@daluo/cli 0.1.3 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BUILD-STAMP +1 -1
- package/dist/run.js +29697 -25913
- package/dist/ui-web/assets/index-BsUQ8UFN.js +66 -0
- package/dist/ui-web/assets/index-bxja70L2.css +1 -0
- package/dist/ui-web/index.html +13 -0
- package/package.json +10 -3
- package/dist/page.css +0 -1828
- package/dist/page.js +0 -7642
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const c of a)if(c.type==="childList")for(const h of c.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&r(h)}).observe(document,{childList:!0,subtree:!0});function s(a){const c={};return a.integrity&&(c.integrity=a.integrity),a.referrerPolicy&&(c.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?c.credentials="include":a.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function r(a){if(a.ep)return;a.ep=!0;const c=s(a);fetch(a.href,c)}})();function yN(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var df={exports:{}},ja={};var g0;function SN(){if(g0)return ja;g0=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function s(r,a,c){var h=null;if(c!==void 0&&(h=""+c),a.key!==void 0&&(h=""+a.key),"key"in a){c={};for(var f in a)f!=="key"&&(c[f]=a[f])}else c=a;return a=c.ref,{$$typeof:e,type:r,key:h,ref:a!==void 0?a:null,props:c}}return ja.Fragment=t,ja.jsx=s,ja.jsxs=s,ja}var _0;function bN(){return _0||(_0=1,df.exports=SN()),df.exports}var u=bN(),ff={exports:{}},Ie={};var v0;function xN(){if(v0)return Ie;v0=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),h=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),_=Symbol.for("react.activity"),S=Symbol.for("react.view_transition"),y=Symbol.iterator;function x(E){return E===null||typeof E!="object"?null:(E=y&&E[y]||E["@@iterator"],typeof E=="function"?E:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,N={};function M(E,ie,ce){this.props=E,this.context=ie,this.refs=N,this.updater=ce||w}M.prototype.isReactComponent={},M.prototype.setState=function(E,ie){if(typeof E!="object"&&typeof E!="function"&&E!=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,E,ie,"setState")},M.prototype.forceUpdate=function(E){this.updater.enqueueForceUpdate(this,E,"forceUpdate")};function T(){}T.prototype=M.prototype;function O(E,ie,ce){this.props=E,this.context=ie,this.refs=N,this.updater=ce||w}var U=O.prototype=new T;U.constructor=O,j(U,M.prototype),U.isPureReactComponent=!0;var z=Array.isArray;function A(){}var Y={H:null,A:null,T:null,S:null},ue=Object.prototype.hasOwnProperty;function P(E,ie,ce){var fe=ce.ref;return{$$typeof:e,type:E,key:ie,ref:fe!==void 0?fe:null,props:ce}}function J(E,ie){return P(E.type,ie,E.props)}function G(E){return typeof E=="object"&&E!==null&&E.$$typeof===e}function L(E){var ie={"=":"=0",":":"=2"};return"$"+E.replace(/[=:]/g,function(ce){return ie[ce]})}var q=/\/+/g;function F(E,ie){return typeof E=="object"&&E!==null&&E.key!=null?L(""+E.key):ie.toString(36)}function V(E){switch(E.status){case"fulfilled":return E.value;case"rejected":throw E.reason;default:switch(typeof E.status=="string"?E.then(A,A):(E.status="pending",E.then(function(ie){E.status==="pending"&&(E.status="fulfilled",E.value=ie)},function(ie){E.status==="pending"&&(E.status="rejected",E.reason=ie)})),E.status){case"fulfilled":return E.value;case"rejected":throw E.reason}}throw E}function Q(E,ie,ce,fe,ve){var Z=typeof E;(Z==="undefined"||Z==="boolean")&&(E=null);var le=!1;if(E===null)le=!0;else switch(Z){case"bigint":case"string":case"number":le=!0;break;case"object":switch(E.$$typeof){case e:case t:le=!0;break;case v:return le=E._init,Q(le(E._payload),ie,ce,fe,ve)}}if(le)return ve=ve(E),le=fe===""?"."+F(E,0):fe,z(ve)?(ce="",le!=null&&(ce=le.replace(q,"$&/")+"/"),Q(ve,ie,ce,"",function(xe){return xe})):ve!=null&&(G(ve)&&(ve=J(ve,ce+(ve.key==null||E&&E.key===ve.key?"":(""+ve.key).replace(q,"$&/")+"/")+le)),ie.push(ve)),1;le=0;var se=fe===""?".":fe+":";if(z(E))for(var me=0;me<E.length;me++)fe=E[me],Z=se+F(fe,me),le+=Q(fe,ie,ce,Z,ve);else if(me=x(E),typeof me=="function")for(E=me.call(E),me=0;!(fe=E.next()).done;)fe=fe.value,Z=se+F(fe,me++),le+=Q(fe,ie,ce,Z,ve);else if(Z==="object"){if(typeof E.then=="function")return Q(V(E),ie,ce,fe,ve);throw ie=String(E),Error("Objects are not valid as a React child (found: "+(ie==="[object Object]"?"object with keys {"+Object.keys(E).join(", ")+"}":ie)+"). If you meant to render a collection of children, use an array instead.")}return le}function K(E,ie,ce){if(E==null)return E;var fe=[],ve=0;return Q(E,fe,"","",function(Z){return ie.call(ce,Z,ve++)}),fe}function ge(E){if(E._status===-1){var ie=E._result,ce=ie();ce.then(function(fe){(E._status===0||E._status===-1)&&(E._status=1,E._result=fe,ce.status===void 0&&(ce.status="fulfilled",ce.value=fe))},function(fe){(E._status===0||E._status===-1)&&(E._status=2,E._result=fe,ce.status===void 0&&(ce.status="rejected",ce.reason=fe))}),E._status===-1&&(E._status=0,E._result=ce)}if(E._status===1)return E._result.default;throw E._result}var D=typeof reportError=="function"?reportError:function(E){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var ie=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof E=="object"&&E!==null&&typeof E.message=="string"?String(E.message):String(E),error:E});if(!window.dispatchEvent(ie))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",E);return}console.error(E)};function Ae(E){var ie=Y.T,ce={};ce.types=ie!==null?ie.types:null,Y.T=ce;try{var fe=E(),ve=Y.S;ve!==null&&ve(ce,fe),typeof fe=="object"&&fe!==null&&typeof fe.then=="function"&&fe.then(A,D)}catch(Z){D(Z)}finally{ie!==null&&ce.types!==null&&(ie.types=ce.types),Y.T=ie}}function Se(E){var ie=Y.T;if(ie!==null){var ce=ie.types;ce===null?ie.types=[E]:ce.indexOf(E)===-1&&ce.push(E)}else Ae(Se.bind(null,E))}var R={map:K,forEach:function(E,ie,ce){K(E,function(){ie.apply(this,arguments)},ce)},count:function(E){var ie=0;return K(E,function(){ie++}),ie},toArray:function(E){return K(E,function(ie){return ie})||[]},only:function(E){if(!G(E))throw Error("React.Children.only expected to receive a single React element child.");return E}};return Ie.Activity=_,Ie.Children=R,Ie.Component=M,Ie.Fragment=s,Ie.Profiler=a,Ie.PureComponent=O,Ie.StrictMode=r,Ie.Suspense=g,Ie.ViewTransition=S,Ie.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Y,Ie.__COMPILER_RUNTIME={__proto__:null,c:function(E){return Y.H.useMemoCache(E)}},Ie.addTransitionType=Se,Ie.cache=function(E){return function(){return E.apply(null,arguments)}},Ie.cacheSignal=function(){return null},Ie.cloneElement=function(E,ie,ce){if(E==null)throw Error("The argument must be a React element, but you passed "+E+".");var fe=j({},E.props),ve=E.key;if(ie!=null)for(Z in ie.key!==void 0&&(ve=""+ie.key),ie)!ue.call(ie,Z)||Z==="key"||Z==="__self"||Z==="__source"||Z==="ref"&&ie.ref===void 0||(fe[Z]=ie[Z]);var Z=arguments.length-2;if(Z===1)fe.children=ce;else if(1<Z){for(var le=Array(Z),se=0;se<Z;se++)le[se]=arguments[se+2];fe.children=le}return P(E.type,ve,fe)},Ie.createContext=function(E){return E={$$typeof:h,_currentValue:E,_currentValue2:E,_threadCount:0,Provider:null,Consumer:null},E.Provider=E,E.Consumer={$$typeof:c,_context:E},E},Ie.createElement=function(E,ie,ce){var fe,ve={},Z=null;if(ie!=null)for(fe in ie.key!==void 0&&(Z=""+ie.key),ie)ue.call(ie,fe)&&fe!=="key"&&fe!=="__self"&&fe!=="__source"&&(ve[fe]=ie[fe]);var le=arguments.length-2;if(le===1)ve.children=ce;else if(1<le){for(var se=Array(le),me=0;me<le;me++)se[me]=arguments[me+2];ve.children=se}if(E&&E.defaultProps)for(fe in le=E.defaultProps,le)ve[fe]===void 0&&(ve[fe]=le[fe]);return P(E,Z,ve)},Ie.createRef=function(){return{current:null}},Ie.forwardRef=function(E){return{$$typeof:f,render:E}},Ie.isValidElement=G,Ie.lazy=function(E){return{$$typeof:v,_payload:{_status:-1,_result:E},_init:ge}},Ie.memo=function(E,ie){return{$$typeof:p,type:E,compare:ie===void 0?null:ie}},Ie.startTransition=Ae,Ie.unstable_useCacheRefresh=function(){return Y.H.useCacheRefresh()},Ie.use=function(E){return Y.H.use(E)},Ie.useActionState=function(E,ie,ce){return Y.H.useActionState(E,ie,ce)},Ie.useCallback=function(E,ie){return Y.H.useCallback(E,ie)},Ie.useContext=function(E){return Y.H.useContext(E)},Ie.useDebugValue=function(){},Ie.useDeferredValue=function(E,ie){return Y.H.useDeferredValue(E,ie)},Ie.useEffect=function(E,ie){return Y.H.useEffect(E,ie)},Ie.useEffectEvent=function(E){return Y.H.useEffectEvent(E)},Ie.useId=function(){return Y.H.useId()},Ie.useImperativeHandle=function(E,ie,ce){return Y.H.useImperativeHandle(E,ie,ce)},Ie.useInsertionEffect=function(E,ie){return Y.H.useInsertionEffect(E,ie)},Ie.useLayoutEffect=function(E,ie){return Y.H.useLayoutEffect(E,ie)},Ie.useMemo=function(E,ie){return Y.H.useMemo(E,ie)},Ie.useOptimistic=function(E,ie){return Y.H.useOptimistic(E,ie)},Ie.useReducer=function(E,ie,ce){return Y.H.useReducer(E,ie,ce)},Ie.useRef=function(E){return Y.H.useRef(E)},Ie.useState=function(E){return Y.H.useState(E)},Ie.useSyncExternalStore=function(E,ie,ce){return Y.H.useSyncExternalStore(E,ie,ce)},Ie.useTransition=function(){return Y.H.useTransition()},Ie.version="19.3.1",Ie}var y0;function cp(){return y0||(y0=1,ff.exports=xN()),ff.exports}var k=cp(),mf={exports:{}},Ta={},pf={exports:{}},gf={};var S0;function wN(){return S0||(S0=1,(function(e){function t(V,Q){var K=V.length;V.push(Q);e:for(;0<K;){var ge=K-1>>>1,D=V[ge];if(0<a(D,Q))V[ge]=Q,V[K]=D,K=ge;else break e}}function s(V){return V.length===0?null:V[0]}function r(V){if(V.length===0)return null;var Q=V[0],K=V.pop();if(K!==Q){V[0]=K;e:for(var ge=0,D=V.length,Ae=D>>>1;ge<Ae;){var Se=2*(ge+1)-1,R=V[Se],E=Se+1,ie=V[E];if(0>a(R,K))E<D&&0>a(ie,R)?(V[ge]=ie,V[E]=K,ge=E):(V[ge]=R,V[Se]=K,ge=Se);else if(E<D&&0>a(ie,K))V[ge]=ie,V[E]=K,ge=E;else break e}}return Q}function a(V,Q){var K=V.sortIndex-Q.sortIndex;return K!==0?K:V.id-Q.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var h=Date,f=h.now();e.unstable_now=function(){return h.now()-f}}var g=[],p=[],v=1,_=null,S=3,y=!1,x=!1,w=!1,j=!1,N=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;function O(V){for(var Q=s(p);Q!==null;){if(Q.callback===null)r(p);else if(Q.startTime<=V)r(p),Q.sortIndex=Q.expirationTime,t(g,Q);else break;Q=s(p)}}function U(V){if(w=!1,O(V),!x)if(s(g)!==null)x=!0,z||(z=!0,G());else{var Q=s(p);Q!==null&&F(U,Q.startTime-V)}}var z=!1,A=-1,Y=5,ue=-1;function P(){return j?!0:!(e.unstable_now()-ue<Y)}function J(){if(j=!1,z){var V=e.unstable_now();ue=V;var Q=!0;try{e:{x=!1,w&&(w=!1,M(A),A=-1),y=!0;var K=S;try{t:{for(O(V),_=s(g);_!==null&&!(_.expirationTime>V&&P());){var ge=_.callback;if(typeof ge=="function"){_.callback=null,S=_.priorityLevel;var D=ge(_.expirationTime<=V);if(V=e.unstable_now(),typeof D=="function"){_.callback=D,O(V),Q=!0;break t}_===s(g)&&r(g),O(V)}else r(g);_=s(g)}if(_!==null)Q=!0;else{var Ae=s(p);Ae!==null&&F(U,Ae.startTime-V),Q=!1}}break e}finally{_=null,S=K,y=!1}Q=void 0}}finally{Q?G():z=!1}}}var G;if(typeof T=="function")G=function(){T(J)};else if(typeof MessageChannel<"u"){var L=new MessageChannel,q=L.port2;L.port1.onmessage=J,G=function(){q.postMessage(null)}}else G=function(){N(J,0)};function F(V,Q){A=N(function(){V(e.unstable_now())},Q)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(V){V.callback=null},e.unstable_forceFrameRate=function(V){0>V||125<V?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Y=0<V?Math.floor(1e3/V):5},e.unstable_getCurrentPriorityLevel=function(){return S},e.unstable_next=function(V){switch(S){case 1:case 2:case 3:var Q=3;break;default:Q=S}var K=S;S=Q;try{return V()}finally{S=K}},e.unstable_requestPaint=function(){j=!0},e.unstable_runWithPriority=function(V,Q){switch(V){case 1:case 2:case 3:case 4:case 5:break;default:V=3}var K=S;S=V;try{return Q()}finally{S=K}},e.unstable_scheduleCallback=function(V,Q,K){var ge=e.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?ge+K:ge):K=ge,V){case 1:var D=-1;break;case 2:D=250;break;case 5:D=1073741823;break;case 4:D=1e4;break;default:D=5e3}return D=K+D,V={id:v++,callback:Q,priorityLevel:V,startTime:K,expirationTime:D,sortIndex:-1},K>ge?(V.sortIndex=K,t(p,V),s(g)===null&&V===s(p)&&(w?(M(A),A=-1):w=!0,F(U,K-ge))):(V.sortIndex=D,t(g,V),x||y||(x=!0,z||(z=!0,G()))),V},e.unstable_shouldYield=P,e.unstable_wrapCallback=function(V){var Q=S;return function(){var K=S;S=Q;try{return V.apply(this,arguments)}finally{S=K}}}})(gf)),gf}var b0;function CN(){return b0||(b0=1,pf.exports=wN()),pf.exports}var _f={exports:{}},hn={};var x0;function kN(){if(x0)return hn;x0=1;var e=cp();function t(v){var _="https://react.dev/errors/"+v;if(1<arguments.length){_+="?args[]="+encodeURIComponent(arguments[1]);for(var S=2;S<arguments.length;S++)_+="&args[]="+encodeURIComponent(arguments[S])}return"Minified React error #"+v+"; visit "+_+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(){}var r={d:{f:s,r:function(){throw Error(t(522))},D:s,C:s,L:s,m:s,X:s,S:s,M:s},p:0,findDOMNode:null},a=Symbol.for("react.portal"),c=Symbol.for("react.recoverable"),h=Symbol.for("react.optimistic_key");function f(v,_,S){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:y==null?null:y===h?h:""+y,children:v,containerInfo:_,implementation:S}}var g=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function p(v,_){if(v==="font")return"";if(typeof _=="string")return _==="use-credentials"?_:""}return hn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,hn.browser=function(v){return{$$typeof:c,_reason:v}},hn.createPortal=function(v,_){var S=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!_||_.nodeType!==1&&_.nodeType!==9&&_.nodeType!==11)throw Error(t(299));return f(v,_,null,S)},hn.flushSync=function(v){var _=g.T,S=r.p;try{if(g.T=null,r.p=2,v)return v()}finally{g.T=_,r.p=S,r.d.f()}},hn.preconnect=function(v,_){typeof v=="string"&&(_?(_=_.crossOrigin,_=typeof _=="string"?_==="use-credentials"?_:"":void 0):_=null,r.d.C(v,_))},hn.prefetchDNS=function(v){typeof v=="string"&&r.d.D(v)},hn.preinit=function(v,_){if(typeof v=="string"&&_&&typeof _.as=="string"){var S=_.as,y=p(S,_.crossOrigin),x=typeof _.integrity=="string"?_.integrity:void 0,w=typeof _.fetchPriority=="string"?_.fetchPriority:void 0;S==="style"?r.d.S(v,typeof _.precedence=="string"?_.precedence:void 0,{crossOrigin:y,integrity:x,fetchPriority:w}):S==="script"&&r.d.X(v,{crossOrigin:y,integrity:x,fetchPriority:w,nonce:typeof _.nonce=="string"?_.nonce:void 0})}},hn.preinitModule=function(v,_){if(typeof v=="string")if(typeof _=="object"&&_!==null){if(_.as==null||_.as==="script"){var S=p(_.as,_.crossOrigin);r.d.M(v,{crossOrigin:S,integrity:typeof _.integrity=="string"?_.integrity:void 0,nonce:typeof _.nonce=="string"?_.nonce:void 0,fetchPriority:typeof _.fetchPriority=="string"?_.fetchPriority:void 0})}}else _==null&&r.d.M(v)},hn.preload=function(v,_){if(typeof v=="string"&&typeof _=="object"&&_!==null&&typeof _.as=="string"){var S=_.as,y=p(S,_.crossOrigin);r.d.L(v,S,{crossOrigin:y,integrity:typeof _.integrity=="string"?_.integrity:void 0,nonce:typeof _.nonce=="string"?_.nonce:void 0,type:typeof _.type=="string"?_.type:void 0,fetchPriority:typeof _.fetchPriority=="string"?_.fetchPriority:void 0,referrerPolicy:typeof _.referrerPolicy=="string"?_.referrerPolicy:void 0,imageSrcSet:typeof _.imageSrcSet=="string"?_.imageSrcSet:void 0,imageSizes:typeof _.imageSizes=="string"?_.imageSizes:void 0,media:typeof _.media=="string"?_.media:void 0})}},hn.preloadModule=function(v,_){if(typeof v=="string")if(_){var S=p(_.as,_.crossOrigin);r.d.m(v,{as:typeof _.as=="string"&&_.as!=="script"?_.as:void 0,crossOrigin:S,integrity:typeof _.integrity=="string"?_.integrity:void 0,nonce:typeof _.nonce=="string"?_.nonce:void 0,fetchPriority:typeof _.fetchPriority=="string"?_.fetchPriority:void 0})}else r.d.m(v)},hn.requestFormReset=function(v){r.d.r(v)},hn.unstable_batchedUpdates=function(v,_){return v(_)},hn.useFormState=function(v,_,S){return g.H.useFormState(v,_,S)},hn.useFormStatus=function(){return g.H.useHostTransitionStatus()},hn.version="19.3.1",hn}var w0;function NN(){if(w0)return _f.exports;w0=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(),_f.exports=kN(),_f.exports}var C0;function EN(){if(C0)return Ta;C0=1;var e=CN(),t=cp(),s=NN();function r(n){var i="https://react.dev/errors/"+n;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)i+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+n+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function c(n){for(var i=n,l=i;l&&!l.alternate;)i=l,(i.flags&4098)!==0&&(n=i.return),l=i.return;for(;i.return;)i=i.return;return i.tag===3?n:null}function h(n){if(n.tag===13){var i=n.memoizedState;if(i===null&&(n=n.alternate,n!==null&&(i=n.memoizedState)),i!==null)return i.dehydrated}return null}function f(n){if(n.tag===31){var i=n.memoizedState;if(i===null&&(n=n.alternate,n!==null&&(i=n.memoizedState)),i!==null)return i.dehydrated}return null}function g(n){if(c(n)!==n)throw Error(r(188))}function p(n){var i=n.alternate;if(!i){if(i=c(n),i===null)throw Error(r(188));return i!==n?null:n}for(var l=n,o=i;;){var d=l.return;if(d===null)break;var m=d.alternate;if(m===null){if(o=d.return,o!==null){l=o;continue}break}if(d.child===m.child){for(m=d.child;m;){if(m===l)return g(d),n;if(m===o)return g(d),i;m=m.sibling}throw Error(r(188))}if(l.return!==o.return)l=d,o=m;else{for(var b=!1,C=d.child;C;){if(C===l){b=!0,l=d,o=m;break}if(C===o){b=!0,o=d,l=m;break}C=C.sibling}if(!b){for(C=m.child;C;){if(C===l){b=!0,l=m,o=d;break}if(C===o){b=!0,o=m,l=d;break}C=C.sibling}if(!b)throw Error(r(189))}}if(l.alternate!==o)throw Error(r(190))}if(l.tag!==3)throw Error(r(188));return l.stateNode.current===l?n:i}function v(n){var i=n.tag;if(i===5||i===26||i===27||i===6)return n;for(n=n.child;n!==null;){if(i=v(n),i!==null)return i;n=n.sibling}return null}function _(n,i,l,o,d,m){for(;n!==null;){if((n.tag===5||n.tag===27||n.tag===6)&&l(n,o,d,m)||(n.tag!==22||n.memoizedState===null)&&(i||n.tag!==5&&n.tag!==27)&&_(n.child,i,l,o,d,m))return!0;n=n.sibling}return!1}function S(n){for(n=n.return;n!==null;){if(n.tag===3||n.tag===5||n.tag===27)return n;n=n.return}return null}function y(n){var i=!1;for(n=n.return;n!==null&&(n.tag===4&&(i=!0),!(n.tag===3||n.tag===5||n.tag===27));)n=n.return;return i}function x(n){var i=[null,null],l=S(n);return l===null||w(i,n,l.child,{foundSelf:!1}),i}function w(n,i,l,o){for(;l!==null;){if(l===i)o.foundSelf=!0;else if(l.tag===5||l.tag===27||l.tag===6){if(o.foundSelf)return n[1]=l,!0;n[0]=l}else if((l.tag!==22||l.memoizedState===null)&&w(n,i,l.child,o))return!0;l=l.sibling}return!1}function j(n){switch(n.tag){case 5:case 27:case 6:return n.stateNode;case 3:return n.stateNode.containerInfo;default:throw Error(r(559))}}var N=null,M=null;function T(n,i,l){return n===l?!0:n===i?(N=n,!0):!1}function O(n,i,l){return n===l?(M=n,!1):n===i?(M!==null&&(N=n),!0):!1}function U(n){if(n===null)return null;do n=n===null?null:n.return;while(n&&n.tag!==5&&n.tag!==27&&n.tag!==3);return n||null}function z(n,i,l){for(var o=0,d=n;d;d=l(d))o++;d=0;for(var m=i;m;m=l(m))d++;for(;0<o-d;)n=l(n),o--;for(;0<d-o;)i=l(i),d--;for(;o--;){if(n===i||i!==null&&n===i.alternate)return n;n=l(n),i=l(i)}return null}var A=Object.assign,Y=Symbol.for("react.element"),ue=Symbol.for("react.transitional.element"),P=Symbol.for("react.portal"),J=Symbol.for("react.fragment"),G=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),q=Symbol.for("react.consumer"),F=Symbol.for("react.context"),V=Symbol.for("react.forward_ref"),Q=Symbol.for("react.suspense"),K=Symbol.for("react.suspense_list"),ge=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),Ae=Symbol.for("react.activity"),Se=Symbol.for("react.legacy_hidden"),R=Symbol.for("react.memo_cache_sentinel"),E=Symbol.for("react.view_transition"),ie=Symbol.for("react.recoverable"),ce=Symbol.iterator;function fe(n){return n===null||typeof n!="object"?null:(n=ce&&n[ce]||n["@@iterator"],typeof n=="function"?n:null)}var ve=Symbol.for("react.client.reference");function Z(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===ve?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case J:return"Fragment";case L:return"Profiler";case G:return"StrictMode";case Q:return"Suspense";case K:return"SuspenseList";case Ae:return"Activity";case E:return"ViewTransition"}if(typeof n=="object")switch(n.$$typeof){case P:return"Portal";case F:return n.displayName||"Context";case q:return(n._context.displayName||"Context")+".Consumer";case V:var i=n.render;return n=n.displayName,n||(n=i.displayName||i.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case ge:return i=n.displayName||null,i!==null?i:Z(n.type)||"Memo";case D:i=n._payload,n=n._init;try{return Z(n(i))}catch{}}return null}var le=Array.isArray,se=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,me=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,xe={pending:!1,data:null,method:null,action:null},Fe=[],Xe=-1;function Ge(n){return{current:n}}function nt(n){0>Xe||(n.current=Fe[Xe],Fe[Xe]=null,Xe--)}function $e(n,i){Xe++,Fe[Xe]=n.current,n.current=i}var Ot=Ge(null),kt=Ge(null),ke=Ge(null),Oe=Ge(null);function oe(n,i){switch($e(ke,i),$e(kt,n),$e(Ot,null),i.nodeType){case 9:case 11:n=(n=i.documentElement)&&(n=n.namespaceURI)?ky(n):0;break;default:if(n=i.tagName,i=i.namespaceURI)i=ky(i),n=Ny(i,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}nt(Ot),$e(Ot,n)}function Ne(){nt(Ot),nt(kt),nt(ke)}function Le(n){var i=n.memoizedState;i!==null&&(gl._currentValue=i.memoizedState,$e(Oe,n)),i=Ot.current;var l=Ny(i,n.type);i!==l&&($e(kt,n),$e(Ot,l))}function Qe(n){kt.current===n&&(nt(Ot),nt(kt)),Oe.current===n&&(nt(Oe),gl._currentValue=xe)}var ae,_e;function re(n){if(ae===void 0)try{throw Error()}catch(l){var i=l.stack.trim().match(/\n( *(at )?)/);ae=i&&i[1]||"",_e=-1<l.stack.indexOf(`
|
|
2
|
+
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
+
`+ae+n+_e}var H=!1;function we(n,i){if(!n||H)return"";H=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(i){var de=function(){throw Error()};if(Object.defineProperty(de.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(de,[])}catch(Ce){var $=Ce}Reflect.construct(n,[],de)}else{try{de.call()}catch(Ce){$=Ce}de=!1;try{var te=Object.getOwnPropertyDescriptor(n.prototype,"props");Object.defineProperty(n.prototype,"props",{configurable:!0,set:function(){throw Error()}}),de=!0,new n}finally{de&&(te!==void 0?Object.defineProperty(n.prototype,"props",te):delete n.prototype.props)}}}else{try{throw Error()}catch(Ce){$=Ce}(de=n())&&typeof de.catch=="function"&&de.catch(function(){})}}catch(Ce){if(Ce&&$&&typeof Ce.stack=="string")return[Ce.stack,$.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var d=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");d&&d.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var m=o.DetermineComponentFrameRoot(),b=m[0],C=m[1];if(b&&C){var B=b.split(`
|
|
4
|
+
`),X=C.split(`
|
|
5
|
+
`);for(d=o=0;o<B.length&&!B[o].includes("DetermineComponentFrameRoot");)o++;for(;d<X.length&&!X[d].includes("DetermineComponentFrameRoot");)d++;if(o===B.length||d===X.length)for(o=B.length-1,d=X.length-1;1<=o&&0<=d&&B[o]!==X[d];)d--;for(;1<=o&&0<=d;o--,d--)if(B[o]!==X[d]){if(o!==1||d!==1)do if(o--,d--,0>d||B[o]!==X[d]){var ne=`
|
|
6
|
+
`+B[o].replace(" at new "," at ");return n.displayName&&ne.includes("<anonymous>")&&(ne=ne.replace("<anonymous>",n.displayName)),ne}while(1<=o&&0<=d);break}}}finally{H=!1,Error.prepareStackTrace=l}return(l=n?n.displayName||n.name:"")?re(l):""}function je(n,i){switch(n.tag){case 26:case 27:case 5:return re(n.type);case 16:return re("Lazy");case 13:return n.child!==i&&i!==null?re("Suspense Fallback"):re("Suspense");case 19:return re("SuspenseList");case 0:case 15:return we(n.type,!1);case 11:return we(n.type.render,!1);case 1:return we(n.type,!0);case 31:return re("Activity");case 30:return re("ViewTransition");default:return""}}function ot(n){try{var i="",l=null;do i+=je(n,l),l=n,n=n.return;while(n);return i}catch(o){return`
|
|
7
|
+
Error generating stack: `+o.message+`
|
|
8
|
+
`+o.stack}}var gt=Object.prototype.hasOwnProperty,rt=e.unstable_scheduleCallback,Ii=e.unstable_cancelCallback,Vs=e.unstable_shouldYield,ho=e.unstable_requestPaint,sn=e.unstable_now,vn=e.unstable_getCurrentPriorityLevel,Ui=e.unstable_ImmediatePriority,Xn=e.unstable_UserBlockingPriority,fo=e.unstable_NormalPriority,Ew=e.unstable_LowPriority,Gp=e.unstable_IdlePriority,jw=e.log,Tw=e.unstable_setDisableYieldValue,Bl=null,Bn=null;function os(n){if(typeof jw=="function"&&Tw(n),Bn&&typeof Bn.setStrictMode=="function")try{Bn.setStrictMode(Bl,n)}catch{}}var Ln=Math.clz32?Math.clz32:Aw,Dw=Math.log,Mw=Math.LN2;function Aw(n){return n>>>=0,n===0?32:31-(Dw(n)/Mw|0)|0}var mo=256,po=262144,go=4194304;function Ys(n){var i=n&42;if(i!==0)return i;switch(n&-n){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 n&-n;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function _o(n,i,l){var o=n.pendingLanes;if(o===0)return 0;var d=0,m=n.suspendedLanes,b=n.pingedLanes;n=n.warmLanes;var C=o&134217727;return C!==0?(o=C&~m,o!==0?d=Ys(o):(b&=C,b!==0?d=Ys(b):l||(l=C&~n,l!==0&&(d=Ys(l))))):(C=o&~m,C!==0?d=Ys(C):b!==0?d=Ys(b):l||(l=o&~n,l!==0&&(d=Ys(l)))),d===0?0:i!==0&&i!==d&&(i&m)===0&&(m=d&-d,l=i&-i,m>=l||m===32&&(l&4194048)!==0)?i:d}function Ll(n,i){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&i)===0}function Qp(n,i){(i&8)!==0&&(i|=i&32);var l=n.entangledLanes;if(l!==0)for(n=n.entanglements,l&=i;0<l;){var o=31-Ln(l),d=1<<o;i|=n[o],l&=~d}return i}function Rw(n,i){switch(n){case 1:case 2:case 4:case 8:case 64:return i+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 i+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 Zp(){var n=go;return go<<=1,(go&62914560)===0&&(go=4194304),n}function Hu(n){for(var i=[],l=0;31>l;l++)i.push(n);return i}function zl(n,i){n.pendingLanes|=i,i!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function Ow(n,i,l,o,d,m){var b=n.pendingLanes;n.pendingLanes=l,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=l,n.entangledLanes&=l,n.errorRecoveryDisabledLanes&=l,n.shellSuspendCounter=0;var C=n.entanglements,B=n.expirationTimes,X=n.hiddenUpdates;for(l=b&~l;0<l;){var ne=31-Ln(l),de=1<<ne;C[ne]=0,B[ne]=-1;var $=X[ne];if($!==null)for(X[ne]=null,ne=0;ne<$.length;ne++){var te=$[ne];te!==null&&(te.lane&=-536870913)}l&=~de}o!==0&&Jp(n,o,0),m!==0&&d===0&&n.tag!==0&&(n.suspendedLanes|=m&~(b&~i))}function Jp(n,i,l){n.pendingLanes|=i,n.suspendedLanes&=~i;var o=31-Ln(i);n.entangledLanes|=i,n.entanglements[o]=n.entanglements[o]|1073741824|l&261930}function eg(n,i){var l=n.entangledLanes|=i;for(n=n.entanglements;l;){var o=31-Ln(l),d=1<<o;d&i|n[o]&i&&(n[o]|=i),l&=~d}}function tg(n,i){var l=i&-i;return l=(l&42)!==0?1:Iu(l),(l&(n.suspendedLanes|i))!==0?0:l}function Iu(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=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:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function Uu(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function ng(){var n=me.p;return n!==0?n:(n=window.event,n===void 0?32:c0(n.type))}function ig(n,i){var l=me.p;try{return me.p=n,i()}finally{me.p=l}}var Pi=Math.random().toString(36).slice(2),rn="__reactFiber$"+Pi,Nn="__reactProps$"+Pi,Dr="__reactContainer$"+Pi,sg="__reactEvents$"+Pi,Bw="__reactListeners$"+Pi,Lw="__reactHandles$"+Pi,rg="__reactResources$"+Pi,Hl="__reactMarker$"+Pi,vo="__reactLoad$"+Pi;function yo(n){delete n[rn],delete n[Nn],delete n[Bw],delete n[Lw]}function Ks(n){var i;if(i=n[rn])return i;for(var l=n.parentNode;l;){if(i=l[Dr]||l[rn]){if(l=i.alternate,i.child!==null||l!==null&&l.child!==null)for(n=Fy(n);n!==null;){if(l=n[rn])return l;n=Fy(n)}return i}n=l,l=n.parentNode}return null}function Mr(n){if(n=n[rn]||n[Dr]){var i=n.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return n}return null}function Il(n){var i=n.tag;if(i===5||i===26||i===27||i===6)return n.stateNode;throw Error(r(33))}function Ar(n){var i=n[rg];return i||(i=n[rg]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function Wt(n){n[Hl]=!0}function lg(n){n[vo]=void 0}var ag=new Set,og={};function Ws(n,i){Rr(n,i),Rr(n+"Capture",i)}function Rr(n,i){for(og[n]=i,n=0;n<i.length;n++)ag.add(i[n])}var zw=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]*$"),cg={},ug={};function Hw(n){return gt.call(ug,n)?!0:gt.call(cg,n)?!1:zw.test(n)?ug[n]=!0:(cg[n]=!0,!1)}var lt=!1;function hg(){var n=lt;return lt=!1,n}function So(n,i,l){if(Hw(i))if(l===null)n.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":n.removeAttribute(i);return;case"boolean":var o=i.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){n.removeAttribute(i);return}}n.setAttribute(i,l)}}function bo(n,i,l){if(l===null)n.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(i);return}n.setAttribute(i,l)}}function qi(n,i,l,o){if(o===null)n.removeAttribute(l);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(l);return}n.setAttributeNS(i,l,o)}}function zn(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function dg(n){var i=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function Iw(n,i,l){var o=Object.getOwnPropertyDescriptor(n.constructor.prototype,i);if(!n.hasOwnProperty(i)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var d=o.get,m=o.set;return Object.defineProperty(n,i,{configurable:!0,get:function(){return d.call(this)},set:function(b){l=""+b,m.call(this,b)}}),Object.defineProperty(n,i,{enumerable:o.enumerable}),{getValue:function(){return l},setValue:function(b){l=""+b},stopTracking:function(){n._valueTracker=null,delete n[i]}}}}function Pu(n){if(!n._valueTracker){var i=dg(n)?"checked":"value";n._valueTracker=Iw(n,i,""+n[i])}}function fg(n){if(!n)return!1;var i=n._valueTracker;if(!i)return!0;var l=i.getValue(),o="";return n&&(o=dg(n)?n.checked?"true":"false":n.value),n=o,n!==l?(i.setValue(n),!0):!1}var Uw=/[\n"\\]/g;function Gn(n){return n.replace(Uw,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function qu(n,i,l,o,d,m,b,C){n.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?n.type=b:n.removeAttribute("type"),i!=null?b==="number"?(i===0&&n.value===""||n.value!=i)&&(n.value=""+zn(i)):n.value!==""+zn(i)&&(n.value=""+zn(i)):b!=="submit"&&b!=="reset"||n.removeAttribute("value"),i!=null?b==="number"&&n.value==i?Fu(n,zn(n.value)):Fu(n,zn(i)):l!=null?Fu(n,zn(l)):o!=null&&n.removeAttribute("value"),d==null&&m!=null&&(n.defaultChecked=!!m),d!=null&&(n.checked=d&&typeof d!="function"&&typeof d!="symbol"),C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?n.name=""+zn(C):n.removeAttribute("name")}function mg(n,i,l,o,d,m,b,C){if(m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(n.type=m),i!=null||l!=null){if(!(m!=="submit"&&m!=="reset"||i!=null)){Pu(n);return}l=l!=null?""+zn(l):"",i=i!=null?""+zn(i):l,C||i===n.value||(n.value=i),n.defaultValue=i}o=o??d,o=typeof o!="function"&&typeof o!="symbol"&&!!o,n.checked=C?n.checked:!!o,n.defaultChecked=!!o,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(n.name=b),Pu(n)}function Fu(n,i){n.defaultValue!==""+i&&(n.defaultValue=""+i)}function Or(n,i,l,o){if(n=n.options,i){i={};for(var d=0;d<l.length;d++)i["$"+l[d]]=!0;for(l=0;l<n.length;l++)d=i.hasOwnProperty("$"+n[l].value),n[l].selected!==d&&(n[l].selected=d),d&&o&&(n[l].defaultSelected=!0)}else{for(l=""+zn(l),i=null,d=0;d<n.length;d++){if(n[d].value===l){n[d].selected=!0,o&&(n[d].defaultSelected=!0);return}i!==null||n[d].disabled||(i=n[d])}i!==null&&(i.selected=!0)}}function pg(n,i,l){if(i!=null&&(i=""+zn(i),i!==n.value&&(n.value=i),l==null)){n.defaultValue!==i&&(n.defaultValue=i);return}n.defaultValue=l!=null?""+zn(l):""}function gg(n,i,l,o){if(i==null){if(o!=null){if(l!=null)throw Error(r(92));if(le(o)){if(1<o.length)throw Error(r(93));o=o[0]}l=o}l==null&&(l=""),i=l}l=zn(i),n.defaultValue=l,o=n.textContent,o===l&&o!==""&&o!==null&&(n.value=o),Pu(n)}function Br(n,i){if(i){var l=n.firstChild;if(l&&l===n.lastChild&&l.nodeType===3){l.nodeValue=i;return}}n.textContent=i}var Pw=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 _g(n,i,l){var o=i.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?o?n.setProperty(i,""):i==="float"?n.cssFloat="":n[i]="":o?n.setProperty(i,l):typeof l!="number"||l===0||Pw.has(i)?i==="float"?n.cssFloat=l:n[i]=(""+l).trim():n[i]=l+"px"}function vg(n,i,l){if(i!=null&&typeof i!="object")throw Error(r(62));if(n=n.style,l!=null){for(var o in l)!l.hasOwnProperty(o)||i!=null&&i.hasOwnProperty(o)||(o.indexOf("--")===0?n.setProperty(o,""):o==="float"?n.cssFloat="":n[o]="",lt=!0);for(var d in i)o=i[d],i.hasOwnProperty(d)&&l[d]!==o&&(_g(n,d,o),lt=!0)}else for(var m in i)i.hasOwnProperty(m)&&_g(n,m,i[m])}function $u(n){if(n.indexOf("-")===-1)return!1;switch(n){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 qw=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"],["maskType","mask-type"],["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"]]),Fw=/^[\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 xo(n){return Fw.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function vi(){}var Vu=null;function Yu(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Lr=null,zr=null;function yg(n){var i=Mr(n);if(i&&(n=i.stateNode)){var l=n[Nn]||null;e:switch(n=i.stateNode,i.type){case"input":if(qu(n,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),i=l.name,l.type==="radio"&&i!=null){for(l=n;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+Gn(""+i)+'"][type="radio"]'),i=0;i<l.length;i++){var o=l[i];if(o!==n&&o.form===n.form){var d=o[Nn]||null;if(!d)throw Error(r(90));qu(o,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name)}}for(i=0;i<l.length;i++)o=l[i],o.form===n.form&&fg(o)}break e;case"textarea":pg(n,l.value,l.defaultValue);break e;case"select":i=l.value,i!=null&&Or(n,!!l.multiple,i,!1)}}}var Ku=!1;function Sg(n,i,l){if(Ku)return n(i,l);Ku=!0;try{var o=n(i);return o}finally{if(Ku=!1,(Lr!==null||zr!==null)&&(xc(),Lr&&(i=Lr,n=zr,zr=Lr=null,yg(i),n)))for(i=0;i<n.length;i++)yg(n[i])}}function Ul(n,i){var l=n.stateNode;if(l===null)return null;var o=l[Nn]||null;if(o===null)return null;l=o[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(o=!o.disabled)||(n=n.type,o=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!o;break e;default:n=!1}if(n)return null;if(l&&typeof l!="function")throw Error(r(231,i,typeof l));return l}var Fi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Wu=!1;if(Fi)try{var Pl={};Object.defineProperty(Pl,"passive",{get:function(){Wu=!0}}),window.addEventListener("test",Pl,Pl),window.removeEventListener("test",Pl,Pl)}catch{Wu=!1}var cs=null,Xu=null,wo=null;function bg(){if(wo)return wo;var n,i=Xu,l=i.length,o,d="value"in cs?cs.value:cs.textContent,m=d.length;for(n=0;n<l&&i[n]===d[n];n++);var b=l-n;for(o=1;o<=b&&i[l-o]===d[m-o];o++);return wo=d.slice(n,1<o?1-o:void 0)}function Co(n){var i=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&i===13&&(n=13)):n=i,n===10&&(n=13),32<=n||n===13?n:0}function ko(){return!0}function xg(){return!1}function yn(n){function i(l,o,d,m,b){this._reactName=l,this._targetInst=d,this.type=o,this.nativeEvent=m,this.target=b,this.currentTarget=null;for(var C in n)n.hasOwnProperty(C)&&(l=n[C],this[C]=l?l(m):m[C]);return this.isDefaultPrevented=(m.defaultPrevented!=null?m.defaultPrevented:m.returnValue===!1)?ko:xg,this.isPropagationStopped=xg,this}return A(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=ko)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=ko)},persist:function(){},isPersistent:ko}),i}var us={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},No=yn(us),ql=A({},us,{view:0,detail:0}),$w=yn(ql),Gu,Qu,Fl,Eo=A({},ql,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ju,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==Fl&&(Fl&&n.type==="mousemove"?(Gu=n.screenX-Fl.screenX,Qu=n.screenY-Fl.screenY):Qu=Gu=0,Fl=n),Gu)},movementY:function(n){return"movementY"in n?n.movementY:Qu}}),wg=yn(Eo),Vw=A({},Eo,{dataTransfer:0}),Yw=yn(Vw),Kw=A({},ql,{relatedTarget:0}),Zu=yn(Kw),Ww=A({},us,{animationName:0,elapsedTime:0,pseudoElement:0}),Xw=yn(Ww),Gw=A({},us,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),Qw=yn(Gw),Zw=A({},us,{data:0}),Cg=yn(Zw),Jw={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},eC={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"},tC={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function nC(n){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(n):(n=tC[n])?!!i[n]:!1}function Ju(){return nC}var iC=A({},ql,{key:function(n){if(n.key){var i=Jw[n.key]||n.key;if(i!=="Unidentified")return i}return n.type==="keypress"?(n=Co(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?eC[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ju,charCode:function(n){return n.type==="keypress"?Co(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?Co(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),sC=yn(iC),rC=A({},Eo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),kg=yn(rC),lC=A({},us,{submitter:0}),aC=yn(lC),oC=A({},ql,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ju}),cC=yn(oC),uC=A({},us,{propertyName:0,elapsedTime:0,pseudoElement:0}),hC=yn(uC),dC=A({},Eo,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),fC=yn(dC),mC=A({},us,{newState:0,oldState:0,source:0}),pC=yn(mC),gC=[9,13,27,32],eh=Fi&&"CompositionEvent"in window,$l=null;Fi&&"documentMode"in document&&($l=document.documentMode);var _C=Fi&&"TextEvent"in window&&!$l,Ng=Fi&&(!eh||$l&&8<$l&&11>=$l),Eg=" ",jg=!1;function Tg(n,i){switch(n){case"keyup":return gC.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Dg(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Hr=!1;function vC(n,i){switch(n){case"compositionend":return Dg(i);case"keypress":return i.which!==32?null:(jg=!0,Eg);case"textInput":return n=i.data,n===Eg&&jg?null:n;default:return null}}function yC(n,i){if(Hr)return n==="compositionend"||!eh&&Tg(n,i)?(n=bg(),wo=Xu=cs=null,Hr=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return Ng&&i.locale!=="ko"?null:i.data;default:return null}}var SC={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 Mg(n){var i=n&&n.nodeName&&n.nodeName.toLowerCase();return i==="input"?!!SC[n.type]:i==="textarea"}function Ag(n,i,l,o){Lr?zr?zr.push(o):zr=[o]:Lr=o,i=jc(i,"onChange"),0<i.length&&(l=new No("onChange","change",null,l,o),n.push({event:l,listeners:i}))}var Vl=null,Yl=null;function bC(n){yy(n,0)}function jo(n){var i=Il(n);if(fg(i))return n}function Rg(n,i){if(n==="change")return i}var Og=!1;if(Fi){var th;if(Fi){var nh="oninput"in document;if(!nh){var Bg=document.createElement("div");Bg.setAttribute("oninput","return;"),nh=typeof Bg.oninput=="function"}th=nh}else th=!1;Og=th&&(!document.documentMode||9<document.documentMode)}function Lg(){Vl&&(Vl.detachEvent("onpropertychange",zg),Yl=Vl=null)}function zg(n){if(n.propertyName==="value"&&jo(Yl)){var i=[];Ag(i,Yl,n,Yu(n)),Sg(bC,i)}}function xC(n,i,l){n==="focusin"?(Lg(),Vl=i,Yl=l,Vl.attachEvent("onpropertychange",zg)):n==="focusout"&&Lg()}function wC(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return jo(Yl)}function CC(n,i){if(n==="click")return jo(i)}function kC(n,i){if(n==="input"||n==="change")return jo(i)}function NC(n,i){return n===i&&(n!==0||1/n===1/i)||n!==n&&i!==i}var Hn=typeof Object.is=="function"?Object.is:NC;function Kl(n,i){if(Hn(n,i))return!0;if(typeof n!="object"||n===null||typeof i!="object"||i===null)return!1;var l=Object.keys(n),o=Object.keys(i);if(l.length!==o.length)return!1;for(o=0;o<l.length;o++){var d=l[o];if(!gt.call(i,d)||!Hn(n[d],i[d]))return!1}return!0}function ih(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function Hg(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Ig(n,i){var l=Hg(n);n=0;for(var o;l;){if(l.nodeType===3){if(o=n+l.textContent.length,n<=i&&o>=i)return{node:l,offset:i-n};n=o}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=Hg(l)}}function Ug(n,i){return n&&i?n===i?!0:n&&n.nodeType===3?!1:i&&i.nodeType===3?Ug(n,i.parentNode):"contains"in n?n.contains(i):n.compareDocumentPosition?!!(n.compareDocumentPosition(i)&16):!1:!1}function Pg(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var i=ih(n.document);i instanceof n.HTMLIFrameElement;){try{var l=typeof i.contentWindow.location.href=="string"}catch{l=!1}if(l)n=i.contentWindow;else break;i=ih(n.document)}return i}function sh(n){var i=n&&n.nodeName&&n.nodeName.toLowerCase();return i&&(i==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||i==="textarea"||n.contentEditable==="true")}var EC=Fi&&"documentMode"in document&&11>=document.documentMode,Ir=null,rh=null,Wl=null,lh=!1;function qg(n,i,l){var o=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;lh||Ir==null||Ir!==ih(o)||(o=Ir,"selectionStart"in o&&sh(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),Wl&&Kl(Wl,o)||(Wl=o,o=jc(rh,"onSelect"),0<o.length&&(i=new No("onSelect","select",null,i,l),n.push({event:i,listeners:o}),i.target=Ir)))}function Xs(n,i){var l={};return l[n.toLowerCase()]=i.toLowerCase(),l["Webkit"+n]="webkit"+i,l["Moz"+n]="moz"+i,l}var Ur={animationend:Xs("Animation","AnimationEnd"),animationiteration:Xs("Animation","AnimationIteration"),animationstart:Xs("Animation","AnimationStart"),transitionrun:Xs("Transition","TransitionRun"),transitionstart:Xs("Transition","TransitionStart"),transitioncancel:Xs("Transition","TransitionCancel"),transitionend:Xs("Transition","TransitionEnd")},ah={},Fg={};Fi&&(Fg=document.createElement("div").style,"AnimationEvent"in window||(delete Ur.animationend.animation,delete Ur.animationiteration.animation,delete Ur.animationstart.animation),"TransitionEvent"in window||delete Ur.transitionend.transition);function Gs(n){if(ah[n])return ah[n];if(!Ur[n])return n;var i=Ur[n],l;for(l in i)if(i.hasOwnProperty(l)&&l in Fg)return ah[n]=i[l];return n}var $g=Gs("animationend"),Vg=Gs("animationiteration"),Yg=Gs("animationstart"),jC=Gs("transitionrun"),TC=Gs("transitionstart"),DC=Gs("transitioncancel"),Kg=Gs("transitionend"),Wg=new Map,oh="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError 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(" ");oh.push("scrollEnd");function ui(n,i){Wg.set(n,i),Ws(i,[n])}var MC=0;function $i(n,i){if(n.name!=null&&n.name!=="auto")return n.name;if(i.autoName!==null)return i.autoName;n=mi.identifierPrefix;var l=MC++;return n="_"+n+"t_"+l.toString(32)+"_",i.autoName=n}function Xg(n){if(n==null||typeof n=="string")return n;var i=null,l=ll;if(l!==null)for(var o=0;o<l.length;o++){var d=n[l[o]];if(d!=null){if(d==="none")return"none";i=i==null?d:i+(" "+d)}}return i??n.default}function Vi(n,i){return n=Xg(n),i=Xg(i),i==null?n==="auto"?null:n:i==="auto"?null:i}var To=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},Qn=[],Pr=0,ch=0;function Do(){for(var n=Pr,i=ch=Pr=0;i<n;){var l=Qn[i];Qn[i++]=null;var o=Qn[i];Qn[i++]=null;var d=Qn[i];Qn[i++]=null;var m=Qn[i];if(Qn[i++]=null,o!==null&&d!==null){var b=o.pending;b===null?d.next=d:(d.next=b.next,b.next=d),o.pending=d}m!==0&&Gg(l,d,m)}}function Mo(n,i,l,o){Qn[Pr++]=n,Qn[Pr++]=i,Qn[Pr++]=l,Qn[Pr++]=o,ch|=o,n.lanes|=o,n=n.alternate,n!==null&&(n.lanes|=o)}function uh(n,i,l,o){return Mo(n,i,l,o),Ao(n)}function Qs(n,i){return Mo(n,null,null,i),Ao(n)}function Gg(n,i,l){n.lanes|=l;var o=n.alternate;o!==null&&(o.lanes|=l);for(var d=!1,m=n.return;m!==null;)m.childLanes|=l,o=m.alternate,o!==null&&(o.childLanes|=l),m.tag===22&&(n=m.stateNode,n===null||n._visibility&1||(d=!0)),n=m,m=m.return;return n.tag===3?(m=n.stateNode,d&&i!==null&&(d=31-Ln(l),n=m.hiddenUpdates,o=n[d],o===null?n[d]=[i]:o.push(i),i.lane=l|536870912),m):null}function Ao(n){if(50<ga)throw ga=0,bc=null,Error(r(185));for(var i=n.return;i!==null;)n=i,i=n.return;return n.tag===3?n.stateNode:null}var qr={};function AC(n,i,l,o){this.tag=n,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function En(n,i,l,o){return new AC(n,i,l,o)}function hh(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Yi(n,i){var l=n.alternate;return l===null?(l=En(n.tag,i,n.key,n.mode),l.elementType=n.elementType,l.type=n.type,l.stateNode=n.stateNode,l.alternate=n,n.alternate=l):(l.pendingProps=i,l.type=n.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=n.flags&1206910976,l.childLanes=n.childLanes,l.lanes=n.lanes,l.child=n.child,l.memoizedProps=n.memoizedProps,l.memoizedState=n.memoizedState,l.updateQueue=n.updateQueue,i=n.dependencies,l.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},l.sibling=n.sibling,l.index=n.index,l.ref=n.ref,l.refCleanup=n.refCleanup,l}function Qg(n,i){n.flags&=1206910978;var l=n.alternate;return l===null?(n.childLanes=0,n.lanes=i,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=l.childLanes,n.lanes=l.lanes,n.child=l.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=l.memoizedProps,n.memoizedState=l.memoizedState,n.updateQueue=l.updateQueue,n.type=l.type,i=l.dependencies,n.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),n}function Ro(n,i,l,o,d,m){var b=0;if(o=n,typeof o=="function")hh(o)&&(b=1);else if(typeof o=="string")b=lN(n,l,Ot.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(o){case Ae:return n=En(31,l,i,d),n.elementType=Ae,n.lanes=m,n;case J:return Zs(l.children,d,m,i);case G:b=8,d|=24;break;case L:return n=En(12,l,i,d|2),n.elementType=L,n.lanes=m,n;case Q:return n=En(13,l,i,d),n.elementType=Q,n.lanes=m,n;case K:return n=En(19,l,i,d),n.elementType=K,n.lanes=m,n;case Se:case E:return n=d|32,n=En(30,l,i,n),n.elementType=E,n.lanes=m,n.stateNode={autoName:null,paired:null,clones:null,ref:null},n;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case F:b=10;break e;case q:b=9;break e;case V:b=11;break e;case ge:b=14;break e;case D:b=16,o=null;break e}b=29,l=Error(r(130,n===null?"null":typeof n,"")),o=null}return i=En(b,l,i,d),i.elementType=n,i.type=o,i.lanes=m,i}function Zs(n,i,l,o){return n=En(7,n,o,i),n.lanes=l,n}function dh(n,i,l){return n=En(6,n,null,i),n.lanes=l,n}function Zg(n){var i=En(18,null,null,0);return i.stateNode=n,i}function fh(n,i,l){return i=En(4,n.children!==null?n.children:[],n.key,i),i.lanes=l,i.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},i}var Jg=new WeakMap;function Zn(n,i){if(typeof n=="object"&&n!==null){var l=Jg.get(n);return l!==void 0?l:(i={value:n,source:i,stack:ot(i)},Jg.set(n,i),i)}return{value:n,source:i,stack:ot(i)}}var Fr=[],$r=0,Oo=null,Xl=0,Jn=[],ei=0,hs=null,yi=1,Si="";function Ki(n,i){Fr[$r++]=Xl,Fr[$r++]=Oo,Oo=n,Xl=i}function e_(n,i,l){Jn[ei++]=yi,Jn[ei++]=Si,Jn[ei++]=hs,hs=n;var o=yi;n=Si;var d=32-Ln(o)-1;o&=~(1<<d),l+=1;var m=32-Ln(i)+d;if(30<m){var b=d-d%5;m=(o&(1<<b)-1).toString(32),o>>=b,d-=b,yi=1<<32-Ln(i)+d|l<<d|o,Si=m+n}else yi=1<<m|l<<d|o,Si=n}function Bo(n){n.return!==null&&(Ki(n,1),e_(n,1,0))}function mh(n){for(;n===Oo;)Oo=Fr[--$r],Fr[$r]=null,Xl=Fr[--$r],Fr[$r]=null;for(;n===hs;)hs=Jn[--ei],Jn[ei]=null,Si=Jn[--ei],Jn[ei]=null,yi=Jn[--ei],Jn[ei]=null}function t_(n,i){Jn[ei++]=yi,Jn[ei++]=Si,Jn[ei++]=hs,yi=i.id,Si=i.overflow,hs=n}var Xt=null,St=null,Ve=!1,ds=null,ti=!1,ph=Error(r(519));function fs(n){var i=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Gl(Zn(i,n)),ph}function n_(n){var i=n.stateNode,l=n.type,o=n.memoizedProps;switch(i[rn]=n,i[Nn]=o,l){case"dialog":Je("cancel",i),Je("close",i);break;case"iframe":case"object":case"embed":Je("load",i);break;case"video":case"audio":for(l=0;l<va.length;l++)Je(va[l],i);break;case"source":Je("error",i);break;case"img":case"image":case"link":Je("error",i),Je("load",i);break;case"details":Je("toggle",i);break;case"input":Je("invalid",i),mg(i,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":Je("invalid",i);break;case"textarea":Je("invalid",i),gg(i,o.value,o.defaultValue,o.children)}l=o.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||i.textContent===""+l||o.suppressHydrationWarning===!0||wy(i.textContent,l)?(o.popover!=null&&(Je("beforetoggle",i),Je("toggle",i)),o.onScroll!=null&&Je("scroll",i),o.onScrollEnd!=null&&Je("scrollend",i),o.onClick!=null&&(i.onclick=vi),i=!0):i=!1,i||fs(n,!0)}function Lo(n){for(Xt=n.return;Xt;)switch(Xt.tag){case 5:case 31:case 13:ti=!1;return;case 27:case 3:ti=!0;return;default:Xt=Xt.return}}function Vr(n){if(n!==Xt)return!1;if(!Ve)return Lo(n),Ve=!0,!1;var i=n.tag,l;if((l=i!==3&&i!==27)&&((l=i===5)&&(l=n.type,l=!(l!=="form"&&l!=="button")||Vd(n.type,n.memoizedProps)),l=!l),l&&St&&fs(n),Lo(n),i===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(317));St=qy(n)}else if(i===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(317));St=qy(n)}else i===27?(i=St,Ts(n.type)?(n=ef,ef=null,St=n):St=i):St=Xt?ii(n.stateNode.nextSibling):null;return!0}function Js(){St=Xt=null,Ve=!1}function gh(){var n=ds;return n!==null&&(Dn===null?Dn=n:Dn.push.apply(Dn,n),ds=null),n}function Gl(n){ds===null?ds=[n]:ds.push(n)}var _h=Ge(null),er=null,Wi=null;function ms(n,i,l){$e(_h,i._currentValue),i._currentValue=l}function Xi(n){n._currentValue=_h.current,nt(_h)}function zo(n,i,l){for(;n!==null;){var o=n.alternate;if((n.childLanes&i)!==i?(n.childLanes|=i,o!==null&&(o.childLanes|=i)):o!==null&&(o.childLanes&i)!==i&&(o.childLanes|=i),n===l)break;n=n.return}}function vh(n,i,l,o){var d=n.child;for(d!==null&&(d.return=n);d!==null;){var m=d.dependencies;if(m!==null){var b=d.child;m=m.firstContext;e:for(;m!==null;){var C=m;m=d;for(var B=0;B<i.length;B++)if(C.context===i[B]){m.lanes|=l,C=m.alternate,C!==null&&(C.lanes|=l),zo(m.return,l,n),o||(b=null);break e}m=C.next}}else if(d.tag===18){if(b=d.return,b===null)throw Error(r(341));b.lanes|=l,m=b.alternate,m!==null&&(m.lanes|=l),zo(b,l,n),b=null}else d.tag===13&&d.memoizedState!==null&&d.memoizedState.dehydrated===null?(d.lanes|=l,b=d.alternate,b!==null&&(b.lanes|=l),zo(d.return,l,n),b=d.child,b=b!==null?b.sibling:null):b=d.child;if(b!==null)b.return=d;else for(b=d;b!==null;){if(b===n){b=null;break}if(d=b.sibling,d!==null){d.return=b.return,b=d;break}b=b.return}d=b}}function tr(n,i,l,o){n=null;for(var d=i,m=!1;d!==null;){if(!m){if((d.flags&524288)!==0)m=!0;else if((d.flags&262144)!==0)break}if(d.tag===10){var b=d.alternate;if(b===null)throw Error(r(387));if(b=b.memoizedProps,b!==null){var C=d.type;Hn(d.pendingProps.value,b.value)||(n!==null?n.push(C):n=[C])}}else if(d===Oe.current){if(b=d.alternate,b===null)throw Error(r(387));b.memoizedState.memoizedState!==d.memoizedState.memoizedState&&(n!==null?n.push(gl):n=[gl])}d=d.return}return n!==null&&vh(i,n,l,o),i.flags|=262144,n!==null}function Ho(n){for(n=n.firstContext;n!==null;){if(!Hn(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function nr(n){er=n,Wi=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function ln(n){return i_(er,n)}function Io(n,i){return er===null&&nr(n),i_(n,i)}function i_(n,i){var l=i._currentValue;if(i={context:i,memoizedValue:l,next:null},Wi===null){if(n===null)throw Error(r(308));Wi=i,n.dependencies={lanes:0,firstContext:i},n.flags|=524288}else Wi=Wi.next=i;return l}var RC=typeof AbortController<"u"?AbortController:function(){var n=[],i=this.signal={aborted:!1,addEventListener:function(l,o){n.push(o)}};this.abort=function(){i.aborted=!0,n.forEach(function(l){return l()})}},OC=e.unstable_scheduleCallback,BC=e.unstable_NormalPriority,zt={$$typeof:F,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function yh(){return{controller:new RC,data:new Map,refCount:0}}function Ql(n){n.refCount--,n.refCount===0&&OC(BC,function(){n.controller.abort()})}function s_(n,i){if((n.pendingLanes&4194048)!==0){var l=n.transitionTypes;for(l===null&&(l=n.transitionTypes=[]),n=0;n<i.length;n++){var o=i[n];l.indexOf(o)===-1&&l.push(o)}}}var Zl=null;function LC(n){var i=n.transitionTypes;return n.transitionTypes=null,i}var Jl=null,Sh=0,ir=0,Yr=null;function zC(n,i){if(Jl===null){var l=Jl=[];Sh=0,ir=Ld(),Yr={status:"pending",value:void 0,then:function(o){l.push(o)}}}return Sh++,i.then(r_,r_),i}function r_(){if(--Sh===0&&(Zl=null,Jl!==null)){Yr!==null&&(Yr.status="fulfilled");var n=Jl;Jl=null,ir=0,Yr=null;for(var i=0;i<n.length;i++)(0,n[i])()}}function HC(n,i){var l=[],o={status:"pending",value:null,reason:null,then:function(d){l.push(d)}};return n.then(function(){o.status="fulfilled",o.value=i;for(var d=0;d<l.length;d++)(0,l[d])(i)},function(d){for(o.status="rejected",o.reason=d,d=0;d<l.length;d++)(0,l[d])(void 0)}),o}var l_=se.S;se.S=function(n,i){if(Zv=sn(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&zC(n,i),Zl!==null)for(var l=ul;l!==null;)s_(l,Zl),l=l.next;if(l=n.types,l!==null){for(var o=ul;o!==null;)s_(o,l),o=o.next;if(ir!==0){o=Zl,o===null&&(o=Zl=[]);for(var d=0;d<l.length;d++){var m=l[d];o.indexOf(m)===-1&&o.push(m)}}}l_!==null&&l_(n,i)};var sr=Ge(null);function bh(){var n=sr.current;return n!==null?n:_t.pooledCache}function Uo(n,i){i===null?$e(sr,sr.current):$e(sr,i.pool)}function a_(){var n=bh();return n===null?null:{parent:zt._currentValue,pool:n}}var Kr=Error(r(460)),xh=Error(r(474)),Po=Error(r(542)),qo={then:function(){}};function o_(n){return n=n.status,n==="fulfilled"||n==="rejected"}function c_(n,i,l){switch(l=n[l],l===void 0?n.push(i):l!==i&&(i.then(vi,vi),i=l),i.status){case"fulfilled":return i.value;case"rejected":throw n=i.reason,h_(n),n===void 0&&!("reason"in i)?Error(r(600)):n;default:if(typeof i.status=="string")i.then(vi,vi);else{if(n=_t,n!==null&&100<n.shellSuspendCounter)throw Error(r(482));n=i,n.status="pending",n.then(function(o){if(i.status==="pending"){var d=i;d.status="fulfilled",d.value=o}},function(o){if(i.status==="pending"){var d=i;d.status="rejected",d.reason=o}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw n=i.reason,h_(n),n}throw lr=i,Kr}}function rr(n){try{var i=n._init;return i(n._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(lr=l,Kr):l}}var lr=null;function u_(){if(lr===null)throw Error(r(459));var n=lr;return lr=null,n}function h_(n){if(n===Kr||n===Po)throw Error(r(483))}var Wr=null,ea=0;function Fo(n){var i=ea;return ea+=1,Wr===null&&(Wr=[]),c_(Wr,n,i)}function ps(n,i){i=i.props.ref,n.ref=i!==void 0?i:null}function $o(n,i){throw i.$$typeof===Y?Error(r(525)):(n=Object.prototype.toString.call(i),Error(r(31,n==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":n)))}function d_(n){function i(W,I){if(n){var ee=W.deletions;ee===null?(W.deletions=[I],W.flags|=16):ee.push(I)}}function l(W,I){if(!n)return null;for(;I!==null;)i(W,I),I=I.sibling;return null}function o(W){for(var I=new Map;W!==null;)W.key===null?I.set(W.index,W):I.set(W.key,W),W=W.sibling;return I}function d(W,I){return W=Yi(W,I),W.index=0,W.sibling=null,W}function m(W,I,ee){return W.index=ee,n?(ee=W.alternate,ee!==null?(ee=ee.index,ee<I?(W.flags|=2,I):ee):(W.flags|=134217730,I)):(W.flags|=1048576,I)}function b(W){return n&&W.alternate===null&&(W.flags|=134217730),W}function C(W,I,ee,he){return I===null||I.tag!==6?(I=dh(ee,W.mode,he),I.return=W,I):(I=d(I,ee),I.return=W,I)}function B(W,I,ee,he){var Te=ee.type;return Te===J?(W=ne(W,I,ee.props.children,he,ee.key),ps(W,ee),W):I!==null&&(I.elementType===Te||typeof Te=="object"&&Te!==null&&Te.$$typeof===D&&rr(Te)===I.type)?(I=d(I,ee.props),ps(I,ee),I.return=W,I):(I=Ro(ee.type,ee.key,ee.props,null,W.mode,he),ps(I,ee),I.return=W,I)}function X(W,I,ee,he){return I===null||I.tag!==4||I.stateNode.containerInfo!==ee.containerInfo||I.stateNode.implementation!==ee.implementation?(I=fh(ee,W.mode,he),I.return=W,I):(I=d(I,ee.children||[]),I.return=W,I)}function ne(W,I,ee,he,Te){return I===null||I.tag!==7?(I=Zs(ee,W.mode,he,Te),I.return=W,I):(I=d(I,ee),I.return=W,I)}function de(W,I,ee){if(typeof I=="string"&&I!==""||typeof I=="number"||typeof I=="bigint")return I=dh(""+I,W.mode,ee),I.return=W,I;if(typeof I=="object"&&I!==null){switch(I.$$typeof){case ue:return ee=Ro(I.type,I.key,I.props,null,W.mode,ee),ps(ee,I),ee.return=W,ee;case P:return I=fh(I,W.mode,ee),I.return=W,I;case D:return I=rr(I),de(W,I,ee)}if(le(I)||fe(I))return I=Zs(I,W.mode,ee,null),I.return=W,I;if(typeof I.then=="function")return de(W,Fo(I),ee);if(I.$$typeof===F)return de(W,Io(W,I),ee);$o(W,I)}return null}function $(W,I,ee,he){var Te=I!==null?I.key:null;if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return Te!==null?null:C(W,I,""+ee,he);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case ue:return ee.key===Te?B(W,I,ee,he):null;case P:return ee.key===Te?X(W,I,ee,he):null;case D:return ee=rr(ee),$(W,I,ee,he)}if(le(ee)||fe(ee))return Te!==null?null:ne(W,I,ee,he,null);if(typeof ee.then=="function")return $(W,I,Fo(ee),he);if(ee.$$typeof===F)return $(W,I,Io(W,ee),he);$o(W,ee)}return null}function te(W,I,ee,he,Te){if(typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint")return W=W.get(ee)||null,C(I,W,""+he,Te);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case ue:return W=W.get(he.key===null?ee:he.key)||null,B(I,W,he,Te);case P:return W=W.get(he.key===null?ee:he.key)||null,X(I,W,he,Te);case D:return he=rr(he),te(W,I,ee,he,Te)}if(le(he)||fe(he))return W=W.get(ee)||null,ne(I,W,he,Te,null);if(typeof he.then=="function")return te(W,I,ee,Fo(he),Te);if(he.$$typeof===F)return te(W,I,ee,Io(I,he),Te);$o(I,he)}return null}function Ce(W,I,ee,he){for(var Te=null,tt=null,Re=I,ze=I=0,Ut=null;Re!==null&&ze<ee.length;ze++){Re.index>ze?(Ut=Re,Re=null):Ut=Re.sibling;var it=$(W,Re,ee[ze],he);if(it===null){Re===null&&(Re=Ut);break}n&&Re&&it.alternate===null&&i(W,Re),I=m(it,I,ze),tt===null?Te=it:tt.sibling=it,tt=it,Re=Ut}if(ze===ee.length)return l(W,Re),Ve&&Ki(W,ze),Te;if(Re===null){for(;ze<ee.length;ze++)Re=de(W,ee[ze],he),Re!==null&&(I=m(Re,I,ze),tt===null?Te=Re:tt.sibling=Re,tt=Re);return Ve&&Ki(W,ze),Te}for(Re=o(Re);ze<ee.length;ze++)Ut=te(Re,W,ze,ee[ze],he),Ut!==null&&(n&&(it=Ut.alternate,it!==null&&Re.delete(it.key===null?ze:it.key)),I=m(Ut,I,ze),tt===null?Te=Ut:tt.sibling=Ut,tt=Ut);return n&&Re.forEach(function(Os){return i(W,Os)}),Ve&&Ki(W,ze),Te}function De(W,I,ee,he){if(ee==null)throw Error(r(151));for(var Te=null,tt=null,Re=I,ze=I=0,Ut=null,it=ee.next();Re!==null&&!it.done;ze++,it=ee.next()){Re.index>ze?(Ut=Re,Re=null):Ut=Re.sibling;var Os=$(W,Re,it.value,he);if(Os===null){Re===null&&(Re=Ut);break}n&&Re&&Os.alternate===null&&i(W,Re),I=m(Os,I,ze),tt===null?Te=Os:tt.sibling=Os,tt=Os,Re=Ut}if(it.done)return l(W,Re),Ve&&Ki(W,ze),Te;if(Re===null){for(;!it.done;ze++,it=ee.next())it=de(W,it.value,he),it!==null&&(I=m(it,I,ze),tt===null?Te=it:tt.sibling=it,tt=it);return Ve&&Ki(W,ze),Te}for(Re=o(Re);!it.done;ze++,it=ee.next())it=te(Re,W,ze,it.value,he),it!==null&&(n&&(Ut=it.alternate,Ut!==null&&Re.delete(Ut.key===null?ze:Ut.key)),I=m(it,I,ze),tt===null?Te=it:tt.sibling=it,tt=it);return n&&Re.forEach(function(vN){return i(W,vN)}),Ve&&Ki(W,ze),Te}function qe(W,I,ee,he){if(typeof ee=="object"&&ee!==null&&ee.type===J&&ee.key===null&&ee.props.ref===void 0&&(ee=ee.props.children),typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case ue:e:{for(var Te=ee.key;I!==null;){if(I.key===Te){if(Te=ee.type,Te===J){if(I.tag===7){l(W,I.sibling),he=d(I,ee.props.children),ps(he,ee),he.return=W,W=he;break e}}else if(I.elementType===Te||typeof Te=="object"&&Te!==null&&Te.$$typeof===D&&rr(Te)===I.type){l(W,I.sibling),he=d(I,ee.props),ps(he,ee),he.return=W,W=he;break e}l(W,I);break}else i(W,I);I=I.sibling}ee.type===J?(he=Zs(ee.props.children,W.mode,he,ee.key),ps(he,ee),he.return=W,W=he):(he=Ro(ee.type,ee.key,ee.props,null,W.mode,he),ps(he,ee),he.return=W,W=he)}return b(W);case P:e:{for(Te=ee.key;I!==null;){if(I.key===Te)if(I.tag===4&&I.stateNode.containerInfo===ee.containerInfo&&I.stateNode.implementation===ee.implementation){l(W,I.sibling),he=d(I,ee.children||[]),he.return=W,W=he;break e}else{l(W,I);break}else i(W,I);I=I.sibling}he=fh(ee,W.mode,he),he.return=W,W=he}return b(W);case D:return ee=rr(ee),qe(W,I,ee,he)}if(le(ee))return Ce(W,I,ee,he);if(fe(ee)){if(Te=fe(ee),typeof Te!="function")throw Error(r(150));return ee=Te.call(ee),De(W,I,ee,he)}if(typeof ee.then=="function")return qe(W,I,Fo(ee),he);if(ee.$$typeof===F)return qe(W,I,Io(W,ee),he);$o(W,ee)}return typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint"?(ee=""+ee,I!==null&&I.tag===6?(l(W,I.sibling),he=d(I,ee),he.return=W,W=he):(l(W,I),he=dh(ee,W.mode,he),he.return=W,W=he),b(W)):l(W,I)}return function(W,I,ee,he){try{ea=0;var Te=qe(W,I,ee,he);return Wr=null,Te}catch(Re){if(Re===Kr||Re===Po)throw Re;var tt=En(29,Re,null,W.mode);return tt.lanes=he,tt.return=W,tt}}}var ar=d_(!0),f_=d_(!1),gs=!1;function wh(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ch(n,i){n=n.updateQueue,i.updateQueue===n&&(i.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function _s(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function vs(n,i,l){var o=n.updateQueue;if(o===null)return null;if(o=o.shared,(ct&2)!==0){var d=o.pending;return d===null?i.next=i:(i.next=d.next,d.next=i),o.pending=i,i=Ao(n),Gg(n,null,l),i}return Mo(n,o,i,l),Ao(n)}function ta(n,i,l){if(i=i.updateQueue,i!==null&&(i=i.shared,(l&4194048)!==0)){var o=i.lanes;o&=n.pendingLanes,l|=o,i.lanes=l,eg(n,l)}}function kh(n,i){var l=n.updateQueue,o=n.alternate;if(o!==null&&(o=o.updateQueue,l===o)){var d=null,m=null;if(l=l.firstBaseUpdate,l!==null){do{var b={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};m===null?d=m=b:m=m.next=b,l=l.next}while(l!==null);m===null?d=m=i:m=m.next=i}else d=m=i;l={baseState:o.baseState,firstBaseUpdate:d,lastBaseUpdate:m,shared:o.shared,callbacks:o.callbacks},n.updateQueue=l;return}n=l.lastBaseUpdate,n===null?l.firstBaseUpdate=i:n.next=i,l.lastBaseUpdate=i}var Nh=!1;function na(){if(Nh){var n=Yr;if(n!==null)throw n}}function ia(n,i,l,o){Nh=!1;var d=n.updateQueue;gs=!1;var m=d.firstBaseUpdate,b=d.lastBaseUpdate,C=d.shared.pending;if(C!==null){d.shared.pending=null;var B=C,X=B.next;B.next=null,b===null?m=X:b.next=X,b=B;var ne=n.alternate;ne!==null&&(ne=ne.updateQueue,C=ne.lastBaseUpdate,C!==b&&(C===null?ne.firstBaseUpdate=X:C.next=X,ne.lastBaseUpdate=B))}if(m!==null){var de=d.baseState;b=0,ne=X=B=null,C=m;do{var $=C.lane&-536870913,te=$!==C.lane;if(te?(et&$)===$:(o&$)===$){$!==0&&$===ir&&(Nh=!0),ne!==null&&(ne=ne.next={lane:0,tag:C.tag,payload:C.payload,callback:null,next:null});e:{var Ce=n,De=C;$=i;var qe=l;switch(De.tag){case 1:if(Ce=De.payload,typeof Ce=="function"){de=Ce.call(qe,de,$);break e}de=Ce;break e;case 3:Ce.flags=Ce.flags&-65537|128;case 0:if(Ce=De.payload,$=typeof Ce=="function"?Ce.call(qe,de,$):Ce,$==null)break e;de=A({},de,$);break e;case 2:gs=!0}}$=C.callback,$!==null&&(n.flags|=64,te&&(n.flags|=8192),te=d.callbacks,te===null?d.callbacks=[$]:te.push($))}else te={lane:$,tag:C.tag,payload:C.payload,callback:C.callback,next:null},ne===null?(X=ne=te,B=de):ne=ne.next=te,b|=$;if(C=C.next,C===null){if(C=d.shared.pending,C===null)break;te=C,C=te.next,te.next=null,d.lastBaseUpdate=te,d.shared.pending=null}}while(!0);ne===null&&(B=de),d.baseState=B,d.firstBaseUpdate=X,d.lastBaseUpdate=ne,m===null&&(d.shared.lanes=0),ks|=b,n.lanes=b,n.memoizedState=de}}function m_(n,i){if(typeof n!="function")throw Error(r(191,n));n.call(i)}function p_(n,i){var l=n.callbacks;if(l!==null)for(n.callbacks=null,n=0;n<l.length;n++)m_(l[n],i)}var ys=Ge(null),Vo=Ge(0);function g_(n,i){n=es,$e(Vo,n),$e(ys,i),es=n|i.baseLanes}function Eh(){$e(Vo,es),$e(ys,ys.current)}function jh(){es=Vo.current,nt(ys),nt(Vo)}var an=Ge(null),pn=null;function Ss(n){var i=n.alternate;$e(on,on.current&1),$e(an,n),pn===null&&(i===null||ys.current!==null||i.memoizedState!==null)&&(pn=n)}function Th(n){$e(on,on.current),$e(an,n),pn===null&&(pn=n)}function __(n){n.tag===22?($e(on,on.current),$e(an,n),pn===null&&(pn=n)):bs()}function bs(){$e(on,on.current),$e(an,an.current)}function In(n){nt(an),pn===n&&(pn=null),nt(on)}var on=Ge(0);function sa(n,i){$e(an,an.current),$e(on,i)}function Dh(n){nt(on),nt(an),pn===n&&(pn=null)}function Yo(n){for(var i=n;i!==null;){if(i.tag===13){var l=i.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||Zd(l)||Jd(l)))return i}else if(i.tag===19&&i.memoizedProps.revealOrder!=="independent"){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===n)break;for(;i.sibling===null;){if(i.return===null||i.return===n)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var Gi=0,Pe=null,mt=null,Ht=null,Ko=!1,Xr=!1,or=!1,Wo=0,ra=0,Gr=null,IC=0;function Tt(){throw Error(r(321))}function Mh(n,i){if(i===null)return!1;for(var l=0;l<i.length&&l<n.length;l++)if(!Hn(n[l],i[l]))return!1;return!0}function Ah(n,i,l,o,d,m){return Gi=m,Pe=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,se.H=n===null||n.memoizedState===null?ev:tv,or=!1,m=l(o,d),or=!1,Xr&&(m=y_(i,l,o,d)),v_(n),m}function v_(n){se.H=tc;var i=mt!==null&&mt.next!==null;if(Gi=0,Ht=mt=Pe=null,Ko=!1,ra=0,Gr=null,i)throw Error(r(300));n===null||It||(n=n.dependencies,n!==null&&Ho(n)&&(It=!0))}function y_(n,i,l,o){Pe=n;var d=0;do{if(Xr&&(Gr=null),ra=0,Xr=!1,25<=d)throw Error(r(301));if(d+=1,Ht=mt=null,n.updateQueue!=null){var m=n.updateQueue;m.lastEffect=null,m.events=null,m.stores=null,m.memoCache!=null&&(m.memoCache.index=0)}se.H=KC,m=i(l,o)}while(Xr);return m}function UC(){var n=se.H,i=n.useState()[0];return i=typeof i.then=="function"?la(i):i,n=n.useState()[0],(mt!==null?mt.memoizedState:null)!==n&&(Pe.flags|=1024),i}function Rh(){var n=Wo!==0;return Wo=0,n}function Oh(n,i,l){i.updateQueue=n.updateQueue,i.flags&=-2053,n.lanes&=~l}function Bh(n){if(Ko){for(n=n.memoizedState;n!==null;){var i=n.queue;i!==null&&(i.pending=null),n=n.next}Ko=!1}Gi=0,Ht=mt=Pe=null,Xr=!1,ra=Wo=0,Gr=null}function Sn(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ht===null?Pe.memoizedState=Ht=n:Ht=Ht.next=n,Ht}function Bt(){if(mt===null){var n=Pe.alternate;n=n!==null?n.memoizedState:null}else n=mt.next;var i=Ht===null?Pe.memoizedState:Ht.next;if(i!==null)Ht=i,mt=n;else{if(n===null)throw Pe.alternate===null?Error(r(467)):Error(r(310));mt=n,n={memoizedState:mt.memoizedState,baseState:mt.baseState,baseQueue:mt.baseQueue,queue:mt.queue,next:null},Ht===null?Pe.memoizedState=Ht=n:Ht=Ht.next=n}return Ht}function Xo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function la(n){var i=ra;return ra+=1,Gr===null&&(Gr=[]),n=c_(Gr,n,i),i=Pe,(Ht===null?i.memoizedState:Ht.next)===null&&(i=i.alternate,se.H=i===null||i.memoizedState===null?ev:tv),n}function Go(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return la(n);if(n.$$typeof===ie)return;if(n.$$typeof===F)return ln(n)}throw Error(r(438,String(n)))}function Lh(n){var i=null,l=Pe.updateQueue;if(l!==null&&(i=l.memoCache),i==null){var o=Pe.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(i={data:o.data.map(function(d){return d.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),l===null&&(l=Xo(),Pe.updateQueue=l),l.memoCache=i,l=i.data[i.index],l===void 0)for(l=i.data[i.index]=Array(n),o=0;o<n;o++)l[o]=R;return i.index++,l}function Qi(n,i){return typeof i=="function"?i(n):i}function Qo(n){var i=Bt();return zh(i,mt,n)}function zh(n,i,l){var o=n.queue;if(o===null)throw Error(r(311));o.lastRenderedReducer=l;var d=n.baseQueue,m=o.pending;if(m!==null){if(d!==null){var b=d.next;d.next=m.next,m.next=b}i.baseQueue=d=m,o.pending=null}if(m=n.baseState,d===null)n.memoizedState=m;else{i=d.next;var C=b=null,B=null,X=i,ne=!1;do{var de=X.lane&-536870913;if(de!==X.lane?(et&de)===de:(Gi&de)===de){var $=X.revertLane;if($===0)B!==null&&(B=B.next={lane:0,revertLane:0,gesture:null,action:X.action,hasEagerState:X.hasEagerState,eagerState:X.eagerState,next:null}),de===ir&&(ne=!0);else if((Gi&$)===$){X=X.next,$===ir&&(ne=!0);continue}else de={lane:0,revertLane:X.revertLane,gesture:null,action:X.action,hasEagerState:X.hasEagerState,eagerState:X.eagerState,next:null},B===null?(C=B=de,b=m):B=B.next=de,Pe.lanes|=$,ks|=$;de=X.action,or&&l(m,de),m=X.hasEagerState?X.eagerState:l(m,de)}else $={lane:de,revertLane:X.revertLane,gesture:X.gesture,action:X.action,hasEagerState:X.hasEagerState,eagerState:X.eagerState,next:null},B===null?(C=B=$,b=m):B=B.next=$,Pe.lanes|=de,ks|=de;X=X.next}while(X!==null&&X!==i);if(B===null?b=m:B.next=C,!Hn(m,n.memoizedState)&&(It=!0,ne&&(l=Yr,l!==null)))throw l;n.memoizedState=m,n.baseState=b,n.baseQueue=B,o.lastRenderedState=m}return d===null&&(o.lanes=0),[n.memoizedState,o.dispatch]}function Hh(n){var i=Bt(),l=i.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=n;var o=l.dispatch,d=l.pending,m=i.memoizedState;if(d!==null){l.pending=null;var b=d=d.next;do m=n(m,b.action),b=b.next;while(b!==d);Hn(m,i.memoizedState)||(It=!0),i.memoizedState=m,i.baseQueue===null&&(i.baseState=m),l.lastRenderedState=m}return[m,o]}function S_(n,i,l){var o=Pe,d=Bt(),m=Ve;if(m){if(l===void 0)throw Error(r(407));l=l()}else l=i();var b=!Hn((mt||d).memoizedState,l);if(b&&(d.memoizedState=l,It=!0),d=d.queue,Ph(w_.bind(null,o,d,n),[n]),n=d.getSnapshot!==i||b||Ht!==null&&(Ht.memoizedState.tag&1)!==0,Qr(n?9:8,{destroy:void 0},x_.bind(null,o,d,l,i),null),n){if(o.flags|=2048,_t===null)throw Error(r(349));m||(Gi&127)!==0||b_(o,i,l)}return l}function b_(n,i,l){n.flags|=16384,n={getSnapshot:i,value:l},i=Pe.updateQueue,i===null?(i=Xo(),Pe.updateQueue=i,i.stores=[n]):(l=i.stores,l===null?i.stores=[n]:l.push(n))}function x_(n,i,l,o){i.value=l,i.getSnapshot=o,C_(i)&&k_(n)}function w_(n,i,l){return l(function(){C_(i)&&k_(n)})}function C_(n){var i=n.getSnapshot;n=n.value;try{var l=i();return!Hn(n,l)}catch{return!0}}function k_(n){var i=Qs(n,2);i!==null&&Mn(i,n,2)}function Ih(n){var i=Sn();if(typeof n=="function"){var l=n;if(n=l(),or){os(!0);try{l()}finally{os(!1)}}}return i.memoizedState=i.baseState=n,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qi,lastRenderedState:n},i}function N_(n,i,l,o){return n.baseState=l,zh(n,mt,typeof o=="function"?o:Qi)}function PC(n,i,l,o,d){if(ec(n))throw Error(r(485));if(n=i.action,n!==null){var m={payload:d,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(b){m.listeners.push(b)}};se.T!==null?l(!0):m.isTransition=!1,o(m),l=i.pending,l===null?(m.next=i.pending=m,E_(i,m)):(m.next=l.next,i.pending=l.next=m)}}function E_(n,i){var l=i.action,o=i.payload,d=n.state;if(i.isTransition){var m=se.T,b={};b.types=m!==null?m.types:null,se.T=b;try{var C=l(d,o),B=se.S;B!==null&&B(b,C),j_(n,i,C)}catch(X){Uh(n,i,X)}finally{m!==null&&b.types!==null&&(m.types=b.types),se.T=m}}else try{m=l(d,o),j_(n,i,m)}catch(X){Uh(n,i,X)}}function j_(n,i,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(o){T_(n,i,o)},function(o){return Uh(n,i,o)}):T_(n,i,l)}function T_(n,i,l){i.status="fulfilled",i.value=l,D_(i),n.state=l,i=n.pending,i!==null&&(l=i.next,l===i?n.pending=null:(l=l.next,i.next=l,E_(n,l)))}function Uh(n,i,l){var o=n.pending;if(n.pending=null,o!==null){o=o.next;do i.status="rejected",i.reason=l,D_(i),i=i.next;while(i!==o)}n.action=null}function D_(n){n=n.listeners;for(var i=0;i<n.length;i++)(0,n[i])()}function M_(n,i){return i}function A_(n,i){if(Ve){var l=_t.formState;if(l!==null){e:{var o=Pe;if(Ve){if(St){t:{for(var d=St,m=ti;d.nodeType!==8;){if(!m){d=null;break t}if(d=ii(d.nextSibling),d===null){d=null;break t}}m=d.data,d=m==="F!"||m==="F"?d:null}if(d){St=ii(d.nextSibling),o=d.data==="F!";break e}}fs(o)}o=!1}o&&(i=l[0])}}return l=Sn(),l.memoizedState=l.baseState=i,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:M_,lastRenderedState:i},l.queue=o,l=Q_.bind(null,Pe,o),o.dispatch=l,o=Ih(!1),m=Yh.bind(null,Pe,!1,o.queue),o=Sn(),d={state:i,dispatch:null,action:n,pending:null},o.queue=d,l=PC.bind(null,Pe,d,m,l),d.dispatch=l,o.memoizedState=n,[i,l,!1]}function R_(n){var i=Bt();return O_(i,mt,n)}function O_(n,i,l){if(i=zh(n,i,M_)[0],n=Qo(Qi)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var o=la(i)}catch(b){throw b===Kr?Po:b}else o=i;i=Bt();var d=i.queue,m=d.dispatch;return l!==i.memoizedState&&(Pe.flags|=2048,Qr(9,{destroy:void 0},qC.bind(null,d,l),null)),[o,m,n]}function qC(n,i){n.action=i}function B_(n){var i=Bt(),l=mt;if(l!==null)return O_(i,l,n);Bt(),i=i.memoizedState,l=Bt();var o=l.queue.dispatch;return l.memoizedState=n,[i,o,!1]}function Qr(n,i,l,o){return n={tag:n,create:l,deps:o,inst:i,next:null},i=Pe.updateQueue,i===null&&(i=Xo(),Pe.updateQueue=i),l=i.lastEffect,l===null?i.lastEffect=n.next=n:(o=l.next,l.next=n,n.next=o,i.lastEffect=n),n}function L_(){return Bt().memoizedState}function Zo(n,i,l,o){var d=Sn();Pe.flags|=n,d.memoizedState=Qr(1|i,{destroy:void 0},l,o===void 0?null:o)}function Jo(n,i,l,o){var d=Bt();o=o===void 0?null:o;var m=d.memoizedState.inst;mt!==null&&o!==null&&Mh(o,mt.memoizedState.deps)?d.memoizedState=Qr(i,m,l,o):(Pe.flags|=n,d.memoizedState=Qr(1|i,m,l,o))}function z_(n,i){Zo(8390656,8,n,i)}function Ph(n,i){Jo(2048,8,n,i)}function FC(n){Pe.flags|=4;var i=Pe.updateQueue;if(i===null)i=Xo(),Pe.updateQueue=i,i.events=[n];else{var l=i.events;l===null?i.events=[n]:l.push(n)}}function H_(n){var i=Bt().memoizedState;return FC({ref:i,nextImpl:n}),function(){if((ct&2)!==0)throw Error(r(440));return i.impl.apply(void 0,arguments)}}function I_(n,i){return Jo(4,2,n,i)}function U_(n,i){return Jo(4,4,n,i)}function P_(n,i){if(typeof i=="function"){n=n();var l=i(n);return function(){typeof l=="function"?l():i(null)}}if(i!=null)return n=n(),i.current=n,function(){i.current=null}}function q_(n,i,l){l=l!=null?l.concat([n]):null,Jo(4,4,P_.bind(null,i,n),l)}function qh(){}function F_(n,i){var l=Bt();i=i===void 0?null:i;var o=l.memoizedState;return i!==null&&Mh(i,o[1])?o[0]:(l.memoizedState=[n,i],n)}function $_(n,i){var l=Bt();i=i===void 0?null:i;var o=l.memoizedState;if(i!==null&&Mh(i,o[1]))return o[0];if(o=n(),or){os(!0);try{n()}finally{os(!1)}}return l.memoizedState=[o,i],o}function Fh(n,i,l){return l===void 0||(Gi&1073741824)!==0&&(et&261930)===0?n.memoizedState=i:(n.memoizedState=l,n=ey(),Pe.lanes|=n,ks|=n,l)}function V_(n,i,l,o){return Hn(l,i)?l:ys.current!==null?(n=Fh(n,l,o),Hn(n,i)||(It=!0),n):(Gi&106)===0||(Gi&1073741824)!==0&&(et&261930)===0?(It=!0,n.memoizedState=l):(n=ey(),Pe.lanes|=n,ks|=n,i)}function Y_(n,i,l,o,d){var m=me.p;me.p=m!==0&&8>m?m:8;var b=se.T,C={};C.types=b!==null?b.types:null,se.T=C,Yh(n,!1,i,l);try{var B=d(),X=se.S;if(X!==null&&X(C,B),B!==null&&typeof B=="object"&&typeof B.then=="function"){var ne=HC(B,o);aa(n,i,ne,Fn(n))}else aa(n,i,o,Fn(n))}catch(de){aa(n,i,{then:function(){},status:"rejected",reason:de},Fn())}finally{me.p=m,b!==null&&C.types!==null&&(b.types=C.types),se.T=b}}function $C(){}function $h(n,i,l,o){if(n.tag!==5)throw Error(r(476));var d=K_(n).queue;Y_(n,d,i,xe,l===null?$C:function(){return W_(n),l(o)})}function K_(n){var i=n.memoizedState;if(i!==null)return i;i={memoizedState:xe,baseState:xe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qi,lastRenderedState:xe},next:null};var l={};return i.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qi,lastRenderedState:l},next:null},n.memoizedState=i,n=n.alternate,n!==null&&(n.memoizedState=i),i}function W_(n){var i=K_(n);i.next===null&&(i=n.alternate.memoizedState),aa(n,i.next.queue,{},Fn())}function Vh(){return ln(gl)}function X_(){return Bt().memoizedState}function G_(){return Bt().memoizedState}function VC(n){for(var i=n.return;i!==null;){switch(i.tag){case 24:case 3:var l=Fn();n=_s(l);var o=vs(i,n,l);o!==null&&(Mn(o,i,l),ta(o,i,l)),i={cache:yh()},n.payload=i;return}i=i.return}}function YC(n,i,l){var o=Fn();l={lane:o,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},ec(n)?Z_(i,l):(l=uh(n,i,l,o),l!==null&&(Mn(l,n,o),J_(l,i,o)))}function Q_(n,i,l){var o=Fn();aa(n,i,l,o)}function aa(n,i,l,o){var d={lane:o,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(ec(n))Z_(i,d);else{var m=n.alternate;if(n.lanes===0&&(m===null||m.lanes===0)&&(m=i.lastRenderedReducer,m!==null))try{var b=i.lastRenderedState,C=m(b,l);if(d.hasEagerState=!0,d.eagerState=C,Hn(C,b))return Mo(n,i,d,0),_t===null&&Do(),!1}catch{}if(l=uh(n,i,d,o),l!==null)return Mn(l,n,o),J_(l,i,o),!0}return!1}function Yh(n,i,l,o){if(o={lane:2,revertLane:Ld(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},ec(n)){if(i)throw Error(r(479))}else i=uh(n,l,o,2),i!==null&&Mn(i,n,2)}function ec(n){var i=n.alternate;return n===Pe||i!==null&&i===Pe}function Z_(n,i){Xr=Ko=!0;var l=n.pending;l===null?i.next=i:(i.next=l.next,l.next=i),n.pending=i}function J_(n,i,l){if((l&4194048)!==0){var o=i.lanes;o&=n.pendingLanes,l|=o,i.lanes=l,eg(n,l)}}var tc={readContext:ln,use:Go,useCallback:Tt,useContext:Tt,useEffect:Tt,useImperativeHandle:Tt,useLayoutEffect:Tt,useInsertionEffect:Tt,useMemo:Tt,useReducer:Tt,useRef:Tt,useState:Tt,useDebugValue:Tt,useDeferredValue:Tt,useTransition:Tt,useSyncExternalStore:Tt,useId:Tt,useHostTransitionStatus:Tt,useFormState:Tt,useActionState:Tt,useOptimistic:Tt,useMemoCache:Tt,useCacheRefresh:Tt,useEffectEvent:Tt},ev={readContext:ln,use:Go,useCallback:function(n,i){return Sn().memoizedState=[n,i===void 0?null:i],n},useContext:ln,useEffect:z_,useImperativeHandle:function(n,i,l){l=l!=null?l.concat([n]):null,Zo(4194308,4,P_.bind(null,i,n),l)},useLayoutEffect:function(n,i){return Zo(4194308,4,n,i)},useInsertionEffect:function(n,i){Zo(4,2,n,i)},useMemo:function(n,i){var l=Sn();i=i===void 0?null:i;var o=n();if(or){os(!0);try{n()}finally{os(!1)}}return l.memoizedState=[o,i],o},useReducer:function(n,i,l){var o=Sn();if(l!==void 0){var d=l(i);if(or){os(!0);try{l(i)}finally{os(!1)}}}else d=i;return o.memoizedState=o.baseState=d,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:d},o.queue=n,n=n.dispatch=YC.bind(null,Pe,n),[o.memoizedState,n]},useRef:function(n){var i=Sn();return n={current:n},i.memoizedState=n},useState:function(n){n=Ih(n);var i=n.queue,l=Q_.bind(null,Pe,i);return i.dispatch=l,[n.memoizedState,l]},useDebugValue:qh,useDeferredValue:function(n,i){var l=Sn();return Fh(l,n,i)},useTransition:function(){var n=Ih(!1);return n=Y_.bind(null,Pe,n.queue,!0,!1),Sn().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,i,l){var o=Pe,d=Sn();if(Ve){if(l===void 0)throw Error(r(407));l=l()}else{if(l=i(),_t===null)throw Error(r(349));(et&127)!==0||b_(o,i,l)}d.memoizedState=l;var m={value:l,getSnapshot:i};return d.queue=m,z_(w_.bind(null,o,m,n),[n]),o.flags|=2048,Qr(9,{destroy:void 0},x_.bind(null,o,m,l,i),null),l},useId:function(){var n=Sn(),i=_t.identifierPrefix;if(Ve){var l=Si,o=yi;l=(o&~(1<<32-Ln(o)-1)).toString(32)+l,i="_"+i+"R_"+l,l=Wo++,0<l&&(i+="H"+l.toString(32)),i+="_"}else l=IC++,i="_"+i+"r_"+l.toString(32)+"_";return n.memoizedState=i},useHostTransitionStatus:Vh,useFormState:A_,useActionState:A_,useOptimistic:function(n){var i=Sn();i.memoizedState=i.baseState=n;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=l,i=Yh.bind(null,Pe,!0,l),l.dispatch=i,[n,i]},useMemoCache:Lh,useCacheRefresh:function(){return Sn().memoizedState=VC.bind(null,Pe)},useEffectEvent:function(n){var i=Sn(),l={impl:n};return i.memoizedState=l,function(){if((ct&2)!==0)throw Error(r(440));return l.impl.apply(void 0,arguments)}}},tv={readContext:ln,use:Go,useCallback:F_,useContext:ln,useEffect:Ph,useImperativeHandle:q_,useInsertionEffect:I_,useLayoutEffect:U_,useMemo:$_,useReducer:Qo,useRef:L_,useState:function(){return Qo(Qi)},useDebugValue:qh,useDeferredValue:function(n,i){var l=Bt();return V_(l,mt.memoizedState,n,i)},useTransition:function(){var n=Qo(Qi)[0],i=Bt().memoizedState;return[typeof n=="boolean"?n:la(n),i]},useSyncExternalStore:S_,useId:X_,useHostTransitionStatus:Vh,useFormState:R_,useActionState:R_,useOptimistic:function(n,i){var l=Bt();return N_(l,mt,n,i)},useMemoCache:Lh,useCacheRefresh:G_,useEffectEvent:H_},KC={readContext:ln,use:Go,useCallback:F_,useContext:ln,useEffect:Ph,useImperativeHandle:q_,useInsertionEffect:I_,useLayoutEffect:U_,useMemo:$_,useReducer:Hh,useRef:L_,useState:function(){return Hh(Qi)},useDebugValue:qh,useDeferredValue:function(n,i){var l=Bt();return mt===null?Fh(l,n,i):V_(l,mt.memoizedState,n,i)},useTransition:function(){var n=Hh(Qi)[0],i=Bt().memoizedState;return[typeof n=="boolean"?n:la(n),i]},useSyncExternalStore:S_,useId:X_,useHostTransitionStatus:Vh,useFormState:B_,useActionState:B_,useOptimistic:function(n,i){var l=Bt();return mt!==null?N_(l,mt,n,i):(l.baseState=n,[n,l.queue.dispatch])},useMemoCache:Lh,useCacheRefresh:G_,useEffectEvent:H_};function Kh(n,i,l,o){i=n.memoizedState,l=l(o,i),l=l==null?i:A({},i,l),n.memoizedState=l,n.lanes===0&&(n.updateQueue.baseState=l)}var Wh={enqueueSetState:function(n,i,l){n=n._reactInternals;var o=Fn(),d=_s(o);d.payload=i,l!=null&&(d.callback=l),i=vs(n,d,o),i!==null&&(Mn(i,n,o),ta(i,n,o))},enqueueReplaceState:function(n,i,l){n=n._reactInternals;var o=Fn(),d=_s(o);d.tag=1,d.payload=i,l!=null&&(d.callback=l),i=vs(n,d,o),i!==null&&(Mn(i,n,o),ta(i,n,o))},enqueueForceUpdate:function(n,i){n=n._reactInternals;var l=Fn(),o=_s(l);o.tag=2,i!=null&&(o.callback=i),i=vs(n,o,l),i!==null&&(Mn(i,n,l),ta(i,n,l))}};function nv(n,i,l,o,d,m,b){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(o,m,b):i.prototype&&i.prototype.isPureReactComponent?!Kl(l,o)||!Kl(d,m):!0}function iv(n,i,l,o){n=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(l,o),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(l,o),i.state!==n&&Wh.enqueueReplaceState(i,i.state,null)}function cr(n,i){var l=i;if("ref"in i){l={};for(var o in i)o!=="ref"&&(l[o]=i[o])}if(n=n.defaultProps){l===i&&(l=A({},l));for(var d in n)l[d]===void 0&&(l[d]=n[d])}return l}function sv(n){To(n)}function rv(n){console.error(n)}function lv(n){To(n)}function nc(n,i){try{var l=n.onUncaughtError;l(i.value,{componentStack:i.stack})}catch(o){setTimeout(function(){throw o})}}function av(n,i,l){try{var o=n.onCaughtError;o(l.value,{componentStack:l.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(d){setTimeout(function(){throw d})}}function Xh(n,i,l){return l=_s(l),l.tag=3,l.payload={element:null},l.callback=function(){nc(n,i)},l}function ov(n){return n=_s(n),n.tag=3,n}function cv(n,i,l,o){var d=l.type.getDerivedStateFromError;if(typeof d=="function"){var m=o.value;n.payload=function(){return d(m)},n.callback=function(){av(i,l,o)}}var b=l.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(n.callback=function(){av(i,l,o),typeof d!="function"&&(Ns===null?Ns=new Set([this]):Ns.add(this));var C=o.stack;this.componentDidCatch(o.value,{componentStack:C!==null?C:""})})}function WC(n,i,l,o,d){if(l.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(i=l.alternate,i!==null&&tr(i,l,d,!0),l=an.current,l!==null){switch(l.tag){case 31:case 13:case 19:return pn===null?wc():l.alternate===null&&Dt===0&&(Dt=3),l.flags&=-257,l.flags|=65536,l.lanes=d,o===qo?l.flags|=16384:(i=l.updateQueue,i===null?l.updateQueue=new Set([o]):i.add(o),Rd(n,o,d)),!1;case 22:return l.flags|=65536,o===qo?l.flags|=16384:(i=l.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([o])},l.updateQueue=i):(l=i.retryQueue,l===null?i.retryQueue=new Set([o]):l.add(o)),Rd(n,o,d)),!1}throw Error(r(435,l.tag))}return Rd(n,o,d),wc(),!1}if(Ve)return i=an.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=d,o!==ph&&(n=Error(r(422),{cause:o}),Gl(Zn(n,l)))):(o!==ph&&(i=Error(r(423),{cause:o}),Gl(Zn(i,l))),n=n.current.alternate,n.flags|=65536,d&=-d,n.lanes|=d,o=Zn(o,l),d=Xh(n.stateNode,o,d),kh(n,d),Dt!==4&&(Dt=2)),!1;var m=Error(r(520),{cause:o});if(m=Zn(m,l),pa===null?pa=[m]:pa.push(m),Dt!==4&&(Dt=2),i===null)return!0;o=Zn(o,l),l=i;do{switch(l.tag){case 3:return l.flags|=65536,n=d&-d,l.lanes|=n,n=Xh(l.stateNode,o,n),kh(l,n),!1;case 1:if(i=l.type,m=l.stateNode,(l.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||m!==null&&typeof m.componentDidCatch=="function"&&(Ns===null||!Ns.has(m))))return l.flags|=65536,d&=-d,l.lanes|=d,d=ov(d),cv(d,n,l,o),kh(l,d),!1;break;case 22:if(l.memoizedState!==null)return l.flags|=65536,!1}l=l.return}while(l!==null);return!1}var Gh=Error(r(461)),It=!1;function $t(n,i,l,o){i.child=n===null?f_(i,null,l,o):ar(i,n.child,l,o)}function uv(n,i,l,o,d){l=l.render;var m=i.ref;if("ref"in o){var b={};for(var C in o)C!=="ref"&&(b[C]=o[C])}else b=o;return nr(i),o=Ah(n,i,l,b,m,d),C=Rh(),n!==null&&!It?(Oh(n,i,d),Zi(n,i,d)):(Ve&&C&&Bo(i),i.flags|=1,$t(n,i,o,d),i.child)}function hv(n,i,l,o,d){if(n===null){var m=l.type;return typeof m=="function"&&!hh(m)&&m.defaultProps===void 0&&l.compare===null?(i.tag=15,i.type=m,dv(n,i,m,o,d)):(n=Ro(l.type,null,o,i,i.mode,d),n.ref=i.ref,n.return=i,i.child=n)}if(m=n.child,!sd(n,d)){var b=m.memoizedProps;if(l=l.compare,l=l!==null?l:Kl,l(b,o)&&n.ref===i.ref)return Zi(n,i,d)}return i.flags|=1,n=Yi(m,o),n.ref=i.ref,n.return=i,i.child=n}function dv(n,i,l,o,d){if(n!==null){var m=n.memoizedProps;if(Kl(m,o)&&n.ref===i.ref)if(It=!1,i.pendingProps=o=m,sd(n,d))(n.flags&131072)!==0&&(It=!0);else return i.lanes=n.lanes,Zi(n,i,d)}return Qh(n,i,l,o,d)}function fv(n,i,l,o){var d=o.children,m=n!==null?n.memoizedState:null;if(n===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((i.flags&128)!==0){if(m=m!==null?m.baseLanes|l:l,n!==null){for(o=i.child=n.child,d=0;o!==null;)d=d|o.lanes|o.childLanes,o=o.sibling;o=d&~m}else o=0,i.child=null;return mv(n,i,m,l,o)}if((l&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},n!==null&&Uo(i,m!==null?m.cachePool:null),m!==null?g_(i,m):Eh(),__(i);else return o=i.lanes=536870912,mv(n,i,m!==null?m.baseLanes|l:l,l,o)}else m!==null?(Uo(i,m.cachePool),g_(i,m),bs(),i.memoizedState=null):(n!==null&&Uo(i,null),Eh(),bs());return $t(n,i,d,l),i.child}function oa(n,i){return n!==null&&n.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function mv(n,i,l,o,d){var m=bh();return m=m===null?null:{parent:zt._currentValue,pool:m},i.memoizedState={baseLanes:l,cachePool:m},n!==null&&Uo(i,null),Eh(),__(i),n!==null&&tr(n,i,o,!0),i.childLanes=d,null}function ic(n,i){return i=sc({mode:i.mode,children:i.children},n.mode),i.ref=n.ref,n.child=i,i.return=n,i}function pv(n,i,l){return ar(i,n.child,null,l),n=ic(i,i.pendingProps),n.flags|=2,In(i),i.memoizedState=null,n}function XC(n,i,l){var o=i.pendingProps,d=(i.flags&128)!==0;if(i.flags&=-129,n===null){if(Ve){if(o.mode==="hidden")return n=ic(i,o),i.lanes=536870912,n.memoizedState={baseLanes:0,cachePool:null},oa(null,n);if(Th(i),(n=St)?(n=Py(n,ti),n=n!==null&&n.data==="&"?n:null,n!==null&&(i.memoizedState={dehydrated:n,treeContext:hs!==null?{id:yi,overflow:Si}:null,retryLane:536870912,hydrationErrors:null},l=Zg(n),l.return=i,i.child=l,Xt=i,St=null)):n=null,n===null)throw fs(i);return i.lanes=536870912,null}return ic(i,o)}var m=n.memoizedState;if(m!==null){var b=m.dehydrated;if(Th(i),d)if(i.flags&256)i.flags&=-257,i=pv(n,i,l);else if(i.memoizedState!==null)i.child=n.child,i.flags|=128,i=null;else throw Error(r(558));else if(It||tr(n,i,l,!1),d=(l&n.childLanes)!==0,It||d){if(ys.current===null){if(o=_t,o!==null&&(b=tg(o,l),b!==0&&b!==m.retryLane))throw m.retryLane=b,Qs(n,b),Mn(o,n,b),Gh;wc()}i=pv(n,i,l)}else n=m.treeContext,St=ii(b.nextSibling),Xt=i,Ve=!0,ds=null,ti=!1,n!==null&&t_(i,n),i=ic(i,o),i.flags|=134221824;return i}return n=Yi(n.child,{mode:o.mode,children:o.children}),n.ref=i.ref,i.child=n,n.return=i,n}function Zr(n,i){var l=i.ref;if(l===null)n!==null&&n.ref!==null&&(i.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(r(284));(n===null||n.ref!==l)&&(i.flags|=4194816)}}function Qh(n,i,l,o,d){return nr(i),l=Ah(n,i,l,o,void 0,d),o=Rh(),n!==null&&!It?(Oh(n,i,d),Zi(n,i,d)):(Ve&&o&&Bo(i),i.flags|=1,$t(n,i,l,d),i.child)}function gv(n,i,l,o,d,m){return nr(i),i.updateQueue=null,l=y_(i,o,l,d),v_(n),o=Rh(),n!==null&&!It?(Oh(n,i,m),Zi(n,i,m)):(Ve&&o&&Bo(i),i.flags|=1,$t(n,i,l,m),i.child)}function _v(n,i,l,o,d){if(nr(i),i.stateNode===null){var m=qr,b=l.contextType;typeof b=="object"&&b!==null&&(m=ln(b)),m=new l(o,m),i.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,m.updater=Wh,i.stateNode=m,m._reactInternals=i,m=i.stateNode,m.props=o,m.state=i.memoizedState,m.refs={},wh(i),b=l.contextType,m.context=typeof b=="object"&&b!==null?ln(b):qr,m.state=i.memoizedState,b=l.getDerivedStateFromProps,typeof b=="function"&&(Kh(i,l,b,o),m.state=i.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof m.getSnapshotBeforeUpdate=="function"||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(b=m.state,typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount(),b!==m.state&&Wh.enqueueReplaceState(m,m.state,null),ia(i,o,m,d),na(),m.state=i.memoizedState),typeof m.componentDidMount=="function"&&(i.flags|=4194308),o=!0}else if(n===null){m=i.stateNode;var C=i.memoizedProps,B=cr(l,C);m.props=B;var X=m.context,ne=l.contextType;b=qr,typeof ne=="object"&&ne!==null&&(b=ln(ne));var de=l.getDerivedStateFromProps;ne=typeof de=="function"||typeof m.getSnapshotBeforeUpdate=="function",C=i.pendingProps!==C,ne||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(C||X!==b)&&iv(i,m,o,b),gs=!1;var $=i.memoizedState;m.state=$,ia(i,o,m,d),na(),X=i.memoizedState,C||$!==X||gs?(typeof de=="function"&&(Kh(i,l,de,o),X=i.memoizedState),(B=gs||nv(i,l,B,o,$,X,b))?(ne||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount()),typeof m.componentDidMount=="function"&&(i.flags|=4194308)):(typeof m.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=o,i.memoizedState=X),m.props=o,m.state=X,m.context=b,o=B):(typeof m.componentDidMount=="function"&&(i.flags|=4194308),o=!1)}else{m=i.stateNode,Ch(n,i),b=i.memoizedProps,ne=cr(l,b),m.props=ne,de=i.pendingProps,$=m.context,X=l.contextType,B=qr,typeof X=="object"&&X!==null&&(B=ln(X)),C=l.getDerivedStateFromProps,(X=typeof C=="function"||typeof m.getSnapshotBeforeUpdate=="function")||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(b!==de||$!==B)&&iv(i,m,o,B),gs=!1,$=i.memoizedState,m.state=$,ia(i,o,m,d),na();var te=i.memoizedState;b!==de||$!==te||gs||n!==null&&n.dependencies!==null&&Ho(n.dependencies)?(typeof C=="function"&&(Kh(i,l,C,o),te=i.memoizedState),(ne=gs||nv(i,l,ne,o,$,te,B)||n!==null&&n.dependencies!==null&&Ho(n.dependencies))?(X||typeof m.UNSAFE_componentWillUpdate!="function"&&typeof m.componentWillUpdate!="function"||(typeof m.componentWillUpdate=="function"&&m.componentWillUpdate(o,te,B),typeof m.UNSAFE_componentWillUpdate=="function"&&m.UNSAFE_componentWillUpdate(o,te,B)),typeof m.componentDidUpdate=="function"&&(i.flags|=4),typeof m.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof m.componentDidUpdate!="function"||b===n.memoizedProps&&$===n.memoizedState||(i.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||b===n.memoizedProps&&$===n.memoizedState||(i.flags|=1024),i.memoizedProps=o,i.memoizedState=te),m.props=o,m.state=te,m.context=B,o=ne):(typeof m.componentDidUpdate!="function"||b===n.memoizedProps&&$===n.memoizedState||(i.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||b===n.memoizedProps&&$===n.memoizedState||(i.flags|=1024),o=!1)}return m=o,Zr(n,i),o=(i.flags&128)!==0,m||o?(m=i.stateNode,l=o&&typeof l.getDerivedStateFromError!="function"?null:m.render(),i.flags|=1,n!==null&&o?(i.child=ar(i,n.child,null,d),i.child=ar(i,null,l,d)):$t(n,i,l,d),i.memoizedState=m.state,n=i.child):n=Zi(n,i,d),n}function vv(n,i,l,o){return Js(),i.flags|=256,$t(n,i,l,o),i.child}var Zh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Jh(n){return{baseLanes:n,cachePool:a_()}}function ed(n,i,l){return n=n!==null?n.childLanes&~l:0,i&&(n|=qn),n}function yv(n,i,l){var o=i.pendingProps,d=!1,m=(i.flags&128)!==0,b;if((b=m)||(b=n!==null&&n.memoizedState===null?!1:(on.current&2)!==0),b&&(d=!0,i.flags&=-129),b=(i.flags&32)!==0,i.flags&=-33,n===null){if(Ve){if(d?Ss(i):bs(),(n=St)?(n=Py(n,ti),n=n!==null&&n.data!=="&"?n:null,n!==null&&(i.memoizedState={dehydrated:n,treeContext:hs!==null?{id:yi,overflow:Si}:null,retryLane:536870912,hydrationErrors:null},l=Zg(n),l.return=i,i.child=l,Xt=i,St=null)):n=null,n===null)throw fs(i);return Jd(n)?i.lanes=32:i.lanes=536870912,null}return m=o.children,o=o.fallback,d?(bs(),d=i.mode,m=sc({mode:"hidden",children:m},d),o=Zs(o,d,l,null),m.return=i,o.return=i,m.sibling=o,i.child=m,o=i.child,o.memoizedState=Jh(l),o.childLanes=ed(n,b,l),i.memoizedState=Zh,oa(null,o)):(Ss(i),td(i,m))}var C=n.memoizedState;if(C!==null){var B=C.dehydrated;if(B!==null)return GC(n,i,m,b,o,B,C,l)}return d?(bs(),d=o.fallback,m=i.mode,C=n.child,B=C.sibling,o=Yi(C,{mode:"hidden",children:o.children}),o.subtreeFlags=C.subtreeFlags&1206910976,B!==null?d=Yi(B,d):(d=Zs(d,m,l,null),d.flags|=2),d.return=i,o.return=i,o.sibling=d,i.child=o,oa(null,o),o=i.child,d=n.child.memoizedState,d===null?d=Jh(l):(m=d.cachePool,m!==null?(C=zt._currentValue,m=m.parent!==C?{parent:C,pool:C}:m):m=a_(),d={baseLanes:d.baseLanes|l,cachePool:m}),o.memoizedState=d,o.childLanes=ed(n,b,l),i.memoizedState=Zh,oa(n.child,o)):(Ss(i),l=n.child,n=l.sibling,l=Yi(l,{mode:"visible",children:o.children}),l.return=i,l.sibling=null,n!==null&&(b=i.deletions,b===null?(i.deletions=[n],i.flags|=16):b.push(n)),i.child=l,i.memoizedState=null,l)}function td(n,i){return i=sc({mode:"visible",children:i},n.mode),i.return=n,n.child=i}function sc(n,i){return n=En(22,n,null,i),n.lanes=0,n}function rc(n,i,l){return ar(i,n.child,null,l),n=td(i,i.pendingProps.children),n.flags|=2,i.memoizedState=null,n}function GC(n,i,l,o,d,m,b,C){if(l)return i.flags&256?(Ss(i),i.flags&=-257,rc(n,i,C)):i.memoizedState!==null?(bs(),i.child=n.child,i.flags|=128,null):(bs(),m=d.fallback,b=i.mode,d=sc({mode:"visible",children:d.children},b),m=Zs(m,b,C,null),m.flags|=2,d.return=i,m.return=i,d.sibling=m,i.child=d,ar(i,n.child,null,C),d=i.child,d.memoizedState=Jh(C),d.childLanes=ed(n,o,C),i.memoizedState=Zh,oa(null,d));if(Ss(i),Jd(m)){if(o=m.nextSibling&&m.nextSibling.dataset,o)var B=o.dgst;return o=B,o!==""&&(d=Error(r(419)),d.stack="",d.digest=o,Gl({value:d,source:null,stack:null})),rc(n,i,C)}if(It||tr(n,i,C,!1),o=(C&n.childLanes)!==0,It||o){if(ys.current!==null)return rc(n,i,C);if(o=_t,o!==null&&(d=tg(o,C),d!==0&&d!==b.retryLane))throw b.retryLane=d,Qs(n,d),Mn(o,n,d),Gh;return Zd(m)||wc(),rc(n,i,C)}return Zd(m)?(i.flags|=192,i.child=n.child,null):(n=b.treeContext,St=ii(m.nextSibling),Xt=i,Ve=!0,ds=null,ti=!1,n!==null&&t_(i,n),i=td(i,d.children),i.flags|=134221824,i)}function Sv(n,i,l){n.lanes|=i;var o=n.alternate;o!==null&&(o.lanes|=i),zo(n.return,i,l)}function bv(n){for(var i=null;n!==null;){var l=n.alternate;l!==null&&Yo(l)===null&&(i=n),n=n.sibling}return i}function lc(n,i,l,o,d,m){var b=n.memoizedState;b===null?n.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:o,tail:l,tailMode:d,treeForkCount:m}:(b.isBackwards=i,b.rendering=null,b.renderingStartTime=0,b.last=o,b.tail=l,b.tailMode=d,b.treeForkCount=m)}function nd(n){var i=n.child;for(n.child=null;i!==null;){var l=i.sibling;i.sibling=n.child,n.child=i,i=l}}function id(n,i,l){var o=i.pendingProps,d=o.revealOrder,m=o.tail;o=o.children;var b=on.current;if(i.flags&128)return sa(i,b),null;var C=(b&2)!==0;if(C?(b=b&1|2,i.flags|=128):b&=1,sa(i,b),d==="backwards"&&n!==null?(nd(n),$t(n,i,o,l),nd(n)):$t(n,i,o,l),o=Ve?Xl:0,!C&&n!==null&&(n.flags&128)!==0)e:for(n=i.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&Sv(n,l,i);else if(n.tag===19)Sv(n,l,i);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===i)break e;for(;n.sibling===null;){if(n.return===null||n.return===i)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(d){case"backwards":l=bv(i.child),l===null?(d=i.child,i.child=null):(d=l.sibling,l.sibling=null,nd(i)),lc(i,!0,d,null,m,o);break;case"unstable_legacy-backwards":for(l=null,d=i.child,i.child=null;d!==null;){if(n=d.alternate,n!==null&&Yo(n)===null){i.child=d;break}n=d.sibling,d.sibling=l,l=d,d=n}lc(i,!0,l,null,m,o);break;case"together":lc(i,!1,null,null,void 0,o);break;case"independent":i.memoizedState=null;break;default:l=bv(i.child),l===null?(d=i.child,i.child=null):(d=l.sibling,l.sibling=null),lc(i,!1,d,l,m,o)}return i.child}function xv(n,i,l){var o=i.pendingProps;return ms(i,i.type,o.value),$t(n,i,o.children,l),i.child}function Zi(n,i,l){if(n!==null&&(i.dependencies=n.dependencies),ks|=i.lanes,(l&i.childLanes)===0)if(n!==null){if(tr(n,i,l,!1),(l&i.childLanes)===0)return null}else return null;if(n!==null&&i.child!==n.child)throw Error(r(153));if(i.child!==null){for(n=i.child,l=Yi(n,n.pendingProps),i.child=l,l.return=i;n.sibling!==null;)n=n.sibling,l=l.sibling=Yi(n,n.pendingProps),l.return=i;l.sibling=null}return i.child}function sd(n,i){return(n.lanes&i)!==0?!0:(n=n.dependencies,!!(n!==null&&Ho(n)))}function QC(n,i,l){switch(i.tag){case 3:oe(i,i.stateNode.containerInfo),ms(i,zt,n.memoizedState.cache),Js();break;case 27:case 5:Le(i);break;case 4:oe(i,i.stateNode.containerInfo);break;case 10:ms(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Th(i),null;break;case 13:var o=i.memoizedState;if(o!==null){if(o.dehydrated!==null)return Ss(i),i.flags|=128,null;o=tr(n,i,l,!1);var d=i.child.childLanes;return o||(l&d)!==0?yv(n,i,l):(Ss(i),n=Zi(n,i,l),n!==null?n.sibling:null)}Ss(i);break;case 19:if(i.flags&128)return id(n,i,l);if(d=(n.flags&128)!==0,o=(l&i.childLanes)!==0,o||(tr(n,i,l,!1),o=(l&i.childLanes)!==0),d){if(o)return id(n,i,l);i.flags|=128}if(d=i.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),sa(i,on.current),o)break;return null;case 22:return i.lanes=0,fv(n,i,l,i.pendingProps);case 24:ms(i,zt,n.memoizedState.cache)}return Zi(n,i,l)}function wv(n,i,l){if(n!==null)if(n.memoizedProps!==i.pendingProps)It=!0;else{if(!sd(n,l)&&(i.flags&128)===0)return It=!1,QC(n,i,l);It=(n.flags&131072)!==0}else It=!1,Ve&&(i.flags&1048576)!==0&&e_(i,Xl,i.index);switch(i.lanes=0,i.tag){case 16:e:{var o=i.pendingProps;if(n=rr(i.elementType),i.type=n,typeof n=="function")hh(n)?(o=cr(n,o),i.tag=1,i=_v(null,i,n,o,l)):(i.tag=0,i=Qh(null,i,n,o,l));else{if(n!=null){var d=n.$$typeof;if(d===V){i.tag=11,i=uv(null,i,n,o,l);break e}else if(d===ge){i.tag=14,i=hv(null,i,n,o,l);break e}else if(d===F){i.tag=10,i.type=n,i=xv(null,i,l);break e}}throw i=Z(n)||n,Error(r(306,i,""))}}return i;case 0:return Qh(n,i,i.type,i.pendingProps,l);case 1:return o=i.type,d=cr(o,i.pendingProps),_v(n,i,o,d,l);case 3:e:{if(oe(i,i.stateNode.containerInfo),n===null)throw Error(r(387));o=i.pendingProps;var m=i.memoizedState;d=m.element,Ch(n,i),ia(i,o,null,l);var b=i.memoizedState;if(o=b.cache,ms(i,zt,o),o!==m.cache&&vh(i,[zt],l,!0),na(),o=b.element,m.isDehydrated)if(m={element:o,isDehydrated:!1,cache:b.cache},i.updateQueue.baseState=m,i.memoizedState=m,i.flags&256){i=vv(n,i,o,l);break e}else if(o!==d){d=Zn(Error(r(424)),i),Gl(d),i=vv(n,i,o,l);break e}else for(n=i.stateNode.containerInfo,n.nodeType===9?n=n.body:n=n.nodeName==="HTML"?n.ownerDocument.body:n,St=ii(n.firstChild),Xt=i,Ve=!0,ds=null,ti=!0,l=f_(i,null,o,l),i.child=l;l;)l.flags=l.flags&-3|134221824,l=l.sibling;else{if(Js(),o===d){i=Zi(n,i,l);break e}$t(n,i,o,l)}i=i.child}return i;case 26:return Zr(n,i),n===null?(l=Wy(i.type,null,i.pendingProps,null))?i.memoizedState=l:Ve||(i.stateNode=Ey(i.type,i.pendingProps,ke.current,i)):i.memoizedState=Wy(i.type,n.memoizedProps,i.pendingProps,n.memoizedState),null;case 27:return Le(i),n===null&&Ve&&(o=i.stateNode=$y(i.type,i.pendingProps,ke.current),Xt=i,ti=!0,d=St,Ts(i.type)?(ef=d,St=ii(o.firstChild)):St=d),$t(n,i,i.pendingProps.children,l),Zr(n,i),n===null&&(i.flags|=4194304),i.child;case 5:return n===null&&Ve&&((d=o=St)&&(o=Vk(o,i.type,i.pendingProps,ti),o!==null?(i.stateNode=o,Xt=i,St=ii(o.firstChild),ti=!1,d=!0):d=!1),d||fs(i)),Le(i),d=i.type,m=i.pendingProps,b=n!==null?n.memoizedProps:null,o=m.children,Vd(d,m)?o=null:b!==null&&Vd(d,b)&&(i.flags|=32),i.memoizedState!==null&&(d=Ah(n,i,UC,null,null,l),gl._currentValue=d),Zr(n,i),$t(n,i,o,l),i.child;case 6:return n===null&&Ve&&((n=l=St)&&(l=Yk(l,i.pendingProps,ti),l!==null?(i.stateNode=l,Xt=i,St=null,n=!0):n=!1),n||fs(i)),null;case 13:return yv(n,i,l);case 4:return oe(i,i.stateNode.containerInfo),o=i.pendingProps,n===null?i.child=ar(i,null,o,l):$t(n,i,o,l),i.child;case 11:return uv(n,i,i.type,i.pendingProps,l);case 7:return o=i.pendingProps,Zr(n,i),$t(n,i,o,l),i.child;case 8:return $t(n,i,i.pendingProps.children,l),i.child;case 12:return $t(n,i,i.pendingProps.children,l),i.child;case 10:return xv(n,i,l);case 9:return d=i.type._context,o=i.pendingProps.children,nr(i),d=ln(d),o=o(d),i.flags|=1,$t(n,i,o,l),i.child;case 14:return hv(n,i,i.type,i.pendingProps,l);case 15:return dv(n,i,i.type,i.pendingProps,l);case 19:return id(n,i,l);case 31:return XC(n,i,l);case 22:return fv(n,i,l,i.pendingProps);case 24:return nr(i),o=ln(zt),n===null?(d=bh(),d===null&&(d=_t,m=yh(),d.pooledCache=m,m.refCount++,m!==null&&(d.pooledCacheLanes|=l),d=m),i.memoizedState={parent:o,cache:d},wh(i),ms(i,zt,d)):((n.lanes&l)!==0&&(Ch(n,i),ia(i,null,null,l),na()),d=n.memoizedState,m=i.memoizedState,d.parent!==o?(d={parent:o,cache:o},i.memoizedState=d,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=d),ms(i,zt,o)):(o=m.cache,ms(i,zt,o),o!==d.cache&&vh(i,[zt],l,!0))),$t(n,i,i.pendingProps.children,l),i.child;case 30:return i.stateNode===null&&(i.stateNode={autoName:null,paired:null,clones:null,ref:null}),o=i.pendingProps,o.name!=null&&o.name!=="auto"?i.flags|=n===null?18882560:18874368:Ve&&Bo(i),n!==null&&n.memoizedProps.name!==o.name?i.flags|=4194816:Zr(n,i),$t(n,i,o.children,l),i.child;case 29:throw i.pendingProps}throw Error(r(156,i.tag))}function Ji(n){n.flags|=4}function rd(n,i,l,o,d){var m;if((m=(n.mode&32)!==0)&&(m=l===null?Zy(i,o):Zy(i,o)&&(o.src!==l.src||o.srcSet!==l.srcSet)),m){if(n.flags|=16777216,(d&335544128)===d)if(n.stateNode.complete)n.flags|=8192;else if(sy())n.flags|=8192;else throw lr=qo,xh}else n.flags&=-16777217}function Cv(n,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!Jy(i))if(sy())n.flags|=8192;else throw lr=qo,xh}function ac(n,i){i!==null&&(n.flags|=4),n.flags&16384&&(i=n.tag!==22?Zp():536870912,n.lanes|=i,il|=i)}function ca(n,i){if(!Ve)switch(n.tailMode){case"visible":break;case"collapsed":for(var l=n.tail,o=null;l!==null;)l.alternate!==null&&(o=l),l=l.sibling;o===null?i||n.tail===null?n.tail=null:n.tail.sibling=null:o.sibling=null;break;default:for(i=n.tail,l=null;i!==null;)i.alternate!==null&&(l=i),i=i.sibling;l===null?n.tail=null:l.sibling=null}}function bt(n){var i=n.alternate!==null&&n.alternate.child===n.child,l=0,o=0;if(i)for(var d=n.child;d!==null;)l|=d.lanes|d.childLanes,o|=d.subtreeFlags&1206910976,o|=d.flags&1206910976,d.return=n,d=d.sibling;else for(d=n.child;d!==null;)l|=d.lanes|d.childLanes,o|=d.subtreeFlags,o|=d.flags,d.return=n,d=d.sibling;return n.subtreeFlags|=o,n.childLanes=l,i}function ZC(n,i,l){var o=i.pendingProps;switch(mh(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return bt(i),null;case 1:return bt(i),null;case 3:return l=i.stateNode,o=null,n!==null&&(o=n.memoizedState.cache),i.memoizedState.cache!==o&&(i.flags|=2048),Xi(zt),Ne(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(n===null||n.child===null)&&(Vr(i)?Ji(i):n===null||n.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,gh())),bt(i),null;case 26:var d=i.type,m=i.memoizedState;return n===null?(Ji(i),m!==null?(bt(i),Cv(i,m)):(bt(i),rd(i,d,null,o,l))):m?m!==n.memoizedState?(Ji(i),bt(i),Cv(i,m)):(bt(i),i.flags&=-16777217):(n=n.memoizedProps,n!==o&&Ji(i),bt(i),rd(i,d,n,o,l)),null;case 27:if(Qe(i),l=ke.current,d=i.type,n!==null&&i.stateNode!=null)n.memoizedProps!==o&&Ji(i);else{if(!o){if(i.stateNode===null)throw Error(r(166));return bt(i),i.subtreeFlags&=-33554433,null}n=Ot.current,Vr(i)?n_(i):(n=$y(d,o,l),i.stateNode=n,Ji(i))}return bt(i),i.subtreeFlags&=-33554433,null;case 5:if(Qe(i),d=i.type,n!==null&&i.stateNode!=null)n.memoizedProps!==o&&Ji(i);else{if(!o){if(i.stateNode===null)throw Error(r(166));return bt(i),i.subtreeFlags&=-33554433,null}if(m=Ot.current,Vr(i))n_(i);else{var b=Sa(ke.current);switch(m){case 1:m=b.createElementNS("http://www.w3.org/2000/svg",d);break;case 2:m=b.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;default:switch(d){case"svg":m=b.createElementNS("http://www.w3.org/2000/svg",d);break;case"math":m=b.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;case"script":m=b.createElement("div"),m.innerHTML="<script><\/script>",m=m.removeChild(m.firstChild);break;case"select":m=typeof o.is=="string"?b.createElement("select",{is:o.is}):b.createElement("select"),o.multiple?m.multiple=!0:o.size&&(m.size=o.size);break;default:m=typeof o.is=="string"?b.createElement(d,{is:o.is}):b.createElement(d)}}m[rn]=i,m[Nn]=o;e:for(b=i.child;b!==null;){if(b.tag===5||b.tag===6)m.appendChild(b.stateNode);else if(b.tag!==4&&b.tag!==27&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===i)break e;for(;b.sibling===null;){if(b.return===null||b.return===i)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}i.stateNode=m;e:switch(un(m,d,o),d){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&Ji(i)}}return bt(i),i.subtreeFlags&=-33554433,rd(i,i.type,n===null?null:n.memoizedProps,i.pendingProps,l),null;case 6:if(n&&i.stateNode!=null)n.memoizedProps!==o&&Ji(i);else{if(typeof o!="string"&&i.stateNode===null)throw Error(r(166));if(n=ke.current,Vr(i)){if(n=i.stateNode,l=i.memoizedProps,o=null,d=Xt,d!==null)switch(d.tag){case 27:case 5:o=d.memoizedProps}n[rn]=i,n=!!(n.nodeValue===l||o!==null&&o.suppressHydrationWarning===!0||wy(n.nodeValue,l)),n||fs(i,!0)}else n=Sa(n).createTextNode(o),n[rn]=i,i.stateNode=n}return bt(i),null;case 31:if(l=i.memoizedState,n===null||n.memoizedState!==null){if(o=Vr(i),l!==null){if(n===null){if(!o)throw Error(r(318));if(n=i.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(557));n[rn]=i}else Js(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;bt(i),n=!1}else l=gh(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=l),n=!0;if(!n)return i.flags&256?(In(i),i):(In(i),null);if((i.flags&128)!==0)throw Error(r(558))}return bt(i),null;case 13:if(o=i.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(d=Vr(i),o!==null&&o.dehydrated!==null){if(n===null){if(!d)throw Error(r(318));if(d=i.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(r(317));d[rn]=i}else Js(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;bt(i),d=!1}else d=gh(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=d),d=!0;if(!d)return i.flags&256?(In(i),i):(In(i),null)}return In(i),(i.flags&128)!==0?(i.lanes=l,i):(l=o!==null,n=n!==null&&n.memoizedState!==null,l&&(o=i.child,d=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(d=o.alternate.memoizedState.cachePool.pool),m=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(m=o.memoizedState.cachePool.pool),m!==d&&(o.flags|=2048)),l!==n&&l&&(i.child.flags|=8192),ac(i,i.updateQueue),bt(i),null);case 4:return Ne(),n===null&&Ud(i.stateNode.containerInfo),i.flags|=67108864,bt(i),null;case 10:return Xi(i.type),bt(i),null;case 19:if(Dh(i),o=i.memoizedState,o===null)return bt(i),null;if(d=(i.flags&128)!==0,m=o.rendering,m===null)if(d)ca(o,!1);else{if(Dt!==0||n!==null&&(n.flags&128)!==0)for(n=i.child;n!==null;){if(m=Yo(n),m!==null){for(i.flags|=128,ca(o,!1),n=m.updateQueue,i.updateQueue=n,ac(i,n),i.subtreeFlags=0,n=l,l=i.child;l!==null;)Qg(l,n),l=l.sibling;return sa(i,on.current&1|2),Ve&&Ki(i,o.treeForkCount),i.child}n=n.sibling}o.tail!==null&&sn()>yc&&(i.flags|=128,d=!0,ca(o,!1),i.lanes=4194304)}else{if(!d)if(n=Yo(m),n!==null){if(i.flags|=128,d=!0,n=n.updateQueue,i.updateQueue=n,ac(i,n),ca(o,!0),o.tail===null&&o.tailMode!=="collapsed"&&o.tailMode!=="visible"&&!m.alternate&&!Ve)return bt(i),null}else 2*sn()-o.renderingStartTime>yc&&l!==536870912&&(i.flags|=128,d=!0,ca(o,!1),i.lanes=4194304);o.isBackwards?(m.sibling=i.child,i.child=m):(n=o.last,n!==null?n.sibling=m:i.child=m,o.last=m)}if(o.tail!==null){n=o.tail;e:{for(l=n;l!==null;){if(l.alternate!==null){l=!1;break e}l=l.sibling}l=!0}return o.rendering=n,o.tail=n.sibling,o.renderingStartTime=sn(),n.sibling=null,m=on.current,m=d?m&1|2:m&1,o.tailMode==="visible"||o.tailMode==="collapsed"||!l||Ve?sa(i,m):(l=m,$e(an,i),$e(on,l),pn===null&&(pn=i)),Ve&&Ki(i,o.treeForkCount),n}return bt(i),null;case 22:case 23:return In(i),jh(),o=i.memoizedState!==null,n!==null?n.memoizedState!==null!==o&&(i.flags|=8192):o&&(i.flags|=8192),o?(l&536870912)!==0&&(i.flags&128)===0&&(bt(i),i.subtreeFlags&6&&(i.flags|=8192)):bt(i),l=i.updateQueue,l!==null&&ac(i,l.retryQueue),l=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(l=n.memoizedState.cachePool.pool),o=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),o!==l&&(i.flags|=2048),n!==null&&nt(sr),null;case 24:return l=null,n!==null&&(l=n.memoizedState.cache),i.memoizedState.cache!==l&&(i.flags|=2048),Xi(zt),bt(i),null;case 25:return null;case 30:return i.flags|=33554432,bt(i),null}throw Error(r(156,i.tag))}function JC(n,i){switch(mh(i),i.tag){case 1:return n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 3:return Xi(zt),Ne(),n=i.flags,(n&65536)!==0&&(n&128)===0?(i.flags=n&-65537|128,i):null;case 26:case 27:case 5:return Qe(i),null;case 31:if(i.memoizedState!==null){if(In(i),i.alternate===null)throw Error(r(340));Js()}return n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 13:if(In(i),n=i.memoizedState,n!==null&&n.dehydrated!==null){if(i.alternate===null)throw Error(r(340));Js()}return n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 19:return Dh(i),n=i.flags,n&65536?(i.flags=n&-65537|128,n=i.memoizedState,n!==null&&(n.rendering=null,n.tail=null),i.flags|=4,i):null;case 4:return Ne(),null;case 10:return Xi(i.type),null;case 22:case 23:return In(i),jh(),n!==null&&nt(sr),n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 24:return Xi(zt),null;case 25:return null;default:return null}}function kv(n,i){switch(mh(i),i.tag){case 3:Xi(zt),Ne();break;case 26:case 27:case 5:Qe(i);break;case 4:Ne();break;case 31:i.memoizedState!==null&&In(i);break;case 13:In(i);break;case 19:Dh(i);break;case 10:Xi(i.type);break;case 22:case 23:In(i),jh(),n!==null&&nt(sr);break;case 24:Xi(zt)}}function ua(n,i){try{var l=i.updateQueue,o=l!==null?l.lastEffect:null;if(o!==null){var d=o.next;l=d;do{if((l.tag&n)===n){o=void 0;var m=l.create,b=l.inst;o=m(),b.destroy=o}l=l.next}while(l!==d)}}catch(C){dt(i,i.return,C)}}function xs(n,i,l){try{var o=i.updateQueue,d=o!==null?o.lastEffect:null;if(d!==null){var m=d.next;o=m;do{if((o.tag&n)===n){var b=o.inst,C=b.destroy;if(C!==void 0){b.destroy=void 0,d=i;var B=l,X=C;try{X()}catch(ne){dt(d,B,ne)}}}o=o.next}while(o!==m)}}catch(ne){dt(i,i.return,ne)}}function Nv(n){var i=n.updateQueue;if(i!==null){var l=n.stateNode;try{p_(i,l)}catch(o){dt(n,n.return,o)}}}function Ev(n,i,l){l.props=cr(n.type,n.memoizedProps),l.state=n.memoizedState;try{l.componentWillUnmount()}catch(o){dt(n,i,o)}}function bi(n,i){try{var l=n.ref;if(l!==null){switch(n.tag){case 26:case 27:case 5:var o=n.stateNode;break;case 30:var d=n.stateNode,m=$i(n.memoizedProps,d);(d.ref===null||d.ref.name!==m)&&(d.ref=Oy(m)),o=d.ref;break;case 7:if(n.stateNode===null){var b=new $n(n);_(n.child,!1,Fk,b,void 0,void 0),n.stateNode=b}o=n.stateNode;break;default:o=n.stateNode}typeof l=="function"?n.refCleanup=l(o):l.current=o}}catch(C){dt(n,i,C)}}function cn(n,i){var l=n.ref,o=n.refCleanup;if(l!==null)if(typeof o=="function")try{o()}catch(d){dt(n,i,d)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(d){dt(n,i,d)}else l.current=null}function oc(n,i){if((n.tag===5||n.tag===27||n.tag===6)&&n.alternate===null&&i!==null)for(var l=0;l<i.length;l++)Uy(n.stateNode,i[l])}function jv(n){for(var i=n.return;i!==null&&(ad(i)&&Uy(n.stateNode,i.stateNode),!ld(i));)i=i.return}function ha(n){for(var i=n.return;i!==null&&(ad(i)&&$k(n.stateNode,i.stateNode),!ld(i));)i=i.return}function ld(n){return n.tag===5||n.tag===3||n.tag===27}function ad(n){return n&&n.tag===7&&n.stateNode!==null}function od(n){var i=n.type,l=n.memoizedProps,o=n.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":l.autoFocus&&o.focus();break e;case"img":l.src?o.src=l.src:l.srcSet&&(o.srcset=l.srcSet)}}catch(d){dt(n,n.return,d)}}function cd(n,i,l){try{var o=n.stateNode;kk(o,n.type,l,i),o[Nn]=i}catch(d){dt(n,n.return,d)}}function Tv(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Ts(n.type)||n.tag===4}function ud(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||Tv(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&Ts(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function hd(n,i,l,o){var d=n.tag;if(d===5||d===6)d=n.stateNode,i?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(d,i):(i=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,i.appendChild(d),l=l._reactRootContainer,l!=null||i.onclick!==null||(i.onclick=vi)),oc(n,o),lt=!0;else if(d!==4&&(d===27&&(oc(n,o),o=null,Ts(n.type)&&(l=n.stateNode,i=null)),n=n.child,n!==null))for(hd(n,i,l,o),n=n.sibling;n!==null;)hd(n,i,l,o),n=n.sibling}function cc(n,i,l,o){var d=n.tag;if(d===5||d===6)d=n.stateNode,i?l.insertBefore(d,i):l.appendChild(d),oc(n,o),lt=!0;else if(d!==4&&(d===27&&(oc(n,o),o=null,Ts(n.type)&&(l=n.stateNode)),n=n.child,n!==null))for(cc(n,i,l,o),n=n.sibling;n!==null;)cc(n,i,l,o),n=n.sibling}function Dv(n){var i=n.stateNode,l=n.memoizedProps;try{for(var o=n.type,d=i.attributes;d.length;)i.removeAttributeNode(d[0]);un(i,o,l),i[rn]=n,i[Nn]=l}catch(m){dt(n,n.return,m)}}var uc=!1,Un=null;function Mv(n){(n.tag===30||(n.subtreeFlags&33554432)!==0)&&(uc=!0)}var xi=null;function Av(){var n=xi;return xi=null,n}var jn=0;function Jr(n,i,l,o,d){return jn=0,Rv(n.child,i,l,o,d)}function Rv(n,i,l,o,d){for(var m=!1;n!==null;){if(n.tag===5){var b=n.stateNode;if(o!==null){var C=Wd(b);o.push(C),C.view&&(m=!0)}else m||Wd(b).view&&(m=!0);uc=!0,Ay(b,jn===0?i:i+"_"+jn,l),jn++}else(n.tag!==22||n.memoizedState===null)&&(n.tag===30&&d||Rv(n.child,i,l,o,d)&&(m=!0));n=n.sibling}return m}function wi(n,i){for(;n!==null;)n.tag===5?Ry(n.stateNode,n.memoizedProps):(n.tag!==22||n.memoizedState===null)&&(n.tag===30&&i||wi(n.child,i)),n=n.sibling}function hc(n){if((n.subtreeFlags&18874368)!==0)for(n=n.child;n!==null;){if((n.tag!==22||n.memoizedState===null)&&(hc(n),n.tag===30&&(n.flags&18874368)!==0&&n.stateNode.paired)){var i=n.memoizedProps;if(i.name==null||i.name==="auto")throw Error(r(544));var l=i.name;i=Vi(i.default,i.share),i!=="none"&&(Jr(n,l,i,null,!1)||wi(n.child,!1))}n=n.sibling}}function dd(n,i){if(n.tag===30){var l=n.stateNode,o=n.memoizedProps,d=$i(o,l),m=Vi(o.default,l.paired?o.share:o.enter);m!=="none"?Jr(n,d,m,null,!1)?(hc(n),l.paired||i||al(n,o.onEnter)):wi(n.child,!1):hc(n)}else if((n.subtreeFlags&33554432)!==0)for(n=n.child;n!==null;)dd(n,i),n=n.sibling;else hc(n)}function fd(n){if(Un!==null&&Un.size!==0){var i=Un;if((n.subtreeFlags&18874368)!==0)for(n=n.child;n!==null;){if(n.tag!==22||n.memoizedState===null){if(n.tag===30&&(n.flags&18874368)!==0){var l=n.memoizedProps,o=l.name;if(o!=null&&o!=="auto"){var d=i.get(o);if(d!==void 0){var m=Vi(l.default,l.share);if(m!=="none"&&(Jr(n,o,m,null,!1)?(m=n.stateNode,d.paired=m,m.paired=d,al(n,l.onShare)):wi(n.child,!1)),i.delete(o),i.size===0)break}}}fd(n)}n=n.sibling}}}function md(n){if(n.tag===30){var i=n.memoizedProps,l=$i(i,n.stateNode),o=Un!==null?Un.get(l):void 0,d=Vi(i.default,o!==void 0?i.share:i.exit);d!=="none"&&(Jr(n,l,d,null,!1)?o!==void 0?(d=n.stateNode,o.paired=d,d.paired=o,Un.delete(l),al(n,i.onShare)):al(n,i.onExit):wi(n.child,!1)),Un!==null&&fd(n)}else if((n.subtreeFlags&33554432)!==0)for(n=n.child;n!==null;)md(n),n=n.sibling;else Un!==null&&fd(n)}function Ov(n){for(n=n.child;n!==null;){if(n.tag===30){var i=n.memoizedProps,l=$i(i,n.stateNode);i=Vi(i.default,i.update),n.flags&=-5,i!=="none"&&Jr(n,l,i,n.memoizedState=[],!1)}else(n.subtreeFlags&33554432)!==0&&Ov(n);n=n.sibling}}function pd(n){if((n.subtreeFlags&18874368)!==0)for(n=n.child;n!==null;){if(n.tag!==22||n.memoizedState===null){if(n.tag===30&&(n.flags&18874368)!==0){var i=n.stateNode;i.paired!==null&&(i.paired=null,wi(n.child,!1))}pd(n)}n=n.sibling}}function dc(n){if(n.tag===30)n.stateNode.paired=null,wi(n.child,!1),pd(n);else if((n.subtreeFlags&33554432)!==0)for(n=n.child;n!==null;)dc(n),n=n.sibling;else pd(n)}function Bv(n){for(n=n.child;n!==null;)n.tag===30?wi(n.child,!1):(n.subtreeFlags&33554432)!==0&&Bv(n),n=n.sibling}function gd(n,i,l,o,d,m,b){for(var C=!1;i!==null;){if(i.tag===5){var B=i.stateNode;if(m!==null&&jn<m.length){var X=m[jn],ne=Wd(B);(X.view||ne.view)&&(C=!0);var de;if(de=(n.flags&4)===0)if(ne.clip)de=!0;else{de=X.rect;var $=ne.rect;de=de.y!==$.y||de.x!==$.x||de.height!==$.height||de.width!==$.width}de&&(n.flags|=4),ne.abs?ne=!X.abs:(X=X.rect,ne=ne.rect,ne=X.height!==ne.height||X.width!==ne.width),ne&&(n.flags|=32)}else n.flags|=32;(n.flags&4)!==0&&Ay(B,jn===0?l:l+"_"+jn,d),C&&(n.flags&4)!==0||(xi===null&&(xi=[]),xi.push(B,jn===0?o:o+"_"+jn,i.memoizedProps)),jn++}else(i.tag!==22||i.memoizedState===null)&&(i.tag===30&&b?n.flags|=i.flags&32:gd(n,i.child,l,o,d,m,b)&&(C=!0));i=i.sibling}return C}function Lv(n,i){for(n=n.child;n!==null;){if(n.tag===30){var l=n.memoizedProps,o=n.stateNode,d=$i(l,o),m=Vi(l.default,l.update),b;b=n.memoizedState,n.memoizedState=null,o=n;var C=n.child;jn=0,d=gd(o,C,d,d,m,b,!1),(n.flags&4)!==0&&d&&al(n,l.onUpdate)}else(n.subtreeFlags&33554432)!==0&&Lv(n);n=n.sibling}}var Gt=!1,ut=!1,Ci=!1,_d=!1,zv=typeof WeakSet=="function"?WeakSet:Set,Qt=null,ki=!1,da=!1,fc=!1,vd=!1;function ek(n,i,l){if(n=n.containerInfo,Fd=_l,n=Pg(n),sh(n)){if("selectionStart"in n)var o={start:n.selectionStart,end:n.selectionEnd};else e:{o=(o=n.ownerDocument)&&o.defaultView||window;var d=o.getSelection&&o.getSelection();if(d&&d.rangeCount!==0){o=d.anchorNode;var m=d.anchorOffset,b=d.focusNode;d=d.focusOffset;try{o.nodeType,b.nodeType}catch{o=null;break e}var C=0,B=-1,X=-1,ne=0,de=0,$=n,te=null;t:for(;;){for(var Ce;$!==o||m!==0&&$.nodeType!==3||(B=C+m),$!==b||d!==0&&$.nodeType!==3||(X=C+d),$.nodeType===3&&(C+=$.nodeValue.length),(Ce=$.firstChild)!==null;)te=$,$=Ce;for(;;){if($===n)break t;if(te===o&&++ne===m&&(B=C),te===b&&++de===d&&(X=C),(Ce=$.nextSibling)!==null)break;$=te,te=$.parentNode}$=Ce}o=B===-1||X===-1?null:{start:B,end:X}}else o=null}o=o||{start:0,end:0}}else o=null;for($d={focusedElem:n,selectionRange:o},_l=!1,l=(l&335544064)===l,Qt=i,i=l?9270:1024;Qt!==null;){if(n=Qt,l&&(o=n.deletions,o!==null))for(m=0;m<o.length;m++)l&&md(o[m]);if(n.alternate===null&&(n.flags&2)!==0)l&&Mv(n),mc(l);else{if(n.tag===22){if(o=n.alternate,n.memoizedState!==null){o!==null&&o.memoizedState===null&&l&&md(o),mc(l);continue}else if(o!==null&&o.memoizedState!==null){l&&Mv(n),mc(l);continue}}o=n.child,(n.subtreeFlags&i)!==0&&o!==null?(o.return=n,Qt=o):(l&&Ov(n),mc(l))}}Un=null}function mc(n){for(;Qt!==null;){var i=Qt,l=n,o=i.alternate,d=i.flags;switch(i.tag){case 0:case 11:case 15:break;case 1:if((d&1024)!==0&&o!==null){l=void 0,d=o.memoizedProps,o=o.memoizedState;var m=i.stateNode;try{var b=cr(i.type,d);l=m.getSnapshotBeforeUpdate(b,o),m.__reactInternalSnapshotBeforeUpdate=l}catch(C){dt(i,i.return,C)}}break;case 3:if((d&1024)!==0){if(o=i.stateNode.containerInfo,l=o.nodeType,l===9)Qd(o);else if(l===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":Qd(o);break;default:o.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:l&&o!==null&&(l=$i(o.memoizedProps,o.stateNode),d=i.memoizedProps,d=Vi(d.default,d.update),d!=="none"&&Jr(o,l,d,o.memoizedState=[],!0));break;default:if((d&1024)!==0)throw Error(r(163))}if(o=i.sibling,o!==null){o.return=i.return,Qt=o;break}Qt=i.return}}function Hv(n,i,l){var o=l.flags;switch(l.tag){case 0:case 11:case 15:Ni(n,l),o&4&&ua(5,l);break;case 1:if(Ni(n,l),o&4)if(n=l.stateNode,i===null)try{n.componentDidMount()}catch(b){dt(l,l.return,b)}else{var d=cr(l.type,i.memoizedProps);i=i.memoizedState;try{n.componentDidUpdate(d,i,n.__reactInternalSnapshotBeforeUpdate)}catch(b){dt(l,l.return,b)}}o&64&&Nv(l),o&512&&bi(l,l.return);break;case 3:if(Ni(n,l),o&64&&(n=l.updateQueue,n!==null)){if(i=null,l.child!==null)switch(l.child.tag){case 27:case 5:i=l.child.stateNode;break;case 1:i=l.child.stateNode}try{p_(n,i)}catch(b){dt(l,l.return,b)}}break;case 27:i===null&&o&4&&Dv(l);case 26:case 5:Ni(n,l),i===null&&o&4&&od(l),o&512&&bi(l,l.return);break;case 12:Ni(n,l);break;case 31:Ni(n,l),o&4&&qv(n,l);break;case 13:Ni(n,l),o&4&&Fv(n,l),o&64&&(n=l.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(l=dk.bind(null,l),Kk(n,l))));break;case 22:if(o=l.memoizedState!==null||Gt,!o){var m=i!==null&&i.memoizedState!==null||ut;i=Gt,d=ut,Gt=o,(ut=m)&&!d?(o=2,(l.subtreeFlags&8772)!==0&&(o|=1),fi(n,l,o)):Ni(n,l),Gt=i,ut=d}break;case 30:Ni(n,l),o&512&&bi(l,l.return);break;case 7:o&512&&bi(l,l.return);default:Ni(n,l)}}function yd(n,i){for(n=n.child;n!==null;)Iv(n,i),n=n.sibling}function Iv(n,i){switch(n.tag){case 5:case 26:try{var l=n.stateNode;if(i){var o=l.style;typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"}else{var d=n.stateNode,m=n.memoizedProps.style,b=m!=null&&m.hasOwnProperty("display")?m.display:null;d.style.display=b==null||typeof b=="boolean"?"":(""+b).trim()}}catch(B){dt(n,n.return,B)}Sd(n,i);break;case 6:try{n.stateNode.nodeValue=i?"":n.memoizedProps,lt=!0}catch(B){dt(n,n.return,B)}break;case 18:try{var C=n.stateNode;i?My(C,!0):My(n.stateNode,!1)}catch(B){dt(n,n.return,B)}break;case 22:case 23:n.memoizedState===null&&yd(n,i);break;default:yd(n,i)}}function Sd(n,i){if(n.subtreeFlags&67108864)for(n=n.child;n!==null;){e:{var l=n,o=i;switch(l.tag){case 4:Iv(l,o);break e;case 22:l.memoizedState===null&&Sd(l,o);break e;default:Sd(l,o)}}n=n.sibling}}function Uv(n){var i=n.alternate;i!==null&&(n.alternate=null,Uv(i)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(i=n.stateNode,i!==null&&yo(i)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var wt=null,Tn=!1;function hi(n,i,l){for(l=l.child;l!==null;)Pv(n,i,l),l=l.sibling}function Pv(n,i,l){if(Bn&&typeof Bn.onCommitFiberUnmount=="function")try{Bn.onCommitFiberUnmount(Bl,l)}catch{}switch(l.tag){case 26:ut||cn(l,i),hi(n,i,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&!ut&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:ut||cn(l,i),ha(l);var o=wt,d=Tn;Ts(l.type)&&(wt=l.stateNode,Tn=!1),hi(n,i,l),Vy(l.stateNode,l.type,l.memoizedProps),wt=o,Tn=d;break;case 5:ut||cn(l,i),ha(l);case 6:if(l.tag===6&&ha(l),o=wt,d=Tn,wt=null,hi(n,i,l),wt=o,Tn=d,wt!==null)if(Tn)try{(wt.nodeType===9?wt.body:wt.nodeName==="HTML"?wt.ownerDocument.body:wt).removeChild(l.stateNode),lt=!0}catch(m){dt(l,i,m)}else try{wt.removeChild(l.stateNode),lt=!0}catch(m){dt(l,i,m)}break;case 18:wt!==null&&(Tn?(n=wt,Dy(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,l.stateNode),vl(n)):Dy(wt,l.stateNode));break;case 4:o=wt,d=Tn,wt=l.stateNode.containerInfo,Tn=!0,hi(n,i,l),wt=o,Tn=d;break;case 0:case 11:case 14:case 15:xs(2,l,i),ut||xs(4,l,i),hi(n,i,l);break;case 1:ut||(cn(l,i),o=l.stateNode,typeof o.componentWillUnmount=="function"&&Ev(l,i,o)),hi(n,i,l);break;case 21:hi(n,i,l);break;case 22:ut=(o=ut)||l.memoizedState!==null,hi(n,i,l),ut=o;break;case 30:cn(l,i),hi(n,i,l);break;case 7:ut||cn(l,i),hi(n,i,l);break;default:hi(n,i,l)}}function qv(n,i){if(i.memoizedState===null&&(n=i.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{vl(n)}catch(l){dt(i,i.return,l)}}}function Fv(n,i){if(i.memoizedState===null&&(n=i.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{vl(n)}catch(l){dt(i,i.return,l)}}function tk(n){switch(n.tag){case 31:case 13:case 19:var i=n.stateNode;return i===null&&(i=n.stateNode=new zv),i;case 22:return n=n.stateNode,i=n._retryCache,i===null&&(i=n._retryCache=new zv),i;default:throw Error(r(435,n.tag))}}function pc(n,i){var l=tk(n);i.forEach(function(o){if(!l.has(o)){l.add(o);var d=fk.bind(null,n,o);o.then(d,d)}})}function bn(n,i,l){var o=i.deletions;if(o!==null)for(var d=0;d<o.length;d++){var m=o[d],b=n,C=i,B=C;e:for(;B!==null;){switch(B.tag){case 27:if(Ts(B.type)){wt=B.stateNode,Tn=!1;break e}break;case 5:wt=B.stateNode,Tn=!1;break e;case 3:case 4:wt=B.stateNode.containerInfo,Tn=!0;break e}B=B.return}if(wt===null)throw Error(r(160));Pv(b,C,m),wt=null,Tn=!1,b=m.alternate,b!==null&&(b.return=null),m.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)$v(i,n,l),i=i.sibling}var di=null;function $v(n,i,l){var o=n.alternate,d=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:if(d&4&&(o=n.updateQueue,o=o!==null?o.events:null,o!==null))for(var m=0;m<o.length;m++){var b=o[m];b.ref.impl=b.nextImpl}bn(i,n,l),xn(n),d&4&&(xs(3,n,n.return),ua(3,n),xs(5,n,n.return));break;case 1:bn(i,n,l),xn(n),d&512&&(ut||o===null||cn(o,o.return)),d&64&&Gt&&(n=n.updateQueue,n!==null&&(i=n.callbacks,i!==null&&(l=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=l===null?i:l.concat(i))));break;case 26:if(m=di,bn(i,n,l),xn(n),d&512&&(ut||o===null||cn(o,o.return)),d&4)if(d=o!==null?o.memoizedState:null,l=n.memoizedState,o===null)if(l===null)if(n.stateNode===null)if(Gt)n.stateNode=Ey(n.type,n.memoizedProps,i.containerInfo,n);else{e:{i=n.type,l=n.memoizedProps,d=m.ownerDocument||m;t:switch(i){case"title":o=d.getElementsByTagName("title")[0],(!o||o[Hl]||o[rn]||o.namespaceURI==="http://www.w3.org/2000/svg"||o.hasAttribute("itemprop"))&&(o=d.createElement(i),d.head.insertBefore(o,d.querySelector("head > title"))),un(o,i,l),o[rn]=n,Wt(o),i=o;break e;case"link":if(m=Qy("link","href",d).get(i+(l.href||""))){for(b=0;b<m.length;b++)if(o=m[b],o.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&o.getAttribute("rel")===(l.rel==null?null:l.rel)&&o.getAttribute("title")===(l.title==null?null:l.title)&&o.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){m.splice(b,1);break t}}o=d.createElement(i),un(o,i,l),d.head.appendChild(o);break;case"meta":if(m=Qy("meta","content",d).get(i+(l.content||""))){for(b=0;b<m.length;b++)if(o=m[b],o.getAttribute("content")===(l.content==null?null:""+l.content)&&o.getAttribute("name")===(l.name==null?null:l.name)&&o.getAttribute("property")===(l.property==null?null:l.property)&&o.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&o.getAttribute("charset")===(l.charSet==null?null:l.charSet)){m.splice(b,1);break t}}o=d.createElement(i),un(o,i,l),d.head.appendChild(o);break;default:throw Error(r(468,i))}o[rn]=n,Wt(o),i=o}n.stateNode=i}else Gt||rf(m,n.type,n.stateNode);else n.stateNode=Gy(m,l,n.memoizedProps);else d!==l?(d===null?(i=o.stateNode,i===null||ut||i.parentNode.removeChild(i)):d.count--,l===null?Gt||rf(m,n.type,n.stateNode):Gy(m,l,n.memoizedProps)):l===null&&n.stateNode!==null&&cd(n,n.memoizedProps,o.memoizedProps);break;case 27:bn(i,n,l),xn(n),d&512&&(ut||o===null||cn(o,o.return)),o!==null&&d&4&&cd(n,n.memoizedProps,o.memoizedProps);break;case 5:if(m=Ci,Ci=!1,bn(i,n,l),Ci=m,xn(n),d&512&&(ut||o===null||cn(o,o.return)),n.flags&32){i=n.stateNode;try{Br(i,""),lt=!0}catch(ne){dt(n,n.return,ne)}}d&4&&n.stateNode!=null&&(i=n.memoizedProps,cd(n,i,o!==null?o.memoizedProps:i)),d&1024&&(_d=!0);break;case 6:if(bn(i,n,l),xn(n),d&4){if(n.stateNode===null)throw Error(r(162));i=n.memoizedProps,l=n.stateNode;try{l.nodeValue=i,lt=!0}catch(ne){dt(n,n.return,ne)}}break;case 3:if(lt=!1,Dc=null,m=di,di=ba(i.containerInfo),bn(i,n,l),di=m,xn(n),d&4&&o!==null&&o.memoizedState.isDehydrated)try{vl(i.containerInfo)}catch(ne){dt(n,n.return,ne)}_d&&(_d=!1,Vv(n)),lt=!1;break;case 4:d=Ci,Ci=Gt,o=hg(),m=di,di=ba(n.stateNode.containerInfo),bn(i,n,l),xn(n),di=m,lt&&da&&(fc=!0),lt=o,Ci=d;break;case 12:bn(i,n,l),xn(n);break;case 31:bn(i,n,l),xn(n),d&4&&(i=n.updateQueue,i!==null&&(n.updateQueue=null,pc(n,i)));break;case 13:bn(i,n,l),xn(n),n.child.flags&8192&&n.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(vc=sn()),d&4&&(i=n.updateQueue,i!==null&&(n.updateQueue=null,pc(n,i)));break;case 22:m=n.memoizedState!==null,b=o!==null&&o.memoizedState!==null;var C=Gt,B=ut,X=Ci;Gt=C||m,Ci=X||m,ut=B||b,bn(i,n,l),ut=B,Ci=X,Gt=C,xn(n),d&8192&&(i=n.stateNode,i._visibility=m?i._visibility&-2:i._visibility|1,!m||o===null||b||Gt||ut||(i=b||ut,l=Gt,o=ut,Gt=m||Gt,ut=i,ws(n,2),Gt=l,ut=o),!m&&Ci||yd(n,m)),d&4&&(i=n.updateQueue,i!==null&&(l=i.retryQueue,l!==null&&(i.retryQueue=null,pc(n,l))));break;case 19:bn(i,n,l),xn(n),d&4&&(i=n.updateQueue,i!==null&&(n.updateQueue=null,pc(n,i)));break;case 30:d&512&&(ut||o===null||cn(o,o.return)),d=hg(),m=da,b=(l&335544064)===l,C=n.memoizedProps,da=b&&Vi(C.default,C.update)!=="none",bn(i,n,l),xn(n),b&&o!==null&<&&(n.flags|=4),da=m,lt=d;break;case 21:break;case 7:d&512&&(ut||o===null||cn(o,o.return)),o&&o.stateNode!==null&&(o.stateNode._fragmentFiber=n);default:bn(i,n,l),xn(n)}}function xn(n){var i=n.flags;if(i&2){try{for(var l,o=n.return;o!==null;){if(Tv(o)){l=o;break}o=o.return}o=null;for(var d=n.return;d!==null;){if(ad(d)){var m=d.stateNode;o===null?o=[m]:o.push(m)}if(ld(d))break;d=d.return}var b=o;if(l==null)throw Error(r(160));switch(l.tag){case 27:var C=l.stateNode,B=ud(n);cc(n,B,C,b);break;case 5:var X=l.stateNode;l.flags&32&&(Br(X,""),l.flags&=-33);var ne=ud(n);cc(n,ne,X,b);break;case 3:case 4:var de=l.stateNode.containerInfo,$=ud(n);hd(n,$,de,b);break;default:throw Error(r(161))}}catch(te){dt(n,n.return,te)}n.flags&=-3}i&4096&&(n.flags&=-4097)}function Vv(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var i=n;Vv(i),i.tag===5&&i.flags&1024&&(i=i.stateNode,_l=!0,i.reset(),_l=!1),n=n.sibling}}function el(n,i){if(i.subtreeFlags&9270)for(i=i.child;i!==null;)Yv(i,n),i=i.sibling;else Lv(i)}function Yv(n,i){var l=n.alternate;if(l===null)dd(n,!1);else switch(n.tag){case 3:if(vd=ki=!1,Av(),el(i,n),!ki&&!fc){if(n=xi,n!==null)for(var o=0;o<n.length;o+=3){l=n[o];var d=n[o+1];Ry(l,n[o+2]),l=l.ownerDocument.documentElement,l!==null&&l.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+d+")"})}n=i.containerInfo,n=n.nodeType===9?n.documentElement:n.ownerDocument.documentElement,n!==null&&n.style.viewTransitionName===""&&(n.style.viewTransitionName="none",n.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group(root)"}),n.animate({width:[0,0],height:[0,0]},{duration:0,fill:"forwards",pseudoElement:"::view-transition"})),vd=!0}xi=null;break;case 5:el(i,n);break;case 4:o=ki,ki=!1,el(i,n),ki&&(fc=!0),ki=o;break;case 22:n.memoizedState===null&&(l.memoizedState!==null?dd(n,!1):el(i,n));break;case 30:o=ki,d=Av(),ki=!1,el(i,n),ki&&(n.flags|=4);var m=n.memoizedProps,b=n.stateNode;i=$i(m,b),b=$i(l.memoizedProps,b);var C=Vi(m.default,m.update);C==="none"?i=!1:(m=l.memoizedState,l.memoizedState=null,l=n.child,jn=0,i=gd(n,l,i,b,C,m,!0),jn!==(m===null?0:m.length)&&(n.flags|=32)),(n.flags&4)!==0&&i?(al(n,n.memoizedProps.onUpdate),xi=d):d!==null&&(d.push.apply(d,xi),xi=d),ki=(n.flags&32)!==0?!0:o;break;default:el(i,n)}}function Ni(n,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)Hv(n,i.alternate,i),i=i.sibling}function ws(n,i){for(n=n.child;n!==null;){var l=n,o=i;switch(l.tag){case 0:case 11:case 14:case 15:xs(4,l,l.return),ws(l,o);break;case 1:cn(l,l.return);var d=l.stateNode;typeof d.componentWillUnmount=="function"&&Ev(l,l.return,d),ws(l,o);break;case 27:(o&2)!==0&&Vy(l.stateNode,l.type,l.memoizedProps);case 5:cn(l,l.return),l.tag!==5&&l.tag!==27||ha(l),ws(l,o);break;case 6:ha(l);break;case 26:cn(l,l.return),d=l.stateNode,l.memoizedState!==null||d===null||ut||d.parentNode.removeChild(d),ws(l,o);break;case 22:l.memoizedState===null&&ws(l,o);break;case 30:cn(l,l.return),ws(l,o);break;case 7:cn(l,l.return);default:ws(l,o)}n=n.sibling}}function fi(n,i,l){for(l=(i.subtreeFlags&8772)!==0?l:l&-2,i=i.child;i!==null;){var o=i.alternate,d=n,m=i,b=m.flags,C=(l&1)!==0;switch(m.tag){case 0:case 11:case 15:fi(d,m,l),ua(4,m);break;case 1:if(fi(d,m,l),o=m,d=o.stateNode,typeof d.componentDidMount=="function")try{d.componentDidMount()}catch(ne){dt(o,o.return,ne)}if(o=m,d=o.updateQueue,d!==null){var B=o.stateNode;try{var X=d.shared.hiddenCallbacks;if(X!==null)for(d.shared.hiddenCallbacks=null,d=0;d<X.length;d++)m_(X[d],B)}catch(ne){dt(o,o.return,ne)}}C&&b&64&&Nv(m),bi(m,m.return);break;case 27:(l&2)!==0&&Dv(m);case 5:m.tag!==5&&m.tag!==27||jv(m),fi(d,m,l),C&&o===null&&b&4&&od(m),bi(m,m.return);break;case 6:jv(m);break;case 26:B=m.stateNode,m.memoizedState!==null||B===null||Gt||rf(ba(B.ownerDocument),m.type,B),fi(d,m,l),C&&o===null&&b&4&&od(m),bi(m,m.return);break;case 12:fi(d,m,l);break;case 31:fi(d,m,l),C&&b&4&&qv(d,m);break;case 13:fi(d,m,l),C&&b&4&&Fv(d,m);break;case 22:m.memoizedState===null&&fi(d,m,l),bi(m,m.return);break;case 30:fi(d,m,l),bi(m,m.return);break;case 7:bi(m,m.return);default:fi(d,m,l)}i=i.sibling}}function bd(n,i){var l=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(l=n.memoizedState.cachePool.pool),n=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(n=i.memoizedState.cachePool.pool),n!==l&&(n!=null&&n.refCount++,l!=null&&Ql(l))}function xd(n,i){n=null,i.alternate!==null&&(n=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==n&&(i.refCount++,n!=null&&Ql(n))}function ni(n,i,l,o){var d=(l&335544064)===l;if(i.subtreeFlags&(d?10262:10256))for(i=i.child;i!==null;)Kv(n,i,l,o),i=i.sibling;else d&&Bv(i)}function Kv(n,i,l,o){var d=(l&335544064)===l;d&&i.alternate===null&&i.return!==null&&i.return.alternate!==null&&dc(i);var m=i.flags;switch(i.tag){case 0:case 11:case 15:ni(n,i,l,o),m&2048&&ua(9,i);break;case 1:ni(n,i,l,o);break;case 3:ni(n,i,l,o),d&&vd&&(n=n.containerInfo,n=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,n.style.viewTransitionName==="root"&&(n.style.viewTransitionName=""),n=n.ownerDocument.documentElement,n!==null&&n.style.viewTransitionName==="none"&&(n.style.viewTransitionName="")),m&2048&&(m=null,i.alternate!==null&&(m=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==m&&(i.refCount++,m!=null&&Ql(m)));break;case 12:if(m&2048){ni(n,i,l,o),m=i.stateNode;try{var b=i.memoizedProps,C=b.id,B=b.onPostCommit;typeof B=="function"&&B(C,i.alternate===null?"mount":"update",m.passiveEffectDuration,-0)}catch(X){dt(i,i.return,X)}}else ni(n,i,l,o);break;case 31:ni(n,i,l,o);break;case 13:ni(n,i,l,o);break;case 23:break;case 22:b=i.stateNode,C=i.alternate,i.memoizedState!==null?(d&&C!==null&&C.memoizedState===null&&dc(C),b._visibility&2?ni(n,i,l,o):fa(n,i)):(d&&C!==null&&C.memoizedState!==null&&dc(i),b._visibility&2?ni(n,i,l,o):(b._visibility|=2,tl(n,i,l,o,(i.subtreeFlags&10256)!==0||!1))),m&2048&&bd(C,i);break;case 24:ni(n,i,l,o),m&2048&&xd(i.alternate,i);break;case 30:d&&(m=i.alternate,m!==null&&(wi(m.child,!0),wi(i.child,!0))),ni(n,i,l,o);break;default:ni(n,i,l,o)}}function tl(n,i,l,o,d){for(d=d&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var m=n,b=i,C=l,B=o,X=b.flags;switch(b.tag){case 0:case 11:case 15:tl(m,b,C,B,d),ua(8,b);break;case 23:break;case 22:var ne=b.stateNode;b.memoizedState!==null?ne._visibility&2?tl(m,b,C,B,d):fa(m,b):(ne._visibility|=2,tl(m,b,C,B,d)),d&&X&2048&&bd(b.alternate,b);break;case 24:tl(m,b,C,B,d),d&&X&2048&&xd(b.alternate,b);break;default:tl(m,b,C,B,d)}i=i.sibling}}function fa(n,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var l=n,o=i,d=o.flags;switch(o.tag){case 22:fa(l,o),d&2048&&bd(o.alternate,o);break;case 24:fa(l,o),d&2048&&xd(o.alternate,o);break;default:fa(l,o)}i=i.sibling}}var ur=8192;function hr(n,i,l){if(n.subtreeFlags&ur)for(n=n.child;n!==null;)Wv(n,i,l),n=n.sibling}function Wv(n,i,l){switch(n.tag){case 26:hr(n,i,l),n.flags&ur&&(n.memoizedState!==null?aN(l,di,n.memoizedState,n.memoizedProps):(n=n.stateNode,(i&335544128)===i&&t0(l,n)));break;case 5:hr(n,i,l),n.flags&ur&&(n=n.stateNode,(i&335544128)===i&&t0(l,n));break;case 3:case 4:var o=di;di=ba(n.stateNode.containerInfo),hr(n,i,l),di=o;break;case 22:n.memoizedState===null&&(o=n.alternate,o!==null&&o.memoizedState!==null?(o=ur,ur=16777216,hr(n,i,l),ur=o):hr(n,i,l));break;case 30:if((n.flags&ur)!==0&&(o=n.memoizedProps.name,o!=null&&o!=="auto")){var d=n.stateNode;d.paired=null,Un===null&&(Un=new Map),Un.set(o,d)}hr(n,i,l);break;default:hr(n,i,l)}}function Xv(n){var i=n.alternate;if(i!==null&&(n=i.child,n!==null)){i.child=null;do i=n.sibling,n.sibling=null,n=i;while(n!==null)}}function ma(n){var i=n.deletions;if((n.flags&16)!==0){if(i!==null)for(var l=0;l<i.length;l++){var o=i[l];Qt=o,Qv(o,n)}Xv(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Gv(n),n=n.sibling}function Gv(n){switch(n.tag){case 0:case 11:case 15:ma(n),n.flags&2048&&xs(9,n,n.return);break;case 3:ma(n);break;case 12:ma(n);break;case 22:var i=n.stateNode;n.memoizedState!==null&&i._visibility&2&&(n.return===null||n.return.tag!==13)?(i._visibility&=-3,gc(n)):ma(n);break;default:ma(n)}}function gc(n){var i=n.deletions;if((n.flags&16)!==0){if(i!==null)for(var l=0;l<i.length;l++){var o=i[l];Qt=o,Qv(o,n)}Xv(n)}for(n=n.child;n!==null;){switch(i=n,i.tag){case 0:case 11:case 15:xs(8,i,i.return),gc(i);break;case 22:l=i.stateNode,l._visibility&2&&(l._visibility&=-3,gc(i));break;default:gc(i)}n=n.sibling}}function Qv(n,i){for(;Qt!==null;){var l=Qt;switch(l.tag){case 0:case 11:case 15:xs(8,l,i);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var o=l.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:Ql(l.memoizedState.cache)}if(o=l.child,o!==null)o.return=l,Qt=o;else e:for(l=n;Qt!==null;){o=Qt;var d=o.sibling,m=o.return;if(Uv(o),o===l){Qt=null;break e}if(d!==null){d.return=m,Qt=d;break e}Qt=m}}}var nk={getCacheForType:function(n){var i=ln(zt),l=i.data.get(n);return l===void 0&&(l=n(),i.data.set(n,l)),l},cacheSignal:function(){return ln(zt).controller.signal}},ik=typeof WeakMap=="function"?WeakMap:Map,ct=0,_t=null,Ze=null,et=0,ht=0,Pn=null,Cs=!1,nl=!1,wd=!1,es=0,Dt=0,ks=0,dr=0,_c=0,qn=0,il=0,pa=null,Dn=null,Cd=!1,vc=0,Zv=0,yc=1/0,Sc=null,Ns=null,Nt=0,mi=null,fr=null,Ei=0,kd=0,Nd=null,Jv=null,sl=null,rl=null,ll=null,ga=0,bc=null;function Fn(){return(ct&2)!==0&&et!==0?et&-et:se.T!==null?Ld():ng()}function ey(){if(qn===0)if((et&536870912)===0||Ve){var n=po;po<<=1,(po&3932160)===0&&(po=262144),qn=n}else qn=536870912;return n=an.current,n!==null&&(n.flags|=32),qn}function al(n,i){if(i!=null){var l=n.stateNode,o=l.ref;o===null&&(o=l.ref=Oy($i(n.memoizedProps,l))),rl===null&&(rl=[]),rl.push(i.bind(null,o))}}function Mn(n,i,l){(n===_t&&(ht===2||ht===9)||n.cancelPendingCommit!==null)&&(ol(n,0),Es(n,et,qn,!1)),zl(n,l),((ct&2)===0||n!==_t)&&(n===_t&&((ct&2)===0&&(dr|=l),Dt===4&&Es(n,et,qn,!1)),ji(n))}function ty(n,i,l){if((ct&6)!==0)throw Error(r(327));var o=!l&&(i&127)===0&&(i&n.expiredLanes)===0||Ll(n,i),d=o?lk(n,i):jd(n,i,!0),m=o;do{if(d===0){nl&&!o&&Es(n,i,0,!1);break}else{if(l=n.current.alternate,m&&!sk(l)){d=jd(n,i,!1),m=!1;continue}if(d===2){if(m=i,n.errorRecoveryDisabledLanes&m)var b=0;else b=n.pendingLanes&-536870913,b=b!==0?b:b&536870912?536870912:0;if(b!==0){i=b;e:{var C=n;d=pa;var B=C.current.memoizedState.isDehydrated;if(B&&(ol(C,b).flags|=256),b=jd(C,b,!1),b!==2&&b!==6){if(wd&&!B){C.errorRecoveryDisabledLanes|=m,dr|=m,d=4;break e}m=Dn,Dn=d,m!==null&&(Dn===null?Dn=m:Dn.push.apply(Dn,m))}d=b}if(m=!1,d!==2)continue}}if(d===1){ol(n,0),Es(n,i,0,!0);break}e:{switch(o=n,m=d,m){case 0:case 1:throw Error(r(345));case 4:if((i&4194048)!==i&&(i&62914560)!==i)break;case 6:Es(o,i,qn,!Cs);break e;case 2:Dn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((i&62914560)===i&&(d=vc+300-sn(),10<d)){if(Es(o,i,qn,!Cs),_o(o,0,!0)!==0)break e;Ei=i,o.timeoutHandle=Kd(ny.bind(null,o,l,Dn,Sc,Cd,i,qn,dr,il,Cs,m,"Throttled",-0,0),d);break e}ny(o,l,Dn,Sc,Cd,i,qn,dr,il,Cs,m,null,-0,0)}}break}while(!0);ji(n)}function ny(n,i,l,o,d,m,b,C,B,X,ne,de,$,te){n.timeoutHandle=-1;var Ce=i.subtreeFlags,De=(m&335544064)===m;if(de=null,(De||Ce&8192||(Ce&16785408)===16785408)&&(de={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:vi},Un=null,Wv(i,m,de),De&&(Ce=de,De=n.containerInfo,De=(De.nodeType===9?De:De.ownerDocument).__reactViewTransition,De!=null&&(Ce.count++,Ce.waitingForViewTransition=!0,Ce=Ca.bind(Ce),De.finished.then(Ce,Ce))),Ce=(m&62914560)===m?vc-sn():(m&4194048)===m?Zv-sn():0,Ce=oN(de,Ce),Ce!==null)){Ei=m,n.cancelPendingCommit=Ce(uy.bind(null,n,i,m,l,o,d,b,C,B,X,ne,de,null,$,te)),Es(n,m,b,!X);return}uy(n,i,m,l,o,d,b,C,B,X,ne,de)}function sk(n){for(var i=n;;){var l=i.tag;if((l===0||l===11||l===15)&&i.flags&16384&&(l=i.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var o=0;o<l.length;o++){var d=l[o],m=d.getSnapshot;d=d.value;try{if(!Hn(m(),d))return!1}catch{return!1}}if(l=i.child,i.subtreeFlags&16384&&l!==null)l.return=i,i=l;else{if(i===n)break;for(;i.sibling===null;){if(i.return===null||i.return===n)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function Es(n,i,l,o){i=Qp(n,i),i&=~_c,i&=~dr,n.suspendedLanes|=i,n.pingedLanes&=~i,o&&(n.warmLanes|=i),o=n.expirationTimes;for(var d=i;0<d;){var m=31-Ln(d),b=1<<m;o[m]=-1,d&=~b}l!==0&&Jp(n,l,i)}function xc(){return(ct&6)===0?(_a(0),!1):!0}function Ed(){if(Ze!==null){if(ht===0)var n=Ze.return;else n=Ze,Wi=er=null,Bh(n),Wr=null,ea=0,n=Ze;for(;n!==null;)kv(n.alternate,n),n=n.return;Ze=null}}function ol(n,i){var l=n.timeoutHandle;return l!==-1&&(n.timeoutHandle=-1,jk(l)),l=n.cancelPendingCommit,l!==null&&(n.cancelPendingCommit=null,l()),Ei=0,Ed(),_t=n,Ze=l=Yi(n.current,null),et=i,ht=0,Pn=null,Cs=!1,nl=Ll(n,i),wd=!1,il=qn=_c=dr=ks=Dt=0,Dn=pa=null,Cd=!1,es=Qp(n,i),Do(),l}function iy(n,i){Pe=null,se.H=tc,i===Kr||i===Po?(i=u_(),ht=3):i===xh?(i=u_(),ht=4):ht=i===Gh?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,Pn=i,Ze===null&&(Dt=1,nc(n,Zn(i,n.current)))}function sy(){var n=an.current;return n===null?!0:(et&4194048)===et?pn===null:(et&62914560)===et||(et&536870912)!==0?n===pn:!1}function ry(){var n=se.H;return se.H=tc,n===null?tc:n}function ly(){var n=se.A;return se.A=nk,n}function wc(){Dt=4,Cs||(et&4194048)!==et&&an.current!==null||(nl=!0),(ks&134217727)===0&&(dr&134217727)===0||_t===null||Es(_t,et,qn,!1)}function jd(n,i,l){var o=ct;ct|=2;var d=ry(),m=ly();(_t!==n||et!==i)&&(Sc=null,ol(n,i)),i=!1;var b=Dt;e:do try{if(ht!==0&&Ze!==null){var C=Ze,B=Pn;switch(ht){case 8:Ed(),b=6;break e;case 3:case 2:case 9:case 6:an.current===null&&(i=!0);var X=ht;if(ht=0,Pn=null,cl(n,C,B,X),l&&nl){b=0;break e}break;default:X=ht,ht=0,Pn=null,cl(n,C,B,X)}}rk(),b=Dt;break}catch(ne){iy(n,ne)}while(!0);return i&&n.shellSuspendCounter++,Wi=er=null,ct=o,se.H=d,se.A=m,Ze===null&&(_t=null,et=0,Do()),b}function rk(){for(;Ze!==null;)ay(Ze)}function lk(n,i){var l=ct;ct|=2;var o=ry(),d=ly();_t!==n||et!==i?(Sc=null,yc=sn()+500,ol(n,i)):nl=Ll(n,i);e:do try{if(ht!==0&&Ze!==null){i=Ze;var m=Pn;t:switch(ht){case 1:ht=0,Pn=null,cl(n,i,m,1);break;case 2:case 9:if(o_(m)){ht=0,Pn=null,oy(i);break}i=function(){ht!==2&&ht!==9||_t!==n||(ht=7),ji(n)},m.then(i,i);break e;case 3:ht=7;break e;case 4:ht=5;break e;case 7:o_(m)?(ht=0,Pn=null,oy(i)):(ht=0,Pn=null,cl(n,i,m,7));break;case 5:var b=null;switch(Ze.tag){case 26:b=Ze.memoizedState;case 5:case 27:var C=Ze;if(b?Jy(b):C.stateNode.complete){ht=0,Pn=null;var B=C.sibling;if(B!==null)Ze=B;else{var X=C.return;X!==null?(Ze=X,Cc(X)):Ze=null}break t}}ht=0,Pn=null,cl(n,i,m,5);break;case 6:ht=0,Pn=null,cl(n,i,m,6);break;case 8:Ed(),Dt=6;break e;default:throw Error(r(462))}}ak();break}catch(ne){iy(n,ne)}while(!0);return Wi=er=null,se.H=o,se.A=d,ct=l,Ze!==null?0:(_t=null,et=0,Do(),Dt)}function ak(){for(;Ze!==null&&!Vs();)ay(Ze)}function ay(n){var i=wv(n.alternate,n,es);n.memoizedProps=n.pendingProps,i===null?Cc(n):Ze=i}function oy(n){var i=n,l=i.alternate;switch(i.tag){case 15:case 0:i=gv(l,i,i.pendingProps,i.type,void 0,et);break;case 11:i=gv(l,i,i.pendingProps,i.type.render,i.ref,et);break;case 5:Bh(i);var o=i;o===Xt&&(Ve?(Lo(o),o.tag===5&&o.stateNode!=null&&(St=o.stateNode)):(Lo(o),Ve=!0));default:kv(l,i),i=Ze=Qg(i,es),i=wv(l,i,es)}n.memoizedProps=n.pendingProps,i===null?Cc(n):Ze=i}function cl(n,i,l,o){Wi=er=null,Bh(i),Wr=null,ea=0;var d=i.return;try{if(WC(n,d,i,l,et)){Dt=1,nc(n,Zn(l,n.current)),Ze=null;return}}catch(m){if(d!==null)throw Ze=d,m;Dt=1,nc(n,Zn(l,n.current)),Ze=null;return}i.flags&32768?(Ve||o===1?n=!0:nl||(et&536870912)!==0?n=!1:(Cs=n=!0,(o===2||o===9||o===3||o===6)&&(o=an.current,o!==null&&o.tag===13&&(o.flags|=16384))),cy(i,n)):Cc(i)}function Cc(n){var i=n;do{if((i.flags&32768)!==0){cy(i,Cs);return}n=i.return;var l=ZC(i.alternate,i,es);if(l!==null){Ze=l;return}if(i=i.sibling,i!==null){Ze=i;return}Ze=i=n}while(i!==null);Dt===0&&(Dt=5)}function cy(n,i){do{var l=JC(n.alternate,n);if(l!==null){l.flags&=32767,Ze=l;return}if(l=n.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!i&&(n=n.sibling,n!==null)){Ze=n;return}Ze=n=l}while(n!==null);Dt=6,Ze=null}function uy(n,i,l,o,d,m,b,C,B,X,ne,de){n.cancelPendingCommit=null;do kc();while(Nt!==0);if((ct&6)!==0)throw Error(r(327));if(i!==null){if(i===n.current)throw Error(r(177));n===_t&&(Ze=_t=null,et=0),fr=i,mi=n,Ei=l,Nd=d,Jv=o,ok(n,i,l,b,C,B,de)}}function ok(n,i,l,o,d,m,b){var C=i.lanes|i.childLanes;if(kd=C,C|=ch,Ow(n,l,C,o,d,m),rl=null,(l&335544064)===l?(ll=LC(n),o=10262):(ll=null,o=10256),(i.subtreeFlags&o)!==0||(i.flags&o)!==0?(n.callbackNode=null,n.callbackPriority=0,mk(fo,function(){return Ad(),null})):(n.callbackNode=null,n.callbackPriority=0),uc=!1,o=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||o){o=se.T,se.T=null,d=me.p,me.p=2,m=ct,ct|=4;try{ek(n,i,l)}finally{ct=m,me.p=d,se.T=o}}Nt=1,uc?sl=Ok(b,n.containerInfo,ll,Td,Dd,uk,Md,Ad,ck):(Td(),Dd(),Md())}function ck(n){if(Nt!==0){var i=mi.onRecoverableError;i(n,{componentStack:null})}}function uk(){Nt===3&&(Nt=0,Yv(fr,mi),Nt=4)}function Td(){if(Nt===1){Nt=0;var n=mi,i=fr,l=Ei,o=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||o){o=se.T,se.T=null;var d=me.p;me.p=2;var m=ct;ct|=4;try{da=fc=!1,$v(i,n,l),l=$d;var b=Pg(n.containerInfo),C=l.focusedElem,B=l.selectionRange;if(b!==C&&C&&C.ownerDocument&&Ug(C.ownerDocument.documentElement,C)){if(B!==null&&sh(C)){var X=B.start,ne=B.end;if(ne===void 0&&(ne=X),"selectionStart"in C)C.selectionStart=X,C.selectionEnd=Math.min(ne,C.value.length);else{var de=C.ownerDocument||document,$=de&&de.defaultView||window;if($.getSelection){var te=$.getSelection(),Ce=C.textContent.length,De=Math.min(B.start,Ce),qe=B.end===void 0?De:Math.min(B.end,Ce);!te.extend&&De>qe&&(b=qe,qe=De,De=b);var W=Ig(C,De),I=Ig(C,qe);if(W&&I&&(te.rangeCount!==1||te.anchorNode!==W.node||te.anchorOffset!==W.offset||te.focusNode!==I.node||te.focusOffset!==I.offset)){var ee=de.createRange();ee.setStart(W.node,W.offset),te.removeAllRanges(),De>qe?(te.addRange(ee),te.extend(I.node,I.offset)):(ee.setEnd(I.node,I.offset),te.addRange(ee))}}}}for(de=[],te=C;te=te.parentNode;)te.nodeType===1&&de.push({element:te,left:te.scrollLeft,top:te.scrollTop});for(typeof C.focus=="function"&&C.focus(),C=0;C<de.length;C++){var he=de[C];he.element.scrollLeft=he.left,he.element.scrollTop=he.top}}_l=!!Fd,$d=Fd=null}finally{ct=m,me.p=d,se.T=o}}n.current=i,Nt=2}}function Dd(){if(Nt===2){Nt=0;var n=mi,i=fr,l=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||l){l=se.T,se.T=null;var o=me.p;me.p=2;var d=ct;ct|=4;try{Hv(n,i.alternate,i)}finally{ct=d,me.p=o,se.T=l}}Nt=3}}function Md(){if(Nt===4||Nt===3){Nt=0;var n=sl;sl=null,ho();var i=mi,l=fr,o=Ei,d=Jv,m=(o&335544064)===o?10262:10256;if((l.subtreeFlags&m)!==0||(l.flags&m)!==0?Nt=5:(Nt=0,fr=mi=null,hy(i,i.pendingLanes)),m=i.pendingLanes,m===0&&(Ns=null),Uu(o),l=l.stateNode,Bn&&typeof Bn.onCommitFiberRoot=="function")try{Bn.onCommitFiberRoot(Bl,l,void 0,(l.current.flags&128)===128)}catch{}if(d!==null){l=se.T,m=me.p,me.p=2,se.T=null;try{for(var b=i.onRecoverableError,C=0;C<d.length;C++){var B=d[C];b(B.value,{componentStack:B.stack})}}finally{se.T=l,me.p=m}}if(d=rl,b=ll,ll=null,d!==null&&(rl=null,b===null&&(b=[]),n!==null))for(B=0;B<d.length;B++)l=(0,d[B])(b),l!==void 0&&n.finished.finally(l);(Ei&3)!==0&&kc(),ji(i),m=i.pendingLanes,(o&261930)!==0&&(m&42)!==0?i===bc?ga++:(ga=0,bc=i):(ga=0,bc=null),_a(0)}}function hy(n,i){(n.pooledCacheLanes&=i)===0&&(i=n.pooledCache,i!=null&&(n.pooledCache=null,Ql(i)))}function kc(){return sl!==null&&(sl.skipTransition(),sl=null),Td(),Dd(),Md(),Ad()}function Ad(){if(Nt!==5)return!1;var n=mi,i=kd;kd=0;var l=Uu(Ei),o=se.T,d=me.p;try{me.p=32>l?32:l,se.T=null,l=Nd,Nd=null;var m=mi,b=Ei;if(Nt=0,fr=mi=null,Ei=0,(ct&6)!==0)throw Error(r(331));var C=ct;if(ct|=4,Gv(m.current),Kv(m,m.current,b,l),ct=C,_a(0,!1),Bn&&typeof Bn.onPostCommitFiberRoot=="function")try{Bn.onPostCommitFiberRoot(Bl,m)}catch{}return!0}finally{me.p=d,se.T=o,hy(n,i)}}function dy(n,i,l){i=Zn(l,i),i=Xh(n.stateNode,i,2),n=vs(n,i,2),n!==null&&(zl(n,2),ji(n))}function dt(n,i,l){if(n.tag===3)dy(n,n,l);else for(;i!==null;){if(i.tag===3){dy(i,n,l);break}else if(i.tag===1){var o=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(Ns===null||!Ns.has(o))){n=Zn(l,n),l=ov(2),o=vs(i,l,2),o!==null&&(cv(l,o,i,n),zl(o,2),ji(o));break}}i=i.return}}function Rd(n,i,l){var o=n.pingCache;if(o===null){o=n.pingCache=new ik;var d=new Set;o.set(i,d)}else d=o.get(i),d===void 0&&(d=new Set,o.set(i,d));d.has(l)||(wd=!0,d.add(l),n=hk.bind(null,n,i,l),i.then(n,n))}function hk(n,i,l){var o=n.pingCache;o!==null&&o.delete(i),n.pingedLanes|=n.suspendedLanes&l,n.warmLanes&=~l,_t===n&&(et&l)===l&&((Dt===4||Dt===3&&(et&62914560)===et&&300>sn()-vc)&&(ct&2)===0?ol(n,0):_c|=l,il===et&&(il=0)),ji(n)}function fy(n,i){i===0&&(i=Zp()),n=Qs(n,i),n!==null&&(zl(n,i),ji(n))}function dk(n){var i=n.memoizedState,l=0;i!==null&&(l=i.retryLane),fy(n,l)}function fk(n,i){var l=0;switch(n.tag){case 31:case 13:var o=n.stateNode,d=n.memoizedState;d!==null&&(l=d.retryLane);break;case 19:o=n.stateNode;break;case 22:o=n.stateNode._retryCache;break;default:throw Error(r(314))}o!==null&&o.delete(i),fy(n,l)}function mk(n,i){return rt(n,i)}var ul=null,hl=null,Od=!1,Nc=!1,Bd=!1,js=0;function ji(n){n!==hl&&n.next===null&&(hl===null?ul=hl=n:hl=hl.next=n),Nc=!0,Od||(Od=!0,gk())}function _a(n,i){if(!Bd&&Nc){Bd=!0;do for(var l=!1,o=ul;o!==null;){if(n!==0){var d=o.pendingLanes;if(d===0)var m=0;else{var b=o.suspendedLanes,C=o.pingedLanes;m=(1<<31-Ln(42|n)+1)-1,m&=d&~(b&~C),m=m&201326741?m&201326741|1:m?m|2:0}m!==0&&(l=!0,_y(o,m))}else m=et,m=_o(o,o===_t?m:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(m&3)===0||Ll(o,m)||(l=!0,_y(o,m));o=o.next}while(l);Bd=!1}}function pk(){my()}function my(){Nc=Od=!1;var n=0;js!==0&&Ek()&&(n=js);for(var i=sn(),l=null,o=ul;o!==null;){var d=o.next,m=py(o,i);m===0?(o.next=null,l===null?ul=d:l.next=d,d===null&&(hl=l)):(l=o,(n!==0||(m&3)!==0)&&(Nc=!0)),o=d}Nt!==0&&Nt!==5||_a(n),js!==0&&(js=0)}function py(n,i){for(var l=n.suspendedLanes,o=n.pingedLanes,d=n.expirationTimes,m=n.pendingLanes&-62914561;0<m;){var b=31-Ln(m),C=1<<b,B=d[b];B===-1?((C&l)===0||(C&o)!==0)&&(d[b]=Rw(C,i)):B<=i&&(n.expiredLanes|=C),m&=~C}if(i=_t,l=et,l=_o(n,n===i?l:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),o=n.callbackNode,l===0||n===i&&(ht===2||ht===9)||n.cancelPendingCommit!==null)return o!==null&&o!==null&&Ii(o),n.callbackNode=null,n.callbackPriority=0;if((l&3)===0||Ll(n,l)){if(i=l&-l,i===n.callbackPriority)return i;switch(o!==null&&Ii(o),Uu(l)){case 2:case 8:l=Xn;break;case 32:l=fo;break;case 268435456:l=Gp;break;default:l=fo}return o=gy.bind(null,n),l=rt(l,o),n.callbackPriority=i,n.callbackNode=l,i}return o!==null&&o!==null&&Ii(o),n.callbackPriority=2,n.callbackNode=null,2}function gy(n,i){if(Nt!==0&&Nt!==5)return n.callbackNode=null,n.callbackPriority=0,null;var l=n.callbackNode;if(kc()&&n.callbackNode!==l)return null;var o=et;return o=_o(n,n===_t?o:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),o===0?null:(ty(n,o,i),py(n,sn()),n.callbackNode!=null&&n.callbackNode===l?gy.bind(null,n):null)}function _y(n,i){if(kc())return null;ty(n,i,!0)}function gk(){Tk(function(){(ct&6)!==0?rt(Ui,pk):my()})}function Ld(){if(js===0){var n=ir;n===0&&(n=mo,mo<<=1,(mo&261888)===0&&(mo=256)),js=n}return js}function vy(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:xo(n)}function _k(n,i,l,o,d){if(i==="submit"&&l&&l.stateNode===d){var m=vy((d[Nn]||null).action),b=o.submitter;b&&(i=(i=b[Nn]||null)?vy(i.formAction):b.getAttribute("formAction"),i!==null&&(m=i,b=null));var C=new No("action","action",null,o,d);n.push({event:C,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(js!==0){var B=new FormData(d,b);$h(l,{pending:!0,data:B,method:d.method,action:m},null,B)}}else typeof m=="function"&&(C.preventDefault(),B=new FormData(d,b),$h(l,{pending:!0,data:B,method:d.method,action:m},m,B))},currentTarget:d}]})}}for(var zd=0;zd<oh.length;zd++){var Hd=oh[zd],vk=Hd.toLowerCase(),yk=Hd[0].toUpperCase()+Hd.slice(1);ui(vk,"on"+yk)}ui($g,"onAnimationEnd"),ui(Vg,"onAnimationIteration"),ui(Yg,"onAnimationStart"),ui("dblclick","onDoubleClick"),ui("focusin","onFocus"),ui("focusout","onBlur"),ui(jC,"onTransitionRun"),ui(TC,"onTransitionStart"),ui(DC,"onTransitionCancel"),ui(Kg,"onTransitionEnd"),Rr("onMouseEnter",["mouseout","mouseover"]),Rr("onMouseLeave",["mouseout","mouseover"]),Rr("onPointerEnter",["pointerout","pointerover"]),Rr("onPointerLeave",["pointerout","pointerover"]),Ws("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ws("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ws("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ws("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ws("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ws("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var va="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(" "),Sk=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(va));function yy(n,i){i=(i&4)!==0;for(var l=0;l<n.length;l++){var o=n[l],d=o.event;o=o.listeners;e:{var m=void 0;if(i)for(var b=o.length-1;0<=b;b--){var C=o[b],B=C.instance,X=C.currentTarget;if(C=C.listener,B!==m&&d.isPropagationStopped())break e;m=C,d.currentTarget=X;try{m(d)}catch(ne){To(ne)}d.currentTarget=null,m=B}else for(b=0;b<o.length;b++){if(C=o[b],B=C.instance,X=C.currentTarget,C=C.listener,B!==m&&d.isPropagationStopped())break e;m=C,d.currentTarget=X;try{m(d)}catch(ne){To(ne)}d.currentTarget=null,m=B}}}}function Je(n,i){var l=i[sg];l===void 0&&(l=i[sg]=new Set);var o=n+"__bubble";l.has(o)||(Sy(i,n,2,!1),l.add(o))}function Id(n,i,l){var o=0;i&&(o|=4),Sy(l,n,o,i)}var Ec="_reactListening"+Math.random().toString(36).slice(2);function Ud(n){if(!n[Ec]){n[Ec]=!0,ag.forEach(function(l){l!=="selectionchange"&&(Sk.has(l)||Id(l,!1,n),Id(l,!0,n))});var i=n.nodeType===9?n:n.ownerDocument;i===null||i[Ec]||(i[Ec]=!0,Id("selectionchange",!1,i))}}function Sy(n,i,l,o){switch(c0(i)){case 2:var d=dN;break;case 8:d=fN;break;default:d=af}l=d.bind(null,i,l,n),d=void 0,!Wu||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(d=!0),o?d!==void 0?n.addEventListener(i,l,{capture:!0,passive:d}):n.addEventListener(i,l,!0):d!==void 0?n.addEventListener(i,l,{passive:d}):n.addEventListener(i,l,!1)}function Pd(n,i,l,o,d){var m=o;if((i&1)===0&&(i&2)===0&&o!==null)e:for(;;){if(o===null)return;var b=o.tag;if(b===3||b===4){var C=o.stateNode.containerInfo;if(C===d)break;if(b===4)for(b=o.return;b!==null;){var B=b.tag;if((B===3||B===4)&&b.stateNode.containerInfo===d)return;b=b.return}for(;C!==null;){if(b=Ks(C),b===null)return;if(B=b.tag,B===5||B===6||B===26||B===27){o=m=b;continue e}C=C.parentNode}}o=o.return}Sg(function(){var X=m,ne=Yu(l),de=[];e:{var $=Wg.get(n);if($!==void 0){var te=No,Ce=n;switch(n){case"keypress":if(Co(l)===0)break e;case"keydown":case"keyup":te=sC;break;case"focusin":Ce="focus",te=Zu;break;case"focusout":Ce="blur",te=Zu;break;case"beforeblur":case"afterblur":te=Zu;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":te=wg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":te=Yw;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":te=cC;break;case $g:case Vg:case Yg:te=Xw;break;case Kg:te=hC;break;case"scroll":case"scrollend":te=$w;break;case"wheel":te=fC;break;case"copy":case"cut":case"paste":te=Qw;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":te=kg;break;case"submit":te=aC;break;case"toggle":case"beforetoggle":te=pC}var De=(i&4)!==0,qe=!De&&(n==="scroll"||n==="scrollend"),W=De?$!==null?$+"Capture":null:$;De=[];for(var I=X,ee;I!==null;){var he=I;if(ee=he.stateNode,he=he.tag,he!==5&&he!==26&&he!==27||ee===null||W===null||(he=Ul(I,W),he!=null&&De.push(ya(I,he,ee))),qe)break;I=I.return}0<De.length&&($=new te($,Ce,null,l,ne),de.push({event:$,listeners:De}))}}if((i&7)===0){e:{if(te=n==="mouseover"||n==="pointerover",$=n==="mouseout"||n==="pointerout",te&&l!==Vu&&(Ce=l.relatedTarget||l.fromElement)&&(Ks(Ce)||Ce[Dr]))break e;($||te)&&(Ce=ne.window===ne?ne:(te=ne.ownerDocument)?te.defaultView||te.parentWindow:window,$?(te=l.relatedTarget||l.toElement,$=X,te=te?Ks(te):null,te!==null&&(qe=c(te),De=te.tag,te!==qe||De!==5&&De!==27&&De!==6)&&(te=null)):($=null,te=X),$!==te&&(De=wg,he="onMouseLeave",W="onMouseEnter",I="mouse",(n==="pointerout"||n==="pointerover")&&(De=kg,he="onPointerLeave",W="onPointerEnter",I="pointer"),qe=$==null?Ce:Il($),ee=te==null?Ce:Il(te),Ce=new De(he,I+"leave",$,l,ne),Ce.target=qe,Ce.relatedTarget=ee,he=null,Ks(ne)===X&&(De=new De(W,I+"enter",te,l,ne),De.target=ee,De.relatedTarget=qe,he=De),qe=he,De=$&&te?z($,te,bk):null,$!==null&&by(de,Ce,$,De,!1),te!==null&&qe!==null&&by(de,qe,te,De,!0)))}e:{if($=X?Il(X):window,te=$.nodeName&&$.nodeName.toLowerCase(),te==="select"||te==="input"&&$.type==="file")var Te=Rg;else if(Mg($))if(Og)Te=kC;else{Te=wC;var tt=xC}else te=$.nodeName,!te||te.toLowerCase()!=="input"||$.type!=="checkbox"&&$.type!=="radio"?X&&$u(X.elementType)&&(Te=Rg):Te=CC;if(Te&&(Te=Te(n,X))){Ag(de,Te,l,ne);break e}tt&&tt(n,$,X)}switch(tt=X?Il(X):window,n){case"focusin":(Mg(tt)||tt.contentEditable==="true")&&(Ir=tt,rh=X,Wl=null);break;case"focusout":Wl=rh=Ir=null;break;case"mousedown":lh=!0;break;case"contextmenu":case"mouseup":case"dragend":lh=!1,qg(de,l,ne);break;case"selectionchange":if(EC)break;case"keydown":case"keyup":qg(de,l,ne)}var Re;if(eh)e:{switch(n){case"compositionstart":var ze="onCompositionStart";break e;case"compositionend":ze="onCompositionEnd";break e;case"compositionupdate":ze="onCompositionUpdate";break e}ze=void 0}else Hr?Tg(n,l)&&(ze="onCompositionEnd"):n==="keydown"&&l.keyCode===229&&(ze="onCompositionStart");ze&&(Ng&&l.locale!=="ko"&&(Hr||ze!=="onCompositionStart"?ze==="onCompositionEnd"&&Hr&&(Re=bg()):(cs=ne,Xu="value"in cs?cs.value:cs.textContent,Hr=!0)),tt=jc(X,ze),0<tt.length&&(ze=new Cg(ze,n,null,l,ne),de.push({event:ze,listeners:tt}),Re?ze.data=Re:(Re=Dg(l),Re!==null&&(ze.data=Re)))),(Re=_C?vC(n,l):yC(n,l))&&(ze=jc(X,"onBeforeInput"),0<ze.length&&(tt=new Cg("onBeforeInput","beforeinput",null,l,ne),de.push({event:tt,listeners:ze}),tt.data=Re)),_k(de,n,X,l,ne)}yy(de,i)})}function ya(n,i,l){return{instance:n,listener:i,currentTarget:l}}function jc(n,i){for(var l=i+"Capture",o=[];n!==null;){var d=n,m=d.stateNode;if(d=d.tag,d!==5&&d!==26&&d!==27||m===null||(d=Ul(n,l),d!=null&&o.unshift(ya(n,d,m)),d=Ul(n,i),d!=null&&o.push(ya(n,d,m))),n.tag===3)return o;n=n.return}return[]}function bk(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function by(n,i,l,o,d){for(var m=i._reactName,b=[];l!==null&&l!==o;){var C=l,B=C.alternate,X=C.stateNode;if(C=C.tag,B!==null&&B===o)break;C!==5&&C!==26&&C!==27||X===null||(B=X,d?(X=Ul(l,m),X!=null&&b.unshift(ya(l,X,B))):d||(X=Ul(l,m),X!=null&&b.push(ya(l,X,B)))),l=l.return}b.length!==0&&n.push({event:i,listeners:b})}var xk=/\r\n?/g,wk=/\u0000|\uFFFD/g;function xy(n){return(typeof n=="string"?n:""+n).replace(xk,`
|
|
9
|
+
`).replace(wk,"")}function wy(n,i){return i=xy(i),xy(n)===i}function ft(n,i,l,o,d,m){switch(l){case"children":if(typeof o=="string")i==="body"||i==="textarea"&&o===""||Br(n,o);else if(typeof o=="number"||typeof o=="bigint")i!=="body"&&Br(n,""+o);else return;break;case"className":bo(n,"class",o);break;case"tabIndex":bo(n,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":bo(n,l,o);break;case"style":vg(n,o,m);return;case"data":if(i!=="object"){bo(n,"data",o);break}case"src":case"href":if(o===""&&(i!=="a"||l!=="href")){n.removeAttribute(l);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){n.removeAttribute(l);break}o=xo(o),n.setAttribute(l,o);break;case"action":case"formAction":if(typeof o=="function"){n.setAttribute(l,"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 m=="function"&&(l==="formAction"?(i!=="input"&&ft(n,i,"name",d.name,d,null),ft(n,i,"formEncType",d.formEncType,d,null),ft(n,i,"formMethod",d.formMethod,d,null),ft(n,i,"formTarget",d.formTarget,d,null)):(ft(n,i,"encType",d.encType,d,null),ft(n,i,"method",d.method,d,null),ft(n,i,"target",d.target,d,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){n.removeAttribute(l);break}o=xo(o),n.setAttribute(l,o);break;case"onClick":o!=null&&(n.onclick=vi);return;case"onScroll":o!=null&&Je("scroll",n);return;case"onScrollEnd":o!=null&&Je("scrollend",n);return;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(r(61));if(l=o.__html,l!=null){if(d.children!=null)throw Error(r(60));m?.__html!==l&&(n.innerHTML=l)}}break;case"multiple":n.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":n.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){n.removeAttribute("xlink:href");break}l=xo(o),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":o!=null&&typeof o!="function"&&typeof o!="symbol"?n.setAttribute(l,o):n.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"credentialless":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":o&&typeof o!="function"&&typeof o!="symbol"?n.setAttribute(l,""):n.removeAttribute(l);break;case"capture":case"download":o===!0?n.setAttribute(l,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?n.setAttribute(l,o):n.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?n.setAttribute(l,o):n.removeAttribute(l);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?n.removeAttribute(l):n.setAttribute(l,o);break;case"popover":Je("beforetoggle",n),Je("toggle",n),So(n,"popover",o);break;case"xlinkActuate":qi(n,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":qi(n,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":qi(n,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":qi(n,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":qi(n,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":qi(n,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":qi(n,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":qi(n,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":qi(n,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":So(n,"is",o);break;case"innerText":case"textContent":return;default:if(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")l=qw.get(l)||l,So(n,l,o);else return}lt=!0}function qd(n,i,l,o,d,m){switch(l){case"style":vg(n,o,m);return;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(r(61));if(l=o.__html,l!=null){if(d.children!=null)throw Error(r(60));m?.__html!==l&&(n.innerHTML=l)}}break;case"children":if(typeof o=="string")Br(n,o);else if(typeof o=="number"||typeof o=="bigint")Br(n,""+o);else return;break;case"onScroll":o!=null&&Je("scroll",n);return;case"onScrollEnd":o!=null&&Je("scrollend",n);return;case"onClick":o!=null&&(n.onclick=vi);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!og.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(d=l.endsWith("Capture"),m=l.slice(2,d?l.length-7:void 0),i=n[Nn]||null,i=i!=null?i[l]:null,typeof i=="function"&&n.removeEventListener(m,i,d),typeof o=="function")){typeof i!="function"&&i!==null&&(l in n?n[l]=null:n.hasAttribute(l)&&n.removeAttribute(l)),n.addEventListener(m,o,d);break e}lt=!0,l in n?n[l]=o:o===!0?n.setAttribute(l,""):So(n,l,o)}return}lt=!0}function un(n,i,l){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Je("error",n),Je("load",n);var o=!1,d=!1,m;for(m in l)if(l.hasOwnProperty(m)){var b=l[m];if(b!=null)switch(m){case"src":o=!0;break;case"srcSet":d=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,i));default:ft(n,i,m,b,l,null)}}d&&ft(n,i,"srcSet",l.srcSet,l,null),o&&ft(n,i,"src",l.src,l,null);return;case"input":Je("invalid",n);var C=m=b=d=null,B=null,X=null;for(o in l)if(l.hasOwnProperty(o)){var ne=l[o];if(ne!=null)switch(o){case"name":d=ne;break;case"type":b=ne;break;case"checked":B=ne;break;case"defaultChecked":X=ne;break;case"value":m=ne;break;case"defaultValue":C=ne;break;case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(r(137,i));break;default:ft(n,i,o,ne,l,null)}}mg(n,m,C,B,X,b,d,!1);return;case"select":Je("invalid",n),o=b=m=null;for(d in l)if(l.hasOwnProperty(d)&&(C=l[d],C!=null))switch(d){case"value":m=C;break;case"defaultValue":b=C;break;case"multiple":o=C;default:ft(n,i,d,C,l,null)}i=m,l=b,n.multiple=!!o,i!=null?Or(n,!!o,i,!1):l!=null&&Or(n,!!o,l,!0);return;case"textarea":Je("invalid",n),m=d=o=null;for(b in l)if(l.hasOwnProperty(b)&&(C=l[b],C!=null))switch(b){case"value":o=C;break;case"defaultValue":d=C;break;case"children":m=C;break;case"dangerouslySetInnerHTML":if(C!=null)throw Error(r(91));break;default:ft(n,i,b,C,l,null)}gg(n,o,d,m);return;case"option":for(B in l)l.hasOwnProperty(B)&&(o=l[B],o!=null)&&(B==="selected"?n.selected=o&&typeof o!="function"&&typeof o!="symbol":ft(n,i,B,o,l,null));return;case"dialog":Je("beforetoggle",n),Je("toggle",n),Je("cancel",n),Je("close",n);break;case"iframe":case"object":Je("load",n);break;case"video":case"audio":for(o=0;o<va.length;o++)Je(va[o],n);break;case"image":Je("error",n),Je("load",n);break;case"details":Je("toggle",n);break;case"embed":case"source":case"link":Je("error",n),Je("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(X in l)if(l.hasOwnProperty(X)&&(o=l[X],o!=null))switch(X){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,i));default:ft(n,i,X,o,l,null)}return;default:if($u(i)){for(ne in l)l.hasOwnProperty(ne)&&(o=l[ne],o!==void 0&&qd(n,i,ne,o,l,void 0));return}}for(C in l)l.hasOwnProperty(C)&&(o=l[C],o!=null&&ft(n,i,C,o,l,null))}var Ck={};function kk(n,i,l,o){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var d=null,m=null,b=null,C=null,B=null,X=null,ne=null;for(te in l){var de=l[te];if(l.hasOwnProperty(te)&&de!=null)switch(te){case"checked":break;case"value":break;case"defaultValue":B=de;default:o.hasOwnProperty(te)||ft(n,i,te,null,o,de)}}for(var $ in o){var te=o[$];if(de=l[$],o.hasOwnProperty($)&&(te!=null||de!=null))switch($){case"type":te!==de&&(lt=!0),m=te;break;case"name":te!==de&&(lt=!0),d=te;break;case"checked":te!==de&&(lt=!0),X=te;break;case"defaultChecked":te!==de&&(lt=!0),ne=te;break;case"value":te!==de&&(lt=!0),b=te;break;case"defaultValue":te!==de&&(lt=!0),C=te;break;case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(r(137,i));break;default:te!==de&&ft(n,i,$,te,o,de)}}qu(n,b,C,B,X,ne,m,d);return;case"select":te=b=C=$=null;for(m in l)if(B=l[m],l.hasOwnProperty(m)&&B!=null)switch(m){case"value":break;case"multiple":te=B;default:o.hasOwnProperty(m)||ft(n,i,m,null,o,B)}for(d in o)if(m=o[d],B=l[d],o.hasOwnProperty(d)&&(m!=null||B!=null))switch(d){case"value":m!==B&&(lt=!0),$=m;break;case"defaultValue":m!==B&&(lt=!0),C=m;break;case"multiple":m!==B&&(lt=!0),b=m;default:m!==B&&ft(n,i,d,m,o,B)}i=C,l=b,o=te,$!=null?Or(n,!!l,$,!1):!!o!=!!l&&(i!=null?Or(n,!!l,i,!0):Or(n,!!l,l?[]:"",!1));return;case"textarea":te=$=null;for(C in l)if(d=l[C],l.hasOwnProperty(C)&&d!=null&&!o.hasOwnProperty(C))switch(C){case"value":break;case"children":break;default:ft(n,i,C,null,o,d)}for(b in o)if(d=o[b],m=l[b],o.hasOwnProperty(b)&&(d!=null||m!=null))switch(b){case"value":d!==m&&(lt=!0),$=d;break;case"defaultValue":d!==m&&(lt=!0),te=d;break;case"children":break;case"dangerouslySetInnerHTML":if(d!=null)throw Error(r(91));break;default:d!==m&&ft(n,i,b,d,o,m)}pg(n,$,te);return;case"option":for(var Ce in l)$=l[Ce],l.hasOwnProperty(Ce)&&$!=null&&!o.hasOwnProperty(Ce)&&(Ce==="selected"?n.selected=!1:ft(n,i,Ce,null,o,$));for(B in o)$=o[B],te=l[B],o.hasOwnProperty(B)&&$!==te&&($!=null||te!=null)&&(B==="selected"?($!==te&&(lt=!0),n.selected=$&&typeof $!="function"&&typeof $!="symbol"):ft(n,i,B,$,o,te));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 De in l)$=l[De],l.hasOwnProperty(De)&&$!=null&&!o.hasOwnProperty(De)&&ft(n,i,De,null,o,$);for(X in o)if($=o[X],te=l[X],o.hasOwnProperty(X)&&$!==te&&($!=null||te!=null))switch(X){case"children":case"dangerouslySetInnerHTML":if($!=null)throw Error(r(137,i));break;default:ft(n,i,X,$,o,te)}return;default:if($u(i)){for(var qe in l)$=l[qe],l.hasOwnProperty(qe)&&$!==void 0&&!o.hasOwnProperty(qe)&&qd(n,i,qe,void 0,o,$);for(ne in o)$=o[ne],te=l[ne],!o.hasOwnProperty(ne)||$===te||$===void 0&&te===void 0||qd(n,i,ne,$,o,te);return}}for(var W in l)$=l[W],l.hasOwnProperty(W)&&$!=null&&!o.hasOwnProperty(W)&&ft(n,i,W,null,o,$);for(de in o)$=o[de],te=l[de],!o.hasOwnProperty(de)||$===te||$==null&&te==null||ft(n,i,de,$,o,te)}function Cy(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Nk(){if(typeof performance.getEntriesByType=="function"){for(var n=0,i=0,l=performance.getEntriesByType("resource"),o=0;o<l.length;o++){var d=l[o],m=d.transferSize,b=d.initiatorType,C=d.duration;if(m&&C&&Cy(b)){for(b=0,C=d.responseEnd,o+=1;o<l.length;o++){var B=l[o],X=B.startTime;if(X>C)break;var ne=B.transferSize,de=B.initiatorType;ne&&Cy(de)&&(B=B.responseEnd,b+=ne*(B<C?1:(C-X)/(B-X)))}if(--o,i+=8*(m+b)/(d.duration/1e3),n++,10<n)break}}if(0<n)return i/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var Fd=null,$d=null;function Sa(n){return n.nodeType===9?n:n.ownerDocument}function ky(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Ny(n,i){if(n===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&i==="foreignObject"?0:n}function Ey(n,i,l,o){return l=Sa(l).createElement(n),l[rn]=o,l[Nn]=i,un(l,n,i),Wt(l),l}function Vd(n,i){return n==="textarea"||n==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var Yd=null;function Ek(){var n=window.event;return n&&n.type==="popstate"?n===Yd?!1:(Yd=n,!0):(Yd=null,!1)}var Kd=typeof setTimeout=="function"?setTimeout:void 0,jk=typeof clearTimeout=="function"?clearTimeout:void 0,jy=typeof Promise=="function"?Promise:void 0,Ty=typeof requestAnimationFrame=="function"?requestAnimationFrame:Kd,Tk=typeof queueMicrotask=="function"?queueMicrotask:typeof jy<"u"?function(n){return jy.resolve(null).then(n).catch(Dk)}:Kd;function Dk(n){setTimeout(function(){throw n})}function Ts(n){return n==="head"}function Dy(n,i){var l=i,o=0;do{var d=l.nextSibling;if(n.removeChild(l),d&&d.nodeType===8)if(l=d.data,l==="/$"||l==="/&"){if(o===0){n.removeChild(d),vl(i);return}o--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")o++;else if(l==="html")tf(n.ownerDocument.documentElement);else if(l==="head"){l=n.ownerDocument.head,tf(l);for(var m=l.firstChild;m;){var b=m.nextSibling,C=m.nodeName;m[Hl]||C==="SCRIPT"||C==="STYLE"||C==="LINK"&&m.rel.toLowerCase()==="stylesheet"||l.removeChild(m),m=b}}else l==="body"&&tf(n.ownerDocument.body);l=d}while(l);vl(i)}function My(n,i){var l=n;n=0;do{var o=l.nextSibling;if(l.nodeType===1?i?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(i?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),o&&o.nodeType===8)if(l=o.data,l==="/$"){if(n===0)break;n--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||n++;l=o}while(l)}function Ay(n,i,l){if(i=CSS.escape(i)!==i?"r-"+btoa(i).replace(/=/g,""):i,n.style.viewTransitionName=i,l!=null&&(n.style.viewTransitionClass=l),l=getComputedStyle(n),l.display==="inline"){if(i=n.getClientRects(),i.length===1)var o=1;else for(var d=o=0;d<i.length;d++){var m=i[d];0<m.width&&0<m.height&&o++}o===1&&(n=n.style,n.display=i.length===1?"inline-block":"block",n.marginTop="-"+l.paddingTop,n.marginBottom="-"+l.paddingBottom)}}function Ry(n,i){n=n.style,i=i.style;var l=i!=null?i.hasOwnProperty("viewTransitionName")?i.viewTransitionName:i.hasOwnProperty("view-transition-name")?i["view-transition-name"]:null:null;n.viewTransitionName=l==null||typeof l=="boolean"?"":(""+l).trim(),l=i!=null?i.hasOwnProperty("viewTransitionClass")?i.viewTransitionClass:i.hasOwnProperty("view-transition-class")?i["view-transition-class"]:null:null,n.viewTransitionClass=l==null||typeof l=="boolean"?"":(""+l).trim(),n.display==="inline-block"&&(i==null?n.display=n.margin="":(l=i.display,n.display=l==null||typeof l=="boolean"?"":l,l=i.margin,l!=null?n.margin=l:(l=i.hasOwnProperty("marginTop")?i.marginTop:i["margin-top"],n.marginTop=l==null||typeof l=="boolean"?"":l,i=i.hasOwnProperty("marginBottom")?i.marginBottom:i["margin-bottom"],n.marginBottom=i==null||typeof i=="boolean"?"":i)))}function Mk(n,i,l){return l=l.ownerDocument.defaultView,{rect:n,abs:i.position==="absolute"||i.position==="fixed",clip:i.clipPath!=="none"||i.overflow!=="visible"||i.filter!=="none"||i.mask!=="none"||i.mask!=="none"||i.borderRadius!=="0px",view:0<=n.bottom&&0<=n.right&&n.top<=l.innerHeight&&n.left<=l.innerWidth}}function Wd(n){var i=n.getBoundingClientRect(),l=getComputedStyle(n);return Mk(i,l,n)}function Ak(n){return n.documentElement.clientHeight}function Rk(n){this.addEventListener("load",n),this.addEventListener("error",n)}function Ok(n,i,l,o,d,m,b,C,B){var X=i.nodeType===9?i:i.ownerDocument;try{var ne=X.startViewTransition({update:function(){var $=X.defaultView,te=$.navigation&&$.navigation.transition,Ce=X.fonts.status;o();var De=[];if(Ce==="loaded"&&(Ak(X),X.fonts.status==="loading"&&De.push(X.fonts.ready)),Ce=De.length,n!==null)for(var qe=n.suspenseyImages,W=0,I=0;I<qe.length;I++){var ee=qe[I];if(!ee.complete){var he=ee.getBoundingClientRect();if(0<he.bottom&&0<he.right&&he.top<$.innerHeight&&he.left<$.innerWidth){if(W+=e0(ee),W>Mc){De.length=Ce;break}ee=new Promise(Rk.bind(ee)),De.push(ee)}}}if(0<De.length)return $=Promise.race([Promise.all(De),new Promise(function(Te){return setTimeout(Te,500)})]).then(d,d),(te?Promise.allSettled([te.finished,$]):$).then(m,m);if(d(),te)return te.finished.then(m,m);m()},types:l});X.__reactViewTransition=ne;var de=[];return ne.ready.then(function(){for(var $=X.documentElement.getAnimations({subtree:!0}),te=0;te<$.length;te++){var Ce=$[te],De=Ce.effect,qe=De.pseudoElement;if(qe!=null&&qe.startsWith("::view-transition")){de.push(Ce),Ce=De.getKeyframes();for(var W=qe=void 0,I=!0,ee=0;ee<Ce.length;ee++){var he=Ce[ee],Te=he.width;if(qe===void 0)qe=Te;else if(qe!==Te){I=!1;break}if(Te=he.height,W===void 0)W=Te;else if(W!==Te){I=!1;break}delete he.width,delete he.height,he.transform==="none"&&delete he.transform}I&&qe!==void 0&&W!==void 0&&(De.setKeyframes(Ce),I=getComputedStyle(De.target,De.pseudoElement),I.width!==qe||I.height!==W)&&(I=Ce[0],I.width=qe,I.height=W,I=Ce[Ce.length-1],I.width=qe,I.height=W,De.setKeyframes(Ce))}}b()},function($){X.__reactViewTransition===ne&&(X.__reactViewTransition=null);try{typeof $=="object"&&$!==null&&$.name==="InvalidStateError"&&($.message==="View transition was skipped because document visibility state is hidden."||$.message==="Skipping view transition because document visibility state has become hidden."||$.message==="Skipping view transition because viewport size changed."||$.message==="Transition was aborted because of invalid state")&&($=null),$!==null&&B($)}finally{o(),d(),b()}}),ne.finished.finally(function(){for(var $=0;$<de.length;$++)de[$].cancel();X.__reactViewTransition===ne&&(X.__reactViewTransition=null),C()}),ne}catch{return o(),d(),b(),null}}function mr(n,i){this._scope=document.documentElement,this._selector="::view-transition-"+n+"("+i+")"}mr.prototype.animate=function(n,i){return i=typeof i=="number"?{duration:i}:A({},i),i.pseudoElement=this._selector,this._scope.animate(n,i)},mr.prototype.getAnimations=function(){for(var n=this._scope,i=this._selector,l=n.getAnimations({subtree:!0}),o=[],d=0;d<l.length;d++){var m=l[d].effect;m!==null&&m.target===n&&m.pseudoElement===i&&o.push(l[d])}return o},mr.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Oy(n){return{name:n,group:new mr("group",n),imagePair:new mr("image-pair",n),old:new mr("old",n),new:new mr("new",n)}}function $n(n){this._fragmentFiber=n,this._observers=this._eventListeners=null}$n.prototype.addEventListener=function(n,i,l){var o=null,d=null;if(!(l!=null&&typeof l!="boolean"&&(o=l.signal||null,o!==null&&o.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var m=this._eventListeners;if(Ly(m,n,i,l)===-1){var b=this,C=i;l!=null&&typeof l!="boolean"&&l.once===!0&&(C=function(B){b.removeEventListener(n,i,l),typeof i=="function"?i.call(this,B):i.handleEvent(B)}),o!==null&&(d=b.removeEventListener.bind(b,n,i,l),o.addEventListener("abort",d,{once:!0}),d=o.removeEventListener.bind(o,"abort",d)),o=dl(l),m.push({type:n,listener:i,optionsOrUseCapture:l,attachedListener:C,cleanup:d}),_(this._fragmentFiber.child,!1,Bk,n,C,o)}this._eventListeners=m}};function Bk(n,i,l,o){return j(n).addEventListener(i,l,o),!1}$n.prototype.removeEventListener=function(n,i,l){var o=this._eventListeners;if(o!==null&&(i=Ly(o,n,i,l),i!==-1)){var d=o[i];l=d.attachedListener;var m=d.cleanup;d=dl(d.optionsOrUseCapture),_(this._fragmentFiber.child,!1,Lk,n,l,d),o.splice(i,1),m!==null&&m()}};function Lk(n,i,l,o){return j(n).removeEventListener(i,l,o),!1}function dl(n){return n!=null&&typeof n!="boolean"&&(n.once===!0||n.signal instanceof AbortSignal)?{capture:n.capture,passive:n.passive}:n}function By(n){return n==null?"c=0":typeof n=="boolean"?"c="+(n?"1":"0"):"c="+(n.capture?"1":"0")}function Ly(n,i,l,o){if(n.length===0)return-1;o=By(o);for(var d=0;d<n.length;d++){var m=n[d];if(m.type===i&&m.listener===l&&By(m.optionsOrUseCapture)===o)return d}return-1}$n.prototype.dispatchEvent=function(n){var i=S(this._fragmentFiber);if(i===null)return!0;i=j(i);var l=this._eventListeners;if(l!==null&&0<l.length||!n.bubbles){var o=i.nodeType===9?i.createComment(""):document.createTextNode("");if(l)for(var d=0;d<l.length;d++){var m=l[d];o.addEventListener(m.type,m.attachedListener,dl(m.optionsOrUseCapture))}if(i.appendChild(o),n=o.dispatchEvent(n),l)for(d=0;d<l.length;d++)m=l[d],o.removeEventListener(m.type,m.attachedListener,dl(m.optionsOrUseCapture));return i.removeChild(o),n}return i.dispatchEvent(n)},$n.prototype.focus=function(n){_(this._fragmentFiber.child,!0,zy,n,void 0,void 0)};function zy(n,i){return n.tag===6?!1:(n=j(n),Wk(n,i))}$n.prototype.focusLast=function(n){var i=[];_(this._fragmentFiber.child,!0,Xd,i,void 0,void 0);for(var l=i.length-1;0<=l&&!zy(i[l],n);l--);};function Xd(n,i){return i.push(n),!1}$n.prototype.blur=function(){var n=S(this._fragmentFiber);n!==null&&(n=j(n),n=Sa(n).activeElement,n!==null&&_(this._fragmentFiber.child,!1,zk,n,void 0,void 0))};function zk(n,i){return n.tag===6?!1:(n=j(n),n===i||n.contains(i)?(i.blur(),!0):!1)}$n.prototype.observeUsing=function(n){this._observers===null&&(this._observers=new Set),this._observers.add(n),_(this._fragmentFiber.child,!1,Hk,n,void 0,void 0)};function Hk(n,i){return n.tag===6||(n=j(n),i.observe(n)),!1}$n.prototype.unobserveUsing=function(n){var i=this._observers;if(i!==null&&i.has(n)){i.delete(n),_(this._fragmentFiber.child,!1,Ik,n,void 0,void 0);for(var l=i=0;l<pi.length;l++){var o=pi[l];o.fragmentInstance===this&&o.observer===n?n.unobserve(o.instance):pi[i++]=o}pi.length=i}};function Ik(n,i){return n.tag===6||(n=j(n),i.unobserve(n)),!1}var pi=[],Gd=!1;function Uk(n,i,l){pi.push({fragmentInstance:n,observer:i,instance:l}),Gd||(Gd=!0,Xk(function(){Gd=!1;var o=pi;pi=[];for(var d=0;d<o.length;d++){var m=o[d];m.observer.unobserve(m.instance)}}))}$n.prototype.getClientRects=function(){var n=[];return _(this._fragmentFiber.child,!1,Pk,n,void 0,void 0),n};function Pk(n,i){if(n.tag===6){n=n.stateNode;var l=n.ownerDocument.createRange();l.selectNodeContents(n),i.push.apply(i,l.getClientRects())}else n=j(n),i.push.apply(i,n.getClientRects());return!1}$n.prototype.getRootNode=function(n){var i=S(this._fragmentFiber);return i===null?this:j(i).getRootNode(n)},$n.prototype.compareDocumentPosition=function(n){var i=S(this._fragmentFiber);if(i===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var l=[];_(this._fragmentFiber.child,!1,Xd,l,void 0,void 0);var o=j(i);if(l.length===0){if(l=o,y(this._fragmentFiber)){e:{for(i=this._fragmentFiber.return;i!==null;){if(i.tag===4){i=i.stateNode.containerInfo;break e}if(i.tag===3||i.tag===5||i.tag===27)break;i=i.return}i=null}i!=null&&(l=i)}i=this._fragmentFiber;var d=o=l.compareDocumentPosition(n);return l===n?d=Node.DOCUMENT_POSITION_CONTAINS:o&Node.DOCUMENT_POSITION_CONTAINED_BY&&(l=x(i)[1],l===null?d=Node.DOCUMENT_POSITION_PRECEDING:(n=j(l).compareDocumentPosition(n),d=n===0||n&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),d|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}i=j(l[0]),d=j(l[l.length-1]);var m=y(this._fragmentFiber)?i.parentElement:o;if(m==null)return Node.DOCUMENT_POSITION_DISCONNECTED;o=m.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY,m=m.compareDocumentPosition(d)&Node.DOCUMENT_POSITION_CONTAINED_BY;var b=i.compareDocumentPosition(n),C=d.compareDocumentPosition(n),B=b&Node.DOCUMENT_POSITION_CONTAINED_BY||C&Node.DOCUMENT_POSITION_CONTAINED_BY;return C=o&&m&&b&Node.DOCUMENT_POSITION_FOLLOWING&&C&Node.DOCUMENT_POSITION_PRECEDING,i=o&&i===n||m&&d===n||B||C?Node.DOCUMENT_POSITION_CONTAINED_BY:!o&&i===n||!m&&d===n?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:b,i&Node.DOCUMENT_POSITION_DISCONNECTED||i&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||qk(i,this._fragmentFiber,l[0],l[l.length-1],n)?i:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function qk(n,i,l,o,d){var m=Ks(d);if(n&Node.DOCUMENT_POSITION_CONTAINED_BY){if(l=!!m)e:{for(;m!==null;){if(m.tag===7&&(m===i||m.alternate===i)){l=!0;break e}m=m.return}l=!1}return l}if(n&Node.DOCUMENT_POSITION_CONTAINS){if(m===null)return m=d.ownerDocument,d===m||d===m.documentElement||d===m.body;e:{for(m=i,i=S(i);m!==null;){if(!(m.tag!==5&&m.tag!==3&&m.tag!==27||m!==i&&m.alternate!==i)){m=!0;break e}m=m.return}m=!1}return m}return n&Node.DOCUMENT_POSITION_PRECEDING?((i=!!m)&&!(i=m===l)&&(i=z(l,m,U),i===null?i=!1:(_(i,!0,T,m,l),m=N,N=null,i=m!==null)),i):n&Node.DOCUMENT_POSITION_FOLLOWING?((i=!!m)&&!(i=m===o)&&(i=z(o,m,U),i===null?i=!1:(_(i,!0,O,m,o),m=N,M=N=null,i=m!==null)),i):!1}function Hy(n,i){var l=n.ownerDocument.createRange();l.selectNodeContents(n),n=l.getBoundingClientRect(),window.scrollTo(window.scrollX+n.left,i?window.scrollY+n.top:window.scrollY+n.bottom-window.innerHeight)}$n.prototype.scrollIntoView=function(n){if(typeof n=="object")throw Error(r(566));var i=[];_(this._fragmentFiber.child,!1,Xd,i,void 0,void 0);var l=n!==!1;if(i.length===0){var o=x(this._fragmentFiber);if(o=l?o[1]||o[0]||S(this._fragmentFiber):o[0]||o[1],o===null)return;if(o.tag===6){n=j(o),Hy(n,l);return}if(o=j(o),o.nodeType!==9){if(o.nodeType===11){l="host"in o?o.host:null,l!==null&&l.scrollIntoView(n);return}o.scrollIntoView(n)}}for(o=l?i.length-1:0;o!==(l?-1:i.length);){var d=i[o];d.tag===6?(d=j(d),Hy(d,l)):j(d).scrollIntoView(n),o+=l?-1:1}};function Fk(n,i){return n=j(n),Iy(n,i),!1}function Iy(n,i){n.reactFragments==null&&(n.reactFragments=new Set),n.reactFragments.add(i)}function Uy(n,i){var l=i._eventListeners;if(l!==null)for(var o=0;o<l.length;o++){var d=l[o];n.addEventListener(d.type,d.attachedListener,dl(d.optionsOrUseCapture))}n.nodeType!==3&&(l=i._observers,l!==null&&l.forEach(function(m){for(var b=0,C=0;C<pi.length;C++){var B=pi[C];(B.fragmentInstance!==i||B.observer!==m||B.instance!==n)&&(pi[b++]=B)}pi.length=b,m.observe(n)}),Iy(n,i))}function $k(n,i){var l=i._eventListeners;if(l!==null)for(var o=0;o<l.length;o++){var d=l[o];n.removeEventListener(d.type,d.attachedListener,dl(d.optionsOrUseCapture))}n.nodeType!==3&&(l=i._observers,l!==null&&l.forEach(function(m){typeof m.rootMargin=="string"?Uk(i,m,n):m.unobserve(n)}),n.reactFragments!=null&&n.reactFragments.delete(i))}function Qd(n){var i=n.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var l=i;switch(i=i.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":Qd(l),yo(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}n.removeChild(l)}}function Vk(n,i,l,o){for(;n.nodeType===1;){var d=l;if(n.nodeName.toLowerCase()!==i.toLowerCase()){if(!o&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(o){if(!n[Hl])switch(i){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(m=n.getAttribute("rel"),m==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(m!==d.rel||n.getAttribute("href")!==(d.href==null||d.href===""?null:d.href)||n.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin)||n.getAttribute("title")!==(d.title==null?null:d.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(m=n.getAttribute("src"),(m!==(d.src==null?null:d.src)||n.getAttribute("type")!==(d.type==null?null:d.type)||n.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin))&&m&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(i==="input"&&n.type==="hidden"){var m=d.name==null?null:""+d.name;if(d.type==="hidden"&&n.getAttribute("name")===m)return n}else return n;if(n=ii(n.nextSibling),n===null)break}return null}function Yk(n,i,l){if(i==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!l||(n=ii(n.nextSibling),n===null))return null;return n}function Py(n,i){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!i||(n=ii(n.nextSibling),n===null))return null;return n}function Zd(n){return n.data==="$?"||n.data==="$~"}function Jd(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function Kk(n,i){var l=n.ownerDocument;if(n.data==="$~")n._reactRetry=i;else if(n.data!=="$?"||l.readyState!=="loading")i();else{var o=function(){i(),l.removeEventListener("DOMContentLoaded",o)};l.addEventListener("DOMContentLoaded",o),n._reactRetry=o}}function ii(n){for(;n!=null;n=n.nextSibling){var i=n.nodeType;if(i===1||i===3)break;if(i===8){if(i=n.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return n}var ef=null;function qy(n){n=n.nextSibling;for(var i=0;n;){if(n.nodeType===8){var l=n.data;if(l==="/$"||l==="/&"){if(i===0)return ii(n.nextSibling);i--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||i++}n=n.nextSibling}return null}function Fy(n){n=n.previousSibling;for(var i=0;n;){if(n.nodeType===8){var l=n.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(i===0)return n;i--}else l!=="/$"&&l!=="/&"||i++}n=n.previousSibling}return null}function Wk(n,i){function l(){o=!0}if(n.ownerDocument.activeElement===n)return!0;var o=!1;try{n.ownerDocument.addEventListener("focus",l,!0),(n.focus||HTMLElement.prototype.focus).call(n,i)}finally{n.ownerDocument.removeEventListener("focus",l,!0)}return o}function Xk(n){Ty(function(){Ty(function(i){return n(i)})})}function $y(n,i,l){switch(i=Sa(l),n){case"html":if(n=i.documentElement,!n)throw Error(r(452));return n;case"head":if(n=i.head,!n)throw Error(r(453));return n;case"body":if(n=i.body,!n)throw Error(r(454));return n;default:throw Error(r(451))}}function Vy(n,i,l){for(var o in l){var d=l[o];l.hasOwnProperty(o)&&d!=null&&ft(n,i,o,null,Ck,d)}l.dangerouslySetInnerHTML!=null&&(n.textContent=""),n.onclick===vi&&(n.onclick=null),yo(n)}function tf(n){for(var i=n.attributes;i.length;)n.removeAttributeNode(i[0]);yo(n)}var si=new Map,Yy=new Set;function ba(n){if(typeof n.getRootNode=="function"){var i=n.getRootNode();if(i.nodeType===9||i.nodeType===11)return i}return n.nodeType===9?n:n.ownerDocument}var ts=me.d;me.d={f:Gk,r:Qk,D:Zk,C:Jk,L:eN,m:tN,X:iN,S:nN,M:sN};function Gk(){var n=ts.f(),i=xc();return n||i}function Qk(n){var i=Mr(n);i!==null&&i.tag===5&&i.type==="form"?W_(i):ts.r(n)}var fl=typeof document>"u"?null:document;function Ky(n,i,l){var o=fl;if(o&&typeof i=="string"&&i){var d=Gn(i);d='link[rel="'+n+'"][href="'+d+'"]',typeof l=="string"&&(d+='[crossorigin="'+l+'"]'),Yy.has(d)||(Yy.add(d),n={rel:n,crossOrigin:l,href:i},o.querySelector(d)===null&&(i=o.createElement("link"),un(i,"link",n),Wt(i),o.head.appendChild(i)))}}function Zk(n){ts.D(n),Ky("dns-prefetch",n,null)}function Jk(n,i){ts.C(n,i),Ky("preconnect",n,i)}function eN(n,i,l){ts.L(n,i,l);var o=fl;if(o&&n&&i){var d='link[rel="preload"][as="'+Gn(i)+'"]';i==="image"&&l&&l.imageSrcSet?(d+='[imagesrcset="'+Gn(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(d+='[imagesizes="'+Gn(l.imageSizes)+'"]')):d+='[href="'+Gn(n)+'"]';var m=d;switch(i){case"style":m=ml(n);break;case"script":m=pl(n)}if(!(si.has(m)||(n=A({rel:"preload",href:i==="image"&&l&&l.imageSrcSet?void 0:n,as:i},l),si.set(m,n),o.querySelector(d)!==null||i==="style"&&o.querySelector(xa(m))||i==="script"&&o.querySelector(wa(m))))){var b=o.createElement("link");un(b,"link",n),i==="style"&&(b[vo]=!0,b.onload=b.onerror=function(){lg(b)}),Wt(b),o.head.appendChild(b)}}}function tN(n,i){ts.m(n,i);var l=fl;if(l&&n){var o=i&&typeof i.as=="string"?i.as:"script",d='link[rel="modulepreload"][as="'+Gn(o)+'"][href="'+Gn(n)+'"]',m=d;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":m=pl(n)}if(!si.has(m)&&(n=A({rel:"modulepreload",href:n},i),si.set(m,n),l.querySelector(d)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(wa(m)))return}o=l.createElement("link"),un(o,"link",n),Wt(o),l.head.appendChild(o)}}}function nN(n,i,l){ts.S(n,i,l);var o=fl;if(o&&n){var d=Ar(o).hoistableStyles,m=ml(n);i=i||"default";var b=d.get(m);if(!b){var C={loading:0,preload:null};if(b=o.querySelector(xa(m)))C.loading=5;else{n=A({rel:"stylesheet",href:n,"data-precedence":i},l),(l=si.get(m))&&nf(n,l);var B=b=o.createElement("link");Wt(B),un(B,"link",n),B._p=new Promise(function(X,ne){B.onload=X,B.onerror=ne}),B.addEventListener("load",function(){C.loading|=1}),B.addEventListener("error",function(){C.loading|=2}),C.loading|=4,Tc(b,i,o)}b={type:"stylesheet",instance:b,count:1,state:C},d.set(m,b)}}}function iN(n,i){ts.X(n,i);var l=fl;if(l&&n){var o=Ar(l).hoistableScripts,d=pl(n),m=o.get(d);m||(m=l.querySelector(wa(d)),m||(n=A({src:n,async:!0},i),(i=si.get(d))&&sf(n,i),m=l.createElement("script"),Wt(m),un(m,"link",n),l.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},o.set(d,m))}}function sN(n,i){ts.M(n,i);var l=fl;if(l&&n){var o=Ar(l).hoistableScripts,d=pl(n),m=o.get(d);m||(m=l.querySelector(wa(d)),m||(n=A({src:n,async:!0,type:"module"},i),(i=si.get(d))&&sf(n,i),m=l.createElement("script"),Wt(m),un(m,"link",n),l.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},o.set(d,m))}}function Wy(n,i,l,o){var d=(d=ke.current)?ba(d):null;if(!d)throw Error(r(446));switch(n){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(l=ml(l.href),i=Ar(d).hoistableStyles,o=i.get(l),o||(o={type:"style",instance:null,count:0,state:null},i.set(l,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){n=ml(l.href);var m=Ar(d).hoistableStyles,b=m.get(n);if(b||(d=d.ownerDocument||d,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},m.set(n,b),(m=d.querySelector(xa(n)))?m._p||(b.instance=m,b.state.loading=5):(m=si.get(n),m||(m={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},si.set(n,m)),rN(d,n,m,b.state))),i&&o===null)throw Error(r(528,""));return b}if(i&&o!==null)throw Error(r(529,""));return null;case"script":return i=l.async,l=l.src,typeof l=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(l=pl(l),i=Ar(d).hoistableScripts,o=i.get(l),o||(o={type:"script",instance:null,count:0,state:null},i.set(l,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,n))}}function ml(n){return'href="'+Gn(n)+'"'}function xa(n){return'link[rel="stylesheet"]['+n+"]"}function Xy(n){return A({},n,{"data-precedence":n.precedence,precedence:null})}function rN(n,i,l,o){if(i=n.querySelector('link[rel="preload"][as="style"]['+i+"]")){if(i[vo]!==!0){o.loading=1;return}}else i=n.createElement("link"),i[vo]=!0,i.onload=i.onerror=lg.bind(null,i),un(i,"link",l),Wt(i),n.head.appendChild(i);o.preload=i,i.addEventListener("load",function(){return o.loading|=1}),i.addEventListener("error",function(){return o.loading|=2})}function pl(n){return'[src="'+Gn(n)+'"]'}function wa(n){return"script[async]"+n}function Gy(n,i,l){if(i.count++,i.instance===null)switch(i.type){case"style":var o=n.querySelector('style[data-href~="'+Gn(l.href)+'"]');if(o)return i.instance=o,Wt(o),o;var d=A({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return o=(n.ownerDocument||n).createElement("style"),Wt(o),un(o,"style",d),Tc(o,l.precedence,n),i.instance=o;case"stylesheet":d=ml(l.href);var m=n.querySelector(xa(d));if(m)return i.state.loading|=4,i.instance=m,Wt(m),m;o=Xy(l),(d=si.get(d))&&nf(o,d),m=(n.ownerDocument||n).createElement("link"),Wt(m);var b=m;return b._p=new Promise(function(C,B){b.onload=C,b.onerror=B}),un(m,"link",o),i.state.loading|=4,Tc(m,l.precedence,n),i.instance=m;case"script":return m=pl(l.src),(d=n.querySelector(wa(m)))?(i.instance=d,Wt(d),d):(o=l,(d=si.get(m))&&(o=A({},l),sf(o,d)),n=n.ownerDocument||n,d=n.createElement("script"),Wt(d),un(d,"link",o),n.head.appendChild(d),i.instance=d);case"void":return null;default:throw Error(r(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(o=i.instance,i.state.loading|=4,Tc(o,l.precedence,n));return i.instance}function Tc(n,i,l){for(var o=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=o.length?o[o.length-1]:null,m=d,b=0;b<o.length;b++){var C=o[b];if(C.dataset.precedence===i)m=C;else if(m!==d)break}m?m.parentNode.insertBefore(n,m.nextSibling):(i=l.nodeType===9?l.head:l,i.insertBefore(n,i.firstChild))}function nf(n,i){n.crossOrigin==null&&(n.crossOrigin=i.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=i.referrerPolicy),n.title==null&&(n.title=i.title)}function sf(n,i){n.crossOrigin==null&&(n.crossOrigin=i.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=i.referrerPolicy),n.integrity==null&&(n.integrity=i.integrity)}var Dc=null;function Qy(n,i,l){if(Dc===null){var o=new Map,d=Dc=new Map;d.set(l,o)}else d=Dc,o=d.get(l),o||(o=new Map,d.set(l,o));if(o.has(n))return o;for(o.set(n,null),l=l.getElementsByTagName(n),d=0;d<l.length;d++){var m=l[d];if(!(m[Hl]||m[rn]||n==="link"&&m.getAttribute("rel")==="stylesheet")&&m.namespaceURI!=="http://www.w3.org/2000/svg"){var b=m.getAttribute(i)||"";b=n+b;var C=o.get(b);C?C.push(m):o.set(b,[m])}}return o}function rf(n,i,l){n=n.ownerDocument||n,n.head.insertBefore(l,i==="title"?n.querySelector("head > title"):null)}function lN(n,i,l){if(l===1||i.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;return i.rel==="stylesheet"?(n=i.disabled,typeof i.precedence=="string"&&n==null):!0;case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function Zy(n,i){return n==="img"&&i.src!=null&&i.src!==""&&i.onLoad==null&&i.loading!=="lazy"}function Jy(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function e0(n){return(n.width||100)*(n.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function t0(n,i){typeof i.decode=="function"&&(n.imgCount++,i.complete||(n.imgBytes+=e0(i),n.suspenseyImages.push(i)),n=cN.bind(n),i.decode().then(n,n))}function aN(n,i,l,o){if(l.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var d=ml(o.href),m=i.querySelector(xa(d));if(m){i=m._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(n.count++,n=Ca.bind(n),i.then(n,n)),l.state.loading|=4,l.instance=m,Wt(m);return}m=i.ownerDocument||i,o=Xy(o),(d=si.get(d))&&nf(o,d),m=m.createElement("link"),Wt(m);var b=m;b._p=new Promise(function(C,B){b.onload=C,b.onerror=B}),un(m,"link",o),l.instance=m}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(l,i),(i=l.state.preload)&&(l.state.loading&3)===0&&(n.count++,l=Ca.bind(n),i.addEventListener("load",l),i.addEventListener("error",l))}}var Mc=0;function oN(n,i){return n.stylesheets&&n.count===0&&Rc(n,n.stylesheets),0<n.count||0<n.imgCount?function(l){var o=setTimeout(function(){if(n.stylesheets&&Rc(n,n.stylesheets),n.unsuspend){var m=n.unsuspend;n.unsuspend=null,m()}},6e4+i);0<n.imgBytes&&Mc===0&&(Mc=62500*Nk());var d=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&Rc(n,n.stylesheets),n.unsuspend)){var m=n.unsuspend;n.unsuspend=null,m()}},(n.imgBytes>Mc?50:800)+i);return n.unsuspend=l,function(){n.unsuspend=null,clearTimeout(o),clearTimeout(d)}}:null}function n0(n){if(n.count===0&&(n.imgCount===0||!n.waitingForImages)){if(n.stylesheets)Rc(n,n.stylesheets);else if(n.unsuspend){var i=n.unsuspend;n.unsuspend=null,i()}}}function Ca(){this.count--,n0(this)}function cN(){this.imgCount--,n0(this)}var Ac=null;function Rc(n,i){n.stylesheets=null,n.unsuspend!==null&&(n.count++,Ac=new Map,i.forEach(uN,n),Ac=null,Ca.call(n))}function uN(n,i){if(!(i.state.loading&4)){var l=Ac.get(n);if(l)var o=l.get(null);else{l=new Map,Ac.set(n,l);for(var d=n.querySelectorAll("link[data-precedence],style[data-precedence]"),m=0;m<d.length;m++){var b=d[m];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(l.set(b.dataset.precedence,b),o=b)}o&&l.set(null,o)}d=i.instance,b=d.getAttribute("data-precedence"),m=l.get(b)||o,m===o&&l.set(null,d),l.set(b,d),this.count++,o=Ca.bind(this),d.addEventListener("load",o),d.addEventListener("error",o),m?m.parentNode.insertBefore(d,m.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(d,n.firstChild)),i.state.loading|=4}}var gl={$$typeof:F,Provider:null,Consumer:null,_currentValue:xe,_currentValue2:xe,_threadCount:0};function hN(n,i,l,o,d,m,b,C,B){this.tag=1,this.containerInfo=n,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=Hu(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Hu(0),this.hiddenUpdates=Hu(null),this.identifierPrefix=o,this.onUncaughtError=d,this.onCaughtError=m,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=B,this.transitionTypes=null,this.incompleteTransitions=new Map}function i0(n,i,l,o,d,m,b,C,B,X,ne,de){return n=new hN(n,i,l,b,B,X,ne,de,C),i=1,m===!0&&(i|=24),m=En(3,null,null,i),n.current=m,m.stateNode=n,i=yh(),i.refCount++,n.pooledCache=i,i.refCount++,m.memoizedState={element:o,isDehydrated:l,cache:i},wh(m),n}function s0(n){return n?(n=qr,n):qr}function r0(n,i,l,o,d,m){d=s0(d),o.context===null?o.context=d:o.pendingContext=d,o=_s(i),o.payload={element:l},m=m===void 0?null:m,m!==null&&(o.callback=m),l=vs(n,o,i),l!==null&&(Mn(l,n,i),ta(l,n,i))}function l0(n,i){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var l=n.retryLane;n.retryLane=l!==0&&l<i?l:i}}function lf(n,i){l0(n,i),(n=n.alternate)&&l0(n,i)}function a0(n){if(n.tag===13||n.tag===31){var i=Qs(n,67108864);i!==null&&Mn(i,n,67108864),lf(n,67108864)}}function o0(n){if(n.tag===13||n.tag===31){var i=Fn();i=Iu(i);var l=Qs(n,i);l!==null&&Mn(l,n,i),lf(n,i)}}var _l=!0;function dN(n,i,l,o){var d=se.T;se.T=null;var m=me.p;try{me.p=2,af(n,i,l,o)}finally{me.p=m,se.T=d}}function fN(n,i,l,o){var d=se.T;se.T=null;var m=me.p;try{me.p=8,af(n,i,l,o)}finally{me.p=m,se.T=d}}function af(n,i,l,o){if(_l){var d=of(o);if(d===null)Pd(n,i,o,Oc,l),u0(n,o);else if(pN(d,n,i,l,o))o.stopPropagation();else if(u0(n,o),i&4&&-1<mN.indexOf(n)){for(;d!==null;){var m=Mr(d);if(m!==null)switch(m.tag){case 3:if(m=m.stateNode,m.current.memoizedState.isDehydrated){var b=Ys(m.pendingLanes);if(b!==0){var C=m;for(C.pendingLanes|=2,C.entangledLanes|=2;b;){var B=1<<31-Ln(b);C.entanglements[1]|=B,b&=~B}ji(m),(ct&6)===0&&(yc=sn()+500,_a(0))}}break;case 31:case 13:C=Qs(m,2),C!==null&&Mn(C,m,2),xc(),lf(m,2)}if(m=of(o),m===null&&Pd(n,i,o,Oc,l),m===d)break;d=m}d!==null&&o.stopPropagation()}else Pd(n,i,o,null,l)}}function of(n){return n=Yu(n),cf(n)}var Oc=null;function cf(n){if(Oc=null,n=Ks(n),n!==null){var i=c(n);if(i===null)n=null;else{var l=i.tag;if(l===13){if(n=h(i),n!==null)return n;n=null}else if(l===31){if(n=f(i),n!==null)return n;n=null}else if(l===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;n=null}else i!==n&&(n=null)}}return Oc=n,null}function c0(n){switch(n){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"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"fullscreenerror":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"resize":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(vn()){case Ui:return 2;case Xn:return 8;case fo:case Ew:return 32;case Gp:return 268435456;default:return 32}default:return 32}}var uf=!1,Ds=null,Ms=null,As=null,ka=new Map,Na=new Map,Rs=[],mN="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 u0(n,i){switch(n){case"focusin":case"focusout":Ds=null;break;case"dragenter":case"dragleave":Ms=null;break;case"mouseover":case"mouseout":As=null;break;case"pointerover":case"pointerout":ka.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":Na.delete(i.pointerId)}}function Ea(n,i,l,o,d,m){return n===null||n.nativeEvent!==m?(n={blockedOn:i,domEventName:l,eventSystemFlags:o,nativeEvent:m,targetContainers:[d]},i!==null&&(i=Mr(i),i!==null&&a0(i)),n):(n.eventSystemFlags|=o,i=n.targetContainers,d!==null&&i.indexOf(d)===-1&&i.push(d),n)}function pN(n,i,l,o,d){switch(i){case"focusin":return Ds=Ea(Ds,n,i,l,o,d),!0;case"dragenter":return Ms=Ea(Ms,n,i,l,o,d),!0;case"mouseover":return As=Ea(As,n,i,l,o,d),!0;case"pointerover":var m=d.pointerId;return ka.set(m,Ea(ka.get(m)||null,n,i,l,o,d)),!0;case"gotpointercapture":return m=d.pointerId,Na.set(m,Ea(Na.get(m)||null,n,i,l,o,d)),!0}return!1}function h0(n){var i=Ks(n.target);if(i!==null){var l=c(i);if(l!==null){if(i=l.tag,i===13){if(i=h(l),i!==null){n.blockedOn=i,ig(n.priority,function(){o0(l)});return}}else if(i===31){if(i=f(l),i!==null){n.blockedOn=i,ig(n.priority,function(){o0(l)});return}}else if(i===3&&l.stateNode.current.memoizedState.isDehydrated){n.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}n.blockedOn=null}function Bc(n){if(n.blockedOn!==null)return!1;for(var i=n.targetContainers;0<i.length;){var l=of(n.nativeEvent);if(l===null){l=n.nativeEvent;var o=new l.constructor(l.type,l);Vu=o,l.target.dispatchEvent(o),Vu=null}else return i=Mr(l),i!==null&&a0(i),n.blockedOn=l,!1;i.shift()}return!0}function d0(n,i,l){Bc(n)&&l.delete(i)}function gN(){uf=!1,Ds!==null&&Bc(Ds)&&(Ds=null),Ms!==null&&Bc(Ms)&&(Ms=null),As!==null&&Bc(As)&&(As=null),ka.forEach(d0),Na.forEach(d0)}function Lc(n,i){n.blockedOn===i&&(n.blockedOn=null,uf||(uf=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,gN)))}var zc=null;function f0(n){zc!==n&&(zc=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){zc===n&&(zc=null);for(var i=0;i<n.length;i+=3){var l=n[i],o=n[i+1],d=n[i+2];if(typeof o!="function"){if(cf(o||l)===null)continue;break}var m=Mr(l);m!==null&&(n.splice(i,3),i-=3,$h(m,{pending:!0,data:d,method:l.method,action:o},o,d))}}))}function vl(n){function i(B){return Lc(B,n)}Ds!==null&&Lc(Ds,n),Ms!==null&&Lc(Ms,n),As!==null&&Lc(As,n),ka.forEach(i),Na.forEach(i);for(var l=0;l<Rs.length;l++){var o=Rs[l];o.blockedOn===n&&(o.blockedOn=null)}for(;0<Rs.length&&(l=Rs[0],l.blockedOn===null);)h0(l),l.blockedOn===null&&Rs.shift();if(l=(n.ownerDocument||n).$$reactFormReplay,l!=null)for(o=0;o<l.length;o+=3){var d=l[o],m=l[o+1],b=d[Nn]||null;if(typeof m=="function")b||f0(l);else if(b){var C=null;if(m&&m.hasAttribute("formAction")){if(d=m,b=m[Nn]||null)C=b.formAction;else if(cf(d)!==null)continue}else C=b.action;typeof C=="function"?l[o+1]=C:(l.splice(o,3),o-=3),f0(l)}}}function m0(){function n(m){m.canIntercept&&m.info==="react-transition"&&m.intercept({handler:function(){return new Promise(function(b){return d=b})},focusReset:"manual",scroll:"manual"})}function i(){d!==null&&(d(),d=null),o||setTimeout(l,20)}function l(){if(!o&&!navigation.transition){var m=navigation.currentEntry;m&&m.url!=null&&navigation.navigate(m.url,{state:m.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,d=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(l,100),function(){o=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),d!==null&&(d(),d=null)}}}function hf(n){this._internalRoot=n}Hc.prototype.render=hf.prototype.render=function(n){var i=this._internalRoot;if(i===null)throw Error(r(409));var l=i.current,o=Fn();r0(l,o,n,i,null,null)},Hc.prototype.unmount=hf.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var i=n.containerInfo;r0(n.current,2,null,n,null,null),xc(),i[Dr]=null}};function Hc(n){this._internalRoot=n}Hc.prototype.unstable_scheduleHydration=function(n){if(n){var i=ng();n={blockedOn:null,target:n,priority:i};for(var l=0;l<Rs.length&&i!==0&&i<Rs[l].priority;l++);Rs.splice(l,0,n),l===0&&h0(n)}};var p0=t.version;if(p0!=="19.3.1")throw Error(r(527,p0,"19.3.1"));me.findDOMNode=function(n){var i=n._reactInternals;if(i===void 0)throw typeof n.render=="function"?Error(r(188)):(n=Object.keys(n).join(","),Error(r(268,n)));return n=p(i),n=n!==null?v(n):null,n=n===null?null:n.stateNode,n};var _N={bundleType:0,version:"19.3.1",rendererPackageName:"react-dom",currentDispatcherRef:se,reconcilerVersion:"19.3.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ic=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ic.isDisabled&&Ic.supportsFiber)try{Bl=Ic.inject(_N),Bn=Ic}catch{}}return Ta.createRoot=function(n,i){if(!a(n))throw Error(r(299));var l=!1,o="",d=sv,m=rv,b=lv;return i!=null&&(i.unstable_strictMode===!0&&(l=!0),i.identifierPrefix!==void 0&&(o=i.identifierPrefix),i.onUncaughtError!==void 0&&(d=i.onUncaughtError),i.onCaughtError!==void 0&&(m=i.onCaughtError),i.onRecoverableError!==void 0&&(b=i.onRecoverableError)),i=i0(n,1,!1,null,null,l,o,null,d,m,b,m0),n[Dr]=i.current,Ud(n),new hf(i)},Ta.hydrateRoot=function(n,i,l){if(!a(n))throw Error(r(299));var o=!1,d="",m=sv,b=rv,C=lv,B=null;return l!=null&&(l.unstable_strictMode===!0&&(o=!0),l.identifierPrefix!==void 0&&(d=l.identifierPrefix),l.onUncaughtError!==void 0&&(m=l.onUncaughtError),l.onCaughtError!==void 0&&(b=l.onCaughtError),l.onRecoverableError!==void 0&&(C=l.onRecoverableError),l.formState!==void 0&&(B=l.formState)),i=i0(n,1,!0,i,l??null,o,d,B,m,b,C,m0),i.context=s0(null),l=i.current,o=Fn(),o=Iu(o),d=_s(o),d.callback=null,vs(l,d,o),l=o,i.current.lanes=l,zl(i,l),ji(i),n[Dr]=i.current,Ud(n),new Hc(i)},Ta.version="19.3.1",Ta}var k0;function jN(){if(k0)return mf.exports;k0=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(),mf.exports=EN(),mf.exports}var TN=jN();async function Me(e,t){const s=await fetch(e,t),r=await s.text(),a=r===""?void 0:JSON.parse(r);if(!s.ok){const c=typeof a=="object"&&a!==null&&typeof a.error=="string"?a.error:`HTTP ${String(s.status)}`;throw new Error(c)}return a}const st=e=>({method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)});function DN(e={}){return Me(`/sessions?grouped=1${e.archived===!0?"&archived=1":""}`)}function MN(e,t){return Me("/sessions/rename",st({session:e,title:t}))}function AN(e){return Me("/sessions/delete",st({session:e}))}function RN(e){return Me("/sessions/order",st({names:e}))}function ON(e,t){return Me("/sessions/archive",st({session:e,archived:t}))}function BN(e,t){return Me("/sessions/labels",st({session:e,labels:t}))}function N0(e,t){return Me("/sessions/fork",st({session:e,at:t}))}function LN(e){return Me(`/sessions/anchors?session=${encodeURIComponent(e)}`)}function E0(e){return Me(`/files?path=${encodeURIComponent(e)}`)}function zN(e,t={}){const s=t.offset??1,r=t.limit??400;return Me(`/file?path=${encodeURIComponent(e)}&offset=${String(s)}&limit=${String(r)}`)}function HN(e){return Me(`/file-version?path=${encodeURIComponent(e)}`)}function Vb(e){return Me("/open-external",st(e))}function IN(){return Me("/git")}function UN(e){return Me(`/git/diff?path=${encodeURIComponent(e)}`)}function PN(){return Me("/terminals")}function qN(){return Me("/terminal",st({}))}function FN(e){return Me("/terminal/close",st({id:e}))}function Yb(e,t){return Me("/terminal/send",st({id:e,text:t,raw:!0}))}function j0(e,t,s){return Me("/terminal/resize",st({id:e,cols:t,rows:s}))}function $N(e,t){return`/terminal/events?id=${encodeURIComponent(e)}&raw=1`}function VN(e){return Me(`/thread?session=${encodeURIComponent(e)}`)}function YN(e){return Me(`/turn-changes?session=${encodeURIComponent(e)}`)}function KN(e,t){return Me("/turn-undo",st({session:e,key:t}))}function vf(e,t,s,r){return Me("/chat",st({prompt:e,...t===void 0||t===""?{}:{logFile:t},...s===void 0?{}:{sessionId:s},...r===void 0||r.length===0?{}:{images:r}}))}function Kb(e){return Me(`/running?session=${encodeURIComponent(e)}`)}function WN(e){return Me("/interrupt",st({session:e}))}function XN(e,t){return Me("/answer",st({session:e,...t}))}function GN(){return Me("/settings")}function QN(e){return Me("/settings",st(e))}function ZN(){return Me("/provider")}function Da(e){return Me("/provider",st(e))}function T0(e){return Me("/provider/test",st(e))}function Wb(e){const t=e===void 0?"":`?session=${encodeURIComponent(e)}`;return Me(`/models${t}`)}function JN(e,t){return Me("/session-model",st(t===void 0?{model:e}:{session:t,model:e}))}function e2(e,t){return Me("/session-profile",st({session:e,profile:t}))}function t2(e){return Me(`/trajectory?session=${encodeURIComponent(e)}`)}function n2(e,t,s){return Me(`/page?session=${encodeURIComponent(e)}&from=${String(t)}&limit=${String(s)}`)}function i2(){return Me("/plugins")}function s2(e,t){return Me("/plugins/toggle",st({id:e,enabled:t}))}function r2(e,t={}){const s=new URLSearchParams({session:e});return t.status!==void 0&&s.set("status",t.status),t.ready!==void 0&&s.set("ready",t.ready?"1":"0"),Me(`/team?${s.toString()}`)}function D0(e){return Me("/workspace",st({path:e}))}function l2(e,t,s){return Me("/team/claim",st({session:e,taskId:t,expectedRevision:s}))}function a2(){return Me("/subagents")}function o2(e){return Me("/subagents/stop",st({agentId:e}))}function c2(){return Me("/tasks")}function u2(e){return Me("/task-stop",st({taskId:e}))}function h2(){return Me("/tasks/clear",st({}))}function up(e){const t=/^\/goal(?:\s+([\s\S]*))?$/u.exec(e.trim());if(t===null)return null;const s=(t[1]??"").trim();return s===""?{kind:"usage"}:{kind:"set",objective:s}}function d2(e,t){const s=t.trim();if(s==="")return"resend";const r=[...e].reverse().find(h=>h.role==="user"&&h.source!=="context"&&h.text.trim()!=="");if(r===void 0||r.text.trim()!==s)return"resend";const a=e.lastIndexOf(r);return e.slice(a+1).some(h=>h.role==="assistant")?"resend":"reanswer"}function f2(e,t){const s=e.filter(r=>r.seq<t).map(r=>r.seq);return s.length===0?1:Math.max(...s)}function m2(e,t){const s=t.trim().toLowerCase();return s===""?e:e.filter(r=>`${r.label} ${r.hint??""} ${r.keywords??""}`.toLowerCase().includes(s))}function M0(e,t,s){return s<=0?0:((e+t)%s+s)%s}function p2({items:e,onClose:t}){const[s,r]=k.useState(""),[a,c]=k.useState(0),h=k.useRef(null),f=k.useMemo(()=>m2(e,s),[e,s]);k.useEffect(()=>{h.current?.focus()},[]),k.useEffect(()=>{c(0)},[s]);const g=p=>{p!==void 0&&(t(),p.run())};return u.jsx("div",{className:"cmdk-mask",role:"dialog","aria-modal":"true","aria-label":"命令面板",onMouseDown:p=>{p.target===p.currentTarget&&t()},children:u.jsxs("div",{className:"cmdk",children:[u.jsx("input",{ref:h,className:"cmdk-input",value:s,placeholder:"搜索会话,或输入动作…",onChange:p=>{r(p.target.value)},onKeyDown:p=>{p.key==="ArrowDown"?(p.preventDefault(),c(v=>M0(v,1,f.length))):p.key==="ArrowUp"?(p.preventDefault(),c(v=>M0(v,-1,f.length))):p.key==="Enter"?(p.preventDefault(),g(f[a])):p.key==="Escape"&&(p.preventDefault(),t())}}),u.jsx("div",{className:"cmdk-list",children:f.length===0?u.jsx("div",{className:"cmdk-empty",children:"没有匹配的会话或动作"}):f.map((p,v)=>{const _=f[v-1]?.group;return u.jsxs("div",{children:[p.group===_?null:u.jsx("div",{className:"cmdk-group",children:p.group}),u.jsxs("button",{className:v===a?"cmdk-item sel":"cmdk-item",onMouseMove:()=>{c(v)},onClick:()=>{g(p)},children:[u.jsx("span",{className:"cmdk-icon g","aria-hidden":"true",children:p.group==="会话"?"▤":"⌘"}),u.jsx("span",{className:"cmdk-label",children:p.label}),p.hint===void 0?null:u.jsx("span",{className:"cmdk-hint",children:p.hint})]})]},p.id)})}),u.jsxs("div",{className:"cmdk-foot",children:[u.jsx("span",{children:"↑↓ 选择"}),u.jsx("span",{children:"↵ 执行"}),u.jsx("span",{children:"esc 关闭"})]})]})})}function A0(e,t,s){return Me("/goal",st({session:e,op:t,...s===void 0?{}:{objective:s}}))}function g2(e,t){return Me("/plan-mode",st({session:e,active:t}))}function _2(e){return Me(`/refs?query=${encodeURIComponent(e)}`)}function v2(e,t,s){return Me("/queue",st({session:e,op:"add",content:t}))}function y2(e,t,s){return Me("/queue",st({session:e,op:"edit",id:t,content:s}))}function S2(e,t){return Me("/queue",st({session:e,op:"remove",id:t}))}function R0(e,t,s){return Me("/queue",st({session:e,op:"steer",id:t,placement:s}))}const b2=4e3;function x2(e){const[t,s]=k.useState(null),[r,a]=k.useState([]),[c,h]=k.useState([]),[f,g]=k.useState(null),[p,v]=k.useState({}),_=k.useRef(e);_.current=e;const S=k.useRef(p);S.current=p;const y=k.useRef(!0),x=k.useCallback(async w=>{const j=_.current,N=w?.silent===!0;try{const[M,T,O]=await Promise.allSettled([j===null?Promise.resolve(null):r2(j,S.current),a2(),c2()]);if(!y.current||_.current!==j)return;M.status==="fulfilled"&&s(M.value),T.status==="fulfilled"&&a(T.value.agents),O.status==="fulfilled"&&h(O.value.tasks);const U=[M,T,O].find(z=>z.status==="rejected");if(g(U===void 0?null:U.reason instanceof Error?U.reason.message:String(U.reason)),N)return}catch(M){if(!y.current)return;g(M instanceof Error?M.message:String(M))}},[]);return k.useEffect(()=>(y.current=!0,()=>{y.current=!1}),[]),k.useEffect(()=>{s(null),g(null),x()},[e,x]),k.useEffect(()=>{x({silent:!0})},[p,x]),k.useEffect(()=>{if(e===null)return;const w=setInterval(()=>{x({silent:!0})},b2);return()=>{clearInterval(w)}},[e,x]),{team:t,agents:r,jobs:c,error:f,reload:x,filter:p,setFilter:v}}const w2={low:"低风险",medium:"中风险",high:"高风险",critical:"极高风险"};function C2(e){if(typeof e!="object"||e===null)return"";const t=e;for(const r of["command","path","file_path","pattern","url","query"]){const a=t[r];if(typeof a=="string"&&a!=="")return a}const s=JSON.stringify(e);return s===void 0?"":s}function k2({ask:e,count:t,onAnswer:s}){const[r,a]=k.useState(!1),[c,h]=k.useState(()=>JSON.stringify(e.input??{},null,2)),[f,g]=k.useState(null),[p,v]=k.useState(!1),_=e.riskLevel??"medium",S=_==="high"||_==="critical",y=C2(e.input),x=e.permissionOptions??[],w=N=>{v(!0),s({id:e.id,...N}).finally(()=>{v(!1)})},j=()=>{try{const N=JSON.parse(c);g(null),w({optionId:"modify",modifiedInput:N})}catch{g("改后的输入不是合法 JSON——没发出去")}};return u.jsxs("div",{className:S?"perm danger":"perm",children:[u.jsxs("div",{className:"t",children:[u.jsx("span",{className:"g",children:"!"}),"需要你确认 · ",e.question,u.jsxs("span",{style:{marginLeft:"auto",color:"var(--text-3)",fontWeight:400},children:[e.origin===void 0?"主代理":`来自 ${e.origin.kind==="subagent"?"子代理":e.origin.kind==="workflow-node"?"工作流节点":"团队成员"} ${e.origin.agentType??e.origin.agentId}`,e.toolName===void 0?"":` · ${e.toolName}`]})]}),u.jsxs("div",{className:"perm-tool",children:[u.jsx("span",{className:S?"badge high":"badge",children:w2[_]??_}),y===""?null:u.jsx("code",{children:y}),t>1?u.jsxs("span",{style:{marginLeft:"auto",color:"var(--text-3)"},children:["还有 ",t," 个等待确认"]}):null]}),S?u.jsx("div",{className:"hint",children:"这是破坏性操作:执行后可能删改工作区内容。看清楚命令再点。"}):null,e.expiresAt===void 0?null:u.jsxs("div",{className:"hint",children:["截止:",new Date(e.expiresAt).toLocaleTimeString("zh-CN"),"(超时按拒绝处理)"]}),r?u.jsxs("div",{className:"perm-modify",children:[u.jsx("textarea",{value:c,onChange:N=>{h(N.target.value)},spellCheck:!1}),f===null?null:u.jsx("div",{className:"err",children:f}),u.jsxs("div",{className:"a",children:[u.jsx("button",{className:"btn",onClick:()=>{a(!1)},children:"取消"}),u.jsx("button",{className:"btn primary",disabled:p,onClick:j,children:"提交改后的输入"})]})]}):u.jsx("div",{className:"a",children:x.length===0?u.jsxs(u.Fragment,{children:[u.jsx("button",{className:"btn",disabled:p,onClick:()=>{w({allow:!1})},children:"拒绝"}),e.allowModify===!0?u.jsx("button",{className:"btn",disabled:p,onClick:()=>{a(!0)},children:"改后批准"}):null,u.jsx("button",{className:"btn primary",disabled:p,onClick:()=>{w({allow:!0})},children:"允许执行"})]}):x.map(N=>u.jsx("button",{className:N.optionId==="deny"?"btn danger":N.optionId==="allow-once"?"btn primary":"btn",title:N.description??N.label,disabled:p,onClick:()=>{if(N.optionId==="modify"){a(!0);return}w({optionId:N.optionId})},children:N.label},N.optionId))})]})}function N2({ask:e,onAnswer:t}){const[s,r]=k.useState([]),[a,c]=k.useState(""),[h,f]=k.useState(!1),g=e.multiSelect===!0,p=e.options??[],v=S=>{f(!0),t({id:e.id,...S}).finally(()=>{f(!1)})},_=S=>{if(!g){v({answer:S,selected:[S]});return}r(y=>y.includes(S)?y.filter(x=>x!==S):[...y,S])};return u.jsxs("div",{className:"ask",children:[u.jsxs("div",{className:"t",children:[u.jsx("span",{className:"g",children:"?"}),"需要你回答 · ",g?`多选${s.length===0?"":`(${String(s.length)} 项已选)`}`:"单选"]}),u.jsx("div",{className:"q",children:e.question}),p.length===0?null:u.jsx("div",{className:"opts",children:p.map(S=>{const y=s.includes(S.label);return u.jsxs("button",{className:y?"opt sel":"opt",disabled:h,onClick:()=>{_(S.label)},children:[u.jsx("span",{className:g?"box":"box radio",children:y?"✓":""}),S.label,S.description===void 0?null:u.jsx("span",{className:"desc",children:S.description})]},S.label)})}),u.jsxs("div",{className:"foot",children:[u.jsx("input",{className:"free",value:a,placeholder:"或者直接说你的想法…",onChange:S=>{c(S.target.value)},onKeyDown:S=>{if(S.key!=="Enter")return;S.preventDefault();const y=a.trim();y!==""&&v({answer:y})}}),g?u.jsxs("button",{className:"btn primary",disabled:h||s.length===0,onClick:()=>{v({selected:[...s]})},children:["提交这 ",s.length," 项"]}):u.jsx("span",{className:"muted",children:"Enter 提交"})]})]})}function E2({record:e}){return u.jsxs("div",{className:"perm expired",children:[u.jsxs("div",{className:"t",children:[u.jsx("span",{className:"g",style:{color:"var(--text-3)"},children:"⌛"}),"已失效 · ",e.reason,u.jsx("span",{style:{marginLeft:"auto",color:"var(--text-3)",fontWeight:400},children:new Date(e.atMs).toLocaleTimeString("zh-CN")})]}),u.jsxs("div",{className:"hint",children:[e.kind==="permission"?"审批":"提问",":",e.question]})]})}function Xb(e){const t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${String(t)} 秒`;const s=Math.floor(t/60);if(s<60){const c=t%60;return c===0?`${String(s)} 分`:`${String(s)} 分 ${String(c)} 秒`}const r=Math.floor(s/60),a=s%60;return`${String(r)} 时 ${String(a).padStart(2,"0")} 分`}function O0(e){switch(e.status){case"running":return"运行中";case"idle":return"空闲";case"provisioning":return"启动中";case"failed":return"失败";case"released":return"已释放"}}function rm(e){switch(e.status){case"running":return"run";case"provisioning":return"prov";case"failed":return"fail";case"idle":case"released":return"idle"}}function Gb(e){const t={total:e.length,running:0,idle:0,provisioning:0,failed:0};for(const s of e)s.status!=="released"&&(s.status==="running"?t.running+=1:s.status==="provisioning"?t.provisioning+=1:s.status==="failed"?t.failed+=1:t.idle+=1);return t}function Qb(e){const t={total:e.length,running:0,completed:0,failed:0,cancelled:0};for(const s of e)s.taskStatus==="running"?t.running+=1:s.taskStatus==="completed"?t.completed+=1:s.taskStatus==="failed"?t.failed+=1:t.cancelled+=1;return t}function Zb(e){let t=0;for(const s of e)s.taskStatus==="running"&&(t+=1);return{running:t,finished:e.length-t}}function j2(e){switch(e){case"all":return"全部";case"pending":return"待认领";case"in_progress":return"进行中";case"completed":return"已完成"}}function T2(e,t){switch(t){case"all":return e.pending+e.in_progress+e.completed;case"pending":return e.pending;case"in_progress":return e.in_progress;case"completed":return e.completed}}function D2(e,t){return e.filter(s=>s.taskId===t||s.otherTaskId===t)}function M2(e){switch(e.status){case"completed":return"已完成";case"in_progress":return"进行中";case"pending":return e.ready?"待认领":"被阻塞"}}function B0(e){return e.status==="completed"?"idle":e.status==="in_progress"?"run":e.ready?"idle":"prov"}function yf(e){return e.label!==void 0&&e.label!==""?e.label:e.agentId}function L0(e){if(e.taskStatus==="running")return"正在跑…";const t=(e.replyTail??"").trim().replace(/\s+/g," ");return t===""?"(无文本产出)":t}function A2(e){return{name:"lead",id:"lead",description:"当前会话 · 决策与合议",context:"fresh",kind:"temp",phase:"active",status:e?"running":"idle",unread:0}}function R2(e){return e.status==="pending"&&e.ready}function z0(e){return e.trim()===""?"(空命令)":e}function O2({team:e,agents:t,jobs:s,open:r,onOpen:a}){const c=Gb(e?.members??[]),h=Qb(t).running,f=Zb(s);return u.jsxs(u.Fragment,{children:[u.jsxs("button",{className:`tp-team-btn${r==="team"?" on":""}`,title:"智能体团队:成员花名册 + 共享任务板",onClick:()=>{a("team")},disabled:e===null,children:[u.jsx("span",{className:"ticon",children:"⊛"}),"智能体团队",u.jsx("span",{className:"n",children:e===null?0:e.members.length+1}),c.running>0?u.jsx("span",{className:"tp-live-dot"}):null]}),t.length===0?null:u.jsxs("button",{className:`chip tp-chip-btn${r==="agents"?" on":""}`,onClick:()=>{a("agents")},children:[u.jsx("span",{className:"g",children:"◉"}),t.length," 个子智能体",h>0?u.jsx("span",{className:"tp-live-dot"}):null,u.jsx("span",{className:"caret",children:"▾"})]}),f.running===0?null:u.jsxs("button",{className:`chip tp-chip-btn live${r==="jobs"?" on":""}`,onClick:()=>{a("jobs")},children:[u.jsx("span",{className:"pulse"}),f.running," 个后台任务运行中",u.jsx("span",{className:"caret",children:"▾"})]})]})}function du({title:e,count:t,facts:s,foot:r,wide:a,onClose:c,children:h}){return u.jsx("div",{className:"tp-overlay",onMouseDown:c,children:u.jsxs("div",{className:`tp-pop${a===!0?" wide":""}`,role:"dialog","aria-label":e,onMouseDown:f=>{f.stopPropagation()},children:[u.jsxs("div",{className:"tp-pop-head",children:[u.jsx("span",{className:"ttl",children:e}),t===void 0?null:u.jsx("span",{className:"count",children:t}),s===void 0?null:u.jsx("span",{className:"facts",children:s}),u.jsx("button",{className:"tp-close",title:"关闭","aria-label":"关闭弹层",onClick:c,children:"✕"})]}),u.jsx("div",{className:"tp-pop-body",children:h}),r===void 0?null:u.jsx("div",{className:"tp-pop-foot",children:r})]})})}function B2({kind:e,panel:t,session:s,onClose:r,onOpenMember:a}){return e==="agents"?u.jsx(z2,{panel:t,onClose:r}):e==="jobs"?u.jsx(H2,{panel:t,onClose:r}):u.jsx(L2,{panel:t,session:s,onClose:r,onOpenMember:a})}function L2({panel:e,session:t,onClose:s,onOpenMember:r}){const a=e.team,[c,h]=k.useState("all"),[f,g]=k.useState(new Set),[p,v]=k.useState(null),[_,S]=k.useState(null);if(a===null)return u.jsx(du,{title:"智能体团队",onClose:s,children:u.jsx("div",{className:"tp-empty",children:"还没有团队读数(会话未选中或读取失败)。"})});const y=A2(a.running),x=Gb(a.members),w=M=>{h(M),e.setFilter(M==="all"?{}:{status:M})},j=M=>{g(T=>{const O=new Set(T);return O.has(M)?O.delete(M):O.add(M),O})},N=async M=>{S(null),v(M.id);try{await l2(t,M.id,M.revision)}catch(T){const O=T instanceof Error?T.message:String(T);S(O.includes("revision 过期")?"这张任务刚被改过(revision 过期):读数已刷新,请再试一次。":O)}finally{v(null),await e.reload({silent:!0})}};return u.jsxs(du,{title:"成员",count:a.members.length+1,wide:!0,facts:u.jsxs(u.Fragment,{children:[u.jsxs("span",{children:["运行中 ",x.running+(a.running?1:0)]}),u.jsx("span",{className:"sep",children:"·"}),u.jsxs("span",{children:["空闲 ",x.idle+(a.running?0:1)]}),u.jsx("span",{className:"sep",children:"·"}),u.jsxs("span",{children:["启动中 ",x.provisioning]}),u.jsx("span",{className:"sep",children:"·"}),u.jsxs("span",{children:["失败 ",x.failed]})]}),onClose:s,foot:u.jsxs(u.Fragment,{children:[u.jsx("span",{children:"认领 / 成员消息是写操作(均走服务端校验)"}),u.jsx("button",{className:"go",onClick:()=>{e.reload({silent:!0})},children:"刷新"})]}),children:[a.failures.length>0?u.jsxs("div",{className:"tp-banner warn",children:[u.jsx("span",{children:"⚠"}),u.jsxs("span",{children:["投影层拒绝了 ",a.failures.length," 条团队事件:",a.failures[0]]})]}):null,_===null?null:u.jsxs("div",{className:"tp-banner err",children:[u.jsx("span",{children:"⚠"}),u.jsx("span",{children:_}),u.jsx("button",{onClick:()=>{S(null)},children:"知道了"})]}),u.jsxs("div",{className:"tp-member-grid",children:[u.jsxs("div",{className:`tp-member lead${y.status==="running"?" running":""}`,children:[u.jsx("div",{className:"tp-ava",children:"●"}),u.jsxs("div",{className:"tp-m-main",children:[u.jsxs("div",{className:"tp-m-name",children:[u.jsx("span",{className:"nm",children:"lead"}),u.jsx("span",{className:"tp-badge lead",children:"LEAD"})]}),u.jsx("div",{className:"tp-m-desc",children:y.description}),u.jsxs("div",{className:"tp-m-status",children:[u.jsx("span",{className:`st-dot ${rm(y)}`}),O0(y)," · 当前会话"]})]})]}),a.members.map(M=>u.jsxs("div",{className:`tp-member${M.status==="failed"?" failed":""}${M.status==="provisioning"?" provisioning":""}${M.status==="running"?" running":""}`,children:[u.jsx("div",{className:"tp-ava",children:(M.status==="running","◌")}),u.jsxs("div",{className:"tp-m-main",children:[u.jsxs("div",{className:"tp-m-name",children:[u.jsx("span",{className:"nm",children:M.name}),u.jsx("span",{className:`tp-badge${M.kind==="seat"?" seat":""}`,children:M.kind==="seat"?"席位":"临时"}),M.unread>0?u.jsx("span",{className:"tp-badge unread",children:M.unread}):null]}),u.jsx("div",{className:"tp-m-desc",children:M.description}),u.jsxs("div",{className:"tp-m-status",children:[u.jsx("span",{className:`st-dot ${rm(M)}`}),M.status==="failed"&&M.error!==void 0?u.jsxs(u.Fragment,{children:["失败 ",u.jsxs("span",{className:"why",children:["· ",M.error]})]}):M.status==="idle"?"空闲 · 可唤醒":O0(M)]})]}),r===void 0?null:u.jsx("button",{className:"tp-talk",type:"button",title:M.status==="failed"||M.status==="provisioning"?"成员不可对话(失败/启动中)":"打开子会话并给它发消息",disabled:M.status==="failed"||M.status==="provisioning",onClick:()=>{r(M.name)},children:"对话"})]},M.id))]}),u.jsxs("div",{className:"tp-tsec",children:[u.jsx("span",{className:"ttl",children:"共享任务"}),u.jsx("span",{className:"count",children:a.counts.pending+a.counts.in_progress+a.counts.completed}),u.jsx("div",{className:"tp-fchips",children:["all","pending","in_progress","completed"].map(M=>u.jsxs("button",{className:`fc${c===M?" on":""}`,onClick:()=>{w(M)},children:[j2(M)," ",T2(a.counts,M)]},M))})]}),a.tasks.tasks.length===0?u.jsx("div",{className:"tp-empty",children:a.counts.pending+a.counts.in_progress+a.counts.completed===0?"还没有共享任务——Lead 建的活会出现在这里(轮询自动刷新)。":"这个筛选下没有任务。"}):null,a.tasks.tasks.map(M=>{const T=D2(a.warnings,M.id),O=f.has(M.id);return u.jsxs("div",{className:`tp-tcard${O?" open":""}`,children:[u.jsxs("div",{className:"tp-trow1",children:[u.jsx("span",{className:`st-dot ${B0(M)}`}),u.jsx("span",{className:"subj",title:M.subject,children:M.subject}),u.jsxs("span",{className:`tp-tstat${M.status==="completed"?" done":M.status==="in_progress"?" prog":" todo"}`,children:[u.jsx("span",{className:`st-dot ${B0(M)}`}),M2(M)]})]}),M.description===""?null:u.jsx("div",{className:"tp-tdesc",children:M.description}),u.jsxs("div",{className:"tp-tfoot",children:[u.jsx("span",{className:"tid",children:M.id}),u.jsx("span",{children:"·"}),u.jsx("span",{className:"who",children:M.ownerName===void 0?"Owner 未认领":`Owner ${M.ownerName}`}),M.writeScopes.length===0?null:u.jsxs(u.Fragment,{children:[u.jsx("span",{children:"·"}),u.jsxs("span",{className:"scope",children:["写入范围 ",M.writeScopes.join(" ")]})]}),R2(M)?u.jsx("button",{className:"tp-claim",disabled:a.running||p!==null,title:a.running?"会话在跑:等这一轮结束再认领(任务板同时只许一个写者)":"认领给当前会话(lead)",onClick:()=>{N(M)},children:p===M.id?"认领中…":"认领"}):null,u.jsx("button",{className:"expand",onClick:()=>{j(M.id)},children:O?"收起 ▴":"展开 ▾"})]}),O?u.jsxs("div",{className:"tp-tdetail",children:[u.jsxs("div",{className:"tp-drow",children:[u.jsx("span",{className:"dk",children:"版本"}),u.jsxs("span",{className:"dv",children:[u.jsxs("span",{className:"mono",children:["revision ",M.revision]}),"(CAS:认领/改状态要带这版,spec 决策 21)"]})]}),u.jsxs("div",{className:"tp-drow",children:[u.jsx("span",{className:"dk",children:"阻塞"}),u.jsxs("span",{className:"dv",children:[M.blockedBy.length===0?"无":M.blockedBy.join("、"),M.ready?"":"(未完成,暂不可认领)"]})]}),u.jsxs("div",{className:"tp-drow",children:[u.jsx("span",{className:"dk",children:"写入范围"}),u.jsx("span",{className:"dv",children:M.writeScopes.length===0?"未声明":M.writeScopes.map(U=>u.jsx("span",{className:"tp-scope-chip",children:U},U))})]}),M.obligations.length===0?null:u.jsxs("div",{className:"tp-drow",children:[u.jsx("span",{className:"dk",children:"核验义务"}),u.jsx("span",{className:"dv",children:M.obligations.map(U=>u.jsx("span",{className:"tp-scope-chip",children:U},U))})]}),T.map(U=>{const z=U.taskId===M.id?U.otherTaskId:U.taskId;return u.jsxs("div",{className:"tp-scope-warn",children:[u.jsx("span",{className:"w",children:"⚠"}),u.jsxs("span",{children:["与 ",u.jsx("b",{children:z})," 的写入范围重叠(",U.a," 与 ",U.b,")——只提醒不阻塞,spec 决策 16。"]})]},`${U.taskId}:${U.otherTaskId}:${U.a}:${U.b}`)})]}):null]},M.id)}),a.tasks.hasMore?u.jsxs("div",{className:"tp-more",children:["还有 ",a.tasks.total-a.tasks.tasks.length," 条(筛选/分页由服务端算)"]}):null]})}function z2({panel:e,onClose:t}){const[s,r]=k.useState(null),[a,c]=k.useState(null),[h,f]=k.useState(()=>Date.now());k.useEffect(()=>{const v=setInterval(()=>{f(Date.now())},1e3);return()=>{clearInterval(v)}},[]);const g=Qb(e.agents),p=async v=>{c(null),r(v.agentId);try{await o2(v.agentId)}catch(_){c(_ instanceof Error?_.message:String(_))}finally{r(null),await e.reload({silent:!0})}};return u.jsxs(du,{title:"子智能体",count:e.agents.length,facts:u.jsxs(u.Fragment,{children:[u.jsxs("span",{children:["运行中 ",g.running]}),u.jsx("span",{className:"sep",children:"·"}),u.jsxs("span",{children:["已完成 ",g.completed]}),u.jsx("span",{className:"sep",children:"·"}),u.jsxs("span",{children:["失败 ",g.failed]}),u.jsx("span",{className:"sep",children:"·"}),u.jsxs("span",{children:["已停止 ",g.cancelled]})]}),onClose:t,foot:u.jsxs(u.Fragment,{children:[u.jsx("span",{children:"进程内读数 · 重启即空"}),u.jsx("button",{className:"go",onClick:()=>{e.reload({silent:!0})},children:"刷新"})]}),children:[a===null?null:u.jsxs("div",{className:"tp-banner err",children:[u.jsx("span",{children:"⚠"}),u.jsx("span",{children:a}),u.jsx("button",{onClick:()=>{c(null)},children:"知道了"})]}),e.agents.length===0?u.jsx("div",{className:"tp-empty",children:"没有子智能体在跑,也没有历史记录。"}):null,e.agents.map(v=>{const _=v.taskStatus==="running",S=Date.parse(v.startedAt),y=_&&Number.isFinite(S)?h-S:v.elapsedMs;return u.jsxs("div",{className:"tp-srow",children:[u.jsx("span",{className:`st-dot ${rm({status:_?"running":v.taskStatus==="failed"?"failed":(v.taskStatus==="completed","idle")})}`}),u.jsxs("div",{className:"tp-s-main",children:[u.jsxs("div",{className:"tp-s-title",children:[u.jsx("span",{className:"tp-kind",children:"subagent"}),u.jsx("span",{className:"nm",title:yf(v),children:yf(v)})]}),u.jsx("div",{className:"tp-s-sub",title:L0(v),children:L0(v)})]}),u.jsxs("div",{className:"tp-s-right",children:[u.jsx("span",{className:`tp-s-status${_?" run":v.taskStatus==="failed"?" fail":v.taskStatus==="completed"?" done":""}`,children:v.statusText}),u.jsx("span",{className:`tp-s-time${_?" run":""}`,children:Xb(y)}),_?u.jsx("button",{className:"tp-stop-btn",title:"停止这只子智能体","aria-label":`停止 ${yf(v)}`,disabled:s!==null,onClick:()=>{p(v)},children:s===v.agentId?"◌":"■"}):null]})]},v.agentId)})]})}function H2({panel:e,onClose:t}){const[s,r]=k.useState(!1),[a,c]=k.useState(new Set),[h,f]=k.useState(null),[g,p]=k.useState(!1),[v,_]=k.useState(null),[S,y]=k.useState(()=>Date.now());k.useEffect(()=>{const T=setInterval(()=>{y(Date.now())},1e3);return()=>{clearInterval(T)}},[]);const x=Zb(e.jobs),w=s?e.jobs:e.jobs.filter(T=>T.taskStatus==="running"),j=T=>{c(O=>{const U=new Set(O);return U.has(T)?U.delete(T):U.add(T),U})},N=async T=>{_(null),f(T.taskId);try{await u2(T.taskId)}catch(O){_(O instanceof Error?O.message:String(O))}finally{f(null),await e.reload({silent:!0})}},M=async()=>{_(null),p(!0);try{await h2()}catch(T){_(T instanceof Error?T.message:String(T))}finally{p(!1),await e.reload({silent:!0})}};return u.jsxs(du,{title:"后台任务",facts:u.jsxs(u.Fragment,{children:[u.jsxs("span",{children:[x.running," 个运行中"]}),u.jsx("span",{className:"sep",children:"·"}),u.jsxs("span",{children:["已结束 ",x.finished]})]}),onClose:t,foot:u.jsxs(u.Fragment,{children:[u.jsx("button",{className:s?"on":"",onClick:()=>{r(T=>!T)},children:s?"只看运行中":`查看已结束 ${x.finished}`}),u.jsx("button",{className:"go",disabled:x.finished===0||g,title:x.finished===0?"没有已结束的任务":"清掉已结束条目(运行中的不动)",onClick:()=>{M()},children:g?"清空中…":"清空"})]}),children:[v===null?null:u.jsxs("div",{className:"tp-banner err",children:[u.jsx("span",{children:"⚠"}),u.jsx("span",{children:v}),u.jsx("button",{onClick:()=>{_(null)},children:"知道了"})]}),w.length===0?u.jsx("div",{className:"tp-empty",children:s?"没有后台任务。":"没有正在运行的后台任务。"}):null,w.map(T=>{const O=T.taskStatus==="running",U=Date.parse(T.startedAt),z=O&&Number.isFinite(U)?S-U:void 0,A=a.has(T.taskId);return u.jsxs("div",{className:"tp-jrow",children:[u.jsx("span",{className:`st-dot ${O?"run":T.taskStatus==="failed"?"fail":(T.taskStatus==="completed","idle")}`}),u.jsxs("div",{className:"tp-j-main",children:[u.jsxs("div",{className:"tp-j-cmd",children:[u.jsx("span",{className:"tp-kind",children:"bash"}),u.jsx("span",{className:"nm",title:z0(T.command),children:z0(T.command)})]}),u.jsxs("div",{className:"tp-j-sub",children:[u.jsx("span",{children:T.taskId}),u.jsx("span",{className:"sep",children:"·"}),u.jsx("span",{children:O?`已运行 ${Xb(z??0)}`:T.statusText}),T.exitCode===void 0?null:u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"sep",children:"·"}),u.jsxs("span",{children:["exit ",T.exitCode]})]}),T.truncated===!0?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"sep",children:"·"}),u.jsx("span",{children:"输出被截断"})]}):null]}),A?u.jsx("pre",{className:"tp-out",children:T.outputTail===""?"(无输出)":T.outputTail}):null]}),u.jsxs("div",{className:"tp-s-right",children:[u.jsx("span",{className:`tp-s-status${O?" run":T.taskStatus==="failed"?" fail":T.taskStatus==="completed"?" done":""}`,children:T.statusText}),u.jsx("button",{className:"tp-caret-btn",title:A?"收起输出":"展开输出",onClick:()=>{j(T.taskId)},children:A?"▴":"▾"}),O?u.jsx("button",{className:"tp-stop-btn",title:"停止这条后台任务","aria-label":`停止 ${T.taskId}`,disabled:h!==null,onClick:()=>{N(T)},children:h===T.taskId?"◌":"■"}):null]})]},T.taskId)})]})}const I2=[{icon:"◇",title:"摸清这个仓库",desc:"先看 spec 和目录结构,给我一张地图",prompt:"先带我把这个仓库摸一遍:spec 和目录结构各有什么,给我一张地图。"},{icon:"✓",title:"把 check 跑绿",desc:"typecheck + 静态闸 + vitest,红了就修",prompt:"把 npm run check 跑一遍,红了的修到全绿,把每一步的证据贴给我。"},{icon:"↳",title:"审阅未提交的改动",desc:"逐文件说风险,判断要不要拆",prompt:"审阅一下当前未提交的改动:逐个文件说做了什么、风险在哪、该不该拆。"},{icon:"▤",title:"改主页面原型",desc:"布局 / 配色 / 交互,你提我改",prompt:"按刚才的原型改主页面:三栏比例、目标条、输入卡,哪里不对你说。"}],U2=[{name:"/model",desc:"换模型(可跨供应商)",scope:"本会话"},{name:"/compact",desc:"压缩上下文",scope:"本会话"},{name:"/goal",desc:"设定目标并持续追踪",scope:"目标"},{name:"/review",desc:"审阅当前改动",scope:"技能"}],P2=[{id:"deepseek-v4",label:"deepseek-v4",note:"1M 上下文 · 当前"},{id:"deepseek-v4-fast",label:"deepseek-v4-fast",note:"低延迟"},{id:"claude-sonnet-4.5",label:"claude-sonnet-4.5",note:"另一供应商"}];function fu(e){return e.kind==="directory"?`${e.path}/`:e.path}const q2=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function F2(e,t){return new RegExp(`(^|\\s)@${q2(t)}(?=\\s|$)`).test(e)}function H0(e,t){const s=e.trim(),r=new Set,c=t.filter(h=>{const f=fu(h);return r.has(f)||F2(s,f)?!1:(r.add(f),!0)}).map(h=>`@${fu(h)}`).join(" ");return c===""?s:s===""?c:`${s}
|
|
10
|
+
|
|
11
|
+
${c}`}function $2(e){const t=[],s=/(@[^\s@]+)/g;let r=0;for(const a of e.matchAll(s)){const c=a.index;c>r&&t.push({text:e.slice(r,c),mention:!1}),t.push({text:a[0],mention:!0}),r=c+a[0].length}return r<e.length&&t.push({text:e.slice(r),mention:!1}),t}let I0=0;function V2(){return I0+=1,`att-${String(I0)}`}function Y2(e){return Me(`/upload?name=${encodeURIComponent(e.name)}`,{method:"POST",headers:{"content-type":"application/octet-stream"},body:e})}function K2(e){return e<1024?`${String(e)} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function W2(e,t=0){const s=a=>String(a).padStart(2,"0");return`粘贴图片-${`${s(e.getHours())}${s(e.getMinutes())}${s(e.getSeconds())}`}${t===0?"":`-${String(t)}`}.png`}function U0(e){const t=new Set,s=[];for(const r of e)r.state!=="ok"||r.result===void 0||Nu(r)||t.has(r.result.path)||(t.add(r.result.path),s.push({path:r.result.path,kind:"file"}));return s}function lm(e){const t=new Set,s=[];for(const r of e)r.state!=="ok"||r.result===void 0||!Nu(r)||t.has(r.result.path)||(t.add(r.result.path),s.push({path:r.result.path}));return s}function X2(e){const t=lm(e).length;return t===0?"":Array.from({length:t},(s,r)=>`[图片 #${String(r+1)}]`).join(" ")}function G2(e,t,s){return s.some(r=>r.state!=="ok")?!1:e.trim()!==""||t.length>0||s.length>0}const Q2=/\.(?:png|jpe?g|gif|webp|avif|bmp|heic|heif)$/iu;function Nu(e){const t=e.mediaType?.trim().toLowerCase()??"";return t!==""?t.startsWith("image/"):Q2.test(e.name)}function Z2(e){return e.some(Nu)}function P0(e,t){return t!==!1?null:Z2(e)?"本模型不支持图片":null}const Jb=k.forwardRef(function({value:t,onChange:s,onSend:r,contextLabel:a,empty:c=!1,busy:h=!1,onStop:f,onQueue:g,onInterjectAll:p,profile:v,onProfile:_,session:S,planMode:y=!1,planDisabled:x=!1,onTogglePlan:w},j){const[N,M]=k.useState(!1),[T,O]=k.useState(!1),U=k.useRef(null),z=k.useRef(null),[A,Y]=k.useState([]),[ue,P]=k.useState([]),[J,G]=k.useState(null),[L,q]=k.useState(0),[F,V]=k.useState([]),[Q,K]=k.useState(!1),[ge,D]=k.useState(null),[Ae,Se]=k.useState(!1),[R,E]=k.useState("deepseek-v4"),[ie,ce]=k.useState(!1),[fe,ve]=k.useState(void 0),[Z,le]=k.useState(null);k.useEffect(()=>{let oe=!1;return Wb(S).then(Ne=>{oe||ve({name:Ne.current,vision:Ne.currentVision})}).catch(()=>{oe||ve(void 0)}),()=>{oe=!0}},[S]),k.useEffect(()=>{P0(A,fe?.vision??null)===null&&le(null)},[A,fe]);const se=()=>{U.current?.focus()},me=oe=>{for(const Ne of oe){const Le=V2();Y(Qe=>[...Qe,{id:Le,name:Ne.name,state:"uploading",mediaType:Ne.type}]),Y2(Ne).then(Qe=>{Y(ae=>ae.map(_e=>_e.id===Le?{..._e,name:Qe.name,state:"ok",result:Qe}:_e))}).catch(Qe=>{Y(ae=>ae.map(_e=>_e.id===Le?{..._e,state:"failed",error:Qe instanceof Error?Qe.message:String(Qe)}:_e))})}};k.useImperativeHandle(j,()=>({addFiles:me})),k.useEffect(()=>{const oe=U.current;oe!==null&&(oe.style.height="auto",oe.style.height=`${String(Math.min(oe.scrollHeight,220))}px`)},[t]);const xe=J?.kind==="mention"?F:[],Fe=J?.kind==="slash"?U2.filter(oe=>oe.name.includes(J.query)):[],Xe=G2(t,ue,A),Ge=A.filter(oe=>oe.state==="failed");k.useEffect(()=>{if(J?.kind!=="mention")return;const oe=J.query;let Ne=!0;Se(!0);const Le=setTimeout(()=>{_2(oe).then(Qe=>{Ne&&(V(Qe.candidates),K(Qe.truncated),D(null))}).catch(Qe=>{Ne&&(V([]),K(!1),D(Qe instanceof Error?Qe.message:String(Qe)))}).finally(()=>{Ne&&Se(!1)})},120);return()=>{Ne=!1,clearTimeout(Le)}},[J]);const nt=oe=>{const Ne={path:oe.path,kind:oe.kind};P(Le=>Le.some(Qe=>Qe.path===Ne.path)?Le:[...Le,Ne]),s(t.replace(/@([^\s@]*)$/,"")),G(null),se()},$e=oe=>{s(`${oe} `),G(null),se()},Ot=oe=>{s(oe);const Ne=/@([^\s@]*)$/.exec(oe);if(Ne!==null){G({kind:"mention",query:Ne[1]??""}),q(0);return}if(oe.startsWith("/")&&!oe.includes(" ")){G({kind:"slash",query:oe.slice(1)}),q(0);return}G(null)},kt=()=>{const oe=P0(A,fe?.vision??null);return oe===null?!1:(le({text:oe,hint:"换一个声明了图片输入的模型,或先把图片移除。"}),!0)},ke=()=>{if(kt())return;const oe=lm(A),Ne=H0(t,[...ue,...U0(A)]);r(Ne.trim()===""&&oe.length>0?X2(A):Ne,oe.length===0?void 0:oe),P([]),Y([])},Oe=oe=>{if(J!==null){const Ne=J.kind==="mention"?xe:Fe;if(oe.key==="ArrowDown"){oe.preventDefault(),q(Le=>Ne.length===0?0:(Le+1)%Ne.length);return}if(oe.key==="ArrowUp"){oe.preventDefault(),q(Le=>Ne.length===0?0:(Le-1+Ne.length)%Ne.length);return}if(oe.key==="Escape"){oe.preventDefault(),G(null);return}if(oe.key==="Enter"||oe.key==="Tab"&&J.kind==="slash"){if(Ne.length===0)return;if(oe.preventDefault(),J.kind==="mention"){const Le=xe[L]??xe[0];Le!==void 0&&nt(Le)}else{const Le=Fe[L]??Fe[0];Le!==void 0&&$e(Le.name)}return}}if(oe.key==="Enter"&&!oe.shiftKey&&(oe.metaKey||oe.ctrlKey)){oe.preventDefault(),p?.();return}if(oe.key==="Enter"&&!oe.shiftKey){if(oe.preventDefault(),h){if(kt())return;if(lm(A).length>0){le({text:"运行中不能排队带图",hint:"等这一轮结束再发;或先把图片移除。"});return}if(up(t)!==null){le({text:"运行中不能改目标",hint:"等这一轮结束再发;或先停止当前回合。"});return}(t.trim()!==""||ue.length>0||A.length>0)&&(g?.(H0(t,[...ue,...U0(A)])),P([]),Y([]));return}Xe&&ke()}};return u.jsxs("div",{className:c?"composer empty-composer":"composer",children:[ue.length>0||A.length>0?u.jsxs("div",{className:"chips",children:[ue.map(oe=>u.jsxs("span",{className:"att",children:[u.jsx("span",{className:"g",children:"@"}),u.jsx("span",{className:"att-path",children:fu(oe)}),u.jsx("button",{className:"x",title:"移除引用",onClick:()=>{P(Ne=>Ne.filter(Le=>Le.path!==oe.path))},children:"✕"})]},`ref-${oe.path}`)),A.map(oe=>{const Ne=oe.result,Le=Ne?.textLike??!0,Qe=oe.state==="uploading"?" uploading":oe.state==="failed"?" failed":"";return u.jsxs("span",{className:`att${Qe}`,title:Ne?.path??oe.name,children:[Ne!==void 0&&!Ne.textLike?u.jsx("img",{className:"thumb",src:`/file/raw?path=${encodeURIComponent(Ne.path)}`,alt:""}):u.jsx("span",{className:"g",children:"▤"}),u.jsx("span",{className:"att-name",children:oe.name}),Ne===void 0?null:u.jsx("span",{className:"att-size",children:K2(Ne.bytes)}),oe.state==="uploading"?u.jsx("span",{className:"att-tag muted",children:"上传中"}):oe.state==="failed"?u.jsx("span",{className:"att-tag bad",children:"失败"}):Le?u.jsx("span",{className:"att-tag ok",children:"可读"}):Nu(oe)?u.jsx("span",{className:"att-tag muted",children:"图片"}):u.jsx("span",{className:"att-tag warn",children:"非文本 · 只落盘"}),oe.state==="uploading"?u.jsx("span",{className:"spinner"}):null,u.jsx("button",{className:"x",title:"移除附件(只去掉本次输入里的引用;已上传的文件仍在 .daluo/uploads/,删除要走审批)",onClick:()=>{Y(ae=>ae.filter(_e=>_e.id!==oe.id))},children:"✕"})]},oe.id)})]}):null,J?.kind==="mention"?u.jsxs("div",{className:"menu",children:[u.jsxs("div",{className:"menu-head",children:[u.jsx("span",{children:"引用文件 · 工作区 daluo"}),u.jsx("span",{style:{marginLeft:"auto"},children:"↑↓ 选择 · Enter 插入 · Esc 关闭"})]}),xe.map((oe,Ne)=>u.jsxs("button",{className:Ne===L?"menu-item sel":"menu-item",onMouseDown:Le=>{Le.preventDefault(),nt(oe)},children:[u.jsx("span",{className:"g",children:oe.kind==="directory"?"◻":"▤"}),u.jsx("span",{className:"path",children:fu(oe)}),oe.kind==="directory"?u.jsx("span",{className:"key",children:"目录"}):null]},`${oe.kind}-${oe.path}`)),ge!==null?u.jsxs("div",{className:"menu-item empty",children:["候选取不到:",ge]}):null,ge===null&&xe.length===0&&!Ae?u.jsx("div",{className:"menu-item empty",children:"没有匹配的路径"}):null,Ae?u.jsx("div",{className:"menu-item empty",children:"查工作区…"}):null,Q?u.jsx("div",{className:"menu-foot",children:"结果可能被截断(遍历到 5 万条上限就停)——先打几个字符收窄"}):null]}):null,J?.kind==="slash"?u.jsxs("div",{className:"menu",children:[u.jsxs("div",{className:"menu-head",children:[u.jsx("span",{children:"技能与指令"}),u.jsx("span",{style:{marginLeft:"auto"},children:"Tab 补全 · Enter 执行 · Esc 关闭"})]}),Fe.map((oe,Ne)=>u.jsxs("button",{className:Ne===L?"menu-item sel":"menu-item",onMouseDown:Le=>{Le.preventDefault(),$e(oe.name)},children:[u.jsx("span",{className:"g",children:"›"}),oe.name," ",oe.desc,u.jsx("span",{className:"key",children:oe.scope})]},oe.name)),Fe.length===0?u.jsx("div",{className:"menu-item",children:"没有匹配的指令"}):null]}):null,u.jsx("input",{ref:z,type:"file",multiple:!0,hidden:!0,onChange:oe=>{const Ne=Array.from(oe.target.files??[]);oe.target.value="",me(Ne)}}),u.jsx("textarea",{ref:U,rows:1,value:t,placeholder:"说一句话就开始(Enter 提交,Shift+Enter 换行)",onChange:oe=>{Ot(oe.target.value)},onKeyDown:Oe,onPaste:oe=>{const Ne=Array.from(oe.clipboardData.files).filter(Qe=>Qe.type.startsWith("image/"));if(Ne.length===0)return;oe.preventDefault();const Le=new Date;me(Ne.map((Qe,ae)=>new File([Qe],W2(Le,ae),{type:Qe.type})))}}),Z===null?null:u.jsxs("div",{className:"att-error",children:[u.jsx("div",{className:"att-error-title",children:u.jsx("b",{children:Z.text})}),u.jsx("div",{className:"att-error-line dim",children:Z.hint})]}),Ge.length===0?null:u.jsxs("div",{className:"att-error",children:[u.jsxs("div",{className:"att-error-title",children:[u.jsx("b",{children:"上传被拒:"}),Ge[0]?.error]}),Ge.slice(1).map(oe=>u.jsxs("div",{className:"att-error-line",children:[oe.name,":",oe.error]},oe.id)),u.jsx("div",{className:"att-error-line dim",children:"大文件请直接放进工作区再用 @ 引用(cp 一次,没有中间层);空文件不上传。"})]}),u.jsxs("div",{className:"composer-bar",children:[u.jsx("button",{className:"tool-btn key",title:"添加附件(也可以把文件拖进来,或直接粘贴截图)",onClick:()=>{z.current?.click()},children:"+"}),u.jsx("button",{className:"tool-btn key",title:"引用文件 @",onClick:()=>{G({kind:"mention",query:""}),q(0),se()},children:"@"}),u.jsx("button",{className:"tool-btn key",title:"跑本机命令 !",onClick:()=>{s(`${t}!`),se()},children:"!"}),u.jsx("button",{className:"tool-btn key",title:"技能与指令 /",onClick:()=>{s("/"),G({kind:"slash",query:""}),q(0),se()},children:"/"}),u.jsx("span",{className:"grow"}),_===void 0?null:u.jsxs("span",{style:{position:"relative"},children:[u.jsxs("button",{className:v==="danger-full"?"model-chip profile-chip danger":"model-chip profile-chip",title:"切换这个会话的权限档(写 policy/profile,下一轮生效)",onClick:()=>{M(oe=>!oe)},children:[u.jsx("span",{className:"g",style:{fontSize:"11px"},children:"⛨"}),v===void 0?"缺省档":q0[v],u.jsx("span",{className:"g g-dim",style:{fontSize:"10px"},children:"▾"})]}),N?u.jsxs("div",{className:"menu",style:{position:"absolute",bottom:"36px",right:0,width:"300px",marginBottom:0},children:[u.jsx("div",{className:"menu-head",children:"会话权限档 · 只影响这个会话"}),["read-only","workspace","danger-full"].map(oe=>u.jsxs("button",{className:oe===v?"menu-item sel":"menu-item",onClick:()=>{if(M(!1),oe!==v){if(oe==="danger-full"){O(!0);return}_(oe)}},children:[u.jsx("span",{className:"g",children:oe===v?"●":"○"}),q0[oe],u.jsx("span",{className:"key",children:J2[oe]})]},oe)),u.jsx("div",{className:"menu-head",style:{borderTop:"1px solid var(--border)",paddingTop:"6px"},children:"切档写进事件日志,下一轮请求生效"})]}):null]}),u.jsx("button",{className:"tool-btn g",title:"上下文用量",children:a}),u.jsx("button",{className:y===!0?"plan-toggle on":"plan-toggle",type:"button",title:x===!0?"运行中不能切计划模式:等这一轮结束":"计划模式:只读探索,不写文件",disabled:x===!0,onClick:w,children:"◐ 计划模式"}),u.jsxs("span",{style:{position:"relative"},children:[u.jsxs("button",{className:"model-chip",title:"选择模型",onClick:()=>{ce(oe=>!oe)},children:[u.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:"var(--green)",display:"inline-block"}}),R,u.jsx("span",{className:"g g-dim",style:{fontSize:"10px"},children:"▾"})]}),ie?u.jsxs("div",{className:"menu",style:{position:"absolute",bottom:"36px",right:0,width:"280px",marginBottom:0},children:[u.jsx("div",{className:"menu-head",children:"选择模型"}),P2.map(oe=>u.jsxs("button",{className:oe.id===R?"menu-item sel":"menu-item",onClick:()=>{E(oe.label),ce(!1)},children:[u.jsx("span",{className:"g",children:oe.id===R?"●":"○"}),oe.label,u.jsx("span",{className:"key",children:oe.note})]},oe.id))]}):null]}),h?u.jsx("button",{className:"stop",title:"停止","aria-label":"停止",onClick:()=>f?.(),children:"■"}):u.jsx("button",{className:"send",title:"发送","aria-label":"发送",disabled:!Xe,onClick:ke,children:u.jsx("span",{className:"g",style:{fontSize:"16px"},children:"↵"})})]}),T?u.jsx("div",{className:"modal-mask",role:"dialog","aria-modal":"true",children:u.jsxs("div",{className:"modal",children:[u.jsxs("h3",{children:[u.jsx("span",{className:"g",style:{color:"var(--red)"},children:"⚠"})," 切到「完全放开」?"]}),u.jsx("p",{children:"这个会话不再限制路径,也不再跑 Guardian 审查:写文件、跑命令都会直接执行。风险和它造成的一切由你自己兜。"}),u.jsxs("div",{className:"modal-actions",children:[u.jsx("button",{className:"btn",onClick:()=>{O(!1)},children:"取消"}),u.jsx("button",{className:"btn danger",onClick:()=>{O(!1),_?.("danger-full")},children:"确认切换"})]})]})}):null]})}),q0={"read-only":"只读",workspace:"可写工作区","danger-full":"完全放开"},J2={"read-only":"只能读",workspace:"工作区内可写","danger-full":"不限路径 · 不审查"},eE=e=>e==="completed"?"✓ 已完成":e==="paused"?"已暂停":e==="blocked"?"⊘ 已阻塞":"进行中";function tE({goal:e,busy:t,onPause:s,onResume:r,onClear:a}){return e.objective===""?null:u.jsxs("div",{className:`goal-bar${e.status==="completed"?" done":""}${e.status==="paused"?" paused":""}`,children:[u.jsx("span",{className:"tag",children:"◆ 目标"}),u.jsx("span",{className:"txt",title:e.objective,children:e.objective}),u.jsx("span",{className:"goal-status",children:eE(e.status)}),e.status==="active"?u.jsx("button",{className:"goal-icon",type:"button",title:"暂停目标(挂起,不再要求完成表态)","aria-label":"暂停目标",disabled:t,onClick:s,children:"⏸"}):null,e.status==="paused"?u.jsx("button",{className:"goal-icon",type:"button",title:"恢复目标(写回 active)","aria-label":"恢复目标",disabled:t,onClick:r,children:"▶"}):null,u.jsx("button",{className:"goal-icon",type:"button",title:"清除目标(直接消失,历史不删)","aria-label":"清除目标",disabled:t,onClick:a,children:"✕"})]})}function Sf(e){return Array.from(e.dataTransfer.types).includes("Files")}function ex(e){const[t,s]=k.useState(!1),r=k.useRef(0);return{dragging:t,handlers:{onDragEnter:a=>{Sf(a)&&(a.preventDefault(),r.current+=1,s(!0))},onDragOver:a=>{Sf(a)&&(a.preventDefault(),a.dataTransfer.dropEffect="copy")},onDragLeave:a=>{Sf(a)&&(r.current=Math.max(0,r.current-1),r.current===0&&s(!1))},onDrop:a=>{a.preventDefault(),r.current=0,s(!1);const c=Array.from(a.dataTransfer.files);c.length>0&&e(c)}}}}function tx(){return u.jsx("div",{className:"drop-overlay",children:u.jsxs("div",{className:"drop-card",children:[u.jsx("div",{className:"drop-icon",children:"+"}),u.jsxs("div",{className:"drop-title",children:["松开上传到 ",u.jsx("code",{children:".daluo/uploads/"})]}),u.jsx("div",{className:"drop-sub",children:"文本 → 模型能 read 到 · 图片等非文本 → 只落盘(模型拿不到内容)"}),u.jsx("div",{className:"drop-sub dim",children:"一次可拖多个 · 单个 ≤ 1 MB(请求体上限同源)"})]})})}function nE({pending:e,onEdit:t,onRemove:s,onSteer:r}){const[a,c]=k.useState(!1),[h,f]=k.useState(null),[g,p]=k.useState(""),[v,_]=k.useState(!1);if(e.length===0)return null;const S=x=>{_(!0),x().finally(()=>{_(!1)})},y=x=>{f(x.id),p(x.content)};return u.jsxs("div",{className:"qdock",children:[u.jsxs("button",{className:"qdock-head",onClick:()=>{c(x=>!x)},"aria-expanded":!a,children:[u.jsx("span",{className:"qicon","aria-hidden":"true",children:"≣"}),u.jsx("b",{children:String(e.length)})," 条排队消息",u.jsx("span",{className:"qchev","aria-hidden":"true",children:a?"▾":"▴"})]}),a?null:u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"qitems",children:e.map((x,w)=>u.jsxs("div",{className:h===x.id?"qrow editing":"qrow",children:[u.jsx("span",{className:"qno",children:String(w+1)}),x.placement==="steering"?u.jsx("span",{className:"qtag",children:"插话"}):null,h===x.id?u.jsxs("span",{className:"qedit",children:[u.jsx("textarea",{value:g,onChange:j=>{p(j.target.value)},rows:2,autoFocus:!0}),u.jsxs("span",{className:"qedit-act",children:[u.jsx("button",{className:"mini primary",disabled:v||g.trim()==="",onClick:()=>{S(async()=>{await t(x.id,g.trim()),f(null)})},children:"保存"}),u.jsx("button",{className:"mini",onClick:()=>{f(null)},children:"取消"})]})]}):u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"qtext",title:x.content,children:x.content}),u.jsxs("span",{className:"qact",children:[u.jsx("button",{title:"编辑",onClick:()=>{y(x)},children:"✎"}),u.jsx("button",{title:"删除",onClick:()=>{S(async()=>{await s(x.id)})},children:"✕"}),u.jsx("button",{title:"插话发送这一条",onClick:()=>{S(async()=>{await r(x.id)})},children:"↑"})]})]})]},x.id))}),u.jsx("div",{className:"qfoot",children:"⌘/Ctrl+Enter 插话发送全部排队消息"})]})]})}async function iE(e){try{return await navigator.clipboard.writeText(e),!0}catch{}try{const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly","readonly"),t.style.position="fixed",t.style.top="-1000px",t.style.opacity="0",document.body.appendChild(t),t.select();const s=document.execCommand("copy");return t.remove(),s}catch{return!1}}function sE(e,t){const s={};return(e[e.length-1]===""?[...e,""]:e).join((s.padRight?" ":"")+","+(s.padLeft===!1?"":" ")).trim()}const rE=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,lE=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,aE={};function F0(e,t){return(aE.jsx?lE:rE).test(e)}const oE=/[ \t\n\f\r]/g;function cE(e){return typeof e=="object"?e.type==="text"?$0(e.value):!1:$0(e)}function $0(e){return e.replace(oE,"")===""}class io{constructor(t,s,r){this.normal=s,this.property=t,r&&(this.space=r)}}io.prototype.normal={};io.prototype.property={};io.prototype.space=void 0;function nx(e,t){const s={},r={};for(const a of e)Object.assign(s,a.property),Object.assign(r,a.normal);return new io(s,r,t)}function am(e){return e.toLowerCase()}class On{constructor(t,s){this.attribute=s,this.property=t}}On.prototype.attribute="";On.prototype.booleanish=!1;On.prototype.boolean=!1;On.prototype.commaOrSpaceSeparated=!1;On.prototype.commaSeparated=!1;On.prototype.defined=!1;On.prototype.mustUseProperty=!1;On.prototype.number=!1;On.prototype.overloadedBoolean=!1;On.prototype.property="";On.prototype.spaceSeparated=!1;On.prototype.space=void 0;let uE=0;const Ue=jr(),Pt=jr(),om=jr(),ye=jr(),vt=jr(),wr=jr(),Kn=jr();function jr(){return 2**++uE}const cm=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ue,booleanish:Pt,commaOrSpaceSeparated:Kn,commaSeparated:wr,number:ye,overloadedBoolean:om,spaceSeparated:vt},Symbol.toStringTag,{value:"Module"})),bf=Object.keys(cm);class hp extends On{constructor(t,s,r,a){let c=-1;if(super(t,s),V0(this,"space",a),typeof r=="number")for(;++c<bf.length;){const h=bf[c];V0(this,bf[c],(r&cm[h])===cm[h])}}}hp.prototype.defined=!0;function V0(e,t,s){s&&(e[t]=s)}function Ml(e){const t={},s={};for(const[r,a]of Object.entries(e.properties)){const c=new hp(r,e.transform(e.attributes||{},r),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(c.mustUseProperty=!0),t[r]=c,s[am(r)]=r,s[am(c.attribute)]=r}return new io(t,s,e.space)}const ix=Ml({properties:{ariaActiveDescendant:null,ariaAtomic:Pt,ariaAutoComplete:null,ariaBusy:Pt,ariaChecked:Pt,ariaColCount:ye,ariaColIndex:ye,ariaColSpan:ye,ariaControls:vt,ariaCurrent:null,ariaDescribedBy:vt,ariaDetails:null,ariaDisabled:Pt,ariaDropEffect:vt,ariaErrorMessage:null,ariaExpanded:Pt,ariaFlowTo:vt,ariaGrabbed:Pt,ariaHasPopup:null,ariaHidden:Pt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:vt,ariaLevel:ye,ariaLive:null,ariaModal:Pt,ariaMultiLine:Pt,ariaMultiSelectable:Pt,ariaOrientation:null,ariaOwns:vt,ariaPlaceholder:null,ariaPosInSet:ye,ariaPressed:Pt,ariaReadOnly:Pt,ariaRelevant:null,ariaRequired:Pt,ariaRoleDescription:vt,ariaRowCount:ye,ariaRowIndex:ye,ariaRowSpan:ye,ariaSelected:Pt,ariaSetSize:ye,ariaSort:null,ariaValueMax:ye,ariaValueMin:ye,ariaValueNow:ye,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function sx(e,t){return t in e?e[t]:t}function rx(e,t){return sx(e,t.toLowerCase())}const hE=Ml({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:wr,acceptCharset:vt,accessKey:vt,action:null,allow:null,allowFullScreen:Ue,allowPaymentRequest:Ue,allowUserMedia:Ue,alpha:Ue,alt:null,as:null,async:Ue,autoCapitalize:null,autoComplete:vt,autoFocus:Ue,autoPlay:Ue,blocking:vt,capture:null,charSet:null,checked:Ue,cite:null,className:vt,closedBy:null,colorSpace:null,cols:ye,colSpan:ye,command:null,commandFor:null,content:null,contentEditable:Pt,controls:Ue,controlsList:vt,coords:ye|wr,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ue,defer:Ue,dir:null,dirName:null,disabled:Ue,download:om,draggable:Pt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ue,formTarget:null,headers:vt,height:ye,hidden:om,high:ye,href:null,hrefLang:null,htmlFor:vt,httpEquiv:vt,id:null,imageSizes:null,imageSrcSet:null,inert:Ue,inputMode:null,integrity:null,is:null,isMap:Ue,itemId:null,itemProp:vt,itemRef:vt,itemScope:Ue,itemType:vt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ue,low:ye,manifest:null,max:null,maxLength:ye,media:null,method:null,min:null,minLength:ye,multiple:Ue,muted:Ue,name:null,nonce:null,noModule:Ue,noValidate:Ue,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:Ue,optimum:ye,pattern:null,ping:vt,placeholder:null,playsInline:Ue,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ue,referrerPolicy:null,rel:vt,required:Ue,reversed:Ue,rows:ye,rowSpan:ye,sandbox:vt,scope:null,scoped:Ue,seamless:Ue,selected:Ue,shadowRootClonable:Ue,shadowRootCustomElementRegistry:Ue,shadowRootDelegatesFocus:Ue,shadowRootMode:null,shadowRootSerializable:Ue,shape:null,size:ye,sizes:null,slot:null,span:ye,spellCheck:Pt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ye,step:null,style:null,tabIndex:ye,target:null,title:null,translate:null,type:null,typeMustMatch:Ue,useMap:null,value:Pt,width:ye,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:vt,axis:null,background:null,bgColor:null,border:ye,borderColor:null,bottomMargin:ye,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ue,declare:Ue,event:null,face:null,frame:null,frameBorder:null,hSpace:ye,leftMargin:ye,link:null,longDesc:null,lowSrc:null,marginHeight:ye,marginWidth:ye,noResize:Ue,noHref:Ue,noShade:Ue,noWrap:Ue,object:null,profile:null,prompt:null,rev:null,rightMargin:ye,rules:null,scheme:null,scrolling:Pt,standby:null,summary:null,text:null,topMargin:ye,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ye,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Ue,disablePictureInPicture:Ue,disableRemotePlayback:Ue,exportParts:wr,part:vt,prefix:null,property:null,results:ye,security:null,unselectable:null},space:"html",transform:rx}),dE=Ml({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",maskType:"mask-type",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:Kn,accentHeight:ye,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ye,amplitude:ye,arabicForm:null,ascent:ye,attributeName:null,attributeType:null,azimuth:ye,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ye,by:null,calcMode:null,capHeight:ye,className:vt,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:ye,diffuseConstant:ye,direction:null,display:null,dur:null,divisor:ye,dominantBaseline:null,download:Ue,dx:null,dy:null,edgeMode:null,editable:null,elevation:ye,enableBackground:null,end:null,event:null,exponent:ye,externalResourcesRequired:null,fill:null,fillOpacity:ye,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:wr,g2:wr,glyphName:wr,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ye,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ye,horizOriginX:ye,horizOriginY:ye,id:null,ideographic:ye,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ye,k:ye,k1:ye,k2:ye,k3:ye,k4:ye,kernelMatrix:Kn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ye,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ye,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:ye,overlineThickness:ye,paintOrder:null,panose1:null,path:null,pathLength:ye,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:vt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ye,pointsAtY:ye,pointsAtZ:ye,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Kn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Kn,rev:Kn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Kn,requiredFeatures:Kn,requiredFonts:Kn,requiredFormats:Kn,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:ye,specularExponent:ye,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ye,strikethroughThickness:ye,string:null,stroke:null,strokeDashArray:Kn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ye,strokeOpacity:ye,strokeWidth:null,style:null,surfaceScale:ye,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Kn,tabIndex:ye,tableValues:null,target:null,targetX:ye,targetY:ye,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Kn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ye,underlineThickness:ye,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ye,values:null,vAlphabetic:ye,vMathematical:ye,vectorEffect:null,vHanging:ye,vIdeographic:ye,version:null,vertAdvY:ye,vertOriginX:ye,vertOriginY:ye,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ye,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:sx}),lx=Ml({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()}}),ax=Ml({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:rx}),ox=Ml({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),fE={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"},mE=/[A-Z]/g,Y0=/-[a-z]/g,pE=/^data[-\w.:]+$/i;function gE(e,t){const s=am(t);let r=t,a=On;if(s in e.normal)return e.property[e.normal[s]];if(s.length>4&&s.slice(0,4)==="data"&&pE.test(t)){if(t.charAt(4)==="-"){const c=t.slice(5).replace(Y0,vE);r="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=t.slice(4);if(!Y0.test(c)){let h=c.replace(mE,_E);h.charAt(0)!=="-"&&(h="-"+h),t="data"+h}}a=hp}return new a(r,t)}function _E(e){return"-"+e.toLowerCase()}function vE(e){return e.charAt(1).toUpperCase()}const yE=nx([ix,hE,lx,ax,ox],"html"),dp=nx([ix,dE,lx,ax,ox],"svg");function SE(e){return e.join(" ").trim()}var K0=/\/\*(?:[^*]|\*(?!\/))*\*\//g,bE=/\n/g,xE=/^\s*/,wE=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,CE=/^:\s*/,kE=/^((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|url\((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|[^)]*)\)|[^};])+)/,NE=/^[;\s]*/,EE=`
|
|
12
|
+
`,W0="/",X0="*",Ma="",jE="comment",TE="declaration";function DE(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var s=1,r=1;function a(x){var w=x.match(bE);w&&(s+=w.length);var j=x.lastIndexOf(EE);r=~j?x.length-j:r+x.length}function c(){var x={line:s,column:r};return function(w){return w.position=new h(x),p(),w}}function h(x){this.start=x,this.end={line:s,column:r},this.source=t.source}h.prototype.content=e;function f(x){var w=new Error(t.source+":"+s+":"+r+": "+x);if(w.reason=x,w.filename=t.source,w.line=s,w.column=r,w.source=e,!t.silent)throw w}function g(x){var w=x.exec(e);if(w){var j=w[0];return a(j),e=e.slice(j.length),w}}function p(){g(xE)}function v(x){for(var w;w=_();)x.push(w);return x}function _(){var x=c();if(!(W0!=e.charAt(0)||X0!=e.charAt(1))){for(var w=2;Ma!=e.charAt(w)&&(X0!=e.charAt(w)||W0!=e.charAt(w+1));)++w;if(w+=2,Ma===e.charAt(w-1))return f("End of comment missing");var j=e.slice(2,w-2);return r+=2,a(j),e=e.slice(w),r+=2,x({type:jE,comment:j})}}function S(){var x=c(),w=g(wE);if(w){if(_(),!g(CE))return f("property missing ':'");var j=g(kE),N=x({type:TE,property:w[0].replace(K0,Ma).trim(),value:j?j[0].replace(K0,Ma).trim():Ma});return g(NE),N}}function y(){var x=[];v(x);for(var w;w=S();)x.push(w),v(x);return x}return p(),y()}function ME(e,t){let s=null;if(!e||typeof e!="string")return s;const r=DE(e),a=typeof t=="function";return r.forEach(c=>{if(c.type!=="declaration")return;const{property:h,value:f}=c;a?t(h,f,c):f&&(s=s??{},s[h]=f)}),s}const cx=ux("end"),fp=ux("start");function ux(e){return t;function t(s){const r=s&&s.position&&s.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 AE(e){const t=fp(e),s=cx(e);if(t&&s)return{start:t,end:s}}function Ya(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?G0(e.position):"start"in e||"end"in e?G0(e):"line"in e||"column"in e?um(e):""}function um(e){return Q0(e&&e.line)+":"+Q0(e&&e.column)}function G0(e){return um(e&&e.start)+"-"+um(e&&e.end)}function Q0(e){return e&&typeof e=="number"?e:1}class _n extends Error{constructor(t,s,r){super(),typeof s=="string"&&(r=s,s=void 0);let a="",c={},h=!1;if(s&&("line"in s&&"column"in s?c={place:s}:"start"in s&&"end"in s?c={place:s}:"type"in s?c={ancestors:[s],place:s.position}:c={...s}),typeof t=="string"?a=t:!c.cause&&t&&(h=!0,a=t.message,c.cause=t),!c.ruleId&&!c.source&&typeof r=="string"){const g=r.indexOf(":");g===-1?c.ruleId=r:(c.source=r.slice(0,g),c.ruleId=r.slice(g+1))}if(!c.place&&c.ancestors&&c.ancestors){const g=c.ancestors[c.ancestors.length-1];g&&(c.place=g.position)}const f=c.place&&"start"in c.place?c.place.start:c.place;this.ancestors=c.ancestors||void 0,this.cause=c.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=f?f.line:void 0,this.name=Ya(c.place)||"1:1",this.place=c.place||void 0,this.reason=this.message,this.ruleId=c.ruleId||void 0,this.source=c.source||void 0,this.stack=h&&c.cause&&typeof c.cause.stack=="string"?c.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}_n.prototype.file="";_n.prototype.name="";_n.prototype.reason="";_n.prototype.message="";_n.prototype.stack="";_n.prototype.column=void 0;_n.prototype.line=void 0;_n.prototype.ancestors=void 0;_n.prototype.cause=void 0;_n.prototype.fatal=void 0;_n.prototype.place=void 0;_n.prototype.ruleId=void 0;_n.prototype.source=void 0;const mp={}.hasOwnProperty,RE=new Map,OE=/[A-Z]/g,BE=/-([a-z])/g,LE=new Set(["table","tbody","thead","tfoot","tr"]),zE=new Set(["td","th"]),hx="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function HE(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const s=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=YE(s,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=VE(s,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:s,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?dp:yE,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},c=dx(a,e,void 0);return c&&typeof c!="string"?c:a.create(e,a.Fragment,{children:c||void 0},void 0)}function dx(e,t,s){if(t.type==="element")return IE(e,t,s);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return UE(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return qE(e,t,s);if(t.type==="mdxjsEsm")return PE(e,t);if(t.type==="root")return FE(e,t,s);if(t.type==="text")return $E(e,t)}function IE(e,t,s){const r=e.schema;let a=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(a=dp,e.schema=a),e.ancestors.push(t);const c=mx(e,t.tagName,!1),h=KE(e,t);let f=gp(e,t);return LE.has(t.tagName)&&(f=f.filter(function(g){return typeof g=="string"?!cE(g):!0})),fx(e,h,c,t),pp(h,f),e.ancestors.pop(),e.schema=r,e.create(t,c,h,s)}function UE(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)}Qa(e,t.position)}function PE(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Qa(e,t.position)}function qE(e,t,s){const r=e.schema;let a=r;t.name==="svg"&&r.space==="html"&&(a=dp,e.schema=a),e.ancestors.push(t);const c=t.name===null?e.Fragment:mx(e,t.name,!0),h=WE(e,t),f=gp(e,t);return fx(e,h,c,t),pp(h,f),e.ancestors.pop(),e.schema=r,e.create(t,c,h,s)}function FE(e,t,s){const r={};return pp(r,gp(e,t)),e.create(t,e.Fragment,r,s)}function $E(e,t){return t.value}function fx(e,t,s,r){typeof s!="string"&&s!==e.Fragment&&e.passNode&&(t.node=r)}function pp(e,t){if(t.length>0){const s=t.length>1?t:t[0];s&&(e.children=s)}}function VE(e,t,s){return r;function r(a,c,h,f){const p=Array.isArray(h.children)?s:t;return f?p(c,h,f):p(c,h)}}function YE(e,t){return s;function s(r,a,c,h){const f=Array.isArray(c.children),g=fp(r);return t(a,c,h,f,{columnNumber:g?g.column-1:void 0,fileName:e,lineNumber:g?g.line:void 0},void 0)}}function KE(e,t){const s={};let r,a;for(a in t.properties)if(a!=="children"&&mp.call(t.properties,a)){const c=XE(e,a,t.properties[a]);if(c){const[h,f]=c;e.tableCellAlignToStyle&&h==="align"&&typeof f=="string"&&zE.has(t.tagName)?r=f:s[h]=f}}if(r){const c=s.style||(s.style={});c[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return s}function WE(e,t){const s={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const c=r.data.estree.body[0];c.type;const h=c.expression;h.type;const f=h.properties[0];f.type,Object.assign(s,e.evaluater.evaluateExpression(f.argument))}else Qa(e,t.position);else{const{name:a}=r;let c;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const f=r.value.data.estree.body[0];f.type,c=e.evaluater.evaluateExpression(f.expression)}else Qa(e,t.position);else c=r.value===null?!0:r.value;s[a]=c}return s}function gp(e,t){const s=[];let r=-1;const a=e.passKeys?new Map:RE;for(;++r<t.children.length;){const c=t.children[r];let h;if(e.passKeys){const g=c.type==="element"?c.tagName:c.type==="mdxJsxFlowElement"||c.type==="mdxJsxTextElement"?c.name:void 0;if(g){const p=a.get(g)||0;h=g+"-"+p,a.set(g,p+1)}}const f=dx(e,c,h);f!==void 0&&s.push(f)}return s}function XE(e,t,s){if(s==null||typeof s=="number"&&Number.isNaN(s))return;const r=gE(e.schema,t);return Array.isArray(s)&&(s=r.commaSeparated?sE(s):SE(s)),r.property==="style"?["style",typeof s=="object"?e.stylePropertyNameCase==="dom"?s:QE(s):GE(e,String(s))]:[e.elementAttributeNameCase==="react"&&r.space?fE[r.property]||r.property:r.attribute,s]}function GE(e,t){const s={};try{ME(t,function(r,a){if(r&&a){let c=r;c.slice(0,2)!=="--"&&(c=c.toLowerCase(),e.stylePropertyNameCase==="dom"&&(c.slice(0,4)==="-ms-"&&(c=c.slice(1)),c=c.replace(BE,ej))),s[c]=a}})}catch(r){if(e.ignoreInvalidStyle)return{};const a=r,c=new _n("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:a,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw c.file=e.filePath||void 0,c.url=hx+"#cannot-parse-style-attribute",c}return s}function mx(e,t,s){let r;if(!s)r={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let c=-1,h;for(;++c<a.length;){const f=F0(a[c])?{type:"Identifier",name:a[c]}:{type:"Literal",value:a[c]};h=h?{type:"MemberExpression",object:h,property:f,computed:!!(c&&f.type==="Literal"),optional:!1}:f}r=h}else r=F0(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const a=r.value;return mp.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(r);Qa(e)}function Qa(e,t){const s=new _n("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=hx+"#cannot-handle-mdx-estrees-without-createevaluater",s}function QE(e){const t={};let s;for(s in e)mp.call(e,s)&&(t[ZE(s)]=e[s]);return t}function ZE(e){if(e.slice(0,2)==="--")return e;let t=e.replace(OE,JE);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function JE(e){return"-"+e.toLowerCase()}function ej(e,t){return t.toUpperCase()}const xf={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"]},tj={};function _p(e,t){const s=tj,r=typeof s.includeImageAlt=="boolean"?s.includeImageAlt:!0,a=typeof s.includeHtml=="boolean"?s.includeHtml:!0;return px(e,r,a)}function px(e,t,s){if(nj(e)){if("value"in e)return e.type==="html"&&!s?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Z0(e.children,t,s)}return Array.isArray(e)?Z0(e,t,s):""}function Z0(e,t,s){const r=[];let a=-1;for(;++a<e.length;)r[a]=px(e[a],t,s);return r.join("")}function nj(e){return!!(e&&typeof e=="object")}const J0=document.createElement("i");function vp(e){const t="&"+e+";";J0.innerHTML=t;const s=J0.textContent;return s.charCodeAt(s.length-1)===59&&e!=="semi"||s===t?!1:s}function gi(e,t,s,r){const a=e.length;let c=0,h;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,s=s>0?s:0,r.length<1e4)h=Array.from(r),h.unshift(t,s),e.splice(...h);else for(s&&e.splice(t,s);c<r.length;)h=r.slice(c,c+1e4),h.unshift(t,0),e.splice(...h),c+=1e4,t+=1e4}function oi(e,t){return e.length>0?(gi(e,e.length,0,t),e):t}const eS={}.hasOwnProperty;function gx(e){const t={};let s=-1;for(;++s<e.length;)ij(t,e[s]);return t}function ij(e,t){let s;for(s in t){const a=(eS.call(e,s)?e[s]:void 0)||(e[s]={}),c=t[s];let h;if(c)for(h in c){eS.call(a,h)||(a[h]=[]);const f=c[h];sj(a[h],Array.isArray(f)?f:f?[f]:[])}}}function sj(e,t){let s=-1;const r=[];for(;++s<t.length;)(t[s].add==="after"?e:r).push(t[s]);gi(e,0,0,r)}function _x(e,t){const s=Number.parseInt(e,t);return s<9||s===11||s>13&&s<32||s>126&&s<160||s>55295&&s<57344||s>64975&&s<65008||(s&65535)===65535||(s&65535)===65534||s>1114111?"�":String.fromCodePoint(s)}function _i(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const dn=$s(/[A-Za-z]/),mn=$s(/[\dA-Za-z]/),rj=$s(/[#-'*+\--9=?A-Z^-~]/);function mu(e){return e!==null&&(e<32||e===127)}const hm=$s(/\d/),lj=$s(/[\dA-Fa-f]/),vx=$s(/[!-/:-@[-`{-~]/);function Be(e){return e!==null&&e<-2}function yt(e){return e!==null&&(e<0||e===32)}function Ke(e){return e===-2||e===-1||e===32}const Eu=$s(new RegExp("\\p{P}|\\p{S}","u")),kr=$s(/\s/);function $s(e){return t;function t(s){return s!==null&&s>-1&&e.test(String.fromCharCode(s))}}function Al(e){const t=[];let s=-1,r=0,a=0;for(;++s<e.length;){const c=e.charCodeAt(s);let h="";if(c===37&&mn(e.charCodeAt(s+1))&&mn(e.charCodeAt(s+2)))a=2;else if(c<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(c))||(h=String.fromCharCode(c));else if(c>55295&&c<57344){const f=e.charCodeAt(s+1);c<56320&&f>56319&&f<57344?(h=String.fromCharCode(c,f),a=1):h="�"}else h=String.fromCharCode(c);h&&(t.push(e.slice(r,s),encodeURIComponent(h)),r=s+a+1,h=""),a&&(s+=a,a=0)}return t.join("")+e.slice(r)}function at(e,t,s,r){const a=r?r-1:1/0;let c=0;return h;function h(g){return Ke(g)?(e.enter(s),f(g)):t(g)}function f(g){return Ke(g)&&c++<a?(e.consume(g),f):(e.exit(s),t(g))}}function yx(e,t,s,r,a,c){let h=0;return f;function f(v){return Ke(v)?(e.enter(r),g(v)):p(v)}function g(v){return Ke(v)&&h<c?(e.consume(v),h++,g):(e.exit(r),p(v))}function p(v){return h>=a?t(v):s(v)}}const aj={tokenize:oj};function oj(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let s;return t;function r(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),at(e,t,"linePrefix")}function a(f){return e.enter("paragraph"),c(f)}function c(f){const g=e.enter("chunkText",{contentType:"text",previous:s});return s&&(s.next=g),s=g,h(f)}function h(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return Be(f)?(e.consume(f),e.exit("chunkText"),c):(e.consume(f),h)}}let pu=class{constructor(){this.index=new Map,this.map=[]}add(t,s,r){tS(this,t,s,r,!1)}addBefore(t,s,r){tS(this,t,s,r,!0)}consume(t){if(this.map.sort(function(c,h){return c[0]-h[0]}),this.map.length===0)return;let s=this.map.length;const r=[];for(;s>0;)s-=1,r.push(t.slice(this.map[s][0]+this.map[s][1]),this.map[s][2]),t.length=this.map[s][0];r.push(t.slice()),t.length=0;let a=r.pop();for(;a;){for(const c of a)t.push(c);a=r.pop()}this.map.length=0,this.index.clear()}};function tS(e,t,s,r,a){if(s===0&&r.length===0)return;const c=e.index.get(t);if(c){c[1]+=s,a?(r.push(...c[2]),c[2]=r):c[2].push(...r);return}const h=[t,s,r];e.map.push(h),e.index.set(t,h)}const cj={tokenize:uj},nS={tokenize:hj};function uj(e){const t=this,s=[];let r=0,a,c,h;return f;function f(T){if(r<s.length){const O=s[r];return t.containerState=O[1],e.attempt(O[0].continuation,g,p)(T)}return p(T)}function g(T){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&M();const O=t.events.length;let U=O,z;for(;U--;)if(t.events[U][0]==="exit"&&t.events[U][1].type==="chunkFlow"){z=t.events[U][1].end;break}N(r);let A=O;for(;A<t.events.length;)t.events[A][1].end={...z},A++;const Y=new pu;return Y.add(U+1,0,t.events.slice(O)),Y.add(O,A-O,[]),Y.consume(t.events),p(T)}return f(T)}function p(T){if(r===s.length){if(!a)return S(T);if(a.currentConstruct&&a.currentConstruct.concrete)return x(T);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(nS,v,_)(T)}function v(T){return a&&M(),N(r),S(T)}function _(T){return t.parser.lazy[t.now().line]=r!==s.length,h=t.now().offset,x(T)}function S(T){return t.containerState={},e.attempt(nS,y,x)(T)}function y(T){return r++,s.push([t.currentConstruct,t.containerState]),S(T)}function x(T){if(T===null){a&&M(),N(0),e.consume(T);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:c}),w(T)}function w(T){if(T===null){j(e.exit("chunkFlow"),!0),N(0),e.consume(T);return}return Be(T)?(e.consume(T),j(e.exit("chunkFlow")),r=0,t.interrupt=void 0,f):(e.consume(T),w)}function j(T,O){const U=t.sliceStream(T);if(O&&U.push(null),T.previous=c,c&&(c.next=T),c=T,a.defineSkip(T.start),a.write(U),t.parser.lazy[T.start.line]){let z=a.events.length;for(;z--;)if(a.events[z][1].start.offset<h&&(!a.events[z][1].end||a.events[z][1].end.offset>h))return;const A=t.events.length;let Y=A,ue,P;for(;Y--;)if(t.events[Y][0]==="exit"&&t.events[Y][1].type==="chunkFlow"){if(ue){P=t.events[Y][1].end;break}ue=!0}for(N(r),z=A;z<t.events.length;)t.events[z][1].end={...P},z++;const J=new pu;J.add(Y+1,0,t.events.slice(A)),J.add(A,z-A,[]),J.consume(t.events)}}function N(T){let O=s.length;for(;O-- >T;){const U=s[O];t.containerState=U[1],U[0].exit.call(t,e)}s.length=T}function M(){a.write([null]),c=void 0,a=void 0,t.containerState._closeFlow=void 0}}function hj(e,t,s){return at(e,e.attempt(this.parser.constructs.document,t,s),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function qs(e){if(e===null||yt(e)||kr(e))return 1;if(Eu(e))return 2}function ju(e,t,s){const r=[];let a=-1;for(;++a<e.length;){const c=e[a].resolveAll;c&&!r.includes(c)&&(t=c(t,s),r.push(c))}return t}const dm={name:"attention",resolveAll:dj,tokenize:fj};function dj(e,t){let s=-1,r;for(;++s<e.length;)if(e[s][0]==="enter"&&e[s][1].type==="attentionSequence"&&e[s][1]._close){let a=s;for(;a--;)if(e[a][0]==="exit"&&e[a][1].type==="attentionSequence"&&e[a][1]._open&&t.sliceSerialize(e[a][1]).charCodeAt(0)===t.sliceSerialize(e[s][1]).charCodeAt(0)){if((e[a][1]._close||e[s][1]._open)&&(e[s][1].end.offset-e[s][1].start.offset)%3&&!((e[a][1].end.offset-e[a][1].start.offset+e[s][1].end.offset-e[s][1].start.offset)%3))continue;const c=e[a][1].end.offset-e[a][1].start.offset>1&&e[s][1].end.offset-e[s][1].start.offset>1?2:1,h={...e[a][1].end},f={...e[s][1].start};iS(h,-c),iS(f,c);const g={type:c>1?"strongSequence":"emphasisSequence",start:h,end:{...e[a][1].end}},p={type:c>1?"strongSequence":"emphasisSequence",start:{...e[s][1].start},end:f},v={type:c>1?"strongText":"emphasisText",start:{...e[a][1].end},end:{...e[s][1].start}},_={type:c>1?"strong":"emphasis",start:{...g.start},end:{...p.end}};e[a][1].end={...g.start},e[s][1].start={...p.end},r=[],e[a][1].end.offset-e[a][1].start.offset&&(r=oi(r,[["enter",e[a][1],t],["exit",e[a][1],t]])),r=oi(r,[["enter",_,t],["enter",g,t],["exit",g,t],["enter",v,t]]),r=oi(r,ju(t.parser.constructs.insideSpan.null,e.slice(a+1,s),t)),r=oi(r,[["exit",v,t],["enter",p,t],["exit",p,t],["exit",_,t]]);let S=0;e[s][1].end.offset-e[s][1].start.offset&&(S=2,r=oi(r,[["enter",e[s][1],t],["exit",e[s][1],t]])),gi(e,a-1,s-a+3,r),s=a+r.length-S-2;break}}for(s=-1;++s<e.length;)e[s][1].type==="attentionSequence"&&(e[s][1].type="data");return e}function fj(e,t){const s=this.parser.constructs.attentionMarkers.null,r=this.previous,a=qs(r);let c;return h;function h(g){return c=g,e.enter("attentionSequence"),f(g)}function f(g){if(g===c)return e.consume(g),f;const p=e.exit("attentionSequence"),v=qs(g),_=!v||v===2&&a||s.includes(g)&&g!==42&&g!==95,S=!a||a===2&&v||s.includes(r)&&r!==42&&r!==95;return p._open=!!(c===42?_:_&&(a||!S)),p._close=!!(c===42?S:S&&(v||!_)),t(g)}}function iS(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const mj={name:"autolink",tokenize:pj};function pj(e,t,s){let r=0;return a;function a(y){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),c}function c(y){return dn(y)?(e.consume(y),h):y===64?s(y):p(y)}function h(y){return y===43||y===45||y===46||mn(y)?(r=1,f(y)):p(y)}function f(y){return y===58?(e.consume(y),r=0,g):(y===43||y===45||y===46||mn(y))&&r++<32?(e.consume(y),f):(r=0,p(y))}function g(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||mu(y)?s(y):(e.consume(y),g)}function p(y){return y===64?(e.consume(y),v):rj(y)?(e.consume(y),p):s(y)}function v(y){return mn(y)?_(y):s(y)}function _(y){return y===46?(e.consume(y),r=0,v):y===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):S(y)}function S(y){if((y===45||mn(y))&&r++<63){const x=y===45?S:_;return e.consume(y),x}return s(y)}}const so={partial:!0,tokenize:gj};function gj(e,t,s){return r;function r(c){return Ke(c)?at(e,a,"linePrefix")(c):a(c)}function a(c){return c===null||Be(c)?t(c):s(c)}}const Sx={continuation:{tokenize:vj},exit:yj,name:"blockQuote",tokenize:_j};function _j(e,t,s){const r=this;return a;function a(h){if(h===62){const f=r.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(h),e.exit("blockQuoteMarker"),c}return s(h)}function c(h){return Ke(h)?(e.enter("blockQuotePrefixWhitespace"),e.consume(h),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(h))}}function vj(e,t,s){const r=this;return a;function a(h){return Ke(h)?at(e,c,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h):c(h)}function c(h){return e.attempt(Sx,t,s)(h)}}function yj(e){e.exit("blockQuote")}const bx={name:"characterEscape",tokenize:Sj};function Sj(e,t,s){return r;function r(c){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(c),e.exit("escapeMarker"),a}function a(c){return vx(c)?(e.enter("characterEscapeValue"),e.consume(c),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):s(c)}}const xx={name:"characterReference",tokenize:bj};function bj(e,t,s){const r=this;let a=0,c,h;return f;function f(_){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(_),e.exit("characterReferenceMarker"),g}function g(_){return _===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(_),e.exit("characterReferenceMarkerNumeric"),p):(e.enter("characterReferenceValue"),c=31,h=mn,v(_))}function p(_){return _===88||_===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(_),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),c=6,h=lj,v):(e.enter("characterReferenceValue"),c=7,h=hm,v(_))}function v(_){if(_===59&&a){const S=e.exit("characterReferenceValue");return h===mn&&!vp(r.sliceSerialize(S))?s(_):(e.enter("characterReferenceMarker"),e.consume(_),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return h(_)&&a++<c?(e.consume(_),v):s(_)}}const fm={partial:!0,tokenize:xj};function xj(e,t,s){const r=this;return a;function a(h){return h===null?s(h):(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),c)}function c(h){return r.parser.lazy[r.now().line]?s(h):t(h)}}const sS={concrete:!0,name:"codeFenced",tokenize:wj};function wj(e,t,s){const r=this,a={partial:!0,tokenize:U};let c=0,h=0,f;return g;function g(z){return p(z)}function p(z){const A=r.events[r.events.length-1];return c=A&&A[1].type==="linePrefix"?A[2].sliceSerialize(A[1],!0).length:0,f=z,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),v(z)}function v(z){return z===f?(h++,e.consume(z),v):h<3?s(z):(e.exit("codeFencedFenceSequence"),Ke(z)?at(e,_,"whitespace")(z):_(z))}function _(z){return z===null||Be(z)?(e.exit("codeFencedFence"),r.interrupt?t(z):e.check(fm,w,O)(z)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),S(z))}function S(z){return z===null||Be(z)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),_(z)):Ke(z)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),at(e,y,"whitespace")(z)):z===96&&z===f?s(z):(e.consume(z),S)}function y(z){return z===null||Be(z)?_(z):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),x(z))}function x(z){return z===null||Be(z)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),_(z)):z===96&&z===f?s(z):(e.consume(z),x)}function w(z){return e.attempt(a,O,j)(z)}function j(z){return e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),N}function N(z){return c>0&&Ke(z)?at(e,M,"linePrefix",c+1)(z):M(z)}function M(z){return z===null||Be(z)?e.check(fm,w,O)(z):(e.enter("codeFlowValue"),T(z))}function T(z){return z===null||Be(z)?(e.exit("codeFlowValue"),M(z)):(e.consume(z),T)}function O(z){return e.exit("codeFenced"),t(z)}function U(z,A,Y){let ue=0;return P;function P(F){return z.enter("lineEnding"),z.consume(F),z.exit("lineEnding"),J}function J(F){return z.enter("codeFencedFence"),Ke(F)?at(z,G,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):G(F)}function G(F){return F===f?(z.enter("codeFencedFenceSequence"),L(F)):Y(F)}function L(F){return F===f?(ue++,z.consume(F),L):ue>=h?(z.exit("codeFencedFenceSequence"),Ke(F)?at(z,q,"whitespace")(F):q(F)):Y(F)}function q(F){return F===null||Be(F)?(z.exit("codeFencedFence"),A(F)):Y(F)}}}const wf={name:"codeIndented",tokenize:kj},Cj={partial:!0,tokenize:Nj};function kj(e,t,s){return r;function r(f){return e.enter("codeIndented"),yx(e,a,s,"linePrefix",4,4)(f)}function a(f){return f===null?h(f):Be(f)?e.attempt(Cj,a,h)(f):(e.enter("codeFlowValue"),c(f))}function c(f){return f===null||Be(f)?(e.exit("codeFlowValue"),a(f)):(e.consume(f),c)}function h(f){return e.exit("codeIndented"),t(f)}}function Nj(e,t,s){const r=this;return a;function a(h){return r.parser.lazy[r.now().line]?s(h):Be(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),a):yx(e,t,c,"linePrefix",4,4)(h)}function c(h){return Be(h)?a(h):s(h)}}const Ej={name:"codeText",previous:Tj,resolve:jj,tokenize:Dj};function jj(e){let t=e.length-4,s=3,r,a;if((e[s][1].type==="lineEnding"||e[s][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=s;++r<t;)if(e[r][1].type==="codeTextData"){e[s][1].type="codeTextPadding",e[t][1].type="codeTextPadding",s+=2,t-=2;break}}for(r=s-1,t++;++r<=t;)a===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(a=r):(r===t||e[r][1].type==="lineEnding")&&(e[a][1].type="codeTextData",r!==a+2&&(e[a][1].end=e[r-1][1].end,e.splice(a+2,r-a-2),t-=r-a-2,r=a+2),a=void 0);return e}function Tj(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Dj(e,t,s){let r=0,a,c;return h;function h(_){return e.enter("codeText"),e.enter("codeTextSequence"),f(_)}function f(_){return _===96?(e.consume(_),r++,f):(e.exit("codeTextSequence"),g(_))}function g(_){return _===null?s(_):_===32?(e.enter("space"),e.consume(_),e.exit("space"),g):_===96?(c=e.enter("codeTextSequence"),a=0,v(_)):Be(_)?(e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),g):(e.enter("codeTextData"),p(_))}function p(_){return _===null||_===32||_===96||Be(_)?(e.exit("codeTextData"),g(_)):(e.consume(_),p)}function v(_){return _===96?(e.consume(_),a++,v):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(_)):(c.type="codeTextData",p(_))}}class Mj{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,s){const r=s??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,s,r){const a=s||0;this.setCursor(Math.trunc(t));const c=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&Aa(this.left,r),c.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),Aa(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Aa(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 s=this.left.splice(t,Number.POSITIVE_INFINITY);Aa(this.right,s.reverse())}else{const s=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Aa(this.left,s.reverse())}}}function Aa(e,t){let s=0;if(t.length<1e4)e.push(...t);else for(;s<t.length;)e.push(...t.slice(s,s+1e4)),s+=1e4}function wx(e){const t={};let s=-1,r,a,c,h,f,g,p;const v=new Mj(e);for(;++s<v.length;){for(;s in t;)s=t[s];if(r=v.get(s),s&&r[1].type==="chunkFlow"&&v.get(s-1)[1].type==="listItemPrefix"&&(g=r[1]._tokenizer.events,c=0,c<g.length&&g[c][1].type==="lineEndingBlank"&&(c+=2),c<g.length&&g[c][1].type==="content"))for(;++c<g.length&&g[c][1].type!=="content";)g[c][1].type==="chunkText"&&(g[c][1]._isInFirstContentOfListItem=!0,c++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,Aj(v,s)),s=t[s],p=!0);else if(r[1]._container){for(c=s,a=void 0;c--;)if(h=v.get(c),h[1].type==="lineEnding"||h[1].type==="lineEndingBlank")h[0]==="enter"&&(a&&(v.get(a)[1].type="lineEndingBlank"),h[1].type="lineEnding",a=c);else if(!(h[1].type==="linePrefix"||h[1].type==="listItemIndent"))break;a&&(r[1].end={...v.get(a)[1].start},f=v.slice(a,s),f.unshift(r),v.splice(a,s-a+1,f))}}return gi(e,0,Number.POSITIVE_INFINITY,v.slice(0)),!p}function Aj(e,t){const s=e.get(t)[1],r=e.get(t)[2];let a=t-1;const c=[];let h=s._tokenizer;h||(h=r.parser[s.contentType](s.start),s._contentTypeTextTrailing&&(h._contentTypeTextTrailing=!0));const f=h.events,g=[],p={};let v,_,S=-1,y=s,x=0,w=0;const j=[w];for(;y;){for(;e.get(++a)[1]!==y;);c.push(a),y._tokenizer||(v=r.sliceStream(y),y.next||v.push(null),_&&h.defineSkip(y.start),y._isInFirstContentOfListItem&&(h._gfmTasklistFirstContentOfListItem=!0),h.write(v),y._isInFirstContentOfListItem&&(h._gfmTasklistFirstContentOfListItem=void 0)),_=y,y=y.next}for(y=s;++S<f.length;)f[S][0]==="exit"&&f[S-1][0]==="enter"&&f[S][1].type===f[S-1][1].type&&f[S][1].start.line!==f[S][1].end.line&&(w=S+1,j.push(w),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(h.events=[],y?(y._tokenizer=void 0,y.previous=void 0):j.pop(),S=j.length;S--;){const N=f.slice(j[S],j[S+1]),M=c.pop();g.push([M,M+N.length-1]),e.splice(M,2,N)}for(g.reverse(),S=-1;++S<g.length;)p[x+g[S][0]]=x+g[S][1],x+=g[S][1]-g[S][0]-1;return p}const Rj={resolve:Bj,tokenize:Lj},Oj={partial:!0,tokenize:zj};function Bj(e){return wx(e),e}function Lj(e,t){let s;return r;function r(f){return e.enter("content"),s=e.enter("chunkContent",{contentType:"content"}),a(f)}function a(f){return f===null?c(f):Be(f)?e.check(Oj,h,c)(f):(e.consume(f),a)}function c(f){return e.exit("chunkContent"),e.exit("content"),t(f)}function h(f){return e.consume(f),e.exit("chunkContent"),s.next=e.enter("chunkContent",{contentType:"content",previous:s}),s=s.next,a}}function zj(e,t,s){const r=this;return a;function a(h){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),at(e,c,"linePrefix")}function c(h){if(h===null||Be(h))return s(h);const f=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(h):e.interrupt(r.parser.constructs.flow,s,t)(h)}}function Cx(e,t,s,r,a,c,h,f,g){const p=g||Number.POSITIVE_INFINITY;let v=0;return _;function _(N){return N===60?(e.enter(r),e.enter(a),e.enter(c),e.consume(N),e.exit(c),S):N===null||N===32||N===41||mu(N)?s(N):(e.enter(r),e.enter(h),e.enter(f),e.enter("chunkString",{contentType:"string"}),w(N))}function S(N){return N===62?(e.enter(c),e.consume(N),e.exit(c),e.exit(a),e.exit(r),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),y(N))}function y(N){return N===62?(e.exit("chunkString"),e.exit(f),S(N)):N===null||N===60||Be(N)?s(N):(e.consume(N),N===92?x:y)}function x(N){return N===60||N===62||N===92?(e.consume(N),y):y(N)}function w(N){return!v&&(N===null||N===41||yt(N))?(e.exit("chunkString"),e.exit(f),e.exit(h),e.exit(r),t(N)):v<p&&N===40?(e.consume(N),v++,w):N===41?(e.consume(N),v--,w):N===null||N===32||N===40||mu(N)?s(N):(e.consume(N),N===92?j:w)}function j(N){return N===40||N===41||N===92?(e.consume(N),w):w(N)}}function kx(e,t,s,r,a,c){const h=this;let f=0,g;return p;function p(y){return e.enter(r),e.enter(a),e.consume(y),e.exit(a),e.enter(c),v}function v(y){return f>999||y===null||y===91||y===93&&!g||y===94&&!f&&"_hiddenFootnoteSupport"in h.parser.constructs?s(y):y===93?(e.exit(c),e.enter(a),e.consume(y),e.exit(a),e.exit(r),t):Be(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),v):(e.enter("chunkString",{contentType:"string"}),_(y))}function _(y){return y===null||y===91||y===93||Be(y)||f++>999?(e.exit("chunkString"),v(y)):(e.consume(y),g||(g=!Ke(y)),y===92?S:_)}function S(y){return y===91||y===92||y===93?(e.consume(y),f++,_):_(y)}}function Nx(e,t,s,r,a,c){let h;return f;function f(S){return S===34||S===39||S===40?(e.enter(r),e.enter(a),e.consume(S),e.exit(a),h=S===40?41:S,g):s(S)}function g(S){return S===h?(e.enter(a),e.consume(S),e.exit(a),e.exit(r),t):(e.enter(c),p(S))}function p(S){return S===h?(e.exit(c),g(h)):S===null?s(S):Be(S)?(e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),at(e,p,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),v(S))}function v(S){return S===h||S===null||Be(S)?(e.exit("chunkString"),p(S)):(e.consume(S),S===92?_:v)}function _(S){return S===h||S===92?(e.consume(S),v):v(S)}}function Ka(e,t){let s;return r;function r(a){return Be(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s=!0,r):Ke(a)?at(e,r,s?"linePrefix":"lineSuffix")(a):t(a)}}const Hj={name:"definition",tokenize:Uj},Ij={partial:!0,tokenize:Pj};function Uj(e,t,s){const r=this;let a;return c;function c(y){return e.enter("definition"),h(y)}function h(y){return kx.call(r,e,f,s,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function f(y){return a=_i(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),g):s(y)}function g(y){return yt(y)?Ka(e,p)(y):p(y)}function p(y){return Cx(e,v,s,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function v(y){return e.attempt(Ij,_,_)(y)}function _(y){return Ke(y)?at(e,S,"whitespace")(y):S(y)}function S(y){return y===null||Be(y)?(e.exit("definition"),r.parser.defined.push(a),t(y)):s(y)}}function Pj(e,t,s){return r;function r(f){return yt(f)?Ka(e,a)(f):s(f)}function a(f){return Nx(e,c,s,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function c(f){return Ke(f)?at(e,h,"whitespace")(f):h(f)}function h(f){return f===null||Be(f)?t(f):s(f)}}const qj={name:"hardBreakEscape",tokenize:Fj};function Fj(e,t,s){return r;function r(c){return e.enter("hardBreakEscape"),e.consume(c),a}function a(c){return Be(c)?(e.exit("hardBreakEscape"),t(c)):s(c)}}const $j={name:"headingAtx",resolve:Vj,tokenize:Yj};function Vj(e,t){let s=e.length-2,r=3;if(e[r][1].type==="whitespace"&&(r+=2),s-2>r&&e[s][1].type==="whitespace"&&(s-=2),e[s][1].type==="atxHeadingSequence"&&(r===s-1||s-4>r&&e[s-2][1].type==="whitespace")&&(s-=r+1===s?2:4),s>r){const a={type:"atxHeadingText",start:e[r][1].start,end:e[s][1].end},c={type:"chunkText",start:e[r][1].start,end:e[s][1].end,contentType:"text"};gi(e,r,s-r+1,[["enter",a,t],["enter",c,t],["exit",c,t],["exit",a,t]])}return e}function Yj(e,t,s){let r=0;return a;function a(v){return e.enter("atxHeading"),c(v)}function c(v){return e.enter("atxHeadingSequence"),h(v)}function h(v){return v===35&&r++<6?(e.consume(v),h):v===null||yt(v)?(e.exit("atxHeadingSequence"),f(v)):s(v)}function f(v){return v===35?(e.enter("atxHeadingSequence"),g(v)):v===null||Be(v)?(e.exit("atxHeading"),t(v)):Ke(v)?at(e,f,"whitespace")(v):(e.enter("atxHeadingText"),p(v))}function g(v){return v===35?(e.consume(v),g):(e.exit("atxHeadingSequence"),f(v))}function p(v){return v===null||v===35||yt(v)?(e.exit("atxHeadingText"),f(v)):(e.consume(v),p)}}const Ex=["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"],mm=["pre","script","style","textarea"],Kj={concrete:!0,name:"htmlFlow",resolveTo:Xj,tokenize:Gj},Wj={partial:!0,tokenize:Qj};function Xj(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 Gj(e,t,s){const r=this;let a,c,h,f,g;return p;function p(R){return v(R)}function v(R){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(R),_}function _(R){return R===33?(e.consume(R),S):R===47?(e.consume(R),c=!0,w):R===63?(e.consume(R),a=3,r.interrupt?t:D):dn(R)?(e.consume(R),h=String.fromCharCode(R),j):s(R)}function S(R){return R===45?(e.consume(R),a=2,y):R===91?(e.consume(R),a=5,f=0,x):dn(R)?(e.consume(R),a=4,r.interrupt?t:D):s(R)}function y(R){return R===45?(e.consume(R),r.interrupt?t:D):s(R)}function x(R){const E="CDATA[";return R===E.charCodeAt(f++)?(e.consume(R),f===E.length?r.interrupt?t:G:x):s(R)}function w(R){return dn(R)?(e.consume(R),h=String.fromCharCode(R),j):s(R)}function j(R){if(R===null||R===47||R===62||yt(R)){const E=R===47,ie=h.toLowerCase();return!E&&!c&&mm.includes(ie)?(a=1,r.interrupt?t(R):G(R)):Ex.includes(h.toLowerCase())?(a=6,E?(e.consume(R),N):r.interrupt?t(R):G(R)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?s(R):c?M(R):T(R))}return R===45||mn(R)?(e.consume(R),h+=String.fromCharCode(R),j):s(R)}function N(R){return R===62?(e.consume(R),r.interrupt?t:G):s(R)}function M(R){return Ke(R)?(e.consume(R),M):P(R)}function T(R){return R===47?(e.consume(R),P):R===58||R===95||dn(R)?(e.consume(R),O):Ke(R)?(e.consume(R),T):P(R)}function O(R){return R===45||R===46||R===58||R===95||mn(R)?(e.consume(R),O):U(R)}function U(R){return R===61?(e.consume(R),z):Ke(R)?(e.consume(R),U):T(R)}function z(R){return R===null||R===60||R===61||R===62||R===96?s(R):R===34||R===39?(e.consume(R),g=R,A):Ke(R)?(e.consume(R),z):Y(R)}function A(R){return R===g?(e.consume(R),g=null,ue):R===null||Be(R)?s(R):(e.consume(R),A)}function Y(R){return R===null||R===34||R===39||R===47||R===60||R===61||R===62||R===96||yt(R)?U(R):(e.consume(R),Y)}function ue(R){return R===47||R===62||Ke(R)?T(R):s(R)}function P(R){return R===62?(e.consume(R),J):s(R)}function J(R){return R===null||Be(R)?G(R):Ke(R)?(e.consume(R),J):s(R)}function G(R){return R===45&&a===2?(e.consume(R),V):R===60&&a===1?(e.consume(R),Q):R===62&&a===4?(e.consume(R),Ae):R===63&&a===3?(e.consume(R),D):R===93&&a===5?(e.consume(R),ge):Be(R)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(Wj,Se,L)(R)):R===null||Be(R)?(e.exit("htmlFlowData"),L(R)):(e.consume(R),G)}function L(R){return e.check(fm,q,Se)(R)}function q(R){return e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),F}function F(R){return R===null||Be(R)?L(R):(e.enter("htmlFlowData"),G(R))}function V(R){return R===45?(e.consume(R),D):G(R)}function Q(R){return R===47?(e.consume(R),h="",K):G(R)}function K(R){if(R===62){const E=h.toLowerCase();return mm.includes(E)?(e.consume(R),Ae):G(R)}return dn(R)&&h.length<8?(e.consume(R),h+=String.fromCharCode(R),K):G(R)}function ge(R){return R===93?(e.consume(R),D):G(R)}function D(R){return R===62?(e.consume(R),Ae):R===45&&a===2?(e.consume(R),D):G(R)}function Ae(R){return R===null||Be(R)?(e.exit("htmlFlowData"),Se(R)):(e.consume(R),Ae)}function Se(R){return e.exit("htmlFlow"),t(R)}}function Qj(e,t,s){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(so,t,s)}}const Zj={name:"htmlText",tokenize:Jj};function Jj(e,t,s){const r=this;let a,c,h;return f;function f(D){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(D),g}function g(D){return D===33?(e.consume(D),p):D===47?(e.consume(D),U):D===63?(e.consume(D),T):dn(D)?(e.consume(D),Y):s(D)}function p(D){return D===45?(e.consume(D),v):D===91?(e.consume(D),c=0,x):dn(D)?(e.consume(D),M):s(D)}function v(D){return D===45?(e.consume(D),y):s(D)}function _(D){return D===null?s(D):D===45?(e.consume(D),S):Be(D)?(h=_,Q(D)):(e.consume(D),_)}function S(D){return D===45?(e.consume(D),y):_(D)}function y(D){return D===62?V(D):D===45?S(D):_(D)}function x(D){const Ae="CDATA[";return D===Ae.charCodeAt(c++)?(e.consume(D),c===Ae.length?w:x):s(D)}function w(D){return D===null?s(D):D===93?(e.consume(D),j):Be(D)?(h=w,Q(D)):(e.consume(D),w)}function j(D){return D===93?(e.consume(D),N):w(D)}function N(D){return D===62?V(D):D===93?(e.consume(D),N):w(D)}function M(D){return D===null||D===62?V(D):Be(D)?(h=M,Q(D)):(e.consume(D),M)}function T(D){return D===null?s(D):D===63?(e.consume(D),O):Be(D)?(h=T,Q(D)):(e.consume(D),T)}function O(D){return D===62?V(D):T(D)}function U(D){return dn(D)?(e.consume(D),z):s(D)}function z(D){return D===45||mn(D)?(e.consume(D),z):A(D)}function A(D){return Be(D)?(h=A,Q(D)):Ke(D)?(e.consume(D),A):V(D)}function Y(D){return D===45||mn(D)?(e.consume(D),Y):D===47||D===62||yt(D)?ue(D):s(D)}function ue(D){return D===47?(e.consume(D),V):D===58||D===95||dn(D)?(e.consume(D),P):Be(D)?(h=ue,Q(D)):Ke(D)?(e.consume(D),ue):V(D)}function P(D){return D===45||D===46||D===58||D===95||mn(D)?(e.consume(D),P):J(D)}function J(D){return D===61?(e.consume(D),G):Be(D)?(h=J,Q(D)):Ke(D)?(e.consume(D),J):ue(D)}function G(D){return D===null||D===60||D===61||D===62||D===96?s(D):D===34||D===39?(e.consume(D),a=D,L):Be(D)?(h=G,Q(D)):Ke(D)?(e.consume(D),G):(e.consume(D),q)}function L(D){return D===a?(e.consume(D),a=void 0,F):D===null?s(D):Be(D)?(h=L,Q(D)):(e.consume(D),L)}function q(D){return D===null||D===34||D===39||D===60||D===61||D===96?s(D):D===47||D===62||yt(D)?ue(D):(e.consume(D),q)}function F(D){return D===47||D===62||yt(D)?ue(D):s(D)}function V(D){return D===62?(e.consume(D),e.exit("htmlTextData"),e.exit("htmlText"),t):s(D)}function Q(D){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),K}function K(D){return Ke(D)?at(e,ge,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):ge(D)}function ge(D){return e.enter("htmlTextData"),h(D)}}const yp={name:"labelEnd",resolveAll:iT,resolveTo:sT,tokenize:rT},eT={tokenize:lT},tT={tokenize:aT},nT={tokenize:oT};function iT(e){let t=-1;const s=[];for(;++t<e.length;){const r=e[t][1];if(s.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const a=r.type==="labelImage"?4:2;r.type="data",t+=a}}return e.length!==s.length&&gi(e,0,e.length,s),e}function sT(e,t){let s=e.length,r=0,a,c,h;for(;s--;){const v=e[s][1];if(a){if(v.type==="link"||v.type==="labelLink"&&v._inactive)break;e[s][0]==="enter"&&v.type==="labelLink"&&(v._inactive=!0)}else if(c){if(e[s][0]==="enter"&&(v.type==="labelImage"||v.type==="labelLink")&&!v._balanced&&(a=s,v.type!=="labelLink")){r=2;break}}else v.type==="labelEnd"&&(c=s)}const f={type:e[a][1].type==="labelLink"?"link":"image",start:{...e[a][1].start},end:{...e[e.length-1][1].end}},g={type:"label",start:{...e[a][1].start},end:{...e[c][1].end}},p={type:"labelText",start:{...e[a+r+2][1].end},end:{...e[c-2][1].start}};return h=[["enter",f,t],["enter",g,t]],h=oi(h,e.slice(a+1,a+r+3)),h=oi(h,[["enter",p,t]]),h=oi(h,ju(t.parser.constructs.insideSpan.null,e.slice(a+r+4,c-3),t)),h=oi(h,[["exit",p,t],e[c-2],e[c-1],["exit",g,t]]),h=oi(h,e.slice(c+1)),h=oi(h,[["exit",f,t]]),gi(e,a,e.length,h),e}function rT(e,t,s){const r=this,a=r._labelStarts;let c,h;if(a){for(;a.length>0&&a[a.length-1]._balanced;)a.pop();c=a[a.length-1]}return f;function f(S){return c?c._inactive?_(S):(h=r.parser.defined.includes(_i(r.sliceSerialize({start:c.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(S),e.exit("labelMarker"),e.exit("labelEnd"),g):s(S)}function g(S){return S===40?e.attempt(eT,v,h?v:_)(S):S===91?e.attempt(tT,v,h?p:_)(S):h?v(S):_(S)}function p(S){return e.attempt(nT,v,_)(S)}function v(S){return a.pop(),t(S)}function _(S){return c._balanced=!0,s(S)}}function lT(e,t,s){return r;function r(_){return e.enter("resource"),e.enter("resourceMarker"),e.consume(_),e.exit("resourceMarker"),a}function a(_){return yt(_)?Ka(e,c)(_):c(_)}function c(_){return _===41?v(_):Cx(e,h,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(_)}function h(_){return yt(_)?Ka(e,g)(_):v(_)}function f(_){return s(_)}function g(_){return _===34||_===39||_===40?Nx(e,p,s,"resourceTitle","resourceTitleMarker","resourceTitleString")(_):v(_)}function p(_){return yt(_)?Ka(e,v)(_):v(_)}function v(_){return _===41?(e.enter("resourceMarker"),e.consume(_),e.exit("resourceMarker"),e.exit("resource"),t):s(_)}}function aT(e,t,s){const r=this;return a;function a(f){return kx.call(r,e,c,h,"reference","referenceMarker","referenceString")(f)}function c(f){return r.parser.defined.includes(_i(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(f):s(f)}function h(f){return s(f)}}function oT(e,t,s){return r;function r(c){return e.enter("reference"),e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),a}function a(c){return c===93?(e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),e.exit("reference"),t):s(c)}}const cT={name:"labelStartImage",resolveAll:yp.resolveAll,tokenize:uT};function uT(e,t,s){const r=this;let a;return c;function c(g){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(g),e.exit("labelImageMarker"),h}function h(g){return g===91?(e.enter("labelMarker"),e.consume(g),e.exit("labelMarker"),a=e.exit("labelImage"),f):s(g)}function f(g){return g===94&&"_hiddenFootnoteSupport"in r.parser.constructs?s(g):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(a),t(g))}}const hT={name:"labelStartLink",resolveAll:yp.resolveAll,tokenize:dT};function dT(e,t,s){const r=this;let a;return c;function c(f){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),a=e.exit("labelLink"),h}function h(f){return f===94&&"_hiddenFootnoteSupport"in r.parser.constructs?s(f):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(a),t(f))}}const Cf={name:"lineEnding",tokenize:fT};function fT(e,t){return s;function s(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),at(e,t,"linePrefix")}}const nu={name:"thematicBreak",tokenize:mT};function mT(e,t,s){let r=0,a;return c;function c(p){return e.enter("thematicBreak"),h(p)}function h(p){return a=p,f(p)}function f(p){return p===a?(e.enter("thematicBreakSequence"),g(p)):r>=3&&(p===null||Be(p))?(e.exit("thematicBreak"),t(p)):s(p)}function g(p){return p===a?(e.consume(p),r++,g):(e.exit("thematicBreakSequence"),Ke(p)?at(e,f,"whitespace")(p):f(p))}}const Rn={continuation:{tokenize:vT},exit:ST,name:"list",tokenize:_T},pT={partial:!0,tokenize:bT},gT={partial:!0,tokenize:yT};function _T(e,t,s){const r=this,a=r.events[r.events.length-1];let c=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,h=0;return f;function f(y){const x=r.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(x==="listUnordered"?!r.containerState.marker||y===r.containerState.marker:hm(y)){if(r.containerState.type||(r.containerState.type=x,e.enter(x,{_container:!0})),x==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(nu,s,p)(y):p(y);if(!r.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),g(y)}return s(y)}function g(y){return hm(y)&&++h<10?(e.consume(y),g):(!r.interrupt||h<2)&&(r.containerState.marker?y===r.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),p(y)):s(y)}function p(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||y,e.check(so,r.interrupt?s:v,e.attempt(pT,S,_))}function v(y){return r.containerState.initialBlankLine=!0,c++,S(y)}function _(y){return Ke(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),S):s(y)}function S(y){return r.containerState.size=c+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(y)}}function vT(e,t,s){const r=this;return r.containerState._closeFlow=void 0,e.check(so,a,c);function a(f){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,at(e,t,"listItemIndent",r.containerState.size+1)(f)}function c(f){return r.containerState.furtherBlankLines||!Ke(f)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,h(f)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(gT,t,h)(f))}function h(f){return r.containerState._closeFlow=!0,r.interrupt=void 0,at(e,e.attempt(Rn,t,s),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function yT(e,t,s){const r=this;return at(e,a,"listItemIndent",r.containerState.size+1);function a(c){const h=r.events[r.events.length-1];return h&&h[1].type==="listItemIndent"&&h[2].sliceSerialize(h[1],!0).length===r.containerState.size?t(c):s(c)}}function ST(e){e.exit(this.containerState.type)}function bT(e,t,s){const r=this;return at(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(c){const h=r.events[r.events.length-1];return!Ke(c)&&h&&h[1].type==="listItemPrefixWhitespace"?t(c):s(c)}}const rS={name:"setextUnderline",resolveTo:xT,tokenize:wT};function xT(e,t){const s=new pu;let r=e.length,a,c,h;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){a=r;break}e[r][1].type==="paragraph"&&(c=r)}else e[r][1].type==="content"&&s.add(r,1,[]),!h&&e[r][1].type==="definition"&&(h=r);const f={type:"setextHeading",start:{...e[a][1].start},end:{...e[e.length-1][1].end}};return e[c][1].type="setextHeadingText",h?(s.add(c,0,[["enter",f,t]]),s.add(h+1,0,[["exit",e[a][1],t]]),e[a][1].end={...e[h][1].end}):e[a][1]=f,s.add(e.length,0,[["exit",f,t]]),s.consume(e),e}function wT(e,t,s){const r=this;let a;return c;function c(p){let v=r.events.length,_;for(;v--;)if(r.events[v][1].type!=="lineEnding"&&r.events[v][1].type!=="linePrefix"&&r.events[v][1].type!=="content"){_=r.events[v][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||_)?(e.enter("setextHeadingLine"),a=p,h(p)):s(p)}function h(p){return e.enter("setextHeadingLineSequence"),f(p)}function f(p){return p===a?(e.consume(p),f):(e.exit("setextHeadingLineSequence"),Ke(p)?at(e,g,"lineSuffix")(p):g(p))}function g(p){return p===null||Be(p)?(e.exit("setextHeadingLine"),t(p)):s(p)}}const CT={tokenize:kT};function kT(e){const t=this,s=e.attempt(so,r,e.attempt(this.parser.constructs.flowInitial,a,at(e,e.attempt(this.parser.constructs.flow,a,e.attempt(Rj,a)),"linePrefix")));return s;function r(c){if(c===null){e.consume(c);return}return e.enter("lineEndingBlank"),e.consume(c),e.exit("lineEndingBlank"),t.currentConstruct=void 0,s}function a(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),t.currentConstruct=void 0,s}}const NT={resolveAll:Tx()},ET=jx("string"),jT=jx("text");function jx(e){return{resolveAll:Tx(e==="text"?TT:void 0),tokenize:t};function t(s){const r=this,a=this.parser.constructs[e],c=s.attempt(a,h,f);return h;function h(v){return p(v)?c(v):f(v)}function f(v){if(v===null){s.consume(v);return}return s.enter("data"),s.consume(v),g}function g(v){return p(v)?(s.exit("data"),c(v)):(s.consume(v),g)}function p(v){if(v===null)return!0;const _=a[v];let S=-1;if(_)for(;++S<_.length;){const y=_[S];if(!y.previous||y.previous.call(r,r.previous))return!0}return!1}}}function Tx(e){return t;function t(s,r){let a=-1,c;for(;++a<=s.length;)c===void 0?s[a]&&s[a][1].type==="data"&&(c=a,a++):(!s[a]||s[a][1].type!=="data")&&(a!==c+2&&(s[c][1].end=s[a-1][1].end,s.splice(c+2,a-c-2),a=c+2),c=void 0);return e?e(s,r):s}}function TT(e,t){const s=new pu;let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const a=e[r-1][1],c=t.sliceStream(a);let h=c.length,f=-1,g=0,p;for(;h--;){const v=c[h];if(typeof v=="string"){for(f=v.length;v.charCodeAt(f-1)===32;)g++,f--;if(f)break;f=-1}else if(v===-2)p=!0,g++;else if(v!==-1){h++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(g=0),g){const v={type:r===e.length||p||g<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:h?f:a.start._bufferIndex+f,_index:a.start._index+h,line:a.end.line,column:a.end.column-g,offset:a.end.offset-g},end:{...a.end}};a.end={...v.start},a.start.offset===a.end.offset?Object.assign(a,v):s.add(r,0,[["enter",v,t],["exit",v,t]])}r++}return s.consume(e),e}const DT={42:Rn,43:Rn,45:Rn,48:Rn,49:Rn,50:Rn,51:Rn,52:Rn,53:Rn,54:Rn,55:Rn,56:Rn,57:Rn,62:Sx},MT={91:Hj},AT={[-2]:wf,[-1]:wf,32:wf},RT={35:$j,42:nu,45:[rS,nu],60:Kj,61:rS,95:nu,96:sS,126:sS},OT={38:xx,92:bx},BT={[-5]:Cf,[-4]:Cf,[-3]:Cf,33:cT,38:xx,42:dm,60:[mj,Zj],91:hT,92:[qj,bx],93:yp,95:dm,96:Ej},LT={null:[dm,NT]},zT={null:[42,95]},HT={null:[]},IT=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:zT,contentInitial:MT,disable:HT,document:DT,flow:RT,flowInitial:AT,insideSpan:LT,string:OT,text:BT},Symbol.toStringTag,{value:"Module"}));function UT(e,t,s){let r={_bufferIndex:-1,_index:0,line:s&&s.line||1,column:s&&s.column||1,offset:s&&s.offset||0};const a={},c=[];let h=[],f=[];const g={attempt:A(U),check:A(z),consume:M,enter:T,exit:O,interrupt:A(z,{interrupt:!0})},p={code:null,containerState:{},defineSkip:w,events:[],now:x,parser:e,previous:null,sliceSerialize:S,sliceStream:y,write:_};let v=t.tokenize.call(p,g);return t.resolveAll&&c.push(t),p;function _(J){return h=oi(h,J),j(),h[h.length-1]!==null?[]:(Y(t,0),p.events=ju(c,p.events,p),p.events)}function S(J,G){return qT(y(J),G)}function y(J){return PT(h,J)}function x(){const{_bufferIndex:J,_index:G,line:L,column:q,offset:F}=r;return{_bufferIndex:J,_index:G,line:L,column:q,offset:F}}function w(J){a[J.line]=J.column,P()}function j(){for(;r._index<h.length;){const J=h[r._index];if(typeof J=="string"){const G=r._index;for(r._bufferIndex<0&&(r._bufferIndex=0);r._index===G&&r._bufferIndex<J.length;)N(J.charCodeAt(r._bufferIndex))}else N(J)}}function N(J){v=v(J)}function M(J){Be(J)?(r.line++,r.column=1,r.offset+=J===-3?2:1,P()):J!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===h[r._index].length&&(r._bufferIndex=-1,r._index++)),p.previous=J}function T(J,G){const L=G||{};return L.type=J,L.start=x(),p.events.push(["enter",L,p]),f.push(L),L}function O(J){const G=f.pop();return G.end=x(),p.events.push(["exit",G,p]),G}function U(J,G){Y(J,G.from)}function z(J,G){G.restore()}function A(J,G){return L;function L(q,F,V){let Q,K,ge,D;return Array.isArray(q)?Se(q):"tokenize"in q?Se([q]):Ae(q);function Ae(ce){return fe;function fe(ve){const Z=ve!==null&&ce[ve],le=ve!==null&&ce.null,se=[...Array.isArray(Z)?Z:Z?[Z]:[],...Array.isArray(le)?le:le?[le]:[]];return Se(se)(ve)}}function Se(ce){return Q=ce,K=0,ce.length===0?V:R(ce[K])}function R(ce){return fe;function fe(ve){return D=ue(),ge=ce,ce.partial||(p.currentConstruct=ce),ce.name&&p.parser.constructs.disable.null.includes(ce.name)?ie():ce.tokenize.call(G?Object.assign(Object.create(p),G):p,g,E,ie)(ve)}}function E(ce){return J(ge,D),F}function ie(ce){return D.restore(),++K<Q.length?R(Q[K]):V}}}function Y(J,G){J.resolveAll&&!c.includes(J)&&c.push(J),J.resolve&&gi(p.events,G,p.events.length-G,J.resolve(p.events.slice(G),p)),J.resolveTo&&(p.events=J.resolveTo(p.events,p))}function ue(){const J=x(),G=p.previous,L=p.currentConstruct,q=p.events.length,F=Array.from(f);return{from:q,restore:V};function V(){r=J,p.previous=G,p.currentConstruct=L,p.events.length=q,f=F,P()}}function P(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function PT(e,t){const s=t.start._index,r=t.start._bufferIndex,a=t.end._index,c=t.end._bufferIndex;let h;if(s===a)h=[e[s].slice(r,c)];else{if(h=e.slice(s,a),r>-1){const f=h[0];typeof f=="string"?h[0]=f.slice(r):h.shift()}c>0&&h.push(e[a].slice(0,c))}return h}function qT(e,t){let s=-1;const r=[];let a;for(;++s<e.length;){const c=e[s];let h;if(typeof c=="string")h=c;else switch(c){case-5:{h="\r";break}case-4:{h=`
|
|
13
|
+
`;break}case-3:{h=`\r
|
|
14
|
+
`;break}case-2:{h=t?" ":" ";break}case-1:{if(!t&&a)continue;h=" ";break}default:h=String.fromCharCode(c)}a=c===-2,r.push(h)}return r.join("")}function FT(e){const r={constructs:gx([IT,...(e||{}).extensions||[]]),content:a(aj),defined:[],document:a(cj),flow:a(CT),lazy:{},string:a(ET),text:a(jT)};return r;function a(c){return h;function h(f){return UT(r,c,f)}}}function $T(e){for(;!wx(e););return e}const lS=/[\0\t\n\r]/g;function VT(){let e=1,t="",s=!0,r;return a;function a(c,h,f){c=t+(typeof c=="string"?c.toString():new TextDecoder(h||void 0).decode(c));const g=[];let p=0;for(t="",s&&(c.charCodeAt(0)===65279&&p++,s=void 0);p<c.length;){lS.lastIndex=p;const v=lS.exec(c),_=v&&v.index!==void 0?v.index:c.length,S=c.charCodeAt(_);if(!v){t=c.slice(p);break}if(S===10&&p===_&&r)g.push(-3),r=void 0;else switch(r&&(g.push(-5),r=void 0),p<_&&(g.push(c.slice(p,_)),e+=_-p),S){case 0:{g.push(65533),e++;break}case 9:{const y=Math.ceil(e/4)*4;for(g.push(-2);e++<y;)g.push(-1);break}case 10:{g.push(-4),e=1;break}default:r=!0,e=1}p=_+1}return f&&(r&&g.push(-5),t&&g.push(t),g.push(null)),g}}const YT=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function KT(e){return e.replace(YT,WT)}function WT(e,t,s){if(t)return t;if(s.charCodeAt(0)===35){const a=s.charCodeAt(1),c=a===120||a===88;return _x(s.slice(c?2:1),c?16:10)}return vp(s)||e}const Dx={}.hasOwnProperty;function XT(e,t,s){return t&&typeof t=="object"&&(s=t,t=void 0),GT(s)($T(FT(s).document().write(VT()(e,t,!0))))}function GT(e){const t={afterExit:[],beforeEnter:[],transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:h(kt),autolinkProtocol:P,autolinkEmail:P,atxHeading:h(Ge),blockQuote:h(se),characterEscape:P,characterReference:P,codeFenced:h(me),codeFencedFenceInfo:f,codeFencedFenceMeta:f,codeIndented:h(me,f),codeText:h(xe,f),codeTextData:P,data:P,codeFlowValue:P,definition:h(Fe),definitionDestinationString:f,definitionLabelString:f,definitionTitleString:f,emphasis:h(Xe),hardBreakEscape:h(nt),hardBreakTrailing:h(nt),htmlFlow:h($e,f),htmlFlowData:P,htmlText:h($e,f),htmlTextData:P,image:h(Ot),label:f,link:h(kt),listItem:h(Oe),listItemValue:y,listOrdered:h(ke,S),listUnordered:h(ke),paragraph:h(oe),reference:E,referenceString:f,resourceDestinationString:f,resourceTitleString:f,setextHeading:h(Ge),strong:h(Ne),thematicBreak:h(Qe)},exit:{atxHeading:p(),atxHeadingSequence:z,autolink:p(),autolinkEmail:le,autolinkProtocol:Z,blockQuote:p(),characterEscapeValue:J,characterReferenceMarkerHexadecimal:ce,characterReferenceMarkerNumeric:ce,characterReferenceValue:fe,characterReference:ve,codeFenced:p(N),codeFencedFence:j,codeFencedFenceInfo:x,codeFencedFenceMeta:w,codeFlowValue:J,codeIndented:p(M),codeText:p(V),codeTextData:J,data:J,definition:p(),definitionDestinationString:U,definitionLabelString:T,definitionTitleString:O,emphasis:p(),hardBreakEscape:p(L),hardBreakTrailing:p(L),htmlFlow:p(q),htmlFlowData:J,htmlText:p(F),htmlTextData:J,image:p(K),label:D,labelText:ge,lineEnding:G,link:p(Q),listItem:p(),listOrdered:p(),listUnordered:p(),paragraph:p(),referenceString:ie,resourceDestinationString:Ae,resourceTitleString:Se,resource:R,setextHeading:p(ue),setextHeadingLineSequence:Y,setextHeadingText:A,strong:p(),thematicBreak:p()}};Mx(t,(e||{}).mdastExtensions||[]);const s={};return r;function r(ae){let _e={type:"root",children:[],position:void 0};const re={stack:[_e],tokenStack:[],config:t,enter:g,exit:v,buffer:f,resume:_,data:s},H=[],we=[];let je=-1;for(;++je<ae.length;)if(we.push(ae[je]),ae[je][1].type==="listOrdered"||ae[je][1].type==="listUnordered")if(ae[je][0]==="enter")H.push(we.length-1);else{const ot=H.pop();c(we,ot)}for(ae=we,je=-1;++je<ae.length;){const ot=t[ae[je][0]];ae[je][0]==="enter"&&t.beforeEnter.length>0&&a(t.beforeEnter,{...re,sliceSerialize:ae[je][2].sliceSerialize},ae[je][1]),Dx.call(ot,ae[je][1].type)&&ot[ae[je][1].type].call({...re,sliceSerialize:ae[je][2].sliceSerialize},ae[je][1]),ae[je][0]==="exit"&&t.afterExit.length>0&&a(t.afterExit,{...re,sliceSerialize:ae[je][2].sliceSerialize},ae[je][1])}if(re.tokenStack.length>0){const ot=re.tokenStack[re.tokenStack.length-1];(ot[1]||aS).call(re,void 0,ot[0])}for(_e.position={start:Bs(ae.length>0?ae[0][1].start:{line:1,column:1,offset:0}),end:Bs(ae.length>0?ae[ae.length-2][1].end:{line:1,column:1,offset:0})},je=-1;++je<t.transforms.length;)_e=t.transforms[je](_e)||_e;return _e}function a(ae,_e,re){let H=-1;for(;++H<ae.length;)ae[H].call(_e,re)}function c(ae,_e){const re=ae.length-1;let H=_e-1,we=-1,je=!1,ot,gt,rt,Ii;const Vs=[];for(;++H<=re;){const vn=ae[H];switch(vn[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{vn[0]==="enter"?we++:we--,Ii=void 0;break}case"lineEndingBlank":{vn[0]==="enter"&&(ot&&!Ii&&!we&&!rt&&(rt=H),Ii=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ii=void 0}if(!we&&vn[0]==="enter"&&vn[1].type==="listItemPrefix"||we===-1&&vn[0]==="exit"&&(vn[1].type==="listUnordered"||vn[1].type==="listOrdered")){if(ot){let Ui=H;for(gt=void 0;Ui--;){const Xn=ae[Ui];if(Xn[1].type==="lineEnding"||Xn[1].type==="lineEndingBlank"){if(Xn[0]==="exit")continue;gt&&(ae[gt][1].type="lineEndingBlank",je=!0),Xn[1].type="lineEnding",gt=Ui}else if(!(Xn[1].type==="linePrefix"||Xn[1].type==="blockQuotePrefix"||Xn[1].type==="blockQuotePrefixWhitespace"||Xn[1].type==="blockQuoteMarker"||Xn[1].type==="listItemIndent"))break}rt&&(!gt||rt<gt)&&(ot._spread=!0),ot.end=Object.assign({},gt?ae[gt][1].start:vn[1].end),Vs.push({at:gt||H,event:["exit",ot,vn[2]]})}if(vn[1].type==="listItemPrefix"){const Ui={type:"listItem",_spread:!1,start:Object.assign({},vn[1].start),end:void 0};ot=Ui,Vs.push({at:H,event:["enter",Ui,vn[2]]}),rt=void 0,Ii=!0}}}const ho=ae.splice(_e);let sn=0;for(H=-1;++H<ho.length;){for(;sn<Vs.length&&Vs[sn].at===_e+H;)ae.push(Vs[sn++].event);ae.push(ho[H])}ae[_e][1]._spread=je}function h(ae,_e){return re;function re(H){g.call(this,ae(H),H),_e&&_e.call(this,H)}}function f(){this.stack.push({type:"fragment",children:[]})}function g(ae,_e,re){this.stack[this.stack.length-1].children.push(ae),this.stack.push(ae),this.tokenStack.push([_e,re||void 0]),ae.position={start:Bs(_e.start),end:void 0}}function p(ae){return _e;function _e(re){ae&&ae.call(this,re),v.call(this,re)}}function v(ae,_e){const re=this.stack.pop(),H=this.tokenStack.pop();if(!H)throw new Error("Cannot close `"+ae.type+"` ("+Ya({start:ae.start,end:ae.end})+"): it’s not open");H[0].type!==ae.type&&(_e?_e.call(this,ae,H[0]):(H[1]||aS).call(this,ae,H[0])),re.position.end=Bs(ae.end)}function _(){return _p(this.stack.pop())}function S(){this.data.expectingFirstListItemValue=!0}function y(ae){if(this.data.expectingFirstListItemValue){const _e=this.stack[this.stack.length-2];_e.start=Number.parseInt(this.sliceSerialize(ae),10),this.data.expectingFirstListItemValue=void 0}}function x(){const ae=this.resume(),_e=this.stack[this.stack.length-1];_e.lang=ae}function w(){const ae=this.resume(),_e=this.stack[this.stack.length-1];_e.meta=ae}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function N(){const ae=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ae.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function M(){const ae=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ae.replace(/(\r?\n|\r)$/g,"")}function T(ae){const _e=this.resume(),re=this.stack[this.stack.length-1];re.label=_e,re.identifier=_i(this.sliceSerialize(ae)).toLowerCase()}function O(){const ae=this.resume(),_e=this.stack[this.stack.length-1];_e.title=ae}function U(){const ae=this.resume(),_e=this.stack[this.stack.length-1];_e.url=ae}function z(ae){const _e=this.stack[this.stack.length-1];if(!_e.depth){const re=this.sliceSerialize(ae).length;_e.depth=re}}function A(){this.data.setextHeadingSlurpLineEnding=!0}function Y(ae){const _e=this.stack[this.stack.length-1];_e.depth=this.sliceSerialize(ae).codePointAt(0)===61?1:2}function ue(){this.data.setextHeadingSlurpLineEnding=void 0}function P(ae){const re=this.stack[this.stack.length-1].children;let H=re[re.length-1];(!H||H.type!=="text")&&(H=Le(),H.position={start:Bs(ae.start),end:void 0},re.push(H)),this.stack.push(H)}function J(ae){const _e=this.stack.pop();_e.value+=this.sliceSerialize(ae),_e.position.end=Bs(ae.end)}function G(ae){const _e=this.stack[this.stack.length-1];if(this.data.atHardBreak){const re=_e.children[_e.children.length-1];re.position.end=Bs(ae.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(_e.type)&&(P.call(this,ae),J.call(this,ae))}function L(){this.data.atHardBreak=!0}function q(){const ae=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ae}function F(){const ae=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ae}function V(){const ae=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ae}function Q(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const _e=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=_e,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function K(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const _e=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=_e,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function ge(ae){const _e=this.sliceSerialize(ae),re=this.stack[this.stack.length-2];re.label=KT(_e),re.identifier=_i(_e).toLowerCase()}function D(){const ae=this.stack[this.stack.length-1],_e=this.resume(),re=this.stack[this.stack.length-1];if(this.data.inReference=!0,re.type==="link"){const H=ae.children;re.children=H}else re.alt=_e}function Ae(){const ae=this.resume(),_e=this.stack[this.stack.length-1];_e.url=ae}function Se(){const ae=this.resume(),_e=this.stack[this.stack.length-1];_e.title=ae}function R(){this.data.inReference=void 0}function E(){this.data.referenceType="collapsed"}function ie(ae){const _e=this.resume(),re=this.stack[this.stack.length-1];re.label=_e,re.identifier=_i(this.sliceSerialize(ae)).toLowerCase(),this.data.referenceType="full"}function ce(ae){this.data.characterReferenceType=ae.type}function fe(ae){const _e=this.sliceSerialize(ae),re=this.data.characterReferenceType;let H;re?(H=_x(_e,re==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):H=vp(_e);const we=this.stack[this.stack.length-1];we.value+=H}function ve(ae){const _e=this.stack.pop();_e.position.end=Bs(ae.end)}function Z(ae){J.call(this,ae);const _e=this.stack[this.stack.length-1];_e.url=this.sliceSerialize(ae)}function le(ae){J.call(this,ae);const _e=this.stack[this.stack.length-1];_e.url="mailto:"+this.sliceSerialize(ae)}function se(){return{type:"blockquote",children:[],position:void 0}}function me(){return{type:"code",lang:null,meta:null,value:"",position:void 0}}function xe(){return{type:"inlineCode",value:"",position:void 0}}function Fe(){return{type:"definition",identifier:"",label:null,title:null,url:"",position:void 0}}function Xe(){return{type:"emphasis",children:[],position:void 0}}function Ge(){return{type:"heading",depth:0,children:[],position:void 0}}function nt(){return{type:"break",position:void 0}}function $e(){return{type:"html",value:"",position:void 0}}function Ot(){return{type:"image",title:null,url:"",alt:null,position:void 0}}function kt(){return{type:"link",title:null,url:"",children:[],position:void 0}}function ke(ae){return{type:"list",ordered:ae.type==="listOrdered",start:null,spread:ae._spread,children:[],position:void 0}}function Oe(ae){return{type:"listItem",spread:ae._spread,checked:null,children:[],position:void 0}}function oe(){return{type:"paragraph",children:[],position:void 0}}function Ne(){return{type:"strong",children:[],position:void 0}}function Le(){return{type:"text",value:"",position:void 0}}function Qe(){return{type:"thematicBreak",position:void 0}}}function Bs(e){return{line:e.line,column:e.column,offset:e.offset}}function Mx(e,t){let s=-1;for(;++s<t.length;){const r=t[s];Array.isArray(r)?Mx(e,r):QT(e,r)}}function QT(e,t){let s;for(s in t)if(Dx.call(t,s))switch(s){case"canContainEols":{const r=t[s];r&&e[s].push(...r);break}case"transforms":{const r=t[s];r&&e[s].push(...r);break}case"afterExit":case"beforeEnter":{const r=t[s];r&&e[s].push(r);break}case"enter":case"exit":{const r=t[s];r&&Object.assign(e[s],r);break}}}function aS(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Ya({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ya({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Ya({start:t.start,end:t.end})+") is still open")}function ZT(e){const t=this;t.parser=s;function s(r){return XT(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function JT(e,t){const s={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,s),e.applyData(t,s)}function eD(e,t){const s={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,s),[e.applyData(t,s),{type:"text",value:`
|
|
15
|
+
`}]}function tD(e,t){const s=t.value?t.value+`
|
|
16
|
+
`:"",r={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(r.className=["language-"+a[0]]);let c={type:"element",tagName:"code",properties:r,children:[{type:"text",value:s}]};return t.meta&&(c.data={meta:t.meta}),e.patch(t,c),c=e.applyData(t,c),c={type:"element",tagName:"pre",properties:{},children:[c]},e.patch(t,c),c}function nD(e,t){const s={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function iD(e,t){const s={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function sD(e,t){const s=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),a=Al(r.toLowerCase()),c=e.footnoteOrder.indexOf(r);let h,f=e.footnoteCounts.get(r);f===void 0?(f=0,e.footnoteOrder.push(r),h=e.footnoteOrder.length):h=c+1,f+=1,e.footnoteCounts.set(r,f);const g={type:"element",tagName:"a",properties:{href:"#"+s+"fn-"+a,id:s+"fnref-"+a+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(h)}]};e.patch(t,g);const p={type:"element",tagName:"sup",properties:{},children:[g]};return e.patch(t,p),e.applyData(t,p)}function rD(e,t){const s={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function lD(e,t){if(e.options.allowDangerousHtml){const s={type:"raw",value:t.value};return e.patch(t,s),e.applyData(t,s)}}function Ax(e,t){const s=t.referenceType;let r="]";if(s==="collapsed"?r+="[]":s==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const a=e.all(t),c=a[0];c&&c.type==="text"?c.value="["+c.value:a.unshift({type:"text",value:"["});const h=a[a.length-1];return h&&h.type==="text"?h.value+=r:a.push({type:"text",value:r}),a}function aD(e,t){const s=String(t.identifier).toUpperCase(),r=e.definitionById.get(s);if(!r)return Ax(e,t);const a={src:Al(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(a.title=r.title);const c={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,c),e.applyData(t,c)}function oD(e,t){const s={src:Al(t.url)};t.alt!==null&&t.alt!==void 0&&(s.alt=t.alt),t.title!==null&&t.title!==void 0&&(s.title=t.title);const r={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,r),e.applyData(t,r)}function cD(e,t){const s={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,s);const r={type:"element",tagName:"code",properties:{},children:[s]};return e.patch(t,r),e.applyData(t,r)}function uD(e,t){const s=String(t.identifier).toUpperCase(),r=e.definitionById.get(s);if(!r)return Ax(e,t);const a={href:Al(r.url||"")};r.title!==null&&r.title!==void 0&&(a.title=r.title);const c={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,c),e.applyData(t,c)}function hD(e,t){const s={href:Al(t.url)};t.title!==null&&t.title!==void 0&&(s.title=t.title);const r={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function dD(e,t,s){const r=e.all(t),a=s?fD(s):Rx(t),c={},h=[];if(typeof t.checked=="boolean"){const v=r[0];let _;v&&v.type==="element"&&v.tagName==="p"?_=v:(_={type:"element",tagName:"p",properties:{},children:[]},r.unshift(_)),_.children.length>0&&_.children.unshift({type:"text",value:" "}),_.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),c.className=["task-list-item"]}let f=-1;for(;++f<r.length;){const v=r[f];(a||f!==0||v.type!=="element"||v.tagName!=="p")&&h.push({type:"text",value:`
|
|
17
|
+
`}),v.type==="element"&&v.tagName==="p"&&!a?h.push(...v.children):h.push(v)}const g=r[r.length-1];g&&(a||g.type!=="element"||g.tagName!=="p")&&h.push({type:"text",value:`
|
|
18
|
+
`});const p={type:"element",tagName:"li",properties:c,children:h};return e.patch(t,p),e.applyData(t,p)}function fD(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const s=e.children;let r=-1;for(;!t&&++r<s.length;)t=Rx(s[r])}return t}function Rx(e){const t=e.spread;return t??e.children.length>1}function mD(e,t){const s={},r=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(s.start=t.start);++a<r.length;){const h=r[a];if(h.type==="element"&&h.tagName==="li"&&h.properties&&Array.isArray(h.properties.className)&&h.properties.className.includes("task-list-item")){s.className=["contains-task-list"];break}}const c={type:"element",tagName:t.ordered?"ol":"ul",properties:s,children:e.wrap(r,!0)};return e.patch(t,c),e.applyData(t,c)}function pD(e,t){const s={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function gD(e,t){const s={type:"root",children:e.wrap(e.all(t))};return e.patch(t,s),e.applyData(t,s)}function _D(e,t){const s={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function vD(e,t){const s=e.all(t),r=s.shift(),a=[];if(r){const h={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],h),a.push(h)}if(s.length>0){const h={type:"element",tagName:"tbody",properties:{},children:e.wrap(s,!0)},f=fp(t.children[1]),g=cx(t.children[t.children.length-1]);f&&g&&(h.position={start:f,end:g}),a.push(h)}const c={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,c),e.applyData(t,c)}function yD(e,t,s){const r=s?s.children:void 0,c=(r?r.indexOf(t):1)===0?"th":"td",h=s&&s.type==="table"?s.align:void 0,f=h?h.length:t.children.length;let g=-1;const p=[];for(;++g<f;){const _=t.children[g],S={},y=h?h[g]:void 0;y&&(S.align=y);let x={type:"element",tagName:c,properties:S,children:[]};_&&(x.children=e.all(_),e.patch(_,x),x=e.applyData(_,x)),p.push(x)}const v={type:"element",tagName:"tr",properties:{},children:e.wrap(p,!0)};return e.patch(t,v),e.applyData(t,v)}function SD(e,t){const s={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}const oS=9,cS=32;function bD(e){const t=String(e),s=/\r?\n|\r/g;let r=s.exec(t),a=0;const c=[];for(;r;)c.push(uS(t.slice(a,r.index),a>0,!0),r[0]),a=r.index+r[0].length,r=s.exec(t);return c.push(uS(t.slice(a),a>0,!1)),c.join("")}function uS(e,t,s){let r=0,a=e.length;if(t){let c=e.codePointAt(r);for(;c===oS||c===cS;)r++,c=e.codePointAt(r)}if(s){let c=e.codePointAt(a-1);for(;c===oS||c===cS;)a--,c=e.codePointAt(a-1)}return a>r?e.slice(r,a):""}function xD(e,t){const s={type:"text",value:bD(String(t.value))};return e.patch(t,s),e.applyData(t,s)}function wD(e,t){const s={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,s),e.applyData(t,s)}const CD={blockquote:JT,break:eD,code:tD,delete:nD,emphasis:iD,footnoteReference:sD,heading:rD,html:lD,imageReference:aD,image:oD,inlineCode:cD,linkReference:uD,link:hD,listItem:dD,list:mD,paragraph:pD,root:gD,strong:_D,table:vD,tableCell:SD,tableRow:yD,text:xD,thematicBreak:wD,toml:Uc,yaml:Uc,definition:Uc,footnoteDefinition:Uc};function Uc(){}const Ox=-1,Tu=0,Wa=1,gu=2,Sp=3,bp=4,xp=5,wp=6,Bx=7,Lx=8,{defineProperty:kD}=Object,zx=typeof self=="object"?self:globalThis,hS=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new zx[e](t)},ND=(e,t)=>{const s=(a,c)=>(e.set(c,a),a),r=a=>{if(e.has(a))return e.get(a);const[c,h]=t[a];switch(c){case Tu:case Ox:return s(h,a);case Wa:{const f=s([],a);for(const g of h)f.push(r(g));return f}case gu:{const f=s({},a);for(const[g,p]of h){const v=r(g),_=r(p);v==="__proto__"?kD(f,v,{value:_,configurable:!0,enumerable:!0,writable:!0}):f[v]=_}return f}case Sp:return s(new Date(h),a);case bp:{const{source:f,flags:g}=h;return s(new RegExp(f,g),a)}case xp:{const f=s(new Map,a);for(const[g,p]of h)f.set(r(g),r(p));return f}case wp:{const f=s(new Set,a);for(const g of h)f.add(r(g));return f}case Bx:{const{name:f,message:g}=h;return s(typeof zx[f]=="function"?hS(f,g):new Error(g),a)}case Lx:return s(BigInt(h),a);case"BigInt":return s(Object(BigInt(h)),a);case"ArrayBuffer":return s(new Uint8Array(h).buffer,h);case"DataView":{const{buffer:f}=new Uint8Array(h);return s(new DataView(f),h)}case"-0":return-0}return s(hS(c,h),a)};return r},dS=e=>ND(new Map,e)(0),yr="",{toString:ED}={},{keys:jD,is:TD}=Object,Ra=e=>{const t=typeof e;if(t!=="object"||!e)return[Tu,t];const s=ED.call(e).slice(8,-1);switch(s){case"Array":return[Wa,yr];case"Object":return[gu,yr];case"Date":return[Sp,yr];case"RegExp":return[bp,yr];case"Map":return[xp,yr];case"Set":return[wp,yr];case"DataView":return[Wa,s]}return s.includes("Array")?[Wa,s]:e instanceof Error?[Bx,e.name||"Error"]:[gu,s]},Pc=([e,t])=>e===Tu&&(t==="function"||t==="symbol"),DD=(e,t,s,r)=>{const a=(h,f)=>{const g=r.push(h)-1;return s.set(f,g),g},c=h=>{if(s.has(h))return s.get(h);let[f,g]=Ra(h);switch(f){case Tu:{let v=h;switch(g){case"bigint":f=Lx,v=h.toString();break;case"number":if(!h&&TD(h,-0))return r.push(["-0"])-1;break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+g);v=null;break;case"undefined":return a([Ox],h)}return a([f,v],h)}case Wa:{if(g){let S=h;return g==="DataView"?S=new Uint8Array(h.buffer):g==="ArrayBuffer"&&(S=new Uint8Array(h)),a([g,[...S]],h)}const v=[],_=a([f,v],h);for(const S of h)v.push(c(S));return _}case gu:{if(g)switch(g){case"BigInt":return a([g,h.toString()],h);case"Boolean":case"Number":case"String":return a([g,h.valueOf()],h)}if(t&&"toJSON"in h)return c(h.toJSON());const v=[],_=a([f,v],h);for(const S of jD(h))(e||!Pc(Ra(h[S])))&&v.push([c(S),c(h[S])]);return _}case Sp:return a([f,isNaN(h.getTime())?yr:h.toISOString()],h);case bp:{const{source:v,flags:_}=h;return a([f,{source:v,flags:_}],h)}case xp:{const v=[],_=a([f,v],h);for(const[S,y]of h)(e||!(Pc(Ra(S))||Pc(Ra(y))))&&v.push([c(S),c(y)]);return _}case wp:{const v=[],_=a([f,v],h);for(const S of h)(e||!Pc(Ra(S)))&&v.push(c(S));return _}}const{message:p}=h;return a([f,{name:g,message:p}],h)};return c},fS=(e,{json:t,lossy:s}={})=>{const r=[];return DD(!(t||s),!!t,new Map,r)(e),r},_u=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?dS(fS(e,t)):structuredClone(e):(e,t)=>dS(fS(e,t));function MD(e,t){const s=[{type:"text",value:"↩"}];return t>1&&s.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),s}function AD(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function RD(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=e.options.footnoteBackContent||MD,r=e.options.footnoteBackLabel||AD,a=e.options.footnoteLabel||"Footnotes",c=e.options.footnoteLabelTagName||"h2",h=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let g=-1;for(;++g<e.footnoteOrder.length;){const p=e.footnoteById.get(e.footnoteOrder[g]);if(!p)continue;const v=e.all(p),_=String(p.identifier).toUpperCase(),S=Al(_.toLowerCase());let y=0;const x=[],w=e.footnoteCounts.get(_);for(;w!==void 0&&++y<=w;){x.length>0&&x.push({type:"text",value:" "});let M=typeof s=="string"?s:s(g,y);typeof M=="string"&&(M={type:"text",value:M}),x.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+S+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(g,y),className:["data-footnote-backref"]},children:Array.isArray(M)?M:[M]})}const j=v[v.length-1];if(j&&j.type==="element"&&j.tagName==="p"){const M=j.children[j.children.length-1];M&&M.type==="text"?M.value+=" ":j.children.push({type:"text",value:" "}),j.children.push(...x)}else v.push(...x);const N={type:"element",tagName:"li",properties:{id:t+"fn-"+S},children:e.wrap(v,!0)};e.patch(p,N),f.push(N)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:c,properties:{..._u(h),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
|
|
19
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
|
|
20
|
+
`}]}}const Du=(function(e){if(e==null)return zD;if(typeof e=="function")return Mu(e);if(typeof e=="object")return Array.isArray(e)?OD(e):BD(e);if(typeof e=="string")return LD(e);throw new Error("Expected function, string, or object as test")});function OD(e){const t=[];let s=-1;for(;++s<e.length;)t[s]=Du(e[s]);return Mu(r);function r(...a){let c=-1;for(;++c<t.length;)if(t[c].apply(this,a))return!0;return!1}}function BD(e){const t=e;return Mu(s);function s(r){const a=r;let c;for(c in e)if(a[c]!==t[c])return!1;return!0}}function LD(e){return Mu(t);function t(s){return s&&s.type===e}}function Mu(e){return t;function t(s,r,a){return!!(HD(s)&&e.call(this,s,typeof r=="number"?r:void 0,a||void 0))}}function zD(){return!0}function HD(e){return e!==null&&typeof e=="object"&&"type"in e}const Hx=[],ID=!0,iu=!1,pm="skip";function gm(e,t,s,r){if(!e||typeof e!="object")throw new Error("Unexpected value `"+e+"` for `tree`, expected node");let a=!0,c,h,f,g;if(typeof s=="function"||s&&typeof s=="object"?(c=t,h=s,r&&(a=!1)):(h=t,s&&(a=!1)),typeof h=="function")f=h;else if(h&&typeof h=="object"){if(!(h.enter===null||h.enter===void 0))if(typeof h.enter=="function")f=h.enter;else throw new Error("Unexpected value `"+h.enter+"` for `visitors.enter`, expected optional visitor");if(typeof h.exit=="function")g=h.exit;else throw new Error("Unexpected value `"+h.exit+"` for `visitors.exit`, expected visitor (pass a visitor directly if you only want an enter visitor)")}else throw new Error("Unexpected value `"+h+"` for `enter` or `visitors`, expected visitor or object with visitors");const p=Du(c),v=a?1:-1;_(e,void 0,[])();function _(S,y,x){const w=S&&typeof S=="object"?S:{};if(typeof w.type=="string"){const N=typeof w.tagName=="string"?w.tagName:typeof w.name=="string"?w.name:void 0;Object.defineProperty(j,"name",{value:"node ("+(S.type+(N?"<"+N+">":""))+")"})}return j;function j(){const N=!c||p(S,y,x[x.length-1]||void 0);let M=Hx;if(f&&N&&(M=mS(f(S,x,y)),M[0]===iu))return M;if("children"in S&&S.children){const T=S;if(T.children&&M[0]!==pm){let O=(a?-1:T.children.length)+v;const U=[...x,T];for(;O>-1&&O<T.children.length;){const z=T.children[O],A=_(z,O,U)();if(A[0]===iu)return A;O=typeof A[1]=="number"?A[1]:O+v}}}if(g&&N){const T=mS(g(S,x,y));if(T[0]===pm)throw new Error("Unexpected value `"+T[0]+"` from `exit`, expected `CONTINUE`, `EXIT`, index, or nothing");if(T[0]===iu||typeof T[1]=="number")return T}return M}}}function mS(e){return Array.isArray(e)?e:typeof e=="number"?[ID,e]:e==null?Hx:[e]}function Cp(e,t,s,r){let a,c,h;c=t,h=s,typeof c=="function"?gm(e,a,_m(c),h):gm(e,a,UD(c),h)}function UD(e){return!e||typeof e!="object"?e:{enter:typeof e.enter=="function"?_m(e.enter):e.enter,exit:typeof e.exit=="function"?_m(e.exit):e.exit}}function _m(e){return t;function t(s,r,a){return e(s,a,r[r.length-1])}}const vm={}.hasOwnProperty,PD={};function qD(e,t){const s=t||PD,r=new Map,a=new Map,c=new Map,h={...CD,...s.handlers},f={all:p,applyData:$D,definitionById:r,footnoteById:a,footnoteCounts:c,footnoteOrder:[],handlers:h,one:g,options:s,patch:FD,wrap:YD};return Cp(e,function(v){if(v.type==="definition"||v.type==="footnoteDefinition"){const _=v.type==="definition"?r:a,S=String(v.identifier).toUpperCase();_.has(S)||_.set(S,v)}}),f;function g(v,_){const S=v.type,y=f.handlers[S];if(vm.call(f.handlers,S)&&y)return y(f,v,_);if(f.options.passThrough&&f.options.passThrough.includes(S)){if("children"in v){const{children:w,...j}=v,N=_u(j);return N.children=f.all(v),N}return _u(v)}return(f.options.unknownHandler||VD)(f,v,_)}function p(v){const _=[];if("children"in v){const S=v.children;let y=-1;for(;++y<S.length;){const x=f.one(S[y],v);if(x){if(y&&S[y-1].type==="break"&&(!Array.isArray(x)&&x.type==="text"&&(x.value=pS(x.value)),!Array.isArray(x)&&x.type==="element")){const w=x.children[0];w&&w.type==="text"&&(w.value=pS(w.value))}Array.isArray(x)?_.push(...x):_.push(x)}}}return _}}function FD(e,t){e.position&&(t.position=AE(e))}function $D(e,t){let s=t;if(e&&e.data){const r=e.data.hName,a=e.data.hChildren,c=e.data.hProperties;if(typeof r=="string")if(s.type==="element")s.tagName=r;else{const h="children"in s?s.children:[s];s={type:"element",tagName:r,properties:{},children:h}}s.type==="element"&&c&&Object.assign(s.properties,_u(c)),"children"in s&&s.children&&a!==null&&a!==void 0&&(s.children=a)}return s}function VD(e,t){const s=t.data||{},r="value"in t&&!(vm.call(s,"hProperties")||vm.call(s,"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 YD(e,t){const s=[];let r=-1;for(t&&s.push({type:"text",value:`
|
|
21
|
+
`});++r<e.length;)r&&s.push({type:"text",value:`
|
|
22
|
+
`}),s.push(e[r]);return t&&e.length>0&&s.push({type:"text",value:`
|
|
23
|
+
`}),s}function pS(e){let t=0,s=e.charCodeAt(t);for(;s===9||s===32;)t++,s=e.charCodeAt(t);return e.slice(t)}function gS(e,t){const s=qD(e,t),r=s.one(e,void 0),a=RD(s),c=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return a&&c.children.push({type:"text",value:`
|
|
24
|
+
`},a),c}function KD(e,t){return e&&"run"in e?async function(s,r){const a=gS(s,{file:r,...t});await e.run(a,r)}:function(s,r){return gS(s,{file:r,...e||t})}}function _S(e){if(e)throw e}var kf,vS;function WD(){if(vS)return kf;vS=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,s=Object.defineProperty,r=Object.getOwnPropertyDescriptor,a=function(p){return typeof Array.isArray=="function"?Array.isArray(p):t.call(p)==="[object Array]"},c=function(p){if(!p||t.call(p)!=="[object Object]")return!1;var v=e.call(p,"constructor"),_=p.constructor&&p.constructor.prototype&&e.call(p.constructor.prototype,"isPrototypeOf");if(p.constructor&&!v&&!_)return!1;var S;for(S in p);return typeof S>"u"||e.call(p,S)},h=function(p,v){s&&v.name==="__proto__"?s(p,v.name,{enumerable:!0,configurable:!0,value:v.newValue,writable:!0}):p[v.name]=v.newValue},f=function(p,v){if(v==="__proto__")if(e.call(p,v)){if(r)return r(p,v).value}else return;return p[v]};return kf=function g(){var p,v,_,S,y,x,w=arguments[0],j=1,N=arguments.length,M=!1;for(typeof w=="boolean"&&(M=w,w=arguments[1]||{},j=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});j<N;++j)if(p=arguments[j],p!=null)for(v in p)_=f(w,v),S=f(p,v),w!==S&&(M&&S&&(c(S)||(y=a(S)))?(y?(y=!1,x=_&&a(_)?_:[]):x=_&&c(_)?_:{},h(w,{name:v,newValue:g(M,x,S)})):typeof S<"u"&&h(w,{name:v,newValue:S}));return w},kf}var XD=WD();const Nf=yN(XD);function ym(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 GD(){const e=[],t={run:s,use:r};return t;function s(...a){let c=-1;const h=a.pop();if(typeof h!="function")throw new TypeError("Expected function as last argument, not "+h);f(null,...a);function f(g,...p){const v=e[++c];let _=-1;if(g){h(g);return}for(;++_<a.length;)(p[_]===null||p[_]===void 0)&&(p[_]=a[_]);a=p,v?QD(v,f)(...p):h(null,...p)}}function r(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function QD(e,t){let s;return r;function r(...h){const f=e.length>h.length;let g;f&&h.push(a);try{g=e.apply(this,h)}catch(p){const v=p;if(f&&s)throw v;return a(v)}f||(g&&g.then&&typeof g.then=="function"?g.then(c,a):g instanceof Error?a(g):c(g))}function a(h,...f){s||(s=!0,t(h,...f))}function c(h){a(null,h)}}const Ri={basename:ZD,dirname:JD,extname:e3,join:t3,sep:"/"};function ZD(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');ro(e);let s=0,r=-1,a=e.length,c;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(c){s=a+1;break}}else r<0&&(c=!0,r=a+1);return r<0?"":e.slice(s,r)}if(t===e)return"";let h=-1,f=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(c){s=a+1;break}}else h<0&&(c=!0,h=a+1),f>-1&&(e.codePointAt(a)===t.codePointAt(f--)?f<0&&(r=a):(f=-1,r=h));return s===r?r=h:r<0&&(r=e.length),e.slice(s,r)}function JD(e){if(ro(e),e.length===0)return".";let t=-1,s=e.length,r;for(;--s;)if(e.codePointAt(s)===47){if(r){t=s;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function e3(e){ro(e);let t=e.length,s=-1,r=0,a=-1,c=0,h;for(;t--;){const f=e.codePointAt(t);if(f===47){if(h){r=t+1;break}continue}s<0&&(h=!0,s=t+1),f===46?a<0?a=t:c!==1&&(c=1):a>-1&&(c=-1)}return a<0||s<0||c===0||c===1&&a===s-1&&a===r+1?"":e.slice(a,s)}function t3(...e){let t=-1,s;for(;++t<e.length;)ro(e[t]),e[t]&&(s=s===void 0?e[t]:s+"/"+e[t]);return s===void 0?".":n3(s)}function n3(e){ro(e);const t=e.codePointAt(0)===47;let s=i3(e,!t);return s.length===0&&!t&&(s="."),s.length>0&&e.codePointAt(e.length-1)===47&&(s+="/"),t?"/"+s:s}function i3(e,t){let s="",r=0,a=-1,c=0,h=-1,f,g;for(;++h<=e.length;){if(h<e.length)f=e.codePointAt(h);else{if(f===47)break;f=47}if(f===47){if(!(a===h-1||c===1))if(a!==h-1&&c===2){if(s.length<2||r!==2||s.codePointAt(s.length-1)!==46||s.codePointAt(s.length-2)!==46){if(s.length>2){if(g=s.lastIndexOf("/"),g!==s.length-1){g<0?(s="",r=0):(s=s.slice(0,g),r=s.length-1-s.lastIndexOf("/")),a=h,c=0;continue}}else if(s.length>0){s="",r=0,a=h,c=0;continue}}t&&(s=s.length>0?s+"/..":"..",r=2)}else s.length>0?s+="/"+e.slice(a+1,h):s=e.slice(a+1,h),r=h-a-1;a=h,c=0}else f===46&&c>-1?c++:c=-1}return s}function ro(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const s3={cwd:r3};function r3(){return"/"}function Sm(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function l3(e){if(typeof e=="string")e=new URL(e);else if(!Sm(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 a3(e)}function a3(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 s=-1;for(;++s<t.length;)if(t.codePointAt(s)===37&&t.codePointAt(s+1)===50){const r=t.codePointAt(s+2);if(r===70||r===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const Ef=["history","path","basename","stem","extname","dirname"];class Ix{constructor(t){let s;t?Sm(t)?s={path:t}:typeof t=="string"||o3(t)?s={value:t}:s=t:s={},this.cwd="cwd"in s?"":s3.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Ef.length;){const c=Ef[r];c in s&&s[c]!==void 0&&s[c]!==null&&(this[c]=c==="history"?[...s[c]]:s[c])}let a;for(a in s)Ef.includes(a)||(this[a]=s[a])}get basename(){return typeof this.path=="string"?Ri.basename(this.path):void 0}set basename(t){Tf(t,"basename"),jf(t,"basename"),this.path=Ri.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ri.dirname(this.path):void 0}set dirname(t){yS(this.basename,"dirname"),this.path=Ri.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ri.extname(this.path):void 0}set extname(t){if(jf(t,"extname"),yS(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=Ri.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Sm(t)&&(t=l3(t)),Tf(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ri.basename(this.path,this.extname):void 0}set stem(t){Tf(t,"stem"),jf(t,"stem"),this.path=Ri.join(this.dirname||"",t+(this.extname||""))}fail(t,s,r){const a=this.message(t,s,r);throw a.fatal=!0,a}info(t,s,r){const a=this.message(t,s,r);return a.fatal=void 0,a}message(t,s,r){const a=new _n(t,s,r);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function jf(e,t){if(e&&e.includes(Ri.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ri.sep+"`")}function Tf(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function yS(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function o3(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const c3=(function(e){const r=this.constructor.prototype,a=r[e],c=function(){return a.apply(c,arguments)};return Object.setPrototypeOf(c,r),c}),u3={}.hasOwnProperty;class kp extends c3{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=GD()}copy(){const t=new kp;let s=-1;for(;++s<this.attachers.length;){const r=this.attachers[s];t.use(...r)}return t.data(Nf(!0,{},this.namespace)),t}data(t,s){return typeof t=="string"?arguments.length===2?(Af("data",this.frozen),this.namespace[t]=s,this):u3.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Af("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[s,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const a=s.call(t,...r);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const s=qc(t),r=this.parser||this.Parser;return Df("parse",r),r(String(s),s)}process(t,s){const r=this;return this.freeze(),Df("process",this.parser||this.Parser),Mf("process",this.compiler||this.Compiler),s?a(void 0,s):new Promise(a);function a(c,h){const f=qc(t),g=r.parse(f);r.run(g,f,function(v,_,S){if(v||!_||!S)return p(v);const y=_,x=r.stringify(y,S);f3(x)?S.value=x:S.result=x,p(v,S)});function p(v,_){v||!_?h(v):c?c(_):s(void 0,_)}}}processSync(t){let s=!1,r;return this.freeze(),Df("processSync",this.parser||this.Parser),Mf("processSync",this.compiler||this.Compiler),this.process(t,a),bS("processSync","process",s),r;function a(c,h){s=!0,_S(c),r=h}}run(t,s,r){SS(t),this.freeze();const a=this.transformers;return!r&&typeof s=="function"&&(r=s,s=void 0),r?c(void 0,r):new Promise(c);function c(h,f){const g=qc(s);a.run(t,g,p);function p(v,_,S){const y=_||t;v?f(v):h?h(y):r(void 0,y,S)}}}runSync(t,s){let r=!1,a;return this.run(t,s,c),bS("runSync","run",r),a;function c(h,f){_S(h),a=f,r=!0}}stringify(t,s){this.freeze();const r=qc(s),a=this.compiler||this.Compiler;return Mf("stringify",a),SS(t),a(t,r)}use(t,...s){const r=this.attachers,a=this.namespace;if(Af("use",this.frozen),t!=null)if(typeof t=="function")g(t,s);else if(typeof t=="object")Array.isArray(t)?f(t):h(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function c(p){if(typeof p=="function")g(p,[]);else if(typeof p=="object")if(Array.isArray(p)){const[v,..._]=p;g(v,_)}else h(p);else throw new TypeError("Expected usable value, not `"+p+"`")}function h(p){if(!("plugins"in p)&&!("settings"in p))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");f(p.plugins),p.settings&&(a.settings=Nf(!0,a.settings,p.settings))}function f(p){let v=-1;if(p!=null)if(Array.isArray(p))for(;++v<p.length;){const _=p[v];c(_)}else throw new TypeError("Expected a list of plugins, not `"+p+"`")}function g(p,v){let _=-1,S=-1;for(;++_<r.length;)if(r[_][0]===p){S=_;break}if(S===-1)r.push([p,...v]);else if(v.length>0){let[y,...x]=v;const w=r[S][1];ym(w)&&ym(y)&&(y=Nf(!0,w,y)),r[S]=[p,y,...x]}}}}const h3=new kp().freeze();function Df(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Mf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Af(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 SS(e){if(!ym(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function bS(e,t,s){if(!s)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function qc(e){return d3(e)?e:new Ix(e)}function d3(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function f3(e){return typeof e=="string"||m3(e)}function m3(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const p3="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",xS=[],wS={allowDangerousHtml:!0},g3=/^(https?|ircs?|mailto|xmpp)$/i,_3=[{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 v3(e){const t=y3(e),s=S3(e);return b3(t.runSync(t.parse(s),s),e)}function y3(e){const t=e.rehypePlugins||xS,s=e.remarkPlugins||xS,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...wS}:wS;return h3().use(ZT).use(s).use(KD,r).use(t)}function S3(e){const t=e.children||"",s=new Ix;return typeof t=="string"&&(s.value=t),s}function b3(e,t){const s=t.allowedElements,r=t.allowElement,a=t.components,c=t.disallowedElements,h=t.skipHtml,f=t.unwrapDisallowed,g=t.urlTransform||x3;for(const v of _3)Object.hasOwn(t,v.from)&&(""+v.from+(v.to?"use `"+v.to+"` instead":"remove it")+p3+v.id,void 0);return Cp(e,p),HE(e,{Fragment:u.Fragment,components:a,ignoreInvalidStyle:!0,jsx:u.jsx,jsxs:u.jsxs,passKeys:!0,passNode:!0});function p(v,_,S){if(v.type==="raw"&&S&&typeof _=="number")return h?S.children.splice(_,1):S.children[_]={type:"text",value:v.value},_;if(v.type==="element"){let y;for(y in xf)if(Object.hasOwn(xf,y)&&Object.hasOwn(v.properties,y)){const x=v.properties[y],w=xf[y];(w===null||w.includes(v.tagName))&&(v.properties[y]=g(String(x||""),y,v))}}if(v.type==="element"){let y=s?!s.includes(v.tagName):c?c.includes(v.tagName):!1;if(!y&&r&&typeof _=="number"&&(y=!r(v,_,S)),y&&S&&typeof _=="number")return f&&v.children?S.children.splice(_,1,...v.children):S.children.splice(_,1),_}}}function x3(e){const t=e.indexOf(":"),s=e.indexOf("?"),r=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||s!==-1&&t>s||r!==-1&&t>r||g3.test(e.slice(0,t))?e:""}function CS(e,t){const s=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,a=s.indexOf(t);for(;a!==-1;)r++,a=s.indexOf(t,a+t.length);return r}function w3(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function C3(e,t,s){const a=Du((s||{}).ignore||[]),c=k3(t);let h=-1;for(;++h<c.length;)gm(e,f);function f(p,v,_){if(p.type==="text"&&typeof _=="number")return g(p,v,_);if(a(p,_,v[v.length-1]))return pm}function g(p,v,_){const S=v[v.length-1],y=c[h][0],x=c[h][1];let w=0,j=!1,N=[];y.lastIndex=0;let M=y.exec(p.value);for(;M;){const O=M.index,U={index:M.index,input:M.input,stack:[...v,p]};let z=x(...M,U);if(typeof z=="string"&&(z=z.length>0?{type:"text",value:z}:void 0),z===!1)y.lastIndex=O+1;else{if(w!==O&&T({type:"text",value:p.value.slice(w,O)}),Array.isArray(z))for(const A of z)T(A);else z&&T(z);w=O+M[0].length,j=!0}if(!y.global)break;M=y.exec(p.value)}return j?(w<p.value.length&&T({type:"text",value:p.value.slice(w)}),S.children.splice(_,1,...N)):N=[p],_+N.length;function T(O){const U=N[N.length-1];U&&U.type==="text"&&O.type==="text"?U.value+=O.value:N.push(O)}}}function k3(e){if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const t=[],s=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<s.length;){const a=s[r];t.push([N3(a[0]),E3(a[1])])}return t}function N3(e){return typeof e=="string"?new RegExp(w3(e),"g"):e}function E3(e){return typeof e=="function"?e:function(){return e}}const Rf="phrasing",Of=["autolink","link","image","label"];function j3(){return{transforms:[B3],enter:{literalAutolink:D3,literalAutolinkEmail:Bf,literalAutolinkHttp:Bf,literalAutolinkWww:Bf},exit:{literalAutolink:O3,literalAutolinkEmail:R3,literalAutolinkHttp:M3,literalAutolinkWww:A3}}}function T3(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Rf,notInConstruct:Of},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Rf,notInConstruct:Of},{character:":",before:"[ps]",after:"\\/",inConstruct:Rf,notInConstruct:Of}]}}function D3(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Bf(e){this.config.enter.autolinkProtocol.call(this,e)}function M3(e){this.config.exit.autolinkProtocol.call(this,e)}function A3(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 R3(e){this.config.exit.autolinkEmail.call(this,e)}function O3(e){this.exit(e)}function B3(e){C3(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,L3],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),z3]],{ignore:["link","linkReference"]})}function L3(e,t,s,r,a){let c="";if(!Ux(a)||(/^w/i.test(t)&&(s=t+s,t="",c="http://"),!H3(s)))return!1;const h=I3(s+r);if(!h[0])return!1;const f={type:"link",title:null,url:c+t+h[0],children:[{type:"text",value:t+h[0]}]};return h[1]?[f,{type:"text",value:h[1]}]:f}function z3(e,t,s,r){return!Ux(r,!0)||/[-\d_]$/.test(s)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+s,children:[{type:"text",value:t+"@"+s}]}}function H3(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 I3(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let s=t[0],r=s.indexOf(")");const a=CS(e,"(");let c=CS(e,")");for(;r!==-1&&a>c;)e+=s.slice(0,r+1),s=s.slice(r+1),r=s.indexOf(")"),c++;return[e,s]}function Ux(e,t){const s=e.input.charCodeAt(e.index-1);return(e.index===0||kr(s)||Eu(s))&&(!t||s!==47)}Px.peek=W3;function U3(){this.buffer()}function P3(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function q3(){this.buffer()}function F3(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function $3(e){const t=this.resume(),s=this.stack[this.stack.length-1];s.type,s.identifier=_i(this.sliceSerialize(e)).toLowerCase(),s.label=t}function V3(e){this.exit(e)}function Y3(e){const t=this.resume(),s=this.stack[this.stack.length-1];s.type,s.identifier=_i(this.sliceSerialize(e)).toLowerCase(),s.label=t}function K3(e){this.exit(e)}function W3(){return"["}function Px(e,t,s,r){const a=s.createTracker(r);let c=a.move("[^");const h=s.enter("footnoteReference"),f=s.enter("reference");return c+=a.move(s.safe(s.associationId(e),{after:"]",before:c})),f(),h(),c+=a.move("]"),c}function X3(){return{enter:{gfmFootnoteCallString:U3,gfmFootnoteCall:P3,gfmFootnoteDefinitionLabelString:q3,gfmFootnoteDefinition:F3},exit:{gfmFootnoteCallString:$3,gfmFootnoteCall:V3,gfmFootnoteDefinitionLabelString:Y3,gfmFootnoteDefinition:K3}}}function G3(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:s,footnoteReference:Px},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function s(r,a,c,h){const f=c.createTracker(h);let g=f.move("[^");const p=c.enter("footnoteDefinition"),v=c.enter("label");return g+=f.move(c.safe(c.associationId(r),{before:g,after:"]"})),v(),g+=f.move("]:"),r.children&&r.children.length>0&&(f.shift(4),g+=f.move((t?`
|
|
25
|
+
`:" ")+c.indentLines(c.containerFlow(r,f.current()),t?qx:Q3))),p(),g}}function Q3(e,t,s){return t===0?e:qx(e,t,s)}function qx(e,t,s){return(s?"":" ")+e}const Z3=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Np.attention=iM;Np.peek=sM;function J3(){return{canContainEols:["delete"],enter:{strikethrough:tM},exit:{strikethrough:nM}}}function eM(){return{handlers:{delete:Np},unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Z3}]}}function tM(e){this.enter({type:"delete",children:[],position:void 0},e)}function nM(e){this.exit(e)}function Np(e,t,s,r){const a=s.createTracker(r),c=s.stack.includes("strikethrough")?"~":"~~",h=s.enter("strikethrough");let f=a.move(c);return f+=s.containerPhrasing(e,{...a.current(),before:f,after:"~"}),f+=a.move(c),h(),f}function iM(){return{construct:"strikethrough",markers:["~"],sizes:[2,1]}}function sM(){return"~"}function rM(e){return e.length}function lM(e,t){const s=t||{},r=(s.align||[]).concat(),a=s.stringLength||rM,c=[],h=[],f=[],g=[];let p=0,v=-1;for(;++v<e.length;){const w=[],j=[];let N=-1;for(e[v].length>p&&(p=e[v].length);++N<e[v].length;){const M=aM(e[v][N]);if(s.alignDelimiters!==!1){const T=a(M);j[N]=T,(g[N]===void 0||T>g[N])&&(g[N]=T)}w.push(M)}h[v]=w,f[v]=j}let _=-1;if(typeof r=="object"&&"length"in r)for(;++_<p;)c[_]=kS(r[_]);else{const w=kS(r);for(;++_<p;)c[_]=w}_=-1;const S=[],y=[];for(;++_<p;){const w=c[_];let j="",N="";w===99?(j=":",N=":"):w===108?j=":":w===114&&(N=":");let M=s.alignDelimiters===!1?1:Math.max(1,g[_]-j.length-N.length);const T=j+"-".repeat(M)+N;s.alignDelimiters!==!1&&(M=j.length+M+N.length,M>g[_]&&(g[_]=M),y[_]=M),S[_]=T}h.splice(1,0,S),f.splice(1,0,y),v=-1;const x=[];for(;++v<h.length;){const w=h[v],j=f[v];_=-1;const N=[];for(;++_<p;){const M=w[_]||"";let T="",O="";if(s.alignDelimiters!==!1){const U=g[_]-(j[_]||0),z=c[_];z===114?T=" ".repeat(U):z===99?U%2?(T=" ".repeat(U/2+.5),O=" ".repeat(U/2-.5)):(T=" ".repeat(U/2),O=T):O=" ".repeat(U)}s.delimiterStart!==!1&&!_&&N.push("|"),s.padding!==!1&&!(s.alignDelimiters===!1&&M==="")&&(s.delimiterStart!==!1||_)&&N.push(" "),s.alignDelimiters!==!1&&N.push(T),N.push(M),s.alignDelimiters!==!1&&N.push(O),s.padding!==!1&&N.push(" "),(s.delimiterEnd!==!1||_!==p-1)&&N.push("|")}x.push(s.delimiterEnd===!1?N.join("").replace(/ +$/,""):N.join(""))}return x.join(`
|
|
26
|
+
`)}function aM(e){return e==null?"":String(e)}function kS(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}const oM=Du(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function cM(e,t,s,r){const a=s.enter("blockquote"),c=s.createTracker(r);c.move("> "),c.shift(2);const h=s.indentLines(s.containerFlow(e,c.current()),uM);return a(),h}function uM(e,t,s){return">"+(s?"":" ")+e}function hM(e,t){return NS(e,t.inConstruct,!0)&&!NS(e,t.notInConstruct,!1)}function NS(e,t,s){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return s;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function ES(e,t,s,r){let a=-1;for(;++a<s.unsafe.length;){const c=s.unsafe[a];if(c.character===`
|
|
27
|
+
`&&!c.before&&!c.after&&hM(s.stack,c))return/[\t ]/.test(r.before)?"":" "}return`\\
|
|
28
|
+
`}function dM(e,t){const s=String(e);let r=s.indexOf(t),a=r,c=0,h=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===a?++c>h&&(h=c):c=1,a=r+t.length,r=s.indexOf(t,a);return h}function fM(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^\n\r ]/.test(e.value)&&!/^[\t ]*(?:[\n\r]|$)|(?:^|[\n\r])[\t ]*$/.test(e.value))}function mM(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 pM(e,t,s,r){const a=mM(s),c=e.value||"";if(fM(e,s)){const _=s.enter("codeIndented"),S=s.indentLines(c,gM);return _(),S}const h=s.createTracker(r),f=a.repeat(Math.max(dM(c,a)+1,3)),g=s.enter("codeFenced"),p=a==="`"?"GraveAccent":"Tilde";let v=h.move(f);if(e.lang){const _=s.enter(`codeFencedLang${p}`);v+=h.move(s.safe(e.lang,{before:v,after:" ",encode:["`"],...h.current()})),_()}if(e.lang&&e.meta){const _=s.enter(`codeFencedMeta${p}`);v+=h.move(" "),v+=h.move(s.safe(e.meta,{before:v,after:`
|
|
29
|
+
`,encode:["`"],...h.current()})),_()}return v+=h.move(`
|
|
30
|
+
`),c&&(v+=h.move(c+`
|
|
31
|
+
`)),v+=h.move(f),g(),v}function gM(e,t,s){return(s?"":" ")+e}function Ep(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 _M(e,t,s,r){const a=Ep(s),c=a==='"'?"Quote":"Apostrophe",h=s.enter("definition");let f=s.enter("label");const g=s.createTracker(r);let p=g.move("[");return p+=g.move(s.safe(s.associationId(e),{before:p,after:"]",...g.current()})),p+=g.move("]: "),f(),!e.url||/[\0- \u007F]/.test(e.url)?(f=s.enter("destinationLiteral"),p+=g.move("<"),p+=g.move(s.safe(e.url,{before:p,after:">",...g.current()})),p+=g.move(">")):(f=s.enter("destinationRaw"),p+=g.move(s.safe(e.url,{before:p,after:e.title?" ":`
|
|
32
|
+
`,...g.current()}))),f(),e.title&&(f=s.enter(`title${c}`),p+=g.move(" "+a),p+=g.move(s.safe(e.title,{before:p,after:a,...g.current()})),p+=g.move(a),f()),h(),p}function vM(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 vu(e){const t=e.codePointAt(0);return t===void 0?"":String.fromCodePoint(t)}function El(e){const t=e.codePointAt(e.length-2);return t!==void 0&&t>65535?e.slice(-2):e.slice(-1)}function Fx(e){return"&#x"+e.toString(16).toUpperCase()+";"}function jS(e,t,s){const r=qs(e),a=qs(t);return r===void 0?a===void 0?s==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}function yM(e){if(e.charCodeAt(0)!==60)return;const t=e.charCodeAt(1);if(t===33){const f=e.charCodeAt(2);return f===45?2:f===91?5:dn(f)?4:void 0}if(t===63)return 3;const s=t===47,r=s?2:1;let a=r,c=e.charCodeAt(a);if(!dn(c))return;for(;c===45||mn(c);)c=e.charCodeAt(++a);const h=e.slice(r,a).toLowerCase();return!s&&c!==47&&mm.includes(h)?1:Ex.includes(h)?6:7}const SM=new Map([["*",!1],["_",!0]]);function bM(e,t,s){const r=new Set;for(const c of e){const h=s.get(c);if(h&&c.attention&&t.some(f=>f.attention===c.attention))for(const f of h.tokens)r.add(f.attention)}const a=[];for(const c of e)c.attention&&r.delete(c.attention)&&a.push(c.attention);return a.reverse(),a}function $x(e,t,s){const r=[],a=new Map,c=new Map;let h=0;for(;h<e.length;){if(!e[h].attention){h++;continue}const f=e[h].value.charAt(0),g=SM.get(f);let p=h+1;for(;p<e.length&&e[p].attention&&e[p].value.charAt(0)===f;)p++;const v=h?e[h-1].value:t,_=qs(v.charCodeAt(v.length-1)),S=qs((p<e.length?e[p].value:s).charCodeAt(0)),y=!S||S===2&&!!_,x=!_||_===2&&!!S,w={tokens:e.slice(h,p),markers:[],start:0,end:0,open:g?y&&(!!_||!x):y,close:g?x&&(!!S||!y):x,split:g!==void 0};for(const j of w.tokens){a.set(j,[...w.tokens]),c.set(j,w);let N=j.value.length;for(;N--;)w.markers.push(j)}w.end=w.markers.length,r.push(w),h=p}for(wM(r,a),h=-1;++h<e.length;){const f=a.get(e[h]);if(f)return{attention:bM(e,f,c),index:h}}}function Fc(e,t){const s=e[t?0:e.length-1];if(!s||s.attention)return;const r=t?vu(s.value):El(s.value),a=Fx(r.codePointAt(0));if(t)s.value=a+s.value.slice(r.length);else{let c=s.value.slice(0,s.value.length-r.length),h=0;for(;c.charCodeAt(c.length-1-h)===92;)h++;h%2&&(c+="\\"),s.value=c+a}}function xM(e,t,s,r,a){for(const c of s.attention){const h=t.get(c)||c.sequences[0];for(const f of c.sequences){if(f===h)continue;const g=new Map(t);g.set(c,f);const p=Tp(e,g,r,a),v=$x(p,r,a);if(!v||v.index>s.index)return{chosen:g,mistake:v,tokens:p}}}}function wM(e,t){const s=new Map;for(const r of e){const a=r.tokens[0].value.charAt(0);let c=s.get(a);c||(c=[],s.set(a,c));let h=r.close?c.length:0;for(;h--&&r.start<r.end;){const f=c[h],g=f.end-f.start,p=r.end-r.start;if(r.split?(f.close||r.open)&&p%3&&!((g+p)%3):g!==f.markers.length||g!==p)continue;const v=r.split?g>1&&p>1?2:1:p,_=f.markers.slice(f.end-v,f.end),S=r.markers.slice(r.start,r.start+v),y=_[0],x=S[0];if(y===_[v-1]&&y.value.length===v&&x===S[v-1]&&x.value.length===v&&y.attention===x.attention)t.delete(y),t.delete(x);else{const w=[...new Set([..._,...S])];for(const j of w){const N=t.get(j);N&&N.push(...w)}}f.end-=v,r.start+=v,f.start===f.end&&c.splice(h,1),h=c.length}r.open&&r.start<r.end&&c.push(r)}}function CM(e,t,s){if(t.length===0)throw new Error("Cannot serialize `"+e+"` as attention without markers, expected one or more markers");if(s.length===0)throw new Error("Cannot serialize `"+e+"` as attention without sizes, expected one or more sizes");for(const a of s)if(!Number.isSafeInteger(a)||a<1)throw new Error("Cannot serialize `"+e+"` as attention with `"+a+"` as size, expected positive integer");const r=[];for(const a of t){if(a.length!==1)throw new Error("Cannot serialize `"+e+"` as attention with `"+a+"` as marker, expected a single ascii character");if(!vx(a.charCodeAt(0)))throw new Error("Cannot serialize `"+e+"` as attention with `"+a+"` as marker, expected ascii punctuation");for(const c of s)r.push(a.repeat(c))}return r}function kM(e,t,s){const r=t.indexStack,a=e.children||[],c=[];let h=-1,f=s.before;r.push(-1);let g=t.createTracker(s);for(;++h<a.length;){const p=a[h];let v;if(r[r.length-1]=h,h+1<a.length){let y=t.handle.handlers[a[h+1].type];y&&y.peek&&(y=y.peek),v=y?vu(y(a[h+1],e,t,{before:"",after:"",...g.current()})):""}else v=s.after;const _=c[c.length-1];typeof _=="string"&&(f==="\r"||f===`
|
|
33
|
+
`)&&p.type==="html"&&yM(p.value)!==7&&(c[c.length-1]=_.replace(/(\r?\n|\r)$/," "),f=" ",g=t.createTracker(s),g.move(Au(c,s.before,s.after)));const S=t.handle.handlers[p.type];if(S&&S.attention){const y=jp(p,S.attention,t,g);c.push(y),f=El(y.sequences[0])}else{const y=t.handle(p,e,t,{...g.current(),after:v,before:f});if(!y)continue;g.move(y),c.push(y),f=El(y)}}return r.pop(),c}function jp(e,t,s,r){const{construct:a,markers:c,sizes:h}=t(e,s),f=CM(e.type,c,h),g=f[0],p=s.enter(a);r.move(g);const v=kM(e,s,{...r.current(),before:g,after:g});return r.move(Au(v,g,g)),r.move(g),p(),{children:v,sequences:f}}function Tp(e,t,s,r){const a=[];let c,h=El(s),f=-1;for(;++f<e.length;){const g=e[f];if(typeof g=="string"){const T={value:g,attention:void 0};c&&c===vu(g)&&Fc([T],!0),c=void 0,a.push(T),T.value&&(h=El(T.value));continue}const p=t.get(g)||g.sequences[0],v=p.charAt(0),_=e[f+1],S=h,y=vu(_===void 0?r:typeof _=="string"?_:t.get(_)||_.sequences[0]),x=Tp(g.children,t,p,p),w=x.length>0?x[0].value:"",j=jS(S.charCodeAt(S.length-1),w.charCodeAt(0),v);j.inside&&Fc(x,!0);const N=x.length>0?El(x[x.length-1].value):"",M=jS(y.charCodeAt(0),N.charCodeAt(N.length-1),v);M.inside&&Fc(x,!1),j.outside&&S!==`
|
|
34
|
+
`&&S!=="\r"&&Fc(a,!1),M.outside&&(c=y),a.push({value:p,attention:g},...x,{value:p,attention:g}),h=p.charAt(p.length-1)}return a}function Au(e,t,s){let r=new Map;const a=Tp(e,r,t,s);let c=a,h=$x(c,t,s);for(;h;){const g=xM(e,r,h,t,s);if(!g){c=a;break}r=g.chosen,c=g.tokens,h=g.mistake}let f="";for(const g of c)f+=g.value;return f}Dp.attention=Vx;Dp.peek=NM;function Dp(e,t,s,r){const a=s.enter("phrasing"),c=jp(e,Vx,s,s.createTracker(r)),h=Au([c],r.before,r.after);return a(),h}function Vx(e,t){return{construct:"emphasis",markers:vM(t)==="*"?["*","_"]:["_","*"],sizes:[1]}}function NM(e,t,s){return s.options.emphasis||"*"}function EM(e,t){let s=!1;return Cp(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return s=!0,iu}),!!((!e.depth||e.depth<3)&&_p(e)&&(t.options.setext||s))}function jM(e,t,s,r){const a=Math.max(Math.min(6,e.depth||1),1),c=s.createTracker(r);if(EM(e,s)){const _=s.enter("headingSetext"),S=s.enter("phrasing"),y=s.containerPhrasing(e,{...c.current(),before:`
|
|
35
|
+
`,after:`
|
|
36
|
+
`});return S(),_(),y+`
|
|
37
|
+
`+(a===1?"=":"-").repeat(y.length-(Math.max(y.lastIndexOf("\r"),y.lastIndexOf(`
|
|
38
|
+
`))+1))}const h="#".repeat(a),f=s.enter("headingAtx"),g=s.enter("phrasing");c.move(h+" ");let p=s.containerPhrasing(e,{before:"# ",after:`
|
|
39
|
+
`,...c.current()});const v=p.charCodeAt(0);return(v===9||v===32)&&(p=Fx(v)+p.slice(1)),p=p?h+" "+p:h,s.options.closeAtx&&(p+=" "+h),g(),f(),p}Yx.peek=TM;function Yx(e){return e.value||""}function TM(){return"<"}Kx.peek=DM;function Kx(e,t,s,r){const a=Ep(s),c=a==='"'?"Quote":"Apostrophe",h=s.enter("image");let f=s.enter("label");const g=s.createTracker(r);let p=g.move("![");return p+=g.move(s.safe(e.alt,{before:p,after:"]",...g.current()})),p+=g.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=s.enter("destinationLiteral"),p+=g.move("<"),p+=g.move(s.safe(e.url,{before:p,after:">",...g.current()})),p+=g.move(">")):(f=s.enter("destinationRaw"),p+=g.move(s.safe(e.url,{before:p,after:e.title?" ":")",...g.current()}))),f(),e.title&&(f=s.enter(`title${c}`),p+=g.move(" "+a),p+=g.move(s.safe(e.title,{before:p,after:a,...g.current()})),p+=g.move(a),f()),p+=g.move(")"),h(),p}function DM(){return"!"}Wx.peek=MM;function Wx(e,t,s,r){const a=e.referenceType,c=s.enter("imageReference");let h=s.enter("label");const f=s.createTracker(r);let g=f.move("![");const p=s.safe(e.alt,{before:g,after:"]",...f.current()});g+=f.move(p+"]["),h();const v=s.stack;s.stack=v.filter(function(S){return S!=="phrasing"}),h=s.enter("reference");const _=s.safe(s.associationId(e),{before:g,after:"]",...f.current()});return h(),s.stack=v,c(),a==="full"||!p||p!==_?g+=f.move(_+"]"):a==="shortcut"?g=g.slice(0,-1):g+=f.move("]"),g}function MM(){return"!"}Xx.peek=AM;function Xx(e,t,s){let r=e.value||"",a="`",c=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(r);)a+="`";for(/[^\n\r ]/.test(r)&&(/^[\n\r ]/.test(r)&&/[\n\r ]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++c<s.unsafe.length;){const h=s.unsafe[c],f=s.compilePattern(h);if(!h.atBreak)continue;let g;for(;g=f.exec(r);){let p=g.index;r.charCodeAt(p)===10&&r.charCodeAt(p-1)===13&&p--,r=r.slice(0,p)+" "+r.slice(g.index+1)}}return a+r+a}function AM(){return"`"}function Gx(e,t){const s=_p(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(s===e.url||"mailto:"+s===e.url)&&/^[a-z][+\-.a-z]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Qx.peek=RM;function Qx(e,t,s,r){const a=Ep(s),c=a==='"'?"Quote":"Apostrophe",h=s.createTracker(r);if(Gx(e,s)){const x=s.stack;s.stack=x.filter(function(N){return N!=="phrasing"});const w=s.enter("autolink");let j=h.move("<");return j+=h.move(s.containerPhrasing(e,{before:j,after:">",...h.current()})),j+=h.move(">"),w(),s.stack=x,j}const f=s.enter("link");let g=s.enter("label"),p=h.move("[");const v=s.containerPhrasing(e,{before:p,after:"](",...h.current()});p+=h.move(v),g(),p+=h.move("](");const _=/[\0- \u007F]/.test(e.url),S=r.before.charAt(r.before.length-1);let y=e.title||void 0;if(!y&&!_&&(S===`
|
|
40
|
+
`||S==="\r")){let x=0;for(;x<v.length&&v.charCodeAt(x)!==93;)x+=v.charCodeAt(x)===92?2:1;v.charCodeAt(x+1)===58&&(y="")}return!e.url&&typeof y=="string"||_?(g=s.enter("destinationLiteral"),p+=h.move("<"),p+=h.move(s.safe(e.url,{before:p,after:">",...h.current()})),p+=h.move(">")):(g=s.enter("destinationRaw"),p+=h.move(s.safe(e.url,{before:p,after:typeof y=="string"?" ":")",...h.current()}))),g(),typeof y=="string"&&(g=s.enter(`title${c}`),p+=h.move(" "+a),p+=h.move(s.safe(y,{before:p,after:a,...h.current()})),p+=h.move(a),g()),p+=h.move(")"),f(),p}function RM(e,t,s){return Gx(e,s)?"<":"["}Zx.peek=OM;function Zx(e,t,s,r){const a=e.referenceType,c=s.enter("linkReference");let h=s.enter("label");const f=s.createTracker(r);let g=f.move("[");const p=s.containerPhrasing(e,{before:g,after:"]",...f.current()});g+=f.move(p+"]["),h();const v=s.stack;s.stack=v.filter(function(S){return S!=="phrasing"}),h=s.enter("reference");const _=s.safe(s.associationId(e),{before:g,after:"]",...f.current()});return h(),s.stack=v,c(),a==="full"||!p||p!==_?g+=f.move(_+"]"):a==="shortcut"?g=g.slice(0,-1):g+=f.move("]"),g}function OM(){return"["}function Mp(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 BM(e){const t=Mp(e),s=e.options.bulletOther;if(!s)return t==="*"?"-":"*";if(s!=="*"&&s!=="+"&&s!=="-")throw new Error("Cannot serialize items with `"+s+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(s===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+s+"`) to be different");return s}function LM(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 Jx(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 zM(e,t,s,r){const a=s.enter("list"),c=s.bulletCurrent;let h=e.ordered?LM(s):Mp(s);const f=e.ordered?h==="."?")":".":BM(s);let g=t&&s.bulletLastUsed?h===s.bulletLastUsed:!1;if(!e.ordered){const v=e.children?e.children[0]:void 0;if((h==="*"||h==="-")&&v&&(!v.children||!v.children[0])&&s.stack[s.stack.length-1]==="list"&&s.stack[s.stack.length-2]==="listItem"&&s.stack[s.stack.length-3]==="list"&&s.stack[s.stack.length-4]==="listItem"&&s.indexStack[s.indexStack.length-1]===0&&s.indexStack[s.indexStack.length-2]===0&&s.indexStack[s.indexStack.length-3]===0&&(g=!0),Jx(s)===h&&v){let _=-1;for(;++_<e.children.length;){const S=e.children[_];if(S&&S.type==="listItem"&&S.children&&S.children[0]&&S.children[0].type==="thematicBreak"){g=!0;break}}}}g&&(h=f),s.bulletCurrent=h;const p=s.containerFlow(e,r);return s.bulletLastUsed=h,s.bulletCurrent=c,a(),p}function HM(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 IM(e,t,s,r){const a=HM(s);let c=s.bulletCurrent||Mp(s);t&&t.type==="list"&&t.ordered&&(c=(typeof t.start=="number"&&t.start>-1?t.start:1)+(s.options.incrementListMarker===!1?0:t.children.indexOf(e))+c);let h=c.length+1;(a==="tab"||a==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(h=Math.ceil(h/4)*4);const f=s.createTracker(r);f.move(c+" ".repeat(h-c.length)),f.shift(h);const g=s.enter("listItem"),p=s.indentLines(s.containerFlow(e,f.current()),v);return g(),p;function v(_,S,y){return S?(y?"":" ".repeat(h))+_:(y?c:c+" ".repeat(h-c.length))+_}}function UM(e,t,s,r){const a=s.enter("paragraph"),c=s.enter("phrasing"),h=s.containerPhrasing(e,r);return c(),a(),h}function PM(e,t,s,r){if(!e.children.some(function(f){return oM(f)}))return s.containerFlow(e,r);const c=s.enter("phrasing"),h=s.containerPhrasing(e,r);return c(),h}function qM(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Ap.attention=e1;Ap.peek=FM;function Ap(e,t,s,r){const a=s.enter("phrasing"),c=jp(e,e1,s,s.createTracker(r)),h=Au([c],r.before,r.after);return a(),h}function e1(e,t){return{construct:"strong",markers:qM(t)==="*"?["*","_"]:["_","*"],sizes:[2]}}function FM(e,t,s){return s.options.strong||"*"}function $M(e,t,s,r){const a=t?t.children:[],c=s.indexStack[s.indexStack.length-1];return s.safe(e.value,{...r,afterNode:a[c+1],beforeNode:a[c-1]})}function VM(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 YM(e,t,s){const r=(Jx(s)+(s.options.ruleSpaces?" ":"")).repeat(VM(s));return s.options.ruleSpaces?r.slice(0,-1):r}const t1={blockquote:cM,break:ES,code:pM,definition:_M,emphasis:Dp,hardBreak:ES,heading:jM,html:Yx,image:Kx,imageReference:Wx,inlineCode:Xx,link:Qx,linkReference:Zx,list:zM,listItem:IM,paragraph:UM,root:PM,strong:Ap,text:$M,thematicBreak:YM};function KM(){return{enter:{table:WM,tableData:TS,tableHeader:TS,tableRow:GM},exit:{codeText:QM,table:XM,tableData:Lf,tableHeader:Lf,tableRow:Lf}}}function WM(e){const t=e._align;this.enter({type:"table",align:t.map(function(s){return s==="none"?null:s}),children:[]},e),this.data.inTable=!0}function XM(e){this.exit(e),this.data.inTable=void 0}function GM(e){this.enter({type:"tableRow",children:[]},e)}function Lf(e){this.exit(e)}function TS(e){this.enter({type:"tableCell",children:[]},e)}function QM(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,ZM));const s=this.stack[this.stack.length-1];s.type,s.value=t,this.exit(e)}function ZM(e,t){return t==="|"?t:e}function JM(e){const t=e||{},s=t.tableCellPadding,r=t.tablePipeAlign,a=t.stringLength,c=s?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
41
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:S,table:h,tableCell:g,tableRow:f}};function h(y,x,w,j){return p(v(y,w,j),y.align)}function f(y,x,w,j){const N=_(y,w,j),M=p([N]);return M.slice(0,M.indexOf(`
|
|
42
|
+
`))}function g(y,x,w,j){const N=w.enter("tableCell"),M=w.enter("phrasing"),T=w.containerPhrasing(y,{...j,before:c,after:c});return M(),N(),T}function p(y,x){return lM(y,{align:x,alignDelimiters:r,padding:s,stringLength:a})}function v(y,x,w){const j=y.children;let N=-1;const M=[],T=x.enter("table");for(;++N<j.length;)M[N]=_(j[N],x,w);return T(),M}function _(y,x,w){const j=y.children;let N=-1;const M=[],T=x.enter("tableRow");for(;++N<j.length;)M[N]=g(j[N],y,x,w);return T(),M}function S(y,x,w){let j=t1.inlineCode(y,x,w);return w.stack.includes("tableCell")&&(j=j.replace(/\|/g,"\\$&")),j}}function eA(){return{exit:{taskListCheckValueChecked:DS,taskListCheckValueUnchecked:DS,paragraph:nA}}}function tA(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:iA}}}function DS(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function nA(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const s=this.stack[this.stack.length-1];s.type;const r=s.children[0];if(r&&r.type==="text"){const a=t.children;let c=-1,h;for(;++c<a.length;){const f=a[c];if(f.type==="paragraph"){h=f;break}}h===s&&(r.value=r.value.slice(1),r.value.length===0?s.children.shift():s.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,s.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function iA(e,t,s,r){const a=e.children[0],c=typeof e.checked=="boolean"&&a&&a.type==="paragraph",h="["+(e.checked?"x":" ")+"] ",f=s.createTracker(r);c&&f.move(h);let g=t1.listItem(e,t,s,{...r,...f.current()});return c&&(g=g.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,p)),g;function p(v){return v+h}}function sA(){return[j3(),X3(),J3(),KM(),eA()]}function rA(e){return{extensions:[T3(),G3(e),eM(),JM(e),tA()]}}const lA={tokenize:dA,partial:!0},n1={tokenize:fA,partial:!0},i1={tokenize:mA,partial:!0},s1={tokenize:pA,partial:!0},aA={tokenize:gA,partial:!0},r1={name:"wwwAutolink",tokenize:uA,previous:a1},l1={name:"protocolAutolink",tokenize:hA,previous:o1},rs={name:"emailAutolink",tokenize:cA,previous:c1},Hi={};function oA(){return{text:Hi}}let pr=48;for(;pr<123;)Hi[pr]=rs,pr++,pr===58?pr=65:pr===91&&(pr=97);Hi[43]=rs;Hi[45]=rs;Hi[46]=rs;Hi[95]=rs;Hi[72]=[rs,l1];Hi[104]=[rs,l1];Hi[87]=[rs,r1];Hi[119]=[rs,r1];function cA(e,t,s){const r=this;let a,c;return h;function h(_){return!bm(_)||!c1.call(r,r.previous)||Rp(r.events)?s(_):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(_))}function f(_){return bm(_)?(e.consume(_),f):_===64?(e.consume(_),g):s(_)}function g(_){return _===46?e.check(aA,v,p)(_):_===45||_===95||mn(_)?(c=!0,e.consume(_),g):v(_)}function p(_){return e.consume(_),a=!0,g}function v(_){return c&&a&&dn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(_)):s(_)}}function uA(e,t,s){const r=this;return a;function a(h){return h!==87&&h!==119||!a1.call(r,r.previous)||Rp(r.events)?s(h):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(lA,e.attempt(n1,e.attempt(i1,c),s),s)(h))}function c(h){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(h)}}function hA(e,t,s){const r=this;let a="",c=!1;return h;function h(_){return(_===72||_===104)&&o1.call(r,r.previous)&&!Rp(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(_),e.consume(_),f):s(_)}function f(_){if(dn(_)&&a.length<5)return a+=String.fromCodePoint(_),e.consume(_),f;if(_===58){const S=a.toLowerCase();if(S==="http"||S==="https")return e.consume(_),g}return s(_)}function g(_){return _===47?(e.consume(_),c?p:(c=!0,g)):s(_)}function p(_){return _===null||mu(_)||yt(_)||kr(_)||Eu(_)?s(_):e.attempt(n1,e.attempt(i1,v),s)(_)}function v(_){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(_)}}function dA(e,t,s){let r=0;return a;function a(h){return(h===87||h===119)&&r<3?(r++,e.consume(h),a):h===46&&r===3?(e.consume(h),c):s(h)}function c(h){return h===null?s(h):t(h)}}function fA(e,t,s){let r,a,c;return h;function h(p){return p===46||p===95?e.check(s1,g,f)(p):p===null||yt(p)||kr(p)||p!==45&&Eu(p)?g(p):(c=!0,e.consume(p),h)}function f(p){return p===95?r=!0:(a=r,r=void 0),e.consume(p),h}function g(p){return a||r||!c?s(p):t(p)}}function mA(e,t){let s=0,r=0;return a;function a(h){return h===40?(s++,e.consume(h),a):h===41&&r<s?c(h):h===33||h===34||h===38||h===39||h===41||h===42||h===44||h===46||h===58||h===59||h===60||h===63||h===93||h===95||h===126?e.check(s1,t,c)(h):h===null||yt(h)||kr(h)?t(h):(e.consume(h),a)}function c(h){return h===41&&r++,e.consume(h),a}}function pA(e,t,s){return r;function r(f){return f===33||f===34||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===63||f===95||f===126?(e.consume(f),r):f===38?(e.consume(f),c):f===93?(e.consume(f),a):f===60||f===null||yt(f)||kr(f)?t(f):s(f)}function a(f){return f===null||f===40||f===91||yt(f)||kr(f)?t(f):r(f)}function c(f){return dn(f)?h(f):s(f)}function h(f){return f===59?(e.consume(f),r):dn(f)?(e.consume(f),h):s(f)}}function gA(e,t,s){return r;function r(c){return e.consume(c),a}function a(c){return mn(c)?s(c):t(c)}}function a1(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||yt(e)}function o1(e){return!dn(e)}function c1(e){return!(e===47||bm(e))}function bm(e){return e===43||e===45||e===46||e===95||mn(e)}function Rp(e){let t=e.length,s=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){s=!0;break}if(r._gfmAutolinkLiteralWalkedInto){s=!1;break}}return e.length>0&&!s&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),s}const _A={tokenize:kA,partial:!0};function vA(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:xA,continuation:{tokenize:wA},exit:CA}},text:{91:{name:"gfmFootnoteCall",tokenize:bA},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:yA,resolveTo:SA}}}}function yA(e,t,s){const r=this;let a=r.events.length;const c=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let h;for(;a--;){const g=r.events[a][1];if(g.type==="labelImage"){h=g;break}if(g.type==="gfmFootnoteCall"||g.type==="labelLink"||g.type==="label"||g.type==="image"||g.type==="link")break}return f;function f(g){if(!h||!h._balanced)return s(g);const p=_i(r.sliceSerialize({start:h.end,end:r.now()}));return p.codePointAt(0)!==94||!c.includes(p.slice(1))?s(g):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),t(g))}}function SA(e,t){let s=e.length;for(;s--;)if(e[s][1].type==="labelImage"&&e[s][0]==="enter"){e[s][1];break}e[s+1][1].type="data",e[s+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[s+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[s+3][1].end),end:Object.assign({},e[s+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const c={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},h={type:"chunkString",contentType:"string",start:Object.assign({},c.start),end:Object.assign({},c.end)},f=[e[s+1],e[s+2],["enter",r,t],e[s+3],e[s+4],["enter",a,t],["exit",a,t],["enter",c,t],["enter",h,t],["exit",h,t],["exit",c,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(s,e.length-s+1,...f),e}function bA(e,t,s){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let c=0,h;return f;function f(_){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(_),e.exit("gfmFootnoteCallLabelMarker"),g}function g(_){return _!==94?s(_):(e.enter("gfmFootnoteCallMarker"),e.consume(_),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",p)}function p(_){if(c>999||_===93&&!h||_===null||_===91||yt(_))return s(_);if(_===93){e.exit("chunkString");const S=e.exit("gfmFootnoteCallString");return a.includes(_i(r.sliceSerialize(S)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(_),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):s(_)}return yt(_)||(h=!0),c++,e.consume(_),_===92?v:p}function v(_){return _===91||_===92||_===93?(e.consume(_),c++,p):p(_)}}function xA(e,t,s){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let c,h=0,f;return g;function g(x){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),p}function p(x){return x===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",v):s(x)}function v(x){if(h>999||x===93&&!f||x===null||x===91||yt(x))return s(x);if(x===93){e.exit("chunkString");const w=e.exit("gfmFootnoteDefinitionLabelString");return c=_i(r.sliceSerialize(w)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),S}return yt(x)||(f=!0),h++,e.consume(x),x===92?_:v}function _(x){return x===91||x===92||x===93?(e.consume(x),h++,v):v(x)}function S(x){return x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),a.includes(c)||a.push(c),at(e,y,"gfmFootnoteDefinitionWhitespace")):s(x)}function y(x){return t(x)}}function wA(e,t,s){return e.check(so,t,e.attempt(_A,t,s))}function CA(e){e.exit("gfmFootnoteDefinition")}function kA(e,t,s){const r=this;return at(e,a,"gfmFootnoteDefinitionIndent",5);function a(c){const h=r.events[r.events.length-1];return h&&h[1].type==="gfmFootnoteDefinitionIndent"&&h[2].sliceSerialize(h[1],!0).length===4?t(c):s(c)}}function NA(e){let s=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:c,resolveAll:a};return s==null&&(s=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function a(h,f){let g=-1;for(;++g<h.length;)if(h[g][0]==="enter"&&h[g][1].type==="strikethroughSequenceTemporary"&&h[g][1]._close){let p=g;for(;p--;)if(h[p][0]==="exit"&&h[p][1].type==="strikethroughSequenceTemporary"&&h[p][1]._open&&h[g][1].end.offset-h[g][1].start.offset===h[p][1].end.offset-h[p][1].start.offset){h[g][1].type="strikethroughSequence",h[p][1].type="strikethroughSequence";const v={type:"strikethrough",start:Object.assign({},h[p][1].start),end:Object.assign({},h[g][1].end)},_={type:"strikethroughText",start:Object.assign({},h[p][1].end),end:Object.assign({},h[g][1].start)},S=[["enter",v,f],["enter",h[p][1],f],["exit",h[p][1],f],["enter",_,f]],y=f.parser.constructs.insideSpan.null;y&&gi(S,S.length,0,ju(y,h.slice(p+1,g),f)),gi(S,S.length,0,[["exit",_,f],["enter",h[g][1],f],["exit",h[g][1],f],["exit",v,f]]),gi(h,p-1,g-p+3,S),g=p+S.length-2;break}}for(g=-1;++g<h.length;)h[g][1].type==="strikethroughSequenceTemporary"&&(h[g][1].type="data");return h}function c(h,f,g){const p=this.previous,v=this.events;let _=0;return S;function S(x){return p===126&&v[v.length-1][1].type!=="characterEscape"?g(x):(h.enter("strikethroughSequenceTemporary"),y(x))}function y(x){const w=qs(p);if(x===126)return _>1?g(x):(h.consume(x),_++,y);if(_<2&&!s)return g(x);const j=h.exit("strikethroughSequenceTemporary"),N=qs(x);return j._open=!N||N===2&&!!w,j._close=!w||w===2&&!!N,f(x)}}}class EA{constructor(){this.map=[],this.index=new Map}add(t,s,r){jA(this,t,s,r)}consume(t){if(this.map.sort(function(c,h){return c[0]-h[0]}),this.map.length===0)return;let s=this.map.length;const r=[];for(;s>0;)s-=1,r.push(t.slice(this.map[s][0]+this.map[s][1]),this.map[s][2]),t.length=this.map[s][0];r.push(t.slice()),t.length=0;let a=r.pop();for(;a;){for(const c of a)t.push(c);a=r.pop()}this.map.length=0,this.index.clear()}}function jA(e,t,s,r){if(s===0&&r.length===0)return;const a=e.index.get(t);if(a){a[1]+=s,a[2].push(...r);return}const c=[t,s,r];e.map.push(c),e.index.set(t,c)}function TA(e,t){let s=!1;const r=[];for(;t<e.length;){const a=e[t];if(s){if(a[0]==="enter")a[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const c=r.length-1;r[c]=r[c]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(s=!0);t+=1}return r}function DA(){return{flow:{null:{name:"table",tokenize:MA,resolveAll:AA}}}}function MA(e,t,s){const r=this;let a=0,c=0,h;return f;function f(P){let J=r.events.length-1;for(;J>-1;){const{type:q}=r.events[J][1];if(q==="lineEnding"||q==="linePrefix")J--;else break}const G=J>-1?r.events[J][1].type:null,L=G==="tableHead"||G==="tableRow"?z:g;return L===z&&r.parser.lazy[r.now().line]?s(P):L(P)}function g(P){return e.enter("tableHead"),e.enter("tableRow"),p(P)}function p(P){return P===124||(h=!0,c+=1),v(P)}function v(P){return P===null?s(P):Be(P)?c>1?(c=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),y):s(P):Ke(P)?at(e,v,"whitespace")(P):(c+=1,h&&(h=!1,a+=1),P===124?(e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),h=!0,v):(e.enter("data"),_(P)))}function _(P){return P===null||P===124||yt(P)?(e.exit("data"),v(P)):(e.consume(P),P===92?S:_)}function S(P){return P===92||P===124?(e.consume(P),_):_(P)}function y(P){return r.interrupt=!1,r.parser.lazy[r.now().line]?s(P):(e.enter("tableDelimiterRow"),h=!1,Ke(P)?at(e,x,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):x(P))}function x(P){return P===45||P===58?j(P):P===124?(h=!0,e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),w):U(P)}function w(P){return Ke(P)?at(e,j,"whitespace")(P):j(P)}function j(P){return P===58?(c+=1,h=!0,e.enter("tableDelimiterMarker"),e.consume(P),e.exit("tableDelimiterMarker"),N):P===45?(c+=1,N(P)):P===null||Be(P)?O(P):U(P)}function N(P){return P===45?(e.enter("tableDelimiterFiller"),M(P)):U(P)}function M(P){return P===45?(e.consume(P),M):P===58?(h=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(P),e.exit("tableDelimiterMarker"),T):(e.exit("tableDelimiterFiller"),T(P))}function T(P){return Ke(P)?at(e,O,"whitespace")(P):O(P)}function O(P){return P===124?x(P):P===null||Be(P)?!h||a!==c?U(P):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(P)):U(P)}function U(P){return s(P)}function z(P){return e.enter("tableRow"),A(P)}function A(P){return P===124?(e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),A):P===null||Be(P)?(e.exit("tableRow"),t(P)):Ke(P)?at(e,A,"whitespace")(P):(e.enter("data"),Y(P))}function Y(P){return P===null||P===124||yt(P)?(e.exit("data"),A(P)):(e.consume(P),P===92?ue:Y)}function ue(P){return P===92||P===124?(e.consume(P),Y):Y(P)}}function AA(e,t){let s=-1,r=!0,a=0,c=[0,0,0,0],h=[0,0,0,0],f=!1,g=0,p,v,_;const S=new EA;for(;++s<e.length;){const y=e[s],x=y[1];y[0]==="enter"?x.type==="tableHead"?(f=!1,g!==0&&(MS(S,t,g,p,v),v=void 0,g=0),p={type:"table",start:Object.assign({},x.start),end:Object.assign({},x.end)},S.add(s,0,[["enter",p,t]])):x.type==="tableRow"||x.type==="tableDelimiterRow"?(r=!0,_=void 0,c=[0,0,0,0],h=[0,s+1,0,0],f&&(f=!1,v={type:"tableBody",start:Object.assign({},x.start),end:Object.assign({},x.end)},S.add(s,0,[["enter",v,t]])),a=x.type==="tableDelimiterRow"?2:v?3:1):a&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")?(r=!1,h[2]===0&&(c[1]!==0&&(h[0]=h[1],_=$c(S,t,c,a,void 0,_),c=[0,0,0,0]),h[2]=s)):x.type==="tableCellDivider"&&(r?r=!1:(c[1]!==0&&(h[0]=h[1],_=$c(S,t,c,a,void 0,_)),c=h,h=[c[1],s,0,0])):x.type==="tableHead"?(f=!0,g=s):x.type==="tableRow"||x.type==="tableDelimiterRow"?(g=s,c[1]!==0?(h[0]=h[1],_=$c(S,t,c,a,s,_)):h[1]!==0&&(_=$c(S,t,h,a,s,_)),a=0):a&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")&&(h[3]=s)}for(g!==0&&MS(S,t,g,p,v),S.consume(t.events),s=-1;++s<t.events.length;){const y=t.events[s];y[0]==="enter"&&y[1].type==="table"&&(y[1]._align=TA(t.events,s))}return e}function $c(e,t,s,r,a,c){const h=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",f="tableContent";s[0]!==0&&(c.end=Object.assign({},Cl(t.events,s[0])),e.add(s[0],0,[["exit",c,t]]));const g=Cl(t.events,s[1]);if(c={type:h,start:Object.assign({},g),end:Object.assign({},g)},e.add(s[1],0,[["enter",c,t]]),s[2]!==0){const p=Cl(t.events,s[2]),v=Cl(t.events,s[3]),_={type:f,start:Object.assign({},p),end:Object.assign({},v)};if(e.add(s[2],0,[["enter",_,t]]),r!==2){const S=t.events[s[2]],y=t.events[s[3]];if(S[1].end=Object.assign({},y[1].end),S[1].type="chunkText",S[1].contentType="text",s[3]>s[2]+1){const x=s[2]+1,w=s[3]-s[2]-1;e.add(x,w,[])}}e.add(s[3]+1,0,[["exit",_,t]])}return a!==void 0&&(c.end=Object.assign({},Cl(t.events,a)),e.add(a,0,[["exit",c,t]]),c=void 0),c}function MS(e,t,s,r,a){const c=[],h=Cl(t.events,s);a&&(a.end=Object.assign({},h),c.push(["exit",a,t])),r.end=Object.assign({},h),c.push(["exit",r,t]),e.add(s+1,0,c)}function Cl(e,t){const s=e[t],r=s[0]==="enter"?"start":"end";return s[1][r]}const RA={name:"tasklistCheck",tokenize:BA};function OA(){return{text:{91:RA}}}function BA(e,t,s){const r=this;return a;function a(g){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?s(g):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(g),e.exit("taskListCheckMarker"),c)}function c(g){return yt(g)?(e.enter("taskListCheckValueUnchecked"),e.consume(g),e.exit("taskListCheckValueUnchecked"),h):g===88||g===120?(e.enter("taskListCheckValueChecked"),e.consume(g),e.exit("taskListCheckValueChecked"),h):s(g)}function h(g){return g===93?(e.enter("taskListCheckMarker"),e.consume(g),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):s(g)}function f(g){return Be(g)?t(g):Ke(g)?e.check({tokenize:LA},t,s)(g):s(g)}}function LA(e,t,s){return at(e,r,"whitespace");function r(a){return a===null?s(a):t(a)}}function zA(e){return gx([oA(),vA(),NA(e),DA(),OA()])}const HA={};function IA(e){const t=this,s=e||HA,r=t.data(),a=r.micromarkExtensions||(r.micromarkExtensions=[]),c=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),h=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);a.push(zA(s)),c.push(sA()),h.push(rA(s))}function Op(e){return e.trim()===""?null:u.jsx("div",{className:"md",children:u.jsx(v3,{remarkPlugins:[IA],components:{a:({href:t,children:s})=>{const r=typeof t=="string"&&/^(https?:|mailto:)/i.test(t)?t:void 0;return r===void 0?u.jsx("span",{children:s}):u.jsxs("a",{href:r,target:"_blank",rel:"noreferrer noopener",className:"md-link",children:[u.jsx("span",{className:"md-link-icon","aria-hidden":"true",children:"🌐"}),s]})},pre:({children:t})=>u.jsx("pre",{className:"md-pre",children:t}),table:({children:t})=>u.jsx("div",{className:"md-table-wrap",children:u.jsx("table",{children:t})}),input:({checked:t})=>u.jsx("input",{type:"checkbox",checked:t===!0,readOnly:!0,className:"md-task"})},children:e})})}function UA(e){return Object.entries(e??{}).map(([t,s])=>({key:t,value:s}))}function PA(e){const t={};for(const s of e){const r=s.key.trim();r!==""&&(t[r]=s.value.trim())}return t}function qA(e){const t=e.at(-1);return t===void 0?null:t.seq}function AS(e,t){return t===null?!1:e===null?!0:e.has(t)}function FA(e){const t=[];for(const s of e){if(s.role==="user"){t.push({kind:"user",turn:s});continue}const r=t.at(-1);if(r!==void 0&&r.kind==="assistant"){t[t.length-1]={kind:"assistant",parts:[...r.parts,s]};continue}t.push({kind:"assistant",parts:[s]})}return t}function $A(e,t){return t===void 0?!e:t.kind==="user"}function VA(e){return`已编辑 ${String(e)} 个文件`}function YA(e,t){const s=[];return e>0&&s.push(`+${String(e)}`),t>0&&s.push(`−${String(t)}`),s.join(" ")}function yl(e,t){return{add:e>0?`+${String(e)}`:"",del:t>0?`−${String(t)}`:""}}function KA(e){return e==="A"?"新增":e==="D"?"删除":"修改"}function WA(e){return e.binary===!0?"二进制":YA(e.added,e.removed)}function XA(e){return`撤销本轮对 ${String(e)} 个文件的改动,回到本轮开始前的快照。之后若这些文件又被改过,也会退回那个快照的内容;对话记录不受影响。`}function GA(e){return`另有 ${String(e)} 个写入被拒绝(权限 / Guardian),未计入上面的增删`}function QA(e){return`已撤销本轮 ${String(e)} 个文件的改动`}function ZA(e){const t=e.lastIndexOf("/");return t<0?{名:e,目录:""}:{名:e.slice(t+1),目录:e.slice(0,t+1)}}function JA({data:e,session:t,onViewChanges:s,onUndone:r}){const[a,c]=k.useState(!0),[h,f]=k.useState(!1),[g,p]=k.useState(!1),[v,_]=k.useState(!1),[S,y]=k.useState(null),x=e.files.length,w=async()=>{p(!0),y(null);try{await KN(t,e.key),_(!0),f(!1),r()}catch(j){y(j instanceof Error?j.message:String(j))}finally{p(!1)}};return u.jsxs("div",{className:v?"edit-card undone":a?"edit-card open":"edit-card",children:[u.jsxs("div",{className:"edit-head",children:[u.jsxs("button",{type:"button",className:"edit-toggle","aria-expanded":a,onClick:()=>{c(j=>!j)},children:[u.jsx("span",{className:"edit-icon","aria-hidden":"true",children:"▣"}),u.jsx("span",{className:"edit-title",children:v?QA(x):VA(x)}),v?null:u.jsxs("span",{className:"edit-stat",children:[u.jsx("span",{className:"add",children:yl(e.added,e.removed).add})," ",u.jsx("span",{className:"del",children:yl(e.added,e.removed).del})]})]}),u.jsxs("span",{className:"edit-actions",children:[!v&&e.undoable&&!h?u.jsx("button",{type:"button",className:"ghost",onClick:()=>{f(!0)},children:"撤销"}):null,s===void 0||v?null:u.jsx("button",{type:"button",className:"ghost",onClick:s,children:"查看变更 ↗"}),u.jsx("span",{className:"edit-caret","aria-hidden":"true",children:"▾"})]})]}),h&&!v?u.jsxs("div",{className:"undo-bar",children:[u.jsx("span",{className:"undo-warn","aria-hidden":"true",children:"⚠"}),u.jsx("span",{className:"grow",children:XA(x)}),u.jsx("button",{type:"button",className:"btn",onClick:()=>{f(!1)},children:"取消"}),u.jsx("button",{type:"button",className:"btn danger",disabled:g,onClick:()=>{w()},children:g?"撤销中…":"确认撤销"})]}):null,S===null?null:u.jsx("div",{className:"edit-error",children:S}),a?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"edit-files",children:e.files.map(j=>{const{名:N,目录:M}=ZA(j.path);return u.jsxs("div",{className:"edit-row",children:[u.jsx("span",{className:v?"edit-name done":"edit-name",children:v?`${KA(j.status)} · ${N}`:N}),u.jsx("span",{className:"edit-dir",children:M}),u.jsx("span",{className:"edit-fstat",children:v?"已回到快照":j.binary===!0?WA(j):u.jsxs(u.Fragment,{children:[yl(j.added,j.removed).add===""?null:u.jsx("span",{className:"add",children:yl(j.added,j.removed).add}),yl(j.added,j.removed).del===""?null:u.jsx("span",{className:"del",children:yl(j.added,j.removed).del})]})})]},j.path)})}),u.jsxs("div",{className:"edit-foot",children:[e.denied>0?u.jsxs("span",{children:[GA(e.denied),"。 "]}):null,v?"对话与工具行不动;工作区已回到本轮开始前的快照。":"点「查看变更」→ 右栏「改动」tab,看每个文件的真 diff。"]})]}):null]})}function eR(){const e=k.useRef(Date.now()),[t,s]=k.useState(()=>Date.now());k.useEffect(()=>{const a=setInterval(()=>{s(Date.now())},1e3);return()=>{clearInterval(a)}},[]);const r=Math.max(0,Math.round((t-e.current)/1e3));return u.jsxs("div",{className:"working","aria-live":"polite",children:[u.jsx("span",{className:"work-mark g","aria-hidden":"true",children:"✦"}),u.jsxs("span",{className:"work-dots","aria-hidden":"true",children:[u.jsx("i",{}),u.jsx("i",{}),u.jsx("i",{})]}),"思考中,用时 ",r," 秒…"]})}const tR=e=>/^(?:\[图片 #\d+\]\s*)+$/u.test(e.trim()),nR=e=>e<1e3?"不到 1 秒":e<6e4?`${String(Math.round(e/1e3))} 秒`:`${String(Math.floor(e/6e4))} 分 ${String(Math.round(e%6e4/1e3))} 秒`,iR=e=>{if(typeof e=="string")return e;if(typeof e=="object"&&e!==null){const t=e;if(typeof t.output=="string")return t.output;if(typeof t.error=="string")return t.error;if(typeof t.content=="string")return t.content;const s=JSON.stringify(e);return s===void 0?"":s}return e===void 0?"":String(e)},zf=e=>{const t=typeof e.input=="object"&&e.input!==null?e.input:{};for(const s of["command","path","pattern","url","query","file_path"]){const r=t[s];if(typeof r=="string"&&r!=="")return r}return e.toolName},sR=e=>({bash:"运行",run_command:"运行",shell:"运行",read:"读取",read_file:"读取",write:"写入",write_file:"写入",edit:"编辑",str_replace:"编辑",grep:"搜索",search:"搜索",glob:"查找",list:"列目录",ls:"列目录",task:"子任务",subagent:"子任务",todo:"计划",web_fetch:"抓取",web_search:"搜索"})[e]??e,rR=e=>["bash","run_command","shell"].includes(e);function lR({call:e}){const t=iR(e.output),s=e.state!=="running"&&rR(e.toolName)&&t.trim()!=="",[r,a]=k.useState(()=>e.state==="error");k.useEffect(()=>{e.state==="error"&&a(!0)},[e.state]);const c=u.jsxs(u.Fragment,{children:[u.jsx("span",{className:e.state==="running"?"ic g g-run":e.state==="error"?"ic g g-err":"ic g g-ok",children:e.state==="running"?"◌":e.state==="error"?"✕":"✓"}),u.jsx("span",{className:"name",children:sR(e.toolName)}),u.jsx("span",{className:"target",title:zf(e),children:zf(e)}),s?u.jsx("span",{className:"out-hint",children:r?"收起输出":"展开输出"}):null,u.jsx("span",{className:e.state==="running"?"state":"state ok",children:e.state==="running"?"进行中":e.state==="error"?"失败":"完成"})]});return u.jsxs(u.Fragment,{children:[s?u.jsx("button",{type:"button",className:"tool-row clickable","aria-expanded":r,onClick:()=>{a(h=>!h)},children:c}):u.jsx("div",{className:"tool-row",children:c}),s&&r?u.jsxs("div",{className:"terminal",children:[u.jsxs("div",{className:"bar",children:[u.jsx("span",{className:"dot"}),u.jsxs("span",{className:"t",children:["$ ",zf(e)]})]}),u.jsx("pre",{className:"out",children:t.length>1200?`${t.slice(0,1200)}
|
|
43
|
+
…(已截断)`:t})]}):null]})}function aR({text:e}){const[t,s]=k.useState(!1);return u.jsxs(u.Fragment,{children:[u.jsxs("button",{className:"disclosure","aria-expanded":t,onClick:()=>{s(r=>!r)},children:[u.jsx("span",{className:"g g-accent",children:"✻"}),u.jsx("span",{children:"思考"}),u.jsx("span",{className:"chev",children:"▾"})]}),u.jsx("div",{className:t?"disclosure-body open":"disclosure-body",children:u.jsx("p",{children:e})})]})}function oR({parts:e,model:t,durationMs:s,收尾:r,改动:a,session:c,onViewChanges:h,分叉:f,onFork:g,forkError:p}){const v=e[0],[_,S]=k.useState(null),y=async()=>{const x=e.map(w=>w.text).join("");S(await iE(x)?"ok":"err"),window.setTimeout(()=>{S(null)},2e3)};return u.jsx("div",{className:"turn","data-seq":v?.seq,"data-seq-list":e.map(x=>String(x.seq)).join(" "),children:u.jsxs("div",{className:"ai",children:[u.jsx("div",{className:"ai-avatar g",children:"●"}),u.jsxs("div",{className:"ai-body",children:[u.jsxs("div",{className:"ai-head",children:[u.jsx("span",{className:"ai-name",children:"大罗"}),t===void 0?null:u.jsx("span",{className:"ai-model",children:t}),v?.ts===void 0?null:u.jsx("span",{className:"ai-time",children:new Date(v.ts).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"})})]}),r&&s!==void 0?u.jsxs("div",{className:"turn-done",children:[u.jsx("span",{className:"g g-dim","aria-hidden":"true",children:"✓"}),"已完成,用时 ",nR(s)]}):null,e.map((x,w)=>{const j=x.reasoning.trim();return u.jsxs("div",{className:"assistant-part",children:[j===""?null:u.jsx(aR,{text:j}),x.text.trim()===""?null:Op(x.text),x.toolCalls.map(N=>u.jsx(lR,{call:N},N.toolCallId))]},`${String(x.seq)}-${String(w)}`)}),r===!0&&a!==void 0&&c!==void 0&&c!==""?u.jsx(JA,{data:a,session:c,onViewChanges:h,onUndone:()=>{}}):null,u.jsxs("div",{className:"ai-actions",children:[u.jsx("button",{className:"msg-tool icon-only",title:"复制回答(markdown 原文)","aria-label":"复制回答",onClick:()=>{y()},children:u.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[u.jsx("rect",{x:"9",y:"9",width:"12",height:"12",rx:"2.5"}),u.jsx("path",{d:"M5 15V5.5A2.5 2.5 0 0 1 7.5 3H17"})]})}),f==null||g===void 0?null:u.jsxs("button",{className:"msg-tool fork",title:"新会话保留到这条回答为止,源会话只读",onClick:()=>{g(f)},children:[u.jsx("span",{className:"g",children:"⑂"})," 从这条回答分叉"]}),_===null?null:u.jsx("span",{className:_==="ok"?"copy-hint ok":"copy-hint err",children:_==="ok"?"已复制":"复制失败"})]}),p==null?null:u.jsx("div",{className:"msg-error",children:p})]})]})})}function u1({view:e,loading:t,error:s,liveText:r,visible:a,onLoadEarlier:c,onRetry:h,onBack:f,questions:g,expired:p,onAnswer:v,busy:_,onViewChanges:S,onFork:y,onReanswer:x,focusSeq:w}){const j=e?.session,[N,M]=k.useState(null),T=k.useCallback(async()=>{if(j===void 0||j===""){M(null);return}try{const Q=await YN(j);M(Q.ok?Q:null)}catch{M(null)}},[j]);k.useEffect(()=>{_||T()},[T,_]);const[O,U]=k.useState(null),[z,A]=k.useState(null),[Y,ue]=k.useState(null),[P,J]=k.useState(null);k.useEffect(()=>{if(j===void 0||j===""){U(null);return}if(_)return;let Q=!0;return(async()=>{try{const K=await LN(j);if(!Q)return;U(new Set(K.anchors))}catch{Q&&U(null)}})(),()=>{Q=!1}},[j,_]);const G=async Q=>{if(!(y===void 0||z!==null)){ue(null),A(Q.at);try{await y(Q)}catch(K){ue({seq:Q.at,message:K instanceof Error?K.message:String(K)})}finally{A(null)}}};if(k.useEffect(()=>{if(w===void 0)return;const Q=String(w),K=[...document.querySelectorAll("[data-seq]")].find(D=>D.getAttribute("data-seq")===Q||(D.getAttribute("data-seq-list")??"").split(" ").includes(Q));if(!(K instanceof HTMLElement))return;K.scrollIntoView({block:"center"}),K.classList.add("msg-flash");const ge=window.setTimeout(()=>{K.classList.remove("msg-flash")},2200);return()=>{window.clearTimeout(ge)}},[w,e,a]),t&&e===null)return u.jsxs("div",{className:"thread-skeleton","aria-label":"载入会话",children:[u.jsx("div",{className:"sk sk-user"}),u.jsx("div",{className:"sk sk-head"}),u.jsx("div",{className:"sk sk-line"}),u.jsx("div",{className:"sk sk-line"}),u.jsx("div",{className:"sk sk-line short"}),u.jsx("div",{className:"sk sk-head"}),u.jsx("div",{className:"sk sk-line"})]});if(s!==null)return u.jsxs("div",{className:"thread-error-page",children:[u.jsx("div",{className:"warn",children:"⚠"}),u.jsx("h2",{children:"会话读取失败"}),u.jsx("p",{children:"事件日志读不出来(可能是文件被删/权限变化/服务重连中)。这一页不会假装是空会话。"}),u.jsx("p",{className:"detail",children:s}),u.jsxs("div",{className:"actions",children:[u.jsx("button",{className:"btn",onClick:f,children:"返回列表"}),u.jsx("button",{className:"btn primary",onClick:h,children:"重试"})]})]});if(e===null)return null;const L=e.turns.filter(Q=>Q.source!=="context"),q=Math.max(0,L.length-a),F=q===0?L:L.slice(q),V=e.todos.filter(Q=>Q.status==="completed").length;return L.length===0&&r===""?u.jsx("div",{className:"thread-empty",children:"这个会话还没有消息——在下面输入一句话开始。"}):u.jsxs(u.Fragment,{children:[e.goal===void 0?null:u.jsxs("div",{className:"goal-strip",children:[u.jsx("span",{className:"tag g",children:"◆ 目标"}),u.jsx("span",{className:"txt",children:e.goal.objective}),e.todos.length===0?null:u.jsxs("span",{className:"right",children:[u.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:u.jsx("path",{d:"M20 6 9 17l-5-5"})}),V," / ",e.todos.length," 步"]})]}),q>0?u.jsxs("div",{className:"load-earlier",children:[u.jsxs("button",{className:"btn",onClick:c,children:["载入更早的 ",q," 条"]}),u.jsxs("span",{className:"muted",children:["更早的记录已折叠(",q," 条)"]})]}):null,e.planMode?u.jsx("div",{className:"thread-note",children:"计划模式:只读分析中,不会改文件"}):null,e.todos.length===0?null:u.jsxs("div",{className:"plan",children:[u.jsxs("div",{className:"plan-head",children:[u.jsx("span",{className:"g",children:"◆"}),u.jsx("span",{children:"执行计划"}),u.jsxs("span",{className:"badge chip",children:[V," / ",e.todos.length]})]}),u.jsx("ul",{className:"plan-list",children:e.todos.map(Q=>u.jsxs("li",{className:Q.status==="completed"?"done":Q.status==="in_progress"?"doing":void 0,children:[u.jsx("span",{className:Q.status==="in_progress"?"tick g g-accent":"tick g",children:Q.status==="completed"?"✓":Q.status==="in_progress"?"◌":""}),Q.content]},Q.id))})]}),(()=>{const Q=Se=>{if(Se===void 0)return;const R=Date.parse(Se);return Number.isNaN(R)?void 0:R};let K=0,ge=0,D=0;const Ae=FA(F);return Ae.map((Se,R)=>{if(Se.kind==="user"){K=Q(Se.turn.ts)??K,ge=Se.turn.seq,D+=1;const xe=D,Fe=Se.turn.seq;return u.jsxs("div",{className:"turn user-turn","data-seq":Se.turn.seq,children:[(()=>{const Xe=y!==void 0&&AS(O,Fe),Ge=x!==void 0&&Se.turn.source!=="context"&&Se.turn.text.trim()!=="";return!Xe&&!Ge?null:u.jsxs("div",{className:"msg-tools",children:[Xe?u.jsxs("button",{className:"msg-tool fork",title:"新会话保留到这句为止,让它重新答;源会话只读",disabled:z!==null,onClick:()=>{G({at:Fe,quote:Se.turn.text,round:xe,ts:Se.turn.ts,kind:"user"})},children:[u.jsx("span",{className:"g",children:"⑂"})," 从这句分叉"]}):null,Ge?u.jsxs("button",{className:"msg-tool primary",title:"从这句问题之前分叉,自动重发同一句话(新会话重跑,源会话保留)",onClick:()=>{J(null),x({seq:Se.turn.seq,text:Se.turn.text,...Se.turn.ts===void 0?{}:{ts:Se.turn.ts},...Se.turn.images===void 0?{}:{images:Se.turn.images}}).catch(nt=>{J({seq:Fe,message:nt instanceof Error?nt.message:String(nt)})})},children:[u.jsx("span",{className:"g",children:"↻"})," 重答"]}):null]})})(),u.jsxs("div",{children:[Se.turn.images===void 0||Se.turn.images.length===0?null:u.jsx("div",{className:"user-images",children:Se.turn.images.map(Xe=>{const Ge=`/file/raw?path=${encodeURIComponent(Xe.path)}`;return u.jsx("a",{className:"user-image",href:Ge,target:"_blank",rel:"noreferrer",children:u.jsx("img",{src:Ge,alt:"",loading:"lazy"})},Xe.path)})}),tR(Se.turn.text)?null:u.jsx("div",{className:"user-bubble",children:$2(Se.turn.text).map((Xe,Ge)=>Xe.mention?u.jsx("span",{className:"mention",children:Xe.text},`m-${String(Ge)}`):u.jsx("span",{children:Xe.text},`t-${String(Ge)}`))}),u.jsx("div",{className:"user-meta",children:Se.turn.ts===void 0?null:u.jsx("span",{children:new Date(Se.turn.ts).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"})})}),Y!==null&&Y.seq===Fe?u.jsx("div",{className:"msg-error",children:Y.message}):null,P!==null&&P.seq===Fe?u.jsx("div",{className:"msg-error",children:P.message}):null]})]},`${String(Se.turn.seq)}-${String(R)}`)}const E=Se.parts.at(-1),ie=Q(E?.ts),ce=K>0&&ie!==void 0&&ie>K?ie-K:void 0,fe=Ae[R+1],ve=N?.turns.find(xe=>xe.key===ge),Z=$A(_,fe),le=qA(Se.parts),se=y!==void 0&&Z&&AS(O,le),me=[...Se.parts].reverse().find(xe=>xe.text.trim()!=="")?.text.trim()??"(这条回答没有正文)";return u.jsx(oR,{parts:Se.parts,model:e?.model,durationMs:ce,收尾:Z,改动:ve,session:e?.session,onViewChanges:S,分叉:se&&le!==null?{at:le,quote:me,round:D,ts:E?.ts,kind:"assistant"}:null,onFork:xe=>{G(xe)},forkError:Y!==null&&Y.seq===le?Y.message:null},`a-${String(E?.seq??R)}-${String(R)}`)})})(),_?u.jsx(eR,{}):null,r===""?null:u.jsx("div",{className:"turn",children:u.jsxs("div",{className:"ai",children:[u.jsx("div",{className:"ai-avatar g",children:"●"}),u.jsxs("div",{className:"ai-body",children:[u.jsxs("div",{className:"ai-head",children:[u.jsx("span",{className:"ai-name",children:"大罗"}),e.model===void 0?null:u.jsx("span",{className:"ai-model",children:e.model})]}),Op(r),u.jsx("span",{className:"live-cursor",children:"▌"})]})]})}),g.map(Q=>u.jsx(N2,{ask:Q,onAnswer:v},Q.id)),p.map(Q=>u.jsx(E2,{record:Q},`${Q.id}-${String(Q.atMs)}`))]})}function h1({title:e,running:t,onToggleTheme:s,panels:r,showShare:a=!1,onTrajectory:c}){return u.jsxs("header",{className:"topbar",children:[u.jsx("div",{className:"title",id:"conv-title",children:e}),t?u.jsxs("span",{className:"chip live",children:[u.jsx("span",{className:"pulse"}),"运行中"]}):u.jsx("span",{className:"chip",children:"就绪"}),r,u.jsx("span",{className:"chip",children:"deepseek-v4"}),u.jsx("div",{className:"grow"}),c===void 0?null:u.jsx("button",{className:"icon-btn g",title:"轨迹","aria-label":"打开轨迹",onClick:c,children:"▤"}),u.jsx("button",{className:"icon-btn g theme-toggle",title:"主题切换","aria-label":"切换明暗主题",onClick:s,children:"◐"}),a?u.jsx("button",{className:"icon-btn g",title:"分享","aria-label":"分享",children:"↗"}):null,u.jsx("button",{className:"icon-btn g",title:"更多","aria-label":"更多",children:"⋯"})]})}function cR(e,t){return Me(`/team/member?session=${encodeURIComponent(e)}&name=${encodeURIComponent(t)}`)}function RS(e,t,s){return Me("/team/message",st({session:e,to:t,content:s}))}function uR(e,t,s){return Me("/team/wake",st({session:e,to:t,prompt:s}))}function hR(e,t){return e==="failed"||e==="released"?"disabled":e==="running"||e==="provisioning"?"queue":t?"wake":"queue"}const dR=e=>e==="running"?"运行中":e==="idle"?"空闲":e==="failed"?"失败":e==="provisioning"?"启动中":"已释放";function fR({session:e,name:t,onClose:s}){const[r,a]=k.useState(null),[c,h]=k.useState(null),[f,g]=k.useState(""),[p,v]=k.useState(!1),[_,S]=k.useState(null),y=k.useRef(!0),x=k.useCallback(async(O=!1)=>{O||h(null);try{const U=await cR(e,t);y.current&&a(U)}catch(U){O||h(U instanceof Error?U.message:String(U))}},[e,t]);k.useEffect(()=>{y.current=!0,x();const O=window.setInterval(()=>{x(!0)},3e3);return()=>{y.current=!1,window.clearInterval(O)}},[x]);const w=O=>{S(O),window.setTimeout(()=>{S(null)},2600)},j=async()=>{const O=f.trim();if(!(O===""||r===null||p)&&!(r.member.status==="released"||r.member.status==="failed")){v(!0),h(null);try{if(M==="wake")try{await uR(e,t,O),g(""),w("已唤醒:未读已并入 prompt")}catch(U){if((U instanceof Error?U.message:String(U)).includes("父会话没在跑"))await RS(e,t,O),g(""),w("父会话空闲:已入队,等下次唤醒读取(未送达)");else throw U}else await RS(e,t,O),g(""),w("已入队:等它读取(未送达)");await x(!0)}catch(U){h(U instanceof Error?U.message:String(U))}finally{v(!1)}}},N=r?.member,M=N===void 0?"disabled":hR(N.status,r?.canWake===!0),T=M==="disabled"||p;return u.jsx("div",{className:"tm-mask",onMouseDown:s,children:u.jsxs("aside",{className:"tm-drawer",role:"dialog","aria-label":"子智能体会话",onMouseDown:O=>{O.stopPropagation()},children:[u.jsxs("div",{className:"tm-head",children:[u.jsx("div",{className:"tm-avatar",children:"◆"}),u.jsxs("div",{className:"tm-title",children:[u.jsxs("div",{className:"tm-name-line",children:[u.jsx("span",{className:"tm-kind",children:N?.kind==="seat"?"seat":"temp"}),u.jsx("span",{className:"tm-name",children:t}),N===void 0?null:u.jsx("span",{className:`tm-status ${N.status}`,children:dR(N.status)})]}),u.jsx("div",{className:"tm-sub",children:N?.description??""})]}),u.jsx("button",{className:"tm-close",type:"button",title:"关闭",onClick:s,children:"✕"})]}),c===null?null:u.jsxs("div",{className:"tm-banner err",children:[u.jsx("span",{children:"✕"}),u.jsx("span",{children:c})]}),r===null?u.jsx("div",{className:"tm-empty",children:"读取成员…"}):u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"tm-info",children:[u.jsxs("span",{children:["子会话:",u.jsx("b",{children:r.child.readable?"只读":"读不到"})]}),u.jsxs("span",{children:["未读:",u.jsx("b",{children:String(r.member.unread)})]}),u.jsxs("span",{children:["待投递:",u.jsx("b",{children:String(r.messages.filter(O=>!O.delivered).length)})]}),u.jsx("span",{className:"tm-info-id",children:r.member.id})]}),r.messages.length===0?null:u.jsxs("div",{className:"tm-pending",children:[u.jsx("div",{className:"tm-pending-head",children:"我发给它的消息"}),r.messages.map(O=>u.jsxs("div",{className:"tm-pmsg",children:[u.jsx("div",{className:"tm-pmsg-text",children:O.content}),u.jsxs("div",{className:"tm-pmsg-meta",children:[u.jsx("span",{children:O.id}),u.jsx("span",{className:O.delivered?"delivered":"queued",children:O.delivered?"已送达":"待投递"})]})]},O.id))]}),u.jsx("div",{className:"tm-thread",children:r.child.readable&&r.child.thread!==void 0?u.jsx(u1,{view:r.child.thread,loading:!1,error:null,liveText:"",visible:r.child.thread.total,onLoadEarlier:()=>{},onRetry:()=>{},onBack:s,questions:[],expired:[],onAnswer:async()=>{},busy:!1}):u.jsxs("div",{className:"tm-empty",children:[u.jsx("div",{className:"tm-empty-mark",children:"◌"}),u.jsxs("div",{children:["读不到 ",t," 的子会话"]}),u.jsxs("div",{className:"tm-empty-sub",children:["临时成员会话落在系统临时目录(",u.jsx("code",{children:"/tmp/daluo-peers/…"}),"),清理或释放后可能已不在。",r.member.status==="released"?" 成员已释放:不可发消息、不可唤醒。":""]})]})}),u.jsxs("div",{className:"tm-composer-wrap",children:[u.jsxs("div",{className:"tm-composer",children:[u.jsx("textarea",{className:"tm-input",rows:2,placeholder:r.member.status==="released"?"成员已释放,不能发消息":"给成员发消息(Enter 提交)",value:f,disabled:T,onChange:O=>{g(O.target.value)},onKeyDown:O=>{O.key==="Enter"&&!O.shiftKey&&(O.preventDefault(),j())}}),u.jsx("button",{className:"tm-send",type:"button",disabled:T||f.trim()==="",onClick:()=>{j()},children:p?"…":"发送"})]}),u.jsx("div",{className:"tm-note",children:M==="wake"?"成员空闲:发送将唤醒它(wake_member),并把未读一并送达。":r.member.status==="running"?"成员运行中:发送会入队,等它这一轮结束读取(不做 live 打断)。":"父会话空闲:发送只入队(等下次唤醒读取);唤醒需要父会话进程内的 TeamService。"})]})]}),_===null?null:u.jsxs("div",{className:"tm-toast",children:[u.jsx("span",{children:"✓"}),_]})]})})}const OS=12;function mR({title:e,session:t,thread:s,onToggleTheme:r,onSend:a,onStop:c,onBack:h,onTrajectory:f,onViewChanges:g,onFork:p,onReanswer:v,focusSeq:_}){const[S,y]=k.useState(""),[x,w]=k.useState(!1),j=k.useRef(null),N=ex(ke=>{j.current?.addFiles(ke)}),[M,T]=k.useState(!1),[O,U]=k.useState(0),z=x||M,[A,Y]=k.useState(OS);k.useEffect(()=>{const ke=s.view;_===void 0||ke===null||Y(Oe=>Math.max(Oe,ke.turns.length))},[_,s.view]);const[ue,P]=k.useState([]),[J,G]=k.useState(null),[L,q]=k.useState(null),[F,V]=k.useState(null),[Q,K]=k.useState(null),ge=k.useRef(null),D=ke=>{ge.current!==null&&window.clearTimeout(ge.current),K(ke),ge.current=window.setTimeout(()=>{K(null)},2600)};k.useEffect(()=>()=>{ge.current!==null&&window.clearTimeout(ge.current)},[]);const Ae=x2(t),[Se,R]=k.useState(null),E=k.useRef(null),ie=k.useRef(s.reload);ie.current=s.reload;const ce=k.useRef(0);k.useEffect(()=>{const ke=E.current;if(ke===null)return;const Oe=s.view?.turns.length??0;Oe<=ce.current&&s.liveText===""||(ce.current=Oe,ke.scrollTop=ke.scrollHeight)},[s.view,s.liveText]),k.useEffect(()=>{if(!z)return;const ke=setInterval(()=>{U(Oe=>Oe+1)},1e3);return()=>{clearInterval(ke)}},[z]),k.useEffect(()=>{if(t===null){T(!1);return}let ke=!0;const Oe=async()=>{try{const Ne=await Kb(t);if(!ke)return;T(Le=>(Le&&!Ne.running&&ie.current(),Ne.running)),Ne.running||w(!1)}catch{}};Oe();const oe=setInterval(()=>{Oe()},2e3);return()=>{ke=!1,clearInterval(oe)}},[t]);const fe=(ke,Oe)=>{const oe=ke.trim();if(oe==="")return;const Ne=up(oe);if(Ne!==null){if(y(""),t===null){D("先发一句话建会话,再设目标");return}if(Ne.kind==="usage"){D("用法:/goal <目标>");return}w(!0),A0(t,"set",Ne.objective).then(async()=>{await s.reload(),D("目标已设定")}).catch(Le=>{D(Le instanceof Error?Le.message:String(Le))}).finally(()=>{w(!1)});return}y(""),U(0),w(!0),a(oe,Oe).finally(()=>{w(!1)})},ve=ke=>{t!==null&&A0(t,ke).then(async()=>{await s.reload(),D(ke==="pause"?"目标已暂停":ke==="resume"?"目标已恢复":"已清除目标")}).catch(Oe=>{D(Oe instanceof Error?Oe.message:String(Oe))})},Z=()=>{if(t===null)return;const ke=s.view?.planMode!==!0;g2(t,ke).then(async()=>{await s.reload(),D(ke?"计划模式已开启(只读)":"计划模式已关闭")}).catch(Oe=>{D(Oe instanceof Error?Oe.message:String(Oe))})},le=async ke=>{q(null);try{await ke(),await s.reload()}catch(Oe){q(Oe instanceof Error?Oe.message:String(Oe))}},se=ke=>{if(t===null)return;const Oe=ke.trim();Oe!==""&&(y(""),le(async()=>{await v2(t,Oe)}))},me=()=>{if(t===null)return;const ke=s.view?.inbox.pending??[];ke.length!==0&&le(async()=>{for(const Oe of ke)Oe.placement!=="steering"&&await R0(t,Oe.id,"steering")})},xe=()=>{s.reload()},Fe=new Set(ue.map(ke=>ke.id)),Xe=(s.view?.asks.pending??[]).filter(ke=>!Fe.has(ke.id)),Ge=Xe.filter(ke=>ke.kind==="permission"),nt=Xe.filter(ke=>ke.kind==="question"),$e=Ge[0],Ot=ke=>{t!==null&&e2(t,ke).then(async()=>{G(null),await s.reload()}).catch(Oe=>{G(Oe instanceof Error?Oe.message:String(Oe))})},kt=async ke=>{if(t===null)return;const Oe=Xe.find(oe=>oe.id===ke.id);try{await XN(t,ke)}catch(oe){const Ne=oe instanceof Error?oe.message:String(oe);Oe!==void 0&&P(Le=>[...Le,{id:Oe.id,kind:Oe.kind,question:Oe.question,reason:Ne,atMs:Date.now()}])}finally{await s.reload()}};return u.jsxs("div",{className:"view",style:{display:"flex"},...N.handlers,children:[u.jsx(h1,{title:e,running:z,showShare:!0,onToggleTheme:r,onTrajectory:f,panels:u.jsx(O2,{team:Ae.team,agents:Ae.agents,jobs:Ae.jobs,open:Se,onOpen:ke=>{R(Oe=>Oe===ke?null:ke)}})}),Se===null||t===null?null:u.jsx(B2,{kind:Se,panel:Ae,session:t,onClose:()=>{R(null)},onOpenMember:ke=>{V(ke),R(null)}}),u.jsxs("div",{className:"thread",ref:E,children:[s.stream==="closed"&&s.view!==null?u.jsxs("div",{className:"conn-banner",children:[u.jsx("span",{className:"warn",children:"⚠"}),u.jsx("span",{children:"与事件流的连接断开,自动重连中…"}),u.jsx("button",{className:"btn",onClick:xe,children:"立即重连"})]}):null,u.jsx("div",{className:"thread-inner",children:u.jsx(u1,{view:s.view,loading:s.loading,error:s.error,liveText:s.liveText,visible:A,onLoadEarlier:()=>{Y(ke=>ke+OS)},onRetry:()=>{s.reload()},onBack:h,questions:nt,expired:ue,onAnswer:kt,busy:z,onViewChanges:g,onFork:p,onReanswer:v,focusSeq:_})})]}),u.jsxs("div",{className:"composer-wrap",children:[Q===null?null:u.jsx("div",{className:"goal-toast",children:Q}),s.view?.goal===void 0?null:u.jsx(tE,{goal:s.view.goal,busy:z,onPause:()=>{ve("pause")},onResume:()=>{ve("resume")},onClear:()=>{ve("clear")}}),$e===void 0?null:u.jsx(k2,{ask:$e,count:Ge.length,onAnswer:kt}),t===null?null:u.jsx(nE,{pending:s.view?.inbox.pending??[],onEdit:async(ke,Oe)=>{await le(async()=>{await y2(t,ke,Oe)})},onRemove:async ke=>{await le(async()=>{await S2(t,ke)})},onSteer:async ke=>{await le(async()=>{await R0(t,ke,"steering")})}}),L===null?null:u.jsx("div",{className:"q-error standalone",children:L}),z?u.jsxs("div",{className:"composer-status",children:[u.jsx("span",{className:"g g-run",children:"◌"})," 运行中 · ",O,"s",u.jsxs("span",{style:{marginLeft:"auto"},children:[Ge.length>1?`还有 ${String(Ge.length)} 个等待确认`:"",(s.view?.inbox.pending.length??0)===0?null:` · 排队 ${String(s.view?.inbox.pending.length)} 条`]})]}):null,u.jsx(Jb,{ref:j,value:S,onChange:y,contextLabel:"ctx —",session:t??void 0,profile:s.view?.profile,onProfile:Ot,busy:z,onSend:fe,onQueue:se,onInterjectAll:me,planMode:s.view?.planMode===!0,planDisabled:z,onTogglePlan:Z,onStop:()=>{w(!1),c()}})]}),N.dragging?u.jsx(tx,{}):null,F===null||t===null?null:u.jsx(fR,{session:t,name:F,onClose:()=>{V(null)}})]})}const d1=280,f1=640,Fs=420;function Bp(e){if(e==null||e==="")return Fs;const t=typeof e=="number"?e:Number(e);return Number.isFinite(t)?Math.min(f1,Math.max(d1,Math.round(t))):Fs}const m1="daluo.dock.width",p1="daluo.dock.tab",At=()=>{try{return typeof localStorage>"u"?null:localStorage}catch{return null}};function pR(e=At()){if(e===null)return Fs;try{return Bp(e.getItem(m1))}catch{return Fs}}function Hf(e=At(),t){const s=t===void 0?Fs:Bp(t);if(e===null)return s;try{e.setItem(m1,String(s))}catch{}return s}function BS(e=At()){if(e===null)return"files";try{const t=e.getItem(p1);return t==="term"||t==="diff"?t:"files"}catch{return"files"}}function LS(e=At(),t){if(e!==null)try{e.setItem(p1,t)}catch{}return t}const gR=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif","heic"]),_R=new Set(["ts","tsx","js","jsx","mjs","cjs","json","jsonc","css","scss","less","html","htm","vue","svelte","py","rb","go","rs","java","kt","c","h","cc","cpp","hpp","cs","swift","php","lua","sh","bash","zsh","fish","ps1","sql","yaml","yml","toml","ini","xml","gradle","dockerfile","makefile","cmake","proto"]),vR=new Set(["txt","log","csv","tsv","env","lock","gitignore","editorconfig","patch","diff","license"]),yR=new Set(["wasm","zip","gz","tgz","tar","bz2","xz","7z","rar","jar","exe","dll","so","dylib","o","a","class","pyc","woff","woff2","ttf","otf","eot","mp3","mp4","mov","avi","webm","wav","flac","docx","xlsx","pptx","doc","xls","ppt"]);function g1(e){const t=e.slice(e.lastIndexOf("/")+1),s=t.lastIndexOf("."),r=(s>0?t.slice(s+1):t).toLowerCase();return gR.has(r)?"image":r==="pdf"?"pdf":r==="md"||r==="markdown"||r==="mdx"?"markdown":_R.has(r)?"code":vR.has(r)||t==="LICENSE"||t==="Makefile"||t==="Dockerfile"?"text":yR.has(r)?"binary":"text"}function SR(e){return e==="code"||e==="markdown"||e==="text"}const bR={docx:"DOCX",doc:"DOC",xlsx:"XLSX",xls:"XLS",pptx:"PPTX",ppt:"PPT"};function xR(e){const t=e.slice(e.lastIndexOf("/")+1),s=t.lastIndexOf(".");return s<=0?null:bR[t.slice(s+1).toLowerCase()]??null}function Lp(e){const t=e.lastIndexOf("/");return t<0?{dir:"",name:e}:{dir:e.slice(0,t),name:e.slice(t+1)}}function wR(e){return!Number.isFinite(e)||e<0?"—":e<1024?`${String(Math.round(e))} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function CR(e){if(e==="")return{行:[],增:0,删:0};const t=[];let s=0,r=0,a=0,c=0;for(const h of e.split(`
|
|
44
|
+
`)){if(h.startsWith("diff --git")||h.startsWith("index ")||h.startsWith("--- ")||h.startsWith("+++ ")||h.startsWith("\\")){t.push({kind:"meta",oldLine:null,newLine:null,text:h});continue}if(h.startsWith("@@")){const f=/-(\d+)(?:,\d+)? \+(\d+)(?:,\d+)?/.exec(h);f!==null&&(s=Number(f[1]),r=Number(f[2]));const g=h.slice(h.indexOf("@@",2)+2).trim();t.push({kind:"hunk",oldLine:null,newLine:null,text:`@@ ${g}`});continue}if(h.startsWith("+")){t.push({kind:"add",oldLine:null,newLine:r,text:h.slice(1)}),r+=1,a+=1;continue}if(h.startsWith("-")){t.push({kind:"del",oldLine:s,newLine:null,text:h.slice(1)}),s+=1,c+=1;continue}if(h.startsWith(" ")){t.push({kind:"ctx",oldLine:s,newLine:r,text:h.slice(1)}),s+=1,r+=1;continue}t.push({kind:"meta",oldLine:null,newLine:null,text:h})}return{行:t,增:a,删:c}}const kR=new Set(["import","from","export","const","let","var","type","interface","function","return","if","else","new","async","await","readonly","true","false","undefined","null","for","of","in","as","void","class","extends","implements","default","this","typeof","switch","case","break","continue","try","catch","throw","def","elif","fn","pub","struct","impl","match","package","func","defer","select","range","and","or","not","is","with","lambda","yield","pass","raise","except","finally","while","do","end"]),zS=e=>/[A-Za-z0-9_$]/.test(e);function NR(e){const t=[];let s="";const r=()=>{s!==""&&(t.push({cls:"",text:s}),s="")};let a=0;for(;a<e.length;){const h=e[a]??"";if(h==="/"&&e[a+1]==="/")return r(),t.push({cls:"c",text:e.slice(a)}),t;if(h==='"'||h==="'"||h==="`"){r();let f=a+1;for(;f<e.length;){const g=e[f]??"";if(g==="\\"&&f+1<e.length){f+=2;continue}if(g===h){f+=1;break}f+=1}t.push({cls:"s",text:e.slice(a,f)}),a=f;continue}if(zS(h)&&!/^\d$/.test(h)){let f=a;for(;f<e.length&&zS(e[f]??"");)f+=1;const g=e.slice(a,f);r(),t.push({cls:kR.has(g)?"k":"",text:g}),a=f;continue}if(/^\d$/.test(h)){let f=a;for(;f<e.length&&/[\d.]/.test(e[f]??"");)f+=1;r(),t.push({cls:"n",text:e.slice(a,f)}),a=f;continue}s+=h,a+=1}r();const c=[];for(const h of t){const f=c[c.length-1];f!==void 0&&f.cls===h.cls?c[c.length-1]={cls:f.cls,text:f.text+h.text}:c.push(h)}return c.length===0?[{cls:"",text:""}]:c}function _1(e){const t=e.worktree.trim()!==""&&e.worktree!=="?"?e.worktree:e.index;return t==="?"?"?":t==="A"?"A":t==="D"?"D":t==="R"||t==="C"?"R":t!==""&&t!==" "?"M":"?"}function ER(e,t){return e===""?t:`${e.endsWith("/")?e.slice(0,-1):e}/${t}`}function HS(e,t){const s=[{id:"copy-rel",label:"复制相对路径",hint:t},{id:"copy-abs",label:"复制绝对路径",hint:ER(e,t)}];return e!==""&&s.push({id:"reveal",label:"在 Finder 中显示",hint:Lp(t).name}),s}function IS(e){return e.kind==="running"?"运行中":e.exitCode!==null?`已退出 ${String(e.exitCode)}`:`已退出 ${e.signal??"未知"}`}const xm=360,wm=280,jR=620,TR=468,v1="daluo.dock.float",y1="daluo.dock.float.rect",S1="daluo.dock.split.ratio",b1="daluo.dock.side",x1="daluo.term.split",Oi=8,lo=()=>typeof window>"u"?{width:1440,height:900}:{width:window.innerWidth,height:window.innerHeight};function Za(e=lo()){const t=Math.max(xm,Math.min(jR,e.width-Oi*2)),s=Math.max(wm,Math.min(TR,e.height-Oi*2));return{x:Math.round((e.width-t)/2),y:56,width:t,height:s}}function w1(e,t=lo()){const s=Za(t),r=typeof e=="object"&&e!==null?e:{},a=(_,S)=>{const y=typeof _=="number"?_:Number(_);return Number.isFinite(y)?Math.round(y):S},c=Math.max(xm,t.width-Oi*2),h=Math.max(wm,t.height-Oi*2),f=Math.min(c,Math.max(xm,a(r.width,s.width))),g=Math.min(h,Math.max(wm,a(r.height,s.height))),p=Math.min(Math.max(Oi,t.width-f-Oi),Math.max(Oi,a(r.x,s.x))),v=Math.min(Math.max(Oi,t.height-g-Oi),Math.max(Oi,a(r.y,s.y)));return{x:p,y:v,width:f,height:g}}function DR(e,t=lo()){if(e===null||e.trim()==="")return Za(t);try{return w1(JSON.parse(e),t)}catch{return Za(t)}}function MR(e=At(),t=lo()){if(e===null)return Za(t);try{return DR(e.getItem(y1),t)}catch{return Za(t)}}function gr(e=At(),t,s=lo()){const r=w1(t,s);if(e!==null)try{e.setItem(y1,JSON.stringify(r))}catch{}return r}function AR(e=At()){if(e===null)return!1;try{return e.getItem(v1)==="1"}catch{return!1}}function Vc(e=At(),t){if(e!==null)try{e.setItem(v1,t?"1":"0")}catch{}return t}function Ru(e){if(e==null||e==="")return .5;const t=typeof e=="number"?e:Number(e);return Number.isFinite(t)?Math.round(Math.min(.75,Math.max(.25,t))*100)/100:.5}function RR(e=At()){if(e===null)return .5;try{return Ru(e.getItem(S1))}catch{return .5}}function Yc(e=At(),t){const s=t===void 0?.5:Ru(t);if(e!==null)try{e.setItem(S1,String(s))}catch{}return s}function su(e){return e==="term"?"files":"term"}function OR(e=At(),t="files"){if(e===null)return su(t);try{const s=e.getItem(b1);return(s==="files"||s==="term"||s==="diff")&&s!==t?s:su(t)}catch{return su(t)}}function If(e=At(),t){if(e!==null)try{e.setItem(b1,t)}catch{}return t}function zp(e){return Ru(e)}const C1="daluo.term.split.ratio";function BR(e=At()){if(e===null)return .5;try{return zp(e.getItem(C1))}catch{return .5}}function Uf(e=At(),t){const s=t===void 0?.5:zp(t);if(e!==null)try{e.setItem(C1,String(s))}catch{}return s}function LR(e=At()){if(e===null)return!1;try{return e.getItem(x1)==="1"}catch{return!1}}function Pf(e=At(),t){if(e!==null)try{e.setItem(x1,t?"1":"0")}catch{}return t}const k1="daluo.dock.layout";function zR(e=At()){if(e===null)return"单栏";try{const t=e.getItem(k1);return t==="双栏"||t==="三栏"?t:"单栏"}catch{return"单栏"}}function HR(e=At(),t){if(e!==null)try{e.setItem(k1,t)}catch{}return t}function IR(e,t,s="files"){const r=Number.isFinite(t)?t:0;return e==="三栏"?s==="files"&&r>=560?"三栏":r>=460?"双栏":"单栏":e==="双栏"&&r>=460?"双栏":"单栏"}const UR=140,PR=240,Ja=176,N1="daluo.files.tree";function Hp(e){if(e==null||e==="")return Ja;const t=typeof e=="number"?e:Number(e);return Number.isFinite(t)?Math.min(PR,Math.max(UR,Math.round(t))):Ja}function qR(e=At()){if(e===null)return Ja;try{return Hp(e.getItem(N1))}catch{return Ja}}function US(e=At(),t){const s=t===void 0?Ja:Hp(t);if(e!==null)try{e.setItem(N1,String(s))}catch{}return s}const E1="daluo.dock.float.pinned";function FR(e=At()){if(e===null)return!1;try{return e.getItem(E1)==="1"}catch{return!1}}function PS(e=At(),t){if(e!==null)try{e.setItem(E1,t?"1":"0")}catch{}return t}function $R({facts:e,factsError:t,refreshKey:s,onRefresh:r}){const[a,c]=k.useState(null),[h,f]=k.useState(""),[g,p]=k.useState(null),[v,_]=k.useState(""),[S,y]=k.useState(!1),[x,w]=k.useState(!1),[j,N]=k.useState(!1);k.useEffect(()=>{g!==null&&M(g)},[s]);const M=k.useCallback(async A=>{p(A),_(""),w(!0);try{const Y=await UN(A);_(Y.diff),y(Y.truncated),c(null)}catch(Y){c(Y instanceof Error?Y.message:String(Y))}finally{w(!1)}},[]);if(k.useEffect(()=>{e===null||e.changed.length===0||g===null&&M(e.changed[0]?.path??"")},[e,g,M]),t!==null&&e===null)return u.jsxs("div",{className:"dock-empty",children:["读取 git 状态失败:",t]});if(e===null)return u.jsx("div",{className:"dock-empty",children:"读取 git 状态…"});if(!e.isRepo)return u.jsx("div",{className:"dock-empty",children:"这个工作区不是 git 仓库(或读不到 git)。"});if(e.changed.length===0)return u.jsxs("div",{className:"dock-empty",children:[u.jsx("span",{className:"big",children:"◇"}),"本轮还没有改动",u.jsx("br",{}),"编辑文件或跑工具后会出现在这里"]});const T=e.changed.filter(A=>h.trim()===""||A.path.toLowerCase().includes(h.trim().toLowerCase())),O=g===null?null:CR(v),U=O?.增??0,z=O?.删??0;return u.jsxs("div",{className:j?"changes expanded":"changes",children:[u.jsxs("div",{className:"changes-head",children:[u.jsx("span",{className:"branch",title:e.root,children:e.branch??"HEAD"}),u.jsxs("span",{className:"sum",children:[e.changed.length," 个改动"]}),O===null?null:u.jsxs("span",{className:"stat",title:"当前选中文件的增删",children:[u.jsxs("span",{className:"plus",children:["+",U]}),u.jsxs("span",{className:"minus",children:["−",z]})]}),u.jsx("span",{className:"grow"}),u.jsx("button",{className:"link-btn",onClick:r,children:"刷新"})]}),u.jsxs("div",{className:"dock-search",children:[u.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[u.jsx("circle",{cx:"11",cy:"11",r:"7"}),u.jsx("path",{d:"m20 20-3.5-3.5"})]}),u.jsx("input",{value:h,placeholder:"筛选改动文件…","aria-label":"筛选改动文件",onChange:A=>{f(A.target.value)},onKeyDown:A=>{A.key==="Escape"&&f("")}}),h===""?null:u.jsx("button",{className:"clear",title:"清空 (Esc)",onClick:()=>{f("")},children:"✕"})]}),j?null:u.jsxs("div",{className:"changes-list",children:[T.map(A=>{const Y=_1(A);return u.jsxs("div",{className:g===A.path?"change sel":"change",title:A.path,onClick:()=>{M(A.path)},children:[u.jsx("span",{className:`st ${Y}`,children:Y}),u.jsx("span",{className:"p",children:A.path})]},A.path)}),T.length===0?u.jsx("div",{className:"tree-hint",children:"没有匹配的改动"}):null]}),g===null?null:u.jsxs("div",{className:j?"diff expanded":"diff",children:[u.jsxs("div",{className:"diff-head",children:[u.jsx("span",{className:"path",title:g,children:g}),O===null?null:u.jsxs("span",{className:"stat",children:[u.jsxs("span",{className:"plus",children:["+",O.增]}),u.jsxs("span",{className:"minus",children:["−",O.删]})]}),u.jsx("button",{className:"link-btn",onClick:()=>{N(A=>!A)},children:j?"收起":"展开"})]}),S?u.jsx("div",{className:"hunk",children:"(diff 太大,已截断)"}):null,x?u.jsx("div",{className:"hunk",children:"读取 diff…"}):null,!x&&v===""?u.jsx("div",{className:"hunk",children:"(无 diff 内容)"}):null,O?.行.map((A,Y)=>u.jsxs("div",{className:`dl ${A.kind==="add"?"a":A.kind==="del"?"d":A.kind==="hunk"?"h":A.kind==="meta"?"m":"x"}`,children:[u.jsx("span",{className:"dn",children:A.oldLine??""}),u.jsx("span",{className:"dn",children:A.newLine??""}),u.jsx("span",{className:"dc",children:A.text})]},Y))]})]})}function VR({root:e,path:t,x:s,y:r,onClose:a,onFeedback:c}){k.useEffect(()=>{const g=()=>{a()},p=v=>{v.key==="Escape"&&a()};return window.addEventListener("pointerdown",g),window.addEventListener("blur",g),window.addEventListener("keydown",p),()=>{window.removeEventListener("pointerdown",g),window.removeEventListener("blur",g),window.removeEventListener("keydown",p)}},[a]);const h=async g=>{if(g==="copy-rel"||g==="copy-abs"){try{await navigator.clipboard.writeText(g==="copy-rel"?t:HS(e,t)[1]?.hint??t),c(`已复制${g==="copy-rel"?"相对":"绝对"}路径`)}catch{c("剪贴板不可用(浏览器拒了)")}a();return}try{await Vb({target:"finder",path:t,reveal:!0}),c(`已在 Finder 中选中 ${Lp(t).name}`)}catch(p){c(`Finder 打不开:${p instanceof Error?p.message:String(p)}`)}a()},f=HS(e,t);return u.jsxs("div",{className:"ctx-menu",style:{left:Math.min(s,window.innerWidth-230),top:Math.min(r,window.innerHeight-140)},onPointerDown:g=>{g.stopPropagation()},children:[u.jsx("div",{className:"ctx-head",title:t,children:t}),f.map(g=>u.jsxs("button",{className:"ctx-item",onClick:()=>{h(g.id)},children:[u.jsx("span",{className:"ctx-label",children:g.label}),u.jsx("span",{className:"ctx-hint",title:g.hint,children:g.hint})]},g.id))]})}const qf=(e,t)=>e===""?t:`${e}/${t}`,YR=e=>e.startsWith(".")||j1.has(e),j1=new Set(["node_modules",".git","dist","build","target","venv",".venv","__pycache__",".next",".cache",".turbo"]);function KR({path:e}){const t=g1(e);return t==="image"?u.jsxs("svg",{className:"ico",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",children:[u.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),u.jsx("circle",{cx:"9",cy:"10",r:"1.6"}),u.jsx("path",{d:"m4 18 5-4 4 3 3-2 4 3"})]}):t==="markdown"?u.jsxs("svg",{className:"ico",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",children:[u.jsx("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),u.jsx("path",{d:"M7 15V9l2.5 3L12 9v6M16 9v6M14.5 13.5 16 15l1.5-1.5"})]}):u.jsxs("svg",{className:"ico",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",children:[u.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),u.jsx("path",{d:"M14 2v6h6"})]})}function WR({selected:e,onSelect:t,changed:s,q:r,refreshKey:a,onMenu:c}){const[h,f]=k.useState({}),[g,p]=k.useState(new Set([""])),[v,_]=k.useState(null),[S,y]=k.useState({state:"idle",dirs:0}),x=k.useRef({});x.current=h;const w=k.useCallback(async O=>{try{const U=await E0(O);f(z=>({...z,[O]:U})),_(null)}catch(U){_(U instanceof Error?U.message:String(U))}},[]);k.useEffect(()=>{h[""]===void 0&&w("")},[h,w]),k.useEffect(()=>{a!==0&&(f({}),p(new Set([""])),w(""))},[a,w]),k.useEffect(()=>{if(r===""){y({state:"idle",dirs:0});return}let O=!1;const U=async()=>{y({state:"walking",dirs:0});const A=new Set,Y=[""];let ue=0;for(;Y.length>0&&ue<300&&!O;){const P=Y.shift();if(A.has(P))continue;A.add(P),ue+=1;let J=x.current[P];if(J===void 0){try{J=await E0(P)}catch{continue}if(O)return;f(G=>({...G,[P]:J}))}for(const G of J.entries)G.type==="directory"&&!G.name.startsWith(".")&&!j1.has(G.name)&&Y.push(qf(P,G.name))}O||y({state:Y.length>0?"capped":"done",dirs:ue})},z=setTimeout(()=>{U()},180);return()=>{O=!0,clearTimeout(z)}},[r]);const j=O=>{p(U=>{const z=new Set(U);return z.has(O)?z.delete(O):z.add(O),z}),h[O]===void 0&&w(O)},N=O=>r===""||O.toLowerCase().includes(r),M=O=>{if(r==="")return!0;const U=h[O];return U===void 0?!1:U.entries.some(z=>{const A=qf(O,z.name);return z.type==="directory"?M(A):N(A)})},T=(O,U)=>{const z=h[O];if(z===void 0)return g.has(O)?u.jsx("div",{className:"tree-hint",style:{paddingLeft:`${String(8+U*16)}px`},children:"读取中…"},`loading-${O}`):null;const A=[];for(const Y of z.entries){const ue=qf(O,Y.name),P=8+U*16;if(Y.type==="directory"){if(YR(Y.name)||!M(ue))continue;const J=g.has(ue)||r!=="";A.push(u.jsxs("div",{className:"tree-item dir",style:{paddingLeft:`${String(P)}px`},onClick:()=>{j(ue)},title:ue,children:[u.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:J?"none":"rotate(-90deg)",flex:"0 0 auto"},children:u.jsx("path",{d:"m6 9 6 6 6-6"})}),u.jsx("svg",{className:"ico",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",children:u.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h5l2 2h7a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"})}),u.jsx("span",{className:"nm",children:Y.name})]},ue)),J&&A.push(T(ue,U+1))}else if(Y.type==="file"&&N(ue)){const J=s.get(ue);A.push(u.jsxs("div",{className:e===ue?"tree-item sel":"tree-item",style:{paddingLeft:`${String(P)}px`},onClick:()=>{t(ue)},onContextMenu:G=>{G.preventDefault(),c?.(ue,G.clientX,G.clientY)},title:ue,children:[u.jsx(KR,{path:ue}),u.jsx("span",{className:"nm",children:Y.name}),J===void 0?null:u.jsx("span",{className:`tag ${J}`,children:J})]},ue))}}return u.jsx("div",{children:A},`dir-${O}`)};return u.jsxs(u.Fragment,{children:[v===null?null:u.jsxs("div",{className:"dock-empty",children:["目录读不到:",v]}),r!==""?u.jsx("div",{className:"tree-hint",children:S.state==="walking"?"搜索中…":S.state==="capped"?"已搜 300 个目录(到上限,可先展开目录再筛)":`已搜 ${String(S.dirs)} 个目录`}):null,u.jsx("div",{className:"tree",children:T("",0)})]})}const XR=400,GR=2500;function QR({path:e,narrow:t,onBack:s,onNotice:r,onMenu:a}){const[c,h]=k.useState(null),[f,g]=k.useState(""),[p,v]=k.useState(0),[_,S]=k.useState(0),[y,x]=k.useState(!0),[w,j]=k.useState(null),[N,M]=k.useState(null),[T,O]=k.useState(null),[U,z]=k.useState(null),[A,Y]=k.useState(!1),[ue,P]=k.useState(!1),[J,G]=k.useState(!1),[L,q]=k.useState(null),F=k.useRef(null),V=k.useRef(null),Q=g1(e),K=SR(Q),ge=k.useCallback(async(fe,ve)=>{Y(!0);try{const Z=await zN(e,{offset:fe,limit:XR});h(Z),g(le=>ve?`${le}${le===""?"":`
|
|
45
|
+
`}${Z.text}`:Z.text),v(Z.offset),S(Z.lines),x(Z.eof),j(Z.bytes??null),Z.version!==void 0&&M(Z.version),z(null),O(null),r?.(null)}catch(Z){const le=Z instanceof Error?Z.message:String(Z);z(le),r?.(`读不到 ${e}:${le}`)}finally{Y(!1)}},[e,r]);k.useEffect(()=>{h(null),g(""),v(0),x(!0),M(null),O(null),K&&ge(1,!1)},[e,K,ge]),k.useEffect(()=>{if(!K||N===null)return;let fe=!1;const ve=setInterval(()=>{HN(e).then(Z=>{fe||O(Z.version)},()=>{})},GR);return()=>{fe=!0,clearInterval(ve)}},[e,K,N]),k.useEffect(()=>()=>{F.current!==null&&clearTimeout(F.current),V.current!==null&&clearTimeout(V.current)},[]);const D=async()=>{try{await navigator.clipboard.writeText(e),G(!0),F.current!==null&&clearTimeout(F.current),F.current=setTimeout(()=>{G(!1)},1600)}catch{r?.("剪贴板不可用(浏览器拒了)")}},Ae=fe=>{q(fe),V.current!==null&&clearTimeout(V.current),V.current=setTimeout(()=>{q(null)},2200)},{dir:Se,name:R}=Lp(e),E=_===0?0:p+_-1,ie=T!==null&&N!==null&&T!==N,ce=u.jsxs("div",{className:"pv-head",onContextMenu:fe=>{fe.preventDefault(),a?.(e,fe.clientX,fe.clientY)},children:[t?u.jsx("button",{className:"ib",title:"返回文件树","aria-label":"返回文件树",onClick:s,children:"←"}):null,u.jsxs("span",{className:"pv-path",title:e,children:[Se===""?null:u.jsxs("span",{className:"dim",children:[Se,"/"]}),u.jsx("b",{children:R})]}),u.jsxs("span",{className:"pv-actions",children:[K?u.jsx("button",{className:ue?"ib on":"ib",title:ue?"不换行":"自动换行",onClick:()=>{P(fe=>!fe)},children:"↵"}):null,u.jsx("button",{className:J?"ib on":"ib",title:J?"已复制":"复制路径",onClick:()=>{D()},children:"⧉"}),K?u.jsx("button",{className:"ib",title:"从磁盘重载",onClick:()=>{ge(1,!1)},children:"↻"}):null,u.jsx("button",{className:"ib",title:"关闭预览","aria-label":"关闭预览",onClick:s,children:"✕"})]})]});if(!K){const fe=Q==="image",ve=Q==="pdf",Z=xR(e),le=R.includes(".")?R.slice(R.lastIndexOf(".")+1).toUpperCase():"BIN",se=async xe=>{try{await Vb(xe?{target:"finder",path:e,reveal:!0}:{target:"finder",path:e}),Ae(xe?"已在 Finder 中显示":"已交给系统默认应用打开")}catch(Fe){const Xe=Fe instanceof Error?Fe.message:String(Fe);r?.(`打开失败:${Xe}`),Ae(`打开失败:${Xe}`)}},me=u.jsxs(u.Fragment,{children:[u.jsx("button",{className:"ib",title:"复制路径",onClick:()=>{D()},children:"⧉"}),u.jsx("button",{className:"ib",title:"用系统应用打开",onClick:()=>{se(!1)},children:"↗"}),u.jsx("button",{className:"ib",title:"关闭预览","aria-label":"关闭预览",onClick:s,children:"✕"})]});return u.jsxs("div",{className:"pv",children:[u.jsxs("div",{className:"pv-head",onContextMenu:xe=>{xe.preventDefault(),a?.(e,xe.clientX,xe.clientY)},children:[t?u.jsx("button",{className:"ib",title:"返回文件树","aria-label":"返回文件树",onClick:s,children:"←"}):null,u.jsxs("span",{className:"pv-path",title:e,children:[Se===""?null:u.jsxs("span",{className:"dim",children:[Se,"/"]}),u.jsx("b",{children:R})]}),u.jsx("span",{className:"pv-actions",children:me})]}),fe?u.jsx("div",{className:"pv-body image",children:u.jsx("img",{src:`/file/raw?path=${encodeURIComponent(e)}`,alt:R})}):null,ve?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"pv-body pdf",children:u.jsx("iframe",{className:"pv-pdf",title:R,src:`/file/raw?path=${encodeURIComponent(e)}`})}),u.jsxs("div",{className:"pv-more",children:[u.jsx("span",{children:"浏览器原生 PDF 查看器"}),u.jsx("span",{className:"dim",children:"· 字节走 /file/raw(application/pdf)"})]})]}):null,fe||ve?null:u.jsxs("div",{className:"pv-boundary",children:[u.jsx("span",{className:"doc-badge",children:Z??le}),u.jsx("h3",{children:Z===null?"这个文件不做内嵌预览":"Office 文档不内嵌预览"}),u.jsx("p",{children:Z===null?`二进制(${Q})不内嵌、也不当文本读——不装作能看,给真动作:`:"要渲染 .docx / .xlsx / .pptx 得引一套文档内核(解析 + 排版),与「UI 复刻、功能自研」的取舍不一致。不装作能看,给真动作:"}),u.jsxs("div",{className:"pv-boundary-actions",children:[u.jsx("button",{className:"btn primary",onClick:()=>{se(!1)},children:"用系统应用打开"}),u.jsx("button",{className:"btn",onClick:()=>{se(!0)},children:"在 Finder 中显示"}),u.jsx("button",{className:"btn",onClick:()=>{D()},children:"复制路径"})]}),u.jsx("p",{className:"dim small",children:"「用系统应用打开」= POST /open-external 的 open <文件>(系统默认应用);「Finder 显示」= reveal 选中。"}),L===null?null:u.jsx("p",{className:"pv-note",children:L})]})]})}return u.jsxs("div",{className:"pv",children:[ce,ie?u.jsxs("div",{className:"pv-banner",children:[u.jsx("span",{className:"bi",children:"◈"}),u.jsx("span",{children:"磁盘上的文件已更新(版本对不上)"}),u.jsx("button",{className:"link-btn",onClick:()=>{ge(1,!1)},children:"重载"}),u.jsx("span",{className:"grow"}),u.jsx("button",{className:"ib",title:"先不重载",onClick:()=>{O(null)},children:"✕"})]}):null,U!==null?u.jsxs("div",{className:"pv-empty err",children:["读不到:",U]}):null,U===null&&c===null&&A?u.jsx("div",{className:"pv-empty",children:"读取中…"}):null,U===null&&c!==null?Q==="markdown"?u.jsx("div",{className:"pv-body md",children:Op(f)}):u.jsx("div",{className:ue?"pv-body code wrap":"pv-body code",children:f.split(`
|
|
46
|
+
`).map((fe,ve)=>u.jsxs("div",{className:"cl",children:[u.jsx("span",{className:"ln",children:ve+1}),u.jsx("span",{className:"lc",children:NR(fe).map((Z,le)=>Z.cls===""?Z.text:u.jsx("span",{className:`tok ${Z.cls}`,children:Z.text},le))})]},ve))}):null,c===null?null:u.jsxs("div",{className:"pv-more",children:[u.jsx("span",{children:y?`已加载 ${String(E)} 行 · 到文件末尾`:`已加载 ${String(E)} 行`}),w===null?null:u.jsxs("span",{className:"dim",children:["· ",wR(w)]}),y?null:u.jsx("button",{className:"link-btn",disabled:A,onClick:()=>{ge(p+_,!0)},children:A?"读取中…":"加载更多"})]})]})}const ZR=460;function JR({width:e,changed:t,refreshKey:s,root:r,forceSplit:a=!1,onCollapseTree:c}){const[h,f]=k.useState(""),[g,p]=k.useState(null),[v,_]=k.useState(null),[S,y]=k.useState(0),[x,w]=k.useState(null),[j,N]=k.useState(null),M=k.useRef(null),T=a||e>=ZR,[O,U]=k.useState(()=>qR()),z=k.useRef(null);k.useEffect(()=>()=>{M.current!==null&&clearTimeout(M.current)},[]);const A=q=>{N(q),M.current!==null&&clearTimeout(M.current),M.current=setTimeout(()=>{N(null)},1800)},Y=u.jsxs("div",{className:h===""?"dock-search":"dock-search searching",children:[u.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[u.jsx("circle",{cx:"11",cy:"11",r:"7"}),u.jsx("path",{d:"m20 20-3.5-3.5"})]}),u.jsx("input",{value:h,placeholder:"筛选文件…","aria-label":"筛选文件",onChange:q=>{f(q.target.value)},onKeyDown:q=>{q.key==="Escape"&&f("")}}),h===""?u.jsx("kbd",{children:"⌘P"}):u.jsx("button",{className:"clear",title:"清空 (Esc)",onClick:()=>{f("")},children:"✕"})]}),ue=q=>{q.button===0&&(q.currentTarget.setPointerCapture(q.pointerId),z.current={startX:q.clientX,startW:O})},P=q=>{z.current!==null&&U(Hp(z.current.startW+(q.clientX-z.current.startX)))},J=q=>{if(z.current!==null){z.current=null;try{q.currentTarget.releasePointerCapture(q.pointerId)}catch{}US(void 0,O)}},G=u.jsxs("div",{className:"tree-pane",style:a?{flex:`0 0 ${String(O)}px`,width:O}:void 0,children:[a?u.jsxs("div",{className:"pane-head tree-head",children:[u.jsx("span",{children:"文件树"}),u.jsx("span",{className:"grow"}),u.jsx("button",{className:"ib",title:"收起文件树(回双栏)","aria-label":"收起文件树",onClick:()=>{c?.()},children:"✕"})]}):null,Y,v===null?null:u.jsx("div",{className:"tree-hint err",children:v}),u.jsx("div",{className:"tree-scroll",children:u.jsx(WR,{selected:g,onSelect:p,changed:t,q:h.trim().toLowerCase(),refreshKey:s+S,onMenu:(q,F,V)=>{w({path:q,x:F,y:V})}})}),u.jsx("div",{className:"tree-foot",children:u.jsx("button",{className:"link-btn",onClick:()=>{y(q=>q+1)},children:"刷新目录"})})]}),L=g===null?null:u.jsx(QR,{path:g,narrow:!T,onBack:()=>{p(null),_(null)},onNotice:_,onMenu:(q,F,V)=>{w({path:q,x:F,y:V})}});return u.jsxs("div",{className:["files-wrap",T?"split":"single",g===null?"no-pv":"has-pv",a?"force-split":""].join(" "),children:[G,a?u.jsx("span",{className:"dock-splitter tree-splitter",title:"拖动调整文件树宽度(双击复位 176)",role:"separator","aria-orientation":"vertical","aria-label":"拖动调整文件树宽度",onPointerDown:ue,onPointerMove:P,onPointerUp:J,onPointerCancel:J,onDoubleClick:()=>{U(US(void 0,176))}}):null,u.jsx("div",{className:"pv-slot",children:L??(a?u.jsxs("div",{className:"pv-empty",children:[u.jsx("span",{className:"dim",children:"选一个文件看预览"}),u.jsx("span",{className:"smaller",children:"三栏里中间这格是预览;树宽可拖(140–240),栏头 ✕ 收起回双栏"})]}):null)}),x===null?null:u.jsx(VR,{root:r,path:x.path,x:x.x,y:x.y,onClose:()=>{w(null)},onFeedback:A}),j===null?null:u.jsx("div",{className:"dock-toast",children:j})]})}var e4=2,t4=1,n4=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,s=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(s.getPropertyValue("height")),a=Math.max(0,parseInt(s.getPropertyValue("width"))),c=window.getComputedStyle(this._terminal.element),h={top:parseInt(c.getPropertyValue("padding-top")),bottom:parseInt(c.getPropertyValue("padding-bottom")),right:parseInt(c.getPropertyValue("padding-right")),left:parseInt(c.getPropertyValue("padding-left"))},f=h.top+h.bottom,g=h.right+h.left,p=r-f,v=a-g-t;return{cols:Math.max(e4,Math.floor(v/e.css.cell.width)),rows:Math.max(t4,Math.floor(p/e.css.cell.height))}}};var T1=Object.defineProperty,i4=Object.getOwnPropertyDescriptor,s4=(e,t)=>{for(var s in t)T1(e,s,{get:t[s],enumerable:!0})},Rt=(e,t,s,r)=>{for(var a=r>1?void 0:r?i4(t,s):t,c=e.length-1,h;c>=0;c--)(h=e[c])&&(a=(r?h(t,s,a):h(a))||a);return r&&a&&T1(t,s,a),a},Ee=(e,t)=>(s,r)=>t(s,r,e),qS="Terminal input",Cm={get:()=>qS,set:e=>qS=e},FS="Too much output to announce, navigate to rows manually to read",km={get:()=>FS,set:e=>FS=e};function r4(e){return e.replace(/\r?\n/g,"\r")}function l4(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function a4(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function o4(e,t,s,r){if(e.stopPropagation(),e.clipboardData){let a=e.clipboardData.getData("text/plain");D1(a,t,s,r)}}function D1(e,t,s,r){e=r4(e),e=l4(e,s.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(e,!0),t.value=""}function M1(e,t,s){let r=s.getBoundingClientRect(),a=e.clientX-r.left-10,c=e.clientY-r.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${a}px`,t.style.top=`${c}px`,t.style.zIndex="1000",t.focus()}function $S(e,t,s,r,a){M1(e,t,s),a&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function Is(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Ou(e,t=0,s=e.length){let r="";for(let a=t;a<s;++a){let c=e[a];c>65535?(c-=65536,r+=String.fromCharCode((c>>10)+55296)+String.fromCharCode(c%1024+56320)):r+=String.fromCharCode(c)}return r}var c4=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let s=e.length;if(!s)return 0;let r=0,a=0;if(this._interim){let c=e.charCodeAt(a++);56320<=c&&c<=57343?t[r++]=(this._interim-55296)*1024+c-56320+65536:(t[r++]=this._interim,t[r++]=c),this._interim=0}for(let c=a;c<s;++c){let h=e.charCodeAt(c);if(55296<=h&&h<=56319){if(++c>=s)return this._interim=h,r;let f=e.charCodeAt(c);56320<=f&&f<=57343?t[r++]=(h-55296)*1024+f-56320+65536:(t[r++]=h,t[r++]=f);continue}h!==65279&&(t[r++]=h)}return r}},u4=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let s=e.length;if(!s)return 0;let r=0,a,c,h,f,g=0,p=0;if(this.interim[0]){let S=!1,y=this.interim[0];y&=(y&224)===192?31:(y&240)===224?15:7;let x=0,w;for(;(w=this.interim[++x]&63)&&x<4;)y<<=6,y|=w;let j=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,N=j-x;for(;p<N;){if(p>=s)return 0;if(w=e[p++],(w&192)!==128){p--,S=!0;break}else this.interim[x++]=w,y<<=6,y|=w&63}S||(j===2?y<128?p--:t[r++]=y:j===3?y<2048||y>=55296&&y<=57343||y===65279||(t[r++]=y):y<65536||y>1114111||(t[r++]=y)),this.interim.fill(0)}let v=s-4,_=p;for(;_<s;){for(;_<v&&!((a=e[_])&128)&&!((c=e[_+1])&128)&&!((h=e[_+2])&128)&&!((f=e[_+3])&128);)t[r++]=a,t[r++]=c,t[r++]=h,t[r++]=f,_+=4;if(a=e[_++],a<128)t[r++]=a;else if((a&224)===192){if(_>=s)return this.interim[0]=a,r;if(c=e[_++],(c&192)!==128){_--;continue}if(g=(a&31)<<6|c&63,g<128){_--;continue}t[r++]=g}else if((a&240)===224){if(_>=s)return this.interim[0]=a,r;if(c=e[_++],(c&192)!==128){_--;continue}if(_>=s)return this.interim[0]=a,this.interim[1]=c,r;if(h=e[_++],(h&192)!==128){_--;continue}if(g=(a&15)<<12|(c&63)<<6|h&63,g<2048||g>=55296&&g<=57343||g===65279)continue;t[r++]=g}else if((a&248)===240){if(_>=s)return this.interim[0]=a,r;if(c=e[_++],(c&192)!==128){_--;continue}if(_>=s)return this.interim[0]=a,this.interim[1]=c,r;if(h=e[_++],(h&192)!==128){_--;continue}if(_>=s)return this.interim[0]=a,this.interim[1]=c,this.interim[2]=h,r;if(f=e[_++],(f&192)!==128){_--;continue}if(g=(a&7)<<18|(c&63)<<12|(h&63)<<6|f&63,g<65536||g>1114111)continue;t[r++]=g}}return r}},A1="",Us=" ",ao=class R1{constructor(){this.fg=0,this.bg=0,this.extended=new yu}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 R1;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}},yu=class O1{constructor(t=0,s=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=s}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 O1(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},ci=class B1 extends ao{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new yu,this.combinedData=""}static fromCharData(t){let s=new B1;return s.setFromCharData(t),s}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Is(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 s=!1;if(t[1].length>2)s=!0;else if(t[1].length===2){let r=t[1].charCodeAt(0);if(55296<=r&&r<=56319){let a=t[1].charCodeAt(1);56320<=a&&a<=57343?this.content=(r-55296)*1024+a-56320+65536|t[2]<<22:s=!0}else s=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;s&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},VS="di$target",Nm="di$dependencies",Ff=new Map;function h4(e){return e[Nm]||[]}function nn(e){if(Ff.has(e))return Ff.get(e);let t=function(s,r,a){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");d4(t,s,a)};return t._id=e,Ff.set(e,t),t}function d4(e,t,s){t[VS]===t?t[Nm].push({id:e,index:s}):(t[Nm]=[{id:e,index:s}],t[VS]=t)}var Cn=nn("BufferService"),L1=nn("CoreMouseService"),Tr=nn("CoreService"),f4=nn("CharsetService"),Ip=nn("InstantiationService"),z1=nn("LogService"),kn=nn("OptionsService"),H1=nn("OscLinkService"),m4=nn("UnicodeService"),oo=nn("DecorationService"),Em=class{constructor(e,t,s){this._bufferService=e,this._optionsService=t,this._oscLinkService=s}provideLinks(e,t){let s=this._bufferService.buffer.lines.get(e-1);if(!s){t(void 0);return}let r=[],a=this._optionsService.rawOptions.linkHandler,c=new ci,h=s.getTrimmedLength(),f=-1,g=-1,p=!1;for(let v=0;v<h;v++)if(!(g===-1&&!s.hasContent(v))){if(s.loadCell(v,c),c.hasExtendedAttrs()&&c.extended.urlId)if(g===-1){g=v,f=c.extended.urlId;continue}else p=c.extended.urlId!==f;else g!==-1&&(p=!0);if(p||g!==-1&&v===h-1){let _=this._oscLinkService.getLinkData(f)?.uri;if(_){let S={start:{x:g+1,y:e},end:{x:v+(!p&&v===h-1?1:0),y:e}},y=!1;if(!a?.allowNonHttpProtocols)try{let x=new URL(_);["http:","https:"].includes(x.protocol)||(y=!0)}catch{y=!0}y||r.push({text:_,range:S,activate:(x,w)=>a?a.activate(x,w,S):p4(x,w),hover:(x,w)=>a?.hover?.(x,w,S),leave:(x,w)=>a?.leave?.(x,w,S)})}p=!1,c.hasExtendedAttrs()&&c.extended.urlId?(g=v,f=c.extended.urlId):(g=-1,f=-1)}}t(r)}};Em=Rt([Ee(0,Cn),Ee(1,kn),Ee(2,H1)],Em);function p4(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
47
|
+
|
|
48
|
+
WARNING: This link could potentially be dangerous`)){let s=window.open();if(s){try{s.opener=null}catch{}s.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var Bu=nn("CharSizeService"),ls=nn("CoreBrowserService"),Up=nn("MouseService"),as=nn("RenderService"),g4=nn("SelectionService"),I1=nn("CharacterJoinerService"),Rl=nn("ThemeService"),U1=nn("LinkProviderService"),_4=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?YS.isErrorNoTelemetry(e)?new YS(e.message+`
|
|
49
|
+
|
|
50
|
+
`+e.stack):new Error(e.message+`
|
|
51
|
+
|
|
52
|
+
`+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)}},v4=new _4;function ru(e){y4(e)||v4.onUnexpectedError(e)}var jm="Canceled";function y4(e){return e instanceof S4?!0:e instanceof Error&&e.name===jm&&e.message===jm}var S4=class extends Error{constructor(){super(jm),this.name=this.message}};function b4(e){return new Error(`Illegal argument: ${e}`)}var YS=class Tm extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Tm)return t;let s=new Tm;return s.message=t.message,s.stack=t.stack,s}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Dm=class P1 extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,P1.prototype)}};function Vn(e,t=0){return e[e.length-(1+t)]}var x4;(e=>{function t(c){return c<0}e.isLessThan=t;function s(c){return c<=0}e.isLessThanOrEqual=s;function r(c){return c>0}e.isGreaterThan=r;function a(c){return c===0}e.isNeitherLessOrGreaterThan=a,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(x4||={});function w4(e,t){let s=this,r=!1,a;return function(){return r||(r=!0,t||(a=e.apply(s,arguments))),a}}var q1;(e=>{function t(O){return O&&typeof O=="object"&&typeof O[Symbol.iterator]=="function"}e.is=t;let s=Object.freeze([]);function r(){return s}e.empty=r;function*a(O){yield O}e.single=a;function c(O){return t(O)?O:a(O)}e.wrap=c;function h(O){return O||s}e.from=h;function*f(O){for(let U=O.length-1;U>=0;U--)yield O[U]}e.reverse=f;function g(O){return!O||O[Symbol.iterator]().next().done===!0}e.isEmpty=g;function p(O){return O[Symbol.iterator]().next().value}e.first=p;function v(O,U){let z=0;for(let A of O)if(U(A,z++))return!0;return!1}e.some=v;function _(O,U){for(let z of O)if(U(z))return z}e.find=_;function*S(O,U){for(let z of O)U(z)&&(yield z)}e.filter=S;function*y(O,U){let z=0;for(let A of O)yield U(A,z++)}e.map=y;function*x(O,U){let z=0;for(let A of O)yield*U(A,z++)}e.flatMap=x;function*w(...O){for(let U of O)yield*U}e.concat=w;function j(O,U,z){let A=z;for(let Y of O)A=U(A,Y);return A}e.reduce=j;function*N(O,U,z=O.length){for(U<0&&(U+=O.length),z<0?z+=O.length:z>O.length&&(z=O.length);U<z;U++)yield O[U]}e.slice=N;function M(O,U=Number.POSITIVE_INFINITY){let z=[];if(U===0)return[z,O];let A=O[Symbol.iterator]();for(let Y=0;Y<U;Y++){let ue=A.next();if(ue.done)return[z,e.empty()];z.push(ue.value)}return[z,{[Symbol.iterator](){return A}}]}e.consume=M;async function T(O){let U=[];for await(let z of O)U.push(z);return Promise.resolve(U)}e.asyncToArray=T})(q1||={});function Nr(e){if(q1.is(e)){let t=[];for(let s of e)if(s)try{s.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 C4(...e){return Ct(()=>Nr(e))}function Ct(e){return{dispose:w4(()=>{e()})}}var F1=class $1{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{Nr(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?$1.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)}};F1.DISABLE_DISPOSED_WARNING=!1;var Ps=F1,We=class{constructor(){this._store=new Ps,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)}};We.None=Object.freeze({dispose(){}});var Dl=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},ss=typeof window=="object"?window:globalThis,Mm=class Am{constructor(t){this.element=t,this.next=Am.Undefined,this.prev=Am.Undefined}};Mm.Undefined=new Mm(void 0);var Et=Mm,KS=class{constructor(){this._first=Et.Undefined,this._last=Et.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Et.Undefined}clear(){let e=this._first;for(;e!==Et.Undefined;){let t=e.next;e.prev=Et.Undefined,e.next=Et.Undefined,e=t}this._first=Et.Undefined,this._last=Et.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let s=new Et(e);if(this._first===Et.Undefined)this._first=s,this._last=s;else if(t){let a=this._last;this._last=s,s.prev=a,a.next=s}else{let a=this._first;this._first=s,s.next=a,a.prev=s}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(s))}}shift(){if(this._first!==Et.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Et.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Et.Undefined&&e.next!==Et.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Et.Undefined&&e.next===Et.Undefined?(this._first=Et.Undefined,this._last=Et.Undefined):e.next===Et.Undefined?(this._last=this._last.prev,this._last.next=Et.Undefined):e.prev===Et.Undefined&&(this._first=this._first.next,this._first.prev=Et.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Et.Undefined;)yield e.element,e=e.next}},k4=globalThis.performance&&typeof globalThis.performance.now=="function",N4=class V1{static create(t){return new V1(t)}constructor(t){this._now=k4&&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}},fn;(e=>{e.None=()=>We.None;function t(G,L){return _(G,()=>{},0,void 0,!0,void 0,L)}e.defer=t;function s(G){return(L,q=null,F)=>{let V=!1,Q;return Q=G(K=>{if(!V)return Q?Q.dispose():V=!0,L.call(q,K)},null,F),V&&Q.dispose(),Q}}e.once=s;function r(G,L,q){return p((F,V=null,Q)=>G(K=>F.call(V,L(K)),null,Q),q)}e.map=r;function a(G,L,q){return p((F,V=null,Q)=>G(K=>{L(K),F.call(V,K)},null,Q),q)}e.forEach=a;function c(G,L,q){return p((F,V=null,Q)=>G(K=>L(K)&&F.call(V,K),null,Q),q)}e.filter=c;function h(G){return G}e.signal=h;function f(...G){return(L,q=null,F)=>{let V=C4(...G.map(Q=>Q(K=>L.call(q,K))));return v(V,F)}}e.any=f;function g(G,L,q,F){let V=q;return r(G,Q=>(V=L(V,Q),V),F)}e.reduce=g;function p(G,L){let q,F={onWillAddFirstListener(){q=G(V.fire,V)},onDidRemoveLastListener(){q?.dispose()}},V=new be(F);return L?.add(V),V.event}function v(G,L){return L instanceof Array?L.push(G):L&&L.add(G),G}function _(G,L,q=100,F=!1,V=!1,Q,K){let ge,D,Ae,Se=0,R,E={leakWarningThreshold:Q,onWillAddFirstListener(){ge=G(ce=>{Se++,D=L(D,ce),F&&!Ae&&(ie.fire(D),D=void 0),R=()=>{let fe=D;D=void 0,Ae=void 0,(!F||Se>1)&&ie.fire(fe),Se=0},typeof q=="number"?(clearTimeout(Ae),Ae=setTimeout(R,q)):Ae===void 0&&(Ae=0,queueMicrotask(R))})},onWillRemoveListener(){V&&Se>0&&R?.()},onDidRemoveLastListener(){R=void 0,ge.dispose()}},ie=new be(E);return K?.add(ie),ie.event}e.debounce=_;function S(G,L=0,q){return e.debounce(G,(F,V)=>F?(F.push(V),F):[V],L,void 0,!0,void 0,q)}e.accumulate=S;function y(G,L=(F,V)=>F===V,q){let F=!0,V;return c(G,Q=>{let K=F||!L(Q,V);return F=!1,V=Q,K},q)}e.latch=y;function x(G,L,q){return[e.filter(G,L,q),e.filter(G,F=>!L(F),q)]}e.split=x;function w(G,L=!1,q=[],F){let V=q.slice(),Q=G(D=>{V?V.push(D):ge.fire(D)});F&&F.add(Q);let K=()=>{V?.forEach(D=>ge.fire(D)),V=null},ge=new be({onWillAddFirstListener(){Q||(Q=G(D=>ge.fire(D)),F&&F.add(Q))},onDidAddFirstListener(){V&&(L?setTimeout(K):K())},onDidRemoveLastListener(){Q&&Q.dispose(),Q=null}});return F&&F.add(ge),ge.event}e.buffer=w;function j(G,L){return(q,F,V)=>{let Q=L(new M);return G(function(K){let ge=Q.evaluate(K);ge!==N&&q.call(F,ge)},void 0,V)}}e.chain=j;let N=Symbol("HaltChainable");class M{constructor(){this.steps=[]}map(L){return this.steps.push(L),this}forEach(L){return this.steps.push(q=>(L(q),q)),this}filter(L){return this.steps.push(q=>L(q)?q:N),this}reduce(L,q){let F=q;return this.steps.push(V=>(F=L(F,V),F)),this}latch(L=(q,F)=>q===F){let q=!0,F;return this.steps.push(V=>{let Q=q||!L(V,F);return q=!1,F=V,Q?V:N}),this}evaluate(L){for(let q of this.steps)if(L=q(L),L===N)break;return L}}function T(G,L,q=F=>F){let F=(...ge)=>K.fire(q(...ge)),V=()=>G.on(L,F),Q=()=>G.removeListener(L,F),K=new be({onWillAddFirstListener:V,onDidRemoveLastListener:Q});return K.event}e.fromNodeEventEmitter=T;function O(G,L,q=F=>F){let F=(...ge)=>K.fire(q(...ge)),V=()=>G.addEventListener(L,F),Q=()=>G.removeEventListener(L,F),K=new be({onWillAddFirstListener:V,onDidRemoveLastListener:Q});return K.event}e.fromDOMEventEmitter=O;function U(G){return new Promise(L=>s(G)(L))}e.toPromise=U;function z(G){let L=new be;return G.then(q=>{L.fire(q)},()=>{L.fire(void 0)}).finally(()=>{L.dispose()}),L.event}e.fromPromise=z;function A(G,L){return G(q=>L.fire(q))}e.forward=A;function Y(G,L,q){return L(q),G(F=>L(F))}e.runAndSubscribe=Y;class ue{constructor(L,q){this._observable=L,this._counter=0,this._hasChanged=!1;let F={onWillAddFirstListener:()=>{L.addObserver(this)},onDidRemoveLastListener:()=>{L.removeObserver(this)}};this.emitter=new be(F),q&&q.add(this.emitter)}beginUpdate(L){this._counter++}handlePossibleChange(L){}handleChange(L,q){this._hasChanged=!0}endUpdate(L){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function P(G,L){return new ue(G,L).emitter.event}e.fromObservable=P;function J(G){return(L,q,F)=>{let V=0,Q=!1,K={beginUpdate(){V++},endUpdate(){V--,V===0&&(G.reportChanges(),Q&&(Q=!1,L.call(q)))},handlePossibleChange(){},handleChange(){Q=!0}};G.addObserver(K),G.reportChanges();let ge={dispose(){G.removeObserver(K)}};return F instanceof Ps?F.add(ge):Array.isArray(F)&&F.push(ge),ge}}e.fromObservableLight=J})(fn||={});var Rm=class Om{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Om._idPool++}`,Om.all.add(this)}start(t){this._stopWatch=new N4,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}}};Rm.all=new Set,Rm._idPool=0;var E4=Rm,j4=-1,Y1=class K1{constructor(t,s,r=(K1._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=s,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,s){let r=this.threshold;if(r<=0||s<r)return;this._stacks||(this._stacks=new Map);let a=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,a+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[c,h]=this.getMostFrequentStack(),f=`[${this.name}] potential listener LEAK detected, having ${s} listeners already. MOST frequent listener (${h}):`;console.warn(f),console.warn(c);let g=new M4(f,c);this._errorHandler(g)}return()=>{let c=this._stacks.get(t.value)||0;this._stacks.set(t.value,c-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,s=0;for(let[r,a]of this._stacks)(!t||s<a)&&(t=[r,a],s=a);return t}};Y1._idPool=1;var T4=Y1,D4=class W1{constructor(t){this.value=t}static create(){let t=new Error;return new W1(t.stack??"")}print(){console.warn(this.value.split(`
|
|
53
|
+
`).slice(2).join(`
|
|
54
|
+
`))}},M4=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},A4=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},R4=0,$f=class{constructor(e){this.value=e,this.id=R4++}},O4=2,B4,be=class{constructor(e){this._size=0,this._options=e,this._leakageMon=this._options?.leakWarningThreshold?new T4(e?.onListenerError??ru,this._options?.leakWarningThreshold??j4):void 0,this._perfMon=this._options?._profName?new E4(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,s)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let h=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(h);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],g=new A4(`${h}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(this._options?.onListenerError||ru)(g),We.None}if(this._disposed)return We.None;t&&(e=e.bind(t));let r=new $f(e),a;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=D4.create(),a=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof $f?(this._deliveryQueue??=new L4,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let c=Ct(()=>{a?.(),this._removeListener(r)});return s instanceof Ps?s.add(c):Array.isArray(s)&&s.push(c),c},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,s=t.indexOf(e);if(s===-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[s]=void 0;let r=this._deliveryQueue.current===this;if(this._size*O4<=t.length){let a=0;for(let c=0;c<t.length;c++)t[c]?t[a++]=t[c]:r&&(this._deliveryQueue.end--,a<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=a}}_deliver(e,t){if(!e)return;let s=this._options?.onListenerError||ru;if(!s){e.value(t);return}try{e.value(t)}catch(r){s(r)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof $f)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},L4=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,s){this.i=0,this.end=s,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Bm=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new be,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new be,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,s){if(this.getZoomLevel(s)===t)return;let r=this.getWindowId(s);this.mapWindowIdToZoomLevel.set(r,t),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,s){this.mapWindowIdToZoomFactor.set(this.getWindowId(s),t)}setFullscreen(t,s){if(this.isFullscreen(s)===t)return;let r=this.getWindowId(s);this.mapWindowIdToFullScreen.set(r,t),this._onDidChangeFullscreen.fire(r)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Bm.INSTANCE=new Bm;var Pp=Bm;function z4(e,t,s){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",s)}Pp.INSTANCE.onDidChangeZoomLevel;function H4(e){return Pp.INSTANCE.getZoomFactor(e)}Pp.INSTANCE.onDidChangeFullscreen;var Ol=typeof navigator=="object"?navigator.userAgent:"",Lm=Ol.indexOf("Firefox")>=0,I4=Ol.indexOf("AppleWebKit")>=0,qp=Ol.indexOf("Chrome")>=0,U4=!qp&&Ol.indexOf("Safari")>=0;Ol.indexOf("Electron/")>=0;Ol.indexOf("Android")>=0;var Vf=!1;if(typeof ss.matchMedia=="function"){let e=ss.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=ss.matchMedia("(display-mode: fullscreen)");Vf=e.matches,z4(ss,e,({matches:s})=>{Vf&&t.matches||(Vf=s)})}var Nl="en",zm=!1,Hm=!1,lu=!1,X1=!1,Kc,au=Nl,WS=Nl,P4,is,Cr=globalThis,Wn;typeof Cr.vscode<"u"&&typeof Cr.vscode.process<"u"?Wn=Cr.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Wn=process);var q4=typeof Wn?.versions?.electron=="string",F4=q4&&Wn?.type==="renderer";if(typeof Wn=="object"){zm=Wn.platform==="win32",Hm=Wn.platform==="darwin",lu=Wn.platform==="linux",lu&&Wn.env.SNAP&&Wn.env.SNAP_REVISION,Wn.env.CI||Wn.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Kc=Nl,au=Nl;let e=Wn.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Kc=t.userLocale,WS=t.osLocale,au=t.resolvedLanguage||Nl,P4=t.languagePack?.translationsConfigFile}catch{}X1=!0}else typeof navigator=="object"&&!F4?(is=navigator.userAgent,zm=is.indexOf("Windows")>=0,Hm=is.indexOf("Macintosh")>=0,(is.indexOf("Macintosh")>=0||is.indexOf("iPad")>=0||is.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,lu=is.indexOf("Linux")>=0,is?.indexOf("Mobi")>=0,au=globalThis._VSCODE_NLS_LANGUAGE||Nl,Kc=navigator.language.toLowerCase(),WS=Kc):console.error("Unable to resolve platform.");var G1=zm,Li=Hm,$4=lu,XS=X1,zi=is,Ls=au,V4;(e=>{function t(){return Ls}e.value=t;function s(){return Ls.length===2?Ls==="en":Ls.length>=3?Ls[0]==="e"&&Ls[1]==="n"&&Ls[2]==="-":!1}e.isDefaultVariant=s;function r(){return Ls==="en"}e.isDefault=r})(V4||={});var Y4=typeof Cr.postMessage=="function"&&!Cr.importScripts;(()=>{if(Y4){let e=[];Cr.addEventListener("message",s=>{if(s.data&&s.data.vscodeScheduleAsyncWork)for(let r=0,a=e.length;r<a;r++){let c=e[r];if(c.id===s.data.vscodeScheduleAsyncWork){e.splice(r,1),c.callback();return}}});let t=0;return s=>{let r=++t;e.push({id:r,callback:s}),Cr.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})();var K4=!!(zi&&zi.indexOf("Chrome")>=0);zi&&zi.indexOf("Firefox")>=0;!K4&&zi&&zi.indexOf("Safari")>=0;zi&&zi.indexOf("Edg/")>=0;zi&&zi.indexOf("Android")>=0;var Sl=typeof navigator=="object"?navigator:{};XS||document.queryCommandSupported&&document.queryCommandSupported("copy")||Sl&&Sl.clipboard&&Sl.clipboard.writeText,XS||Sl&&Sl.clipboard&&Sl.clipboard.readText;var Fp=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}},Yf=new Fp,GS=new Fp,QS=new Fp,W4=new Array(230),Q1;(e=>{function t(f){return Yf.keyCodeToStr(f)}e.toString=t;function s(f){return Yf.strToKeyCode(f)}e.fromString=s;function r(f){return GS.keyCodeToStr(f)}e.toUserSettingsUS=r;function a(f){return QS.keyCodeToStr(f)}e.toUserSettingsGeneral=a;function c(f){return GS.strToKeyCode(f)||QS.strToKeyCode(f)}e.fromUserSettings=c;function h(f){if(f>=98&&f<=113)return null;switch(f){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Yf.keyCodeToStr(f)}e.toElectronAccelerator=h})(Q1||={});var X4=class Z1{constructor(t,s,r,a,c){this.ctrlKey=t,this.shiftKey=s,this.altKey=r,this.metaKey=a,this.keyCode=c}equals(t){return t instanceof Z1&&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",s=this.shiftKey?"1":"0",r=this.altKey?"1":"0",a=this.metaKey?"1":"0";return`K${t}${s}${r}${a}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new G4([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},G4=class{constructor(e){if(e.length===0)throw b4("chords");this.chords=e}getHashCode(){let e="";for(let t=0,s=this.chords.length;t<s;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 Q4(e){if(e.charCode){let s=String.fromCharCode(e.charCode).toUpperCase();return Q1.fromString(s)}let t=e.keyCode;if(t===3)return 7;if(Lm)switch(t){case 59:return 85;case 60:if($4)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Li)return 57;break}else if(I4&&(Li&&t===93||!Li&&t===92))return 57;return W4[t]||0}var Z4=Li?256:2048,J4=512,e5=1024,t5=Li?2048:256,ZS=class{constructor(e){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=t.getModifierState?.("AltGraph"),this.keyCode=Q4(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|=Z4),this.altKey&&(t|=J4),this.shiftKey&&(t|=e5),this.metaKey&&(t|=t5),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new X4(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},JS=new WeakMap;function n5(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,s=e.parent.location;if(t.origin!=="null"&&s.origin!=="null"&&t.origin!==s.origin)return null}catch{return null}return e.parent}var i5=class{static getSameOriginWindowChain(e){let t=JS.get(e);if(!t){t=[],JS.set(e,t);let s=e,r;do r=n5(s),r?t.push({window:new WeakRef(s),iframeElement:s.frameElement||null}):t.push({window:new WeakRef(s),iframeElement:null}),s=r;while(s)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let s=0,r=0,a=this.getSameOriginWindowChain(e);for(let c of a){let h=c.window.deref();if(s+=h?.scrollY??0,r+=h?.scrollX??0,h===t||!c.iframeElement)break;let f=c.iframeElement.getBoundingClientRect();s+=f.top,r+=f.left}return{top:s,left:r}}},Wc=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 s=i5.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=s.left,this.posy-=s.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},eb=class{constructor(e,t=0,s=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=s,this.deltaX=t;let r=!1;if(qp){let a=navigator.userAgent.match(/Chrome\/(\d+)/);r=(a?parseInt(a[1]):123)<=122}if(e){let a=e,c=e,h=e.view?.devicePixelRatio||1;if(typeof a.wheelDeltaY<"u")r?this.deltaY=a.wheelDeltaY/(120*h):this.deltaY=a.wheelDeltaY/120;else if(typeof c.VERTICAL_AXIS<"u"&&c.axis===c.VERTICAL_AXIS)this.deltaY=-c.detail/3;else if(e.type==="wheel"){let f=e;f.deltaMode===f.DOM_DELTA_LINE?Lm&&!Li?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof a.wheelDeltaX<"u")U4&&G1?this.deltaX=-(a.wheelDeltaX/120):r?this.deltaX=a.wheelDeltaX/(120*h):this.deltaX=a.wheelDeltaX/120;else if(typeof c.HORIZONTAL_AXIS<"u"&&c.axis===c.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let f=e;f.deltaMode===f.DOM_DELTA_LINE?Lm&&!Li?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*h):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},J1=Object.freeze(function(e,t){let s=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(s)}}}),s5;(e=>{function t(s){return s===e.None||s===e.Cancelled||s instanceof r5?!0:!s||typeof s!="object"?!1:typeof s.isCancellationRequested=="boolean"&&typeof s.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:fn.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:J1})})(s5||={});var r5=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?J1:(this._emitter||(this._emitter=new be),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},$p=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 Dm("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Dm("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},l5=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,s=globalThis){if(this.isDisposed)throw new Dm("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=s.setInterval(()=>{e()},t);this.disposable=Ct(()=>{s.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},a5;(e=>{async function t(r){let a,c=await Promise.all(r.map(h=>h.then(f=>f,f=>{a||(a=f)})));if(typeof a<"u")throw a;return c}e.settled=t;function s(r){return new Promise(async(a,c)=>{try{await r(a,c)}catch(h){c(h)}})}e.withAsyncBody=s})(a5||={});var tb=class li{static fromArray(t){return new li(s=>{s.emitMany(t)})}static fromPromise(t){return new li(async s=>{s.emitMany(await t)})}static fromPromises(t){return new li(async s=>{await Promise.all(t.map(async r=>s.emitOne(await r)))})}static merge(t){return new li(async s=>{await Promise.all(t.map(async r=>{for await(let a of r)s.emitOne(a)}))})}constructor(t,s){this._state=0,this._results=[],this._error=null,this._onReturn=s,this._onStateChanged=new be,queueMicrotask(async()=>{let r={emitOne:a=>this.emitOne(a),emitMany:a=>this.emitMany(a),reject:a=>this.reject(a)};try{await Promise.resolve(t(r)),this.resolve()}catch(a){this.reject(a)}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 fn.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,s){return new li(async r=>{for await(let a of t)r.emitOne(s(a))})}map(t){return li.map(this,t)}static filter(t,s){return new li(async r=>{for await(let a of t)s(a)&&r.emitOne(a)})}filter(t){return li.filter(this,t)}static coalesce(t){return li.filter(t,s=>!!s)}coalesce(){return li.coalesce(this)}static async toPromise(t){let s=[];for await(let r of t)s.push(r);return s}toPromise(){return li.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())}};tb.EMPTY=tb.fromArray([]);var{getWindow:Bi,getWindowId:o5,onDidRegisterWindow:c5}=(function(){let e=new Map,t={window:ss,disposables:new Ps};e.set(ss.vscodeWindowId,t);let s=new be,r=new be,a=new be;function c(h,f){return(typeof h=="number"?e.get(h):void 0)??(f?t:void 0)}return{onDidRegisterWindow:s.event,onWillUnregisterWindow:a.event,onDidUnregisterWindow:r.event,registerWindow(h){if(e.has(h.vscodeWindowId))return We.None;let f=new Ps,g={window:h,disposables:f.add(new Ps)};return e.set(h.vscodeWindowId,g),f.add(Ct(()=>{e.delete(h.vscodeWindowId),r.fire(h)})),f.add(He(h,Zt.BEFORE_UNLOAD,()=>{a.fire(h)})),s.fire(g),f},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(h){return h.vscodeWindowId},hasWindow(h){return e.has(h)},getWindowById:c,getWindow(h){let f=h;if(f?.ownerDocument?.defaultView)return f.ownerDocument.defaultView.window;let g=h;return g?.view?g.view.window:ss},getDocument(h){return Bi(h).document}}})(),u5=class{constructor(e,t,s,r){this._node=e,this._type=t,this._handler=s,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 He(e,t,s,r){return new u5(e,t,s,r)}var nb=function(e,t,s,r){return He(e,t,s,r)},Vp,h5=class extends l5{constructor(e){super(),this.defaultTarget=e&&Bi(e)}cancelAndSet(e,t,s){return super.cancelAndSet(e,t,s??this.defaultTarget)}},ib=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){ru(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,s=new Map,r=new Map,a=c=>{s.set(c,!1);let h=e.get(c)??[];for(t.set(c,h),e.set(c,[]),r.set(c,!0);h.length>0;)h.sort(ib.sort),h.shift().execute();r.set(c,!1)};Vp=(c,h,f=0)=>{let g=o5(c),p=new ib(h,f),v=e.get(g);return v||(v=[],e.set(g,v)),v.push(p),s.get(g)||(s.set(g,!0),c.requestAnimationFrame(()=>a(g))),p}})();function d5(e){let t=e.getBoundingClientRect(),s=Bi(e);return{left:t.left+s.scrollX,top:t.top+s.scrollY,width:t.width,height:t.height}}var Zt={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"},f5=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=An(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=An(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=An(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=An(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=An(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=An(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=An(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=An(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=An(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=An(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=An(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=An(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=An(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=An(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 An(e){return typeof e=="number"?`${e}px`:e}function Xa(e){return new f5(e)}var ew=class{constructor(){this._hooks=new Ps,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 s=this._onStopCallback;this._onStopCallback=null,e&&s&&s(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,s,r,a){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=a;let c=e;try{e.setPointerCapture(t),this._hooks.add(Ct(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{c=Bi(e)}this._hooks.add(He(c,Zt.POINTER_MOVE,h=>{if(h.buttons!==s){this.stopMonitoring(!0);return}h.preventDefault(),this._pointerMoveCallback(h)})),this._hooks.add(He(c,Zt.POINTER_UP,h=>this.stopMonitoring(!0)))}};function m5(e,t,s){let r=null,a=null;if(typeof s.value=="function"?(r="value",a=s.value,a.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof s.get=="function"&&(r="get",a=s.get),!a)throw new Error("not supported");let c=`$memoize$${t}`;s[r]=function(...h){return this.hasOwnProperty(c)||Object.defineProperty(this,c,{configurable:!1,enumerable:!1,writable:!1,value:a.apply(this,h)}),this[c]}}var Ai;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Ai||={});var Pa=class gn extends We{constructor(){super(),this.dispatched=!1,this.targets=new KS,this.ignoreTargets=new KS,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(fn.runAndSubscribe(c5,({window:t,disposables:s})=>{s.add(He(t.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),s.add(He(t.document,"touchend",r=>this.onTouchEnd(t,r))),s.add(He(t.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:ss,disposables:this._store}))}static addTarget(t){if(!gn.isTouchDevice())return We.None;gn.INSTANCE||(gn.INSTANCE=new gn);let s=gn.INSTANCE.targets.push(t);return Ct(s)}static ignoreTarget(t){if(!gn.isTouchDevice())return We.None;gn.INSTANCE||(gn.INSTANCE=new gn);let s=gn.INSTANCE.ignoreTargets.push(t);return Ct(s)}static isTouchDevice(){return"ontouchstart"in ss||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let s=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,a=t.targetTouches.length;r<a;r++){let c=t.targetTouches.item(r);this.activeTouches[c.identifier]={id:c.identifier,initialTarget:c.target,initialTimeStamp:s,initialPageX:c.pageX,initialPageY:c.pageY,rollingTimestamps:[s],rollingPageX:[c.pageX],rollingPageY:[c.pageY]};let h=this.newGestureEvent(Ai.Start,c.target);h.pageX=c.pageX,h.pageY=c.pageY,this.dispatchEvent(h)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,s){let r=Date.now(),a=Object.keys(this.activeTouches).length;for(let c=0,h=s.changedTouches.length;c<h;c++){let f=s.changedTouches.item(c);if(!this.activeTouches.hasOwnProperty(String(f.identifier))){console.warn("move of an UNKNOWN touch",f);continue}let g=this.activeTouches[f.identifier],p=Date.now()-g.initialTimeStamp;if(p<gn.HOLD_DELAY&&Math.abs(g.initialPageX-Vn(g.rollingPageX))<30&&Math.abs(g.initialPageY-Vn(g.rollingPageY))<30){let v=this.newGestureEvent(Ai.Tap,g.initialTarget);v.pageX=Vn(g.rollingPageX),v.pageY=Vn(g.rollingPageY),this.dispatchEvent(v)}else if(p>=gn.HOLD_DELAY&&Math.abs(g.initialPageX-Vn(g.rollingPageX))<30&&Math.abs(g.initialPageY-Vn(g.rollingPageY))<30){let v=this.newGestureEvent(Ai.Contextmenu,g.initialTarget);v.pageX=Vn(g.rollingPageX),v.pageY=Vn(g.rollingPageY),this.dispatchEvent(v)}else if(a===1){let v=Vn(g.rollingPageX),_=Vn(g.rollingPageY),S=Vn(g.rollingTimestamps)-g.rollingTimestamps[0],y=v-g.rollingPageX[0],x=_-g.rollingPageY[0],w=[...this.targets].filter(j=>g.initialTarget instanceof Node&&j.contains(g.initialTarget));this.inertia(t,w,r,Math.abs(y)/S,y>0?1:-1,v,Math.abs(x)/S,x>0?1:-1,_)}this.dispatchEvent(this.newGestureEvent(Ai.End,g.initialTarget)),delete this.activeTouches[f.identifier]}this.dispatched&&(s.preventDefault(),s.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,s){let r=document.createEvent("CustomEvent");return r.initEvent(t,!1,!0),r.initialTarget=s,r.tapCount=0,r}dispatchEvent(t){if(t.type===Ai.Tap){let s=new Date().getTime(),r=0;s-this._lastSetTapCountTime>gn.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=s,t.tapCount=r}else(t.type===Ai.Change||t.type===Ai.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(t.initialTarget))return;let s=[];for(let r of this.targets)if(r.contains(t.initialTarget)){let a=0,c=t.initialTarget;for(;c&&c!==r;)a++,c=c.parentElement;s.push([a,r])}s.sort((r,a)=>r[0]-a[0]);for(let[r,a]of s)a.dispatchEvent(t),this.dispatched=!0}}inertia(t,s,r,a,c,h,f,g,p){this.handle=Vp(t,()=>{let v=Date.now(),_=v-r,S=0,y=0,x=!0;a+=gn.SCROLL_FRICTION*_,f+=gn.SCROLL_FRICTION*_,a>0&&(x=!1,S=c*a*_),f>0&&(x=!1,y=g*f*_);let w=this.newGestureEvent(Ai.Change);w.translationX=S,w.translationY=y,s.forEach(j=>j.dispatchEvent(w)),x||this.inertia(t,s,v,a,c,h+S,f,g,p+y)})}onTouchMove(t){let s=Date.now();for(let r=0,a=t.changedTouches.length;r<a;r++){let c=t.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(c.identifier))){console.warn("end of an UNKNOWN touch",c);continue}let h=this.activeTouches[c.identifier],f=this.newGestureEvent(Ai.Change,h.initialTarget);f.translationX=c.pageX-Vn(h.rollingPageX),f.translationY=c.pageY-Vn(h.rollingPageY),f.pageX=c.pageX,f.pageY=c.pageY,this.dispatchEvent(f),h.rollingPageX.length>3&&(h.rollingPageX.shift(),h.rollingPageY.shift(),h.rollingTimestamps.shift()),h.rollingPageX.push(c.pageX),h.rollingPageY.push(c.pageY),h.rollingTimestamps.push(s)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Pa.SCROLL_FRICTION=-.005,Pa.HOLD_DELAY=700,Pa.CLEAR_TAP_COUNT_TIME=400,Rt([m5],Pa,"isTouchDevice",1);var p5=Pa,Yp=class extends We{onclick(e,t){this._register(He(e,Zt.CLICK,s=>t(new Wc(Bi(e),s))))}onmousedown(e,t){this._register(He(e,Zt.MOUSE_DOWN,s=>t(new Wc(Bi(e),s))))}onmouseover(e,t){this._register(He(e,Zt.MOUSE_OVER,s=>t(new Wc(Bi(e),s))))}onmouseleave(e,t){this._register(He(e,Zt.MOUSE_LEAVE,s=>t(new Wc(Bi(e),s))))}onkeydown(e,t){this._register(He(e,Zt.KEY_DOWN,s=>t(new ZS(s))))}onkeyup(e,t){this._register(He(e,Zt.KEY_UP,s=>t(new ZS(s))))}oninput(e,t){this._register(He(e,Zt.INPUT,t))}onblur(e,t){this._register(He(e,Zt.BLUR,t))}onfocus(e,t){this._register(He(e,Zt.FOCUS,t))}onchange(e,t){this._register(He(e,Zt.CHANGE,t))}ignoreGesture(e){return p5.ignoreTarget(e)}},sb=11,g5=class extends Yp{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=sb+"px",this.domNode.style.height=sb+"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 ew),this._register(nb(this.bgDomNode,Zt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(nb(this.domNode,Zt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new h5),this._pointerdownScheduleRepeatTimer=this._register(new $p)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Bi(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,s=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},_5=class Im{constructor(t,s,r,a,c,h,f){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(s=s|0,r=r|0,a=a|0,c=c|0,h=h|0,f=f|0),this.rawScrollLeft=a,this.rawScrollTop=f,s<0&&(s=0),a+s>r&&(a=r-s),a<0&&(a=0),c<0&&(c=0),f+c>h&&(f=h-c),f<0&&(f=0),this.width=s,this.scrollWidth=r,this.scrollLeft=a,this.height=c,this.scrollHeight=h,this.scrollTop=f}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,s){return new Im(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,s?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,s?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new Im(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,s){let r=this.width!==t.width,a=this.scrollWidth!==t.scrollWidth,c=this.scrollLeft!==t.scrollLeft,h=this.height!==t.height,f=this.scrollHeight!==t.scrollHeight,g=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:s,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:a,scrollLeftChanged:c,heightChanged:h,scrollHeightChanged:f,scrollTopChanged:g}}},v5=class extends We{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new be),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new _5(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){let s=this._state.withScrollDimensions(e,t);this._setState(s,!!this._smoothScrolling),this._smoothScrolling?.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 s=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===s.scrollLeft&&this._smoothScrolling.to.scrollTop===s.scrollTop)return;let r;t?r=new lb(this._smoothScrolling.from,s,this._smoothScrolling.startTime,this._smoothScrolling.duration):r=this._smoothScrolling.combine(this._state,s,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let s=this._state.withScrollPosition(e);this._smoothScrolling=lb.start(this._state,s,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 s=this._state;s.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(s,t)))}},rb=class{constructor(e,t,s){this.scrollLeft=e,this.scrollTop=t,this.isDone=s}};function Kf(e,t){let s=t-e;return function(r){return e+s*b5(r)}}function y5(e,t,s){return function(r){return r<s?e(r/s):t((r-s)/(1-s))}}var lb=class Um{constructor(t,s,r,a){this.from=t,this.to=s,this.duration=a,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,s,r){if(Math.abs(t-s)>2.5*r){let a,c;return t<s?(a=t+.75*r,c=s-.75*r):(a=t-.75*r,c=s+.75*r),y5(Kf(t,a),Kf(c,s),.33)}return Kf(t,s)}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 s=(t-this.startTime)/this.duration;if(s<1){let r=this.scrollLeft(s),a=this.scrollTop(s);return new rb(r,a,!1)}return new rb(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,s,r){return Um.start(t,s,r)}static start(t,s,r){r=r+10;let a=Date.now()-10;return new Um(t,s,a,r)}};function S5(e){return Math.pow(e,3)}function b5(e){return 1-S5(1-e)}var x5=class extends We{constructor(e,t,s){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=s,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new $p)}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(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?" fade":"")))}},w5=140,tw=class extends Yp{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 x5(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new ew),this._shouldRender=!0,this.domNode=Xa(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(He(this.domNode.domNode,Zt.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new g5(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,s,r){this.slider=Xa(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof s=="number"&&this.slider.setWidth(s),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(He(this.slider.domNode,Zt.POINTER_DOWN,a=>{a.button===0&&(a.preventDefault(),this._sliderPointerDown(a))})),this.onclick(this.slider.domNode,a=>{a.leftButton&&a.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,s=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),a=this._sliderPointerPosition(e);s<=a&&a<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,s;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,s=e.offsetY;else{let a=d5(this.domNode.domNode);t=e.pageX-a.left,s=e.pageY-a.top}let r=this._pointerDownRelativePosition(t,s);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),s=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,a=>{let c=this._sliderOrthogonalPointerPosition(a),h=Math.abs(c-s);if(G1&&h>w5){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let f=this._sliderPointerPosition(a)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(f))},()=>{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()}},nw=class Pm{constructor(t,s,r,a,c,h){this._scrollbarSize=Math.round(s),this._oppositeScrollbarSize=Math.round(r),this._arrowSize=Math.round(t),this._visibleSize=a,this._scrollSize=c,this._scrollPosition=h,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Pm(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let s=Math.round(t);return this._visibleSize!==s?(this._visibleSize=s,this._refreshComputedValues(),!0):!1}setScrollSize(t){let s=Math.round(t);return this._scrollSize!==s?(this._scrollSize=s,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let s=Math.round(t);return this._scrollPosition!==s?(this._scrollPosition=s,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,s,r,a,c){let h=Math.max(0,r-t),f=Math.max(0,h-2*s),g=a>0&&a>r;if(!g)return{computedAvailableSize:Math.round(h),computedIsNeeded:g,computedSliderSize:Math.round(f),computedSliderRatio:0,computedSliderPosition:0};let p=Math.round(Math.max(20,Math.floor(r*f/a))),v=(f-p)/(a-r),_=c*v;return{computedAvailableSize:Math.round(h),computedIsNeeded:g,computedSliderSize:Math.round(p),computedSliderRatio:v,computedSliderPosition:Math.round(_)}}_refreshComputedValues(){let t=Pm._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 s=t-this._arrowSize-this._computedSliderSize/2;return Math.round(s/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let s=t-this._arrowSize,r=this._scrollPosition;return s<this._computedSliderPosition?r-=this._visibleSize:r+=this._visibleSize,r}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let s=this._computedSliderPosition+t;return Math.round(s/this._computedSliderRatio)}},C5=class extends tw{constructor(e,t,s){let r=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:s,scrollbarState:new nw(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,a.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}},k5=class extends tw{constructor(e,t,s){let r=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:s,scrollbarState:new nw(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,a.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}},N5=500,ab=50,E5=class{constructor(e,t,s){this.timestamp=e,this.deltaX=t,this.deltaY=s,this.score=0}},qm=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,s=0,r=1,a=this._rear;do{let c=a===this._front?t:Math.pow(2,-r);if(t-=c,s+=this._memory[a].score*c,a===this._front)break;a=(this._capacity+a-1)%this._capacity,r++}while(!0);return s<=.5}acceptStandardWheelEvent(t){if(qp){let s=Bi(t.browserEvent),r=H4(s);this.accept(Date.now(),t.deltaX*r,t.deltaY*r)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,s,r){let a=null,c=new E5(t,s,r);this._front===-1&&this._rear===-1?(this._memory[0]=c,this._front=0,this._rear=0):(a=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]=c),c.score=this._computeScore(c,a)}_computeScore(t,s){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),s){let a=Math.abs(t.deltaX),c=Math.abs(t.deltaY),h=Math.abs(s.deltaX),f=Math.abs(s.deltaY),g=Math.max(Math.min(a,h),1),p=Math.max(Math.min(c,f),1),v=Math.max(a,h),_=Math.max(c,f);v%g===0&&_%p===0&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};qm.INSTANCE=new qm;var j5=qm,T5=class extends Yp{constructor(e,t,s){super(),this._onScroll=this._register(new be),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new be),this.onWillScroll=this._onWillScroll.event,this._options=M5(t),this._scrollable=s,this._register(this._scrollable.onScroll(a=>{this._onWillScroll.fire(a),this._onDidScroll(a),this._onScroll.fire(a)}));let r={onMouseWheel:a=>this._onMouseWheel(a),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new k5(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new C5(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=Xa(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Xa(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Xa(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,a=>this._onMouseOver(a)),this.onmouseleave(this._listenOnDomNode,a=>this._onMouseLeave(a)),this._hideTimeout=this._register(new $p),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Nr(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,Li&&(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 eb(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Nr(this._mouseWheelToDispose),e)){let t=s=>{this._onMouseWheel(new eb(s))};this._mouseWheelToDispose.push(He(this._listenOnDomNode,Zt.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=j5.INSTANCE;t.acceptStandardWheelEvent(e);let s=!1;if(e.deltaY||e.deltaX){let a=e.deltaY*this._options.mouseWheelScrollSensitivity,c=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&c+a===0?c=a=0:Math.abs(a)>=Math.abs(c)?c=0:a=0),this._options.flipAxes&&([a,c]=[c,a]);let h=!Li&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||h)&&!c&&(c=a,a=0),e.browserEvent&&e.browserEvent.altKey&&(c=c*this._options.fastScrollSensitivity,a=a*this._options.fastScrollSensitivity);let f=this._scrollable.getFutureScrollPosition(),g={};if(a){let p=ab*a,v=f.scrollTop-(p<0?Math.floor(p):Math.ceil(p));this._verticalScrollbar.writeScrollPosition(g,v)}if(c){let p=ab*c,v=f.scrollLeft-(p<0?Math.floor(p):Math.ceil(p));this._horizontalScrollbar.writeScrollPosition(g,v)}g=this._scrollable.validateScrollPosition(g),(f.scrollLeft!==g.scrollLeft||f.scrollTop!==g.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(g):this._scrollable.setScrollPositionNow(g),s=!0)}let r=s;!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,s=e.scrollLeft>0,r=s?" left":"",a=t?" top":"",c=s||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${a}`),this._topLeftShadowDomNode.setClassName(`shadow${c}${a}${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(),N5)}},D5=class extends T5{constructor(e,t,s){super(e,t,s)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function M5(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,Li&&(t.className+=" mac"),t}var Fm=class extends We{constructor(e,t,s,r,a,c,h,f){super(),this._bufferService=s,this._optionsService=h,this._renderService=f,this._onRequestScrollLines=this._register(new be),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let g=this._register(new v5({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:p=>Vp(r.window,p)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{g.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new D5(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},g)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(a.onProtocolChange(p=>{this._scrollableElement.updateOptions({handleMouseWheel:!(p&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(fn.runAndSubscribe(c.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=c.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Ct(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Ct(()=>this._styleElement.remove())),this._register(fn.runAndSubscribe(c.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${c.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${c.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${c.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
55
|
+
`)})),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(p=>this._handleScroll(p)))}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(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.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),s=t-this._bufferService.buffer.ydisp;s!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(s)),this._isHandlingScroll=!1}};Fm=Rt([Ee(2,Cn),Ee(3,ls),Ee(4,L1),Ee(5,Rl),Ee(6,kn),Ee(7,as)],Fm);var $m=class extends We{constructor(e,t,s,r,a){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=s,this._decorationService=r,this._renderService=a,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(c=>this._removeDecoration(c))),this._register(Ct(()=>{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){let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",e?.options?.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 s=e.options.x??0;return s&&s>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 s=this._decorationElements.get(e);s||(s=this._createElement(e),e.element=s,this._decorationElements.set(e,s),this._container.appendChild(s),e.onDispose(()=>{this._decorationElements.delete(e),s.remove()})),s.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(s.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,s.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,s.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,s.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(s)}}_refreshXPosition(e,t=e.element){if(!t)return;let s=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=s?`${s*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=s?`${s*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};$m=Rt([Ee(1,Cn),Ee(2,ls),Ee(3,oo),Ee(4,as)],$m);var A5=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,s){return t>=e.startBufferLine-this._linePadding[s||"full"]&&t<=e.endBufferLine+this._linePadding[s||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Ti={full:0,left:0,center:0,right:0},zs={full:0,left:0,center:0,right:0},Oa={full:0,left:0,center:0,right:0},Su=class extends We{constructor(e,t,s,r,a,c,h,f){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=s,this._decorationService=r,this._renderService=a,this._optionsService=c,this._themeService=h,this._coreBrowserService=f,this._colorZoneStore=new A5,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(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(Ct(()=>this._canvas?.remove()));let g=this._canvas.getContext("2d");if(g)this._ctx=g;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(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);zs.full=this._canvas.width,zs.left=e,zs.center=t,zs.right=e,this._refreshDrawHeightConstants(),Oa.full=1,Oa.left=1,Oa.center=1+zs.left,Oa.right=1+zs.left+zs.center}_refreshDrawHeightConstants(){Ti.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);Ti.left=t,Ti.center=t,Ti.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ti.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ti.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ti.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ti.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(Oa[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Ti[e.position||"full"]/2),zs[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Ti[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}))}};Su=Rt([Ee(2,Cn),Ee(3,oo),Ee(4,as),Ee(5,kn),Ee(6,Rl),Ee(7,ls)],Su);var pe;(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=`
|
|
56
|
+
`,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=""))(pe||={});var ou;(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=""))(ou||={});var iw;(e=>e.ST=`${pe.ESC}\\`)(iw||={});var Vm=class{constructor(e,t,s,r,a,c){this._textarea=e,this._compositionView=t,this._bufferService=s,this._optionsService=r,this._coreService=a,this._renderService=c,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 s;t.start+=this._dataAlreadySent.length,this._isComposing?s=this._textarea.value.substring(t.start,this._compositionPosition.start):s=this._textarea.value.substring(t.start),s.length>0&&this._coreService.triggerDataEvent(s,!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,s=t.replace(e,"");this._dataAlreadySent=s,t.length>e.length?this._coreService.triggerDataEvent(s,!0):t.length<e.length?this._coreService.triggerDataEvent(`${pe.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),s=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,a=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=a+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=s+"px",this._compositionView.style.lineHeight=s+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let c=this._compositionView.getBoundingClientRect();this._textarea.style.left=a+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(c.width,1)+"px",this._textarea.style.height=Math.max(c.height,1)+"px",this._textarea.style.lineHeight=c.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Vm=Rt([Ee(2,Cn),Ee(3,kn),Ee(4,Tr),Ee(5,as)],Vm);var Jt=0,en=0,tn=0,Mt=0,ob={css:"#00000000",rgba:0},Ft;(e=>{function t(a,c,h,f){return f!==void 0?`#${_r(a)}${_r(c)}${_r(h)}${_r(f)}`:`#${_r(a)}${_r(c)}${_r(h)}`}e.toCss=t;function s(a,c,h,f=255){return(a<<24|c<<16|h<<8|f)>>>0}e.toRgba=s;function r(a,c,h,f){return{css:e.toCss(a,c,h,f),rgba:e.toRgba(a,c,h,f)}}e.toColor=r})(Ft||={});var xt;(e=>{function t(g,p){if(Mt=(p.rgba&255)/255,Mt===1)return{css:p.css,rgba:p.rgba};let v=p.rgba>>24&255,_=p.rgba>>16&255,S=p.rgba>>8&255,y=g.rgba>>24&255,x=g.rgba>>16&255,w=g.rgba>>8&255;Jt=y+Math.round((v-y)*Mt),en=x+Math.round((_-x)*Mt),tn=w+Math.round((S-w)*Mt);let j=Ft.toCss(Jt,en,tn),N=Ft.toRgba(Jt,en,tn);return{css:j,rgba:N}}e.blend=t;function s(g){return(g.rgba&255)===255}e.isOpaque=s;function r(g,p,v){let _=cu.ensureContrastRatio(g.rgba,p.rgba,v);if(_)return Ft.toColor(_>>24&255,_>>16&255,_>>8&255)}e.ensureContrastRatio=r;function a(g){let p=(g.rgba|255)>>>0;return[Jt,en,tn]=cu.toChannels(p),{css:Ft.toCss(Jt,en,tn),rgba:p}}e.opaque=a;function c(g,p){return Mt=Math.round(p*255),[Jt,en,tn]=cu.toChannels(g.rgba),{css:Ft.toCss(Jt,en,tn,Mt),rgba:Ft.toRgba(Jt,en,tn,Mt)}}e.opacity=c;function h(g,p){return Mt=g.rgba&255,c(g,Mt*p/255)}e.multiplyOpacity=h;function f(g){return[g.rgba>>24&255,g.rgba>>16&255,g.rgba>>8&255]}e.toColorRGB=f})(xt||={});var jt;(e=>{let t,s;try{let a=document.createElement("canvas");a.width=1,a.height=1;let c=a.getContext("2d",{willReadFrequently:!0});c&&(t=c,t.globalCompositeOperation="copy",s=t.createLinearGradient(0,0,1,1))}catch{}function r(a){if(a.match(/#[\da-f]{3,8}/i))switch(a.length){case 4:return Jt=parseInt(a.slice(1,2).repeat(2),16),en=parseInt(a.slice(2,3).repeat(2),16),tn=parseInt(a.slice(3,4).repeat(2),16),Ft.toColor(Jt,en,tn);case 5:return Jt=parseInt(a.slice(1,2).repeat(2),16),en=parseInt(a.slice(2,3).repeat(2),16),tn=parseInt(a.slice(3,4).repeat(2),16),Mt=parseInt(a.slice(4,5).repeat(2),16),Ft.toColor(Jt,en,tn,Mt);case 7:return{css:a,rgba:(parseInt(a.slice(1),16)<<8|255)>>>0};case 9:return{css:a,rgba:parseInt(a.slice(1),16)>>>0}}let c=a.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(c)return Jt=parseInt(c[1]),en=parseInt(c[2]),tn=parseInt(c[3]),Mt=Math.round((c[5]===void 0?1:parseFloat(c[5]))*255),Ft.toColor(Jt,en,tn,Mt);if(!t||!s)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=s,t.fillStyle=a,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Jt,en,tn,Mt]=t.getImageData(0,0,1,1).data,Mt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Ft.toRgba(Jt,en,tn,Mt),css:a}}e.toColor=r})(jt||={});var wn;(e=>{function t(r){return s(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function s(r,a,c){let h=r/255,f=a/255,g=c/255,p=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),v=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4),_=g<=.03928?g/12.92:Math.pow((g+.055)/1.055,2.4);return p*.2126+v*.7152+_*.0722}e.relativeLuminance2=s})(wn||={});var cu;(e=>{function t(h,f){if(Mt=(f&255)/255,Mt===1)return f;let g=f>>24&255,p=f>>16&255,v=f>>8&255,_=h>>24&255,S=h>>16&255,y=h>>8&255;return Jt=_+Math.round((g-_)*Mt),en=S+Math.round((p-S)*Mt),tn=y+Math.round((v-y)*Mt),Ft.toRgba(Jt,en,tn)}e.blend=t;function s(h,f,g){let p=wn.relativeLuminance(h>>8),v=wn.relativeLuminance(f>>8);if(ns(p,v)<g){if(v<p){let y=r(h,f,g),x=ns(p,wn.relativeLuminance(y>>8));if(x<g){let w=a(h,f,g),j=ns(p,wn.relativeLuminance(w>>8));return x>j?y:w}return y}let _=a(h,f,g),S=ns(p,wn.relativeLuminance(_>>8));if(S<g){let y=r(h,f,g),x=ns(p,wn.relativeLuminance(y>>8));return S>x?_:y}return _}}e.ensureContrastRatio=s;function r(h,f,g){let p=h>>24&255,v=h>>16&255,_=h>>8&255,S=f>>24&255,y=f>>16&255,x=f>>8&255,w=ns(wn.relativeLuminance2(S,y,x),wn.relativeLuminance2(p,v,_));for(;w<g&&(S>0||y>0||x>0);)S-=Math.max(0,Math.ceil(S*.1)),y-=Math.max(0,Math.ceil(y*.1)),x-=Math.max(0,Math.ceil(x*.1)),w=ns(wn.relativeLuminance2(S,y,x),wn.relativeLuminance2(p,v,_));return(S<<24|y<<16|x<<8|255)>>>0}e.reduceLuminance=r;function a(h,f,g){let p=h>>24&255,v=h>>16&255,_=h>>8&255,S=f>>24&255,y=f>>16&255,x=f>>8&255,w=ns(wn.relativeLuminance2(S,y,x),wn.relativeLuminance2(p,v,_));for(;w<g&&(S<255||y<255||x<255);)S=Math.min(255,S+Math.ceil((255-S)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),x=Math.min(255,x+Math.ceil((255-x)*.1)),w=ns(wn.relativeLuminance2(S,y,x),wn.relativeLuminance2(p,v,_));return(S<<24|y<<16|x<<8|255)>>>0}e.increaseLuminance=a;function c(h){return[h>>24&255,h>>16&255,h>>8&255,h&255]}e.toChannels=c})(cu||={});function _r(e){let t=e.toString(16);return t.length<2?"0"+t:t}function ns(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var R5=class extends ao{constructor(e,t,s){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=s}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()]}},bu=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new ci}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 s=[],r=t.translateToString(!0),a=0,c=0,h=0,f=t.getFg(0),g=t.getBg(0);for(let p=0;p<t.getTrimmedLength();p++)if(t.loadCell(p,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==f||this._workCell.bg!==g){if(p-a>1){let v=this._getJoinedRanges(r,h,c,t,a);for(let _=0;_<v.length;_++)s.push(v[_])}a=p,h=c,f=this._workCell.fg,g=this._workCell.bg}c+=this._workCell.getChars().length||Us.length}if(this._bufferService.cols-a>1){let p=this._getJoinedRanges(r,h,c,t,a);for(let v=0;v<p.length;v++)s.push(p[v])}return s}_getJoinedRanges(e,t,s,r,a){let c=e.substring(t,s),h=[];try{h=this._characterJoiners[0].handler(c)}catch(f){console.error(f)}for(let f=1;f<this._characterJoiners.length;f++)try{let g=this._characterJoiners[f].handler(c);for(let p=0;p<g.length;p++)bu._mergeRanges(h,g[p])}catch(g){console.error(g)}return this._stringRangesToCellRanges(h,r,a),h}_stringRangesToCellRanges(e,t,s){let r=0,a=!1,c=0,h=e[r];if(h){for(let f=s;f<this._bufferService.cols;f++){let g=t.getWidth(f),p=t.getString(f).length||Us.length;if(g!==0){if(!a&&h[0]<=c&&(h[0]=f,a=!0),h[1]<=c){if(h[1]=f,h=e[++r],!h)break;h[0]<=c?(h[0]=f,a=!0):a=!1}c+=p}}h&&(h[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let s=!1;for(let r=0;r<e.length;r++){let a=e[r];if(s){if(t[1]<=a[0])return e[r-1][1]=t[1],e;if(t[1]<=a[1])return e[r-1][1]=Math.max(t[1],a[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=a[0])return e.splice(r,0,t),e;if(t[1]<=a[1])return a[0]=Math.min(t[0],a[0]),e;t[0]<a[1]&&(a[0]=Math.min(t[0],a[0]),s=!0);continue}}return s?e[e.length-1][1]=t[1]:e.push(t),e}};bu=Rt([Ee(0,Cn)],bu);function O5(e){return 57508<=e&&e<=57558}function B5(e){return 9472<=e&&e<=9631}function L5(e){return O5(e)||B5(e)}function z5(){return{css:{canvas:Xc(),cell:Xc()},device:{canvas:Xc(),cell:Xc(),char:{width:0,height:0,left:0,top:0}}}}function Xc(){return{width:0,height:0}}var Ym=class{constructor(e,t,s,r,a,c,h){this._document=e,this._characterJoinerService=t,this._optionsService=s,this._coreBrowserService=r,this._coreService=a,this._decorationService=c,this._themeService=h,this._workCell=new ci,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,s){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=s}createRow(e,t,s,r,a,c,h,f,g,p,v){let _=[],S=this._characterJoinerService.getJoinedCharacters(t),y=this._themeService.colors,x=e.getNoBgTrimmedLength();s&&x<c+1&&(x=c+1);let w,j=0,N="",M=0,T=0,O=0,U=0,z=!1,A=0,Y=!1,ue=0,P=0,J=[],G=p!==-1&&v!==-1;for(let L=0;L<x;L++){e.loadCell(L,this._workCell);let q=this._workCell.getWidth();if(q===0)continue;let F=!1,V=L>=P,Q=L,K=this._workCell;if(S.length>0&&L===S[0][0]&&V){let xe=S.shift(),Fe=this._isCellInSelection(xe[0],t);for(M=xe[0]+1;M<xe[1];M++)V&&=Fe===this._isCellInSelection(M,t);V&&=!s||c<xe[0]||c>=xe[1],V?(F=!0,K=new R5(this._workCell,e.translateToString(!0,xe[0],xe[1]),xe[1]-xe[0]),Q=xe[1]-1,q=K.getWidth()):P=xe[1]}let ge=this._isCellInSelection(L,t),D=s&&L===c,Ae=G&&L>=p&&L<=v,Se=!1;this._decorationService.forEachDecorationAtCell(L,t,void 0,xe=>{Se=!0});let R=K.getChars()||Us;if(R===" "&&(K.isUnderline()||K.isOverline())&&(R=" "),ue=q*f-g.get(R,K.isBold(),K.isItalic()),!w)w=this._document.createElement("span");else if(j&&(ge&&Y||!ge&&!Y&&K.bg===T)&&(ge&&Y&&y.selectionForeground||K.fg===O)&&K.extended.ext===U&&Ae===z&&ue===A&&!D&&!F&&!Se&&V){K.isInvisible()?N+=Us:N+=R,j++;continue}else j&&(w.textContent=N),w=this._document.createElement("span"),j=0,N="";if(T=K.bg,O=K.fg,U=K.extended.ext,z=Ae,A=ue,Y=ge,F&&c>=L&&c<=Q&&(c=L),!this._coreService.isCursorHidden&&D&&this._coreService.isCursorInitialized){if(J.push("xterm-cursor"),this._coreBrowserService.isFocused)h&&J.push("xterm-cursor-blink"),J.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(a)switch(a){case"outline":J.push("xterm-cursor-outline");break;case"block":J.push("xterm-cursor-block");break;case"bar":J.push("xterm-cursor-bar");break;case"underline":J.push("xterm-cursor-underline");break}}if(K.isBold()&&J.push("xterm-bold"),K.isItalic()&&J.push("xterm-italic"),K.isDim()&&J.push("xterm-dim"),K.isInvisible()?N=Us:N=K.getChars()||Us,K.isUnderline()&&(J.push(`xterm-underline-${K.extended.underlineStyle}`),N===" "&&(N=" "),!K.isUnderlineColorDefault()))if(K.isUnderlineColorRGB())w.style.textDecorationColor=`rgb(${ao.toColorRGB(K.getUnderlineColor()).join(",")})`;else{let xe=K.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&K.isBold()&&xe<8&&(xe+=8),w.style.textDecorationColor=y.ansi[xe].css}K.isOverline()&&(J.push("xterm-overline"),N===" "&&(N=" ")),K.isStrikethrough()&&J.push("xterm-strikethrough"),Ae&&(w.style.textDecoration="underline");let E=K.getFgColor(),ie=K.getFgColorMode(),ce=K.getBgColor(),fe=K.getBgColorMode(),ve=!!K.isInverse();if(ve){let xe=E;E=ce,ce=xe;let Fe=ie;ie=fe,fe=Fe}let Z,le,se=!1;this._decorationService.forEachDecorationAtCell(L,t,void 0,xe=>{xe.options.layer!=="top"&&se||(xe.backgroundColorRGB&&(fe=50331648,ce=xe.backgroundColorRGB.rgba>>8&16777215,Z=xe.backgroundColorRGB),xe.foregroundColorRGB&&(ie=50331648,E=xe.foregroundColorRGB.rgba>>8&16777215,le=xe.foregroundColorRGB),se=xe.options.layer==="top")}),!se&&ge&&(Z=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,ce=Z.rgba>>8&16777215,fe=50331648,se=!0,y.selectionForeground&&(ie=50331648,E=y.selectionForeground.rgba>>8&16777215,le=y.selectionForeground)),se&&J.push("xterm-decoration-top");let me;switch(fe){case 16777216:case 33554432:me=y.ansi[ce],J.push(`xterm-bg-${ce}`);break;case 50331648:me=Ft.toColor(ce>>16,ce>>8&255,ce&255),this._addStyle(w,`background-color:#${cb((ce>>>0).toString(16),"0",6)}`);break;default:ve?(me=y.foreground,J.push("xterm-bg-257")):me=y.background}switch(Z||K.isDim()&&(Z=xt.multiplyOpacity(me,.5)),ie){case 16777216:case 33554432:K.isBold()&&E<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(E+=8),this._applyMinimumContrast(w,me,y.ansi[E],K,Z,void 0)||J.push(`xterm-fg-${E}`);break;case 50331648:let xe=Ft.toColor(E>>16&255,E>>8&255,E&255);this._applyMinimumContrast(w,me,xe,K,Z,le)||this._addStyle(w,`color:#${cb(E.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(w,me,y.foreground,K,Z,le)||ve&&J.push("xterm-fg-257")}J.length&&(w.className=J.join(" "),J.length=0),!D&&!F&&!Se&&V?j++:w.textContent=N,ue!==this.defaultSpacing&&(w.style.letterSpacing=`${ue}px`),_.push(w),L=Q}return w&&j&&(w.textContent=N),_}_applyMinimumContrast(e,t,s,r,a,c){if(this._optionsService.rawOptions.minimumContrastRatio===1||L5(r.getCode()))return!1;let h=this._getContrastCache(r),f;if(!a&&!c&&(f=h.getColor(t.rgba,s.rgba)),f===void 0){let g=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);f=xt.ensureContrastRatio(a||t,c||s,g),h.setColor((a||t).rgba,(c||s).rgba,f??null)}return f?(this._addStyle(e,`color:${f.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 s=this._selectionStart,r=this._selectionEnd;return!s||!r?!1:this._columnSelectMode?s[0]<=r[0]?e>=s[0]&&t>=s[1]&&e<r[0]&&t<=r[1]:e<s[0]&&t>=s[1]&&e>=r[0]&&t<=r[1]:t>s[1]&&t<r[1]||s[1]===r[1]&&t===s[1]&&e>=s[0]&&e<r[0]||s[1]<r[1]&&t===r[1]&&e<r[0]||s[1]<r[1]&&t===s[1]&&e>=s[0]}};Ym=Rt([Ee(1,I1),Ee(2,kn),Ee(3,ls),Ee(4,Tr),Ee(5,oo),Ee(6,Rl)],Ym);function cb(e,t,s){for(;e.length<s;)e=t+e;return e}var H5=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 s=e.createElement("span");s.classList.add("xterm-char-measure-element");let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontWeight="bold";let a=e.createElement("span");a.classList.add("xterm-char-measure-element"),a.style.fontStyle="italic";let c=e.createElement("span");c.classList.add("xterm-char-measure-element"),c.style.fontWeight="bold",c.style.fontStyle="italic",this._measureElements=[s,r,a,c],this._container.appendChild(s),this._container.appendChild(r),this._container.appendChild(a),this._container.appendChild(c),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,s,r){e===this._font&&t===this._fontSize&&s===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=s,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${s}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${s}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,s){let r=0;if(!t&&!s&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let h=this._measure(e,0);return h>0&&(this._flat[r]=h),h}let a=e;t&&(a+="B"),s&&(a+="I");let c=this._holey.get(a);if(c===void 0){let h=0;t&&(h|=1),s&&(h|=2),c=this._measure(e,h),c>0&&this._holey.set(a,c)}return c}_measure(e,t){let s=this._measureElements[t];return s.textContent=e.repeat(32),s.offsetWidth/32}},I5=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,s,r=!1){if(this.selectionStart=t,this.selectionEnd=s,!t||!s||t[0]===s[0]&&t[1]===s[1]){this.clear();return}let a=e.buffers.active.ydisp,c=t[1]-a,h=s[1]-a,f=Math.max(c,0),g=Math.min(h,e.rows-1);if(f>=e.rows||g<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=c,this.viewportEndRow=h,this.viewportCappedStartRow=f,this.viewportCappedEndRow=g,this.startCol=t[0],this.endCol=s[0]}isCellSelected(e,t,s){return this.hasSelection?(s-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&s>=this.viewportCappedStartRow&&t<this.endCol&&s<=this.viewportCappedEndRow:t<this.startCol&&s>=this.viewportCappedStartRow&&t>=this.endCol&&s<=this.viewportCappedEndRow:s>this.viewportStartRow&&s<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&s===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportStartRow&&t>=this.startCol):!1}};function U5(){return new I5}var Wf="xterm-dom-renderer-owner-",ri="xterm-rows",Gc="xterm-fg-",ub="xterm-bg-",Ba="xterm-focus",Qc="xterm-selection",P5=1,Km=class extends We{constructor(e,t,s,r,a,c,h,f,g,p,v,_,S,y){super(),this._terminal=e,this._document=t,this._element=s,this._screenElement=r,this._viewportElement=a,this._helperContainer=c,this._linkifier2=h,this._charSizeService=g,this._optionsService=p,this._bufferService=v,this._coreService=_,this._coreBrowserService=S,this._themeService=y,this._terminalClass=P5++,this._rowElements=[],this._selectionRenderModel=U5(),this.onRequestRedraw=this._register(new be).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(ri),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(Qc),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=z5(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(x=>this._injectCss(x))),this._injectCss(this._themeService.colors),this._rowFactory=f.createInstance(Ym,document),this._element.classList.add(Wf+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(x=>this._handleLinkHover(x))),this._register(this._linkifier2.onHideLinkUnderline(x=>this._handleLinkLeave(x))),this._register(Ct(()=>{this._element.classList.remove(Wf+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new H5(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 s of this._rowElements)s.style.width=`${this.dimensions.css.canvas.width}px`,s.style.height=`${this.dimensions.css.cell.height}px`,s.style.lineHeight=`${this.dimensions.css.cell.height}px`,s.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${ri} 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} .${ri} { 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} .${ri} .xterm-dim { color: ${xt.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 s=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,a=`blink_block_${this._terminalClass}`;t+=`@keyframes ${s} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${a} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${ri}.${Ba} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${ri}.${Ba} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${ri}.${Ba} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${a} 1s step-end infinite;}${this._terminalSelector} .${ri} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${ri} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${ri} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${ri} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${ri} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Qc} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Qc} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Qc} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[c,h]of e.ansi.entries())t+=`${this._terminalSelector} .${Gc}${c} { color: ${h.css}; }${this._terminalSelector} .${Gc}${c}.xterm-dim { color: ${xt.multiplyOpacity(h,.5).css}; }${this._terminalSelector} .${ub}${c} { background-color: ${h.css}; }`;t+=`${this._terminalSelector} .${Gc}257 { color: ${xt.opaque(e.background).css}; }${this._terminalSelector} .${Gc}257.xterm-dim { color: ${xt.multiplyOpacity(xt.opaque(e.background),.5).css}; }${this._terminalSelector} .${ub}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 s=this._rowElements.length;s<=t;s++){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(Ba),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Ba),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,s){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,s),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,s),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,a=this._selectionRenderModel.viewportEndRow,c=this._selectionRenderModel.viewportCappedStartRow,h=this._selectionRenderModel.viewportCappedEndRow,f=this._document.createDocumentFragment();if(s){let g=e[0]>t[0];f.appendChild(this._createSelectionElement(c,g?t[0]:e[0],g?e[0]:t[0],h-c+1))}else{let g=r===c?e[0]:0,p=c===a?t[0]:this._bufferService.cols;f.appendChild(this._createSelectionElement(c,g,p));let v=h-c-1;if(f.appendChild(this._createSelectionElement(c+1,0,this._bufferService.cols,v)),c!==h){let _=a===h?t[0]:this._bufferService.cols;f.appendChild(this._createSelectionElement(h,0,_))}}this._selectionContainer.appendChild(f)}_createSelectionElement(e,t,s,r=1){let a=this._document.createElement("div"),c=t*this.dimensions.css.cell.width,h=this.dimensions.css.cell.width*(s-t);return c+h>this.dimensions.css.canvas.width&&(h=this.dimensions.css.canvas.width-c),a.style.height=`${r*this.dimensions.css.cell.height}px`,a.style.top=`${e*this.dimensions.css.cell.height}px`,a.style.left=`${c}px`,a.style.width=`${h}px`,a}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 s=this._bufferService.buffer,r=s.ybase+s.y,a=Math.min(s.x,this._bufferService.cols-1),c=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,h=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let g=e;g<=t;g++){let p=g+s.ydisp,v=this._rowElements[g],_=s.lines.get(p);if(!v||!_)break;v.replaceChildren(...this._rowFactory.createRow(_,p,p===r,h,f,a,c,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Wf}${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,s,r,a,c){s<0&&(e=0),r<0&&(t=0);let h=this._bufferService.rows-1;s=Math.max(Math.min(s,h),0),r=Math.max(Math.min(r,h),0),a=Math.min(a,this._bufferService.cols);let f=this._bufferService.buffer,g=f.ybase+f.y,p=Math.min(f.x,a-1),v=this._optionsService.rawOptions.cursorBlink,_=this._optionsService.rawOptions.cursorStyle,S=this._optionsService.rawOptions.cursorInactiveStyle;for(let y=s;y<=r;++y){let x=y+f.ydisp,w=this._rowElements[y],j=f.lines.get(x);if(!w||!j)break;w.replaceChildren(...this._rowFactory.createRow(j,x,x===g,_,S,p,v,this.dimensions.css.cell.width,this._widthCache,c?y===s?e:0:-1,c?(y===r?t:a)-1:-1))}}};Km=Rt([Ee(7,Ip),Ee(8,Bu),Ee(9,kn),Ee(10,Cn),Ee(11,Tr),Ee(12,ls),Ee(13,Rl)],Km);var Wm=class extends We{constructor(e,t,s){super(),this._optionsService=s,this.width=0,this.height=0,this._onCharSizeChange=this._register(new be),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new F5(this._optionsService))}catch{this._measureStrategy=this._register(new q5(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())}};Wm=Rt([Ee(2,kn)],Wm);var sw=class extends We{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)}},q5=class extends sw{constructor(e,t,s){super(),this._document=e,this._parentElement=t,this._optionsService=s,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}},F5=class extends sw{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}},$5=class extends We{constructor(e,t,s){super(),this._textarea=e,this._window=t,this.mainDocument=s,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new V5(this._window)),this._onDprChange=this._register(new be),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new be),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(fn.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(He(this._textarea,"focus",()=>this._isFocused=!0)),this._register(He(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}},V5=class extends We{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Dl),this._onDprChange=this._register(new be),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Ct(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=He(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.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)}},Y5=class extends We{constructor(){super(),this.linkProviders=[],this._register(Ct(()=>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 Kp(e,t,s){let r=s.getBoundingClientRect(),a=e.getComputedStyle(s),c=parseInt(a.getPropertyValue("padding-left")),h=parseInt(a.getPropertyValue("padding-top"));return[t.clientX-r.left-c,t.clientY-r.top-h]}function K5(e,t,s,r,a,c,h,f,g){if(!c)return;let p=Kp(e,t,s);if(p)return p[0]=Math.ceil((p[0]+(g?h/2:0))/h),p[1]=Math.ceil(p[1]/f),p[0]=Math.min(Math.max(p[0],1),r+(g?1:0)),p[1]=Math.min(Math.max(p[1],1),a),p}var Xm=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,s,r,a){return K5(window,e,t,s,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,a)}getMouseReportCoords(e,t){let s=Kp(window,e,t);if(this._charSizeService.hasValidSize)return s[0]=Math.min(Math.max(s[0],0),this._renderService.dimensions.css.canvas.width-1),s[1]=Math.min(Math.max(s[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(s[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(s[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(s[0]),y:Math.floor(s[1])}}};Xm=Rt([Ee(0,as),Ee(1,Bu)],Xm);var W5=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,s){this._rowCount=s,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=[]}},rw={};s4(rw,{getSafariVersion:()=>G5,isChromeOS:()=>cw,isFirefox:()=>lw,isIpad:()=>Q5,isIphone:()=>Z5,isLegacyEdge:()=>X5,isLinux:()=>Wp,isMac:()=>xu,isNode:()=>Lu,isSafari:()=>aw,isWindows:()=>ow});var Lu=typeof process<"u"&&"title"in process,co=Lu?"node":navigator.userAgent,uo=Lu?"node":navigator.platform,lw=co.includes("Firefox"),X5=co.includes("Edge"),aw=/^((?!chrome|android).)*safari/i.test(co);function G5(){if(!aw)return 0;let e=co.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var xu=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(uo),Q5=uo==="iPad",Z5=uo==="iPhone",ow=["Windows","Win16","Win32","WinCE"].includes(uo),Wp=uo.indexOf("Linux")>=0,cw=/\bCrOS\b/.test(co),uw=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,s=0,r=e.timeRemaining(),a=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),s=Math.max(t,s),a=e.timeRemaining(),s*1.5>a){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=a}this.clear()}},J5=class extends uw{_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())}}},eO=class extends uw{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},wu=!Lu&&"requestIdleCallback"in window?eO:J5,tO=class{constructor(){this._queue=new wu}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Gm=class extends We{constructor(e,t,s,r,a,c,h,f,g){super(),this._rowCount=e,this._optionsService=s,this._charSizeService=r,this._coreService=a,this._coreBrowserService=f,this._renderer=this._register(new Dl),this._pausedResizeTask=new tO,this._observerDisposable=this._register(new Dl),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 be),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new be),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new be),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new be),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new W5((p,v)=>this._renderRows(p,v),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new nO(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Ct(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(h.onResize(()=>this._fullRefresh())),this._register(h.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(c.onDecorationRegistered(()=>this._fullRefresh())),this._register(c.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(h.cols,h.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(h.buffer.y,h.buffer.y,!0))),this._register(g.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(p=>this._registerIntersectionObserver(p,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let s=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});s.observe(t),this._observerDisposable.value=Ct(()=>s.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,s=!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)),s||(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(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),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(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,s){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=s,this._renderer.value?.handleSelectionChanged(e,t,s)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};Gm=Rt([Ee(2,kn),Ee(3,Bu),Ee(4,Tr),Ee(5,oo),Ee(6,Cn),Ee(7,ls),Ee(8,Rl)],Gm);var nO=class{constructor(e,t,s){this._coreBrowserService=e,this._coreService=t,this._onTimeout=s,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 iO(e,t,s,r){let a=s.buffer.x,c=s.buffer.y;if(!s.buffer.hasScrollback)return lO(a,c,e,t,s,r)+zu(c,t,s,r)+aO(a,c,e,t,s,r);let h;if(c===t)return h=a>e?"D":"C",to(Math.abs(a-e),eo(h,r));h=c>t?"D":"C";let f=Math.abs(c-t),g=rO(c>t?e:a,s)+(f-1)*s.cols+1+sO(c>t?a:e);return to(g,eo(h,r))}function sO(e,t){return e-1}function rO(e,t){return t.cols-e}function lO(e,t,s,r,a,c){return zu(t,r,a,c).length===0?"":to(dw(e,t,e,t-Er(t,a),!1,a).length,eo("D",c))}function zu(e,t,s,r){let a=e-Er(e,s),c=t-Er(t,s),h=Math.abs(a-c)-oO(e,t,s);return to(h,eo(hw(e,t),r))}function aO(e,t,s,r,a,c){let h;zu(t,r,a,c).length>0?h=r-Er(r,a):h=t;let f=r,g=cO(e,t,s,r,a,c);return to(dw(e,h,s,f,g==="C",a).length,eo(g,c))}function oO(e,t,s){let r=0,a=e-Er(e,s),c=t-Er(t,s);for(let h=0;h<Math.abs(a-c);h++){let f=hw(e,t)==="A"?-1:1;s.buffer.lines.get(a+f*h)?.isWrapped&&r++}return r}function Er(e,t){let s=0,r=t.buffer.lines.get(e),a=r?.isWrapped;for(;a&&e>=0&&e<t.rows;)s++,r=t.buffer.lines.get(--e),a=r?.isWrapped;return s}function cO(e,t,s,r,a,c){let h;return zu(s,r,a,c).length>0?h=r-Er(r,a):h=t,e<s&&h<=r||e>=s&&h<r?"C":"D"}function hw(e,t){return e>t?"A":"B"}function dw(e,t,s,r,a,c){let h=e,f=t,g="";for(;(h!==s||f!==r)&&f>=0&&f<c.buffer.lines.length;)h+=a?1:-1,a&&h>c.cols-1?(g+=c.buffer.translateBufferLineToString(f,!1,e,h),h=0,e=0,f++):!a&&h<0&&(g+=c.buffer.translateBufferLineToString(f,!1,0,e+1),h=c.cols-1,e=h,f--);return g+c.buffer.translateBufferLineToString(f,!1,e,h)}function eo(e,t){let s=t?"O":"[";return pe.ESC+s+e}function to(e,t){e=Math.floor(e);let s="";for(let r=0;r<e;r++)s+=t;return s}var uO=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 hb(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 Xf=50,hO=15,dO=50,fO=500,mO=" ",pO=new RegExp(mO,"g"),Qm=class extends We{constructor(e,t,s,r,a,c,h,f,g){super(),this._element=e,this._screenElement=t,this._linkifier=s,this._bufferService=r,this._coreService=a,this._mouseService=c,this._optionsService=h,this._renderService=f,this._coreBrowserService=g,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new ci,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new be),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new be),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new be),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new be),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=p=>this._handleMouseMove(p),this._mouseUpListener=p=>this._handleMouseUp(p),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(p=>this._handleTrim(p)),this._register(this._bufferService.buffers.onBufferActivate(p=>this._handleBufferActivate(p))),this.enable(),this._model=new uO(this._bufferService),this._activeSelectionMode=0,this._register(Ct(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(p=>{p.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 s=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let a=e[0]<t[0]?e[0]:t[0],c=e[0]<t[0]?t[0]:e[0];for(let h=e[1];h<=t[1];h++){let f=s.translateBufferLineToString(h,!0,a,c);r.push(f)}}else{let a=e[1]===t[1]?t[0]:void 0;r.push(s.translateBufferLineToString(e[1],!0,e[0],a));for(let c=e[1]+1;c<=t[1]-1;c++){let h=s.lines.get(c),f=s.translateBufferLineToString(c,!0);h?.isWrapped?r[r.length-1]+=f:r.push(f)}if(e[1]!==t[1]){let c=s.lines.get(t[1]),h=s.translateBufferLineToString(t[1],!0,0,t[0]);c&&c.isWrapped?r[r.length-1]+=h:r.push(h)}}return r.map(a=>a.replace(pO," ")).join(ow?`\r
|
|
57
|
+
`:`
|
|
58
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Wp&&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),s=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!s||!r||!t?!1:this._areCoordsInSelection(t,s,r)}isCellInSelection(e,t){let s=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!s||!r?!1:this._areCoordsInSelection([e,t],s,r)}_areCoordsInSelection(e,t,s){return e[1]>t[1]&&e[1]<s[1]||t[1]===s[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<s[0]||t[1]<s[1]&&e[1]===s[1]&&e[0]<s[0]||t[1]<s[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let s=this._linkifier.currentLink?.link?.range;if(s)return this._model.selectionStart=[s.start.x-1,s.start.y-1],this._model.selectionStartLength=hb(s,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=Kp(this._coreBrowserService.window,e,this._screenElement)[1],s=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=s?0:(t>s&&(t-=s),t=Math.min(Math.max(t,-Xf),Xf),t/=Xf,t/Math.abs(t)+Math.round(t*(hO-1)))}shouldForceSelection(e){return xu?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(),dO)}_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&&!(xu&&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 s=this._bufferService.buffer;if(this._model.selectionEnd[1]<s.lines.length){let r=s.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<fO&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let s=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(s&&s[0]!==void 0&&s[1]!==void 0){let r=iO(s[0]-1,s[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,s=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!s){this._oldHasSelection&&this._fireOnSelectionChange(e,t,s);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,s)}_fireOnSelectionChange(e,t,s){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=s,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let s=t;for(let r=0;t>=r;r++){let a=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?s--:a>1&&t!==r&&(s+=a-1)}return s}setSelection(e,t,s){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=s,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,s=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let a=this._bufferService.buffer,c=a.lines.get(e[1]);if(!c)return;let h=a.translateBufferLineToString(e[1],!1),f=this._convertViewportColToCharacterIndex(c,e[0]),g=f,p=e[0]-f,v=0,_=0,S=0,y=0;if(h.charAt(f)===" "){for(;f>0&&h.charAt(f-1)===" ";)f--;for(;g<h.length&&h.charAt(g+1)===" ";)g++}else{let j=e[0],N=e[0];c.getWidth(j)===0&&(v++,j--),c.getWidth(N)===2&&(_++,N++);let M=c.getString(N).length;for(M>1&&(y+=M-1,g+=M-1);j>0&&f>0&&!this._isCharWordSeparator(c.loadCell(j-1,this._workCell));){c.loadCell(j-1,this._workCell);let T=this._workCell.getChars().length;this._workCell.getWidth()===0?(v++,j--):T>1&&(S+=T-1,f-=T-1),f--,j--}for(;N<c.length&&g+1<h.length&&!this._isCharWordSeparator(c.loadCell(N+1,this._workCell));){c.loadCell(N+1,this._workCell);let T=this._workCell.getChars().length;this._workCell.getWidth()===2?(_++,N++):T>1&&(y+=T-1,g+=T-1),g++,N++}}g++;let x=f+p-v+S,w=Math.min(this._bufferService.cols,g-f+v+_-S-y);if(!(!t&&h.slice(f,g).trim()==="")){if(s&&x===0&&c.getCodePoint(0)!==32){let j=a.lines.get(e[1]-1);if(j&&c.isWrapped&&j.getCodePoint(this._bufferService.cols-1)!==32){let N=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(N){let M=this._bufferService.cols-N.start;x-=M,w+=M}}}if(r&&x+w===this._bufferService.cols&&c.getCodePoint(this._bufferService.cols-1)!==32){let j=a.lines.get(e[1]+1);if(j?.isWrapped&&j.getCodePoint(0)!==32){let N=this._getWordAt([0,e[1]+1],!1,!1,!0);N&&(w+=N.length)}}return{start:x,length:w}}}_selectWordAt(e,t){let s=this._getWordAt(e,t);if(s){for(;s.start<0;)s.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[s.start,e[1]],this._model.selectionStartLength=s.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let s=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,s--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,s++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,s]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),s={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=hb(s,this._bufferService.cols)}};Qm=Rt([Ee(3,Cn),Ee(4,Tr),Ee(5,Up),Ee(6,kn),Ee(7,as),Ee(8,ls)],Qm);var db=class{constructor(){this._data={}}set(e,t,s){this._data[e]||(this._data[e]={}),this._data[e][t]=s}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},fb=class{constructor(){this._color=new db,this._css=new db}setCss(e,t,s){this._css.set(e,t,s)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,s){this._color.set(e,t,s)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Vt=Object.freeze((()=>{let e=[jt.toColor("#2e3436"),jt.toColor("#cc0000"),jt.toColor("#4e9a06"),jt.toColor("#c4a000"),jt.toColor("#3465a4"),jt.toColor("#75507b"),jt.toColor("#06989a"),jt.toColor("#d3d7cf"),jt.toColor("#555753"),jt.toColor("#ef2929"),jt.toColor("#8ae234"),jt.toColor("#fce94f"),jt.toColor("#729fcf"),jt.toColor("#ad7fa8"),jt.toColor("#34e2e2"),jt.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let s=0;s<216;s++){let r=t[s/36%6|0],a=t[s/6%6|0],c=t[s%6];e.push({css:Ft.toCss(r,a,c),rgba:Ft.toRgba(r,a,c)})}for(let s=0;s<24;s++){let r=8+s*10;e.push({css:Ft.toCss(r,r,r),rgba:Ft.toRgba(r,r,r)})}return e})()),Sr=jt.toColor("#ffffff"),qa=jt.toColor("#000000"),mb=jt.toColor("#ffffff"),pb=qa,La={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},gO=Sr,Zm=class extends We{constructor(e){super(),this._optionsService=e,this._contrastCache=new fb,this._halfContrastCache=new fb,this._onChangeColors=this._register(new be),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Sr,background:qa,cursor:mb,cursorAccent:pb,selectionForeground:void 0,selectionBackgroundTransparent:La,selectionBackgroundOpaque:xt.blend(qa,La),selectionInactiveBackgroundTransparent:La,selectionInactiveBackgroundOpaque:xt.blend(qa,La),scrollbarSliderBackground:xt.opacity(Sr,.2),scrollbarSliderHoverBackground:xt.opacity(Sr,.4),scrollbarSliderActiveBackground:xt.opacity(Sr,.5),overviewRulerBorder:Sr,ansi:Vt.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=pt(e.foreground,Sr),t.background=pt(e.background,qa),t.cursor=xt.blend(t.background,pt(e.cursor,mb)),t.cursorAccent=xt.blend(t.background,pt(e.cursorAccent,pb)),t.selectionBackgroundTransparent=pt(e.selectionBackground,La),t.selectionBackgroundOpaque=xt.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=pt(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=xt.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?pt(e.selectionForeground,ob):void 0,t.selectionForeground===ob&&(t.selectionForeground=void 0),xt.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=xt.opacity(t.selectionBackgroundTransparent,.3)),xt.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=xt.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=pt(e.scrollbarSliderBackground,xt.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=pt(e.scrollbarSliderHoverBackground,xt.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=pt(e.scrollbarSliderActiveBackground,xt.opacity(t.foreground,.5)),t.overviewRulerBorder=pt(e.overviewRulerBorder,gO),t.ansi=Vt.slice(),t.ansi[0]=pt(e.black,Vt[0]),t.ansi[1]=pt(e.red,Vt[1]),t.ansi[2]=pt(e.green,Vt[2]),t.ansi[3]=pt(e.yellow,Vt[3]),t.ansi[4]=pt(e.blue,Vt[4]),t.ansi[5]=pt(e.magenta,Vt[5]),t.ansi[6]=pt(e.cyan,Vt[6]),t.ansi[7]=pt(e.white,Vt[7]),t.ansi[8]=pt(e.brightBlack,Vt[8]),t.ansi[9]=pt(e.brightRed,Vt[9]),t.ansi[10]=pt(e.brightGreen,Vt[10]),t.ansi[11]=pt(e.brightYellow,Vt[11]),t.ansi[12]=pt(e.brightBlue,Vt[12]),t.ansi[13]=pt(e.brightMagenta,Vt[13]),t.ansi[14]=pt(e.brightCyan,Vt[14]),t.ansi[15]=pt(e.brightWhite,Vt[15]),e.extendedAnsi){let s=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<s;r++)t.ansi[r+16]=pt(e.extendedAnsi[r],Vt[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()}}};Zm=Rt([Ee(0,kn)],Zm);function pt(e,t){if(e!==void 0)try{return jt.toColor(e)}catch{}return t}var _O=class{constructor(...e){this._entries=new Map;for(let[t,s]of e)this.set(t,s)}set(e,t){let s=this._entries.get(e);return this._entries.set(e,t),s}forEach(e){for(let[t,s]of this._entries.entries())e(t,s)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},vO=class{constructor(){this._services=new _O,this._services.set(Ip,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let s=h4(e).sort((c,h)=>c.index-h.index),r=[];for(let c of s){let h=this._services.get(c.id);if(!h)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${c.id._id}.`);r.push(h)}let a=s.length>0?s[0].index:t.length;if(t.length!==a)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${a+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},yO={trace:0,debug:1,info:2,warn:3,error:4,off:5},SO="xterm.js: ",Jm=class extends We{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=yO[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,s){this._evalLazyOptionalParams(s),e.call(console,(this._optionsService.options.logger?"":SO)+t,...s)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};Jm=Rt([Ee(0,kn)],Jm);var gb=class extends We{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new be),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new be),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new be),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 s=0;s<Math.min(e,this.length);s++)t[s]=this._array[this._getCyclicIndex(s)];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,...s){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+s.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<s.length;r++)this._array[this._getCyclicIndex(e+r)]=s[r];if(s.length&&this.onInsertEmitter.fire({index:e,amount:s.length}),this._length+s.length>this._maxLength){let r=this._length+s.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}else this._length+=s.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,s){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+s<0)throw new Error("Cannot shift elements in list beyond index 0");if(s>0){for(let a=t-1;a>=0;a--)this.set(e+a+s,this.get(e+a));let r=e+t+s-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+s,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Ye=3,qt=Object.freeze(new ao),Zc=0,Gf=2,Fa=class fw{constructor(t,s,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Ye);let a=s||ci.fromCharData([0,A1,1,0]);for(let c=0;c<t;++c)this.setCell(c,a);this.length=t}get(t){let s=this._data[t*Ye+0],r=s&2097151;return[this._data[t*Ye+1],s&2097152?this._combined[t]:r?Is(r):"",s>>22,s&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r]}set(t,s){this._data[t*Ye+1]=s[0],s[1].length>1?(this._combined[t]=s[1],this._data[t*Ye+0]=t|2097152|s[2]<<22):this._data[t*Ye+0]=s[1].charCodeAt(0)|s[2]<<22}getWidth(t){return this._data[t*Ye+0]>>22}hasWidth(t){return this._data[t*Ye+0]&12582912}getFg(t){return this._data[t*Ye+1]}getBg(t){return this._data[t*Ye+2]}hasContent(t){return this._data[t*Ye+0]&4194303}getCodePoint(t){let s=this._data[t*Ye+0];return s&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):s&2097151}isCombined(t){return this._data[t*Ye+0]&2097152}getString(t){let s=this._data[t*Ye+0];return s&2097152?this._combined[t]:s&2097151?Is(s&2097151):""}isProtected(t){return this._data[t*Ye+2]&536870912}loadCell(t,s){return Zc=t*Ye,s.content=this._data[Zc+0],s.fg=this._data[Zc+1],s.bg=this._data[Zc+2],s.content&2097152&&(s.combinedData=this._combined[t]),s.bg&268435456&&(s.extended=this._extendedAttrs[t]),s}setCell(t,s){s.content&2097152&&(this._combined[t]=s.combinedData),s.bg&268435456&&(this._extendedAttrs[t]=s.extended),this._data[t*Ye+0]=s.content,this._data[t*Ye+1]=s.fg,this._data[t*Ye+2]=s.bg}setCellFromCodepoint(t,s,r,a){a.bg&268435456&&(this._extendedAttrs[t]=a.extended),this._data[t*Ye+0]=s|r<<22,this._data[t*Ye+1]=a.fg,this._data[t*Ye+2]=a.bg}addCodepointToCell(t,s,r){let a=this._data[t*Ye+0];a&2097152?this._combined[t]+=Is(s):a&2097151?(this._combined[t]=Is(a&2097151)+Is(s),a&=-2097152,a|=2097152):a=s|1<<22,r&&(a&=-12582913,a|=r<<22),this._data[t*Ye+0]=a}insertCells(t,s,r){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),s<this.length-t){let a=new ci;for(let c=this.length-t-s-1;c>=0;--c)this.setCell(t+s+c,this.loadCell(t+c,a));for(let c=0;c<s;++c)this.setCell(t+c,r)}else for(let a=t;a<this.length;++a)this.setCell(a,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(t,s,r){if(t%=this.length,s<this.length-t){let a=new ci;for(let c=0;c<this.length-t-s;++c)this.setCell(t+c,this.loadCell(t+s+c,a));for(let c=this.length-s;c<this.length;++c)this.setCell(c,r)}else for(let a=t;a<this.length;++a)this.setCell(a,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,s,r,a=!1){if(a){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,r),s<this.length&&this.getWidth(s-1)===2&&!this.isProtected(s)&&this.setCellFromCodepoint(s,0,1,r);t<s&&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),s<this.length&&this.getWidth(s-1)===2&&this.setCellFromCodepoint(s,0,1,r);t<s&&t<this.length;)this.setCell(t++,r)}resize(t,s){if(t===this.length)return this._data.length*4*Gf<this._data.buffer.byteLength;let r=t*Ye;if(t>this.length){if(this._data.buffer.byteLength>=r*4)this._data=new Uint32Array(this._data.buffer,0,r);else{let a=new Uint32Array(r);a.set(this._data),this._data=a}for(let a=this.length;a<t;++a)this.setCell(a,s)}else{this._data=this._data.subarray(0,r);let a=Object.keys(this._combined);for(let h=0;h<a.length;h++){let f=parseInt(a[h],10);f>=t&&delete this._combined[f]}let c=Object.keys(this._extendedAttrs);for(let h=0;h<c.length;h++){let f=parseInt(c[h],10);f>=t&&delete this._extendedAttrs[f]}}return this.length=t,r*4*Gf<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Gf<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,s=!1){if(s){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 s in t._combined)this._combined[s]=t._combined[s];this._extendedAttrs={};for(let s in t._extendedAttrs)this._extendedAttrs[s]=t._extendedAttrs[s];this.isWrapped=t.isWrapped}clone(){let t=new fw(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let s in this._combined)t._combined[s]=this._combined[s];for(let s in this._extendedAttrs)t._extendedAttrs[s]=this._extendedAttrs[s];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Ye+0]&4194303)return t+(this._data[t*Ye+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Ye+0]&4194303||this._data[t*Ye+2]&50331648)return t+(this._data[t*Ye+0]>>22);return 0}copyCellsFrom(t,s,r,a,c){let h=t._data;if(c)for(let g=a-1;g>=0;g--){for(let p=0;p<Ye;p++)this._data[(r+g)*Ye+p]=h[(s+g)*Ye+p];h[(s+g)*Ye+2]&268435456&&(this._extendedAttrs[r+g]=t._extendedAttrs[s+g])}else for(let g=0;g<a;g++){for(let p=0;p<Ye;p++)this._data[(r+g)*Ye+p]=h[(s+g)*Ye+p];h[(s+g)*Ye+2]&268435456&&(this._extendedAttrs[r+g]=t._extendedAttrs[s+g])}let f=Object.keys(t._combined);for(let g=0;g<f.length;g++){let p=parseInt(f[g],10);p>=s&&(this._combined[p-s+r]=t._combined[p])}}translateToString(t,s,r,a){s=s??0,r=r??this.length,t&&(r=Math.min(r,this.getTrimmedLength())),a&&(a.length=0);let c="";for(;s<r;){let h=this._data[s*Ye+0],f=h&2097151,g=h&2097152?this._combined[s]:f?Is(f):Us;if(c+=g,a)for(let p=0;p<g.length;++p)a.push(s);s+=h>>22||1}return a&&a.push(s),c}};function bO(e,t,s,r,a,c){let h=[];for(let f=0;f<e.length-1;f++){let g=f,p=e.get(++g);if(!p.isWrapped)continue;let v=[e.get(f)];for(;g<e.length&&p.isWrapped;)v.push(p),p=e.get(++g);if(!c&&r>=f&&r<g){f+=v.length-1;continue}let _=0,S=no(v,_,t),y=1,x=0;for(;y<v.length;){let j=no(v,y,t),N=j-x,M=s-S,T=Math.min(N,M);v[_].copyCellsFrom(v[y],x,S,T,!1),S+=T,S===s&&(_++,S=0),x+=T,x===j&&(y++,x=0),S===0&&_!==0&&v[_-1].getWidth(s-1)===2&&(v[_].copyCellsFrom(v[_-1],s-1,S++,1,!1),v[_-1].setCell(s-1,a))}v[_].replaceCells(S,s,a);let w=0;for(let j=v.length-1;j>0&&(j>_||v[j].getTrimmedLength()===0);j--)w++;w>0&&(h.push(f+v.length-w),h.push(w)),f+=v.length-1}return h}function xO(e,t){let s=[],r=0,a=t[r],c=0;for(let h=0;h<e.length;h++)if(a===h){let f=t[++r];e.onDeleteEmitter.fire({index:h-c,amount:f}),h+=f-1,c+=f,a=t[++r]}else s.push(h);return{layout:s,countRemoved:c}}function wO(e,t){let s=[];for(let r=0;r<t.length;r++)s.push(e.get(t[r]));for(let r=0;r<s.length;r++)e.set(r,s[r]);e.length=t.length}function CO(e,t,s){let r=[],a=e.map((g,p)=>no(e,p,t)).reduce((g,p)=>g+p),c=0,h=0,f=0;for(;f<a;){if(a-f<s){r.push(a-f);break}c+=s;let g=no(e,h,t);c>g&&(c-=g,h++);let p=e[h].getWidth(c-1)===2;p&&c--;let v=p?s-1:s;r.push(v),f+=v}return r}function no(e,t,s){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(s-1)&&e[t].getWidth(s-1)===1,a=e[t+1].getWidth(0)===2;return r&&a?s-1:s}var mw=class pw{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=pw._nextId++,this._onDispose=this.register(new be),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Nr(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};mw._nextId=1;var kO=mw,Kt={},br=Kt.B;Kt[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Kt.A={"#":"£"};Kt.B=void 0;Kt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Kt.C=Kt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Kt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Kt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Kt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Kt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Kt.E=Kt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Kt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Kt.H=Kt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Kt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var _b=4294967295,vb=class{constructor(e,t,s){this._hasScrollback=e,this._optionsService=t,this._bufferService=s,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=qt.clone(),this.savedCharset=br,this.markers=[],this._nullCell=ci.fromCharData([0,A1,1,0]),this._whitespaceCell=ci.fromCharData([0,Us,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new wu,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new gb(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 yu),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 yu),this._whitespaceCell}getBlankLine(e,t){return new Fa(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>_b?_b:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=qt);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 gb(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let s=this.getNullCell(qt),r=0,a=this._getCorrectBufferLength(t);if(a>this.lines.maxLength&&(this.lines.maxLength=a),this.lines.length>0){if(this._cols<e)for(let h=0;h<this.lines.length;h++)r+=+this.lines.get(h).resize(e,s);let c=0;if(this._rows<t)for(let h=this._rows;h<t;h++)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 Fa(e,s)):this.ybase>0&&this.lines.length<=this.ybase+this.y+c+1?(this.ybase--,c++,this.ydisp>0&&this.ydisp--):this.lines.push(new Fa(e,s)));else for(let h=this._rows;h>t;h--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(a<this.lines.maxLength){let h=this.lines.length-a;h>0&&(this.lines.trimStart(h),this.ybase=Math.max(this.ybase-h,0),this.ydisp=Math.max(this.ydisp-h,0),this.savedY=Math.max(this.savedY-h,0)),this.lines.maxLength=a}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),c&&(this.y+=c),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 c=0;c<this.lines.length;c++)r+=+this.lines.get(c).resize(e,s);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 s=this._optionsService.rawOptions.reflowCursorLine,r=bO(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(qt),s);if(r.length>0){let a=xO(this.lines,r);wO(this.lines,a.layout),this._reflowLargerAdjustViewport(e,t,a.countRemoved)}}_reflowLargerAdjustViewport(e,t,s){let r=this.getNullCell(qt),a=s;for(;a-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Fa(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-s,0)}_reflowSmaller(e,t){let s=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(qt),a=[],c=0;for(let h=this.lines.length-1;h>=0;h--){let f=this.lines.get(h);if(!f||!f.isWrapped&&f.getTrimmedLength()<=e)continue;let g=[f];for(;f.isWrapped&&h>0;)f=this.lines.get(--h),g.unshift(f);if(!s){let T=this.ybase+this.y;if(T>=h&&T<h+g.length)continue}let p=g[g.length-1].getTrimmedLength(),v=CO(g,this._cols,e),_=v.length-g.length,S;this.ybase===0&&this.y!==this.lines.length-1?S=Math.max(0,this.y-this.lines.maxLength+_):S=Math.max(0,this.lines.length-this.lines.maxLength+_);let y=[];for(let T=0;T<_;T++){let O=this.getBlankLine(qt,!0);y.push(O)}y.length>0&&(a.push({start:h+g.length+c,newLines:y}),c+=y.length),g.push(...y);let x=v.length-1,w=v[x];w===0&&(x--,w=v[x]);let j=g.length-_-1,N=p;for(;j>=0;){let T=Math.min(N,w);if(g[x]===void 0)break;if(g[x].copyCellsFrom(g[j],N-T,w-T,T,!0),w-=T,w===0&&(x--,w=v[x]),N-=T,N===0){j--;let O=Math.max(j,0);N=no(g,O,this._cols)}}for(let T=0;T<g.length;T++)v[T]<e&&g[T].setCell(v[T],r);let M=_-S;for(;M-- >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+c)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+_,this.ybase+t-1)}if(a.length>0){let h=[],f=[];for(let w=0;w<this.lines.length;w++)f.push(this.lines.get(w));let g=this.lines.length,p=g-1,v=0,_=a[v];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+c);let S=0;for(let w=Math.min(this.lines.maxLength-1,g+c-1);w>=0;w--)if(_&&_.start>p+S){for(let j=_.newLines.length-1;j>=0;j--)this.lines.set(w--,_.newLines[j]);w++,h.push({index:p+1,amount:_.newLines.length}),S+=_.newLines.length,_=a[++v]}else this.lines.set(w,f[p--]);let y=0;for(let w=h.length-1;w>=0;w--)h[w].index+=y,this.lines.onInsertEmitter.fire(h[w]),y+=h[w].amount;let x=Math.max(0,g+c-this.lines.maxLength);x>0&&this.lines.onTrimEmitter.fire(x)}}translateBufferLineToString(e,t,s=0,r){let a=this.lines.get(e);return a?a.translateToString(t,s,r):""}getWrappedRangeForLine(e){let t=e,s=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;s+1<this.lines.length&&this.lines.get(s+1).isWrapped;)s++;return{first:t,last:s}}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 kO(e);return this.markers.push(t),t.register(this.lines.onTrim(s=>{t.line-=s,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(s=>{t.line>=s.index&&(t.line+=s.amount)})),t.register(this.lines.onDelete(s=>{t.line>=s.index&&t.line<s.index+s.amount&&t.dispose(),t.line>s.index&&(t.line-=s.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},NO=class extends We{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new be),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 vb(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new vb(!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)}},gw=2,_w=1,ep=class extends We{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new be),this.onResize=this._onResize.event,this._onScroll=this._register(new be),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,gw),this.rows=Math.max(e.rawOptions.rows||0,_w),this.buffers=this._register(new NO(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let s=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:s,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let s=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=s.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let a=s.ybase+s.scrollTop,c=s.ybase+s.scrollBottom;if(s.scrollTop===0){let h=s.lines.isFull;c===s.lines.length-1?h?s.lines.recycle().copyFrom(r):s.lines.push(r.clone()):s.lines.splice(c+1,0,r.clone()),h?this.isUserScrolling&&(s.ydisp=Math.max(s.ydisp-1,0)):(s.ybase++,this.isUserScrolling||s.ydisp++)}else{let h=c-a+1;s.lines.shiftElements(a+1,h-1,-1),s.lines.set(c,r.clone())}this.isUserScrolling||(s.ydisp=s.ybase),this._onScroll.fire(s.ydisp)}scrollLines(e,t){let s=this.buffer;if(e<0){if(s.ydisp===0)return;this.isUserScrolling=!0}else e+s.ydisp>=s.ybase&&(this.isUserScrolling=!1);let r=s.ydisp;s.ydisp=Math.max(Math.min(s.ydisp+e,s.ybase),0),r!==s.ydisp&&(t||this._onScroll.fire(s.ydisp))}};ep=Rt([Ee(0,kn)],ep);var bl={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:xu,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},EO=["normal","bold","100","200","300","400","500","600","700","800","900"],jO=class extends We{constructor(e){super(),this._onOptionChange=this._register(new be),this.onOptionChange=this._onOptionChange.event;let t={...bl};for(let s in e)if(s in t)try{let r=e[s];t[s]=this._sanitizeAndValidateOption(s,r)}catch(r){console.error(r)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(Ct(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(s=>{s===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(s=>{e.indexOf(s)!==-1&&t()})}_setupOptions(){let e=s=>{if(!(s in bl))throw new Error(`No option with key "${s}"`);return this.rawOptions[s]},t=(s,r)=>{if(!(s in bl))throw new Error(`No option with key "${s}"`);r=this._sanitizeAndValidateOption(s,r),this.rawOptions[s]!==r&&(this.rawOptions[s]=r,this._onOptionChange.fire(s))};for(let s in this.rawOptions){let r={get:e.bind(this,s),set:t.bind(this,s)};Object.defineProperty(this.options,s,r)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=bl[e]),!TO(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=bl[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=EO.includes(t)?t:bl[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 TO(e){return e==="block"||e==="underline"||e==="bar"}function $a(e,t=5){if(typeof e!="object")return e;let s=Array.isArray(e)?[]:{};for(let r in e)s[r]=t<=1?e[r]:e[r]&&$a(e[r],t-1);return s}var yb=Object.freeze({insertMode:!1}),Sb=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),tp=class extends We{constructor(e,t,s){super(),this._bufferService=e,this._logService=t,this._optionsService=s,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new be),this.onData=this._onData.event,this._onUserInput=this._register(new be),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new be),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new be),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=$a(yb),this.decPrivateModes=$a(Sb)}reset(){this.modes=$a(yb),this.decPrivateModes=$a(Sb)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let s=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&s.ybase!==s.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))}};tp=Rt([Ee(0,Cn),Ee(1,z1),Ee(2,kn)],tp);var bb={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 Qf(e,t){let s=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(s|=64,s|=e.action):(s|=e.button&3,e.button&4&&(s|=64),e.button&8&&(s|=128),e.action===32?s|=32:e.action===0&&!t&&(s|=3)),s}var Zf=String.fromCharCode,xb={DEFAULT:e=>{let t=[Qf(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Zf(t[0])}${Zf(t[1])}${Zf(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Qf(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Qf(e,!0)};${e.x};${e.y}${t}`}},np=class extends We{constructor(e,t,s){super(),this._bufferService=e,this._coreService=t,this._optionsService=s,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new be),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(bb))this.addProtocol(r,bb[r]);for(let r of Object.keys(xb))this.addEncoding(r,xb[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,s){if(e.deltaY===0||e.shiftKey||t===void 0||s===void 0)return 0;let r=t/s,a=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(a/=r+0,Math.abs(e.deltaY)<50&&(a*=.3),this._wheelPartialScroll+=a,a=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(a*=this._bufferService.rows),a}_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,s){if(s){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)}};np=Rt([Ee(0,Cn),Ee(1,Tr),Ee(2,kn)],np);var Jf=[[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]],DO=[[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]],Yt;function MO(e,t){let s=0,r=t.length-1,a;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=s;)if(a=s+r>>1,e>t[a][1])s=a+1;else if(e<t[a][0])r=a-1;else return!0;return!1}var AO=class{constructor(){if(this.version="6",!Yt){Yt=new Uint8Array(65536),Yt.fill(1),Yt[0]=0,Yt.fill(0,1,32),Yt.fill(0,127,160),Yt.fill(2,4352,4448),Yt[9001]=2,Yt[9002]=2,Yt.fill(2,11904,42192),Yt[12351]=1,Yt.fill(2,44032,55204),Yt.fill(2,63744,64256),Yt.fill(2,65040,65050),Yt.fill(2,65072,65136),Yt.fill(2,65280,65377),Yt.fill(2,65504,65511);for(let e=0;e<Jf.length;++e)Yt.fill(0,Jf[e][0],Jf[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Yt[e]:MO(e,DO)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let s=this.wcwidth(e),r=s===0&&t!==0;if(r){let a=xr.extractWidth(t);a===0?r=!1:a>s&&(s=a)}return xr.createPropertyValue(0,s,r)}},xr=class uu{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new be,this.onChange=this._onChange.event;let t=new AO;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,s,r=!1){return(t&16777215)<<3|(s&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 s=0,r=0,a=t.length;for(let c=0;c<a;++c){let h=t.charCodeAt(c);if(55296<=h&&h<=56319){if(++c>=a)return s+this.wcwidth(h);let p=t.charCodeAt(c);56320<=p&&p<=57343?h=(h-55296)*1024+p-56320+65536:s+=this.wcwidth(p)}let f=this.charProperties(h,r),g=uu.extractWidth(f);uu.extractShouldJoin(f)&&(g-=uu.extractWidth(r)),s+=g,r=f}return s}charProperties(t,s){return this._activeProvider.charProperties(t,s)}},RO=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 wb(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),s=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);s&&t&&(s.isWrapped=t[3]!==0&&t[3]!==32)}var za=2147483647,OO=256,vw=class ip{constructor(t=32,s=32){if(this.maxLength=t,this.maxSubParamsLength=s,s>OO)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(s),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let s=new ip;if(!t.length)return s;for(let r=Array.isArray(t[0])?1:0;r<t.length;++r){let a=t[r];if(Array.isArray(a))for(let c=0;c<a.length;++c)s.addSubParam(a[c]);else s.addParam(a)}return s}clone(){let t=new ip(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 s=0;s<this.length;++s){t.push(this.params[s]);let r=this._subParamsIdx[s]>>8,a=this._subParamsIdx[s]&255;a-r>0&&t.push(Array.prototype.slice.call(this._subParams,r,a))}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>za?za: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>za?za:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let s=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;return r-s>0?this._subParams.subarray(s,r):null}getSubParamsAll(){let t={};for(let s=0;s<this.length;++s){let r=this._subParamsIdx[s]>>8,a=this._subParamsIdx[s]&255;a-r>0&&(t[s]=this._subParams.slice(r,a))}return t}addDigit(t){let s;if(this._rejectDigits||!(s=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,a=r[s-1];r[s-1]=~a?Math.min(a*10+t,za):t}},Ha=[],BO=class{constructor(){this._state=0,this._active=Ha,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 s=this._handlers[e];return s.push(t),{dispose:()=>{let r=s.indexOf(t);r!==-1&&s.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=Ha}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=Ha,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Ha,!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,s){if(!this._active.length)this._handlerFb(this._id,"PUT",Ou(e,t,s));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,s)}start(){this.reset(),this._state=1}put(e,t,s){if(this._state!==3){if(this._state===1)for(;t<s;){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&&s-t>0&&this._put(e,t,s)}}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 s=!1,r=this._active.length-1,a=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,s=t,a=this._stack.fallThrough,this._stack.paused=!1),!a&&s===!1){for(;r>=0&&(s=this._active[r].end(e),s!==!0);r--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,s;r--}for(;r>=0;r--)if(s=this._active[r].end(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,s}this._active=Ha,this._id=-1,this._state=0}}},Yn=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,s){this._hitLimit||(this._data+=Ou(e,t,s),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(s=>(this._data="",this._hitLimit=!1,s));return this._data="",this._hitLimit=!1,t}},Ia=[],LO=class{constructor(){this._handlers=Object.create(null),this._active=Ia,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Ia}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let s=this._handlers[e];return s.push(t),{dispose:()=>{let r=s.indexOf(t);r!==-1&&s.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=Ia,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Ia,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let s=this._active.length-1;s>=0;s--)this._active[s].hook(t)}put(e,t,s){if(!this._active.length)this._handlerFb(this._ident,"PUT",Ou(e,t,s));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,s)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let s=!1,r=this._active.length-1,a=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,s=t,a=this._stack.fallThrough,this._stack.paused=!1),!a&&s===!1){for(;r>=0&&(s=this._active[r].unhook(e),s!==!0);r--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,s;r--}for(;r>=0;r--)if(s=this._active[r].unhook(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,s}this._active=Ia,this._ident=0}},Va=new vw;Va.addParam(0);var Cb=class{constructor(e){this._handler=e,this._data="",this._params=Va,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Va,this._data="",this._hitLimit=!1}put(e,t,s){this._hitLimit||(this._data+=Ou(e,t,s),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(s=>(this._params=Va,this._data="",this._hitLimit=!1,s));return this._params=Va,this._data="",this._hitLimit=!1,t}},zO=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,s,r){this.table[t<<8|e]=s<<4|r}addMany(e,t,s,r){for(let a=0;a<e.length;a++)this.table[t<<8|e[a]]=s<<4|r}},ai=160,HO=(function(){let e=new zO(4095),t=Array.apply(null,Array(256)).map((f,g)=>g),s=(f,g)=>t.slice(f,g),r=s(32,127),a=s(0,24);a.push(25),a.push.apply(a,s(28,32));let c=s(0,14),h;e.setDefault(1,0),e.addMany(r,0,2,0);for(h in c)e.addMany([24,26,153,154],h,3,0),e.addMany(s(128,144),h,3,0),e.addMany(s(144,152),h,3,0),e.add(156,h,0,0),e.add(27,h,11,1),e.add(157,h,4,8),e.addMany([152,158,159],h,0,7),e.add(155,h,11,3),e.add(144,h,11,9);return e.addMany(a,0,3,0),e.addMany(a,1,3,1),e.add(127,1,0,1),e.addMany(a,8,0,8),e.addMany(a,3,3,3),e.add(127,3,0,3),e.addMany(a,4,3,4),e.add(127,4,0,4),e.addMany(a,6,3,6),e.addMany(a,5,3,5),e.add(127,5,0,5),e.addMany(a,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(s(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(a,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(s(64,127),3,7,0),e.addMany(s(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(s(48,60),4,8,4),e.addMany(s(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(s(32,64),6,0,6),e.add(127,6,0,6),e.addMany(s(64,127),6,0,0),e.addMany(s(32,48),3,9,5),e.addMany(s(32,48),5,9,5),e.addMany(s(48,64),5,0,6),e.addMany(s(64,127),5,7,0),e.addMany(s(32,48),4,9,5),e.addMany(s(32,48),1,9,2),e.addMany(s(32,48),2,9,2),e.addMany(s(48,127),2,10,0),e.addMany(s(48,80),1,10,0),e.addMany(s(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(s(96,127),1,10,0),e.add(80,1,11,9),e.addMany(a,9,0,9),e.add(127,9,0,9),e.addMany(s(28,32),9,0,9),e.addMany(s(32,48),9,9,12),e.addMany(s(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(a,11,0,11),e.addMany(s(32,128),11,0,11),e.addMany(s(28,32),11,0,11),e.addMany(a,10,0,10),e.add(127,10,0,10),e.addMany(s(28,32),10,0,10),e.addMany(s(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(s(32,48),10,9,12),e.addMany(a,12,0,12),e.add(127,12,0,12),e.addMany(s(28,32),12,0,12),e.addMany(s(32,48),12,9,12),e.addMany(s(48,64),12,0,11),e.addMany(s(64,127),12,12,13),e.addMany(s(64,127),10,12,13),e.addMany(s(64,127),9,12,13),e.addMany(a,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(ai,0,2,0),e.add(ai,8,5,8),e.add(ai,6,0,6),e.add(ai,11,0,11),e.add(ai,13,13,13),e})(),IO=class extends We{constructor(e=HO){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 vw,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,s,r)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,s)=>{},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(Ct(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new BO),this._dcsParser=this._register(new LO),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let s=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(s=e.prefix.charCodeAt(0),s&&60>s||s>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 a=0;a<e.intermediates.length;++a){let c=e.intermediates.charCodeAt(a);if(32>c||c>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");s<<=8,s|=c}}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 s<<=8,s|=r,s}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 s=this._identifier(e,[48,126]);this._escHandlers[s]===void 0&&(this._escHandlers[s]=[]);let r=this._escHandlers[s];return r.push(t),{dispose:()=>{let a=r.indexOf(t);a!==-1&&r.splice(a,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 s=this._identifier(e);this._csiHandlers[s]===void 0&&(this._csiHandlers[s]=[]);let r=this._csiHandlers[s];return r.push(t),{dispose:()=>{let a=r.indexOf(t);a!==-1&&r.splice(a,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,s,r,a){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=s,this._parseStack.transition=r,this._parseStack.chunkPos=a}parse(e,t,s){let r=0,a=0,c=0,h;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,c=this._parseStack.chunkPos+1;else{if(s===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let f=this._parseStack.handlers,g=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(s===!1&&g>-1){for(;g>=0&&(h=f[g](this._params),h!==!0);g--)if(h instanceof Promise)return this._parseStack.handlerPos=g,h}this._parseStack.handlers=[];break;case 4:if(s===!1&&g>-1){for(;g>=0&&(h=f[g](),h!==!0);g--)if(h instanceof Promise)return this._parseStack.handlerPos=g,h}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],h=this._dcsParser.unhook(r!==24&&r!==26,s),h)return h;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],h=this._oscParser.end(r!==24&&r!==26,s),h)return h;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,c=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let f=c;f<t;++f){switch(r=e[f],a=this._transitions.table[this.currentState<<8|(r<160?r:ai)],a>>4){case 2:for(let S=f+1;;++S){if(S>=t||(r=e[S])<32||r>126&&r<ai){this._printHandler(e,f,S),f=S-1;break}if(++S>=t||(r=e[S])<32||r>126&&r<ai){this._printHandler(e,f,S),f=S-1;break}if(++S>=t||(r=e[S])<32||r>126&&r<ai){this._printHandler(e,f,S),f=S-1;break}if(++S>=t||(r=e[S])<32||r>126&&r<ai){this._printHandler(e,f,S),f=S-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:f,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let g=this._csiHandlers[this._collect<<8|r],p=g?g.length-1:-1;for(;p>=0&&(h=g[p](this._params),h!==!0);p--)if(h instanceof Promise)return this._preserveStack(3,g,p,a,f),h;p<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(++f<t&&(r=e[f])>47&&r<60);f--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let v=this._escHandlers[this._collect<<8|r],_=v?v.length-1:-1;for(;_>=0&&(h=v[_](),h!==!0);_--)if(h instanceof Promise)return this._preserveStack(4,v,_,a,f),h;_<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 S=f+1;;++S)if(S>=t||(r=e[S])===24||r===26||r===27||r>127&&r<ai){this._dcsParser.put(e,f,S),f=S-1;break}break;case 14:if(h=this._dcsParser.unhook(r!==24&&r!==26),h)return this._preserveStack(6,[],0,a,f),h;r===27&&(a|=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 S=f+1;;S++)if(S>=t||(r=e[S])<32||r>127&&r<ai){this._oscParser.put(e,f,S),f=S-1;break}break;case 6:if(h=this._oscParser.end(r!==24&&r!==26),h)return this._preserveStack(5,[],0,a,f),h;r===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=a&15}}},UO=/^([\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})$/,PO=/^[\da-f]+$/;function kb(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let s=UO.exec(t);if(s){let r=s[1]?15:s[4]?255:s[7]?4095:65535;return[Math.round(parseInt(s[1]||s[4]||s[7]||s[10],16)/r*255),Math.round(parseInt(s[2]||s[5]||s[8]||s[11],16)/r*255),Math.round(parseInt(s[3]||s[6]||s[9]||s[12],16)/r*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),PO.exec(t)&&[3,6,9,12].includes(t.length))){let s=t.length/3,r=[0,0,0];for(let a=0;a<3;++a){let c=parseInt(t.slice(s*a,s*a+s),16);r[a]=s===1?c<<4:s===2?c:s===3?c>>4:c>>8}return r}}function em(e,t){let s=e.toString(16),r=s.length<2?"0"+s:s;switch(t){case 4:return s[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function qO(e,t=16){let[s,r,a]=e;return`rgb:${em(s,t)}/${em(r,t)}/${em(a,t)}`}var FO={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Hs=131072,Nb=10;function Eb(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 jb=5e3,Tb=0,$O=class extends We{constructor(e,t,s,r,a,c,h,f,g=new IO){super(),this._bufferService=e,this._charsetService=t,this._coreService=s,this._logService=r,this._optionsService=a,this._oscLinkService=c,this._coreMouseService=h,this._unicodeService=f,this._parser=g,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new c4,this._utf8Decoder=new u4,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=qt.clone(),this._eraseAttrDataInternal=qt.clone(),this._onRequestBell=this._register(new be),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new be),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new be),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new be),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new be),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new be),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new be),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new be),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new be),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new be),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new be),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new be),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new be),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 sp(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(p=>this._activeBuffer=p.activeBuffer)),this._parser.setCsiHandlerFallback((p,v)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(p),params:v.toArray()})}),this._parser.setEscHandlerFallback(p=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(p)})}),this._parser.setExecuteHandlerFallback(p=>{this._logService.debug("Unknown EXECUTE code: ",{code:p})}),this._parser.setOscHandlerFallback((p,v,_)=>{this._logService.debug("Unknown OSC code: ",{identifier:p,action:v,data:_})}),this._parser.setDcsHandlerFallback((p,v,_)=>{v==="HOOK"&&(_=_.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(p),action:v,payload:_})}),this._parser.setPrintHandler((p,v,_)=>this.print(p,v,_)),this._parser.registerCsiHandler({final:"@"},p=>this.insertChars(p)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},p=>this.scrollLeft(p)),this._parser.registerCsiHandler({final:"A"},p=>this.cursorUp(p)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},p=>this.scrollRight(p)),this._parser.registerCsiHandler({final:"B"},p=>this.cursorDown(p)),this._parser.registerCsiHandler({final:"C"},p=>this.cursorForward(p)),this._parser.registerCsiHandler({final:"D"},p=>this.cursorBackward(p)),this._parser.registerCsiHandler({final:"E"},p=>this.cursorNextLine(p)),this._parser.registerCsiHandler({final:"F"},p=>this.cursorPrecedingLine(p)),this._parser.registerCsiHandler({final:"G"},p=>this.cursorCharAbsolute(p)),this._parser.registerCsiHandler({final:"H"},p=>this.cursorPosition(p)),this._parser.registerCsiHandler({final:"I"},p=>this.cursorForwardTab(p)),this._parser.registerCsiHandler({final:"J"},p=>this.eraseInDisplay(p,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},p=>this.eraseInDisplay(p,!0)),this._parser.registerCsiHandler({final:"K"},p=>this.eraseInLine(p,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},p=>this.eraseInLine(p,!0)),this._parser.registerCsiHandler({final:"L"},p=>this.insertLines(p)),this._parser.registerCsiHandler({final:"M"},p=>this.deleteLines(p)),this._parser.registerCsiHandler({final:"P"},p=>this.deleteChars(p)),this._parser.registerCsiHandler({final:"S"},p=>this.scrollUp(p)),this._parser.registerCsiHandler({final:"T"},p=>this.scrollDown(p)),this._parser.registerCsiHandler({final:"X"},p=>this.eraseChars(p)),this._parser.registerCsiHandler({final:"Z"},p=>this.cursorBackwardTab(p)),this._parser.registerCsiHandler({final:"`"},p=>this.charPosAbsolute(p)),this._parser.registerCsiHandler({final:"a"},p=>this.hPositionRelative(p)),this._parser.registerCsiHandler({final:"b"},p=>this.repeatPrecedingCharacter(p)),this._parser.registerCsiHandler({final:"c"},p=>this.sendDeviceAttributesPrimary(p)),this._parser.registerCsiHandler({prefix:">",final:"c"},p=>this.sendDeviceAttributesSecondary(p)),this._parser.registerCsiHandler({final:"d"},p=>this.linePosAbsolute(p)),this._parser.registerCsiHandler({final:"e"},p=>this.vPositionRelative(p)),this._parser.registerCsiHandler({final:"f"},p=>this.hVPosition(p)),this._parser.registerCsiHandler({final:"g"},p=>this.tabClear(p)),this._parser.registerCsiHandler({final:"h"},p=>this.setMode(p)),this._parser.registerCsiHandler({prefix:"?",final:"h"},p=>this.setModePrivate(p)),this._parser.registerCsiHandler({final:"l"},p=>this.resetMode(p)),this._parser.registerCsiHandler({prefix:"?",final:"l"},p=>this.resetModePrivate(p)),this._parser.registerCsiHandler({final:"m"},p=>this.charAttributes(p)),this._parser.registerCsiHandler({final:"n"},p=>this.deviceStatus(p)),this._parser.registerCsiHandler({prefix:"?",final:"n"},p=>this.deviceStatusPrivate(p)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},p=>this.softReset(p)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},p=>this.setCursorStyle(p)),this._parser.registerCsiHandler({final:"r"},p=>this.setScrollRegion(p)),this._parser.registerCsiHandler({final:"s"},p=>this.saveCursor(p)),this._parser.registerCsiHandler({final:"t"},p=>this.windowOptions(p)),this._parser.registerCsiHandler({final:"u"},p=>this.restoreCursor(p)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},p=>this.insertColumns(p)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},p=>this.deleteColumns(p)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},p=>this.selectProtected(p)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},p=>this.requestMode(p,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},p=>this.requestMode(p,!1)),this._parser.setExecuteHandler(pe.BEL,()=>this.bell()),this._parser.setExecuteHandler(pe.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(pe.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(pe.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(pe.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(pe.BS,()=>this.backspace()),this._parser.setExecuteHandler(pe.HT,()=>this.tab()),this._parser.setExecuteHandler(pe.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(pe.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(ou.IND,()=>this.index()),this._parser.setExecuteHandler(ou.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(ou.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Yn(p=>(this.setTitle(p),this.setIconName(p),!0))),this._parser.registerOscHandler(1,new Yn(p=>this.setIconName(p))),this._parser.registerOscHandler(2,new Yn(p=>this.setTitle(p))),this._parser.registerOscHandler(4,new Yn(p=>this.setOrReportIndexedColor(p))),this._parser.registerOscHandler(8,new Yn(p=>this.setHyperlink(p))),this._parser.registerOscHandler(10,new Yn(p=>this.setOrReportFgColor(p))),this._parser.registerOscHandler(11,new Yn(p=>this.setOrReportBgColor(p))),this._parser.registerOscHandler(12,new Yn(p=>this.setOrReportCursorColor(p))),this._parser.registerOscHandler(104,new Yn(p=>this.restoreIndexedColor(p))),this._parser.registerOscHandler(110,new Yn(p=>this.restoreFgColor(p))),this._parser.registerOscHandler(111,new Yn(p=>this.restoreBgColor(p))),this._parser.registerOscHandler(112,new Yn(p=>this.restoreCursorColor(p))),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 p in Kt)this._parser.registerEscHandler({intermediates:"(",final:p},()=>this.selectCharset("("+p)),this._parser.registerEscHandler({intermediates:")",final:p},()=>this.selectCharset(")"+p)),this._parser.registerEscHandler({intermediates:"*",final:p},()=>this.selectCharset("*"+p)),this._parser.registerEscHandler({intermediates:"+",final:p},()=>this.selectCharset("+"+p)),this._parser.registerEscHandler({intermediates:"-",final:p},()=>this.selectCharset("-"+p)),this._parser.registerEscHandler({intermediates:".",final:p},()=>this.selectCharset("."+p)),this._parser.registerEscHandler({intermediates:"/",final:p},()=>this.selectCharset("/"+p));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(p=>(this._logService.error("Parsing error: ",p),p)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new Cb((p,v)=>this.requestStatusString(p,v)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,s,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=s,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,s)=>setTimeout(()=>s("#SLOW_TIMEOUT"),jb))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${jb} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let s,r=this._activeBuffer.x,a=this._activeBuffer.y,c=0,h=this._parseStack.paused;if(h){if(s=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(s),s;r=this._parseStack.cursorStartX,a=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Hs&&(c=this._parseStack.position+Hs)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,p=>String.fromCharCode(p)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(p=>p.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Hs&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Hs))),h||this._dirtyRowTracker.clearRange(),e.length>Hs)for(let p=c;p<e.length;p+=Hs){let v=p+Hs<e.length?p+Hs:e.length,_=typeof e=="string"?this._stringDecoder.decode(e.substring(p,v),this._parseBuffer):this._utf8Decoder.decode(e.subarray(p,v),this._parseBuffer);if(s=this._parser.parse(this._parseBuffer,_))return this._preserveStack(r,a,_,p),this._logSlowResolvingAsync(s),s}else if(!h){let p=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(s=this._parser.parse(this._parseBuffer,p))return this._preserveStack(r,a,p,0),this._logSlowResolvingAsync(s),s}(this._activeBuffer.x!==r||this._activeBuffer.y!==a)&&this._onCursorMove.fire();let f=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),g=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);g<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(g,this._bufferService.rows-1),end:Math.min(f,this._bufferService.rows-1)})}print(e,t,s){let r,a,c=this._charsetService.charset,h=this._optionsService.rawOptions.screenReaderMode,f=this._bufferService.cols,g=this._coreService.decPrivateModes.wraparound,p=this._coreService.modes.insertMode,v=this._curAttrData,_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&s-t>0&&_.getWidth(this._activeBuffer.x-1)===2&&_.setCellFromCodepoint(this._activeBuffer.x-1,0,1,v);let S=this._parser.precedingJoinState;for(let y=t;y<s;++y){if(r=e[y],r<127&&c){let N=c[String.fromCharCode(r)];N&&(r=N.charCodeAt(0))}let x=this._unicodeService.charProperties(r,S);a=xr.extractWidth(x);let w=xr.extractShouldJoin(x),j=w?xr.extractWidth(S):0;if(S=x,h&&this._onA11yChar.fire(Is(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+a-j>f){if(g){let N=_,M=this._activeBuffer.x-j;for(this._activeBuffer.x=j,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),_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),j>0&&_ instanceof Fa&&_.copyCellsFrom(N,M,0,j,!1);M<f;)N.setCellFromCodepoint(M++,0,1,v)}else if(this._activeBuffer.x=f-1,a===2)continue}if(w&&this._activeBuffer.x){let N=_.getWidth(this._activeBuffer.x-1)?1:2;_.addCodepointToCell(this._activeBuffer.x-N,r,a);for(let M=a-j;--M>=0;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,v);continue}if(p&&(_.insertCells(this._activeBuffer.x,a-j,this._activeBuffer.getNullCell(v)),_.getWidth(f-1)===2&&_.setCellFromCodepoint(f-1,0,1,v)),_.setCellFromCodepoint(this._activeBuffer.x++,r,a,v),a>0)for(;--a;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,v)}this._parser.precedingJoinState=S,this._activeBuffer.x<f&&s-t>0&&_.getWidth(this._activeBuffer.x)===0&&!_.hasContent(this._activeBuffer.x)&&_.setCellFromCodepoint(this._activeBuffer.x,0,1,v),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,s=>Eb(s.params[0],this._optionsService.rawOptions.windowOptions)?t(s):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new Cb(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Yn(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(){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&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.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,s,r=!1,a=!1){let c=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);c.replaceCells(t,s,this._activeBuffer.getNullCell(this._eraseAttrData()),a),r&&(c.isWrapped=!1)}_resetBufferLine(e,t=!1){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s&&(s.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),s.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let s;switch(e.params[0]){case 0:for(s=this._activeBuffer.y,this._dirtyRowTracker.markDirty(s),this._eraseInBufferLine(s++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);s<this._bufferService.rows;s++)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(s);break;case 1:for(s=this._activeBuffer.y,this._dirtyRowTracker.markDirty(s),this._eraseInBufferLine(s,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(s+1).isWrapped=!1);s--;)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(s=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,s-1);s--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+s)?.getTrimmedLength(););for(;s>=0;s--)this._bufferService.scroll(this._eraseAttrData())}else{for(s=this._bufferService.rows,this._dirtyRowTracker.markDirty(s-1);s--;)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let r=this._activeBuffer.lines.length-this._bufferService.rows;r>0&&(this._activeBuffer.lines.trimStart(r),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-r,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-r,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 s=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,a=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(a-1,1),this._activeBuffer.lines.splice(s,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 s=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(s,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(qt));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 s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);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 s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);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 s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);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 s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);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 s=e.params[0]||1,r=xr.extractWidth(t),a=this._activeBuffer.x-r,c=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(a),h=new Uint32Array(c.length*s),f=0;for(let p=0;p<c.length;){let v=c.codePointAt(p)||0;h[f++]=v,p+=v>65535?2:1}let g=f;for(let p=1;p<s;++p)h.copyWithin(g,0,f),g+=f;return this.print(h,0,g),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(pe.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(pe.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(pe.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(pe.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(pe.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,br),this._charsetService.setgCharset(1,br),this._charsetService.setgCharset(2,br),this._charsetService.setgCharset(3,br);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){let s;(w=>(w[w.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",w[w.SET=1]="SET",w[w.RESET=2]="RESET",w[w.PERMANENTLY_SET=3]="PERMANENTLY_SET",w[w.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(s||={});let r=this._coreService.decPrivateModes,{activeProtocol:a,activeEncoding:c}=this._coreMouseService,h=this._coreService,{buffers:f,cols:g}=this._bufferService,{active:p,alt:v}=f,_=this._optionsService.rawOptions,S=(w,j)=>(h.triggerDataEvent(`${pe.ESC}[${t?"":"?"}${w};${j}$y`),!0),y=w=>w?1:2,x=e.params[0];return t?x===2?S(x,4):x===4?S(x,y(h.modes.insertMode)):x===12?S(x,3):x===20?S(x,y(_.convertEol)):S(x,0):x===1?S(x,y(r.applicationCursorKeys)):x===3?S(x,_.windowOptions.setWinLines?g===80?2:g===132?1:0:0):x===6?S(x,y(r.origin)):x===7?S(x,y(r.wraparound)):x===8?S(x,3):x===9?S(x,y(a==="X10")):x===12?S(x,y(_.cursorBlink)):x===25?S(x,y(!h.isCursorHidden)):x===45?S(x,y(r.reverseWraparound)):x===66?S(x,y(r.applicationKeypad)):x===67?S(x,4):x===1e3?S(x,y(a==="VT200")):x===1002?S(x,y(a==="DRAG")):x===1003?S(x,y(a==="ANY")):x===1004?S(x,y(r.sendFocus)):x===1005?S(x,4):x===1006?S(x,y(c==="SGR")):x===1015?S(x,4):x===1016?S(x,y(c==="SGR_PIXELS")):x===1048?S(x,1):x===47||x===1047||x===1049?S(x,y(p===v)):x===2004?S(x,y(r.bracketedPasteMode)):x===2026?S(x,y(r.synchronizedOutput)):S(x,0)}_updateAttrColor(e,t,s,r,a){return t===2?(e|=50331648,e&=-16777216,e|=ao.fromColorRGB([s,r,a])):t===5&&(e&=-50331904,e|=33554432|s&255),e}_extractColor(e,t,s){let r=[0,0,-1,0,0,0],a=0,c=0;do{if(r[c+a]=e.params[t+c],e.hasSubParams(t+c)){let h=e.getSubParams(t+c),f=0;do r[1]===5&&(a=1),r[c+f+1+a]=h[f];while(++f<h.length&&f+c+1+a<r.length);break}if(r[1]===5&&c+a>=2||r[1]===2&&c+a>=5)break;r[1]&&(a=1)}while(++c+t<e.length&&c+a<r.length);for(let h=2;h<r.length;++h)r[h]===-1&&(r[h]=0);switch(r[0]){case 38:s.fg=this._updateAttrColor(s.fg,r[1],r[3],r[4],r[5]);break;case 48:s.bg=this._updateAttrColor(s.bg,r[1],r[3],r[4],r[5]);break;case 58:s.extended=s.extended.clone(),s.extended.underlineColor=this._updateAttrColor(s.extended.underlineColor,r[1],r[3],r[4],r[5])}return c}_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=qt.fg,e.bg=qt.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,s,r=this._curAttrData;for(let a=0;a<t;a++)s=e.params[a],s>=30&&s<=37?(r.fg&=-50331904,r.fg|=16777216|s-30):s>=40&&s<=47?(r.bg&=-50331904,r.bg|=16777216|s-40):s>=90&&s<=97?(r.fg&=-50331904,r.fg|=16777216|s-90|8):s>=100&&s<=107?(r.bg&=-50331904,r.bg|=16777216|s-100|8):s===0?this._processSGR0(r):s===1?r.fg|=134217728:s===3?r.bg|=67108864:s===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(a)?e.getSubParams(a)[0]:1,r)):s===5?r.fg|=536870912:s===7?r.fg|=67108864:s===8?r.fg|=1073741824:s===9?r.fg|=2147483648:s===2?r.bg|=134217728:s===21?this._processUnderline(2,r):s===22?(r.fg&=-134217729,r.bg&=-134217729):s===23?r.bg&=-67108865:s===24?(r.fg&=-268435457,this._processUnderline(0,r)):s===25?r.fg&=-536870913:s===27?r.fg&=-67108865:s===28?r.fg&=-1073741825:s===29?r.fg&=2147483647:s===39?(r.fg&=-67108864,r.fg|=qt.fg&16777215):s===49?(r.bg&=-67108864,r.bg|=qt.bg&16777215):s===38||s===48||s===58?a+=this._extractColor(e,a,r):s===53?r.bg|=1073741824:s===55?r.bg&=-1073741825:s===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):s===100?(r.fg&=-67108864,r.fg|=qt.fg&16777215,r.bg&=-67108864,r.bg|=qt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",s);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${pe.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,s=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${pe.ESC}[${t};${s}R`);break}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let t=this._activeBuffer.y+1,s=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${pe.ESC}[?${t};${s}R`)}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=qt.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 s=t%2===1;this._coreService.decPrivateModes.cursorBlink=s}return!0}setScrollRegion(e){let t=e.params[0]||1,s;return(e.length<2||(s=e.params[1])>this._bufferService.rows||s===0)&&(s=this._bufferService.rows),s>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=s-1,this._setCursor(0,0)),!0}windowOptions(e){if(!Eb(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(`${pe.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Nb&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Nb&&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=[],s=e.split(";");for(;s.length>1;){let r=s.shift(),a=s.shift();if(/^\d+$/.exec(r)){let c=parseInt(r);if(Db(c))if(a==="?")t.push({type:0,index:c});else{let h=kb(a);h&&t.push({type:1,index:c,color:h})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let s=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(s,r):s.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let s=e.split(":"),r,a=s.findIndex(c=>c.startsWith("id="));return a!==-1&&(r=s[a].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 s=e.split(";");for(let r=0;r<s.length&&!(t>=this._specialColors.length);++r,++t)if(s[r]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let a=kb(s[r]);a&&this._onColor.fire([{type:1,index:this._specialColors[t],color:a}])}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=[],s=e.split(";");for(let r=0;r<s.length;++r)if(/^\d+$/.exec(s[r])){let a=parseInt(s[r]);Db(a)&&t.push({type:2,index:a})}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,br),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(FO[e[0]],Kt[e[1]]||br),!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=qt.clone(),this._eraseAttrDataInternal=qt.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 ci;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 s=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(s);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let s=h=>(this._coreService.triggerDataEvent(`${pe.ESC}${h}${pe.ESC}\\`),!0),r=this._bufferService.buffer,a=this._optionsService.rawOptions;return s(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}[a.cursorStyle]-(a.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},sp=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&&(Tb=e,e=t,t=Tb),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};sp=Rt([Ee(0,Cn)],sp);function Db(e){return 0<=e&&e<256}var VO=5e7,Mb=12,YO=50,KO=class extends We{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 be),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 s;for(;s=this._writeBuffer.shift();){this._action(s);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>VO)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 s=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let r=this._writeBuffer[this._bufferOffset],a=this._action(r,t);if(a){let h=f=>performance.now()-s>=Mb?setTimeout(()=>this._innerWrite(0,f)):this._innerWrite(s,f);a.catch(f=>(queueMicrotask(()=>{throw f}),Promise.resolve(!1))).then(h);return}let c=this._callbacks[this._bufferOffset];if(c&&c(),this._bufferOffset++,this._pendingData-=r.length,performance.now()-s>=Mb)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>YO&&(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()}},rp=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 f=t.addMarker(t.ybase+t.y),g={data:e,id:this._nextId++,lines:[f]};return f.onDispose(()=>this._removeMarkerFromLink(g,f)),this._dataByLinkId.set(g.id,g),g.id}let s=e,r=this._getEntryIdKey(s),a=this._entriesWithId.get(r);if(a)return this.addLineToLink(a.id,t.ybase+t.y),a.id;let c=t.addMarker(t.ybase+t.y),h={id:this._nextId++,key:this._getEntryIdKey(s),data:s,lines:[c]};return c.onDispose(()=>this._removeMarkerFromLink(h,c)),this._entriesWithId.set(h.key,h),this._dataByLinkId.set(h.id,h),h.id}addLineToLink(e,t){let s=this._dataByLinkId.get(e);if(s&&s.lines.every(r=>r.line!==t)){let r=this._bufferService.buffer.addMarker(t);s.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(s,r))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let s=e.lines.indexOf(t);s!==-1&&(e.lines.splice(s,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};rp=Rt([Ee(0,Cn)],rp);var Ab=!1,WO=class extends We{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Dl),this._onBinary=this._register(new be),this.onBinary=this._onBinary.event,this._onData=this._register(new be),this.onData=this._onData.event,this._onLineFeed=this._register(new be),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new be),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new be),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new be),this._instantiationService=new vO,this.optionsService=this._register(new jO(e)),this._instantiationService.setService(kn,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(ep)),this._instantiationService.setService(Cn,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Jm)),this._instantiationService.setService(z1,this._logService),this.coreService=this._register(this._instantiationService.createInstance(tp)),this._instantiationService.setService(Tr,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(np)),this._instantiationService.setService(L1,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(xr)),this._instantiationService.setService(m4,this.unicodeService),this._charsetService=this._instantiationService.createInstance(RO),this._instantiationService.setService(f4,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(rp),this._instantiationService.setService(H1,this._oscLinkService),this._inputHandler=this._register(new $O(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(fn.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(fn.forward(this._bufferService.onResize,this._onResize)),this._register(fn.forward(this.coreService.onData,this._onData)),this._register(fn.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 KO((t,s)=>this._inputHandler.parse(t,s))),this._register(fn.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new be),this._onScroll.event(e=>{this._onScrollApi?.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&&!Ab&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Ab=!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,gw),t=Math.max(t,_w),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(wb.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(wb(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Ct(()=>{for(let t of e)t.dispose()})}}},XO={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 GO(e,t,s,r){let a={type:0,cancel:!1,key:void 0},c=(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?a.key=pe.ESC+"OA":a.key=pe.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?a.key=pe.ESC+"OD":a.key=pe.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?a.key=pe.ESC+"OC":a.key=pe.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?a.key=pe.ESC+"OB":a.key=pe.ESC+"[B");break;case 8:a.key=e.ctrlKey?"\b":pe.DEL,e.altKey&&(a.key=pe.ESC+a.key);break;case 9:if(e.shiftKey){a.key=pe.ESC+"[Z";break}a.key=pe.HT,a.cancel=!0;break;case 13:a.key=e.altKey?pe.ESC+pe.CR:pe.CR,a.cancel=!0;break;case 27:a.key=pe.ESC,e.altKey&&(a.key=pe.ESC+pe.ESC),a.cancel=!0;break;case 37:if(e.metaKey)break;c?a.key=pe.ESC+"[1;"+(c+1)+"D":t?a.key=pe.ESC+"OD":a.key=pe.ESC+"[D";break;case 39:if(e.metaKey)break;c?a.key=pe.ESC+"[1;"+(c+1)+"C":t?a.key=pe.ESC+"OC":a.key=pe.ESC+"[C";break;case 38:if(e.metaKey)break;c?a.key=pe.ESC+"[1;"+(c+1)+"A":t?a.key=pe.ESC+"OA":a.key=pe.ESC+"[A";break;case 40:if(e.metaKey)break;c?a.key=pe.ESC+"[1;"+(c+1)+"B":t?a.key=pe.ESC+"OB":a.key=pe.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(a.key=pe.ESC+"[2~");break;case 46:c?a.key=pe.ESC+"[3;"+(c+1)+"~":a.key=pe.ESC+"[3~";break;case 36:c?a.key=pe.ESC+"[1;"+(c+1)+"H":t?a.key=pe.ESC+"OH":a.key=pe.ESC+"[H";break;case 35:c?a.key=pe.ESC+"[1;"+(c+1)+"F":t?a.key=pe.ESC+"OF":a.key=pe.ESC+"[F";break;case 33:e.shiftKey?a.type=2:e.ctrlKey?a.key=pe.ESC+"[5;"+(c+1)+"~":a.key=pe.ESC+"[5~";break;case 34:e.shiftKey?a.type=3:e.ctrlKey?a.key=pe.ESC+"[6;"+(c+1)+"~":a.key=pe.ESC+"[6~";break;case 112:c?a.key=pe.ESC+"[1;"+(c+1)+"P":a.key=pe.ESC+"OP";break;case 113:c?a.key=pe.ESC+"[1;"+(c+1)+"Q":a.key=pe.ESC+"OQ";break;case 114:c?a.key=pe.ESC+"[1;"+(c+1)+"R":a.key=pe.ESC+"OR";break;case 115:c?a.key=pe.ESC+"[1;"+(c+1)+"S":a.key=pe.ESC+"OS";break;case 116:c?a.key=pe.ESC+"[15;"+(c+1)+"~":a.key=pe.ESC+"[15~";break;case 117:c?a.key=pe.ESC+"[17;"+(c+1)+"~":a.key=pe.ESC+"[17~";break;case 118:c?a.key=pe.ESC+"[18;"+(c+1)+"~":a.key=pe.ESC+"[18~";break;case 119:c?a.key=pe.ESC+"[19;"+(c+1)+"~":a.key=pe.ESC+"[19~";break;case 120:c?a.key=pe.ESC+"[20;"+(c+1)+"~":a.key=pe.ESC+"[20~";break;case 121:c?a.key=pe.ESC+"[21;"+(c+1)+"~":a.key=pe.ESC+"[21~";break;case 122:c?a.key=pe.ESC+"[23;"+(c+1)+"~":a.key=pe.ESC+"[23~";break;case 123:c?a.key=pe.ESC+"[24;"+(c+1)+"~":a.key=pe.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?a.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?a.key=pe.NUL:e.keyCode>=51&&e.keyCode<=55?a.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?a.key=pe.DEL:e.keyCode===219?a.key=pe.ESC:e.keyCode===220?a.key=pe.FS:e.keyCode===221&&(a.key=pe.GS);else if((!s||r)&&e.altKey&&!e.metaKey){let h=XO[e.keyCode]?.[e.shiftKey?1:0];if(h)a.key=pe.ESC+h;else if(e.keyCode>=65&&e.keyCode<=90){let f=e.ctrlKey?e.keyCode-64:e.keyCode+32,g=String.fromCharCode(f);e.shiftKey&&(g=g.toUpperCase()),a.key=pe.ESC+g}else if(e.keyCode===32)a.key=pe.ESC+(e.ctrlKey?pe.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let f=e.code.slice(3,4);e.shiftKey||(f=f.toLowerCase()),a.key=pe.ESC+f,a.cancel=!0}}else s&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(a.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?a.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(a.key=pe.US),e.key==="@"&&(a.key=pe.NUL));break}return a}var Lt=0,QO=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new wu,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new wu,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((a,c)=>this._getKey(a)-this._getKey(c)),t=0,s=0,r=new Array(this._array.length+this._insertedValues.length);for(let a=0;a<r.length;a++)s>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[s])?(r[a]=e[t],t++):r[a]=this._array[s++];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||(Lt=this._search(t),Lt===-1)||this._getKey(this._array[Lt])!==t)return!1;do if(this._array[Lt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Lt),!0;while(++Lt<this._array.length&&this._getKey(this._array[Lt])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((a,c)=>a-c),t=0,s=new Array(this._array.length-e.length),r=0;for(let a=0;a<this._array.length;a++)e[t]===a?t++:s[r++]=this._array[a];this._array=s,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&&(Lt=this._search(e),!(Lt<0||Lt>=this._array.length)&&this._getKey(this._array[Lt])===e))do yield this._array[Lt];while(++Lt<this._array.length&&this._getKey(this._array[Lt])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Lt=this._search(e),!(Lt<0||Lt>=this._array.length)&&this._getKey(this._array[Lt])===e))do t(this._array[Lt]);while(++Lt<this._array.length&&this._getKey(this._array[Lt])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,s=this._array.length-1;for(;s>=t;){let r=t+s>>1,a=this._getKey(this._array[r]);if(a>e)s=r-1;else if(a<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},tm=0,Rb=0,ZO=class extends We{constructor(){super(),this._decorations=new QO(e=>e?.marker.line),this._onDecorationRegistered=this._register(new be),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new be),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Ct(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new JO(e);if(t){let s=t.marker.onDispose(()=>t.dispose()),r=t.onDispose(()=>{r.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),s.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,s){let r=0,a=0;for(let c of this._decorations.getKeyIterator(t))r=c.options.x??0,a=r+(c.options.width??1),e>=r&&e<a&&(!s||(c.options.layer??"bottom")===s)&&(yield c)}forEachDecorationAtCell(e,t,s,r){this._decorations.forEachByKey(t,a=>{tm=a.options.x??0,Rb=tm+(a.options.width??1),e>=tm&&e<Rb&&(!s||(a.options.layer??"bottom")===s)&&r(a)})}},JO=class extends Ps{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new be),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new be),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=jt.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=jt.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},eB=1e3,tB=class{constructor(e,t=eB){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,s){this._rowCount=s,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 a=r-this._lastRefreshMs,c=this._debounceThresholdMS-a;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},c)}}_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)}},Ob=20,Cu=class extends We{constructor(e,t,s,r){super(),this._terminal=e,this._coreBrowserService=s,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let a=this._coreBrowserService.mainDocument;this._accessibilityContainer=a.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=a.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let c=0;c<this._terminal.rows;c++)this._rowElements[c]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[c]);if(this._topBoundaryFocusListener=c=>this._handleBoundaryFocus(c,0),this._bottomBoundaryFocusListener=c=>this._handleBoundaryFocus(c,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=a.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new tB(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(c=>this._handleResize(c.rows))),this._register(this._terminal.onRender(c=>this._refreshRows(c.start,c.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(c=>this._handleChar(c))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
59
|
+
`))),this._register(this._terminal.onA11yTab(c=>this._handleTab(c))),this._register(this._terminal.onKey(c=>this._handleKey(c.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(He(a,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Ct(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<Ob+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
60
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===Ob+1&&(this._liveRegion.textContent+=km.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 s=this._terminal.buffer,r=s.lines.length.toString();for(let a=e;a<=t;a++){let c=s.lines.get(s.ydisp+a),h=[],f=c?.translateToString(!0,void 0,void 0,h)||"",g=(s.ydisp+a+1).toString(),p=this._rowElements[a];p&&(f.length===0?(p.textContent=" ",this._rowColumns.set(p,[0,1])):(p.textContent=f,this._rowColumns.set(p,h)),p.setAttribute("aria-posinset",g),p.setAttribute("aria-setsize",r),this._alignRowWidth(p))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let s=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2],a=s.getAttribute("aria-posinset"),c=t===0?"1":`${this._terminal.buffer.lines.length}`;if(a===c||e.relatedTarget!==r)return;let h,f;if(t===0?(h=s,f=this._rowElements.pop(),this._rowContainer.removeChild(f)):(h=this._rowElements.shift(),f=s,this._rowContainer.removeChild(h)),h.removeEventListener("focus",this._topBoundaryFocusListener),f.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let g=this._createAccessibilityTreeNode();this._rowElements.unshift(g),this._rowContainer.insertAdjacentElement("afterbegin",g)}else{let g=this._createAccessibilityTreeNode();this._rowElements.push(g),this._rowContainer.appendChild(g)}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(){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},s={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(s.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===s.node&&t.offset>s.offset)&&([t,s]=[s,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(s.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(s={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(s.node))return;let a=({node:f,offset:g})=>{let p=f instanceof Text?f.parentNode:f,v=parseInt(p?.getAttribute("aria-posinset"),10)-1;if(isNaN(v))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 S=g<_.length?_[g]:_.slice(-1)[0]+1;return S>=this._terminal.cols&&(++v,S=0),{row:v,column:S}},c=a(t),h=a(s);if(!(!c||!h)){if(c.row>h.row||c.row===h.row&&c.column>=h.column)throw new Error("invalid range");this._terminal.select(c.column,c.row,(h.row-c.row)*this._terminal.cols-c.column+h.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){e.style.transform="";let t=e.getBoundingClientRect().width,s=this._rowColumns.get(e)?.slice(-1)?.[0];if(!s)return;let r=s*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};Cu=Rt([Ee(1,Ip),Ee(2,ls),Ee(3,as)],Cu);var lp=class extends We{constructor(e,t,s,r,a){super(),this._element=e,this._mouseService=t,this._renderService=s,this._bufferService=r,this._linkProviderService=a,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new be),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new be),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Ct(()=>{Nr(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(He(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(He(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(He(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(He(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 s=e.composedPath();for(let r=0;r<s.length;r++){let a=s[r];if(a.classList.contains("xterm"))break;if(a.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){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(r=>{r?.forEach(a=>{a.link.dispose&&a.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let s=!1;for(let[r,a]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(s=this._checkLinkProviderResult(r,e,s)):a.provideLinks(e.y,c=>{if(this._isMouseOut)return;let h=c?.map(f=>({link:f}));this._activeProviderReplies?.set(r,h),s=this._checkLinkProviderResult(r,e,s),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let s=new Set;for(let r=0;r<t.size;r++){let a=t.get(r);if(a)for(let c=0;c<a.length;c++){let h=a[c],f=h.link.range.start.y<e?0:h.link.range.start.x,g=h.link.range.end.y>e?this._bufferService.cols:h.link.range.end.x;for(let p=f;p<=g;p++){if(s.has(p)){a.splice(c--,1);break}s.add(p)}}}}_checkLinkProviderResult(e,t,s){if(!this._activeProviderReplies)return s;let r=this._activeProviderReplies.get(e),a=!1;for(let c=0;c<e;c++)(!this._activeProviderReplies.has(c)||this._activeProviderReplies.get(c))&&(a=!0);if(!a&&r){let c=r.find(h=>this._linkAtPosition(h.link,t));c&&(s=!0,this._handleNewLink(c))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!s)for(let c=0;c<this._activeProviderReplies.size;c++){let h=this._activeProviderReplies.get(c)?.find(f=>this._linkAtPosition(f.link,t));if(h){s=!0,this._handleNewLink(h);break}}return s}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&nB(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,Nr(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:()=>this._currentLink?.state?.decorations.pointerCursor,set:s=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==s&&(this._currentLink.state.decorations.pointerCursor=s,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",s))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:s=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==s&&(this._currentLink.state.decorations.underline=s,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,s))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(s=>{if(!this._currentLink)return;let r=s.start===0?0:s.start+1+this._bufferService.buffer.ydisp,a=this._bufferService.buffer.ydisp+1+s.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=a&&(this._clearCurrentLink(r,a),this._lastMouseEvent)){let c=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);c&&this._askForLink(c,!1)}})))}_linkHover(e,t,s){this._currentLink?.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(s,t.text)}_fireUnderlineEvent(e,t){let s=e.range,r=this._bufferService.buffer.ydisp,a=this._createLinkUnderlineEvent(s.start.x-1,s.start.y-r-1,s.end.x,s.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(a)}_linkLeave(e,t,s){this._currentLink?.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(s,t.text)}_linkAtPosition(e,t){let s=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,a=t.y*this._bufferService.cols+t.x;return s<=a&&a<=r}_positionFromMouseEvent(e,t,s){let r=s.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,s,r,a){return{x1:e,y1:t,x2:s,y2:r,cols:this._bufferService.cols,fg:a}}};lp=Rt([Ee(1,Up),Ee(2,as),Ee(3,Cn),Ee(4,U1)],lp);function nB(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 iB=class extends WO{constructor(e={}){super(e),this._linkifier=this._register(new Dl),this.browser=rw,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Dl),this._onCursorMove=this._register(new be),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new be),this.onKey=this._onKey.event,this._onRender=this._register(new be),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new be),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new be),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new be),this.onBell=this._onBell.event,this._onFocus=this._register(new be),this._onBlur=this._register(new be),this._onA11yCharEmitter=this._register(new be),this._onA11yTabEmitter=this._register(new be),this._onWillOpen=this._register(new be),this._setup(),this._decorationService=this._instantiationService.createInstance(ZO),this._instantiationService.setService(oo,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Y5),this._instantiationService.setService(U1,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Em)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh(t?.start??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(fn.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(fn.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(fn.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(fn.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(Ct(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.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 s,r="";switch(t.index){case 256:s="foreground",r="10";break;case 257:s="background",r="11";break;case 258:s="cursor",r="12";break;default:s="ansi",r="4;"+t.index}switch(t.type){case 0:let a=xt.toColorRGB(s==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[s]);this.coreService.triggerDataEvent(`${pe.ESC}]${r};${qO(a)}${iw.ST}`);break;case 1:if(s==="ansi")this._themeService.modifyColors(c=>c.ansi[t.index]=Ft.toColor(...t.color));else{let c=s;this._themeService.modifyColors(h=>h[c]=Ft.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(Cu,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(pe.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(pe.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 s=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,a=t.getWidth(s),c=this._renderService.dimensions.css.cell.width*a,h=this.buffer.y*this._renderService.dimensions.css.cell.height,f=s*this._renderService.dimensions.css.cell.width;this.textarea.style.left=f+"px",this.textarea.style.top=h+"px",this.textarea.style.width=c+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(He(this.element,"copy",t=>{this.hasSelection()&&a4(t,this._selectionService)}));let e=t=>o4(t,this.textarea,this.coreService,this.optionsService);this._register(He(this.textarea,"paste",e)),this._register(He(this.element,"paste",e)),lw?this._register(He(this.element,"mousedown",t=>{t.button===2&&$S(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(He(this.element,"contextmenu",t=>{$S(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Wp&&this._register(He(this.element,"auxclick",t=>{t.button===1&&M1(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(He(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(He(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(He(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(He(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(He(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(He(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(He(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){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"),this.element?.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(He(this.screenElement,"mousemove",a=>this.updateCursorStyle(a))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let s=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Cm.get()),cw||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",()=>s.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance($5,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(ls,this._coreBrowserService),this._register(He(this.textarea,"focus",a=>this._handleTextAreaFocus(a))),this._register(He(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Wm,this._document,this._helperContainer),this._instantiationService.setService(Bu,this._charSizeService),this._themeService=this._instantiationService.createInstance(Zm),this._instantiationService.setService(Rl,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(bu),this._instantiationService.setService(I1,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Gm,this.rows,this.screenElement)),this._instantiationService.setService(as,this._renderService),this._register(this._renderService.onRenderedViewportChange(a=>this._onRender.fire(a))),this.onResize(a=>this._renderService.resize(a.cols,a.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Vm,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Xm),this._instantiationService.setService(Up,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(lp,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(Fm,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(a=>{super.scrollLines(a,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Qm,this.element,this.screenElement,r)),this._instantiationService.setService(g4,this._selectionService),this._register(this._selectionService.onRequestScrollLines(a=>this.scrollLines(a.amount,a.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(a=>this._renderService.handleSelectionChanged(a.start,a.end,a.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(a=>{this.textarea.value=a,this.textarea.focus(),this.textarea.select()})),this._register(fn.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance($m,this.screenElement)),this._register(He(this.element,"mousedown",a=>this._selectionService.handleMouseDown(a))),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(Cu,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",a=>this._handleScreenReaderModeOptionChange(a))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Su,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",a=>{!this._overviewRulerRenderer&&a&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Su,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Km,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function s(c){let h=e._mouseService.getMouseReportCoords(c,e.screenElement);if(!h)return!1;let f,g;switch(c.overrideType||c.type){case"mousemove":g=32,c.buttons===void 0?(f=3,c.button!==void 0&&(f=c.button<3?c.button:3)):f=c.buttons&1?0:c.buttons&4?1:c.buttons&2?2:3;break;case"mouseup":g=0,f=c.button<3?c.button:3;break;case"mousedown":g=1,f=c.button<3?c.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(c)===!1)return!1;let p=c.deltaY;if(p===0||e.coreMouseService.consumeWheelEvent(c,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;g=p<0?0:1,f=4;break;default:return!1}return g===void 0||f===void 0||f>4?!1:e.coreMouseService.triggerMouseEvent({col:h.col,row:h.row,x:h.x,y:h.y,button:f,action:g,ctrl:c.ctrlKey,alt:c.altKey,shift:c.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},a={mouseup:c=>(s(c),c.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(c)),wheel:c=>(s(c),this.cancel(c,!0)),mousedrag:c=>{c.buttons&&s(c)},mousemove:c=>{c.buttons||s(c)}};this._register(this.coreMouseService.onProtocolChange(c=>{c?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(c)),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()),c&8?r.mousemove||(t.addEventListener("mousemove",a.mousemove),r.mousemove=a.mousemove):(t.removeEventListener("mousemove",r.mousemove),r.mousemove=null),c&16?r.wheel||(t.addEventListener("wheel",a.wheel,{passive:!1}),r.wheel=a.wheel):(t.removeEventListener("wheel",r.wheel),r.wheel=null),c&2?r.mouseup||(r.mouseup=a.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),c&4?r.mousedrag||(r.mousedrag=a.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(He(t,"mousedown",c=>{if(c.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(c)))return s(c),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(c)})),this._register(He(t,"wheel",c=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(c)===!1)return!1;if(!this.buffer.hasScrollback){if(c.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(c,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(c,!0);let h=pe.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(c.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(h,!0),this.cancel(c,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.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){D1(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,s){this._selectionService.setSelection(e,t,s)}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(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.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 s=GO(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),s.type===3||s.type===2){let r=this.rows-1;return this.scrollLines(s.type===2?-r:r),this.cancel(e,!0)}if(s.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(s.cancel&&this.cancel(e,!0),!s.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((s.key===pe.ETX||s.key===pe.CR)&&(this.textarea.value=""),this._onKey.fire({key:s.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(s.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let s=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"?s:s&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(sB(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){this._charSizeService?.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(qt));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(pe.ESC+"[I"):this.coreService.triggerDataEvent(pe.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),s=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${pe.ESC}[4;${s};${t}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),a=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${pe.ESC}[6;${a};${r}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function sB(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var rB=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let s={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(s),t.dispose=()=>this._wrappedAddonDispose(s),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let s=0;s<this._addons.length;s++)if(this._addons[s]===e){t=s;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)}},lB=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 ci)}translateToString(e,t,s){return this._line.translateToString(e,t,s)}},Bb=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 lB(t)}getNullCell(){return new ci}},aB=class extends We{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new be),this.onBufferChange=this._onBufferChange.event,this._normal=new Bb(this._core.buffers.normal,"normal"),this._alternate=new Bb(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)}},oB=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,s=>t(s.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(s,r)=>t(s,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)}},cB=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}},uB=["cols","rows"],Di=0,hB=class extends We{constructor(e){super(),this._core=this._register(new iB(e)),this._addonManager=this._register(new rB),this._publicOptions={...this._core.options};let t=r=>this._core.options[r],s=(r,a)=>{this._checkReadonlyOptions(r),this._core.options[r]=a};for(let r in this._core.options){let a={get:t.bind(this,r),set:s.bind(this,r)};Object.defineProperty(this._publicOptions,r,a)}}_checkReadonlyOptions(e){if(uB.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 oB(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new cB(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 aB(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,s){this._verifyIntegers(e,t,s),this._core.select(e,t,s)}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
|
|
61
|
+
`,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 Cm.get()},set promptLabel(e){Cm.set(e)},get tooMuchOutput(){return km.get()},set tooMuchOutput(e){km.set(e)}}}_verifyIntegers(...e){for(Di of e)if(Di===1/0||isNaN(Di)||Di%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Di of e)if(Di&&(Di===1/0||isNaN(Di)||Di%1!==0||Di<0))throw new Error("This API only accepts positive integers")}};const dB=12,fB=250,mB={background:"#ffffff",foreground:"#1f2328",cursor:"#1f2328",selectionBackground:"#dbe4ff",black:"#24292f",red:"#cf222e",green:"#116329",yellow:"#9a6700",blue:"#0969da",magenta:"#8250df",cyan:"#1b7c83",white:"#6e7781",brightBlack:"#57606a",brightRed:"#a40e26",brightGreen:"#1a7f37",brightYellow:"#bf8700",brightBlue:"#218bff",brightMagenta:"#a475f9",brightCyan:"#3192aa",brightWhite:"#8c959f"},pB={background:"#16181d",foreground:"#e6e8eb",cursor:"#e6e8eb",selectionBackground:"#33406b",black:"#252a31",red:"#f47174",green:"#6cc98a",yellow:"#e5c07b",blue:"#7aa2f7",magenta:"#bb9af7",cyan:"#7dcfff",white:"#cfd3da",brightBlack:"#6b7280",brightRed:"#ff8b8e",brightGreen:"#93e3ab",brightYellow:"#f2d38a",brightBlue:"#9ab8ff",brightMagenta:"#d0b4ff",brightCyan:"#a4e2ff",brightWhite:"#ffffff"},Lb=()=>document.documentElement.dataset.theme==="dark"?pB:mB;function nm({id:e,active:t,onStatus:s,onProblem:r}){const a=k.useRef(null),c=k.useRef(null),h=k.useRef(null),f=k.useRef(s),g=k.useRef(r);return f.current=s,g.current=r,k.useLayoutEffect(()=>{const p=a.current;if(p===null)return;const v=new hB({fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:12,lineHeight:1.35,cursorBlink:!0,scrollback:5e3,theme:Lb()}),_=new n4;v.loadAddon(_),v.open(p),c.current=v,h.current=_;let S="",y=null,x=null;const w=()=>{if(y=null,S==="")return;const U=S;S="",Yb(e,U).catch(z=>{g.current?.(z instanceof Error?z.message:String(z))})},j=v.onData(U=>{S+=U,y===null&&(y=setTimeout(w,dB))}),N=()=>{x!==null&&clearTimeout(x),x=setTimeout(()=>{v.cols<=0||v.rows<=0||j0(e,v.cols,v.rows).catch(()=>{})},fB)},M=new EventSource($N(e));M.onmessage=U=>{let z;try{z=JSON.parse(U.data)}catch{return}if(z.kind==="snapshot"){v.reset(),v.write(z.text),f.current(z.status),g.current?.(null);return}if(z.kind==="chunk"){v.write(z.text);return}f.current(z.status)},M.onerror=()=>{g.current?.("终端流断开,正在重连…")};const T=new ResizeObserver(()=>{if(!(p.offsetWidth===0||p.offsetHeight===0))try{_.fit(),N()}catch{}});T.observe(p);const O=new MutationObserver(()=>{v.options.theme=Lb()});return O.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),_.fit(),N(),()=>{j.dispose(),M.close(),T.disconnect(),O.disconnect(),y!==null&&clearTimeout(y),x!==null&&clearTimeout(x),v.dispose(),c.current=null,h.current=null}},[e]),k.useEffect(()=>{if(!t)return;const p=c.current;if(p===null)return;const v=setTimeout(()=>{try{h.current?.fit(),p.focus(),j0(e,p.cols,p.rows)}catch{}},0);return()=>{clearTimeout(v)}},[t]),u.jsx("div",{className:t?"term-host active":"term-host",ref:a})}function gB({onStats:e,createSignal:t}){const[s,r]=k.useState([]),[a,c]=k.useState(null),[h,f]=k.useState(null),[g,p]=k.useState(()=>LR()),[v,_]=k.useState(()=>BR()),[S,y]=k.useState(null),x=k.useRef(null),w=k.useRef(null),[j,N]=k.useState(!1),M=k.useRef(t),T=k.useCallback(async()=>{try{const L=await PN();r(L.terminals),c(q=>q!==null&&L.terminals.some(F=>F.id===q)?q:L.terminals[0]?.id??null),y(null)}catch(L){y(L instanceof Error?L.message:String(L))}},[]);k.useEffect(()=>{T();const L=setInterval(()=>{T()},5e3);return()=>{clearInterval(L)}},[T]),k.useEffect(()=>{e?.({running:s.filter(L=>L.status.kind==="running").length,total:s.length})},[s,e]),k.useEffect(()=>{g&&f(L=>L!==null&&L!==a&&s.some(F=>F.id===L)?L:(s.find(F=>F.id!==a&&F.status.kind==="running")??s.find(F=>F.id!==a))?.id??null)},[g,a,s]);const O=k.useCallback(async()=>{if(j)return null;N(!0);try{const L=await qN();return await T(),c(L.id),y(null),L.id}catch(L){return y(L instanceof Error?L.message:String(L)),null}finally{N(!1)}},[j,T]);k.useEffect(()=>{t!==M.current&&(M.current=t,O())},[t,O]);const U=async L=>{try{await FN(L),r(q=>q.filter(F=>F.id!==L)),c(q=>q===L?null:q),f(q=>q===L?null:q),await T()}catch(q){y(q instanceof Error?q.message:String(q))}},z=(L,q)=>{r(F=>F.map(V=>V.id===L?{...V,status:q}:V))},A=L=>{Yb(L,"\f").catch(q=>{y(q instanceof Error?q.message:String(q))})},Y=async L=>{if(!L){p(Pf(void 0,!1));return}let q=s.find(F=>F.id!==a&&F.status.kind==="running")?.id??s.find(F=>F.id!==a)?.id??null;q===null&&(q=await O()),q!==null&&(f(q),p(Pf(void 0,!0)))},ue=L=>{const q=s.find(F=>F.id===L);return q===void 0?null:q.status.kind==="running"?u.jsx("span",{className:"live-dot"}):u.jsx("span",{className:"exited",children:IS(q.status)})},P=L=>{if(L.button!==0)return;const q=x.current?.clientHeight??0;q<=0||(L.currentTarget.setPointerCapture(L.pointerId),w.current={startY:L.clientY,startRatio:v,height:q})},J=L=>{const q=w.current;if(q===null)return;const F=zp(q.startRatio+(L.clientY-q.startY)/q.height);_(F),Uf(void 0,F)},G=L=>{if(w.current!==null){w.current=null;try{L.currentTarget.releasePointerCapture(L.pointerId)}catch{}Uf(void 0,v)}};return s.length===0?u.jsxs("div",{className:"dock-empty",children:[u.jsx("span",{className:"big",children:"▮"}),"还没有终端",u.jsx("br",{}),"新建一个(真 PTY,工作区根目录;↑↓ 历史、Ctrl-C、vim 都能用)",u.jsx("div",{style:{marginTop:10},children:u.jsx("button",{className:"btn",disabled:j,onClick:()=>{O()},children:j?"启动中…":"新建终端"})}),S===null?null:u.jsx("div",{className:"err",children:S})]}):u.jsxs("div",{className:"term-stack",children:[u.jsxs("div",{className:"mini-tabs",children:[s.map(L=>u.jsxs("button",{className:L.id===a?"mini-tab active":"mini-tab",title:L.id,onClick:()=>{c(L.id)},children:[L.id,L.status.kind==="running"?u.jsx("span",{className:"live-dot"}):u.jsx("span",{className:"exited",children:IS(L.status)})]},L.id)),u.jsx("button",{className:"mini-tab add",title:"新建终端","aria-label":"新建终端",onClick:()=>{O()},children:"+"}),u.jsx("span",{className:"grow"}),u.jsx("button",{className:g?"ib on":"ib",title:g?"取消上下分屏":"上下分屏(再开一个 PTY)","aria-label":"上下分屏","aria-pressed":g,onClick:()=>{Y(!g)},disabled:s.length===0,children:u.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[u.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),u.jsx("path",{d:"M3 12h18"})]})}),a===null?null:u.jsxs(u.Fragment,{children:[u.jsx("button",{className:"ib",title:"清屏(Ctrl-L)",onClick:()=>{A(a)},children:"⌫"}),u.jsx("button",{className:"ib",title:"关闭这个终端",onClick:()=>{U(a)},children:"✕"})]})]}),S===null?null:u.jsx("div",{className:"tree-hint err",children:S}),g?u.jsxs("div",{className:"term-split",ref:x,children:[u.jsxs("div",{className:"tp",style:{flex:`0 0 ${String(Math.round(v*100))}%`},children:[u.jsxs("div",{className:"tp-head",children:[u.jsx("span",{children:a===null?"没有终端":`${a} · 分屏 1`}),a===null?null:ue(a),u.jsx("span",{className:"grow"}),u.jsx("span",{className:"dim",children:"上"})]}),u.jsx("div",{className:"term-hosts split",children:a===null?u.jsx("div",{className:"dock-empty small",children:"没有终端"}):u.jsx(nm,{id:a,active:!0,onStatus:L=>{z(a,L)},onProblem:L=>{y(L)}})})]}),u.jsx("span",{className:"term-splitter",title:"拖动调整上下比例(双击复位 50%)",role:"separator","aria-orientation":"horizontal","aria-label":"拖动调整终端分屏比例",onPointerDown:P,onPointerMove:J,onPointerUp:G,onPointerCancel:G,onDoubleClick:()=>{_(Uf(void 0,.5))}}),u.jsxs("div",{className:"tp",style:{flex:"1 1 0"},children:[u.jsxs("div",{className:"tp-head",children:[u.jsx("span",{children:h===null?"没有第二个终端":`${h} · 分屏 2`}),h===null?null:ue(h),u.jsx("span",{className:"grow"}),h!==null?u.jsx("button",{className:"ib",title:"关闭这块分屏(终端本身留着)",onClick:()=>{f(null),p(Pf(void 0,!1))},children:"✕"}):u.jsx("button",{className:"link-btn",disabled:j,onClick:()=>{Y(!0)},children:j?"启动中…":"新建分屏"})]}),u.jsx("div",{className:"term-hosts split",children:h===null?u.jsx("div",{className:"dock-empty small",children:"点「新建分屏」再开一个 PTY"}):u.jsx(nm,{id:h,active:!0,onStatus:L=>{z(h,L)},onProblem:L=>{y(L)}})})]})]}):u.jsx("div",{className:"term-hosts",children:s.map(L=>u.jsx(nm,{id:L.id,active:L.id===a,onStatus:q=>{z(L.id,q)},onProblem:q=>{y(q)}},L.id))}),u.jsx("div",{className:"term-hint",children:"↑↓ 历史 · Ctrl-C 中断 · ⌫ 清屏(Ctrl-L) · 字节直通真 PTY(xterm.js)"})]})}const hu=[{id:"files",label:"文件"},{id:"term",label:"终端"},{id:"diff",label:"改动"}],_B=["三栏","双栏","单栏"];function yw({tab:e}){return e==="files"?u.jsxs("svg",{className:"ico",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",children:[u.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),u.jsx("path",{d:"M14 2v6h6"})]}):e==="term"?u.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[u.jsx("path",{d:"m4 17 6-6-6-6"}),u.jsx("path",{d:"M12 19h8"})]}):u.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[u.jsx("path",{d:"M12 3v18"}),u.jsx("path",{d:"M5 8h14"}),u.jsx("path",{d:"M5 16h14"})]})}function vB({tab:e,onExpand:t}){return u.jsxs("aside",{className:"dock rail",children:[hu.map(s=>u.jsx("button",{className:s.id===e?"rbtn active":"rbtn",title:s.label,"aria-label":s.label,onClick:()=>{t(s.id)},children:u.jsx(yw,{tab:s.id})},s.id)),u.jsx("span",{className:"spacer"}),u.jsx("button",{className:"rbtn",title:"展开面板","aria-label":"展开面板",onClick:()=>{t(e)},children:u.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[u.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),u.jsx("path",{d:"M15 4v16"})]})})]})}const zb=`${String(d1)}–${String(f1)} px · 双击复位 ${String(Fs)}`;function vr(){return typeof window>"u"?{width:1440,height:900}:{width:window.innerWidth,height:window.innerHeight}}function yB({collapsed:e,onToggle:t,changesSignal:s}){const[r,a]=k.useState(()=>BS()),[c,h]=k.useState(()=>pR()),[f,g]=k.useState(()=>zR()),[p,v]=k.useState(()=>AR()),[_,S]=k.useState(()=>FR()),[y,x]=k.useState(()=>MR()),[w,j]=k.useState(()=>RR()),[N,M]=k.useState(()=>OR(void 0,BS())),[T,O]=k.useState(null),[U,z]=k.useState(null),[A,Y]=k.useState(0),[ue,P]=k.useState({running:0,total:0}),[J,G]=k.useState(0);k.useEffect(()=>{(s??0)>0&&a("diff")},[s]);const L=k.useRef(null),q=k.useRef(null),F=k.useRef(null),V=k.useRef(null),Q=k.useRef(c),K=k.useRef(null),ge=k.useRef(null),D=k.useCallback(async()=>{try{const H=await IN();O(H),z(null)}catch(H){z(H instanceof Error?H.message:String(H))}},[]);k.useEffect(()=>{D();const H=setInterval(()=>{D()},1e4);return()=>{clearInterval(H)}},[D]),k.useEffect(()=>{if(!p)return;const H=()=>{x(we=>gr(void 0,we,vr()))};return window.addEventListener("resize",H),()=>{window.removeEventListener("resize",H)}},[p]),k.useEffect(()=>()=>{K.current!==null&&clearTimeout(K.current),ge.current!==null&&clearTimeout(ge.current)},[]);const Ae=k.useMemo(()=>{const H=new Map;for(const we of T?.changed??[])H.set(we.path,_1(we));return H},[T]),Se=H=>{if(f==="三栏"&&H!=="files"){N!==H&&(M(H),If(void 0,H));return}if(H===N){const we=r;M(we),If(void 0,we)}a(H),LS(void 0,H)},R=H=>{if(H==="三栏"&&r!=="files"&&(a("files"),LS(void 0,"files")),g(HR(void 0,H)),H==="三栏"&&w<.55&&j(Yc(void 0,.62)),H!=="单栏"&&N===(H==="三栏"?"files":r)){const we=su(r);M(we),If(void 0,we)}},E=H=>{H.button===0&&(H.currentTarget.setPointerCapture(H.pointerId),L.current={startX:H.clientX,startW:c},document.body.classList.add("dock-resizing"))},ie=()=>{K.current!==null&&clearTimeout(K.current),K.current=setTimeout(()=>{K.current=null,Hf(void 0,Q.current)},300)},ce=H=>{if(L.current===null)return;const we=Bp(L.current.startW+(L.current.startX-H.clientX));Q.current=we,h(we),ie()},fe=H=>{if(L.current!==null){L.current=null,document.body.classList.remove("dock-resizing");try{H.currentTarget.releasePointerCapture(H.pointerId)}catch{}K.current!==null&&clearTimeout(K.current),K.current=null,Hf(void 0,Q.current)}},ve=()=>{Q.current=Fs,h(Hf(void 0,Fs))},Z=H=>{x(H),ge.current!==null&&clearTimeout(ge.current),ge.current=setTimeout(()=>{ge.current=null,gr(void 0,H,vr())},300)},le=H=>{H.button!==0||_||H.target.closest("button")===null&&(H.currentTarget.setPointerCapture(H.pointerId),q.current={dx:H.clientX-y.x,dy:H.clientY-y.y})},se=H=>{q.current!==null&&Z({...y,x:H.clientX-q.current.dx,y:H.clientY-q.current.dy})},me=H=>{if(q.current!==null){q.current=null;try{H.currentTarget.releasePointerCapture(H.pointerId)}catch{}gr(void 0,y,vr())}},xe=H=>{H.button!==0||_||(H.currentTarget.setPointerCapture(H.pointerId),F.current={startX:H.clientX,startY:H.clientY,startW:y.width,startH:y.height})},Fe=H=>{F.current!==null&&Z({...y,width:F.current.startW+(H.clientX-F.current.startX),height:F.current.startH+(H.clientY-F.current.startY)})},Xe=H=>{if(F.current!==null){F.current=null;try{H.currentTarget.releasePointerCapture(H.pointerId)}catch{}gr(void 0,y,vr())}},Ge=H=>{if(H){const we=gr(void 0,y,vr());x(we),v(Vc(void 0,!0))}else v(Vc(void 0,!1)),gr(void 0,y,vr())},nt=H=>{S(PS(void 0,H)),H&&v(Vc(void 0,!0))},$e=()=>{S(PS(void 0,!1)),Vc(void 0,!1),v(!1),gr(void 0,y,vr())},Ot=()=>{$e(),t()},kt=H=>{H.button===0&&(H.currentTarget.setPointerCapture(H.pointerId),V.current={startX:H.clientX,startRatio:w,width:oe()})},ke=H=>{const we=V.current;if(we===null||we.width<=0)return;const je=Ru(we.startRatio+(H.clientX-we.startX)/we.width);j(je),Yc(void 0,je)},Oe=H=>{if(V.current!==null){V.current=null;try{H.currentTarget.releasePointerCapture(H.pointerId)}catch{}Yc(void 0,w)}},oe=()=>p?y.width:c,Ne=(H,we,je)=>H==="files"?u.jsx("div",{className:"dock-body files",children:u.jsx(JR,{width:we,changed:Ae,refreshKey:A,root:T?.root??"",forceSplit:je,onCollapseTree:je?()=>{R("双栏")}:void 0})}):H==="term"?u.jsx("div",{className:"dock-body term",children:u.jsx(gB,{onStats:P,createSignal:J})}):u.jsx("div",{className:"dock-body diff",children:u.jsx($R,{facts:T,factsError:U,refreshKey:A,onRefresh:()=>{Y(ot=>ot+1),D()}})});if(e)return u.jsx(vB,{tab:r,onExpand:H=>{Se(H),t()}});const Le=IR(f,oe(),r),Qe=Math.max(240,Math.round((oe()-5)*w)),ae=Math.max(200,oe()-5-Qe),_e=Le==="单栏"?u.jsx("div",{className:`dock-body-wrap ${r}`,children:Ne(r,oe(),!1)}):u.jsxs("div",{className:"dock-panes",children:[u.jsx("div",{className:"dock-pane",style:{flex:`0 0 ${String(Qe)}px`},children:Ne(r,Qe,Le==="三栏")}),u.jsx("span",{className:"dock-splitter",title:"拖动分栏(双击复位 50%)",role:"separator","aria-orientation":"vertical","aria-label":"拖动调整分栏",onPointerDown:kt,onPointerMove:ke,onPointerUp:Oe,onPointerCancel:Oe,onDoubleClick:()=>{j(Yc(void 0,.5))}}),u.jsxs("div",{className:"dock-pane side",children:[u.jsxs("div",{className:"dock-side-head",children:[u.jsx(yw,{tab:N}),u.jsx("span",{className:"nm",children:hu.find(H=>H.id===N)?.label??N}),u.jsx("span",{className:"grow"}),u.jsx("button",{className:"ib",title:"关闭附栏(回单栏)","aria-label":"关闭附栏",onClick:()=>{R("单栏")},children:"✕"})]}),Ne(N,ae,!1)]})]});return u.jsxs("aside",{className:p?_?"dock dock-float fixed":"dock dock-float":"dock",style:p?_?{right:8,top:8,bottom:8,width:y.width}:{left:y.x,top:y.y,width:y.width,height:y.height}:{width:c,flex:`0 0 ${String(c)}px`},children:[p?u.jsxs("div",{className:"dock-float-bar",title:_?"已固定到右栏(禁拖禁缩;点 ⇥ 取消固定)":"拖动浮层(双击收回右栏)",onPointerDown:le,onPointerMove:se,onPointerUp:me,onPointerCancel:me,onDoubleClick:()=>{Ge(!1)},children:[u.jsx("span",{className:"grip",children:"⠿"}),u.jsxs("span",{className:"float-title",children:["面板 · ",hu.find(H=>H.id===r)?.label??r]}),u.jsx("span",{className:_?"float-tag on":"float-tag",children:_?"已固定":"浮出"}),u.jsx("span",{className:"grow"}),u.jsx("button",{className:"icon-btn",title:"收回右栏","aria-label":"收回右栏",onClick:$e,children:"⤓"}),u.jsx("button",{className:_?"icon-btn on":"icon-btn",title:_?"取消固定(回浮动)":"固定到右栏","aria-label":_?"取消固定":"固定到右栏","aria-pressed":_,onClick:()=>{nt(!_)},children:"⇥"}),u.jsx("button",{className:"icon-btn",title:"关闭(收起到 rail)","aria-label":"关闭面板",onClick:Ot,children:"✕"})]}):u.jsx("div",{className:"dock-resize",title:zb,role:"separator","aria-orientation":"vertical","aria-label":"拖动调整右栏宽度",onPointerDown:E,onPointerMove:ce,onPointerUp:fe,onPointerCancel:fe,onDoubleClick:ve}),u.jsxs("div",{className:"dock-tabs",children:[hu.map(H=>u.jsx("button",{className:r===H.id?"dock-tab active":"dock-tab",onClick:()=>{Se(H.id)},children:H.label},H.id)),u.jsx("span",{className:"grow"}),u.jsx("span",{className:"seg",role:"group","aria-label":"布局",children:_B.map(H=>u.jsx("button",{className:f===H?"on":"",title:H==="三栏"?"文件树 + 预览 + 附栏(主栏=文件;窄了自动降级)":H==="双栏"?"主栏 + 附栏":"只留主栏","aria-pressed":f===H,onClick:()=>{R(H)},children:H},H))}),Le!==f?u.jsxs("span",{className:"seg-note",title:"窗口/面板不够宽,已按原型规则自动降级",children:["自动降为",Le]}):null,p?null:u.jsxs(u.Fragment,{children:[u.jsxs("span",{className:"dock-width",title:zb,children:[c,"px"]}),u.jsx("button",{className:"icon-btn",title:"浮出面板","aria-label":"浮出面板",onClick:()=>{Ge(!0)},children:u.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[u.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),u.jsx("path",{d:"M9 9h6v6"})]})}),u.jsx("button",{className:"icon-btn",title:"收起面板","aria-label":"收起面板",onClick:Ot,children:u.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[u.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),u.jsx("path",{d:"M15 4v16"})]})})]})]}),_e,u.jsxs("div",{className:"dock-footer",children:[u.jsxs("button",{className:"status-line",title:T?.root??"工作区",onClick:()=>{Se("diff")},children:[u.jsx("span",{className:"dot",style:{background:"var(--green)"}}),T?.branch===void 0?U===null?"工作区已连接":"git 读不到":T.branch,T!==null&&(T.ahead??0)>0?u.jsxs("span",{className:"dim",children:["↑",T.ahead]}):null,T!==null&&(T.behind??0)>0?u.jsxs("span",{className:"dim",children:["↓",T.behind]}):null]}),u.jsx("span",{className:"grow"}),u.jsx("button",{className:"ft-r",title:"打开改动",onClick:()=>{Se("diff")},children:T===null?"":`${String(T.changed.length)} 个改动`}),u.jsxs("button",{className:"ft-r",title:"打开终端",onClick:()=>{Se("term")},children:[ue.running," 个终端运行中"]}),u.jsx("button",{className:"ft-r",title:"新建终端",onClick:()=>{r!=="term"&&Se("term"),G(H=>H+1)},children:"+"})]}),p&&!_?u.jsx("span",{className:"dock-float-grip",title:"拖动缩放浮层",onPointerDown:xe,onPointerMove:Fe,onPointerUp:Xe,onPointerCancel:Xe}):null]})}function SB({rightText:e,align:t}){const s=t==="composer"?{maxWidth:"812px",margin:"10px auto 0",padding:"0 14px"}:void 0;return u.jsxs("div",{className:"env-bar",style:s,children:[u.jsxs("button",{className:"env-pill",title:"选择工作环境",children:[u.jsx("span",{className:"g",children:"◻"})," 本地",u.jsx("span",{className:"g chev",children:"▾"})]}),u.jsxs("button",{className:"env-pill",title:"选择工作目录",children:[u.jsx("span",{className:"g",children:"▤"})," daluo",u.jsx("span",{className:"g chev",children:"▾"})]}),u.jsxs("button",{className:"env-pill",title:"切换分支",children:[u.jsx("span",{className:"g",children:"⑂"})," main",u.jsx("span",{className:"g chev",children:"▾"})]}),u.jsxs("span",{className:"env-right",children:[u.jsx("span",{className:"g",children:"·"})," ",e]})]})}const bB=[{keys:["Enter"],label:"提交"},{keys:["Shift","Enter"],label:"换行"},{keys:["@"],label:"提文件"},{keys:["!"],label:"跑本机命令"},{keys:["/"],label:"技能"}];function xB(){return u.jsx("span",{className:"kbd-row",style:{justifyContent:"center"},children:bB.map(e=>u.jsxs("span",{children:[e.keys.map((t,s)=>u.jsxs("span",{children:[s>0?"+":"",u.jsx("kbd",{children:t})]},t))," ",e.label]},e.label))})}function wB({onToggleTheme:e,onSend:t}){const[s,r]=k.useState(""),a=k.useRef(null),c=ex(f=>{a.current?.addFiles(f)}),h=(f,g)=>{const p=f.trim();p!==""&&(t(p,g),r(""))};return u.jsxs("div",{className:"view",style:{display:"flex"},...c.handlers,children:[u.jsx(h1,{title:"新会话",running:!1,onToggleTheme:e}),u.jsx("div",{className:"empty-body",children:u.jsx("div",{className:"empty-wrap",children:u.jsxs("div",{className:"empty-inner",children:[u.jsxs("div",{className:"empty-hero",children:[u.jsxs("pre",{className:"empty-mark",children:[" ",u.jsx("span",{className:"star",children:"✦"}),`
|
|
62
|
+
╭───────╮
|
|
63
|
+
│ · `,u.jsx("span",{className:"star",children:"◆"}),` · │
|
|
64
|
+
╭─┴───────┴─╮
|
|
65
|
+
│ · `,u.jsx("span",{className:"star",children:"✦"})," · ",u.jsx("span",{className:"star",children:"✦"}),` │
|
|
66
|
+
╰───────────╯`]}),u.jsx("h1",{className:"empty-title",children:"有什么可以帮你的?"}),u.jsx("p",{className:"empty-sub",children:"说一句话就开始"})]}),u.jsx(Jb,{ref:a,value:s,onChange:r,contextLabel:"ctx 0%",onSend:h,empty:!0}),u.jsx(SB,{rightText:"事件流已连接"}),u.jsx("div",{className:"suggestions",children:I2.map(f=>u.jsxs("button",{className:"sugg",onClick:()=>{r(f.prompt)},children:[u.jsx("span",{className:"ico",children:f.icon}),u.jsxs("span",{children:[u.jsx("span",{className:"t",children:f.title}),u.jsx("span",{className:"d",children:f.desc})]})]},f.title))}),u.jsx("div",{className:"empty-foot",children:u.jsx(xB,{})})]})})}),c.dragging?u.jsx(tx,{}):null]})}const CB=e=>{if(e===void 0)return null;const t=new Date(e);return Number.isNaN(t.getTime())?null:t.toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"})};function kB({info:e,onBackToSource:t,onClose:s}){const r=CB(e.ts);return u.jsx("div",{className:"modal-backdrop fork-done-backdrop",onClick:s,children:u.jsxs("div",{className:"modal-card fork-done",role:"dialog","aria-label":"已分叉到新会话",onClick:a=>{a.stopPropagation()},children:[u.jsxs("div",{className:"modal-head",children:[u.jsx("span",{className:"ok",children:"✓"})," 已分叉到新会话",u.jsx("span",{className:"mut",children:"源会话只读"})]}),u.jsxs("div",{className:"modal-body",children:[u.jsxs("blockquote",{className:"fork-quote",children:["「",e.quote,"」"]}),u.jsxs("div",{className:"fork-meta",children:[u.jsxs("span",{className:"chip",children:["第 ",e.round," 轮"]}),u.jsxs("span",{children:["seq #",e.at]}),r===null?null:u.jsx("span",{children:r}),u.jsxs("span",{children:["源:",e.sourceTitle]})]}),u.jsx("div",{className:"modal-note",children:e.kind==="user"?u.jsxs(u.Fragment,{children:["新会话",u.jsx("b",{children:"保留到这句为止"}),",让大罗重新答;源会话没被改动。之后想回到原来的线,从侧栏点源会话即可。"]}):u.jsxs(u.Fragment,{children:["新会话",u.jsx("b",{children:"保留到这条回答为止"}),",从这里接着聊;源会话没被改动。之后想回到原来的线,从侧栏点源会话即可。"]})})]}),u.jsxs("div",{className:"modal-foot",children:[u.jsx("button",{className:"btn",onClick:t,children:"回到源会话"}),u.jsx("button",{className:"btn primary",onClick:s,children:"开始输入"})]})]})})}function NB(e){const t=e.completionOk===!0?`补全 ✓${e.probedModel===void 0?"":`(${e.probedModel})`}`:"补全未测通",s=e.modelsOk===!0?"":" · 清单未拉到",r=[...e.errors??[]];r.length===0&&e.error!==void 0&&e.error!==""&&r.push(e.error);const a=r.length===0?"":` · ${r.join(";")}`;return`${e.completionOk===!0?`连通 ✓ ${String(e.ms)}ms`:"不通"} · ${t}${s}${a}`}function EB(e){return e==="registry"?"注册表":e==="builtin"?"内置":"用户插件"}function jB(e){return e==="active"?"已装载":e==="failed"?"装载失败":e==="pending"?"未就绪":"已停用"}function TB(e){const t=e??{active:0,failed:0,pending:0,disabled:0},s=[`${String(t.active)} 个已装载`];return t.disabled>0&&s.push(`${String(t.disabled)} 个已停用`),t.pending>0&&s.push(`${String(t.pending)} 个未就绪`),t.failed>0&&s.push(`${String(t.failed)} 个装载失败`),s.join(" · ")}function Hb(e,t){const s=t.trim().toLowerCase();return s===""?e:e.filter(r=>r.id.toLowerCase().includes(s)||r.title.toLowerCase().includes(s)||r.description.toLowerCase().includes(s))}function DB(e,t){return t?`已启用「${e}」:下一条消息起生效(正在跑的回合不拆)`:`已停用「${e}」:下一条消息起生效(正在跑的回合不拆)`}function MB(e){return e.trim()===""?"没有配置用户插件。把插件写进 daluo.plugins.ts(或 DALUO_PLUGINS)后刷新即可,装载失败的原话会出现在上面。":"没有匹配的用户插件——清掉筛选看看。"}function AB(){const[e,t]=k.useState(null),[s,r]=k.useState(null),[a,c]=k.useState(null),[h,f]=k.useState(""),[g,p]=k.useState(null),v=k.useCallback(async()=>{try{t(await i2()),r(null)}catch(x){r(x instanceof Error?x.message:String(x))}},[]);k.useEffect(()=>{v()},[v]);const _=async x=>{if(x.locked||g!==null)return;const w=x.state==="disabled";p(x.id);try{await s2(x.id,w),c(DB(x.id,w)),r(null),await v()}catch(j){r(j instanceof Error?j.message:String(j))}finally{p(null)}};if(s!==null)return u.jsxs("div",{className:"err-bar",children:[u.jsx("span",{className:"warn",children:"⚠"}),u.jsxs("span",{className:"grow",children:["插件列表读不出来:",s]}),u.jsx("button",{className:"btn",onClick:()=>{v()},children:"重试"})]});if(e===null)return u.jsxs("div",{className:"set-title",children:[u.jsx("h2",{children:"插件"}),u.jsx("span",{className:"muted",children:"正在读取当前装配…"})]});if(!e.ok)return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"set-title",children:[u.jsx("h2",{children:"插件"}),u.jsx("span",{className:"muted",children:"装配失败 · 失败行不隐藏、不改写原因"})]}),u.jsxs("div",{className:"err-bar",children:[u.jsx("span",{className:"warn",children:"⚠"}),u.jsx("span",{className:"grow",children:e.error??"装配失败"}),u.jsx("button",{className:"btn",onClick:()=>{v()},children:"重试"})]}),u.jsxs("div",{className:"card",children:[u.jsx("h3",{children:"装载失败的行"}),u.jsx("div",{className:"sub",children:"loader 原话照抄(来源 + 原因)。修好配置后重启 serve 或重新装配。"}),(e.rows??[]).map(x=>u.jsxs("div",{className:"plug-logline",children:[u.jsx("code",{children:x.id}),u.jsx("span",{className:"plug-src",children:x.source}),u.jsx("span",{className:"plug-bad",children:x.detail??x.state})]},x.id))]})]});const S=Hb(e.builtin??[],h),y=Hb(e.user??[],h);return u.jsxs("div",{className:"plug-page",children:[u.jsxs("div",{className:"set-title",children:[u.jsx("h2",{children:"插件"}),u.jsx("span",{className:"muted",children:"装配审计 · 与 agent 实际吃到的是同一份"})]}),u.jsxs("div",{className:"plug-head",children:[u.jsx("span",{className:"plug-dot","aria-hidden":"true"}),u.jsx("span",{children:u.jsx("b",{children:TB(e.counts)})}),u.jsx("span",{className:"grow"}),u.jsx("span",{className:"plug-locknote",children:"🔒 内置插件不允许停止"}),u.jsx("span",{className:"plug-effective",children:"启停立即生效(下一条消息起)"}),u.jsx("button",{className:"btn",onClick:()=>{v()},children:"刷新"})]}),u.jsxs("div",{className:"plug-sources",children:[u.jsx("span",{children:"来源:"}),(e.sources??[]).length===0?u.jsx("span",{children:"没有用户插件配置(daluo.plugins.ts / DALUO_PLUGINS_FILE / DALUO_PLUGINS)"}):(e.sources??[]).map(x=>u.jsx("code",{children:x},x))]}),a===null?null:u.jsxs("div",{className:"save-bar",children:[u.jsx("span",{children:"✓"}),u.jsx("span",{className:"grow",children:a}),u.jsx("button",{className:"btn",onClick:()=>{c(null)},children:"知道了"})]}),u.jsxs("div",{className:"plug-search",children:[u.jsx("span",{"aria-hidden":"true",children:"⌕"}),u.jsx("input",{value:h,onChange:x=>{f(x.target.value)},placeholder:"按 id / 名称 / 职责筛选插件…","aria-label":"筛选插件"}),h===""?null:u.jsx("button",{className:"ghost",onClick:()=>{f("")},children:"清空"})]}),u.jsxs("div",{className:"plug-group",children:[u.jsxs("h3",{children:["内置插件 ",u.jsx("span",{className:"plug-count",children:S.length})]}),u.jsx("div",{className:"sub",children:"三条贡献面的接缝 + 安全/省钱硬闸;只读详情,开关锁定。"}),u.jsx("div",{className:"plug-grid",children:S.map(x=>u.jsx(Ib,{card:x,busy:g,onToggle:()=>{_(x)}},x.id))})]}),u.jsxs("div",{className:"plug-group",children:[u.jsxs("h3",{children:["用户插件 ",u.jsx("span",{className:"plug-count",children:y.length})]}),u.jsx("div",{className:"sub",children:"来自 daluo.plugins.ts / DALUO_PLUGINS_FILE / DALUO_PLUGINS;只有这里能启停。"}),y.length===0?u.jsx("div",{className:"plug-empty",children:MB(h)}):u.jsx("div",{className:"plug-grid",children:y.map(x=>u.jsx(Ib,{card:x,busy:g,onToggle:()=>{_(x)}},x.id))})]})]})}function Ib({card:e,busy:t,onToggle:s}){const[r,a]=k.useState(!1),c=!e.locked,h=e.state==="disabled";return u.jsxs("div",{className:`plug-card${h?" off":""}${r?" open":""}`,children:[u.jsxs("div",{className:"plug-card-main",children:[u.jsx("span",{className:`plug-ico ${e.kind}`,"aria-hidden":"true",children:e.kind==="registry"?"◇":e.kind==="builtin"?"⛨":"✧"}),u.jsxs("div",{className:"plug-body",children:[u.jsxs("div",{className:"plug-title",children:[u.jsx("span",{className:"plug-name",children:e.title}),u.jsx("span",{className:`plug-tag ${e.kind}`,children:EB(e.kind)}),u.jsx("span",{className:`plug-state ${e.state}`,children:jB(e.state)})]}),u.jsx("div",{className:"plug-slug",children:e.id}),e.description===""?null:u.jsx("div",{className:"plug-desc",children:e.description})]}),c?u.jsx("button",{className:`plug-switch${h?"":" on"}${t===e.id?" busy":""}`,role:"switch","aria-checked":!h,"aria-label":`${h?"启用":"停用"} ${e.title}`,disabled:t!==null,onClick:s,title:t!==null?"正在写设置…":h?"启用(下一条消息起生效)":"停用(下一条消息起生效)",children:u.jsx("span",{"aria-hidden":"true"})}):u.jsx("span",{className:"plug-switch locked",title:"内置插件不允许停止","aria-hidden":"true",children:u.jsx("span",{"aria-hidden":"true"})}),u.jsx("button",{className:"plug-expand",onClick:()=>{a(f=>!f)},"aria-expanded":r,"aria-label":"展开详情",children:u.jsx("span",{"aria-hidden":"true",children:r?"▴":"▾"})})]}),r?u.jsxs("div",{className:"plug-detail",children:[u.jsxs("div",{className:"plug-kv",children:[u.jsx("span",{children:"来源"}),u.jsx("code",{children:e.source})]}),u.jsxs("div",{className:"plug-kv",children:[u.jsx("span",{children:"装配顺序"}),u.jsxs("code",{children:["#",e.order]})]}),e.pageUrl===void 0?null:u.jsxs("div",{className:"plug-kv",children:[u.jsx("span",{children:"页面入口"}),u.jsxs("a",{href:e.pageUrl,target:"_blank",rel:"noopener noreferrer",children:[e.pageUrl," ↗"]})]}),e.contributions.length===0?null:u.jsxs("div",{className:"plug-contrib",children:[u.jsx("span",{children:"贡献面"}),e.contributions.map(f=>u.jsxs("div",{className:"plug-contrib-line",children:[u.jsx("b",{children:f.type}),u.jsx("code",{children:f.value}),f.note===void 0?null:u.jsx("span",{children:f.note})]},`${f.type}:${f.value}`))]}),u.jsxs("div",{className:"plug-kv",children:[u.jsx("span",{children:"装载日志"}),u.jsx("code",{className:e.state==="failed"?"bad":"",children:e.log})]}),e.detail===void 0?null:u.jsxs("div",{className:"plug-kv",children:[u.jsx("span",{children:"原因"}),u.jsx("code",{className:"bad",children:e.detail})]}),c?null:u.jsx("div",{className:"plug-lockhint",children:"🔒 内置插件不允许停止(用户定稿):要改行为请改它的配置,而不是停掉它。"})]}):null]})}function RB({onClose:e,session:t,onTheme:s}){const[r,a]=k.useState("appearance"),[c,h]=k.useState(null),[f,g]=k.useState(null),[p,v]=k.useState(null),[_,S]=k.useState(null),[y,x]=k.useState(null),w=async()=>{try{const[N,M,T]=await Promise.all([GN(),ZN(),Wb(t??void 0)]);h(N),g(M),v(T),S(null)}catch(N){S(N instanceof Error?N.message:String(N))}};k.useEffect(()=>{w()},[]);const j=async N=>{try{h(await QN(N)),S(null)}catch(M){S(M instanceof Error?M.message:String(M))}};return u.jsxs("div",{className:"settings",children:[u.jsxs("div",{className:"set-nav",children:[u.jsxs("button",{className:"back",onClick:e,title:"返回会话",children:[u.jsx("span",{"aria-hidden":"true",children:"←"})," 返回"]}),u.jsx("div",{className:"gtitle",children:"设置"}),[["◐","外观","appearance"],["◇","模型与提供方","providers"],["✧","插件","plugins"],["ⓘ","关于","about"]].map(([N,M,T])=>u.jsxs("button",{className:r===T?"on":"",onClick:()=>{a(T)},children:[u.jsx("span",{className:"g",children:N}),M]},T))]}),u.jsxs("div",{className:"set-body",children:[_===null?null:u.jsxs("div",{className:"err-bar",children:[u.jsx("span",{className:"warn",children:"⚠"}),u.jsx("span",{className:"grow",children:_}),u.jsx("button",{className:"btn",onClick:()=>{w()},children:"重试"})]}),y===null?null:u.jsxs("div",{className:"save-bar",children:[u.jsx("span",{children:"✓"}),u.jsx("span",{className:"grow",children:y}),u.jsx("button",{className:"btn",onClick:()=>{x(null)},children:"知道了"})]}),r==="appearance"?u.jsx(OB,{p:{settings:c,保存设置:j,onTheme:s}}):r==="providers"?u.jsx(BB,{p:{providers:f,models:p,session:t,刷新:w,setError:S,setNotice:x}}):r==="plugins"?u.jsx(AB,{}):u.jsx(LB,{p:{settings:c,providers:f}})]})]})}function OB({p:e}){const{settings:t,保存设置:s,onTheme:r}=e,a=t?.values.theme??"light";return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"set-title",children:[u.jsx("h2",{children:"外观"}),u.jsx("span",{className:"muted",children:"只影响这台机器上的这个浏览器 · 立即生效,不需要保存"})]}),u.jsxs("div",{className:"card",children:[u.jsx("h3",{children:"主题"}),u.jsx("div",{className:"sub",children:"深色/浅色都会写进设置文件(`/settings`),换浏览器也一致。"}),u.jsxs("div",{className:"seg",children:[a==="system"?u.jsx("span",{className:"pill",children:"当前:跟随系统(选一个就固定下来)"}):null,["light","dark"].map(c=>u.jsx("button",{className:a===c?"on":"",onClick:()=>{r(c),s({theme:c})},children:c==="light"?"浅色":"深色"},c))]})]}),u.jsxs("div",{className:"card",children:[u.jsx("h3",{children:"字号"}),u.jsx("div",{className:"sub",children:"消息与工具卡的基础字号(会随主题一起写盘)。"}),u.jsx("div",{className:"seg",children:[13,14,16].map(c=>u.jsx("button",{className:(t?.values.fontSize??14)===c?"on":"",onClick:()=>{s({fontSize:c})},children:c===13?"紧凑":c===14?"标准":"宽松"},c))})]})]})}const im={name:"",baseUrl:"",apiKey:"",clearApiKey:!1,contextWindowTokens:""};function BB({p:e}){const{providers:t,models:s,session:r,刷新:a,setError:c,setNotice:h}=e,[f,g]=k.useState(im),[p,v]=k.useState(!1),[_,S]=k.useState({}),[y,x]=k.useState(null),w=k.useRef(null),j=y!==null;k.useEffect(()=>{if(!j)return;w.current?.focus();const A=ue=>{const P=ue.target;P instanceof Element&&P.closest(".picker")===null&&P.closest("[data-picker-trigger]")===null&&x(null)},Y=ue=>{ue.key==="Escape"&&x(null)};return document.addEventListener("mousedown",A),document.addEventListener("keydown",Y),()=>{document.removeEventListener("mousedown",A),document.removeEventListener("keydown",Y)}},[j]);const N=async(A,Y)=>{v(!0);try{await A(),await a(),c(null),Y!==void 0&&h(Y)}catch(ue){c(ue instanceof Error?ue.message:String(ue))}finally{v(!1)}},M=async()=>{await N(()=>Da({op:f.id===void 0?"add":"update",...f.id===void 0?{}:{id:f.id},name:f.name,baseUrl:f.baseUrl,...f.apiKey===""?{}:{apiKey:f.apiKey},...f.clearApiKey?{clearApiKey:!0}:{},...f.contextWindowTokens===""?{}:{contextWindowTokens:f.contextWindowTokens}}),f.id===void 0?"已新增提供方":"已保存提供方"),g(im)},T=A=>{g({id:A.id,name:A.name,baseUrl:A.baseUrl,apiKey:"",clearApiKey:!1,contextWindowTokens:A.contextWindowTokens===void 0?"":String(A.contextWindowTokens)})},O=async A=>{S(Y=>({...Y,[A.id]:"拉取模型清单…"}));try{const Y=await T0({id:A.id});if(Y.modelsOk!==!0){S(P=>({...P,[A.id]:`拉取失败:${(Y.errors??[]).join(";")||"取不到清单"}`}));return}const ue=Y.models??[];S(P=>({...P,[A.id]:`接口返回 ${String(ue.length)} 个模型 · 补全${Y.completionOk===!0?" ✓":"未测通"}`})),x({providerId:A.id,name:A.name,全部:ue,选中:A.models.map(P=>P.name),过滤:""})}catch(Y){S(ue=>({...ue,[A.id]:`拉取失败:${Y instanceof Error?Y.message:String(Y)}`}))}},U=async()=>{if(y===null)return;const A=t?.providers.find(J=>J.id===y.providerId),Y=new Map((A?.models??[]).map(J=>[J.name,J.contextWindowTokens])),ue=new Set(y.选中),P=y.全部.filter(J=>ue.has(J)).map(J=>{const G=Y.get(J);return G===void 0||G===""?{name:J}:{name:J,contextWindowTokens:G}});await N(()=>Da({op:"update",id:y.providerId,models:P}),`已保存 ${String(P.length)} 个模型`),x(null)},z=async A=>{S(Y=>({...Y,[A.id]:"测试中…"}));try{const Y=await T0({id:A.id});S(ue=>({...ue,[A.id]:NB(Y)}))}catch(Y){S(ue=>({...ue,[A.id]:`不通 · ${Y instanceof Error?Y.message:String(Y)}`}))}};return t===null?u.jsx("div",{className:"muted",children:"载入提供方配置…"}):u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"set-title",children:[u.jsx("h2",{children:"模型与提供方"}),u.jsx("span",{className:"muted",children:"可配多套,随时切换 · 密钥只显示末四位"})]}),u.jsxs("div",{className:"card",children:[u.jsxs("h3",{children:["提供方(",t.providers.length," 套)"]}),u.jsxs("div",{className:"sub",children:["当前:",t.providers.find(A=>A.id===t.activeProviderId)?.name??"未配置"," · 进程实际连接:",t.runningBaseUrl," / ",t.runningModel,t.envOverride.length===0?"":` · 环境变量覆盖:${t.envOverride.join(", ")}`]}),t.providers.length===0?u.jsx("div",{className:"hint",children:"还没有配置提供方。下面填一套(baseURL + 密钥 + 模型清单)就能用。"}):u.jsx("div",{className:"models",children:t.providers.map(A=>u.jsxs("div",{style:{position:"relative"},className:A.id===t.activeProviderId?"model on":"model",children:[u.jsxs("div",{style:{minWidth:0},children:[u.jsxs("div",{children:[u.jsx("span",{className:"nm",children:A.name}),A.id===t.activeProviderId?u.jsx("span",{className:"pill",style:{marginLeft:8},children:"当前"}):null,A.enabled?null:u.jsx("span",{className:"pill",style:{marginLeft:8},children:"已关闭"})]}),u.jsxs("div",{className:"tagm",style:{marginLeft:0},children:[A.baseUrl," · ",A.models.length," 个模型 · 密钥",A.apiKeySet?` 已配置 · …${A.apiKeyHint}`:" 未配置"]}),_[A.id]===void 0?null:u.jsx("div",{className:"hint",children:_[A.id]})]}),u.jsxs("span",{className:"tagm",style:{display:"flex",gap:6,flexWrap:"wrap",justifyContent:"flex-end"},children:[u.jsx("button",{className:"btn",disabled:p,onClick:()=>{z(A)},title:"真打一次提供方:列清单 + 一次最小补全,只报连通/补全状态",children:"测试连通"}),u.jsx("button",{className:"btn","data-picker-trigger":"1",disabled:p,onClick:()=>{O(A)},children:"获取模型"}),u.jsx("button",{className:"btn",disabled:p||A.id===t.activeProviderId||!A.enabled,onClick:()=>{N(()=>Da({op:"activate",id:A.id}),`已切到 ${A.name}`)},children:"启用"}),u.jsx("button",{className:"btn",disabled:p,onClick:()=>{T(A)},children:"编辑"}),u.jsx("button",{className:"btn",disabled:p,onClick:()=>{N(()=>Da({op:"update",id:A.id,enabled:!A.enabled}),A.enabled?"已关闭":"已开启")},children:A.enabled?"停用":"开启"}),u.jsx("button",{className:"btn danger",disabled:p||A.id===t.activeProviderId,onClick:()=>{window.confirm(`删除提供方「${A.name}」?`)&&N(()=>Da({op:"remove",id:A.id}),"已删除")},children:"删除"})]}),y===null||y.providerId!==A.id?null:u.jsxs("div",{className:"picker","data-picker":"1",children:[u.jsxs("div",{className:"picker-head",children:[u.jsx("b",{children:y.name}),u.jsxs("span",{children:["· 接口返回 ",y.全部.length," 个模型 · 已选 ",y.选中.length]}),u.jsxs("span",{style:{marginLeft:"auto",display:"flex",gap:6},children:[u.jsx("button",{className:"btn",onClick:()=>{x({...y,选中:y.全部})},children:"全选"}),u.jsx("button",{className:"btn",onClick:()=>{x({...y,选中:[]})},children:"清空"})]})]}),u.jsx("input",{ref:w,className:"picker-search",value:y.过滤,placeholder:"筛选模型名…(Esc 关闭)",onChange:Y=>{x({...y,过滤:Y.target.value})}}),u.jsxs("div",{className:"picker-list",children:[y.全部.filter(Y=>y.过滤.trim()===""||Y.toLowerCase().includes(y.过滤.trim().toLowerCase())).map(Y=>{const ue=y.选中.includes(Y),P=t.providers.find(J=>J.id===y.providerId)?.models.some(J=>J.name===Y)===!0;return u.jsxs("label",{className:ue?"pick on":"pick",children:[u.jsx("input",{type:"checkbox",checked:ue,onChange:()=>{x({...y,选中:ue?y.选中.filter(J=>J!==Y):[...y.选中,Y]})}}),u.jsx("span",{className:"nm",children:Y}),P?null:u.jsx("span",{className:"pill",children:"未添加"})]},Y)}),y.全部.filter(Y=>y.过滤.trim()===""||Y.toLowerCase().includes(y.过滤.trim().toLowerCase())).length===0?u.jsx("div",{className:"picker-empty",children:"没有匹配的模型"}):null]}),u.jsxs("div",{className:"section-actions",children:[u.jsx("button",{className:"btn",onClick:()=>{x(null)},children:"取消"}),u.jsxs("button",{className:"btn primary",disabled:p,onClick:()=>{U()},children:["保存勾选的 ",y.选中.length," 个"]})]})]})]},A.id))}),u.jsx("div",{className:"hint",children:"模型清单从提供方接口拉取(`/provider/test` 的 `models`),勾选后才写进配置——默认模型只显示已添加的。"}),u.jsxs("div",{className:"hint",children:["配置文件:",t.configFile]})]}),u.jsxs("div",{className:"card",children:[u.jsx("h3",{children:f.id===void 0?"新增提供方":`编辑:${f.name}`}),u.jsx("div",{className:"sub",children:"模型不在表单里手填:新增后在列表里点「获取模型」从提供方接口拉清单,勾选要用的那些。"}),u.jsxs("div",{className:"form-grid",children:[u.jsxs("label",{children:["名称",u.jsx("input",{value:f.name,placeholder:"DeepSeek / 公司网关",onChange:A=>{g({...f,name:A.target.value})}})]}),u.jsxs("label",{children:["baseURL",u.jsx("input",{value:f.baseUrl,placeholder:"https://api.deepseek.com/v1",onChange:A=>{g({...f,baseUrl:A.target.value})}})]}),u.jsxs("label",{children:["密钥",u.jsx("input",{type:"password",value:f.apiKey,placeholder:f.id===void 0?"sk-…(可留空,用环境变量)":"留空 = 不改",onChange:A=>{g({...f,apiKey:A.target.value})}})]}),u.jsxs("label",{children:["上下文窗口",u.jsx("input",{value:f.contextWindowTokens,placeholder:"1000000(可留空)",onChange:A=>{g({...f,contextWindowTokens:A.target.value})}})]})]}),f.id===void 0?null:u.jsxs("label",{className:"check",children:[u.jsx("input",{type:"checkbox",checked:f.clearApiKey,onChange:A=>{g({...f,clearApiKey:A.target.checked})}}),"清除已存的密钥"]}),u.jsxs("div",{className:"section-actions",children:[f.id===void 0?null:u.jsx("button",{className:"btn",onClick:()=>{g(im)},children:"取消编辑"}),u.jsx("button",{className:"btn primary",disabled:p||f.baseUrl.trim()==="",onClick:()=>{M()},children:f.id===void 0?"新增":"保存"})]})]}),u.jsxs("div",{className:"card",children:[u.jsx("h3",{children:"默认模型"}),u.jsxs("div",{className:"sub",children:["当前:",s?.current??"—","(",s?.currentSource??"—",")· 新会话默认:",s?.default??"—",r===null?"":" · 改的是这个会话"]}),u.jsx("div",{className:"pills",children:(t.providers.find(A=>A.id===t.activeProviderId)?.models??[]).filter(A=>A.enabled!==!1).map(A=>u.jsx("button",{className:s?.current===A.name?"pill on":"pill",disabled:p,onClick:()=>{v(!0),JN(A.name,r??void 0).then(async()=>{await a(),h(`已切到 ${A.name}`)}).catch(Y=>{c(Y instanceof Error?Y.message:String(Y))}).finally(()=>{v(!1)})},children:A.name},A.name))}),(t.providers.find(A=>A.id===t.activeProviderId)?.models??[]).length===0?u.jsx("div",{className:"hint",children:"当前提供方还没有模型:先在它那一行点「获取模型」,勾选要用的模型保存。"}):null]})]})}function LB({p:e}){const{settings:t,providers:s}=e;return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"set-title",children:[u.jsx("h2",{children:"关于"}),u.jsx("span",{className:"muted",children:"大罗 · v0.1"})]}),u.jsxs("div",{className:"card",children:[u.jsx("h3",{children:"本机服务"}),u.jsxs("div",{className:"field",children:[u.jsx("span",{className:"k",children:"地址"}),u.jsx("span",{className:"v",children:location.origin})]}),u.jsxs("div",{className:"field",children:[u.jsx("span",{className:"k",children:"模式"}),u.jsx("span",{className:"v",children:"本机 loopback · 免 token"})]}),u.jsxs("div",{className:"field",children:[u.jsx("span",{className:"k",children:"设置文件"}),u.jsx("span",{className:"v",children:t?.file??"—"})]}),u.jsxs("div",{className:"field",children:[u.jsx("span",{className:"k",children:"提供方配置"}),u.jsx("span",{className:"v",children:s?.configFile??"—"})]})]}),u.jsxs("div",{className:"card",children:[u.jsx("h3",{children:"运行中连接"}),u.jsxs("div",{className:"field",children:[u.jsx("span",{className:"k",children:"baseURL"}),u.jsx("span",{className:"v",children:s?.runningBaseUrl??"—"})]}),u.jsxs("div",{className:"field",children:[u.jsx("span",{className:"k",children:"模型"}),u.jsx("span",{className:"v",children:s?.runningModel??"—"})]}),u.jsxs("div",{className:"field",children:[u.jsx("span",{className:"k",children:"环境变量覆盖"}),u.jsx("span",{className:"v",children:s===null||s.envOverride.length===0?"无":s.envOverride.join(", ")})]})]})]})}const zB=[{mode:"sequence",名:"序",说明:"每格等宽:看清顺序与谁挨着谁(没时间戳的格也在)"},{mode:"duration",名:"时长",说明:"条宽 = 实测时长,空档压缩:谁占了多少干活时间"},{mode:"time",名:"时间",说明:"归零标记,空档保留:真实时间轴上的位置"},{mode:"actual",名:"实际",说明:"位置 + 宽度:真实时间轴上实际发生在哪、各花多久"}],HB=[{kind:"user",名:"用户",图标:"●"},{kind:"assistant-text",名:"回复",图标:"◆"},{kind:"tool-call",名:"工具",图标:"▸"},{kind:"compaction",名:"压缩",图标:"◱"},{kind:"ask",名:"确认",图标:"?"},{kind:"inbox",名:"排队",图标:"▤"},{kind:"feedback",名:"反馈",图标:"✎"},{kind:"goal",名:"目标",图标:"◎"},{kind:"todo",名:"计划",图标:"☑"},{kind:"subagent",名:"子代理",图标:"⧉"},{kind:"workflow",名:"工作流",图标:"⌘"},{kind:"team",名:"团队",图标:"⚇"},{kind:"system",名:"系统",图标:"⚙"},{kind:"context",名:"上下文",图标:"ⓘ"},{kind:"event",名:"事件",图标:"·"}],Sw=new Map(HB.map(e=>[e.kind,e]));function Xp(e){return Sw.get(e)?.名??e}function bw(e){return Sw.get(e)?.图标??"·"}const IB=e=>{if(e===void 0)return null;const t=Date.parse(e);return Number.isNaN(t)?null:t},Ua=e=>Math.min(100,Math.max(0,e));function UB(e,t){if(t==="sequence")return e.map(()=>({left:0,width:100}));const s=e.map(f=>IB(f.ts)),r=s.filter(f=>f!==null),a=r.length>0?Math.min(...r):null,c=r.length>0?Math.max(...r):null,h=a===null||c===null?0:c-a;if(t==="duration"){const f=e.reduce((p,v)=>p+(v.durationMs??0),0);if(f<=0)return e.map(()=>null);let g=0;return e.map(p=>{if(p.durationMs===void 0)return null;const v=p.durationMs/f*100,_=g/f*100;return g+=p.durationMs,{left:Ua(_),width:Ua(v)}})}return e.map((f,g)=>{const p=s[g]??null;if(p===null||a===null)return null;const v=h<=0?0:(p-a)/h*100;if(t==="time")return{left:Ua(v),width:.6};const _=h<=0?0:(f.durationMs??0)/h*100;return{left:Ua(v),width:Ua(Math.max(.4,_))}})}function jl(e){if(e===void 0||!Number.isFinite(e)||e<0)return null;if(e<1e3)return`${String(Math.round(e))} ms`;if(e<6e4)return`${(e/1e3).toFixed(1)} s`;const t=Math.floor(e/6e4),s=Math.round(e%6e4/1e3);return`${String(t)} 分 ${String(s)} 秒`}const Jc=e=>e.toLocaleString("en-US");function Ga(e){if(e===void 0)return"未记录用量";const t=[`提示 ${Jc(e.promptTokens)}`,`输出 ${Jc(e.completionTokens)}`];return e.cachedTokens!==void 0&&t.push(`缓存 ${Jc(e.cachedTokens)}`),e.reasoningTokens!==void 0&&t.push(`推理 ${Jc(e.reasoningTokens)}`),t.join(" · ")}function xw(e){let t=0,s=0,r=0,a=0,c=!1,h=!1,f=!1;for(const g of e){const p=g.usage;p!==void 0&&(c=!0,t+=p.promptTokens,s+=p.completionTokens,p.cachedTokens!==void 0&&(h=!0,r+=p.cachedTokens),p.reasoningTokens!==void 0&&(f=!0,a+=p.reasoningTokens))}if(c)return{promptTokens:t,completionTokens:s,...h?{cachedTokens:r}:{},...f?{reasoningTokens:a}:{}}}function PB(e){const t=e.flatMap(a=>a.steps),s=[...e.flatMap(a=>a.cells),...t.flatMap(a=>a.cells)],r=t.reduce((a,c)=>a+(c.durationMs??0),0);return{轮数:e.length,步数:t.length,格数:s.length,工具数:s.filter(a=>a.kind==="tool-call").length,时长Ms:r>0?r:null,用量:xw(t)}}function qB(e,t,s){if(s.trim()!=="")return{视图:e,隐藏轮数:0};const r=Math.max(0,e.length-t);return{视图:e.slice(r),隐藏轮数:r}}function FB(e,t){const s=t.trim();return s===""?e:e.filter(r=>kl(r,s))}function kl(e,t){const s=t.trim().toLowerCase();return s===""?!0:[e.label??"",Xp(e.kind),e.ref??""].some(a=>a.toLowerCase().includes(s))}const eu=8,Ub=e=>{for(const t of e)if(t.ts!==void 0)return t.ts},ap=e=>{if(e===void 0)return"";const t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit",second:"2-digit"})},op=e=>typeof e=="object"&&e!==null?e:null;function $B(e,t){if(t!==void 0)for(const s of e){const r=op(s);if(!(r?.type!=="message/assistant"||!Array.isArray(r.content)))for(const a of r.content){const c=op(a);if(c?.toolCallId===t)return c.input}}}function VB(e,t){if(t!==void 0)for(const s of e){const r=op(s);if(r?.type==="tool/result"&&r.toolCallId===t)return r.output}}const tu=e=>{if(e===void 0)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}},Pb=e=>e!==void 0&&!(typeof e=="string"&&e==="");function YB({session:e,项:t,累计用量:s}){const[r,a]=k.useState("概述"),[c,h]=k.useState(null),[f,g]=k.useState(null),[p,v]=k.useState(!1),{cell:_,step:S}=t,y=_.kind==="tool-call";k.useEffect(()=>{let T=!0;h(null),g(null),a("概述");const O=Math.max(1,_.toSeq-_.fromSeq+1);return n2(e,_.fromSeq,O).then(U=>{T&&h(U)}).catch(U=>{T&&g(U instanceof Error?U.message:String(U))}),()=>{T=!1}},[e,_.fromSeq,_.toSeq]);const x=c?.events??[],w=y?$B(x,_.ref):void 0,j=y?VB(x,_.ref):void 0,N=["概述",...y?["参数","结果"]:[],"计时","用量","原始 JSON"],M=T=>{navigator.clipboard.writeText(T).then(()=>{v(!0),window.setTimeout(()=>{v(!1)},1400)}).catch(()=>{v(!1)})};return u.jsxs("aside",{className:"traj-inspector","aria-label":"轨迹记录详情",children:[u.jsxs("div",{className:"traj-ins-head",children:[u.jsx("span",{className:"ic","aria-hidden":"true",children:bw(_.kind)}),u.jsx("span",{className:"t",children:Xp(_.kind)}),u.jsxs("span",{className:"mut",children:["#",_.fromSeq,_.toSeq===_.fromSeq?"":`–${String(_.toSeq)}`]})]}),u.jsx("div",{className:"traj-tabs",role:"tablist",children:N.map(T=>u.jsx("button",{type:"button",role:"tab","aria-selected":r===T,className:r===T?"on":"",onClick:()=>{a(T)},children:T},T))}),u.jsxs("div",{className:"traj-ins-body",children:[f===null?null:u.jsxs("div",{className:"traj-ins-err",children:["正文回查失败:",f]}),r==="概述"?u.jsxs("dl",{className:"traj-facts",children:[u.jsx("dt",{children:"内容"}),u.jsx("dd",{children:_.label??"(无摘录)"}),u.jsx("dt",{children:"seq"}),u.jsxs("dd",{className:"mono",children:["#",_.fromSeq,_.toSeq===_.fromSeq?"":`–${String(_.toSeq)}`]}),u.jsx("dt",{children:"时长"}),u.jsx("dd",{children:jl(_.durationMs)??"不可用"}),u.jsx("dt",{children:"状态"}),u.jsx("dd",{children:_.durationMs===void 0&&_.kind==="tool-call"?"未记录结果时长":"已落盘"}),S?.model===void 0?null:u.jsxs(u.Fragment,{children:[u.jsx("dt",{children:"模型"}),u.jsx("dd",{className:"mono",children:S.model})]}),S?.usage===void 0?null:u.jsxs(u.Fragment,{children:[u.jsx("dt",{children:"用量"}),u.jsx("dd",{children:Ga(S.usage)})]})]}):null,r==="参数"?Pb(w)?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"traj-sec",children:"<工具入参>"}),u.jsx("pre",{className:"traj-pre",children:tu(w)}),u.jsx("button",{className:"btn",type:"button",onClick:()=>{M(tu(w))},children:p?"已复制":"复制参数"})]}):u.jsx("div",{className:"traj-ins-empty",children:"这次调用没记到入参"}):null,r==="结果"?c===null?u.jsx("div",{className:"traj-ins-empty",children:"读取中…"}):Pb(j)?u.jsxs(u.Fragment,{children:[u.jsx("pre",{className:"traj-pre",children:tu(j)}),u.jsx("button",{className:"btn",type:"button",onClick:()=>{M(tu(j))},children:p?"已复制":"复制结果"})]}):u.jsx("div",{className:"traj-ins-empty",children:"这次调用没记到结果"}):null,r==="计时"?u.jsxs("dl",{className:"traj-facts",children:[u.jsx("dt",{children:"本格时长"}),u.jsx("dd",{children:jl(_.durationMs)??"不可用"}),u.jsx("dt",{children:"请求耗时"}),u.jsx("dd",{children:jl(S?.durationMs)??"不可用"}),u.jsx("dt",{children:"开始时刻"}),u.jsx("dd",{className:"mono",children:ap(_.ts)||"不可用"}),u.jsx("dt",{children:"首 token"}),u.jsx("dd",{children:"不可用(日志不落首 token 时刻,不编)"})]}):null,r==="用量"?u.jsxs("dl",{className:"traj-facts",children:[u.jsx("dt",{children:"本次请求"}),u.jsx("dd",{children:Ga(S?.usage)}),u.jsx("dt",{children:"会话累计"}),u.jsx("dd",{children:s})]}):null,r==="原始 JSON"?c===null?u.jsx("div",{className:"traj-ins-empty",children:"读取中…"}):u.jsxs(u.Fragment,{children:[u.jsx("pre",{className:"traj-pre",children:JSON.stringify(x,null,2)}),u.jsx("button",{className:"btn",type:"button",onClick:()=>{M(JSON.stringify(x,null,2))},children:p?"已复制":"复制 JSON"})]}):null]})]})}function KB({session:e,title:t,onBack:s}){const[r,a]=k.useState(null),[c,h]=k.useState(e!==null),[f,g]=k.useState(null),[p,v]=k.useState("sequence"),[_,S]=k.useState(""),[y,x]=k.useState(eu),[w,j]=k.useState(new Set),[N,M]=k.useState(new Set),[T,O]=k.useState(null),[U,z]=k.useState(!1),A=k.useCallback(async()=>{if(e===null){a(null),h(!1);return}h(!0);try{const E=await t2(e);a(E),g(null)}catch(E){g(E instanceof Error?E.message:String(E))}finally{h(!1)}},[e]);k.useEffect(()=>{A()},[A]),k.useEffect(()=>{if(e===null)return;let E=!0;const ie=async()=>{try{const fe=await Kb(e);if(!E)return;z(fe.running),fe.running&&A()}catch{}};ie();const ce=window.setInterval(()=>{ie()},2e3);return()=>{E=!1,window.clearInterval(ce)}},[e,A]);const Y=r?.turns??[],ue=r?.preamble??[],{视图:P,隐藏轮数:J}=k.useMemo(()=>qB(Y,eu,_),[Y,_]),G=k.useMemo(()=>FB(ue,_),[ue,_]),L=k.useMemo(()=>PB(Y),[Y]),q=k.useMemo(()=>[...ue.length>0?[0]:[],...P.map(E=>E.fromSeq)],[ue.length,P]),F=q.length>0&&q.every(E=>w.has(E)),V=P.flatMap(E=>E.steps).length>0&&P.flatMap(E=>E.steps).every(E=>N.has(E.fromSeq)),Q=k.useMemo(()=>{const E=[];let ie=0,ce=0;if(G.length>0){const fe=w.has(0);if(E.push({type:"preamble",cells:G,时刻:Ub(G),收起:fe}),!fe)for(const ve of G)E.push({type:"cell",项:{cell:ve,railIndex:ce}}),ce+=1}for(let fe=0;fe<P.length;fe+=1){const ve=P[fe];if(ve===void 0)continue;const Z=Y.indexOf(ve)+1;if(!(!(ve.cells.some(se=>kl(se,_))||ve.steps.some(se=>se.cells.some(me=>kl(me,_))))&&_.trim()!=="")&&(E.push({type:"turn",轮号:Z,turn:ve,时刻:Ub([...ve.cells,...ve.steps.flatMap(se=>se.cells)]),步数:ve.steps.length,格数:ve.cells.length+ve.steps.reduce((se,me)=>se+me.cells.length,0)}),!w.has(ve.fromSeq))){for(const se of ve.cells)kl(se,_)&&(E.push({type:"cell",项:{cell:se,railIndex:ce}}),ce+=1);for(const se of ve.steps)if(ie+=1,!(se.cells.filter(xe=>kl(xe,_)).length===0&&_.trim()!=="")&&(E.push({type:"step",请求号:ie,step:se,格数:se.cells.length}),!N.has(se.fromSeq)))for(const xe of se.cells)kl(xe,_)&&(E.push({type:"cell",项:{cell:xe,step:se,railIndex:ce}}),ce+=1)}}return E},[P,G,Y,_,w,N]),K=[];for(const E of Q)E.type==="cell"&&K.push(E.项.cell);const ge=UB(K,p),D=(E,ie,ce,fe)=>{const ve=new Set(ie);ve.has(ce)?ve.delete(ce):ve.add(ce),E(ve)},Ae=()=>{j(F?new Set:new Set(q))},Se=()=>{const E=P.flatMap(ie=>ie.steps).map(ie=>ie.fromSeq);M(V?new Set:new Set(E))},R=Ga(xw(Y.flatMap(E=>E.steps)));return e===null?u.jsxs("div",{className:"traj-page",children:[u.jsxs("div",{className:"traj-top",children:[u.jsxs("button",{className:"back",type:"button",onClick:s,children:[u.jsx("span",{"aria-hidden":"true",children:"←"})," 返回"]}),u.jsx("div",{className:"traj-name",children:"轨迹"})]}),u.jsxs("div",{className:"traj-empty",children:[u.jsx("div",{className:"eic",children:"◇"}),u.jsx("div",{className:"et",children:"先选一个会话"}),u.jsx("div",{className:"es",children:"轨迹从会话的事件日志派生;没有会话就没有可看的格。"})]})]}):u.jsxs("div",{className:"traj-page",children:[u.jsxs("div",{className:"traj-top",children:[u.jsxs("button",{className:"back",type:"button",onClick:s,children:[u.jsx("span",{"aria-hidden":"true",children:"←"})," 返回"]}),u.jsxs("div",{className:"traj-name",children:["轨迹 ",u.jsx("span",{className:"mut",children:t})]}),u.jsxs("div",{className:"traj-meta",children:[L.轮数," 轮 · ",L.步数," 步 · ",L.格数+ue.length," 格",L.时长Ms===null?"":` · ${jl(L.时长Ms)??""}`,L.用量===void 0?"":` · ${Ga(L.用量)}`]}),u.jsx("div",{className:"grow"}),U?u.jsxs("span",{className:"chip live",children:[u.jsx("span",{className:"pulse"}),"运行中"]}):null,u.jsx("div",{className:"seg",role:"group","aria-label":"导轨投影",children:zB.map(E=>u.jsx("button",{type:"button",className:p===E.mode?"on":"",title:E.说明,"aria-pressed":p===E.mode,onClick:()=>{v(E.mode)},children:E.名},E.mode))}),u.jsx("input",{className:"traj-search",type:"search",value:_,placeholder:"搜索轨迹","aria-label":"搜索轨迹",onChange:E=>{S(E.target.value)}}),u.jsxs("button",{type:"button",className:F?"traj-fold on":"traj-fold","aria-pressed":F,title:F?"展开所有轮次":"收起所有轮次",onClick:Ae,children:[F?"⊞":"⊟"," 轮次"]}),u.jsxs("button",{type:"button",className:V?"traj-fold on":"traj-fold","aria-pressed":V,title:V?"展开所有请求":"收起所有请求",onClick:Se,children:[V?"⊞":"⊟"," 请求"]})]}),f!==null?u.jsxs("div",{className:"conn-banner",children:[u.jsx("span",{className:"warn",children:"⚠"}),u.jsxs("span",{children:["轨迹载入失败:",f]}),u.jsx("button",{className:"btn",type:"button",onClick:()=>{A()},children:"重试"})]}):null,u.jsxs("div",{className:"traj-body",children:[u.jsx("div",{className:"traj-main",children:c&&r===null?u.jsxs("div",{className:"traj-skeleton","aria-label":"载入轨迹",children:[u.jsx("div",{className:"sk sk-head"}),u.jsx("div",{className:"sk sk-line"}),u.jsx("div",{className:"sk sk-line"}),u.jsx("div",{className:"sk sk-line short"})]}):Q.length===0?u.jsxs("div",{className:"traj-empty",children:[u.jsx("div",{className:"eic",children:"◇"}),u.jsx("div",{className:"et",children:Y.length===0&&ue.length===0?"这个会话还没有轨迹":"没有匹配的格"}),u.jsx("div",{className:"es",children:Y.length===0&&ue.length===0?"轨迹由事件日志派生:发一句话、跑一次工具之后就会出现。":"换个关键词,或清空搜索框。"})]}):u.jsxs("table",{className:"traj-table","aria-label":"轨迹账本",children:[u.jsxs("colgroup",{children:[u.jsx("col",{className:"c-kind"}),u.jsx("col",{className:"c-label"}),u.jsx("col",{className:"c-seq"}),u.jsx("col",{className:"c-dur"}),u.jsx("col",{className:"c-rail"})]}),u.jsx("thead",{children:u.jsxs("tr",{children:[u.jsx("th",{children:"类型"}),u.jsx("th",{children:"内容"}),u.jsx("th",{children:"seq"}),u.jsx("th",{children:"时长"}),u.jsx("th",{children:"导轨"})]})}),u.jsxs("tbody",{children:[J>0?u.jsx("tr",{className:"traj-more",children:u.jsx("td",{colSpan:5,children:u.jsxs("button",{type:"button",className:"btn",onClick:()=>{x(E=>E+eu)},children:["载入更早的 ",Math.min(J,eu)," 轮(还剩 ",J," 轮)"]})})}):null,Q.map((E,ie)=>{if(E.type==="preamble")return u.jsx("tr",{className:"traj-turn-row",onClick:()=>{D(j,w,0)},children:u.jsxs("td",{colSpan:5,children:[u.jsx("span",{className:"chev",children:E.收起?"▸":"▾"}),u.jsx("span",{className:"th",children:"启动前"}),u.jsxs("span",{className:"mut",children:[E.cells.length," 格 · 首次用户消息之前"]}),u.jsx("span",{className:"time",children:ap(E.时刻)})]})},"preamble");if(E.type==="turn"){const se=w.has(E.turn.fromSeq);return u.jsx("tr",{className:"traj-turn-row",onClick:()=>{D(j,w,E.turn.fromSeq)},children:u.jsxs("td",{colSpan:5,children:[u.jsx("span",{className:"chev",children:se?"▸":"▾"}),u.jsxs("span",{className:"th",children:["第 ",E.轮号," 轮"]}),u.jsxs("span",{className:"mut",children:[E.步数," 步 · ",E.格数," 格"]}),u.jsx("span",{className:"time",children:ap(E.时刻)})]})},`t-${String(E.turn.fromSeq)}`)}if(E.type==="step"){const se=N.has(E.step.fromSeq);return u.jsx("tr",{className:"traj-step-row",onClick:()=>{D(M,N,E.step.fromSeq)},children:u.jsxs("td",{colSpan:5,children:[u.jsx("span",{className:"chev",children:se?"▸":"▾"}),u.jsxs("span",{className:"req",children:["请求 #",E.请求号]}),E.step.model===void 0?null:u.jsx("span",{className:"mut mono",children:E.step.model}),E.step.usage===void 0?null:u.jsx("span",{className:"mut",children:Ga(E.step.usage)}),E.step.durationMs===void 0?null:u.jsx("span",{className:"mut",children:jl(E.step.durationMs)}),u.jsxs("span",{className:"mut",children:[E.格数," 格"]})]})},`s-${String(E.step.fromSeq)}`)}const{cell:ce,step:fe,railIndex:ve}=E.项,Z=ge[ve]??null,le=T!==null&&T.cell.fromSeq===ce.fromSeq&&T.cell.kind===ce.kind;return u.jsxs("tr",{className:le?"traj-cell-row sel":"traj-cell-row",tabIndex:0,onClick:()=>{O({cell:ce,step:fe,railIndex:ve})},onKeyDown:se=>{se.key==="Enter"&&O({cell:ce,step:fe,railIndex:ve})},children:[u.jsxs("td",{className:"k",children:[u.jsx("span",{className:`ic ${ce.kind==="tool-call"?"tool":ce.kind==="assistant-text"?"as":""}`,"aria-hidden":"true",children:bw(ce.kind)}),Xp(ce.kind)]}),u.jsx("td",{className:"label",title:ce.label??"",children:ce.label??"(无摘录)"}),u.jsxs("td",{className:"seq mono",children:["#",ce.fromSeq,ce.toSeq===ce.fromSeq?"":`–${String(ce.toSeq)}`]}),u.jsx("td",{className:"dur mono",children:jl(ce.durationMs)??"—"}),u.jsx("td",{className:"rail",children:u.jsx("span",{className:"track",children:Z===null?null:u.jsx("i",{className:"bar",style:{left:`${String(Z.left)}%`,width:`${String(Z.width)}%`}})})})]},`c-${String(ce.fromSeq)}-${ce.kind}-${String(ie)}`)})]})]})}),T===null?null:u.jsx(YB,{session:e,项:T,累计用量:R})]})]})}function WB(e,t=20){return Me(`/search?all=1&limit=${String(t)}&q=${encodeURIComponent(e)}`)}const xl={grouping:"workspace",sorting:"recent",filter:"all"},ww="daluo.sidebar.view",XB=["workspace","tree","flat"],GB=["manual","recent"],QB=["active","all","archived"];function ZB(e){try{const t=e?.getItem(ww);if(t==null)return xl;const s=JSON.parse(t);if(typeof s!="object"||s===null)return xl;const r=s;return{grouping:XB.includes(r.grouping)?r.grouping:xl.grouping,sorting:GB.includes(r.sorting)?r.sorting:xl.sorting,filter:QB.includes(r.filter)?r.filter:xl.filter}}catch{return xl}}function JB(e,t){try{t?.setItem(ww,JSON.stringify(e))}catch{}}const Cw=(e,t)=>t===""||(e.title??e.name).toLowerCase().includes(t),wl=e=>e.reduce((t,s)=>Math.max(t,s.row.lastActiveMs),0);function ku(e,t){return t==="manual"?e:[...e].sort((s,r)=>r.row.lastActiveMs-s.row.lastActiveMs)}function e6(e){const t=e.lastIndexOf("/");return t>0?e.slice(0,t):"/"}function t6(e,t,s=""){const r=s.trim().toLowerCase(),a=[];for(const h of e)for(const f of h.sessions)Cw(f,r)&&f.archived&&a.push({row:f,group:h});if(t.filter==="archived"){const h=ku(a,t.sorting);return{sections:[],archivedRows:h,total:0}}if(t.filter==="active"&&a.length>0)return{sections:sm(e,t,r),archivedRows:[],total:qb(sm(e,t,r))};const c=sm(e,t,r);return{sections:c,archivedRows:t.sorting==="manual"?a:ku(a,t.sorting),total:qb(c)}}function qb(e){return e.reduce((t,s)=>t+s.rows.length,0)}function sm(e,t,s){const r=c=>ku(c.sessions.filter(h=>!h.archived&&Cw(h,s)).map(h=>({row:h,group:c})),t.sorting);if(t.grouping==="flat"){const c=[];for(const f of e)c.push(...r(f));const h=t.sorting==="manual"?c:ku(c,t.sorting);return h.length===0?[]:[{key:"flat",title:"全部会话",depth:0,root:"",active:!1,rows:h}]}if(t.grouping==="tree"){const c=new Map;for(const g of e){const p=r(g);if(p.length===0)continue;const v=e6(g.root),_={key:g.root,title:g.name,depth:1,root:g.root,active:g.active,rows:p};c.set(v,[...c.get(v)??[],_])}const h=[...c.keys()];t.sorting==="recent"&&h.sort((g,p)=>wl(c.get(p).flatMap(v=>v.rows))-wl(c.get(g).flatMap(v=>v.rows)));const f=[];for(const g of h){const p=c.get(g);t.sorting==="recent"&&p.sort((v,_)=>wl(_.rows)-wl(v.rows)),f.push({key:`tree:${g}`,title:g.split("/").filter(Boolean).at(-1)??g,depth:0,root:g,active:!1,rows:[]}),f.push(...p)}return f}const a=[];for(const c of e){const h=r(c);h.length!==0&&a.push({key:c.root,title:c.name,depth:0,root:c.root,active:c.active,rows:h})}return t.sorting==="recent"&&a.sort((c,h)=>wl(h.rows)-wl(c.rows)),a}function kw(e,t=Date.now()){if(!Number.isFinite(e)||e<=0)return"";const s=t-e;if(s<6e4)return"刚刚";if(s<36e5)return`${String(Math.floor(s/6e4))} 分钟前`;if(s<864e5)return`${String(Math.floor(s/36e5))} 小时前`;if(s<1728e5)return"昨天";if(s<7*864e5)return`${String(Math.floor(s/864e5))} 天前`;const r=new Date(e),a=String(r.getMonth()+1).padStart(2,"0"),c=String(r.getDate()).padStart(2,"0");return`${a}-${c}`}function n6(e,t=Date.now()){let s=0;for(const r of e)r.lastActiveMs>s&&(s=r.lastActiveMs);return kw(s,t)}function i6(e,t=Date.now()){if(!Number.isFinite(e)||e<=0)return"";const s=new Date(e);return new Date(t).toDateString()===s.toDateString()?`${String(s.getHours()).padStart(2,"0")}:${String(s.getMinutes()).padStart(2,"0")}`:`${String(s.getMonth()+1).padStart(2,"0")}-${String(s.getDate()).padStart(2,"0")}`}const Mi=(e,t)=>e!==null&&e.root===t.root&&e.name===t.name;function s6({text:e,query:t}){if(t==="")return u.jsx(u.Fragment,{children:e});const s=e.toLowerCase().indexOf(t.toLowerCase());return s<0?u.jsx(u.Fragment,{children:e}):u.jsxs(u.Fragment,{children:[e.slice(0,s),u.jsx("mark",{children:e.slice(s,s+t.length)}),e.slice(s+t.length)]})}function r6({labels:e}){return u.jsx("span",{className:"label-chips",children:Object.entries(e).map(([t,s])=>u.jsxs("span",{className:"label-chip",title:`${t}: ${s}`,children:[u.jsx("span",{className:"k",children:t}),s]},t))})}const Fb=e=>e.labels??{},l6=[["workspace","按工作区"],["tree","按工作区树"],["flat","单列表"]],a6=[["manual","手动排序"],["recent","最近更新"]],o6=[["active","隐藏已归档"],["all","全部对话(显示已归档)"],["archived","仅显示已归档"]];function c6({groups:e,activeName:t,loading:s,loadError:r,onNewChat:a,onSelect:c,onRename:h,onDelete:f,onPin:g,onArchive:p,onLabels:v,onReload:_,onOpenSettings:S,onOpenSearchHit:y}){const[x,w]=k.useState(""),[j,N]=k.useState([]),[M,T]=k.useState(!1),[O,U]=k.useState(null),[z,A]=k.useState(new Set),[Y,ue]=k.useState(null),[P,J]=k.useState(null),[G,L]=k.useState(""),[q,F]=k.useState(null),[V,Q]=k.useState(null),[K,ge]=k.useState(null),[D,Ae]=k.useState(null),[Se,R]=k.useState(null),[E,ie]=k.useState([]),[ce,fe]=k.useState(null),[ve,Z]=k.useState(!1),[le,se]=k.useState(!1),[me,xe]=k.useState(()=>ZB(typeof window>"u"?void 0:window.localStorage)),[Fe,Xe]=k.useState(!1),Ge=k.useRef(null),nt=k.useRef(null);k.useEffect(()=>{const re=x.trim();if(re===""){N([]),T(!1),U(null);return}let H=!1;T(!0),U(null);const we=window.setTimeout(()=>{WB(re).then(je=>{H||N(je.hits)}).catch(je=>{H||(N([]),U(je instanceof Error?je.message:String(je)))}).finally(()=>{H||T(!1)})},250);return()=>{H=!0,window.clearTimeout(we)}},[x]),k.useEffect(()=>{const re=H=>{(H.metaKey||H.ctrlKey)&&H.key.toLowerCase()==="k"&&(H.preventDefault(),Ge.current?.focus())};return window.addEventListener("keydown",re),()=>{window.removeEventListener("keydown",re)}},[]),k.useEffect(()=>{if(!Fe)return;const re=we=>{nt.current!==null&&!nt.current.contains(we.target)&&Xe(!1)},H=we=>{we.key==="Escape"&&Xe(!1)};return document.addEventListener("mousedown",re),document.addEventListener("keydown",H),()=>{document.removeEventListener("mousedown",re),document.removeEventListener("keydown",H)}},[Fe]),k.useEffect(()=>{if(D===null)return;const re=setTimeout(()=>{Ae(null)},1500);return()=>{clearTimeout(re)}},[D]);const $e=k.useMemo(()=>t6(e,me,x),[e,me,x]),{sections:Ot,archivedRows:kt,total:ke}=$e;k.useEffect(()=>{JB(me,typeof window>"u"?void 0:window.localStorage),me.filter==="archived"&&se(!0)},[me]);const Oe=re=>{ue(H=>Mi(H,re)?null:re),F(null),Q(null)},oe=(re,H)=>{ue(null),J(re),L(H.title??H.name),ge(null)},Ne=async(re,H)=>{const we=G.trim();if(we===""){ge({key:re,message:"名字不能为空"});return}try{await h(H,we),J(null)}catch(je){ge({key:re,message:je instanceof Error?je.message:String(je)})}},Le=async re=>{ue(null);const H=`${location.origin}/?session=${encodeURIComponent(re.name)}`;try{await navigator.clipboard.writeText(H),Ae(re)}catch{ge({key:re,message:`复制失败,手动复制:${H}`})}},Qe=(re,H)=>{ue(null),R({key:re,row:H}),ie(UA(H.labels)),fe(null)},ae=async()=>{if(!(Se===null||ve)){Z(!0),fe(null);try{await v(Se.row,PA(E)),R(null)}catch(re){fe(re instanceof Error?re.message:String(re))}finally{Z(!1)}}},_e=async(re,H)=>{Q(null),ue(null);try{await p(H,!0)}catch(we){ge({key:re,message:we instanceof Error?we.message:String(we)})}};return u.jsxs("aside",{className:"sidebar",children:[u.jsxs("div",{className:"brand",children:[u.jsx("div",{className:"brand-mark",title:"大罗 · 层天",children:"✦"}),u.jsx("div",{children:u.jsx("div",{className:"brand-name",children:"大罗"})}),u.jsx("div",{className:"brand-sub",children:document.querySelector('meta[name="daluo-version-label"]')?.getAttribute("content")??""}),u.jsx("button",{className:"icon-btn",title:"收起侧栏","aria-label":"收起侧栏",children:u.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[u.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),u.jsx("path",{d:"M9 4v16"})]})})]}),u.jsxs("button",{className:"new-chat",onClick:a,children:[u.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:u.jsx("path",{d:"M12 5v14M5 12h14"})}),"新会话",u.jsx("kbd",{children:"⌘N"})]}),u.jsxs("div",{className:"search-line",ref:nt,children:[u.jsxs("div",{className:x===""?"search":"search searching",children:[u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[u.jsx("circle",{cx:"11",cy:"11",r:"7"}),u.jsx("path",{d:"m20 20-3.5-3.5"})]}),u.jsx("input",{ref:Ge,value:x,placeholder:"搜索会话…","aria-label":"搜索会话",onChange:re=>{w(re.target.value)},onKeyDown:re=>{re.key==="Escape"&&(w(""),re.currentTarget.blur())}}),x===""?u.jsx("kbd",{children:"⌘K"}):u.jsx("button",{className:"clear",title:"清空 (Esc)",onClick:()=>{w(""),Ge.current?.focus()},children:"✕"})]}),u.jsx("button",{className:Fe?"sb-view-btn on":"sb-view-btn",type:"button",title:"分组 / 排序 / 筛选","aria-label":"分组 / 排序 / 筛选",onClick:()=>{Xe(re=>!re)},children:"⇅"}),Fe?u.jsxs("div",{className:"sb-view-menu",children:[u.jsx("div",{className:"sb-menu-head",children:"分组方式"}),l6.map(([re,H])=>u.jsxs("button",{className:"sb-opt",type:"button",onClick:()=>{xe(we=>({...we,grouping:re})),Xe(!1)},children:[u.jsx("span",{className:"g",children:me.grouping===re?"✓":" "}),H]},re)),u.jsx("div",{className:"sb-menu-head",children:"排序方式"}),a6.map(([re,H])=>u.jsxs("button",{className:"sb-opt",type:"button",onClick:()=>{xe(we=>({...we,sorting:re})),Xe(!1)},children:[u.jsx("span",{className:"g",children:me.sorting===re?"✓":" "}),H]},re)),u.jsx("div",{className:"sb-menu-head",children:"筛选会话"}),o6.map(([re,H])=>u.jsxs("button",{className:"sb-opt",type:"button",onClick:()=>{xe(we=>({...we,filter:re})),Xe(!1)},children:[u.jsx("span",{className:"g",children:me.filter===re?"✓":" "}),H]},re))]}):null]}),u.jsxs("div",{className:"sessions",children:[x!==""?u.jsxs("div",{className:"result-meta",children:[ke," 个标题结果 · Esc 清空"]}):null,x===""||y===void 0?null:u.jsxs("div",{className:"content-hits",children:[u.jsxs("div",{className:"content-hits-head",children:["内容命中",M?" · 检索中…":j.length===0?" · 无":` · ${String(j.length)}`]}),O===null?null:u.jsx("div",{className:"content-hit-err",children:O}),j.map(re=>u.jsxs("button",{className:"search-hit",type:"button",title:`${re.workspace} · ${re.file} · seq ${String(re.seq)}`,onClick:()=>{y(re)},children:[u.jsxs("div",{className:"search-hit-meta",children:[u.jsx("span",{className:"ws",children:re.workspace}),u.jsx("span",{className:"role",children:re.role==="user"?"你":"大罗"}),u.jsxs("span",{className:"seq",children:["#",String(re.seq)]}),u.jsx("span",{className:"ts",children:new Date(re.ts).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"})})]}),u.jsx("div",{className:"search-hit-snippet",children:re.snippet})]},`${re.root}/${re.file}/${String(re.seq)}`))]}),s&&e.length===0?u.jsx("div",{className:"sessions-state",children:"读取会话列表…"}):null,r===null?null:u.jsxs("div",{className:"sessions-state",children:[u.jsxs("span",{className:"err",children:["会话列表读不到:",r]}),u.jsx("button",{className:"link-btn",onClick:()=>{_()},children:"重试"})]}),!s&&r===null&&ke===0&&x!==""?u.jsxs("div",{className:"empty-result",children:[u.jsx("span",{className:"big",children:"◇"}),"没有找到「",x,"」",u.jsx("br",{}),"按 Esc 清空搜索"]}):null,!s&&r===null&&ke===0&&x===""?u.jsxs("div",{className:"empty-result",children:[u.jsx("span",{className:"big",children:"◇"}),kt.length===0?me.filter==="archived"?"还没有已归档会话":"还没有会话":me.filter==="archived"?"":"没有活跃会话",u.jsx("br",{}),kt.length===0?"点「新会话」开始":me.filter==="archived"?"这里只显示已归档会话":`展开下面的「已归档 ${String(kt.length)}」`]}):null,Ot.map(re=>u.jsxs("div",{className:`group${re.depth>0?" tree-child":""}`,"data-open":!z.has(re.key)||x!=="",children:[u.jsxs("div",{className:"group-label",title:re.root===""?re.title:re.root,style:re.depth>0?{paddingLeft:"26px"}:void 0,onClick:()=>{A(H=>{const we=new Set(H);return we.has(re.key)?we.delete(re.key):we.add(re.key),we})},children:[u.jsx("svg",{className:"chev",width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",children:u.jsx("path",{d:"m6 9 6 6 6-6"})}),u.jsx("span",{className:"g",children:"▤"}),u.jsx("span",{className:"dir",children:re.title}),re.active?u.jsx("span",{className:"here",children:"当前"}):null,u.jsx("span",{className:"recent",children:re.rows.length===0?"":n6(re.rows.map(H=>H.row))}),re.rows.length===0?null:u.jsx("span",{className:"count",children:re.rows.length})]}),u.jsx("div",{className:"group-items",children:re.rows.map(({row:H,group:we})=>{const je={root:we.root,name:H.name},ot=H.title??H.name,gt=Object.keys(Fb(H)).length>0;return u.jsxs("div",{className:"row-menu",children:[Mi(P,je)?u.jsxs("div",{className:"session editing",children:[u.jsx("span",{className:"dot"}),u.jsx("input",{className:"rename-input",ref:rt=>{rt!==null&&(rt.focus({preventScroll:!0}),rt.select())},value:G,onChange:rt=>{L(rt.target.value)},onKeyDown:rt=>{rt.key==="Enter"?(rt.preventDefault(),Ne(je,H)):rt.key==="Escape"&&(J(null),ge(null))},onBlur:()=>{J(null)}})]}):u.jsxs("div",{className:`session${H.name===t&&we.active?" active":""}${Mi(Y,je)?" menu-open":""}${gt?" has-labels":""}`,onClick:()=>{c(H,we)},children:[u.jsx("span",{className:"dot"}),u.jsx("span",{className:"title",children:u.jsx(s6,{text:ot,query:x})}),H.forkedFrom===void 0?null:u.jsx("span",{className:"fork-badge",title:`从 ${H.forkedFrom.file} 的 seq ${String(H.forkedFrom.seq)} 分叉`,children:"分叉"}),Mi(D,je)?u.jsx("span",{className:"meta",children:"已复制"}):null,Mi(D,je)?null:H.waiting===!0?u.jsx("span",{className:"meta waiting",children:"!"}):H.running===!0?u.jsx("span",{className:"meta running",children:"●"}):u.jsx("span",{className:"meta",children:i6(H.lastActiveMs)}),we.active?u.jsx("button",{className:"more",title:"会话操作","aria-label":"会话操作",onClick:rt=>{rt.stopPropagation(),Oe(je)},children:"⋯"}):null,gt?u.jsx(r6,{labels:Fb(H)}):null]}),Mi(Y,je)?u.jsxs("div",{className:"menu row-menu-pop",children:[u.jsx("div",{className:"menu-head",children:"会话操作"}),u.jsxs("button",{className:"menu-item",onClick:()=>{oe(je,H)},children:[u.jsx("span",{className:"g",children:"✎"})," 重命名",u.jsx("span",{className:"key",children:"F2"})]}),u.jsxs("button",{className:"menu-item",onClick:()=>{ue(null),g(H).catch(rt=>{ge({key:je,message:rt instanceof Error?rt.message:String(rt)})})},children:[u.jsx("span",{className:"g",children:"↧"})," 置顶",u.jsx("span",{className:"key"})]}),u.jsxs("button",{className:"menu-item",onClick:()=>{Le(je)},children:[u.jsx("span",{className:"g",children:"⑂"})," 复制会话链接",u.jsx("span",{className:"key"})]}),u.jsx("div",{className:"menu-sep"}),u.jsxs("button",{className:"menu-item",onClick:()=>{Qe(je,H)},children:[u.jsx("span",{className:"g",children:"⌁"})," 标签…",u.jsx("span",{className:"key"})]}),u.jsxs("button",{className:"menu-item",onClick:()=>{ue(null),Q(je),ge(null)},children:[u.jsx("span",{className:"g",children:"▣"})," 归档",u.jsx("span",{className:"key"})]}),u.jsx("div",{className:"menu-sep"}),u.jsxs("button",{className:"menu-item danger",onClick:()=>{ue(null),F(je),ge(null)},children:[u.jsx("span",{className:"g",children:"✕"})," 删除会话",u.jsx("span",{className:"key",children:"⌫"})]})]}):null,Mi(V,je)?u.jsxs("div",{className:"confirm archived-confirm",children:[u.jsxs("div",{className:"t",children:["归档会话 ",u.jsxs("b",{className:"t-name",children:["「",ot,"」"]}),"?",u.jsx("br",{}),"从主列表移到「已归档」,日志不动;随时可以恢复。"]}),u.jsxs("div",{className:"a",children:[u.jsx("button",{className:"btn",onClick:()=>{Q(null)},children:"取消"}),u.jsx("button",{className:"btn primary",onClick:()=>{_e(je,H)},children:"归档"})]})]}):null,Mi(q,je)?u.jsxs("div",{className:"confirm",children:[u.jsxs("div",{className:"t",children:["删除会话 ",u.jsxs("b",{children:["「",ot,"」"]}),"?",u.jsx("br",{}),"会话日志会一起删除,不可恢复。"]}),u.jsxs("div",{className:"a",children:[u.jsx("button",{className:"btn",onClick:()=>{F(null)},children:"取消"}),u.jsx("button",{className:"btn danger-solid",onClick:()=>{f(H).then(()=>{F(null)},rt=>{ge({key:je,message:rt instanceof Error?rt.message:String(rt)})})},children:"删除"})]})]}):null,K!==null&&Mi(K.key,je)?u.jsx("div",{className:"action-error",children:K.message}):null]},`${we.root}/${H.name}`)})})]},re.key))]}),kt.length===0?null:u.jsxs("div",{className:"archived","data-open":me.filter==="archived"?!0:le,children:[u.jsxs("button",{className:"archived-toggle","aria-expanded":le,onClick:()=>{se(re=>!re)},children:[u.jsx("span",{className:"chev",children:me.filter==="archived"||le?"▾":"▸"})," 已归档 ",u.jsx("span",{className:"count",children:kt.length})]}),le||me.filter==="archived"?u.jsx("div",{className:"archived-items",children:kt.map(({group:re,row:H})=>{const we={root:re.root,name:H.name},je=H.title??H.name;return u.jsxs("div",{className:"row-menu",children:[u.jsxs("div",{className:"session archived-row",title:"点开查看;取消归档会把它放回主列表",onClick:()=>{c(H,re)},children:[u.jsx("span",{className:"dot"}),u.jsx("span",{className:"title",children:je}),u.jsx("button",{className:"unarchive",onClick:ot=>{ot.stopPropagation(),p(H,!1).catch(gt=>{ge({key:we,message:gt instanceof Error?gt.message:String(gt)})})},children:"取消归档"})]}),K!==null&&Mi(K.key,we)?u.jsx("div",{className:"action-error",children:K.message}):null]},`${re.root}/${H.name}`)})}):null]}),u.jsx("div",{className:"sidebar-foot",children:u.jsxs("button",{className:"foot-item",onClick:S,children:[u.jsx("span",{className:"g",style:{width:"15px",textAlign:"center"},children:"⚙"}),"设置",u.jsx("span",{className:"spacer"}),u.jsx("kbd",{children:"⌘,"})]})}),Se===null?null:u.jsx("div",{className:"modal-backdrop label-backdrop",onClick:()=>{ve||R(null)},children:u.jsxs("div",{className:"modal-card",role:"dialog","aria-label":"编辑标签",onClick:re=>{re.stopPropagation()},children:[u.jsxs("div",{className:"modal-head",children:["编辑标签 ",u.jsx("span",{className:"mut",children:Se.row.title??Se.row.name})]}),u.jsxs("div",{className:"modal-body",children:[u.jsx("div",{className:"label-rows",children:E.map((re,H)=>u.jsxs("div",{className:"label-row",children:[u.jsx("input",{className:"label-key",value:re.key,placeholder:"键(如 run / pr / ticket)","aria-label":"标签键",onChange:we=>{const je=we.target.value;ie(ot=>ot.map((gt,rt)=>rt===H?{...gt,key:je}:gt))}}),u.jsx("span",{className:"sep",children:"="}),u.jsx("input",{className:"label-val",value:re.value,placeholder:"值","aria-label":"标签值",onChange:we=>{const je=we.target.value;ie(ot=>ot.map((gt,rt)=>rt===H?{...gt,value:je}:gt))}}),u.jsx("button",{className:"label-del",title:"删除",onClick:()=>{ie(we=>we.filter((je,ot)=>ot!==H))},children:"✕"})]},H))}),u.jsx("button",{className:"add-label",onClick:()=>{ie(re=>[...re,{key:"",value:""}])},children:"+ 添加标签"}),u.jsxs("div",{className:"modal-note",children:["标签写进日志(",u.jsx("code",{children:"session/labels"}),"),只作关联标识、不进决策链;",u.jsx("b",{children:"键和值都是自由字符串"}),",",u.jsx("code",{children:"{}"})," 清空。会话在跑时改不了(日志归那一轮写,服务端 409)。"]}),ce===null?null:u.jsx("div",{className:"dialog-error",children:ce})]}),u.jsxs("div",{className:"modal-foot",children:[u.jsx("button",{className:"btn",disabled:ve,onClick:()=>{R(null)},children:"取消"}),u.jsx("button",{className:"btn primary",disabled:ve,onClick:()=>{ae()},children:"保存标签"})]})]})})]})}function u6(e){const[t,s]=k.useState(null),[r,a]=k.useState(!1),[c,h]=k.useState(null),[f,g]=k.useState("connecting"),[p,v]=k.useState(""),_=k.useRef(!0),S=k.useRef(e);S.current=e;const y=k.useCallback(async()=>{const x=S.current;if(x===null){s(null);return}try{const w=await VN(x);if(!_.current||S.current!==x)return;s(w),h(null),v("")}catch(w){if(!_.current||S.current!==x)return;h(w instanceof Error?w.message:String(w))}},[]);return k.useEffect(()=>(_.current=!0,e===null?(s(null),h(null),v(""),a(!1),()=>{_.current=!1}):(a(!0),s(null),h(null),v(""),y().finally(()=>{_.current&&a(!1)}),()=>{_.current=!1})),[e,y]),k.useEffect(()=>{if(e===null){g("connecting");return}let x;const w=()=>{x!==void 0&&clearTimeout(x),x=setTimeout(()=>{y()},150)},j=new EventSource(`/events?session=${encodeURIComponent(e)}`);return j.onopen=()=>{g("open"),w()},j.onerror=()=>{g("closed")},j.onmessage=N=>{let M=null;try{M=JSON.parse(N.data)}catch{return}if(M===null)return;const T=M.delta;if(M.type==="assistant/delta"&&T?.kind==="text"&&typeof T.text=="string"){const O=T.text;v(U=>U+O)}M.type==="message/assistant"&&v(""),w()},()=>{x!==void 0&&clearTimeout(x),j.close(),g("connecting")}},[e,y]),{view:t,loading:r,error:c,stream:f,liveText:p,reload:y}}const Tl=new URLSearchParams(location.search),h6=Tl.get("theme")==="dark"?"dark":"light",d6=Tl.get("view")==="settings"?"settings":Tl.get("view")==="trajectory"?"trajectory":Tl.get("view")==="empty"?"empty":"conv",$b=Tl.get("session"),f6=(()=>{const e=Tl.get("seq"),t=e===null?Number.NaN:Number(e);return Number.isInteger(t)&&t>0?t:void 0})();function m6(){const[e,t]=k.useState(h6),[s,r]=k.useState(d6),[a,c]=k.useState([]),[h,f]=k.useState(!0),[g,p]=k.useState(null),[v,_]=k.useState($b),[S,y]=k.useState("新会话"),[x,w]=k.useState(!0),[j,N]=k.useState(0),[M,T]=k.useState(null),[O,U]=k.useState(null),[z,A]=k.useState(!1),[Y,ue]=k.useState(null),[P,J]=k.useState(!1),[G,L]=k.useState(null),q=u6(v);k.useEffect(()=>{document.documentElement.dataset.theme=e},[e]),k.useEffect(()=>{const Z=le=>{if((le.metaKey||le.ctrlKey)&&le.key.toLowerCase()==="k"){le.preventDefault(),J(se=>!se);return}if((le.metaKey||le.ctrlKey)&&le.key===","){le.preventDefault(),r("settings");return}(le.metaKey||le.ctrlKey)&&le.key.toLowerCase()==="t"&&(le.preventDefault(),r("trajectory"))};return window.addEventListener("keydown",Z),()=>{window.removeEventListener("keydown",Z)}},[]);const F=k.useCallback(async()=>{f(!0);try{const Z=await DN({archived:!0});c(Z.groups),p(null);const le=new URLSearchParams(location.search).get("session")??$b;if(le!==null){for(const se of Z.groups){const me=se.sessions.find(xe=>xe.name===le);if(me!==void 0){_(me.name),y(me.title??me.name);return}}_(le),y(le);return}y(se=>se)}catch(Z){p(Z instanceof Error?Z.message:String(Z))}finally{f(!1)}},[]);k.useEffect(()=>{F()},[F]),k.useEffect(()=>{if(h||s!=="conv"||v!==null||new URLSearchParams(location.search).get("session")!==null)return;const le=(a.find(se=>se.active)??a[0])?.sessions.find(se=>se.archived!==!0);le!==void 0&&(_(le.name),y(le.title??le.name),history.replaceState(null,"",`/?session=${encodeURIComponent(le.name)}`))},[h,a,s,v]);const V=()=>{t(Z=>Z==="dark"?"light":"dark")},Q=(Z,le)=>{r("conv"),_(Z),y(le??Z),history.replaceState(null,"",`/?session=${encodeURIComponent(Z)}`)},K=()=>{r("empty"),_(null),y("新会话"),history.replaceState(null,"","/")},ge=Z=>{Q(Z.name,Z.title??Z.name)},D=(Z,le)=>{if(le.active){ge(Z);return}T(null),D0(le.root).then(()=>{location.href=`/?session=${encodeURIComponent(Z.name)}`}).catch(se=>{T(se instanceof Error?se.message:String(se))})},Ae=Date.now(),Se=[{id:"action:new",group:"动作",label:"新会话",hint:"⌘N",keywords:"new chat",run:K},{id:"action:settings",group:"动作",label:"打开设置",hint:"⌘,",keywords:"settings 提供方 模型 外观",run:()=>{r("settings")}},{id:"action:trajectory",group:"动作",label:"打开轨迹",hint:"⌘T",keywords:"trajectory 轨迹 时间线 用量 tokens",run:()=>{r("trajectory")}},{id:"action:theme",group:"动作",label:e==="dark"?"切换到浅色主题":"切换到深色主题",hint:"主题",keywords:"theme dark light",run:()=>{t(e==="dark"?"light":"dark")}},{id:"action:reload",group:"动作",label:"刷新会话列表",hint:"R",keywords:"refresh reload",run:()=>{F()}},...a.flatMap(Z=>Z.sessions.map(le=>({id:`session:${le.name}`,group:"会话",label:le.title??le.name,hint:kw(le.lastActiveMs,Ae),keywords:`${le.name} ${Z.name}`,run:()=>{r("conv"),ge(le)}}))).slice(0,80)],R=async Z=>{if(v===null)return;const le=v,se=S,me=await N0(le,Z.at);Q(me.session),await F(),L({session:me.session,source:le,sourceTitle:se,at:Z.at,round:Z.round,quote:Z.quote.length>160?`${Z.quote.slice(0,160)}…`:Z.quote,ts:Z.ts,kind:Z.kind})},E=Z=>{const le=`/?session=${encodeURIComponent(Z.file)}&seq=${String(Z.seq)}`;if(a.find(me=>me.root===Z.root)?.active===!0){location.href=le;return}T(null),D0(Z.root).then(()=>{location.href=le}).catch(me=>{T(me instanceof Error?me.message:String(me))})},ie=async(Z,le)=>{if(v!==null){T(null);try{await vf(Z,v,q.view?.sessionId,le),U(null),ue(null)}catch(se){T(se instanceof Error?se.message:String(se)),U({text:Z,...le===void 0?{}:{images:le}})}finally{await q.reload(),await F()}}},ce=async(Z,le)=>{if(up(Z)!==null){T("还没有会话:先发一句话建会话,再设目标。");return}T(null);try{const se=await vf(Z,void 0,void 0,le);U(null),Q(se.logFile,Z.length>24?`${Z.slice(0,24)}…`:Z),await F()}catch(se){T(se instanceof Error?se.message:String(se)),U({text:Z,...le===void 0?{}:{images:le}})}},fe=async Z=>{if(v===null)return;const le=v,se=f2(q.view?.turns??[],Z.seq),me=await N0(le,se);Q(me.session),await F();const xe=Z.images?.map(Fe=>({path:Fe.path}));T(null),U(null);try{await vf(Z.text,me.session,void 0,xe),ue(`已重答:新会话 ${me.session}(源会话 ${le} 保留)`)}catch(Fe){T(Fe instanceof Error?Fe.message:String(Fe)),U({text:Z.text,...xe===void 0?{}:{images:xe}})}finally{await q.reload(),await F()}},ve=async()=>{const Z=O;if(Z!==null){A(!0),T(null),ue(null);try{if(v===null){await ce(Z.text,Z.images);return}const le=q.view?.turns??[],se=[...le].reverse().find(me=>me.role==="user"&&me.source!=="context"&&me.text.trim()!=="");if(d2(le,Z.text)==="reanswer"&&se!==void 0){await fe({seq:se.seq,text:se.text,...se.images===void 0?{}:{images:se.images}});return}await ie(Z.text,Z.images)}finally{A(!1)}}};return s==="settings"?u.jsx("div",{className:"app",children:u.jsx(RB,{onClose:()=>{r(v===null?"empty":"conv")},session:v,onTheme:t})}):s==="trajectory"?u.jsx("div",{className:"app",children:u.jsx(KB,{session:v,title:S,onBack:()=>{r(v===null?"empty":"conv")}})}):u.jsxs("div",{className:"app",children:[u.jsx(c6,{groups:a,activeName:v,loading:h,loadError:g,onNewChat:K,onRename:async(Z,le)=>{await MN(Z.name,le),v===Z.name&&y(le),await F()},onDelete:async Z=>{await AN(Z.name),v===Z.name&&K(),await F()},onPin:async Z=>{const le=a.flatMap(se=>se.sessions.map(me=>me.name));await RN([Z.name,...le.filter(se=>se!==Z.name)]),await F()},onArchive:async(Z,le)=>{await ON(Z.name,le),await F()},onLabels:async(Z,le)=>{await BN(Z.name,le),await F()},onReload:async()=>{await F()},onOpenSettings:()=>{r("settings")},onSelect:D,onOpenSearchHit:E}),u.jsxs("main",{className:"main",children:[M===null&&O===null&&Y===null?null:u.jsxs("div",{className:`conn-banner${M===null?" ok":""}`,style:{margin:"10px auto 0",maxWidth:"812px"},children:[u.jsx("span",{className:M===null?"ok":"warn",children:M===null?"✓":"⚠"}),u.jsx("span",{children:M??Y??"上一次发送失败:可以直接重试。"}),O===null?null:u.jsx("button",{className:"btn",disabled:z,onClick:()=>{ve()},children:z?"重试中…":"重试"}),u.jsx("button",{className:"btn",onClick:()=>{T(null),U(null),ue(null)},children:"知道了"})]}),s==="conv"?u.jsx(mR,{title:S,session:v,thread:q,onToggleTheme:V,onSend:ie,onStop:()=>{v!==null&&WN(v)},onBack:K,onFork:R,onReanswer:fe,focusSeq:f6,onTrajectory:()=>{r("trajectory")},onViewChanges:()=>{w(!0),N(Z=>Z+1)}},v??"none"):u.jsx(wB,{onToggleTheme:V,onSend:(Z,le)=>{ce(Z,le)}})]}),P?u.jsx(p2,{items:Se,onClose:()=>{J(!1)}}):null,u.jsx(yB,{collapsed:!x,changesSignal:j,onToggle:()=>w(Z=>!Z)}),G===null?null:u.jsx(kB,{info:G,onClose:()=>{L(null)},onBackToSource:()=>{Q(G.source,G.sourceTitle),L(null)}})]})}const Nw=document.getElementById("root");if(Nw===null)throw new Error("找不到 #root:index.html 与 main.tsx 不同步");TN.createRoot(Nw).render(u.jsx(k.StrictMode,{children:u.jsx(m6,{})}));
|