(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))s(a);new MutationObserver(a=>{for(const o of a)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function n(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(a){if(a.ep)return;a.ep=!0;const o=n(a);fetch(a.href,o)}})();function $y(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var qf={exports:{}},Ba={};/**
 * @license React
 * react-jsx-runtime.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var lv;function xC(){if(lv)return Ba;lv=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(s,a,o){var c=null;if(o!==void 0&&(c=""+o),a.key!==void 0&&(c=""+a.key),"key"in a){o={};for(var f in a)f!=="key"&&(o[f]=a[f])}else o=a;return a=o.ref,{$$typeof:e,type:s,key:c,ref:a!==void 0?a:null,props:o}}return Ba.Fragment=t,Ba.jsx=n,Ba.jsxs=n,Ba}var av;function SC(){return av||(av=1,qf.exports=xC()),qf.exports}var g=SC(),$f={exports:{}},He={};/**
 * @license React
 * react.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var ov;function wC(){if(ov)return He;ov=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),b=Symbol.iterator;function y(T){return T===null||typeof T!="object"?null:(T=b&&T[b]||T["@@iterator"],typeof T=="function"?T:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},A=Object.assign,R={};function D(T,q,k){this.props=T,this.context=q,this.refs=R,this.updater=k||S}D.prototype.isReactComponent={},D.prototype.setState=function(T,q){if(typeof T!="object"&&typeof T!="function"&&T!=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,T,q,"setState")},D.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function W(){}W.prototype=D.prototype;function j(T,q,k){this.props=T,this.context=q,this.refs=R,this.updater=k||S}var I=j.prototype=new W;I.constructor=j,A(I,D.prototype),I.isPureReactComponent=!0;var J=Array.isArray;function L(){}var te={H:null,A:null,T:null,S:null},X=Object.prototype.hasOwnProperty;function pe(T,q,k){var ie=k.ref;return{$$typeof:e,type:T,key:q,ref:ie!==void 0?ie:null,props:k}}function G(T,q){return pe(T.type,q,T.props)}function K(T){return typeof T=="object"&&T!==null&&T.$$typeof===e}function V(T){var q={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(k){return q[k]})}var z=/\/+/g;function P(T,q){return typeof T=="object"&&T!==null&&T.key!=null?V(""+T.key):q.toString(36)}function $(T){switch(T.status){case"fulfilled":return T.value;case"rejected":throw T.reason;default:switch(typeof T.status=="string"?T.then(L,L):(T.status="pending",T.then(function(q){T.status==="pending"&&(T.status="fulfilled",T.value=q)},function(q){T.status==="pending"&&(T.status="rejected",T.reason=q)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function C(T,q,k,ie,ue){var le=typeof T;(le==="undefined"||le==="boolean")&&(T=null);var ve=!1;if(T===null)ve=!0;else switch(le){case"bigint":case"string":case"number":ve=!0;break;case"object":switch(T.$$typeof){case e:case t:ve=!0;break;case _:return ve=T._init,C(ve(T._payload),q,k,ie,ue)}}if(ve)return ue=ue(T),ve=ie===""?"."+P(T,0):ie,J(ue)?(k="",ve!=null&&(k=ve.replace(z,"$&/")+"/"),C(ue,q,k,"",function(Ie){return Ie})):ue!=null&&(K(ue)&&(ue=G(ue,k+(ue.key==null||T&&T.key===ue.key?"":(""+ue.key).replace(z,"$&/")+"/")+ve)),q.push(ue)),1;ve=0;var Ee=ie===""?".":ie+":";if(J(T))for(var oe=0;oe<T.length;oe++)ie=T[oe],le=Ee+P(ie,oe),ve+=C(ie,q,k,le,ue);else if(oe=y(T),typeof oe=="function")for(T=oe.call(T),oe=0;!(ie=T.next()).done;)ie=ie.value,le=Ee+P(ie,oe++),ve+=C(ie,q,k,le,ue);else if(le==="object"){if(typeof T.then=="function")return C($(T),q,k,ie,ue);throw q=String(T),Error("Objects are not valid as a React child (found: "+(q==="[object Object]"?"object with keys {"+Object.keys(T).join(", ")+"}":q)+"). If you meant to render a collection of children, use an array instead.")}return ve}function B(T,q,k){if(T==null)return T;var ie=[],ue=0;return C(T,ie,"","",function(le){return q.call(k,le,ue++)}),ie}function U(T){if(T._status===-1){var q=T._result;q=q(),q.then(function(k){(T._status===0||T._status===-1)&&(T._status=1,T._result=k)},function(k){(T._status===0||T._status===-1)&&(T._status=2,T._result=k)}),T._status===-1&&(T._status=0,T._result=q)}if(T._status===1)return T._result.default;throw T._result}var ce=typeof reportError=="function"?reportError:function(T){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof T=="object"&&T!==null&&typeof T.message=="string"?String(T.message):String(T),error:T});if(!window.dispatchEvent(q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",T);return}console.error(T)},w={map:B,forEach:function(T,q,k){B(T,function(){q.apply(this,arguments)},k)},count:function(T){var q=0;return B(T,function(){q++}),q},toArray:function(T){return B(T,function(q){return q})||[]},only:function(T){if(!K(T))throw Error("React.Children.only expected to receive a single React element child.");return T}};return He.Activity=v,He.Children=w,He.Component=D,He.Fragment=n,He.Profiler=a,He.PureComponent=j,He.StrictMode=s,He.Suspense=d,He.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=te,He.__COMPILER_RUNTIME={__proto__:null,c:function(T){return te.H.useMemoCache(T)}},He.cache=function(T){return function(){return T.apply(null,arguments)}},He.cacheSignal=function(){return null},He.cloneElement=function(T,q,k){if(T==null)throw Error("The argument must be a React element, but you passed "+T+".");var ie=A({},T.props),ue=T.key;if(q!=null)for(le in q.key!==void 0&&(ue=""+q.key),q)!X.call(q,le)||le==="key"||le==="__self"||le==="__source"||le==="ref"&&q.ref===void 0||(ie[le]=q[le]);var le=arguments.length-2;if(le===1)ie.children=k;else if(1<le){for(var ve=Array(le),Ee=0;Ee<le;Ee++)ve[Ee]=arguments[Ee+2];ie.children=ve}return pe(T.type,ue,ie)},He.createContext=function(T){return T={$$typeof:c,_currentValue:T,_currentValue2:T,_threadCount:0,Provider:null,Consumer:null},T.Provider=T,T.Consumer={$$typeof:o,_context:T},T},He.createElement=function(T,q,k){var ie,ue={},le=null;if(q!=null)for(ie in q.key!==void 0&&(le=""+q.key),q)X.call(q,ie)&&ie!=="key"&&ie!=="__self"&&ie!=="__source"&&(ue[ie]=q[ie]);var ve=arguments.length-2;if(ve===1)ue.children=k;else if(1<ve){for(var Ee=Array(ve),oe=0;oe<ve;oe++)Ee[oe]=arguments[oe+2];ue.children=Ee}if(T&&T.defaultProps)for(ie in ve=T.defaultProps,ve)ue[ie]===void 0&&(ue[ie]=ve[ie]);return pe(T,le,ue)},He.createRef=function(){return{current:null}},He.forwardRef=function(T){return{$$typeof:f,render:T}},He.isValidElement=K,He.lazy=function(T){return{$$typeof:_,_payload:{_status:-1,_result:T},_init:U}},He.memo=function(T,q){return{$$typeof:h,type:T,compare:q===void 0?null:q}},He.startTransition=function(T){var q=te.T,k={};te.T=k;try{var ie=T(),ue=te.S;ue!==null&&ue(k,ie),typeof ie=="object"&&ie!==null&&typeof ie.then=="function"&&ie.then(L,ce)}catch(le){ce(le)}finally{q!==null&&k.types!==null&&(q.types=k.types),te.T=q}},He.unstable_useCacheRefresh=function(){return te.H.useCacheRefresh()},He.use=function(T){return te.H.use(T)},He.useActionState=function(T,q,k){return te.H.useActionState(T,q,k)},He.useCallback=function(T,q){return te.H.useCallback(T,q)},He.useContext=function(T){return te.H.useContext(T)},He.useDebugValue=function(){},He.useDeferredValue=function(T,q){return te.H.useDeferredValue(T,q)},He.useEffect=function(T,q){return te.H.useEffect(T,q)},He.useEffectEvent=function(T){return te.H.useEffectEvent(T)},He.useId=function(){return te.H.useId()},He.useImperativeHandle=function(T,q,k){return te.H.useImperativeHandle(T,q,k)},He.useInsertionEffect=function(T,q){return te.H.useInsertionEffect(T,q)},He.useLayoutEffect=function(T,q){return te.H.useLayoutEffect(T,q)},He.useMemo=function(T,q){return te.H.useMemo(T,q)},He.useOptimistic=function(T,q){return te.H.useOptimistic(T,q)},He.useReducer=function(T,q,k){return te.H.useReducer(T,q,k)},He.useRef=function(T){return te.H.useRef(T)},He.useState=function(T){return te.H.useState(T)},He.useSyncExternalStore=function(T,q,k){return te.H.useSyncExternalStore(T,q,k)},He.useTransition=function(){return te.H.useTransition()},He.version="19.2.4",He}var cv;function Fp(){return cv||(cv=1,$f.exports=wC()),$f.exports}var N=Fp(),Yf={exports:{}},ja={},Vf={exports:{}},Gf={};/**
 * @license React
 * scheduler.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var uv;function CC(){return uv||(uv=1,(function(e){function t(C,B){var U=C.length;C.push(B);e:for(;0<U;){var ce=U-1>>>1,w=C[ce];if(0<a(w,B))C[ce]=B,C[U]=w,U=ce;else break e}}function n(C){return C.length===0?null:C[0]}function s(C){if(C.length===0)return null;var B=C[0],U=C.pop();if(U!==B){C[0]=U;e:for(var ce=0,w=C.length,T=w>>>1;ce<T;){var q=2*(ce+1)-1,k=C[q],ie=q+1,ue=C[ie];if(0>a(k,U))ie<w&&0>a(ue,k)?(C[ce]=ue,C[ie]=U,ce=ie):(C[ce]=k,C[q]=U,ce=q);else if(ie<w&&0>a(ue,U))C[ce]=ue,C[ie]=U,ce=ie;else break e}}return B}function a(C,B){var U=C.sortIndex-B.sortIndex;return U!==0?U:C.id-B.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var c=Date,f=c.now();e.unstable_now=function(){return c.now()-f}}var d=[],h=[],_=1,v=null,b=3,y=!1,S=!1,A=!1,R=!1,D=typeof setTimeout=="function"?setTimeout:null,W=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;function I(C){for(var B=n(h);B!==null;){if(B.callback===null)s(h);else if(B.startTime<=C)s(h),B.sortIndex=B.expirationTime,t(d,B);else break;B=n(h)}}function J(C){if(A=!1,I(C),!S)if(n(d)!==null)S=!0,L||(L=!0,V());else{var B=n(h);B!==null&&$(J,B.startTime-C)}}var L=!1,te=-1,X=5,pe=-1;function G(){return R?!0:!(e.unstable_now()-pe<X)}function K(){if(R=!1,L){var C=e.unstable_now();pe=C;var B=!0;try{e:{S=!1,A&&(A=!1,W(te),te=-1),y=!0;var U=b;try{t:{for(I(C),v=n(d);v!==null&&!(v.expirationTime>C&&G());){var ce=v.callback;if(typeof ce=="function"){v.callback=null,b=v.priorityLevel;var w=ce(v.expirationTime<=C);if(C=e.unstable_now(),typeof w=="function"){v.callback=w,I(C),B=!0;break t}v===n(d)&&s(d),I(C)}else s(d);v=n(d)}if(v!==null)B=!0;else{var T=n(h);T!==null&&$(J,T.startTime-C),B=!1}}break e}finally{v=null,b=U,y=!1}B=void 0}}finally{B?V():L=!1}}}var V;if(typeof j=="function")V=function(){j(K)};else if(typeof MessageChannel<"u"){var z=new MessageChannel,P=z.port2;z.port1.onmessage=K,V=function(){P.postMessage(null)}}else V=function(){D(K,0)};function $(C,B){te=D(function(){C(e.unstable_now())},B)}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(C){C.callback=null},e.unstable_forceFrameRate=function(C){0>C||125<C?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):X=0<C?Math.floor(1e3/C):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(C){switch(b){case 1:case 2:case 3:var B=3;break;default:B=b}var U=b;b=B;try{return C()}finally{b=U}},e.unstable_requestPaint=function(){R=!0},e.unstable_runWithPriority=function(C,B){switch(C){case 1:case 2:case 3:case 4:case 5:break;default:C=3}var U=b;b=C;try{return B()}finally{b=U}},e.unstable_scheduleCallback=function(C,B,U){var ce=e.unstable_now();switch(typeof U=="object"&&U!==null?(U=U.delay,U=typeof U=="number"&&0<U?ce+U:ce):U=ce,C){case 1:var w=-1;break;case 2:w=250;break;case 5:w=1073741823;break;case 4:w=1e4;break;default:w=5e3}return w=U+w,C={id:_++,callback:B,priorityLevel:C,startTime:U,expirationTime:w,sortIndex:-1},U>ce?(C.sortIndex=U,t(h,C),n(d)===null&&C===n(h)&&(A?(W(te),te=-1):A=!0,$(J,U-ce))):(C.sortIndex=w,t(d,C),S||y||(S=!0,L||(L=!0,V()))),C},e.unstable_shouldYield=G,e.unstable_wrapCallback=function(C){var B=b;return function(){var U=b;b=B;try{return C.apply(this,arguments)}finally{b=U}}}})(Gf)),Gf}var hv;function kC(){return hv||(hv=1,Vf.exports=CC()),Vf.exports}var Kf={exports:{}},Si={};/**
 * @license React
 * react-dom.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var fv;function EC(){if(fv)return Si;fv=1;var e=Fp();function t(d){var h="https://react.dev/errors/"+d;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var _=2;_<arguments.length;_++)h+="&args[]="+encodeURIComponent(arguments[_])}return"Minified React error #"+d+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var s={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},a=Symbol.for("react.portal");function o(d,h,_){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:v==null?null:""+v,children:d,containerInfo:h,implementation:_}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(d,h){if(d==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return Si.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,Si.createPortal=function(d,h){var _=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(t(299));return o(d,h,null,_)},Si.flushSync=function(d){var h=c.T,_=s.p;try{if(c.T=null,s.p=2,d)return d()}finally{c.T=h,s.p=_,s.d.f()}},Si.preconnect=function(d,h){typeof d=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,s.d.C(d,h))},Si.prefetchDNS=function(d){typeof d=="string"&&s.d.D(d)},Si.preinit=function(d,h){if(typeof d=="string"&&h&&typeof h.as=="string"){var _=h.as,v=f(_,h.crossOrigin),b=typeof h.integrity=="string"?h.integrity:void 0,y=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;_==="style"?s.d.S(d,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:v,integrity:b,fetchPriority:y}):_==="script"&&s.d.X(d,{crossOrigin:v,integrity:b,fetchPriority:y,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Si.preinitModule=function(d,h){if(typeof d=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var _=f(h.as,h.crossOrigin);s.d.M(d,{crossOrigin:_,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&s.d.M(d)},Si.preload=function(d,h){if(typeof d=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var _=h.as,v=f(_,h.crossOrigin);s.d.L(d,_,{crossOrigin:v,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},Si.preloadModule=function(d,h){if(typeof d=="string")if(h){var _=f(h.as,h.crossOrigin);s.d.m(d,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:_,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else s.d.m(d)},Si.requestFormReset=function(d){s.d.r(d)},Si.unstable_batchedUpdates=function(d,h){return d(h)},Si.useFormState=function(d,h,_){return c.H.useFormState(d,h,_)},Si.useFormStatus=function(){return c.H.useHostTransitionStatus()},Si.version="19.2.4",Si}var dv;function AC(){if(dv)return Kf.exports;dv=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(),Kf.exports=EC(),Kf.exports}/**
 * @license React
 * react-dom-client.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var pv;function TC(){if(pv)return ja;pv=1;var e=kC(),t=Fp(),n=AC();function s(i){var r="https://react.dev/errors/"+i;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)r+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+i+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function o(i){var r=i,l=i;if(i.alternate)for(;r.return;)r=r.return;else{i=r;do r=i,(r.flags&4098)!==0&&(l=r.return),i=r.return;while(i)}return r.tag===3?l:null}function c(i){if(i.tag===13){var r=i.memoizedState;if(r===null&&(i=i.alternate,i!==null&&(r=i.memoizedState)),r!==null)return r.dehydrated}return null}function f(i){if(i.tag===31){var r=i.memoizedState;if(r===null&&(i=i.alternate,i!==null&&(r=i.memoizedState)),r!==null)return r.dehydrated}return null}function d(i){if(o(i)!==i)throw Error(s(188))}function h(i){var r=i.alternate;if(!r){if(r=o(i),r===null)throw Error(s(188));return r!==i?null:i}for(var l=i,u=r;;){var p=l.return;if(p===null)break;var m=p.alternate;if(m===null){if(u=p.return,u!==null){l=u;continue}break}if(p.child===m.child){for(m=p.child;m;){if(m===l)return d(p),i;if(m===u)return d(p),r;m=m.sibling}throw Error(s(188))}if(l.return!==u.return)l=p,u=m;else{for(var x=!1,E=p.child;E;){if(E===l){x=!0,l=p,u=m;break}if(E===u){x=!0,u=p,l=m;break}E=E.sibling}if(!x){for(E=m.child;E;){if(E===l){x=!0,l=m,u=p;break}if(E===u){x=!0,u=m,l=p;break}E=E.sibling}if(!x)throw Error(s(189))}}if(l.alternate!==u)throw Error(s(190))}if(l.tag!==3)throw Error(s(188));return l.stateNode.current===l?i:r}function _(i){var r=i.tag;if(r===5||r===26||r===27||r===6)return i;for(i=i.child;i!==null;){if(r=_(i),r!==null)return r;i=i.sibling}return null}var v=Object.assign,b=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),R=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),W=Symbol.for("react.consumer"),j=Symbol.for("react.context"),I=Symbol.for("react.forward_ref"),J=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),te=Symbol.for("react.memo"),X=Symbol.for("react.lazy"),pe=Symbol.for("react.activity"),G=Symbol.for("react.memo_cache_sentinel"),K=Symbol.iterator;function V(i){return i===null||typeof i!="object"?null:(i=K&&i[K]||i["@@iterator"],typeof i=="function"?i:null)}var z=Symbol.for("react.client.reference");function P(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===z?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case A:return"Fragment";case D:return"Profiler";case R:return"StrictMode";case J:return"Suspense";case L:return"SuspenseList";case pe:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case S:return"Portal";case j:return i.displayName||"Context";case W:return(i._context.displayName||"Context")+".Consumer";case I:var r=i.render;return i=i.displayName,i||(i=r.displayName||r.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case te:return r=i.displayName||null,r!==null?r:P(i.type)||"Memo";case X:r=i._payload,i=i._init;try{return P(i(r))}catch{}}return null}var $=Array.isArray,C=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,B=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U={pending:!1,data:null,method:null,action:null},ce=[],w=-1;function T(i){return{current:i}}function q(i){0>w||(i.current=ce[w],ce[w]=null,w--)}function k(i,r){w++,ce[w]=i.current,i.current=r}var ie=T(null),ue=T(null),le=T(null),ve=T(null);function Ee(i,r){switch(k(le,r),k(ue,i),k(ie,null),r.nodeType){case 9:case 11:i=(i=r.documentElement)&&(i=i.namespaceURI)?N0(i):0;break;default:if(i=r.tagName,r=r.namespaceURI)r=N0(r),i=D0(r,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}q(ie),k(ie,i)}function oe(){q(ie),q(ue),q(le)}function Ie(i){i.memoizedState!==null&&k(ve,i);var r=ie.current,l=D0(r,i.type);r!==l&&(k(ue,i),k(ie,l))}function ot(i){ue.current===i&&(q(ie),q(ue)),ve.current===i&&(q(ve),Ma._currentValue=U)}var yt,se;function Oe(i){if(yt===void 0)try{throw Error()}catch(l){var r=l.stack.trim().match(/\n( *(at )?)/);yt=r&&r[1]||"",se=-1<l.stack.indexOf(`
    at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
`+yt+i+se}var nt=!1;function Je(i,r){if(!i||nt)return"";nt=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(r){var fe=function(){throw Error()};if(Object.defineProperty(fe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(fe,[])}catch(ne){var ee=ne}Reflect.construct(i,[],fe)}else{try{fe.call()}catch(ne){ee=ne}i.call(fe.prototype)}}else{try{throw Error()}catch(ne){ee=ne}(fe=i())&&typeof fe.catch=="function"&&fe.catch(function(){})}}catch(ne){if(ne&&ee&&typeof ne.stack=="string")return[ne.stack,ee.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var p=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");p&&p.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var m=u.DetermineComponentFrameRoot(),x=m[0],E=m[1];if(x&&E){var O=x.split(`
`),Q=E.split(`
`);for(p=u=0;u<O.length&&!O[u].includes("DetermineComponentFrameRoot");)u++;for(;p<Q.length&&!Q[p].includes("DetermineComponentFrameRoot");)p++;if(u===O.length||p===Q.length)for(u=O.length-1,p=Q.length-1;1<=u&&0<=p&&O[u]!==Q[p];)p--;for(;1<=u&&0<=p;u--,p--)if(O[u]!==Q[p]){if(u!==1||p!==1)do if(u--,p--,0>p||O[u]!==Q[p]){var ae=`
`+O[u].replace(" at new "," at ");return i.displayName&&ae.includes("<anonymous>")&&(ae=ae.replace("<anonymous>",i.displayName)),ae}while(1<=u&&0<=p);break}}}finally{nt=!1,Error.prepareStackTrace=l}return(l=i?i.displayName||i.name:"")?Oe(l):""}function fi(i,r){switch(i.tag){case 26:case 27:case 5:return Oe(i.type);case 16:return Oe("Lazy");case 13:return i.child!==r&&r!==null?Oe("Suspense Fallback"):Oe("Suspense");case 19:return Oe("SuspenseList");case 0:case 15:return Je(i.type,!1);case 11:return Je(i.type.render,!1);case 1:return Je(i.type,!0);case 31:return Oe("Activity");default:return""}}function gt(i){try{var r="",l=null;do r+=fi(i,l),l=i,i=i.return;while(i);return r}catch(u){return`
Error generating stack: `+u.message+`
`+u.stack}}var Rt=Object.prototype.hasOwnProperty,Ot=e.unstable_scheduleCallback,Vi=e.unstable_cancelCallback,on=e.unstable_shouldYield,Bn=e.unstable_requestPaint,St=e.unstable_now,ze=e.unstable_getCurrentPriorityLevel,M=e.unstable_ImmediatePriority,re=e.unstable_UserBlockingPriority,ye=e.unstable_NormalPriority,je=e.unstable_LowPriority,rt=e.unstable_IdlePriority,di=e.log,cn=e.unstable_setDisableYieldValue,qt=null,Et=null;function At(i){if(typeof di=="function"&&cn(i),Et&&typeof Et.setStrictMode=="function")try{Et.setStrictMode(qt,i)}catch{}}var tt=Math.clz32?Math.clz32:Ou,un=Math.log,Ei=Math.LN2;function Ou(i){return i>>>=0,i===0?32:31-(un(i)/Ei|0)|0}var Zn=256,Qn=262144,Ps=4194304;function Gi(i){var r=i&42;if(r!==0)return r;switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function Us(i,r,l){var u=i.pendingLanes;if(u===0)return 0;var p=0,m=i.suspendedLanes,x=i.pingedLanes;i=i.warmLanes;var E=u&134217727;return E!==0?(u=E&~m,u!==0?p=Gi(u):(x&=E,x!==0?p=Gi(x):l||(l=E&~i,l!==0&&(p=Gi(l))))):(E=u&~m,E!==0?p=Gi(E):x!==0?p=Gi(x):l||(l=u&~i,l!==0&&(p=Gi(l)))),p===0?0:r!==0&&r!==p&&(r&m)===0&&(m=p&-p,l=r&-r,m>=l||m===32&&(l&4194048)!==0)?r:p}function os(i,r){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&r)===0}function Pt(i,r){switch(i){case 1:case 2:case 4:case 8:case 64:return r+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 r+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 Jn(){var i=Ps;return Ps<<=1,(Ps&62914560)===0&&(Ps=4194304),i}function Ul(i){for(var r=[],l=0;31>l;l++)r.push(i);return r}function kr(i,r){i.pendingLanes|=r,r!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function Fl(i,r,l,u,p,m){var x=i.pendingLanes;i.pendingLanes=l,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=l,i.entangledLanes&=l,i.errorRecoveryDisabledLanes&=l,i.shellSuspendCounter=0;var E=i.entanglements,O=i.expirationTimes,Q=i.hiddenUpdates;for(l=x&~l;0<l;){var ae=31-tt(l),fe=1<<ae;E[ae]=0,O[ae]=-1;var ee=Q[ae];if(ee!==null)for(Q[ae]=null,ae=0;ae<ee.length;ae++){var ne=ee[ae];ne!==null&&(ne.lane&=-536870913)}l&=~fe}u!==0&&Wl(i,u,0),m!==0&&p===0&&i.tag!==0&&(i.suspendedLanes|=m&~(x&~r))}function Wl(i,r,l){i.pendingLanes|=r,i.suspendedLanes&=~r;var u=31-tt(r);i.entangledLanes|=r,i.entanglements[u]=i.entanglements[u]|1073741824|l&261930}function ql(i,r){var l=i.entangledLanes|=r;for(i=i.entanglements;l;){var u=31-tt(l),p=1<<u;p&r|i[u]&r&&(i[u]|=r),l&=~p}}function ko(i,r){var l=r&-r;return l=(l&42)!==0?1:Bi(l),(l&(i.suspendedLanes|r))!==0?0:l}function Bi(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function Dn(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function $l(){var i=B.p;return i!==0?i:(i=window.event,i===void 0?32:J0(i.type))}function Yl(i,r){var l=B.p;try{return B.p=i,r()}finally{B.p=l}}var hn=Math.random().toString(36).slice(2),$t="__reactFiber$"+hn,Tt="__reactProps$"+hn,er="__reactContainer$"+hn,Fs="__reactEvents$"+hn,Eo="__reactListeners$"+hn,Ao="__reactHandles$"+hn,To="__reactResources$"+hn,Ae="__reactMarker$"+hn;function H(i){delete i[$t],delete i[Tt],delete i[Fs],delete i[Eo],delete i[Ao]}function me(i){var r=i[$t];if(r)return r;for(var l=i.parentNode;l;){if(r=l[er]||l[$t]){if(l=r.alternate,r.child!==null||l!==null&&l.child!==null)for(i=j0(i);i!==null;){if(l=i[$t])return l;i=j0(i)}return r}i=l,l=i.parentNode}return null}function xe(i){if(i=i[$t]||i[er]){var r=i.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return i}return null}function ct(i){var r=i.tag;if(r===5||r===26||r===27||r===6)return i.stateNode;throw Error(s(33))}function Mt(i){var r=i[To];return r||(r=i[To]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function We(i){i[Ae]=!0}var pi=new Set,fn={};function ji(i,r){jn(i,r),jn(i+"Capture",r)}function jn(i,r){for(fn[i]=r,i=0;i<r.length;i++)pi.add(r[i])}var Jt=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]*$"),Vl={},Gl={};function d1(i){return Rt.call(Gl,i)?!0:Rt.call(Vl,i)?!1:Jt.test(i)?Gl[i]=!0:(Vl[i]=!0,!1)}function No(i,r,l){if(d1(r))if(l===null)i.removeAttribute(r);else{switch(typeof l){case"undefined":case"function":case"symbol":i.removeAttribute(r);return;case"boolean":var u=r.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){i.removeAttribute(r);return}}i.setAttribute(r,""+l)}}function Do(i,r,l){if(l===null)i.removeAttribute(r);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(r);return}i.setAttribute(r,""+l)}}function tr(i,r,l,u){if(u===null)i.removeAttribute(l);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(l);return}i.setAttributeNS(r,l,""+u)}}function dn(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function xm(i){var r=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function p1(i,r,l){var u=Object.getOwnPropertyDescriptor(i.constructor.prototype,r);if(!i.hasOwnProperty(r)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var p=u.get,m=u.set;return Object.defineProperty(i,r,{configurable:!0,get:function(){return p.call(this)},set:function(x){l=""+x,m.call(this,x)}}),Object.defineProperty(i,r,{enumerable:u.enumerable}),{getValue:function(){return l},setValue:function(x){l=""+x},stopTracking:function(){i._valueTracker=null,delete i[r]}}}}function Bu(i){if(!i._valueTracker){var r=xm(i)?"checked":"value";i._valueTracker=p1(i,r,""+i[r])}}function Sm(i){if(!i)return!1;var r=i._valueTracker;if(!r)return!0;var l=r.getValue(),u="";return i&&(u=xm(i)?i.checked?"true":"false":i.value),i=u,i!==l?(r.setValue(i),!0):!1}function Ro(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var m1=/[\n"\\]/g;function pn(i){return i.replace(m1,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function ju(i,r,l,u,p,m,x,E){i.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?i.type=x:i.removeAttribute("type"),r!=null?x==="number"?(r===0&&i.value===""||i.value!=r)&&(i.value=""+dn(r)):i.value!==""+dn(r)&&(i.value=""+dn(r)):x!=="submit"&&x!=="reset"||i.removeAttribute("value"),r!=null?Hu(i,x,dn(r)):l!=null?Hu(i,x,dn(l)):u!=null&&i.removeAttribute("value"),p==null&&m!=null&&(i.defaultChecked=!!m),p!=null&&(i.checked=p&&typeof p!="function"&&typeof p!="symbol"),E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?i.name=""+dn(E):i.removeAttribute("name")}function wm(i,r,l,u,p,m,x,E){if(m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(i.type=m),r!=null||l!=null){if(!(m!=="submit"&&m!=="reset"||r!=null)){Bu(i);return}l=l!=null?""+dn(l):"",r=r!=null?""+dn(r):l,E||r===i.value||(i.value=r),i.defaultValue=r}u=u??p,u=typeof u!="function"&&typeof u!="symbol"&&!!u,i.checked=E?i.checked:!!u,i.defaultChecked=!!u,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(i.name=x),Bu(i)}function Hu(i,r,l){r==="number"&&Ro(i.ownerDocument)===i||i.defaultValue===""+l||(i.defaultValue=""+l)}function Ws(i,r,l,u){if(i=i.options,r){r={};for(var p=0;p<l.length;p++)r["$"+l[p]]=!0;for(l=0;l<i.length;l++)p=r.hasOwnProperty("$"+i[l].value),i[l].selected!==p&&(i[l].selected=p),p&&u&&(i[l].defaultSelected=!0)}else{for(l=""+dn(l),r=null,p=0;p<i.length;p++){if(i[p].value===l){i[p].selected=!0,u&&(i[p].defaultSelected=!0);return}r!==null||i[p].disabled||(r=i[p])}r!==null&&(r.selected=!0)}}function Cm(i,r,l){if(r!=null&&(r=""+dn(r),r!==i.value&&(i.value=r),l==null)){i.defaultValue!==r&&(i.defaultValue=r);return}i.defaultValue=l!=null?""+dn(l):""}function km(i,r,l,u){if(r==null){if(u!=null){if(l!=null)throw Error(s(92));if($(u)){if(1<u.length)throw Error(s(93));u=u[0]}l=u}l==null&&(l=""),r=l}l=dn(r),i.defaultValue=l,u=i.textContent,u===l&&u!==""&&u!==null&&(i.value=u),Bu(i)}function qs(i,r){if(r){var l=i.firstChild;if(l&&l===i.lastChild&&l.nodeType===3){l.nodeValue=r;return}}i.textContent=r}var g1=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 Em(i,r,l){var u=r.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?u?i.setProperty(r,""):r==="float"?i.cssFloat="":i[r]="":u?i.setProperty(r,l):typeof l!="number"||l===0||g1.has(r)?r==="float"?i.cssFloat=l:i[r]=(""+l).trim():i[r]=l+"px"}function Am(i,r,l){if(r!=null&&typeof r!="object")throw Error(s(62));if(i=i.style,l!=null){for(var u in l)!l.hasOwnProperty(u)||r!=null&&r.hasOwnProperty(u)||(u.indexOf("--")===0?i.setProperty(u,""):u==="float"?i.cssFloat="":i[u]="");for(var p in r)u=r[p],r.hasOwnProperty(p)&&l[p]!==u&&Em(i,p,u)}else for(var m in r)r.hasOwnProperty(m)&&Em(i,m,r[m])}function Iu(i){if(i.indexOf("-")===-1)return!1;switch(i){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var _1=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),v1=/^[\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 Mo(i){return v1.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function ir(){}var Pu=null;function Uu(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var $s=null,Ys=null;function Tm(i){var r=xe(i);if(r&&(i=r.stateNode)){var l=i[Tt]||null;e:switch(i=r.stateNode,r.type){case"input":if(ju(i,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),r=l.name,l.type==="radio"&&r!=null){for(l=i;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+pn(""+r)+'"][type="radio"]'),r=0;r<l.length;r++){var u=l[r];if(u!==i&&u.form===i.form){var p=u[Tt]||null;if(!p)throw Error(s(90));ju(u,p.value,p.defaultValue,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name)}}for(r=0;r<l.length;r++)u=l[r],u.form===i.form&&Sm(u)}break e;case"textarea":Cm(i,l.value,l.defaultValue);break e;case"select":r=l.value,r!=null&&Ws(i,!!l.multiple,r,!1)}}}var Fu=!1;function Nm(i,r,l){if(Fu)return i(r,l);Fu=!0;try{var u=i(r);return u}finally{if(Fu=!1,($s!==null||Ys!==null)&&(bc(),$s&&(r=$s,i=Ys,Ys=$s=null,Tm(r),i)))for(r=0;r<i.length;r++)Tm(i[r])}}function Kl(i,r){var l=i.stateNode;if(l===null)return null;var u=l[Tt]||null;if(u===null)return null;l=u[r];e:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(u=!u.disabled)||(i=i.type,u=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!u;break e;default:i=!1}if(i)return null;if(l&&typeof l!="function")throw Error(s(231,r,typeof l));return l}var nr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Wu=!1;if(nr)try{var Xl={};Object.defineProperty(Xl,"passive",{get:function(){Wu=!0}}),window.addEventListener("test",Xl,Xl),window.removeEventListener("test",Xl,Xl)}catch{Wu=!1}var Er=null,qu=null,zo=null;function Dm(){if(zo)return zo;var i,r=qu,l=r.length,u,p="value"in Er?Er.value:Er.textContent,m=p.length;for(i=0;i<l&&r[i]===p[i];i++);var x=l-i;for(u=1;u<=x&&r[l-u]===p[m-u];u++);return zo=p.slice(i,1<u?1-u:void 0)}function Lo(i){var r=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&r===13&&(i=13)):i=r,i===10&&(i=13),32<=i||i===13?i:0}function Oo(){return!0}function Rm(){return!1}function Hi(i){function r(l,u,p,m,x){this._reactName=l,this._targetInst=p,this.type=u,this.nativeEvent=m,this.target=x,this.currentTarget=null;for(var E in i)i.hasOwnProperty(E)&&(l=i[E],this[E]=l?l(m):m[E]);return this.isDefaultPrevented=(m.defaultPrevented!=null?m.defaultPrevented:m.returnValue===!1)?Oo:Rm,this.isPropagationStopped=Rm,this}return v(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=Oo)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Oo)},persist:function(){},isPersistent:Oo}),r}var cs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Bo=Hi(cs),Zl=v({},cs,{view:0,detail:0}),b1=Hi(Zl),$u,Yu,Ql,jo=v({},Zl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Gu,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==Ql&&(Ql&&i.type==="mousemove"?($u=i.screenX-Ql.screenX,Yu=i.screenY-Ql.screenY):Yu=$u=0,Ql=i),$u)},movementY:function(i){return"movementY"in i?i.movementY:Yu}}),Mm=Hi(jo),y1=v({},jo,{dataTransfer:0}),x1=Hi(y1),S1=v({},Zl,{relatedTarget:0}),Vu=Hi(S1),w1=v({},cs,{animationName:0,elapsedTime:0,pseudoElement:0}),C1=Hi(w1),k1=v({},cs,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),E1=Hi(k1),A1=v({},cs,{data:0}),zm=Hi(A1),T1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},N1={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"},D1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function R1(i){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(i):(i=D1[i])?!!r[i]:!1}function Gu(){return R1}var M1=v({},Zl,{key:function(i){if(i.key){var r=T1[i.key]||i.key;if(r!=="Unidentified")return r}return i.type==="keypress"?(i=Lo(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?N1[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Gu,charCode:function(i){return i.type==="keypress"?Lo(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Lo(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),z1=Hi(M1),L1=v({},jo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Lm=Hi(L1),O1=v({},Zl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Gu}),B1=Hi(O1),j1=v({},cs,{propertyName:0,elapsedTime:0,pseudoElement:0}),H1=Hi(j1),I1=v({},jo,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),P1=Hi(I1),U1=v({},cs,{newState:0,oldState:0}),F1=Hi(U1),W1=[9,13,27,32],Ku=nr&&"CompositionEvent"in window,Jl=null;nr&&"documentMode"in document&&(Jl=document.documentMode);var q1=nr&&"TextEvent"in window&&!Jl,Om=nr&&(!Ku||Jl&&8<Jl&&11>=Jl),Bm=" ",jm=!1;function Hm(i,r){switch(i){case"keyup":return W1.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Im(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Vs=!1;function $1(i,r){switch(i){case"compositionend":return Im(r);case"keypress":return r.which!==32?null:(jm=!0,Bm);case"textInput":return i=r.data,i===Bm&&jm?null:i;default:return null}}function Y1(i,r){if(Vs)return i==="compositionend"||!Ku&&Hm(i,r)?(i=Dm(),zo=qu=Er=null,Vs=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return Om&&r.locale!=="ko"?null:r.data;default:return null}}var V1={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 Pm(i){var r=i&&i.nodeName&&i.nodeName.toLowerCase();return r==="input"?!!V1[i.type]:r==="textarea"}function Um(i,r,l,u){$s?Ys?Ys.push(u):Ys=[u]:$s=u,r=Ec(r,"onChange"),0<r.length&&(l=new Bo("onChange","change",null,l,u),i.push({event:l,listeners:r}))}var ea=null,ta=null;function G1(i){w0(i,0)}function Ho(i){var r=ct(i);if(Sm(r))return i}function Fm(i,r){if(i==="change")return r}var Wm=!1;if(nr){var Xu;if(nr){var Zu="oninput"in document;if(!Zu){var qm=document.createElement("div");qm.setAttribute("oninput","return;"),Zu=typeof qm.oninput=="function"}Xu=Zu}else Xu=!1;Wm=Xu&&(!document.documentMode||9<document.documentMode)}function $m(){ea&&(ea.detachEvent("onpropertychange",Ym),ta=ea=null)}function Ym(i){if(i.propertyName==="value"&&Ho(ta)){var r=[];Um(r,ta,i,Uu(i)),Nm(G1,r)}}function K1(i,r,l){i==="focusin"?($m(),ea=r,ta=l,ea.attachEvent("onpropertychange",Ym)):i==="focusout"&&$m()}function X1(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Ho(ta)}function Z1(i,r){if(i==="click")return Ho(r)}function Q1(i,r){if(i==="input"||i==="change")return Ho(r)}function J1(i,r){return i===r&&(i!==0||1/i===1/r)||i!==i&&r!==r}var Ki=typeof Object.is=="function"?Object.is:J1;function ia(i,r){if(Ki(i,r))return!0;if(typeof i!="object"||i===null||typeof r!="object"||r===null)return!1;var l=Object.keys(i),u=Object.keys(r);if(l.length!==u.length)return!1;for(u=0;u<l.length;u++){var p=l[u];if(!Rt.call(r,p)||!Ki(i[p],r[p]))return!1}return!0}function Vm(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function Gm(i,r){var l=Vm(i);i=0;for(var u;l;){if(l.nodeType===3){if(u=i+l.textContent.length,i<=r&&u>=r)return{node:l,offset:r-i};i=u}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=Vm(l)}}function Km(i,r){return i&&r?i===r?!0:i&&i.nodeType===3?!1:r&&r.nodeType===3?Km(i,r.parentNode):"contains"in i?i.contains(r):i.compareDocumentPosition?!!(i.compareDocumentPosition(r)&16):!1:!1}function Xm(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var r=Ro(i.document);r instanceof i.HTMLIFrameElement;){try{var l=typeof r.contentWindow.location.href=="string"}catch{l=!1}if(l)i=r.contentWindow;else break;r=Ro(i.document)}return r}function Qu(i){var r=i&&i.nodeName&&i.nodeName.toLowerCase();return r&&(r==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||r==="textarea"||i.contentEditable==="true")}var ew=nr&&"documentMode"in document&&11>=document.documentMode,Gs=null,Ju=null,na=null,eh=!1;function Zm(i,r,l){var u=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;eh||Gs==null||Gs!==Ro(u)||(u=Gs,"selectionStart"in u&&Qu(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),na&&ia(na,u)||(na=u,u=Ec(Ju,"onSelect"),0<u.length&&(r=new Bo("onSelect","select",null,r,l),i.push({event:r,listeners:u}),r.target=Gs)))}function us(i,r){var l={};return l[i.toLowerCase()]=r.toLowerCase(),l["Webkit"+i]="webkit"+r,l["Moz"+i]="moz"+r,l}var Ks={animationend:us("Animation","AnimationEnd"),animationiteration:us("Animation","AnimationIteration"),animationstart:us("Animation","AnimationStart"),transitionrun:us("Transition","TransitionRun"),transitionstart:us("Transition","TransitionStart"),transitioncancel:us("Transition","TransitionCancel"),transitionend:us("Transition","TransitionEnd")},th={},Qm={};nr&&(Qm=document.createElement("div").style,"AnimationEvent"in window||(delete Ks.animationend.animation,delete Ks.animationiteration.animation,delete Ks.animationstart.animation),"TransitionEvent"in window||delete Ks.transitionend.transition);function hs(i){if(th[i])return th[i];if(!Ks[i])return i;var r=Ks[i],l;for(l in r)if(r.hasOwnProperty(l)&&l in Qm)return th[i]=r[l];return i}var Jm=hs("animationend"),eg=hs("animationiteration"),tg=hs("animationstart"),tw=hs("transitionrun"),iw=hs("transitionstart"),nw=hs("transitioncancel"),ig=hs("transitionend"),ng=new Map,ih="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");ih.push("scrollEnd");function Rn(i,r){ng.set(i,r),ji(r,[i])}var Io=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},mn=[],Xs=0,nh=0;function Po(){for(var i=Xs,r=nh=Xs=0;r<i;){var l=mn[r];mn[r++]=null;var u=mn[r];mn[r++]=null;var p=mn[r];mn[r++]=null;var m=mn[r];if(mn[r++]=null,u!==null&&p!==null){var x=u.pending;x===null?p.next=p:(p.next=x.next,x.next=p),u.pending=p}m!==0&&rg(l,p,m)}}function Uo(i,r,l,u){mn[Xs++]=i,mn[Xs++]=r,mn[Xs++]=l,mn[Xs++]=u,nh|=u,i.lanes|=u,i=i.alternate,i!==null&&(i.lanes|=u)}function rh(i,r,l,u){return Uo(i,r,l,u),Fo(i)}function fs(i,r){return Uo(i,null,null,r),Fo(i)}function rg(i,r,l){i.lanes|=l;var u=i.alternate;u!==null&&(u.lanes|=l);for(var p=!1,m=i.return;m!==null;)m.childLanes|=l,u=m.alternate,u!==null&&(u.childLanes|=l),m.tag===22&&(i=m.stateNode,i===null||i._visibility&1||(p=!0)),i=m,m=m.return;return i.tag===3?(m=i.stateNode,p&&r!==null&&(p=31-tt(l),i=m.hiddenUpdates,u=i[p],u===null?i[p]=[r]:u.push(r),r.lane=l|536870912),m):null}function Fo(i){if(50<ka)throw ka=0,pf=null,Error(s(185));for(var r=i.return;r!==null;)i=r,r=i.return;return i.tag===3?i.stateNode:null}var Zs={};function rw(i,r,l,u){this.tag=i,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=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Xi(i,r,l,u){return new rw(i,r,l,u)}function sh(i){return i=i.prototype,!(!i||!i.isReactComponent)}function rr(i,r){var l=i.alternate;return l===null?(l=Xi(i.tag,r,i.key,i.mode),l.elementType=i.elementType,l.type=i.type,l.stateNode=i.stateNode,l.alternate=i,i.alternate=l):(l.pendingProps=r,l.type=i.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=i.flags&65011712,l.childLanes=i.childLanes,l.lanes=i.lanes,l.child=i.child,l.memoizedProps=i.memoizedProps,l.memoizedState=i.memoizedState,l.updateQueue=i.updateQueue,r=i.dependencies,l.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},l.sibling=i.sibling,l.index=i.index,l.ref=i.ref,l.refCleanup=i.refCleanup,l}function sg(i,r){i.flags&=65011714;var l=i.alternate;return l===null?(i.childLanes=0,i.lanes=r,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=l.childLanes,i.lanes=l.lanes,i.child=l.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=l.memoizedProps,i.memoizedState=l.memoizedState,i.updateQueue=l.updateQueue,i.type=l.type,r=l.dependencies,i.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),i}function Wo(i,r,l,u,p,m){var x=0;if(u=i,typeof i=="function")sh(i)&&(x=1);else if(typeof i=="string")x=cC(i,l,ie.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case pe:return i=Xi(31,l,r,p),i.elementType=pe,i.lanes=m,i;case A:return ds(l.children,p,m,r);case R:x=8,p|=24;break;case D:return i=Xi(12,l,r,p|2),i.elementType=D,i.lanes=m,i;case J:return i=Xi(13,l,r,p),i.elementType=J,i.lanes=m,i;case L:return i=Xi(19,l,r,p),i.elementType=L,i.lanes=m,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case j:x=10;break e;case W:x=9;break e;case I:x=11;break e;case te:x=14;break e;case X:x=16,u=null;break e}x=29,l=Error(s(130,i===null?"null":typeof i,"")),u=null}return r=Xi(x,l,r,p),r.elementType=i,r.type=u,r.lanes=m,r}function ds(i,r,l,u){return i=Xi(7,i,u,r),i.lanes=l,i}function lh(i,r,l){return i=Xi(6,i,null,r),i.lanes=l,i}function lg(i){var r=Xi(18,null,null,0);return r.stateNode=i,r}function ah(i,r,l){return r=Xi(4,i.children!==null?i.children:[],i.key,r),r.lanes=l,r.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},r}var ag=new WeakMap;function gn(i,r){if(typeof i=="object"&&i!==null){var l=ag.get(i);return l!==void 0?l:(r={value:i,source:r,stack:gt(r)},ag.set(i,r),r)}return{value:i,source:r,stack:gt(r)}}var Qs=[],Js=0,qo=null,ra=0,_n=[],vn=0,Ar=null,Hn=1,In="";function sr(i,r){Qs[Js++]=ra,Qs[Js++]=qo,qo=i,ra=r}function og(i,r,l){_n[vn++]=Hn,_n[vn++]=In,_n[vn++]=Ar,Ar=i;var u=Hn;i=In;var p=32-tt(u)-1;u&=~(1<<p),l+=1;var m=32-tt(r)+p;if(30<m){var x=p-p%5;m=(u&(1<<x)-1).toString(32),u>>=x,p-=x,Hn=1<<32-tt(r)+p|l<<p|u,In=m+i}else Hn=1<<m|l<<p|u,In=i}function oh(i){i.return!==null&&(sr(i,1),og(i,1,0))}function ch(i){for(;i===qo;)qo=Qs[--Js],Qs[Js]=null,ra=Qs[--Js],Qs[Js]=null;for(;i===Ar;)Ar=_n[--vn],_n[vn]=null,In=_n[--vn],_n[vn]=null,Hn=_n[--vn],_n[vn]=null}function cg(i,r){_n[vn++]=Hn,_n[vn++]=In,_n[vn++]=Ar,Hn=r.id,In=r.overflow,Ar=i}var mi=null,wt=null,et=!1,Tr=null,bn=!1,uh=Error(s(519));function Nr(i){var r=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw sa(gn(r,i)),uh}function ug(i){var r=i.stateNode,l=i.type,u=i.memoizedProps;switch(r[$t]=i,r[Tt]=u,l){case"dialog":Ke("cancel",r),Ke("close",r);break;case"iframe":case"object":case"embed":Ke("load",r);break;case"video":case"audio":for(l=0;l<Aa.length;l++)Ke(Aa[l],r);break;case"source":Ke("error",r);break;case"img":case"image":case"link":Ke("error",r),Ke("load",r);break;case"details":Ke("toggle",r);break;case"input":Ke("invalid",r),wm(r,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":Ke("invalid",r);break;case"textarea":Ke("invalid",r),km(r,u.value,u.defaultValue,u.children)}l=u.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||r.textContent===""+l||u.suppressHydrationWarning===!0||A0(r.textContent,l)?(u.popover!=null&&(Ke("beforetoggle",r),Ke("toggle",r)),u.onScroll!=null&&Ke("scroll",r),u.onScrollEnd!=null&&Ke("scrollend",r),u.onClick!=null&&(r.onclick=ir),r=!0):r=!1,r||Nr(i,!0)}function hg(i){for(mi=i.return;mi;)switch(mi.tag){case 5:case 31:case 13:bn=!1;return;case 27:case 3:bn=!0;return;default:mi=mi.return}}function el(i){if(i!==mi)return!1;if(!et)return hg(i),et=!0,!1;var r=i.tag,l;if((l=r!==3&&r!==27)&&((l=r===5)&&(l=i.type,l=!(l!=="form"&&l!=="button")||Nf(i.type,i.memoizedProps)),l=!l),l&&wt&&Nr(i),hg(i),r===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(s(317));wt=B0(i)}else if(r===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(s(317));wt=B0(i)}else r===27?(r=wt,Wr(i.type)?(i=Lf,Lf=null,wt=i):wt=r):wt=mi?xn(i.stateNode.nextSibling):null;return!0}function ps(){wt=mi=null,et=!1}function hh(){var i=Tr;return i!==null&&(Fi===null?Fi=i:Fi.push.apply(Fi,i),Tr=null),i}function sa(i){Tr===null?Tr=[i]:Tr.push(i)}var fh=T(null),ms=null,lr=null;function Dr(i,r,l){k(fh,r._currentValue),r._currentValue=l}function ar(i){i._currentValue=fh.current,q(fh)}function dh(i,r,l){for(;i!==null;){var u=i.alternate;if((i.childLanes&r)!==r?(i.childLanes|=r,u!==null&&(u.childLanes|=r)):u!==null&&(u.childLanes&r)!==r&&(u.childLanes|=r),i===l)break;i=i.return}}function ph(i,r,l,u){var p=i.child;for(p!==null&&(p.return=i);p!==null;){var m=p.dependencies;if(m!==null){var x=p.child;m=m.firstContext;e:for(;m!==null;){var E=m;m=p;for(var O=0;O<r.length;O++)if(E.context===r[O]){m.lanes|=l,E=m.alternate,E!==null&&(E.lanes|=l),dh(m.return,l,i),u||(x=null);break e}m=E.next}}else if(p.tag===18){if(x=p.return,x===null)throw Error(s(341));x.lanes|=l,m=x.alternate,m!==null&&(m.lanes|=l),dh(x,l,i),x=null}else x=p.child;if(x!==null)x.return=p;else for(x=p;x!==null;){if(x===i){x=null;break}if(p=x.sibling,p!==null){p.return=x.return,x=p;break}x=x.return}p=x}}function tl(i,r,l,u){i=null;for(var p=r,m=!1;p!==null;){if(!m){if((p.flags&524288)!==0)m=!0;else if((p.flags&262144)!==0)break}if(p.tag===10){var x=p.alternate;if(x===null)throw Error(s(387));if(x=x.memoizedProps,x!==null){var E=p.type;Ki(p.pendingProps.value,x.value)||(i!==null?i.push(E):i=[E])}}else if(p===ve.current){if(x=p.alternate,x===null)throw Error(s(387));x.memoizedState.memoizedState!==p.memoizedState.memoizedState&&(i!==null?i.push(Ma):i=[Ma])}p=p.return}i!==null&&ph(r,i,l,u),r.flags|=262144}function $o(i){for(i=i.firstContext;i!==null;){if(!Ki(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function gs(i){ms=i,lr=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function gi(i){return fg(ms,i)}function Yo(i,r){return ms===null&&gs(i),fg(i,r)}function fg(i,r){var l=r._currentValue;if(r={context:r,memoizedValue:l,next:null},lr===null){if(i===null)throw Error(s(308));lr=r,i.dependencies={lanes:0,firstContext:r},i.flags|=524288}else lr=lr.next=r;return l}var sw=typeof AbortController<"u"?AbortController:function(){var i=[],r=this.signal={aborted:!1,addEventListener:function(l,u){i.push(u)}};this.abort=function(){r.aborted=!0,i.forEach(function(l){return l()})}},lw=e.unstable_scheduleCallback,aw=e.unstable_NormalPriority,Yt={$$typeof:j,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function mh(){return{controller:new sw,data:new Map,refCount:0}}function la(i){i.refCount--,i.refCount===0&&lw(aw,function(){i.controller.abort()})}var aa=null,gh=0,il=0,nl=null;function ow(i,r){if(aa===null){var l=aa=[];gh=0,il=yf(),nl={status:"pending",value:void 0,then:function(u){l.push(u)}}}return gh++,r.then(dg,dg),r}function dg(){if(--gh===0&&aa!==null){nl!==null&&(nl.status="fulfilled");var i=aa;aa=null,il=0,nl=null;for(var r=0;r<i.length;r++)(0,i[r])()}}function cw(i,r){var l=[],u={status:"pending",value:null,reason:null,then:function(p){l.push(p)}};return i.then(function(){u.status="fulfilled",u.value=r;for(var p=0;p<l.length;p++)(0,l[p])(r)},function(p){for(u.status="rejected",u.reason=p,p=0;p<l.length;p++)(0,l[p])(void 0)}),u}var pg=C.S;C.S=function(i,r){Z_=St(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&ow(i,r),pg!==null&&pg(i,r)};var _s=T(null);function _h(){var i=_s.current;return i!==null?i:_t.pooledCache}function Vo(i,r){r===null?k(_s,_s.current):k(_s,r.pool)}function mg(){var i=_h();return i===null?null:{parent:Yt._currentValue,pool:i}}var rl=Error(s(460)),vh=Error(s(474)),Go=Error(s(542)),Ko={then:function(){}};function gg(i){return i=i.status,i==="fulfilled"||i==="rejected"}function _g(i,r,l){switch(l=i[l],l===void 0?i.push(r):l!==r&&(r.then(ir,ir),r=l),r.status){case"fulfilled":return r.value;case"rejected":throw i=r.reason,bg(i),i;default:if(typeof r.status=="string")r.then(ir,ir);else{if(i=_t,i!==null&&100<i.shellSuspendCounter)throw Error(s(482));i=r,i.status="pending",i.then(function(u){if(r.status==="pending"){var p=r;p.status="fulfilled",p.value=u}},function(u){if(r.status==="pending"){var p=r;p.status="rejected",p.reason=u}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw i=r.reason,bg(i),i}throw bs=r,rl}}function vs(i){try{var r=i._init;return r(i._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(bs=l,rl):l}}var bs=null;function vg(){if(bs===null)throw Error(s(459));var i=bs;return bs=null,i}function bg(i){if(i===rl||i===Go)throw Error(s(483))}var sl=null,oa=0;function Xo(i){var r=oa;return oa+=1,sl===null&&(sl=[]),_g(sl,i,r)}function ca(i,r){r=r.props.ref,i.ref=r!==void 0?r:null}function Zo(i,r){throw r.$$typeof===b?Error(s(525)):(i=Object.prototype.toString.call(r),Error(s(31,i==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":i)))}function yg(i){function r(Y,F){if(i){var Z=Y.deletions;Z===null?(Y.deletions=[F],Y.flags|=16):Z.push(F)}}function l(Y,F){if(!i)return null;for(;F!==null;)r(Y,F),F=F.sibling;return null}function u(Y){for(var F=new Map;Y!==null;)Y.key!==null?F.set(Y.key,Y):F.set(Y.index,Y),Y=Y.sibling;return F}function p(Y,F){return Y=rr(Y,F),Y.index=0,Y.sibling=null,Y}function m(Y,F,Z){return Y.index=Z,i?(Z=Y.alternate,Z!==null?(Z=Z.index,Z<F?(Y.flags|=67108866,F):Z):(Y.flags|=67108866,F)):(Y.flags|=1048576,F)}function x(Y){return i&&Y.alternate===null&&(Y.flags|=67108866),Y}function E(Y,F,Z,he){return F===null||F.tag!==6?(F=lh(Z,Y.mode,he),F.return=Y,F):(F=p(F,Z),F.return=Y,F)}function O(Y,F,Z,he){var Re=Z.type;return Re===A?ae(Y,F,Z.props.children,he,Z.key):F!==null&&(F.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===X&&vs(Re)===F.type)?(F=p(F,Z.props),ca(F,Z),F.return=Y,F):(F=Wo(Z.type,Z.key,Z.props,null,Y.mode,he),ca(F,Z),F.return=Y,F)}function Q(Y,F,Z,he){return F===null||F.tag!==4||F.stateNode.containerInfo!==Z.containerInfo||F.stateNode.implementation!==Z.implementation?(F=ah(Z,Y.mode,he),F.return=Y,F):(F=p(F,Z.children||[]),F.return=Y,F)}function ae(Y,F,Z,he,Re){return F===null||F.tag!==7?(F=ds(Z,Y.mode,he,Re),F.return=Y,F):(F=p(F,Z),F.return=Y,F)}function fe(Y,F,Z){if(typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint")return F=lh(""+F,Y.mode,Z),F.return=Y,F;if(typeof F=="object"&&F!==null){switch(F.$$typeof){case y:return Z=Wo(F.type,F.key,F.props,null,Y.mode,Z),ca(Z,F),Z.return=Y,Z;case S:return F=ah(F,Y.mode,Z),F.return=Y,F;case X:return F=vs(F),fe(Y,F,Z)}if($(F)||V(F))return F=ds(F,Y.mode,Z,null),F.return=Y,F;if(typeof F.then=="function")return fe(Y,Xo(F),Z);if(F.$$typeof===j)return fe(Y,Yo(Y,F),Z);Zo(Y,F)}return null}function ee(Y,F,Z,he){var Re=F!==null?F.key:null;if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return Re!==null?null:E(Y,F,""+Z,he);if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case y:return Z.key===Re?O(Y,F,Z,he):null;case S:return Z.key===Re?Q(Y,F,Z,he):null;case X:return Z=vs(Z),ee(Y,F,Z,he)}if($(Z)||V(Z))return Re!==null?null:ae(Y,F,Z,he,null);if(typeof Z.then=="function")return ee(Y,F,Xo(Z),he);if(Z.$$typeof===j)return ee(Y,F,Yo(Y,Z),he);Zo(Y,Z)}return null}function ne(Y,F,Z,he,Re){if(typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint")return Y=Y.get(Z)||null,E(F,Y,""+he,Re);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case y:return Y=Y.get(he.key===null?Z:he.key)||null,O(F,Y,he,Re);case S:return Y=Y.get(he.key===null?Z:he.key)||null,Q(F,Y,he,Re);case X:return he=vs(he),ne(Y,F,Z,he,Re)}if($(he)||V(he))return Y=Y.get(Z)||null,ae(F,Y,he,Re,null);if(typeof he.then=="function")return ne(Y,F,Z,Xo(he),Re);if(he.$$typeof===j)return ne(Y,F,Z,Yo(F,he),Re);Zo(F,he)}return null}function Se(Y,F,Z,he){for(var Re=null,st=null,Te=F,Ue=F=0,Qe=null;Te!==null&&Ue<Z.length;Ue++){Te.index>Ue?(Qe=Te,Te=null):Qe=Te.sibling;var lt=ee(Y,Te,Z[Ue],he);if(lt===null){Te===null&&(Te=Qe);break}i&&Te&&lt.alternate===null&&r(Y,Te),F=m(lt,F,Ue),st===null?Re=lt:st.sibling=lt,st=lt,Te=Qe}if(Ue===Z.length)return l(Y,Te),et&&sr(Y,Ue),Re;if(Te===null){for(;Ue<Z.length;Ue++)Te=fe(Y,Z[Ue],he),Te!==null&&(F=m(Te,F,Ue),st===null?Re=Te:st.sibling=Te,st=Te);return et&&sr(Y,Ue),Re}for(Te=u(Te);Ue<Z.length;Ue++)Qe=ne(Te,Y,Ue,Z[Ue],he),Qe!==null&&(i&&Qe.alternate!==null&&Te.delete(Qe.key===null?Ue:Qe.key),F=m(Qe,F,Ue),st===null?Re=Qe:st.sibling=Qe,st=Qe);return i&&Te.forEach(function(Gr){return r(Y,Gr)}),et&&sr(Y,Ue),Re}function Le(Y,F,Z,he){if(Z==null)throw Error(s(151));for(var Re=null,st=null,Te=F,Ue=F=0,Qe=null,lt=Z.next();Te!==null&&!lt.done;Ue++,lt=Z.next()){Te.index>Ue?(Qe=Te,Te=null):Qe=Te.sibling;var Gr=ee(Y,Te,lt.value,he);if(Gr===null){Te===null&&(Te=Qe);break}i&&Te&&Gr.alternate===null&&r(Y,Te),F=m(Gr,F,Ue),st===null?Re=Gr:st.sibling=Gr,st=Gr,Te=Qe}if(lt.done)return l(Y,Te),et&&sr(Y,Ue),Re;if(Te===null){for(;!lt.done;Ue++,lt=Z.next())lt=fe(Y,lt.value,he),lt!==null&&(F=m(lt,F,Ue),st===null?Re=lt:st.sibling=lt,st=lt);return et&&sr(Y,Ue),Re}for(Te=u(Te);!lt.done;Ue++,lt=Z.next())lt=ne(Te,Y,Ue,lt.value,he),lt!==null&&(i&&lt.alternate!==null&&Te.delete(lt.key===null?Ue:lt.key),F=m(lt,F,Ue),st===null?Re=lt:st.sibling=lt,st=lt);return i&&Te.forEach(function(yC){return r(Y,yC)}),et&&sr(Y,Ue),Re}function pt(Y,F,Z,he){if(typeof Z=="object"&&Z!==null&&Z.type===A&&Z.key===null&&(Z=Z.props.children),typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case y:e:{for(var Re=Z.key;F!==null;){if(F.key===Re){if(Re=Z.type,Re===A){if(F.tag===7){l(Y,F.sibling),he=p(F,Z.props.children),he.return=Y,Y=he;break e}}else if(F.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===X&&vs(Re)===F.type){l(Y,F.sibling),he=p(F,Z.props),ca(he,Z),he.return=Y,Y=he;break e}l(Y,F);break}else r(Y,F);F=F.sibling}Z.type===A?(he=ds(Z.props.children,Y.mode,he,Z.key),he.return=Y,Y=he):(he=Wo(Z.type,Z.key,Z.props,null,Y.mode,he),ca(he,Z),he.return=Y,Y=he)}return x(Y);case S:e:{for(Re=Z.key;F!==null;){if(F.key===Re)if(F.tag===4&&F.stateNode.containerInfo===Z.containerInfo&&F.stateNode.implementation===Z.implementation){l(Y,F.sibling),he=p(F,Z.children||[]),he.return=Y,Y=he;break e}else{l(Y,F);break}else r(Y,F);F=F.sibling}he=ah(Z,Y.mode,he),he.return=Y,Y=he}return x(Y);case X:return Z=vs(Z),pt(Y,F,Z,he)}if($(Z))return Se(Y,F,Z,he);if(V(Z)){if(Re=V(Z),typeof Re!="function")throw Error(s(150));return Z=Re.call(Z),Le(Y,F,Z,he)}if(typeof Z.then=="function")return pt(Y,F,Xo(Z),he);if(Z.$$typeof===j)return pt(Y,F,Yo(Y,Z),he);Zo(Y,Z)}return typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint"?(Z=""+Z,F!==null&&F.tag===6?(l(Y,F.sibling),he=p(F,Z),he.return=Y,Y=he):(l(Y,F),he=lh(Z,Y.mode,he),he.return=Y,Y=he),x(Y)):l(Y,F)}return function(Y,F,Z,he){try{oa=0;var Re=pt(Y,F,Z,he);return sl=null,Re}catch(Te){if(Te===rl||Te===Go)throw Te;var st=Xi(29,Te,null,Y.mode);return st.lanes=he,st.return=Y,st}finally{}}}var ys=yg(!0),xg=yg(!1),Rr=!1;function bh(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function yh(i,r){i=i.updateQueue,r.updateQueue===i&&(r.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function Mr(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function zr(i,r,l){var u=i.updateQueue;if(u===null)return null;if(u=u.shared,(at&2)!==0){var p=u.pending;return p===null?r.next=r:(r.next=p.next,p.next=r),u.pending=r,r=Fo(i),rg(i,null,l),r}return Uo(i,u,r,l),Fo(i)}function ua(i,r,l){if(r=r.updateQueue,r!==null&&(r=r.shared,(l&4194048)!==0)){var u=r.lanes;u&=i.pendingLanes,l|=u,r.lanes=l,ql(i,l)}}function xh(i,r){var l=i.updateQueue,u=i.alternate;if(u!==null&&(u=u.updateQueue,l===u)){var p=null,m=null;if(l=l.firstBaseUpdate,l!==null){do{var x={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};m===null?p=m=x:m=m.next=x,l=l.next}while(l!==null);m===null?p=m=r:m=m.next=r}else p=m=r;l={baseState:u.baseState,firstBaseUpdate:p,lastBaseUpdate:m,shared:u.shared,callbacks:u.callbacks},i.updateQueue=l;return}i=l.lastBaseUpdate,i===null?l.firstBaseUpdate=r:i.next=r,l.lastBaseUpdate=r}var Sh=!1;function ha(){if(Sh){var i=nl;if(i!==null)throw i}}function fa(i,r,l,u){Sh=!1;var p=i.updateQueue;Rr=!1;var m=p.firstBaseUpdate,x=p.lastBaseUpdate,E=p.shared.pending;if(E!==null){p.shared.pending=null;var O=E,Q=O.next;O.next=null,x===null?m=Q:x.next=Q,x=O;var ae=i.alternate;ae!==null&&(ae=ae.updateQueue,E=ae.lastBaseUpdate,E!==x&&(E===null?ae.firstBaseUpdate=Q:E.next=Q,ae.lastBaseUpdate=O))}if(m!==null){var fe=p.baseState;x=0,ae=Q=O=null,E=m;do{var ee=E.lane&-536870913,ne=ee!==E.lane;if(ne?(Ze&ee)===ee:(u&ee)===ee){ee!==0&&ee===il&&(Sh=!0),ae!==null&&(ae=ae.next={lane:0,tag:E.tag,payload:E.payload,callback:null,next:null});e:{var Se=i,Le=E;ee=r;var pt=l;switch(Le.tag){case 1:if(Se=Le.payload,typeof Se=="function"){fe=Se.call(pt,fe,ee);break e}fe=Se;break e;case 3:Se.flags=Se.flags&-65537|128;case 0:if(Se=Le.payload,ee=typeof Se=="function"?Se.call(pt,fe,ee):Se,ee==null)break e;fe=v({},fe,ee);break e;case 2:Rr=!0}}ee=E.callback,ee!==null&&(i.flags|=64,ne&&(i.flags|=8192),ne=p.callbacks,ne===null?p.callbacks=[ee]:ne.push(ee))}else ne={lane:ee,tag:E.tag,payload:E.payload,callback:E.callback,next:null},ae===null?(Q=ae=ne,O=fe):ae=ae.next=ne,x|=ee;if(E=E.next,E===null){if(E=p.shared.pending,E===null)break;ne=E,E=ne.next,ne.next=null,p.lastBaseUpdate=ne,p.shared.pending=null}}while(!0);ae===null&&(O=fe),p.baseState=O,p.firstBaseUpdate=Q,p.lastBaseUpdate=ae,m===null&&(p.shared.lanes=0),Hr|=x,i.lanes=x,i.memoizedState=fe}}function Sg(i,r){if(typeof i!="function")throw Error(s(191,i));i.call(r)}function wg(i,r){var l=i.callbacks;if(l!==null)for(i.callbacks=null,i=0;i<l.length;i++)Sg(l[i],r)}var ll=T(null),Qo=T(0);function Cg(i,r){i=gr,k(Qo,i),k(ll,r),gr=i|r.baseLanes}function wh(){k(Qo,gr),k(ll,ll.current)}function Ch(){gr=Qo.current,q(ll),q(Qo)}var Zi=T(null),yn=null;function Lr(i){var r=i.alternate;k(Ut,Ut.current&1),k(Zi,i),yn===null&&(r===null||ll.current!==null||r.memoizedState!==null)&&(yn=i)}function kh(i){k(Ut,Ut.current),k(Zi,i),yn===null&&(yn=i)}function kg(i){i.tag===22?(k(Ut,Ut.current),k(Zi,i),yn===null&&(yn=i)):Or()}function Or(){k(Ut,Ut.current),k(Zi,Zi.current)}function Qi(i){q(Zi),yn===i&&(yn=null),q(Ut)}var Ut=T(0);function Jo(i){for(var r=i;r!==null;){if(r.tag===13){var l=r.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||Mf(l)||zf(l)))return r}else if(r.tag===19&&(r.memoizedProps.revealOrder==="forwards"||r.memoizedProps.revealOrder==="backwards"||r.memoizedProps.revealOrder==="unstable_legacy-backwards"||r.memoizedProps.revealOrder==="together")){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===i)break;for(;r.sibling===null;){if(r.return===null||r.return===i)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var or=0,Pe=null,ft=null,Vt=null,ec=!1,al=!1,xs=!1,tc=0,da=0,ol=null,uw=0;function Bt(){throw Error(s(321))}function Eh(i,r){if(r===null)return!1;for(var l=0;l<r.length&&l<i.length;l++)if(!Ki(i[l],r[l]))return!1;return!0}function Ah(i,r,l,u,p,m){return or=m,Pe=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,C.H=i===null||i.memoizedState===null?o_:Fh,xs=!1,m=l(u,p),xs=!1,al&&(m=Ag(r,l,u,p)),Eg(i),m}function Eg(i){C.H=ga;var r=ft!==null&&ft.next!==null;if(or=0,Vt=ft=Pe=null,ec=!1,da=0,ol=null,r)throw Error(s(300));i===null||Gt||(i=i.dependencies,i!==null&&$o(i)&&(Gt=!0))}function Ag(i,r,l,u){Pe=i;var p=0;do{if(al&&(ol=null),da=0,al=!1,25<=p)throw Error(s(301));if(p+=1,Vt=ft=null,i.updateQueue!=null){var m=i.updateQueue;m.lastEffect=null,m.events=null,m.stores=null,m.memoCache!=null&&(m.memoCache.index=0)}C.H=c_,m=r(l,u)}while(al);return m}function hw(){var i=C.H,r=i.useState()[0];return r=typeof r.then=="function"?pa(r):r,i=i.useState()[0],(ft!==null?ft.memoizedState:null)!==i&&(Pe.flags|=1024),r}function Th(){var i=tc!==0;return tc=0,i}function Nh(i,r,l){r.updateQueue=i.updateQueue,r.flags&=-2053,i.lanes&=~l}function Dh(i){if(ec){for(i=i.memoizedState;i!==null;){var r=i.queue;r!==null&&(r.pending=null),i=i.next}ec=!1}or=0,Vt=ft=Pe=null,al=!1,da=tc=0,ol=null}function Ai(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Vt===null?Pe.memoizedState=Vt=i:Vt=Vt.next=i,Vt}function Ft(){if(ft===null){var i=Pe.alternate;i=i!==null?i.memoizedState:null}else i=ft.next;var r=Vt===null?Pe.memoizedState:Vt.next;if(r!==null)Vt=r,ft=i;else{if(i===null)throw Pe.alternate===null?Error(s(467)):Error(s(310));ft=i,i={memoizedState:ft.memoizedState,baseState:ft.baseState,baseQueue:ft.baseQueue,queue:ft.queue,next:null},Vt===null?Pe.memoizedState=Vt=i:Vt=Vt.next=i}return Vt}function ic(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function pa(i){var r=da;return da+=1,ol===null&&(ol=[]),i=_g(ol,i,r),r=Pe,(Vt===null?r.memoizedState:Vt.next)===null&&(r=r.alternate,C.H=r===null||r.memoizedState===null?o_:Fh),i}function nc(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return pa(i);if(i.$$typeof===j)return gi(i)}throw Error(s(438,String(i)))}function Rh(i){var r=null,l=Pe.updateQueue;if(l!==null&&(r=l.memoCache),r==null){var u=Pe.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(r={data:u.data.map(function(p){return p.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),l===null&&(l=ic(),Pe.updateQueue=l),l.memoCache=r,l=r.data[r.index],l===void 0)for(l=r.data[r.index]=Array(i),u=0;u<i;u++)l[u]=G;return r.index++,l}function cr(i,r){return typeof r=="function"?r(i):r}function rc(i){var r=Ft();return Mh(r,ft,i)}function Mh(i,r,l){var u=i.queue;if(u===null)throw Error(s(311));u.lastRenderedReducer=l;var p=i.baseQueue,m=u.pending;if(m!==null){if(p!==null){var x=p.next;p.next=m.next,m.next=x}r.baseQueue=p=m,u.pending=null}if(m=i.baseState,p===null)i.memoizedState=m;else{r=p.next;var E=x=null,O=null,Q=r,ae=!1;do{var fe=Q.lane&-536870913;if(fe!==Q.lane?(Ze&fe)===fe:(or&fe)===fe){var ee=Q.revertLane;if(ee===0)O!==null&&(O=O.next={lane:0,revertLane:0,gesture:null,action:Q.action,hasEagerState:Q.hasEagerState,eagerState:Q.eagerState,next:null}),fe===il&&(ae=!0);else if((or&ee)===ee){Q=Q.next,ee===il&&(ae=!0);continue}else fe={lane:0,revertLane:Q.revertLane,gesture:null,action:Q.action,hasEagerState:Q.hasEagerState,eagerState:Q.eagerState,next:null},O===null?(E=O=fe,x=m):O=O.next=fe,Pe.lanes|=ee,Hr|=ee;fe=Q.action,xs&&l(m,fe),m=Q.hasEagerState?Q.eagerState:l(m,fe)}else ee={lane:fe,revertLane:Q.revertLane,gesture:Q.gesture,action:Q.action,hasEagerState:Q.hasEagerState,eagerState:Q.eagerState,next:null},O===null?(E=O=ee,x=m):O=O.next=ee,Pe.lanes|=fe,Hr|=fe;Q=Q.next}while(Q!==null&&Q!==r);if(O===null?x=m:O.next=E,!Ki(m,i.memoizedState)&&(Gt=!0,ae&&(l=nl,l!==null)))throw l;i.memoizedState=m,i.baseState=x,i.baseQueue=O,u.lastRenderedState=m}return p===null&&(u.lanes=0),[i.memoizedState,u.dispatch]}function zh(i){var r=Ft(),l=r.queue;if(l===null)throw Error(s(311));l.lastRenderedReducer=i;var u=l.dispatch,p=l.pending,m=r.memoizedState;if(p!==null){l.pending=null;var x=p=p.next;do m=i(m,x.action),x=x.next;while(x!==p);Ki(m,r.memoizedState)||(Gt=!0),r.memoizedState=m,r.baseQueue===null&&(r.baseState=m),l.lastRenderedState=m}return[m,u]}function Tg(i,r,l){var u=Pe,p=Ft(),m=et;if(m){if(l===void 0)throw Error(s(407));l=l()}else l=r();var x=!Ki((ft||p).memoizedState,l);if(x&&(p.memoizedState=l,Gt=!0),p=p.queue,Bh(Rg.bind(null,u,p,i),[i]),p.getSnapshot!==r||x||Vt!==null&&Vt.memoizedState.tag&1){if(u.flags|=2048,cl(9,{destroy:void 0},Dg.bind(null,u,p,l,r),null),_t===null)throw Error(s(349));m||(or&127)!==0||Ng(u,r,l)}return l}function Ng(i,r,l){i.flags|=16384,i={getSnapshot:r,value:l},r=Pe.updateQueue,r===null?(r=ic(),Pe.updateQueue=r,r.stores=[i]):(l=r.stores,l===null?r.stores=[i]:l.push(i))}function Dg(i,r,l,u){r.value=l,r.getSnapshot=u,Mg(r)&&zg(i)}function Rg(i,r,l){return l(function(){Mg(r)&&zg(i)})}function Mg(i){var r=i.getSnapshot;i=i.value;try{var l=r();return!Ki(i,l)}catch{return!0}}function zg(i){var r=fs(i,2);r!==null&&Wi(r,i,2)}function Lh(i){var r=Ai();if(typeof i=="function"){var l=i;if(i=l(),xs){At(!0);try{l()}finally{At(!1)}}}return r.memoizedState=r.baseState=i,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:cr,lastRenderedState:i},r}function Lg(i,r,l,u){return i.baseState=l,Mh(i,ft,typeof u=="function"?u:cr)}function fw(i,r,l,u,p){if(ac(i))throw Error(s(485));if(i=r.action,i!==null){var m={payload:p,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(x){m.listeners.push(x)}};C.T!==null?l(!0):m.isTransition=!1,u(m),l=r.pending,l===null?(m.next=r.pending=m,Og(r,m)):(m.next=l.next,r.pending=l.next=m)}}function Og(i,r){var l=r.action,u=r.payload,p=i.state;if(r.isTransition){var m=C.T,x={};C.T=x;try{var E=l(p,u),O=C.S;O!==null&&O(x,E),Bg(i,r,E)}catch(Q){Oh(i,r,Q)}finally{m!==null&&x.types!==null&&(m.types=x.types),C.T=m}}else try{m=l(p,u),Bg(i,r,m)}catch(Q){Oh(i,r,Q)}}function Bg(i,r,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(u){jg(i,r,u)},function(u){return Oh(i,r,u)}):jg(i,r,l)}function jg(i,r,l){r.status="fulfilled",r.value=l,Hg(r),i.state=l,r=i.pending,r!==null&&(l=r.next,l===r?i.pending=null:(l=l.next,r.next=l,Og(i,l)))}function Oh(i,r,l){var u=i.pending;if(i.pending=null,u!==null){u=u.next;do r.status="rejected",r.reason=l,Hg(r),r=r.next;while(r!==u)}i.action=null}function Hg(i){i=i.listeners;for(var r=0;r<i.length;r++)(0,i[r])()}function Ig(i,r){return r}function Pg(i,r){if(et){var l=_t.formState;if(l!==null){e:{var u=Pe;if(et){if(wt){t:{for(var p=wt,m=bn;p.nodeType!==8;){if(!m){p=null;break t}if(p=xn(p.nextSibling),p===null){p=null;break t}}m=p.data,p=m==="F!"||m==="F"?p:null}if(p){wt=xn(p.nextSibling),u=p.data==="F!";break e}}Nr(u)}u=!1}u&&(r=l[0])}}return l=Ai(),l.memoizedState=l.baseState=r,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ig,lastRenderedState:r},l.queue=u,l=s_.bind(null,Pe,u),u.dispatch=l,u=Lh(!1),m=Uh.bind(null,Pe,!1,u.queue),u=Ai(),p={state:r,dispatch:null,action:i,pending:null},u.queue=p,l=fw.bind(null,Pe,p,m,l),p.dispatch=l,u.memoizedState=i,[r,l,!1]}function Ug(i){var r=Ft();return Fg(r,ft,i)}function Fg(i,r,l){if(r=Mh(i,r,Ig)[0],i=rc(cr)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var u=pa(r)}catch(x){throw x===rl?Go:x}else u=r;r=Ft();var p=r.queue,m=p.dispatch;return l!==r.memoizedState&&(Pe.flags|=2048,cl(9,{destroy:void 0},dw.bind(null,p,l),null)),[u,m,i]}function dw(i,r){i.action=r}function Wg(i){var r=Ft(),l=ft;if(l!==null)return Fg(r,l,i);Ft(),r=r.memoizedState,l=Ft();var u=l.queue.dispatch;return l.memoizedState=i,[r,u,!1]}function cl(i,r,l,u){return i={tag:i,create:l,deps:u,inst:r,next:null},r=Pe.updateQueue,r===null&&(r=ic(),Pe.updateQueue=r),l=r.lastEffect,l===null?r.lastEffect=i.next=i:(u=l.next,l.next=i,i.next=u,r.lastEffect=i),i}function qg(){return Ft().memoizedState}function sc(i,r,l,u){var p=Ai();Pe.flags|=i,p.memoizedState=cl(1|r,{destroy:void 0},l,u===void 0?null:u)}function lc(i,r,l,u){var p=Ft();u=u===void 0?null:u;var m=p.memoizedState.inst;ft!==null&&u!==null&&Eh(u,ft.memoizedState.deps)?p.memoizedState=cl(r,m,l,u):(Pe.flags|=i,p.memoizedState=cl(1|r,m,l,u))}function $g(i,r){sc(8390656,8,i,r)}function Bh(i,r){lc(2048,8,i,r)}function pw(i){Pe.flags|=4;var r=Pe.updateQueue;if(r===null)r=ic(),Pe.updateQueue=r,r.events=[i];else{var l=r.events;l===null?r.events=[i]:l.push(i)}}function Yg(i){var r=Ft().memoizedState;return pw({ref:r,nextImpl:i}),function(){if((at&2)!==0)throw Error(s(440));return r.impl.apply(void 0,arguments)}}function Vg(i,r){return lc(4,2,i,r)}function Gg(i,r){return lc(4,4,i,r)}function Kg(i,r){if(typeof r=="function"){i=i();var l=r(i);return function(){typeof l=="function"?l():r(null)}}if(r!=null)return i=i(),r.current=i,function(){r.current=null}}function Xg(i,r,l){l=l!=null?l.concat([i]):null,lc(4,4,Kg.bind(null,r,i),l)}function jh(){}function Zg(i,r){var l=Ft();r=r===void 0?null:r;var u=l.memoizedState;return r!==null&&Eh(r,u[1])?u[0]:(l.memoizedState=[i,r],i)}function Qg(i,r){var l=Ft();r=r===void 0?null:r;var u=l.memoizedState;if(r!==null&&Eh(r,u[1]))return u[0];if(u=i(),xs){At(!0);try{i()}finally{At(!1)}}return l.memoizedState=[u,r],u}function Hh(i,r,l){return l===void 0||(or&1073741824)!==0&&(Ze&261930)===0?i.memoizedState=r:(i.memoizedState=l,i=J_(),Pe.lanes|=i,Hr|=i,l)}function Jg(i,r,l,u){return Ki(l,r)?l:ll.current!==null?(i=Hh(i,l,u),Ki(i,r)||(Gt=!0),i):(or&42)===0||(or&1073741824)!==0&&(Ze&261930)===0?(Gt=!0,i.memoizedState=l):(i=J_(),Pe.lanes|=i,Hr|=i,r)}function e_(i,r,l,u,p){var m=B.p;B.p=m!==0&&8>m?m:8;var x=C.T,E={};C.T=E,Uh(i,!1,r,l);try{var O=p(),Q=C.S;if(Q!==null&&Q(E,O),O!==null&&typeof O=="object"&&typeof O.then=="function"){var ae=cw(O,u);ma(i,r,ae,tn(i))}else ma(i,r,u,tn(i))}catch(fe){ma(i,r,{then:function(){},status:"rejected",reason:fe},tn())}finally{B.p=m,x!==null&&E.types!==null&&(x.types=E.types),C.T=x}}function mw(){}function Ih(i,r,l,u){if(i.tag!==5)throw Error(s(476));var p=t_(i).queue;e_(i,p,r,U,l===null?mw:function(){return i_(i),l(u)})}function t_(i){var r=i.memoizedState;if(r!==null)return r;r={memoizedState:U,baseState:U,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:cr,lastRenderedState:U},next:null};var l={};return r.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:cr,lastRenderedState:l},next:null},i.memoizedState=r,i=i.alternate,i!==null&&(i.memoizedState=r),r}function i_(i){var r=t_(i);r.next===null&&(r=i.alternate.memoizedState),ma(i,r.next.queue,{},tn())}function Ph(){return gi(Ma)}function n_(){return Ft().memoizedState}function r_(){return Ft().memoizedState}function gw(i){for(var r=i.return;r!==null;){switch(r.tag){case 24:case 3:var l=tn();i=Mr(l);var u=zr(r,i,l);u!==null&&(Wi(u,r,l),ua(u,r,l)),r={cache:mh()},i.payload=r;return}r=r.return}}function _w(i,r,l){var u=tn();l={lane:u,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},ac(i)?l_(r,l):(l=rh(i,r,l,u),l!==null&&(Wi(l,i,u),a_(l,r,u)))}function s_(i,r,l){var u=tn();ma(i,r,l,u)}function ma(i,r,l,u){var p={lane:u,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(ac(i))l_(r,p);else{var m=i.alternate;if(i.lanes===0&&(m===null||m.lanes===0)&&(m=r.lastRenderedReducer,m!==null))try{var x=r.lastRenderedState,E=m(x,l);if(p.hasEagerState=!0,p.eagerState=E,Ki(E,x))return Uo(i,r,p,0),_t===null&&Po(),!1}catch{}finally{}if(l=rh(i,r,p,u),l!==null)return Wi(l,i,u),a_(l,r,u),!0}return!1}function Uh(i,r,l,u){if(u={lane:2,revertLane:yf(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},ac(i)){if(r)throw Error(s(479))}else r=rh(i,l,u,2),r!==null&&Wi(r,i,2)}function ac(i){var r=i.alternate;return i===Pe||r!==null&&r===Pe}function l_(i,r){al=ec=!0;var l=i.pending;l===null?r.next=r:(r.next=l.next,l.next=r),i.pending=r}function a_(i,r,l){if((l&4194048)!==0){var u=r.lanes;u&=i.pendingLanes,l|=u,r.lanes=l,ql(i,l)}}var ga={readContext:gi,use:nc,useCallback:Bt,useContext:Bt,useEffect:Bt,useImperativeHandle:Bt,useLayoutEffect:Bt,useInsertionEffect:Bt,useMemo:Bt,useReducer:Bt,useRef:Bt,useState:Bt,useDebugValue:Bt,useDeferredValue:Bt,useTransition:Bt,useSyncExternalStore:Bt,useId:Bt,useHostTransitionStatus:Bt,useFormState:Bt,useActionState:Bt,useOptimistic:Bt,useMemoCache:Bt,useCacheRefresh:Bt};ga.useEffectEvent=Bt;var o_={readContext:gi,use:nc,useCallback:function(i,r){return Ai().memoizedState=[i,r===void 0?null:r],i},useContext:gi,useEffect:$g,useImperativeHandle:function(i,r,l){l=l!=null?l.concat([i]):null,sc(4194308,4,Kg.bind(null,r,i),l)},useLayoutEffect:function(i,r){return sc(4194308,4,i,r)},useInsertionEffect:function(i,r){sc(4,2,i,r)},useMemo:function(i,r){var l=Ai();r=r===void 0?null:r;var u=i();if(xs){At(!0);try{i()}finally{At(!1)}}return l.memoizedState=[u,r],u},useReducer:function(i,r,l){var u=Ai();if(l!==void 0){var p=l(r);if(xs){At(!0);try{l(r)}finally{At(!1)}}}else p=r;return u.memoizedState=u.baseState=p,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:p},u.queue=i,i=i.dispatch=_w.bind(null,Pe,i),[u.memoizedState,i]},useRef:function(i){var r=Ai();return i={current:i},r.memoizedState=i},useState:function(i){i=Lh(i);var r=i.queue,l=s_.bind(null,Pe,r);return r.dispatch=l,[i.memoizedState,l]},useDebugValue:jh,useDeferredValue:function(i,r){var l=Ai();return Hh(l,i,r)},useTransition:function(){var i=Lh(!1);return i=e_.bind(null,Pe,i.queue,!0,!1),Ai().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,r,l){var u=Pe,p=Ai();if(et){if(l===void 0)throw Error(s(407));l=l()}else{if(l=r(),_t===null)throw Error(s(349));(Ze&127)!==0||Ng(u,r,l)}p.memoizedState=l;var m={value:l,getSnapshot:r};return p.queue=m,$g(Rg.bind(null,u,m,i),[i]),u.flags|=2048,cl(9,{destroy:void 0},Dg.bind(null,u,m,l,r),null),l},useId:function(){var i=Ai(),r=_t.identifierPrefix;if(et){var l=In,u=Hn;l=(u&~(1<<32-tt(u)-1)).toString(32)+l,r="_"+r+"R_"+l,l=tc++,0<l&&(r+="H"+l.toString(32)),r+="_"}else l=uw++,r="_"+r+"r_"+l.toString(32)+"_";return i.memoizedState=r},useHostTransitionStatus:Ph,useFormState:Pg,useActionState:Pg,useOptimistic:function(i){var r=Ai();r.memoizedState=r.baseState=i;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=l,r=Uh.bind(null,Pe,!0,l),l.dispatch=r,[i,r]},useMemoCache:Rh,useCacheRefresh:function(){return Ai().memoizedState=gw.bind(null,Pe)},useEffectEvent:function(i){var r=Ai(),l={impl:i};return r.memoizedState=l,function(){if((at&2)!==0)throw Error(s(440));return l.impl.apply(void 0,arguments)}}},Fh={readContext:gi,use:nc,useCallback:Zg,useContext:gi,useEffect:Bh,useImperativeHandle:Xg,useInsertionEffect:Vg,useLayoutEffect:Gg,useMemo:Qg,useReducer:rc,useRef:qg,useState:function(){return rc(cr)},useDebugValue:jh,useDeferredValue:function(i,r){var l=Ft();return Jg(l,ft.memoizedState,i,r)},useTransition:function(){var i=rc(cr)[0],r=Ft().memoizedState;return[typeof i=="boolean"?i:pa(i),r]},useSyncExternalStore:Tg,useId:n_,useHostTransitionStatus:Ph,useFormState:Ug,useActionState:Ug,useOptimistic:function(i,r){var l=Ft();return Lg(l,ft,i,r)},useMemoCache:Rh,useCacheRefresh:r_};Fh.useEffectEvent=Yg;var c_={readContext:gi,use:nc,useCallback:Zg,useContext:gi,useEffect:Bh,useImperativeHandle:Xg,useInsertionEffect:Vg,useLayoutEffect:Gg,useMemo:Qg,useReducer:zh,useRef:qg,useState:function(){return zh(cr)},useDebugValue:jh,useDeferredValue:function(i,r){var l=Ft();return ft===null?Hh(l,i,r):Jg(l,ft.memoizedState,i,r)},useTransition:function(){var i=zh(cr)[0],r=Ft().memoizedState;return[typeof i=="boolean"?i:pa(i),r]},useSyncExternalStore:Tg,useId:n_,useHostTransitionStatus:Ph,useFormState:Wg,useActionState:Wg,useOptimistic:function(i,r){var l=Ft();return ft!==null?Lg(l,ft,i,r):(l.baseState=i,[i,l.queue.dispatch])},useMemoCache:Rh,useCacheRefresh:r_};c_.useEffectEvent=Yg;function Wh(i,r,l,u){r=i.memoizedState,l=l(u,r),l=l==null?r:v({},r,l),i.memoizedState=l,i.lanes===0&&(i.updateQueue.baseState=l)}var qh={enqueueSetState:function(i,r,l){i=i._reactInternals;var u=tn(),p=Mr(u);p.payload=r,l!=null&&(p.callback=l),r=zr(i,p,u),r!==null&&(Wi(r,i,u),ua(r,i,u))},enqueueReplaceState:function(i,r,l){i=i._reactInternals;var u=tn(),p=Mr(u);p.tag=1,p.payload=r,l!=null&&(p.callback=l),r=zr(i,p,u),r!==null&&(Wi(r,i,u),ua(r,i,u))},enqueueForceUpdate:function(i,r){i=i._reactInternals;var l=tn(),u=Mr(l);u.tag=2,r!=null&&(u.callback=r),r=zr(i,u,l),r!==null&&(Wi(r,i,l),ua(r,i,l))}};function u_(i,r,l,u,p,m,x){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(u,m,x):r.prototype&&r.prototype.isPureReactComponent?!ia(l,u)||!ia(p,m):!0}function h_(i,r,l,u){i=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(l,u),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(l,u),r.state!==i&&qh.enqueueReplaceState(r,r.state,null)}function Ss(i,r){var l=r;if("ref"in r){l={};for(var u in r)u!=="ref"&&(l[u]=r[u])}if(i=i.defaultProps){l===r&&(l=v({},l));for(var p in i)l[p]===void 0&&(l[p]=i[p])}return l}function f_(i){Io(i)}function d_(i){console.error(i)}function p_(i){Io(i)}function oc(i,r){try{var l=i.onUncaughtError;l(r.value,{componentStack:r.stack})}catch(u){setTimeout(function(){throw u})}}function m_(i,r,l){try{var u=i.onCaughtError;u(l.value,{componentStack:l.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(p){setTimeout(function(){throw p})}}function $h(i,r,l){return l=Mr(l),l.tag=3,l.payload={element:null},l.callback=function(){oc(i,r)},l}function g_(i){return i=Mr(i),i.tag=3,i}function __(i,r,l,u){var p=l.type.getDerivedStateFromError;if(typeof p=="function"){var m=u.value;i.payload=function(){return p(m)},i.callback=function(){m_(r,l,u)}}var x=l.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(i.callback=function(){m_(r,l,u),typeof p!="function"&&(Ir===null?Ir=new Set([this]):Ir.add(this));var E=u.stack;this.componentDidCatch(u.value,{componentStack:E!==null?E:""})})}function vw(i,r,l,u,p){if(l.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(r=l.alternate,r!==null&&tl(r,l,p,!0),l=Zi.current,l!==null){switch(l.tag){case 31:case 13:return yn===null?yc():l.alternate===null&&jt===0&&(jt=3),l.flags&=-257,l.flags|=65536,l.lanes=p,u===Ko?l.flags|=16384:(r=l.updateQueue,r===null?l.updateQueue=new Set([u]):r.add(u),_f(i,u,p)),!1;case 22:return l.flags|=65536,u===Ko?l.flags|=16384:(r=l.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([u])},l.updateQueue=r):(l=r.retryQueue,l===null?r.retryQueue=new Set([u]):l.add(u)),_f(i,u,p)),!1}throw Error(s(435,l.tag))}return _f(i,u,p),yc(),!1}if(et)return r=Zi.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=p,u!==uh&&(i=Error(s(422),{cause:u}),sa(gn(i,l)))):(u!==uh&&(r=Error(s(423),{cause:u}),sa(gn(r,l))),i=i.current.alternate,i.flags|=65536,p&=-p,i.lanes|=p,u=gn(u,l),p=$h(i.stateNode,u,p),xh(i,p),jt!==4&&(jt=2)),!1;var m=Error(s(520),{cause:u});if(m=gn(m,l),Ca===null?Ca=[m]:Ca.push(m),jt!==4&&(jt=2),r===null)return!0;u=gn(u,l),l=r;do{switch(l.tag){case 3:return l.flags|=65536,i=p&-p,l.lanes|=i,i=$h(l.stateNode,u,i),xh(l,i),!1;case 1:if(r=l.type,m=l.stateNode,(l.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||m!==null&&typeof m.componentDidCatch=="function"&&(Ir===null||!Ir.has(m))))return l.flags|=65536,p&=-p,l.lanes|=p,p=g_(p),__(p,i,l,u),xh(l,p),!1}l=l.return}while(l!==null);return!1}var Yh=Error(s(461)),Gt=!1;function _i(i,r,l,u){r.child=i===null?xg(r,null,l,u):ys(r,i.child,l,u)}function v_(i,r,l,u,p){l=l.render;var m=r.ref;if("ref"in u){var x={};for(var E in u)E!=="ref"&&(x[E]=u[E])}else x=u;return gs(r),u=Ah(i,r,l,x,m,p),E=Th(),i!==null&&!Gt?(Nh(i,r,p),ur(i,r,p)):(et&&E&&oh(r),r.flags|=1,_i(i,r,u,p),r.child)}function b_(i,r,l,u,p){if(i===null){var m=l.type;return typeof m=="function"&&!sh(m)&&m.defaultProps===void 0&&l.compare===null?(r.tag=15,r.type=m,y_(i,r,m,u,p)):(i=Wo(l.type,null,u,r,r.mode,p),i.ref=r.ref,i.return=r,r.child=i)}if(m=i.child,!ef(i,p)){var x=m.memoizedProps;if(l=l.compare,l=l!==null?l:ia,l(x,u)&&i.ref===r.ref)return ur(i,r,p)}return r.flags|=1,i=rr(m,u),i.ref=r.ref,i.return=r,r.child=i}function y_(i,r,l,u,p){if(i!==null){var m=i.memoizedProps;if(ia(m,u)&&i.ref===r.ref)if(Gt=!1,r.pendingProps=u=m,ef(i,p))(i.flags&131072)!==0&&(Gt=!0);else return r.lanes=i.lanes,ur(i,r,p)}return Vh(i,r,l,u,p)}function x_(i,r,l,u){var p=u.children,m=i!==null?i.memoizedState:null;if(i===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((r.flags&128)!==0){if(m=m!==null?m.baseLanes|l:l,i!==null){for(u=r.child=i.child,p=0;u!==null;)p=p|u.lanes|u.childLanes,u=u.sibling;u=p&~m}else u=0,r.child=null;return S_(i,r,m,l,u)}if((l&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},i!==null&&Vo(r,m!==null?m.cachePool:null),m!==null?Cg(r,m):wh(),kg(r);else return u=r.lanes=536870912,S_(i,r,m!==null?m.baseLanes|l:l,l,u)}else m!==null?(Vo(r,m.cachePool),Cg(r,m),Or(),r.memoizedState=null):(i!==null&&Vo(r,null),wh(),Or());return _i(i,r,p,l),r.child}function _a(i,r){return i!==null&&i.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function S_(i,r,l,u,p){var m=_h();return m=m===null?null:{parent:Yt._currentValue,pool:m},r.memoizedState={baseLanes:l,cachePool:m},i!==null&&Vo(r,null),wh(),kg(r),i!==null&&tl(i,r,u,!0),r.childLanes=p,null}function cc(i,r){return r=hc({mode:r.mode,children:r.children},i.mode),r.ref=i.ref,i.child=r,r.return=i,r}function w_(i,r,l){return ys(r,i.child,null,l),i=cc(r,r.pendingProps),i.flags|=2,Qi(r),r.memoizedState=null,i}function bw(i,r,l){var u=r.pendingProps,p=(r.flags&128)!==0;if(r.flags&=-129,i===null){if(et){if(u.mode==="hidden")return i=cc(r,u),r.lanes=536870912,_a(null,i);if(kh(r),(i=wt)?(i=O0(i,bn),i=i!==null&&i.data==="&"?i:null,i!==null&&(r.memoizedState={dehydrated:i,treeContext:Ar!==null?{id:Hn,overflow:In}:null,retryLane:536870912,hydrationErrors:null},l=lg(i),l.return=r,r.child=l,mi=r,wt=null)):i=null,i===null)throw Nr(r);return r.lanes=536870912,null}return cc(r,u)}var m=i.memoizedState;if(m!==null){var x=m.dehydrated;if(kh(r),p)if(r.flags&256)r.flags&=-257,r=w_(i,r,l);else if(r.memoizedState!==null)r.child=i.child,r.flags|=128,r=null;else throw Error(s(558));else if(Gt||tl(i,r,l,!1),p=(l&i.childLanes)!==0,Gt||p){if(u=_t,u!==null&&(x=ko(u,l),x!==0&&x!==m.retryLane))throw m.retryLane=x,fs(i,x),Wi(u,i,x),Yh;yc(),r=w_(i,r,l)}else i=m.treeContext,wt=xn(x.nextSibling),mi=r,et=!0,Tr=null,bn=!1,i!==null&&cg(r,i),r=cc(r,u),r.flags|=4096;return r}return i=rr(i.child,{mode:u.mode,children:u.children}),i.ref=r.ref,r.child=i,i.return=r,i}function uc(i,r){var l=r.ref;if(l===null)i!==null&&i.ref!==null&&(r.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(s(284));(i===null||i.ref!==l)&&(r.flags|=4194816)}}function Vh(i,r,l,u,p){return gs(r),l=Ah(i,r,l,u,void 0,p),u=Th(),i!==null&&!Gt?(Nh(i,r,p),ur(i,r,p)):(et&&u&&oh(r),r.flags|=1,_i(i,r,l,p),r.child)}function C_(i,r,l,u,p,m){return gs(r),r.updateQueue=null,l=Ag(r,u,l,p),Eg(i),u=Th(),i!==null&&!Gt?(Nh(i,r,m),ur(i,r,m)):(et&&u&&oh(r),r.flags|=1,_i(i,r,l,m),r.child)}function k_(i,r,l,u,p){if(gs(r),r.stateNode===null){var m=Zs,x=l.contextType;typeof x=="object"&&x!==null&&(m=gi(x)),m=new l(u,m),r.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,m.updater=qh,r.stateNode=m,m._reactInternals=r,m=r.stateNode,m.props=u,m.state=r.memoizedState,m.refs={},bh(r),x=l.contextType,m.context=typeof x=="object"&&x!==null?gi(x):Zs,m.state=r.memoizedState,x=l.getDerivedStateFromProps,typeof x=="function"&&(Wh(r,l,x,u),m.state=r.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof m.getSnapshotBeforeUpdate=="function"||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(x=m.state,typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount(),x!==m.state&&qh.enqueueReplaceState(m,m.state,null),fa(r,u,m,p),ha(),m.state=r.memoizedState),typeof m.componentDidMount=="function"&&(r.flags|=4194308),u=!0}else if(i===null){m=r.stateNode;var E=r.memoizedProps,O=Ss(l,E);m.props=O;var Q=m.context,ae=l.contextType;x=Zs,typeof ae=="object"&&ae!==null&&(x=gi(ae));var fe=l.getDerivedStateFromProps;ae=typeof fe=="function"||typeof m.getSnapshotBeforeUpdate=="function",E=r.pendingProps!==E,ae||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(E||Q!==x)&&h_(r,m,u,x),Rr=!1;var ee=r.memoizedState;m.state=ee,fa(r,u,m,p),ha(),Q=r.memoizedState,E||ee!==Q||Rr?(typeof fe=="function"&&(Wh(r,l,fe,u),Q=r.memoizedState),(O=Rr||u_(r,l,O,u,ee,Q,x))?(ae||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"&&(r.flags|=4194308)):(typeof m.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=u,r.memoizedState=Q),m.props=u,m.state=Q,m.context=x,u=O):(typeof m.componentDidMount=="function"&&(r.flags|=4194308),u=!1)}else{m=r.stateNode,yh(i,r),x=r.memoizedProps,ae=Ss(l,x),m.props=ae,fe=r.pendingProps,ee=m.context,Q=l.contextType,O=Zs,typeof Q=="object"&&Q!==null&&(O=gi(Q)),E=l.getDerivedStateFromProps,(Q=typeof E=="function"||typeof m.getSnapshotBeforeUpdate=="function")||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(x!==fe||ee!==O)&&h_(r,m,u,O),Rr=!1,ee=r.memoizedState,m.state=ee,fa(r,u,m,p),ha();var ne=r.memoizedState;x!==fe||ee!==ne||Rr||i!==null&&i.dependencies!==null&&$o(i.dependencies)?(typeof E=="function"&&(Wh(r,l,E,u),ne=r.memoizedState),(ae=Rr||u_(r,l,ae,u,ee,ne,O)||i!==null&&i.dependencies!==null&&$o(i.dependencies))?(Q||typeof m.UNSAFE_componentWillUpdate!="function"&&typeof m.componentWillUpdate!="function"||(typeof m.componentWillUpdate=="function"&&m.componentWillUpdate(u,ne,O),typeof m.UNSAFE_componentWillUpdate=="function"&&m.UNSAFE_componentWillUpdate(u,ne,O)),typeof m.componentDidUpdate=="function"&&(r.flags|=4),typeof m.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof m.componentDidUpdate!="function"||x===i.memoizedProps&&ee===i.memoizedState||(r.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||x===i.memoizedProps&&ee===i.memoizedState||(r.flags|=1024),r.memoizedProps=u,r.memoizedState=ne),m.props=u,m.state=ne,m.context=O,u=ae):(typeof m.componentDidUpdate!="function"||x===i.memoizedProps&&ee===i.memoizedState||(r.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||x===i.memoizedProps&&ee===i.memoizedState||(r.flags|=1024),u=!1)}return m=u,uc(i,r),u=(r.flags&128)!==0,m||u?(m=r.stateNode,l=u&&typeof l.getDerivedStateFromError!="function"?null:m.render(),r.flags|=1,i!==null&&u?(r.child=ys(r,i.child,null,p),r.child=ys(r,null,l,p)):_i(i,r,l,p),r.memoizedState=m.state,i=r.child):i=ur(i,r,p),i}function E_(i,r,l,u){return ps(),r.flags|=256,_i(i,r,l,u),r.child}var Gh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Kh(i){return{baseLanes:i,cachePool:mg()}}function Xh(i,r,l){return i=i!==null?i.childLanes&~l:0,r&&(i|=en),i}function A_(i,r,l){var u=r.pendingProps,p=!1,m=(r.flags&128)!==0,x;if((x=m)||(x=i!==null&&i.memoizedState===null?!1:(Ut.current&2)!==0),x&&(p=!0,r.flags&=-129),x=(r.flags&32)!==0,r.flags&=-33,i===null){if(et){if(p?Lr(r):Or(),(i=wt)?(i=O0(i,bn),i=i!==null&&i.data!=="&"?i:null,i!==null&&(r.memoizedState={dehydrated:i,treeContext:Ar!==null?{id:Hn,overflow:In}:null,retryLane:536870912,hydrationErrors:null},l=lg(i),l.return=r,r.child=l,mi=r,wt=null)):i=null,i===null)throw Nr(r);return zf(i)?r.lanes=32:r.lanes=536870912,null}var E=u.children;return u=u.fallback,p?(Or(),p=r.mode,E=hc({mode:"hidden",children:E},p),u=ds(u,p,l,null),E.return=r,u.return=r,E.sibling=u,r.child=E,u=r.child,u.memoizedState=Kh(l),u.childLanes=Xh(i,x,l),r.memoizedState=Gh,_a(null,u)):(Lr(r),Zh(r,E))}var O=i.memoizedState;if(O!==null&&(E=O.dehydrated,E!==null)){if(m)r.flags&256?(Lr(r),r.flags&=-257,r=Qh(i,r,l)):r.memoizedState!==null?(Or(),r.child=i.child,r.flags|=128,r=null):(Or(),E=u.fallback,p=r.mode,u=hc({mode:"visible",children:u.children},p),E=ds(E,p,l,null),E.flags|=2,u.return=r,E.return=r,u.sibling=E,r.child=u,ys(r,i.child,null,l),u=r.child,u.memoizedState=Kh(l),u.childLanes=Xh(i,x,l),r.memoizedState=Gh,r=_a(null,u));else if(Lr(r),zf(E)){if(x=E.nextSibling&&E.nextSibling.dataset,x)var Q=x.dgst;x=Q,u=Error(s(419)),u.stack="",u.digest=x,sa({value:u,source:null,stack:null}),r=Qh(i,r,l)}else if(Gt||tl(i,r,l,!1),x=(l&i.childLanes)!==0,Gt||x){if(x=_t,x!==null&&(u=ko(x,l),u!==0&&u!==O.retryLane))throw O.retryLane=u,fs(i,u),Wi(x,i,u),Yh;Mf(E)||yc(),r=Qh(i,r,l)}else Mf(E)?(r.flags|=192,r.child=i.child,r=null):(i=O.treeContext,wt=xn(E.nextSibling),mi=r,et=!0,Tr=null,bn=!1,i!==null&&cg(r,i),r=Zh(r,u.children),r.flags|=4096);return r}return p?(Or(),E=u.fallback,p=r.mode,O=i.child,Q=O.sibling,u=rr(O,{mode:"hidden",children:u.children}),u.subtreeFlags=O.subtreeFlags&65011712,Q!==null?E=rr(Q,E):(E=ds(E,p,l,null),E.flags|=2),E.return=r,u.return=r,u.sibling=E,r.child=u,_a(null,u),u=r.child,E=i.child.memoizedState,E===null?E=Kh(l):(p=E.cachePool,p!==null?(O=Yt._currentValue,p=p.parent!==O?{parent:O,pool:O}:p):p=mg(),E={baseLanes:E.baseLanes|l,cachePool:p}),u.memoizedState=E,u.childLanes=Xh(i,x,l),r.memoizedState=Gh,_a(i.child,u)):(Lr(r),l=i.child,i=l.sibling,l=rr(l,{mode:"visible",children:u.children}),l.return=r,l.sibling=null,i!==null&&(x=r.deletions,x===null?(r.deletions=[i],r.flags|=16):x.push(i)),r.child=l,r.memoizedState=null,l)}function Zh(i,r){return r=hc({mode:"visible",children:r},i.mode),r.return=i,i.child=r}function hc(i,r){return i=Xi(22,i,null,r),i.lanes=0,i}function Qh(i,r,l){return ys(r,i.child,null,l),i=Zh(r,r.pendingProps.children),i.flags|=2,r.memoizedState=null,i}function T_(i,r,l){i.lanes|=r;var u=i.alternate;u!==null&&(u.lanes|=r),dh(i.return,r,l)}function Jh(i,r,l,u,p,m){var x=i.memoizedState;x===null?i.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:u,tail:l,tailMode:p,treeForkCount:m}:(x.isBackwards=r,x.rendering=null,x.renderingStartTime=0,x.last=u,x.tail=l,x.tailMode=p,x.treeForkCount=m)}function N_(i,r,l){var u=r.pendingProps,p=u.revealOrder,m=u.tail;u=u.children;var x=Ut.current,E=(x&2)!==0;if(E?(x=x&1|2,r.flags|=128):x&=1,k(Ut,x),_i(i,r,u,l),u=et?ra:0,!E&&i!==null&&(i.flags&128)!==0)e:for(i=r.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&T_(i,l,r);else if(i.tag===19)T_(i,l,r);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break e;for(;i.sibling===null;){if(i.return===null||i.return===r)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(p){case"forwards":for(l=r.child,p=null;l!==null;)i=l.alternate,i!==null&&Jo(i)===null&&(p=l),l=l.sibling;l=p,l===null?(p=r.child,r.child=null):(p=l.sibling,l.sibling=null),Jh(r,!1,p,l,m,u);break;case"backwards":case"unstable_legacy-backwards":for(l=null,p=r.child,r.child=null;p!==null;){if(i=p.alternate,i!==null&&Jo(i)===null){r.child=p;break}i=p.sibling,p.sibling=l,l=p,p=i}Jh(r,!0,l,null,m,u);break;case"together":Jh(r,!1,null,null,void 0,u);break;default:r.memoizedState=null}return r.child}function ur(i,r,l){if(i!==null&&(r.dependencies=i.dependencies),Hr|=r.lanes,(l&r.childLanes)===0)if(i!==null){if(tl(i,r,l,!1),(l&r.childLanes)===0)return null}else return null;if(i!==null&&r.child!==i.child)throw Error(s(153));if(r.child!==null){for(i=r.child,l=rr(i,i.pendingProps),r.child=l,l.return=r;i.sibling!==null;)i=i.sibling,l=l.sibling=rr(i,i.pendingProps),l.return=r;l.sibling=null}return r.child}function ef(i,r){return(i.lanes&r)!==0?!0:(i=i.dependencies,!!(i!==null&&$o(i)))}function yw(i,r,l){switch(r.tag){case 3:Ee(r,r.stateNode.containerInfo),Dr(r,Yt,i.memoizedState.cache),ps();break;case 27:case 5:Ie(r);break;case 4:Ee(r,r.stateNode.containerInfo);break;case 10:Dr(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,kh(r),null;break;case 13:var u=r.memoizedState;if(u!==null)return u.dehydrated!==null?(Lr(r),r.flags|=128,null):(l&r.child.childLanes)!==0?A_(i,r,l):(Lr(r),i=ur(i,r,l),i!==null?i.sibling:null);Lr(r);break;case 19:var p=(i.flags&128)!==0;if(u=(l&r.childLanes)!==0,u||(tl(i,r,l,!1),u=(l&r.childLanes)!==0),p){if(u)return N_(i,r,l);r.flags|=128}if(p=r.memoizedState,p!==null&&(p.rendering=null,p.tail=null,p.lastEffect=null),k(Ut,Ut.current),u)break;return null;case 22:return r.lanes=0,x_(i,r,l,r.pendingProps);case 24:Dr(r,Yt,i.memoizedState.cache)}return ur(i,r,l)}function D_(i,r,l){if(i!==null)if(i.memoizedProps!==r.pendingProps)Gt=!0;else{if(!ef(i,l)&&(r.flags&128)===0)return Gt=!1,yw(i,r,l);Gt=(i.flags&131072)!==0}else Gt=!1,et&&(r.flags&1048576)!==0&&og(r,ra,r.index);switch(r.lanes=0,r.tag){case 16:e:{var u=r.pendingProps;if(i=vs(r.elementType),r.type=i,typeof i=="function")sh(i)?(u=Ss(i,u),r.tag=1,r=k_(null,r,i,u,l)):(r.tag=0,r=Vh(null,r,i,u,l));else{if(i!=null){var p=i.$$typeof;if(p===I){r.tag=11,r=v_(null,r,i,u,l);break e}else if(p===te){r.tag=14,r=b_(null,r,i,u,l);break e}}throw r=P(i)||i,Error(s(306,r,""))}}return r;case 0:return Vh(i,r,r.type,r.pendingProps,l);case 1:return u=r.type,p=Ss(u,r.pendingProps),k_(i,r,u,p,l);case 3:e:{if(Ee(r,r.stateNode.containerInfo),i===null)throw Error(s(387));u=r.pendingProps;var m=r.memoizedState;p=m.element,yh(i,r),fa(r,u,null,l);var x=r.memoizedState;if(u=x.cache,Dr(r,Yt,u),u!==m.cache&&ph(r,[Yt],l,!0),ha(),u=x.element,m.isDehydrated)if(m={element:u,isDehydrated:!1,cache:x.cache},r.updateQueue.baseState=m,r.memoizedState=m,r.flags&256){r=E_(i,r,u,l);break e}else if(u!==p){p=gn(Error(s(424)),r),sa(p),r=E_(i,r,u,l);break e}else{switch(i=r.stateNode.containerInfo,i.nodeType){case 9:i=i.body;break;default:i=i.nodeName==="HTML"?i.ownerDocument.body:i}for(wt=xn(i.firstChild),mi=r,et=!0,Tr=null,bn=!0,l=xg(r,null,u,l),r.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(ps(),u===p){r=ur(i,r,l);break e}_i(i,r,u,l)}r=r.child}return r;case 26:return uc(i,r),i===null?(l=U0(r.type,null,r.pendingProps,null))?r.memoizedState=l:et||(l=r.type,i=r.pendingProps,u=Ac(le.current).createElement(l),u[$t]=r,u[Tt]=i,vi(u,l,i),We(u),r.stateNode=u):r.memoizedState=U0(r.type,i.memoizedProps,r.pendingProps,i.memoizedState),null;case 27:return Ie(r),i===null&&et&&(u=r.stateNode=H0(r.type,r.pendingProps,le.current),mi=r,bn=!0,p=wt,Wr(r.type)?(Lf=p,wt=xn(u.firstChild)):wt=p),_i(i,r,r.pendingProps.children,l),uc(i,r),i===null&&(r.flags|=4194304),r.child;case 5:return i===null&&et&&((p=u=wt)&&(u=Xw(u,r.type,r.pendingProps,bn),u!==null?(r.stateNode=u,mi=r,wt=xn(u.firstChild),bn=!1,p=!0):p=!1),p||Nr(r)),Ie(r),p=r.type,m=r.pendingProps,x=i!==null?i.memoizedProps:null,u=m.children,Nf(p,m)?u=null:x!==null&&Nf(p,x)&&(r.flags|=32),r.memoizedState!==null&&(p=Ah(i,r,hw,null,null,l),Ma._currentValue=p),uc(i,r),_i(i,r,u,l),r.child;case 6:return i===null&&et&&((i=l=wt)&&(l=Zw(l,r.pendingProps,bn),l!==null?(r.stateNode=l,mi=r,wt=null,i=!0):i=!1),i||Nr(r)),null;case 13:return A_(i,r,l);case 4:return Ee(r,r.stateNode.containerInfo),u=r.pendingProps,i===null?r.child=ys(r,null,u,l):_i(i,r,u,l),r.child;case 11:return v_(i,r,r.type,r.pendingProps,l);case 7:return _i(i,r,r.pendingProps,l),r.child;case 8:return _i(i,r,r.pendingProps.children,l),r.child;case 12:return _i(i,r,r.pendingProps.children,l),r.child;case 10:return u=r.pendingProps,Dr(r,r.type,u.value),_i(i,r,u.children,l),r.child;case 9:return p=r.type._context,u=r.pendingProps.children,gs(r),p=gi(p),u=u(p),r.flags|=1,_i(i,r,u,l),r.child;case 14:return b_(i,r,r.type,r.pendingProps,l);case 15:return y_(i,r,r.type,r.pendingProps,l);case 19:return N_(i,r,l);case 31:return bw(i,r,l);case 22:return x_(i,r,l,r.pendingProps);case 24:return gs(r),u=gi(Yt),i===null?(p=_h(),p===null&&(p=_t,m=mh(),p.pooledCache=m,m.refCount++,m!==null&&(p.pooledCacheLanes|=l),p=m),r.memoizedState={parent:u,cache:p},bh(r),Dr(r,Yt,p)):((i.lanes&l)!==0&&(yh(i,r),fa(r,null,null,l),ha()),p=i.memoizedState,m=r.memoizedState,p.parent!==u?(p={parent:u,cache:u},r.memoizedState=p,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=p),Dr(r,Yt,u)):(u=m.cache,Dr(r,Yt,u),u!==p.cache&&ph(r,[Yt],l,!0))),_i(i,r,r.pendingProps.children,l),r.child;case 29:throw r.pendingProps}throw Error(s(156,r.tag))}function hr(i){i.flags|=4}function tf(i,r,l,u,p){if((r=(i.mode&32)!==0)&&(r=!1),r){if(i.flags|=16777216,(p&335544128)===p)if(i.stateNode.complete)i.flags|=8192;else if(n0())i.flags|=8192;else throw bs=Ko,vh}else i.flags&=-16777217}function R_(i,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!Y0(r))if(n0())i.flags|=8192;else throw bs=Ko,vh}function fc(i,r){r!==null&&(i.flags|=4),i.flags&16384&&(r=i.tag!==22?Jn():536870912,i.lanes|=r,dl|=r)}function va(i,r){if(!et)switch(i.tailMode){case"hidden":r=i.tail;for(var l=null;r!==null;)r.alternate!==null&&(l=r),r=r.sibling;l===null?i.tail=null:l.sibling=null;break;case"collapsed":l=i.tail;for(var u=null;l!==null;)l.alternate!==null&&(u=l),l=l.sibling;u===null?r||i.tail===null?i.tail=null:i.tail.sibling=null:u.sibling=null}}function Ct(i){var r=i.alternate!==null&&i.alternate.child===i.child,l=0,u=0;if(r)for(var p=i.child;p!==null;)l|=p.lanes|p.childLanes,u|=p.subtreeFlags&65011712,u|=p.flags&65011712,p.return=i,p=p.sibling;else for(p=i.child;p!==null;)l|=p.lanes|p.childLanes,u|=p.subtreeFlags,u|=p.flags,p.return=i,p=p.sibling;return i.subtreeFlags|=u,i.childLanes=l,r}function xw(i,r,l){var u=r.pendingProps;switch(ch(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ct(r),null;case 1:return Ct(r),null;case 3:return l=r.stateNode,u=null,i!==null&&(u=i.memoizedState.cache),r.memoizedState.cache!==u&&(r.flags|=2048),ar(Yt),oe(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(i===null||i.child===null)&&(el(r)?hr(r):i===null||i.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,hh())),Ct(r),null;case 26:var p=r.type,m=r.memoizedState;return i===null?(hr(r),m!==null?(Ct(r),R_(r,m)):(Ct(r),tf(r,p,null,u,l))):m?m!==i.memoizedState?(hr(r),Ct(r),R_(r,m)):(Ct(r),r.flags&=-16777217):(i=i.memoizedProps,i!==u&&hr(r),Ct(r),tf(r,p,i,u,l)),null;case 27:if(ot(r),l=le.current,p=r.type,i!==null&&r.stateNode!=null)i.memoizedProps!==u&&hr(r);else{if(!u){if(r.stateNode===null)throw Error(s(166));return Ct(r),null}i=ie.current,el(r)?ug(r):(i=H0(p,u,l),r.stateNode=i,hr(r))}return Ct(r),null;case 5:if(ot(r),p=r.type,i!==null&&r.stateNode!=null)i.memoizedProps!==u&&hr(r);else{if(!u){if(r.stateNode===null)throw Error(s(166));return Ct(r),null}if(m=ie.current,el(r))ug(r);else{var x=Ac(le.current);switch(m){case 1:m=x.createElementNS("http://www.w3.org/2000/svg",p);break;case 2:m=x.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;default:switch(p){case"svg":m=x.createElementNS("http://www.w3.org/2000/svg",p);break;case"math":m=x.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;case"script":m=x.createElement("div"),m.innerHTML="<script><\/script>",m=m.removeChild(m.firstChild);break;case"select":m=typeof u.is=="string"?x.createElement("select",{is:u.is}):x.createElement("select"),u.multiple?m.multiple=!0:u.size&&(m.size=u.size);break;default:m=typeof u.is=="string"?x.createElement(p,{is:u.is}):x.createElement(p)}}m[$t]=r,m[Tt]=u;e:for(x=r.child;x!==null;){if(x.tag===5||x.tag===6)m.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===r)break e;for(;x.sibling===null;){if(x.return===null||x.return===r)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}r.stateNode=m;e:switch(vi(m,p,u),p){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&hr(r)}}return Ct(r),tf(r,r.type,i===null?null:i.memoizedProps,r.pendingProps,l),null;case 6:if(i&&r.stateNode!=null)i.memoizedProps!==u&&hr(r);else{if(typeof u!="string"&&r.stateNode===null)throw Error(s(166));if(i=le.current,el(r)){if(i=r.stateNode,l=r.memoizedProps,u=null,p=mi,p!==null)switch(p.tag){case 27:case 5:u=p.memoizedProps}i[$t]=r,i=!!(i.nodeValue===l||u!==null&&u.suppressHydrationWarning===!0||A0(i.nodeValue,l)),i||Nr(r,!0)}else i=Ac(i).createTextNode(u),i[$t]=r,r.stateNode=i}return Ct(r),null;case 31:if(l=r.memoizedState,i===null||i.memoizedState!==null){if(u=el(r),l!==null){if(i===null){if(!u)throw Error(s(318));if(i=r.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(s(557));i[$t]=r}else ps(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;Ct(r),i=!1}else l=hh(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=l),i=!0;if(!i)return r.flags&256?(Qi(r),r):(Qi(r),null);if((r.flags&128)!==0)throw Error(s(558))}return Ct(r),null;case 13:if(u=r.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(p=el(r),u!==null&&u.dehydrated!==null){if(i===null){if(!p)throw Error(s(318));if(p=r.memoizedState,p=p!==null?p.dehydrated:null,!p)throw Error(s(317));p[$t]=r}else ps(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;Ct(r),p=!1}else p=hh(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=p),p=!0;if(!p)return r.flags&256?(Qi(r),r):(Qi(r),null)}return Qi(r),(r.flags&128)!==0?(r.lanes=l,r):(l=u!==null,i=i!==null&&i.memoizedState!==null,l&&(u=r.child,p=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(p=u.alternate.memoizedState.cachePool.pool),m=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(m=u.memoizedState.cachePool.pool),m!==p&&(u.flags|=2048)),l!==i&&l&&(r.child.flags|=8192),fc(r,r.updateQueue),Ct(r),null);case 4:return oe(),i===null&&Cf(r.stateNode.containerInfo),Ct(r),null;case 10:return ar(r.type),Ct(r),null;case 19:if(q(Ut),u=r.memoizedState,u===null)return Ct(r),null;if(p=(r.flags&128)!==0,m=u.rendering,m===null)if(p)va(u,!1);else{if(jt!==0||i!==null&&(i.flags&128)!==0)for(i=r.child;i!==null;){if(m=Jo(i),m!==null){for(r.flags|=128,va(u,!1),i=m.updateQueue,r.updateQueue=i,fc(r,i),r.subtreeFlags=0,i=l,l=r.child;l!==null;)sg(l,i),l=l.sibling;return k(Ut,Ut.current&1|2),et&&sr(r,u.treeForkCount),r.child}i=i.sibling}u.tail!==null&&St()>_c&&(r.flags|=128,p=!0,va(u,!1),r.lanes=4194304)}else{if(!p)if(i=Jo(m),i!==null){if(r.flags|=128,p=!0,i=i.updateQueue,r.updateQueue=i,fc(r,i),va(u,!0),u.tail===null&&u.tailMode==="hidden"&&!m.alternate&&!et)return Ct(r),null}else 2*St()-u.renderingStartTime>_c&&l!==536870912&&(r.flags|=128,p=!0,va(u,!1),r.lanes=4194304);u.isBackwards?(m.sibling=r.child,r.child=m):(i=u.last,i!==null?i.sibling=m:r.child=m,u.last=m)}return u.tail!==null?(i=u.tail,u.rendering=i,u.tail=i.sibling,u.renderingStartTime=St(),i.sibling=null,l=Ut.current,k(Ut,p?l&1|2:l&1),et&&sr(r,u.treeForkCount),i):(Ct(r),null);case 22:case 23:return Qi(r),Ch(),u=r.memoizedState!==null,i!==null?i.memoizedState!==null!==u&&(r.flags|=8192):u&&(r.flags|=8192),u?(l&536870912)!==0&&(r.flags&128)===0&&(Ct(r),r.subtreeFlags&6&&(r.flags|=8192)):Ct(r),l=r.updateQueue,l!==null&&fc(r,l.retryQueue),l=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(l=i.memoizedState.cachePool.pool),u=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(u=r.memoizedState.cachePool.pool),u!==l&&(r.flags|=2048),i!==null&&q(_s),null;case 24:return l=null,i!==null&&(l=i.memoizedState.cache),r.memoizedState.cache!==l&&(r.flags|=2048),ar(Yt),Ct(r),null;case 25:return null;case 30:return null}throw Error(s(156,r.tag))}function Sw(i,r){switch(ch(r),r.tag){case 1:return i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 3:return ar(Yt),oe(),i=r.flags,(i&65536)!==0&&(i&128)===0?(r.flags=i&-65537|128,r):null;case 26:case 27:case 5:return ot(r),null;case 31:if(r.memoizedState!==null){if(Qi(r),r.alternate===null)throw Error(s(340));ps()}return i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 13:if(Qi(r),i=r.memoizedState,i!==null&&i.dehydrated!==null){if(r.alternate===null)throw Error(s(340));ps()}return i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 19:return q(Ut),null;case 4:return oe(),null;case 10:return ar(r.type),null;case 22:case 23:return Qi(r),Ch(),i!==null&&q(_s),i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 24:return ar(Yt),null;case 25:return null;default:return null}}function M_(i,r){switch(ch(r),r.tag){case 3:ar(Yt),oe();break;case 26:case 27:case 5:ot(r);break;case 4:oe();break;case 31:r.memoizedState!==null&&Qi(r);break;case 13:Qi(r);break;case 19:q(Ut);break;case 10:ar(r.type);break;case 22:case 23:Qi(r),Ch(),i!==null&&q(_s);break;case 24:ar(Yt)}}function ba(i,r){try{var l=r.updateQueue,u=l!==null?l.lastEffect:null;if(u!==null){var p=u.next;l=p;do{if((l.tag&i)===i){u=void 0;var m=l.create,x=l.inst;u=m(),x.destroy=u}l=l.next}while(l!==p)}}catch(E){ht(r,r.return,E)}}function Br(i,r,l){try{var u=r.updateQueue,p=u!==null?u.lastEffect:null;if(p!==null){var m=p.next;u=m;do{if((u.tag&i)===i){var x=u.inst,E=x.destroy;if(E!==void 0){x.destroy=void 0,p=r;var O=l,Q=E;try{Q()}catch(ae){ht(p,O,ae)}}}u=u.next}while(u!==m)}}catch(ae){ht(r,r.return,ae)}}function z_(i){var r=i.updateQueue;if(r!==null){var l=i.stateNode;try{wg(r,l)}catch(u){ht(i,i.return,u)}}}function L_(i,r,l){l.props=Ss(i.type,i.memoizedProps),l.state=i.memoizedState;try{l.componentWillUnmount()}catch(u){ht(i,r,u)}}function ya(i,r){try{var l=i.ref;if(l!==null){switch(i.tag){case 26:case 27:case 5:var u=i.stateNode;break;case 30:u=i.stateNode;break;default:u=i.stateNode}typeof l=="function"?i.refCleanup=l(u):l.current=u}}catch(p){ht(i,r,p)}}function Pn(i,r){var l=i.ref,u=i.refCleanup;if(l!==null)if(typeof u=="function")try{u()}catch(p){ht(i,r,p)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(p){ht(i,r,p)}else l.current=null}function O_(i){var r=i.type,l=i.memoizedProps,u=i.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":l.autoFocus&&u.focus();break e;case"img":l.src?u.src=l.src:l.srcSet&&(u.srcset=l.srcSet)}}catch(p){ht(i,i.return,p)}}function nf(i,r,l){try{var u=i.stateNode;qw(u,i.type,l,r),u[Tt]=r}catch(p){ht(i,i.return,p)}}function B_(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&Wr(i.type)||i.tag===4}function rf(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||B_(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&Wr(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function sf(i,r,l){var u=i.tag;if(u===5||u===6)i=i.stateNode,r?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(i,r):(r=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,r.appendChild(i),l=l._reactRootContainer,l!=null||r.onclick!==null||(r.onclick=ir));else if(u!==4&&(u===27&&Wr(i.type)&&(l=i.stateNode,r=null),i=i.child,i!==null))for(sf(i,r,l),i=i.sibling;i!==null;)sf(i,r,l),i=i.sibling}function dc(i,r,l){var u=i.tag;if(u===5||u===6)i=i.stateNode,r?l.insertBefore(i,r):l.appendChild(i);else if(u!==4&&(u===27&&Wr(i.type)&&(l=i.stateNode),i=i.child,i!==null))for(dc(i,r,l),i=i.sibling;i!==null;)dc(i,r,l),i=i.sibling}function j_(i){var r=i.stateNode,l=i.memoizedProps;try{for(var u=i.type,p=r.attributes;p.length;)r.removeAttributeNode(p[0]);vi(r,u,l),r[$t]=i,r[Tt]=l}catch(m){ht(i,i.return,m)}}var fr=!1,Kt=!1,lf=!1,H_=typeof WeakSet=="function"?WeakSet:Set,si=null;function ww(i,r){if(i=i.containerInfo,Af=Lc,i=Xm(i),Qu(i)){if("selectionStart"in i)var l={start:i.selectionStart,end:i.selectionEnd};else e:{l=(l=i.ownerDocument)&&l.defaultView||window;var u=l.getSelection&&l.getSelection();if(u&&u.rangeCount!==0){l=u.anchorNode;var p=u.anchorOffset,m=u.focusNode;u=u.focusOffset;try{l.nodeType,m.nodeType}catch{l=null;break e}var x=0,E=-1,O=-1,Q=0,ae=0,fe=i,ee=null;t:for(;;){for(var ne;fe!==l||p!==0&&fe.nodeType!==3||(E=x+p),fe!==m||u!==0&&fe.nodeType!==3||(O=x+u),fe.nodeType===3&&(x+=fe.nodeValue.length),(ne=fe.firstChild)!==null;)ee=fe,fe=ne;for(;;){if(fe===i)break t;if(ee===l&&++Q===p&&(E=x),ee===m&&++ae===u&&(O=x),(ne=fe.nextSibling)!==null)break;fe=ee,ee=fe.parentNode}fe=ne}l=E===-1||O===-1?null:{start:E,end:O}}else l=null}l=l||{start:0,end:0}}else l=null;for(Tf={focusedElem:i,selectionRange:l},Lc=!1,si=r;si!==null;)if(r=si,i=r.child,(r.subtreeFlags&1028)!==0&&i!==null)i.return=r,si=i;else for(;si!==null;){switch(r=si,m=r.alternate,i=r.flags,r.tag){case 0:if((i&4)!==0&&(i=r.updateQueue,i=i!==null?i.events:null,i!==null))for(l=0;l<i.length;l++)p=i[l],p.ref.impl=p.nextImpl;break;case 11:case 15:break;case 1:if((i&1024)!==0&&m!==null){i=void 0,l=r,p=m.memoizedProps,m=m.memoizedState,u=l.stateNode;try{var Se=Ss(l.type,p);i=u.getSnapshotBeforeUpdate(Se,m),u.__reactInternalSnapshotBeforeUpdate=i}catch(Le){ht(l,l.return,Le)}}break;case 3:if((i&1024)!==0){if(i=r.stateNode.containerInfo,l=i.nodeType,l===9)Rf(i);else if(l===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":Rf(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(s(163))}if(i=r.sibling,i!==null){i.return=r.return,si=i;break}si=r.return}}function I_(i,r,l){var u=l.flags;switch(l.tag){case 0:case 11:case 15:pr(i,l),u&4&&ba(5,l);break;case 1:if(pr(i,l),u&4)if(i=l.stateNode,r===null)try{i.componentDidMount()}catch(x){ht(l,l.return,x)}else{var p=Ss(l.type,r.memoizedProps);r=r.memoizedState;try{i.componentDidUpdate(p,r,i.__reactInternalSnapshotBeforeUpdate)}catch(x){ht(l,l.return,x)}}u&64&&z_(l),u&512&&ya(l,l.return);break;case 3:if(pr(i,l),u&64&&(i=l.updateQueue,i!==null)){if(r=null,l.child!==null)switch(l.child.tag){case 27:case 5:r=l.child.stateNode;break;case 1:r=l.child.stateNode}try{wg(i,r)}catch(x){ht(l,l.return,x)}}break;case 27:r===null&&u&4&&j_(l);case 26:case 5:pr(i,l),r===null&&u&4&&O_(l),u&512&&ya(l,l.return);break;case 12:pr(i,l);break;case 31:pr(i,l),u&4&&F_(i,l);break;case 13:pr(i,l),u&4&&W_(i,l),u&64&&(i=l.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(l=Mw.bind(null,l),Qw(i,l))));break;case 22:if(u=l.memoizedState!==null||fr,!u){r=r!==null&&r.memoizedState!==null||Kt,p=fr;var m=Kt;fr=u,(Kt=r)&&!m?mr(i,l,(l.subtreeFlags&8772)!==0):pr(i,l),fr=p,Kt=m}break;case 30:break;default:pr(i,l)}}function P_(i){var r=i.alternate;r!==null&&(i.alternate=null,P_(r)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(r=i.stateNode,r!==null&&H(r)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var Nt=null,Ii=!1;function dr(i,r,l){for(l=l.child;l!==null;)U_(i,r,l),l=l.sibling}function U_(i,r,l){if(Et&&typeof Et.onCommitFiberUnmount=="function")try{Et.onCommitFiberUnmount(qt,l)}catch{}switch(l.tag){case 26:Kt||Pn(l,r),dr(i,r,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:Kt||Pn(l,r);var u=Nt,p=Ii;Wr(l.type)&&(Nt=l.stateNode,Ii=!1),dr(i,r,l),Na(l.stateNode),Nt=u,Ii=p;break;case 5:Kt||Pn(l,r);case 6:if(u=Nt,p=Ii,Nt=null,dr(i,r,l),Nt=u,Ii=p,Nt!==null)if(Ii)try{(Nt.nodeType===9?Nt.body:Nt.nodeName==="HTML"?Nt.ownerDocument.body:Nt).removeChild(l.stateNode)}catch(m){ht(l,r,m)}else try{Nt.removeChild(l.stateNode)}catch(m){ht(l,r,m)}break;case 18:Nt!==null&&(Ii?(i=Nt,z0(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,l.stateNode),xl(i)):z0(Nt,l.stateNode));break;case 4:u=Nt,p=Ii,Nt=l.stateNode.containerInfo,Ii=!0,dr(i,r,l),Nt=u,Ii=p;break;case 0:case 11:case 14:case 15:Br(2,l,r),Kt||Br(4,l,r),dr(i,r,l);break;case 1:Kt||(Pn(l,r),u=l.stateNode,typeof u.componentWillUnmount=="function"&&L_(l,r,u)),dr(i,r,l);break;case 21:dr(i,r,l);break;case 22:Kt=(u=Kt)||l.memoizedState!==null,dr(i,r,l),Kt=u;break;default:dr(i,r,l)}}function F_(i,r){if(r.memoizedState===null&&(i=r.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{xl(i)}catch(l){ht(r,r.return,l)}}}function W_(i,r){if(r.memoizedState===null&&(i=r.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{xl(i)}catch(l){ht(r,r.return,l)}}function Cw(i){switch(i.tag){case 31:case 13:case 19:var r=i.stateNode;return r===null&&(r=i.stateNode=new H_),r;case 22:return i=i.stateNode,r=i._retryCache,r===null&&(r=i._retryCache=new H_),r;default:throw Error(s(435,i.tag))}}function pc(i,r){var l=Cw(i);r.forEach(function(u){if(!l.has(u)){l.add(u);var p=zw.bind(null,i,u);u.then(p,p)}})}function Pi(i,r){var l=r.deletions;if(l!==null)for(var u=0;u<l.length;u++){var p=l[u],m=i,x=r,E=x;e:for(;E!==null;){switch(E.tag){case 27:if(Wr(E.type)){Nt=E.stateNode,Ii=!1;break e}break;case 5:Nt=E.stateNode,Ii=!1;break e;case 3:case 4:Nt=E.stateNode.containerInfo,Ii=!0;break e}E=E.return}if(Nt===null)throw Error(s(160));U_(m,x,p),Nt=null,Ii=!1,m=p.alternate,m!==null&&(m.return=null),p.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)q_(r,i),r=r.sibling}var Mn=null;function q_(i,r){var l=i.alternate,u=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:Pi(r,i),Ui(i),u&4&&(Br(3,i,i.return),ba(3,i),Br(5,i,i.return));break;case 1:Pi(r,i),Ui(i),u&512&&(Kt||l===null||Pn(l,l.return)),u&64&&fr&&(i=i.updateQueue,i!==null&&(u=i.callbacks,u!==null&&(l=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=l===null?u:l.concat(u))));break;case 26:var p=Mn;if(Pi(r,i),Ui(i),u&512&&(Kt||l===null||Pn(l,l.return)),u&4){var m=l!==null?l.memoizedState:null;if(u=i.memoizedState,l===null)if(u===null)if(i.stateNode===null){e:{u=i.type,l=i.memoizedProps,p=p.ownerDocument||p;t:switch(u){case"title":m=p.getElementsByTagName("title")[0],(!m||m[Ae]||m[$t]||m.namespaceURI==="http://www.w3.org/2000/svg"||m.hasAttribute("itemprop"))&&(m=p.createElement(u),p.head.insertBefore(m,p.querySelector("head > title"))),vi(m,u,l),m[$t]=i,We(m),u=m;break e;case"link":var x=q0("link","href",p).get(u+(l.href||""));if(x){for(var E=0;E<x.length;E++)if(m=x[E],m.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&m.getAttribute("rel")===(l.rel==null?null:l.rel)&&m.getAttribute("title")===(l.title==null?null:l.title)&&m.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){x.splice(E,1);break t}}m=p.createElement(u),vi(m,u,l),p.head.appendChild(m);break;case"meta":if(x=q0("meta","content",p).get(u+(l.content||""))){for(E=0;E<x.length;E++)if(m=x[E],m.getAttribute("content")===(l.content==null?null:""+l.content)&&m.getAttribute("name")===(l.name==null?null:l.name)&&m.getAttribute("property")===(l.property==null?null:l.property)&&m.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&m.getAttribute("charset")===(l.charSet==null?null:l.charSet)){x.splice(E,1);break t}}m=p.createElement(u),vi(m,u,l),p.head.appendChild(m);break;default:throw Error(s(468,u))}m[$t]=i,We(m),u=m}i.stateNode=u}else $0(p,i.type,i.stateNode);else i.stateNode=W0(p,u,i.memoizedProps);else m!==u?(m===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):m.count--,u===null?$0(p,i.type,i.stateNode):W0(p,u,i.memoizedProps)):u===null&&i.stateNode!==null&&nf(i,i.memoizedProps,l.memoizedProps)}break;case 27:Pi(r,i),Ui(i),u&512&&(Kt||l===null||Pn(l,l.return)),l!==null&&u&4&&nf(i,i.memoizedProps,l.memoizedProps);break;case 5:if(Pi(r,i),Ui(i),u&512&&(Kt||l===null||Pn(l,l.return)),i.flags&32){p=i.stateNode;try{qs(p,"")}catch(Se){ht(i,i.return,Se)}}u&4&&i.stateNode!=null&&(p=i.memoizedProps,nf(i,p,l!==null?l.memoizedProps:p)),u&1024&&(lf=!0);break;case 6:if(Pi(r,i),Ui(i),u&4){if(i.stateNode===null)throw Error(s(162));u=i.memoizedProps,l=i.stateNode;try{l.nodeValue=u}catch(Se){ht(i,i.return,Se)}}break;case 3:if(Dc=null,p=Mn,Mn=Tc(r.containerInfo),Pi(r,i),Mn=p,Ui(i),u&4&&l!==null&&l.memoizedState.isDehydrated)try{xl(r.containerInfo)}catch(Se){ht(i,i.return,Se)}lf&&(lf=!1,$_(i));break;case 4:u=Mn,Mn=Tc(i.stateNode.containerInfo),Pi(r,i),Ui(i),Mn=u;break;case 12:Pi(r,i),Ui(i);break;case 31:Pi(r,i),Ui(i),u&4&&(u=i.updateQueue,u!==null&&(i.updateQueue=null,pc(i,u)));break;case 13:Pi(r,i),Ui(i),i.child.flags&8192&&i.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(gc=St()),u&4&&(u=i.updateQueue,u!==null&&(i.updateQueue=null,pc(i,u)));break;case 22:p=i.memoizedState!==null;var O=l!==null&&l.memoizedState!==null,Q=fr,ae=Kt;if(fr=Q||p,Kt=ae||O,Pi(r,i),Kt=ae,fr=Q,Ui(i),u&8192)e:for(r=i.stateNode,r._visibility=p?r._visibility&-2:r._visibility|1,p&&(l===null||O||fr||Kt||ws(i)),l=null,r=i;;){if(r.tag===5||r.tag===26){if(l===null){O=l=r;try{if(m=O.stateNode,p)x=m.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{E=O.stateNode;var fe=O.memoizedProps.style,ee=fe!=null&&fe.hasOwnProperty("display")?fe.display:null;E.style.display=ee==null||typeof ee=="boolean"?"":(""+ee).trim()}}catch(Se){ht(O,O.return,Se)}}}else if(r.tag===6){if(l===null){O=r;try{O.stateNode.nodeValue=p?"":O.memoizedProps}catch(Se){ht(O,O.return,Se)}}}else if(r.tag===18){if(l===null){O=r;try{var ne=O.stateNode;p?L0(ne,!0):L0(O.stateNode,!1)}catch(Se){ht(O,O.return,Se)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===i)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===i)break e;for(;r.sibling===null;){if(r.return===null||r.return===i)break e;l===r&&(l=null),r=r.return}l===r&&(l=null),r.sibling.return=r.return,r=r.sibling}u&4&&(u=i.updateQueue,u!==null&&(l=u.retryQueue,l!==null&&(u.retryQueue=null,pc(i,l))));break;case 19:Pi(r,i),Ui(i),u&4&&(u=i.updateQueue,u!==null&&(i.updateQueue=null,pc(i,u)));break;case 30:break;case 21:break;default:Pi(r,i),Ui(i)}}function Ui(i){var r=i.flags;if(r&2){try{for(var l,u=i.return;u!==null;){if(B_(u)){l=u;break}u=u.return}if(l==null)throw Error(s(160));switch(l.tag){case 27:var p=l.stateNode,m=rf(i);dc(i,m,p);break;case 5:var x=l.stateNode;l.flags&32&&(qs(x,""),l.flags&=-33);var E=rf(i);dc(i,E,x);break;case 3:case 4:var O=l.stateNode.containerInfo,Q=rf(i);sf(i,Q,O);break;default:throw Error(s(161))}}catch(ae){ht(i,i.return,ae)}i.flags&=-3}r&4096&&(i.flags&=-4097)}function $_(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var r=i;$_(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),i=i.sibling}}function pr(i,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)I_(i,r.alternate,r),r=r.sibling}function ws(i){for(i=i.child;i!==null;){var r=i;switch(r.tag){case 0:case 11:case 14:case 15:Br(4,r,r.return),ws(r);break;case 1:Pn(r,r.return);var l=r.stateNode;typeof l.componentWillUnmount=="function"&&L_(r,r.return,l),ws(r);break;case 27:Na(r.stateNode);case 26:case 5:Pn(r,r.return),ws(r);break;case 22:r.memoizedState===null&&ws(r);break;case 30:ws(r);break;default:ws(r)}i=i.sibling}}function mr(i,r,l){for(l=l&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var u=r.alternate,p=i,m=r,x=m.flags;switch(m.tag){case 0:case 11:case 15:mr(p,m,l),ba(4,m);break;case 1:if(mr(p,m,l),u=m,p=u.stateNode,typeof p.componentDidMount=="function")try{p.componentDidMount()}catch(Q){ht(u,u.return,Q)}if(u=m,p=u.updateQueue,p!==null){var E=u.stateNode;try{var O=p.shared.hiddenCallbacks;if(O!==null)for(p.shared.hiddenCallbacks=null,p=0;p<O.length;p++)Sg(O[p],E)}catch(Q){ht(u,u.return,Q)}}l&&x&64&&z_(m),ya(m,m.return);break;case 27:j_(m);case 26:case 5:mr(p,m,l),l&&u===null&&x&4&&O_(m),ya(m,m.return);break;case 12:mr(p,m,l);break;case 31:mr(p,m,l),l&&x&4&&F_(p,m);break;case 13:mr(p,m,l),l&&x&4&&W_(p,m);break;case 22:m.memoizedState===null&&mr(p,m,l),ya(m,m.return);break;case 30:break;default:mr(p,m,l)}r=r.sibling}}function af(i,r){var l=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(l=i.memoizedState.cachePool.pool),i=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(i=r.memoizedState.cachePool.pool),i!==l&&(i!=null&&i.refCount++,l!=null&&la(l))}function of(i,r){i=null,r.alternate!==null&&(i=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==i&&(r.refCount++,i!=null&&la(i))}function zn(i,r,l,u){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)Y_(i,r,l,u),r=r.sibling}function Y_(i,r,l,u){var p=r.flags;switch(r.tag){case 0:case 11:case 15:zn(i,r,l,u),p&2048&&ba(9,r);break;case 1:zn(i,r,l,u);break;case 3:zn(i,r,l,u),p&2048&&(i=null,r.alternate!==null&&(i=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==i&&(r.refCount++,i!=null&&la(i)));break;case 12:if(p&2048){zn(i,r,l,u),i=r.stateNode;try{var m=r.memoizedProps,x=m.id,E=m.onPostCommit;typeof E=="function"&&E(x,r.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(O){ht(r,r.return,O)}}else zn(i,r,l,u);break;case 31:zn(i,r,l,u);break;case 13:zn(i,r,l,u);break;case 23:break;case 22:m=r.stateNode,x=r.alternate,r.memoizedState!==null?m._visibility&2?zn(i,r,l,u):xa(i,r):m._visibility&2?zn(i,r,l,u):(m._visibility|=2,ul(i,r,l,u,(r.subtreeFlags&10256)!==0||!1)),p&2048&&af(x,r);break;case 24:zn(i,r,l,u),p&2048&&of(r.alternate,r);break;default:zn(i,r,l,u)}}function ul(i,r,l,u,p){for(p=p&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var m=i,x=r,E=l,O=u,Q=x.flags;switch(x.tag){case 0:case 11:case 15:ul(m,x,E,O,p),ba(8,x);break;case 23:break;case 22:var ae=x.stateNode;x.memoizedState!==null?ae._visibility&2?ul(m,x,E,O,p):xa(m,x):(ae._visibility|=2,ul(m,x,E,O,p)),p&&Q&2048&&af(x.alternate,x);break;case 24:ul(m,x,E,O,p),p&&Q&2048&&of(x.alternate,x);break;default:ul(m,x,E,O,p)}r=r.sibling}}function xa(i,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var l=i,u=r,p=u.flags;switch(u.tag){case 22:xa(l,u),p&2048&&af(u.alternate,u);break;case 24:xa(l,u),p&2048&&of(u.alternate,u);break;default:xa(l,u)}r=r.sibling}}var Sa=8192;function hl(i,r,l){if(i.subtreeFlags&Sa)for(i=i.child;i!==null;)V_(i,r,l),i=i.sibling}function V_(i,r,l){switch(i.tag){case 26:hl(i,r,l),i.flags&Sa&&i.memoizedState!==null&&uC(l,Mn,i.memoizedState,i.memoizedProps);break;case 5:hl(i,r,l);break;case 3:case 4:var u=Mn;Mn=Tc(i.stateNode.containerInfo),hl(i,r,l),Mn=u;break;case 22:i.memoizedState===null&&(u=i.alternate,u!==null&&u.memoizedState!==null?(u=Sa,Sa=16777216,hl(i,r,l),Sa=u):hl(i,r,l));break;default:hl(i,r,l)}}function G_(i){var r=i.alternate;if(r!==null&&(i=r.child,i!==null)){r.child=null;do r=i.sibling,i.sibling=null,i=r;while(i!==null)}}function wa(i){var r=i.deletions;if((i.flags&16)!==0){if(r!==null)for(var l=0;l<r.length;l++){var u=r[l];si=u,X_(u,i)}G_(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)K_(i),i=i.sibling}function K_(i){switch(i.tag){case 0:case 11:case 15:wa(i),i.flags&2048&&Br(9,i,i.return);break;case 3:wa(i);break;case 12:wa(i);break;case 22:var r=i.stateNode;i.memoizedState!==null&&r._visibility&2&&(i.return===null||i.return.tag!==13)?(r._visibility&=-3,mc(i)):wa(i);break;default:wa(i)}}function mc(i){var r=i.deletions;if((i.flags&16)!==0){if(r!==null)for(var l=0;l<r.length;l++){var u=r[l];si=u,X_(u,i)}G_(i)}for(i=i.child;i!==null;){switch(r=i,r.tag){case 0:case 11:case 15:Br(8,r,r.return),mc(r);break;case 22:l=r.stateNode,l._visibility&2&&(l._visibility&=-3,mc(r));break;default:mc(r)}i=i.sibling}}function X_(i,r){for(;si!==null;){var l=si;switch(l.tag){case 0:case 11:case 15:Br(8,l,r);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var u=l.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:la(l.memoizedState.cache)}if(u=l.child,u!==null)u.return=l,si=u;else e:for(l=i;si!==null;){u=si;var p=u.sibling,m=u.return;if(P_(u),u===l){si=null;break e}if(p!==null){p.return=m,si=p;break e}si=m}}}var kw={getCacheForType:function(i){var r=gi(Yt),l=r.data.get(i);return l===void 0&&(l=i(),r.data.set(i,l)),l},cacheSignal:function(){return gi(Yt).controller.signal}},Ew=typeof WeakMap=="function"?WeakMap:Map,at=0,_t=null,Ge=null,Ze=0,ut=0,Ji=null,jr=!1,fl=!1,cf=!1,gr=0,jt=0,Hr=0,Cs=0,uf=0,en=0,dl=0,Ca=null,Fi=null,hf=!1,gc=0,Z_=0,_c=1/0,vc=null,Ir=null,ei=0,Pr=null,pl=null,_r=0,ff=0,df=null,Q_=null,ka=0,pf=null;function tn(){return(at&2)!==0&&Ze!==0?Ze&-Ze:C.T!==null?yf():$l()}function J_(){if(en===0)if((Ze&536870912)===0||et){var i=Qn;Qn<<=1,(Qn&3932160)===0&&(Qn=262144),en=i}else en=536870912;return i=Zi.current,i!==null&&(i.flags|=32),en}function Wi(i,r,l){(i===_t&&(ut===2||ut===9)||i.cancelPendingCommit!==null)&&(ml(i,0),Ur(i,Ze,en,!1)),kr(i,l),((at&2)===0||i!==_t)&&(i===_t&&((at&2)===0&&(Cs|=l),jt===4&&Ur(i,Ze,en,!1)),Un(i))}function e0(i,r,l){if((at&6)!==0)throw Error(s(327));var u=!l&&(r&127)===0&&(r&i.expiredLanes)===0||os(i,r),p=u?Nw(i,r):gf(i,r,!0),m=u;do{if(p===0){fl&&!u&&Ur(i,r,0,!1);break}else{if(l=i.current.alternate,m&&!Aw(l)){p=gf(i,r,!1),m=!1;continue}if(p===2){if(m=r,i.errorRecoveryDisabledLanes&m)var x=0;else x=i.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){r=x;e:{var E=i;p=Ca;var O=E.current.memoizedState.isDehydrated;if(O&&(ml(E,x).flags|=256),x=gf(E,x,!1),x!==2){if(cf&&!O){E.errorRecoveryDisabledLanes|=m,Cs|=m,p=4;break e}m=Fi,Fi=p,m!==null&&(Fi===null?Fi=m:Fi.push.apply(Fi,m))}p=x}if(m=!1,p!==2)continue}}if(p===1){ml(i,0),Ur(i,r,0,!0);break}e:{switch(u=i,m=p,m){case 0:case 1:throw Error(s(345));case 4:if((r&4194048)!==r)break;case 6:Ur(u,r,en,!jr);break e;case 2:Fi=null;break;case 3:case 5:break;default:throw Error(s(329))}if((r&62914560)===r&&(p=gc+300-St(),10<p)){if(Ur(u,r,en,!jr),Us(u,0,!0)!==0)break e;_r=r,u.timeoutHandle=R0(t0.bind(null,u,l,Fi,vc,hf,r,en,Cs,dl,jr,m,"Throttled",-0,0),p);break e}t0(u,l,Fi,vc,hf,r,en,Cs,dl,jr,m,null,-0,0)}}break}while(!0);Un(i)}function t0(i,r,l,u,p,m,x,E,O,Q,ae,fe,ee,ne){if(i.timeoutHandle=-1,fe=r.subtreeFlags,fe&8192||(fe&16785408)===16785408){fe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ir},V_(r,m,fe);var Se=(m&62914560)===m?gc-St():(m&4194048)===m?Z_-St():0;if(Se=hC(fe,Se),Se!==null){_r=m,i.cancelPendingCommit=Se(c0.bind(null,i,r,m,l,u,p,x,E,O,ae,fe,null,ee,ne)),Ur(i,m,x,!Q);return}}c0(i,r,m,l,u,p,x,E,O)}function Aw(i){for(var r=i;;){var l=r.tag;if((l===0||l===11||l===15)&&r.flags&16384&&(l=r.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var u=0;u<l.length;u++){var p=l[u],m=p.getSnapshot;p=p.value;try{if(!Ki(m(),p))return!1}catch{return!1}}if(l=r.child,r.subtreeFlags&16384&&l!==null)l.return=r,r=l;else{if(r===i)break;for(;r.sibling===null;){if(r.return===null||r.return===i)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function Ur(i,r,l,u){r&=~uf,r&=~Cs,i.suspendedLanes|=r,i.pingedLanes&=~r,u&&(i.warmLanes|=r),u=i.expirationTimes;for(var p=r;0<p;){var m=31-tt(p),x=1<<m;u[m]=-1,p&=~x}l!==0&&Wl(i,l,r)}function bc(){return(at&6)===0?(Ea(0),!1):!0}function mf(){if(Ge!==null){if(ut===0)var i=Ge.return;else i=Ge,lr=ms=null,Dh(i),sl=null,oa=0,i=Ge;for(;i!==null;)M_(i.alternate,i),i=i.return;Ge=null}}function ml(i,r){var l=i.timeoutHandle;l!==-1&&(i.timeoutHandle=-1,Vw(l)),l=i.cancelPendingCommit,l!==null&&(i.cancelPendingCommit=null,l()),_r=0,mf(),_t=i,Ge=l=rr(i.current,null),Ze=r,ut=0,Ji=null,jr=!1,fl=os(i,r),cf=!1,dl=en=uf=Cs=Hr=jt=0,Fi=Ca=null,hf=!1,(r&8)!==0&&(r|=r&32);var u=i.entangledLanes;if(u!==0)for(i=i.entanglements,u&=r;0<u;){var p=31-tt(u),m=1<<p;r|=i[p],u&=~m}return gr=r,Po(),l}function i0(i,r){Pe=null,C.H=ga,r===rl||r===Go?(r=vg(),ut=3):r===vh?(r=vg(),ut=4):ut=r===Yh?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,Ji=r,Ge===null&&(jt=1,oc(i,gn(r,i.current)))}function n0(){var i=Zi.current;return i===null?!0:(Ze&4194048)===Ze?yn===null:(Ze&62914560)===Ze||(Ze&536870912)!==0?i===yn:!1}function r0(){var i=C.H;return C.H=ga,i===null?ga:i}function s0(){var i=C.A;return C.A=kw,i}function yc(){jt=4,jr||(Ze&4194048)!==Ze&&Zi.current!==null||(fl=!0),(Hr&134217727)===0&&(Cs&134217727)===0||_t===null||Ur(_t,Ze,en,!1)}function gf(i,r,l){var u=at;at|=2;var p=r0(),m=s0();(_t!==i||Ze!==r)&&(vc=null,ml(i,r)),r=!1;var x=jt;e:do try{if(ut!==0&&Ge!==null){var E=Ge,O=Ji;switch(ut){case 8:mf(),x=6;break e;case 3:case 2:case 9:case 6:Zi.current===null&&(r=!0);var Q=ut;if(ut=0,Ji=null,gl(i,E,O,Q),l&&fl){x=0;break e}break;default:Q=ut,ut=0,Ji=null,gl(i,E,O,Q)}}Tw(),x=jt;break}catch(ae){i0(i,ae)}while(!0);return r&&i.shellSuspendCounter++,lr=ms=null,at=u,C.H=p,C.A=m,Ge===null&&(_t=null,Ze=0,Po()),x}function Tw(){for(;Ge!==null;)l0(Ge)}function Nw(i,r){var l=at;at|=2;var u=r0(),p=s0();_t!==i||Ze!==r?(vc=null,_c=St()+500,ml(i,r)):fl=os(i,r);e:do try{if(ut!==0&&Ge!==null){r=Ge;var m=Ji;t:switch(ut){case 1:ut=0,Ji=null,gl(i,r,m,1);break;case 2:case 9:if(gg(m)){ut=0,Ji=null,a0(r);break}r=function(){ut!==2&&ut!==9||_t!==i||(ut=7),Un(i)},m.then(r,r);break e;case 3:ut=7;break e;case 4:ut=5;break e;case 7:gg(m)?(ut=0,Ji=null,a0(r)):(ut=0,Ji=null,gl(i,r,m,7));break;case 5:var x=null;switch(Ge.tag){case 26:x=Ge.memoizedState;case 5:case 27:var E=Ge;if(x?Y0(x):E.stateNode.complete){ut=0,Ji=null;var O=E.sibling;if(O!==null)Ge=O;else{var Q=E.return;Q!==null?(Ge=Q,xc(Q)):Ge=null}break t}}ut=0,Ji=null,gl(i,r,m,5);break;case 6:ut=0,Ji=null,gl(i,r,m,6);break;case 8:mf(),jt=6;break e;default:throw Error(s(462))}}Dw();break}catch(ae){i0(i,ae)}while(!0);return lr=ms=null,C.H=u,C.A=p,at=l,Ge!==null?0:(_t=null,Ze=0,Po(),jt)}function Dw(){for(;Ge!==null&&!on();)l0(Ge)}function l0(i){var r=D_(i.alternate,i,gr);i.memoizedProps=i.pendingProps,r===null?xc(i):Ge=r}function a0(i){var r=i,l=r.alternate;switch(r.tag){case 15:case 0:r=C_(l,r,r.pendingProps,r.type,void 0,Ze);break;case 11:r=C_(l,r,r.pendingProps,r.type.render,r.ref,Ze);break;case 5:Dh(r);default:M_(l,r),r=Ge=sg(r,gr),r=D_(l,r,gr)}i.memoizedProps=i.pendingProps,r===null?xc(i):Ge=r}function gl(i,r,l,u){lr=ms=null,Dh(r),sl=null,oa=0;var p=r.return;try{if(vw(i,p,r,l,Ze)){jt=1,oc(i,gn(l,i.current)),Ge=null;return}}catch(m){if(p!==null)throw Ge=p,m;jt=1,oc(i,gn(l,i.current)),Ge=null;return}r.flags&32768?(et||u===1?i=!0:fl||(Ze&536870912)!==0?i=!1:(jr=i=!0,(u===2||u===9||u===3||u===6)&&(u=Zi.current,u!==null&&u.tag===13&&(u.flags|=16384))),o0(r,i)):xc(r)}function xc(i){var r=i;do{if((r.flags&32768)!==0){o0(r,jr);return}i=r.return;var l=xw(r.alternate,r,gr);if(l!==null){Ge=l;return}if(r=r.sibling,r!==null){Ge=r;return}Ge=r=i}while(r!==null);jt===0&&(jt=5)}function o0(i,r){do{var l=Sw(i.alternate,i);if(l!==null){l.flags&=32767,Ge=l;return}if(l=i.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!r&&(i=i.sibling,i!==null)){Ge=i;return}Ge=i=l}while(i!==null);jt=6,Ge=null}function c0(i,r,l,u,p,m,x,E,O){i.cancelPendingCommit=null;do Sc();while(ei!==0);if((at&6)!==0)throw Error(s(327));if(r!==null){if(r===i.current)throw Error(s(177));if(m=r.lanes|r.childLanes,m|=nh,Fl(i,l,m,x,E,O),i===_t&&(Ge=_t=null,Ze=0),pl=r,Pr=i,_r=l,ff=m,df=p,Q_=u,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,Lw(ye,function(){return p0(),null})):(i.callbackNode=null,i.callbackPriority=0),u=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||u){u=C.T,C.T=null,p=B.p,B.p=2,x=at,at|=4;try{ww(i,r,l)}finally{at=x,B.p=p,C.T=u}}ei=1,u0(),h0(),f0()}}function u0(){if(ei===1){ei=0;var i=Pr,r=pl,l=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||l){l=C.T,C.T=null;var u=B.p;B.p=2;var p=at;at|=4;try{q_(r,i);var m=Tf,x=Xm(i.containerInfo),E=m.focusedElem,O=m.selectionRange;if(x!==E&&E&&E.ownerDocument&&Km(E.ownerDocument.documentElement,E)){if(O!==null&&Qu(E)){var Q=O.start,ae=O.end;if(ae===void 0&&(ae=Q),"selectionStart"in E)E.selectionStart=Q,E.selectionEnd=Math.min(ae,E.value.length);else{var fe=E.ownerDocument||document,ee=fe&&fe.defaultView||window;if(ee.getSelection){var ne=ee.getSelection(),Se=E.textContent.length,Le=Math.min(O.start,Se),pt=O.end===void 0?Le:Math.min(O.end,Se);!ne.extend&&Le>pt&&(x=pt,pt=Le,Le=x);var Y=Gm(E,Le),F=Gm(E,pt);if(Y&&F&&(ne.rangeCount!==1||ne.anchorNode!==Y.node||ne.anchorOffset!==Y.offset||ne.focusNode!==F.node||ne.focusOffset!==F.offset)){var Z=fe.createRange();Z.setStart(Y.node,Y.offset),ne.removeAllRanges(),Le>pt?(ne.addRange(Z),ne.extend(F.node,F.offset)):(Z.setEnd(F.node,F.offset),ne.addRange(Z))}}}}for(fe=[],ne=E;ne=ne.parentNode;)ne.nodeType===1&&fe.push({element:ne,left:ne.scrollLeft,top:ne.scrollTop});for(typeof E.focus=="function"&&E.focus(),E=0;E<fe.length;E++){var he=fe[E];he.element.scrollLeft=he.left,he.element.scrollTop=he.top}}Lc=!!Af,Tf=Af=null}finally{at=p,B.p=u,C.T=l}}i.current=r,ei=2}}function h0(){if(ei===2){ei=0;var i=Pr,r=pl,l=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||l){l=C.T,C.T=null;var u=B.p;B.p=2;var p=at;at|=4;try{I_(i,r.alternate,r)}finally{at=p,B.p=u,C.T=l}}ei=3}}function f0(){if(ei===4||ei===3){ei=0,Bn();var i=Pr,r=pl,l=_r,u=Q_;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?ei=5:(ei=0,pl=Pr=null,d0(i,i.pendingLanes));var p=i.pendingLanes;if(p===0&&(Ir=null),Dn(l),r=r.stateNode,Et&&typeof Et.onCommitFiberRoot=="function")try{Et.onCommitFiberRoot(qt,r,void 0,(r.current.flags&128)===128)}catch{}if(u!==null){r=C.T,p=B.p,B.p=2,C.T=null;try{for(var m=i.onRecoverableError,x=0;x<u.length;x++){var E=u[x];m(E.value,{componentStack:E.stack})}}finally{C.T=r,B.p=p}}(_r&3)!==0&&Sc(),Un(i),p=i.pendingLanes,(l&261930)!==0&&(p&42)!==0?i===pf?ka++:(ka=0,pf=i):ka=0,Ea(0)}}function d0(i,r){(i.pooledCacheLanes&=r)===0&&(r=i.pooledCache,r!=null&&(i.pooledCache=null,la(r)))}function Sc(){return u0(),h0(),f0(),p0()}function p0(){if(ei!==5)return!1;var i=Pr,r=ff;ff=0;var l=Dn(_r),u=C.T,p=B.p;try{B.p=32>l?32:l,C.T=null,l=df,df=null;var m=Pr,x=_r;if(ei=0,pl=Pr=null,_r=0,(at&6)!==0)throw Error(s(331));var E=at;if(at|=4,K_(m.current),Y_(m,m.current,x,l),at=E,Ea(0,!1),Et&&typeof Et.onPostCommitFiberRoot=="function")try{Et.onPostCommitFiberRoot(qt,m)}catch{}return!0}finally{B.p=p,C.T=u,d0(i,r)}}function m0(i,r,l){r=gn(l,r),r=$h(i.stateNode,r,2),i=zr(i,r,2),i!==null&&(kr(i,2),Un(i))}function ht(i,r,l){if(i.tag===3)m0(i,i,l);else for(;r!==null;){if(r.tag===3){m0(r,i,l);break}else if(r.tag===1){var u=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(Ir===null||!Ir.has(u))){i=gn(l,i),l=g_(2),u=zr(r,l,2),u!==null&&(__(l,u,r,i),kr(u,2),Un(u));break}}r=r.return}}function _f(i,r,l){var u=i.pingCache;if(u===null){u=i.pingCache=new Ew;var p=new Set;u.set(r,p)}else p=u.get(r),p===void 0&&(p=new Set,u.set(r,p));p.has(l)||(cf=!0,p.add(l),i=Rw.bind(null,i,r,l),r.then(i,i))}function Rw(i,r,l){var u=i.pingCache;u!==null&&u.delete(r),i.pingedLanes|=i.suspendedLanes&l,i.warmLanes&=~l,_t===i&&(Ze&l)===l&&(jt===4||jt===3&&(Ze&62914560)===Ze&&300>St()-gc?(at&2)===0&&ml(i,0):uf|=l,dl===Ze&&(dl=0)),Un(i)}function g0(i,r){r===0&&(r=Jn()),i=fs(i,r),i!==null&&(kr(i,r),Un(i))}function Mw(i){var r=i.memoizedState,l=0;r!==null&&(l=r.retryLane),g0(i,l)}function zw(i,r){var l=0;switch(i.tag){case 31:case 13:var u=i.stateNode,p=i.memoizedState;p!==null&&(l=p.retryLane);break;case 19:u=i.stateNode;break;case 22:u=i.stateNode._retryCache;break;default:throw Error(s(314))}u!==null&&u.delete(r),g0(i,l)}function Lw(i,r){return Ot(i,r)}var wc=null,_l=null,vf=!1,Cc=!1,bf=!1,Fr=0;function Un(i){i!==_l&&i.next===null&&(_l===null?wc=_l=i:_l=_l.next=i),Cc=!0,vf||(vf=!0,Bw())}function Ea(i,r){if(!bf&&Cc){bf=!0;do for(var l=!1,u=wc;u!==null;){if(i!==0){var p=u.pendingLanes;if(p===0)var m=0;else{var x=u.suspendedLanes,E=u.pingedLanes;m=(1<<31-tt(42|i)+1)-1,m&=p&~(x&~E),m=m&201326741?m&201326741|1:m?m|2:0}m!==0&&(l=!0,y0(u,m))}else m=Ze,m=Us(u,u===_t?m:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(m&3)===0||os(u,m)||(l=!0,y0(u,m));u=u.next}while(l);bf=!1}}function Ow(){_0()}function _0(){Cc=vf=!1;var i=0;Fr!==0&&Yw()&&(i=Fr);for(var r=St(),l=null,u=wc;u!==null;){var p=u.next,m=v0(u,r);m===0?(u.next=null,l===null?wc=p:l.next=p,p===null&&(_l=l)):(l=u,(i!==0||(m&3)!==0)&&(Cc=!0)),u=p}ei!==0&&ei!==5||Ea(i),Fr!==0&&(Fr=0)}function v0(i,r){for(var l=i.suspendedLanes,u=i.pingedLanes,p=i.expirationTimes,m=i.pendingLanes&-62914561;0<m;){var x=31-tt(m),E=1<<x,O=p[x];O===-1?((E&l)===0||(E&u)!==0)&&(p[x]=Pt(E,r)):O<=r&&(i.expiredLanes|=E),m&=~E}if(r=_t,l=Ze,l=Us(i,i===r?l:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),u=i.callbackNode,l===0||i===r&&(ut===2||ut===9)||i.cancelPendingCommit!==null)return u!==null&&u!==null&&Vi(u),i.callbackNode=null,i.callbackPriority=0;if((l&3)===0||os(i,l)){if(r=l&-l,r===i.callbackPriority)return r;switch(u!==null&&Vi(u),Dn(l)){case 2:case 8:l=re;break;case 32:l=ye;break;case 268435456:l=rt;break;default:l=ye}return u=b0.bind(null,i),l=Ot(l,u),i.callbackPriority=r,i.callbackNode=l,r}return u!==null&&u!==null&&Vi(u),i.callbackPriority=2,i.callbackNode=null,2}function b0(i,r){if(ei!==0&&ei!==5)return i.callbackNode=null,i.callbackPriority=0,null;var l=i.callbackNode;if(Sc()&&i.callbackNode!==l)return null;var u=Ze;return u=Us(i,i===_t?u:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),u===0?null:(e0(i,u,r),v0(i,St()),i.callbackNode!=null&&i.callbackNode===l?b0.bind(null,i):null)}function y0(i,r){if(Sc())return null;e0(i,r,!0)}function Bw(){Gw(function(){(at&6)!==0?Ot(M,Ow):_0()})}function yf(){if(Fr===0){var i=il;i===0&&(i=Zn,Zn<<=1,(Zn&261888)===0&&(Zn=256)),Fr=i}return Fr}function x0(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:Mo(""+i)}function S0(i,r){var l=r.ownerDocument.createElement("input");return l.name=r.name,l.value=r.value,i.id&&l.setAttribute("form",i.id),r.parentNode.insertBefore(l,r),i=new FormData(i),l.parentNode.removeChild(l),i}function jw(i,r,l,u,p){if(r==="submit"&&l&&l.stateNode===p){var m=x0((p[Tt]||null).action),x=u.submitter;x&&(r=(r=x[Tt]||null)?x0(r.formAction):x.getAttribute("formAction"),r!==null&&(m=r,x=null));var E=new Bo("action","action",null,u,p);i.push({event:E,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(Fr!==0){var O=x?S0(p,x):new FormData(p);Ih(l,{pending:!0,data:O,method:p.method,action:m},null,O)}}else typeof m=="function"&&(E.preventDefault(),O=x?S0(p,x):new FormData(p),Ih(l,{pending:!0,data:O,method:p.method,action:m},m,O))},currentTarget:p}]})}}for(var xf=0;xf<ih.length;xf++){var Sf=ih[xf],Hw=Sf.toLowerCase(),Iw=Sf[0].toUpperCase()+Sf.slice(1);Rn(Hw,"on"+Iw)}Rn(Jm,"onAnimationEnd"),Rn(eg,"onAnimationIteration"),Rn(tg,"onAnimationStart"),Rn("dblclick","onDoubleClick"),Rn("focusin","onFocus"),Rn("focusout","onBlur"),Rn(tw,"onTransitionRun"),Rn(iw,"onTransitionStart"),Rn(nw,"onTransitionCancel"),Rn(ig,"onTransitionEnd"),jn("onMouseEnter",["mouseout","mouseover"]),jn("onMouseLeave",["mouseout","mouseover"]),jn("onPointerEnter",["pointerout","pointerover"]),jn("onPointerLeave",["pointerout","pointerover"]),ji("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ji("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ji("onBeforeInput",["compositionend","keypress","textInput","paste"]),ji("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ji("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ji("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Aa="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(" "),Pw=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Aa));function w0(i,r){r=(r&4)!==0;for(var l=0;l<i.length;l++){var u=i[l],p=u.event;u=u.listeners;e:{var m=void 0;if(r)for(var x=u.length-1;0<=x;x--){var E=u[x],O=E.instance,Q=E.currentTarget;if(E=E.listener,O!==m&&p.isPropagationStopped())break e;m=E,p.currentTarget=Q;try{m(p)}catch(ae){Io(ae)}p.currentTarget=null,m=O}else for(x=0;x<u.length;x++){if(E=u[x],O=E.instance,Q=E.currentTarget,E=E.listener,O!==m&&p.isPropagationStopped())break e;m=E,p.currentTarget=Q;try{m(p)}catch(ae){Io(ae)}p.currentTarget=null,m=O}}}}function Ke(i,r){var l=r[Fs];l===void 0&&(l=r[Fs]=new Set);var u=i+"__bubble";l.has(u)||(C0(r,i,2,!1),l.add(u))}function wf(i,r,l){var u=0;r&&(u|=4),C0(l,i,u,r)}var kc="_reactListening"+Math.random().toString(36).slice(2);function Cf(i){if(!i[kc]){i[kc]=!0,pi.forEach(function(l){l!=="selectionchange"&&(Pw.has(l)||wf(l,!1,i),wf(l,!0,i))});var r=i.nodeType===9?i:i.ownerDocument;r===null||r[kc]||(r[kc]=!0,wf("selectionchange",!1,r))}}function C0(i,r,l,u){switch(J0(r)){case 2:var p=pC;break;case 8:p=mC;break;default:p=If}l=p.bind(null,r,l,i),p=void 0,!Wu||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(p=!0),u?p!==void 0?i.addEventListener(r,l,{capture:!0,passive:p}):i.addEventListener(r,l,!0):p!==void 0?i.addEventListener(r,l,{passive:p}):i.addEventListener(r,l,!1)}function kf(i,r,l,u,p){var m=u;if((r&1)===0&&(r&2)===0&&u!==null)e:for(;;){if(u===null)return;var x=u.tag;if(x===3||x===4){var E=u.stateNode.containerInfo;if(E===p)break;if(x===4)for(x=u.return;x!==null;){var O=x.tag;if((O===3||O===4)&&x.stateNode.containerInfo===p)return;x=x.return}for(;E!==null;){if(x=me(E),x===null)return;if(O=x.tag,O===5||O===6||O===26||O===27){u=m=x;continue e}E=E.parentNode}}u=u.return}Nm(function(){var Q=m,ae=Uu(l),fe=[];e:{var ee=ng.get(i);if(ee!==void 0){var ne=Bo,Se=i;switch(i){case"keypress":if(Lo(l)===0)break e;case"keydown":case"keyup":ne=z1;break;case"focusin":Se="focus",ne=Vu;break;case"focusout":Se="blur",ne=Vu;break;case"beforeblur":case"afterblur":ne=Vu;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":ne=Mm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ne=x1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ne=B1;break;case Jm:case eg:case tg:ne=C1;break;case ig:ne=H1;break;case"scroll":case"scrollend":ne=b1;break;case"wheel":ne=P1;break;case"copy":case"cut":case"paste":ne=E1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ne=Lm;break;case"toggle":case"beforetoggle":ne=F1}var Le=(r&4)!==0,pt=!Le&&(i==="scroll"||i==="scrollend"),Y=Le?ee!==null?ee+"Capture":null:ee;Le=[];for(var F=Q,Z;F!==null;){var he=F;if(Z=he.stateNode,he=he.tag,he!==5&&he!==26&&he!==27||Z===null||Y===null||(he=Kl(F,Y),he!=null&&Le.push(Ta(F,he,Z))),pt)break;F=F.return}0<Le.length&&(ee=new ne(ee,Se,null,l,ae),fe.push({event:ee,listeners:Le}))}}if((r&7)===0){e:{if(ee=i==="mouseover"||i==="pointerover",ne=i==="mouseout"||i==="pointerout",ee&&l!==Pu&&(Se=l.relatedTarget||l.fromElement)&&(me(Se)||Se[er]))break e;if((ne||ee)&&(ee=ae.window===ae?ae:(ee=ae.ownerDocument)?ee.defaultView||ee.parentWindow:window,ne?(Se=l.relatedTarget||l.toElement,ne=Q,Se=Se?me(Se):null,Se!==null&&(pt=o(Se),Le=Se.tag,Se!==pt||Le!==5&&Le!==27&&Le!==6)&&(Se=null)):(ne=null,Se=Q),ne!==Se)){if(Le=Mm,he="onMouseLeave",Y="onMouseEnter",F="mouse",(i==="pointerout"||i==="pointerover")&&(Le=Lm,he="onPointerLeave",Y="onPointerEnter",F="pointer"),pt=ne==null?ee:ct(ne),Z=Se==null?ee:ct(Se),ee=new Le(he,F+"leave",ne,l,ae),ee.target=pt,ee.relatedTarget=Z,he=null,me(ae)===Q&&(Le=new Le(Y,F+"enter",Se,l,ae),Le.target=Z,Le.relatedTarget=pt,he=Le),pt=he,ne&&Se)t:{for(Le=Uw,Y=ne,F=Se,Z=0,he=Y;he;he=Le(he))Z++;he=0;for(var Re=F;Re;Re=Le(Re))he++;for(;0<Z-he;)Y=Le(Y),Z--;for(;0<he-Z;)F=Le(F),he--;for(;Z--;){if(Y===F||F!==null&&Y===F.alternate){Le=Y;break t}Y=Le(Y),F=Le(F)}Le=null}else Le=null;ne!==null&&k0(fe,ee,ne,Le,!1),Se!==null&&pt!==null&&k0(fe,pt,Se,Le,!0)}}e:{if(ee=Q?ct(Q):window,ne=ee.nodeName&&ee.nodeName.toLowerCase(),ne==="select"||ne==="input"&&ee.type==="file")var st=Fm;else if(Pm(ee))if(Wm)st=Q1;else{st=X1;var Te=K1}else ne=ee.nodeName,!ne||ne.toLowerCase()!=="input"||ee.type!=="checkbox"&&ee.type!=="radio"?Q&&Iu(Q.elementType)&&(st=Fm):st=Z1;if(st&&(st=st(i,Q))){Um(fe,st,l,ae);break e}Te&&Te(i,ee,Q),i==="focusout"&&Q&&ee.type==="number"&&Q.memoizedProps.value!=null&&Hu(ee,"number",ee.value)}switch(Te=Q?ct(Q):window,i){case"focusin":(Pm(Te)||Te.contentEditable==="true")&&(Gs=Te,Ju=Q,na=null);break;case"focusout":na=Ju=Gs=null;break;case"mousedown":eh=!0;break;case"contextmenu":case"mouseup":case"dragend":eh=!1,Zm(fe,l,ae);break;case"selectionchange":if(ew)break;case"keydown":case"keyup":Zm(fe,l,ae)}var Ue;if(Ku)e:{switch(i){case"compositionstart":var Qe="onCompositionStart";break e;case"compositionend":Qe="onCompositionEnd";break e;case"compositionupdate":Qe="onCompositionUpdate";break e}Qe=void 0}else Vs?Hm(i,l)&&(Qe="onCompositionEnd"):i==="keydown"&&l.keyCode===229&&(Qe="onCompositionStart");Qe&&(Om&&l.locale!=="ko"&&(Vs||Qe!=="onCompositionStart"?Qe==="onCompositionEnd"&&Vs&&(Ue=Dm()):(Er=ae,qu="value"in Er?Er.value:Er.textContent,Vs=!0)),Te=Ec(Q,Qe),0<Te.length&&(Qe=new zm(Qe,i,null,l,ae),fe.push({event:Qe,listeners:Te}),Ue?Qe.data=Ue:(Ue=Im(l),Ue!==null&&(Qe.data=Ue)))),(Ue=q1?$1(i,l):Y1(i,l))&&(Qe=Ec(Q,"onBeforeInput"),0<Qe.length&&(Te=new zm("onBeforeInput","beforeinput",null,l,ae),fe.push({event:Te,listeners:Qe}),Te.data=Ue)),jw(fe,i,Q,l,ae)}w0(fe,r)})}function Ta(i,r,l){return{instance:i,listener:r,currentTarget:l}}function Ec(i,r){for(var l=r+"Capture",u=[];i!==null;){var p=i,m=p.stateNode;if(p=p.tag,p!==5&&p!==26&&p!==27||m===null||(p=Kl(i,l),p!=null&&u.unshift(Ta(i,p,m)),p=Kl(i,r),p!=null&&u.push(Ta(i,p,m))),i.tag===3)return u;i=i.return}return[]}function Uw(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function k0(i,r,l,u,p){for(var m=r._reactName,x=[];l!==null&&l!==u;){var E=l,O=E.alternate,Q=E.stateNode;if(E=E.tag,O!==null&&O===u)break;E!==5&&E!==26&&E!==27||Q===null||(O=Q,p?(Q=Kl(l,m),Q!=null&&x.unshift(Ta(l,Q,O))):p||(Q=Kl(l,m),Q!=null&&x.push(Ta(l,Q,O)))),l=l.return}x.length!==0&&i.push({event:r,listeners:x})}var Fw=/\r\n?/g,Ww=/\u0000|\uFFFD/g;function E0(i){return(typeof i=="string"?i:""+i).replace(Fw,`
`).replace(Ww,"")}function A0(i,r){return r=E0(r),E0(i)===r}function dt(i,r,l,u,p,m){switch(l){case"children":typeof u=="string"?r==="body"||r==="textarea"&&u===""||qs(i,u):(typeof u=="number"||typeof u=="bigint")&&r!=="body"&&qs(i,""+u);break;case"className":Do(i,"class",u);break;case"tabIndex":Do(i,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":Do(i,l,u);break;case"style":Am(i,u,m);break;case"data":if(r!=="object"){Do(i,"data",u);break}case"src":case"href":if(u===""&&(r!=="a"||l!=="href")){i.removeAttribute(l);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){i.removeAttribute(l);break}u=Mo(""+u),i.setAttribute(l,u);break;case"action":case"formAction":if(typeof u=="function"){i.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"?(r!=="input"&&dt(i,r,"name",p.name,p,null),dt(i,r,"formEncType",p.formEncType,p,null),dt(i,r,"formMethod",p.formMethod,p,null),dt(i,r,"formTarget",p.formTarget,p,null)):(dt(i,r,"encType",p.encType,p,null),dt(i,r,"method",p.method,p,null),dt(i,r,"target",p.target,p,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){i.removeAttribute(l);break}u=Mo(""+u),i.setAttribute(l,u);break;case"onClick":u!=null&&(i.onclick=ir);break;case"onScroll":u!=null&&Ke("scroll",i);break;case"onScrollEnd":u!=null&&Ke("scrollend",i);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(s(61));if(l=u.__html,l!=null){if(p.children!=null)throw Error(s(60));i.innerHTML=l}}break;case"multiple":i.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":i.muted=u&&typeof u!="function"&&typeof u!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(u==null||typeof u=="function"||typeof u=="boolean"||typeof u=="symbol"){i.removeAttribute("xlink:href");break}l=Mo(""+u),i.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":u!=null&&typeof u!="function"&&typeof u!="symbol"?i.setAttribute(l,""+u):i.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":u&&typeof u!="function"&&typeof u!="symbol"?i.setAttribute(l,""):i.removeAttribute(l);break;case"capture":case"download":u===!0?i.setAttribute(l,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?i.setAttribute(l,u):i.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?i.setAttribute(l,u):i.removeAttribute(l);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?i.removeAttribute(l):i.setAttribute(l,u);break;case"popover":Ke("beforetoggle",i),Ke("toggle",i),No(i,"popover",u);break;case"xlinkActuate":tr(i,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":tr(i,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":tr(i,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":tr(i,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":tr(i,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":tr(i,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":tr(i,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":tr(i,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":tr(i,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":No(i,"is",u);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=_1.get(l)||l,No(i,l,u))}}function Ef(i,r,l,u,p,m){switch(l){case"style":Am(i,u,m);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(s(61));if(l=u.__html,l!=null){if(p.children!=null)throw Error(s(60));i.innerHTML=l}}break;case"children":typeof u=="string"?qs(i,u):(typeof u=="number"||typeof u=="bigint")&&qs(i,""+u);break;case"onScroll":u!=null&&Ke("scroll",i);break;case"onScrollEnd":u!=null&&Ke("scrollend",i);break;case"onClick":u!=null&&(i.onclick=ir);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!fn.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(p=l.endsWith("Capture"),r=l.slice(2,p?l.length-7:void 0),m=i[Tt]||null,m=m!=null?m[l]:null,typeof m=="function"&&i.removeEventListener(r,m,p),typeof u=="function")){typeof m!="function"&&m!==null&&(l in i?i[l]=null:i.hasAttribute(l)&&i.removeAttribute(l)),i.addEventListener(r,u,p);break e}l in i?i[l]=u:u===!0?i.setAttribute(l,""):No(i,l,u)}}}function vi(i,r,l){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ke("error",i),Ke("load",i);var u=!1,p=!1,m;for(m in l)if(l.hasOwnProperty(m)){var x=l[m];if(x!=null)switch(m){case"src":u=!0;break;case"srcSet":p=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,r));default:dt(i,r,m,x,l,null)}}p&&dt(i,r,"srcSet",l.srcSet,l,null),u&&dt(i,r,"src",l.src,l,null);return;case"input":Ke("invalid",i);var E=m=x=p=null,O=null,Q=null;for(u in l)if(l.hasOwnProperty(u)){var ae=l[u];if(ae!=null)switch(u){case"name":p=ae;break;case"type":x=ae;break;case"checked":O=ae;break;case"defaultChecked":Q=ae;break;case"value":m=ae;break;case"defaultValue":E=ae;break;case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(s(137,r));break;default:dt(i,r,u,ae,l,null)}}wm(i,m,E,O,Q,x,p,!1);return;case"select":Ke("invalid",i),u=x=m=null;for(p in l)if(l.hasOwnProperty(p)&&(E=l[p],E!=null))switch(p){case"value":m=E;break;case"defaultValue":x=E;break;case"multiple":u=E;default:dt(i,r,p,E,l,null)}r=m,l=x,i.multiple=!!u,r!=null?Ws(i,!!u,r,!1):l!=null&&Ws(i,!!u,l,!0);return;case"textarea":Ke("invalid",i),m=p=u=null;for(x in l)if(l.hasOwnProperty(x)&&(E=l[x],E!=null))switch(x){case"value":u=E;break;case"defaultValue":p=E;break;case"children":m=E;break;case"dangerouslySetInnerHTML":if(E!=null)throw Error(s(91));break;default:dt(i,r,x,E,l,null)}km(i,u,p,m);return;case"option":for(O in l)if(l.hasOwnProperty(O)&&(u=l[O],u!=null))switch(O){case"selected":i.selected=u&&typeof u!="function"&&typeof u!="symbol";break;default:dt(i,r,O,u,l,null)}return;case"dialog":Ke("beforetoggle",i),Ke("toggle",i),Ke("cancel",i),Ke("close",i);break;case"iframe":case"object":Ke("load",i);break;case"video":case"audio":for(u=0;u<Aa.length;u++)Ke(Aa[u],i);break;case"image":Ke("error",i),Ke("load",i);break;case"details":Ke("toggle",i);break;case"embed":case"source":case"link":Ke("error",i),Ke("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Q in l)if(l.hasOwnProperty(Q)&&(u=l[Q],u!=null))switch(Q){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,r));default:dt(i,r,Q,u,l,null)}return;default:if(Iu(r)){for(ae in l)l.hasOwnProperty(ae)&&(u=l[ae],u!==void 0&&Ef(i,r,ae,u,l,void 0));return}}for(E in l)l.hasOwnProperty(E)&&(u=l[E],u!=null&&dt(i,r,E,u,l,null))}function qw(i,r,l,u){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var p=null,m=null,x=null,E=null,O=null,Q=null,ae=null;for(ne in l){var fe=l[ne];if(l.hasOwnProperty(ne)&&fe!=null)switch(ne){case"checked":break;case"value":break;case"defaultValue":O=fe;default:u.hasOwnProperty(ne)||dt(i,r,ne,null,u,fe)}}for(var ee in u){var ne=u[ee];if(fe=l[ee],u.hasOwnProperty(ee)&&(ne!=null||fe!=null))switch(ee){case"type":m=ne;break;case"name":p=ne;break;case"checked":Q=ne;break;case"defaultChecked":ae=ne;break;case"value":x=ne;break;case"defaultValue":E=ne;break;case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(s(137,r));break;default:ne!==fe&&dt(i,r,ee,ne,u,fe)}}ju(i,x,E,O,Q,ae,m,p);return;case"select":ne=x=E=ee=null;for(m in l)if(O=l[m],l.hasOwnProperty(m)&&O!=null)switch(m){case"value":break;case"multiple":ne=O;default:u.hasOwnProperty(m)||dt(i,r,m,null,u,O)}for(p in u)if(m=u[p],O=l[p],u.hasOwnProperty(p)&&(m!=null||O!=null))switch(p){case"value":ee=m;break;case"defaultValue":E=m;break;case"multiple":x=m;default:m!==O&&dt(i,r,p,m,u,O)}r=E,l=x,u=ne,ee!=null?Ws(i,!!l,ee,!1):!!u!=!!l&&(r!=null?Ws(i,!!l,r,!0):Ws(i,!!l,l?[]:"",!1));return;case"textarea":ne=ee=null;for(E in l)if(p=l[E],l.hasOwnProperty(E)&&p!=null&&!u.hasOwnProperty(E))switch(E){case"value":break;case"children":break;default:dt(i,r,E,null,u,p)}for(x in u)if(p=u[x],m=l[x],u.hasOwnProperty(x)&&(p!=null||m!=null))switch(x){case"value":ee=p;break;case"defaultValue":ne=p;break;case"children":break;case"dangerouslySetInnerHTML":if(p!=null)throw Error(s(91));break;default:p!==m&&dt(i,r,x,p,u,m)}Cm(i,ee,ne);return;case"option":for(var Se in l)if(ee=l[Se],l.hasOwnProperty(Se)&&ee!=null&&!u.hasOwnProperty(Se))switch(Se){case"selected":i.selected=!1;break;default:dt(i,r,Se,null,u,ee)}for(O in u)if(ee=u[O],ne=l[O],u.hasOwnProperty(O)&&ee!==ne&&(ee!=null||ne!=null))switch(O){case"selected":i.selected=ee&&typeof ee!="function"&&typeof ee!="symbol";break;default:dt(i,r,O,ee,u,ne)}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 Le in l)ee=l[Le],l.hasOwnProperty(Le)&&ee!=null&&!u.hasOwnProperty(Le)&&dt(i,r,Le,null,u,ee);for(Q in u)if(ee=u[Q],ne=l[Q],u.hasOwnProperty(Q)&&ee!==ne&&(ee!=null||ne!=null))switch(Q){case"children":case"dangerouslySetInnerHTML":if(ee!=null)throw Error(s(137,r));break;default:dt(i,r,Q,ee,u,ne)}return;default:if(Iu(r)){for(var pt in l)ee=l[pt],l.hasOwnProperty(pt)&&ee!==void 0&&!u.hasOwnProperty(pt)&&Ef(i,r,pt,void 0,u,ee);for(ae in u)ee=u[ae],ne=l[ae],!u.hasOwnProperty(ae)||ee===ne||ee===void 0&&ne===void 0||Ef(i,r,ae,ee,u,ne);return}}for(var Y in l)ee=l[Y],l.hasOwnProperty(Y)&&ee!=null&&!u.hasOwnProperty(Y)&&dt(i,r,Y,null,u,ee);for(fe in u)ee=u[fe],ne=l[fe],!u.hasOwnProperty(fe)||ee===ne||ee==null&&ne==null||dt(i,r,fe,ee,u,ne)}function T0(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function $w(){if(typeof performance.getEntriesByType=="function"){for(var i=0,r=0,l=performance.getEntriesByType("resource"),u=0;u<l.length;u++){var p=l[u],m=p.transferSize,x=p.initiatorType,E=p.duration;if(m&&E&&T0(x)){for(x=0,E=p.responseEnd,u+=1;u<l.length;u++){var O=l[u],Q=O.startTime;if(Q>E)break;var ae=O.transferSize,fe=O.initiatorType;ae&&T0(fe)&&(O=O.responseEnd,x+=ae*(O<E?1:(E-Q)/(O-Q)))}if(--u,r+=8*(m+x)/(p.duration/1e3),i++,10<i)break}}if(0<i)return r/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var Af=null,Tf=null;function Ac(i){return i.nodeType===9?i:i.ownerDocument}function N0(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function D0(i,r){if(i===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&r==="foreignObject"?0:i}function Nf(i,r){return i==="textarea"||i==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var Df=null;function Yw(){var i=window.event;return i&&i.type==="popstate"?i===Df?!1:(Df=i,!0):(Df=null,!1)}var R0=typeof setTimeout=="function"?setTimeout:void 0,Vw=typeof clearTimeout=="function"?clearTimeout:void 0,M0=typeof Promise=="function"?Promise:void 0,Gw=typeof queueMicrotask=="function"?queueMicrotask:typeof M0<"u"?function(i){return M0.resolve(null).then(i).catch(Kw)}:R0;function Kw(i){setTimeout(function(){throw i})}function Wr(i){return i==="head"}function z0(i,r){var l=r,u=0;do{var p=l.nextSibling;if(i.removeChild(l),p&&p.nodeType===8)if(l=p.data,l==="/$"||l==="/&"){if(u===0){i.removeChild(p),xl(r);return}u--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")u++;else if(l==="html")Na(i.ownerDocument.documentElement);else if(l==="head"){l=i.ownerDocument.head,Na(l);for(var m=l.firstChild;m;){var x=m.nextSibling,E=m.nodeName;m[Ae]||E==="SCRIPT"||E==="STYLE"||E==="LINK"&&m.rel.toLowerCase()==="stylesheet"||l.removeChild(m),m=x}}else l==="body"&&Na(i.ownerDocument.body);l=p}while(l);xl(r)}function L0(i,r){var l=i;i=0;do{var u=l.nextSibling;if(l.nodeType===1?r?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(r?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),u&&u.nodeType===8)if(l=u.data,l==="/$"){if(i===0)break;i--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||i++;l=u}while(l)}function Rf(i){var r=i.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var l=r;switch(r=r.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":Rf(l),H(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}i.removeChild(l)}}function Xw(i,r,l,u){for(;i.nodeType===1;){var p=l;if(i.nodeName.toLowerCase()!==r.toLowerCase()){if(!u&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(u){if(!i[Ae])switch(r){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(m=i.getAttribute("rel"),m==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(m!==p.rel||i.getAttribute("href")!==(p.href==null||p.href===""?null:p.href)||i.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin)||i.getAttribute("title")!==(p.title==null?null:p.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(m=i.getAttribute("src"),(m!==(p.src==null?null:p.src)||i.getAttribute("type")!==(p.type==null?null:p.type)||i.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin))&&m&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(r==="input"&&i.type==="hidden"){var m=p.name==null?null:""+p.name;if(p.type==="hidden"&&i.getAttribute("name")===m)return i}else return i;if(i=xn(i.nextSibling),i===null)break}return null}function Zw(i,r,l){if(r==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!l||(i=xn(i.nextSibling),i===null))return null;return i}function O0(i,r){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!r||(i=xn(i.nextSibling),i===null))return null;return i}function Mf(i){return i.data==="$?"||i.data==="$~"}function zf(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function Qw(i,r){var l=i.ownerDocument;if(i.data==="$~")i._reactRetry=r;else if(i.data!=="$?"||l.readyState!=="loading")r();else{var u=function(){r(),l.removeEventListener("DOMContentLoaded",u)};l.addEventListener("DOMContentLoaded",u),i._reactRetry=u}}function xn(i){for(;i!=null;i=i.nextSibling){var r=i.nodeType;if(r===1||r===3)break;if(r===8){if(r=i.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return i}var Lf=null;function B0(i){i=i.nextSibling;for(var r=0;i;){if(i.nodeType===8){var l=i.data;if(l==="/$"||l==="/&"){if(r===0)return xn(i.nextSibling);r--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||r++}i=i.nextSibling}return null}function j0(i){i=i.previousSibling;for(var r=0;i;){if(i.nodeType===8){var l=i.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(r===0)return i;r--}else l!=="/$"&&l!=="/&"||r++}i=i.previousSibling}return null}function H0(i,r,l){switch(r=Ac(l),i){case"html":if(i=r.documentElement,!i)throw Error(s(452));return i;case"head":if(i=r.head,!i)throw Error(s(453));return i;case"body":if(i=r.body,!i)throw Error(s(454));return i;default:throw Error(s(451))}}function Na(i){for(var r=i.attributes;r.length;)i.removeAttributeNode(r[0]);H(i)}var Sn=new Map,I0=new Set;function Tc(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var vr=B.d;B.d={f:Jw,r:eC,D:tC,C:iC,L:nC,m:rC,X:lC,S:sC,M:aC};function Jw(){var i=vr.f(),r=bc();return i||r}function eC(i){var r=xe(i);r!==null&&r.tag===5&&r.type==="form"?i_(r):vr.r(i)}var vl=typeof document>"u"?null:document;function P0(i,r,l){var u=vl;if(u&&typeof r=="string"&&r){var p=pn(r);p='link[rel="'+i+'"][href="'+p+'"]',typeof l=="string"&&(p+='[crossorigin="'+l+'"]'),I0.has(p)||(I0.add(p),i={rel:i,crossOrigin:l,href:r},u.querySelector(p)===null&&(r=u.createElement("link"),vi(r,"link",i),We(r),u.head.appendChild(r)))}}function tC(i){vr.D(i),P0("dns-prefetch",i,null)}function iC(i,r){vr.C(i,r),P0("preconnect",i,r)}function nC(i,r,l){vr.L(i,r,l);var u=vl;if(u&&i&&r){var p='link[rel="preload"][as="'+pn(r)+'"]';r==="image"&&l&&l.imageSrcSet?(p+='[imagesrcset="'+pn(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(p+='[imagesizes="'+pn(l.imageSizes)+'"]')):p+='[href="'+pn(i)+'"]';var m=p;switch(r){case"style":m=bl(i);break;case"script":m=yl(i)}Sn.has(m)||(i=v({rel:"preload",href:r==="image"&&l&&l.imageSrcSet?void 0:i,as:r},l),Sn.set(m,i),u.querySelector(p)!==null||r==="style"&&u.querySelector(Da(m))||r==="script"&&u.querySelector(Ra(m))||(r=u.createElement("link"),vi(r,"link",i),We(r),u.head.appendChild(r)))}}function rC(i,r){vr.m(i,r);var l=vl;if(l&&i){var u=r&&typeof r.as=="string"?r.as:"script",p='link[rel="modulepreload"][as="'+pn(u)+'"][href="'+pn(i)+'"]',m=p;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":m=yl(i)}if(!Sn.has(m)&&(i=v({rel:"modulepreload",href:i},r),Sn.set(m,i),l.querySelector(p)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Ra(m)))return}u=l.createElement("link"),vi(u,"link",i),We(u),l.head.appendChild(u)}}}function sC(i,r,l){vr.S(i,r,l);var u=vl;if(u&&i){var p=Mt(u).hoistableStyles,m=bl(i);r=r||"default";var x=p.get(m);if(!x){var E={loading:0,preload:null};if(x=u.querySelector(Da(m)))E.loading=5;else{i=v({rel:"stylesheet",href:i,"data-precedence":r},l),(l=Sn.get(m))&&Of(i,l);var O=x=u.createElement("link");We(O),vi(O,"link",i),O._p=new Promise(function(Q,ae){O.onload=Q,O.onerror=ae}),O.addEventListener("load",function(){E.loading|=1}),O.addEventListener("error",function(){E.loading|=2}),E.loading|=4,Nc(x,r,u)}x={type:"stylesheet",instance:x,count:1,state:E},p.set(m,x)}}}function lC(i,r){vr.X(i,r);var l=vl;if(l&&i){var u=Mt(l).hoistableScripts,p=yl(i),m=u.get(p);m||(m=l.querySelector(Ra(p)),m||(i=v({src:i,async:!0},r),(r=Sn.get(p))&&Bf(i,r),m=l.createElement("script"),We(m),vi(m,"link",i),l.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},u.set(p,m))}}function aC(i,r){vr.M(i,r);var l=vl;if(l&&i){var u=Mt(l).hoistableScripts,p=yl(i),m=u.get(p);m||(m=l.querySelector(Ra(p)),m||(i=v({src:i,async:!0,type:"module"},r),(r=Sn.get(p))&&Bf(i,r),m=l.createElement("script"),We(m),vi(m,"link",i),l.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},u.set(p,m))}}function U0(i,r,l,u){var p=(p=le.current)?Tc(p):null;if(!p)throw Error(s(446));switch(i){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(r=bl(l.href),l=Mt(p).hoistableStyles,u=l.get(r),u||(u={type:"style",instance:null,count:0,state:null},l.set(r,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){i=bl(l.href);var m=Mt(p).hoistableStyles,x=m.get(i);if(x||(p=p.ownerDocument||p,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},m.set(i,x),(m=p.querySelector(Da(i)))&&!m._p&&(x.instance=m,x.state.loading=5),Sn.has(i)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},Sn.set(i,l),m||oC(p,i,l,x.state))),r&&u===null)throw Error(s(528,""));return x}if(r&&u!==null)throw Error(s(529,""));return null;case"script":return r=l.async,l=l.src,typeof l=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=yl(l),l=Mt(p).hoistableScripts,u=l.get(r),u||(u={type:"script",instance:null,count:0,state:null},l.set(r,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,i))}}function bl(i){return'href="'+pn(i)+'"'}function Da(i){return'link[rel="stylesheet"]['+i+"]"}function F0(i){return v({},i,{"data-precedence":i.precedence,precedence:null})}function oC(i,r,l,u){i.querySelector('link[rel="preload"][as="style"]['+r+"]")?u.loading=1:(r=i.createElement("link"),u.preload=r,r.addEventListener("load",function(){return u.loading|=1}),r.addEventListener("error",function(){return u.loading|=2}),vi(r,"link",l),We(r),i.head.appendChild(r))}function yl(i){return'[src="'+pn(i)+'"]'}function Ra(i){return"script[async]"+i}function W0(i,r,l){if(r.count++,r.instance===null)switch(r.type){case"style":var u=i.querySelector('style[data-href~="'+pn(l.href)+'"]');if(u)return r.instance=u,We(u),u;var p=v({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return u=(i.ownerDocument||i).createElement("style"),We(u),vi(u,"style",p),Nc(u,l.precedence,i),r.instance=u;case"stylesheet":p=bl(l.href);var m=i.querySelector(Da(p));if(m)return r.state.loading|=4,r.instance=m,We(m),m;u=F0(l),(p=Sn.get(p))&&Of(u,p),m=(i.ownerDocument||i).createElement("link"),We(m);var x=m;return x._p=new Promise(function(E,O){x.onload=E,x.onerror=O}),vi(m,"link",u),r.state.loading|=4,Nc(m,l.precedence,i),r.instance=m;case"script":return m=yl(l.src),(p=i.querySelector(Ra(m)))?(r.instance=p,We(p),p):(u=l,(p=Sn.get(m))&&(u=v({},l),Bf(u,p)),i=i.ownerDocument||i,p=i.createElement("script"),We(p),vi(p,"link",u),i.head.appendChild(p),r.instance=p);case"void":return null;default:throw Error(s(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(u=r.instance,r.state.loading|=4,Nc(u,l.precedence,i));return r.instance}function Nc(i,r,l){for(var u=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),p=u.length?u[u.length-1]:null,m=p,x=0;x<u.length;x++){var E=u[x];if(E.dataset.precedence===r)m=E;else if(m!==p)break}m?m.parentNode.insertBefore(i,m.nextSibling):(r=l.nodeType===9?l.head:l,r.insertBefore(i,r.firstChild))}function Of(i,r){i.crossOrigin==null&&(i.crossOrigin=r.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=r.referrerPolicy),i.title==null&&(i.title=r.title)}function Bf(i,r){i.crossOrigin==null&&(i.crossOrigin=r.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=r.referrerPolicy),i.integrity==null&&(i.integrity=r.integrity)}var Dc=null;function q0(i,r,l){if(Dc===null){var u=new Map,p=Dc=new Map;p.set(l,u)}else p=Dc,u=p.get(l),u||(u=new Map,p.set(l,u));if(u.has(i))return u;for(u.set(i,null),l=l.getElementsByTagName(i),p=0;p<l.length;p++){var m=l[p];if(!(m[Ae]||m[$t]||i==="link"&&m.getAttribute("rel")==="stylesheet")&&m.namespaceURI!=="http://www.w3.org/2000/svg"){var x=m.getAttribute(r)||"";x=i+x;var E=u.get(x);E?E.push(m):u.set(x,[m])}}return u}function $0(i,r,l){i=i.ownerDocument||i,i.head.insertBefore(l,r==="title"?i.querySelector("head > title"):null)}function cC(i,r,l){if(l===1||r.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;switch(r.rel){case"stylesheet":return i=r.disabled,typeof r.precedence=="string"&&i==null;default:return!0}case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function Y0(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function uC(i,r,l,u){if(l.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var p=bl(u.href),m=r.querySelector(Da(p));if(m){r=m._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(i.count++,i=Rc.bind(i),r.then(i,i)),l.state.loading|=4,l.instance=m,We(m);return}m=r.ownerDocument||r,u=F0(u),(p=Sn.get(p))&&Of(u,p),m=m.createElement("link"),We(m);var x=m;x._p=new Promise(function(E,O){x.onload=E,x.onerror=O}),vi(m,"link",u),l.instance=m}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(l,r),(r=l.state.preload)&&(l.state.loading&3)===0&&(i.count++,l=Rc.bind(i),r.addEventListener("load",l),r.addEventListener("error",l))}}var jf=0;function hC(i,r){return i.stylesheets&&i.count===0&&zc(i,i.stylesheets),0<i.count||0<i.imgCount?function(l){var u=setTimeout(function(){if(i.stylesheets&&zc(i,i.stylesheets),i.unsuspend){var m=i.unsuspend;i.unsuspend=null,m()}},6e4+r);0<i.imgBytes&&jf===0&&(jf=62500*$w());var p=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&zc(i,i.stylesheets),i.unsuspend)){var m=i.unsuspend;i.unsuspend=null,m()}},(i.imgBytes>jf?50:800)+r);return i.unsuspend=l,function(){i.unsuspend=null,clearTimeout(u),clearTimeout(p)}}:null}function Rc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)zc(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var Mc=null;function zc(i,r){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Mc=new Map,r.forEach(fC,i),Mc=null,Rc.call(i))}function fC(i,r){if(!(r.state.loading&4)){var l=Mc.get(i);if(l)var u=l.get(null);else{l=new Map,Mc.set(i,l);for(var p=i.querySelectorAll("link[data-precedence],style[data-precedence]"),m=0;m<p.length;m++){var x=p[m];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(l.set(x.dataset.precedence,x),u=x)}u&&l.set(null,u)}p=r.instance,x=p.getAttribute("data-precedence"),m=l.get(x)||u,m===u&&l.set(null,p),l.set(x,p),this.count++,u=Rc.bind(this),p.addEventListener("load",u),p.addEventListener("error",u),m?m.parentNode.insertBefore(p,m.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(p,i.firstChild)),r.state.loading|=4}}var Ma={$$typeof:j,Provider:null,Consumer:null,_currentValue:U,_currentValue2:U,_threadCount:0};function dC(i,r,l,u,p,m,x,E,O){this.tag=1,this.containerInfo=i,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ul(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ul(0),this.hiddenUpdates=Ul(null),this.identifierPrefix=u,this.onUncaughtError=p,this.onCaughtError=m,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=O,this.incompleteTransitions=new Map}function V0(i,r,l,u,p,m,x,E,O,Q,ae,fe){return i=new dC(i,r,l,x,O,Q,ae,fe,E),r=1,m===!0&&(r|=24),m=Xi(3,null,null,r),i.current=m,m.stateNode=i,r=mh(),r.refCount++,i.pooledCache=r,r.refCount++,m.memoizedState={element:u,isDehydrated:l,cache:r},bh(m),i}function G0(i){return i?(i=Zs,i):Zs}function K0(i,r,l,u,p,m){p=G0(p),u.context===null?u.context=p:u.pendingContext=p,u=Mr(r),u.payload={element:l},m=m===void 0?null:m,m!==null&&(u.callback=m),l=zr(i,u,r),l!==null&&(Wi(l,i,r),ua(l,i,r))}function X0(i,r){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var l=i.retryLane;i.retryLane=l!==0&&l<r?l:r}}function Hf(i,r){X0(i,r),(i=i.alternate)&&X0(i,r)}function Z0(i){if(i.tag===13||i.tag===31){var r=fs(i,67108864);r!==null&&Wi(r,i,67108864),Hf(i,67108864)}}function Q0(i){if(i.tag===13||i.tag===31){var r=tn();r=Bi(r);var l=fs(i,r);l!==null&&Wi(l,i,r),Hf(i,r)}}var Lc=!0;function pC(i,r,l,u){var p=C.T;C.T=null;var m=B.p;try{B.p=2,If(i,r,l,u)}finally{B.p=m,C.T=p}}function mC(i,r,l,u){var p=C.T;C.T=null;var m=B.p;try{B.p=8,If(i,r,l,u)}finally{B.p=m,C.T=p}}function If(i,r,l,u){if(Lc){var p=Pf(u);if(p===null)kf(i,r,u,Oc,l),ev(i,u);else if(_C(p,i,r,l,u))u.stopPropagation();else if(ev(i,u),r&4&&-1<gC.indexOf(i)){for(;p!==null;){var m=xe(p);if(m!==null)switch(m.tag){case 3:if(m=m.stateNode,m.current.memoizedState.isDehydrated){var x=Gi(m.pendingLanes);if(x!==0){var E=m;for(E.pendingLanes|=2,E.entangledLanes|=2;x;){var O=1<<31-tt(x);E.entanglements[1]|=O,x&=~O}Un(m),(at&6)===0&&(_c=St()+500,Ea(0))}}break;case 31:case 13:E=fs(m,2),E!==null&&Wi(E,m,2),bc(),Hf(m,2)}if(m=Pf(u),m===null&&kf(i,r,u,Oc,l),m===p)break;p=m}p!==null&&u.stopPropagation()}else kf(i,r,u,null,l)}}function Pf(i){return i=Uu(i),Uf(i)}var Oc=null;function Uf(i){if(Oc=null,i=me(i),i!==null){var r=o(i);if(r===null)i=null;else{var l=r.tag;if(l===13){if(i=c(r),i!==null)return i;i=null}else if(l===31){if(i=f(r),i!==null)return i;i=null}else if(l===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;i=null}else r!==i&&(i=null)}}return Oc=i,null}function J0(i){switch(i){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ze()){case M:return 2;case re:return 8;case ye:case je:return 32;case rt:return 268435456;default:return 32}default:return 32}}var Ff=!1,qr=null,$r=null,Yr=null,za=new Map,La=new Map,Vr=[],gC="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 ev(i,r){switch(i){case"focusin":case"focusout":qr=null;break;case"dragenter":case"dragleave":$r=null;break;case"mouseover":case"mouseout":Yr=null;break;case"pointerover":case"pointerout":za.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":La.delete(r.pointerId)}}function Oa(i,r,l,u,p,m){return i===null||i.nativeEvent!==m?(i={blockedOn:r,domEventName:l,eventSystemFlags:u,nativeEvent:m,targetContainers:[p]},r!==null&&(r=xe(r),r!==null&&Z0(r)),i):(i.eventSystemFlags|=u,r=i.targetContainers,p!==null&&r.indexOf(p)===-1&&r.push(p),i)}function _C(i,r,l,u,p){switch(r){case"focusin":return qr=Oa(qr,i,r,l,u,p),!0;case"dragenter":return $r=Oa($r,i,r,l,u,p),!0;case"mouseover":return Yr=Oa(Yr,i,r,l,u,p),!0;case"pointerover":var m=p.pointerId;return za.set(m,Oa(za.get(m)||null,i,r,l,u,p)),!0;case"gotpointercapture":return m=p.pointerId,La.set(m,Oa(La.get(m)||null,i,r,l,u,p)),!0}return!1}function tv(i){var r=me(i.target);if(r!==null){var l=o(r);if(l!==null){if(r=l.tag,r===13){if(r=c(l),r!==null){i.blockedOn=r,Yl(i.priority,function(){Q0(l)});return}}else if(r===31){if(r=f(l),r!==null){i.blockedOn=r,Yl(i.priority,function(){Q0(l)});return}}else if(r===3&&l.stateNode.current.memoizedState.isDehydrated){i.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}i.blockedOn=null}function Bc(i){if(i.blockedOn!==null)return!1;for(var r=i.targetContainers;0<r.length;){var l=Pf(i.nativeEvent);if(l===null){l=i.nativeEvent;var u=new l.constructor(l.type,l);Pu=u,l.target.dispatchEvent(u),Pu=null}else return r=xe(l),r!==null&&Z0(r),i.blockedOn=l,!1;r.shift()}return!0}function iv(i,r,l){Bc(i)&&l.delete(r)}function vC(){Ff=!1,qr!==null&&Bc(qr)&&(qr=null),$r!==null&&Bc($r)&&($r=null),Yr!==null&&Bc(Yr)&&(Yr=null),za.forEach(iv),La.forEach(iv)}function jc(i,r){i.blockedOn===r&&(i.blockedOn=null,Ff||(Ff=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,vC)))}var Hc=null;function nv(i){Hc!==i&&(Hc=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Hc===i&&(Hc=null);for(var r=0;r<i.length;r+=3){var l=i[r],u=i[r+1],p=i[r+2];if(typeof u!="function"){if(Uf(u||l)===null)continue;break}var m=xe(l);m!==null&&(i.splice(r,3),r-=3,Ih(m,{pending:!0,data:p,method:l.method,action:u},u,p))}}))}function xl(i){function r(O){return jc(O,i)}qr!==null&&jc(qr,i),$r!==null&&jc($r,i),Yr!==null&&jc(Yr,i),za.forEach(r),La.forEach(r);for(var l=0;l<Vr.length;l++){var u=Vr[l];u.blockedOn===i&&(u.blockedOn=null)}for(;0<Vr.length&&(l=Vr[0],l.blockedOn===null);)tv(l),l.blockedOn===null&&Vr.shift();if(l=(i.ownerDocument||i).$$reactFormReplay,l!=null)for(u=0;u<l.length;u+=3){var p=l[u],m=l[u+1],x=p[Tt]||null;if(typeof m=="function")x||nv(l);else if(x){var E=null;if(m&&m.hasAttribute("formAction")){if(p=m,x=m[Tt]||null)E=x.formAction;else if(Uf(p)!==null)continue}else E=x.action;typeof E=="function"?l[u+1]=E:(l.splice(u,3),u-=3),nv(l)}}}function rv(){function i(m){m.canIntercept&&m.info==="react-transition"&&m.intercept({handler:function(){return new Promise(function(x){return p=x})},focusReset:"manual",scroll:"manual"})}function r(){p!==null&&(p(),p=null),u||setTimeout(l,20)}function l(){if(!u&&!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 u=!1,p=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(l,100),function(){u=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),p!==null&&(p(),p=null)}}}function Wf(i){this._internalRoot=i}Ic.prototype.render=Wf.prototype.render=function(i){var r=this._internalRoot;if(r===null)throw Error(s(409));var l=r.current,u=tn();K0(l,u,i,r,null,null)},Ic.prototype.unmount=Wf.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var r=i.containerInfo;K0(i.current,2,null,i,null,null),bc(),r[er]=null}};function Ic(i){this._internalRoot=i}Ic.prototype.unstable_scheduleHydration=function(i){if(i){var r=$l();i={blockedOn:null,target:i,priority:r};for(var l=0;l<Vr.length&&r!==0&&r<Vr[l].priority;l++);Vr.splice(l,0,i),l===0&&tv(i)}};var sv=t.version;if(sv!=="19.2.4")throw Error(s(527,sv,"19.2.4"));B.findDOMNode=function(i){var r=i._reactInternals;if(r===void 0)throw typeof i.render=="function"?Error(s(188)):(i=Object.keys(i).join(","),Error(s(268,i)));return i=h(r),i=i!==null?_(i):null,i=i===null?null:i.stateNode,i};var bC={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:C,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Pc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Pc.isDisabled&&Pc.supportsFiber)try{qt=Pc.inject(bC),Et=Pc}catch{}}return ja.createRoot=function(i,r){if(!a(i))throw Error(s(299));var l=!1,u="",p=f_,m=d_,x=p_;return r!=null&&(r.unstable_strictMode===!0&&(l=!0),r.identifierPrefix!==void 0&&(u=r.identifierPrefix),r.onUncaughtError!==void 0&&(p=r.onUncaughtError),r.onCaughtError!==void 0&&(m=r.onCaughtError),r.onRecoverableError!==void 0&&(x=r.onRecoverableError)),r=V0(i,1,!1,null,null,l,u,null,p,m,x,rv),i[er]=r.current,Cf(i),new Wf(r)},ja.hydrateRoot=function(i,r,l){if(!a(i))throw Error(s(299));var u=!1,p="",m=f_,x=d_,E=p_,O=null;return l!=null&&(l.unstable_strictMode===!0&&(u=!0),l.identifierPrefix!==void 0&&(p=l.identifierPrefix),l.onUncaughtError!==void 0&&(m=l.onUncaughtError),l.onCaughtError!==void 0&&(x=l.onCaughtError),l.onRecoverableError!==void 0&&(E=l.onRecoverableError),l.formState!==void 0&&(O=l.formState)),r=V0(i,1,!0,r,l??null,u,p,O,m,x,E,rv),r.context=G0(null),l=r.current,u=tn(),u=Bi(u),p=Mr(u),p.callback=null,zr(l,p,u),l=u,r.current.lanes=l,kr(r,l),Un(r),i[er]=r.current,Cf(i),new Ic(r)},ja.version="19.2.4",ja}var mv;function NC(){if(mv)return Yf.exports;mv=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(),Yf.exports=TC(),Yf.exports}var DC=NC();const Yy=N.createContext(null);function Vy(){const e=N.useContext(Yy);if(!e)throw new Error("useConfirm must be used within ConfirmProvider");return e.confirm}function RC({children:e}){const[t,n]=N.useState(null),s=N.useRef(null),a=N.useRef(null);N.useEffect(()=>{var f;t&&((f=a.current)==null||f.focus())},[t]);const o=N.useCallback(f=>new Promise(d=>{n({...f,resolve:d})}),[]),c=N.useCallback(f=>{t==null||t.resolve(f),n(null)},[t]);return g.jsxs(Yy.Provider,{value:{confirm:o},children:[e,t&&g.jsx("div",{role:"dialog",ref:s,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",onClick:f=>{f.target===s.current&&c(!1)},onKeyDown:f=>{f.key==="Escape"&&c(!1)},children:g.jsxs("div",{className:"w-full max-w-sm rounded-xl border border-white/10 bg-zinc-900 p-5 shadow-2xl",children:[t.title&&g.jsx("h3",{className:"mb-1 text-sm font-semibold text-zinc-100",children:t.title}),g.jsx("p",{className:"text-[13px] leading-relaxed text-zinc-400",children:t.message}),g.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[g.jsx("button",{type:"button",onClick:()=>c(!1),className:"rounded-lg px-3 py-1.5 text-xs text-zinc-400 transition-colors hover:bg-white/10 hover:text-zinc-200",children:t.cancelLabel??"Cancel"}),g.jsx("button",{type:"button",ref:a,onClick:()=>c(!0),className:`rounded-lg px-3 py-1.5 text-xs font-medium transition-colors ${t.variant==="danger"?"bg-red-500/15 text-red-400 hover:bg-red-500/25":"bg-cyan-500/15 text-cyan-400 hover:bg-cyan-500/25"}`,children:t.confirmLabel??"Confirm"})]})]})})]})}const MC="modulepreload",zC=function(e){return"/"+e},gv={},LC=function(t,n,s){let a=Promise.resolve();if(n&&n.length>0){let c=function(h){return Promise.all(h.map(_=>Promise.resolve(_).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),d=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));a=c(n.map(h=>{if(h=zC(h),h in gv)return;gv[h]=!0;const _=h.endsWith(".css"),v=_?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${v}`))return;const b=document.createElement("link");if(b.rel=_?"stylesheet":MC,_||(b.as="script"),b.crossOrigin="",b.href=h,d&&b.setAttribute("nonce",d),document.head.appendChild(b),_)return new Promise((y,S)=>{b.addEventListener("load",y),b.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${h}`)))})}))}function o(c){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=c,window.dispatchEvent(f),!f.defaultPrevented)throw c}return a.then(c=>{for(const f of c||[])f.status==="rejected"&&o(f.reason);return t().catch(o)})};function OC(){const t=new URLSearchParams(window.location.search).get("token")||"";return{baseUrl:window.location.origin,token:t}}const Ml=OC();async function Ne(e,t={}){const n=`${Ml.baseUrl}/api${e}`,s=await fetch(n,{...t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${Ml.token}`,...t.headers}});if(!s.ok){const a=await s.text();throw new Error(`API error ${s.status}: ${a}`)}return s.json()}function zl(e){if(typeof e=="string")return e;if(e==null)return"Unknown";const t=Object.keys(e).filter(n=>n!=="type");return t.length>0?t[0]:"type"in e&&typeof e.type=="string"?e.type:"Unknown"}function ho(e){const t=zl(e);return t==="AwaitingApproval"||t==="Error"}function Id(e){return e==="ClaudeCode"||e==="OpenCode"||e==="CodexCli"||e==="GeminiCli"}function _v(e){return e.replace(/\/\.git\/?$/,"").split("/").filter(Boolean).pop()||e}function Kr(e){return e.replace(/\/\.git\/?$/,"").replace(/\/+$/,"")}function BC(e,t=[],n=[]){var f,d,h;const s=new Map,a=new Map;for(const _ of e)if(_.git_common_dir){const v=Kr(_.git_common_dir);a.set(_.cwd,v)}for(const _ of e){let v;if(_.git_common_dir)v=Kr(_.git_common_dir);else{let y=a.get(_.cwd);if(!y){for(const[S,A]of a)if(_.cwd.startsWith(S)||S.startsWith(_.cwd)){y=A;break}}v=y||_.cwd}const b=s.get(v);b?b.push(_):s.set(v,[_])}const o=[];for(const[_,v]of s){const b=new Map;for(const I of v){const J=I.is_worktree?I.worktree_name||I.git_branch||"worktree":"main",L=b.get(J);L?L.push(I):b.set(J,[I])}const y=[],S=b.get("main");S&&(b.delete("main"),y.push({name:"main",path:_,branch:((f=S[0])==null?void 0:f.git_branch)??null,isWorktree:!1,dirty:S.some(I=>I.git_dirty===!0),agents:S}));const A=[...b.entries()].sort(([I],[J])=>I.localeCompare(J));for(const[I,J]of A){const L=n.find(te=>Kr(te.repo_path)===_&&te.name===I);y.push({name:I,path:(L==null?void 0:L.path)??((d=J[0])==null?void 0:d.cwd)??_,branch:((h=J[0])==null?void 0:h.git_branch)??(L==null?void 0:L.branch)??null,isWorktree:!0,dirty:J.some(te=>te.git_dirty===!0),agents:J})}const R=new Set(y.map(I=>I.name)),D=n.filter(I=>Kr(I.repo_path)===_);if(!R.has("main")){const I=D.find(J=>J.is_main);I&&(y.unshift({name:"main",path:_,branch:I.branch,isWorktree:!1,dirty:I.is_dirty??!1,agents:[]}),R.add("main"))}for(const I of D)I.is_main||R.has(I.name)||y.push({name:I.name,path:I.path,branch:I.branch,isWorktree:!0,dirty:I.is_dirty??!1,agents:[]});const W=v.filter(I=>ho(I.status)).length,j=new Set(t.map(I=>Kr(I)));o.push({name:_v(_),path:_,worktrees:y,totalAgents:v.length,attentionAgents:W,isRegistered:j.has(Kr(_))})}const c=new Set(o.map(_=>Kr(_.path)));for(const _ of t){const v=Kr(_);c.has(v)||o.push({name:_v(_),path:_,worktrees:[],totalAgents:0,attentionAgents:0,isRegistered:!0})}return o.sort((_,v)=>_.isRegistered&&!v.isRegistered?-1:!_.isRegistered&&v.isRegistered?1:_.name.localeCompare(v.name)),o}const De={listAgents:()=>Ne("/agents"),attentionCount:async()=>(await Ne("/agents")).filter(t=>ho(t.status)).length,approve:e=>Ne(`/agents/${encodeURIComponent(e)}/approve`,{method:"POST"}),selectChoice:(e,t)=>Ne(`/agents/${encodeURIComponent(e)}/select`,{method:"POST",body:JSON.stringify({choice:t})}),submitSelection:(e,t)=>Ne(`/agents/${encodeURIComponent(e)}/submit`,{method:"POST",body:JSON.stringify({choices:t})}),sendText:(e,t)=>Ne(`/agents/${encodeURIComponent(e)}/input`,{method:"POST",body:JSON.stringify({text:t})}),sendKey:(e,t)=>Ne(`/agents/${encodeURIComponent(e)}/key`,{method:"POST",body:JSON.stringify({key:t})}),killAgent:e=>Ne(`/agents/${encodeURIComponent(e)}/kill`,{method:"POST"}),setAutoApprove:(e,t)=>Ne(`/agents/${encodeURIComponent(e)}/auto-approve`,{method:"PUT",body:JSON.stringify({enabled:t})}),passthrough:(e,t)=>Ne(`/agents/${encodeURIComponent(e)}/passthrough`,{method:"POST",body:JSON.stringify(t)}),getPreview:e=>Ne(`/agents/${encodeURIComponent(e)}/preview`),spawnPty:e=>Ne("/spawn",{method:"POST",body:JSON.stringify(e)}),spawnWorktree:e=>Ne("/spawn/worktree",{method:"POST",body:JSON.stringify(e)}),listWorktrees:()=>Ne("/worktrees"),getWorktreeDiff:(e,t)=>Ne("/worktrees/diff",{method:"POST",body:JSON.stringify({worktree_path:e,base_branch:t??"main"})}),launchWorktreeAgent:(e,t)=>Ne("/worktrees/launch",{method:"POST",body:JSON.stringify({repo_path:e,worktree_name:t})}),deleteWorktree:(e,t,n)=>Ne("/worktrees/delete",{method:"POST",body:JSON.stringify({repo_path:e,worktree_name:t,force:n??!1})}),listBranches:e=>Ne(`/git/branches?repo=${encodeURIComponent(e)}`),gitLog:(e,t,n)=>Ne(`/git/log?repo=${encodeURIComponent(e)}&base=${encodeURIComponent(t)}&branch=${encodeURIComponent(n)}`),gitGraph:(e,t)=>Ne(`/git/graph?repo=${encodeURIComponent(e)}${t?`&limit=${t}`:""}`),gitDiffStat:(e,t,n)=>Ne(`/git/diff-stat?repo=${encodeURIComponent(e)}&branch=${encodeURIComponent(t)}&base=${encodeURIComponent(n)}`),gitBranchDiff:(e,t,n)=>Ne(`/git/diff?repo=${encodeURIComponent(e)}&branch=${encodeURIComponent(t)}&base=${encodeURIComponent(n)}`),listPrs:e=>Ne(`/github/prs?repo=${encodeURIComponent(e)}`),listChecks:(e,t)=>Ne(`/github/checks?repo=${encodeURIComponent(e)}&branch=${encodeURIComponent(t)}`),listIssues:e=>Ne(`/github/issues?repo=${encodeURIComponent(e)}`),getPrComments:(e,t)=>Ne(`/github/pr/comments?repo=${encodeURIComponent(e)}&pr_number=${t}`),getPrFiles:(e,t)=>Ne(`/github/pr/files?repo=${encodeURIComponent(e)}&pr_number=${t}`),getPrMergeStatus:(e,t)=>Ne(`/github/pr/merge-status?repo=${encodeURIComponent(e)}&pr_number=${t}`),getCiFailureLog:(e,t)=>Ne(`/github/ci/failure-log?repo=${encodeURIComponent(e)}&run_id=${t}`),rerunFailedChecks:(e,t)=>Ne("/github/ci/rerun",{method:"POST",body:JSON.stringify({repo:e,run_id:t})}),deleteBranch:(e,t,n,s)=>Ne("/git/branches/delete",{method:"POST",body:JSON.stringify({repo_path:e,branch:t,force:n??!1,delete_remote:s??!1})}),createBranch:(e,t,n)=>Ne("/git/branches/create",{method:"POST",body:JSON.stringify({repo_path:e,name:t,base:n})}),checkoutBranch:(e,t)=>Ne("/git/checkout",{method:"POST",body:JSON.stringify({repo_path:e,branch:t})}),gitFetch:e=>Ne("/git/fetch",{method:"POST",body:JSON.stringify({repo_path:e})}),gitPull:e=>Ne("/git/pull",{method:"POST",body:JSON.stringify({repo_path:e})}),gitMerge:(e,t)=>Ne("/git/merge",{method:"POST",body:JSON.stringify({repo_path:e,branch:t})}),listDirectories:e=>Ne(`/directories${e?`?path=${encodeURIComponent(e)}`:""}`),listProjects:()=>Ne("/projects"),addProject:e=>Ne("/projects",{method:"POST",body:JSON.stringify({path:e})}),removeProject:e=>Ne("/projects/remove",{method:"POST",body:JSON.stringify({path:e})}),runSecurityScan:()=>Ne("/security/scan",{method:"POST"}),lastSecurityScan:()=>Ne("/security/last"),getUsage:()=>Ne("/usage"),fetchUsage:()=>Ne("/usage/fetch",{method:"POST"}),getUsageSettings:()=>Ne("/settings/usage"),updateUsageSettings:e=>Ne("/settings/usage",{method:"PUT",body:JSON.stringify(e)}),getAutoApproveSettings:()=>Ne("/settings/auto-approve"),updateAutoApproveMode:e=>Ne("/settings/auto-approve",{method:"PUT",body:JSON.stringify({mode:e})}),updateAutoApproveRules:e=>Ne("/settings/auto-approve",{method:"PUT",body:JSON.stringify({rules:e})}),readFile:e=>Ne(`/files/read?path=${encodeURIComponent(e)}`),writeFile:(e,t)=>Ne("/files/write",{method:"POST",body:JSON.stringify({path:e,content:t})}),mdTree:e=>Ne(`/files/md-tree?root=${encodeURIComponent(e)}`),getSpawnSettings:()=>Ne("/settings/spawn"),updateSpawnSettings:e=>Ne("/settings/spawn",{method:"PUT",body:JSON.stringify(e)}),getPreviewSettings:()=>Ne("/settings/preview"),updatePreviewSettings:e=>Ne("/settings/preview",{method:"PUT",body:JSON.stringify(e)}),listTeams:()=>Ne("/teams"),getTeamTasks:e=>Ne(`/teams/${encodeURIComponent(e)}/tasks`)};function Wp(e){const t=`${Ml.baseUrl}/api/events?token=${Ml.token}`,n=new EventSource(t);n.addEventListener("agents",a=>{var o;try{const c=JSON.parse(a.data);(o=e.onAgents)==null||o.call(e,c)}catch{}});const s=["teams","teammate_idle","task_completed","context_compacting","review_launched","review_completed","usage","worktree_created","worktree_removed"];for(const a of s)n.addEventListener(a,o=>{var c;try{const f=JSON.parse(o.data);(c=e.onEvent)==null||c.call(e,a,f)}catch{}});return n.onerror=()=>{},{unlisten:()=>n.close()}}function jC(e,t){const n=`${Ml.baseUrl.replace("http","ws")}/api/agents/${encodeURIComponent(e)}/terminal?token=${Ml.token}`,s=new WebSocket(n);return s.binaryType="arraybuffer",s.onmessage=o=>{o.data instanceof ArrayBuffer?t(new Uint8Array(o.data)):typeof o.data=="string"&&t(new TextEncoder().encode(o.data))},{ws:s,send:o=>{s.readyState===WebSocket.OPEN&&s.send(o)}}}function bi(e,t,n,s){if(typeof t=="function"?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?s:n==="a"?s.call(e):s?s.value:t.get(e)}function Al(e,t,n,s,a){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var ks,wn,Sl,Uc,nu;const Pd="__TAURI_TO_IPC_KEY__";function qp(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}class Gy{constructor(t){ks.set(this,void 0),wn.set(this,0),Sl.set(this,[]),Uc.set(this,void 0),Al(this,ks,t||(()=>{})),this.id=qp(n=>{const s=n.index;if("end"in n){s==bi(this,wn,"f")?this.cleanupCallback():Al(this,Uc,s);return}const a=n.message;if(s==bi(this,wn,"f")){for(bi(this,ks,"f").call(this,a),Al(this,wn,bi(this,wn,"f")+1);bi(this,wn,"f")in bi(this,Sl,"f");){const o=bi(this,Sl,"f")[bi(this,wn,"f")];bi(this,ks,"f").call(this,o),delete bi(this,Sl,"f")[bi(this,wn,"f")],Al(this,wn,bi(this,wn,"f")+1)}bi(this,wn,"f")===bi(this,Uc,"f")&&this.cleanupCallback()}else bi(this,Sl,"f")[s]=a})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(t){Al(this,ks,t)}get onmessage(){return bi(this,ks,"f")}[(ks=new WeakMap,wn=new WeakMap,Sl=new WeakMap,Uc=new WeakMap,Pd)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[Pd]()}}class Ud{constructor(t,n,s){this.plugin=t,this.event=n,this.channelId=s}async unregister(){return Di(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}}async function HC(e,t,n){const s=new Gy(n);try{return await Di(`plugin:${e}|register_listener`,{event:t,handler:s}),new Ud(e,t,s.id)}catch{return await Di(`plugin:${e}|registerListener`,{event:t,handler:s}),new Ud(e,t,s.id)}}async function IC(e){return Di(`plugin:${e}|check_permissions`)}async function PC(e){return Di(`plugin:${e}|request_permissions`)}async function Di(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}function UC(e,t="asset"){return window.__TAURI_INTERNALS__.convertFileSrc(e,t)}class FC{get rid(){return bi(this,nu,"f")}constructor(t){nu.set(this,void 0),Al(this,nu,t)}async close(){return Di("plugin:resources|close",{rid:this.rid})}}nu=new WeakMap;function WC(){return!!(globalThis||window).isTauri}const qC=Object.freeze(Object.defineProperty({__proto__:null,Channel:Gy,PluginListener:Ud,Resource:FC,SERIALIZE_TO_IPC_FN:Pd,addPluginListener:HC,checkPermissions:IC,convertFileSrc:UC,invoke:Di,isTauri:WC,requestPermissions:PC,transformCallback:qp},Symbol.toStringTag,{value:"Module"}));function vv(e){let t;return e.status==="Idle"?t="Idle":e.status==="Offline"?t="Offline":e.status==="Unknown"?t="Unknown":e.status.startsWith("Processing")?t={Processing:{activity:e.status.substring(11)}}:e.status.startsWith("AwaitingApproval")?t={AwaitingApproval:{approval_type:"unknown",details:""}}:e.status.startsWith("Error")?t={Error:{message:e.status.substring(7)}}:t="Unknown",{id:e.id,target:e.target,agent_type:e.type,status:t,title:e.title,cwd:e.cwd,display_cwd:e.display_cwd,display_name:e.title,detection_source:e.detection_source,git_branch:e.git_branch,git_dirty:e.git_dirty,is_worktree:null,git_common_dir:null,worktree_name:null,worktree_base_branch:null,effort_level:e.effort,active_subagents:0,compaction_count:0,pty_session_id:null,send_capability:"None",is_virtual:e.is_virtual,team_info:e.team_name?{team_name:e.team_name,member_name:""}:null,auto_approve_phase:null,auto_approve_override:null}}const Ha={listAgents:async()=>(await Di("list_agents")).map(vv),getAgent:async e=>{const t=await Di("get_agent",{target:e});return vv(t)},attentionCount:async()=>await Di("attention_count"),approveAgent:async e=>await Di("approve_agent",{target:e}),sendText:async(e,t)=>await Di("send_text",{target:e,text:t}),sendKey:async(e,t)=>await Di("send_key",{target:e,key:t})};async function $C(){try{return await LC(()=>Promise.resolve().then(()=>qC),void 0),!0}catch{return!1}}let Xf=null;async function Ia(){return Xf===null&&(Xf=await $C()),Xf}const we={listAgents:async()=>{try{if(await Ia())return await Ha.listAgents()}catch{}return await De.listAgents()},attentionCount:async()=>{try{if(await Ia())return await Ha.attentionCount()}catch{}return await De.attentionCount()},approve:async e=>{try{if(await Ia())return await Ha.approveAgent(e)}catch{}return await De.approve(e)},sendText:async(e,t)=>{try{if(await Ia())return await Ha.sendText(e,t)}catch{}return await De.sendText(e,t)},sendKey:async(e,t)=>{try{if(await Ia())return await Ha.sendKey(e,t)}catch{}return await De.sendKey(e,t)},selectChoice:(e,t)=>De.selectChoice(e,t),submitSelection:(e,t)=>De.submitSelection(e,t),killAgent:e=>De.killAgent(e),setAutoApprove:(e,t)=>De.setAutoApprove(e,t),passthrough:(e,t)=>De.passthrough(e,t),getPreview:e=>De.getPreview(e),spawnPty:e=>De.spawnPty(e),spawnWorktree:e=>De.spawnWorktree(e),listWorktrees:()=>De.listWorktrees(),getWorktreeDiff:(e,t)=>De.getWorktreeDiff(e,t),launchWorktreeAgent:(e,t)=>De.launchWorktreeAgent(e,t),deleteWorktree:(e,t,n)=>De.deleteWorktree(e,t,n),listBranches:e=>De.listBranches(e),gitLog:(e,t,n)=>De.gitLog(e,t,n),gitGraph:(e,t)=>De.gitGraph(e,t),listPrs:e=>De.listPrs(e),listChecks:(e,t)=>De.listChecks(e,t),listIssues:e=>De.listIssues(e),getPrComments:(e,t)=>De.getPrComments(e,t),getPrFiles:(e,t)=>De.getPrFiles(e,t),getPrMergeStatus:(e,t)=>De.getPrMergeStatus(e,t),getCiFailureLog:(e,t)=>De.getCiFailureLog(e,t),rerunFailedChecks:(e,t)=>De.rerunFailedChecks(e,t),deleteBranch:(e,t,n,s)=>De.deleteBranch(e,t,n,s),createBranch:(e,t,n)=>De.createBranch(e,t,n),checkoutBranch:(e,t)=>De.checkoutBranch(e,t),gitFetch:e=>De.gitFetch(e),gitPull:e=>De.gitPull(e),gitMerge:(e,t)=>De.gitMerge(e,t),gitDiffStat:(e,t,n)=>De.gitDiffStat(e,t,n),gitBranchDiff:(e,t,n)=>De.gitBranchDiff(e,t,n),listDirectories:e=>De.listDirectories(e),listProjects:()=>De.listProjects(),addProject:e=>De.addProject(e),removeProject:e=>De.removeProject(e),runSecurityScan:()=>De.runSecurityScan(),lastSecurityScan:()=>De.lastSecurityScan(),getUsage:()=>De.getUsage(),fetchUsage:()=>De.fetchUsage(),getUsageSettings:()=>De.getUsageSettings(),updateUsageSettings:e=>De.updateUsageSettings(e),getAutoApproveSettings:()=>De.getAutoApproveSettings(),updateAutoApproveMode:e=>De.updateAutoApproveMode(e),updateAutoApproveRules:e=>De.updateAutoApproveRules(e),readFile:e=>De.readFile(e),writeFile:(e,t)=>De.writeFile(e,t),mdTree:e=>De.mdTree(e),getSpawnSettings:()=>De.getSpawnSettings(),updateSpawnSettings:e=>De.updateSpawnSettings(e),getPreviewSettings:()=>De.getPreviewSettings(),updatePreviewSettings:e=>De.updatePreviewSettings(e),listTeams:()=>De.listTeams(),getTeamTasks:e=>De.getTeamTasks(e)};function Ky(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=Ky(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function YC(){for(var e,t,n=0,s="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=Ky(e))&&(s&&(s+=" "),s+=t);return s}const VC=(e,t)=>{const n=new Array(e.length+t.length);for(let s=0;s<e.length;s++)n[s]=e[s];for(let s=0;s<t.length;s++)n[e.length+s]=t[s];return n},GC=(e,t)=>({classGroupId:e,validator:t}),Xy=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),du="-",bv=[],KC="arbitrary..",XC=e=>{const t=QC(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:c=>{if(c.startsWith("[")&&c.endsWith("]"))return ZC(c);const f=c.split(du),d=f[0]===""&&f.length>1?1:0;return Zy(f,d,t)},getConflictingClassGroupIds:(c,f)=>{if(f){const d=s[c],h=n[c];return d?h?VC(h,d):d:h||bv}return n[c]||bv}}},Zy=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const a=e[t],o=n.nextPart.get(a);if(o){const h=Zy(e,t+1,o);if(h)return h}const c=n.validators;if(c===null)return;const f=t===0?e.join(du):e.slice(t).join(du),d=c.length;for(let h=0;h<d;h++){const _=c[h];if(_.validator(f))return _.classGroupId}},ZC=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),s=t.slice(0,n);return s?KC+s:void 0})(),QC=e=>{const{theme:t,classGroups:n}=e;return JC(n,t)},JC=(e,t)=>{const n=Xy();for(const s in e){const a=e[s];$p(a,n,s,t)}return n},$p=(e,t,n,s)=>{const a=e.length;for(let o=0;o<a;o++){const c=e[o];ek(c,t,n,s)}},ek=(e,t,n,s)=>{if(typeof e=="string"){tk(e,t,n);return}if(typeof e=="function"){ik(e,t,n,s);return}nk(e,t,n,s)},tk=(e,t,n)=>{const s=e===""?t:Qy(t,e);s.classGroupId=n},ik=(e,t,n,s)=>{if(rk(e)){$p(e(s),t,n,s);return}t.validators===null&&(t.validators=[]),t.validators.push(GC(n,e))},nk=(e,t,n,s)=>{const a=Object.entries(e),o=a.length;for(let c=0;c<o;c++){const[f,d]=a[c];$p(d,Qy(t,f),n,s)}},Qy=(e,t)=>{let n=e;const s=t.split(du),a=s.length;for(let o=0;o<a;o++){const c=s[o];let f=n.nextPart.get(c);f||(f=Xy(),n.nextPart.set(c,f)),n=f}return n},rk=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,sk=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),s=Object.create(null);const a=(o,c)=>{n[o]=c,t++,t>e&&(t=0,s=n,n=Object.create(null))};return{get(o){let c=n[o];if(c!==void 0)return c;if((c=s[o])!==void 0)return a(o,c),c},set(o,c){o in n?n[o]=c:a(o,c)}}},Fd="!",yv=":",lk=[],xv=(e,t,n,s,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:s,isExternal:a}),ak=e=>{const{prefix:t,experimentalParseClassName:n}=e;let s=a=>{const o=[];let c=0,f=0,d=0,h;const _=a.length;for(let A=0;A<_;A++){const R=a[A];if(c===0&&f===0){if(R===yv){o.push(a.slice(d,A)),d=A+1;continue}if(R==="/"){h=A;continue}}R==="["?c++:R==="]"?c--:R==="("?f++:R===")"&&f--}const v=o.length===0?a:a.slice(d);let b=v,y=!1;v.endsWith(Fd)?(b=v.slice(0,-1),y=!0):v.startsWith(Fd)&&(b=v.slice(1),y=!0);const S=h&&h>d?h-d:void 0;return xv(o,y,b,S)};if(t){const a=t+yv,o=s;s=c=>c.startsWith(a)?o(c.slice(a.length)):xv(lk,!1,c,void 0,!0)}if(n){const a=s;s=o=>n({className:o,parseClassName:a})}return s},ok=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,s)=>{t.set(n,1e6+s)}),n=>{const s=[];let a=[];for(let o=0;o<n.length;o++){const c=n[o],f=c[0]==="[",d=t.has(c);f||d?(a.length>0&&(a.sort(),s.push(...a),a=[]),s.push(c)):a.push(c)}return a.length>0&&(a.sort(),s.push(...a)),s}},ck=e=>({cache:sk(e.cacheSize),parseClassName:ak(e),sortModifiers:ok(e),...XC(e)}),uk=/\s+/,hk=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:a,sortModifiers:o}=t,c=[],f=e.trim().split(uk);let d="";for(let h=f.length-1;h>=0;h-=1){const _=f[h],{isExternal:v,modifiers:b,hasImportantModifier:y,baseClassName:S,maybePostfixModifierPosition:A}=n(_);if(v){d=_+(d.length>0?" "+d:d);continue}let R=!!A,D=s(R?S.substring(0,A):S);if(!D){if(!R){d=_+(d.length>0?" "+d:d);continue}if(D=s(S),!D){d=_+(d.length>0?" "+d:d);continue}R=!1}const W=b.length===0?"":b.length===1?b[0]:o(b).join(":"),j=y?W+Fd:W,I=j+D;if(c.indexOf(I)>-1)continue;c.push(I);const J=a(D,R);for(let L=0;L<J.length;++L){const te=J[L];c.push(j+te)}d=_+(d.length>0?" "+d:d)}return d},fk=(...e)=>{let t=0,n,s,a="";for(;t<e.length;)(n=e[t++])&&(s=Jy(n))&&(a&&(a+=" "),a+=s);return a},Jy=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=Jy(e[s]))&&(n&&(n+=" "),n+=t);return n},dk=(e,...t)=>{let n,s,a,o;const c=d=>{const h=t.reduce((_,v)=>v(_),e());return n=ck(h),s=n.cache.get,a=n.cache.set,o=f,f(d)},f=d=>{const h=s(d);if(h)return h;const _=hk(d,n);return a(d,_),_};return o=c,(...d)=>o(fk(...d))},pk=[],ti=e=>{const t=n=>n[e]||pk;return t.isThemeGetter=!0,t},ex=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,tx=/^\((?:(\w[\w-]*):)?(.+)\)$/i,mk=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,gk=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,_k=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,vk=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,bk=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,yk=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Xr=e=>mk.test(e),$e=e=>!!e&&!Number.isNaN(Number(e)),Zr=e=>!!e&&Number.isInteger(Number(e)),Zf=e=>e.endsWith("%")&&$e(e.slice(0,-1)),br=e=>gk.test(e),ix=()=>!0,xk=e=>_k.test(e)&&!vk.test(e),Yp=()=>!1,Sk=e=>bk.test(e),wk=e=>yk.test(e),Ck=e=>!Ce(e)&&!ke(e),kk=e=>ls(e,sx,Yp),Ce=e=>ex.test(e),Es=e=>ls(e,lx,xk),Sv=e=>ls(e,zk,$e),Ek=e=>ls(e,ox,ix),Ak=e=>ls(e,ax,Yp),wv=e=>ls(e,nx,Yp),Tk=e=>ls(e,rx,wk),Fc=e=>ls(e,cx,Sk),ke=e=>tx.test(e),Pa=e=>js(e,lx),Nk=e=>js(e,ax),Cv=e=>js(e,nx),Dk=e=>js(e,sx),Rk=e=>js(e,rx),Wc=e=>js(e,cx,!0),Mk=e=>js(e,ox,!0),ls=(e,t,n)=>{const s=ex.exec(e);return s?s[1]?t(s[1]):n(s[2]):!1},js=(e,t,n=!1)=>{const s=tx.exec(e);return s?s[1]?t(s[1]):n:!1},nx=e=>e==="position"||e==="percentage",rx=e=>e==="image"||e==="url",sx=e=>e==="length"||e==="size"||e==="bg-size",lx=e=>e==="length",zk=e=>e==="number",ax=e=>e==="family-name",ox=e=>e==="number"||e==="weight",cx=e=>e==="shadow",Lk=()=>{const e=ti("color"),t=ti("font"),n=ti("text"),s=ti("font-weight"),a=ti("tracking"),o=ti("leading"),c=ti("breakpoint"),f=ti("container"),d=ti("spacing"),h=ti("radius"),_=ti("shadow"),v=ti("inset-shadow"),b=ti("text-shadow"),y=ti("drop-shadow"),S=ti("blur"),A=ti("perspective"),R=ti("aspect"),D=ti("ease"),W=ti("animate"),j=()=>["auto","avoid","all","avoid-page","page","left","right","column"],I=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],J=()=>[...I(),ke,Ce],L=()=>["auto","hidden","clip","visible","scroll"],te=()=>["auto","contain","none"],X=()=>[ke,Ce,d],pe=()=>[Xr,"full","auto",...X()],G=()=>[Zr,"none","subgrid",ke,Ce],K=()=>["auto",{span:["full",Zr,ke,Ce]},Zr,ke,Ce],V=()=>[Zr,"auto",ke,Ce],z=()=>["auto","min","max","fr",ke,Ce],P=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],$=()=>["start","end","center","stretch","center-safe","end-safe"],C=()=>["auto",...X()],B=()=>[Xr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...X()],U=()=>[Xr,"screen","full","dvw","lvw","svw","min","max","fit",...X()],ce=()=>[Xr,"screen","full","lh","dvh","lvh","svh","min","max","fit",...X()],w=()=>[e,ke,Ce],T=()=>[...I(),Cv,wv,{position:[ke,Ce]}],q=()=>["no-repeat",{repeat:["","x","y","space","round"]}],k=()=>["auto","cover","contain",Dk,kk,{size:[ke,Ce]}],ie=()=>[Zf,Pa,Es],ue=()=>["","none","full",h,ke,Ce],le=()=>["",$e,Pa,Es],ve=()=>["solid","dashed","dotted","double"],Ee=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],oe=()=>[$e,Zf,Cv,wv],Ie=()=>["","none",S,ke,Ce],ot=()=>["none",$e,ke,Ce],yt=()=>["none",$e,ke,Ce],se=()=>[$e,ke,Ce],Oe=()=>[Xr,"full",...X()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[br],breakpoint:[br],color:[ix],container:[br],"drop-shadow":[br],ease:["in","out","in-out"],font:[Ck],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[br],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[br],shadow:[br],spacing:["px",$e],text:[br],"text-shadow":[br],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Xr,Ce,ke,R]}],container:["container"],columns:[{columns:[$e,Ce,ke,f]}],"break-after":[{"break-after":j()}],"break-before":[{"break-before":j()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:J()}],overflow:[{overflow:L()}],"overflow-x":[{"overflow-x":L()}],"overflow-y":[{"overflow-y":L()}],overscroll:[{overscroll:te()}],"overscroll-x":[{"overscroll-x":te()}],"overscroll-y":[{"overscroll-y":te()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:pe()}],"inset-x":[{"inset-x":pe()}],"inset-y":[{"inset-y":pe()}],start:[{"inset-s":pe(),start:pe()}],end:[{"inset-e":pe(),end:pe()}],"inset-bs":[{"inset-bs":pe()}],"inset-be":[{"inset-be":pe()}],top:[{top:pe()}],right:[{right:pe()}],bottom:[{bottom:pe()}],left:[{left:pe()}],visibility:["visible","invisible","collapse"],z:[{z:[Zr,"auto",ke,Ce]}],basis:[{basis:[Xr,"full","auto",f,...X()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[$e,Xr,"auto","initial","none",Ce]}],grow:[{grow:["",$e,ke,Ce]}],shrink:[{shrink:["",$e,ke,Ce]}],order:[{order:[Zr,"first","last","none",ke,Ce]}],"grid-cols":[{"grid-cols":G()}],"col-start-end":[{col:K()}],"col-start":[{"col-start":V()}],"col-end":[{"col-end":V()}],"grid-rows":[{"grid-rows":G()}],"row-start-end":[{row:K()}],"row-start":[{"row-start":V()}],"row-end":[{"row-end":V()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":z()}],"auto-rows":[{"auto-rows":z()}],gap:[{gap:X()}],"gap-x":[{"gap-x":X()}],"gap-y":[{"gap-y":X()}],"justify-content":[{justify:[...P(),"normal"]}],"justify-items":[{"justify-items":[...$(),"normal"]}],"justify-self":[{"justify-self":["auto",...$()]}],"align-content":[{content:["normal",...P()]}],"align-items":[{items:[...$(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...$(),{baseline:["","last"]}]}],"place-content":[{"place-content":P()}],"place-items":[{"place-items":[...$(),"baseline"]}],"place-self":[{"place-self":["auto",...$()]}],p:[{p:X()}],px:[{px:X()}],py:[{py:X()}],ps:[{ps:X()}],pe:[{pe:X()}],pbs:[{pbs:X()}],pbe:[{pbe:X()}],pt:[{pt:X()}],pr:[{pr:X()}],pb:[{pb:X()}],pl:[{pl:X()}],m:[{m:C()}],mx:[{mx:C()}],my:[{my:C()}],ms:[{ms:C()}],me:[{me:C()}],mbs:[{mbs:C()}],mbe:[{mbe:C()}],mt:[{mt:C()}],mr:[{mr:C()}],mb:[{mb:C()}],ml:[{ml:C()}],"space-x":[{"space-x":X()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":X()}],"space-y-reverse":["space-y-reverse"],size:[{size:B()}],"inline-size":[{inline:["auto",...U()]}],"min-inline-size":[{"min-inline":["auto",...U()]}],"max-inline-size":[{"max-inline":["none",...U()]}],"block-size":[{block:["auto",...ce()]}],"min-block-size":[{"min-block":["auto",...ce()]}],"max-block-size":[{"max-block":["none",...ce()]}],w:[{w:[f,"screen",...B()]}],"min-w":[{"min-w":[f,"screen","none",...B()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[c]},...B()]}],h:[{h:["screen","lh",...B()]}],"min-h":[{"min-h":["screen","lh","none",...B()]}],"max-h":[{"max-h":["screen","lh",...B()]}],"font-size":[{text:["base",n,Pa,Es]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,Mk,Ek]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Zf,Ce]}],"font-family":[{font:[Nk,Ak,t]}],"font-features":[{"font-features":[Ce]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,ke,Ce]}],"line-clamp":[{"line-clamp":[$e,"none",ke,Sv]}],leading:[{leading:[o,...X()]}],"list-image":[{"list-image":["none",ke,Ce]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ke,Ce]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:w()}],"text-color":[{text:w()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ve(),"wavy"]}],"text-decoration-thickness":[{decoration:[$e,"from-font","auto",ke,Es]}],"text-decoration-color":[{decoration:w()}],"underline-offset":[{"underline-offset":[$e,"auto",ke,Ce]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:X()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ke,Ce]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ke,Ce]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:T()}],"bg-repeat":[{bg:q()}],"bg-size":[{bg:k()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Zr,ke,Ce],radial:["",ke,Ce],conic:[Zr,ke,Ce]},Rk,Tk]}],"bg-color":[{bg:w()}],"gradient-from-pos":[{from:ie()}],"gradient-via-pos":[{via:ie()}],"gradient-to-pos":[{to:ie()}],"gradient-from":[{from:w()}],"gradient-via":[{via:w()}],"gradient-to":[{to:w()}],rounded:[{rounded:ue()}],"rounded-s":[{"rounded-s":ue()}],"rounded-e":[{"rounded-e":ue()}],"rounded-t":[{"rounded-t":ue()}],"rounded-r":[{"rounded-r":ue()}],"rounded-b":[{"rounded-b":ue()}],"rounded-l":[{"rounded-l":ue()}],"rounded-ss":[{"rounded-ss":ue()}],"rounded-se":[{"rounded-se":ue()}],"rounded-ee":[{"rounded-ee":ue()}],"rounded-es":[{"rounded-es":ue()}],"rounded-tl":[{"rounded-tl":ue()}],"rounded-tr":[{"rounded-tr":ue()}],"rounded-br":[{"rounded-br":ue()}],"rounded-bl":[{"rounded-bl":ue()}],"border-w":[{border:le()}],"border-w-x":[{"border-x":le()}],"border-w-y":[{"border-y":le()}],"border-w-s":[{"border-s":le()}],"border-w-e":[{"border-e":le()}],"border-w-bs":[{"border-bs":le()}],"border-w-be":[{"border-be":le()}],"border-w-t":[{"border-t":le()}],"border-w-r":[{"border-r":le()}],"border-w-b":[{"border-b":le()}],"border-w-l":[{"border-l":le()}],"divide-x":[{"divide-x":le()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":le()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ve(),"hidden","none"]}],"divide-style":[{divide:[...ve(),"hidden","none"]}],"border-color":[{border:w()}],"border-color-x":[{"border-x":w()}],"border-color-y":[{"border-y":w()}],"border-color-s":[{"border-s":w()}],"border-color-e":[{"border-e":w()}],"border-color-bs":[{"border-bs":w()}],"border-color-be":[{"border-be":w()}],"border-color-t":[{"border-t":w()}],"border-color-r":[{"border-r":w()}],"border-color-b":[{"border-b":w()}],"border-color-l":[{"border-l":w()}],"divide-color":[{divide:w()}],"outline-style":[{outline:[...ve(),"none","hidden"]}],"outline-offset":[{"outline-offset":[$e,ke,Ce]}],"outline-w":[{outline:["",$e,Pa,Es]}],"outline-color":[{outline:w()}],shadow:[{shadow:["","none",_,Wc,Fc]}],"shadow-color":[{shadow:w()}],"inset-shadow":[{"inset-shadow":["none",v,Wc,Fc]}],"inset-shadow-color":[{"inset-shadow":w()}],"ring-w":[{ring:le()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:w()}],"ring-offset-w":[{"ring-offset":[$e,Es]}],"ring-offset-color":[{"ring-offset":w()}],"inset-ring-w":[{"inset-ring":le()}],"inset-ring-color":[{"inset-ring":w()}],"text-shadow":[{"text-shadow":["none",b,Wc,Fc]}],"text-shadow-color":[{"text-shadow":w()}],opacity:[{opacity:[$e,ke,Ce]}],"mix-blend":[{"mix-blend":[...Ee(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Ee()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[$e]}],"mask-image-linear-from-pos":[{"mask-linear-from":oe()}],"mask-image-linear-to-pos":[{"mask-linear-to":oe()}],"mask-image-linear-from-color":[{"mask-linear-from":w()}],"mask-image-linear-to-color":[{"mask-linear-to":w()}],"mask-image-t-from-pos":[{"mask-t-from":oe()}],"mask-image-t-to-pos":[{"mask-t-to":oe()}],"mask-image-t-from-color":[{"mask-t-from":w()}],"mask-image-t-to-color":[{"mask-t-to":w()}],"mask-image-r-from-pos":[{"mask-r-from":oe()}],"mask-image-r-to-pos":[{"mask-r-to":oe()}],"mask-image-r-from-color":[{"mask-r-from":w()}],"mask-image-r-to-color":[{"mask-r-to":w()}],"mask-image-b-from-pos":[{"mask-b-from":oe()}],"mask-image-b-to-pos":[{"mask-b-to":oe()}],"mask-image-b-from-color":[{"mask-b-from":w()}],"mask-image-b-to-color":[{"mask-b-to":w()}],"mask-image-l-from-pos":[{"mask-l-from":oe()}],"mask-image-l-to-pos":[{"mask-l-to":oe()}],"mask-image-l-from-color":[{"mask-l-from":w()}],"mask-image-l-to-color":[{"mask-l-to":w()}],"mask-image-x-from-pos":[{"mask-x-from":oe()}],"mask-image-x-to-pos":[{"mask-x-to":oe()}],"mask-image-x-from-color":[{"mask-x-from":w()}],"mask-image-x-to-color":[{"mask-x-to":w()}],"mask-image-y-from-pos":[{"mask-y-from":oe()}],"mask-image-y-to-pos":[{"mask-y-to":oe()}],"mask-image-y-from-color":[{"mask-y-from":w()}],"mask-image-y-to-color":[{"mask-y-to":w()}],"mask-image-radial":[{"mask-radial":[ke,Ce]}],"mask-image-radial-from-pos":[{"mask-radial-from":oe()}],"mask-image-radial-to-pos":[{"mask-radial-to":oe()}],"mask-image-radial-from-color":[{"mask-radial-from":w()}],"mask-image-radial-to-color":[{"mask-radial-to":w()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":I()}],"mask-image-conic-pos":[{"mask-conic":[$e]}],"mask-image-conic-from-pos":[{"mask-conic-from":oe()}],"mask-image-conic-to-pos":[{"mask-conic-to":oe()}],"mask-image-conic-from-color":[{"mask-conic-from":w()}],"mask-image-conic-to-color":[{"mask-conic-to":w()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:T()}],"mask-repeat":[{mask:q()}],"mask-size":[{mask:k()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ke,Ce]}],filter:[{filter:["","none",ke,Ce]}],blur:[{blur:Ie()}],brightness:[{brightness:[$e,ke,Ce]}],contrast:[{contrast:[$e,ke,Ce]}],"drop-shadow":[{"drop-shadow":["","none",y,Wc,Fc]}],"drop-shadow-color":[{"drop-shadow":w()}],grayscale:[{grayscale:["",$e,ke,Ce]}],"hue-rotate":[{"hue-rotate":[$e,ke,Ce]}],invert:[{invert:["",$e,ke,Ce]}],saturate:[{saturate:[$e,ke,Ce]}],sepia:[{sepia:["",$e,ke,Ce]}],"backdrop-filter":[{"backdrop-filter":["","none",ke,Ce]}],"backdrop-blur":[{"backdrop-blur":Ie()}],"backdrop-brightness":[{"backdrop-brightness":[$e,ke,Ce]}],"backdrop-contrast":[{"backdrop-contrast":[$e,ke,Ce]}],"backdrop-grayscale":[{"backdrop-grayscale":["",$e,ke,Ce]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[$e,ke,Ce]}],"backdrop-invert":[{"backdrop-invert":["",$e,ke,Ce]}],"backdrop-opacity":[{"backdrop-opacity":[$e,ke,Ce]}],"backdrop-saturate":[{"backdrop-saturate":[$e,ke,Ce]}],"backdrop-sepia":[{"backdrop-sepia":["",$e,ke,Ce]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":X()}],"border-spacing-x":[{"border-spacing-x":X()}],"border-spacing-y":[{"border-spacing-y":X()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ke,Ce]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[$e,"initial",ke,Ce]}],ease:[{ease:["linear","initial",D,ke,Ce]}],delay:[{delay:[$e,ke,Ce]}],animate:[{animate:["none",W,ke,Ce]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[A,ke,Ce]}],"perspective-origin":[{"perspective-origin":J()}],rotate:[{rotate:ot()}],"rotate-x":[{"rotate-x":ot()}],"rotate-y":[{"rotate-y":ot()}],"rotate-z":[{"rotate-z":ot()}],scale:[{scale:yt()}],"scale-x":[{"scale-x":yt()}],"scale-y":[{"scale-y":yt()}],"scale-z":[{"scale-z":yt()}],"scale-3d":["scale-3d"],skew:[{skew:se()}],"skew-x":[{"skew-x":se()}],"skew-y":[{"skew-y":se()}],transform:[{transform:[ke,Ce,"","none","gpu","cpu"]}],"transform-origin":[{origin:J()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Oe()}],"translate-x":[{"translate-x":Oe()}],"translate-y":[{"translate-y":Oe()}],"translate-z":[{"translate-z":Oe()}],"translate-none":["translate-none"],accent:[{accent:w()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:w()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ke,Ce]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":X()}],"scroll-mx":[{"scroll-mx":X()}],"scroll-my":[{"scroll-my":X()}],"scroll-ms":[{"scroll-ms":X()}],"scroll-me":[{"scroll-me":X()}],"scroll-mbs":[{"scroll-mbs":X()}],"scroll-mbe":[{"scroll-mbe":X()}],"scroll-mt":[{"scroll-mt":X()}],"scroll-mr":[{"scroll-mr":X()}],"scroll-mb":[{"scroll-mb":X()}],"scroll-ml":[{"scroll-ml":X()}],"scroll-p":[{"scroll-p":X()}],"scroll-px":[{"scroll-px":X()}],"scroll-py":[{"scroll-py":X()}],"scroll-ps":[{"scroll-ps":X()}],"scroll-pe":[{"scroll-pe":X()}],"scroll-pbs":[{"scroll-pbs":X()}],"scroll-pbe":[{"scroll-pbe":X()}],"scroll-pt":[{"scroll-pt":X()}],"scroll-pr":[{"scroll-pr":X()}],"scroll-pb":[{"scroll-pb":X()}],"scroll-pl":[{"scroll-pl":X()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ke,Ce]}],fill:[{fill:["none",...w()]}],"stroke-w":[{stroke:[$e,Pa,Es,Sv]}],stroke:[{stroke:["none",...w()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Ok=dk(Lk);function ui(...e){return Ok(YC(e))}function kv({agent:e,passthrough:t}){const n=zl(e.status),s=n==="AwaitingApproval",a=n==="Processing",o=n==="Idle",c=N.useCallback(async()=>{try{await we.approve(e.target)}catch{}},[e.target]),f=N.useCallback(async()=>{try{await we.sendKey(e.target,"Escape")}catch{}},[e.target]),d=N.useCallback(async()=>{try{await we.killAgent(e.target)}catch{}},[e.target]);return N.useEffect(()=>{const h=_=>{_.ctrlKey&&_.key==="Enter"&&s&&(_.preventDefault(),c())};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[s,c]),g.jsxs("div",{className:"glass flex items-center gap-2 border-0 border-b border-white/5 px-3 py-2",children:[g.jsx("span",{className:"text-sm font-medium text-zinc-300",children:e.display_name}),g.jsx("span",{className:ui("rounded px-1.5 py-0.5 text-xs",s&&"bg-red-500/20 text-red-400",a&&"bg-cyan-500/20 text-cyan-400",o&&"bg-zinc-500/20 text-zinc-400",!s&&!a&&!o&&"bg-zinc-700/50 text-zinc-400"),children:n}),g.jsx("div",{className:"flex-1"}),s&&!t&&g.jsxs(g.Fragment,{children:[g.jsx("button",{type:"button",onClick:c,className:"rounded-md bg-emerald-500/20 px-3 py-1 text-xs font-medium text-emerald-400 transition-colors hover:bg-emerald-500/30",title:"Ctrl+Enter",children:"Approve"}),g.jsx("button",{type:"button",onClick:f,className:"glass-card rounded-md px-3 py-1 text-xs font-medium text-zinc-300 transition-colors",children:"Reject"})]}),g.jsx("button",{type:"button",onClick:d,className:"rounded-md px-2 py-1 text-xs text-zinc-600 transition-colors hover:text-red-400",title:"Kill agent",children:"Kill"})]})}const Ev={Processing:"bg-cyan-500/20 text-cyan-400 border-cyan-500/30",AwaitingApproval:"bg-red-500/20 text-red-400 border-red-500/30",Idle:"bg-zinc-500/20 text-zinc-400 border-zinc-500/30",Error:"bg-red-500/20 text-red-300 border-red-500/30",Offline:"bg-zinc-500/20 text-zinc-600 border-zinc-500/30",Unknown:"bg-zinc-500/20 text-zinc-500 border-zinc-500/30"},Bk={Processing:"glow-cyan",AwaitingApproval:"glow-red"};function jk(e){return e==="ClaudeCode"?{icon:"⬡",label:"Claude",color:"text-orange-400"}:e==="CodexCli"?{icon:"◆",label:"Codex",color:"text-green-400"}:e==="GeminiCli"?{icon:"✦",label:"Gemini",color:"text-blue-400"}:e==="OpenCode"?{icon:"◇",label:"OpenCode",color:"text-purple-400"}:typeof e=="object"&&"Custom"in e?{icon:"›",label:e.Custom,color:"text-zinc-400"}:{icon:"›",label:"agent",color:"text-zinc-400"}}function Av(e){const t=e.toLowerCase();return t.includes("opus")?{color:"text-amber-400/80",glow:"drop-shadow-[0_0_3px_rgba(251,191,36,0.3)]"}:t.includes("sonnet")?{color:"text-violet-400/80",glow:"drop-shadow-[0_0_3px_rgba(167,139,250,0.2)]"}:t.includes("haiku")?{color:"text-emerald-400/70",glow:""}:{color:"text-zinc-500",glow:""}}function Hk(e,t,n){const s=[];e.has_hook&&s.push("Hook"),e.has_websocket&&s.push("WebSocket"),e.has_ipc&&s.push("IPC"),e.has_tmux&&s.push("tmux"),s.length===0&&s.push("None");const o={Ipc:"IPC",Tmux:"tmux",PtyInject:"PTY inject",None:"None"}[n]??n,c=t==="HttpHook"?"Hook":t==="IpcSocket"?"IPC":t==="WebSocket"?"WebSocket":"tmux";return`Detect: ${s.join(" + ")} (active: ${c})
Send: ${o}`}function Ik(e){return e.auto_approve_override!==null&&e.auto_approve_override!==void 0?e.auto_approve_override:!0}function qc({label:e,active:t,activeColor:n}){return g.jsx("span",{className:ui("rounded-sm px-1 py-px text-[9px] font-medium leading-tight transition-subtle",t?`${n} border border-current/20`:"text-zinc-700 border border-zinc-800"),children:e})}function Pk({agent:e,selected:t,onClick:n}){const s=zl(e.status),a=ho(e.status),o=jk(e.agent_type),c=Id(e.agent_type),f=e.auto_approve_override!==null&&e.auto_approve_override!==void 0,d=Ik(e),h=e.auto_approve_phase,_=h==="Judging",v=h==="ApprovedByRule"||h==="ApprovedByAi",b=_?"Judging":v?"Approved":s,y=_?"bg-amber-500/20 text-amber-400 border-amber-500/30":v?"bg-emerald-500/20 text-emerald-400 border-emerald-500/30":Ev[s]??Ev.Unknown,S=_||v?"":Bk[s]??"",A=e.connection_channels??{has_tmux:e.detection_source==="CapturePane"||e.send_capability==="Tmux",has_ipc:e.detection_source==="IpcSocket"||e.send_capability==="Ipc",has_hook:e.detection_source==="HttpHook",has_websocket:e.detection_source==="WebSocket"},R=c?Hk(A,e.detection_source,e.send_capability):void 0;function D(W){W.stopPropagation();let j;e.auto_approve_override===null||e.auto_approve_override===void 0?j=!1:e.auto_approve_override===!1?j=!0:j=null,we.setAutoApprove(e.target,j)}return g.jsxs("button",{type:"button",onClick:n,className:ui("glass-card group w-full rounded-xl px-3 py-2 text-left transition-subtle","hover:bg-white/[0.08] hover:border-white/10",t&&"!border-cyan-500/30 !bg-cyan-500/10",a&&"!border-amber-500/30 animate-glow-pulse",S&&t&&S),children:[g.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g.jsx("div",{className:"flex items-center gap-1.5 truncate",children:g.jsxs("span",{className:"truncate text-sm font-medium text-zinc-200 group-hover:text-zinc-100 transition-subtle",children:[c?o.label:e.display_name||o.label,c&&e.model_display_name&&g.jsx("span",{className:ui("ml-1.5 text-[10px] font-medium tracking-wide transition-subtle",Av(e.model_display_name).color,Av(e.model_display_name).glow),children:e.model_display_name})]})}),g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx("button",{type:"button",onClick:D,className:ui("shrink-0 cursor-pointer rounded px-1 py-0.5 text-[10px] transition-subtle",!f&&"text-zinc-600 hover:text-zinc-400 hover:bg-white/5",f&&d&&"text-emerald-400 bg-emerald-500/10 hover:bg-emerald-500/15",f&&!d&&"text-red-400 bg-red-500/10 hover:bg-red-500/15"),title:f?d?"Auto-approve: ON (click to cycle)":"Auto-approve: OFF (click to cycle)":"Auto-approve: global default (click to override)",children:f?d?"⚡on":"⚡off":"⚡"}),g.jsx("span",{className:ui("shrink-0 rounded-md border px-1.5 py-0.5 text-[10px] font-medium transition-subtle",y),children:b})]})]}),g.jsxs("div",{className:"mt-1 flex items-center gap-1 text-xs text-zinc-500 transition-subtle group-hover:text-zinc-400",children:[c&&g.jsxs("div",{className:"flex items-center gap-0.5",title:R,children:[(A.has_hook||A.has_websocket)&&g.jsx(qc,{label:A.has_websocket?"WS":"Hook",active:A.has_hook||A.has_websocket,activeColor:"text-cyan-400"}),(A.has_ipc||A.has_hook||A.has_websocket||A.has_tmux)&&g.jsx(qc,{label:"IPC",active:A.has_ipc,activeColor:"text-emerald-400"}),A.has_tmux&&g.jsx(qc,{label:"tmux",active:A.has_tmux,activeColor:"text-yellow-400"}),!A.has_hook&&!A.has_websocket&&!A.has_ipc&&!A.has_tmux&&g.jsx(qc,{label:"--",active:!1,activeColor:""})]}),g.jsx("div",{className:"flex-1"}),e.git_branch?g.jsxs("span",{className:ui("truncate text-right",e.is_worktree?"text-emerald-600":"text-zinc-600","group-hover:text-zinc-500 transition-subtle"),title:`${e.is_worktree?"worktree: ":"branch: "}${e.git_branch}${e.git_dirty?" (dirty)":""}`,children:[e.is_worktree&&"🌿",e.git_branch,e.git_dirty&&g.jsx("span",{className:"text-amber-500",children:"*"})]}):g.jsx("span",{className:"truncate text-right text-zinc-600 group-hover:text-zinc-500 transition-subtle",title:e.cwd,children:e.display_cwd}),e.active_subagents>0&&g.jsxs("span",{className:"shrink-0 text-zinc-600 group-hover:text-zinc-400 transition-subtle",children:["⑂",e.active_subagents]}),e.compaction_count>0&&g.jsxs("span",{className:"shrink-0 text-zinc-600 group-hover:text-zinc-400 transition-subtle",children:["♻",e.compaction_count]})]})]})}function Uk({project:e,selection:t,onSelectAgent:n,onSelectProject:s,onSelectMarkdown:a,onSpawned:o}){const[c,f]=N.useState(!1),[d,h]=N.useState(!1),[_,v]=N.useState(!1),b=N.useRef(null);N.useEffect(()=>{if(!d)return;const K=V=>{b.current&&!b.current.contains(V.target)&&h(!1)};return document.addEventListener("mousedown",K),()=>document.removeEventListener("mousedown",K)},[d]);const y=e.worktrees.find(K=>!K.isWorktree),S=(y==null?void 0:y.branch)??null,A=(y==null?void 0:y.dirty)??!1,R=e.worktrees.filter(K=>K.isWorktree).length,D=e.worktrees.filter(K=>K.isWorktree).some(K=>K.dirty),W=(t==null?void 0:t.type)==="agent"?t.id:null,j=(t==null?void 0:t.type)==="project"&&t.path===e.path,I=(t==null?void 0:t.type)==="markdown"&&t.projectPath===e.path,J=Vy(),L=N.useCallback(async(K,V,z,P)=>{if(!_&&!(z&&K!=="bash"&&!await J({title:"Agent Active",message:`An agent is already active here. Launch ${K} anyway?`,confirmLabel:`Launch ${K}`,variant:"danger"}))){v(!0),h(!1);try{const $=await we.spawnPty({command:K,args:P,cwd:V});o($.session_id)}catch{}finally{v(!1)}}},[_,J,o]),te={name:"main",path:e.path,branch:null,isWorktree:!1,dirty:!1,agents:[]},X=e.worktrees.length>0?e.worktrees:[te],pe=X.length>1||X.length===1&&X[0].isWorktree,G=e.totalAgents===0;return g.jsxs("div",{className:"mb-1",children:[g.jsxs("div",{className:"flex w-full items-center gap-1 rounded-lg px-2 py-1.5 transition-colors hover:bg-white/5",children:[g.jsxs("button",{type:"button",onClick:()=>f(K=>!K),className:"flex flex-1 items-center gap-2 text-left min-w-0",children:[g.jsx("span",{className:ui("text-[10px] text-zinc-600 transition-transform shrink-0",c&&"-rotate-90"),children:"▼"}),g.jsxs("div",{className:"min-w-0",children:[g.jsx("span",{className:ui("block truncate text-xs font-semibold",G?"text-zinc-500":"text-zinc-300"),children:e.name}),g.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[S&&g.jsxs("span",{className:"truncate text-[10px] text-zinc-500",children:[S,A&&g.jsx("span",{className:"text-amber-500",children:"*"})]}),R>0&&g.jsxs("span",{className:"flex items-center gap-0.5 text-[10px] text-emerald-600",children:[g.jsx("span",{children:"🌿"}),g.jsxs("span",{children:["×",R]}),D&&g.jsx("span",{className:"text-amber-500",children:"*"})]})]})]})]}),g.jsxs("div",{className:"flex items-center gap-1.5",children:[e.totalAgents>0&&g.jsx("span",{className:"text-[10px] text-zinc-600",children:e.totalAgents}),e.attentionAgents>0&&g.jsx("span",{className:"rounded-full bg-amber-500/15 px-1.5 py-0.5 text-[10px] text-amber-400",children:e.attentionAgents}),g.jsx("button",{type:"button",onClick:()=>s(e.path,e.name),className:ui("rounded px-1 py-0.5 transition-colors",j?"text-emerald-400 bg-emerald-500/10":"text-zinc-600 hover:text-emerald-400 hover:bg-emerald-500/10"),title:"Branch graph",children:g.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",className:"inline-block",role:"img","aria-label":"Branch graph",children:[g.jsx("title",{children:"Branch graph"}),g.jsx("circle",{cx:"4",cy:"4",r:"2",fill:"currentColor"}),g.jsx("circle",{cx:"4",cy:"12",r:"2",fill:"currentColor"}),g.jsx("circle",{cx:"12",cy:"8",r:"2",fill:"currentColor"}),g.jsx("line",{x1:"4",y1:"6",x2:"4",y2:"10",stroke:"currentColor",strokeWidth:"1.5"}),g.jsx("path",{d:"M4 6 C4 8, 8 8, 12 8",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})]})}),g.jsx("button",{type:"button",onClick:K=>{K.stopPropagation(),a(e.path,e.name)},className:ui("rounded px-1 py-0.5 transition-colors",I?"text-blue-400 bg-blue-500/10":"text-zinc-600 hover:text-blue-400 hover:bg-blue-500/10"),title:"Markdown files",children:g.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",className:"inline-block",role:"img","aria-label":"Markdown files",children:[g.jsx("title",{children:"Markdown files"}),g.jsx("rect",{x:"2",y:"1",width:"12",height:"14",rx:"1",stroke:"currentColor",strokeWidth:"1.5",fill:"none"}),g.jsx("text",{x:"8",y:"11",textAnchor:"middle",fill:"currentColor",fontSize:"7",fontWeight:"bold",children:"M"})]})}),g.jsxs("div",{className:"relative",ref:b,children:[g.jsx("button",{type:"button",onClick:()=>h(K=>!K),disabled:_,className:"rounded px-1 py-0.5 text-xs text-zinc-500 transition-colors hover:bg-white/10 hover:text-cyan-400 disabled:opacity-50",title:"Spawn agent",children:"+"}),d&&g.jsx("div",{className:"absolute right-0 top-full z-10 mt-1 flex flex-col gap-0.5 rounded-lg border border-white/10 bg-zinc-900 p-1 shadow-lg min-w-[140px]",children:pe?X.map(K=>{const V=K.agents.length>0;return g.jsxs("div",{children:[g.jsxs("div",{className:"px-2 py-0.5 text-[10px] text-zinc-500 truncate",children:[K.isWorktree?"🌿 ":"",K.branch||K.name,V&&g.jsx("span",{className:"ml-1 text-amber-500",title:"Agent active",children:"●"})]}),g.jsx("div",{className:"flex gap-0.5 px-1 pb-0.5",children:["claude","codex","bash"].map(z=>g.jsx("button",{type:"button",onClick:()=>L(z,K.path,V),className:"flex-1 whitespace-nowrap rounded px-2 py-0.5 text-center text-[11px] text-zinc-400 transition-colors hover:bg-white/10 hover:text-cyan-400",children:z},`${K.name}-${z}`))})]},K.name)}):(()=>{var V,z;const K=((z=(V=X[0])==null?void 0:V.agents)==null?void 0:z.length)>0;return["claude","codex","bash"].map(P=>g.jsx("button",{type:"button",onClick:()=>L(P,X[0].path,K),className:"whitespace-nowrap rounded px-3 py-1 text-left text-xs text-zinc-300 transition-colors hover:bg-white/10 hover:text-cyan-400",children:P},P))})()})]})]})]}),!c&&g.jsxs("div",{className:"ml-1 border-l border-white/5 pl-2",children:[e.worktrees.map(K=>g.jsx(Fk,{worktree:K,selectedTarget:W,onSelect:n},K.name)),G&&g.jsx("div",{className:"px-2 py-2 text-[11px] text-zinc-600",children:"No agents — click + to spawn"})]})]})}function Fk({worktree:e,selectedTarget:t,onSelect:n}){return g.jsx("div",{className:"mb-0.5",children:g.jsx("div",{className:"flex flex-col gap-1",children:e.agents.map(s=>g.jsx(Pk,{agent:s,selected:s.id===t,onClick:()=>n(s.id)},s.id))})})}function Wk({agents:e,loading:t,selection:n,onSelectAgent:s,onSelectProject:a,onSelectMarkdown:o,registeredProjects:c,worktrees:f,onSpawned:d}){const h=N.useMemo(()=>BC(e,c,f),[e,c,f]);return t?g.jsx("div",{className:"flex flex-1 items-center justify-center text-sm text-zinc-500",children:"Initializing..."}):e.length===0&&c.length===0?g.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 px-4 text-center text-sm text-zinc-500",children:[g.jsx("p",{children:"No projects registered"}),g.jsxs("p",{className:"text-xs text-zinc-600",children:["Add projects in ",g.jsx("code",{className:"rounded bg-white/5 px-1",children:"config.toml"})," or run"," ",g.jsx("code",{className:"rounded bg-white/5 px-1",children:"tmai init"})]})]}):g.jsx("div",{className:"flex flex-1 flex-col overflow-y-auto p-2",children:h.map(_=>g.jsx(Uk,{project:_,selection:n,onSelectAgent:s,onSelectProject:a,onSelectMarkdown:o,onSpawned:d},_.path))})}var Qf=function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},vt;(function(e){e[e.EOS=0]="EOS",e[e.Text=1]="Text",e[e.Incomplete=2]="Incomplete",e[e.ESC=3]="ESC",e[e.Unknown=4]="Unknown",e[e.SGR=5]="SGR",e[e.OSCURL=6]="OSCURL"})(vt||(vt={}));class qk{constructor(){this.VERSION="6.0.6",this.setup_palettes(),this._use_classes=!1,this.bold=!1,this.faint=!1,this.italic=!1,this.underline=!1,this.fg=this.bg=null,this._buffer="",this._url_allowlist={http:1,https:1},this._escape_html=!0,this.boldStyle="font-weight:bold",this.faintStyle="opacity:0.7",this.italicStyle="font-style:italic",this.underlineStyle="text-decoration:underline"}set use_classes(t){this._use_classes=t}get use_classes(){return this._use_classes}set url_allowlist(t){this._url_allowlist=t}get url_allowlist(){return this._url_allowlist}set escape_html(t){this._escape_html=t}get escape_html(){return this._escape_html}set boldStyle(t){this._boldStyle=t}get boldStyle(){return this._boldStyle}set faintStyle(t){this._faintStyle=t}get faintStyle(){return this._faintStyle}set italicStyle(t){this._italicStyle=t}get italicStyle(){return this._italicStyle}set underlineStyle(t){this._underlineStyle=t}get underlineStyle(){return this._underlineStyle}setup_palettes(){this.ansi_colors=[[{rgb:[0,0,0],class_name:"ansi-black"},{rgb:[187,0,0],class_name:"ansi-red"},{rgb:[0,187,0],class_name:"ansi-green"},{rgb:[187,187,0],class_name:"ansi-yellow"},{rgb:[0,0,187],class_name:"ansi-blue"},{rgb:[187,0,187],class_name:"ansi-magenta"},{rgb:[0,187,187],class_name:"ansi-cyan"},{rgb:[255,255,255],class_name:"ansi-white"}],[{rgb:[85,85,85],class_name:"ansi-bright-black"},{rgb:[255,85,85],class_name:"ansi-bright-red"},{rgb:[0,255,0],class_name:"ansi-bright-green"},{rgb:[255,255,85],class_name:"ansi-bright-yellow"},{rgb:[85,85,255],class_name:"ansi-bright-blue"},{rgb:[255,85,255],class_name:"ansi-bright-magenta"},{rgb:[85,255,255],class_name:"ansi-bright-cyan"},{rgb:[255,255,255],class_name:"ansi-bright-white"}]],this.palette_256=[],this.ansi_colors.forEach(s=>{s.forEach(a=>{this.palette_256.push(a)})});let t=[0,95,135,175,215,255];for(let s=0;s<6;++s)for(let a=0;a<6;++a)for(let o=0;o<6;++o){let c={rgb:[t[s],t[a],t[o]],class_name:"truecolor"};this.palette_256.push(c)}let n=8;for(let s=0;s<24;++s,n+=10){let a={rgb:[n,n,n],class_name:"truecolor"};this.palette_256.push(a)}}escape_txt_for_html(t){return this._escape_html?t.replace(/[&<>"']/gm,n=>{if(n==="&")return"&amp;";if(n==="<")return"&lt;";if(n===">")return"&gt;";if(n==='"')return"&quot;";if(n==="'")return"&#x27;"}):t}append_buffer(t){var n=this._buffer+t;this._buffer=n}get_next_packet(){var t={kind:vt.EOS,text:"",url:""},n=this._buffer.length;if(n==0)return t;var s=this._buffer.indexOf("\x1B");if(s==-1)return t.kind=vt.Text,t.text=this._buffer,this._buffer="",t;if(s>0)return t.kind=vt.Text,t.text=this._buffer.slice(0,s),this._buffer=this._buffer.slice(s),t;if(s==0){if(n<3)return t.kind=vt.Incomplete,t;var a=this._buffer.charAt(1);if(a!="["&&a!="]"&&a!="(")return t.kind=vt.ESC,t.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),t;if(a=="["){this._csi_regex||(this._csi_regex=Tv(Nv||(Nv=Qf([`
                        ^                           # beginning of line
                                                    #
                                                    # First attempt
                        (?:                         # legal sequence
                          \x1B[                      # CSI
                          ([<-?]?)              # private-mode char
                          ([d;]*)                    # any digits or semicolons
                          ([ -/]?               # an intermediate modifier
                          [@-~])                # the command
                        )
                        |                           # alternate (second attempt)
                        (?:                         # illegal sequence
                          \x1B[                      # CSI
                          [ -~]*                # anything legal
                          ([\0-:])              # anything illegal
                        )
                    `],[`
                        ^                           # beginning of line
                                                    #
                                                    # First attempt
                        (?:                         # legal sequence
                          \\x1b\\[                      # CSI
                          ([\\x3c-\\x3f]?)              # private-mode char
                          ([\\d;]*)                    # any digits or semicolons
                          ([\\x20-\\x2f]?               # an intermediate modifier
                          [\\x40-\\x7e])                # the command
                        )
                        |                           # alternate (second attempt)
                        (?:                         # illegal sequence
                          \\x1b\\[                      # CSI
                          [\\x20-\\x7e]*                # anything legal
                          ([\\x00-\\x1f:])              # anything illegal
                        )
                    `]))));let c=this._buffer.match(this._csi_regex);if(c===null)return t.kind=vt.Incomplete,t;if(c[4])return t.kind=vt.ESC,t.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),t;c[1]!=""||c[3]!="m"?t.kind=vt.Unknown:t.kind=vt.SGR,t.text=c[2];var o=c[0].length;return this._buffer=this._buffer.slice(o),t}else if(a=="]"){if(n<4)return t.kind=vt.Incomplete,t;if(this._buffer.charAt(2)!="8"||this._buffer.charAt(3)!=";")return t.kind=vt.ESC,t.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),t;this._osc_st||(this._osc_st=$k(Dv||(Dv=Qf([`
                        (?:                         # legal sequence
                          (\x1B\\)                    # ESC                           |                           # alternate
                          (\x07)                      # BEL (what xterm did)
                        )
                        |                           # alternate (second attempt)
                        (                           # illegal sequence
                          [\0-]                 # anything illegal
                          |                           # alternate
                          [\b-]                 # anything illegal
                          |                           # alternate
                          [-]                 # anything illegal
                        )
                    `],[`
                        (?:                         # legal sequence
                          (\\x1b\\\\)                    # ESC \\
                          |                           # alternate
                          (\\x07)                      # BEL (what xterm did)
                        )
                        |                           # alternate (second attempt)
                        (                           # illegal sequence
                          [\\x00-\\x06]                 # anything illegal
                          |                           # alternate
                          [\\x08-\\x1a]                 # anything illegal
                          |                           # alternate
                          [\\x1c-\\x1f]                 # anything illegal
                        )
                    `])))),this._osc_st.lastIndex=0;{let d=this._osc_st.exec(this._buffer);if(d===null)return t.kind=vt.Incomplete,t;if(d[3])return t.kind=vt.ESC,t.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),t}{let d=this._osc_st.exec(this._buffer);if(d===null)return t.kind=vt.Incomplete,t;if(d[3])return t.kind=vt.ESC,t.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),t}this._osc_regex||(this._osc_regex=Tv(Rv||(Rv=Qf([`
                        ^                           # beginning of line
                                                    #
                        \x1B]8;                    # OSC Hyperlink
                        [ -:<-~]*       # params (excluding ;)
                        ;                           # end of params
                        ([!-~]{0,512})        # URL capture
                        (?:                         # ST
                          (?:\x1B\\)                  # ESC                           |                           # alternate
                          (?:\x07)                    # BEL (what xterm did)
                        )
                        ([ -~]+)              # TEXT capture
                        \x1B]8;;                   # OSC Hyperlink End
                        (?:                         # ST
                          (?:\x1B\\)                  # ESC                           |                           # alternate
                          (?:\x07)                    # BEL (what xterm did)
                        )
                    `],[`
                        ^                           # beginning of line
                                                    #
                        \\x1b\\]8;                    # OSC Hyperlink
                        [\\x20-\\x3a\\x3c-\\x7e]*       # params (excluding ;)
                        ;                           # end of params
                        ([\\x21-\\x7e]{0,512})        # URL capture
                        (?:                         # ST
                          (?:\\x1b\\\\)                  # ESC \\
                          |                           # alternate
                          (?:\\x07)                    # BEL (what xterm did)
                        )
                        ([\\x20-\\x7e]+)              # TEXT capture
                        \\x1b\\]8;;                   # OSC Hyperlink End
                        (?:                         # ST
                          (?:\\x1b\\\\)                  # ESC \\
                          |                           # alternate
                          (?:\\x07)                    # BEL (what xterm did)
                        )
                    `]))));let c=this._buffer.match(this._osc_regex);if(c===null)return t.kind=vt.ESC,t.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),t;t.kind=vt.OSCURL,t.url=c[1],t.text=c[2];var o=c[0].length;return this._buffer=this._buffer.slice(o),t}else if(a=="(")return t.kind=vt.Unknown,this._buffer=this._buffer.slice(3),t}}ansi_to_html(t){this.append_buffer(t);for(var n=[];;){var s=this.get_next_packet();if(s.kind==vt.EOS||s.kind==vt.Incomplete)break;s.kind==vt.ESC||s.kind==vt.Unknown||(s.kind==vt.Text?n.push(this.transform_to_html(this.with_state(s))):s.kind==vt.SGR?this.process_ansi(s):s.kind==vt.OSCURL&&n.push(this.process_hyperlink(s)))}return n.join("")}with_state(t){return{bold:this.bold,faint:this.faint,italic:this.italic,underline:this.underline,fg:this.fg,bg:this.bg,text:t.text}}process_ansi(t){let n=t.text.split(";");for(;n.length>0;){let s=n.shift(),a=parseInt(s,10);if(isNaN(a)||a===0)this.fg=null,this.bg=null,this.bold=!1,this.faint=!1,this.italic=!1,this.underline=!1;else if(a===1)this.bold=!0;else if(a===2)this.faint=!0;else if(a===3)this.italic=!0;else if(a===4)this.underline=!0;else if(a===21)this.bold=!1;else if(a===22)this.faint=!1,this.bold=!1;else if(a===23)this.italic=!1;else if(a===24)this.underline=!1;else if(a===39)this.fg=null;else if(a===49)this.bg=null;else if(a>=30&&a<38)this.fg=this.ansi_colors[0][a-30];else if(a>=40&&a<48)this.bg=this.ansi_colors[0][a-40];else if(a>=90&&a<98)this.fg=this.ansi_colors[1][a-90];else if(a>=100&&a<108)this.bg=this.ansi_colors[1][a-100];else if((a===38||a===48)&&n.length>0){let o=a===38,c=n.shift();if(c==="5"&&n.length>0){let f=parseInt(n.shift(),10);f>=0&&f<=255&&(o?this.fg=this.palette_256[f]:this.bg=this.palette_256[f])}if(c==="2"&&n.length>2){let f=parseInt(n.shift(),10),d=parseInt(n.shift(),10),h=parseInt(n.shift(),10);if(f>=0&&f<=255&&d>=0&&d<=255&&h>=0&&h<=255){let _={rgb:[f,d,h],class_name:"truecolor"};o?this.fg=_:this.bg=_}}}}}transform_to_html(t){let n=t.text;if(n.length===0||(n=this.escape_txt_for_html(n),!t.bold&&!t.italic&&!t.faint&&!t.underline&&t.fg===null&&t.bg===null))return n;let s=[],a=[],o=t.fg,c=t.bg;t.bold&&s.push(this._boldStyle),t.faint&&s.push(this._faintStyle),t.italic&&s.push(this._italicStyle),t.underline&&s.push(this._underlineStyle),this._use_classes?(o&&(o.class_name!=="truecolor"?a.push(`${o.class_name}-fg`):s.push(`color:rgb(${o.rgb.join(",")})`)),c&&(c.class_name!=="truecolor"?a.push(`${c.class_name}-bg`):s.push(`background-color:rgb(${c.rgb.join(",")})`))):(o&&s.push(`color:rgb(${o.rgb.join(",")})`),c&&s.push(`background-color:rgb(${c.rgb})`));let f="",d="";return a.length&&(f=` class="${a.join(" ")}"`),s.length&&(d=` style="${s.join(";")}"`),`<span${d}${f}>${n}</span>`}process_hyperlink(t){let n=t.url.split(":");return n.length<1||!this._url_allowlist[n[0]]?"":`<a href="${this.escape_txt_for_html(t.url)}">${this.escape_txt_for_html(t.text)}</a>`}}function Tv(e,...t){let n=e.raw[0],s=/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm,a=n.replace(s,"");return new RegExp(a)}function $k(e,...t){let n=e.raw[0],s=/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm,a=n.replace(s,"");return new RegExp(a,"g")}var Nv,Dv,Rv;/*! @license DOMPurify 3.3.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.3/LICENSE */const{entries:ux,setPrototypeOf:Mv,isFrozen:Yk,getPrototypeOf:Vk,getOwnPropertyDescriptor:Gk}=Object;let{freeze:Mi,seal:Nn,create:ru}=Object,{apply:Wd,construct:qd}=typeof Reflect<"u"&&Reflect;Mi||(Mi=function(t){return t});Nn||(Nn=function(t){return t});Wd||(Wd=function(t,n){for(var s=arguments.length,a=new Array(s>2?s-2:0),o=2;o<s;o++)a[o-2]=arguments[o];return t.apply(n,a)});qd||(qd=function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),a=1;a<n;a++)s[a-1]=arguments[a];return new t(...s)});const $c=zi(Array.prototype.forEach),Kk=zi(Array.prototype.lastIndexOf),zv=zi(Array.prototype.pop),Ua=zi(Array.prototype.push),Xk=zi(Array.prototype.splice),su=zi(String.prototype.toLowerCase),Jf=zi(String.prototype.toString),ed=zi(String.prototype.match),Fa=zi(String.prototype.replace),Zk=zi(String.prototype.indexOf),Qk=zi(String.prototype.trim),ln=zi(Object.prototype.hasOwnProperty),Ti=zi(RegExp.prototype.test),Wa=Jk(TypeError);function zi(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,s=new Array(n>1?n-1:0),a=1;a<n;a++)s[a-1]=arguments[a];return Wd(e,t,s)}}function Jk(e){return function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return qd(e,n)}}function Ve(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:su;Mv&&Mv(e,null);let s=t.length;for(;s--;){let a=t[s];if(typeof a=="string"){const o=n(a);o!==a&&(Yk(t)||(t[s]=o),a=o)}e[a]=!0}return e}function e2(e){for(let t=0;t<e.length;t++)ln(e,t)||(e[t]=null);return e}function qn(e){const t=ru(null);for(const[n,s]of ux(e))ln(e,n)&&(Array.isArray(s)?t[n]=e2(s):s&&typeof s=="object"&&s.constructor===Object?t[n]=qn(s):t[n]=s);return t}function qa(e,t){for(;e!==null;){const s=Gk(e,t);if(s){if(s.get)return zi(s.get);if(typeof s.value=="function")return zi(s.value)}e=Vk(e)}function n(){return null}return n}const Lv=Mi(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),td=Mi(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),id=Mi(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),t2=Mi(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),nd=Mi(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),i2=Mi(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ov=Mi(["#text"]),Bv=Mi(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),rd=Mi(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),jv=Mi(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Yc=Mi(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),n2=Nn(/\{\{[\w\W]*|[\w\W]*\}\}/gm),r2=Nn(/<%[\w\W]*|[\w\W]*%>/gm),s2=Nn(/\$\{[\w\W]*/gm),l2=Nn(/^data-[\-\w.\u00B7-\uFFFF]+$/),a2=Nn(/^aria-[\-\w]+$/),hx=Nn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),o2=Nn(/^(?:\w+script|data):/i),c2=Nn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),fx=Nn(/^html$/i),u2=Nn(/^[a-z][.\w]*(-[.\w]+)+$/i);var Hv=Object.freeze({__proto__:null,ARIA_ATTR:a2,ATTR_WHITESPACE:c2,CUSTOM_ELEMENT:u2,DATA_ATTR:l2,DOCTYPE_NAME:fx,ERB_EXPR:r2,IS_ALLOWED_URI:hx,IS_SCRIPT_OR_DATA:o2,MUSTACHE_EXPR:n2,TMPLIT_EXPR:s2});const $a={element:1,text:3,progressingInstruction:7,comment:8,document:9},h2=function(){return typeof window>"u"?null:window},f2=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let s=null;const a="data-tt-policy-suffix";n&&n.hasAttribute(a)&&(s=n.getAttribute(a));const o="dompurify"+(s?"#"+s:"");try{return t.createPolicy(o,{createHTML(c){return c},createScriptURL(c){return c}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},Iv=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function dx(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:h2();const t=Ae=>dx(Ae);if(t.version="3.3.3",t.removed=[],!e||!e.document||e.document.nodeType!==$a.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const s=n,a=s.currentScript,{DocumentFragment:o,HTMLTemplateElement:c,Node:f,Element:d,NodeFilter:h,NamedNodeMap:_=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:v,DOMParser:b,trustedTypes:y}=e,S=d.prototype,A=qa(S,"cloneNode"),R=qa(S,"remove"),D=qa(S,"nextSibling"),W=qa(S,"childNodes"),j=qa(S,"parentNode");if(typeof c=="function"){const Ae=n.createElement("template");Ae.content&&Ae.content.ownerDocument&&(n=Ae.content.ownerDocument)}let I,J="";const{implementation:L,createNodeIterator:te,createDocumentFragment:X,getElementsByTagName:pe}=n,{importNode:G}=s;let K=Iv();t.isSupported=typeof ux=="function"&&typeof j=="function"&&L&&L.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:V,ERB_EXPR:z,TMPLIT_EXPR:P,DATA_ATTR:$,ARIA_ATTR:C,IS_SCRIPT_OR_DATA:B,ATTR_WHITESPACE:U,CUSTOM_ELEMENT:ce}=Hv;let{IS_ALLOWED_URI:w}=Hv,T=null;const q=Ve({},[...Lv,...td,...id,...nd,...Ov]);let k=null;const ie=Ve({},[...Bv,...rd,...jv,...Yc]);let ue=Object.seal(ru(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),le=null,ve=null;const Ee=Object.seal(ru(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let oe=!0,Ie=!0,ot=!1,yt=!0,se=!1,Oe=!0,nt=!1,Je=!1,fi=!1,gt=!1,Rt=!1,Ot=!1,Vi=!0,on=!1;const Bn="user-content-";let St=!0,ze=!1,M={},re=null;const ye=Ve({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let je=null;const rt=Ve({},["audio","video","img","source","image","track"]);let di=null;const cn=Ve({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),qt="http://www.w3.org/1998/Math/MathML",Et="http://www.w3.org/2000/svg",At="http://www.w3.org/1999/xhtml";let tt=At,un=!1,Ei=null;const Ou=Ve({},[qt,Et,At],Jf);let Zn=Ve({},["mi","mo","mn","ms","mtext"]),Qn=Ve({},["annotation-xml"]);const Ps=Ve({},["title","style","font","a","script"]);let Gi=null;const Us=["application/xhtml+xml","text/html"],os="text/html";let Pt=null,Jn=null;const Ul=n.createElement("form"),kr=function(H){return H instanceof RegExp||H instanceof Function},Fl=function(){let H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Jn&&Jn===H)){if((!H||typeof H!="object")&&(H={}),H=qn(H),Gi=Us.indexOf(H.PARSER_MEDIA_TYPE)===-1?os:H.PARSER_MEDIA_TYPE,Pt=Gi==="application/xhtml+xml"?Jf:su,T=ln(H,"ALLOWED_TAGS")?Ve({},H.ALLOWED_TAGS,Pt):q,k=ln(H,"ALLOWED_ATTR")?Ve({},H.ALLOWED_ATTR,Pt):ie,Ei=ln(H,"ALLOWED_NAMESPACES")?Ve({},H.ALLOWED_NAMESPACES,Jf):Ou,di=ln(H,"ADD_URI_SAFE_ATTR")?Ve(qn(cn),H.ADD_URI_SAFE_ATTR,Pt):cn,je=ln(H,"ADD_DATA_URI_TAGS")?Ve(qn(rt),H.ADD_DATA_URI_TAGS,Pt):rt,re=ln(H,"FORBID_CONTENTS")?Ve({},H.FORBID_CONTENTS,Pt):ye,le=ln(H,"FORBID_TAGS")?Ve({},H.FORBID_TAGS,Pt):qn({}),ve=ln(H,"FORBID_ATTR")?Ve({},H.FORBID_ATTR,Pt):qn({}),M=ln(H,"USE_PROFILES")?H.USE_PROFILES:!1,oe=H.ALLOW_ARIA_ATTR!==!1,Ie=H.ALLOW_DATA_ATTR!==!1,ot=H.ALLOW_UNKNOWN_PROTOCOLS||!1,yt=H.ALLOW_SELF_CLOSE_IN_ATTR!==!1,se=H.SAFE_FOR_TEMPLATES||!1,Oe=H.SAFE_FOR_XML!==!1,nt=H.WHOLE_DOCUMENT||!1,gt=H.RETURN_DOM||!1,Rt=H.RETURN_DOM_FRAGMENT||!1,Ot=H.RETURN_TRUSTED_TYPE||!1,fi=H.FORCE_BODY||!1,Vi=H.SANITIZE_DOM!==!1,on=H.SANITIZE_NAMED_PROPS||!1,St=H.KEEP_CONTENT!==!1,ze=H.IN_PLACE||!1,w=H.ALLOWED_URI_REGEXP||hx,tt=H.NAMESPACE||At,Zn=H.MATHML_TEXT_INTEGRATION_POINTS||Zn,Qn=H.HTML_INTEGRATION_POINTS||Qn,ue=H.CUSTOM_ELEMENT_HANDLING||{},H.CUSTOM_ELEMENT_HANDLING&&kr(H.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ue.tagNameCheck=H.CUSTOM_ELEMENT_HANDLING.tagNameCheck),H.CUSTOM_ELEMENT_HANDLING&&kr(H.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ue.attributeNameCheck=H.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),H.CUSTOM_ELEMENT_HANDLING&&typeof H.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ue.allowCustomizedBuiltInElements=H.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),se&&(Ie=!1),Rt&&(gt=!0),M&&(T=Ve({},Ov),k=ru(null),M.html===!0&&(Ve(T,Lv),Ve(k,Bv)),M.svg===!0&&(Ve(T,td),Ve(k,rd),Ve(k,Yc)),M.svgFilters===!0&&(Ve(T,id),Ve(k,rd),Ve(k,Yc)),M.mathMl===!0&&(Ve(T,nd),Ve(k,jv),Ve(k,Yc))),ln(H,"ADD_TAGS")||(Ee.tagCheck=null),ln(H,"ADD_ATTR")||(Ee.attributeCheck=null),H.ADD_TAGS&&(typeof H.ADD_TAGS=="function"?Ee.tagCheck=H.ADD_TAGS:(T===q&&(T=qn(T)),Ve(T,H.ADD_TAGS,Pt))),H.ADD_ATTR&&(typeof H.ADD_ATTR=="function"?Ee.attributeCheck=H.ADD_ATTR:(k===ie&&(k=qn(k)),Ve(k,H.ADD_ATTR,Pt))),H.ADD_URI_SAFE_ATTR&&Ve(di,H.ADD_URI_SAFE_ATTR,Pt),H.FORBID_CONTENTS&&(re===ye&&(re=qn(re)),Ve(re,H.FORBID_CONTENTS,Pt)),H.ADD_FORBID_CONTENTS&&(re===ye&&(re=qn(re)),Ve(re,H.ADD_FORBID_CONTENTS,Pt)),St&&(T["#text"]=!0),nt&&Ve(T,["html","head","body"]),T.table&&(Ve(T,["tbody"]),delete le.tbody),H.TRUSTED_TYPES_POLICY){if(typeof H.TRUSTED_TYPES_POLICY.createHTML!="function")throw Wa('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof H.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Wa('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');I=H.TRUSTED_TYPES_POLICY,J=I.createHTML("")}else I===void 0&&(I=f2(y,a)),I!==null&&typeof J=="string"&&(J=I.createHTML(""));Mi&&Mi(H),Jn=H}},Wl=Ve({},[...td,...id,...t2]),ql=Ve({},[...nd,...i2]),ko=function(H){let me=j(H);(!me||!me.tagName)&&(me={namespaceURI:tt,tagName:"template"});const xe=su(H.tagName),ct=su(me.tagName);return Ei[H.namespaceURI]?H.namespaceURI===Et?me.namespaceURI===At?xe==="svg":me.namespaceURI===qt?xe==="svg"&&(ct==="annotation-xml"||Zn[ct]):!!Wl[xe]:H.namespaceURI===qt?me.namespaceURI===At?xe==="math":me.namespaceURI===Et?xe==="math"&&Qn[ct]:!!ql[xe]:H.namespaceURI===At?me.namespaceURI===Et&&!Qn[ct]||me.namespaceURI===qt&&!Zn[ct]?!1:!ql[xe]&&(Ps[xe]||!Wl[xe]):!!(Gi==="application/xhtml+xml"&&Ei[H.namespaceURI]):!1},Bi=function(H){Ua(t.removed,{element:H});try{j(H).removeChild(H)}catch{R(H)}},Dn=function(H,me){try{Ua(t.removed,{attribute:me.getAttributeNode(H),from:me})}catch{Ua(t.removed,{attribute:null,from:me})}if(me.removeAttribute(H),H==="is")if(gt||Rt)try{Bi(me)}catch{}else try{me.setAttribute(H,"")}catch{}},$l=function(H){let me=null,xe=null;if(fi)H="<remove></remove>"+H;else{const We=ed(H,/^[\r\n\t ]+/);xe=We&&We[0]}Gi==="application/xhtml+xml"&&tt===At&&(H='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+H+"</body></html>");const ct=I?I.createHTML(H):H;if(tt===At)try{me=new b().parseFromString(ct,Gi)}catch{}if(!me||!me.documentElement){me=L.createDocument(tt,"template",null);try{me.documentElement.innerHTML=un?J:ct}catch{}}const Mt=me.body||me.documentElement;return H&&xe&&Mt.insertBefore(n.createTextNode(xe),Mt.childNodes[0]||null),tt===At?pe.call(me,nt?"html":"body")[0]:nt?me.documentElement:Mt},Yl=function(H){return te.call(H.ownerDocument||H,H,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},hn=function(H){return H instanceof v&&(typeof H.nodeName!="string"||typeof H.textContent!="string"||typeof H.removeChild!="function"||!(H.attributes instanceof _)||typeof H.removeAttribute!="function"||typeof H.setAttribute!="function"||typeof H.namespaceURI!="string"||typeof H.insertBefore!="function"||typeof H.hasChildNodes!="function")},$t=function(H){return typeof f=="function"&&H instanceof f};function Tt(Ae,H,me){$c(Ae,xe=>{xe.call(t,H,me,Jn)})}const er=function(H){let me=null;if(Tt(K.beforeSanitizeElements,H,null),hn(H))return Bi(H),!0;const xe=Pt(H.nodeName);if(Tt(K.uponSanitizeElement,H,{tagName:xe,allowedTags:T}),Oe&&H.hasChildNodes()&&!$t(H.firstElementChild)&&Ti(/<[/\w!]/g,H.innerHTML)&&Ti(/<[/\w!]/g,H.textContent)||H.nodeType===$a.progressingInstruction||Oe&&H.nodeType===$a.comment&&Ti(/<[/\w]/g,H.data))return Bi(H),!0;if(!(Ee.tagCheck instanceof Function&&Ee.tagCheck(xe))&&(!T[xe]||le[xe])){if(!le[xe]&&Eo(xe)&&(ue.tagNameCheck instanceof RegExp&&Ti(ue.tagNameCheck,xe)||ue.tagNameCheck instanceof Function&&ue.tagNameCheck(xe)))return!1;if(St&&!re[xe]){const ct=j(H)||H.parentNode,Mt=W(H)||H.childNodes;if(Mt&&ct){const We=Mt.length;for(let pi=We-1;pi>=0;--pi){const fn=A(Mt[pi],!0);fn.__removalCount=(H.__removalCount||0)+1,ct.insertBefore(fn,D(H))}}}return Bi(H),!0}return H instanceof d&&!ko(H)||(xe==="noscript"||xe==="noembed"||xe==="noframes")&&Ti(/<\/no(script|embed|frames)/i,H.innerHTML)?(Bi(H),!0):(se&&H.nodeType===$a.text&&(me=H.textContent,$c([V,z,P],ct=>{me=Fa(me,ct," ")}),H.textContent!==me&&(Ua(t.removed,{element:H.cloneNode()}),H.textContent=me)),Tt(K.afterSanitizeElements,H,null),!1)},Fs=function(H,me,xe){if(ve[me]||Vi&&(me==="id"||me==="name")&&(xe in n||xe in Ul))return!1;if(!(Ie&&!ve[me]&&Ti($,me))){if(!(oe&&Ti(C,me))){if(!(Ee.attributeCheck instanceof Function&&Ee.attributeCheck(me,H))){if(!k[me]||ve[me]){if(!(Eo(H)&&(ue.tagNameCheck instanceof RegExp&&Ti(ue.tagNameCheck,H)||ue.tagNameCheck instanceof Function&&ue.tagNameCheck(H))&&(ue.attributeNameCheck instanceof RegExp&&Ti(ue.attributeNameCheck,me)||ue.attributeNameCheck instanceof Function&&ue.attributeNameCheck(me,H))||me==="is"&&ue.allowCustomizedBuiltInElements&&(ue.tagNameCheck instanceof RegExp&&Ti(ue.tagNameCheck,xe)||ue.tagNameCheck instanceof Function&&ue.tagNameCheck(xe))))return!1}else if(!di[me]){if(!Ti(w,Fa(xe,U,""))){if(!((me==="src"||me==="xlink:href"||me==="href")&&H!=="script"&&Zk(xe,"data:")===0&&je[H])){if(!(ot&&!Ti(B,Fa(xe,U,"")))){if(xe)return!1}}}}}}}return!0},Eo=function(H){return H!=="annotation-xml"&&ed(H,ce)},Ao=function(H){Tt(K.beforeSanitizeAttributes,H,null);const{attributes:me}=H;if(!me||hn(H))return;const xe={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:k,forceKeepAttr:void 0};let ct=me.length;for(;ct--;){const Mt=me[ct],{name:We,namespaceURI:pi,value:fn}=Mt,ji=Pt(We),jn=fn;let Jt=We==="value"?jn:Qk(jn);if(xe.attrName=ji,xe.attrValue=Jt,xe.keepAttr=!0,xe.forceKeepAttr=void 0,Tt(K.uponSanitizeAttribute,H,xe),Jt=xe.attrValue,on&&(ji==="id"||ji==="name")&&(Dn(We,H),Jt=Bn+Jt),Oe&&Ti(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Jt)){Dn(We,H);continue}if(ji==="attributename"&&ed(Jt,"href")){Dn(We,H);continue}if(xe.forceKeepAttr)continue;if(!xe.keepAttr){Dn(We,H);continue}if(!yt&&Ti(/\/>/i,Jt)){Dn(We,H);continue}se&&$c([V,z,P],Gl=>{Jt=Fa(Jt,Gl," ")});const Vl=Pt(H.nodeName);if(!Fs(Vl,ji,Jt)){Dn(We,H);continue}if(I&&typeof y=="object"&&typeof y.getAttributeType=="function"&&!pi)switch(y.getAttributeType(Vl,ji)){case"TrustedHTML":{Jt=I.createHTML(Jt);break}case"TrustedScriptURL":{Jt=I.createScriptURL(Jt);break}}if(Jt!==jn)try{pi?H.setAttributeNS(pi,We,Jt):H.setAttribute(We,Jt),hn(H)?Bi(H):zv(t.removed)}catch{Dn(We,H)}}Tt(K.afterSanitizeAttributes,H,null)},To=function Ae(H){let me=null;const xe=Yl(H);for(Tt(K.beforeSanitizeShadowDOM,H,null);me=xe.nextNode();)Tt(K.uponSanitizeShadowNode,me,null),er(me),Ao(me),me.content instanceof o&&Ae(me.content);Tt(K.afterSanitizeShadowDOM,H,null)};return t.sanitize=function(Ae){let H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},me=null,xe=null,ct=null,Mt=null;if(un=!Ae,un&&(Ae="<!-->"),typeof Ae!="string"&&!$t(Ae))if(typeof Ae.toString=="function"){if(Ae=Ae.toString(),typeof Ae!="string")throw Wa("dirty is not a string, aborting")}else throw Wa("toString is not a function");if(!t.isSupported)return Ae;if(Je||Fl(H),t.removed=[],typeof Ae=="string"&&(ze=!1),ze){if(Ae.nodeName){const fn=Pt(Ae.nodeName);if(!T[fn]||le[fn])throw Wa("root node is forbidden and cannot be sanitized in-place")}}else if(Ae instanceof f)me=$l("<!---->"),xe=me.ownerDocument.importNode(Ae,!0),xe.nodeType===$a.element&&xe.nodeName==="BODY"||xe.nodeName==="HTML"?me=xe:me.appendChild(xe);else{if(!gt&&!se&&!nt&&Ae.indexOf("<")===-1)return I&&Ot?I.createHTML(Ae):Ae;if(me=$l(Ae),!me)return gt?null:Ot?J:""}me&&fi&&Bi(me.firstChild);const We=Yl(ze?Ae:me);for(;ct=We.nextNode();)er(ct),Ao(ct),ct.content instanceof o&&To(ct.content);if(ze)return Ae;if(gt){if(Rt)for(Mt=X.call(me.ownerDocument);me.firstChild;)Mt.appendChild(me.firstChild);else Mt=me;return(k.shadowroot||k.shadowrootmode)&&(Mt=G.call(s,Mt,!0)),Mt}let pi=nt?me.outerHTML:me.innerHTML;return nt&&T["!doctype"]&&me.ownerDocument&&me.ownerDocument.doctype&&me.ownerDocument.doctype.name&&Ti(fx,me.ownerDocument.doctype.name)&&(pi="<!DOCTYPE "+me.ownerDocument.doctype.name+`>
`+pi),se&&$c([V,z,P],fn=>{pi=Fa(pi,fn," ")}),I&&Ot?I.createHTML(pi):pi},t.setConfig=function(){let Ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Fl(Ae),Je=!0},t.clearConfig=function(){Jn=null,Je=!1},t.isValidAttribute=function(Ae,H,me){Jn||Fl({});const xe=Pt(Ae),ct=Pt(H);return Fs(xe,ct,me)},t.addHook=function(Ae,H){typeof H=="function"&&Ua(K[Ae],H)},t.removeHook=function(Ae,H){if(H!==void 0){const me=Kk(K[Ae],H);return me===-1?void 0:Xk(K[Ae],me,1)[0]}return zv(K[Ae])},t.removeHooks=function(Ae){K[Ae]=[]},t.removeAllHooks=function(){K=Iv()},t}var d2=dx();function p2(e){if(e.ctrlKey&&e.key.length===1)return`C-${e.key.toLowerCase()}`;switch(e.key){case"Enter":return e.ctrlKey?"C-m":"Enter";case"Escape":return"Escape";case"Backspace":return"BSpace";case"Tab":return e.shiftKey?"BTab":"Tab";case"ArrowUp":return"Up";case"ArrowDown":return"Down";case"ArrowLeft":return"Left";case"ArrowRight":return"Right";case"Home":return"Home";case"End":return"End";case"PageUp":return"PageUp";case"PageDown":return"PageDown";case"Delete":return"DC";case" ":return"Space";default:return null}}const sd=new Map,Pv="'JetBrainsMono Nerd Font', 'JetBrainsMono NF', 'CaskaydiaCove Nerd Font', 'CaskaydiaCove NF', 'FiraCode Nerd Font', 'FiraCode NF', 'MesloLGS NF', 'Hack Nerd Font', 'JetBrains Mono', 'Cascadia Code', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', 'Symbols Nerd Font Mono', monospace";function m2(e){return e>=4352&&e<=4447||e>=11904&&e<=12350||e>=12353&&e<=13247||e>=13312&&e<=19903||e>=19968&&e<=42191||e>=44032&&e<=55215||e>=63744&&e<=64255||e>=65072&&e<=65135||e>=65281&&e<=65376||e>=65504&&e<=65510||e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}const pu=/[\u2500-\u257f]{4,}/g,Dl="\x1B",g2=new RegExp(`${Dl}\\[[0-9;?]*[ -/]*[@-~]`,"g"),_2=new RegExp(`${Dl}\\][^\\x07${Dl}]*(?:\\x07|${Dl}\\\\)`,"g");function v2(e,t){if(e.length<=t)return e;const n=e.length-t,s=[];pu.lastIndex=0;for(const d of e.matchAll(pu))d.index!=null&&s.push({index:d.index,length:d[0].length});if(s.length===0)return e;const a=s.reduce((d,h)=>d+h.length,0);if(a<=n)return e.slice(0,t);const o=s.map(d=>{const h=Math.ceil(d.length/a*n);return Math.max(1,d.length-h)});let c="",f=0;for(let d=0;d<s.length;d++){const h=s[d];c+=e.slice(f,h.index),c+=e.slice(h.index,h.index+o[d]),f=h.index+h.length}return c+=e.slice(f),c}function b2(e,t){const n=e.replace(/(\s*\n)*\s*$/,"");return t<=0?n:n.replace(/^.*$/gm,s=>{var d,h;const a=s.replace(g2,"").replace(_2,"");if(a.length<=t||!pu.test(a))return s;pu.lastIndex=0;const o=v2(a,t),c=((d=s.match(new RegExp(`^(${Dl}\\[[0-9;?]*[ -/]*[@-~])*`)))==null?void 0:d[0])??"",f=((h=s.match(new RegExp(`(${Dl}\\[[0-9;?]*[ -/]*[@-~])*$`)))==null?void 0:h[0])??"";return c+o+f})}function Uv({agentId:e}){const[t,n]=N.useState(""),[s,a]=N.useState(null),[o,c]=N.useState(!0),[f,d]=N.useState(!0),[h,_]=N.useState(!1),[v,b]=N.useState(()=>sd.get(e)??!0),y=N.useCallback(w=>{b(T=>{const q=typeof w=="function"?w(T):w;return sd.set(e,q),q})},[e]),S=N.useRef(null),A=N.useRef(null),R=N.useRef(null),D=N.useRef(null),[W,j]=N.useState(0),I=N.useRef(null);N.useEffect(()=>{const w=D.current;if(!w)return;const T=()=>{const k=I.current;if(!k)return;const ie=k.getBoundingClientRect().width;if(ie>0){const ue=w.clientWidth-24;j(Math.floor(ue/ie))}},q=new ResizeObserver(T);return q.observe(w),T(),()=>q.disconnect()},[]);const J=N.useMemo(()=>{const w=new qk;return w.use_classes=!0,w},[]);N.useEffect(()=>{we.getPreviewSettings().then(w=>c(w.show_cursor)).catch(()=>{})},[]),N.useEffect(()=>{n(""),a(null),d(!0),b(sd.get(e)??!0),_(!1)},[e]);const L=N.useCallback(()=>{d(!0)},[]),te=N.useCallback(()=>{d(!1)},[]);N.useEffect(()=>{var w;if(f){const T=setTimeout(()=>{var q;return(q=A.current)==null?void 0:q.focus()},50);return()=>clearTimeout(T)}else(w=A.current)==null||w.blur()},[f]);const X=f?500:2e3,pe=N.useCallback(async()=>{try{const w=await we.getPreview(e);if(!w.content)return;const T=window.getSelection();if(T&&T.toString().length>0)return;n(w.content),w.cursor_x!=null&&w.cursor_y!=null?a({x:w.cursor_x,y:w.cursor_y}):a(null)}catch{}},[e]);N.useEffect(()=>{pe();const w=setInterval(pe,X);return()=>clearInterval(w)},[pe,X]);const G=N.useRef([]);N.useEffect(()=>()=>{for(const w of G.current)clearTimeout(w);G.current=[]},[e]);const K=N.useCallback(w=>{we.passthrough(e,w).then(()=>{const T=setTimeout(pe,50),q=setTimeout(pe,200);G.current.push(T,q)}).catch(()=>{})},[e,pe]),V=N.useCallback(()=>{const w=D.current;if(!w)return;const T=w.scrollHeight-w.scrollTop-w.clientHeight<24;y(T)},[y]),z=N.useCallback(w=>{if(h)return;if(w.ctrlKey&&w.key==="c"){const q=window.getSelection();if(q&&q.toString().length>0)return}if(w.ctrlKey&&w.key==="v")return;const T=p2(w.nativeEvent);if(T){w.preventDefault(),K({key:T});return}w.key.length===1&&!w.ctrlKey&&!w.altKey&&!w.metaKey&&(w.preventDefault(),K({chars:w.key}))},[h,K]),P=N.useCallback(w=>{const T=w.currentTarget,q=T.value;q&&!h&&(K({chars:q}),T.value="")},[h,K]),C=N.useMemo(()=>{const w=J.ansi_to_html(b2(t,W));if(!s||!o)return w;const T=w.split(`
`);if(s.y>=T.length)return w;const q=T[s.y];let k=0,ie=!1,ue=q.length;for(let ve=0;ve<q.length;ve++){if(q[ve]==="<"){ie=!0;continue}if(q[ve]===">"){ie=!1;continue}if(ie)continue;if(k>=s.x){ue=ve;break}let Ee=q[ve];if(Ee==="&"){const oe=q.indexOf(";",ve);if(oe>ve&&oe-ve<10){const Ie=q.slice(ve,oe+1);Ie==="&amp;"?Ee="&":Ie==="&lt;"?Ee="<":Ie==="&gt;"?Ee=">":Ie==="&quot;"&&(Ee='"'),ve=oe}}k+=m2(Ee.codePointAt(0)??0)}const le='<span data-tmai-cursor="1" style="display:inline-block;width:0;height:0;vertical-align:top;overflow:hidden"></span>';return T[s.y]=q.slice(0,ue)+le+q.slice(ue),T.join(`
`)},[J,t,W,s,o]),[B,U]=N.useState(null),ce=N.useRef(null);return N.useEffect(()=>{var ie;if(ce.current){const ue=window.getSelection();ue&&ue.toString().length>0||(ce.current.innerHTML=d2.sanitize(C,{ADD_ATTR:["data-tmai-cursor"]}))}if(v&&((ie=R.current)==null||ie.scrollIntoView({behavior:"instant"})),!s||!ce.current){U(null);return}const w=ce.current.querySelector("[data-tmai-cursor]"),T=I.current;if(!w||!T){U(null);return}const q=T.getBoundingClientRect().width;if(q<=0){U(null);return}const k=13*1.35;U({left:`${w.offsetLeft}px`,top:`${w.offsetTop}px`,width:`${q}px`,height:`${k}px`})},[C,v,s]),g.jsxs("div",{ref:S,className:`relative flex flex-1 flex-col overflow-hidden bg-[#0c0c0c] outline-none ${f?"ring-1 ring-cyan-500/30 ring-inset":""}`,children:[g.jsxs("div",{role:"log",tabIndex:0,ref:D,onScroll:V,onMouseDown:()=>{f&&te()},onMouseUp:()=>{if(!f){const w=window.getSelection();(!w||w.toString().length===0)&&L()}},className:`flex-1 overflow-y-auto p-3 text-[13px] leading-[1.35] ${f?"":"ring-2 ring-amber-500/40 ring-inset"}`,children:[g.jsx("span",{ref:I,"aria-hidden":"true",className:"pointer-events-none absolute -left-[9999px] whitespace-pre text-[13px]",style:{fontFamily:Pv},children:"X"}),t?g.jsxs("div",{className:"ansi-preview relative m-0 cursor-text select-text whitespace-pre-wrap break-words",style:{fontFamily:Pv},children:[g.jsx("div",{ref:ce}),B&&f&&o&&g.jsx("div",{className:"pointer-events-none absolute animate-pulse bg-cyan-400/70",style:B,"aria-hidden":"true"})]}):g.jsx("span",{className:"text-zinc-600",children:"Waiting for output..."}),g.jsx("div",{ref:R})]}),g.jsx("input",{ref:A,type:"text",className:"pointer-events-none absolute h-px w-px overflow-hidden border-0 p-0 opacity-0",style:{bottom:"2rem",left:"0.75rem",userSelect:"none"},onKeyDown:z,onInput:P,onCompositionStart:()=>_(!0),onCompositionEnd:w=>{_(!1);const T=w.currentTarget.value;T&&(K({chars:T}),w.currentTarget.value="")},autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,tabIndex:-1}),g.jsxs("div",{className:"flex items-center gap-2 border-t border-white/5 px-3 py-1",children:[g.jsx("button",{type:"button",onMouseDown:w=>w.preventDefault(),onClick:f?te:L,className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${f?"bg-cyan-500/20 text-cyan-400":"bg-amber-500/20 text-amber-400"}`,title:f?"Input mode — keystrokes sent to agent (click for select mode)":"Select mode — click to copy text (click for input mode)",children:f?"⌨ Input":"📋 Select"}),g.jsx("button",{type:"button",onMouseDown:w=>w.preventDefault(),onClick:()=>y(w=>!w),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${v?"bg-cyan-500/15 text-cyan-400":"bg-white/5 text-zinc-600 hover:text-zinc-400"}`,title:v?"Auto-scroll: ON":"Auto-scroll: OFF",children:v?"⇩ Auto":"⇩ Off"}),g.jsx("button",{type:"button",onMouseDown:w=>w.preventDefault(),onClick:()=>c(w=>!w),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${o?"bg-cyan-500/15 text-cyan-400":"bg-white/5 text-zinc-600 hover:text-zinc-400"}`,title:o?"Cursor: ON":"Cursor: OFF",children:o?"▮ Cursor":"▯ Cursor"}),g.jsx("div",{className:"flex-1"}),g.jsx("span",{className:"text-[10px] text-zinc-600",children:f?"click to select":"click ⌨ to input"})]})]})}/**
 * @license lucide-react v1.7.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const px=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===n).join(" ").trim();/**
 * @license lucide-react v1.7.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const y2=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
 * @license lucide-react v1.7.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const x2=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,s)=>s?s.toUpperCase():n.toLowerCase());/**
 * @license lucide-react v1.7.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Fv=e=>{const t=x2(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
 * @license lucide-react v1.7.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */var ld={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
 * @license lucide-react v1.7.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const S2=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},w2=N.createContext({}),C2=()=>N.useContext(w2),k2=N.forwardRef(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:s,className:a="",children:o,iconNode:c,...f},d)=>{const{size:h=24,strokeWidth:_=2,absoluteStrokeWidth:v=!1,color:b="currentColor",className:y=""}=C2()??{},S=s??v?Number(n??_)*24/Number(t??h):n??_;return N.createElement("svg",{ref:d,...ld,width:t??h??ld.width,height:t??h??ld.height,stroke:e??b,strokeWidth:S,className:px("lucide",y,a),...!o&&!S2(f)&&{"aria-hidden":"true"},...f},[...c.map(([A,R])=>N.createElement(A,R)),...Array.isArray(o)?o:[o]])});/**
 * @license lucide-react v1.7.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ku=(e,t)=>{const n=N.forwardRef(({className:s,...a},o)=>N.createElement(k2,{ref:o,iconNode:t,className:px(`lucide-${y2(Fv(e))}`,`lucide-${e}`,s),...a}));return n.displayName=Fv(e),n};/**
 * @license lucide-react v1.7.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const E2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],A2=ku("circle-alert",E2);/**
 * @license lucide-react v1.7.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const T2=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],N2=ku("circle-check-big",T2);/**
 * @license lucide-react v1.7.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const D2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],R2=ku("info",D2);/**
 * @license lucide-react v1.7.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const M2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],mx=ku("x",M2);function z2({isOpen:e,onClose:t}){if(!e)return null;const n=[{category:"Navigation",items:[{key:"?",description:"Toggle this help menu"},{key:"\\",description:"Toggle split view"},{key:"[",description:"Previous project"},{key:"]",description:"Next project"},{key:"/",description:"Focus project search"}]},{category:"Agent Control",items:[{key:"a",description:"Approve selected agent"},{key:"k",description:"Kill selected agent"}]},{category:"Settings",items:[{key:"s",description:"Toggle settings panel"},{key:"Ctrl+Shift+S",description:"Toggle security scan"}]}];return g.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:g.jsxs("div",{className:"glass-deep relative w-full max-w-2xl rounded-2xl border border-white/10 shadow-2xl animate-scale-in",children:[g.jsxs("div",{className:"flex items-center justify-between border-b border-white/10 px-6 py-4",children:[g.jsx("h2",{className:"text-lg font-semibold text-zinc-100",children:"Keyboard Shortcuts"}),g.jsx("button",{type:"button",onClick:t,className:"rounded-lg p-2 transition-colors hover:bg-white/10",children:g.jsx(mx,{size:20,className:"text-zinc-400"})})]}),g.jsx("div",{className:"max-h-[60vh] overflow-y-auto px-6 py-4",children:g.jsx("div",{className:"grid grid-cols-2 gap-8",children:n.map(s=>g.jsxs("div",{children:[g.jsx("h3",{className:"mb-3 text-sm font-semibold uppercase text-zinc-500",children:s.category}),g.jsx("div",{className:"space-y-2",children:s.items.map(a=>g.jsxs("div",{className:"flex items-start gap-3",children:[g.jsx("kbd",{className:"flex-shrink-0 rounded-lg border border-white/10 bg-white/[0.05] px-2.5 py-1 text-xs font-mono font-semibold text-cyan-400",children:a.key}),g.jsx("p",{className:"text-sm text-zinc-400",children:a.description})]},a.key))})]},s.category))})}),g.jsxs("div",{className:"border-t border-white/10 px-6 py-3 text-center text-xs text-zinc-600",children:["Press ",g.jsx("kbd",{className:"rounded border border-white/10 bg-white/[0.05] px-1",children:"ESC"})," or click the X to close"]})]})})}function L2(e){return Math.round(e*100)}function Wv({active:e,onClick:t,children:n}){return g.jsx("button",{type:"button",onClick:t,className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${e?"bg-white/10 text-cyan-400":"text-zinc-500 hover:bg-white/[0.05] hover:text-zinc-300"}`,children:n})}function O2({left:e,right:t,rightTab:n,onTabChange:s,splitRatio:a,isDragging:o,containerRef:c,onDividerMouseDown:f,onDividerDoubleClick:d}){const h=`${(a*100).toFixed(2)}%`,_=`${((1-a)*100).toFixed(2)}%`;return g.jsxs("div",{ref:c,className:`flex h-full flex-1 overflow-hidden ${o?"select-none":""}`,children:[g.jsx("div",{className:"flex flex-col overflow-hidden",style:{width:h},children:e}),g.jsxs("div",{role:"separator",tabIndex:0,"aria-valuenow":L2(a),"aria-valuemin":20,"aria-valuemax":80,"aria-label":"Resize split pane",className:"group relative flex shrink-0 cursor-col-resize items-center justify-center",style:{width:"5px"},onMouseDown:f,onDoubleClick:d,children:[g.jsx("div",{className:`h-full w-px transition-colors ${o?"bg-cyan-500/50":"bg-white/[0.06] group-hover:bg-cyan-500/30"}`}),g.jsxs("div",{className:"absolute flex flex-col gap-1 opacity-0 transition-opacity group-hover:opacity-100",children:[g.jsx("div",{className:"h-1 w-1 rounded-full bg-zinc-500"}),g.jsx("div",{className:"h-1 w-1 rounded-full bg-zinc-500"}),g.jsx("div",{className:"h-1 w-1 rounded-full bg-zinc-500"})]})]}),g.jsxs("div",{className:"flex flex-col overflow-hidden",style:{width:_},children:[g.jsxs("div",{className:"flex shrink-0 items-center gap-1 border-b border-white/[0.06] px-3 py-1.5",children:[g.jsx(Wv,{active:n==="git",onClick:()=>s("git"),children:"Git"}),g.jsx(Wv,{active:n==="markdown",onClick:()=>s("markdown"),children:"Docs"})]}),g.jsx("div",{className:"flex flex-1 flex-col overflow-hidden",children:t})]})]})}function B2({agentCount:e,attentionCount:t,onSettingsClick:n,onSecurityClick:s}){return g.jsxs("div",{className:"flex items-center justify-between border-b border-white/5 px-4 py-3",children:[g.jsx("span",{className:"bg-gradient-to-r from-cyan-400 to-blue-400 bg-clip-text text-sm font-bold tracking-wide text-transparent",children:"tmai"}),g.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[g.jsxs("span",{className:"text-zinc-500",children:[e," agents"]}),t>0&&g.jsx("span",{className:"glow-amber rounded-full bg-amber-500/15 px-2.5 py-0.5 text-amber-400",children:t}),g.jsx("button",{type:"button",onClick:s,className:"rounded px-1.5 py-0.5 text-zinc-500 transition-colors hover:bg-white/10 hover:text-cyan-400",title:"Security Scan",children:"🛡"}),g.jsx("button",{type:"button",onClick:n,className:"rounded px-1.5 py-0.5 text-zinc-500 transition-colors hover:bg-white/10 hover:text-cyan-400",title:"Settings",children:"⚙"})]})]})}function j2({toasts:e,onRemove:t}){return g.jsx("div",{className:"fixed bottom-4 right-4 z-40 flex flex-col gap-2 max-w-sm",children:e.map(n=>g.jsx(H2,{toast:n,onRemove:t},n.id))})}function H2({toast:e,onRemove:t}){N.useEffect(()=>{if(!e.duration)return;const c=setTimeout(()=>{t(e.id)},e.duration);return()=>clearTimeout(c)},[e.id,e.duration,t]);const n={info:g.jsx(R2,{size:16}),success:g.jsx(N2,{size:16}),error:g.jsx(A2,{size:16})},s={info:"bg-blue-500/10 border-blue-500/20",success:"bg-emerald-500/10 border-emerald-500/20",error:"bg-red-500/10 border-red-500/20"},a={info:"text-blue-400",success:"text-emerald-400",error:"text-red-400"},o={info:"text-blue-100",success:"text-emerald-100",error:"text-red-100"};return g.jsxs("div",{className:ui("glass-card flex items-start gap-3 rounded-lg border px-4 py-3 animate-slide-in-up",s[e.type]),children:[g.jsx("div",{className:ui("mt-0.5 flex-shrink-0",a[e.type]),children:n[e.type]}),g.jsx("p",{className:ui("flex-1 text-sm",o[e.type]),children:e.message}),g.jsx("button",{type:"button",onClick:()=>t(e.id),className:"flex-shrink-0 rounded p-0.5 transition-colors hover:bg-white/10",children:g.jsx(mx,{size:14,className:"text-zinc-500 hover:text-zinc-300"})})]})}function I2(){const[e,t]=N.useState([]),n=N.useCallback((a,o="info",c=4e3)=>{const f=`toast-${Date.now()}-${Math.random()}`;return t(d=>[...d,{id:f,type:o,message:a,duration:c}]),f},[]),s=N.useCallback(a=>{t(o=>o.filter(c=>c.id!==a))},[]);return{toasts:e,addToast:n,removeToast:s,success:a=>n(a,"success"),error:a=>n(a,"error",5e3),info:a=>n(a,"info")}}function P2(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const U2=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,F2=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,W2={};function qv(e,t){return(W2.jsx?F2:U2).test(e)}const q2=/[ \t\n\f\r]/g;function $2(e){return typeof e=="object"?e.type==="text"?$v(e.value):!1:$v(e)}function $v(e){return e.replace(q2,"")===""}class vo{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}vo.prototype.normal={};vo.prototype.property={};vo.prototype.space=void 0;function gx(e,t){const n={},s={};for(const a of e)Object.assign(n,a.property),Object.assign(s,a.normal);return new vo(n,s,t)}function $d(e){return e.toLowerCase()}class Yi{constructor(t,n){this.attribute=n,this.property=t}}Yi.prototype.attribute="";Yi.prototype.booleanish=!1;Yi.prototype.boolean=!1;Yi.prototype.commaOrSpaceSeparated=!1;Yi.prototype.commaSeparated=!1;Yi.prototype.defined=!1;Yi.prototype.mustUseProperty=!1;Yi.prototype.number=!1;Yi.prototype.overloadedBoolean=!1;Yi.prototype.property="";Yi.prototype.spaceSeparated=!1;Yi.prototype.space=void 0;let Y2=0;const Fe=Hs(),Xt=Hs(),Yd=Hs(),ge=Hs(),xt=Hs(),Rl=Hs(),sn=Hs();function Hs(){return 2**++Y2}const Vd=Object.freeze(Object.defineProperty({__proto__:null,boolean:Fe,booleanish:Xt,commaOrSpaceSeparated:sn,commaSeparated:Rl,number:ge,overloadedBoolean:Yd,spaceSeparated:xt},Symbol.toStringTag,{value:"Module"})),ad=Object.keys(Vd);class Vp extends Yi{constructor(t,n,s,a){let o=-1;if(super(t,n),Yv(this,"space",a),typeof s=="number")for(;++o<ad.length;){const c=ad[o];Yv(this,ad[o],(s&Vd[c])===Vd[c])}}}Vp.prototype.defined=!0;function Yv(e,t,n){n&&(e[t]=n)}function jl(e){const t={},n={};for(const[s,a]of Object.entries(e.properties)){const o=new Vp(s,e.transform(e.attributes||{},s),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(o.mustUseProperty=!0),t[s]=o,n[$d(s)]=s,n[$d(o.attribute)]=s}return new vo(t,n,e.space)}const _x=jl({properties:{ariaActiveDescendant:null,ariaAtomic:Xt,ariaAutoComplete:null,ariaBusy:Xt,ariaChecked:Xt,ariaColCount:ge,ariaColIndex:ge,ariaColSpan:ge,ariaControls:xt,ariaCurrent:null,ariaDescribedBy:xt,ariaDetails:null,ariaDisabled:Xt,ariaDropEffect:xt,ariaErrorMessage:null,ariaExpanded:Xt,ariaFlowTo:xt,ariaGrabbed:Xt,ariaHasPopup:null,ariaHidden:Xt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:xt,ariaLevel:ge,ariaLive:null,ariaModal:Xt,ariaMultiLine:Xt,ariaMultiSelectable:Xt,ariaOrientation:null,ariaOwns:xt,ariaPlaceholder:null,ariaPosInSet:ge,ariaPressed:Xt,ariaReadOnly:Xt,ariaRelevant:null,ariaRequired:Xt,ariaRoleDescription:xt,ariaRowCount:ge,ariaRowIndex:ge,ariaRowSpan:ge,ariaSelected:Xt,ariaSetSize:ge,ariaSort:null,ariaValueMax:ge,ariaValueMin:ge,ariaValueNow:ge,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function vx(e,t){return t in e?e[t]:t}function bx(e,t){return vx(e,t.toLowerCase())}const V2=jl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Rl,acceptCharset:xt,accessKey:xt,action:null,allow:null,allowFullScreen:Fe,allowPaymentRequest:Fe,allowUserMedia:Fe,alt:null,as:null,async:Fe,autoCapitalize:null,autoComplete:xt,autoFocus:Fe,autoPlay:Fe,blocking:xt,capture:null,charSet:null,checked:Fe,cite:null,className:xt,cols:ge,colSpan:null,content:null,contentEditable:Xt,controls:Fe,controlsList:xt,coords:ge|Rl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Fe,defer:Fe,dir:null,dirName:null,disabled:Fe,download:Yd,draggable:Xt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Fe,formTarget:null,headers:xt,height:ge,hidden:Yd,high:ge,href:null,hrefLang:null,htmlFor:xt,httpEquiv:xt,id:null,imageSizes:null,imageSrcSet:null,inert:Fe,inputMode:null,integrity:null,is:null,isMap:Fe,itemId:null,itemProp:xt,itemRef:xt,itemScope:Fe,itemType:xt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Fe,low:ge,manifest:null,max:null,maxLength:ge,media:null,method:null,min:null,minLength:ge,multiple:Fe,muted:Fe,name:null,nonce:null,noModule:Fe,noValidate:Fe,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:Fe,optimum:ge,pattern:null,ping:xt,placeholder:null,playsInline:Fe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Fe,referrerPolicy:null,rel:xt,required:Fe,reversed:Fe,rows:ge,rowSpan:ge,sandbox:xt,scope:null,scoped:Fe,seamless:Fe,selected:Fe,shadowRootClonable:Fe,shadowRootDelegatesFocus:Fe,shadowRootMode:null,shape:null,size:ge,sizes:null,slot:null,span:ge,spellCheck:Xt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ge,step:null,style:null,tabIndex:ge,target:null,title:null,translate:null,type:null,typeMustMatch:Fe,useMap:null,value:Xt,width:ge,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:xt,axis:null,background:null,bgColor:null,border:ge,borderColor:null,bottomMargin:ge,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Fe,declare:Fe,event:null,face:null,frame:null,frameBorder:null,hSpace:ge,leftMargin:ge,link:null,longDesc:null,lowSrc:null,marginHeight:ge,marginWidth:ge,noResize:Fe,noHref:Fe,noShade:Fe,noWrap:Fe,object:null,profile:null,prompt:null,rev:null,rightMargin:ge,rules:null,scheme:null,scrolling:Xt,standby:null,summary:null,text:null,topMargin:ge,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ge,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Fe,disableRemotePlayback:Fe,prefix:null,property:null,results:ge,security:null,unselectable:null},space:"html",transform:bx}),G2=jl({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:sn,accentHeight:ge,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ge,amplitude:ge,arabicForm:null,ascent:ge,attributeName:null,attributeType:null,azimuth:ge,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ge,by:null,calcMode:null,capHeight:ge,className:xt,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:ge,diffuseConstant:ge,direction:null,display:null,dur:null,divisor:ge,dominantBaseline:null,download:Fe,dx:null,dy:null,edgeMode:null,editable:null,elevation:ge,enableBackground:null,end:null,event:null,exponent:ge,externalResourcesRequired:null,fill:null,fillOpacity:ge,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:Rl,g2:Rl,glyphName:Rl,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ge,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ge,horizOriginX:ge,horizOriginY:ge,id:null,ideographic:ge,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ge,k:ge,k1:ge,k2:ge,k3:ge,k4:ge,kernelMatrix:sn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ge,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ge,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:ge,overlineThickness:ge,paintOrder:null,panose1:null,path:null,pathLength:ge,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:xt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ge,pointsAtY:ge,pointsAtZ:ge,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:sn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:sn,rev:sn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:sn,requiredFeatures:sn,requiredFonts:sn,requiredFormats:sn,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:ge,specularExponent:ge,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ge,strikethroughThickness:ge,string:null,stroke:null,strokeDashArray:sn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ge,strokeOpacity:ge,strokeWidth:null,style:null,surfaceScale:ge,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:sn,tabIndex:ge,tableValues:null,target:null,targetX:ge,targetY:ge,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:sn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ge,underlineThickness:ge,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ge,values:null,vAlphabetic:ge,vMathematical:ge,vectorEffect:null,vHanging:ge,vIdeographic:ge,version:null,vertAdvY:ge,vertOriginX:ge,vertOriginY:ge,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ge,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:vx}),yx=jl({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()}}),xx=jl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:bx}),Sx=jl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),K2={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"},X2=/[A-Z]/g,Vv=/-[a-z]/g,Z2=/^data[-\w.:]+$/i;function Q2(e,t){const n=$d(t);let s=t,a=Yi;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Z2.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(Vv,eE);s="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!Vv.test(o)){let c=o.replace(X2,J2);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}a=Vp}return new a(s,t)}function J2(e){return"-"+e.toLowerCase()}function eE(e){return e.charAt(1).toUpperCase()}const tE=gx([_x,V2,yx,xx,Sx],"html"),Gp=gx([_x,G2,yx,xx,Sx],"svg");function iE(e){return e.join(" ").trim()}var wl={},od,Gv;function nE(){if(Gv)return od;Gv=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,d=`
`,h="/",_="*",v="",b="comment",y="declaration";function S(R,D){if(typeof R!="string")throw new TypeError("First argument must be a string");if(!R)return[];D=D||{};var W=1,j=1;function I(P){var $=P.match(t);$&&(W+=$.length);var C=P.lastIndexOf(d);j=~C?P.length-C:j+P.length}function J(){var P={line:W,column:j};return function($){return $.position=new L(P),pe(),$}}function L(P){this.start=P,this.end={line:W,column:j},this.source=D.source}L.prototype.content=R;function te(P){var $=new Error(D.source+":"+W+":"+j+": "+P);if($.reason=P,$.filename=D.source,$.line=W,$.column=j,$.source=R,!D.silent)throw $}function X(P){var $=P.exec(R);if($){var C=$[0];return I(C),R=R.slice(C.length),$}}function pe(){X(n)}function G(P){var $;for(P=P||[];$=K();)$!==!1&&P.push($);return P}function K(){var P=J();if(!(h!=R.charAt(0)||_!=R.charAt(1))){for(var $=2;v!=R.charAt($)&&(_!=R.charAt($)||h!=R.charAt($+1));)++$;if($+=2,v===R.charAt($-1))return te("End of comment missing");var C=R.slice(2,$-2);return j+=2,I(C),R=R.slice($),j+=2,P({type:b,comment:C})}}function V(){var P=J(),$=X(s);if($){if(K(),!X(a))return te("property missing ':'");var C=X(o),B=P({type:y,property:A($[0].replace(e,v)),value:C?A(C[0].replace(e,v)):v});return X(c),B}}function z(){var P=[];G(P);for(var $;$=V();)$!==!1&&(P.push($),G(P));return P}return pe(),z()}function A(R){return R?R.replace(f,v):v}return od=S,od}var Kv;function rE(){if(Kv)return wl;Kv=1;var e=wl&&wl.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(wl,"__esModule",{value:!0}),wl.default=n;const t=e(nE());function n(s,a){let o=null;if(!s||typeof s!="string")return o;const c=(0,t.default)(s),f=typeof a=="function";return c.forEach(d=>{if(d.type!=="declaration")return;const{property:h,value:_}=d;f?a(h,_,d):_&&(o=o||{},o[h]=_)}),o}return wl}var Ya={},Xv;function sE(){if(Xv)return Ya;Xv=1,Object.defineProperty(Ya,"__esModule",{value:!0}),Ya.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(h){return!h||n.test(h)||e.test(h)},c=function(h,_){return _.toUpperCase()},f=function(h,_){return"".concat(_,"-")},d=function(h,_){return _===void 0&&(_={}),o(h)?h:(h=h.toLowerCase(),_.reactCompat?h=h.replace(a,f):h=h.replace(s,f),h.replace(t,c))};return Ya.camelCase=d,Ya}var Va,Zv;function lE(){if(Zv)return Va;Zv=1;var e=Va&&Va.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(rE()),n=sE();function s(a,o){var c={};return!a||typeof a!="string"||(0,t.default)(a,function(f,d){f&&d&&(c[(0,n.camelCase)(f,o)]=d)}),c}return s.default=s,Va=s,Va}var aE=lE();const oE=$y(aE),wx=Cx("end"),Kp=Cx("start");function Cx(e){return t;function t(n){const s=n&&n.position&&n.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function cE(e){const t=Kp(e),n=wx(e);if(t&&n)return{start:t,end:n}}function ao(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Qv(e.position):"start"in e||"end"in e?Qv(e):"line"in e||"column"in e?Gd(e):""}function Gd(e){return Jv(e&&e.line)+":"+Jv(e&&e.column)}function Qv(e){return Gd(e&&e.start)+"-"+Gd(e&&e.end)}function Jv(e){return e&&typeof e=="number"?e:1}class ki extends Error{constructor(t,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let a="",o={},c=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?a=t:!o.cause&&t&&(c=!0,a=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof s=="string"){const d=s.indexOf(":");d===-1?o.ruleId=s:(o.source=s.slice(0,d),o.ruleId=s.slice(d+1))}if(!o.place&&o.ancestors&&o.ancestors){const d=o.ancestors[o.ancestors.length-1];d&&(o.place=d.position)}const f=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.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=ao(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=c&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}ki.prototype.file="";ki.prototype.name="";ki.prototype.reason="";ki.prototype.message="";ki.prototype.stack="";ki.prototype.column=void 0;ki.prototype.line=void 0;ki.prototype.ancestors=void 0;ki.prototype.cause=void 0;ki.prototype.fatal=void 0;ki.prototype.place=void 0;ki.prototype.ruleId=void 0;ki.prototype.source=void 0;const Xp={}.hasOwnProperty,uE=new Map,hE=/[A-Z]/g,fE=new Set(["table","tbody","thead","tfoot","tr"]),dE=new Set(["td","th"]),kx="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function pE(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let s;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=SE(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=xE(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Gp:tE,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=Ex(a,e,void 0);return o&&typeof o!="string"?o:a.create(e,a.Fragment,{children:o||void 0},void 0)}function Ex(e,t,n){if(t.type==="element")return mE(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return gE(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return vE(e,t,n);if(t.type==="mdxjsEsm")return _E(e,t);if(t.type==="root")return bE(e,t,n);if(t.type==="text")return yE(e,t)}function mE(e,t,n){const s=e.schema;let a=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(a=Gp,e.schema=a),e.ancestors.push(t);const o=Tx(e,t.tagName,!1),c=wE(e,t);let f=Qp(e,t);return fE.has(t.tagName)&&(f=f.filter(function(d){return typeof d=="string"?!$2(d):!0})),Ax(e,c,o,t),Zp(c,f),e.ancestors.pop(),e.schema=s,e.create(t,o,c,n)}function gE(e,t){if(t.data&&t.data.estree&&e.evaluater){const s=t.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}fo(e,t.position)}function _E(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);fo(e,t.position)}function vE(e,t,n){const s=e.schema;let a=s;t.name==="svg"&&s.space==="html"&&(a=Gp,e.schema=a),e.ancestors.push(t);const o=t.name===null?e.Fragment:Tx(e,t.name,!0),c=CE(e,t),f=Qp(e,t);return Ax(e,c,o,t),Zp(c,f),e.ancestors.pop(),e.schema=s,e.create(t,o,c,n)}function bE(e,t,n){const s={};return Zp(s,Qp(e,t)),e.create(t,e.Fragment,s,n)}function yE(e,t){return t.value}function Ax(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function Zp(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function xE(e,t,n){return s;function s(a,o,c,f){const h=Array.isArray(c.children)?n:t;return f?h(o,c,f):h(o,c)}}function SE(e,t){return n;function n(s,a,o,c){const f=Array.isArray(o.children),d=Kp(s);return t(a,o,c,f,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function wE(e,t){const n={};let s,a;for(a in t.properties)if(a!=="children"&&Xp.call(t.properties,a)){const o=kE(e,a,t.properties[a]);if(o){const[c,f]=o;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&dE.has(t.tagName)?s=f:n[c]=f}}if(s){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function CE(e,t){const n={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const o=s.data.estree.body[0];o.type;const c=o.expression;c.type;const f=c.properties[0];f.type,Object.assign(n,e.evaluater.evaluateExpression(f.argument))}else fo(e,t.position);else{const a=s.name;let o;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const f=s.value.data.estree.body[0];f.type,o=e.evaluater.evaluateExpression(f.expression)}else fo(e,t.position);else o=s.value===null?!0:s.value;n[a]=o}return n}function Qp(e,t){const n=[];let s=-1;const a=e.passKeys?new Map:uE;for(;++s<t.children.length;){const o=t.children[s];let c;if(e.passKeys){const d=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(d){const h=a.get(d)||0;c=d+"-"+h,a.set(d,h+1)}}const f=Ex(e,o,c);f!==void 0&&n.push(f)}return n}function kE(e,t,n){const s=Q2(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?P2(n):iE(n)),s.property==="style"){let a=typeof n=="object"?n:EE(e,String(n));return e.stylePropertyNameCase==="css"&&(a=AE(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&s.space?K2[s.property]||s.property:s.attribute,n]}}function EE(e,t){try{return oE(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const s=n,a=new ki("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=kx+"#cannot-parse-style-attribute",a}}function Tx(e,t,n){let s;if(!n)s={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let o=-1,c;for(;++o<a.length;){const f=qv(a[o])?{type:"Identifier",name:a[o]}:{type:"Literal",value:a[o]};c=c?{type:"MemberExpression",object:c,property:f,computed:!!(o&&f.type==="Literal"),optional:!1}:f}s=c}else s=qv(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const a=s.value;return Xp.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(s);fo(e)}function fo(e,t){const n=new ki("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=kx+"#cannot-handle-mdx-estrees-without-createevaluater",n}function AE(e){const t={};let n;for(n in e)Xp.call(e,n)&&(t[TE(n)]=e[n]);return t}function TE(e){let t=e.replace(hE,NE);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function NE(e){return"-"+e.toLowerCase()}const cd={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"]},DE={};function Jp(e,t){const n=DE,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Nx(e,s,a)}function Nx(e,t,n){if(RE(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return eb(e.children,t,n)}return Array.isArray(e)?eb(e,t,n):""}function eb(e,t,n){const s=[];let a=-1;for(;++a<e.length;)s[a]=Nx(e[a],t,n);return s.join("")}function RE(e){return!!(e&&typeof e=="object")}const tb=document.createElement("i");function em(e){const t="&"+e+";";tb.innerHTML=t;const n=tb.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function an(e,t,n,s){const a=e.length;let o=0,c;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,s.length<1e4)c=Array.from(s),c.unshift(t,n),e.splice(...c);else for(n&&e.splice(t,n);o<s.length;)c=s.slice(o,o+1e4),c.unshift(t,0),e.splice(...c),o+=1e4,t+=1e4}function An(e,t){return e.length>0?(an(e,e.length,0,t),e):t}const ib={}.hasOwnProperty;function Dx(e){const t={};let n=-1;for(;++n<e.length;)ME(t,e[n]);return t}function ME(e,t){let n;for(n in t){const a=(ib.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let c;if(o)for(c in o){ib.call(a,c)||(a[c]=[]);const f=o[c];zE(a[c],Array.isArray(f)?f:f?[f]:[])}}}function zE(e,t){let n=-1;const s=[];for(;++n<t.length;)(t[n].add==="after"?e:s).push(t[n]);an(e,0,0,s)}function Rx(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function On(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ri=as(/[A-Za-z]/),Ci=as(/[\dA-Za-z]/),LE=as(/[#-'*+\--9=?A-Z^-~]/);function mu(e){return e!==null&&(e<32||e===127)}const Kd=as(/\d/),OE=as(/[\dA-Fa-f]/),BE=as(/[!-/:-@[-`{-~]/);function Me(e){return e!==null&&e<-2}function bt(e){return e!==null&&(e<0||e===32)}function Xe(e){return e===-2||e===-1||e===32}const Eu=as(new RegExp("\\p{P}|\\p{S}","u")),Ls=as(/\s/);function as(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Hl(e){const t=[];let n=-1,s=0,a=0;for(;++n<e.length;){const o=e.charCodeAt(n);let c="";if(o===37&&Ci(e.charCodeAt(n+1))&&Ci(e.charCodeAt(n+2)))a=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(c=String.fromCharCode(o));else if(o>55295&&o<57344){const f=e.charCodeAt(n+1);o<56320&&f>56319&&f<57344?(c=String.fromCharCode(o,f),a=1):c="�"}else c=String.fromCharCode(o);c&&(t.push(e.slice(s,n),encodeURIComponent(c)),s=n+a+1,c=""),a&&(n+=a,a=0)}return t.join("")+e.slice(s)}function it(e,t,n,s){const a=s?s-1:Number.POSITIVE_INFINITY;let o=0;return c;function c(d){return Xe(d)?(e.enter(n),f(d)):t(d)}function f(d){return Xe(d)&&o++<a?(e.consume(d),f):(e.exit(n),t(d))}}const jE={tokenize:HE};function HE(e){const t=e.attempt(this.parser.constructs.contentInitial,s,a);let n;return t;function s(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),it(e,t,"linePrefix")}function a(f){return e.enter("paragraph"),o(f)}function o(f){const d=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=d),n=d,c(f)}function c(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return Me(f)?(e.consume(f),e.exit("chunkText"),o):(e.consume(f),c)}}const IE={tokenize:PE},nb={tokenize:UE};function PE(e){const t=this,n=[];let s=0,a,o,c;return f;function f(j){if(s<n.length){const I=n[s];return t.containerState=I[1],e.attempt(I[0].continuation,d,h)(j)}return h(j)}function d(j){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&W();const I=t.events.length;let J=I,L;for(;J--;)if(t.events[J][0]==="exit"&&t.events[J][1].type==="chunkFlow"){L=t.events[J][1].end;break}D(s);let te=I;for(;te<t.events.length;)t.events[te][1].end={...L},te++;return an(t.events,J+1,0,t.events.slice(I)),t.events.length=te,h(j)}return f(j)}function h(j){if(s===n.length){if(!a)return b(j);if(a.currentConstruct&&a.currentConstruct.concrete)return S(j);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(nb,_,v)(j)}function _(j){return a&&W(),D(s),b(j)}function v(j){return t.parser.lazy[t.now().line]=s!==n.length,c=t.now().offset,S(j)}function b(j){return t.containerState={},e.attempt(nb,y,S)(j)}function y(j){return s++,n.push([t.currentConstruct,t.containerState]),b(j)}function S(j){if(j===null){a&&W(),D(0),e.consume(j);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:o}),A(j)}function A(j){if(j===null){R(e.exit("chunkFlow"),!0),D(0),e.consume(j);return}return Me(j)?(e.consume(j),R(e.exit("chunkFlow")),s=0,t.interrupt=void 0,f):(e.consume(j),A)}function R(j,I){const J=t.sliceStream(j);if(I&&J.push(null),j.previous=o,o&&(o.next=j),o=j,a.defineSkip(j.start),a.write(J),t.parser.lazy[j.start.line]){let L=a.events.length;for(;L--;)if(a.events[L][1].start.offset<c&&(!a.events[L][1].end||a.events[L][1].end.offset>c))return;const te=t.events.length;let X=te,pe,G;for(;X--;)if(t.events[X][0]==="exit"&&t.events[X][1].type==="chunkFlow"){if(pe){G=t.events[X][1].end;break}pe=!0}for(D(s),L=te;L<t.events.length;)t.events[L][1].end={...G},L++;an(t.events,X+1,0,t.events.slice(te)),t.events.length=L}}function D(j){let I=n.length;for(;I-- >j;){const J=n[I];t.containerState=J[1],J[0].exit.call(t,e)}n.length=j}function W(){a.write([null]),o=void 0,a=void 0,t.containerState._closeFlow=void 0}}function UE(e,t,n){return it(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ll(e){if(e===null||bt(e)||Ls(e))return 1;if(Eu(e))return 2}function Au(e,t,n){const s=[];let a=-1;for(;++a<e.length;){const o=e[a].resolveAll;o&&!s.includes(o)&&(t=o(t,n),s.push(o))}return t}const Xd={name:"attention",resolveAll:FE,tokenize:WE};function FE(e,t){let n=-1,s,a,o,c,f,d,h,_;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(s=n;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&t.sliceSerialize(e[s][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[s][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;d=e[s][1].end.offset-e[s][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const v={...e[s][1].end},b={...e[n][1].start};rb(v,-d),rb(b,d),c={type:d>1?"strongSequence":"emphasisSequence",start:v,end:{...e[s][1].end}},f={type:d>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:b},o={type:d>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},a={type:d>1?"strong":"emphasis",start:{...c.start},end:{...f.end}},e[s][1].end={...c.start},e[n][1].start={...f.end},h=[],e[s][1].end.offset-e[s][1].start.offset&&(h=An(h,[["enter",e[s][1],t],["exit",e[s][1],t]])),h=An(h,[["enter",a,t],["enter",c,t],["exit",c,t],["enter",o,t]]),h=An(h,Au(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),h=An(h,[["exit",o,t],["enter",f,t],["exit",f,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(_=2,h=An(h,[["enter",e[n][1],t],["exit",e[n][1],t]])):_=0,an(e,s-1,n-s+3,h),n=s+h.length-_-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function WE(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,a=Ll(s);let o;return c;function c(d){return o=d,e.enter("attentionSequence"),f(d)}function f(d){if(d===o)return e.consume(d),f;const h=e.exit("attentionSequence"),_=Ll(d),v=!_||_===2&&a||n.includes(d),b=!a||a===2&&_||n.includes(s);return h._open=!!(o===42?v:v&&(a||!b)),h._close=!!(o===42?b:b&&(_||!v)),t(d)}}function rb(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const qE={name:"autolink",tokenize:$E};function $E(e,t,n){let s=0;return a;function a(y){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(y){return Ri(y)?(e.consume(y),c):y===64?n(y):h(y)}function c(y){return y===43||y===45||y===46||Ci(y)?(s=1,f(y)):h(y)}function f(y){return y===58?(e.consume(y),s=0,d):(y===43||y===45||y===46||Ci(y))&&s++<32?(e.consume(y),f):(s=0,h(y))}function d(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)?n(y):(e.consume(y),d)}function h(y){return y===64?(e.consume(y),_):LE(y)?(e.consume(y),h):n(y)}function _(y){return Ci(y)?v(y):n(y)}function v(y){return y===46?(e.consume(y),s=0,_):y===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):b(y)}function b(y){if((y===45||Ci(y))&&s++<63){const S=y===45?b:v;return e.consume(y),S}return n(y)}}const bo={partial:!0,tokenize:YE};function YE(e,t,n){return s;function s(o){return Xe(o)?it(e,a,"linePrefix")(o):a(o)}function a(o){return o===null||Me(o)?t(o):n(o)}}const Mx={continuation:{tokenize:GE},exit:KE,name:"blockQuote",tokenize:VE};function VE(e,t,n){const s=this;return a;function a(c){if(c===62){const f=s.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),o}return n(c)}function o(c){return Xe(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function GE(e,t,n){const s=this;return a;function a(c){return Xe(c)?it(e,o,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):o(c)}function o(c){return e.attempt(Mx,t,n)(c)}}function KE(e){e.exit("blockQuote")}const zx={name:"characterEscape",tokenize:XE};function XE(e,t,n){return s;function s(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),a}function a(o){return BE(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const Lx={name:"characterReference",tokenize:ZE};function ZE(e,t,n){const s=this;let a=0,o,c;return f;function f(v){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(v),e.exit("characterReferenceMarker"),d}function d(v){return v===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(v),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),o=31,c=Ci,_(v))}function h(v){return v===88||v===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(v),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,c=OE,_):(e.enter("characterReferenceValue"),o=7,c=Kd,_(v))}function _(v){if(v===59&&a){const b=e.exit("characterReferenceValue");return c===Ci&&!em(s.sliceSerialize(b))?n(v):(e.enter("characterReferenceMarker"),e.consume(v),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(v)&&a++<o?(e.consume(v),_):n(v)}}const sb={partial:!0,tokenize:JE},lb={concrete:!0,name:"codeFenced",tokenize:QE};function QE(e,t,n){const s=this,a={partial:!0,tokenize:J};let o=0,c=0,f;return d;function d(L){return h(L)}function h(L){const te=s.events[s.events.length-1];return o=te&&te[1].type==="linePrefix"?te[2].sliceSerialize(te[1],!0).length:0,f=L,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),_(L)}function _(L){return L===f?(c++,e.consume(L),_):c<3?n(L):(e.exit("codeFencedFenceSequence"),Xe(L)?it(e,v,"whitespace")(L):v(L))}function v(L){return L===null||Me(L)?(e.exit("codeFencedFence"),s.interrupt?t(L):e.check(sb,A,I)(L)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(L))}function b(L){return L===null||Me(L)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),v(L)):Xe(L)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),it(e,y,"whitespace")(L)):L===96&&L===f?n(L):(e.consume(L),b)}function y(L){return L===null||Me(L)?v(L):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),S(L))}function S(L){return L===null||Me(L)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),v(L)):L===96&&L===f?n(L):(e.consume(L),S)}function A(L){return e.attempt(a,I,R)(L)}function R(L){return e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),D}function D(L){return o>0&&Xe(L)?it(e,W,"linePrefix",o+1)(L):W(L)}function W(L){return L===null||Me(L)?e.check(sb,A,I)(L):(e.enter("codeFlowValue"),j(L))}function j(L){return L===null||Me(L)?(e.exit("codeFlowValue"),W(L)):(e.consume(L),j)}function I(L){return e.exit("codeFenced"),t(L)}function J(L,te,X){let pe=0;return G;function G($){return L.enter("lineEnding"),L.consume($),L.exit("lineEnding"),K}function K($){return L.enter("codeFencedFence"),Xe($)?it(L,V,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):V($)}function V($){return $===f?(L.enter("codeFencedFenceSequence"),z($)):X($)}function z($){return $===f?(pe++,L.consume($),z):pe>=c?(L.exit("codeFencedFenceSequence"),Xe($)?it(L,P,"whitespace")($):P($)):X($)}function P($){return $===null||Me($)?(L.exit("codeFencedFence"),te($)):X($)}}}function JE(e,t,n){const s=this;return a;function a(c){return c===null?n(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o)}function o(c){return s.parser.lazy[s.now().line]?n(c):t(c)}}const ud={name:"codeIndented",tokenize:t5},e5={partial:!0,tokenize:i5};function t5(e,t,n){const s=this;return a;function a(h){return e.enter("codeIndented"),it(e,o,"linePrefix",5)(h)}function o(h){const _=s.events[s.events.length-1];return _&&_[1].type==="linePrefix"&&_[2].sliceSerialize(_[1],!0).length>=4?c(h):n(h)}function c(h){return h===null?d(h):Me(h)?e.attempt(e5,c,d)(h):(e.enter("codeFlowValue"),f(h))}function f(h){return h===null||Me(h)?(e.exit("codeFlowValue"),c(h)):(e.consume(h),f)}function d(h){return e.exit("codeIndented"),t(h)}}function i5(e,t,n){const s=this;return a;function a(c){return s.parser.lazy[s.now().line]?n(c):Me(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),a):it(e,o,"linePrefix",5)(c)}function o(c){const f=s.events[s.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(c):Me(c)?a(c):n(c)}}const n5={name:"codeText",previous:s5,resolve:r5,tokenize:l5};function r5(e){let t=e.length-4,n=3,s,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=n;++s<t;)if(e[s][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(s=n-1,t++;++s<=t;)a===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(a=s):(s===t||e[s][1].type==="lineEnding")&&(e[a][1].type="codeTextData",s!==a+2&&(e[a][1].end=e[s-1][1].end,e.splice(a+2,s-a-2),t-=s-a-2,s=a+2),a=void 0);return e}function s5(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function l5(e,t,n){let s=0,a,o;return c;function c(v){return e.enter("codeText"),e.enter("codeTextSequence"),f(v)}function f(v){return v===96?(e.consume(v),s++,f):(e.exit("codeTextSequence"),d(v))}function d(v){return v===null?n(v):v===32?(e.enter("space"),e.consume(v),e.exit("space"),d):v===96?(o=e.enter("codeTextSequence"),a=0,_(v)):Me(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),d):(e.enter("codeTextData"),h(v))}function h(v){return v===null||v===32||v===96||Me(v)?(e.exit("codeTextData"),d(v)):(e.consume(v),h)}function _(v){return v===96?(e.consume(v),a++,_):a===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(v)):(o.type="codeTextData",h(v))}}class a5{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const s=n??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(t,s):t>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(t,n,s){const a=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return s&&Ga(this.left,s),o.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),Ga(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ga(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Ga(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Ga(this.left,n.reverse())}}}function Ga(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Ox(e){const t={};let n=-1,s,a,o,c,f,d,h;const _=new a5(e);for(;++n<_.length;){for(;n in t;)n=t[n];if(s=_.get(n),n&&s[1].type==="chunkFlow"&&_.get(n-1)[1].type==="listItemPrefix"&&(d=s[1]._tokenizer.events,o=0,o<d.length&&d[o][1].type==="lineEndingBlank"&&(o+=2),o<d.length&&d[o][1].type==="content"))for(;++o<d.length&&d[o][1].type!=="content";)d[o][1].type==="chunkText"&&(d[o][1]._isInFirstContentOfListItem=!0,o++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,o5(_,n)),n=t[n],h=!0);else if(s[1]._container){for(o=n,a=void 0;o--;)if(c=_.get(o),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(a&&(_.get(a)[1].type="lineEndingBlank"),c[1].type="lineEnding",a=o);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;a&&(s[1].end={..._.get(a)[1].start},f=_.slice(a,n),f.unshift(s),_.splice(a,n-a+1,f))}}return an(e,0,Number.POSITIVE_INFINITY,_.slice(0)),!h}function o5(e,t){const n=e.get(t)[1],s=e.get(t)[2];let a=t-1;const o=[];let c=n._tokenizer;c||(c=s.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const f=c.events,d=[],h={};let _,v,b=-1,y=n,S=0,A=0;const R=[A];for(;y;){for(;e.get(++a)[1]!==y;);o.push(a),y._tokenizer||(_=s.sliceStream(y),y.next||_.push(null),v&&c.defineSkip(y.start),y._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(_),y._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),v=y,y=y.next}for(y=n;++b<f.length;)f[b][0]==="exit"&&f[b-1][0]==="enter"&&f[b][1].type===f[b-1][1].type&&f[b][1].start.line!==f[b][1].end.line&&(A=b+1,R.push(A),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(c.events=[],y?(y._tokenizer=void 0,y.previous=void 0):R.pop(),b=R.length;b--;){const D=f.slice(R[b],R[b+1]),W=o.pop();d.push([W,W+D.length-1]),e.splice(W,2,D)}for(d.reverse(),b=-1;++b<d.length;)h[S+d[b][0]]=S+d[b][1],S+=d[b][1]-d[b][0]-1;return h}const c5={resolve:h5,tokenize:f5},u5={partial:!0,tokenize:d5};function h5(e){return Ox(e),e}function f5(e,t){let n;return s;function s(f){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(f)}function a(f){return f===null?o(f):Me(f)?e.check(u5,c,o)(f):(e.consume(f),a)}function o(f){return e.exit("chunkContent"),e.exit("content"),t(f)}function c(f){return e.consume(f),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function d5(e,t,n){const s=this;return a;function a(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),it(e,o,"linePrefix")}function o(c){if(c===null||Me(c))return n(c);const f=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(c):e.interrupt(s.parser.constructs.flow,n,t)(c)}}function Bx(e,t,n,s,a,o,c,f,d){const h=d||Number.POSITIVE_INFINITY;let _=0;return v;function v(D){return D===60?(e.enter(s),e.enter(a),e.enter(o),e.consume(D),e.exit(o),b):D===null||D===32||D===41||mu(D)?n(D):(e.enter(s),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),A(D))}function b(D){return D===62?(e.enter(o),e.consume(D),e.exit(o),e.exit(a),e.exit(s),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),y(D))}function y(D){return D===62?(e.exit("chunkString"),e.exit(f),b(D)):D===null||D===60||Me(D)?n(D):(e.consume(D),D===92?S:y)}function S(D){return D===60||D===62||D===92?(e.consume(D),y):y(D)}function A(D){return!_&&(D===null||D===41||bt(D))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(s),t(D)):_<h&&D===40?(e.consume(D),_++,A):D===41?(e.consume(D),_--,A):D===null||D===32||D===40||mu(D)?n(D):(e.consume(D),D===92?R:A)}function R(D){return D===40||D===41||D===92?(e.consume(D),A):A(D)}}function jx(e,t,n,s,a,o){const c=this;let f=0,d;return h;function h(y){return e.enter(s),e.enter(a),e.consume(y),e.exit(a),e.enter(o),_}function _(y){return f>999||y===null||y===91||y===93&&!d||y===94&&!f&&"_hiddenFootnoteSupport"in c.parser.constructs?n(y):y===93?(e.exit(o),e.enter(a),e.consume(y),e.exit(a),e.exit(s),t):Me(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),_):(e.enter("chunkString",{contentType:"string"}),v(y))}function v(y){return y===null||y===91||y===93||Me(y)||f++>999?(e.exit("chunkString"),_(y)):(e.consume(y),d||(d=!Xe(y)),y===92?b:v)}function b(y){return y===91||y===92||y===93?(e.consume(y),f++,v):v(y)}}function Hx(e,t,n,s,a,o){let c;return f;function f(b){return b===34||b===39||b===40?(e.enter(s),e.enter(a),e.consume(b),e.exit(a),c=b===40?41:b,d):n(b)}function d(b){return b===c?(e.enter(a),e.consume(b),e.exit(a),e.exit(s),t):(e.enter(o),h(b))}function h(b){return b===c?(e.exit(o),d(c)):b===null?n(b):Me(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),it(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),_(b))}function _(b){return b===c||b===null||Me(b)?(e.exit("chunkString"),h(b)):(e.consume(b),b===92?v:_)}function v(b){return b===c||b===92?(e.consume(b),_):_(b)}}function oo(e,t){let n;return s;function s(a){return Me(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,s):Xe(a)?it(e,s,n?"linePrefix":"lineSuffix")(a):t(a)}}const p5={name:"definition",tokenize:g5},m5={partial:!0,tokenize:_5};function g5(e,t,n){const s=this;let a;return o;function o(y){return e.enter("definition"),c(y)}function c(y){return jx.call(s,e,f,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function f(y){return a=On(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),d):n(y)}function d(y){return bt(y)?oo(e,h)(y):h(y)}function h(y){return Bx(e,_,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function _(y){return e.attempt(m5,v,v)(y)}function v(y){return Xe(y)?it(e,b,"whitespace")(y):b(y)}function b(y){return y===null||Me(y)?(e.exit("definition"),s.parser.defined.push(a),t(y)):n(y)}}function _5(e,t,n){return s;function s(f){return bt(f)?oo(e,a)(f):n(f)}function a(f){return Hx(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function o(f){return Xe(f)?it(e,c,"whitespace")(f):c(f)}function c(f){return f===null||Me(f)?t(f):n(f)}}const v5={name:"hardBreakEscape",tokenize:b5};function b5(e,t,n){return s;function s(o){return e.enter("hardBreakEscape"),e.consume(o),a}function a(o){return Me(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const y5={name:"headingAtx",resolve:x5,tokenize:S5};function x5(e,t){let n=e.length-2,s=3,a,o;return e[s][1].type==="whitespace"&&(s+=2),n-2>s&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(s===n-1||n-4>s&&e[n-2][1].type==="whitespace")&&(n-=s+1===n?2:4),n>s&&(a={type:"atxHeadingText",start:e[s][1].start,end:e[n][1].end},o={type:"chunkText",start:e[s][1].start,end:e[n][1].end,contentType:"text"},an(e,s,n-s+1,[["enter",a,t],["enter",o,t],["exit",o,t],["exit",a,t]])),e}function S5(e,t,n){let s=0;return a;function a(_){return e.enter("atxHeading"),o(_)}function o(_){return e.enter("atxHeadingSequence"),c(_)}function c(_){return _===35&&s++<6?(e.consume(_),c):_===null||bt(_)?(e.exit("atxHeadingSequence"),f(_)):n(_)}function f(_){return _===35?(e.enter("atxHeadingSequence"),d(_)):_===null||Me(_)?(e.exit("atxHeading"),t(_)):Xe(_)?it(e,f,"whitespace")(_):(e.enter("atxHeadingText"),h(_))}function d(_){return _===35?(e.consume(_),d):(e.exit("atxHeadingSequence"),f(_))}function h(_){return _===null||_===35||bt(_)?(e.exit("atxHeadingText"),f(_)):(e.consume(_),h)}}const w5=["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"],ab=["pre","script","style","textarea"],C5={concrete:!0,name:"htmlFlow",resolveTo:A5,tokenize:T5},k5={partial:!0,tokenize:D5},E5={partial:!0,tokenize:N5};function A5(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 T5(e,t,n){const s=this;let a,o,c,f,d;return h;function h(k){return _(k)}function _(k){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(k),v}function v(k){return k===33?(e.consume(k),b):k===47?(e.consume(k),o=!0,A):k===63?(e.consume(k),a=3,s.interrupt?t:w):Ri(k)?(e.consume(k),c=String.fromCharCode(k),R):n(k)}function b(k){return k===45?(e.consume(k),a=2,y):k===91?(e.consume(k),a=5,f=0,S):Ri(k)?(e.consume(k),a=4,s.interrupt?t:w):n(k)}function y(k){return k===45?(e.consume(k),s.interrupt?t:w):n(k)}function S(k){const ie="CDATA[";return k===ie.charCodeAt(f++)?(e.consume(k),f===ie.length?s.interrupt?t:V:S):n(k)}function A(k){return Ri(k)?(e.consume(k),c=String.fromCharCode(k),R):n(k)}function R(k){if(k===null||k===47||k===62||bt(k)){const ie=k===47,ue=c.toLowerCase();return!ie&&!o&&ab.includes(ue)?(a=1,s.interrupt?t(k):V(k)):w5.includes(c.toLowerCase())?(a=6,ie?(e.consume(k),D):s.interrupt?t(k):V(k)):(a=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(k):o?W(k):j(k))}return k===45||Ci(k)?(e.consume(k),c+=String.fromCharCode(k),R):n(k)}function D(k){return k===62?(e.consume(k),s.interrupt?t:V):n(k)}function W(k){return Xe(k)?(e.consume(k),W):G(k)}function j(k){return k===47?(e.consume(k),G):k===58||k===95||Ri(k)?(e.consume(k),I):Xe(k)?(e.consume(k),j):G(k)}function I(k){return k===45||k===46||k===58||k===95||Ci(k)?(e.consume(k),I):J(k)}function J(k){return k===61?(e.consume(k),L):Xe(k)?(e.consume(k),J):j(k)}function L(k){return k===null||k===60||k===61||k===62||k===96?n(k):k===34||k===39?(e.consume(k),d=k,te):Xe(k)?(e.consume(k),L):X(k)}function te(k){return k===d?(e.consume(k),d=null,pe):k===null||Me(k)?n(k):(e.consume(k),te)}function X(k){return k===null||k===34||k===39||k===47||k===60||k===61||k===62||k===96||bt(k)?J(k):(e.consume(k),X)}function pe(k){return k===47||k===62||Xe(k)?j(k):n(k)}function G(k){return k===62?(e.consume(k),K):n(k)}function K(k){return k===null||Me(k)?V(k):Xe(k)?(e.consume(k),K):n(k)}function V(k){return k===45&&a===2?(e.consume(k),C):k===60&&a===1?(e.consume(k),B):k===62&&a===4?(e.consume(k),T):k===63&&a===3?(e.consume(k),w):k===93&&a===5?(e.consume(k),ce):Me(k)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(k5,q,z)(k)):k===null||Me(k)?(e.exit("htmlFlowData"),z(k)):(e.consume(k),V)}function z(k){return e.check(E5,P,q)(k)}function P(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),$}function $(k){return k===null||Me(k)?z(k):(e.enter("htmlFlowData"),V(k))}function C(k){return k===45?(e.consume(k),w):V(k)}function B(k){return k===47?(e.consume(k),c="",U):V(k)}function U(k){if(k===62){const ie=c.toLowerCase();return ab.includes(ie)?(e.consume(k),T):V(k)}return Ri(k)&&c.length<8?(e.consume(k),c+=String.fromCharCode(k),U):V(k)}function ce(k){return k===93?(e.consume(k),w):V(k)}function w(k){return k===62?(e.consume(k),T):k===45&&a===2?(e.consume(k),w):V(k)}function T(k){return k===null||Me(k)?(e.exit("htmlFlowData"),q(k)):(e.consume(k),T)}function q(k){return e.exit("htmlFlow"),t(k)}}function N5(e,t,n){const s=this;return a;function a(c){return Me(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o):n(c)}function o(c){return s.parser.lazy[s.now().line]?n(c):t(c)}}function D5(e,t,n){return s;function s(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(bo,t,n)}}const R5={name:"htmlText",tokenize:M5};function M5(e,t,n){const s=this;let a,o,c;return f;function f(w){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(w),d}function d(w){return w===33?(e.consume(w),h):w===47?(e.consume(w),J):w===63?(e.consume(w),j):Ri(w)?(e.consume(w),X):n(w)}function h(w){return w===45?(e.consume(w),_):w===91?(e.consume(w),o=0,S):Ri(w)?(e.consume(w),W):n(w)}function _(w){return w===45?(e.consume(w),y):n(w)}function v(w){return w===null?n(w):w===45?(e.consume(w),b):Me(w)?(c=v,B(w)):(e.consume(w),v)}function b(w){return w===45?(e.consume(w),y):v(w)}function y(w){return w===62?C(w):w===45?b(w):v(w)}function S(w){const T="CDATA[";return w===T.charCodeAt(o++)?(e.consume(w),o===T.length?A:S):n(w)}function A(w){return w===null?n(w):w===93?(e.consume(w),R):Me(w)?(c=A,B(w)):(e.consume(w),A)}function R(w){return w===93?(e.consume(w),D):A(w)}function D(w){return w===62?C(w):w===93?(e.consume(w),D):A(w)}function W(w){return w===null||w===62?C(w):Me(w)?(c=W,B(w)):(e.consume(w),W)}function j(w){return w===null?n(w):w===63?(e.consume(w),I):Me(w)?(c=j,B(w)):(e.consume(w),j)}function I(w){return w===62?C(w):j(w)}function J(w){return Ri(w)?(e.consume(w),L):n(w)}function L(w){return w===45||Ci(w)?(e.consume(w),L):te(w)}function te(w){return Me(w)?(c=te,B(w)):Xe(w)?(e.consume(w),te):C(w)}function X(w){return w===45||Ci(w)?(e.consume(w),X):w===47||w===62||bt(w)?pe(w):n(w)}function pe(w){return w===47?(e.consume(w),C):w===58||w===95||Ri(w)?(e.consume(w),G):Me(w)?(c=pe,B(w)):Xe(w)?(e.consume(w),pe):C(w)}function G(w){return w===45||w===46||w===58||w===95||Ci(w)?(e.consume(w),G):K(w)}function K(w){return w===61?(e.consume(w),V):Me(w)?(c=K,B(w)):Xe(w)?(e.consume(w),K):pe(w)}function V(w){return w===null||w===60||w===61||w===62||w===96?n(w):w===34||w===39?(e.consume(w),a=w,z):Me(w)?(c=V,B(w)):Xe(w)?(e.consume(w),V):(e.consume(w),P)}function z(w){return w===a?(e.consume(w),a=void 0,$):w===null?n(w):Me(w)?(c=z,B(w)):(e.consume(w),z)}function P(w){return w===null||w===34||w===39||w===60||w===61||w===96?n(w):w===47||w===62||bt(w)?pe(w):(e.consume(w),P)}function $(w){return w===47||w===62||bt(w)?pe(w):n(w)}function C(w){return w===62?(e.consume(w),e.exit("htmlTextData"),e.exit("htmlText"),t):n(w)}function B(w){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),U}function U(w){return Xe(w)?it(e,ce,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(w):ce(w)}function ce(w){return e.enter("htmlTextData"),c(w)}}const tm={name:"labelEnd",resolveAll:B5,resolveTo:j5,tokenize:H5},z5={tokenize:I5},L5={tokenize:P5},O5={tokenize:U5};function B5(e){let t=-1;const n=[];for(;++t<e.length;){const s=e[t][1];if(n.push(e[t]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const a=s.type==="labelImage"?4:2;s.type="data",t+=a}}return e.length!==n.length&&an(e,0,e.length,n),e}function j5(e,t){let n=e.length,s=0,a,o,c,f;for(;n--;)if(a=e[n][1],o){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(c){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(o=n,a.type!=="labelLink")){s=2;break}}else a.type==="labelEnd"&&(c=n);const d={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[o][1].start},end:{...e[c][1].end}},_={type:"labelText",start:{...e[o+s+2][1].end},end:{...e[c-2][1].start}};return f=[["enter",d,t],["enter",h,t]],f=An(f,e.slice(o+1,o+s+3)),f=An(f,[["enter",_,t]]),f=An(f,Au(t.parser.constructs.insideSpan.null,e.slice(o+s+4,c-3),t)),f=An(f,[["exit",_,t],e[c-2],e[c-1],["exit",h,t]]),f=An(f,e.slice(c+1)),f=An(f,[["exit",d,t]]),an(e,o,e.length,f),e}function H5(e,t,n){const s=this;let a=s.events.length,o,c;for(;a--;)if((s.events[a][1].type==="labelImage"||s.events[a][1].type==="labelLink")&&!s.events[a][1]._balanced){o=s.events[a][1];break}return f;function f(b){return o?o._inactive?v(b):(c=s.parser.defined.includes(On(s.sliceSerialize({start:o.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(b),e.exit("labelMarker"),e.exit("labelEnd"),d):n(b)}function d(b){return b===40?e.attempt(z5,_,c?_:v)(b):b===91?e.attempt(L5,_,c?h:v)(b):c?_(b):v(b)}function h(b){return e.attempt(O5,_,v)(b)}function _(b){return t(b)}function v(b){return o._balanced=!0,n(b)}}function I5(e,t,n){return s;function s(v){return e.enter("resource"),e.enter("resourceMarker"),e.consume(v),e.exit("resourceMarker"),a}function a(v){return bt(v)?oo(e,o)(v):o(v)}function o(v){return v===41?_(v):Bx(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(v)}function c(v){return bt(v)?oo(e,d)(v):_(v)}function f(v){return n(v)}function d(v){return v===34||v===39||v===40?Hx(e,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(v):_(v)}function h(v){return bt(v)?oo(e,_)(v):_(v)}function _(v){return v===41?(e.enter("resourceMarker"),e.consume(v),e.exit("resourceMarker"),e.exit("resource"),t):n(v)}}function P5(e,t,n){const s=this;return a;function a(f){return jx.call(s,e,o,c,"reference","referenceMarker","referenceString")(f)}function o(f){return s.parser.defined.includes(On(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(f):n(f)}function c(f){return n(f)}}function U5(e,t,n){return s;function s(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),a}function a(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const F5={name:"labelStartImage",resolveAll:tm.resolveAll,tokenize:W5};function W5(e,t,n){const s=this;return a;function a(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),o}function o(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),c):n(f)}function c(f){return f===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(f):t(f)}}const q5={name:"labelStartLink",resolveAll:tm.resolveAll,tokenize:$5};function $5(e,t,n){const s=this;return a;function a(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),o}function o(c){return c===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(c):t(c)}}const hd={name:"lineEnding",tokenize:Y5};function Y5(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),it(e,t,"linePrefix")}}const lu={name:"thematicBreak",tokenize:V5};function V5(e,t,n){let s=0,a;return o;function o(h){return e.enter("thematicBreak"),c(h)}function c(h){return a=h,f(h)}function f(h){return h===a?(e.enter("thematicBreakSequence"),d(h)):s>=3&&(h===null||Me(h))?(e.exit("thematicBreak"),t(h)):n(h)}function d(h){return h===a?(e.consume(h),s++,d):(e.exit("thematicBreakSequence"),Xe(h)?it(e,f,"whitespace")(h):f(h))}}const $i={continuation:{tokenize:Z5},exit:J5,name:"list",tokenize:X5},G5={partial:!0,tokenize:eA},K5={partial:!0,tokenize:Q5};function X5(e,t,n){const s=this,a=s.events[s.events.length-1];let o=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,c=0;return f;function f(y){const S=s.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(S==="listUnordered"?!s.containerState.marker||y===s.containerState.marker:Kd(y)){if(s.containerState.type||(s.containerState.type=S,e.enter(S,{_container:!0})),S==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(lu,n,h)(y):h(y);if(!s.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(y)}return n(y)}function d(y){return Kd(y)&&++c<10?(e.consume(y),d):(!s.interrupt||c<2)&&(s.containerState.marker?y===s.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),h(y)):n(y)}function h(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||y,e.check(bo,s.interrupt?n:_,e.attempt(G5,b,v))}function _(y){return s.containerState.initialBlankLine=!0,o++,b(y)}function v(y){return Xe(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),b):n(y)}function b(y){return s.containerState.size=o+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(y)}}function Z5(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(bo,a,o);function a(f){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,it(e,t,"listItemIndent",s.containerState.size+1)(f)}function o(f){return s.containerState.furtherBlankLines||!Xe(f)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,c(f)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(K5,t,c)(f))}function c(f){return s.containerState._closeFlow=!0,s.interrupt=void 0,it(e,e.attempt($i,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function Q5(e,t,n){const s=this;return it(e,a,"listItemIndent",s.containerState.size+1);function a(o){const c=s.events[s.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===s.containerState.size?t(o):n(o)}}function J5(e){e.exit(this.containerState.type)}function eA(e,t,n){const s=this;return it(e,a,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(o){const c=s.events[s.events.length-1];return!Xe(o)&&c&&c[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const ob={name:"setextUnderline",resolveTo:tA,tokenize:iA};function tA(e,t){let n=e.length,s,a,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){s=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const c={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",o?(e.splice(a,0,["enter",c,t]),e.splice(o+1,0,["exit",e[s][1],t]),e[s][1].end={...e[o][1].end}):e[s][1]=c,e.push(["exit",c,t]),e}function iA(e,t,n){const s=this;let a;return o;function o(h){let _=s.events.length,v;for(;_--;)if(s.events[_][1].type!=="lineEnding"&&s.events[_][1].type!=="linePrefix"&&s.events[_][1].type!=="content"){v=s.events[_][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||v)?(e.enter("setextHeadingLine"),a=h,c(h)):n(h)}function c(h){return e.enter("setextHeadingLineSequence"),f(h)}function f(h){return h===a?(e.consume(h),f):(e.exit("setextHeadingLineSequence"),Xe(h)?it(e,d,"lineSuffix")(h):d(h))}function d(h){return h===null||Me(h)?(e.exit("setextHeadingLine"),t(h)):n(h)}}const nA={tokenize:rA};function rA(e){const t=this,n=e.attempt(bo,s,e.attempt(this.parser.constructs.flowInitial,a,it(e,e.attempt(this.parser.constructs.flow,a,e.attempt(c5,a)),"linePrefix")));return n;function s(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const sA={resolveAll:Px()},lA=Ix("string"),aA=Ix("text");function Ix(e){return{resolveAll:Px(e==="text"?oA:void 0),tokenize:t};function t(n){const s=this,a=this.parser.constructs[e],o=n.attempt(a,c,f);return c;function c(_){return h(_)?o(_):f(_)}function f(_){if(_===null){n.consume(_);return}return n.enter("data"),n.consume(_),d}function d(_){return h(_)?(n.exit("data"),o(_)):(n.consume(_),d)}function h(_){if(_===null)return!0;const v=a[_];let b=-1;if(v)for(;++b<v.length;){const y=v[b];if(!y.previous||y.previous.call(s,s.previous))return!0}return!1}}}function Px(e){return t;function t(n,s){let a=-1,o;for(;++a<=n.length;)o===void 0?n[a]&&n[a][1].type==="data"&&(o=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==o+2&&(n[o][1].end=n[a-1][1].end,n.splice(o+2,a-o-2),a=o+2),o=void 0);return e?e(n,s):n}}function oA(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const s=e[n-1][1],a=t.sliceStream(s);let o=a.length,c=-1,f=0,d;for(;o--;){const h=a[o];if(typeof h=="string"){for(c=h.length;h.charCodeAt(c-1)===32;)f++,c--;if(c)break;c=-1}else if(h===-2)d=!0,f++;else if(h!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(f=0),f){const h={type:n===e.length||d||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?c:s.start._bufferIndex+c,_index:s.start._index+o,line:s.end.line,column:s.end.column-f,offset:s.end.offset-f},end:{...s.end}};s.end={...h.start},s.start.offset===s.end.offset?Object.assign(s,h):(e.splice(n,0,["enter",h,t],["exit",h,t]),n+=2)}n++}return e}const cA={42:$i,43:$i,45:$i,48:$i,49:$i,50:$i,51:$i,52:$i,53:$i,54:$i,55:$i,56:$i,57:$i,62:Mx},uA={91:p5},hA={[-2]:ud,[-1]:ud,32:ud},fA={35:y5,42:lu,45:[ob,lu],60:C5,61:ob,95:lu,96:lb,126:lb},dA={38:Lx,92:zx},pA={[-5]:hd,[-4]:hd,[-3]:hd,33:F5,38:Lx,42:Xd,60:[qE,R5],91:q5,92:[v5,zx],93:tm,95:Xd,96:n5},mA={null:[Xd,sA]},gA={null:[42,95]},_A={null:[]},vA=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:gA,contentInitial:uA,disable:_A,document:cA,flow:fA,flowInitial:hA,insideSpan:mA,string:dA,text:pA},Symbol.toStringTag,{value:"Module"}));function bA(e,t,n){let s={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},o=[];let c=[],f=[];const d={attempt:te(J),check:te(L),consume:W,enter:j,exit:I,interrupt:te(L,{interrupt:!0})},h={code:null,containerState:{},defineSkip:A,events:[],now:S,parser:e,previous:null,sliceSerialize:b,sliceStream:y,write:v};let _=t.tokenize.call(h,d);return t.resolveAll&&o.push(t),h;function v(K){return c=An(c,K),R(),c[c.length-1]!==null?[]:(X(t,0),h.events=Au(o,h.events,h),h.events)}function b(K,V){return xA(y(K),V)}function y(K){return yA(c,K)}function S(){const{_bufferIndex:K,_index:V,line:z,column:P,offset:$}=s;return{_bufferIndex:K,_index:V,line:z,column:P,offset:$}}function A(K){a[K.line]=K.column,G()}function R(){let K;for(;s._index<c.length;){const V=c[s._index];if(typeof V=="string")for(K=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===K&&s._bufferIndex<V.length;)D(V.charCodeAt(s._bufferIndex));else D(V)}}function D(K){_=_(K)}function W(K){Me(K)?(s.line++,s.column=1,s.offset+=K===-3?2:1,G()):K!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===c[s._index].length&&(s._bufferIndex=-1,s._index++)),h.previous=K}function j(K,V){const z=V||{};return z.type=K,z.start=S(),h.events.push(["enter",z,h]),f.push(z),z}function I(K){const V=f.pop();return V.end=S(),h.events.push(["exit",V,h]),V}function J(K,V){X(K,V.from)}function L(K,V){V.restore()}function te(K,V){return z;function z(P,$,C){let B,U,ce,w;return Array.isArray(P)?q(P):"tokenize"in P?q([P]):T(P);function T(le){return ve;function ve(Ee){const oe=Ee!==null&&le[Ee],Ie=Ee!==null&&le.null,ot=[...Array.isArray(oe)?oe:oe?[oe]:[],...Array.isArray(Ie)?Ie:Ie?[Ie]:[]];return q(ot)(Ee)}}function q(le){return B=le,U=0,le.length===0?C:k(le[U])}function k(le){return ve;function ve(Ee){return w=pe(),ce=le,le.partial||(h.currentConstruct=le),le.name&&h.parser.constructs.disable.null.includes(le.name)?ue():le.tokenize.call(V?Object.assign(Object.create(h),V):h,d,ie,ue)(Ee)}}function ie(le){return K(ce,w),$}function ue(le){return w.restore(),++U<B.length?k(B[U]):C}}}function X(K,V){K.resolveAll&&!o.includes(K)&&o.push(K),K.resolve&&an(h.events,V,h.events.length-V,K.resolve(h.events.slice(V),h)),K.resolveTo&&(h.events=K.resolveTo(h.events,h))}function pe(){const K=S(),V=h.previous,z=h.currentConstruct,P=h.events.length,$=Array.from(f);return{from:P,restore:C};function C(){s=K,h.previous=V,h.currentConstruct=z,h.events.length=P,f=$,G()}}function G(){s.line in a&&s.column<2&&(s.column=a[s.line],s.offset+=a[s.line]-1)}}function yA(e,t){const n=t.start._index,s=t.start._bufferIndex,a=t.end._index,o=t.end._bufferIndex;let c;if(n===a)c=[e[n].slice(s,o)];else{if(c=e.slice(n,a),s>-1){const f=c[0];typeof f=="string"?c[0]=f.slice(s):c.shift()}o>0&&c.push(e[a].slice(0,o))}return c}function xA(e,t){let n=-1;const s=[];let a;for(;++n<e.length;){const o=e[n];let c;if(typeof o=="string")c=o;else switch(o){case-5:{c="\r";break}case-4:{c=`
`;break}case-3:{c=`\r
`;break}case-2:{c=t?" ":"	";break}case-1:{if(!t&&a)continue;c=" ";break}default:c=String.fromCharCode(o)}a=o===-2,s.push(c)}return s.join("")}function SA(e){const s={constructs:Dx([vA,...(e||{}).extensions||[]]),content:a(jE),defined:[],document:a(IE),flow:a(nA),lazy:{},string:a(lA),text:a(aA)};return s;function a(o){return c;function c(f){return bA(s,o,f)}}}function wA(e){for(;!Ox(e););return e}const cb=/[\0\t\n\r]/g;function CA(){let e=1,t="",n=!0,s;return a;function a(o,c,f){const d=[];let h,_,v,b,y;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(c||void 0).decode(o)),v=0,t="",n&&(o.charCodeAt(0)===65279&&v++,n=void 0);v<o.length;){if(cb.lastIndex=v,h=cb.exec(o),b=h&&h.index!==void 0?h.index:o.length,y=o.charCodeAt(b),!h){t=o.slice(v);break}if(y===10&&v===b&&s)d.push(-3),s=void 0;else switch(s&&(d.push(-5),s=void 0),v<b&&(d.push(o.slice(v,b)),e+=b-v),y){case 0:{d.push(65533),e++;break}case 9:{for(_=Math.ceil(e/4)*4,d.push(-2);e++<_;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:s=!0,e=1}v=b+1}return f&&(s&&d.push(-5),t&&d.push(t),d.push(null)),d}}const kA=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function EA(e){return e.replace(kA,AA)}function AA(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),o=a===120||a===88;return Rx(n.slice(o?2:1),o?16:10)}return em(n)||e}const Ux={}.hasOwnProperty;function TA(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),NA(n)(wA(SA(n).document().write(CA()(e,t,!0))))}function NA(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(Rt),autolinkProtocol:pe,autolinkEmail:pe,atxHeading:o(nt),blockQuote:o(Ie),characterEscape:pe,characterReference:pe,codeFenced:o(ot),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:o(ot,c),codeText:o(yt,c),codeTextData:pe,data:pe,codeFlowValue:pe,definition:o(se),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:o(Oe),hardBreakEscape:o(Je),hardBreakTrailing:o(Je),htmlFlow:o(fi,c),htmlFlowData:pe,htmlText:o(fi,c),htmlTextData:pe,image:o(gt),label:c,link:o(Rt),listItem:o(Vi),listItemValue:b,listOrdered:o(Ot,v),listUnordered:o(Ot),paragraph:o(on),reference:k,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:o(nt),strong:o(Bn),thematicBreak:o(ze)},exit:{atxHeading:d(),atxHeadingSequence:J,autolink:d(),autolinkEmail:oe,autolinkProtocol:Ee,blockQuote:d(),characterEscapeValue:G,characterReferenceMarkerHexadecimal:ue,characterReferenceMarkerNumeric:ue,characterReferenceValue:le,characterReference:ve,codeFenced:d(R),codeFencedFence:A,codeFencedFenceInfo:y,codeFencedFenceMeta:S,codeFlowValue:G,codeIndented:d(D),codeText:d($),codeTextData:G,data:G,definition:d(),definitionDestinationString:I,definitionLabelString:W,definitionTitleString:j,emphasis:d(),hardBreakEscape:d(V),hardBreakTrailing:d(V),htmlFlow:d(z),htmlFlowData:G,htmlText:d(P),htmlTextData:G,image:d(B),label:ce,labelText:U,lineEnding:K,link:d(C),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:ie,resourceDestinationString:w,resourceTitleString:T,resource:q,setextHeading:d(X),setextHeadingLineSequence:te,setextHeadingText:L,strong:d(),thematicBreak:d()}};Fx(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(M){let re={type:"root",children:[]};const ye={stack:[re],tokenStack:[],config:t,enter:f,exit:h,buffer:c,resume:_,data:n},je=[];let rt=-1;for(;++rt<M.length;)if(M[rt][1].type==="listOrdered"||M[rt][1].type==="listUnordered")if(M[rt][0]==="enter")je.push(rt);else{const di=je.pop();rt=a(M,di,rt)}for(rt=-1;++rt<M.length;){const di=t[M[rt][0]];Ux.call(di,M[rt][1].type)&&di[M[rt][1].type].call(Object.assign({sliceSerialize:M[rt][2].sliceSerialize},ye),M[rt][1])}if(ye.tokenStack.length>0){const di=ye.tokenStack[ye.tokenStack.length-1];(di[1]||ub).call(ye,void 0,di[0])}for(re.position={start:Qr(M.length>0?M[0][1].start:{line:1,column:1,offset:0}),end:Qr(M.length>0?M[M.length-2][1].end:{line:1,column:1,offset:0})},rt=-1;++rt<t.transforms.length;)re=t.transforms[rt](re)||re;return re}function a(M,re,ye){let je=re-1,rt=-1,di=!1,cn,qt,Et,At;for(;++je<=ye;){const tt=M[je];switch(tt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{tt[0]==="enter"?rt++:rt--,At=void 0;break}case"lineEndingBlank":{tt[0]==="enter"&&(cn&&!At&&!rt&&!Et&&(Et=je),At=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:At=void 0}if(!rt&&tt[0]==="enter"&&tt[1].type==="listItemPrefix"||rt===-1&&tt[0]==="exit"&&(tt[1].type==="listUnordered"||tt[1].type==="listOrdered")){if(cn){let un=je;for(qt=void 0;un--;){const Ei=M[un];if(Ei[1].type==="lineEnding"||Ei[1].type==="lineEndingBlank"){if(Ei[0]==="exit")continue;qt&&(M[qt][1].type="lineEndingBlank",di=!0),Ei[1].type="lineEnding",qt=un}else if(!(Ei[1].type==="linePrefix"||Ei[1].type==="blockQuotePrefix"||Ei[1].type==="blockQuotePrefixWhitespace"||Ei[1].type==="blockQuoteMarker"||Ei[1].type==="listItemIndent"))break}Et&&(!qt||Et<qt)&&(cn._spread=!0),cn.end=Object.assign({},qt?M[qt][1].start:tt[1].end),M.splice(qt||je,0,["exit",cn,tt[2]]),je++,ye++}if(tt[1].type==="listItemPrefix"){const un={type:"listItem",_spread:!1,start:Object.assign({},tt[1].start),end:void 0};cn=un,M.splice(je,0,["enter",un,tt[2]]),je++,ye++,Et=void 0,At=!0}}}return M[re][1]._spread=di,ye}function o(M,re){return ye;function ye(je){f.call(this,M(je),je),re&&re.call(this,je)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(M,re,ye){this.stack[this.stack.length-1].children.push(M),this.stack.push(M),this.tokenStack.push([re,ye||void 0]),M.position={start:Qr(re.start),end:void 0}}function d(M){return re;function re(ye){M&&M.call(this,ye),h.call(this,ye)}}function h(M,re){const ye=this.stack.pop(),je=this.tokenStack.pop();if(je)je[0].type!==M.type&&(re?re.call(this,M,je[0]):(je[1]||ub).call(this,M,je[0]));else throw new Error("Cannot close `"+M.type+"` ("+ao({start:M.start,end:M.end})+"): it’s not open");ye.position.end=Qr(M.end)}function _(){return Jp(this.stack.pop())}function v(){this.data.expectingFirstListItemValue=!0}function b(M){if(this.data.expectingFirstListItemValue){const re=this.stack[this.stack.length-2];re.start=Number.parseInt(this.sliceSerialize(M),10),this.data.expectingFirstListItemValue=void 0}}function y(){const M=this.resume(),re=this.stack[this.stack.length-1];re.lang=M}function S(){const M=this.resume(),re=this.stack[this.stack.length-1];re.meta=M}function A(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function R(){const M=this.resume(),re=this.stack[this.stack.length-1];re.value=M.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function D(){const M=this.resume(),re=this.stack[this.stack.length-1];re.value=M.replace(/(\r?\n|\r)$/g,"")}function W(M){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.label=re,ye.identifier=On(this.sliceSerialize(M)).toLowerCase()}function j(){const M=this.resume(),re=this.stack[this.stack.length-1];re.title=M}function I(){const M=this.resume(),re=this.stack[this.stack.length-1];re.url=M}function J(M){const re=this.stack[this.stack.length-1];if(!re.depth){const ye=this.sliceSerialize(M).length;re.depth=ye}}function L(){this.data.setextHeadingSlurpLineEnding=!0}function te(M){const re=this.stack[this.stack.length-1];re.depth=this.sliceSerialize(M).codePointAt(0)===61?1:2}function X(){this.data.setextHeadingSlurpLineEnding=void 0}function pe(M){const ye=this.stack[this.stack.length-1].children;let je=ye[ye.length-1];(!je||je.type!=="text")&&(je=St(),je.position={start:Qr(M.start),end:void 0},ye.push(je)),this.stack.push(je)}function G(M){const re=this.stack.pop();re.value+=this.sliceSerialize(M),re.position.end=Qr(M.end)}function K(M){const re=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ye=re.children[re.children.length-1];ye.position.end=Qr(M.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(re.type)&&(pe.call(this,M),G.call(this,M))}function V(){this.data.atHardBreak=!0}function z(){const M=this.resume(),re=this.stack[this.stack.length-1];re.value=M}function P(){const M=this.resume(),re=this.stack[this.stack.length-1];re.value=M}function $(){const M=this.resume(),re=this.stack[this.stack.length-1];re.value=M}function C(){const M=this.stack[this.stack.length-1];if(this.data.inReference){const re=this.data.referenceType||"shortcut";M.type+="Reference",M.referenceType=re,delete M.url,delete M.title}else delete M.identifier,delete M.label;this.data.referenceType=void 0}function B(){const M=this.stack[this.stack.length-1];if(this.data.inReference){const re=this.data.referenceType||"shortcut";M.type+="Reference",M.referenceType=re,delete M.url,delete M.title}else delete M.identifier,delete M.label;this.data.referenceType=void 0}function U(M){const re=this.sliceSerialize(M),ye=this.stack[this.stack.length-2];ye.label=EA(re),ye.identifier=On(re).toLowerCase()}function ce(){const M=this.stack[this.stack.length-1],re=this.resume(),ye=this.stack[this.stack.length-1];if(this.data.inReference=!0,ye.type==="link"){const je=M.children;ye.children=je}else ye.alt=re}function w(){const M=this.resume(),re=this.stack[this.stack.length-1];re.url=M}function T(){const M=this.resume(),re=this.stack[this.stack.length-1];re.title=M}function q(){this.data.inReference=void 0}function k(){this.data.referenceType="collapsed"}function ie(M){const re=this.resume(),ye=this.stack[this.stack.length-1];ye.label=re,ye.identifier=On(this.sliceSerialize(M)).toLowerCase(),this.data.referenceType="full"}function ue(M){this.data.characterReferenceType=M.type}function le(M){const re=this.sliceSerialize(M),ye=this.data.characterReferenceType;let je;ye?(je=Rx(re,ye==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):je=em(re);const rt=this.stack[this.stack.length-1];rt.value+=je}function ve(M){const re=this.stack.pop();re.position.end=Qr(M.end)}function Ee(M){G.call(this,M);const re=this.stack[this.stack.length-1];re.url=this.sliceSerialize(M)}function oe(M){G.call(this,M);const re=this.stack[this.stack.length-1];re.url="mailto:"+this.sliceSerialize(M)}function Ie(){return{type:"blockquote",children:[]}}function ot(){return{type:"code",lang:null,meta:null,value:""}}function yt(){return{type:"inlineCode",value:""}}function se(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Oe(){return{type:"emphasis",children:[]}}function nt(){return{type:"heading",depth:0,children:[]}}function Je(){return{type:"break"}}function fi(){return{type:"html",value:""}}function gt(){return{type:"image",title:null,url:"",alt:null}}function Rt(){return{type:"link",title:null,url:"",children:[]}}function Ot(M){return{type:"list",ordered:M.type==="listOrdered",start:null,spread:M._spread,children:[]}}function Vi(M){return{type:"listItem",spread:M._spread,checked:null,children:[]}}function on(){return{type:"paragraph",children:[]}}function Bn(){return{type:"strong",children:[]}}function St(){return{type:"text",value:""}}function ze(){return{type:"thematicBreak"}}}function Qr(e){return{line:e.line,column:e.column,offset:e.offset}}function Fx(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?Fx(e,s):DA(e,s)}}function DA(e,t){let n;for(n in t)if(Ux.call(t,n))switch(n){case"canContainEols":{const s=t[n];s&&e[n].push(...s);break}case"transforms":{const s=t[n];s&&e[n].push(...s);break}case"enter":case"exit":{const s=t[n];s&&Object.assign(e[n],s);break}}}function ub(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+ao({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+ao({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+ao({start:t.start,end:t.end})+") is still open")}function RA(e){const t=this;t.parser=n;function n(s){return TA(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function MA(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function zA(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
`}]}function LA(e,t){const n=t.value?t.value+`
`:"",s={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(s.className=["language-"+a[0]]);let o={type:"element",tagName:"code",properties:s,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function OA(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function BA(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function jA(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),a=Hl(s.toLowerCase()),o=e.footnoteOrder.indexOf(s);let c,f=e.footnoteCounts.get(s);f===void 0?(f=0,e.footnoteOrder.push(s),c=e.footnoteOrder.length):c=o+1,f+=1,e.footnoteCounts.set(s,f);const d={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};e.patch(t,d);const h={type:"element",tagName:"sup",properties:{},children:[d]};return e.patch(t,h),e.applyData(t,h)}function HA(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function IA(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Wx(e,t){const n=t.referenceType;let s="]";if(n==="collapsed"?s+="[]":n==="full"&&(s+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+s}];const a=e.all(t),o=a[0];o&&o.type==="text"?o.value="["+o.value:a.unshift({type:"text",value:"["});const c=a[a.length-1];return c&&c.type==="text"?c.value+=s:a.push({type:"text",value:s}),a}function PA(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return Wx(e,t);const a={src:Hl(s.url||""),alt:t.alt};s.title!==null&&s.title!==void 0&&(a.title=s.title);const o={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,o),e.applyData(t,o)}function UA(e,t){const n={src:Hl(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,s),e.applyData(t,s)}function FA(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const s={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,s),e.applyData(t,s)}function WA(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return Wx(e,t);const a={href:Hl(s.url||"")};s.title!==null&&s.title!==void 0&&(a.title=s.title);const o={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function qA(e,t){const n={href:Hl(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function $A(e,t,n){const s=e.all(t),a=n?YA(n):qx(t),o={},c=[];if(typeof t.checked=="boolean"){const _=s[0];let v;_&&_.type==="element"&&_.tagName==="p"?v=_:(v={type:"element",tagName:"p",properties:{},children:[]},s.unshift(v)),v.children.length>0&&v.children.unshift({type:"text",value:" "}),v.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let f=-1;for(;++f<s.length;){const _=s[f];(a||f!==0||_.type!=="element"||_.tagName!=="p")&&c.push({type:"text",value:`
`}),_.type==="element"&&_.tagName==="p"&&!a?c.push(..._.children):c.push(_)}const d=s[s.length-1];d&&(a||d.type!=="element"||d.tagName!=="p")&&c.push({type:"text",value:`
`});const h={type:"element",tagName:"li",properties:o,children:c};return e.patch(t,h),e.applyData(t,h)}function YA(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let s=-1;for(;!t&&++s<n.length;)t=qx(n[s])}return t}function qx(e){const t=e.spread;return t??e.children.length>1}function VA(e,t){const n={},s=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a<s.length;){const c=s[a];if(c.type==="element"&&c.tagName==="li"&&c.properties&&Array.isArray(c.properties.className)&&c.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(s,!0)};return e.patch(t,o),e.applyData(t,o)}function GA(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function KA(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function XA(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function ZA(e,t){const n=e.all(t),s=n.shift(),a=[];if(s){const c={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(t.children[0],c),a.push(c)}if(n.length>0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},f=Kp(t.children[1]),d=wx(t.children[t.children.length-1]);f&&d&&(c.position={start:f,end:d}),a.push(c)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,o),e.applyData(t,o)}function QA(e,t,n){const s=n?n.children:void 0,o=(s?s.indexOf(t):1)===0?"th":"td",c=n&&n.type==="table"?n.align:void 0,f=c?c.length:t.children.length;let d=-1;const h=[];for(;++d<f;){const v=t.children[d],b={},y=c?c[d]:void 0;y&&(b.align=y);let S={type:"element",tagName:o,properties:b,children:[]};v&&(S.children=e.all(v),e.patch(v,S),S=e.applyData(v,S)),h.push(S)}const _={type:"element",tagName:"tr",properties:{},children:e.wrap(h,!0)};return e.patch(t,_),e.applyData(t,_)}function JA(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const hb=9,fb=32;function eT(e){const t=String(e),n=/\r?\n|\r/g;let s=n.exec(t),a=0;const o=[];for(;s;)o.push(db(t.slice(a,s.index),a>0,!0),s[0]),a=s.index+s[0].length,s=n.exec(t);return o.push(db(t.slice(a),a>0,!1)),o.join("")}function db(e,t,n){let s=0,a=e.length;if(t){let o=e.codePointAt(s);for(;o===hb||o===fb;)s++,o=e.codePointAt(s)}if(n){let o=e.codePointAt(a-1);for(;o===hb||o===fb;)a--,o=e.codePointAt(a-1)}return a>s?e.slice(s,a):""}function tT(e,t){const n={type:"text",value:eT(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function iT(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const nT={blockquote:MA,break:zA,code:LA,delete:OA,emphasis:BA,footnoteReference:jA,heading:HA,html:IA,imageReference:PA,image:UA,inlineCode:FA,linkReference:WA,link:qA,listItem:$A,list:VA,paragraph:GA,root:KA,strong:XA,table:ZA,tableCell:JA,tableRow:QA,text:tT,thematicBreak:iT,toml:Vc,yaml:Vc,definition:Vc,footnoteDefinition:Vc};function Vc(){}const $x=-1,Tu=0,co=1,gu=2,im=3,nm=4,rm=5,sm=6,Yx=7,Vx=8,pb=typeof self=="object"?self:globalThis,rT=(e,t)=>{const n=(a,o)=>(e.set(o,a),a),s=a=>{if(e.has(a))return e.get(a);const[o,c]=t[a];switch(o){case Tu:case $x:return n(c,a);case co:{const f=n([],a);for(const d of c)f.push(s(d));return f}case gu:{const f=n({},a);for(const[d,h]of c)f[s(d)]=s(h);return f}case im:return n(new Date(c),a);case nm:{const{source:f,flags:d}=c;return n(new RegExp(f,d),a)}case rm:{const f=n(new Map,a);for(const[d,h]of c)f.set(s(d),s(h));return f}case sm:{const f=n(new Set,a);for(const d of c)f.add(s(d));return f}case Yx:{const{name:f,message:d}=c;return n(new pb[f](d),a)}case Vx:return n(BigInt(c),a);case"BigInt":return n(Object(BigInt(c)),a);case"ArrayBuffer":return n(new Uint8Array(c).buffer,c);case"DataView":{const{buffer:f}=new Uint8Array(c);return n(new DataView(f),c)}}return n(new pb[o](c),a)};return s},mb=e=>rT(new Map,e)(0),Cl="",{toString:sT}={},{keys:lT}=Object,Ka=e=>{const t=typeof e;if(t!=="object"||!e)return[Tu,t];const n=sT.call(e).slice(8,-1);switch(n){case"Array":return[co,Cl];case"Object":return[gu,Cl];case"Date":return[im,Cl];case"RegExp":return[nm,Cl];case"Map":return[rm,Cl];case"Set":return[sm,Cl];case"DataView":return[co,n]}return n.includes("Array")?[co,n]:n.includes("Error")?[Yx,n]:[gu,n]},Gc=([e,t])=>e===Tu&&(t==="function"||t==="symbol"),aT=(e,t,n,s)=>{const a=(c,f)=>{const d=s.push(c)-1;return n.set(f,d),d},o=c=>{if(n.has(c))return n.get(c);let[f,d]=Ka(c);switch(f){case Tu:{let _=c;switch(d){case"bigint":f=Vx,_=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);_=null;break;case"undefined":return a([$x],c)}return a([f,_],c)}case co:{if(d){let b=c;return d==="DataView"?b=new Uint8Array(c.buffer):d==="ArrayBuffer"&&(b=new Uint8Array(c)),a([d,[...b]],c)}const _=[],v=a([f,_],c);for(const b of c)_.push(o(b));return v}case gu:{if(d)switch(d){case"BigInt":return a([d,c.toString()],c);case"Boolean":case"Number":case"String":return a([d,c.valueOf()],c)}if(t&&"toJSON"in c)return o(c.toJSON());const _=[],v=a([f,_],c);for(const b of lT(c))(e||!Gc(Ka(c[b])))&&_.push([o(b),o(c[b])]);return v}case im:return a([f,c.toISOString()],c);case nm:{const{source:_,flags:v}=c;return a([f,{source:_,flags:v}],c)}case rm:{const _=[],v=a([f,_],c);for(const[b,y]of c)(e||!(Gc(Ka(b))||Gc(Ka(y))))&&_.push([o(b),o(y)]);return v}case sm:{const _=[],v=a([f,_],c);for(const b of c)(e||!Gc(Ka(b)))&&_.push(o(b));return v}}const{message:h}=c;return a([f,{name:d,message:h}],c)};return o},gb=(e,{json:t,lossy:n}={})=>{const s=[];return aT(!(t||n),!!t,new Map,s)(e),s},_u=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?mb(gb(e,t)):structuredClone(e):(e,t)=>mb(gb(e,t));function oT(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function cT(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function uT(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||oT,s=e.options.footnoteBackLabel||cT,a=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let d=-1;for(;++d<e.footnoteOrder.length;){const h=e.footnoteById.get(e.footnoteOrder[d]);if(!h)continue;const _=e.all(h),v=String(h.identifier).toUpperCase(),b=Hl(v.toLowerCase());let y=0;const S=[],A=e.footnoteCounts.get(v);for(;A!==void 0&&++y<=A;){S.length>0&&S.push({type:"text",value:" "});let W=typeof n=="string"?n:n(d,y);typeof W=="string"&&(W={type:"text",value:W}),S.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+b+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(d,y),className:["data-footnote-backref"]},children:Array.isArray(W)?W:[W]})}const R=_[_.length-1];if(R&&R.type==="element"&&R.tagName==="p"){const W=R.children[R.children.length-1];W&&W.type==="text"?W.value+=" ":R.children.push({type:"text",value:" "}),R.children.push(...S)}else _.push(...S);const D={type:"element",tagName:"li",properties:{id:t+"fn-"+b},children:e.wrap(_,!0)};e.patch(h,D),f.push(D)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{..._u(c),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
`}]}}const Nu=(function(e){if(e==null)return pT;if(typeof e=="function")return Du(e);if(typeof e=="object")return Array.isArray(e)?hT(e):fT(e);if(typeof e=="string")return dT(e);throw new Error("Expected function, string, or object as test")});function hT(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Nu(e[n]);return Du(s);function s(...a){let o=-1;for(;++o<t.length;)if(t[o].apply(this,a))return!0;return!1}}function fT(e){const t=e;return Du(n);function n(s){const a=s;let o;for(o in e)if(a[o]!==t[o])return!1;return!0}}function dT(e){return Du(t);function t(n){return n&&n.type===e}}function Du(e){return t;function t(n,s,a){return!!(mT(n)&&e.call(this,n,typeof s=="number"?s:void 0,a||void 0))}}function pT(){return!0}function mT(e){return e!==null&&typeof e=="object"&&"type"in e}const Gx=[],gT=!0,Zd=!1,_T="skip";function Kx(e,t,n,s){let a;typeof t=="function"&&typeof n!="function"?(s=n,n=t):a=t;const o=Nu(a),c=s?-1:1;f(e,void 0,[])();function f(d,h,_){const v=d&&typeof d=="object"?d:{};if(typeof v.type=="string"){const y=typeof v.tagName=="string"?v.tagName:typeof v.name=="string"?v.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(d.type+(y?"<"+y+">":""))+")"})}return b;function b(){let y=Gx,S,A,R;if((!t||o(d,h,_[_.length-1]||void 0))&&(y=vT(n(d,_)),y[0]===Zd))return y;if("children"in d&&d.children){const D=d;if(D.children&&y[0]!==_T)for(A=(s?D.children.length:-1)+c,R=_.concat(D);A>-1&&A<D.children.length;){const W=D.children[A];if(S=f(W,A,R)(),S[0]===Zd)return S;A=typeof S[1]=="number"?S[1]:A+c}}return y}}}function vT(e){return Array.isArray(e)?e:typeof e=="number"?[gT,e]:e==null?Gx:[e]}function lm(e,t,n,s){let a,o,c;typeof t=="function"&&typeof n!="function"?(o=void 0,c=t,a=n):(o=t,c=n,a=s),Kx(e,o,f,a);function f(d,h){const _=h[h.length-1],v=_?_.children.indexOf(d):void 0;return c(d,v,_)}}const Qd={}.hasOwnProperty,bT={};function yT(e,t){const n=t||bT,s=new Map,a=new Map,o=new Map,c={...nT,...n.handlers},f={all:h,applyData:ST,definitionById:s,footnoteById:a,footnoteCounts:o,footnoteOrder:[],handlers:c,one:d,options:n,patch:xT,wrap:CT};return lm(e,function(_){if(_.type==="definition"||_.type==="footnoteDefinition"){const v=_.type==="definition"?s:a,b=String(_.identifier).toUpperCase();v.has(b)||v.set(b,_)}}),f;function d(_,v){const b=_.type,y=f.handlers[b];if(Qd.call(f.handlers,b)&&y)return y(f,_,v);if(f.options.passThrough&&f.options.passThrough.includes(b)){if("children"in _){const{children:A,...R}=_,D=_u(R);return D.children=f.all(_),D}return _u(_)}return(f.options.unknownHandler||wT)(f,_,v)}function h(_){const v=[];if("children"in _){const b=_.children;let y=-1;for(;++y<b.length;){const S=f.one(b[y],_);if(S){if(y&&b[y-1].type==="break"&&(!Array.isArray(S)&&S.type==="text"&&(S.value=_b(S.value)),!Array.isArray(S)&&S.type==="element")){const A=S.children[0];A&&A.type==="text"&&(A.value=_b(A.value))}Array.isArray(S)?v.push(...S):v.push(S)}}}return v}}function xT(e,t){e.position&&(t.position=cE(e))}function ST(e,t){let n=t;if(e&&e.data){const s=e.data.hName,a=e.data.hChildren,o=e.data.hProperties;if(typeof s=="string")if(n.type==="element")n.tagName=s;else{const c="children"in n?n.children:[n];n={type:"element",tagName:s,properties:{},children:c}}n.type==="element"&&o&&Object.assign(n.properties,_u(o)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function wT(e,t){const n=t.data||{},s="value"in t&&!(Qd.call(n,"hProperties")||Qd.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function CT(e,t){const n=[];let s=-1;for(t&&n.push({type:"text",value:`
`});++s<e.length;)s&&n.push({type:"text",value:`
`}),n.push(e[s]);return t&&e.length>0&&n.push({type:"text",value:`
`}),n}function _b(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function vb(e,t){const n=yT(e,t),s=n.one(e,void 0),a=uT(n),o=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return a&&o.children.push({type:"text",value:`
`},a),o}function kT(e,t){return e&&"run"in e?async function(n,s){const a=vb(n,{file:s,...t});await e.run(a,s)}:function(n,s){return vb(n,{file:s,...e||t})}}function bb(e){if(e)throw e}var fd,yb;function ET(){if(yb)return fd;yb=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,s=Object.getOwnPropertyDescriptor,a=function(h){return typeof Array.isArray=="function"?Array.isArray(h):t.call(h)==="[object Array]"},o=function(h){if(!h||t.call(h)!=="[object Object]")return!1;var _=e.call(h,"constructor"),v=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!_&&!v)return!1;var b;for(b in h);return typeof b>"u"||e.call(h,b)},c=function(h,_){n&&_.name==="__proto__"?n(h,_.name,{enumerable:!0,configurable:!0,value:_.newValue,writable:!0}):h[_.name]=_.newValue},f=function(h,_){if(_==="__proto__")if(e.call(h,_)){if(s)return s(h,_).value}else return;return h[_]};return fd=function d(){var h,_,v,b,y,S,A=arguments[0],R=1,D=arguments.length,W=!1;for(typeof A=="boolean"&&(W=A,A=arguments[1]||{},R=2),(A==null||typeof A!="object"&&typeof A!="function")&&(A={});R<D;++R)if(h=arguments[R],h!=null)for(_ in h)v=f(A,_),b=f(h,_),A!==b&&(W&&b&&(o(b)||(y=a(b)))?(y?(y=!1,S=v&&a(v)?v:[]):S=v&&o(v)?v:{},c(A,{name:_,newValue:d(W,S,b)})):typeof b<"u"&&c(A,{name:_,newValue:b}));return A},fd}var AT=ET();const dd=$y(AT);function Jd(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 TT(){const e=[],t={run:n,use:s};return t;function n(...a){let o=-1;const c=a.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);f(null,...a);function f(d,...h){const _=e[++o];let v=-1;if(d){c(d);return}for(;++v<a.length;)(h[v]===null||h[v]===void 0)&&(h[v]=a[v]);a=h,_?NT(_,f)(...h):c(null,...h)}}function s(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function NT(e,t){let n;return s;function s(...c){const f=e.length>c.length;let d;f&&c.push(a);try{d=e.apply(this,c)}catch(h){const _=h;if(f&&n)throw _;return a(_)}f||(d&&d.then&&typeof d.then=="function"?d.then(o,a):d instanceof Error?a(d):o(d))}function a(c,...f){n||(n=!0,t(c,...f))}function o(c){a(null,c)}}const Yn={basename:DT,dirname:RT,extname:MT,join:zT,sep:"/"};function DT(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');yo(e);let n=0,s=-1,a=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(o){n=a+1;break}}else s<0&&(o=!0,s=a+1);return s<0?"":e.slice(n,s)}if(t===e)return"";let c=-1,f=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(o){n=a+1;break}}else c<0&&(o=!0,c=a+1),f>-1&&(e.codePointAt(a)===t.codePointAt(f--)?f<0&&(s=a):(f=-1,s=c));return n===s?s=c:s<0&&(s=e.length),e.slice(n,s)}function RT(e){if(yo(e),e.length===0)return".";let t=-1,n=e.length,s;for(;--n;)if(e.codePointAt(n)===47){if(s){t=n;break}}else s||(s=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function MT(e){yo(e);let t=e.length,n=-1,s=0,a=-1,o=0,c;for(;t--;){const f=e.codePointAt(t);if(f===47){if(c){s=t+1;break}continue}n<0&&(c=!0,n=t+1),f===46?a<0?a=t:o!==1&&(o=1):a>-1&&(o=-1)}return a<0||n<0||o===0||o===1&&a===n-1&&a===s+1?"":e.slice(a,n)}function zT(...e){let t=-1,n;for(;++t<e.length;)yo(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":LT(n)}function LT(e){yo(e);const t=e.codePointAt(0)===47;let n=OT(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function OT(e,t){let n="",s=0,a=-1,o=0,c=-1,f,d;for(;++c<=e.length;){if(c<e.length)f=e.codePointAt(c);else{if(f===47)break;f=47}if(f===47){if(!(a===c-1||o===1))if(a!==c-1&&o===2){if(n.length<2||s!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(d=n.lastIndexOf("/"),d!==n.length-1){d<0?(n="",s=0):(n=n.slice(0,d),s=n.length-1-n.lastIndexOf("/")),a=c,o=0;continue}}else if(n.length>0){n="",s=0,a=c,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+e.slice(a+1,c):n=e.slice(a+1,c),s=c-a-1;a=c,o=0}else f===46&&o>-1?o++:o=-1}return n}function yo(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const BT={cwd:jT};function jT(){return"/"}function ep(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function HT(e){if(typeof e=="string")e=new URL(e);else if(!ep(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 IT(e)}function IT(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const s=t.codePointAt(n+2);if(s===70||s===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 pd=["history","path","basename","stem","extname","dirname"];class Xx{constructor(t){let n;t?ep(t)?n={path:t}:typeof t=="string"||PT(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":BT.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<pd.length;){const o=pd[s];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let a;for(a in n)pd.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Yn.basename(this.path):void 0}set basename(t){gd(t,"basename"),md(t,"basename"),this.path=Yn.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Yn.dirname(this.path):void 0}set dirname(t){xb(this.basename,"dirname"),this.path=Yn.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Yn.extname(this.path):void 0}set extname(t){if(md(t,"extname"),xb(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=Yn.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){ep(t)&&(t=HT(t)),gd(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Yn.basename(this.path,this.extname):void 0}set stem(t){gd(t,"stem"),md(t,"stem"),this.path=Yn.join(this.dirname||"",t+(this.extname||""))}fail(t,n,s){const a=this.message(t,n,s);throw a.fatal=!0,a}info(t,n,s){const a=this.message(t,n,s);return a.fatal=void 0,a}message(t,n,s){const a=new ki(t,n,s);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 md(e,t){if(e&&e.includes(Yn.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Yn.sep+"`")}function gd(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function xb(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function PT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const UT=(function(e){const s=this.constructor.prototype,a=s[e],o=function(){return a.apply(o,arguments)};return Object.setPrototypeOf(o,s),o}),FT={}.hasOwnProperty;class am extends UT{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=TT()}copy(){const t=new am;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(dd(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(bd("data",this.frozen),this.namespace[t]=n,this):FT.call(this.namespace,t)&&this.namespace[t]||void 0:t?(bd("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const a=n.call(t,...s);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Kc(t),s=this.parser||this.Parser;return _d("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),_d("process",this.parser||this.Parser),vd("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(o,c){const f=Kc(t),d=s.parse(f);s.run(d,f,function(_,v,b){if(_||!v||!b)return h(_);const y=v,S=s.stringify(y,b);$T(S)?b.value=S:b.result=S,h(_,b)});function h(_,v){_||!v?c(_):o?o(v):n(void 0,v)}}}processSync(t){let n=!1,s;return this.freeze(),_d("processSync",this.parser||this.Parser),vd("processSync",this.compiler||this.Compiler),this.process(t,a),wb("processSync","process",n),s;function a(o,c){n=!0,bb(o),s=c}}run(t,n,s){Sb(t),this.freeze();const a=this.transformers;return!s&&typeof n=="function"&&(s=n,n=void 0),s?o(void 0,s):new Promise(o);function o(c,f){const d=Kc(n);a.run(t,d,h);function h(_,v,b){const y=v||t;_?f(_):c?c(y):s(void 0,y,b)}}}runSync(t,n){let s=!1,a;return this.run(t,n,o),wb("runSync","run",s),a;function o(c,f){bb(c),a=f,s=!0}}stringify(t,n){this.freeze();const s=Kc(n),a=this.compiler||this.Compiler;return vd("stringify",a),Sb(t),a(t,s)}use(t,...n){const s=this.attachers,a=this.namespace;if(bd("use",this.frozen),t!=null)if(typeof t=="function")d(t,n);else if(typeof t=="object")Array.isArray(t)?f(t):c(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(h){if(typeof h=="function")d(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[_,...v]=h;d(_,v)}else c(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function c(h){if(!("plugins"in h)&&!("settings"in h))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(h.plugins),h.settings&&(a.settings=dd(!0,a.settings,h.settings))}function f(h){let _=-1;if(h!=null)if(Array.isArray(h))for(;++_<h.length;){const v=h[_];o(v)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function d(h,_){let v=-1,b=-1;for(;++v<s.length;)if(s[v][0]===h){b=v;break}if(b===-1)s.push([h,..._]);else if(_.length>0){let[y,...S]=_;const A=s[b][1];Jd(A)&&Jd(y)&&(y=dd(!0,A,y)),s[b]=[h,y,...S]}}}}const WT=new am().freeze();function _d(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function vd(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function bd(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 Sb(e){if(!Jd(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function wb(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Kc(e){return qT(e)?e:new Xx(e)}function qT(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function $T(e){return typeof e=="string"||YT(e)}function YT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const VT="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Cb=[],kb={allowDangerousHtml:!0},GT=/^(https?|ircs?|mailto|xmpp)$/i,KT=[{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 XT(e){const t=ZT(e),n=QT(e);return JT(t.runSync(t.parse(n),n),e)}function ZT(e){const t=e.rehypePlugins||Cb,n=e.remarkPlugins||Cb,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...kb}:kb;return WT().use(RA).use(n).use(kT,s).use(t)}function QT(e){const t=e.children||"",n=new Xx;return typeof t=="string"&&(n.value=t),n}function JT(e,t){const n=t.allowedElements,s=t.allowElement,a=t.components,o=t.disallowedElements,c=t.skipHtml,f=t.unwrapDisallowed,d=t.urlTransform||eN;for(const _ of KT)Object.hasOwn(t,_.from)&&(""+_.from+(_.to?"use `"+_.to+"` instead":"remove it")+VT+_.id,void 0);return lm(e,h),pE(e,{Fragment:g.Fragment,components:a,ignoreInvalidStyle:!0,jsx:g.jsx,jsxs:g.jsxs,passKeys:!0,passNode:!0});function h(_,v,b){if(_.type==="raw"&&b&&typeof v=="number")return c?b.children.splice(v,1):b.children[v]={type:"text",value:_.value},v;if(_.type==="element"){let y;for(y in cd)if(Object.hasOwn(cd,y)&&Object.hasOwn(_.properties,y)){const S=_.properties[y],A=cd[y];(A===null||A.includes(_.tagName))&&(_.properties[y]=d(String(S||""),y,_))}}if(_.type==="element"){let y=n?!n.includes(_.tagName):o?o.includes(_.tagName):!1;if(!y&&s&&typeof v=="number"&&(y=!s(_,v,b)),y&&b&&typeof v=="number")return f&&_.children?b.children.splice(v,1,..._.children):b.children.splice(v,1),v}}}function eN(e){const t=e.indexOf(":"),n=e.indexOf("?"),s=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||s!==-1&&t>s||GT.test(e.slice(0,t))?e:""}function Eb(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let s=0,a=n.indexOf(t);for(;a!==-1;)s++,a=n.indexOf(t,a+t.length);return s}function tN(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function iN(e,t,n){const a=Nu((n||{}).ignore||[]),o=nN(t);let c=-1;for(;++c<o.length;)Kx(e,"text",f);function f(h,_){let v=-1,b;for(;++v<_.length;){const y=_[v],S=b?b.children:void 0;if(a(y,S?S.indexOf(y):void 0,b))return;b=y}if(b)return d(h,_)}function d(h,_){const v=_[_.length-1],b=o[c][0],y=o[c][1];let S=0;const R=v.children.indexOf(h);let D=!1,W=[];b.lastIndex=0;let j=b.exec(h.value);for(;j;){const I=j.index,J={index:j.index,input:j.input,stack:[..._,h]};let L=y(...j,J);if(typeof L=="string"&&(L=L.length>0?{type:"text",value:L}:void 0),L===!1?b.lastIndex=I+1:(S!==I&&W.push({type:"text",value:h.value.slice(S,I)}),Array.isArray(L)?W.push(...L):L&&W.push(L),S=I+j[0].length,D=!0),!b.global)break;j=b.exec(h.value)}return D?(S<h.value.length&&W.push({type:"text",value:h.value.slice(S)}),v.children.splice(R,1,...W)):W=[h],R+W.length}}function nN(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let s=-1;for(;++s<n.length;){const a=n[s];t.push([rN(a[0]),sN(a[1])])}return t}function rN(e){return typeof e=="string"?new RegExp(tN(e),"g"):e}function sN(e){return typeof e=="function"?e:function(){return e}}const yd="phrasing",xd=["autolink","link","image","label"];function lN(){return{transforms:[dN],enter:{literalAutolink:oN,literalAutolinkEmail:Sd,literalAutolinkHttp:Sd,literalAutolinkWww:Sd},exit:{literalAutolink:fN,literalAutolinkEmail:hN,literalAutolinkHttp:cN,literalAutolinkWww:uN}}}function aN(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:yd,notInConstruct:xd},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:yd,notInConstruct:xd},{character:":",before:"[ps]",after:"\\/",inConstruct:yd,notInConstruct:xd}]}}function oN(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Sd(e){this.config.enter.autolinkProtocol.call(this,e)}function cN(e){this.config.exit.autolinkProtocol.call(this,e)}function uN(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 hN(e){this.config.exit.autolinkEmail.call(this,e)}function fN(e){this.exit(e)}function dN(e){iN(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,pN],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),mN]],{ignore:["link","linkReference"]})}function pN(e,t,n,s,a){let o="";if(!Zx(a)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!gN(n)))return!1;const c=_N(n+s);if(!c[0])return!1;const f={type:"link",title:null,url:o+t+c[0],children:[{type:"text",value:t+c[0]}]};return c[1]?[f,{type:"text",value:c[1]}]:f}function mN(e,t,n,s){return!Zx(s,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function gN(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 _N(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],s=n.indexOf(")");const a=Eb(e,"(");let o=Eb(e,")");for(;s!==-1&&a>o;)e+=n.slice(0,s+1),n=n.slice(s+1),s=n.indexOf(")"),o++;return[e,n]}function Zx(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Ls(n)||Eu(n))&&(!t||n!==47)}Qx.peek=EN;function vN(){this.buffer()}function bN(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function yN(){this.buffer()}function xN(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function SN(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=On(this.sliceSerialize(e)).toLowerCase(),n.label=t}function wN(e){this.exit(e)}function CN(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=On(this.sliceSerialize(e)).toLowerCase(),n.label=t}function kN(e){this.exit(e)}function EN(){return"["}function Qx(e,t,n,s){const a=n.createTracker(s);let o=a.move("[^");const c=n.enter("footnoteReference"),f=n.enter("reference");return o+=a.move(n.safe(n.associationId(e),{after:"]",before:o})),f(),c(),o+=a.move("]"),o}function AN(){return{enter:{gfmFootnoteCallString:vN,gfmFootnoteCall:bN,gfmFootnoteDefinitionLabelString:yN,gfmFootnoteDefinition:xN},exit:{gfmFootnoteCallString:SN,gfmFootnoteCall:wN,gfmFootnoteDefinitionLabelString:CN,gfmFootnoteDefinition:kN}}}function TN(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Qx},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(s,a,o,c){const f=o.createTracker(c);let d=f.move("[^");const h=o.enter("footnoteDefinition"),_=o.enter("label");return d+=f.move(o.safe(o.associationId(s),{before:d,after:"]"})),_(),d+=f.move("]:"),s.children&&s.children.length>0&&(f.shift(4),d+=f.move((t?`
`:" ")+o.indentLines(o.containerFlow(s,f.current()),t?Jx:NN))),h(),d}}function NN(e,t,n){return t===0?e:Jx(e,t,n)}function Jx(e,t,n){return(n?"":"    ")+e}const DN=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];eS.peek=ON;function RN(){return{canContainEols:["delete"],enter:{strikethrough:zN},exit:{strikethrough:LN}}}function MN(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:DN}],handlers:{delete:eS}}}function zN(e){this.enter({type:"delete",children:[]},e)}function LN(e){this.exit(e)}function eS(e,t,n,s){const a=n.createTracker(s),o=n.enter("strikethrough");let c=a.move("~~");return c+=n.containerPhrasing(e,{...a.current(),before:c,after:"~"}),c+=a.move("~~"),o(),c}function ON(){return"~"}function BN(e){return e.length}function jN(e,t){const n=t||{},s=(n.align||[]).concat(),a=n.stringLength||BN,o=[],c=[],f=[],d=[];let h=0,_=-1;for(;++_<e.length;){const A=[],R=[];let D=-1;for(e[_].length>h&&(h=e[_].length);++D<e[_].length;){const W=HN(e[_][D]);if(n.alignDelimiters!==!1){const j=a(W);R[D]=j,(d[D]===void 0||j>d[D])&&(d[D]=j)}A.push(W)}c[_]=A,f[_]=R}let v=-1;if(typeof s=="object"&&"length"in s)for(;++v<h;)o[v]=Ab(s[v]);else{const A=Ab(s);for(;++v<h;)o[v]=A}v=-1;const b=[],y=[];for(;++v<h;){const A=o[v];let R="",D="";A===99?(R=":",D=":"):A===108?R=":":A===114&&(D=":");let W=n.alignDelimiters===!1?1:Math.max(1,d[v]-R.length-D.length);const j=R+"-".repeat(W)+D;n.alignDelimiters!==!1&&(W=R.length+W+D.length,W>d[v]&&(d[v]=W),y[v]=W),b[v]=j}c.splice(1,0,b),f.splice(1,0,y),_=-1;const S=[];for(;++_<c.length;){const A=c[_],R=f[_];v=-1;const D=[];for(;++v<h;){const W=A[v]||"";let j="",I="";if(n.alignDelimiters!==!1){const J=d[v]-(R[v]||0),L=o[v];L===114?j=" ".repeat(J):L===99?J%2?(j=" ".repeat(J/2+.5),I=" ".repeat(J/2-.5)):(j=" ".repeat(J/2),I=j):I=" ".repeat(J)}n.delimiterStart!==!1&&!v&&D.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&W==="")&&(n.delimiterStart!==!1||v)&&D.push(" "),n.alignDelimiters!==!1&&D.push(j),D.push(W),n.alignDelimiters!==!1&&D.push(I),n.padding!==!1&&D.push(" "),(n.delimiterEnd!==!1||v!==h-1)&&D.push("|")}S.push(n.delimiterEnd===!1?D.join("").replace(/ +$/,""):D.join(""))}return S.join(`
`)}function HN(e){return e==null?"":String(e)}function Ab(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function IN(e,t,n,s){const a=n.enter("blockquote"),o=n.createTracker(s);o.move("> "),o.shift(2);const c=n.indentLines(n.containerFlow(e,o.current()),PN);return a(),c}function PN(e,t,n){return">"+(n?"":" ")+e}function UN(e,t){return Tb(e,t.inConstruct,!0)&&!Tb(e,t.notInConstruct,!1)}function Tb(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let s=-1;for(;++s<t.length;)if(e.includes(t[s]))return!0;return!1}function Nb(e,t,n,s){let a=-1;for(;++a<n.unsafe.length;)if(n.unsafe[a].character===`
`&&UN(n.stack,n.unsafe[a]))return/[ \t]/.test(s.before)?"":" ";return`\\
`}function FN(e,t){const n=String(e);let s=n.indexOf(t),a=s,o=0,c=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===a?++o>c&&(c=o):o=1,a=s+t.length,s=n.indexOf(t,a);return c}function WN(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function qN(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 $N(e,t,n,s){const a=qN(n),o=e.value||"",c=a==="`"?"GraveAccent":"Tilde";if(WN(e,n)){const v=n.enter("codeIndented"),b=n.indentLines(o,YN);return v(),b}const f=n.createTracker(s),d=a.repeat(Math.max(FN(o,a)+1,3)),h=n.enter("codeFenced");let _=f.move(d);if(e.lang){const v=n.enter(`codeFencedLang${c}`);_+=f.move(n.safe(e.lang,{before:_,after:" ",encode:["`"],...f.current()})),v()}if(e.lang&&e.meta){const v=n.enter(`codeFencedMeta${c}`);_+=f.move(" "),_+=f.move(n.safe(e.meta,{before:_,after:`
`,encode:["`"],...f.current()})),v()}return _+=f.move(`
`),o&&(_+=f.move(o+`
`)),_+=f.move(d),h(),_}function YN(e,t,n){return(n?"":"    ")+e}function om(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 VN(e,t,n,s){const a=om(n),o=a==='"'?"Quote":"Apostrophe",c=n.enter("definition");let f=n.enter("label");const d=n.createTracker(s);let h=d.move("[");return h+=d.move(n.safe(n.associationId(e),{before:h,after:"]",...d.current()})),h+=d.move("]: "),f(),!e.url||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),h+=d.move("<"),h+=d.move(n.safe(e.url,{before:h,after:">",...d.current()})),h+=d.move(">")):(f=n.enter("destinationRaw"),h+=d.move(n.safe(e.url,{before:h,after:e.title?" ":`
`,...d.current()}))),f(),e.title&&(f=n.enter(`title${o}`),h+=d.move(" "+a),h+=d.move(n.safe(e.title,{before:h,after:a,...d.current()})),h+=d.move(a),f()),c(),h}function GN(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 po(e){return"&#x"+e.toString(16).toUpperCase()+";"}function vu(e,t,n){const s=Ll(e),a=Ll(t);return s===void 0?a===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===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}}tS.peek=KN;function tS(e,t,n,s){const a=GN(n),o=n.enter("emphasis"),c=n.createTracker(s),f=c.move(a);let d=c.move(n.containerPhrasing(e,{after:a,before:f,...c.current()}));const h=d.charCodeAt(0),_=vu(s.before.charCodeAt(s.before.length-1),h,a);_.inside&&(d=po(h)+d.slice(1));const v=d.charCodeAt(d.length-1),b=vu(s.after.charCodeAt(0),v,a);b.inside&&(d=d.slice(0,-1)+po(v));const y=c.move(a);return o(),n.attentionEncodeSurroundingInfo={after:b.outside,before:_.outside},f+d+y}function KN(e,t,n){return n.options.emphasis||"*"}function XN(e,t){let n=!1;return lm(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return n=!0,Zd}),!!((!e.depth||e.depth<3)&&Jp(e)&&(t.options.setext||n))}function ZN(e,t,n,s){const a=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(s);if(XN(e,n)){const _=n.enter("headingSetext"),v=n.enter("phrasing"),b=n.containerPhrasing(e,{...o.current(),before:`
`,after:`
`});return v(),_(),b+`
`+(a===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
`))+1))}const c="#".repeat(a),f=n.enter("headingAtx"),d=n.enter("phrasing");o.move(c+" ");let h=n.containerPhrasing(e,{before:"# ",after:`
`,...o.current()});return/^[\t ]/.test(h)&&(h=po(h.charCodeAt(0))+h.slice(1)),h=h?c+" "+h:c,n.options.closeAtx&&(h+=" "+c),d(),f(),h}iS.peek=QN;function iS(e){return e.value||""}function QN(){return"<"}nS.peek=JN;function nS(e,t,n,s){const a=om(n),o=a==='"'?"Quote":"Apostrophe",c=n.enter("image");let f=n.enter("label");const d=n.createTracker(s);let h=d.move("![");return h+=d.move(n.safe(e.alt,{before:h,after:"]",...d.current()})),h+=d.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),h+=d.move("<"),h+=d.move(n.safe(e.url,{before:h,after:">",...d.current()})),h+=d.move(">")):(f=n.enter("destinationRaw"),h+=d.move(n.safe(e.url,{before:h,after:e.title?" ":")",...d.current()}))),f(),e.title&&(f=n.enter(`title${o}`),h+=d.move(" "+a),h+=d.move(n.safe(e.title,{before:h,after:a,...d.current()})),h+=d.move(a),f()),h+=d.move(")"),c(),h}function JN(){return"!"}rS.peek=eD;function rS(e,t,n,s){const a=e.referenceType,o=n.enter("imageReference");let c=n.enter("label");const f=n.createTracker(s);let d=f.move("![");const h=n.safe(e.alt,{before:d,after:"]",...f.current()});d+=f.move(h+"]["),c();const _=n.stack;n.stack=[],c=n.enter("reference");const v=n.safe(n.associationId(e),{before:d,after:"]",...f.current()});return c(),n.stack=_,o(),a==="full"||!h||h!==v?d+=f.move(v+"]"):a==="shortcut"?d=d.slice(0,-1):d+=f.move("]"),d}function eD(){return"!"}sS.peek=tD;function sS(e,t,n){let s=e.value||"",a="`",o=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(s);)a+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++o<n.unsafe.length;){const c=n.unsafe[o],f=n.compilePattern(c);let d;if(c.atBreak)for(;d=f.exec(s);){let h=d.index;s.charCodeAt(h)===10&&s.charCodeAt(h-1)===13&&h--,s=s.slice(0,h)+" "+s.slice(d.index+1)}}return a+s+a}function tD(){return"`"}function lS(e,t){const n=Jp(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}aS.peek=iD;function aS(e,t,n,s){const a=om(n),o=a==='"'?"Quote":"Apostrophe",c=n.createTracker(s);let f,d;if(lS(e,n)){const _=n.stack;n.stack=[],f=n.enter("autolink");let v=c.move("<");return v+=c.move(n.containerPhrasing(e,{before:v,after:">",...c.current()})),v+=c.move(">"),f(),n.stack=_,v}f=n.enter("link"),d=n.enter("label");let h=c.move("[");return h+=c.move(n.containerPhrasing(e,{before:h,after:"](",...c.current()})),h+=c.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),h+=c.move("<"),h+=c.move(n.safe(e.url,{before:h,after:">",...c.current()})),h+=c.move(">")):(d=n.enter("destinationRaw"),h+=c.move(n.safe(e.url,{before:h,after:e.title?" ":")",...c.current()}))),d(),e.title&&(d=n.enter(`title${o}`),h+=c.move(" "+a),h+=c.move(n.safe(e.title,{before:h,after:a,...c.current()})),h+=c.move(a),d()),h+=c.move(")"),f(),h}function iD(e,t,n){return lS(e,n)?"<":"["}oS.peek=nD;function oS(e,t,n,s){const a=e.referenceType,o=n.enter("linkReference");let c=n.enter("label");const f=n.createTracker(s);let d=f.move("[");const h=n.containerPhrasing(e,{before:d,after:"]",...f.current()});d+=f.move(h+"]["),c();const _=n.stack;n.stack=[],c=n.enter("reference");const v=n.safe(n.associationId(e),{before:d,after:"]",...f.current()});return c(),n.stack=_,o(),a==="full"||!h||h!==v?d+=f.move(v+"]"):a==="shortcut"?d=d.slice(0,-1):d+=f.move("]"),d}function nD(){return"["}function cm(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 rD(e){const t=cm(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function sD(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 cS(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 lD(e,t,n,s){const a=n.enter("list"),o=n.bulletCurrent;let c=e.ordered?sD(n):cm(n);const f=e.ordered?c==="."?")":".":rD(n);let d=t&&n.bulletLastUsed?c===n.bulletLastUsed:!1;if(!e.ordered){const _=e.children?e.children[0]:void 0;if((c==="*"||c==="-")&&_&&(!_.children||!_.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(d=!0),cS(n)===c&&_){let v=-1;for(;++v<e.children.length;){const b=e.children[v];if(b&&b.type==="listItem"&&b.children&&b.children[0]&&b.children[0].type==="thematicBreak"){d=!0;break}}}}d&&(c=f),n.bulletCurrent=c;const h=n.containerFlow(e,s);return n.bulletLastUsed=c,n.bulletCurrent=o,a(),h}function aD(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 oD(e,t,n,s){const a=aD(n);let o=n.bulletCurrent||cm(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let c=o.length+1;(a==="tab"||a==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(c=Math.ceil(c/4)*4);const f=n.createTracker(s);f.move(o+" ".repeat(c-o.length)),f.shift(c);const d=n.enter("listItem"),h=n.indentLines(n.containerFlow(e,f.current()),_);return d(),h;function _(v,b,y){return b?(y?"":" ".repeat(c))+v:(y?o:o+" ".repeat(c-o.length))+v}}function cD(e,t,n,s){const a=n.enter("paragraph"),o=n.enter("phrasing"),c=n.containerPhrasing(e,s);return o(),a(),c}const uD=Nu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function hD(e,t,n,s){return(e.children.some(function(c){return uD(c)})?n.containerPhrasing:n.containerFlow).call(n,e,s)}function fD(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}uS.peek=dD;function uS(e,t,n,s){const a=fD(n),o=n.enter("strong"),c=n.createTracker(s),f=c.move(a+a);let d=c.move(n.containerPhrasing(e,{after:a,before:f,...c.current()}));const h=d.charCodeAt(0),_=vu(s.before.charCodeAt(s.before.length-1),h,a);_.inside&&(d=po(h)+d.slice(1));const v=d.charCodeAt(d.length-1),b=vu(s.after.charCodeAt(0),v,a);b.inside&&(d=d.slice(0,-1)+po(v));const y=c.move(a+a);return o(),n.attentionEncodeSurroundingInfo={after:b.outside,before:_.outside},f+d+y}function dD(e,t,n){return n.options.strong||"*"}function pD(e,t,n,s){return n.safe(e.value,s)}function mD(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 gD(e,t,n){const s=(cS(n)+(n.options.ruleSpaces?" ":"")).repeat(mD(n));return n.options.ruleSpaces?s.slice(0,-1):s}const hS={blockquote:IN,break:Nb,code:$N,definition:VN,emphasis:tS,hardBreak:Nb,heading:ZN,html:iS,image:nS,imageReference:rS,inlineCode:sS,link:aS,linkReference:oS,list:lD,listItem:oD,paragraph:cD,root:hD,strong:uS,text:pD,thematicBreak:gD};function _D(){return{enter:{table:vD,tableData:Db,tableHeader:Db,tableRow:yD},exit:{codeText:xD,table:bD,tableData:wd,tableHeader:wd,tableRow:wd}}}function vD(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function bD(e){this.exit(e),this.data.inTable=void 0}function yD(e){this.enter({type:"tableRow",children:[]},e)}function wd(e){this.exit(e)}function Db(e){this.enter({type:"tableCell",children:[]},e)}function xD(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,SD));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function SD(e,t){return t==="|"?t:e}function wD(e){const t=e||{},n=t.tableCellPadding,s=t.tablePipeAlign,a=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[	 :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:c,tableCell:d,tableRow:f}};function c(y,S,A,R){return h(_(y,A,R),y.align)}function f(y,S,A,R){const D=v(y,A,R),W=h([D]);return W.slice(0,W.indexOf(`
`))}function d(y,S,A,R){const D=A.enter("tableCell"),W=A.enter("phrasing"),j=A.containerPhrasing(y,{...R,before:o,after:o});return W(),D(),j}function h(y,S){return jN(y,{align:S,alignDelimiters:s,padding:n,stringLength:a})}function _(y,S,A){const R=y.children;let D=-1;const W=[],j=S.enter("table");for(;++D<R.length;)W[D]=v(R[D],S,A);return j(),W}function v(y,S,A){const R=y.children;let D=-1;const W=[],j=S.enter("tableRow");for(;++D<R.length;)W[D]=d(R[D],y,S,A);return j(),W}function b(y,S,A){let R=hS.inlineCode(y,S,A);return A.stack.includes("tableCell")&&(R=R.replace(/\|/g,"\\$&")),R}}function CD(){return{exit:{taskListCheckValueChecked:Rb,taskListCheckValueUnchecked:Rb,paragraph:ED}}}function kD(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:AD}}}function Rb(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function ED(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const s=n.children[0];if(s&&s.type==="text"){const a=t.children;let o=-1,c;for(;++o<a.length;){const f=a[o];if(f.type==="paragraph"){c=f;break}}c===n&&(s.value=s.value.slice(1),s.value.length===0?n.children.shift():n.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,n.position.start=Object.assign({},s.position.start)))}}this.exit(e)}function AD(e,t,n,s){const a=e.children[0],o=typeof e.checked=="boolean"&&a&&a.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",f=n.createTracker(s);o&&f.move(c);let d=hS.listItem(e,t,n,{...s,...f.current()});return o&&(d=d.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),d;function h(_){return _+c}}function TD(){return[lN(),AN(),RN(),_D(),CD()]}function ND(e){return{extensions:[aN(),TN(e),MN(),wD(e),kD()]}}const DD={tokenize:BD,partial:!0},fS={tokenize:jD,partial:!0},dS={tokenize:HD,partial:!0},pS={tokenize:ID,partial:!0},RD={tokenize:PD,partial:!0},mS={name:"wwwAutolink",tokenize:LD,previous:_S},gS={name:"protocolAutolink",tokenize:OD,previous:vS},Sr={name:"emailAutolink",tokenize:zD,previous:bS},Xn={};function MD(){return{text:Xn}}let As=48;for(;As<123;)Xn[As]=Sr,As++,As===58?As=65:As===91&&(As=97);Xn[43]=Sr;Xn[45]=Sr;Xn[46]=Sr;Xn[95]=Sr;Xn[72]=[Sr,gS];Xn[104]=[Sr,gS];Xn[87]=[Sr,mS];Xn[119]=[Sr,mS];function zD(e,t,n){const s=this;let a,o;return c;function c(v){return!tp(v)||!bS.call(s,s.previous)||um(s.events)?n(v):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(v))}function f(v){return tp(v)?(e.consume(v),f):v===64?(e.consume(v),d):n(v)}function d(v){return v===46?e.check(RD,_,h)(v):v===45||v===95||Ci(v)?(o=!0,e.consume(v),d):_(v)}function h(v){return e.consume(v),a=!0,d}function _(v){return o&&a&&Ri(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(v)):n(v)}}function LD(e,t,n){const s=this;return a;function a(c){return c!==87&&c!==119||!_S.call(s,s.previous)||um(s.events)?n(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(DD,e.attempt(fS,e.attempt(dS,o),n),n)(c))}function o(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(c)}}function OD(e,t,n){const s=this;let a="",o=!1;return c;function c(v){return(v===72||v===104)&&vS.call(s,s.previous)&&!um(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(v),e.consume(v),f):n(v)}function f(v){if(Ri(v)&&a.length<5)return a+=String.fromCodePoint(v),e.consume(v),f;if(v===58){const b=a.toLowerCase();if(b==="http"||b==="https")return e.consume(v),d}return n(v)}function d(v){return v===47?(e.consume(v),o?h:(o=!0,d)):n(v)}function h(v){return v===null||mu(v)||bt(v)||Ls(v)||Eu(v)?n(v):e.attempt(fS,e.attempt(dS,_),n)(v)}function _(v){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(v)}}function BD(e,t,n){let s=0;return a;function a(c){return(c===87||c===119)&&s<3?(s++,e.consume(c),a):c===46&&s===3?(e.consume(c),o):n(c)}function o(c){return c===null?n(c):t(c)}}function jD(e,t,n){let s,a,o;return c;function c(h){return h===46||h===95?e.check(pS,d,f)(h):h===null||bt(h)||Ls(h)||h!==45&&Eu(h)?d(h):(o=!0,e.consume(h),c)}function f(h){return h===95?s=!0:(a=s,s=void 0),e.consume(h),c}function d(h){return a||s||!o?n(h):t(h)}}function HD(e,t){let n=0,s=0;return a;function a(c){return c===40?(n++,e.consume(c),a):c===41&&s<n?o(c):c===33||c===34||c===38||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===60||c===63||c===93||c===95||c===126?e.check(pS,t,o)(c):c===null||bt(c)||Ls(c)?t(c):(e.consume(c),a)}function o(c){return c===41&&s++,e.consume(c),a}}function ID(e,t,n){return s;function s(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),s):f===38?(e.consume(f),o):f===93?(e.consume(f),a):f===60||f===null||bt(f)||Ls(f)?t(f):n(f)}function a(f){return f===null||f===40||f===91||bt(f)||Ls(f)?t(f):s(f)}function o(f){return Ri(f)?c(f):n(f)}function c(f){return f===59?(e.consume(f),s):Ri(f)?(e.consume(f),c):n(f)}}function PD(e,t,n){return s;function s(o){return e.consume(o),a}function a(o){return Ci(o)?n(o):t(o)}}function _S(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||bt(e)}function vS(e){return!Ri(e)}function bS(e){return!(e===47||tp(e))}function tp(e){return e===43||e===45||e===46||e===95||Ci(e)}function um(e){let t=e.length,n=!1;for(;t--;){const s=e[t][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){n=!0;break}if(s._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const UD={tokenize:KD,partial:!0};function FD(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:YD,continuation:{tokenize:VD},exit:GD}},text:{91:{name:"gfmFootnoteCall",tokenize:$D},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:WD,resolveTo:qD}}}}function WD(e,t,n){const s=this;let a=s.events.length;const o=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let c;for(;a--;){const d=s.events[a][1];if(d.type==="labelImage"){c=d;break}if(d.type==="gfmFootnoteCall"||d.type==="labelLink"||d.type==="label"||d.type==="image"||d.type==="link")break}return f;function f(d){if(!c||!c._balanced)return n(d);const h=On(s.sliceSerialize({start:c.end,end:s.now()}));return h.codePointAt(0)!==94||!o.includes(h.slice(1))?n(d):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),t(d))}}function qD(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},f=[e[n+1],e[n+2],["enter",s,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",o,t],["enter",c,t],["exit",c,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",s,t]];return e.splice(n,e.length-n+1,...f),e}function $D(e,t,n){const s=this,a=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let o=0,c;return f;function f(v){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(v),e.exit("gfmFootnoteCallLabelMarker"),d}function d(v){return v!==94?n(v):(e.enter("gfmFootnoteCallMarker"),e.consume(v),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(v){if(o>999||v===93&&!c||v===null||v===91||bt(v))return n(v);if(v===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return a.includes(On(s.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(v),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(v)}return bt(v)||(c=!0),o++,e.consume(v),v===92?_:h}function _(v){return v===91||v===92||v===93?(e.consume(v),o++,h):h(v)}}function YD(e,t,n){const s=this,a=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let o,c=0,f;return d;function d(S){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(S){return S===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",_):n(S)}function _(S){if(c>999||S===93&&!f||S===null||S===91||bt(S))return n(S);if(S===93){e.exit("chunkString");const A=e.exit("gfmFootnoteDefinitionLabelString");return o=On(s.sliceSerialize(A)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return bt(S)||(f=!0),c++,e.consume(S),S===92?v:_}function v(S){return S===91||S===92||S===93?(e.consume(S),c++,_):_(S)}function b(S){return S===58?(e.enter("definitionMarker"),e.consume(S),e.exit("definitionMarker"),a.includes(o)||a.push(o),it(e,y,"gfmFootnoteDefinitionWhitespace")):n(S)}function y(S){return t(S)}}function VD(e,t,n){return e.check(bo,t,e.attempt(UD,t,n))}function GD(e){e.exit("gfmFootnoteDefinition")}function KD(e,t,n){const s=this;return it(e,a,"gfmFootnoteDefinitionIndent",5);function a(o){const c=s.events[s.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?t(o):n(o)}}function XD(e){let n=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:o,resolveAll:a};return n==null&&(n=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function a(c,f){let d=-1;for(;++d<c.length;)if(c[d][0]==="enter"&&c[d][1].type==="strikethroughSequenceTemporary"&&c[d][1]._close){let h=d;for(;h--;)if(c[h][0]==="exit"&&c[h][1].type==="strikethroughSequenceTemporary"&&c[h][1]._open&&c[d][1].end.offset-c[d][1].start.offset===c[h][1].end.offset-c[h][1].start.offset){c[d][1].type="strikethroughSequence",c[h][1].type="strikethroughSequence";const _={type:"strikethrough",start:Object.assign({},c[h][1].start),end:Object.assign({},c[d][1].end)},v={type:"strikethroughText",start:Object.assign({},c[h][1].end),end:Object.assign({},c[d][1].start)},b=[["enter",_,f],["enter",c[h][1],f],["exit",c[h][1],f],["enter",v,f]],y=f.parser.constructs.insideSpan.null;y&&an(b,b.length,0,Au(y,c.slice(h+1,d),f)),an(b,b.length,0,[["exit",v,f],["enter",c[d][1],f],["exit",c[d][1],f],["exit",_,f]]),an(c,h-1,d-h+3,b),d=h+b.length-2;break}}for(d=-1;++d<c.length;)c[d][1].type==="strikethroughSequenceTemporary"&&(c[d][1].type="data");return c}function o(c,f,d){const h=this.previous,_=this.events;let v=0;return b;function b(S){return h===126&&_[_.length-1][1].type!=="characterEscape"?d(S):(c.enter("strikethroughSequenceTemporary"),y(S))}function y(S){const A=Ll(h);if(S===126)return v>1?d(S):(c.consume(S),v++,y);if(v<2&&!n)return d(S);const R=c.exit("strikethroughSequenceTemporary"),D=Ll(S);return R._open=!D||D===2&&!!A,R._close=!A||A===2&&!!D,f(S)}}}class ZD{constructor(){this.map=[]}add(t,n,s){QD(this,t,n,s)}consume(t){if(this.map.sort(function(o,c){return o[0]-c[0]}),this.map.length===0)return;let n=this.map.length;const s=[];for(;n>0;)n-=1,s.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];s.push(t.slice()),t.length=0;let a=s.pop();for(;a;){for(const o of a)t.push(o);a=s.pop()}this.map.length=0}}function QD(e,t,n,s){let a=0;if(!(n===0&&s.length===0)){for(;a<e.map.length;){if(e.map[a][0]===t){e.map[a][1]+=n,e.map[a][2].push(...s);return}a+=1}e.map.push([t,n,s])}}function JD(e,t){let n=!1;const s=[];for(;t<e.length;){const a=e[t];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&s.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=s.length-1;s[o]=s[o]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return s}function eR(){return{flow:{null:{name:"table",tokenize:tR,resolveAll:iR}}}}function tR(e,t,n){const s=this;let a=0,o=0,c;return f;function f(G){let K=s.events.length-1;for(;K>-1;){const P=s.events[K][1].type;if(P==="lineEnding"||P==="linePrefix")K--;else break}const V=K>-1?s.events[K][1].type:null,z=V==="tableHead"||V==="tableRow"?L:d;return z===L&&s.parser.lazy[s.now().line]?n(G):z(G)}function d(G){return e.enter("tableHead"),e.enter("tableRow"),h(G)}function h(G){return G===124||(c=!0,o+=1),_(G)}function _(G){return G===null?n(G):Me(G)?o>1?(o=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(G),e.exit("lineEnding"),y):n(G):Xe(G)?it(e,_,"whitespace")(G):(o+=1,c&&(c=!1,a+=1),G===124?(e.enter("tableCellDivider"),e.consume(G),e.exit("tableCellDivider"),c=!0,_):(e.enter("data"),v(G)))}function v(G){return G===null||G===124||bt(G)?(e.exit("data"),_(G)):(e.consume(G),G===92?b:v)}function b(G){return G===92||G===124?(e.consume(G),v):v(G)}function y(G){return s.interrupt=!1,s.parser.lazy[s.now().line]?n(G):(e.enter("tableDelimiterRow"),c=!1,Xe(G)?it(e,S,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(G):S(G))}function S(G){return G===45||G===58?R(G):G===124?(c=!0,e.enter("tableCellDivider"),e.consume(G),e.exit("tableCellDivider"),A):J(G)}function A(G){return Xe(G)?it(e,R,"whitespace")(G):R(G)}function R(G){return G===58?(o+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(G),e.exit("tableDelimiterMarker"),D):G===45?(o+=1,D(G)):G===null||Me(G)?I(G):J(G)}function D(G){return G===45?(e.enter("tableDelimiterFiller"),W(G)):J(G)}function W(G){return G===45?(e.consume(G),W):G===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(G),e.exit("tableDelimiterMarker"),j):(e.exit("tableDelimiterFiller"),j(G))}function j(G){return Xe(G)?it(e,I,"whitespace")(G):I(G)}function I(G){return G===124?S(G):G===null||Me(G)?!c||a!==o?J(G):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(G)):J(G)}function J(G){return n(G)}function L(G){return e.enter("tableRow"),te(G)}function te(G){return G===124?(e.enter("tableCellDivider"),e.consume(G),e.exit("tableCellDivider"),te):G===null||Me(G)?(e.exit("tableRow"),t(G)):Xe(G)?it(e,te,"whitespace")(G):(e.enter("data"),X(G))}function X(G){return G===null||G===124||bt(G)?(e.exit("data"),te(G)):(e.consume(G),G===92?pe:X)}function pe(G){return G===92||G===124?(e.consume(G),X):X(G)}}function iR(e,t){let n=-1,s=!0,a=0,o=[0,0,0,0],c=[0,0,0,0],f=!1,d=0,h,_,v;const b=new ZD;for(;++n<e.length;){const y=e[n],S=y[1];y[0]==="enter"?S.type==="tableHead"?(f=!1,d!==0&&(Mb(b,t,d,h,_),_=void 0,d=0),h={type:"table",start:Object.assign({},S.start),end:Object.assign({},S.end)},b.add(n,0,[["enter",h,t]])):S.type==="tableRow"||S.type==="tableDelimiterRow"?(s=!0,v=void 0,o=[0,0,0,0],c=[0,n+1,0,0],f&&(f=!1,_={type:"tableBody",start:Object.assign({},S.start),end:Object.assign({},S.end)},b.add(n,0,[["enter",_,t]])),a=S.type==="tableDelimiterRow"?2:_?3:1):a&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")?(s=!1,c[2]===0&&(o[1]!==0&&(c[0]=c[1],v=Xc(b,t,o,a,void 0,v),o=[0,0,0,0]),c[2]=n)):S.type==="tableCellDivider"&&(s?s=!1:(o[1]!==0&&(c[0]=c[1],v=Xc(b,t,o,a,void 0,v)),o=c,c=[o[1],n,0,0])):S.type==="tableHead"?(f=!0,d=n):S.type==="tableRow"||S.type==="tableDelimiterRow"?(d=n,o[1]!==0?(c[0]=c[1],v=Xc(b,t,o,a,n,v)):c[1]!==0&&(v=Xc(b,t,c,a,n,v)),a=0):a&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")&&(c[3]=n)}for(d!==0&&Mb(b,t,d,h,_),b.consume(t.events),n=-1;++n<t.events.length;){const y=t.events[n];y[0]==="enter"&&y[1].type==="table"&&(y[1]._align=JD(t.events,n))}return e}function Xc(e,t,n,s,a,o){const c=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",f="tableContent";n[0]!==0&&(o.end=Object.assign({},Tl(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const d=Tl(t.events,n[1]);if(o={type:c,start:Object.assign({},d),end:Object.assign({},d)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const h=Tl(t.events,n[2]),_=Tl(t.events,n[3]),v={type:f,start:Object.assign({},h),end:Object.assign({},_)};if(e.add(n[2],0,[["enter",v,t]]),s!==2){const b=t.events[n[2]],y=t.events[n[3]];if(b[1].end=Object.assign({},y[1].end),b[1].type="chunkText",b[1].contentType="text",n[3]>n[2]+1){const S=n[2]+1,A=n[3]-n[2]-1;e.add(S,A,[])}}e.add(n[3]+1,0,[["exit",v,t]])}return a!==void 0&&(o.end=Object.assign({},Tl(t.events,a)),e.add(a,0,[["exit",o,t]]),o=void 0),o}function Mb(e,t,n,s,a){const o=[],c=Tl(t.events,n);a&&(a.end=Object.assign({},c),o.push(["exit",a,t])),s.end=Object.assign({},c),o.push(["exit",s,t]),e.add(n+1,0,o)}function Tl(e,t){const n=e[t],s=n[0]==="enter"?"start":"end";return n[1][s]}const nR={name:"tasklistCheck",tokenize:sR};function rR(){return{text:{91:nR}}}function sR(e,t,n){const s=this;return a;function a(d){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?n(d):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),o)}function o(d){return bt(d)?(e.enter("taskListCheckValueUnchecked"),e.consume(d),e.exit("taskListCheckValueUnchecked"),c):d===88||d===120?(e.enter("taskListCheckValueChecked"),e.consume(d),e.exit("taskListCheckValueChecked"),c):n(d)}function c(d){return d===93?(e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):n(d)}function f(d){return Me(d)?t(d):Xe(d)?e.check({tokenize:lR},t,n)(d):n(d)}}function lR(e,t,n){return it(e,s,"whitespace");function s(a){return a===null?n(a):t(a)}}function aR(e){return Dx([MD(),FD(),XD(e),eR(),rR()])}const oR={};function cR(e){const t=this,n=e||oR,s=t.data(),a=s.micromarkExtensions||(s.micromarkExtensions=[]),o=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),c=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);a.push(aR(n)),o.push(TD()),c.push(ND(n))}function zb({projectPath:e,projectName:t}){const[n,s]=N.useState([]),[a,o]=N.useState(!0),[c,f]=N.useState(null),[d,h]=N.useState(""),[_,v]=N.useState(!1),[b,y]=N.useState(!1),[S,A]=N.useState(""),[R,D]=N.useState(!1),[W,j]=N.useState(null),[I,J]=N.useState(!1);N.useEffect(()=>{o(!0),we.mdTree(e).then(s).catch(()=>s([])).finally(()=>o(!1))},[e]);const L=N.useCallback(X=>{f(X),y(!1),j(null),v(!0),we.readFile(X).then(pe=>{h(pe.content),A(pe.content),J(pe.editable??!1)}).catch(()=>h("Failed to load file")).finally(()=>v(!1))},[]),te=N.useCallback(async()=>{if(!(!c||R)){D(!0),j(null);try{await we.writeFile(c,S),h(S),y(!1)}catch(X){j(X instanceof Error?X.message:"Failed to save")}finally{D(!1)}}},[c,S,R]);return N.useEffect(()=>{if(n.length>0&&!c){const X=xS(n,"CLAUDE.md");X&&L(X)}},[n,c,L]),g.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[g.jsx("div",{className:"glass shrink-0 border-b border-white/5 px-6 py-4",children:g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",className:"text-blue-400",role:"img","aria-label":"Document icon",children:[g.jsx("title",{children:"Document icon"}),g.jsx("rect",{x:"2",y:"1",width:"12",height:"14",rx:"1",stroke:"currentColor",strokeWidth:"1.5",fill:"none"}),g.jsx("line",{x1:"5",y1:"5",x2:"11",y2:"5",stroke:"currentColor",strokeWidth:"1",opacity:"0.5"}),g.jsx("line",{x1:"5",y1:"8",x2:"11",y2:"8",stroke:"currentColor",strokeWidth:"1",opacity:"0.5"}),g.jsx("line",{x1:"5",y1:"11",x2:"9",y2:"11",stroke:"currentColor",strokeWidth:"1",opacity:"0.5"})]}),g.jsx("h2",{className:"text-lg font-semibold text-zinc-100",children:t}),g.jsx("span",{className:"text-xs text-zinc-500",children:"Markdown"})]})}),g.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[g.jsx("div",{className:"w-56 shrink-0 overflow-y-auto border-r border-white/5 bg-black/10 py-2",children:a?g.jsx("div",{className:"px-3 py-2 text-xs text-zinc-500",children:"Loading..."}):n.length===0?g.jsx("div",{className:"px-3 py-2 text-xs text-zinc-500",children:"No markdown files"}):g.jsx(yS,{entries:n,selectedFile:c,onSelect:L,depth:0})}),g.jsx("div",{className:"flex flex-1 flex-col overflow-auto",children:c?_?g.jsx("div",{className:"flex items-center justify-center py-20 text-sm text-zinc-500",children:"Loading..."}):b?g.jsxs("div",{className:"flex flex-1 flex-col h-full",children:[g.jsxs("div",{className:"flex items-center gap-2 border-b border-white/5 px-4 py-2",children:[g.jsx("span",{className:"text-xs text-zinc-400 font-mono truncate flex-1",children:c.split("/").pop()}),g.jsx("button",{type:"button",onClick:te,disabled:R,className:"rounded bg-blue-500/20 px-3 py-1 text-xs text-blue-400 hover:bg-blue-500/30 disabled:opacity-50",children:R?"Saving...":"Save"}),g.jsx("button",{type:"button",onClick:()=>{y(!1),A(d),j(null)},className:"rounded bg-white/5 px-3 py-1 text-xs text-zinc-400 hover:bg-white/10",children:"Cancel"})]}),W&&g.jsx("div",{className:"border-b border-red-500/20 bg-red-500/5 px-4 py-1 text-xs text-red-400",children:W}),g.jsx("textarea",{value:S,onChange:X=>A(X.target.value),className:"flex-1 resize-none bg-transparent px-6 py-4 font-mono text-sm text-zinc-200 outline-none",spellCheck:!1})]}):g.jsxs("div",{className:"flex flex-1 flex-col h-full",children:[g.jsxs("div",{className:"flex items-center gap-2 border-b border-white/5 px-4 py-2",children:[g.jsx("span",{className:"text-xs text-zinc-400 font-mono truncate flex-1",children:c.split("/").pop()}),I?g.jsx("button",{type:"button",onClick:()=>y(!0),className:"rounded bg-white/5 px-3 py-1 text-xs text-zinc-400 hover:bg-white/10 hover:text-zinc-200",children:"Edit"}):g.jsx("span",{className:"text-[10px] text-zinc-600",children:"read-only"})]}),g.jsx("div",{className:"flex-1 overflow-auto px-6 py-4",children:c.endsWith(".md")?g.jsx("div",{className:`prose prose-invert prose-sm max-w-none
                    prose-headings:text-zinc-100 prose-headings:font-semibold
                    prose-p:text-zinc-300 prose-p:leading-relaxed
                    prose-a:text-blue-400 prose-a:no-underline hover:prose-a:underline
                    prose-strong:text-zinc-200
                    prose-code:text-cyan-400 prose-code:bg-white/5 prose-code:rounded prose-code:px-1 prose-code:py-0.5 prose-code:text-xs prose-code:before:content-none prose-code:after:content-none
                    prose-pre:bg-zinc-900/50 prose-pre:border prose-pre:border-white/5 prose-pre:rounded-lg
                    prose-li:text-zinc-300
                    prose-th:text-zinc-300 prose-th:border-white/10
                    prose-td:text-zinc-400 prose-td:border-white/10
                    prose-hr:border-white/10
                    prose-blockquote:border-blue-500/30 prose-blockquote:text-zinc-400
                  `,children:g.jsx(XT,{remarkPlugins:[cR],children:d})}):g.jsx("pre",{className:"text-xs text-zinc-300 font-mono whitespace-pre-wrap break-words select-text leading-relaxed",children:d})})]}):g.jsx("div",{className:"flex items-center justify-center py-20 text-sm text-zinc-500",children:"Select a file to preview"})})]})]})}function uR(e){var s;const t=((s=e.split(".").pop())==null?void 0:s.toLowerCase())??"";return{md:"MD",json:"JS",toml:"TM",txt:"TX",yaml:"YM",yml:"YM",rs:"RS",ts:"TS",tsx:"TX",js:"JS",jsx:"JX",css:"CS",html:"HT",lock:"LK",sh:"SH",py:"PY",go:"GO"}[t]??t.slice(0,2).toUpperCase()}function yS({entries:e,selectedFile:t,onSelect:n,depth:s}){const[a,o]=N.useState(new Set);return g.jsx(g.Fragment,{children:e.map(c=>{if(c.is_dir){const d=a.has(c.path);return g.jsxs("div",{children:[g.jsxs("button",{type:"button",onClick:()=>o(h=>{const _=new Set(h);return _.has(c.path)?_.delete(c.path):_.add(c.path),_}),className:"flex w-full items-center gap-1 px-2 py-1 text-left text-[11px] text-zinc-500 hover:text-zinc-300 transition-colors",style:{paddingLeft:8+s*12},children:[g.jsx("span",{className:"text-[9px]",children:d?"▸":"▾"}),g.jsx("span",{className:"truncate",children:c.name})]}),!d&&c.children&&g.jsx(yS,{entries:c.children,selectedFile:t,onSelect:n,depth:s+1})]},c.path)}const f=t===c.path;return g.jsxs("button",{type:"button",onClick:()=>n(c.path),className:`flex w-full items-center gap-1.5 px-2 py-1 text-left text-[11px] transition-colors ${f?"bg-blue-500/10 text-blue-400":c.openable?"text-zinc-400 hover:bg-white/5 hover:text-zinc-200":"text-zinc-600 hover:bg-white/[0.03] hover:text-zinc-400"}`,style:{paddingLeft:8+s*12},children:[g.jsx("span",{className:`shrink-0 text-[10px] ${f?"text-blue-500":c.openable?"text-zinc-500":"text-zinc-700"}`,children:uR(c.name)}),g.jsx("span",{className:"truncate",children:c.name})]},c.path)})})}function xS(e,t){for(const n of e){if(!n.is_dir&&n.openable&&n.name===t)return n.path;if(n.is_dir&&n.children){const s=xS(n.children,t);if(s)return s}}return null}function Lb(e){switch(e){case"Critical":return"text-red-400";case"High":return"text-orange-400";case"Medium":return"text-yellow-400";case"Low":return"text-blue-400"}}function hR(e){switch(e){case"Critical":return"bg-red-500/15 text-red-400";case"High":return"bg-orange-500/15 text-orange-400";case"Medium":return"bg-yellow-500/15 text-yellow-400";case"Low":return"bg-blue-500/15 text-blue-400"}}function fR(e,t){return e.risks.filter(n=>n.severity===t).length}function dR({onClose:e}){const[t,n]=N.useState(null),[s,a]=N.useState(!1),[o,c]=N.useState("");N.useEffect(()=>{we.lastSecurityScan().then(h=>{h&&n(h)}).catch(console.error)},[]);const f=N.useCallback(async()=>{a(!0),c("");try{const h=await we.runSecurityScan();n(h)}catch(h){c(h instanceof Error?h.message:"Scan failed")}finally{a(!1)}},[]),d=["Critical","High","Medium","Low"];return g.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[g.jsxs("div",{className:"flex items-center justify-between border-b border-white/5 px-6 py-4",children:[g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx("h2",{className:"text-lg font-semibold text-zinc-200",children:"Security Scan"}),g.jsx("button",{type:"button",onClick:f,disabled:s,className:"rounded-md bg-cyan-500/20 px-3 py-1 text-xs text-cyan-400 transition-colors hover:bg-cyan-500/30 disabled:opacity-50",children:s?"Scanning...":"Scan"})]}),g.jsx("button",{type:"button",onClick:e,className:"rounded-md px-3 py-1 text-sm text-zinc-500 transition-colors hover:bg-white/10 hover:text-zinc-300",children:"Close"})]}),g.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-4 space-y-4",children:[o&&g.jsx("p",{className:"text-xs text-red-400",children:o}),t?g.jsxs(g.Fragment,{children:[g.jsxs("section",{children:[g.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.map(h=>{const _=fR(t,h);return _===0?null:g.jsxs("span",{className:`rounded-full px-2.5 py-0.5 text-xs font-medium ${hR(h)}`,children:[_," ",h]},h)}),t.risks.length===0&&g.jsx("span",{className:"rounded-full bg-emerald-500/15 px-2.5 py-0.5 text-xs font-medium text-emerald-400",children:"No risks detected"})]}),g.jsxs("p",{className:"mt-2 text-[11px] text-zinc-600",children:["Scanned ",t.files_scanned," files, ",t.scanned_projects.length," ","projects at ",new Date(t.scanned_at).toLocaleTimeString()]})]}),t.risks.length>0&&g.jsx("section",{className:"space-y-2",children:t.risks.map(h=>g.jsx("div",{className:"rounded-lg border border-white/10 bg-white/[0.02] p-3",children:g.jsxs("div",{className:"flex items-start gap-2",children:[g.jsxs("span",{className:`text-xs font-mono font-bold ${Lb(h.severity)}`,children:["[",h.rule_id,"]"]}),g.jsxs("div",{className:"flex-1 min-w-0",children:[g.jsx("p",{className:"text-sm font-medium text-zinc-200",children:h.summary}),g.jsxs("div",{className:"mt-1 flex items-center gap-2 text-[11px] text-zinc-500",children:[g.jsx("span",{children:h.category}),g.jsx("span",{children:"·"}),g.jsx("span",{className:"truncate",children:h.source})]}),g.jsx("p",{className:"mt-2 text-xs text-zinc-400 leading-relaxed",children:h.detail}),h.matched_value&&g.jsx("div",{className:"mt-2 rounded bg-white/5 px-2 py-1",children:g.jsx("code",{className:`text-[11px] ${Lb(h.severity)}`,children:h.matched_value})})]})]})},`${h.rule_id}-${h.source}-${h.summary}`))})]}):g.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[g.jsx("p",{className:"text-sm text-zinc-500",children:"No scan results yet"}),g.jsx("p",{className:"mt-1 text-xs text-zinc-600",children:"Click Scan to check Claude Code settings for security risks"})]})]})]})}function pR({onSelect:e,onCancel:t}){const[n,s]=N.useState(""),[a,o]=N.useState([]),[c,f]=N.useState(!0),[d,h]=N.useState(""),_=N.useCallback(async b=>{f(!0),h("");try{const y=await we.listDirectories(b);if(o(y),b)s(b);else if(y.length>0){const S=y[0].path;s(S.substring(0,S.lastIndexOf("/")))}}catch(y){h(y instanceof Error?y.message:"Failed to load")}finally{f(!1)}},[]);N.useEffect(()=>{_()},[_]);const v=()=>{if(!n||n==="/")return;const b=n.substring(0,n.lastIndexOf("/"))||"/";_(b)};return g.jsx("div",{role:"dialog",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:t,onKeyDown:b=>{b.key==="Escape"&&t()},children:g.jsxs("div",{role:"presentation",className:"glass mx-4 flex w-full max-w-lg flex-col rounded-2xl border border-white/10 shadow-2xl",onClick:b=>b.stopPropagation(),onKeyDown:b=>b.stopPropagation(),children:[g.jsxs("div",{className:"flex items-center justify-between border-b border-white/5 px-5 py-3",children:[g.jsx("h3",{className:"text-sm font-semibold text-zinc-200",children:"Select Directory"}),g.jsx("button",{type:"button",onClick:t,className:"rounded px-2 py-0.5 text-xs text-zinc-500 transition-colors hover:bg-white/10 hover:text-zinc-300",children:"Cancel"})]}),g.jsxs("div",{className:"flex items-center gap-2 border-b border-white/5 px-5 py-2",children:[g.jsx("button",{type:"button",onClick:v,disabled:!n||n==="/",className:"shrink-0 rounded px-1.5 py-0.5 text-xs text-zinc-400 transition-colors hover:bg-white/10 hover:text-zinc-200 disabled:opacity-30",children:".."}),g.jsx("span",{className:"flex-1 truncate text-xs text-zinc-500",title:n,children:n||"~"}),g.jsx("button",{type:"button",onClick:()=>e(n),className:"shrink-0 rounded-md bg-cyan-500/20 px-3 py-1 text-xs text-cyan-400 transition-colors hover:bg-cyan-500/30",children:"Select this"})]}),g.jsxs("div",{className:"max-h-80 overflow-y-auto",children:[c&&g.jsx("div",{className:"px-5 py-6 text-center text-xs text-zinc-600",children:"Loading..."}),d&&g.jsx("div",{className:"px-5 py-6 text-center text-xs text-red-400",children:d}),!c&&!d&&a.length===0&&g.jsx("div",{className:"px-5 py-6 text-center text-xs text-zinc-600",children:"No subdirectories"}),!c&&!d&&a.map(b=>g.jsxs("button",{type:"button",onClick:()=>_(b.path),onDoubleClick:()=>e(b.path),className:ui("flex w-full items-center gap-2 px-5 py-1.5 text-left text-xs transition-colors hover:bg-white/5",b.is_git?"text-cyan-400":"text-zinc-400"),children:[g.jsx("span",{className:"shrink-0 text-[10px]",children:b.is_git?"●":"▸"}),g.jsx("span",{className:"flex-1 truncate",children:b.name}),b.is_git&&g.jsx("span",{className:"shrink-0 text-[9px] text-cyan-600",children:"git"})]},b.path))]}),g.jsx("div",{className:"border-t border-white/5 px-5 py-2",children:g.jsx("p",{className:"text-[10px] text-zinc-600",children:"Click to navigate, double-click to select"})})]})})}function mR({onClose:e,onProjectsChanged:t}){const[n,s]=N.useState([]),[a,o]=N.useState(!1),[c,f]=N.useState(""),[d,h]=N.useState(""),[_,v]=N.useState(null),[b,y]=N.useState(null),[S,A]=N.useState(null),[R,D]=N.useState(!0),[W,j]=N.useState(""),I=N.useCallback(()=>{we.listProjects().then(s).catch(console.error)},[]),J=N.useCallback(()=>{we.getSpawnSettings().then(v).catch(console.error)},[]),L=N.useCallback(()=>{we.getAutoApproveSettings().then(y).catch(console.error)},[]),te=N.useCallback(()=>{we.getUsageSettings().then(A).catch(console.error)},[]);N.useEffect(()=>{I(),J(),L(),te(),we.getPreviewSettings().then(z=>D(z.show_cursor)).catch(()=>{})},[I,J,L,te]);const X=async z=>{const P=(z??c).trim();if(P){h("");try{await we.addProject(P),f(""),o(!1),I(),t()}catch($){h($ instanceof Error?$.message:"Failed to add project")}}},pe=async z=>{try{await we.removeProject(z),I(),t()}catch{}},G=async()=>{if(!_)return;const z=!_.use_tmux_window;try{await we.updateSpawnSettings({use_tmux_window:z}),v({..._,use_tmux_window:z})}catch{}},K=async z=>{_&&v({..._,tmux_window_name:z})},V=async()=>{if(!_)return;const z=_.tmux_window_name.trim();if(z)try{await we.updateSpawnSettings({use_tmux_window:_.use_tmux_window,tmux_window_name:z})}catch{}};return g.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[g.jsxs("div",{className:"flex items-center justify-between border-b border-white/5 px-6 py-4",children:[g.jsx("h2",{className:"text-lg font-semibold text-zinc-200",children:"Settings"}),g.jsx("button",{type:"button",onClick:e,className:"rounded-md px-3 py-1 text-sm text-zinc-500 transition-colors hover:bg-white/10 hover:text-zinc-300",children:"Close"})]}),g.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-4 space-y-6",children:[b&&g.jsxs("section",{children:[g.jsx("h3",{className:"text-sm font-medium text-zinc-300",children:"Auto-approve"}),g.jsx("p",{className:"mt-1 text-xs text-zinc-600",children:"Automatically approve agent actions. Changes apply on restart."}),g.jsxs("div",{className:"mt-3 rounded-lg border border-white/10 bg-white/[0.02] p-3 space-y-4",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"shrink-0 text-xs text-zinc-500",children:"Mode"}),g.jsxs("select",{value:b.mode,onChange:async z=>{const P=z.target.value;y({...b,mode:P});try{await we.updateAutoApproveMode(P)}catch{}},className:"flex-1 rounded-md border border-white/10 bg-white/5 px-2.5 py-1 text-xs text-zinc-200 outline-none focus:border-cyan-500/30",children:[g.jsx("option",{value:"off",children:"Off"}),g.jsx("option",{value:"rules",children:"Rules (fast, pattern-based)"}),g.jsx("option",{value:"ai",children:"AI (Claude Haiku judge)"}),g.jsx("option",{value:"hybrid",children:"Hybrid (rules → AI fallback)"})]})]}),b.running&&g.jsx("p",{className:"text-[11px] text-emerald-500/70",children:"Service running"}),b.mode!=="off"&&!b.running&&g.jsx("p",{className:"text-[11px] text-amber-500/70",children:"Restart tmai to activate"}),(b.mode==="rules"||b.mode==="hybrid")&&g.jsxs("div",{className:"space-y-2 border-t border-white/5 pt-3",children:[g.jsx("p",{className:"text-[11px] font-medium text-zinc-400 uppercase tracking-wider",children:"Rule Presets"}),[{key:"allow_read",label:"Read operations",desc:"file reads, cat, ls, grep, find"},{key:"allow_tests",label:"Test execution",desc:"cargo test, npm test, pytest, go test"},{key:"allow_fetch",label:"Web fetch",desc:"WebFetch / WebSearch (GET only)"},{key:"allow_git_readonly",label:"Git read-only",desc:"status, log, diff, branch, show, blame"},{key:"allow_format_lint",label:"Format & lint",desc:"cargo fmt/clippy, prettier, eslint"}].map(({key:z,label:P,desc:$})=>g.jsxs("label",{className:"flex items-center justify-between gap-3",children:[g.jsxs("div",{className:"flex-1",children:[g.jsx("span",{className:"text-xs text-zinc-300",children:P}),g.jsx("p",{className:"text-[10px] text-zinc-600",children:$})]}),g.jsx("button",{type:"button",onClick:async()=>{const C=!b.rules[z];y({...b,rules:{...b.rules,[z]:C}});try{await we.updateAutoApproveRules({[z]:C})}catch{}},className:`relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors ${b.rules[z]?"bg-cyan-500/40":"bg-white/10"}`,children:g.jsx("span",{className:`inline-block h-3.5 w-3.5 rounded-full transition-transform ${b.rules[z]?"translate-x-[18px] bg-cyan-400":"translate-x-0.5 bg-zinc-500"}`})})]},z)),g.jsxs("div",{className:"border-t border-white/5 pt-3 space-y-2",children:[g.jsx("p",{className:"text-[11px] font-medium text-zinc-400 uppercase tracking-wider",children:"Custom Patterns"}),g.jsx("p",{className:"text-[10px] text-zinc-600",children:"Regex patterns matched against tool context for approval."}),b.rules.allow_patterns.length>0&&g.jsx("div",{className:"space-y-1",children:b.rules.allow_patterns.map(z=>g.jsxs("div",{className:"group flex items-center gap-2 rounded px-2 py-1 transition-colors hover:bg-white/5",children:[g.jsx("code",{className:"flex-1 text-[11px] text-zinc-300 font-mono",children:z}),g.jsx("button",{type:"button",onClick:async()=>{const P=b.rules.allow_patterns.filter($=>$!==z);y({...b,rules:{...b.rules,allow_patterns:P}});try{await we.updateAutoApproveRules({allow_patterns:P})}catch{}},className:"shrink-0 rounded px-1.5 py-0.5 text-[10px] text-zinc-600 opacity-0 transition-all hover:bg-red-500/10 hover:text-red-400 group-hover:opacity-100",children:"×"})]},z))}),g.jsxs("div",{className:"flex gap-1.5",children:[g.jsx("input",{type:"text",value:W,onChange:z=>j(z.target.value),onKeyDown:async z=>{if(z.key==="Enter"&&W.trim()){const P=[...b.rules.allow_patterns,W.trim()];y({...b,rules:{...b.rules,allow_patterns:P}}),j("");try{await we.updateAutoApproveRules({allow_patterns:P})}catch{}}},placeholder:"e.g. cargo build.*",className:"flex-1 rounded-md border border-white/10 bg-white/5 px-2.5 py-1 text-xs font-mono text-zinc-200 placeholder-zinc-600 outline-none focus:border-cyan-500/30"}),g.jsx("button",{type:"button",onClick:async()=>{if(!W.trim())return;const z=[...b.rules.allow_patterns,W.trim()];y({...b,rules:{...b.rules,allow_patterns:z}}),j("");try{await we.updateAutoApproveRules({allow_patterns:z})}catch{}},className:"rounded-md bg-cyan-500/20 px-3 py-1 text-xs text-cyan-400 transition-colors hover:bg-cyan-500/30",children:"Add"})]})]})]})]})]}),_&&g.jsxs("section",{children:[g.jsx("h3",{className:"text-sm font-medium text-zinc-300",children:"Spawn"}),g.jsx("p",{className:"mt-1 text-xs text-zinc-600",children:"How new agents are started from the Web UI."}),g.jsxs("div",{className:"mt-3 rounded-lg border border-white/10 bg-white/[0.02] p-3",children:[g.jsxs("label",{className:"flex items-center justify-between gap-3",children:[g.jsxs("div",{className:"flex-1",children:[g.jsx("span",{className:"text-sm text-zinc-300",children:"Spawn in tmux window"}),g.jsx("p",{className:"mt-0.5 text-[11px] text-zinc-600",children:_.tmux_available?`New agents will appear as tmux panes in the "${_.tmux_window_name}" window, detected by the poller like regular sessions.`:"tmux is not available in this mode. Agents are spawned as internal PTY sessions."})]}),g.jsx("button",{type:"button",onClick:G,disabled:!_.tmux_available,className:`relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors ${_.tmux_available?_.use_tmux_window?"bg-cyan-500/40":"bg-white/10":"cursor-not-allowed bg-white/5"}`,children:g.jsx("span",{className:`inline-block h-3.5 w-3.5 rounded-full transition-transform ${_.tmux_available?_.use_tmux_window?"translate-x-[18px] bg-cyan-400":"translate-x-0.5 bg-zinc-500":"translate-x-0.5 bg-zinc-700"}`})})]}),_.tmux_available&&_.use_tmux_window&&g.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[g.jsx("span",{className:"shrink-0 text-xs text-zinc-500",children:"Window name"}),g.jsx("input",{type:"text",value:_.tmux_window_name,onChange:z=>K(z.target.value),onBlur:V,onKeyDown:z=>{z.key==="Enter"&&V()},className:"flex-1 rounded-md border border-white/10 bg-white/5 px-2.5 py-1 text-xs text-zinc-200 outline-none focus:border-cyan-500/30"})]})]})]}),S&&g.jsxs("section",{children:[g.jsx("h3",{className:"text-sm font-medium text-zinc-300",children:"Usage Monitoring"}),g.jsx("p",{className:"mt-1 text-xs text-zinc-600",children:"Periodically fetch Claude Code subscription usage. Spawns a temporary Claude Code instance (Haiku) for each refresh."}),g.jsxs("div",{className:"mt-3 rounded-lg border border-white/10 bg-white/[0.02] p-3 space-y-3",children:[g.jsxs("label",{className:"flex items-center justify-between gap-3",children:[g.jsx("div",{className:"flex-1",children:g.jsx("span",{className:"text-sm text-zinc-300",children:"Auto-refresh"})}),g.jsx("button",{type:"button",onClick:async()=>{const z=!S.enabled;A({...S,enabled:z});try{await we.updateUsageSettings({enabled:z})}catch{}},className:`relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors ${S.enabled?"bg-cyan-500/40":"bg-white/10"}`,children:g.jsx("span",{className:`inline-block h-3.5 w-3.5 rounded-full transition-transform ${S.enabled?"translate-x-[18px] bg-cyan-400":"translate-x-0.5 bg-zinc-500"}`})})]}),S.enabled&&g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"shrink-0 text-xs text-zinc-500",children:"Interval"}),g.jsx("input",{type:"number",min:5,max:1440,value:S.auto_refresh_min||30,onChange:z=>{const P=parseInt(z.target.value,10);Number.isNaN(P)||A({...S,auto_refresh_min:P})},onBlur:async()=>{const z=Math.max(5,S.auto_refresh_min||30);try{await we.updateUsageSettings({auto_refresh_min:z})}catch{}},className:"w-20 rounded-md border border-white/10 bg-white/5 px-2.5 py-1 text-xs text-zinc-200 outline-none focus:border-cyan-500/30"}),g.jsx("span",{className:"text-xs text-zinc-500",children:"minutes"})]})]})]}),g.jsxs("section",{children:[g.jsx("h3",{className:"text-sm font-medium text-zinc-300",children:"Preview"}),g.jsx("p",{className:"mt-1 text-xs text-zinc-600",children:"Terminal preview panel display options."}),g.jsx("div",{className:"mt-3 rounded-lg border border-white/10 bg-white/[0.02] p-3",children:g.jsxs("label",{className:"flex items-center justify-between gap-3",children:[g.jsxs("div",{className:"flex-1",children:[g.jsx("span",{className:"text-sm text-zinc-300",children:"Show cursor overlay"}),g.jsx("p",{className:"text-[11px] text-zinc-600 mt-0.5",children:"Display the terminal cursor position in the preview panel. Can also be toggled per-session from the preview footer."})]}),g.jsx("button",{type:"button",onClick:async()=>{const z=R,P=!z;D(P);try{await we.updatePreviewSettings({show_cursor:P})}catch{D(z)}},className:`relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors ${R?"bg-cyan-500/40":"bg-white/10"}`,children:g.jsx("span",{className:`inline-block h-3.5 w-3.5 rounded-full transition-transform ${R?"translate-x-[18px] bg-cyan-400":"translate-x-0.5 bg-zinc-500"}`})})]})})]}),g.jsxs("section",{children:[g.jsx("h3",{className:"text-sm font-medium text-zinc-300",children:"Projects"}),g.jsx("p",{className:"mt-1 text-xs text-zinc-600",children:"Registered directories appear in the sidebar even with no agents running."}),g.jsxs("div",{className:"mt-3 rounded-lg border border-white/10 bg-white/[0.02] p-3",children:[g.jsxs("div",{className:"flex gap-1.5",children:[g.jsx("input",{type:"text",value:c,onChange:z=>f(z.target.value),onKeyDown:z=>{z.key==="Enter"&&X()},placeholder:"/path/to/project",className:"flex-1 rounded-md border border-white/10 bg-white/5 px-2.5 py-1.5 text-xs text-zinc-200 placeholder-zinc-600 outline-none focus:border-cyan-500/30"}),g.jsx("button",{type:"button",onClick:()=>X(),className:"rounded-md bg-cyan-500/20 px-3 py-1.5 text-xs text-cyan-400 transition-colors hover:bg-cyan-500/30",children:"Add"}),g.jsx("button",{type:"button",onClick:()=>o(z=>!z),className:`rounded-md border border-white/10 px-3 py-1.5 text-xs transition-colors hover:bg-white/10 ${a?"text-cyan-400":"text-zinc-400 hover:text-zinc-200"}`,children:"Browse"})]}),d&&g.jsx("p",{className:"mt-1.5 text-[11px] text-red-400",children:d}),a&&g.jsx("div",{className:"mt-2",children:g.jsx(pR,{onSelect:z=>X(z),onCancel:()=>o(!1)})})]}),g.jsxs("div",{className:"mt-3 space-y-1",children:[n.length===0&&g.jsx("p",{className:"py-4 text-center text-xs text-zinc-600",children:"No projects registered"}),n.map(z=>g.jsxs("div",{className:"group flex items-center gap-2 rounded-lg px-3 py-2 transition-colors hover:bg-white/5",children:[g.jsx("span",{className:"text-xs text-zinc-500",children:"●"}),g.jsxs("div",{className:"flex-1 truncate",children:[g.jsx("span",{className:"text-sm text-zinc-300",children:z.split("/").filter(Boolean).pop()}),g.jsx("span",{className:"ml-2 text-[11px] text-zinc-600",children:z})]}),g.jsx("button",{type:"button",onClick:()=>pe(z),className:"shrink-0 rounded px-2 py-0.5 text-xs text-zinc-600 opacity-0 transition-all hover:bg-red-500/10 hover:text-red-400 group-hover:opacity-100",children:"Remove"})]},z))]})]})]})]})}function gR({terminals:e,selectedTarget:t,onSelect:n}){return e.length===0?null:g.jsxs("div",{className:"border-t border-white/5 px-2 pb-2 pt-1",children:[g.jsx("div",{className:"px-1 py-1 text-[10px] font-medium uppercase tracking-wider text-zinc-600",children:"Terminals"}),g.jsx("div",{className:"flex flex-col gap-0.5",children:e.map(s=>{const a=s.id===t||s.target===t,o=_R(s),c=zl(s.status);return g.jsxs("button",{type:"button",onClick:()=>n(s.id),className:ui("flex items-center justify-between rounded-md px-2 py-1 text-left text-xs transition-colors",a?"bg-cyan-500/10 text-cyan-400":"text-zinc-400 hover:bg-white/5 hover:text-zinc-300"),children:[g.jsxs("div",{className:"flex items-center gap-1.5 truncate",children:[g.jsx("span",{className:"text-zinc-600",children:">"}),g.jsx("span",{className:"truncate",children:o})]}),g.jsx("span",{className:ui("shrink-0 text-[10px]",c==="Idle"?"text-zinc-600":"text-zinc-500"),children:c})]},s.id)})})]})}function _R(e){const t=e.agent_type,n=typeof t=="object"&&"Custom"in t?t.Custom:"";return e.display_name&&e.display_name!=="pty:0.0"?e.display_name:n||"terminal"}/**
 * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
 * @license MIT
 *
 * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
 * @license MIT
 *
 * Originally forked from (with the author's permission):
 *   Fabrice Bellard's javascript vt100 for jslinux:
 *   http://bellard.org/jslinux/
 *   Copyright (c) 2011 Fabrice Bellard
 */var vR=2,bR=1,yR=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(){var v;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:((v=this._terminal.options.overviewRuler)==null?void 0:v.width)||14,n=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(n.getPropertyValue("height")),a=Math.max(0,parseInt(n.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),c={top:parseInt(o.getPropertyValue("padding-top")),bottom:parseInt(o.getPropertyValue("padding-bottom")),right:parseInt(o.getPropertyValue("padding-right")),left:parseInt(o.getPropertyValue("padding-left"))},f=c.top+c.bottom,d=c.right+c.left,h=s-f,_=a-d-t;return{cols:Math.max(vR,Math.floor(_/e.css.cell.width)),rows:Math.max(bR,Math.floor(h/e.css.cell.height))}}};/**
 * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
 * @license MIT
 *
 * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
 * @license MIT
 *
 * Originally forked from (with the author's permission):
 *   Fabrice Bellard's javascript vt100 for jslinux:
 *   http://bellard.org/jslinux/
 *   Copyright (c) 2011 Fabrice Bellard
 */var SS=Object.defineProperty,xR=Object.getOwnPropertyDescriptor,SR=(e,t)=>{for(var n in t)SS(e,n,{get:t[n],enumerable:!0})},It=(e,t,n,s)=>{for(var a=s>1?void 0:s?xR(t,n):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(a=(s?c(t,n,a):c(a))||a);return s&&a&&SS(t,n,a),a},be=(e,t)=>(n,s)=>t(n,s,e),Ob="Terminal input",ip={get:()=>Ob,set:e=>Ob=e},Bb="Too much output to announce, navigate to rows manually to read",np={get:()=>Bb,set:e=>Bb=e};function wR(e){return e.replace(/\r?\n/g,"\r")}function CR(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function kR(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function ER(e,t,n,s){if(e.stopPropagation(),e.clipboardData){let a=e.clipboardData.getData("text/plain");wS(a,t,n,s)}}function wS(e,t,n,s){e=wR(e),e=CR(e,n.decPrivateModes.bracketedPasteMode&&s.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function CS(e,t,n){let s=n.getBoundingClientRect(),a=e.clientX-s.left-10,o=e.clientY-s.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${a}px`,t.style.top=`${o}px`,t.style.zIndex="1000",t.focus()}function jb(e,t,n,s,a){CS(e,t,n),a&&s.rightClickSelect(e),t.value=s.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 Ru(e,t=0,n=e.length){let s="";for(let a=t;a<n;++a){let o=e[a];o>65535?(o-=65536,s+=String.fromCharCode((o>>10)+55296)+String.fromCharCode(o%1024+56320)):s+=String.fromCharCode(o)}return s}var AR=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let s=0,a=0;if(this._interim){let o=e.charCodeAt(a++);56320<=o&&o<=57343?t[s++]=(this._interim-55296)*1024+o-56320+65536:(t[s++]=this._interim,t[s++]=o),this._interim=0}for(let o=a;o<n;++o){let c=e.charCodeAt(o);if(55296<=c&&c<=56319){if(++o>=n)return this._interim=c,s;let f=e.charCodeAt(o);56320<=f&&f<=57343?t[s++]=(c-55296)*1024+f-56320+65536:(t[s++]=c,t[s++]=f);continue}c!==65279&&(t[s++]=c)}return s}},TR=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let s=0,a,o,c,f,d=0,h=0;if(this.interim[0]){let b=!1,y=this.interim[0];y&=(y&224)===192?31:(y&240)===224?15:7;let S=0,A;for(;(A=this.interim[++S]&63)&&S<4;)y<<=6,y|=A;let R=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,D=R-S;for(;h<D;){if(h>=n)return 0;if(A=e[h++],(A&192)!==128){h--,b=!0;break}else this.interim[S++]=A,y<<=6,y|=A&63}b||(R===2?y<128?h--:t[s++]=y:R===3?y<2048||y>=55296&&y<=57343||y===65279||(t[s++]=y):y<65536||y>1114111||(t[s++]=y)),this.interim.fill(0)}let _=n-4,v=h;for(;v<n;){for(;v<_&&!((a=e[v])&128)&&!((o=e[v+1])&128)&&!((c=e[v+2])&128)&&!((f=e[v+3])&128);)t[s++]=a,t[s++]=o,t[s++]=c,t[s++]=f,v+=4;if(a=e[v++],a<128)t[s++]=a;else if((a&224)===192){if(v>=n)return this.interim[0]=a,s;if(o=e[v++],(o&192)!==128){v--;continue}if(d=(a&31)<<6|o&63,d<128){v--;continue}t[s++]=d}else if((a&240)===224){if(v>=n)return this.interim[0]=a,s;if(o=e[v++],(o&192)!==128){v--;continue}if(v>=n)return this.interim[0]=a,this.interim[1]=o,s;if(c=e[v++],(c&192)!==128){v--;continue}if(d=(a&15)<<12|(o&63)<<6|c&63,d<2048||d>=55296&&d<=57343||d===65279)continue;t[s++]=d}else if((a&248)===240){if(v>=n)return this.interim[0]=a,s;if(o=e[v++],(o&192)!==128){v--;continue}if(v>=n)return this.interim[0]=a,this.interim[1]=o,s;if(c=e[v++],(c&192)!==128){v--;continue}if(v>=n)return this.interim[0]=a,this.interim[1]=o,this.interim[2]=c,s;if(f=e[v++],(f&192)!==128){v--;continue}if(d=(a&7)<<18|(o&63)<<12|(c&63)<<6|f&63,d<65536||d>1114111)continue;t[s++]=d}}return s}},kS="",rs=" ",xo=class ES{constructor(){this.fg=0,this.bg=0,this.extended=new bu}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 ES;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}},bu=class AS{constructor(t=0,n=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new AS(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Tn=class TS extends xo{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new bu,this.combinedData=""}static fromCharData(t){let n=new TS;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?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 n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let a=t[1].charCodeAt(1);56320<=a&&a<=57343?this.content=(s-55296)*1024+a-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Hb="di$target",rp="di$dependencies",Cd=new Map;function NR(e){return e[rp]||[]}function hi(e){if(Cd.has(e))return Cd.get(e);let t=function(n,s,a){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");DR(t,n,a)};return t._id=e,Cd.set(e,t),t}function DR(e,t,n){t[Hb]===t?t[rp].push({id:e,index:n}):(t[rp]=[{id:e,index:n}],t[Hb]=t)}var Li=hi("BufferService"),NS=hi("CoreMouseService"),Is=hi("CoreService"),RR=hi("CharsetService"),hm=hi("InstantiationService"),DS=hi("LogService"),Oi=hi("OptionsService"),RS=hi("OscLinkService"),MR=hi("UnicodeService"),So=hi("DecorationService"),sp=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){var _;let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let s=[],a=this._optionsService.rawOptions.linkHandler,o=new Tn,c=n.getTrimmedLength(),f=-1,d=-1,h=!1;for(let v=0;v<c;v++)if(!(d===-1&&!n.hasContent(v))){if(n.loadCell(v,o),o.hasExtendedAttrs()&&o.extended.urlId)if(d===-1){d=v,f=o.extended.urlId;continue}else h=o.extended.urlId!==f;else d!==-1&&(h=!0);if(h||d!==-1&&v===c-1){let b=(_=this._oscLinkService.getLinkData(f))==null?void 0:_.uri;if(b){let y={start:{x:d+1,y:e},end:{x:v+(!h&&v===c-1?1:0),y:e}},S=!1;if(!(a!=null&&a.allowNonHttpProtocols))try{let A=new URL(b);["http:","https:"].includes(A.protocol)||(S=!0)}catch{S=!0}S||s.push({text:b,range:y,activate:(A,R)=>a?a.activate(A,R,y):zR(A,R),hover:(A,R)=>{var D;return(D=a==null?void 0:a.hover)==null?void 0:D.call(a,A,R,y)},leave:(A,R)=>{var D;return(D=a==null?void 0:a.leave)==null?void 0:D.call(a,A,R,y)}})}h=!1,o.hasExtendedAttrs()&&o.extended.urlId?(d=v,f=o.extended.urlId):(d=-1,f=-1)}}t(s)}};sp=It([be(0,Li),be(1,Oi),be(2,RS)],sp);function zR(e,t){if(confirm(`Do you want to navigate to ${t}?

WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var Mu=hi("CharSizeService"),wr=hi("CoreBrowserService"),fm=hi("MouseService"),Cr=hi("RenderService"),LR=hi("SelectionService"),MS=hi("CharacterJoinerService"),Il=hi("ThemeService"),zS=hi("LinkProviderService"),OR=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Ib.isErrorNoTelemetry(e)?new Ib(e.message+`

`+e.stack):new Error(e.message+`

`+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)}},BR=new OR;function au(e){jR(e)||BR.onUnexpectedError(e)}var lp="Canceled";function jR(e){return e instanceof HR?!0:e instanceof Error&&e.name===lp&&e.message===lp}var HR=class extends Error{constructor(){super(lp),this.name=this.message}};function IR(e){return new Error(`Illegal argument: ${e}`)}var Ib=class ap extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof ap)return t;let n=new ap;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},op=class LS extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,LS.prototype)}};function nn(e,t=0){return e[e.length-(1+t)]}var PR;(e=>{function t(o){return o<0}e.isLessThan=t;function n(o){return o<=0}e.isLessThanOrEqual=n;function s(o){return o>0}e.isGreaterThan=s;function a(o){return o===0}e.isNeitherLessOrGreaterThan=a,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(PR||(PR={}));function UR(e,t){let n=this,s=!1,a;return function(){return s||(s=!0,t||(a=e.apply(n,arguments))),a}}var OS;(e=>{function t(I){return I&&typeof I=="object"&&typeof I[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function s(){return n}e.empty=s;function*a(I){yield I}e.single=a;function o(I){return t(I)?I:a(I)}e.wrap=o;function c(I){return I||n}e.from=c;function*f(I){for(let J=I.length-1;J>=0;J--)yield I[J]}e.reverse=f;function d(I){return!I||I[Symbol.iterator]().next().done===!0}e.isEmpty=d;function h(I){return I[Symbol.iterator]().next().value}e.first=h;function _(I,J){let L=0;for(let te of I)if(J(te,L++))return!0;return!1}e.some=_;function v(I,J){for(let L of I)if(J(L))return L}e.find=v;function*b(I,J){for(let L of I)J(L)&&(yield L)}e.filter=b;function*y(I,J){let L=0;for(let te of I)yield J(te,L++)}e.map=y;function*S(I,J){let L=0;for(let te of I)yield*J(te,L++)}e.flatMap=S;function*A(...I){for(let J of I)yield*J}e.concat=A;function R(I,J,L){let te=L;for(let X of I)te=J(te,X);return te}e.reduce=R;function*D(I,J,L=I.length){for(J<0&&(J+=I.length),L<0?L+=I.length:L>I.length&&(L=I.length);J<L;J++)yield I[J]}e.slice=D;function W(I,J=Number.POSITIVE_INFINITY){let L=[];if(J===0)return[L,I];let te=I[Symbol.iterator]();for(let X=0;X<J;X++){let pe=te.next();if(pe.done)return[L,e.empty()];L.push(pe.value)}return[L,{[Symbol.iterator](){return te}}]}e.consume=W;async function j(I){let J=[];for await(let L of I)J.push(L);return Promise.resolve(J)}e.asyncToArray=j})(OS||(OS={}));function Os(e){if(OS.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(s){t.push(s)}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 FR(...e){return Dt(()=>Os(e))}function Dt(e){return{dispose:UR(()=>{e()})}}var BS=class jS{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{Os(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?jS.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)}};BS.DISABLE_DISPOSED_WARNING=!1;var ss=BS,Ye=class{constructor(){this._store=new ss,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)}};Ye.None=Object.freeze({dispose(){}});var Ol=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},xr=typeof window=="object"?window:globalThis,cp=class up{constructor(t){this.element=t,this.next=up.Undefined,this.prev=up.Undefined}};cp.Undefined=new cp(void 0);var zt=cp,Pb=class{constructor(){this._first=zt.Undefined,this._last=zt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===zt.Undefined}clear(){let e=this._first;for(;e!==zt.Undefined;){let t=e.next;e.prev=zt.Undefined,e.next=zt.Undefined,e=t}this._first=zt.Undefined,this._last=zt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new zt(e);if(this._first===zt.Undefined)this._first=n,this._last=n;else if(t){let a=this._last;this._last=n,n.prev=a,a.next=n}else{let a=this._first;this._first=n,n.next=a,a.prev=n}this._size+=1;let s=!1;return()=>{s||(s=!0,this._remove(n))}}shift(){if(this._first!==zt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==zt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==zt.Undefined&&e.next!==zt.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===zt.Undefined&&e.next===zt.Undefined?(this._first=zt.Undefined,this._last=zt.Undefined):e.next===zt.Undefined?(this._last=this._last.prev,this._last.next=zt.Undefined):e.prev===zt.Undefined&&(this._first=this._first.next,this._first.prev=zt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==zt.Undefined;)yield e.element,e=e.next}},WR=globalThis.performance&&typeof globalThis.performance.now=="function",qR=class HS{static create(t){return new HS(t)}constructor(t){this._now=WR&&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}},xi;(e=>{e.None=()=>Ye.None;function t(V,z){return v(V,()=>{},0,void 0,!0,void 0,z)}e.defer=t;function n(V){return(z,P=null,$)=>{let C=!1,B;return B=V(U=>{if(!C)return B?B.dispose():C=!0,z.call(P,U)},null,$),C&&B.dispose(),B}}e.once=n;function s(V,z,P){return h(($,C=null,B)=>V(U=>$.call(C,z(U)),null,B),P)}e.map=s;function a(V,z,P){return h(($,C=null,B)=>V(U=>{z(U),$.call(C,U)},null,B),P)}e.forEach=a;function o(V,z,P){return h(($,C=null,B)=>V(U=>z(U)&&$.call(C,U),null,B),P)}e.filter=o;function c(V){return V}e.signal=c;function f(...V){return(z,P=null,$)=>{let C=FR(...V.map(B=>B(U=>z.call(P,U))));return _(C,$)}}e.any=f;function d(V,z,P,$){let C=P;return s(V,B=>(C=z(C,B),C),$)}e.reduce=d;function h(V,z){let P,$={onWillAddFirstListener(){P=V(C.fire,C)},onDidRemoveLastListener(){P==null||P.dispose()}},C=new _e($);return z==null||z.add(C),C.event}function _(V,z){return z instanceof Array?z.push(V):z&&z.add(V),V}function v(V,z,P=100,$=!1,C=!1,B,U){let ce,w,T,q=0,k,ie={leakWarningThreshold:B,onWillAddFirstListener(){ce=V(le=>{q++,w=z(w,le),$&&!T&&(ue.fire(w),w=void 0),k=()=>{let ve=w;w=void 0,T=void 0,(!$||q>1)&&ue.fire(ve),q=0},typeof P=="number"?(clearTimeout(T),T=setTimeout(k,P)):T===void 0&&(T=0,queueMicrotask(k))})},onWillRemoveListener(){C&&q>0&&(k==null||k())},onDidRemoveLastListener(){k=void 0,ce.dispose()}},ue=new _e(ie);return U==null||U.add(ue),ue.event}e.debounce=v;function b(V,z=0,P){return e.debounce(V,($,C)=>$?($.push(C),$):[C],z,void 0,!0,void 0,P)}e.accumulate=b;function y(V,z=($,C)=>$===C,P){let $=!0,C;return o(V,B=>{let U=$||!z(B,C);return $=!1,C=B,U},P)}e.latch=y;function S(V,z,P){return[e.filter(V,z,P),e.filter(V,$=>!z($),P)]}e.split=S;function A(V,z=!1,P=[],$){let C=P.slice(),B=V(w=>{C?C.push(w):ce.fire(w)});$&&$.add(B);let U=()=>{C==null||C.forEach(w=>ce.fire(w)),C=null},ce=new _e({onWillAddFirstListener(){B||(B=V(w=>ce.fire(w)),$&&$.add(B))},onDidAddFirstListener(){C&&(z?setTimeout(U):U())},onDidRemoveLastListener(){B&&B.dispose(),B=null}});return $&&$.add(ce),ce.event}e.buffer=A;function R(V,z){return(P,$,C)=>{let B=z(new W);return V(function(U){let ce=B.evaluate(U);ce!==D&&P.call($,ce)},void 0,C)}}e.chain=R;let D=Symbol("HaltChainable");class W{constructor(){this.steps=[]}map(z){return this.steps.push(z),this}forEach(z){return this.steps.push(P=>(z(P),P)),this}filter(z){return this.steps.push(P=>z(P)?P:D),this}reduce(z,P){let $=P;return this.steps.push(C=>($=z($,C),$)),this}latch(z=(P,$)=>P===$){let P=!0,$;return this.steps.push(C=>{let B=P||!z(C,$);return P=!1,$=C,B?C:D}),this}evaluate(z){for(let P of this.steps)if(z=P(z),z===D)break;return z}}function j(V,z,P=$=>$){let $=(...ce)=>U.fire(P(...ce)),C=()=>V.on(z,$),B=()=>V.removeListener(z,$),U=new _e({onWillAddFirstListener:C,onDidRemoveLastListener:B});return U.event}e.fromNodeEventEmitter=j;function I(V,z,P=$=>$){let $=(...ce)=>U.fire(P(...ce)),C=()=>V.addEventListener(z,$),B=()=>V.removeEventListener(z,$),U=new _e({onWillAddFirstListener:C,onDidRemoveLastListener:B});return U.event}e.fromDOMEventEmitter=I;function J(V){return new Promise(z=>n(V)(z))}e.toPromise=J;function L(V){let z=new _e;return V.then(P=>{z.fire(P)},()=>{z.fire(void 0)}).finally(()=>{z.dispose()}),z.event}e.fromPromise=L;function te(V,z){return V(P=>z.fire(P))}e.forward=te;function X(V,z,P){return z(P),V($=>z($))}e.runAndSubscribe=X;class pe{constructor(z,P){this._observable=z,this._counter=0,this._hasChanged=!1;let $={onWillAddFirstListener:()=>{z.addObserver(this)},onDidRemoveLastListener:()=>{z.removeObserver(this)}};this.emitter=new _e($),P&&P.add(this.emitter)}beginUpdate(z){this._counter++}handlePossibleChange(z){}handleChange(z,P){this._hasChanged=!0}endUpdate(z){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function G(V,z){return new pe(V,z).emitter.event}e.fromObservable=G;function K(V){return(z,P,$)=>{let C=0,B=!1,U={beginUpdate(){C++},endUpdate(){C--,C===0&&(V.reportChanges(),B&&(B=!1,z.call(P)))},handlePossibleChange(){},handleChange(){B=!0}};V.addObserver(U),V.reportChanges();let ce={dispose(){V.removeObserver(U)}};return $ instanceof ss?$.add(ce):Array.isArray($)&&$.push(ce),ce}}e.fromObservableLight=K})(xi||(xi={}));var hp=class fp{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${fp._idPool++}`,fp.all.add(this)}start(t){this._stopWatch=new qR,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}}};hp.all=new Set,hp._idPool=0;var $R=hp,YR=-1,IS=class PS{constructor(t,n,s=(PS._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=s,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,n){let s=this.threshold;if(s<=0||n<s)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=s*.5;let[o,c]=this.getMostFrequentStack(),f=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${c}):`;console.warn(f),console.warn(o);let d=new KR(f,o);this._errorHandler(d)}return()=>{let o=this._stacks.get(t.value)||0;this._stacks.set(t.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[s,a]of this._stacks)(!t||n<a)&&(t=[s,a],n=a);return t}};IS._idPool=1;var VR=IS,GR=class US{constructor(t){this.value=t}static create(){let t=new Error;return new US(t.stack??"")}print(){console.warn(this.value.split(`
`).slice(2).join(`
`))}},KR=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},XR=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},ZR=0,kd=class{constructor(e){this.value=e,this.id=ZR++}},QR=2,JR,_e=class{constructor(e){var t,n,s,a;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new VR((e==null?void 0:e.onListenerError)??au,((n=this._options)==null?void 0:n.leakWarningThreshold)??YR):void 0,this._perfMon=(s=this._options)!=null&&s._profName?new $R(this._options._profName):void 0,this._deliveryQueue=(a=this._options)==null?void 0:a.deliveryQueue}dispose(){var e,t,n,s;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(n=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||n.call(t),(s=this._leakageMon)==null||s.dispose())}get event(){return this._event??(this._event=(e,t,n)=>{var c,f,d,h,_;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let v=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(v);let b=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],y=new XR(`${v}. HINT: Stack shows most frequent listener (${b[1]}-times)`,b[0]);return(((c=this._options)==null?void 0:c.onListenerError)||au)(y),Ye.None}if(this._disposed)return Ye.None;t&&(e=e.bind(t));let s=new kd(e),a;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=GR.create(),a=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof kd?(this._deliveryQueue??(this._deliveryQueue=new eM),this._listeners=[this._listeners,s]):this._listeners.push(s):((d=(f=this._options)==null?void 0:f.onWillAddFirstListener)==null||d.call(f,this),this._listeners=s,(_=(h=this._options)==null?void 0:h.onDidAddFirstListener)==null||_.call(h,this)),this._size++;let o=Dt(()=>{a==null||a(),this._removeListener(s)});return n instanceof ss?n.add(o):Array.isArray(n)&&n.push(o),o}),this._event}_removeListener(e){var a,o,c,f;if((o=(a=this._options)==null?void 0:a.onWillRemoveListener)==null||o.call(a,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(f=(c=this._options)==null?void 0:c.onDidRemoveLastListener)==null||f.call(c,this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[n]=void 0;let s=this._deliveryQueue.current===this;if(this._size*QR<=t.length){let d=0;for(let h=0;h<t.length;h++)t[h]?t[d++]=t[h]:s&&(this._deliveryQueue.end--,d<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=d}}_deliver(e,t){var s;if(!e)return;let n=((s=this._options)==null?void 0:s.onListenerError)||au;if(!n){e.value(t);return}try{e.value(t)}catch(a){n(a)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,n,s,a;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(n=this._perfMon)==null||n.stop()),(s=this._perfMon)==null||s.start(this._size),this._listeners)if(this._listeners instanceof kd)this._deliver(this._listeners,e);else{let o=this._deliveryQueue;o.enqueue(this,e,this._listeners.length),this._deliverQueue(o)}(a=this._perfMon)==null||a.stop()}hasListeners(){return this._size>0}},eM=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},dp=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new _e,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new _e,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let s=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(s,t),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let s=this.getWindowId(n);this.mapWindowIdToFullScreen.set(s,t),this._onDidChangeFullscreen.fire(s)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};dp.INSTANCE=new dp;var dm=dp;function tM(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}dm.INSTANCE.onDidChangeZoomLevel;function iM(e){return dm.INSTANCE.getZoomFactor(e)}dm.INSTANCE.onDidChangeFullscreen;var Pl=typeof navigator=="object"?navigator.userAgent:"",pp=Pl.indexOf("Firefox")>=0,nM=Pl.indexOf("AppleWebKit")>=0,pm=Pl.indexOf("Chrome")>=0,rM=!pm&&Pl.indexOf("Safari")>=0;Pl.indexOf("Electron/")>=0;Pl.indexOf("Android")>=0;var Ed=!1;if(typeof xr.matchMedia=="function"){let e=xr.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=xr.matchMedia("(display-mode: fullscreen)");Ed=e.matches,tM(xr,e,({matches:n})=>{Ed&&t.matches||(Ed=n)})}var Nl="en",mp=!1,gp=!1,ou=!1,FS=!1,Zc,cu=Nl,Ub=Nl,sM,Ln,zs=globalThis,yi,Fy;typeof zs.vscode<"u"&&typeof zs.vscode.process<"u"?yi=zs.vscode.process:typeof process<"u"&&typeof((Fy=process==null?void 0:process.versions)==null?void 0:Fy.node)=="string"&&(yi=process);var Wy,lM=typeof((Wy=yi==null?void 0:yi.versions)==null?void 0:Wy.electron)=="string",aM=lM&&(yi==null?void 0:yi.type)==="renderer",qy;if(typeof yi=="object"){mp=yi.platform==="win32",gp=yi.platform==="darwin",ou=yi.platform==="linux",ou&&yi.env.SNAP&&yi.env.SNAP_REVISION,yi.env.CI||yi.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Zc=Nl,cu=Nl;let e=yi.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Zc=t.userLocale,Ub=t.osLocale,cu=t.resolvedLanguage||Nl,sM=(qy=t.languagePack)==null?void 0:qy.translationsConfigFile}catch{}FS=!0}else typeof navigator=="object"&&!aM?(Ln=navigator.userAgent,mp=Ln.indexOf("Windows")>=0,gp=Ln.indexOf("Macintosh")>=0,(Ln.indexOf("Macintosh")>=0||Ln.indexOf("iPad")>=0||Ln.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,ou=Ln.indexOf("Linux")>=0,(Ln==null?void 0:Ln.indexOf("Mobi"))>=0,cu=globalThis._VSCODE_NLS_LANGUAGE||Nl,Zc=navigator.language.toLowerCase(),Ub=Zc):console.error("Unable to resolve platform.");var WS=mp,Gn=gp,oM=ou,Fb=FS,Kn=Ln,Jr=cu,cM;(e=>{function t(){return Jr}e.value=t;function n(){return Jr.length===2?Jr==="en":Jr.length>=3?Jr[0]==="e"&&Jr[1]==="n"&&Jr[2]==="-":!1}e.isDefaultVariant=n;function s(){return Jr==="en"}e.isDefault=s})(cM||(cM={}));var uM=typeof zs.postMessage=="function"&&!zs.importScripts;(()=>{if(uM){let e=[];zs.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let s=0,a=e.length;s<a;s++){let o=e[s];if(o.id===n.data.vscodeScheduleAsyncWork){e.splice(s,1),o.callback();return}}});let t=0;return n=>{let s=++t;e.push({id:s,callback:n}),zs.postMessage({vscodeScheduleAsyncWork:s},"*")}}return e=>setTimeout(e)})();var hM=!!(Kn&&Kn.indexOf("Chrome")>=0);Kn&&Kn.indexOf("Firefox")>=0;!hM&&Kn&&Kn.indexOf("Safari")>=0;Kn&&Kn.indexOf("Edg/")>=0;Kn&&Kn.indexOf("Android")>=0;var kl=typeof navigator=="object"?navigator:{};Fb||document.queryCommandSupported&&document.queryCommandSupported("copy")||kl&&kl.clipboard&&kl.clipboard.writeText,Fb||kl&&kl.clipboard&&kl.clipboard.readText;var mm=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}},Ad=new mm,Wb=new mm,qb=new mm,fM=new Array(230),qS;(e=>{function t(f){return Ad.keyCodeToStr(f)}e.toString=t;function n(f){return Ad.strToKeyCode(f)}e.fromString=n;function s(f){return Wb.keyCodeToStr(f)}e.toUserSettingsUS=s;function a(f){return qb.keyCodeToStr(f)}e.toUserSettingsGeneral=a;function o(f){return Wb.strToKeyCode(f)||qb.strToKeyCode(f)}e.fromUserSettings=o;function c(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 Ad.keyCodeToStr(f)}e.toElectronAccelerator=c})(qS||(qS={}));var dM=class $S{constructor(t,n,s,a,o){this.ctrlKey=t,this.shiftKey=n,this.altKey=s,this.metaKey=a,this.keyCode=o}equals(t){return t instanceof $S&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",n=this.shiftKey?"1":"0",s=this.altKey?"1":"0",a=this.metaKey?"1":"0";return`K${t}${n}${s}${a}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new pM([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},pM=class{constructor(e){if(e.length===0)throw IR("chords");this.chords=e}getHashCode(){let e="";for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function mM(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return qS.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(pp)switch(t){case 59:return 85;case 60:if(oM)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Gn)return 57;break}else if(nM&&(Gn&&t===93||!Gn&&t===92))return 57;return fM[t]||0}var gM=Gn?256:2048,_M=512,vM=1024,bM=Gn?2048:256,$b=class{constructor(e){var n;this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=(n=t.getModifierState)==null?void 0:n.call(t,"AltGraph"),this.keyCode=mM(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|=gM),this.altKey&&(t|=_M),this.shiftKey&&(t|=vM),this.metaKey&&(t|=bM),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new dM(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},Yb=new WeakMap;function yM(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!=="null"&&n.origin!=="null"&&t.origin!==n.origin)return null}catch{return null}return e.parent}var xM=class{static getSameOriginWindowChain(e){let t=Yb.get(e);if(!t){t=[],Yb.set(e,t);let n=e,s;do s=yM(n),s?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=s;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,s=0,a=this.getSameOriginWindowChain(e);for(let o of a){let c=o.window.deref();if(n+=(c==null?void 0:c.scrollY)??0,s+=(c==null?void 0:c.scrollX)??0,c===t||!o.iframeElement)break;let f=o.iframeElement.getBoundingClientRect();n+=f.top,s+=f.left}return{top:n,left:s}}},Qc=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=xM.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Vb=class{constructor(e,t=0,n=0){var a;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let s=!1;if(pm){let o=navigator.userAgent.match(/Chrome\/(\d+)/);s=(o?parseInt(o[1]):123)<=122}if(e){let o=e,c=e,f=((a=e.view)==null?void 0:a.devicePixelRatio)||1;if(typeof o.wheelDeltaY<"u")s?this.deltaY=o.wheelDeltaY/(120*f):this.deltaY=o.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 d=e;d.deltaMode===d.DOM_DELTA_LINE?pp&&!Gn?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")rM&&WS?this.deltaX=-(o.wheelDeltaX/120):s?this.deltaX=o.wheelDeltaX/(120*f):this.deltaX=o.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 d=e;d.deltaMode===d.DOM_DELTA_LINE?pp&&!Gn?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(s?this.deltaY=e.wheelDelta/(120*f):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},YS=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),SM;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof wM?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:xi.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:YS})})(SM||(SM={}));var wM=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?YS:(this._emitter||(this._emitter=new _e),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},gm=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 op("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new op("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},CM=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new op("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let s=n.setInterval(()=>{e()},t);this.disposable=Dt(()=>{n.clearInterval(s),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},kM;(e=>{async function t(s){let a,o=await Promise.all(s.map(c=>c.then(f=>f,f=>{a||(a=f)})));if(typeof a<"u")throw a;return o}e.settled=t;function n(s){return new Promise(async(a,o)=>{try{await s(a,o)}catch(c){o(c)}})}e.withAsyncBody=n})(kM||(kM={}));var Gb=class kn{static fromArray(t){return new kn(n=>{n.emitMany(t)})}static fromPromise(t){return new kn(async n=>{n.emitMany(await t)})}static fromPromises(t){return new kn(async n=>{await Promise.all(t.map(async s=>n.emitOne(await s)))})}static merge(t){return new kn(async n=>{await Promise.all(t.map(async s=>{for await(let a of s)n.emitOne(a)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new _e,queueMicrotask(async()=>{let s={emitOne:a=>this.emitOne(a),emitMany:a=>this.emitMany(a),reject:a=>this.reject(a)};try{await Promise.resolve(t(s)),this.resolve()}catch(a){this.reject(a)}finally{s.emitOne=void 0,s.emitMany=void 0,s.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 xi.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var n;return(n=this._onReturn)==null||n.call(this),{done:!0,value:void 0}}}}static map(t,n){return new kn(async s=>{for await(let a of t)s.emitOne(n(a))})}map(t){return kn.map(this,t)}static filter(t,n){return new kn(async s=>{for await(let a of t)n(a)&&s.emitOne(a)})}filter(t){return kn.filter(this,t)}static coalesce(t){return kn.filter(t,n=>!!n)}coalesce(){return kn.coalesce(this)}static async toPromise(t){let n=[];for await(let s of t)n.push(s);return n}toPromise(){return kn.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())}};Gb.EMPTY=Gb.fromArray([]);var{getWindow:Vn,getWindowId:EM,onDidRegisterWindow:AM}=(function(){let e=new Map,t={window:xr,disposables:new ss};e.set(xr.vscodeWindowId,t);let n=new _e,s=new _e,a=new _e;function o(c,f){return(typeof c=="number"?e.get(c):void 0)??(f?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:a.event,onDidUnregisterWindow:s.event,registerWindow(c){if(e.has(c.vscodeWindowId))return Ye.None;let f=new ss,d={window:c,disposables:f.add(new ss)};return e.set(c.vscodeWindowId,d),f.add(Dt(()=>{e.delete(c.vscodeWindowId),s.fire(c)})),f.add(Be(c,li.BEFORE_UNLOAD,()=>{a.fire(c)})),n.fire(d),f},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(c){return c.vscodeWindowId},hasWindow(c){return e.has(c)},getWindowById:o,getWindow(c){var h;let f=c;if((h=f==null?void 0:f.ownerDocument)!=null&&h.defaultView)return f.ownerDocument.defaultView.window;let d=c;return d!=null&&d.view?d.view.window:xr},getDocument(c){return Vn(c).document}}})(),TM=class{constructor(e,t,n,s){this._node=e,this._type=t,this._handler=n,this._options=s||!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 Be(e,t,n,s){return new TM(e,t,n,s)}var Kb=function(e,t,n,s){return Be(e,t,n,s)},_m,NM=class extends CM{constructor(e){super(),this.defaultTarget=e&&Vn(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},Xb=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){au(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,s=new Map,a=o=>{n.set(o,!1);let c=e.get(o)??[];for(t.set(o,c),e.set(o,[]),s.set(o,!0);c.length>0;)c.sort(Xb.sort),c.shift().execute();s.set(o,!1)};_m=(o,c,f=0)=>{let d=EM(o),h=new Xb(c,f),_=e.get(d);return _||(_=[],e.set(d,_)),_.push(h),n.get(d)||(n.set(d,!0),o.requestAnimationFrame(()=>a(d))),h}})();function DM(e){let t=e.getBoundingClientRect(),n=Vn(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var li={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"},RM=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=qi(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=qi(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=qi(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=qi(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=qi(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=qi(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=qi(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=qi(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=qi(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=qi(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=qi(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=qi(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=qi(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=qi(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 qi(e){return typeof e=="number"?`${e}px`:e}function uo(e){return new RM(e)}var VS=class{constructor(){this._hooks=new ss,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,s,a){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=s,this._onStopCallback=a;let o=e;try{e.setPointerCapture(t),this._hooks.add(Dt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{o=Vn(e)}this._hooks.add(Be(o,li.POINTER_MOVE,c=>{if(c.buttons!==n){this.stopMonitoring(!0);return}c.preventDefault(),this._pointerMoveCallback(c)})),this._hooks.add(Be(o,li.POINTER_UP,c=>this.stopMonitoring(!0)))}};function MM(e,t,n){let s=null,a=null;if(typeof n.value=="function"?(s="value",a=n.value,a.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(s="get",a=n.get),!a)throw new Error("not supported");let o=`$memoize$${t}`;n[s]=function(...c){return this.hasOwnProperty(o)||Object.defineProperty(this,o,{configurable:!1,enumerable:!1,writable:!1,value:a.apply(this,c)}),this[o]}}var $n;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))($n||($n={}));var io=class wi extends Ye{constructor(){super(),this.dispatched=!1,this.targets=new Pb,this.ignoreTargets=new Pb,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(xi.runAndSubscribe(AM,({window:t,disposables:n})=>{n.add(Be(t.document,"touchstart",s=>this.onTouchStart(s),{passive:!1})),n.add(Be(t.document,"touchend",s=>this.onTouchEnd(t,s))),n.add(Be(t.document,"touchmove",s=>this.onTouchMove(s),{passive:!1}))},{window:xr,disposables:this._store}))}static addTarget(t){if(!wi.isTouchDevice())return Ye.None;wi.INSTANCE||(wi.INSTANCE=new wi);let n=wi.INSTANCE.targets.push(t);return Dt(n)}static ignoreTarget(t){if(!wi.isTouchDevice())return Ye.None;wi.INSTANCE||(wi.INSTANCE=new wi);let n=wi.INSTANCE.ignoreTargets.push(t);return Dt(n)}static isTouchDevice(){return"ontouchstart"in xr||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let n=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let s=0,a=t.targetTouches.length;s<a;s++){let o=t.targetTouches.item(s);this.activeTouches[o.identifier]={id:o.identifier,initialTarget:o.target,initialTimeStamp:n,initialPageX:o.pageX,initialPageY:o.pageY,rollingTimestamps:[n],rollingPageX:[o.pageX],rollingPageY:[o.pageY]};let c=this.newGestureEvent($n.Start,o.target);c.pageX=o.pageX,c.pageY=o.pageY,this.dispatchEvent(c)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,n){let s=Date.now(),a=Object.keys(this.activeTouches).length;for(let o=0,c=n.changedTouches.length;o<c;o++){let f=n.changedTouches.item(o);if(!this.activeTouches.hasOwnProperty(String(f.identifier))){console.warn("move of an UNKNOWN touch",f);continue}let d=this.activeTouches[f.identifier],h=Date.now()-d.initialTimeStamp;if(h<wi.HOLD_DELAY&&Math.abs(d.initialPageX-nn(d.rollingPageX))<30&&Math.abs(d.initialPageY-nn(d.rollingPageY))<30){let _=this.newGestureEvent($n.Tap,d.initialTarget);_.pageX=nn(d.rollingPageX),_.pageY=nn(d.rollingPageY),this.dispatchEvent(_)}else if(h>=wi.HOLD_DELAY&&Math.abs(d.initialPageX-nn(d.rollingPageX))<30&&Math.abs(d.initialPageY-nn(d.rollingPageY))<30){let _=this.newGestureEvent($n.Contextmenu,d.initialTarget);_.pageX=nn(d.rollingPageX),_.pageY=nn(d.rollingPageY),this.dispatchEvent(_)}else if(a===1){let _=nn(d.rollingPageX),v=nn(d.rollingPageY),b=nn(d.rollingTimestamps)-d.rollingTimestamps[0],y=_-d.rollingPageX[0],S=v-d.rollingPageY[0],A=[...this.targets].filter(R=>d.initialTarget instanceof Node&&R.contains(d.initialTarget));this.inertia(t,A,s,Math.abs(y)/b,y>0?1:-1,_,Math.abs(S)/b,S>0?1:-1,v)}this.dispatchEvent(this.newGestureEvent($n.End,d.initialTarget)),delete this.activeTouches[f.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,n){let s=document.createEvent("CustomEvent");return s.initEvent(t,!1,!0),s.initialTarget=n,s.tapCount=0,s}dispatchEvent(t){if(t.type===$n.Tap){let n=new Date().getTime(),s=0;n-this._lastSetTapCountTime>wi.CLEAR_TAP_COUNT_TIME?s=1:s=2,this._lastSetTapCountTime=n,t.tapCount=s}else(t.type===$n.Change||t.type===$n.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let s of this.ignoreTargets)if(s.contains(t.initialTarget))return;let n=[];for(let s of this.targets)if(s.contains(t.initialTarget)){let a=0,o=t.initialTarget;for(;o&&o!==s;)a++,o=o.parentElement;n.push([a,s])}n.sort((s,a)=>s[0]-a[0]);for(let[s,a]of n)a.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,s,a,o,c,f,d,h){this.handle=_m(t,()=>{let _=Date.now(),v=_-s,b=0,y=0,S=!0;a+=wi.SCROLL_FRICTION*v,f+=wi.SCROLL_FRICTION*v,a>0&&(S=!1,b=o*a*v),f>0&&(S=!1,y=d*f*v);let A=this.newGestureEvent($n.Change);A.translationX=b,A.translationY=y,n.forEach(R=>R.dispatchEvent(A)),S||this.inertia(t,n,_,a,o,c+b,f,d,h+y)})}onTouchMove(t){let n=Date.now();for(let s=0,a=t.changedTouches.length;s<a;s++){let o=t.changedTouches.item(s);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn("end of an UNKNOWN touch",o);continue}let c=this.activeTouches[o.identifier],f=this.newGestureEvent($n.Change,c.initialTarget);f.translationX=o.pageX-nn(c.rollingPageX),f.translationY=o.pageY-nn(c.rollingPageY),f.pageX=o.pageX,f.pageY=o.pageY,this.dispatchEvent(f),c.rollingPageX.length>3&&(c.rollingPageX.shift(),c.rollingPageY.shift(),c.rollingTimestamps.shift()),c.rollingPageX.push(o.pageX),c.rollingPageY.push(o.pageY),c.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};io.SCROLL_FRICTION=-.005,io.HOLD_DELAY=700,io.CLEAR_TAP_COUNT_TIME=400,It([MM],io,"isTouchDevice",1);var zM=io,vm=class extends Ye{onclick(e,t){this._register(Be(e,li.CLICK,n=>t(new Qc(Vn(e),n))))}onmousedown(e,t){this._register(Be(e,li.MOUSE_DOWN,n=>t(new Qc(Vn(e),n))))}onmouseover(e,t){this._register(Be(e,li.MOUSE_OVER,n=>t(new Qc(Vn(e),n))))}onmouseleave(e,t){this._register(Be(e,li.MOUSE_LEAVE,n=>t(new Qc(Vn(e),n))))}onkeydown(e,t){this._register(Be(e,li.KEY_DOWN,n=>t(new $b(n))))}onkeyup(e,t){this._register(Be(e,li.KEY_UP,n=>t(new $b(n))))}oninput(e,t){this._register(Be(e,li.INPUT,t))}onblur(e,t){this._register(Be(e,li.BLUR,t))}onfocus(e,t){this._register(Be(e,li.FOCUS,t))}onchange(e,t){this._register(Be(e,li.CHANGE,t))}ignoreGesture(e){return zM.ignoreTarget(e)}},Zb=11,LM=class extends vm{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=Zb+"px",this.domNode.style.height=Zb+"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 VS),this._register(Kb(this.bgDomNode,li.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(Kb(this.domNode,li.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new NM),this._pointerdownScheduleRepeatTimer=this._register(new gm)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Vn(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},OM=class _p{constructor(t,n,s,a,o,c,f){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,s=s|0,a=a|0,o=o|0,c=c|0,f=f|0),this.rawScrollLeft=a,this.rawScrollTop=f,n<0&&(n=0),a+n>s&&(a=s-n),a<0&&(a=0),o<0&&(o=0),f+o>c&&(f=c-o),f<0&&(f=0),this.width=n,this.scrollWidth=s,this.scrollLeft=a,this.height=o,this.scrollHeight=c,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,n){return new _p(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new _p(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,n){let s=this.width!==t.width,a=this.scrollWidth!==t.scrollWidth,o=this.scrollLeft!==t.scrollLeft,c=this.height!==t.height,f=this.scrollHeight!==t.scrollHeight,d=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:n,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:s,scrollWidthChanged:a,scrollLeftChanged:o,heightChanged:c,scrollHeightChanged:f,scrollTopChanged:d}}},BM=class extends Ye{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new _e),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new OM(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var s;let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),(s=this._smoothScrolling)==null||s.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let s;t?s=new Jb(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):s=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=s}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=Jb.start(this._state,n,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},Qb=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function Td(e,t){let n=t-e;return function(s){return e+n*IM(s)}}function jM(e,t,n){return function(s){return s<n?e(s/n):t((s-n)/(1-n))}}var Jb=class vp{constructor(t,n,s,a){this.from=t,this.to=n,this.duration=a,this.startTime=s,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,n,s){if(Math.abs(t-n)>2.5*s){let a,o;return t<n?(a=t+.75*s,o=n-.75*s):(a=t-.75*s,o=n+.75*s),jM(Td(t,a),Td(o,n),.33)}return Td(t,n)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let n=(t-this.startTime)/this.duration;if(n<1){let s=this.scrollLeft(n),a=this.scrollTop(n);return new Qb(s,a,!1)}return new Qb(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,s){return vp.start(t,n,s)}static start(t,n,s){s=s+10;let a=Date.now()-10;return new vp(t,n,a,s)}};function HM(e){return Math.pow(e,3)}function IM(e){return 1-HM(1-e)}var PM=class extends Ye{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new gm)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(t=this._domNode)==null||t.setClassName(this._invisibleClassName+(e?" fade":"")))}},UM=140,GS=class extends vm{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 PM(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new VS),this._shouldRender=!0,this.domNode=uo(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(Be(this.domNode.domNode,li.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new LM(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,s){this.slider=uo(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof n=="number"&&this.slider.setWidth(n),typeof s=="number"&&this.slider.setHeight(s),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Be(this.slider.domNode,li.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,n=t+this._scrollbarState.getSliderPosition(),s=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),a=this._sliderPointerPosition(e);n<=a&&a<=s?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,n=e.offsetY;else{let a=DM(this.domNode.domNode);t=e.pageX-a.left,n=e.pageY-a.top}let s=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(s):this._scrollbarState.getDesiredScrollPositionFromOffset(s)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),s=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,a=>{let o=this._sliderOrthogonalPointerPosition(a),c=Math.abs(o-n);if(WS&&c>UM){this._setDesiredScrollPositionNow(s.getScrollPosition());return}let f=this._sliderPointerPosition(a)-t;this._setDesiredScrollPositionNow(s.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()}},KS=class bp{constructor(t,n,s,a,o,c){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(s),this._arrowSize=Math.round(t),this._visibleSize=a,this._scrollSize=o,this._scrollPosition=c,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new bp(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let n=Math.round(t);return this._visibleSize!==n?(this._visibleSize=n,this._refreshComputedValues(),!0):!1}setScrollSize(t){let n=Math.round(t);return this._scrollSize!==n?(this._scrollSize=n,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let n=Math.round(t);return this._scrollPosition!==n?(this._scrollPosition=n,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,n,s,a,o){let c=Math.max(0,s-t),f=Math.max(0,c-2*n),d=a>0&&a>s;if(!d)return{computedAvailableSize:Math.round(c),computedIsNeeded:d,computedSliderSize:Math.round(f),computedSliderRatio:0,computedSliderPosition:0};let h=Math.round(Math.max(20,Math.floor(s*f/a))),_=(f-h)/(a-s),v=o*_;return{computedAvailableSize:Math.round(c),computedIsNeeded:d,computedSliderSize:Math.round(h),computedSliderRatio:_,computedSliderPosition:Math.round(v)}}_refreshComputedValues(){let t=bp._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize-this._computedSliderSize/2;return Math.round(n/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize,s=this._scrollPosition;return n<this._computedSliderPosition?s-=this._visibleSize:s+=this._visibleSize,s}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let n=this._computedSliderPosition+t;return Math.round(n/this._computedSliderRatio)}},FM=class extends GS{constructor(e,t,n){let s=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new KS(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,s.width,s.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}},WM=class extends GS{constructor(e,t,n){let s=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new KS(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,s.height,s.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}},qM=500,ey=50,$M=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},yp=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,n=0,s=1,a=this._rear;do{let o=a===this._front?t:Math.pow(2,-s);if(t-=o,n+=this._memory[a].score*o,a===this._front)break;a=(this._capacity+a-1)%this._capacity,s++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(pm){let n=Vn(t.browserEvent),s=iM(n);this.accept(Date.now(),t.deltaX*s,t.deltaY*s)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,n,s){let a=null,o=new $M(t,n,s);this._front===-1&&this._rear===-1?(this._memory[0]=o,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]=o),o.score=this._computeScore(o,a)}_computeScore(t,n){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let s=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(s+=.25),n){let a=Math.abs(t.deltaX),o=Math.abs(t.deltaY),c=Math.abs(n.deltaX),f=Math.abs(n.deltaY),d=Math.max(Math.min(a,c),1),h=Math.max(Math.min(o,f),1),_=Math.max(a,c),v=Math.max(o,f);_%d===0&&v%h===0&&(s-=.5)}return Math.min(Math.max(s,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};yp.INSTANCE=new yp;var YM=yp,VM=class extends vm{constructor(e,t,n){super(),this._onScroll=this._register(new _e),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new _e),this.onWillScroll=this._onWillScroll.event,this._options=KM(t),this._scrollable=n,this._register(this._scrollable.onScroll(a=>{this._onWillScroll.fire(a),this._onDidScroll(a),this._onScroll.fire(a)}));let s={onMouseWheel:a=>this._onMouseWheel(a),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new WM(this._scrollable,this._options,s)),this._horizontalScrollbar=this._register(new FM(this._scrollable,this._options,s)),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=uo(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=uo(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=uo(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 gm),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Os(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,Gn&&(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 Vb(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Os(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new Vb(n))};this._mouseWheelToDispose.push(Be(this._listenOnDomNode,li.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var a;if((a=e.browserEvent)!=null&&a.defaultPrevented)return;let t=YM.INSTANCE;t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let o=e.deltaY*this._options.mouseWheelScrollSensitivity,c=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&c+o===0?c=o=0:Math.abs(o)>=Math.abs(c)?c=0:o=0),this._options.flipAxes&&([o,c]=[c,o]);let f=!Gn&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||f)&&!c&&(c=o,o=0),e.browserEvent&&e.browserEvent.altKey&&(c=c*this._options.fastScrollSensitivity,o=o*this._options.fastScrollSensitivity);let d=this._scrollable.getFutureScrollPosition(),h={};if(o){let _=ey*o,v=d.scrollTop-(_<0?Math.floor(_):Math.ceil(_));this._verticalScrollbar.writeScrollPosition(h,v)}if(c){let _=ey*c,v=d.scrollLeft-(_<0?Math.floor(_):Math.ceil(_));this._horizontalScrollbar.writeScrollPosition(h,v)}h=this._scrollable.validateScrollPosition(h),(d.scrollLeft!==h.scrollLeft||d.scrollTop!==h.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(h):this._scrollable.setScrollPositionNow(h),n=!0)}let s=n;!s&&this._options.alwaysConsumeMouseWheel&&(s=!0),!s&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(s=!0),s&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,s=n?" left":"",a=t?" top":"",o=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${s}`),this._topShadowDomNode.setClassName(`shadow${a}`),this._topLeftShadowDomNode.setClassName(`shadow${o}${a}${s}`)}}_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(),qM)}},GM=class extends VM{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function KM(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,Gn&&(t.className+=" mac"),t}var xp=class extends Ye{constructor(e,t,n,s,a,o,c,f){super(),this._bufferService=n,this._optionsService=c,this._renderService=f,this._onRequestScrollLines=this._register(new _e),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let d=this._register(new BM({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:h=>_m(s.window,h)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{d.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new GM(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},d)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(a.onProtocolChange(h=>{this._scrollableElement.updateOptions({handleMouseWheel:!(h&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(xi.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Dt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=s.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Dt(()=>this._styleElement.remove())),this._register(xi.runAndSubscribe(o.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",`  background: ${o.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",`  background: ${o.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",`  background: ${o.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
`)})),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(h=>this._handleScroll(h)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};xp=It([be(2,Li),be(3,wr),be(4,NS),be(5,Il),be(6,Oi),be(7,Cr)],xp);var Sp=class extends Ye{constructor(e,t,n,s,a){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=s,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(o=>this._removeDecoration(o))),this._register(Dt(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var s;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((s=e==null?void 0:e.options)==null?void 0:s.layer)==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};Sp=It([be(1,Li),be(2,wr),be(3,So),be(4,Cr)],Sp);var XM=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||"full"]&&t<=e.endBufferLine+this._linePadding[n||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Fn={full:0,left:0,center:0,right:0},es={full:0,left:0,center:0,right:0},Xa={full:0,left:0,center:0,right:0},yu=class extends Ye{constructor(e,t,n,s,a,o,c,f){var h;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=s,this._renderService=a,this._optionsService=o,this._themeService=c,this._coreBrowserService=f,this._colorZoneStore=new XM,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(),(h=this._viewportElement.parentElement)==null||h.insertBefore(this._canvas,this._viewportElement),this._register(Dt(()=>{var _;return(_=this._canvas)==null?void 0:_.remove()}));let d=this._canvas.getContext("2d");if(d)this._ctx=d;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);es.full=this._canvas.width,es.left=e,es.center=t,es.right=e,this._refreshDrawHeightConstants(),Xa.full=1,Xa.left=1,Xa.center=1+es.left,Xa.right=1+es.left+es.center}_refreshDrawHeightConstants(){Fn.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);Fn.left=t,Fn.center=t,Fn.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Fn.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Fn.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Fn.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Fn.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(Xa[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Fn[e.position||"full"]/2),es[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Fn[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}))}};yu=It([be(2,Li),be(3,So),be(4,Cr),be(5,Oi),be(6,Il),be(7,wr)],yu);var de;(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=`
`,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=""))(de||(de={}));var uu;(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=""))(uu||(uu={}));var XS;(e=>e.ST=`${de.ESC}\\`)(XS||(XS={}));var wp=class{constructor(e,t,n,s,a,o){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=s,this._coreService=a,this._renderService=o,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let n;t.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(t.start,this._compositionPosition.start):n=this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,"");this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${de.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,s=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=s+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let o=this._compositionView.getBoundingClientRect();this._textarea.style.left=a+"px",this._textarea.style.top=s+"px",this._textarea.style.width=Math.max(o.width,1)+"px",this._textarea.style.height=Math.max(o.height,1)+"px",this._textarea.style.lineHeight=o.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};wp=It([be(2,Li),be(3,Oi),be(4,Is),be(5,Cr)],wp);var ai=0,oi=0,ci=0,Ht=0,ty={css:"#00000000",rgba:0},Qt;(e=>{function t(a,o,c,f){return f!==void 0?`#${Ts(a)}${Ts(o)}${Ts(c)}${Ts(f)}`:`#${Ts(a)}${Ts(o)}${Ts(c)}`}e.toCss=t;function n(a,o,c,f=255){return(a<<24|o<<16|c<<8|f)>>>0}e.toRgba=n;function s(a,o,c,f){return{css:e.toCss(a,o,c,f),rgba:e.toRgba(a,o,c,f)}}e.toColor=s})(Qt||(Qt={}));var kt;(e=>{function t(d,h){if(Ht=(h.rgba&255)/255,Ht===1)return{css:h.css,rgba:h.rgba};let _=h.rgba>>24&255,v=h.rgba>>16&255,b=h.rgba>>8&255,y=d.rgba>>24&255,S=d.rgba>>16&255,A=d.rgba>>8&255;ai=y+Math.round((_-y)*Ht),oi=S+Math.round((v-S)*Ht),ci=A+Math.round((b-A)*Ht);let R=Qt.toCss(ai,oi,ci),D=Qt.toRgba(ai,oi,ci);return{css:R,rgba:D}}e.blend=t;function n(d){return(d.rgba&255)===255}e.isOpaque=n;function s(d,h,_){let v=hu.ensureContrastRatio(d.rgba,h.rgba,_);if(v)return Qt.toColor(v>>24&255,v>>16&255,v>>8&255)}e.ensureContrastRatio=s;function a(d){let h=(d.rgba|255)>>>0;return[ai,oi,ci]=hu.toChannels(h),{css:Qt.toCss(ai,oi,ci),rgba:h}}e.opaque=a;function o(d,h){return Ht=Math.round(h*255),[ai,oi,ci]=hu.toChannels(d.rgba),{css:Qt.toCss(ai,oi,ci,Ht),rgba:Qt.toRgba(ai,oi,ci,Ht)}}e.opacity=o;function c(d,h){return Ht=d.rgba&255,o(d,Ht*h/255)}e.multiplyOpacity=c;function f(d){return[d.rgba>>24&255,d.rgba>>16&255,d.rgba>>8&255]}e.toColorRGB=f})(kt||(kt={}));var Lt;(e=>{let t,n;try{let a=document.createElement("canvas");a.width=1,a.height=1;let o=a.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function s(a){if(a.match(/#[\da-f]{3,8}/i))switch(a.length){case 4:return ai=parseInt(a.slice(1,2).repeat(2),16),oi=parseInt(a.slice(2,3).repeat(2),16),ci=parseInt(a.slice(3,4).repeat(2),16),Qt.toColor(ai,oi,ci);case 5:return ai=parseInt(a.slice(1,2).repeat(2),16),oi=parseInt(a.slice(2,3).repeat(2),16),ci=parseInt(a.slice(3,4).repeat(2),16),Ht=parseInt(a.slice(4,5).repeat(2),16),Qt.toColor(ai,oi,ci,Ht);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 o=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(o)return ai=parseInt(o[1]),oi=parseInt(o[2]),ci=parseInt(o[3]),Ht=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),Qt.toColor(ai,oi,ci,Ht);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=a,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[ai,oi,ci,Ht]=t.getImageData(0,0,1,1).data,Ht!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Qt.toRgba(ai,oi,ci,Ht),css:a}}e.toColor=s})(Lt||(Lt={}));var Ni;(e=>{function t(s){return n(s>>16&255,s>>8&255,s&255)}e.relativeLuminance=t;function n(s,a,o){let c=s/255,f=a/255,d=o/255,h=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),_=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4),v=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4);return h*.2126+_*.7152+v*.0722}e.relativeLuminance2=n})(Ni||(Ni={}));var hu;(e=>{function t(c,f){if(Ht=(f&255)/255,Ht===1)return f;let d=f>>24&255,h=f>>16&255,_=f>>8&255,v=c>>24&255,b=c>>16&255,y=c>>8&255;return ai=v+Math.round((d-v)*Ht),oi=b+Math.round((h-b)*Ht),ci=y+Math.round((_-y)*Ht),Qt.toRgba(ai,oi,ci)}e.blend=t;function n(c,f,d){let h=Ni.relativeLuminance(c>>8),_=Ni.relativeLuminance(f>>8);if(yr(h,_)<d){if(_<h){let y=s(c,f,d),S=yr(h,Ni.relativeLuminance(y>>8));if(S<d){let A=a(c,f,d),R=yr(h,Ni.relativeLuminance(A>>8));return S>R?y:A}return y}let v=a(c,f,d),b=yr(h,Ni.relativeLuminance(v>>8));if(b<d){let y=s(c,f,d),S=yr(h,Ni.relativeLuminance(y>>8));return b>S?v:y}return v}}e.ensureContrastRatio=n;function s(c,f,d){let h=c>>24&255,_=c>>16&255,v=c>>8&255,b=f>>24&255,y=f>>16&255,S=f>>8&255,A=yr(Ni.relativeLuminance2(b,y,S),Ni.relativeLuminance2(h,_,v));for(;A<d&&(b>0||y>0||S>0);)b-=Math.max(0,Math.ceil(b*.1)),y-=Math.max(0,Math.ceil(y*.1)),S-=Math.max(0,Math.ceil(S*.1)),A=yr(Ni.relativeLuminance2(b,y,S),Ni.relativeLuminance2(h,_,v));return(b<<24|y<<16|S<<8|255)>>>0}e.reduceLuminance=s;function a(c,f,d){let h=c>>24&255,_=c>>16&255,v=c>>8&255,b=f>>24&255,y=f>>16&255,S=f>>8&255,A=yr(Ni.relativeLuminance2(b,y,S),Ni.relativeLuminance2(h,_,v));for(;A<d&&(b<255||y<255||S<255);)b=Math.min(255,b+Math.ceil((255-b)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),S=Math.min(255,S+Math.ceil((255-S)*.1)),A=yr(Ni.relativeLuminance2(b,y,S),Ni.relativeLuminance2(h,_,v));return(b<<24|y<<16|S<<8|255)>>>0}e.increaseLuminance=a;function o(c){return[c>>24&255,c>>16&255,c>>8&255,c&255]}e.toChannels=o})(hu||(hu={}));function Ts(e){let t=e.toString(16);return t.length<2?"0"+t:t}function yr(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var ZM=class extends xo{constructor(e,t,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},xu=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Tn}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],s=t.translateToString(!0),a=0,o=0,c=0,f=t.getFg(0),d=t.getBg(0);for(let h=0;h<t.getTrimmedLength();h++)if(t.loadCell(h,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==f||this._workCell.bg!==d){if(h-a>1){let _=this._getJoinedRanges(s,c,o,t,a);for(let v=0;v<_.length;v++)n.push(_[v])}a=h,c=o,f=this._workCell.fg,d=this._workCell.bg}o+=this._workCell.getChars().length||rs.length}if(this._bufferService.cols-a>1){let h=this._getJoinedRanges(s,c,o,t,a);for(let _=0;_<h.length;_++)n.push(h[_])}return n}_getJoinedRanges(e,t,n,s,a){let o=e.substring(t,n),c=[];try{c=this._characterJoiners[0].handler(o)}catch(f){console.error(f)}for(let f=1;f<this._characterJoiners.length;f++)try{let d=this._characterJoiners[f].handler(o);for(let h=0;h<d.length;h++)xu._mergeRanges(c,d[h])}catch(d){console.error(d)}return this._stringRangesToCellRanges(c,s,a),c}_stringRangesToCellRanges(e,t,n){let s=0,a=!1,o=0,c=e[s];if(c){for(let f=n;f<this._bufferService.cols;f++){let d=t.getWidth(f),h=t.getString(f).length||rs.length;if(d!==0){if(!a&&c[0]<=o&&(c[0]=f,a=!0),c[1]<=o){if(c[1]=f,c=e[++s],!c)break;c[0]<=o?(c[0]=f,a=!0):a=!1}o+=h}}c&&(c[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let s=0;s<e.length;s++){let a=e[s];if(n){if(t[1]<=a[0])return e[s-1][1]=t[1],e;if(t[1]<=a[1])return e[s-1][1]=Math.max(t[1],a[1]),e.splice(s,1),e;e.splice(s,1),s--}else{if(t[1]<=a[0])return e.splice(s,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]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};xu=It([be(0,Li)],xu);function QM(e){return 57508<=e&&e<=57558}function JM(e){return 9472<=e&&e<=9631}function e3(e){return QM(e)||JM(e)}function t3(){return{css:{canvas:Jc(),cell:Jc()},device:{canvas:Jc(),cell:Jc(),char:{width:0,height:0,left:0,top:0}}}}function Jc(){return{width:0,height:0}}var Cp=class{constructor(e,t,n,s,a,o,c){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=s,this._coreService=a,this._decorationService=o,this._themeService=c,this._workCell=new Tn,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,s,a,o,c,f,d,h,_){let v=[],b=this._characterJoinerService.getJoinedCharacters(t),y=this._themeService.colors,S=e.getNoBgTrimmedLength();n&&S<o+1&&(S=o+1);let A,R=0,D="",W=0,j=0,I=0,J=0,L=!1,te=0,X=!1,pe=0,G=0,K=[],V=h!==-1&&_!==-1;for(let z=0;z<S;z++){e.loadCell(z,this._workCell);let P=this._workCell.getWidth();if(P===0)continue;let $=!1,C=z>=G,B=z,U=this._workCell;if(b.length>0&&z===b[0][0]&&C){let se=b.shift(),Oe=this._isCellInSelection(se[0],t);for(W=se[0]+1;W<se[1];W++)C&&(C=Oe===this._isCellInSelection(W,t));C&&(C=!n||o<se[0]||o>=se[1]),C?($=!0,U=new ZM(this._workCell,e.translateToString(!0,se[0],se[1]),se[1]-se[0]),B=se[1]-1,P=U.getWidth()):G=se[1]}let ce=this._isCellInSelection(z,t),w=n&&z===o,T=V&&z>=h&&z<=_,q=!1;this._decorationService.forEachDecorationAtCell(z,t,void 0,se=>{q=!0});let k=U.getChars()||rs;if(k===" "&&(U.isUnderline()||U.isOverline())&&(k=" "),pe=P*f-d.get(k,U.isBold(),U.isItalic()),!A)A=this._document.createElement("span");else if(R&&(ce&&X||!ce&&!X&&U.bg===j)&&(ce&&X&&y.selectionForeground||U.fg===I)&&U.extended.ext===J&&T===L&&pe===te&&!w&&!$&&!q&&C){U.isInvisible()?D+=rs:D+=k,R++;continue}else R&&(A.textContent=D),A=this._document.createElement("span"),R=0,D="";if(j=U.bg,I=U.fg,J=U.extended.ext,L=T,te=pe,X=ce,$&&o>=z&&o<=B&&(o=z),!this._coreService.isCursorHidden&&w&&this._coreService.isCursorInitialized){if(K.push("xterm-cursor"),this._coreBrowserService.isFocused)c&&K.push("xterm-cursor-blink"),K.push(s==="bar"?"xterm-cursor-bar":s==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(a)switch(a){case"outline":K.push("xterm-cursor-outline");break;case"block":K.push("xterm-cursor-block");break;case"bar":K.push("xterm-cursor-bar");break;case"underline":K.push("xterm-cursor-underline");break}}if(U.isBold()&&K.push("xterm-bold"),U.isItalic()&&K.push("xterm-italic"),U.isDim()&&K.push("xterm-dim"),U.isInvisible()?D=rs:D=U.getChars()||rs,U.isUnderline()&&(K.push(`xterm-underline-${U.extended.underlineStyle}`),D===" "&&(D=" "),!U.isUnderlineColorDefault()))if(U.isUnderlineColorRGB())A.style.textDecorationColor=`rgb(${xo.toColorRGB(U.getUnderlineColor()).join(",")})`;else{let se=U.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&U.isBold()&&se<8&&(se+=8),A.style.textDecorationColor=y.ansi[se].css}U.isOverline()&&(K.push("xterm-overline"),D===" "&&(D=" ")),U.isStrikethrough()&&K.push("xterm-strikethrough"),T&&(A.style.textDecoration="underline");let ie=U.getFgColor(),ue=U.getFgColorMode(),le=U.getBgColor(),ve=U.getBgColorMode(),Ee=!!U.isInverse();if(Ee){let se=ie;ie=le,le=se;let Oe=ue;ue=ve,ve=Oe}let oe,Ie,ot=!1;this._decorationService.forEachDecorationAtCell(z,t,void 0,se=>{se.options.layer!=="top"&&ot||(se.backgroundColorRGB&&(ve=50331648,le=se.backgroundColorRGB.rgba>>8&16777215,oe=se.backgroundColorRGB),se.foregroundColorRGB&&(ue=50331648,ie=se.foregroundColorRGB.rgba>>8&16777215,Ie=se.foregroundColorRGB),ot=se.options.layer==="top")}),!ot&&ce&&(oe=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,le=oe.rgba>>8&16777215,ve=50331648,ot=!0,y.selectionForeground&&(ue=50331648,ie=y.selectionForeground.rgba>>8&16777215,Ie=y.selectionForeground)),ot&&K.push("xterm-decoration-top");let yt;switch(ve){case 16777216:case 33554432:yt=y.ansi[le],K.push(`xterm-bg-${le}`);break;case 50331648:yt=Qt.toColor(le>>16,le>>8&255,le&255),this._addStyle(A,`background-color:#${iy((le>>>0).toString(16),"0",6)}`);break;case 0:default:Ee?(yt=y.foreground,K.push("xterm-bg-257")):yt=y.background}switch(oe||U.isDim()&&(oe=kt.multiplyOpacity(yt,.5)),ue){case 16777216:case 33554432:U.isBold()&&ie<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ie+=8),this._applyMinimumContrast(A,yt,y.ansi[ie],U,oe,void 0)||K.push(`xterm-fg-${ie}`);break;case 50331648:let se=Qt.toColor(ie>>16&255,ie>>8&255,ie&255);this._applyMinimumContrast(A,yt,se,U,oe,Ie)||this._addStyle(A,`color:#${iy(ie.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(A,yt,y.foreground,U,oe,Ie)||Ee&&K.push("xterm-fg-257")}K.length&&(A.className=K.join(" "),K.length=0),!w&&!$&&!q&&C?R++:A.textContent=D,pe!==this.defaultSpacing&&(A.style.letterSpacing=`${pe}px`),v.push(A),z=B}return A&&R&&(A.textContent=D),v}_applyMinimumContrast(e,t,n,s,a,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||e3(s.getCode()))return!1;let c=this._getContrastCache(s),f;if(!a&&!o&&(f=c.getColor(t.rgba,n.rgba)),f===void 0){let d=this._optionsService.rawOptions.minimumContrastRatio/(s.isDim()?2:1);f=kt.ensureContrastRatio(a||t,o||n,d),c.setColor((a||t).rgba,(o||n).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 n=this._selectionStart,s=this._selectionEnd;return!n||!s?!1:this._columnSelectMode?n[0]<=s[0]?e>=n[0]&&t>=n[1]&&e<s[0]&&t<=s[1]:e<n[0]&&t>=n[1]&&e>=s[0]&&t<=s[1]:t>n[1]&&t<s[1]||n[1]===s[1]&&t===n[1]&&e>=n[0]&&e<s[0]||n[1]<s[1]&&t===s[1]&&e<s[0]||n[1]<s[1]&&t===n[1]&&e>=n[0]}};Cp=It([be(1,MS),be(2,Oi),be(3,wr),be(4,Is),be(5,So),be(6,Il)],Cp);function iy(e,t,n){for(;e.length<n;)e=t+e;return e}var i3=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let n=e.createElement("span");n.classList.add("xterm-char-measure-element");let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold";let a=e.createElement("span");a.classList.add("xterm-char-measure-element"),a.style.fontStyle="italic";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold",o.style.fontStyle="italic",this._measureElements=[n,s,a,o],this._container.appendChild(n),this._container.appendChild(s),this._container.appendChild(a),this._container.appendChild(o),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,s){e===this._font&&t===this._fontSize&&n===this._weight&&s===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=s,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${s}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${s}`,this.clear())}get(e,t,n){let s=0;if(!t&&!n&&e.length===1&&(s=e.charCodeAt(0))<256){if(this._flat[s]!==-9999)return this._flat[s];let c=this._measure(e,0);return c>0&&(this._flat[s]=c),c}let a=e;t&&(a+="B"),n&&(a+="I");let o=this._holey.get(a);if(o===void 0){let c=0;t&&(c|=1),n&&(c|=2),o=this._measure(e,c),o>0&&this._holey.set(a,o)}return o}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},n3=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,s=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let a=e.buffers.active.ydisp,o=t[1]-a,c=n[1]-a,f=Math.max(o,0),d=Math.min(c,e.rows-1);if(f>=e.rows||d<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=o,this.viewportEndRow=c,this.viewportCappedStartRow=f,this.viewportCappedEndRow=d,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function r3(){return new n3}var Nd="xterm-dom-renderer-owner-",Cn="xterm-rows",eu="xterm-fg-",ny="xterm-bg-",Za="xterm-focus",tu="xterm-selection",s3=1,kp=class extends Ye{constructor(e,t,n,s,a,o,c,f,d,h,_,v,b,y){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=s,this._viewportElement=a,this._helperContainer=o,this._linkifier2=c,this._charSizeService=d,this._optionsService=h,this._bufferService=_,this._coreService=v,this._coreBrowserService=b,this._themeService=y,this._terminalClass=s3++,this._rowElements=[],this._selectionRenderModel=r3(),this.onRequestRedraw=this._register(new _e).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Cn),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(tu),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=t3(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(S=>this._injectCss(S))),this._injectCss(this._themeService.colors),this._rowFactory=f.createInstance(Cp,document),this._element.classList.add(Nd+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(S=>this._handleLinkHover(S))),this._register(this._linkifier2.onHideLinkUnderline(S=>this._handleLinkLeave(S))),this._register(Dt(()=>{this._element.classList.remove(Nd+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new i3(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Cn} 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} .${Cn} { 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} .${Cn} .xterm-dim { color: ${kt.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,s=`blink_bar_${this._terminalClass}`,a=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% {  border-bottom-style: hidden; }}`,t+=`@keyframes ${s} { 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} .${Cn}.${Za} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Cn}.${Za} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${Cn}.${Za} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${a} 1s step-end infinite;}${this._terminalSelector} .${Cn} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Cn} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Cn} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Cn} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Cn} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${tu} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${tu} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${tu} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,c]of e.ansi.entries())t+=`${this._terminalSelector} .${eu}${o} { color: ${c.css}; }${this._terminalSelector} .${eu}${o}.xterm-dim { color: ${kt.multiplyOpacity(c,.5).css}; }${this._terminalSelector} .${ny}${o} { background-color: ${c.css}; }`;t+=`${this._terminalSelector} .${eu}257 { color: ${kt.opaque(e.background).css}; }${this._terminalSelector} .${eu}257.xterm-dim { color: ${kt.multiplyOpacity(kt.opaque(e.background),.5).css}; }${this._terminalSelector} .${ny}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let n=this._rowElements.length;n<=t;n++){let s=this._document.createElement("div");this._rowContainer.appendChild(s),this._rowElements.push(s)}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(Za),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Za),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let s=this._selectionRenderModel.viewportStartRow,a=this._selectionRenderModel.viewportEndRow,o=this._selectionRenderModel.viewportCappedStartRow,c=this._selectionRenderModel.viewportCappedEndRow,f=this._document.createDocumentFragment();if(n){let d=e[0]>t[0];f.appendChild(this._createSelectionElement(o,d?t[0]:e[0],d?e[0]:t[0],c-o+1))}else{let d=s===o?e[0]:0,h=o===a?t[0]:this._bufferService.cols;f.appendChild(this._createSelectionElement(o,d,h));let _=c-o-1;if(f.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,_)),o!==c){let v=a===c?t[0]:this._bufferService.cols;f.appendChild(this._createSelectionElement(c,0,v))}}this._selectionContainer.appendChild(f)}_createSelectionElement(e,t,n,s=1){let a=this._document.createElement("div"),o=t*this.dimensions.css.cell.width,c=this.dimensions.css.cell.width*(n-t);return o+c>this.dimensions.css.canvas.width&&(c=this.dimensions.css.canvas.width-o),a.style.height=`${s*this.dimensions.css.cell.height}px`,a.style.top=`${e*this.dimensions.css.cell.height}px`,a.style.left=`${o}px`,a.style.width=`${c}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 n=this._bufferService.buffer,s=n.ybase+n.y,a=Math.min(n.x,this._bufferService.cols-1),o=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,c=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let d=e;d<=t;d++){let h=d+n.ydisp,_=this._rowElements[d],v=n.lines.get(h);if(!_||!v)break;_.replaceChildren(...this._rowFactory.createRow(v,h,h===s,c,f,a,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Nd}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,s,a,o){n<0&&(e=0),s<0&&(t=0);let c=this._bufferService.rows-1;n=Math.max(Math.min(n,c),0),s=Math.max(Math.min(s,c),0),a=Math.min(a,this._bufferService.cols);let f=this._bufferService.buffer,d=f.ybase+f.y,h=Math.min(f.x,a-1),_=this._optionsService.rawOptions.cursorBlink,v=this._optionsService.rawOptions.cursorStyle,b=this._optionsService.rawOptions.cursorInactiveStyle;for(let y=n;y<=s;++y){let S=y+f.ydisp,A=this._rowElements[y],R=f.lines.get(S);if(!A||!R)break;A.replaceChildren(...this._rowFactory.createRow(R,S,S===d,v,b,h,_,this.dimensions.css.cell.width,this._widthCache,o?y===n?e:0:-1,o?(y===s?t:a)-1:-1))}}};kp=It([be(7,hm),be(8,Mu),be(9,Oi),be(10,Li),be(11,Is),be(12,wr),be(13,Il)],kp);var Ep=class extends Ye{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new _e),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new a3(this._optionsService))}catch{this._measureStrategy=this._register(new l3(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())}};Ep=It([be(2,Oi)],Ep);var ZS=class extends Ye{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)}},l3=class extends ZS{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},a3=class extends ZS{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}},o3=class extends Ye{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new c3(this._window)),this._onDprChange=this._register(new _e),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new _e),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(s=>this._screenDprMonitor.setWindow(s))),this._register(xi.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Be(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Be(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}},c3=class extends Ye{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Ol),this._onDprChange=this._register(new _e),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Dt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Be(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},u3=class extends Ye{constructor(){super(),this.linkProviders=[],this._register(Dt(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function bm(e,t,n){let s=n.getBoundingClientRect(),a=e.getComputedStyle(n),o=parseInt(a.getPropertyValue("padding-left")),c=parseInt(a.getPropertyValue("padding-top"));return[t.clientX-s.left-o,t.clientY-s.top-c]}function h3(e,t,n,s,a,o,c,f,d){if(!o)return;let h=bm(e,t,n);if(h)return h[0]=Math.ceil((h[0]+(d?c/2:0))/c),h[1]=Math.ceil(h[1]/f),h[0]=Math.min(Math.max(h[0],1),s+(d?1:0)),h[1]=Math.min(Math.max(h[1],1),a),h}var Ap=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,s,a){return h3(window,e,t,n,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,a)}getMouseReportCoords(e,t){let n=bm(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};Ap=It([be(0,Cr),be(1,Mu)],Ap);var f3=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},QS={};SR(QS,{getSafariVersion:()=>p3,isChromeOS:()=>i1,isFirefox:()=>JS,isIpad:()=>m3,isIphone:()=>g3,isLegacyEdge:()=>d3,isLinux:()=>ym,isMac:()=>Su,isNode:()=>zu,isSafari:()=>e1,isWindows:()=>t1});var zu=typeof process<"u"&&"title"in process,wo=zu?"node":navigator.userAgent,Co=zu?"node":navigator.platform,JS=wo.includes("Firefox"),d3=wo.includes("Edge"),e1=/^((?!chrome|android).)*safari/i.test(wo);function p3(){if(!e1)return 0;let e=wo.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Su=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Co),m3=Co==="iPad",g3=Co==="iPhone",t1=["Windows","Win16","Win32","WinCE"].includes(Co),ym=Co.indexOf("Linux")>=0,i1=/\bCrOS\b/.test(wo),n1=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,n=0,s=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),n=Math.max(t,n),a=e.timeRemaining(),n*1.5>a){s-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),this._start();return}s=a}this.clear()}},_3=class extends n1{_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())}}},v3=class extends n1{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},wu=!zu&&"requestIdleCallback"in window?v3:_3,b3=class{constructor(){this._queue=new wu}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Tp=class extends Ye{constructor(e,t,n,s,a,o,c,f,d){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=s,this._coreService=a,this._coreBrowserService=f,this._renderer=this._register(new Ol),this._pausedResizeTask=new b3,this._observerDisposable=this._register(new Ol),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 _e),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new _e),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new _e),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new _e),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new f3((h,_)=>this._renderRows(h,_),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new y3(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Dt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(c.onResize(()=>this._fullRefresh())),this._register(c.buffers.onBufferActivate(()=>{var h;return(h=this._renderer.value)==null?void 0:h.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(c.cols,c.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(c.buffer.y,c.buffer.y,!0))),this._register(d.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(h=>this._registerIntersectionObserver(h,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(s=>this._handleIntersectionChange(s[s.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=Dt(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let s=this._syncOutputHandler.flush();s&&(e=Math.min(e,s.start),t=Math.max(t,s.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var n;return(n=this._renderer.value)==null?void 0:n.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,n){var s;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,(s=this._renderer.value)==null||s.handleSelectionChanged(e,t,n)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};Tp=It([be(2,Oi),be(3,Mu),be(4,Is),be(5,So),be(6,Li),be(7,wr),be(8,Il)],Tp);var y3=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function x3(e,t,n,s){let a=n.buffer.x,o=n.buffer.y;if(!n.buffer.hasScrollback)return C3(a,o,e,t,n,s)+Lu(o,t,n,s)+k3(a,o,e,t,n,s);let c;if(o===t)return c=a>e?"D":"C",go(Math.abs(a-e),mo(c,s));c=o>t?"D":"C";let f=Math.abs(o-t),d=w3(o>t?e:a,n)+(f-1)*n.cols+1+S3(o>t?a:e);return go(d,mo(c,s))}function S3(e,t){return e-1}function w3(e,t){return t.cols-e}function C3(e,t,n,s,a,o){return Lu(t,s,a,o).length===0?"":go(s1(e,t,e,t-Bs(t,a),!1,a).length,mo("D",o))}function Lu(e,t,n,s){let a=e-Bs(e,n),o=t-Bs(t,n),c=Math.abs(a-o)-E3(e,t,n);return go(c,mo(r1(e,t),s))}function k3(e,t,n,s,a,o){let c;Lu(t,s,a,o).length>0?c=s-Bs(s,a):c=t;let f=s,d=A3(e,t,n,s,a,o);return go(s1(e,c,n,f,d==="C",a).length,mo(d,o))}function E3(e,t,n){var c;let s=0,a=e-Bs(e,n),o=t-Bs(t,n);for(let f=0;f<Math.abs(a-o);f++){let d=r1(e,t)==="A"?-1:1;(c=n.buffer.lines.get(a+d*f))!=null&&c.isWrapped&&s++}return s}function Bs(e,t){let n=0,s=t.buffer.lines.get(e),a=s==null?void 0:s.isWrapped;for(;a&&e>=0&&e<t.rows;)n++,s=t.buffer.lines.get(--e),a=s==null?void 0:s.isWrapped;return n}function A3(e,t,n,s,a,o){let c;return Lu(n,s,a,o).length>0?c=s-Bs(s,a):c=t,e<n&&c<=s||e>=n&&c<s?"C":"D"}function r1(e,t){return e>t?"A":"B"}function s1(e,t,n,s,a,o){let c=e,f=t,d="";for(;(c!==n||f!==s)&&f>=0&&f<o.buffer.lines.length;)c+=a?1:-1,a&&c>o.cols-1?(d+=o.buffer.translateBufferLineToString(f,!1,e,c),c=0,e=0,f++):!a&&c<0&&(d+=o.buffer.translateBufferLineToString(f,!1,0,e+1),c=o.cols-1,e=c,f--);return d+o.buffer.translateBufferLineToString(f,!1,e,c)}function mo(e,t){let n=t?"O":"[";return de.ESC+n+e}function go(e,t){e=Math.floor(e);let n="";for(let s=0;s<e;s++)n+=t;return n}var T3=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 ry(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 Dd=50,N3=15,D3=50,R3=500,M3=" ",z3=new RegExp(M3,"g"),Np=class extends Ye{constructor(e,t,n,s,a,o,c,f,d){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=s,this._coreService=a,this._mouseService=o,this._optionsService=c,this._renderService=f,this._coreBrowserService=d,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Tn,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new _e),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new _e),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new _e),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new _e),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=h=>this._handleMouseMove(h),this._mouseUpListener=h=>this._handleMouseUp(h),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(h=>this._handleTrim(h)),this._register(this._bufferService.buffers.onBufferActivate(h=>this._handleBufferActivate(h))),this.enable(),this._model=new T3(this._bufferService),this._activeSelectionMode=0,this._register(Dt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(h=>{h.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let n=this._bufferService.buffer,s=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let a=e[0]<t[0]?e[0]:t[0],o=e[0]<t[0]?t[0]:e[0];for(let c=e[1];c<=t[1];c++){let f=n.translateBufferLineToString(c,!0,a,o);s.push(f)}}else{let a=e[1]===t[1]?t[0]:void 0;s.push(n.translateBufferLineToString(e[1],!0,e[0],a));for(let o=e[1]+1;o<=t[1]-1;o++){let c=n.lines.get(o),f=n.translateBufferLineToString(o,!0);c!=null&&c.isWrapped?s[s.length-1]+=f:s.push(f)}if(e[1]!==t[1]){let o=n.lines.get(t[1]),c=n.translateBufferLineToString(t[1],!0,0,t[0]);o&&o.isWrapped?s[s.length-1]+=c:s.push(c)}}return s.map(a=>a.replace(z3," ")).join(t1?`\r
`:`
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),ym&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!n||!s||!t?!1:this._areCoordsInSelection(t,n,s)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!n||!s?!1:this._areCoordsInSelection([e,t],n,s)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var a,o;let n=(o=(a=this._linkifier.currentLink)==null?void 0:a.link)==null?void 0:o.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=ry(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let s=this._getMouseBufferCoords(e);return s?(this._selectWordAt(s,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=bm(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-Dd),Dd),t/=Dd,t/Math.abs(t)+Math.round(t*(N3-1)))}shouldForceSelection(e){return Su?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(),D3)}_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&&!(Su&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let s=n.lines.get(this._model.selectionEnd[1]);s&&s.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<R3&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let n=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(n&&n[0]!==void 0&&n[1]!==void 0){let s=x3(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(s,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let s=0;t>=s;s++){let a=e.loadCell(s,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:a>1&&t!==s&&(n+=a-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,s=!0){if(e[0]>=this._bufferService.cols)return;let a=this._bufferService.buffer,o=a.lines.get(e[1]);if(!o)return;let c=a.translateBufferLineToString(e[1],!1),f=this._convertViewportColToCharacterIndex(o,e[0]),d=f,h=e[0]-f,_=0,v=0,b=0,y=0;if(c.charAt(f)===" "){for(;f>0&&c.charAt(f-1)===" ";)f--;for(;d<c.length&&c.charAt(d+1)===" ";)d++}else{let R=e[0],D=e[0];o.getWidth(R)===0&&(_++,R--),o.getWidth(D)===2&&(v++,D++);let W=o.getString(D).length;for(W>1&&(y+=W-1,d+=W-1);R>0&&f>0&&!this._isCharWordSeparator(o.loadCell(R-1,this._workCell));){o.loadCell(R-1,this._workCell);let j=this._workCell.getChars().length;this._workCell.getWidth()===0?(_++,R--):j>1&&(b+=j-1,f-=j-1),f--,R--}for(;D<o.length&&d+1<c.length&&!this._isCharWordSeparator(o.loadCell(D+1,this._workCell));){o.loadCell(D+1,this._workCell);let j=this._workCell.getChars().length;this._workCell.getWidth()===2?(v++,D++):j>1&&(y+=j-1,d+=j-1),d++,D++}}d++;let S=f+h-_+b,A=Math.min(this._bufferService.cols,d-f+_+v-b-y);if(!(!t&&c.slice(f,d).trim()==="")){if(n&&S===0&&o.getCodePoint(0)!==32){let R=a.lines.get(e[1]-1);if(R&&o.isWrapped&&R.getCodePoint(this._bufferService.cols-1)!==32){let D=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(D){let W=this._bufferService.cols-D.start;S-=W,A+=W}}}if(s&&S+A===this._bufferService.cols&&o.getCodePoint(this._bufferService.cols-1)!==32){let R=a.lines.get(e[1]+1);if(R!=null&&R.isWrapped&&R.getCodePoint(0)!==32){let D=this._getWordAt([0,e[1]+1],!1,!1,!0);D&&(A+=D.length)}}return{start:S,length:A}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=ry(n,this._bufferService.cols)}};Np=It([be(3,Li),be(4,Is),be(5,fm),be(6,Oi),be(7,Cr),be(8,wr)],Np);var sy=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},ly=class{constructor(){this._color=new sy,this._css=new sy}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},ii=Object.freeze((()=>{let e=[Lt.toColor("#2e3436"),Lt.toColor("#cc0000"),Lt.toColor("#4e9a06"),Lt.toColor("#c4a000"),Lt.toColor("#3465a4"),Lt.toColor("#75507b"),Lt.toColor("#06989a"),Lt.toColor("#d3d7cf"),Lt.toColor("#555753"),Lt.toColor("#ef2929"),Lt.toColor("#8ae234"),Lt.toColor("#fce94f"),Lt.toColor("#729fcf"),Lt.toColor("#ad7fa8"),Lt.toColor("#34e2e2"),Lt.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let s=t[n/36%6|0],a=t[n/6%6|0],o=t[n%6];e.push({css:Qt.toCss(s,a,o),rgba:Qt.toRgba(s,a,o)})}for(let n=0;n<24;n++){let s=8+n*10;e.push({css:Qt.toCss(s,s,s),rgba:Qt.toRgba(s,s,s)})}return e})()),Ns=Lt.toColor("#ffffff"),no=Lt.toColor("#000000"),ay=Lt.toColor("#ffffff"),oy=no,Qa={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},L3=Ns,Dp=class extends Ye{constructor(e){super(),this._optionsService=e,this._contrastCache=new ly,this._halfContrastCache=new ly,this._onChangeColors=this._register(new _e),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Ns,background:no,cursor:ay,cursorAccent:oy,selectionForeground:void 0,selectionBackgroundTransparent:Qa,selectionBackgroundOpaque:kt.blend(no,Qa),selectionInactiveBackgroundTransparent:Qa,selectionInactiveBackgroundOpaque:kt.blend(no,Qa),scrollbarSliderBackground:kt.opacity(Ns,.2),scrollbarSliderHoverBackground:kt.opacity(Ns,.4),scrollbarSliderActiveBackground:kt.opacity(Ns,.5),overviewRulerBorder:Ns,ansi:ii.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=mt(e.foreground,Ns),t.background=mt(e.background,no),t.cursor=kt.blend(t.background,mt(e.cursor,ay)),t.cursorAccent=kt.blend(t.background,mt(e.cursorAccent,oy)),t.selectionBackgroundTransparent=mt(e.selectionBackground,Qa),t.selectionBackgroundOpaque=kt.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=mt(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=kt.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?mt(e.selectionForeground,ty):void 0,t.selectionForeground===ty&&(t.selectionForeground=void 0),kt.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=kt.opacity(t.selectionBackgroundTransparent,.3)),kt.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=kt.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=mt(e.scrollbarSliderBackground,kt.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=mt(e.scrollbarSliderHoverBackground,kt.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=mt(e.scrollbarSliderActiveBackground,kt.opacity(t.foreground,.5)),t.overviewRulerBorder=mt(e.overviewRulerBorder,L3),t.ansi=ii.slice(),t.ansi[0]=mt(e.black,ii[0]),t.ansi[1]=mt(e.red,ii[1]),t.ansi[2]=mt(e.green,ii[2]),t.ansi[3]=mt(e.yellow,ii[3]),t.ansi[4]=mt(e.blue,ii[4]),t.ansi[5]=mt(e.magenta,ii[5]),t.ansi[6]=mt(e.cyan,ii[6]),t.ansi[7]=mt(e.white,ii[7]),t.ansi[8]=mt(e.brightBlack,ii[8]),t.ansi[9]=mt(e.brightRed,ii[9]),t.ansi[10]=mt(e.brightGreen,ii[10]),t.ansi[11]=mt(e.brightYellow,ii[11]),t.ansi[12]=mt(e.brightBlue,ii[12]),t.ansi[13]=mt(e.brightMagenta,ii[13]),t.ansi[14]=mt(e.brightCyan,ii[14]),t.ansi[15]=mt(e.brightWhite,ii[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let s=0;s<n;s++)t.ansi[s+16]=mt(e.extendedAnsi[s],ii[s+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()}}};Dp=It([be(0,Oi)],Dp);function mt(e,t){if(e!==void 0)try{return Lt.toColor(e)}catch{}return t}var O3=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},B3=class{constructor(){this._services=new O3,this._services.set(hm,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=NR(e).sort((o,c)=>o.index-c.index),s=[];for(let o of n){let c=this._services.get(o.id);if(!c)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${o.id._id}.`);s.push(c)}let a=n.length>0?n[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,...s)}},j3={trace:0,debug:1,info:2,warn:3,error:4,off:5},H3="xterm.js: ",Rp=class extends Ye{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=j3[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?"":H3)+t,...n)}trace(e,...t){var n;this._logLevel<=0&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var n;this._logLevel<=1&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var n;this._logLevel<=2&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var n;this._logLevel<=3&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var n;this._logLevel<=4&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.error.bind(this._optionsService.options.logger))??console.error,e,t)}};Rp=It([be(0,Oi)],Rp);var cy=class extends Ye{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new _e),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new _e),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new _e),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let s=e;s<this._length-t;s++)this._array[this._getCyclicIndex(s)]=this._array[this._getCyclicIndex(s+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let s=this._length-1;s>=e;s--)this._array[this._getCyclicIndex(s+n.length)]=this._array[this._getCyclicIndex(s)];for(let s=0;s<n.length;s++)this._array[this._getCyclicIndex(e+s)]=n[s];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let s=this._length+n.length-this._maxLength;this._startIndex+=s,this._length=this._maxLength,this.onTrimEmitter.fire(s)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let a=t-1;a>=0;a--)this.set(e+a+n,this.get(e+a));let s=e+t+n-this._length;if(s>0)for(this._length+=s;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let s=0;s<t;s++)this.set(e+s+n,this.get(e+s))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},qe=3,Zt=Object.freeze(new xo),iu=0,Rd=2,ro=class l1{constructor(t,n,s=!1){this.isWrapped=s,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*qe);let a=n||Tn.fromCharData([0,kS,1,0]);for(let o=0;o<t;++o)this.setCell(o,a);this.length=t}get(t){let n=this._data[t*qe+0],s=n&2097151;return[this._data[t*qe+1],n&2097152?this._combined[t]:s?is(s):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):s]}set(t,n){this._data[t*qe+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*qe+0]=t|2097152|n[2]<<22):this._data[t*qe+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*qe+0]>>22}hasWidth(t){return this._data[t*qe+0]&12582912}getFg(t){return this._data[t*qe+1]}getBg(t){return this._data[t*qe+2]}hasContent(t){return this._data[t*qe+0]&4194303}getCodePoint(t){let n=this._data[t*qe+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*qe+0]&2097152}getString(t){let n=this._data[t*qe+0];return n&2097152?this._combined[t]:n&2097151?is(n&2097151):""}isProtected(t){return this._data[t*qe+2]&536870912}loadCell(t,n){return iu=t*qe,n.content=this._data[iu+0],n.fg=this._data[iu+1],n.bg=this._data[iu+2],n.content&2097152&&(n.combinedData=this._combined[t]),n.bg&268435456&&(n.extended=this._extendedAttrs[t]),n}setCell(t,n){n.content&2097152&&(this._combined[t]=n.combinedData),n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*qe+0]=n.content,this._data[t*qe+1]=n.fg,this._data[t*qe+2]=n.bg}setCellFromCodepoint(t,n,s,a){a.bg&268435456&&(this._extendedAttrs[t]=a.extended),this._data[t*qe+0]=n|s<<22,this._data[t*qe+1]=a.fg,this._data[t*qe+2]=a.bg}addCodepointToCell(t,n,s){let a=this._data[t*qe+0];a&2097152?this._combined[t]+=is(n):a&2097151?(this._combined[t]=is(a&2097151)+is(n),a&=-2097152,a|=2097152):a=n|1<<22,s&&(a&=-12582913,a|=s<<22),this._data[t*qe+0]=a}insertCells(t,n,s){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),n<this.length-t){let a=new Tn;for(let o=this.length-t-n-1;o>=0;--o)this.setCell(t+n+o,this.loadCell(t+o,a));for(let o=0;o<n;++o)this.setCell(t+o,s)}else for(let a=t;a<this.length;++a)this.setCell(a,s);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,s)}deleteCells(t,n,s){if(t%=this.length,n<this.length-t){let a=new Tn;for(let o=0;o<this.length-t-n;++o)this.setCell(t+o,this.loadCell(t+n+o,a));for(let o=this.length-n;o<this.length;++o)this.setCell(o,s)}else for(let a=t;a<this.length;++a)this.setCell(a,s);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,s)}replaceCells(t,n,s,a=!1){if(a){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,s),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,s);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,s),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,s);t<n&&t<this.length;)this.setCell(t++,s)}resize(t,n){if(t===this.length)return this._data.length*4*Rd<this._data.buffer.byteLength;let s=t*qe;if(t>this.length){if(this._data.buffer.byteLength>=s*4)this._data=new Uint32Array(this._data.buffer,0,s);else{let a=new Uint32Array(s);a.set(this._data),this._data=a}for(let a=this.length;a<t;++a)this.setCell(a,n)}else{this._data=this._data.subarray(0,s);let a=Object.keys(this._combined);for(let c=0;c<a.length;c++){let f=parseInt(a[c],10);f>=t&&delete this._combined[f]}let o=Object.keys(this._extendedAttrs);for(let c=0;c<o.length;c++){let f=parseInt(o[c],10);f>=t&&delete this._extendedAttrs[f]}}return this.length=t,s*4*Rd<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Rd<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,n=!1){if(n){for(let s=0;s<this.length;++s)this.isProtected(s)||this.setCell(s,t);return}this._combined={},this._extendedAttrs={};for(let s=0;s<this.length;++s)this.setCell(s,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let n in t._combined)this._combined[n]=t._combined[n];this._extendedAttrs={};for(let n in t._extendedAttrs)this._extendedAttrs[n]=t._extendedAttrs[n];this.isWrapped=t.isWrapped}clone(){let t=new l1(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let n in this._combined)t._combined[n]=this._combined[n];for(let n in this._extendedAttrs)t._extendedAttrs[n]=this._extendedAttrs[n];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*qe+0]&4194303)return t+(this._data[t*qe+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*qe+0]&4194303||this._data[t*qe+2]&50331648)return t+(this._data[t*qe+0]>>22);return 0}copyCellsFrom(t,n,s,a,o){let c=t._data;if(o)for(let d=a-1;d>=0;d--){for(let h=0;h<qe;h++)this._data[(s+d)*qe+h]=c[(n+d)*qe+h];c[(n+d)*qe+2]&268435456&&(this._extendedAttrs[s+d]=t._extendedAttrs[n+d])}else for(let d=0;d<a;d++){for(let h=0;h<qe;h++)this._data[(s+d)*qe+h]=c[(n+d)*qe+h];c[(n+d)*qe+2]&268435456&&(this._extendedAttrs[s+d]=t._extendedAttrs[n+d])}let f=Object.keys(t._combined);for(let d=0;d<f.length;d++){let h=parseInt(f[d],10);h>=n&&(this._combined[h-n+s]=t._combined[h])}}translateToString(t,n,s,a){n=n??0,s=s??this.length,t&&(s=Math.min(s,this.getTrimmedLength())),a&&(a.length=0);let o="";for(;n<s;){let c=this._data[n*qe+0],f=c&2097151,d=c&2097152?this._combined[n]:f?is(f):rs;if(o+=d,a)for(let h=0;h<d.length;++h)a.push(n);n+=c>>22||1}return a&&a.push(n),o}};function I3(e,t,n,s,a,o){let c=[];for(let f=0;f<e.length-1;f++){let d=f,h=e.get(++d);if(!h.isWrapped)continue;let _=[e.get(f)];for(;d<e.length&&h.isWrapped;)_.push(h),h=e.get(++d);if(!o&&s>=f&&s<d){f+=_.length-1;continue}let v=0,b=_o(_,v,t),y=1,S=0;for(;y<_.length;){let R=_o(_,y,t),D=R-S,W=n-b,j=Math.min(D,W);_[v].copyCellsFrom(_[y],S,b,j,!1),b+=j,b===n&&(v++,b=0),S+=j,S===R&&(y++,S=0),b===0&&v!==0&&_[v-1].getWidth(n-1)===2&&(_[v].copyCellsFrom(_[v-1],n-1,b++,1,!1),_[v-1].setCell(n-1,a))}_[v].replaceCells(b,n,a);let A=0;for(let R=_.length-1;R>0&&(R>v||_[R].getTrimmedLength()===0);R--)A++;A>0&&(c.push(f+_.length-A),c.push(A)),f+=_.length-1}return c}function P3(e,t){let n=[],s=0,a=t[s],o=0;for(let c=0;c<e.length;c++)if(a===c){let f=t[++s];e.onDeleteEmitter.fire({index:c-o,amount:f}),c+=f-1,o+=f,a=t[++s]}else n.push(c);return{layout:n,countRemoved:o}}function U3(e,t){let n=[];for(let s=0;s<t.length;s++)n.push(e.get(t[s]));for(let s=0;s<n.length;s++)e.set(s,n[s]);e.length=t.length}function F3(e,t,n){let s=[],a=e.map((d,h)=>_o(e,h,t)).reduce((d,h)=>d+h),o=0,c=0,f=0;for(;f<a;){if(a-f<n){s.push(a-f);break}o+=n;let d=_o(e,c,t);o>d&&(o-=d,c++);let h=e[c].getWidth(o-1)===2;h&&o--;let _=h?n-1:n;s.push(_),f+=_}return s}function _o(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let s=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,a=e[t+1].getWidth(0)===2;return s&&a?n-1:n}var a1=class o1{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=o1._nextId++,this._onDispose=this.register(new _e),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Os(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};a1._nextId=1;var W3=a1,ri={},Ds=ri.B;ri[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:"≥","{":"π","|":"≠","}":"£","~":"·"};ri.A={"#":"£"};ri.B=void 0;ri[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};ri.C=ri[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ri.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};ri.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};ri.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};ri.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};ri.E=ri[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};ri.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};ri.H=ri[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ri["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var uy=4294967295,hy=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Zt.clone(),this.savedCharset=Ds,this.markers=[],this._nullCell=Tn.fromCharData([0,kS,1,0]),this._whitespaceCell=Tn.fromCharData([0,rs,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 cy(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 bu),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 bu),this._whitespaceCell}getBlankLine(e,t){return new ro(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>uy?uy:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Zt);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new cy(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(Zt),s=0,a=this._getCorrectBufferLength(t);if(a>this.lines.maxLength&&(this.lines.maxLength=a),this.lines.length>0){if(this._cols<e)for(let c=0;c<this.lines.length;c++)s+=+this.lines.get(c).resize(e,n);let o=0;if(this._rows<t)for(let c=this._rows;c<t;c++)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 ro(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+o+1?(this.ybase--,o++,this.ydisp>0&&this.ydisp--):this.lines.push(new ro(e,n)));else for(let c=this._rows;c>t;c--)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 c=this.lines.length-a;c>0&&(this.lines.trimStart(c),this.ybase=Math.max(this.ybase-c,0),this.ydisp=Math.max(this.ydisp-c,0),this.savedY=Math.max(this.savedY-c,0)),this.lines.maxLength=a}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),o&&(this.y+=o),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 o=0;o<this.lines.length;o++)s+=+this.lines.get(o).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),s>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,s=I3(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Zt),n);if(s.length>0){let a=P3(this.lines,s);U3(this.lines,a.layout),this._reflowLargerAdjustViewport(e,t,a.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let s=this.getNullCell(Zt),a=n;for(;a-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new ro(e,s))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,s=this.getNullCell(Zt),a=[],o=0;for(let c=this.lines.length-1;c>=0;c--){let f=this.lines.get(c);if(!f||!f.isWrapped&&f.getTrimmedLength()<=e)continue;let d=[f];for(;f.isWrapped&&c>0;)f=this.lines.get(--c),d.unshift(f);if(!n){let j=this.ybase+this.y;if(j>=c&&j<c+d.length)continue}let h=d[d.length-1].getTrimmedLength(),_=F3(d,this._cols,e),v=_.length-d.length,b;this.ybase===0&&this.y!==this.lines.length-1?b=Math.max(0,this.y-this.lines.maxLength+v):b=Math.max(0,this.lines.length-this.lines.maxLength+v);let y=[];for(let j=0;j<v;j++){let I=this.getBlankLine(Zt,!0);y.push(I)}y.length>0&&(a.push({start:c+d.length+o,newLines:y}),o+=y.length),d.push(...y);let S=_.length-1,A=_[S];A===0&&(S--,A=_[S]);let R=d.length-v-1,D=h;for(;R>=0;){let j=Math.min(D,A);if(d[S]===void 0)break;if(d[S].copyCellsFrom(d[R],D-j,A-j,j,!0),A-=j,A===0&&(S--,A=_[S]),D-=j,D===0){R--;let I=Math.max(R,0);D=_o(d,I,this._cols)}}for(let j=0;j<d.length;j++)_[j]<e&&d[j].setCell(_[j],s);let W=v-b;for(;W-- >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+o)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+v,this.ybase+t-1)}if(a.length>0){let c=[],f=[];for(let A=0;A<this.lines.length;A++)f.push(this.lines.get(A));let d=this.lines.length,h=d-1,_=0,v=a[_];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+o);let b=0;for(let A=Math.min(this.lines.maxLength-1,d+o-1);A>=0;A--)if(v&&v.start>h+b){for(let R=v.newLines.length-1;R>=0;R--)this.lines.set(A--,v.newLines[R]);A++,c.push({index:h+1,amount:v.newLines.length}),b+=v.newLines.length,v=a[++_]}else this.lines.set(A,f[h--]);let y=0;for(let A=c.length-1;A>=0;A--)c[A].index+=y,this.lines.onInsertEmitter.fire(c[A]),y+=c[A].amount;let S=Math.max(0,d+o-this.lines.maxLength);S>0&&this.lines.onTrimEmitter.fire(S)}}translateBufferLineToString(e,t,n=0,s){let a=this.lines.get(e);return a?a.translateToString(t,n,s):""}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new W3(e);return this.markers.push(t),t.register(this.lines.onTrim(n=>{t.line-=n,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(n=>{t.line>=n.index&&(t.line+=n.amount)})),t.register(this.lines.onDelete(n=>{t.line>=n.index&&t.line<n.index+n.amount&&t.dispose(),t.line>n.index&&(t.line-=n.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},q3=class extends Ye{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new _e),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 hy(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new hy(!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)}},c1=2,u1=1,Mp=class extends Ye{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new _e),this.onResize=this._onResize.event,this._onScroll=this._register(new _e),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,c1),this.rows=Math.max(e.rawOptions.rows||0,u1),this.buffers=this._register(new q3(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,s=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,s;s=this._cachedBlankLine,(!s||s.length!==this.cols||s.getFg(0)!==e.fg||s.getBg(0)!==e.bg)&&(s=n.getBlankLine(e,t),this._cachedBlankLine=s),s.isWrapped=t;let a=n.ybase+n.scrollTop,o=n.ybase+n.scrollBottom;if(n.scrollTop===0){let c=n.lines.isFull;o===n.lines.length-1?c?n.lines.recycle().copyFrom(s):n.lines.push(s.clone()):n.lines.splice(o+1,0,s.clone()),c?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let c=o-a+1;n.lines.shiftElements(a+1,c-1,-1),n.lines.set(o,s.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let s=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),s!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};Mp=It([be(0,Oi)],Mp);var El={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:Su,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},$3=["normal","bold","100","200","300","400","500","600","700","800","900"],Y3=class extends Ye{constructor(e){super(),this._onOptionChange=this._register(new _e),this.onOptionChange=this._onOptionChange.event;let t={...El};for(let n in e)if(n in t)try{let s=e[n];t[n]=this._sanitizeAndValidateOption(n,s)}catch(s){console.error(s)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(Dt(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=n=>{if(!(n in El))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,s)=>{if(!(n in El))throw new Error(`No option with key "${n}"`);s=this._sanitizeAndValidateOption(n,s),this.rawOptions[n]!==s&&(this.rawOptions[n]=s,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let s={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,s)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=El[e]),!V3(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=El[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=$3.includes(t)?t:El[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 V3(e){return e==="block"||e==="underline"||e==="bar"}function so(e,t=5){if(typeof e!="object")return e;let n=Array.isArray(e)?[]:{};for(let s in e)n[s]=t<=1?e[s]:e[s]&&so(e[s],t-1);return n}var fy=Object.freeze({insertMode:!1}),dy=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),zp=class extends Ye{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new _e),this.onData=this._onData.event,this._onUserInput=this._register(new _e),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new _e),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new _e),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=so(fy),this.decPrivateModes=so(dy)}reset(){this.modes=so(fy),this.decPrivateModes=so(dy)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(s=>s.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))}};zp=It([be(0,Li),be(1,DS),be(2,Oi)],zp);var py={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 Md(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var zd=String.fromCharCode,my={DEFAULT:e=>{let t=[Md(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${zd(t[0])}${zd(t[1])}${zd(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Md(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Md(e,!0)};${e.x};${e.y}${t}`}},Lp=class extends Ye{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new _e),this.onProtocolChange=this._onProtocolChange.event;for(let s of Object.keys(py))this.addProtocol(s,py[s]);for(let s of Object.keys(my))this.addEncoding(s,my[s]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let s=t/n,a=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(a/=s+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,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};Lp=It([be(0,Li),be(1,Is),be(2,Oi)],Lp);var Ld=[[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]],G3=[[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]],ni;function K3(e,t){let n=0,s=t.length-1,a;if(e<t[0][0]||e>t[s][1])return!1;for(;s>=n;)if(a=n+s>>1,e>t[a][1])n=a+1;else if(e<t[a][0])s=a-1;else return!0;return!1}var X3=class{constructor(){if(this.version="6",!ni){ni=new Uint8Array(65536),ni.fill(1),ni[0]=0,ni.fill(0,1,32),ni.fill(0,127,160),ni.fill(2,4352,4448),ni[9001]=2,ni[9002]=2,ni.fill(2,11904,42192),ni[12351]=1,ni.fill(2,44032,55204),ni.fill(2,63744,64256),ni.fill(2,65040,65050),ni.fill(2,65072,65136),ni.fill(2,65280,65377),ni.fill(2,65504,65511);for(let e=0;e<Ld.length;++e)ni.fill(0,Ld[e][0],Ld[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?ni[e]:K3(e,G3)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),s=n===0&&t!==0;if(s){let a=Rs.extractWidth(t);a===0?s=!1:a>n&&(n=a)}return Rs.createPropertyValue(0,n,s)}},Rs=class fu{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new _e,this.onChange=this._onChange.event;let t=new X3;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,n,s=!1){return(t&16777215)<<3|(n&3)<<1|(s?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let n=0,s=0,a=t.length;for(let o=0;o<a;++o){let c=t.charCodeAt(o);if(55296<=c&&c<=56319){if(++o>=a)return n+this.wcwidth(c);let h=t.charCodeAt(o);56320<=h&&h<=57343?c=(c-55296)*1024+h-56320+65536:n+=this.wcwidth(h)}let f=this.charProperties(c,s),d=fu.extractWidth(f);fu.extractShouldJoin(f)&&(d-=fu.extractWidth(s)),n+=d,s=f}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},Z3=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 gy(e){var s;let t=(s=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:s.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var Ja=2147483647,Q3=256,h1=class Op{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>Q3)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new Op;if(!t.length)return n;for(let s=Array.isArray(t[0])?1:0;s<t.length;++s){let a=t[s];if(Array.isArray(a))for(let o=0;o<a.length;++o)n.addSubParam(a[o]);else n.addParam(a)}return n}clone(){let t=new Op(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let n=0;n<this.length;++n){t.push(this.params[n]);let s=this._subParamsIdx[n]>>8,a=this._subParamsIdx[n]&255;a-s>0&&t.push(Array.prototype.slice.call(this._subParams,s,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>Ja?Ja: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>Ja?Ja:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let n=this._subParamsIdx[t]>>8,s=this._subParamsIdx[t]&255;return s-n>0?this._subParams.subarray(n,s):null}getSubParamsAll(){let t={};for(let n=0;n<this.length;++n){let s=this._subParamsIdx[n]>>8,a=this._subParamsIdx[n]&255;a-s>0&&(t[n]=this._subParams.slice(s,a))}return t}addDigit(t){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let s=this._digitIsSub?this._subParams:this.params,a=s[n-1];s[n-1]=~a?Math.min(a*10+t,Ja):t}},eo=[],J3=class{constructor(){this._state=0,this._active=eo,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let s=n.indexOf(t);s!==-1&&n.splice(s,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=eo}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=eo,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||eo,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,"PUT",Ru(e,t,n));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let s=e[t++];if(s===59){this._state=2,this._start();break}if(s<48||57<s){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+s-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let n=!1,s=this._active.length-1,a=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,n=t,a=this._stack.fallThrough,this._stack.paused=!1),!a&&n===!1){for(;s>=0&&(n=this._active[s].end(e),n!==!0);s--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,n;s--}for(;s>=0;s--)if(n=this._active[s].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,n}this._active=eo,this._id=-1,this._state=0}}},rn=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Ru(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(n=>(this._data="",this._hitLimit=!1,n));return this._data="",this._hitLimit=!1,t}},to=[],ez=class{constructor(){this._handlers=Object.create(null),this._active=to,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=to}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let s=n.indexOf(t);s!==-1&&n.splice(s,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=to,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||to,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",Ru(e,t,n));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,s=this._active.length-1,a=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,n=t,a=this._stack.fallThrough,this._stack.paused=!1),!a&&n===!1){for(;s>=0&&(n=this._active[s].unhook(e),n!==!0);s--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,n;s--}for(;s>=0;s--)if(n=this._active[s].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,n}this._active=to,this._ident=0}},lo=new h1;lo.addParam(0);var _y=class{constructor(e){this._handler=e,this._data="",this._params=lo,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():lo,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Ru(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(n=>(this._params=lo,this._data="",this._hitLimit=!1,n));return this._params=lo,this._data="",this._hitLimit=!1,t}},tz=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,s){this.table[t<<8|e]=n<<4|s}addMany(e,t,n,s){for(let a=0;a<e.length;a++)this.table[t<<8|e[a]]=n<<4|s}},En=160,iz=(function(){let e=new tz(4095),t=Array.apply(null,Array(256)).map((f,d)=>d),n=(f,d)=>t.slice(f,d),s=n(32,127),a=n(0,24);a.push(25),a.push.apply(a,n(28,32));let o=n(0,14),c;e.setDefault(1,0),e.addMany(s,0,2,0);for(c in o)e.addMany([24,26,153,154],c,3,0),e.addMany(n(128,144),c,3,0),e.addMany(n(144,152),c,3,0),e.add(156,c,0,0),e.add(27,c,11,1),e.add(157,c,4,8),e.addMany([152,158,159],c,0,7),e.add(155,c,11,3),e.add(144,c,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(s,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(s,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(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(a,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(a,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(a,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(a,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(a,13,13,13),e.addMany(s,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(En,0,2,0),e.add(En,8,5,8),e.add(En,6,0,6),e.add(En,11,0,11),e.add(En,13,13,13),e})(),nz=class extends Ye{constructor(e=iz){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 h1,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,n,s)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,n)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(Dt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new J3),this._dcsParser=this._register(new ez),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let a=0;a<e.intermediates.length;++a){let o=e.intermediates.charCodeAt(a);if(32>o||o>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=o}}if(e.final.length!==1)throw new Error("final must be a single byte");let s=e.final.charCodeAt(0);if(t[0]>s||s>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=s,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let s=this._escHandlers[n];return s.push(t),{dispose:()=>{let a=s.indexOf(t);a!==-1&&s.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 n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let s=this._csiHandlers[n];return s.push(t),{dispose:()=>{let a=s.indexOf(t);a!==-1&&s.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,n,s,a){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=s,this._parseStack.chunkPos=a}parse(e,t,n){let s=0,a=0,o=0,c;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let f=this._parseStack.handlers,d=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&d>-1){for(;d>=0&&(c=f[d](this._params),c!==!0);d--)if(c instanceof Promise)return this._parseStack.handlerPos=d,c}this._parseStack.handlers=[];break;case 4:if(n===!1&&d>-1){for(;d>=0&&(c=f[d](),c!==!0);d--)if(c instanceof Promise)return this._parseStack.handlerPos=d,c}this._parseStack.handlers=[];break;case 6:if(s=e[this._parseStack.chunkPos],c=this._dcsParser.unhook(s!==24&&s!==26,n),c)return c;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(s=e[this._parseStack.chunkPos],c=this._oscParser.end(s!==24&&s!==26,n),c)return c;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let f=o;f<t;++f){switch(s=e[f],a=this._transitions.table[this.currentState<<8|(s<160?s:En)],a>>4){case 2:for(let b=f+1;;++b){if(b>=t||(s=e[b])<32||s>126&&s<En){this._printHandler(e,f,b),f=b-1;break}if(++b>=t||(s=e[b])<32||s>126&&s<En){this._printHandler(e,f,b),f=b-1;break}if(++b>=t||(s=e[b])<32||s>126&&s<En){this._printHandler(e,f,b),f=b-1;break}if(++b>=t||(s=e[b])<32||s>126&&s<En){this._printHandler(e,f,b),f=b-1;break}}break;case 3:this._executeHandlers[s]?this._executeHandlers[s]():this._executeHandlerFb(s),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:f,code:s,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let d=this._csiHandlers[this._collect<<8|s],h=d?d.length-1:-1;for(;h>=0&&(c=d[h](this._params),c!==!0);h--)if(c instanceof Promise)return this._preserveStack(3,d,h,a,f),c;h<0&&this._csiHandlerFb(this._collect<<8|s,this._params),this.precedingJoinState=0;break;case 8:do switch(s){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(s-48)}while(++f<t&&(s=e[f])>47&&s<60);f--;break;case 9:this._collect<<=8,this._collect|=s;break;case 10:let _=this._escHandlers[this._collect<<8|s],v=_?_.length-1:-1;for(;v>=0&&(c=_[v](),c!==!0);v--)if(c instanceof Promise)return this._preserveStack(4,_,v,a,f),c;v<0&&this._escHandlerFb(this._collect<<8|s),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|s,this._params);break;case 13:for(let b=f+1;;++b)if(b>=t||(s=e[b])===24||s===26||s===27||s>127&&s<En){this._dcsParser.put(e,f,b),f=b-1;break}break;case 14:if(c=this._dcsParser.unhook(s!==24&&s!==26),c)return this._preserveStack(6,[],0,a,f),c;s===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 b=f+1;;b++)if(b>=t||(s=e[b])<32||s>127&&s<En){this._oscParser.put(e,f,b),f=b-1;break}break;case 6:if(c=this._oscParser.end(s!==24&&s!==26),c)return this._preserveStack(5,[],0,a,f),c;s===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=a&15}}},rz=/^([\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})$/,sz=/^[\da-f]+$/;function vy(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=rz.exec(t);if(n){let s=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/s*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/s*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/s*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),sz.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,s=[0,0,0];for(let a=0;a<3;++a){let o=parseInt(t.slice(n*a,n*a+n),16);s[a]=n===1?o<<4:n===2?o:n===3?o>>4:o>>8}return s}}function Od(e,t){let n=e.toString(16),s=n.length<2?"0"+n:n;switch(t){case 4:return n[0];case 8:return s;case 12:return(s+s).slice(0,3);default:return s+s}}function lz(e,t=16){let[n,s,a]=e;return`rgb:${Od(n,t)}/${Od(s,t)}/${Od(a,t)}`}var az={"(":0,")":1,"*":2,"+":3,"-":1,".":2},ts=131072,by=10;function yy(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 xy=5e3,Sy=0,oz=class extends Ye{constructor(e,t,n,s,a,o,c,f,d=new nz){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=s,this._optionsService=a,this._oscLinkService=o,this._coreMouseService=c,this._unicodeService=f,this._parser=d,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new AR,this._utf8Decoder=new TR,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Zt.clone(),this._eraseAttrDataInternal=Zt.clone(),this._onRequestBell=this._register(new _e),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new _e),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new _e),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new _e),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new _e),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new _e),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new _e),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new _e),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new _e),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new _e),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new _e),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new _e),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new _e),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 Bp(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(h=>this._activeBuffer=h.activeBuffer)),this._parser.setCsiHandlerFallback((h,_)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(h),params:_.toArray()})}),this._parser.setEscHandlerFallback(h=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(h)})}),this._parser.setExecuteHandlerFallback(h=>{this._logService.debug("Unknown EXECUTE code: ",{code:h})}),this._parser.setOscHandlerFallback((h,_,v)=>{this._logService.debug("Unknown OSC code: ",{identifier:h,action:_,data:v})}),this._parser.setDcsHandlerFallback((h,_,v)=>{_==="HOOK"&&(v=v.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(h),action:_,payload:v})}),this._parser.setPrintHandler((h,_,v)=>this.print(h,_,v)),this._parser.registerCsiHandler({final:"@"},h=>this.insertChars(h)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},h=>this.scrollLeft(h)),this._parser.registerCsiHandler({final:"A"},h=>this.cursorUp(h)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},h=>this.scrollRight(h)),this._parser.registerCsiHandler({final:"B"},h=>this.cursorDown(h)),this._parser.registerCsiHandler({final:"C"},h=>this.cursorForward(h)),this._parser.registerCsiHandler({final:"D"},h=>this.cursorBackward(h)),this._parser.registerCsiHandler({final:"E"},h=>this.cursorNextLine(h)),this._parser.registerCsiHandler({final:"F"},h=>this.cursorPrecedingLine(h)),this._parser.registerCsiHandler({final:"G"},h=>this.cursorCharAbsolute(h)),this._parser.registerCsiHandler({final:"H"},h=>this.cursorPosition(h)),this._parser.registerCsiHandler({final:"I"},h=>this.cursorForwardTab(h)),this._parser.registerCsiHandler({final:"J"},h=>this.eraseInDisplay(h,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},h=>this.eraseInDisplay(h,!0)),this._parser.registerCsiHandler({final:"K"},h=>this.eraseInLine(h,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},h=>this.eraseInLine(h,!0)),this._parser.registerCsiHandler({final:"L"},h=>this.insertLines(h)),this._parser.registerCsiHandler({final:"M"},h=>this.deleteLines(h)),this._parser.registerCsiHandler({final:"P"},h=>this.deleteChars(h)),this._parser.registerCsiHandler({final:"S"},h=>this.scrollUp(h)),this._parser.registerCsiHandler({final:"T"},h=>this.scrollDown(h)),this._parser.registerCsiHandler({final:"X"},h=>this.eraseChars(h)),this._parser.registerCsiHandler({final:"Z"},h=>this.cursorBackwardTab(h)),this._parser.registerCsiHandler({final:"`"},h=>this.charPosAbsolute(h)),this._parser.registerCsiHandler({final:"a"},h=>this.hPositionRelative(h)),this._parser.registerCsiHandler({final:"b"},h=>this.repeatPrecedingCharacter(h)),this._parser.registerCsiHandler({final:"c"},h=>this.sendDeviceAttributesPrimary(h)),this._parser.registerCsiHandler({prefix:">",final:"c"},h=>this.sendDeviceAttributesSecondary(h)),this._parser.registerCsiHandler({final:"d"},h=>this.linePosAbsolute(h)),this._parser.registerCsiHandler({final:"e"},h=>this.vPositionRelative(h)),this._parser.registerCsiHandler({final:"f"},h=>this.hVPosition(h)),this._parser.registerCsiHandler({final:"g"},h=>this.tabClear(h)),this._parser.registerCsiHandler({final:"h"},h=>this.setMode(h)),this._parser.registerCsiHandler({prefix:"?",final:"h"},h=>this.setModePrivate(h)),this._parser.registerCsiHandler({final:"l"},h=>this.resetMode(h)),this._parser.registerCsiHandler({prefix:"?",final:"l"},h=>this.resetModePrivate(h)),this._parser.registerCsiHandler({final:"m"},h=>this.charAttributes(h)),this._parser.registerCsiHandler({final:"n"},h=>this.deviceStatus(h)),this._parser.registerCsiHandler({prefix:"?",final:"n"},h=>this.deviceStatusPrivate(h)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},h=>this.softReset(h)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},h=>this.setCursorStyle(h)),this._parser.registerCsiHandler({final:"r"},h=>this.setScrollRegion(h)),this._parser.registerCsiHandler({final:"s"},h=>this.saveCursor(h)),this._parser.registerCsiHandler({final:"t"},h=>this.windowOptions(h)),this._parser.registerCsiHandler({final:"u"},h=>this.restoreCursor(h)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},h=>this.insertColumns(h)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},h=>this.deleteColumns(h)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},h=>this.selectProtected(h)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},h=>this.requestMode(h,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},h=>this.requestMode(h,!1)),this._parser.setExecuteHandler(de.BEL,()=>this.bell()),this._parser.setExecuteHandler(de.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(de.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(de.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(de.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(de.BS,()=>this.backspace()),this._parser.setExecuteHandler(de.HT,()=>this.tab()),this._parser.setExecuteHandler(de.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(de.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(uu.IND,()=>this.index()),this._parser.setExecuteHandler(uu.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(uu.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new rn(h=>(this.setTitle(h),this.setIconName(h),!0))),this._parser.registerOscHandler(1,new rn(h=>this.setIconName(h))),this._parser.registerOscHandler(2,new rn(h=>this.setTitle(h))),this._parser.registerOscHandler(4,new rn(h=>this.setOrReportIndexedColor(h))),this._parser.registerOscHandler(8,new rn(h=>this.setHyperlink(h))),this._parser.registerOscHandler(10,new rn(h=>this.setOrReportFgColor(h))),this._parser.registerOscHandler(11,new rn(h=>this.setOrReportBgColor(h))),this._parser.registerOscHandler(12,new rn(h=>this.setOrReportCursorColor(h))),this._parser.registerOscHandler(104,new rn(h=>this.restoreIndexedColor(h))),this._parser.registerOscHandler(110,new rn(h=>this.restoreFgColor(h))),this._parser.registerOscHandler(111,new rn(h=>this.restoreBgColor(h))),this._parser.registerOscHandler(112,new rn(h=>this.restoreCursorColor(h))),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 h in ri)this._parser.registerEscHandler({intermediates:"(",final:h},()=>this.selectCharset("("+h)),this._parser.registerEscHandler({intermediates:")",final:h},()=>this.selectCharset(")"+h)),this._parser.registerEscHandler({intermediates:"*",final:h},()=>this.selectCharset("*"+h)),this._parser.registerEscHandler({intermediates:"+",final:h},()=>this.selectCharset("+"+h)),this._parser.registerEscHandler({intermediates:"-",final:h},()=>this.selectCharset("-"+h)),this._parser.registerEscHandler({intermediates:".",final:h},()=>this.selectCharset("."+h)),this._parser.registerEscHandler({intermediates:"/",final:h},()=>this.selectCharset("/"+h));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(h=>(this._logService.error("Parsing error: ",h),h)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new _y((h,_)=>this.requestStatusString(h,_)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,s){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=s}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),xy))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${xy} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,s=this._activeBuffer.x,a=this._activeBuffer.y,o=0,c=this._parseStack.paused;if(c){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;s=this._parseStack.cursorStartX,a=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>ts&&(o=this._parseStack.position+ts)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,h=>String.fromCharCode(h)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(h=>h.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<ts&&(this._parseBuffer=new Uint32Array(Math.min(e.length,ts))),c||this._dirtyRowTracker.clearRange(),e.length>ts)for(let h=o;h<e.length;h+=ts){let _=h+ts<e.length?h+ts:e.length,v=typeof e=="string"?this._stringDecoder.decode(e.substring(h,_),this._parseBuffer):this._utf8Decoder.decode(e.subarray(h,_),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,v))return this._preserveStack(s,a,v,h),this._logSlowResolvingAsync(n),n}else if(!c){let h=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,h))return this._preserveStack(s,a,h,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==s||this._activeBuffer.y!==a)&&this._onCursorMove.fire();let f=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),d=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);d<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(d,this._bufferService.rows-1),end:Math.min(f,this._bufferService.rows-1)})}print(e,t,n){let s,a,o=this._charsetService.charset,c=this._optionsService.rawOptions.screenReaderMode,f=this._bufferService.cols,d=this._coreService.decPrivateModes.wraparound,h=this._coreService.modes.insertMode,_=this._curAttrData,v=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&v.getWidth(this._activeBuffer.x-1)===2&&v.setCellFromCodepoint(this._activeBuffer.x-1,0,1,_);let b=this._parser.precedingJoinState;for(let y=t;y<n;++y){if(s=e[y],s<127&&o){let D=o[String.fromCharCode(s)];D&&(s=D.charCodeAt(0))}let S=this._unicodeService.charProperties(s,b);a=Rs.extractWidth(S);let A=Rs.extractShouldJoin(S),R=A?Rs.extractWidth(b):0;if(b=S,c&&this._onA11yChar.fire(is(s)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+a-R>f){if(d){let D=v,W=this._activeBuffer.x-R;for(this._activeBuffer.x=R,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),v=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),R>0&&v instanceof ro&&v.copyCellsFrom(D,W,0,R,!1);W<f;)D.setCellFromCodepoint(W++,0,1,_)}else if(this._activeBuffer.x=f-1,a===2)continue}if(A&&this._activeBuffer.x){let D=v.getWidth(this._activeBuffer.x-1)?1:2;v.addCodepointToCell(this._activeBuffer.x-D,s,a);for(let W=a-R;--W>=0;)v.setCellFromCodepoint(this._activeBuffer.x++,0,0,_);continue}if(h&&(v.insertCells(this._activeBuffer.x,a-R,this._activeBuffer.getNullCell(_)),v.getWidth(f-1)===2&&v.setCellFromCodepoint(f-1,0,1,_)),v.setCellFromCodepoint(this._activeBuffer.x++,s,a,_),a>0)for(;--a;)v.setCellFromCodepoint(this._activeBuffer.x++,0,0,_)}this._parser.precedingJoinState=b,this._activeBuffer.x<f&&n-t>0&&v.getWidth(this._activeBuffer.x)===0&&!v.hasContent(this._activeBuffer.x)&&v.setCellFromCodepoint(this._activeBuffer.x,0,1,_),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>yy(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new _y(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new rn(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,s=!1,a=!1){let o=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);o.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),a),s&&(o.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){var s;this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!((s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n))!=null&&s.getTrimmedLength()););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let a=this._activeBuffer.lines.length-this._bufferService.rows;a>0&&(this._activeBuffer.lines.trimStart(a),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-a,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-a,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,a=this._bufferService.rows-1+this._activeBuffer.ybase-s+1;for(;t--;)this._activeBuffer.lines.splice(a-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,s;for(s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-s;t--;)this._activeBuffer.lines.splice(n,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}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(Zt));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);s.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);s.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);s.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);s.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,s=Rs.extractWidth(t),a=this._activeBuffer.x-s,o=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(a),c=new Uint32Array(o.length*n),f=0;for(let h=0;h<o.length;){let _=o.codePointAt(h)||0;c[f++]=_,h+=_>65535?2:1}let d=f;for(let h=1;h<n;++h)c.copyWithin(d,0,f),d+=f;return this.print(c,0,d),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(de.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(de.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(de.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(de.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(de.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,Ds),this._charsetService.setgCharset(1,Ds),this._charsetService.setgCharset(2,Ds),this._charsetService.setgCharset(3,Ds);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){(A=>(A[A.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",A[A.SET=1]="SET",A[A.RESET=2]="RESET",A[A.PERMANENTLY_SET=3]="PERMANENTLY_SET",A[A.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(n={}));let s=this._coreService.decPrivateModes,{activeProtocol:a,activeEncoding:o}=this._coreMouseService,c=this._coreService,{buffers:f,cols:d}=this._bufferService,{active:h,alt:_}=f,v=this._optionsService.rawOptions,b=(A,R)=>(c.triggerDataEvent(`${de.ESC}[${t?"":"?"}${A};${R}$y`),!0),y=A=>A?1:2,S=e.params[0];return t?S===2?b(S,4):S===4?b(S,y(c.modes.insertMode)):S===12?b(S,3):S===20?b(S,y(v.convertEol)):b(S,0):S===1?b(S,y(s.applicationCursorKeys)):S===3?b(S,v.windowOptions.setWinLines?d===80?2:d===132?1:0:0):S===6?b(S,y(s.origin)):S===7?b(S,y(s.wraparound)):S===8?b(S,3):S===9?b(S,y(a==="X10")):S===12?b(S,y(v.cursorBlink)):S===25?b(S,y(!c.isCursorHidden)):S===45?b(S,y(s.reverseWraparound)):S===66?b(S,y(s.applicationKeypad)):S===67?b(S,4):S===1e3?b(S,y(a==="VT200")):S===1002?b(S,y(a==="DRAG")):S===1003?b(S,y(a==="ANY")):S===1004?b(S,y(s.sendFocus)):S===1005?b(S,4):S===1006?b(S,y(o==="SGR")):S===1015?b(S,4):S===1016?b(S,y(o==="SGR_PIXELS")):S===1048?b(S,1):S===47||S===1047||S===1049?b(S,y(h===_)):S===2004?b(S,y(s.bracketedPasteMode)):S===2026?b(S,y(s.synchronizedOutput)):b(S,0)}_updateAttrColor(e,t,n,s,a){return t===2?(e|=50331648,e&=-16777216,e|=xo.fromColorRGB([n,s,a])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let s=[0,0,-1,0,0,0],a=0,o=0;do{if(s[o+a]=e.params[t+o],e.hasSubParams(t+o)){let c=e.getSubParams(t+o),f=0;do s[1]===5&&(a=1),s[o+f+1+a]=c[f];while(++f<c.length&&f+o+1+a<s.length);break}if(s[1]===5&&o+a>=2||s[1]===2&&o+a>=5)break;s[1]&&(a=1)}while(++o+t<e.length&&o+a<s.length);for(let c=2;c<s.length;++c)s[c]===-1&&(s[c]=0);switch(s[0]){case 38:n.fg=this._updateAttrColor(n.fg,s[1],s[3],s[4],s[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,s[1],s[3],s[4],s[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,s[1],s[3],s[4],s[5])}return o}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=Zt.fg,e.bg=Zt.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,s=this._curAttrData;for(let a=0;a<t;a++)n=e.params[a],n>=30&&n<=37?(s.fg&=-50331904,s.fg|=16777216|n-30):n>=40&&n<=47?(s.bg&=-50331904,s.bg|=16777216|n-40):n>=90&&n<=97?(s.fg&=-50331904,s.fg|=16777216|n-90|8):n>=100&&n<=107?(s.bg&=-50331904,s.bg|=16777216|n-100|8):n===0?this._processSGR0(s):n===1?s.fg|=134217728:n===3?s.bg|=67108864:n===4?(s.fg|=268435456,this._processUnderline(e.hasSubParams(a)?e.getSubParams(a)[0]:1,s)):n===5?s.fg|=536870912:n===7?s.fg|=67108864:n===8?s.fg|=1073741824:n===9?s.fg|=2147483648:n===2?s.bg|=134217728:n===21?this._processUnderline(2,s):n===22?(s.fg&=-134217729,s.bg&=-134217729):n===23?s.bg&=-67108865:n===24?(s.fg&=-268435457,this._processUnderline(0,s)):n===25?s.fg&=-536870913:n===27?s.fg&=-67108865:n===28?s.fg&=-1073741825:n===29?s.fg&=2147483647:n===39?(s.fg&=-67108864,s.fg|=Zt.fg&16777215):n===49?(s.bg&=-67108864,s.bg|=Zt.bg&16777215):n===38||n===48||n===58?a+=this._extractColor(e,a,s):n===53?s.bg|=1073741824:n===55?s.bg&=-1073741825:n===59?(s.extended=s.extended.clone(),s.extended.underlineColor=-1,s.updateExtended()):n===100?(s.fg&=-67108864,s.fg|=Zt.fg&16777215,s.bg&=-67108864,s.bg|=Zt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${de.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${de.ESC}[${t};${n}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${de.ESC}[?${t};${n}R`);break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=Zt.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let n=t%2===1;this._coreService.decPrivateModes.cursorBlink=n}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!yy(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(`${de.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>by&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>by&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(";");for(;n.length>1;){let s=n.shift(),a=n.shift();if(/^\d+$/.exec(s)){let o=parseInt(s);if(wy(o))if(a==="?")t.push({type:0,index:o});else{let c=vy(a);c&&t.push({type:1,index:o,color:c})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let n=e.slice(0,t).trim(),s=e.slice(t+1);return s?this._createHyperlink(n,s):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),s,a=n.findIndex(o=>o.startsWith("id="));return a!==-1&&(s=n[a].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:s,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(";");for(let s=0;s<n.length&&!(t>=this._specialColors.length);++s,++t)if(n[s]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let a=vy(n[s]);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=[],n=e.split(";");for(let s=0;s<n.length;++s)if(/^\d+$/.exec(n[s])){let a=parseInt(n[s]);wy(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,Ds),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(az[e[0]],ri[e[1]]||Ds),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=Zt.clone(),this._eraseAttrDataInternal=Zt.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new Tn;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,s=this._activeBuffer.lines.get(n);s&&(s.fill(e),s.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=c=>(this._coreService.triggerDataEvent(`${de.ESC}${c}${de.ESC}\\`),!0),s=this._bufferService.buffer,a=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${s.scrollTop+1};${s.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)}},Bp=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&&(Sy=e,e=t,t=Sy),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Bp=It([be(0,Li)],Bp);function wy(e){return 0<=e&&e<256}var cz=5e7,Cy=12,uz=50,hz=class extends Ye{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 _e),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let s=this._callbacks.shift();s&&s()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>cz)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let s=this._writeBuffer[this._bufferOffset],a=this._action(s,t);if(a){let c=f=>performance.now()-n>=Cy?setTimeout(()=>this._innerWrite(0,f)):this._innerWrite(n,f);a.catch(f=>(queueMicrotask(()=>{throw f}),Promise.resolve(!1))).then(c);return}let o=this._callbacks[this._bufferOffset];if(o&&o(),this._bufferOffset++,this._pendingData-=s.length,performance.now()-n>=Cy)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>uz&&(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()}},jp=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),d={data:e,id:this._nextId++,lines:[f]};return f.onDispose(()=>this._removeMarkerFromLink(d,f)),this._dataByLinkId.set(d.id,d),d.id}let n=e,s=this._getEntryIdKey(n),a=this._entriesWithId.get(s);if(a)return this.addLineToLink(a.id,t.ybase+t.y),a.id;let o=t.addMarker(t.ybase+t.y),c={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(c,o)),this._entriesWithId.set(c.key,c),this._dataByLinkId.set(c.id,c),c.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(s=>s.line!==t)){let s=this._bufferService.buffer.addMarker(t);n.lines.push(s),s.onDispose(()=>this._removeMarkerFromLink(n,s))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};jp=It([be(0,Li)],jp);var ky=!1,fz=class extends Ye{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Ol),this._onBinary=this._register(new _e),this.onBinary=this._onBinary.event,this._onData=this._register(new _e),this.onData=this._onData.event,this._onLineFeed=this._register(new _e),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new _e),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new _e),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new _e),this._instantiationService=new B3,this.optionsService=this._register(new Y3(e)),this._instantiationService.setService(Oi,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Mp)),this._instantiationService.setService(Li,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Rp)),this._instantiationService.setService(DS,this._logService),this.coreService=this._register(this._instantiationService.createInstance(zp)),this._instantiationService.setService(Is,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Lp)),this._instantiationService.setService(NS,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Rs)),this._instantiationService.setService(MR,this.unicodeService),this._charsetService=this._instantiationService.createInstance(Z3),this._instantiationService.setService(RR,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(jp),this._instantiationService.setService(RS,this._oscLinkService),this._inputHandler=this._register(new oz(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(xi.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(xi.forward(this._bufferService.onResize,this._onResize)),this._register(xi.forward(this.coreService.onData,this._onData)),this._register(xi.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 hz((t,n)=>this._inputHandler.parse(t,n))),this._register(xi.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new _e),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!ky&&(this._logService.warn("writeSync is unreliable and will be removed soon."),ky=!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,c1),t=Math.max(t,u1),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(gy.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(gy(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Dt(()=>{for(let t of e)t.dispose()})}}},dz={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 pz(e,t,n,s){var c;let a={type:0,cancel:!1,key:void 0},o=(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=de.ESC+"OA":a.key=de.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?a.key=de.ESC+"OD":a.key=de.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?a.key=de.ESC+"OC":a.key=de.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?a.key=de.ESC+"OB":a.key=de.ESC+"[B");break;case 8:a.key=e.ctrlKey?"\b":de.DEL,e.altKey&&(a.key=de.ESC+a.key);break;case 9:if(e.shiftKey){a.key=de.ESC+"[Z";break}a.key=de.HT,a.cancel=!0;break;case 13:a.key=e.altKey?de.ESC+de.CR:de.CR,a.cancel=!0;break;case 27:a.key=de.ESC,e.altKey&&(a.key=de.ESC+de.ESC),a.cancel=!0;break;case 37:if(e.metaKey)break;o?a.key=de.ESC+"[1;"+(o+1)+"D":t?a.key=de.ESC+"OD":a.key=de.ESC+"[D";break;case 39:if(e.metaKey)break;o?a.key=de.ESC+"[1;"+(o+1)+"C":t?a.key=de.ESC+"OC":a.key=de.ESC+"[C";break;case 38:if(e.metaKey)break;o?a.key=de.ESC+"[1;"+(o+1)+"A":t?a.key=de.ESC+"OA":a.key=de.ESC+"[A";break;case 40:if(e.metaKey)break;o?a.key=de.ESC+"[1;"+(o+1)+"B":t?a.key=de.ESC+"OB":a.key=de.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(a.key=de.ESC+"[2~");break;case 46:o?a.key=de.ESC+"[3;"+(o+1)+"~":a.key=de.ESC+"[3~";break;case 36:o?a.key=de.ESC+"[1;"+(o+1)+"H":t?a.key=de.ESC+"OH":a.key=de.ESC+"[H";break;case 35:o?a.key=de.ESC+"[1;"+(o+1)+"F":t?a.key=de.ESC+"OF":a.key=de.ESC+"[F";break;case 33:e.shiftKey?a.type=2:e.ctrlKey?a.key=de.ESC+"[5;"+(o+1)+"~":a.key=de.ESC+"[5~";break;case 34:e.shiftKey?a.type=3:e.ctrlKey?a.key=de.ESC+"[6;"+(o+1)+"~":a.key=de.ESC+"[6~";break;case 112:o?a.key=de.ESC+"[1;"+(o+1)+"P":a.key=de.ESC+"OP";break;case 113:o?a.key=de.ESC+"[1;"+(o+1)+"Q":a.key=de.ESC+"OQ";break;case 114:o?a.key=de.ESC+"[1;"+(o+1)+"R":a.key=de.ESC+"OR";break;case 115:o?a.key=de.ESC+"[1;"+(o+1)+"S":a.key=de.ESC+"OS";break;case 116:o?a.key=de.ESC+"[15;"+(o+1)+"~":a.key=de.ESC+"[15~";break;case 117:o?a.key=de.ESC+"[17;"+(o+1)+"~":a.key=de.ESC+"[17~";break;case 118:o?a.key=de.ESC+"[18;"+(o+1)+"~":a.key=de.ESC+"[18~";break;case 119:o?a.key=de.ESC+"[19;"+(o+1)+"~":a.key=de.ESC+"[19~";break;case 120:o?a.key=de.ESC+"[20;"+(o+1)+"~":a.key=de.ESC+"[20~";break;case 121:o?a.key=de.ESC+"[21;"+(o+1)+"~":a.key=de.ESC+"[21~";break;case 122:o?a.key=de.ESC+"[23;"+(o+1)+"~":a.key=de.ESC+"[23~";break;case 123:o?a.key=de.ESC+"[24;"+(o+1)+"~":a.key=de.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=de.NUL:e.keyCode>=51&&e.keyCode<=55?a.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?a.key=de.DEL:e.keyCode===219?a.key=de.ESC:e.keyCode===220?a.key=de.FS:e.keyCode===221&&(a.key=de.GS);else if((!n||s)&&e.altKey&&!e.metaKey){let f=(c=dz[e.keyCode])==null?void 0:c[e.shiftKey?1:0];if(f)a.key=de.ESC+f;else if(e.keyCode>=65&&e.keyCode<=90){let d=e.ctrlKey?e.keyCode-64:e.keyCode+32,h=String.fromCharCode(d);e.shiftKey&&(h=h.toUpperCase()),a.key=de.ESC+h}else if(e.keyCode===32)a.key=de.ESC+(e.ctrlKey?de.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let d=e.code.slice(3,4);e.shiftKey||(d=d.toLowerCase()),a.key=de.ESC+d,a.cancel=!0}}else n&&!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=de.US),e.key==="@"&&(a.key=de.NUL));break}return a}var Wt=0,mz=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,o)=>this._getKey(a)-this._getKey(o)),t=0,n=0,s=new Array(this._array.length+this._insertedValues.length);for(let a=0;a<s.length;a++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(s[a]=e[t],t++):s[a]=this._array[n++];this._array=s,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||(Wt=this._search(t),Wt===-1)||this._getKey(this._array[Wt])!==t)return!1;do if(this._array[Wt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Wt),!0;while(++Wt<this._array.length&&this._getKey(this._array[Wt])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((a,o)=>a-o),t=0,n=new Array(this._array.length-e.length),s=0;for(let a=0;a<this._array.length;a++)e[t]===a?t++:n[s++]=this._array[a];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Wt=this._search(e),!(Wt<0||Wt>=this._array.length)&&this._getKey(this._array[Wt])===e))do yield this._array[Wt];while(++Wt<this._array.length&&this._getKey(this._array[Wt])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Wt=this._search(e),!(Wt<0||Wt>=this._array.length)&&this._getKey(this._array[Wt])===e))do t(this._array[Wt]);while(++Wt<this._array.length&&this._getKey(this._array[Wt])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let s=t+n>>1,a=this._getKey(this._array[s]);if(a>e)n=s-1;else if(a<e)t=s+1;else{for(;s>0&&this._getKey(this._array[s-1])===e;)s--;return s}}return t}},Bd=0,Ey=0,gz=class extends Ye{constructor(){super(),this._decorations=new mz(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new _e),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new _e),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Dt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new _z(e);if(t){let n=t.marker.onDispose(()=>t.dispose()),s=t.onDispose(()=>{s.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),n.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let s=0,a=0;for(let o of this._decorations.getKeyIterator(t))s=o.options.x??0,a=s+(o.options.width??1),e>=s&&e<a&&(!n||(o.options.layer??"bottom")===n)&&(yield o)}forEachDecorationAtCell(e,t,n,s){this._decorations.forEachByKey(t,a=>{Bd=a.options.x??0,Ey=Bd+(a.options.width??1),e>=Bd&&e<Ey&&(!n||(a.options.layer??"bottom")===n)&&s(a)})}},_z=class extends ss{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new _e),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new _e),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Lt.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Lt.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},vz=1e3,bz=class{constructor(e,t=vz){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let s=performance.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){let a=s-this._lastRefreshMs,o=this._debounceThresholdMS-a;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},o)}}_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)}},Ay=20,Cu=class extends Ye{constructor(e,t,n,s){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=s,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 o=0;o<this._terminal.rows;o++)this._rowElements[o]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[o]);if(this._topBoundaryFocusListener=o=>this._handleBoundaryFocus(o,0),this._bottomBoundaryFocusListener=o=>this._handleBoundaryFocus(o,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 bz(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(o=>this._handleResize(o.rows))),this._register(this._terminal.onRender(o=>this._refreshRows(o.start,o.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(o=>this._handleChar(o))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
`))),this._register(this._terminal.onA11yTab(o=>this._handleTab(o))),this._register(this._terminal.onKey(o=>this._handleKey(o.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Be(a,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Dt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<Ay+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===Ay+1&&(this._liveRegion.textContent+=np.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,s=n.lines.length.toString();for(let a=e;a<=t;a++){let o=n.lines.get(n.ydisp+a),c=[],f=(o==null?void 0:o.translateToString(!0,void 0,void 0,c))||"",d=(n.ydisp+a+1).toString(),h=this._rowElements[a];h&&(f.length===0?(h.textContent=" ",this._rowColumns.set(h,[0,1])):(h.textContent=f,this._rowColumns.set(h,c)),h.setAttribute("aria-posinset",d),h.setAttribute("aria-setsize",s),this._alignRowWidth(h))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let n=e.target,s=this._rowElements[t===0?1:this._rowElements.length-2],a=n.getAttribute("aria-posinset"),o=t===0?"1":`${this._terminal.buffer.lines.length}`;if(a===o||e.relatedTarget!==s)return;let c,f;if(t===0?(c=n,f=this._rowElements.pop(),this._rowContainer.removeChild(f)):(c=this._rowElements.shift(),f=n,this._rowContainer.removeChild(c)),c.removeEventListener("focus",this._topBoundaryFocusListener),f.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let d=this._createAccessibilityTreeNode();this._rowElements.unshift(d),this._rowContainer.insertAdjacentElement("afterbegin",d)}else{let d=this._createAccessibilityTreeNode();this._rowElements.push(d),this._rowContainer.appendChild(d)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var f;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let s=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(s)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:s,offset:((f=s.textContent)==null?void 0:f.length)??0}),!this._rowContainer.contains(n.node))return;let a=({node:d,offset:h})=>{let _=d instanceof Text?d.parentNode:d,v=parseInt(_==null?void 0:_.getAttribute("aria-posinset"),10)-1;if(isNaN(v))return console.warn("row is invalid. Race condition?"),null;let b=this._rowColumns.get(_);if(!b)return console.warn("columns is null. Race condition?"),null;let y=h<b.length?b[h]:b.slice(-1)[0]+1;return y>=this._terminal.cols&&(++v,y=0),{row:v,column:y}},o=a(t),c=a(n);if(!(!o||!c)){if(o.row>c.row||o.row===c.row&&o.column>=c.column)throw new Error("invalid range");this._terminal.select(o.column,o.row,(c.row-o.row)*this._terminal.cols-o.column+c.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var a,o;e.style.transform="";let t=e.getBoundingClientRect().width,n=(o=(a=this._rowColumns.get(e))==null?void 0:a.slice(-1))==null?void 0:o[0];if(!n)return;let s=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${s/t})`}};Cu=It([be(1,hm),be(2,wr),be(3,Cr)],Cu);var Hp=class extends Ye{constructor(e,t,n,s,a){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=s,this._linkProviderService=a,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new _e),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new _e),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Dt(()=>{var o;Os(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(o=this._activeProviderReplies)==null||o.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Be(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Be(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Be(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Be(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let s=0;s<n.length;s++){let a=n[s];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){var s,a;(!this._activeProviderReplies||!t)&&((s=this._activeProviderReplies)==null||s.forEach(o=>{o==null||o.forEach(c=>{c.link.dispose&&c.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[o,c]of this._linkProviderService.linkProviders.entries())t?(a=this._activeProviderReplies)!=null&&a.get(o)&&(n=this._checkLinkProviderResult(o,e,n)):c.provideLinks(e.y,f=>{var h,_;if(this._isMouseOut)return;let d=f==null?void 0:f.map(v=>({link:v}));(h=this._activeProviderReplies)==null||h.set(o,d),n=this._checkLinkProviderResult(o,e,n),((_=this._activeProviderReplies)==null?void 0:_.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let s=0;s<t.size;s++){let a=t.get(s);if(a)for(let o=0;o<a.length;o++){let c=a[o],f=c.link.range.start.y<e?0:c.link.range.start.x,d=c.link.range.end.y>e?this._bufferService.cols:c.link.range.end.x;for(let h=f;h<=d;h++){if(n.has(h)){a.splice(o--,1);break}n.add(h)}}}}_checkLinkProviderResult(e,t,n){var o;if(!this._activeProviderReplies)return n;let s=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&&s){let c=s.find(f=>this._linkAtPosition(f.link,t));c&&(n=!0,this._handleNewLink(c))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let c=0;c<this._activeProviderReplies.size;c++){let f=(o=this._activeProviderReplies.get(c))==null?void 0:o.find(d=>this._linkAtPosition(d.link,t));if(f){n=!0,this._handleNewLink(f);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&yz(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,Os(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var n,s;return(s=(n=this._currentLink)==null?void 0:n.state)==null?void 0:s.decorations.pointerCursor},set:n=>{var s;(s=this._currentLink)!=null&&s.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>{var n,s;return(s=(n=this._currentLink)==null?void 0:n.state)==null?void 0:s.decorations.underline},set:n=>{var s,a,o;(s=this._currentLink)!=null&&s.state&&((o=(a=this._currentLink)==null?void 0:a.state)==null?void 0:o.decorations.underline)!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let s=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,a=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=a&&(this._clearCurrentLink(s,a),this._lastMouseEvent)){let o=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);o&&this._askForLink(o,!1)}})))}_linkHover(e,t,n){var s;(s=this._currentLink)!=null&&s.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,s=this._bufferService.buffer.ydisp,a=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-s-1,n.end.x,n.end.y-s-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(a)}_linkLeave(e,t,n){var s;(s=this._currentLink)!=null&&s.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,s=e.range.end.y*this._bufferService.cols+e.range.end.x,a=t.y*this._bufferService.cols+t.x;return n<=a&&a<=s}_positionFromMouseEvent(e,t,n){let s=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(s)return{x:s[0],y:s[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,s,a){return{x1:e,y1:t,x2:n,y2:s,cols:this._bufferService.cols,fg:a}}};Hp=It([be(1,fm),be(2,Cr),be(3,Li),be(4,zS)],Hp);function yz(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 xz=class extends fz{constructor(e={}){super(e),this._linkifier=this._register(new Ol),this.browser=QS,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Ol),this._onCursorMove=this._register(new _e),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new _e),this.onKey=this._onKey.event,this._onRender=this._register(new _e),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new _e),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new _e),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new _e),this.onBell=this._onBell.event,this._onFocus=this._register(new _e),this._onBlur=this._register(new _e),this._onA11yCharEmitter=this._register(new _e),this._onA11yTabEmitter=this._register(new _e),this._onWillOpen=this._register(new _e),this._setup(),this._decorationService=this._instantiationService.createInstance(gz),this._instantiationService.setService(So,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(u3),this._instantiationService.setService(zS,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(sp)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh((t==null?void 0:t.start)??0,(t==null?void 0:t.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(xi.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(xi.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(xi.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(xi.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(Dt(()=>{var t,n;this._customKeyEventHandler=void 0,(n=(t=this.element)==null?void 0:t.parentNode)==null||n.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let n,s="";switch(t.index){case 256:n="foreground",s="10";break;case 257:n="background",s="11";break;case 258:n="cursor",s="12";break;default:n="ansi",s="4;"+t.index}switch(t.type){case 0:let a=kt.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${de.ESC}]${s};${lz(a)}${XS.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(o=>o.ansi[t.index]=Qt.toColor(...t.color));else{let o=n;this._themeService.modifyColors(c=>c[o]=Qt.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Cu,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(de.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(de.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),s=this._renderService.dimensions.css.cell.height,a=t.getWidth(n),o=this._renderService.dimensions.css.cell.width*a,c=this.buffer.y*this._renderService.dimensions.css.cell.height,f=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=f+"px",this.textarea.style.top=c+"px",this.textarea.style.width=o+"px",this.textarea.style.height=s+"px",this.textarea.style.lineHeight=s+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Be(this.element,"copy",t=>{this.hasSelection()&&kR(t,this._selectionService)}));let e=t=>ER(t,this.textarea,this.coreService,this.optionsService);this._register(Be(this.textarea,"paste",e)),this._register(Be(this.element,"paste",e)),JS?this._register(Be(this.element,"mousedown",t=>{t.button===2&&jb(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Be(this.element,"contextmenu",t=>{jb(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),ym&&this._register(Be(this.element,"auxclick",t=>{t.button===1&&CS(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Be(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Be(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Be(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Be(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Be(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Be(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Be(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var a;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"),((a=this.element)==null?void 0:a.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(Be(this.screenElement,"mousemove",o=>this.updateCursorStyle(o))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",ip.get()),i1||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(o3,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(wr,this._coreBrowserService),this._register(Be(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(Be(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Ep,this._document,this._helperContainer),this._instantiationService.setService(Mu,this._charSizeService),this._themeService=this._instantiationService.createInstance(Dp),this._instantiationService.setService(Il,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(xu),this._instantiationService.setService(MS,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Tp,this.rows,this.screenElement)),this._instantiationService.setService(Cr,this._renderService),this._register(this._renderService.onRenderedViewportChange(o=>this._onRender.fire(o))),this.onResize(o=>this._renderService.resize(o.cols,o.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(wp,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Ap),this._instantiationService.setService(fm,this._mouseService);let s=this._linkifier.value=this._register(this._instantiationService.createInstance(Hp,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(xp,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(o=>{super.scrollLines(o,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Np,this.element,this.screenElement,s)),this._instantiationService.setService(LR,this._selectionService),this._register(this._selectionService.onRequestScrollLines(o=>this.scrollLines(o.amount,o.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(o=>this._renderService.handleSelectionChanged(o.start,o.end,o.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(o=>{this.textarea.value=o,this.textarea.focus(),this.textarea.select()})),this._register(xi.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var o;this._selectionService.refresh(),(o=this._viewport)==null||o.queueSync()})),this._register(this._instantiationService.createInstance(Sp,this.screenElement)),this._register(Be(this.element,"mousedown",o=>this._selectionService.handleMouseDown(o))),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",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(yu,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(yu,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(kp,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(o){var h,_,v,b,y;let c=e._mouseService.getMouseReportCoords(o,e.screenElement);if(!c)return!1;let f,d;switch(o.overrideType||o.type){case"mousemove":d=32,o.buttons===void 0?(f=3,o.button!==void 0&&(f=o.button<3?o.button:3)):f=o.buttons&1?0:o.buttons&4?1:o.buttons&2?2:3;break;case"mouseup":d=0,f=o.button<3?o.button:3;break;case"mousedown":d=1,f=o.button<3?o.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(o)===!1)return!1;let S=o.deltaY;if(S===0||e.coreMouseService.consumeWheelEvent(o,(b=(v=(_=(h=e._renderService)==null?void 0:h.dimensions)==null?void 0:_.device)==null?void 0:v.cell)==null?void 0:b.height,(y=e._coreBrowserService)==null?void 0:y.dpr)===0)return!1;d=S<0?0:1,f=4;break;default:return!1}return d===void 0||f===void 0||f>4?!1:e.coreMouseService.triggerMouseEvent({col:c.col,row:c.row,x:c.x,y:c.y,button:f,action:d,ctrl:o.ctrlKey,alt:o.altKey,shift:o.shiftKey})}let s={mouseup:null,wheel:null,mousedrag:null,mousemove:null},a={mouseup:o=>(n(o),o.buttons||(this._document.removeEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.removeEventListener("mousemove",s.mousedrag)),this.cancel(o)),wheel:o=>(n(o),this.cancel(o,!0)),mousedrag:o=>{o.buttons&&n(o)},mousemove:o=>{o.buttons||n(o)}};this._register(this.coreMouseService.onProtocolChange(o=>{o?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(o)),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()),o&8?s.mousemove||(t.addEventListener("mousemove",a.mousemove),s.mousemove=a.mousemove):(t.removeEventListener("mousemove",s.mousemove),s.mousemove=null),o&16?s.wheel||(t.addEventListener("wheel",a.wheel,{passive:!1}),s.wheel=a.wheel):(t.removeEventListener("wheel",s.wheel),s.wheel=null),o&2?s.mouseup||(s.mouseup=a.mouseup):(this._document.removeEventListener("mouseup",s.mouseup),s.mouseup=null),o&4?s.mousedrag||(s.mousedrag=a.mousedrag):(this._document.removeEventListener("mousemove",s.mousedrag),s.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Be(t,"mousedown",o=>{if(o.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(o)))return n(o),s.mouseup&&this._document.addEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.addEventListener("mousemove",s.mousedrag),this.cancel(o)})),this._register(Be(t,"wheel",o=>{var c,f,d,h,_;if(!s.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(o)===!1)return!1;if(!this.buffer.hasScrollback){if(o.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(o,(h=(d=(f=(c=e._renderService)==null?void 0:c.dimensions)==null?void 0:f.device)==null?void 0:d.cell)==null?void 0:h.height,(_=e._coreBrowserService)==null?void 0:_.dpr)===0)return this.cancel(o,!0);let v=de.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(o.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(v,!0),this.cancel(o,!0)}}},{passive:!1}))}refresh(e,t){var n;(n=this._renderService)==null||n.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){wS(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var n;(n=this._selectionService)==null||n.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let n=pz(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let s=this.rows-1;return this.scrollLines(n.type===2?-s:s),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===de.ETX||n.key===de.CR)&&(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(Sz(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){var n;(n=this._charSizeService)==null||n.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(Zt));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var t;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(t=this._selectionService)==null||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(de.ESC+"[I"):this.coreService.triggerDataEvent(de.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${de.ESC}[4;${n};${t}t`);break;case 1:let s=this._renderService.dimensions.css.cell.width.toFixed(0),a=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${de.ESC}[6;${a};${s}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function Sz(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var wz=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},Cz=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 Tn)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},Ty=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 Cz(t)}getNullCell(){return new Tn}},kz=class extends Ye{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new _e),this.onBufferChange=this._onBufferChange.event,this._normal=new Ty(this._core.buffers.normal,"normal"),this._alternate=new Ty(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)}},Ez=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,n=>t(n.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(n,s)=>t(n,s.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)}},Az=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}},Tz=["cols","rows"],Wn=0,Nz=class extends Ye{constructor(e){super(),this._core=this._register(new xz(e)),this._addonManager=this._register(new wz),this._publicOptions={...this._core.options};let t=s=>this._core.options[s],n=(s,a)=>{this._checkReadonlyOptions(s),this._core.options[s]=a};for(let s in this._core.options){let a={get:t.bind(this,s),set:n.bind(this,s)};Object.defineProperty(this._publicOptions,s,a)}}_checkReadonlyOptions(e){if(Tz.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 Ez(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new Az(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 kz(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
`,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 ip.get()},set promptLabel(e){ip.set(e)},get tooMuchOutput(){return np.get()},set tooMuchOutput(e){np.set(e)}}}_verifyIntegers(...e){for(Wn of e)if(Wn===1/0||isNaN(Wn)||Wn%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Wn of e)if(Wn&&(Wn===1/0||isNaN(Wn)||Wn%1!==0||Wn<0))throw new Error("This API only accepts positive integers")}};function Dz({sessionId:e,containerRef:t,autoScroll:n=!0}){const s=N.useRef(null),a=N.useRef(null),o=N.useRef(null),c=N.useRef(null),f=N.useRef(null),[d,h]=N.useState(!0),_=N.useCallback(()=>{var y;(y=a.current)==null||y.fit()},[]);N.useEffect(()=>{if(!e||!t.current)return;const y=t.current,S=new Nz({fontSize:13,fontFamily:"'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace",theme:{background:"#09090b",foreground:"#fafafa",cursor:"#a1a1aa",selectionBackground:"#3f3f46"},cursorBlink:!0}),A=new yR;S.loadAddon(A),S.open(y),A.fit(),s.current=S,a.current=A;const{ws:R,send:D}=jC(e,L=>{S.write(L)});o.current=D;const W=S.onData(L=>{D(new TextEncoder().encode(L))});c.current=W;const j=S.onBinary(L=>{const te=new Uint8Array(L.length);for(let X=0;X<L.length;X++)te[X]=L.charCodeAt(X);D(te.buffer)});f.current=j;const I=S.onResize(({cols:L,rows:te})=>{D(JSON.stringify({type:"resize",rows:te,cols:L}))}),J=new ResizeObserver(()=>{A.fit()});return J.observe(y),()=>{J.disconnect(),W.dispose(),j.dispose(),I.dispose(),c.current=null,f.current=null,R.close(),S.dispose(),s.current=null,a.current=null,o.current=null}},[e,t]);const v=N.useCallback(y=>{var R;const S=s.current,A=o.current;!S||!A||(y&&!c.current?(c.current=S.onData(D=>{A(new TextEncoder().encode(D))}),f.current=S.onBinary(D=>{const W=new Uint8Array(D.length);for(let j=0;j<D.length;j++)W[j]=D.charCodeAt(j);A(W.buffer)}),S.focus()):!y&&c.current&&(c.current.dispose(),c.current=null,(R=f.current)==null||R.dispose(),f.current=null,S.blur()),h(y))},[]);N.useEffect(()=>{const y=s.current;if(y&&n){y.scrollToBottom();const S=y.onWriteParsed(()=>{y.scrollToBottom()});return()=>S.dispose()}},[n]);const b=N.useCallback(y=>{var S;(S=o.current)==null||S.call(o,new TextEncoder().encode(y))},[]);return{terminal:s,fit:_,writeText:b,setAttachable:v,attached:d}}function Ny({sessionId:e}){const t=N.useRef(null),[n,s]=N.useState(!0),[a,o]=N.useState(!0),{setAttachable:c}=Dz({sessionId:e,containerRef:t,autoScroll:a}),f=N.useCallback(()=>{s(!0),c(!0)},[c]),d=N.useCallback(()=>{s(!1),c(!1)},[c]);return g.jsxs("section",{className:"relative flex h-full w-full flex-col",children:[g.jsx("div",{className:"flex items-center justify-between border-b border-zinc-800 px-3 py-1.5",children:g.jsx("span",{className:"text-xs text-zinc-500",children:e.slice(0,8)})}),g.jsx("div",{ref:t,className:"flex-1 overflow-hidden bg-[#09090b] p-1",onMouseDown:()=>{n&&d()},onMouseUp:()=>{if(!n){const h=window.getSelection();(!h||h.toString().length===0)&&f()}}}),g.jsxs("div",{className:"flex items-center gap-2 border-t border-white/5 px-3 py-1",children:[g.jsx("button",{type:"button",onMouseDown:h=>h.preventDefault(),onClick:n?d:f,className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${n?"bg-cyan-500/20 text-cyan-400":"bg-amber-500/20 text-amber-400"}`,title:n?"Input mode — keystrokes sent to agent (click for select mode)":"Select mode — click to copy text (click for input mode)",children:n?"⌨ Input":"📋 Select"}),g.jsx("button",{type:"button",onMouseDown:h=>h.preventDefault(),onClick:()=>o(h=>!h),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${a?"bg-cyan-500/15 text-cyan-400":"bg-white/5 text-zinc-600 hover:text-zinc-400"}`,title:a?"Auto-scroll: ON":"Auto-scroll: OFF",children:a?"⇩ Auto":"⇩ Off"}),g.jsx("div",{className:"flex-1"}),g.jsx("span",{className:"text-[10px] text-zinc-600",children:n?"click to select":"click ⌨ to input"})]})]})}function Dy(e){return e>=80?"text-red-400":e>=50?"text-amber-400":"text-cyan-400"}function Rz(e){return e>=80?"from-red-500 to-red-400":e>=50?"from-amber-500 to-amber-400":"from-cyan-500 to-blue-500"}function Mz(e){if(!e)return"Never";const t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);return n<1?"Just now":n<60?`${n}m ago`:`${Math.floor(n/60)}h ago`}function zz(){const[e,t]=N.useState(null),[n,s]=N.useState(!1),[a,o]=N.useState(!1);N.useEffect(()=>{we.getUsage().then(t).catch(console.error)},[]),N.useEffect(()=>{const{unlisten:d}=Wp({onEvent:(h,_)=>{h==="usage"&&(t(_),o(!1))}});return d},[]);const c=N.useCallback(()=>{o(!0),we.fetchUsage().catch(()=>o(!1))},[]),f=e&&e.meters.length>0;return g.jsxs("div",{className:"border-t border-white/5",children:[g.jsxs("button",{type:"button",onClick:()=>s(d=>!d),className:"flex w-full items-center gap-2 px-4 py-2 text-left transition-colors hover:bg-white/5",children:[g.jsx("span",{className:"text-[10px] font-semibold tracking-wider text-zinc-500",children:"USAGE"}),!n&&f&&g.jsx("div",{className:"flex flex-1 items-center gap-2",children:e.meters.slice(0,2).map(d=>g.jsxs("span",{className:`text-[11px] font-medium ${Dy(d.percent)}`,children:[d.percent,"%"]},d.label))}),!n&&!f&&g.jsx("span",{className:"flex-1 text-[11px] text-zinc-600",children:"—"}),g.jsx("button",{type:"button",onClick:d=>{d.stopPropagation(),c()},className:`text-xs text-zinc-500 transition-colors hover:text-zinc-300 ${a?"animate-spin":""}`,children:"↻"})]}),n&&g.jsxs("div",{className:"px-4 pb-3 space-y-3",children:[f?g.jsxs(g.Fragment,{children:[e.meters.map(d=>g.jsxs("div",{className:"space-y-1",children:[g.jsxs("div",{className:"flex items-baseline justify-between",children:[g.jsx("span",{className:"text-[11px] text-zinc-400",children:d.label}),g.jsxs("span",{className:`text-[11px] font-medium ${Dy(d.percent)}`,children:[d.percent,"%"]})]}),g.jsx("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-white/5",children:g.jsx("div",{className:`h-full rounded-full bg-gradient-to-r ${Rz(d.percent)} transition-all duration-500`,style:{width:`${Math.min(d.percent,100)}%`}})}),(d.reset_info||d.spending)&&g.jsxs("p",{className:"text-[10px] text-zinc-600",children:[d.spending&&g.jsx("span",{children:d.spending}),d.spending&&d.reset_info&&g.jsx("span",{children:" · "}),d.reset_info&&g.jsx("span",{children:d.reset_info})]})]},d.label)),g.jsxs("p",{className:"text-[10px] text-zinc-600",children:["Updated ",Mz(e.fetched_at)]})]}):g.jsx("p",{className:"text-[11px] text-zinc-600",children:a?"Fetching usage...":"Click ↻ to fetch usage data"}),(e==null?void 0:e.error)&&g.jsx("p",{className:"text-[10px] text-red-400/70",children:e.error})]})]})}function Ip(e){const t=[];for(const n of e.split(/[/\-_]/)){const s=parseInt(n,10);!Number.isNaN(s)&&s>0&&s<1e5&&t.push(s)}return t}function Lz(e){const t=e.title.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,50);return t?`${e.number}-${t}`:`${e.number}`}function Oz(e){const t=[],n=/(?:fix(?:es)?|close[sd]?|resolve[sd]?)\s*#(\d+)/gi;for(const a of e.matchAll(n)){const o=parseInt(a[1],10);o>0&&o<1e5&&t.push(o)}const s=/#(\d+)/g;for(const a of e.matchAll(s)){const o=parseInt(a[1],10);o>0&&o<1e5&&!t.includes(o)&&t.push(o)}return t}function Ry({baseBranch:e,depth:t,depthWarning:n,projectPath:s,onCreated:a,onCancel:o}){const[c,f]=N.useState(""),[d,h]=N.useState(""),[_,v]=N.useState(!1),b=N.useRef(null);N.useEffect(()=>{var S;(S=b.current)==null||S.focus()},[]);const y=N.useCallback(async()=>{const S=c.trim();if(!(!S||_)){if(!/^[a-zA-Z0-9_-]+$/.test(S)||S.length>64){h("a-z, 0-9, -, _ only (max 64)");return}v(!0);try{await we.spawnWorktree({name:S,cwd:s,base_branch:e}),a()}catch(A){h(A instanceof Error?A.message:"Failed to create worktree")}finally{v(!1)}}},[c,_,s,e,a]);return g.jsxs("div",{className:"rounded-lg border border-emerald-500/20 bg-emerald-500/5 p-2",children:[g.jsxs("div",{className:"mb-1 text-[11px] text-zinc-500",children:["from: ",g.jsx("span",{className:"text-emerald-400",children:e})]}),t+1>=n&&g.jsxs("div",{className:"mb-2 rounded bg-amber-500/10 px-2 py-1.5 text-[11px] text-amber-400",children:["This will be ",t+1," levels deep from main. Consider merging the parent branch first."]}),g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx("input",{ref:b,type:"text",value:c,onChange:S=>{f(S.target.value),h("")},onKeyDown:S=>{S.key==="Enter"&&y(),S.key==="Escape"&&o()},placeholder:"worktree name",className:"flex-1 rounded bg-black/30 px-2 py-1 text-xs text-zinc-200 placeholder-zinc-600 outline-none ring-1 ring-emerald-500/30 focus:ring-emerald-500/60"}),g.jsx("button",{type:"button",onClick:y,disabled:!c.trim()||_,className:"rounded px-2 py-1 text-xs text-emerald-400 hover:bg-emerald-500/10 disabled:opacity-30",children:"Go"})]}),d&&g.jsx("span",{className:"text-[10px] text-red-400",children:d})]})}function My({activeNode:e,branches:t,projectPath:n,nodeDepth:s,branchDepthWarning:a,prInfo:o,targetPrs:c,issues:f,onRefresh:d,onSelectNode:h,onFocusAgent:_,onOpenDetail:v,issueMode:b,selectedIssue:y,defaultBranch:S,worktrees:A,onStartWorkDone:R,onSelectWorktreeBranch:D}){const[W,j]=N.useState(!1),[I,J]=N.useState(null),[L,te]=N.useState(!1),[X,pe]=N.useState(!1),[G,K]=N.useState(!0),[V,z]=N.useState(!1),[P,$]=N.useState(null),[C,B]=N.useState(!1),[U,ce]=N.useState(!1),[w,T]=N.useState(!1),[q,k]=N.useState(null),[ie,ue]=N.useState(""),[le,ve]=N.useState(!1),[Ee,oe]=N.useState(null),Ie=N.useRef(null);N.useEffect(()=>{j(!1),J(null),te(!1),pe(!1),K(!0),z(!1)},[e.name]),N.useEffect(()=>{$(null),ce(!1),e.name&&(B(!0),we.listChecks(n,e.name).then(M=>{$(M),M&&M.rollup==="FAILURE"&&ce(!0)}).catch(()=>$(null)).finally(()=>B(!1)))},[e.name,n]),N.useEffect(()=>{y&&(ue(Lz(y)),oe(null),ve(!1),setTimeout(()=>{var M;return(M=Ie.current)==null?void 0:M.focus()},50))},[y]),N.useEffect(()=>{if(k(null),e.isMain||e.diffSummary)return;const M=e.parent??(t==null?void 0:t.default_branch)??"main";we.gitDiffStat(n,e.name,M).then(re=>k(re)).catch(()=>k(null))},[e.name,e.isMain,e.diffSummary,e.parent,t==null?void 0:t.default_branch,n]);const ot=N.useCallback(()=>{const M=e.parent??(t==null?void 0:t.current_branch)??(t==null?void 0:t.default_branch)??"main";h(M)},[e.parent,t,h]),yt=N.useCallback(async()=>{if(!(!e.worktree||W)){j(!0),J(null);try{await we.launchWorktreeAgent(e.worktree.repo_path,e.worktree.name)}catch(M){J(M instanceof Error?M.message:"Failed to launch agent")}finally{j(!1)}}},[e.worktree,W]),se=N.useCallback(async()=>{if(!(!e.worktree||W)){j(!0),J(null);try{await we.deleteWorktree(e.worktree.repo_path,e.worktree.name,X),ot(),d()}catch(M){J(M instanceof Error?M.message:"Failed to delete worktree")}finally{j(!1)}}},[e.worktree,W,X,ot,d]),Oe=N.useCallback(async()=>{if(!W){j(!0),J(null);try{await we.deleteBranch(n,e.name,X,G),ot(),d()}catch(M){J(M instanceof Error?M.message:"Failed to delete branch")}finally{j(!1)}}},[W,n,e.name,X,G,ot,d]),nt=N.useCallback(async()=>{if(!W){j(!0),J(null);try{const M=e.name.includes("/")?e.name.split("/").slice(1).join("/"):e.name;await we.checkoutBranch(n,M),d(),h(M)}catch(M){J(M instanceof Error?M.message:"Failed to checkout branch")}finally{j(!1)}}},[W,n,e.name,d,h]),Je=e.parent??(t==null?void 0:t.default_branch)??"main",fi=Vy(),gt=e.hasAgent,Rt=async(M,re)=>{gt&&!await fi({title:"Agent Active",message:`An agent is already active here. ${M} anyway?`,confirmLabel:M,variant:"danger"})||re()},Ot=N.useCallback(async M=>{if(!W){j(!0),J(null);try{await we.spawnPty({command:"claude",args:[M],cwd:n})}catch(re){J(re instanceof Error?re.message:"Failed to launch agent")}finally{j(!1)}}},[W,n]),Vi=N.useCallback(()=>{z(!1),d()},[d]),on=N.useCallback(()=>{z(!1)},[]),Bn=N.useCallback(async()=>{if(!P||w)return;const M=P.checks.filter(re=>re.conclusion==="failure"&&re.run_id!=null).map(re=>re.run_id);if(M.length!==0){T(!0);try{await Promise.all(M.map(re=>we.rerunFailedChecks(n,re))),setTimeout(()=>{we.listChecks(n,e.name).then(re=>{$(re),re&&re.rollup==="FAILURE"&&ce(!0)}).catch(()=>{})},2e3)}catch{J("Failed to re-run checks")}finally{T(!1)}}},[P,w,n,e.name]),St=N.useCallback(async()=>{if(!y||le||!ie.trim())return;const M=ie.trim();if(!/^[a-zA-Z0-9_-]+$/.test(M)||M.length>64){oe("a-z, 0-9, -, _ only (max 64)");return}ve(!0),oe(null);try{const re=S??"main";await we.spawnWorktree({name:M,cwd:n,base_branch:re});try{await we.launchWorktreeAgent(n,M)}catch{}R==null||R(M)}catch(re){oe(re instanceof Error?re.message:"Failed to create worktree")}finally{ve(!1)}},[y,le,ie,S,n,R]),ze=(()=>{if(!y||!A)return null;for(const M of A){if(M.is_main)continue;const re=M.branch??M.name;if(Ip(re).includes(y.number))return M}return null})();return b?g.jsx("div",{className:"w-80 shrink-0 overflow-y-auto border-l border-white/5 bg-black/20",children:g.jsx("div",{className:"p-4",children:y?g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"mb-4",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsxs("span",{className:"text-lg font-semibold text-green-400",children:["#",y.number]}),g.jsx("a",{href:y.url,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] text-zinc-500 hover:text-zinc-300",children:"open in GitHub"})]}),g.jsx("h3",{className:"mt-1 text-sm font-medium text-zinc-100",children:y.title}),y.labels.length>0&&g.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:y.labels.map(M=>g.jsx("span",{className:"rounded-full px-1.5 py-0.5 text-[10px]",style:{backgroundColor:`#${M.color}22`,color:`#${M.color}`},children:M.name},M.name))}),y.assignees.length>0&&g.jsxs("div",{className:"mt-2 text-[11px] text-zinc-500",children:["Assigned: ",y.assignees.join(", ")]})]}),ze?g.jsxs("div",{className:"rounded-lg border border-cyan-500/20 bg-cyan-500/5 p-3",children:[g.jsx("div",{className:"mb-2 text-[11px] font-medium text-cyan-400",children:ze.agent_status==="in-progress"||ze.agent_status==="waiting"?"Agent In Progress":"Worktree Exists"}),g.jsxs("div",{className:"mb-1 text-[11px] text-zinc-400",children:[g.jsx("span",{className:"text-zinc-500",children:"branch:"})," ",g.jsx("span",{className:"text-cyan-400",children:ze.branch??ze.name})]}),ze.agent_target&&g.jsxs("div",{className:"mb-1 text-[11px] text-zinc-400",children:[g.jsx("span",{className:"text-zinc-500",children:"agent:"})," ",g.jsx("span",{className:"text-cyan-400",children:ze.agent_target})]}),ze.agent_status&&g.jsxs("div",{className:"mb-2 text-[11px] text-zinc-400",children:[g.jsx("span",{className:"text-zinc-500",children:"status:"})," ",g.jsx("span",{className:ze.agent_status==="in-progress"||ze.agent_status==="waiting"?"text-cyan-400":"text-amber-400",children:ze.agent_status})]}),g.jsx("button",{type:"button",onClick:()=>{const M=ze.branch??ze.name;D==null||D(M)},className:"mt-1 w-full rounded-lg bg-cyan-500/20 px-3 py-2 text-xs font-medium text-cyan-400 transition-colors hover:bg-cyan-500/30",children:"Go to Worktree"})]}):g.jsxs("div",{className:"rounded-lg border border-emerald-500/20 bg-emerald-500/5 p-3",children:[g.jsx("div",{className:"mb-2 text-[11px] font-medium text-emerald-400",children:"Start Work"}),g.jsxs("div",{className:"mb-1.5 text-[11px] text-zinc-500",children:["base: ",g.jsx("span",{className:"text-emerald-400",children:S??"main"})]}),g.jsx("div",{className:"flex items-center gap-1",children:g.jsx("input",{ref:Ie,type:"text",value:ie,onChange:M=>{ue(M.target.value),oe(null)},onKeyDown:M=>{M.key==="Enter"&&St()},placeholder:"worktree name",className:"flex-1 rounded bg-black/30 px-2 py-1.5 text-xs text-zinc-200 placeholder-zinc-600 outline-none ring-1 ring-emerald-500/30 focus:ring-emerald-500/60"})}),g.jsx("div",{className:"mt-1 text-[10px] text-zinc-600",children:"Creates worktree + launches agent"}),Ee&&g.jsx("div",{className:"mt-1 text-[10px] text-red-400",children:Ee}),g.jsx("button",{type:"button",onClick:St,disabled:!ie.trim()||le,className:"mt-2 w-full rounded-lg bg-emerald-500/20 px-3 py-2 text-xs font-medium text-emerald-400 transition-colors hover:bg-emerald-500/30 disabled:opacity-40",children:le?"Creating...":"Create & Launch Agent"})]})]}):g.jsx("div",{className:"text-sm text-zinc-500",children:"Select an issue to start work"})})}):g.jsx("div",{className:"w-80 shrink-0 overflow-y-auto border-l border-white/5 bg-black/20",children:g.jsxs("div",{className:"p-4",children:[g.jsxs("div",{className:"mb-4",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[e.isWorktree&&g.jsx("span",{className:"text-sm",children:"🌿"}),g.jsx("h3",{className:"text-sm font-semibold text-zinc-100",children:e.name})]}),g.jsxs("div",{className:"mt-1 flex flex-wrap gap-2 text-[11px]",children:[e.isMain&&g.jsx("span",{className:"rounded bg-emerald-500/15 px-1.5 py-0.5 text-emerald-400",children:"default"}),e.isWorktree&&g.jsx("span",{className:"rounded bg-emerald-500/15 px-1.5 py-0.5 text-emerald-400",children:"worktree"}),e.isCurrent&&g.jsx("span",{className:"rounded bg-cyan-500/15 px-1.5 py-0.5 text-cyan-400",children:"HEAD"}),e.hasAgent&&g.jsx("span",{className:"rounded bg-cyan-500/15 px-1.5 py-0.5 text-cyan-400",children:e.agentStatus||"active"}),e.isDirty&&g.jsx("span",{className:"rounded bg-amber-500/15 px-1.5 py-0.5 text-amber-400",children:"modified"})]}),(()=>{const M=e.diffSummary??q;return M?g.jsxs("div",{className:"mt-2 text-xs text-zinc-500",children:[g.jsxs("span",{className:"text-emerald-400",children:["+",M.insertions]})," ",g.jsxs("span",{className:"text-red-400",children:["-",M.deletions]})," · ",M.files_changed," file",M.files_changed!==1?"s":""]}):null})(),e.remote?g.jsxs("div",{className:"mt-2 rounded bg-white/[0.03] px-2 py-1.5 text-[11px]",children:[g.jsxs("div",{className:"flex items-center gap-1.5 text-zinc-500",children:[g.jsx("span",{className:"text-zinc-600",children:"remote:"}),g.jsx("span",{className:"font-mono text-zinc-400",children:e.remote.remote_branch})]}),g.jsx("div",{className:"mt-0.5 flex items-center gap-2",children:e.remote.ahead===0&&e.remote.behind===0?g.jsx("span",{className:"text-zinc-500",children:"= up to date"}):g.jsxs(g.Fragment,{children:[e.remote.ahead>0&&g.jsxs("span",{className:"text-amber-400",children:[e.remote.ahead," to push"]}),e.remote.behind>0&&g.jsxs("span",{className:"text-cyan-400",children:[e.remote.behind," to pull"]})]})})]}):g.jsx("div",{className:"mt-2 text-[11px] text-zinc-600",children:"no remote tracking"}),o&&g.jsxs("div",{className:"mt-2 rounded bg-white/[0.03] px-2 py-1.5 text-[11px]",children:[g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsxs("a",{href:o.url,target:"_blank",rel:"noopener noreferrer",className:"font-medium text-green-400 hover:underline",children:["PR #",o.number]}),o.is_draft&&g.jsx("span",{className:"rounded bg-zinc-500/15 px-1 py-0.5 text-[10px] text-zinc-500",children:"draft"})]}),g.jsx("div",{className:"mt-0.5 truncate text-zinc-400",children:o.title}),o.review_decision&&g.jsx("div",{className:"mt-1 flex items-center gap-2",children:g.jsx("span",{className:`text-[10px] ${o.review_decision==="APPROVED"?"text-green-400":o.review_decision==="CHANGES_REQUESTED"?"text-orange-400":"text-zinc-500"}`,children:o.review_decision==="APPROVED"?"Approved":o.review_decision==="CHANGES_REQUESTED"?"Changes requested":"Review required"})}),(o.additions>0||o.deletions>0)&&g.jsxs("div",{className:"mt-0.5 text-[10px] text-zinc-600",children:[g.jsxs("span",{className:"text-emerald-400",children:["+",o.additions]})," ",g.jsxs("span",{className:"text-red-400",children:["-",o.deletions]})]}),(o.reviews>0||o.comments>0)&&g.jsxs("div",{className:"mt-0.5 flex items-center gap-2 text-[10px] text-zinc-600",children:[o.reviews>0&&g.jsxs("span",{children:[o.reviews," review",o.reviews!==1?"s":""]}),o.comments>0&&g.jsxs("span",{children:[o.comments," comment",o.comments!==1?"s":""]})]}),g.jsxs("div",{className:"mt-1.5 flex gap-1",children:[g.jsx("button",{type:"button",onClick:()=>v({kind:"pr-comments",prNumber:o.number}),className:"rounded bg-white/5 px-1.5 py-0.5 text-[10px] text-zinc-400 transition-colors hover:bg-white/10 hover:text-zinc-200",children:"Comments"}),g.jsx("button",{type:"button",onClick:()=>v({kind:"pr-files",prNumber:o.number}),className:"rounded bg-white/5 px-1.5 py-0.5 text-[10px] text-zinc-400 transition-colors hover:bg-white/10 hover:text-zinc-200",children:"Files"}),g.jsx("button",{type:"button",onClick:()=>v({kind:"merge-status",prNumber:o.number}),className:"rounded bg-white/5 px-1.5 py-0.5 text-[10px] text-zinc-400 transition-colors hover:bg-white/10 hover:text-zinc-200",children:"Merge"})]})]}),C&&g.jsx("div",{className:"mt-2 text-[11px] text-zinc-600",children:"Loading checks..."}),P&&P.checks.length>0&&g.jsxs("div",{className:"mt-2",children:[g.jsxs("button",{type:"button",onClick:()=>ce(M=>!M),className:"flex items-center gap-1.5 text-[11px] text-zinc-400 transition-colors hover:text-zinc-200",children:[g.jsx("span",{className:`inline-block h-2 w-2 rounded-full ${P.rollup==="SUCCESS"?"bg-green-400":P.rollup==="FAILURE"?"bg-red-400":P.rollup==="PENDING"?"bg-yellow-400":"bg-zinc-600"}`}),g.jsxs("span",{children:["CI"," ",P.rollup==="SUCCESS"?"passed":P.rollup==="FAILURE"?"failed":P.rollup==="PENDING"?"running":"unknown"]}),g.jsxs("span",{className:"text-[10px] text-zinc-600",children:["(",P.checks.length," check",P.checks.length!==1?"s":"",")"]}),g.jsx("span",{className:"text-[10px]",children:U?"▾":"▸"})]}),U&&g.jsx("div",{className:"mt-1.5 flex flex-col gap-1",children:P.checks.map(M=>{const ye=M.conclusion==="failure"&&M.run_id!=null;return g.jsxs("button",{type:"button",onClick:()=>{ye&&M.run_id!=null?v({kind:"ci-log",runId:M.run_id,checkName:M.name}):window.open(M.url,"_blank","noopener,noreferrer")},className:"flex items-center gap-1.5 rounded bg-white/[0.03] px-2 py-1 text-left text-[11px] transition-colors hover:bg-white/[0.06]",children:[g.jsx("span",{className:`inline-block h-1.5 w-1.5 shrink-0 rounded-full ${M.conclusion==="success"?"bg-green-400":M.conclusion==="failure"?"bg-red-400":M.status==="in_progress"||M.status==="queued"?"bg-yellow-400":"bg-zinc-600"}`}),g.jsx("span",{className:"truncate text-zinc-300",children:M.name}),ye&&g.jsx("span",{className:"text-[9px] text-red-400/60",title:"View failure log",children:"log"}),g.jsx("span",{className:`ml-auto shrink-0 text-[10px] ${M.conclusion==="success"?"text-green-400":M.conclusion==="failure"?"text-red-400":M.status==="in_progress"?"text-yellow-400":"text-zinc-600"}`,children:M.conclusion??M.status})]},M.name+M.url)})}),U&&P.rollup==="FAILURE"&&P.checks.some(M=>M.conclusion==="failure"&&M.run_id!=null)&&g.jsx("button",{type:"button",onClick:Bn,disabled:w,className:"mt-1.5 w-full rounded bg-red-500/10 px-2 py-1 text-[11px] text-red-400 transition-colors hover:bg-red-500/20 disabled:opacity-50",children:w?"Re-running...":"Re-run failed checks"})]}),P&&P.checks.length===0&&!C&&(o!=null&&o.check_status?g.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[11px]",children:[g.jsx("span",{className:`inline-block h-2 w-2 rounded-full ${o.check_status==="SUCCESS"?"bg-green-400":o.check_status==="FAILURE"?"bg-red-400":o.check_status==="PENDING"?"bg-yellow-400":"bg-zinc-600"}`}),g.jsx("span",{className:o.check_status==="SUCCESS"?"text-green-400":o.check_status==="FAILURE"?"text-red-400":o.check_status==="PENDING"?"text-yellow-400":"text-zinc-600",children:o.check_status==="SUCCESS"?"CI passed":o.check_status==="FAILURE"?"CI failed":o.check_status==="PENDING"?"CI running":"CI unknown"}),g.jsx("span",{className:"text-[10px] text-zinc-600",children:"(from PR)"})]}):g.jsx("div",{className:"mt-2 text-[11px] text-zinc-600",children:"No CI checks"})),(()=>{const M=Ip(e.name);if(o!=null&&o.title)for(const ye of Oz(o.title))M.includes(ye)||M.push(ye);const re=f.filter(ye=>M.includes(ye.number));return re.length===0?null:g.jsxs("div",{className:"mt-2",children:[g.jsx("div",{className:"mb-1 text-[11px] text-zinc-500",children:"Linked issues"}),g.jsx("div",{className:"flex flex-col gap-1",children:re.map(ye=>g.jsxs("a",{href:ye.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-start gap-1.5 rounded bg-white/[0.03] px-2 py-1.5 text-[11px] transition-colors hover:bg-white/[0.06]",children:[g.jsxs("span",{className:"shrink-0 text-green-400",children:["#",ye.number]}),g.jsx("span",{className:"truncate text-zinc-300",children:ye.title}),ye.labels.length>0&&g.jsx("div",{className:"ml-auto flex shrink-0 gap-1",children:ye.labels.slice(0,2).map(je=>g.jsx("span",{className:"rounded px-1 py-0.5 text-[9px]",style:{backgroundColor:`#${je.color}22`,color:`#${je.color}`},children:je.name},je.name))})]},ye.number))})]})})()]}),c.length>0&&g.jsxs("div",{className:"mb-4",children:[g.jsx("div",{className:"mb-2 text-[11px] font-medium uppercase tracking-wider text-zinc-500",children:"Incoming PRs"}),g.jsx("div",{className:"flex flex-col gap-1.5",children:c.map(M=>g.jsxs("div",{className:"rounded-lg border border-white/5 bg-white/[0.03] p-2",children:[g.jsxs("div",{className:"flex items-center gap-1.5 text-[11px]",children:[g.jsxs("a",{href:M.url,target:"_blank",rel:"noopener noreferrer",className:"font-medium text-green-400 hover:underline",children:["#",M.number]}),M.is_draft&&g.jsx("span",{className:"rounded bg-zinc-500/15 px-1 py-0.5 text-[10px] text-zinc-500",children:"draft"}),M.review_decision==="APPROVED"&&g.jsx("span",{className:"text-[10px] text-green-400",children:"Approved"}),M.check_status==="SUCCESS"&&g.jsx("span",{className:"ml-auto inline-block h-1.5 w-1.5 rounded-full bg-green-400",title:"CI passed"}),M.check_status==="FAILURE"&&g.jsx("span",{className:"ml-auto inline-block h-1.5 w-1.5 rounded-full bg-red-400",title:"CI failed"}),M.check_status==="PENDING"&&g.jsx("span",{className:"ml-auto inline-block h-1.5 w-1.5 rounded-full bg-yellow-400",title:"CI running"})]}),g.jsx("div",{className:"mt-0.5 truncate text-[11px] text-zinc-400",children:M.title}),g.jsxs("div",{className:"mt-0.5 text-[10px] text-zinc-600",children:[M.head_branch," → ",e.name]}),(M.additions>0||M.deletions>0)&&g.jsxs("div",{className:"mt-0.5 text-[10px] text-zinc-600",children:[g.jsxs("span",{className:"text-emerald-400",children:["+",M.additions]})," ",g.jsxs("span",{className:"text-red-400",children:["-",M.deletions]})]}),g.jsxs("button",{type:"button",onClick:()=>Rt("Merge",()=>Ot(`Merge PR #${M.number}. First run 'gh pr view ${M.number} --json baseRefName -q .baseRefName' to verify base is '${e.name}'. If base matches, run 'gh pr merge ${M.number} --squash --delete-branch'. If base does NOT match, STOP and report the mismatch — do not merge.`)),disabled:W,className:"mt-1.5 w-full rounded bg-purple-500/15 px-2 py-1 text-[11px] font-medium text-purple-400 transition-colors hover:bg-purple-500/25 disabled:opacity-50",children:["AI Merge PR #",M.number]})]},M.number))})]}),g.jsxs("div",{className:"flex flex-col gap-2",children:[!e.isMain&&g.jsx("button",{type:"button",onClick:()=>v({kind:"diff"}),className:"w-full rounded-lg bg-white/5 px-3 py-2 text-left text-xs text-zinc-300 transition-colors hover:bg-white/10",children:"View Diff"}),e.isRemoteOnly&&g.jsx("button",{type:"button",onClick:nt,disabled:W,className:"w-full rounded-lg bg-purple-500/15 px-3 py-2 text-left text-xs font-medium text-purple-400 transition-colors hover:bg-purple-500/25 disabled:opacity-50",children:W?"Checking out...":"Checkout (Create Local Branch)"}),!e.isMain&&!e.isRemoteOnly&&g.jsxs(g.Fragment,{children:[e.agentTarget?g.jsx("button",{type:"button",onClick:()=>{e.agentTarget&&_(e.agentTarget)},className:"w-full rounded-lg bg-cyan-500/15 px-3 py-2 text-left text-xs font-medium text-cyan-400 transition-colors hover:bg-cyan-500/25",children:"Focus Agent"}):e.isWorktree&&e.worktree&&g.jsx("button",{type:"button",onClick:()=>Rt("Launch agent",yt),disabled:W,className:"w-full rounded-lg bg-cyan-500/15 px-3 py-2 text-left text-xs font-medium text-cyan-400 transition-colors hover:bg-cyan-500/25 disabled:opacity-50",children:W?"Launching...":"Launch Agent"}),e.ahead>0&&g.jsxs(g.Fragment,{children:[g.jsx("button",{type:"button",onClick:()=>Rt("Merge",()=>Ot(o?`Merge PR #${o.number}. First run 'gh pr view ${o.number} --json baseRefName -q .baseRefName' to verify base is '${Je}'. If base matches, run 'gh pr merge ${o.number} --squash --delete-branch'. If base does NOT match, STOP and report the mismatch — do not merge.`:`Merge branch '${e.name}' into '${Je}'. First check 'gh pr list --head ${e.name} --base ${Je}'. If PR exists and its base is '${Je}', run 'gh pr merge <number> --squash --delete-branch'. If no PR, run 'git checkout ${Je} && git merge ${e.name}'. Do not merge into any branch other than '${Je}'.`)),disabled:W,className:"w-full rounded-lg bg-purple-500/15 px-3 py-2 text-left text-xs font-medium text-purple-400 transition-colors hover:bg-purple-500/25 disabled:opacity-50",children:o?`AI Merge PR #${o.number} into ${Je}`:`AI Merge into ${Je}`}),g.jsxs("button",{type:"button",onClick:()=>Ot(`Run 'gh pr create --base ${Je} --head ${e.name}' to create a PR. Generate a title and description summarizing the changes. Do not merge anything.`),disabled:W,className:"w-full rounded-lg bg-blue-500/15 px-3 py-2 text-left text-xs font-medium text-blue-400 transition-colors hover:bg-blue-500/25 disabled:opacity-50",children:["AI Create PR → ",Je]})]}),e.behind>0&&g.jsxs("div",{className:"rounded-lg bg-amber-500/10 px-3 py-2 text-xs text-amber-400",children:[e.behind," commit",e.behind!==1?"s":""," behind ",Je]}),!e.isWorktree&&(V?g.jsx(Ry,{baseBranch:e.name,depth:s.get(e.name)??0,depthWarning:a,projectPath:n,onCreated:Vi,onCancel:on}):g.jsx("button",{type:"button",onClick:()=>z(!0),className:"w-full rounded-lg bg-emerald-500/15 px-3 py-2 text-left text-xs font-medium text-emerald-400 transition-colors hover:bg-emerald-500/25",children:"Create Worktree"})),g.jsx("hr",{className:"border-white/5"}),L?g.jsxs("div",{className:"rounded-lg border border-red-500/20 bg-red-500/5 p-2",children:[g.jsxs("label",{className:"flex items-center gap-1.5 text-[11px] text-zinc-400",children:[g.jsx("input",{type:"checkbox",checked:X,onChange:M=>pe(M.target.checked),className:"accent-red-500"}),"Force delete",e.isWorktree?"":" (unmerged)"]}),!e.isWorktree&&e.remote&&g.jsxs("label",{className:"mt-1 flex items-center gap-1.5 text-[11px] text-zinc-400",children:[g.jsx("input",{type:"checkbox",checked:G,onChange:M=>K(M.target.checked),className:"accent-red-500"}),"Also delete remote branch"]}),g.jsxs("div",{className:"mt-2 flex gap-2",children:[g.jsx("button",{type:"button",onClick:e.isWorktree?se:Oe,disabled:W,className:"rounded bg-red-500/20 px-2 py-1 text-xs text-red-400 hover:bg-red-500/30 disabled:opacity-50",children:W?"...":"Confirm"}),g.jsx("button",{type:"button",onClick:()=>{te(!1),pe(!1),K(!0)},className:"text-xs text-zinc-500 hover:text-zinc-300",children:"Cancel"})]})]}):g.jsxs("button",{type:"button",onClick:()=>Rt("Delete",()=>te(!0)),disabled:!e.isWorktree&&e.isCurrent,className:"w-full rounded-lg bg-red-500/10 px-3 py-2 text-left text-xs text-red-400 transition-colors hover:bg-red-500/20 disabled:opacity-30",children:["Delete ",e.isWorktree?"Worktree":"Branch"]})]}),e.isMain&&(V?g.jsx(Ry,{baseBranch:e.name,depth:0,depthWarning:a,projectPath:n,onCreated:Vi,onCancel:on}):g.jsx("button",{type:"button",onClick:()=>z(!0),className:"w-full rounded-lg bg-emerald-500/15 px-3 py-2 text-left text-xs font-medium text-emerald-400 transition-colors hover:bg-emerald-500/25",children:"Create Worktree"}))]}),I&&g.jsx("div",{className:"mt-3 rounded-lg border border-red-500/20 bg-red-500/5 px-3 py-2 text-xs text-red-400",children:I})]})})}function Bz(e){const t=[],n=e.split(/^diff --git /m);for(const s of n){if(!s.trim())continue;const a=s.match(/^a\/(.+?) b\//),o=(a==null?void 0:a[1])??"unknown",c=s.split(`
`);let f=0,d=0;for(const h of c)h.startsWith("+")&&!h.startsWith("+++")&&f++,h.startsWith("-")&&!h.startsWith("---")&&d++;t.push({filename:o,insertions:f,deletions:d,lines:c})}return t}function f1({diff:e}){const t=N.useMemo(()=>Bz(e),[e]),n=t.length>20,[s,a]=N.useState(()=>n?new Set(t.map(c=>c.filename)):new Set),o=c=>{a(f=>{const d=new Set(f);return d.has(c)?d.delete(c):d.add(c),d})};return t.length===0?g.jsx("div",{className:"px-4 py-6 text-center text-sm text-zinc-500",children:"No changes"}):g.jsx("div",{className:"flex flex-col gap-2",children:t.map(c=>g.jsxs("div",{className:"overflow-hidden rounded-lg border border-white/5",children:[g.jsxs("button",{type:"button",onClick:()=>o(c.filename),className:"flex w-full items-center gap-2 bg-white/[0.03] px-3 py-1.5 text-left transition-colors hover:bg-white/[0.06]",children:[g.jsx("span",{className:"text-[10px] text-zinc-600",children:s.has(c.filename)?"▸":"▾"}),g.jsx("span",{className:"flex-1 truncate text-xs font-mono text-zinc-300",children:c.filename}),g.jsxs("span",{className:"shrink-0 text-[10px]",children:[g.jsxs("span",{className:"text-emerald-400",children:["+",c.insertions]})," ",g.jsxs("span",{className:"text-red-400",children:["-",c.deletions]})]})]}),!s.has(c.filename)&&g.jsx("pre",{className:"overflow-x-auto text-[11px] leading-relaxed",children:c.lines.map((f,d)=>g.jsx("div",{className:ui("px-3",f.startsWith("+")&&!f.startsWith("+++")&&"bg-emerald-500/10 text-emerald-300",f.startsWith("-")&&!f.startsWith("---")&&"bg-red-500/10 text-red-300",f.startsWith("@@")&&"bg-blue-500/10 text-blue-300",!f.startsWith("+")&&!f.startsWith("-")&&!f.startsWith("@@")&&"text-zinc-500"),children:f},`${c.filename}-L${d}`))})]},c.filename))})}function jz(e){return e.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,"")}function Hz(e){const t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?"just now":t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function Iz(e){switch(e.kind){case"diff":return"Diff";case"pr-comments":return`PR #${e.prNumber} Comments`;case"pr-files":return`PR #${e.prNumber} Files`;case"merge-status":return`PR #${e.prNumber} Merge Status`;case"ci-log":return`CI Log: ${e.checkName}`}}function Pz({projectPath:e,activeNode:t,branches:n}){const[s,a]=N.useState(null),[o,c]=N.useState(!0),[f,d]=N.useState(null),h=N.useCallback(async()=>{c(!0),d(null);try{let _;if(t.worktree)_=await we.getWorktreeDiff(t.worktree.path);else{const v=t.parent??(n==null?void 0:n.default_branch)??"main";_=await we.gitBranchDiff(e,t.name,v)}a(_)}catch(_){d(_ instanceof Error?_.message:"Failed to load diff")}finally{c(!1)}},[t.worktree,t.parent,t.name,n==null?void 0:n.default_branch,e]);return N.useEffect(()=>{h()},[h]),N.useEffect(()=>{const _=setInterval(h,3e4);return()=>clearInterval(_)},[h]),o?g.jsx("div",{className:"text-sm text-zinc-500",children:"Loading diff..."}):f?g.jsx("div",{className:"text-sm text-red-400",children:f}):s!=null&&s.diff?g.jsx(f1,{diff:s.diff}):g.jsx("div",{className:"text-sm text-zinc-500",children:"No changes"})}function Uz({projectPath:e,prNumber:t}){const[n,s]=N.useState([]),[a,o]=N.useState(!0),[c,f]=N.useState(null),d=N.useCallback(async()=>{try{const h=await we.getPrComments(e,t);s(h),f(null)}catch(h){f(h instanceof Error?h.message:"Failed to load comments")}finally{o(!1)}},[e,t]);return N.useEffect(()=>{o(!0),d()},[d]),N.useEffect(()=>{const h=setInterval(d,3e4);return()=>clearInterval(h)},[d]),a?g.jsx("div",{className:"text-sm text-zinc-500",children:"Loading comments..."}):c?g.jsx("div",{className:"text-sm text-red-400",children:c}):n.length===0?g.jsx("div",{className:"text-sm text-zinc-500",children:"No comments"}):g.jsx("div",{className:"flex flex-col gap-4",children:n.map(h=>g.jsxs("div",{className:"rounded-lg border border-white/5 bg-white/[0.02] p-3",children:[g.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[g.jsx("span",{className:"font-semibold text-zinc-200",children:h.author}),g.jsx("span",{className:"text-zinc-600",children:Hz(h.created_at)}),h.comment_type!=="comment"&&g.jsx("span",{className:"rounded bg-blue-500/15 px-1 py-0.5 text-[10px] text-blue-400",children:h.comment_type})]}),h.path&&g.jsxs("div",{className:"mt-2 rounded bg-zinc-800/50 px-2 py-1.5",children:[g.jsx("div",{className:"text-[11px] font-mono text-zinc-400",children:h.path}),h.diff_hunk&&g.jsx("pre",{className:"mt-1 text-[10px] leading-relaxed text-zinc-600 overflow-x-auto",children:h.diff_hunk})]}),g.jsx("div",{className:"mt-2 whitespace-pre-wrap break-words text-sm text-zinc-300",children:h.body})]},h.url))})}function Fz({projectPath:e,prNumber:t}){const[n,s]=N.useState([]),[a,o]=N.useState(!0),[c,f]=N.useState(null),d=N.useCallback(async()=>{try{const b=await we.getPrFiles(e,t);s(b),f(null)}catch(b){f(b instanceof Error?b.message:"Failed to load files")}finally{o(!1)}},[e,t]);if(N.useEffect(()=>{o(!0),d()},[d]),N.useEffect(()=>{const b=setInterval(d,3e4);return()=>clearInterval(b)},[d]),a)return g.jsx("div",{className:"text-sm text-zinc-500",children:"Loading files..."});if(c)return g.jsx("div",{className:"text-sm text-red-400",children:c});if(n.length===0)return g.jsx("div",{className:"text-sm text-zinc-500",children:"No changed files"});const h=[...n].sort((b,y)=>b.path.localeCompare(y.path)),_=h.reduce((b,y)=>b+y.additions,0),v=h.reduce((b,y)=>b+y.deletions,0);return g.jsxs("div",{className:"flex flex-col gap-2",children:[g.jsxs("div",{className:"text-xs text-zinc-400",children:[h.length," file",h.length!==1?"s":""," changed:"," ",g.jsxs("span",{className:"text-emerald-400",children:["+",_]})," ",g.jsxs("span",{className:"text-red-400",children:["-",v]})]}),g.jsx("div",{className:"flex flex-col gap-1",children:h.map(b=>g.jsxs("div",{className:"flex items-center gap-2 rounded bg-white/[0.03] px-3 py-1.5 text-xs",children:[g.jsx("span",{className:"flex-1 break-all font-mono text-zinc-300",children:b.path}),g.jsxs("span",{className:"shrink-0 text-emerald-400",children:["+",b.additions]}),g.jsxs("span",{className:"shrink-0 text-red-400",children:["-",b.deletions]})]},b.path))})]})}function Wz({projectPath:e,prNumber:t}){const[n,s]=N.useState(null),[a,o]=N.useState(!0),[c,f]=N.useState(null),d=N.useCallback(async()=>{try{const y=await we.getPrMergeStatus(e,t);s(y),f(null)}catch(y){f(y instanceof Error?y.message:"Failed to load merge status")}finally{o(!1)}},[e,t]);if(N.useEffect(()=>{o(!0),d()},[d]),N.useEffect(()=>{const y=setInterval(d,3e4);return()=>clearInterval(y)},[d]),a)return g.jsx("div",{className:"text-sm text-zinc-500",children:"Loading merge status..."});if(c)return g.jsx("div",{className:"text-sm text-red-400",children:c});if(!n)return g.jsx("div",{className:"text-sm text-zinc-500",children:"No data"});const h=n.mergeable==="MERGEABLE"?{icon:"✓",color:"text-green-400"}:n.mergeable==="CONFLICTING"?{icon:"✗",color:"text-red-400"}:{icon:"?",color:"text-yellow-400"},_=n.merge_state_status==="CLEAN"?{icon:"✓",color:"text-green-400"}:n.merge_state_status==="BLOCKED"?{icon:"✗",color:"text-red-400"}:n.merge_state_status==="BEHIND"?{icon:"↓",color:"text-yellow-400"}:{icon:"•",color:"text-zinc-400"},v=n.review_decision?n.review_decision==="APPROVED"?{icon:"✓",color:"text-green-400"}:n.review_decision==="CHANGES_REQUESTED"?{icon:"✗",color:"text-orange-400"}:{icon:"○",color:"text-yellow-400"}:{icon:"—",color:"text-zinc-600"},b=n.check_status?n.check_status==="SUCCESS"?{icon:"✓",color:"text-green-400"}:n.check_status==="FAILURE"?{icon:"✗",color:"text-red-400"}:{icon:"○",color:"text-yellow-400"}:{icon:"—",color:"text-zinc-600"};return g.jsx("div",{className:"flex flex-col gap-3",children:[{label:"Mergeable",value:n.mergeable,...h},{label:"Merge state",value:n.merge_state_status,..._},{label:"Review",value:n.review_decision??"none",...v},{label:"CI",value:n.check_status??"none",...b}].map(y=>g.jsxs("div",{className:"flex items-center gap-3 rounded bg-white/[0.03] px-3 py-2 text-sm",children:[g.jsx("span",{className:`text-base ${y.color}`,children:y.icon}),g.jsx("span",{className:"text-zinc-400",children:y.label}),g.jsx("span",{className:"ml-auto font-mono text-xs text-zinc-300",children:y.value})]},y.label))})}function qz({projectPath:e,runId:t}){const[n,s]=N.useState(null),[a,o]=N.useState(!0),[c,f]=N.useState(null),d=N.useRef(null),h=N.useCallback(async()=>{try{const _=await we.getCiFailureLog(e,t);s(_),f(null)}catch(_){f(_ instanceof Error?_.message:"Failed to load CI log")}finally{o(!1)}},[e,t]);return N.useEffect(()=>{o(!0),h()},[h]),N.useEffect(()=>{const _=setInterval(h,3e4);return()=>clearInterval(_)},[h]),a?g.jsx("div",{className:"text-sm text-zinc-500",children:"Loading CI log..."}):c?g.jsx("div",{className:"text-sm text-red-400",children:c}):n!=null&&n.log_text?g.jsx("pre",{ref:d,className:"max-w-full overflow-auto rounded-lg bg-zinc-900/80 p-4 text-[11px] leading-relaxed font-mono text-zinc-300",children:jz(n.log_text)}):g.jsx("div",{className:"text-sm text-zinc-500",children:"No log output"})}function $z({view:e,projectPath:t,activeNode:n,branches:s,onClose:a}){return g.jsxs("div",{className:"min-w-[480px] flex-[2] overflow-hidden flex flex-col border-l border-white/5 bg-black/20",children:[g.jsxs("div",{className:"shrink-0 flex items-center gap-2 border-b border-white/5 px-4 py-2",children:[g.jsx("h3",{className:"flex-1 text-sm font-semibold text-zinc-100 truncate",children:Iz(e)}),g.jsx("button",{type:"button",onClick:a,className:"shrink-0 rounded p-1 text-zinc-500 transition-colors hover:bg-white/10 hover:text-zinc-200",title:"Close detail panel",children:g.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:[g.jsx("title",{children:"Close"}),g.jsx("path",{d:"M3.5 3.5L10.5 10.5M10.5 3.5L3.5 10.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})]}),g.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[e.kind==="diff"&&g.jsx(Pz,{projectPath:t,activeNode:n,branches:s}),e.kind==="pr-comments"&&g.jsx(Uz,{projectPath:t,prNumber:e.prNumber}),e.kind==="pr-files"&&g.jsx(Fz,{projectPath:t,prNumber:e.prNumber}),e.kind==="merge-status"&&g.jsx(Wz,{projectPath:t,prNumber:e.prNumber}),e.kind==="ci-log"&&g.jsx(qz,{projectPath:t,runId:e.runId})]})]})}const Bl=["rgb(16,185,129)","rgb(34,211,238)","rgb(168,85,247)","rgb(59,130,246)","rgb(245,158,11)","rgb(236,72,153)","rgb(20,184,166)","rgb(249,115,22)"];function Ms(e){return Bl[e%Bl.length]}function zy(e){return Bl[e%Bl.length].replace("rgb(","rgba(").replace(")",",0.3)")}function Yz(e){return Bl[e%Bl.length].replace("rgb(","rgba(").replace(")",",0.06)")}const Vz=24,Pp=80,ns=32,Gz=52,Kz=4,Xz=7,Up=20,Zz=300;function Qz(e){return e<=1?Pp:Math.max(Vz,Math.min(Pp,Math.floor(Zz/e)))}function Jz(e){return e.startsWith("HEAD -> ")?e.slice(8):e.startsWith("tag: ")?null:e.startsWith("origin/")?e.slice(7):e.startsWith("refs/")?null:e}function Ly(e,t,n){let s=0,a=e;const o=new Set;for(;a!==n&&!o.has(a);){o.add(a);const c=t[a];if(!c)break;a=c,s++}return s}function e4(e,t,n){const s=new Map;for(const[h,_]of e.entries())s.set(_.sha,h);const a=new Map,o=new Map,c=t.parents;for(const h of e)for(const _ of h.refs){const v=Jz(_);v&&t.branches.includes(v)&&(a.set(h.sha,v),o.has(v)||o.set(v,h.sha))}const f=h=>{let _=0,v=h;for(;c[v];)v=c[v],_++;return _},d=[...o.entries()].sort((h,_)=>f(h[0])-f(_[0]));for(const[h,_]of d){let v=_;const b=new Set;for(;v&&!b.has(v);){b.add(v);const y=s.get(v);if(y===void 0)break;const S=e[y],A=a.get(v);if(A&&A!==h)if(c[A]===h)a.set(v,h);else break;else a.set(v,h);if(S.parents.length>0)v=S.parents[0];else break}}return{shaToBranch:a,branchTipSha:o}}function t4(e,t,n){const s=new Set(t.filter(_=>_.isWorktree||_.hasAgent||_.isDirty||_.ahead>0||_.isCurrent).map(_=>_.name)),a=e.parents,o=new Set(e.branches),c=[];o.has(n)&&c.push(n);const f=[...o].filter(_=>_!==n&&s.has(_)).sort((_,v)=>Ly(_,a,n)-Ly(v,a,n));c.push(...f);const d=[...o].filter(_=>_!==n&&!s.has(_)).sort();c.push(...d);const h=new Map;for(const[_,v]of c.entries())h.set(v,_);return{branchToLane:h,sortedBranches:c}}function i4(e,t,n,s,a,o){const c=[];for(const f of e){const d=t.get(f.sha)??o,h=n.get(d)??0,_=a.has(f.sha),v=f.parents.length>1,b=f.parents.some(R=>{const D=t.get(R)??o;return(n.get(D)??0)!==h}),y=s.has(d),S=f.refs.length>0,A=!y||_||v||b||S;c.push({sha:f.sha,branch:d,lane:h,subject:f.subject,refs:f.refs,isMerge:v,isTip:_,visible:A})}return c}function n4(e){const t=[],n=new Map;let s=Gz;const a=new Map;for(let o=0;o<e.length;o++){const c=e[o];if(!c.visible){a.set(c.lane,(a.get(c.lane)??0)+1);continue}const f=a.get(c.lane)??0;if(f>0){const h={kind:"fold",sha:`__fold_${c.lane}_${o}`,lane:c.lane,y:s,foldCount:f};t.push(h),s+=ns,a.set(c.lane,0)}n.set(c.sha,s);const d={kind:"commit",sha:c.sha,lane:c.lane,y:s,subject:c.subject,refs:c.refs,isMerge:c.isMerge};t.push(d),s+=ns}for(const[o,c]of a)if(c>0){const f={kind:"fold",sha:`__fold_end_${o}`,lane:o,y:s,foldCount:c};t.push(f),s+=ns}return{rows:t,shaToY:n,finalY:s}}function r4(e,t,n,s,a,o){const c=(d,h)=>{const _=n.get(d);if(_!==void 0)return _;const v=t.find(b=>b.kind==="fold"&&b.lane===h);return v==null?void 0:v.y},f=[];for(const d of e){const h=s.get(d.sha)??o,_=a.get(h)??0,v=c(d.sha,_);if(v!==void 0)for(let b=0;b<d.parents.length;b++){const y=d.parents[b],S=s.get(y)??o,A=a.get(S)??0,R=c(y,A);R!==void 0&&_!==A&&(b===0?f.push({fromLane:A,toLane:_,fromY:R,toY:v,type:"fork",color:Ms(_)}):f.push({fromLane:A,toLane:_,fromY:R,toY:v,type:"merge",color:Ms(A)}))}}return f}function s4(e,t,n,s){const a=t.default_branch,o=e.commits,c=s??new Set;if(o.length===0)return{lanes:[],rows:[],connections:[],laneW:Pp,svgWidth:200,svgHeight:100};const{shaToBranch:f,branchTipSha:d}=e4(o,t),h=new Set(n.filter(te=>te.isWorktree||te.hasAgent||te.isDirty||te.ahead>0||te.isCurrent).map(te=>te.name)),{branchToLane:_,sortedBranches:v}=t4(t,n,a),b=v.length||1,y=v.map((te,X)=>({branch:te,laneIndex:X,color:Ms(X),isActive:h.has(te)||te===a})),S=new Set(d.values()),A=i4(o,f,_,c,S,a),{rows:R,shaToY:D,finalY:W}=n4(A),j=r4(o,R,D,f,_,a),I=Qz(b),J=Math.max(Up+b*I+500,600),L=W+40;return{lanes:y,rows:R,connections:j,laneW:I,svgWidth:J,svgHeight:L}}function l4({layout:e,selectedBranch:t,repoPath:n,defaultBranch:s,collapsedLanes:a,prMap:o,onSelectBranch:c,onToggleCollapse:f}){var $;const[d,h]=N.useState(null),[_,v]=N.useState(null),[b,y]=N.useState(null),[S,A]=N.useState(!1),R=N.useRef(null),{lanes:D,rows:W,connections:j,laneW:I,svgHeight:J}=e,L=N.useMemo(()=>{const C={};for(const B of Object.values(o))B.head_sha&&(C[B.head_sha]=B);return C},[o]),te=Up+D.length*I+12,X=(($=D.find(C=>C.branch===t))==null?void 0:$.laneIndex)??-1,pe=N.useCallback(C=>Up+C*I+I/2,[I]),G=N.useMemo(()=>{const C=new Map;for(const B of W){const U=C.get(B.lane);U?(U.minY=Math.min(U.minY,B.y),U.maxY=Math.max(U.maxY,B.y)):C.set(B.lane,{minY:B.y,maxY:B.y})}return C},[W]),K=N.useMemo(()=>{const C=new Set,B=new Set;for(const U of W)U.kind!=="fold"&&(B.has(U.lane)||(C.add(U.sha),B.add(U.lane)));return C},[W]),V=N.useCallback(C=>{var B;return((B=D[C])==null?void 0:B.branch)??s},[D,s]),z=N.useCallback((C,B)=>{if(_===C){v(null),y(null);return}v(C),y(null),A(!0);const U=V(B);we.gitLog(n,s,U).then(ce=>{const w=ce.find(T=>T.sha.startsWith(C.slice(0,7))||C.startsWith(T.sha));if(w)y({sha:w.sha,subject:w.subject,body:w.body});else{const T=W.find(k=>k.sha===C),q=T&&T.kind==="commit"?T.subject:"";y({sha:C,subject:q,body:""})}}).catch(()=>{const ce=W.find(T=>T.sha===C),w=ce&&ce.kind==="commit"?ce.subject:"";y({sha:C,subject:w,body:""})}).finally(()=>A(!1))},[_,V,n,s,W]);N.useEffect(()=>{const C=B=>{B.key==="Escape"&&_&&(v(null),y(null))};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[_]);const P=_?W.find(C=>C.sha===_):null;return g.jsxs("div",{ref:R,className:"relative inline-flex w-max min-w-full",style:{minHeight:J},children:[g.jsx("div",{className:"shrink-0",style:{width:te},children:g.jsxs("svg",{width:te,height:J,role:"img","aria-label":"Branch lane graph",children:[g.jsx("title",{children:"Branch lane graph"}),g.jsxs("defs",{children:[g.jsxs("filter",{id:"lane-glow",children:[g.jsx("feGaussianBlur",{stdDeviation:"3",result:"blur"}),g.jsxs("feMerge",{children:[g.jsx("feMergeNode",{in:"blur"}),g.jsx("feMergeNode",{in:"SourceGraphic"})]})]}),g.jsxs("filter",{id:"lane-glow-selected",children:[g.jsx("feGaussianBlur",{stdDeviation:"4",result:"blur"}),g.jsxs("feMerge",{children:[g.jsx("feMergeNode",{in:"blur"}),g.jsx("feMergeNode",{in:"SourceGraphic"})]})]})]}),D.map(C=>g.jsx("rect",{role:"button",tabIndex:0,x:pe(C.laneIndex)-I/2,y:0,width:I,height:J,fill:C.laneIndex===X?Yz(C.laneIndex):"transparent",className:"cursor-pointer",onClick:()=>c(C.branch),onKeyDown:B=>{(B.key==="Enter"||B.key===" ")&&(B.preventDefault(),c(C.branch))}},`bg-${C.laneIndex}`)),D.map(C=>{const B=G.get(C.laneIndex);if(!B)return null;const U=C.laneIndex===X;return g.jsx("line",{x1:pe(C.laneIndex),y1:B.minY,x2:pe(C.laneIndex),y2:B.maxY,stroke:U?C.color:zy(C.laneIndex),strokeWidth:U?2:1.5},`line-${C.laneIndex}`)}),D.map(C=>{if(G.has(C.laneIndex))return null;const B=W.find(T=>T.kind==="commit"&&T.refs.some(q=>q.replace(/^HEAD -> /,"").replace(/^origin\//,"")===C.branch));if(!B)return null;const U=pe(B.lane),ce=pe(C.laneIndex),w=W.length>0?W[0].y:0;return g.jsx("line",{x1:U,y1:B.y,x2:ce,y2:w,stroke:C.color,strokeWidth:1.5,strokeOpacity:.4,strokeDasharray:"4 4"},`empty-lane-${C.laneIndex}`)}),Object.values(o).map(C=>{const B=D.find(oe=>oe.branch===C.head_branch),U=D.find(oe=>oe.branch===C.base_branch);if(!B||!U||B.laneIndex===U.laneIndex)return null;const ce=G.get(B.laneIndex);if(!ce)return null;const w=pe(B.laneIndex),T=pe(U.laneIndex),q=ce.minY,k=28,ie=C.is_draft?"rgb(161,161,170)":"rgb(74,222,128)",ue=(q+k)/2,le=`M ${w} ${q} C ${w} ${ue}, ${T} ${ue}, ${T} ${k}`,ve=4,Ee=`M ${T-ve} ${k+ve*1.5} L ${T} ${k} L ${T+ve} ${k+ve*1.5}`;return g.jsxs("g",{children:[g.jsx("path",{d:le,fill:"none",stroke:ie,strokeWidth:1.5,strokeOpacity:.5,strokeDasharray:"6 3"}),g.jsx("path",{d:Ee,fill:"none",stroke:ie,strokeWidth:1.5,strokeOpacity:.6})]},`pr-target-${C.number}`)}),j.map((C,B)=>{const U=pe(C.fromLane),ce=pe(C.toLane);return g.jsx("line",{x1:U,y1:C.fromY,x2:ce,y2:C.toY,stroke:C.color,strokeWidth:1.5,strokeOpacity:.5},`conn-${C.fromLane}-${C.toLane}-${C.fromY}-${C.toY}`)}),W.map(C=>{const B=pe(C.lane),U=Ms(C.lane);if(C.kind==="fold")return g.jsxs("g",{role:"button",tabIndex:0,className:"cursor-pointer",onClick:()=>f(V(C.lane)),onKeyDown:ie=>{(ie.key==="Enter"||ie.key===" ")&&(ie.preventDefault(),f(V(C.lane)))},children:[g.jsx("line",{x1:B,y1:C.y-8,x2:B,y2:C.y+8,stroke:U,strokeWidth:1.5,strokeOpacity:.3,strokeDasharray:"2 3"}),[-4,0,4].map(ie=>g.jsx("circle",{cx:B,cy:C.y+ie,r:1.5,fill:U,fillOpacity:.5},ie))]},C.sha);const ce=K.has(C.sha),w=C.lane===X,T=d===C.sha,q=_===C.sha,k=ce?Xz:Kz;return g.jsxs("g",{children:[g.jsx("circle",{cx:B,cy:C.y,r:T||q?k+2:k,fill:U,fillOpacity:ce?.2:T||q?.25:.15,stroke:U,strokeWidth:ce||w||q||T?2:1.5,strokeOpacity:w||T||q?1:.6,filter:ce&&w?"url(#lane-glow-selected)":ce?"url(#lane-glow)":void 0,className:"cursor-pointer",onMouseEnter:()=>h(C.sha),onMouseLeave:()=>h(null),onClick:()=>z(C.sha,C.lane)}),C.isMerge&&g.jsx("circle",{cx:B,cy:C.y,r:k+3,fill:"none",stroke:U,strokeWidth:1,strokeOpacity:.3})]},C.sha)}),D.map(C=>{const B=C.laneIndex===X,U=a.has(C.branch),ce=Math.max(4,Math.floor(I/7)),w=C.branch.length>ce?C.branch.slice(0,Math.ceil(ce/2))+"…"+C.branch.slice(-Math.floor(ce/2)):C.branch,q=W.filter(k=>k.lane===C.laneIndex&&k.kind==="commit").length>2;return g.jsxs("g",{children:[g.jsxs("g",{role:"button",tabIndex:0,className:"cursor-pointer",onClick:()=>c(C.branch),onKeyDown:k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),c(C.branch))},children:[g.jsx("title",{children:C.branch}),g.jsx("text",{x:pe(C.laneIndex),y:16,textAnchor:"middle",fill:B?C.color:zy(C.laneIndex),fontSize:"10",fontWeight:B?"600":"400",style:{userSelect:"none"},children:w})]}),q?g.jsxs("g",{role:"button",tabIndex:0,className:"cursor-pointer",onClick:()=>f(C.branch),onKeyDown:k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),f(C.branch))},children:[g.jsx("title",{children:U?"Expand commits":"Collapse commits"}),g.jsx("circle",{cx:pe(C.laneIndex),cy:28,r:5,fill:U?C.color:"transparent",fillOpacity:U?.15:0,stroke:C.color,strokeWidth:1,strokeOpacity:B?.8:.4}),g.jsx("text",{x:pe(C.laneIndex),y:29,textAnchor:"middle",dominantBaseline:"middle",fill:C.color,fillOpacity:B?1:.5,fontSize:"8",fontWeight:"600",style:{userSelect:"none"},children:U?"▸":"▾"})]}):g.jsx("circle",{cx:pe(C.laneIndex),cy:28,r:3,fill:C.color,fillOpacity:B?1:.4})]},`hdr-${C.laneIndex}`)})]})}),g.jsx("div",{className:"relative shrink-0",style:{minHeight:J},children:W.map(C=>{var ue;const B=d===C.sha,U=C.lane===X,ce=_===C.sha,w=Ms(C.lane);if(C.kind==="fold")return g.jsxs("button",{type:"button",className:"absolute flex cursor-pointer items-center gap-2 px-2",style:{height:ns,top:C.y-ns/2,left:0,right:0},onClick:()=>f(V(C.lane)),children:[g.jsx("span",{className:"text-[10px]",style:{color:w,opacity:.5},children:"⋮"}),g.jsxs("span",{className:"text-[10px] text-zinc-500",children:[C.foldCount," commit",C.foldCount>1?"s":""," hidden"]}),g.jsx("span",{className:"text-[9px] text-zinc-600",children:"click to expand"})]},C.sha);const T=K.has(C.sha),q=(ue=D[C.lane])==null?void 0:ue.branch,k=q?o[q]:void 0,ie=L[C.sha]??(k&&C.refs.some(le=>le===`origin/${q}`)?k:void 0)??(k&&!k.head_sha&&C.refs.some(le=>!le.startsWith("origin/"))?k:void 0);return g.jsxs("button",{type:"button",className:`absolute flex cursor-pointer items-center gap-2 px-2 text-left transition-colors ${B?"bg-white/[0.02]":""} ${ce?"bg-cyan-500/[0.04]":""}`,style:{height:ns,top:C.y-ns/2,left:0,right:0},onMouseEnter:()=>h(C.sha),onMouseLeave:()=>h(null),onClick:()=>z(C.sha,C.lane),children:[g.jsx("span",{className:"shrink-0 font-mono text-[10px]",style:{color:B||ce?"rgb(34,211,238)":"rgba(34,211,238,0.35)"},children:C.sha.slice(0,7)}),g.jsx("span",{className:"whitespace-nowrap text-[11px]",style:{color:B||ce?"rgba(228,228,231,0.9)":T?"rgba(228,228,231,0.6)":U?"rgba(161,161,170,0.6)":"rgba(161,161,170,0.35)",fontWeight:T?500:400},children:C.subject}),(T||ie)&&g.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[T&&C.refs.filter(le=>!le.startsWith("origin/")).slice(0,1).map(le=>g.jsx("span",{className:"rounded px-1 py-0.5 text-[9px] font-semibold",style:{color:w,backgroundColor:w.replace("rgb(","rgba(").replace(")",",0.1)")},children:le.startsWith("HEAD -> ")?le.slice(8):le},le)),ie&&g.jsxs("a",{href:ie.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium transition-colors hover:brightness-125",style:{backgroundColor:ie.is_draft?"rgba(161,161,170,0.1)":"rgba(34,197,94,0.1)",color:ie.is_draft?"rgba(161,161,170,0.6)":"rgb(74,222,128)"},onClick:le=>le.stopPropagation(),children:["#",ie.number,ie.is_draft&&g.jsx("span",{className:"text-[9px] opacity-60",children:"draft"}),ie.review_decision==="APPROVED"&&g.jsx("span",{className:"text-green-400",children:"✔"}),ie.review_decision==="CHANGES_REQUESTED"&&g.jsx("span",{className:"text-orange-400",children:"✖"}),ie.check_status&&g.jsx("span",{className:`inline-block h-2 w-2 rounded-full ${ie.check_status==="SUCCESS"?"bg-green-400":ie.check_status==="FAILURE"?"bg-red-400":"bg-yellow-400"}`}),ie.reviews>0&&g.jsxs("span",{className:"text-[9px] text-zinc-500",children:[ie.reviews,"r"]})]})]})]},C.sha)})}),P&&P.kind==="commit"&&g.jsx("div",{className:"absolute z-10 rounded-lg border border-white/10 bg-zinc-900/95 shadow-xl backdrop-blur-sm",style:{left:te+8,top:P.y+ns/2+4,right:16,minWidth:280},children:g.jsxs("div",{className:"p-3",children:[g.jsxs("div",{className:"flex items-center justify-between gap-3",children:[g.jsx("span",{className:"font-mono text-[11px] text-cyan-400 select-all",children:(b==null?void 0:b.sha)??P.sha}),g.jsx("button",{type:"button",onClick:()=>{v(null),y(null)},className:"text-[10px] text-zinc-600 hover:text-zinc-300 transition-colors",children:"Esc"})]}),g.jsx("div",{className:"mt-1.5 text-xs font-medium text-zinc-200 select-text",children:P.subject}),S?g.jsx("div",{className:"mt-2 text-[11px] text-zinc-600",children:"Loading..."}):b!=null&&b.body?g.jsx("div",{className:"mt-2 rounded bg-white/[0.03] px-2 py-1.5 text-[11px] text-zinc-400 font-mono whitespace-pre-wrap break-words select-text max-h-48 overflow-y-auto",children:b.body}):null,g.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[10px] text-zinc-600",children:[g.jsx("span",{className:"rounded px-1.5 py-0.5",style:{backgroundColor:Ms(P.lane).replace("rgb(","rgba(").replace(")",",0.1)"),color:Ms(P.lane)},children:V(P.lane)}),P.isMerge&&g.jsx("span",{className:"rounded bg-purple-500/10 px-1.5 py-0.5 text-purple-400",children:"merge"})]})]})})]})}function a4({issues:e,worktrees:t,selectedIssue:n,onSelectIssue:s}){const[a,o]=N.useState(""),[c,f]=N.useState(new Set),d=N.useMemo(()=>{const b=new Map;for(const y of t){if(y.is_main)continue;const S=y.branch??y.name,A=Ip(S);for(const R of A)if(!b.has(R)){const D=y.agent_status==="in-progress"||y.agent_status==="waiting";b.set(R,{worktree:y,isAgentActive:D})}}return b},[t]),h=N.useMemo(()=>{const b=new Map;for(const y of e)for(const S of y.labels)b.has(S.name)||b.set(S.name,S);return Array.from(b.values())},[e]),_=N.useMemo(()=>e.filter(b=>{if(a){const y=a.toLowerCase();if(!(b.title.toLowerCase().includes(y)||b.number.toString().includes(y)))return!1}return!(c.size>0&&!b.labels.some(S=>c.has(S.name)))}),[e,a,c]),v=b=>{f(y=>{const S=new Set(y);return S.has(b)?S.delete(b):S.add(b),S})};return g.jsxs("div",{className:"flex-1 overflow-auto p-6",children:[g.jsxs("div",{className:"mb-4",children:[g.jsx("input",{type:"text",value:a,onChange:b=>o(b.target.value),placeholder:"Search issues...",className:"w-full rounded-lg bg-white/5 px-3 py-2 text-sm text-zinc-200 placeholder-zinc-600 outline-none ring-1 ring-white/10 transition-colors focus:ring-white/20"}),h.length>0&&g.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:h.map(b=>g.jsx("button",{type:"button",onClick:()=>v(b.name),className:"rounded-full px-2 py-0.5 text-[11px] transition-opacity",style:{backgroundColor:c.has(b.name)?`#${b.color}33`:`#${b.color}15`,color:`#${b.color}`,opacity:c.size>0&&!c.has(b.name)?.5:1},children:b.name},b.name))})]}),g.jsxs("div",{className:"mb-3 text-[11px] text-zinc-500",children:[_.length," issue",_.length!==1?"s":"",_.length!==e.length?` (${e.length} total)`:""]}),_.length===0?g.jsx("div",{className:"flex items-center justify-center py-20 text-sm text-zinc-500",children:e.length===0?"No open issues":"No issues match filters"}):g.jsx("div",{className:"flex flex-col gap-2",children:_.map(b=>{const y=(n==null?void 0:n.number)===b.number,S=d.get(b.number);return g.jsx("button",{type:"button",onClick:()=>s(y?null:b),className:`rounded-lg border p-3 text-left transition-colors ${y?"border-cyan-500/30 bg-cyan-500/[0.06]":"border-white/5 bg-white/[0.02] hover:bg-white/[0.05]"}`,children:g.jsxs("div",{className:"flex items-start gap-2",children:[g.jsxs("span",{className:"shrink-0 text-sm font-medium text-green-400",children:["#",b.number]}),g.jsxs("div",{className:"min-w-0 flex-1",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"text-sm text-zinc-200",children:b.title}),S&&g.jsx("span",{className:`shrink-0 rounded-full px-1.5 py-0.5 text-[10px] font-medium ${S.isAgentActive?"bg-cyan-500/15 text-cyan-400":"bg-amber-500/15 text-amber-400"}`,children:S.isAgentActive?"In Progress":"Worktree"})]}),b.labels.length>0&&g.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1",children:b.labels.map(A=>g.jsx("span",{className:"rounded-full px-1.5 py-0.5 text-[10px]",style:{backgroundColor:`#${A.color}22`,color:`#${A.color}`},children:A.name},A.name))}),b.assignees.length>0&&g.jsx("div",{className:"mt-1 text-[10px] text-zinc-500",children:b.assignees.join(", ")})]})]})},b.number)})})]})}function o4(e){const t=Math.floor(Date.now()/1e3)-e;return t<60?"just now":t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}const Oy=3;function By({projectPath:e,projectName:t,worktrees:n,agents:s,onFocusAgent:a}){const[o,c]=N.useState(null),[f,d]=N.useState(null),[h,_]=N.useState(!0),[v,b]=N.useState(null),[y,S]=N.useState(!1),[A,R]=N.useState(!1),[D,W]=N.useState(null),[j,I]=N.useState(new Set),[J,L]=N.useState({}),[te,X]=N.useState([]),[pe,G]=N.useState(200),[K,V]=N.useState(null),[z,P]=N.useState(!1),[$,C]=N.useState(null),B=N.useRef(null),U=N.useRef(null),ce=N.useCallback(async()=>{try{const[se,Oe,nt,Je]=await Promise.all([we.listBranches(e),we.gitGraph(e,pe),we.listPrs(e).catch(()=>({})),we.listIssues(e).catch(()=>[])]);c(se),d(Oe),L(nt),X(Je)}catch{}},[e,pe]),w=N.useCallback(()=>{ce()},[ce]);N.useEffect(()=>{_(!0),S(!1),ce().finally(()=>_(!1))},[ce]),N.useEffect(()=>{o&&!y&&(b(o.current_branch??o.default_branch),S(!0))},[o,y]),N.useEffect(()=>{V(null)},[v]),N.useLayoutEffect(()=>{U.current!=null&&B.current&&(B.current.scrollTop=U.current,U.current=null)},[]);const T=e.replace(/\/\.git\/?$/,"").replace(/\/+$/,""),q=N.useMemo(()=>n.filter(se=>se.repo_path.replace(/\/\.git\/?$/,"").replace(/\/+$/,"")===T),[n,T]),k=N.useMemo(()=>{var on,Bn,St;const se=(o==null?void 0:o.default_branch)??"main",Oe=(o==null?void 0:o.current_branch)??null,nt=(o==null?void 0:o.parents)??{},Je=(o==null?void 0:o.ahead_behind)??{},fi=(o==null?void 0:o.remote_tracking)??{},gt=q.find(ze=>ze.is_main),Rt=[],Ot=new Map;for(const ze of s)ze.git_branch&&Ot.set(ze.git_branch,ze);Rt.push({name:se,parent:null,isWorktree:!1,isMain:!0,isCurrent:Oe===se,isDirty:(gt==null?void 0:gt.is_dirty)??!1,hasAgent:!!(gt!=null&&gt.agent_target),agentTarget:(gt==null?void 0:gt.agent_target)??((on=Ot.get(se))==null?void 0:on.target)??null,agentStatus:(gt==null?void 0:gt.agent_status)??(Ot.has(se)?zl(((Bn=Ot.get(se))==null?void 0:Bn.status)??"Unknown"):null),diffSummary:null,worktree:gt??null,ahead:0,behind:0,remote:fi[se]??null,isRemoteOnly:!1});for(const ze of q){if(ze.is_main)continue;const M=ze.branch||ze.name,re=Je[M];Rt.push({name:M,parent:nt[M]??se,isWorktree:!0,isMain:!1,isCurrent:Oe===M,isDirty:ze.is_dirty??!1,hasAgent:!!ze.agent_target,agentTarget:ze.agent_target??((St=Ot.get(M))==null?void 0:St.target)??null,agentStatus:ze.agent_status,diffSummary:ze.diff_summary,worktree:ze,ahead:(re==null?void 0:re[0])??0,behind:(re==null?void 0:re[1])??0,remote:fi[M]??null,isRemoteOnly:!1})}const Vi=new Set(Rt.map(ze=>ze.name));if(o){for(const ze of o.branches)if(!Vi.has(ze)){const M=Je[ze],re=Ot.get(ze);Rt.push({name:ze,parent:nt[ze]??se,isWorktree:!1,isMain:!1,isCurrent:Oe===ze,isDirty:!1,hasAgent:!!re,agentTarget:(re==null?void 0:re.target)??null,agentStatus:re?zl(re.status):null,diffSummary:null,worktree:null,ahead:(M==null?void 0:M[0])??0,behind:(M==null?void 0:M[1])??0,remote:fi[ze]??null,isRemoteOnly:!1})}}if(o!=null&&o.remote_only_branches)for(const ze of o.remote_only_branches)Rt.push({name:ze,parent:se,isWorktree:!1,isMain:!1,isCurrent:!1,isDirty:!1,hasAgent:!1,agentTarget:null,agentStatus:null,diffSummary:null,worktree:null,ahead:0,behind:0,remote:null,isRemoteOnly:!0});return Rt},[q,o,s]),ie=k.filter(se=>!se.isMain).length,ue=N.useMemo(()=>{const se=new Map,Oe=k[0];if(!Oe)return se;se.set(Oe.name,0);let nt=!0;for(;nt;){nt=!1;for(const Je of k){if(se.has(Je.name))continue;const fi=Je.parent?se.get(Je.parent):0;fi!==void 0&&(se.set(Je.name,fi+1),nt=!0)}}for(const Je of k)se.has(Je.name)||se.set(Je.name,1);return se},[k]),le=N.useMemo(()=>!f||!o?null:s4(f,o,k,j),[f,o,k,j]),ve=N.useMemo(()=>{const se={};for(const Oe of Object.values(J))Oe.base_branch&&(se[Oe.base_branch]||(se[Oe.base_branch]=[]),se[Oe.base_branch].push(Oe));return se},[J]),Ee=k.find(se=>se.name===v)??null,oe=N.useCallback(se=>{b(se)},[]),Ie=N.useCallback(se=>{I(Oe=>{const nt=new Set(Oe);return nt.has(se)?nt.delete(se):nt.add(se),nt})},[]),ot=N.useCallback(async()=>{if(!A){R(!0),W(null);try{await we.gitFetch(e),await ce()}catch(se){W(se instanceof Error?se.message:"Fetch failed")}finally{R(!1)}}},[A,e,ce]);N.useEffect(()=>{const se=setInterval(()=>{e&&Promise.all([we.listPrs(e).catch(()=>({})),we.listIssues(e).catch(()=>[])]).then(([Oe,nt])=>{Oe&&L(Oe),nt&&X(nt)})},3e4);return()=>clearInterval(se)},[e]);const yt=N.useCallback(se=>{P(!1),C(null),w(),setTimeout(()=>b(se),500)},[w]);return h?g.jsx("div",{className:"flex flex-1 items-center justify-center text-sm text-zinc-500",children:"Loading branches..."}):g.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[g.jsxs("div",{className:"glass shrink-0 border-b border-white/5 px-6 py-4",children:[g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",className:"text-emerald-400",role:"img","aria-label":"Branch graph",children:[g.jsx("title",{children:"Branch graph"}),g.jsx("circle",{cx:"4",cy:"4",r:"2",fill:"currentColor"}),g.jsx("circle",{cx:"4",cy:"12",r:"2",fill:"currentColor"}),g.jsx("circle",{cx:"12",cy:"8",r:"2",fill:"currentColor"}),g.jsx("line",{x1:"4",y1:"6",x2:"4",y2:"10",stroke:"currentColor",strokeWidth:"1.5"}),g.jsx("path",{d:"M4 6 C4 8, 8 8, 12 8",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})]}),g.jsx("h2",{className:"text-lg font-semibold text-zinc-100",children:t}),g.jsxs("div",{className:"flex gap-1 rounded-lg bg-white/5 p-0.5",children:[g.jsx("button",{type:"button",onClick:()=>{P(!1),C(null)},className:`rounded-md px-2.5 py-1 text-xs transition-colors ${z?"text-zinc-500 hover:text-zinc-300":"bg-white/10 text-zinc-200"}`,children:"Branches"}),g.jsxs("button",{type:"button",onClick:()=>P(!0),className:`rounded-md px-2.5 py-1 text-xs transition-colors ${z?"bg-white/10 text-zinc-200":"text-zinc-500 hover:text-zinc-300"}`,children:["Issues",te.length>0?` (${te.length})`:""]})]}),g.jsx("span",{className:"text-xs text-zinc-500",children:!z&&g.jsxs(g.Fragment,{children:[ie," branch",ie!==1?"es":"",(()=>{const se=q.filter(Oe=>!Oe.is_main).length;return se===0?null:` (${se} worktree${se!==1?"s":""})`})(),f&&g.jsxs(g.Fragment,{children:[" · ",f.total_count," commit",f.total_count!==1?"s":""]})]})}),g.jsx("div",{className:"flex-1"}),(o==null?void 0:o.last_fetch)&&g.jsxs("span",{className:"text-[10px] text-zinc-600",title:new Date(o.last_fetch*1e3).toLocaleString(),children:["fetched ",o4(o.last_fetch)]}),g.jsx("button",{type:"button",onClick:ot,disabled:A,className:"rounded-lg bg-white/5 px-3 py-1.5 text-xs text-zinc-400 transition-colors hover:bg-white/10 hover:text-zinc-200 disabled:opacity-50",children:A?"...":"Refresh"})]}),D&&g.jsx("div",{className:"mt-2 text-xs text-red-400",children:D})]}),g.jsx("div",{className:"flex flex-1 overflow-hidden",children:z?g.jsxs(g.Fragment,{children:[g.jsx(a4,{issues:te,worktrees:q,selectedIssue:$,onSelectIssue:C}),g.jsx(My,{activeNode:Ee??k[0],branches:o,projectPath:e,nodeDepth:ue,branchDepthWarning:Oy,prInfo:void 0,targetPrs:[],issues:te,onRefresh:w,onSelectNode:b,onFocusAgent:a,onOpenDetail:V,issueMode:!0,selectedIssue:$,defaultBranch:(o==null?void 0:o.default_branch)??"main",worktrees:q,onStartWorkDone:yt,onSelectWorktreeBranch:se=>{P(!1),C(null),b(se)}})]}):g.jsxs(g.Fragment,{children:[g.jsxs("div",{ref:B,className:"flex-1 overflow-auto p-6",children:[le&&le.lanes.length>0?g.jsx(l4,{layout:le,selectedBranch:v,repoPath:e,defaultBranch:(o==null?void 0:o.default_branch)??"main",collapsedLanes:j,prMap:J,onSelectBranch:oe,onToggleCollapse:Ie}):g.jsx("div",{className:"flex items-center justify-center py-20 text-sm text-zinc-500",children:(f==null?void 0:f.commits.length)===0?"No commits found":"Only the default branch exists"}),f&&f.commits.length>=pe&&g.jsx("div",{className:"mt-4 flex justify-center",children:g.jsxs("button",{type:"button",onClick:()=>{var se;U.current=((se=B.current)==null?void 0:se.scrollTop)??null,G(Oe=>Oe+200)},className:"rounded-lg bg-white/5 px-4 py-2 text-xs text-zinc-400 transition-colors hover:bg-white/10 hover:text-zinc-200",children:["Load more commits (",pe," shown)"]})}),k.filter(se=>!se.isMain&&!se.isWorktree&&!se.isRemoteOnly&&!se.hasAgent&&!se.isDirty&&se.ahead===0&&!se.isCurrent).length>0&&g.jsxs("div",{className:"mt-6 border-t border-white/5 pt-4",children:[g.jsx("div",{className:"mb-2 text-[11px] text-zinc-600",children:"Inactive branches"}),g.jsx("div",{className:"flex flex-wrap gap-1.5",children:k.filter(se=>!se.isMain&&!se.isWorktree&&!se.isRemoteOnly&&!se.hasAgent&&!se.isDirty&&se.ahead===0&&!se.isCurrent).map(se=>g.jsxs("button",{type:"button",onClick:()=>oe(se.name),className:`rounded-md px-2 py-1 text-[11px] transition-colors ${v===se.name?"bg-cyan-500/15 text-cyan-400":"bg-white/5 text-zinc-500 hover:bg-white/10 hover:text-zinc-300"}`,children:[se.name,se.behind>0&&g.jsxs("span",{className:"ml-1 text-[10px] text-red-400",children:[se.behind,"\\u2193"]})]},se.name))})]}),k.filter(se=>se.isRemoteOnly).length>0&&g.jsxs("div",{className:"mt-6 border-t border-white/5 pt-4",children:[g.jsx("div",{className:"mb-2 text-[11px] text-zinc-600",children:"Remote branches"}),g.jsx("div",{className:"flex flex-wrap gap-1.5",children:k.filter(se=>se.isRemoteOnly).map(se=>g.jsxs("button",{type:"button",onClick:()=>oe(se.name),className:`rounded-md px-2 py-1 text-[11px] transition-colors ${v===se.name?"bg-purple-500/15 text-purple-400":"bg-white/5 text-zinc-500 hover:bg-white/10 hover:text-zinc-300"}`,children:[g.jsx("span",{className:"mr-1 text-[10px] text-purple-500/60",children:"remote"}),se.name]},se.name))})]})]}),K&&Ee&&g.jsx($z,{view:K,projectPath:e,activeNode:Ee,branches:o,onClose:()=>V(null)}),Ee&&g.jsx(My,{activeNode:Ee,branches:o,projectPath:e,nodeDepth:ue,branchDepthWarning:Oy,prInfo:J[Ee.name],targetPrs:ve[Ee.name]??[],issues:te,onRefresh:w,onSelectNode:b,onFocusAgent:a,onOpenDetail:V})]})})]})}function c4({worktree:e,onLaunched:t,onDeleted:n}){const[s,a]=N.useState(null),[o,c]=N.useState(!1),[f,d]=N.useState(null),[h,_]=N.useState(!1),[v,b]=N.useState(!1),[y,S]=N.useState(!1),[A,R]=N.useState(!1),D=N.useCallback(async()=>{c(!0),d(null);try{const L=await we.getWorktreeDiff(e.path);a(L)}catch(L){d(L instanceof Error?L.message:"Failed to load diff")}finally{c(!1)}},[e.path]);N.useEffect(()=>{D()},[D]);const W=async()=>{if(!h){_(!0);try{const L=await we.launchWorktreeAgent(e.repo_path,e.name);t(L.target)}catch{}finally{_(!1)}}},j=async()=>{if(!v){b(!0);try{await we.deleteWorktree(e.repo_path,e.name,A),n()}catch{}finally{b(!1),S(!1),R(!1)}}},I=e.diff_summary,J=!!e.agent_target;return g.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[g.jsxs("div",{className:"glass shrink-0 border-b border-white/5 px-6 py-4",children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"text-emerald-500",children:"🌿"}),g.jsx("h2",{className:"text-lg font-semibold text-zinc-100",children:e.branch||e.name}),e.is_dirty&&g.jsx("span",{className:"text-sm text-amber-500",children:"*"})]}),g.jsxs("div",{className:"mt-1 flex items-center gap-3 text-xs text-zinc-500",children:[I&&g.jsxs("span",{children:[g.jsxs("span",{className:"text-emerald-400",children:["+",I.insertions]})," ",g.jsxs("span",{className:"text-red-400",children:["-",I.deletions]})," · ",I.files_changed," file",I.files_changed!==1?"s":""]}),J?g.jsxs("span",{className:"text-cyan-400",children:["Agent: ",e.agent_status||"active"]}):g.jsx("span",{className:"text-zinc-600",children:"No agent"})]})]}),g.jsx("div",{className:"flex items-center gap-2 text-xs text-zinc-500",children:g.jsx("span",{className:"font-mono",children:e.repo_name})})]}),g.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[!J&&g.jsx("button",{type:"button",onClick:W,disabled:h,className:"rounded-lg bg-cyan-500/15 px-3 py-1.5 text-xs font-medium text-cyan-400 transition-colors hover:bg-cyan-500/25 disabled:opacity-50",children:h?"Launching...":"Launch Agent"}),y?g.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-red-500/20 bg-red-500/5 px-3 py-1.5",children:[g.jsxs("label",{className:"flex items-center gap-1.5 text-[11px] text-zinc-400",children:[g.jsx("input",{type:"checkbox",checked:A,onChange:L=>R(L.target.checked),className:"accent-red-500"}),"Force"]}),g.jsx("button",{type:"button",onClick:j,disabled:v,className:"rounded bg-red-500/20 px-2 py-0.5 text-xs text-red-400 transition-colors hover:bg-red-500/30 disabled:opacity-50",children:v?"Deleting...":"Confirm"}),g.jsx("button",{type:"button",onClick:()=>{S(!1),R(!1)},className:"text-xs text-zinc-500 transition-colors hover:text-zinc-300",children:"Cancel"})]}):g.jsx("button",{type:"button",onClick:()=>S(!0),className:"rounded-lg bg-red-500/10 px-3 py-1.5 text-xs font-medium text-red-400 transition-colors hover:bg-red-500/20",children:"Delete"}),g.jsx("button",{type:"button",onClick:D,disabled:o,className:"rounded-lg bg-white/5 px-3 py-1.5 text-xs text-zinc-400 transition-colors hover:bg-white/10 disabled:opacity-50",children:o?"Loading...":"Refresh Diff"})]})]}),g.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:f?g.jsx("div",{className:"rounded-lg border border-red-500/20 bg-red-500/5 px-4 py-3 text-sm text-red-400",children:f}):o&&!s?g.jsx("div",{className:"py-8 text-center text-sm text-zinc-500",children:"Loading diff..."}):s!=null&&s.diff?g.jsx(f1,{diff:s.diff}):g.jsx("div",{className:"py-8 text-center text-sm text-zinc-500",children:"No changes vs base branch"})})]})}var jy;(function(e){e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_CREATED="tauri://window-created",e.WEBVIEW_CREATED="tauri://webview-created",e.DRAG_ENTER="tauri://drag-enter",e.DRAG_OVER="tauri://drag-over",e.DRAG_DROP="tauri://drag-drop",e.DRAG_LEAVE="tauri://drag-leave"})(jy||(jy={}));async function u4(e,t){window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(e,t),await Di("plugin:event|unlisten",{event:e,eventId:t})}async function h4(e,t,n){var s;const a=(s=void 0)!==null&&s!==void 0?s:{kind:"Any"};return Di("plugin:event|listen",{event:e,target:a,handler:qp(t)}).then(o=>async()=>u4(e,o))}function f4(e){const t=N.useCallback(n=>{e(n.payload)},[e]);return N.useEffect(()=>{let n=!0,s=null;return h4("core-event",t).then(a=>{n?s=a:a()}).catch(a=>{}),()=>{n=!1,s&&s()}},[t]),{isListening:!0}}function d4(){const[e,t]=N.useState([]),[n,s]=N.useState(0),[a,o]=N.useState(!0),c=N.useCallback(async()=>{try{const d=await we.listAgents();t(d),s(d.filter(h=>ho(h.status)).length)}catch{}finally{o(!1)}},[]),f=N.useCallback(d=>{d.type==="agents-updated"&&c()},[c]);return f4(f),N.useEffect(()=>{const d=setInterval(()=>{c().then(()=>clearInterval(d))},500),{unlisten:h}=Wp({onAgents:_=>{t(_),s(_.filter(v=>ho(v.status)).length),o(!1)}});return()=>{clearInterval(d),h()}},[c]),{agents:e,attentionCount:n,loading:a,refresh:c}}function p4(e){const t=N.useRef(e);t.current=e,N.useEffect(()=>{const n=s=>{const a=s.target;if(!((a.tagName==="INPUT"||a.tagName==="TEXTAREA"||a.contentEditable==="true")&&!["Escape"].includes(s.key)))for(const c of t.current){const f=c.keys.includes(s.key.toLowerCase())||c.keys.includes(s.code.toLowerCase()),d=c.requiresCtrl?s.ctrlKey||s.metaKey:!s.ctrlKey&&!s.metaKey,h=c.requiresShift?s.shiftKey:!s.shiftKey,_=c.requiresAlt?s.altKey:!s.altKey;if(f&&d&&h&&_){s.preventDefault(),c.handler();break}}};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[])}const jd="tmai:split-ratio",Hy="tmai:split-enabled",Hd=.5,Iy=.2,Py=.8,Uy="(min-width: 1024px)";function m4(e,t){try{const n=localStorage.getItem(e);if(n===null)return t;const s=Number.parseFloat(n);return Number.isFinite(s)?s:t}catch{return t}}function g4(e,t){try{const n=localStorage.getItem(e);return n===null?t:n==="true"}catch{return t}}function _4(){const e=N.useRef(null),[t,n]=N.useState(()=>{const y=m4(jd,Hd);return Math.max(Iy,Math.min(Py,y))}),[s,a]=N.useState(()=>g4(Hy,!0)),[o,c]=N.useState(!1),[f,d]=N.useState(()=>typeof window>"u"?!1:!window.matchMedia(Uy).matches),h=N.useCallback(y=>{a(y);try{localStorage.setItem(Hy,String(y))}catch{}},[]);N.useEffect(()=>{const y=window.matchMedia(Uy),S=A=>d(!A.matches);return y.addEventListener("change",S),()=>y.removeEventListener("change",S)},[]);const _=N.useCallback(y=>{y.preventDefault(),c(!0)},[]),v=N.useCallback(()=>{n(Hd);try{localStorage.setItem(jd,String(Hd))}catch{}},[]),b=N.useRef(t);return b.current=t,N.useEffect(()=>{if(!o)return;const y=A=>{const R=e.current;if(!R)return;const D=R.getBoundingClientRect(),W=(A.clientX-D.left)/D.width;n(Math.max(Iy,Math.min(Py,W)))},S=()=>{c(!1);try{localStorage.setItem(jd,String(b.current))}catch{}window.dispatchEvent(new Event("resize"))};return document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",y),document.addEventListener("mouseup",S),()=>{document.body.style.cursor="",document.body.style.userSelect="",document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",S)}},[o]),{splitRatio:t,splitEnabled:s,setSplitEnabled:h,isDragging:o,isNarrowScreen:f,containerRef:e,onDividerMouseDown:_,onDividerDoubleClick:v}}function v4(){const[e,t]=N.useState([]),[n,s]=N.useState(!0),a=N.useCallback(async()=>{try{const o=await we.listWorktrees();t(o)}catch{}finally{s(!1)}},[]);return N.useEffect(()=>{a();const{unlisten:o}=Wp({onAgents:()=>{a()},onEvent:c=>{(c==="worktree_created"||c==="worktree_removed")&&a()}});return()=>{o()}},[a]),{worktrees:e,loading:n,refresh:a}}function b4(){const{agents:e,attentionCount:t,loading:n,refresh:s}=d4(),{worktrees:a,refresh:o}=v4(),c=I2(),[f,d]=N.useState(null),[h,_]=N.useState([]),[v,b]=N.useState(null),[y,S]=N.useState(0),[A,R]=N.useState(!1),[D,W]=N.useState(!1),[j,I]=N.useState(!1),[J,L]=N.useState("git"),{splitRatio:te,splitEnabled:X,setSplitEnabled:pe,isDragging:G,isNarrowScreen:K,containerRef:V,onDividerMouseDown:z,onDividerDoubleClick:P}=_4(),$=N.useCallback(()=>{we.listProjects().then(oe=>{_(oe),oe.length>0&&b(Ie=>Ie??oe[0])}).catch(oe=>{c.error("Failed to load projects")})},[c]);N.useEffect(()=>{$()},[$]);const C=N.useMemo(()=>e.filter(oe=>Id(oe.agent_type)),[e]),B=N.useMemo(()=>e.filter(oe=>!Id(oe.agent_type)),[e]),U=(f==null?void 0:f.type)==="agent"?e.find(oe=>oe.id===f.id||oe.target===f.id):void 0,ce=(U==null?void 0:U.pty_session_id)??null,w=(f==null?void 0:f.type)==="worktree"?a.find(oe=>oe.repo_path===f.repoPath&&oe.name===f.name):void 0,T=N.useCallback(oe=>{d({type:"agent",id:oe}),R(!1),W(!1),s(),c.success("Agent spawned")},[s,c]),q=N.useCallback(oe=>{d({type:"agent",id:oe}),R(!1),W(!1)},[]),k=N.useCallback((oe,Ie)=>{d({type:"project",path:oe,name:Ie}),R(!1),W(!1)},[]),ie=N.useCallback((oe,Ie)=>{d({type:"markdown",projectPath:oe,projectName:Ie}),R(!1),W(!1)},[]),ue=(f==null?void 0:f.type)==="agent"?f.id:null,le=(U==null?void 0:U.git_common_dir)??null,ve=le?le.replace(/\/\.git\/?$/,"").replace(/\/+$/,"").split("/").pop()??le:null,Ee=(f==null?void 0:f.type)==="agent"&&le!==null&&X&&!K;return p4([{keys:["?"],description:"Toggle help menu",handler:()=>I(oe=>!oe)},{keys:["s"],description:"Toggle settings",handler:()=>{R(oe=>!oe),W(!1)}},{keys:["["],description:"Previous project",handler:()=>{const oe=Math.max(0,y-1);S(oe),h[oe]&&(b(h[oe]),c.info("Previous project"))}},{keys:["\\"],description:"Toggle split view",handler:()=>pe(!X)},{keys:["]"],description:"Next project",handler:()=>{const oe=Math.min(h.length-1,y+1);S(oe),h[oe]&&(b(h[oe]),c.info("Next project"))}}]),N.useEffect(()=>{const oe=Ie=>{Ie.key==="Escape"&&j&&I(!1)};return window.addEventListener("keydown",oe),()=>window.removeEventListener("keydown",oe)},[j]),N.useEffect(()=>{const oe=h.indexOf(v||"");oe>=0&&S(oe)},[v,h]),g.jsxs("div",{className:"flex h-screen text-zinc-100",children:[g.jsxs("aside",{className:"glass flex w-80 shrink-0 flex-col transition-subtle",children:[g.jsx(B2,{agentCount:C.length,attentionCount:t,onSettingsClick:()=>{R(oe=>!oe),W(!1)},onSecurityClick:()=>{W(oe=>!oe),R(!1)}}),g.jsx(Wk,{agents:C,loading:n,selection:f,onSelectAgent:q,onSelectProject:k,onSelectMarkdown:ie,registeredProjects:h,worktrees:a,onSpawned:T}),g.jsx(gR,{terminals:B,selectedTarget:ue,onSelect:q}),g.jsx(zz,{})]}),g.jsx("main",{className:"flex flex-1 flex-col overflow-hidden transition-subtle",children:D?g.jsx("div",{className:"flex flex-1 flex-col overflow-hidden animate-scale-in",children:g.jsx(dR,{onClose:()=>W(!1)})}):A?g.jsx("div",{className:"flex flex-1 flex-col overflow-hidden animate-scale-in",children:g.jsx(mR,{onClose:()=>R(!1),onProjectsChanged:$})}):(f==null?void 0:f.type)==="project"?g.jsx("div",{className:"flex flex-1 flex-col overflow-hidden animate-fade-in",children:g.jsx(By,{projectPath:f.path,projectName:f.name,worktrees:a,agents:C,onFocusAgent:q},f.path)}):(f==null?void 0:f.type)==="markdown"?g.jsx("div",{className:"flex flex-1 flex-col overflow-hidden animate-fade-in",children:g.jsx(zb,{projectPath:f.projectPath,projectName:f.projectName},f.projectPath)}):(f==null?void 0:f.type)==="worktree"&&w?g.jsx("div",{className:"flex flex-1 flex-col overflow-hidden animate-fade-in",children:g.jsx(c4,{worktree:w,onLaunched:oe=>{T(oe),o()},onDeleted:()=>{d(null),o(),c.success("Worktree deleted")}})}):Ee&&U&&le&&ve?g.jsx(O2,{left:g.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[g.jsx(kv,{agent:U,passthrough:!0}),ce?g.jsx("div",{className:"flex-1 overflow-hidden animate-fade-in",children:g.jsx(Ny,{sessionId:ce})},ce):g.jsx("div",{className:"flex flex-1 flex-col overflow-hidden animate-fade-in",children:g.jsx(Uv,{agentId:U.id})},U.id)]}),right:J==="git"?g.jsx(By,{projectPath:le,projectName:ve,worktrees:a,agents:C,onFocusAgent:q},le):g.jsx(zb,{projectPath:le,projectName:ve},le),rightTab:J,onTabChange:L,splitRatio:te,isDragging:G,containerRef:V,onDividerMouseDown:z,onDividerDoubleClick:P}):g.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[U&&g.jsx(kv,{agent:U,passthrough:!0}),ce?g.jsx("div",{className:"flex-1 overflow-hidden animate-fade-in",children:g.jsx(Ny,{sessionId:ce})},ce):U?g.jsx("div",{className:"flex flex-1 flex-col overflow-hidden animate-fade-in",children:g.jsx(Uv,{agentId:U.id})},U.id):g.jsx("div",{className:"flex flex-1 items-center justify-center animate-fade-in",children:g.jsxs("div",{className:"glass-light rounded-2xl px-12 py-10 text-center transition-subtle hover:glass",children:[g.jsx("h1",{className:"bg-gradient-to-r from-cyan-400 to-blue-500 bg-clip-text text-3xl font-bold tracking-tight text-transparent",children:"tmai"}),g.jsx("p",{className:"mt-2 text-sm text-zinc-500",children:e.length>0?"Select an agent to view • Press ? for shortcuts":"Click + on a project to spawn an agent • Press ? for shortcuts"})]})})]})}),g.jsx(z2,{isOpen:j,onClose:()=>I(!1)}),g.jsx(j2,{toasts:c.toasts,onRemove:c.removeToast})]})}DC.createRoot(document.getElementById("root")).render(g.jsx(N.StrictMode,{children:g.jsx(RC,{children:g.jsx(b4,{})})}));
