create-claudeportal 0.3.9 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/index-Dorw4dQE.js +171 -0
- package/dist/index.html +1 -1
- package/package.json +2 -1
- package/server/index.js +2 -0
- package/server/lib/agent-storage.js +64 -0
- package/server/lib/agents.js +81 -0
- package/server/routes/agent.js +144 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/assets/index-CjHE0n_q.js +0 -161
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))l(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&l(d)}).observe(document,{childList:!0,subtree:!0});function n(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function l(o){if(o.ep)return;o.ep=!0;const c=n(o);fetch(o.href,c)}})();var Oh={exports:{}},Vn={};var u_;function fx(){if(u_)return Vn;u_=1;var e=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function n(l,o,c){var d=null;if(c!==void 0&&(d=""+c),o.key!==void 0&&(d=""+o.key),"key"in o){c={};for(var _ in o)_!=="key"&&(c[_]=o[_])}else c=o;return o=c.ref,{$$typeof:e,type:l,key:d,ref:o!==void 0?o:null,props:c}}return Vn.Fragment=i,Vn.jsx=n,Vn.jsxs=n,Vn}var d_;function px(){return d_||(d_=1,Oh.exports=fx()),Oh.exports}var p=px(),jh={exports:{}},_e={};var f_;function gx(){if(f_)return _e;f_=1;var e=Symbol.for("react.transitional.element"),i=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),d=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),b=Symbol.iterator;function w(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(){}},R=Object.assign,z={};function A(T,K,ee){this.props=T,this.context=K,this.refs=z,this.updater=ee||S}A.prototype.isReactComponent={},A.prototype.setState=function(T,K){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,K,"setState")},A.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function W(){}W.prototype=A.prototype;function j(T,K,ee){this.props=T,this.context=K,this.refs=z,this.updater=ee||S}var C=j.prototype=new W;C.constructor=j,R(C,A.prototype),C.isPureReactComponent=!0;var O=Array.isArray;function G(){}var Z={H:null,A:null,T:null,S:null},ae=Object.prototype.hasOwnProperty;function pe(T,K,ee){var ie=ee.ref;return{$$typeof:e,type:T,key:K,ref:ie!==void 0?ie:null,props:ee}}function Oe(T,K){return pe(T.type,K,T.props)}function he(T){return typeof T=="object"&&T!==null&&T.$$typeof===e}function V(T){var K={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(ee){return K[ee]})}var X=/\/+/g;function te(T,K){return typeof T=="object"&&T!==null&&T.key!=null?V(""+T.key):K.toString(36)}function Q(T){switch(T.status){case"fulfilled":return T.value;case"rejected":throw T.reason;default:switch(typeof T.status=="string"?T.then(G,G):(T.status="pending",T.then(function(K){T.status==="pending"&&(T.status="fulfilled",T.value=K)},function(K){T.status==="pending"&&(T.status="rejected",T.reason=K)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function B(T,K,ee,ie,ce){var de=typeof T;(de==="undefined"||de==="boolean")&&(T=null);var Se=!1;if(T===null)Se=!0;else switch(de){case"bigint":case"string":case"number":Se=!0;break;case"object":switch(T.$$typeof){case e:case i:Se=!0;break;case x:return Se=T._init,B(Se(T._payload),K,ee,ie,ce)}}if(Se)return ce=ce(T),Se=ie===""?"."+te(T,0):ie,O(ce)?(ee="",Se!=null&&(ee=Se.replace(X,"$&/")+"/"),B(ce,K,ee,"",function(wi){return wi})):ce!=null&&(he(ce)&&(ce=Oe(ce,ee+(ce.key==null||T&&T.key===ce.key?"":(""+ce.key).replace(X,"$&/")+"/")+Se)),K.push(ce)),1;Se=0;var ot=ie===""?".":ie+":";if(O(T))for(var Ae=0;Ae<T.length;Ae++)ie=T[Ae],de=ot+te(ie,Ae),Se+=B(ie,K,ee,de,ce);else if(Ae=w(T),typeof Ae=="function")for(T=Ae.call(T),Ae=0;!(ie=T.next()).done;)ie=ie.value,de=ot+te(ie,Ae++),Se+=B(ie,K,ee,de,ce);else if(de==="object"){if(typeof T.then=="function")return B(Q(T),K,ee,ie,ce);throw K=String(T),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys(T).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.")}return Se}function q(T,K,ee){if(T==null)return T;var ie=[],ce=0;return B(T,ie,"","",function(de){return K.call(ee,de,ce++)}),ie}function I(T){if(T._status===-1){var K=T._result;K=K(),K.then(function(ee){(T._status===0||T._status===-1)&&(T._status=1,T._result=ee)},function(ee){(T._status===0||T._status===-1)&&(T._status=2,T._result=ee)}),T._status===-1&&(T._status=0,T._result=K)}if(T._status===1)return T._result.default;throw T._result}var ne=typeof reportError=="function"?reportError:function(T){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var K=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(K))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",T);return}console.error(T)},ge={map:q,forEach:function(T,K,ee){q(T,function(){K.apply(this,arguments)},ee)},count:function(T){var K=0;return q(T,function(){K++}),K},toArray:function(T){return q(T,function(K){return K})||[]},only:function(T){if(!he(T))throw Error("React.Children.only expected to receive a single React element child.");return T}};return _e.Activity=v,_e.Children=ge,_e.Component=A,_e.Fragment=n,_e.Profiler=o,_e.PureComponent=j,_e.StrictMode=l,_e.Suspense=g,_e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Z,_e.__COMPILER_RUNTIME={__proto__:null,c:function(T){return Z.H.useMemoCache(T)}},_e.cache=function(T){return function(){return T.apply(null,arguments)}},_e.cacheSignal=function(){return null},_e.cloneElement=function(T,K,ee){if(T==null)throw Error("The argument must be a React element, but you passed "+T+".");var ie=R({},T.props),ce=T.key;if(K!=null)for(de in K.key!==void 0&&(ce=""+K.key),K)!ae.call(K,de)||de==="key"||de==="__self"||de==="__source"||de==="ref"&&K.ref===void 0||(ie[de]=K[de]);var de=arguments.length-2;if(de===1)ie.children=ee;else if(1<de){for(var Se=Array(de),ot=0;ot<de;ot++)Se[ot]=arguments[ot+2];ie.children=Se}return pe(T.type,ce,ie)},_e.createContext=function(T){return T={$$typeof:d,_currentValue:T,_currentValue2:T,_threadCount:0,Provider:null,Consumer:null},T.Provider=T,T.Consumer={$$typeof:c,_context:T},T},_e.createElement=function(T,K,ee){var ie,ce={},de=null;if(K!=null)for(ie in K.key!==void 0&&(de=""+K.key),K)ae.call(K,ie)&&ie!=="key"&&ie!=="__self"&&ie!=="__source"&&(ce[ie]=K[ie]);var Se=arguments.length-2;if(Se===1)ce.children=ee;else if(1<Se){for(var ot=Array(Se),Ae=0;Ae<Se;Ae++)ot[Ae]=arguments[Ae+2];ce.children=ot}if(T&&T.defaultProps)for(ie in Se=T.defaultProps,Se)ce[ie]===void 0&&(ce[ie]=Se[ie]);return pe(T,de,ce)},_e.createRef=function(){return{current:null}},_e.forwardRef=function(T){return{$$typeof:_,render:T}},_e.isValidElement=he,_e.lazy=function(T){return{$$typeof:x,_payload:{_status:-1,_result:T},_init:I}},_e.memo=function(T,K){return{$$typeof:f,type:T,compare:K===void 0?null:K}},_e.startTransition=function(T){var K=Z.T,ee={};Z.T=ee;try{var ie=T(),ce=Z.S;ce!==null&&ce(ee,ie),typeof ie=="object"&&ie!==null&&typeof ie.then=="function"&&ie.then(G,ne)}catch(de){ne(de)}finally{K!==null&&ee.types!==null&&(K.types=ee.types),Z.T=K}},_e.unstable_useCacheRefresh=function(){return Z.H.useCacheRefresh()},_e.use=function(T){return Z.H.use(T)},_e.useActionState=function(T,K,ee){return Z.H.useActionState(T,K,ee)},_e.useCallback=function(T,K){return Z.H.useCallback(T,K)},_e.useContext=function(T){return Z.H.useContext(T)},_e.useDebugValue=function(){},_e.useDeferredValue=function(T,K){return Z.H.useDeferredValue(T,K)},_e.useEffect=function(T,K){return Z.H.useEffect(T,K)},_e.useEffectEvent=function(T){return Z.H.useEffectEvent(T)},_e.useId=function(){return Z.H.useId()},_e.useImperativeHandle=function(T,K,ee){return Z.H.useImperativeHandle(T,K,ee)},_e.useInsertionEffect=function(T,K){return Z.H.useInsertionEffect(T,K)},_e.useLayoutEffect=function(T,K){return Z.H.useLayoutEffect(T,K)},_e.useMemo=function(T,K){return Z.H.useMemo(T,K)},_e.useOptimistic=function(T,K){return Z.H.useOptimistic(T,K)},_e.useReducer=function(T,K,ee){return Z.H.useReducer(T,K,ee)},_e.useRef=function(T){return Z.H.useRef(T)},_e.useState=function(T){return Z.H.useState(T)},_e.useSyncExternalStore=function(T,K,ee){return Z.H.useSyncExternalStore(T,K,ee)},_e.useTransition=function(){return Z.H.useTransition()},_e.version="19.2.4",_e}var p_;function qu(){return p_||(p_=1,jh.exports=gx()),jh.exports}var E=qu(),Lh={exports:{}},Zn={},Nh={exports:{}},Hh={};var g_;function _x(){return g_||(g_=1,(function(e){function i(B,q){var I=B.length;B.push(q);e:for(;0<I;){var ne=I-1>>>1,ge=B[ne];if(0<o(ge,q))B[ne]=q,B[I]=ge,I=ne;else break e}}function n(B){return B.length===0?null:B[0]}function l(B){if(B.length===0)return null;var q=B[0],I=B.pop();if(I!==q){B[0]=I;e:for(var ne=0,ge=B.length,T=ge>>>1;ne<T;){var K=2*(ne+1)-1,ee=B[K],ie=K+1,ce=B[ie];if(0>o(ee,I))ie<ge&&0>o(ce,ee)?(B[ne]=ce,B[ie]=I,ne=ie):(B[ne]=ee,B[K]=I,ne=K);else if(ie<ge&&0>o(ce,I))B[ne]=ce,B[ie]=I,ne=ie;else break e}}return q}function o(B,q){var I=B.sortIndex-q.sortIndex;return I!==0?I:B.id-q.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var d=Date,_=d.now();e.unstable_now=function(){return d.now()-_}}var g=[],f=[],x=1,v=null,b=3,w=!1,S=!1,R=!1,z=!1,A=typeof setTimeout=="function"?setTimeout:null,W=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;function C(B){for(var q=n(f);q!==null;){if(q.callback===null)l(f);else if(q.startTime<=B)l(f),q.sortIndex=q.expirationTime,i(g,q);else break;q=n(f)}}function O(B){if(R=!1,C(B),!S)if(n(g)!==null)S=!0,G||(G=!0,V());else{var q=n(f);q!==null&&Q(O,q.startTime-B)}}var G=!1,Z=-1,ae=5,pe=-1;function Oe(){return z?!0:!(e.unstable_now()-pe<ae)}function he(){if(z=!1,G){var B=e.unstable_now();pe=B;var q=!0;try{e:{S=!1,R&&(R=!1,W(Z),Z=-1),w=!0;var I=b;try{t:{for(C(B),v=n(g);v!==null&&!(v.expirationTime>B&&Oe());){var ne=v.callback;if(typeof ne=="function"){v.callback=null,b=v.priorityLevel;var ge=ne(v.expirationTime<=B);if(B=e.unstable_now(),typeof ge=="function"){v.callback=ge,C(B),q=!0;break t}v===n(g)&&l(g),C(B)}else l(g);v=n(g)}if(v!==null)q=!0;else{var T=n(f);T!==null&&Q(O,T.startTime-B),q=!1}}break e}finally{v=null,b=I,w=!1}q=void 0}}finally{q?V():G=!1}}}var V;if(typeof j=="function")V=function(){j(he)};else if(typeof MessageChannel<"u"){var X=new MessageChannel,te=X.port2;X.port1.onmessage=he,V=function(){te.postMessage(null)}}else V=function(){A(he,0)};function Q(B,q){Z=A(function(){B(e.unstable_now())},q)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(B){B.callback=null},e.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ae=0<B?Math.floor(1e3/B):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(B){switch(b){case 1:case 2:case 3:var q=3;break;default:q=b}var I=b;b=q;try{return B()}finally{b=I}},e.unstable_requestPaint=function(){z=!0},e.unstable_runWithPriority=function(B,q){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var I=b;b=B;try{return q()}finally{b=I}},e.unstable_scheduleCallback=function(B,q,I){var ne=e.unstable_now();switch(typeof I=="object"&&I!==null?(I=I.delay,I=typeof I=="number"&&0<I?ne+I:ne):I=ne,B){case 1:var ge=-1;break;case 2:ge=250;break;case 5:ge=1073741823;break;case 4:ge=1e4;break;default:ge=5e3}return ge=I+ge,B={id:x++,callback:q,priorityLevel:B,startTime:I,expirationTime:ge,sortIndex:-1},I>ne?(B.sortIndex=I,i(f,B),n(g)===null&&B===n(f)&&(R?(W(Z),Z=-1):R=!0,Q(O,I-ne))):(B.sortIndex=ge,i(g,B),S||w||(S=!0,G||(G=!0,V()))),B},e.unstable_shouldYield=Oe,e.unstable_wrapCallback=function(B){var q=b;return function(){var I=b;b=q;try{return B.apply(this,arguments)}finally{b=I}}}})(Hh)),Hh}var __;function mx(){return __||(__=1,Nh.exports=_x()),Nh.exports}var Uh={exports:{}},Tt={};var m_;function vx(){if(m_)return Tt;m_=1;var e=qu();function i(g){var f="https://react.dev/errors/"+g;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var x=2;x<arguments.length;x++)f+="&args[]="+encodeURIComponent(arguments[x])}return"Minified React error #"+g+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var l={d:{f:n,r:function(){throw Error(i(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},o=Symbol.for("react.portal");function c(g,f,x){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:v==null?null:""+v,children:g,containerInfo:f,implementation:x}}var d=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function _(g,f){if(g==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return Tt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,Tt.createPortal=function(g,f){var x=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(i(299));return c(g,f,null,x)},Tt.flushSync=function(g){var f=d.T,x=l.p;try{if(d.T=null,l.p=2,g)return g()}finally{d.T=f,l.p=x,l.d.f()}},Tt.preconnect=function(g,f){typeof g=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,l.d.C(g,f))},Tt.prefetchDNS=function(g){typeof g=="string"&&l.d.D(g)},Tt.preinit=function(g,f){if(typeof g=="string"&&f&&typeof f.as=="string"){var x=f.as,v=_(x,f.crossOrigin),b=typeof f.integrity=="string"?f.integrity:void 0,w=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;x==="style"?l.d.S(g,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:v,integrity:b,fetchPriority:w}):x==="script"&&l.d.X(g,{crossOrigin:v,integrity:b,fetchPriority:w,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},Tt.preinitModule=function(g,f){if(typeof g=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var x=_(f.as,f.crossOrigin);l.d.M(g,{crossOrigin:x,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&l.d.M(g)},Tt.preload=function(g,f){if(typeof g=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var x=f.as,v=_(x,f.crossOrigin);l.d.L(g,x,{crossOrigin:v,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},Tt.preloadModule=function(g,f){if(typeof g=="string")if(f){var x=_(f.as,f.crossOrigin);l.d.m(g,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:x,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else l.d.m(g)},Tt.requestFormReset=function(g){l.d.r(g)},Tt.unstable_batchedUpdates=function(g,f){return g(f)},Tt.useFormState=function(g,f,x){return d.H.useFormState(g,f,x)},Tt.useFormStatus=function(){return d.H.useHostTransitionStatus()},Tt.version="19.2.4",Tt}var v_;function yx(){if(v_)return Uh.exports;v_=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(i){console.error(i)}}return e(),Uh.exports=vx(),Uh.exports}var y_;function xx(){if(y_)return Zn;y_=1;var e=mx(),i=qu(),n=yx();function l(t){var s="https://react.dev/errors/"+t;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)s+="&args[]="+encodeURIComponent(arguments[r])}return"Minified React error #"+t+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function c(t){var s=t,r=t;if(t.alternate)for(;s.return;)s=s.return;else{t=s;do s=t,(s.flags&4098)!==0&&(r=s.return),t=s.return;while(t)}return s.tag===3?r:null}function d(t){if(t.tag===13){var s=t.memoizedState;if(s===null&&(t=t.alternate,t!==null&&(s=t.memoizedState)),s!==null)return s.dehydrated}return null}function _(t){if(t.tag===31){var s=t.memoizedState;if(s===null&&(t=t.alternate,t!==null&&(s=t.memoizedState)),s!==null)return s.dehydrated}return null}function g(t){if(c(t)!==t)throw Error(l(188))}function f(t){var s=t.alternate;if(!s){if(s=c(t),s===null)throw Error(l(188));return s!==t?null:t}for(var r=t,a=s;;){var h=r.return;if(h===null)break;var u=h.alternate;if(u===null){if(a=h.return,a!==null){r=a;continue}break}if(h.child===u.child){for(u=h.child;u;){if(u===r)return g(h),t;if(u===a)return g(h),s;u=u.sibling}throw Error(l(188))}if(r.return!==a.return)r=h,a=u;else{for(var m=!1,y=h.child;y;){if(y===r){m=!0,r=h,a=u;break}if(y===a){m=!0,a=h,r=u;break}y=y.sibling}if(!m){for(y=u.child;y;){if(y===r){m=!0,r=u,a=h;break}if(y===a){m=!0,a=u,r=h;break}y=y.sibling}if(!m)throw Error(l(189))}}if(r.alternate!==a)throw Error(l(190))}if(r.tag!==3)throw Error(l(188));return r.stateNode.current===r?t:s}function x(t){var s=t.tag;if(s===5||s===26||s===27||s===6)return t;for(t=t.child;t!==null;){if(s=x(t),s!==null)return s;t=t.sibling}return null}var v=Object.assign,b=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),R=Symbol.for("react.fragment"),z=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),W=Symbol.for("react.consumer"),j=Symbol.for("react.context"),C=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),G=Symbol.for("react.suspense_list"),Z=Symbol.for("react.memo"),ae=Symbol.for("react.lazy"),pe=Symbol.for("react.activity"),Oe=Symbol.for("react.memo_cache_sentinel"),he=Symbol.iterator;function V(t){return t===null||typeof t!="object"?null:(t=he&&t[he]||t["@@iterator"],typeof t=="function"?t:null)}var X=Symbol.for("react.client.reference");function te(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===X?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case R:return"Fragment";case A:return"Profiler";case z:return"StrictMode";case O:return"Suspense";case G:return"SuspenseList";case pe:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case S:return"Portal";case j:return t.displayName||"Context";case W:return(t._context.displayName||"Context")+".Consumer";case C:var s=t.render;return t=t.displayName,t||(t=s.displayName||s.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Z:return s=t.displayName||null,s!==null?s:te(t.type)||"Memo";case ae:s=t._payload,t=t._init;try{return te(t(s))}catch{}}return null}var Q=Array.isArray,B=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I={pending:!1,data:null,method:null,action:null},ne=[],ge=-1;function T(t){return{current:t}}function K(t){0>ge||(t.current=ne[ge],ne[ge]=null,ge--)}function ee(t,s){ge++,ne[ge]=t.current,t.current=s}var ie=T(null),ce=T(null),de=T(null),Se=T(null);function ot(t,s){switch(ee(de,s),ee(ce,t),ee(ie,null),s.nodeType){case 9:case 11:t=(t=s.documentElement)&&(t=t.namespaceURI)?Og(t):0;break;default:if(t=s.tagName,s=s.namespaceURI)s=Og(s),t=jg(s,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}K(ie),ee(ie,t)}function Ae(){K(ie),K(ce),K(de)}function wi(t){t.memoizedState!==null&&ee(Se,t);var s=ie.current,r=jg(s,t.type);s!==r&&(ee(ce,t),ee(ie,r))}function Ci(t){ce.current===t&&(K(ie),K(ce)),Se.current===t&&(K(Se),Yn._currentValue=I)}var ti,Re;function mi(t){if(ti===void 0)try{throw Error()}catch(r){var s=r.stack.trim().match(/\n( *(at )?)/);ti=s&&s[1]||"",Re=-1<r.stack.indexOf(`
|
|
2
|
+
at`)?" (<anonymous>)":-1<r.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
+
`+ti+t+Re}var mo=!1;function vo(t,s){if(!t||mo)return"";mo=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var a={DetermineComponentFrameRoot:function(){try{if(s){var Y=function(){throw Error()};if(Object.defineProperty(Y.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Y,[])}catch(U){var H=U}Reflect.construct(t,[],Y)}else{try{Y.call()}catch(U){H=U}t.call(Y.prototype)}}else{try{throw Error()}catch(U){H=U}(Y=t())&&typeof Y.catch=="function"&&Y.catch(function(){})}}catch(U){if(U&&H&&typeof U.stack=="string")return[U.stack,H.stack]}return[null,null]}};a.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var h=Object.getOwnPropertyDescriptor(a.DetermineComponentFrameRoot,"name");h&&h.configurable&&Object.defineProperty(a.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var u=a.DetermineComponentFrameRoot(),m=u[0],y=u[1];if(m&&y){var k=m.split(`
|
|
4
|
+
`),N=y.split(`
|
|
5
|
+
`);for(h=a=0;a<k.length&&!k[a].includes("DetermineComponentFrameRoot");)a++;for(;h<N.length&&!N[h].includes("DetermineComponentFrameRoot");)h++;if(a===k.length||h===N.length)for(a=k.length-1,h=N.length-1;1<=a&&0<=h&&k[a]!==N[h];)h--;for(;1<=a&&0<=h;a--,h--)if(k[a]!==N[h]){if(a!==1||h!==1)do if(a--,h--,0>h||k[a]!==N[h]){var P=`
|
|
6
|
+
`+k[a].replace(" at new "," at ");return t.displayName&&P.includes("<anonymous>")&&(P=P.replace("<anonymous>",t.displayName)),P}while(1<=a&&0<=h);break}}}finally{mo=!1,Error.prepareStackTrace=r}return(r=t?t.displayName||t.name:"")?mi(r):""}function Kv(t,s){switch(t.tag){case 26:case 27:case 5:return mi(t.type);case 16:return mi("Lazy");case 13:return t.child!==s&&s!==null?mi("Suspense Fallback"):mi("Suspense");case 19:return mi("SuspenseList");case 0:case 15:return vo(t.type,!1);case 11:return vo(t.type.render,!1);case 1:return vo(t.type,!0);case 31:return mi("Activity");default:return""}}function hd(t){try{var s="",r=null;do s+=Kv(t,r),r=t,t=t.return;while(t);return s}catch(a){return`
|
|
7
|
+
Error generating stack: `+a.message+`
|
|
8
|
+
`+a.stack}}var yo=Object.prototype.hasOwnProperty,xo=e.unstable_scheduleCallback,So=e.unstable_cancelCallback,$v=e.unstable_shouldYield,Yv=e.unstable_requestPaint,qt=e.unstable_now,Fv=e.unstable_getCurrentPriorityLevel,ud=e.unstable_ImmediatePriority,dd=e.unstable_UserBlockingPriority,bl=e.unstable_NormalPriority,Gv=e.unstable_LowPriority,fd=e.unstable_IdlePriority,Xv=e.log,Vv=e.unstable_setDisableYieldValue,rn=null,It=null;function ls(t){if(typeof Xv=="function"&&Vv(t),It&&typeof It.setStrictMode=="function")try{It.setStrictMode(rn,t)}catch{}}var Kt=Math.clz32?Math.clz32:Jv,Zv=Math.log,Qv=Math.LN2;function Jv(t){return t>>>=0,t===0?32:31-(Zv(t)/Qv|0)|0}var wl=256,Cl=262144,kl=4194304;function Ns(t){var s=t&42;if(s!==0)return s;switch(t&-t){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 t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function El(t,s,r){var a=t.pendingLanes;if(a===0)return 0;var h=0,u=t.suspendedLanes,m=t.pingedLanes;t=t.warmLanes;var y=a&134217727;return y!==0?(a=y&~u,a!==0?h=Ns(a):(m&=y,m!==0?h=Ns(m):r||(r=y&~t,r!==0&&(h=Ns(r))))):(y=a&~u,y!==0?h=Ns(y):m!==0?h=Ns(m):r||(r=a&~t,r!==0&&(h=Ns(r)))),h===0?0:s!==0&&s!==h&&(s&u)===0&&(u=h&-h,r=s&-s,u>=r||u===32&&(r&4194048)!==0)?s:h}function nn(t,s){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&s)===0}function e0(t,s){switch(t){case 1:case 2:case 4:case 8:case 64:return s+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 s+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 pd(){var t=kl;return kl<<=1,(kl&62914560)===0&&(kl=4194304),t}function bo(t){for(var s=[],r=0;31>r;r++)s.push(t);return s}function ln(t,s){t.pendingLanes|=s,s!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function t0(t,s,r,a,h,u){var m=t.pendingLanes;t.pendingLanes=r,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=r,t.entangledLanes&=r,t.errorRecoveryDisabledLanes&=r,t.shellSuspendCounter=0;var y=t.entanglements,k=t.expirationTimes,N=t.hiddenUpdates;for(r=m&~r;0<r;){var P=31-Kt(r),Y=1<<P;y[P]=0,k[P]=-1;var H=N[P];if(H!==null)for(N[P]=null,P=0;P<H.length;P++){var U=H[P];U!==null&&(U.lane&=-536870913)}r&=~Y}a!==0&&gd(t,a,0),u!==0&&h===0&&t.tag!==0&&(t.suspendedLanes|=u&~(m&~s))}function gd(t,s,r){t.pendingLanes|=s,t.suspendedLanes&=~s;var a=31-Kt(s);t.entangledLanes|=s,t.entanglements[a]=t.entanglements[a]|1073741824|r&261930}function _d(t,s){var r=t.entangledLanes|=s;for(t=t.entanglements;r;){var a=31-Kt(r),h=1<<a;h&s|t[a]&s&&(t[a]|=s),r&=~h}}function md(t,s){var r=s&-s;return r=(r&42)!==0?1:wo(r),(r&(t.suspendedLanes|s))!==0?0:r}function wo(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=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:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function Co(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function vd(){var t=q.p;return t!==0?t:(t=window.event,t===void 0?32:r_(t.type))}function yd(t,s){var r=q.p;try{return q.p=t,s()}finally{q.p=r}}var as=Math.random().toString(36).slice(2),xt="__reactFiber$"+as,Ot="__reactProps$"+as,dr="__reactContainer$"+as,ko="__reactEvents$"+as,i0="__reactListeners$"+as,s0="__reactHandles$"+as,xd="__reactResources$"+as,an="__reactMarker$"+as;function Eo(t){delete t[xt],delete t[Ot],delete t[ko],delete t[i0],delete t[s0]}function fr(t){var s=t[xt];if(s)return s;for(var r=t.parentNode;r;){if(s=r[dr]||r[xt]){if(r=s.alternate,s.child!==null||r!==null&&r.child!==null)for(t=qg(t);t!==null;){if(r=t[xt])return r;t=qg(t)}return s}t=r,r=t.parentNode}return null}function pr(t){if(t=t[xt]||t[dr]){var s=t.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return t}return null}function on(t){var s=t.tag;if(s===5||s===26||s===27||s===6)return t.stateNode;throw Error(l(33))}function gr(t){var s=t[xd];return s||(s=t[xd]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function ft(t){t[an]=!0}var Sd=new Set,bd={};function Hs(t,s){_r(t,s),_r(t+"Capture",s)}function _r(t,s){for(bd[t]=s,t=0;t<s.length;t++)Sd.add(s[t])}var r0=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]*$"),wd={},Cd={};function n0(t){return yo.call(Cd,t)?!0:yo.call(wd,t)?!1:r0.test(t)?Cd[t]=!0:(wd[t]=!0,!1)}function Tl(t,s,r){if(n0(s))if(r===null)t.removeAttribute(s);else{switch(typeof r){case"undefined":case"function":case"symbol":t.removeAttribute(s);return;case"boolean":var a=s.toLowerCase().slice(0,5);if(a!=="data-"&&a!=="aria-"){t.removeAttribute(s);return}}t.setAttribute(s,""+r)}}function Rl(t,s,r){if(r===null)t.removeAttribute(s);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(s);return}t.setAttribute(s,""+r)}}function Ni(t,s,r,a){if(a===null)t.removeAttribute(r);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(r);return}t.setAttributeNS(s,r,""+a)}}function ii(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function kd(t){var s=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function l0(t,s,r){var a=Object.getOwnPropertyDescriptor(t.constructor.prototype,s);if(!t.hasOwnProperty(s)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var h=a.get,u=a.set;return Object.defineProperty(t,s,{configurable:!0,get:function(){return h.call(this)},set:function(m){r=""+m,u.call(this,m)}}),Object.defineProperty(t,s,{enumerable:a.enumerable}),{getValue:function(){return r},setValue:function(m){r=""+m},stopTracking:function(){t._valueTracker=null,delete t[s]}}}}function To(t){if(!t._valueTracker){var s=kd(t)?"checked":"value";t._valueTracker=l0(t,s,""+t[s])}}function Ed(t){if(!t)return!1;var s=t._valueTracker;if(!s)return!0;var r=s.getValue(),a="";return t&&(a=kd(t)?t.checked?"true":"false":t.value),t=a,t!==r?(s.setValue(t),!0):!1}function Dl(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var a0=/[\n"\\]/g;function si(t){return t.replace(a0,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function Ro(t,s,r,a,h,u,m,y){t.name="",m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"?t.type=m:t.removeAttribute("type"),s!=null?m==="number"?(s===0&&t.value===""||t.value!=s)&&(t.value=""+ii(s)):t.value!==""+ii(s)&&(t.value=""+ii(s)):m!=="submit"&&m!=="reset"||t.removeAttribute("value"),s!=null?Do(t,m,ii(s)):r!=null?Do(t,m,ii(r)):a!=null&&t.removeAttribute("value"),h==null&&u!=null&&(t.defaultChecked=!!u),h!=null&&(t.checked=h&&typeof h!="function"&&typeof h!="symbol"),y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?t.name=""+ii(y):t.removeAttribute("name")}function Td(t,s,r,a,h,u,m,y){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(t.type=u),s!=null||r!=null){if(!(u!=="submit"&&u!=="reset"||s!=null)){To(t);return}r=r!=null?""+ii(r):"",s=s!=null?""+ii(s):r,y||s===t.value||(t.value=s),t.defaultValue=s}a=a??h,a=typeof a!="function"&&typeof a!="symbol"&&!!a,t.checked=y?t.checked:!!a,t.defaultChecked=!!a,m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(t.name=m),To(t)}function Do(t,s,r){s==="number"&&Dl(t.ownerDocument)===t||t.defaultValue===""+r||(t.defaultValue=""+r)}function mr(t,s,r,a){if(t=t.options,s){s={};for(var h=0;h<r.length;h++)s["$"+r[h]]=!0;for(r=0;r<t.length;r++)h=s.hasOwnProperty("$"+t[r].value),t[r].selected!==h&&(t[r].selected=h),h&&a&&(t[r].defaultSelected=!0)}else{for(r=""+ii(r),s=null,h=0;h<t.length;h++){if(t[h].value===r){t[h].selected=!0,a&&(t[h].defaultSelected=!0);return}s!==null||t[h].disabled||(s=t[h])}s!==null&&(s.selected=!0)}}function Rd(t,s,r){if(s!=null&&(s=""+ii(s),s!==t.value&&(t.value=s),r==null)){t.defaultValue!==s&&(t.defaultValue=s);return}t.defaultValue=r!=null?""+ii(r):""}function Dd(t,s,r,a){if(s==null){if(a!=null){if(r!=null)throw Error(l(92));if(Q(a)){if(1<a.length)throw Error(l(93));a=a[0]}r=a}r==null&&(r=""),s=r}r=ii(s),t.defaultValue=r,a=t.textContent,a===r&&a!==""&&a!==null&&(t.value=a),To(t)}function vr(t,s){if(s){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=s;return}}t.textContent=s}var o0=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 Bd(t,s,r){var a=s.indexOf("--")===0;r==null||typeof r=="boolean"||r===""?a?t.setProperty(s,""):s==="float"?t.cssFloat="":t[s]="":a?t.setProperty(s,r):typeof r!="number"||r===0||o0.has(s)?s==="float"?t.cssFloat=r:t[s]=(""+r).trim():t[s]=r+"px"}function zd(t,s,r){if(s!=null&&typeof s!="object")throw Error(l(62));if(t=t.style,r!=null){for(var a in r)!r.hasOwnProperty(a)||s!=null&&s.hasOwnProperty(a)||(a.indexOf("--")===0?t.setProperty(a,""):a==="float"?t.cssFloat="":t[a]="");for(var h in s)a=s[h],s.hasOwnProperty(h)&&r[h]!==a&&Bd(t,h,a)}else for(var u in s)s.hasOwnProperty(u)&&Bd(t,u,s[u])}function Bo(t){if(t.indexOf("-")===-1)return!1;switch(t){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 c0=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"]]),h0=/^[\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 Bl(t){return h0.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function Hi(){}var zo=null;function Ao(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var yr=null,xr=null;function Ad(t){var s=pr(t);if(s&&(t=s.stateNode)){var r=t[Ot]||null;e:switch(t=s.stateNode,s.type){case"input":if(Ro(t,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name),s=r.name,r.type==="radio"&&s!=null){for(r=t;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll('input[name="'+si(""+s)+'"][type="radio"]'),s=0;s<r.length;s++){var a=r[s];if(a!==t&&a.form===t.form){var h=a[Ot]||null;if(!h)throw Error(l(90));Ro(a,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name)}}for(s=0;s<r.length;s++)a=r[s],a.form===t.form&&Ed(a)}break e;case"textarea":Rd(t,r.value,r.defaultValue);break e;case"select":s=r.value,s!=null&&mr(t,!!r.multiple,s,!1)}}}var Mo=!1;function Md(t,s,r){if(Mo)return t(s,r);Mo=!0;try{var a=t(s);return a}finally{if(Mo=!1,(yr!==null||xr!==null)&&(ma(),yr&&(s=yr,t=xr,xr=yr=null,Ad(s),t)))for(s=0;s<t.length;s++)Ad(t[s])}}function cn(t,s){var r=t.stateNode;if(r===null)return null;var a=r[Ot]||null;if(a===null)return null;r=a[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(a=!a.disabled)||(t=t.type,a=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!a;break e;default:t=!1}if(t)return null;if(r&&typeof r!="function")throw Error(l(231,s,typeof r));return r}var Ui=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Oo=!1;if(Ui)try{var hn={};Object.defineProperty(hn,"passive",{get:function(){Oo=!0}}),window.addEventListener("test",hn,hn),window.removeEventListener("test",hn,hn)}catch{Oo=!1}var os=null,jo=null,zl=null;function Od(){if(zl)return zl;var t,s=jo,r=s.length,a,h="value"in os?os.value:os.textContent,u=h.length;for(t=0;t<r&&s[t]===h[t];t++);var m=r-t;for(a=1;a<=m&&s[r-a]===h[u-a];a++);return zl=h.slice(t,1<a?1-a:void 0)}function Al(t){var s=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&s===13&&(t=13)):t=s,t===10&&(t=13),32<=t||t===13?t:0}function Ml(){return!0}function jd(){return!1}function jt(t){function s(r,a,h,u,m){this._reactName=r,this._targetInst=h,this.type=a,this.nativeEvent=u,this.target=m,this.currentTarget=null;for(var y in t)t.hasOwnProperty(y)&&(r=t[y],this[y]=r?r(u):u[y]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?Ml:jd,this.isPropagationStopped=jd,this}return v(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=Ml)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=Ml)},persist:function(){},isPersistent:Ml}),s}var Us={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ol=jt(Us),un=v({},Us,{view:0,detail:0}),u0=jt(un),Lo,No,dn,jl=v({},un,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Uo,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==dn&&(dn&&t.type==="mousemove"?(Lo=t.screenX-dn.screenX,No=t.screenY-dn.screenY):No=Lo=0,dn=t),Lo)},movementY:function(t){return"movementY"in t?t.movementY:No}}),Ld=jt(jl),d0=v({},jl,{dataTransfer:0}),f0=jt(d0),p0=v({},un,{relatedTarget:0}),Ho=jt(p0),g0=v({},Us,{animationName:0,elapsedTime:0,pseudoElement:0}),_0=jt(g0),m0=v({},Us,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),v0=jt(m0),y0=v({},Us,{data:0}),Nd=jt(y0),x0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},S0={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"},b0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function w0(t){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(t):(t=b0[t])?!!s[t]:!1}function Uo(){return w0}var C0=v({},un,{key:function(t){if(t.key){var s=x0[t.key]||t.key;if(s!=="Unidentified")return s}return t.type==="keypress"?(t=Al(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?S0[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Uo,charCode:function(t){return t.type==="keypress"?Al(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Al(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),k0=jt(C0),E0=v({},jl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Hd=jt(E0),T0=v({},un,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Uo}),R0=jt(T0),D0=v({},Us,{propertyName:0,elapsedTime:0,pseudoElement:0}),B0=jt(D0),z0=v({},jl,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),A0=jt(z0),M0=v({},Us,{newState:0,oldState:0}),O0=jt(M0),j0=[9,13,27,32],Wo=Ui&&"CompositionEvent"in window,fn=null;Ui&&"documentMode"in document&&(fn=document.documentMode);var L0=Ui&&"TextEvent"in window&&!fn,Ud=Ui&&(!Wo||fn&&8<fn&&11>=fn),Wd=" ",Pd=!1;function qd(t,s){switch(t){case"keyup":return j0.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Id(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Sr=!1;function N0(t,s){switch(t){case"compositionend":return Id(s);case"keypress":return s.which!==32?null:(Pd=!0,Wd);case"textInput":return t=s.data,t===Wd&&Pd?null:t;default:return null}}function H0(t,s){if(Sr)return t==="compositionend"||!Wo&&qd(t,s)?(t=Od(),zl=jo=os=null,Sr=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return Ud&&s.locale!=="ko"?null:s.data;default:return null}}var U0={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 Kd(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s==="input"?!!U0[t.type]:s==="textarea"}function $d(t,s,r,a){yr?xr?xr.push(a):xr=[a]:yr=a,s=Ca(s,"onChange"),0<s.length&&(r=new Ol("onChange","change",null,r,a),t.push({event:r,listeners:s}))}var pn=null,gn=null;function W0(t){Rg(t,0)}function Ll(t){var s=on(t);if(Ed(s))return t}function Yd(t,s){if(t==="change")return s}var Fd=!1;if(Ui){var Po;if(Ui){var qo="oninput"in document;if(!qo){var Gd=document.createElement("div");Gd.setAttribute("oninput","return;"),qo=typeof Gd.oninput=="function"}Po=qo}else Po=!1;Fd=Po&&(!document.documentMode||9<document.documentMode)}function Xd(){pn&&(pn.detachEvent("onpropertychange",Vd),gn=pn=null)}function Vd(t){if(t.propertyName==="value"&&Ll(gn)){var s=[];$d(s,gn,t,Ao(t)),Md(W0,s)}}function P0(t,s,r){t==="focusin"?(Xd(),pn=s,gn=r,pn.attachEvent("onpropertychange",Vd)):t==="focusout"&&Xd()}function q0(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Ll(gn)}function I0(t,s){if(t==="click")return Ll(s)}function K0(t,s){if(t==="input"||t==="change")return Ll(s)}function $0(t,s){return t===s&&(t!==0||1/t===1/s)||t!==t&&s!==s}var $t=typeof Object.is=="function"?Object.is:$0;function _n(t,s){if($t(t,s))return!0;if(typeof t!="object"||t===null||typeof s!="object"||s===null)return!1;var r=Object.keys(t),a=Object.keys(s);if(r.length!==a.length)return!1;for(a=0;a<r.length;a++){var h=r[a];if(!yo.call(s,h)||!$t(t[h],s[h]))return!1}return!0}function Zd(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Qd(t,s){var r=Zd(t);t=0;for(var a;r;){if(r.nodeType===3){if(a=t+r.textContent.length,t<=s&&a>=s)return{node:r,offset:s-t};t=a}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Zd(r)}}function Jd(t,s){return t&&s?t===s?!0:t&&t.nodeType===3?!1:s&&s.nodeType===3?Jd(t,s.parentNode):"contains"in t?t.contains(s):t.compareDocumentPosition?!!(t.compareDocumentPosition(s)&16):!1:!1}function ef(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var s=Dl(t.document);s instanceof t.HTMLIFrameElement;){try{var r=typeof s.contentWindow.location.href=="string"}catch{r=!1}if(r)t=s.contentWindow;else break;s=Dl(t.document)}return s}function Io(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s&&(s==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||s==="textarea"||t.contentEditable==="true")}var Y0=Ui&&"documentMode"in document&&11>=document.documentMode,br=null,Ko=null,mn=null,$o=!1;function tf(t,s,r){var a=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;$o||br==null||br!==Dl(a)||(a=br,"selectionStart"in a&&Io(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),mn&&_n(mn,a)||(mn=a,a=Ca(Ko,"onSelect"),0<a.length&&(s=new Ol("onSelect","select",null,s,r),t.push({event:s,listeners:a}),s.target=br)))}function Ws(t,s){var r={};return r[t.toLowerCase()]=s.toLowerCase(),r["Webkit"+t]="webkit"+s,r["Moz"+t]="moz"+s,r}var wr={animationend:Ws("Animation","AnimationEnd"),animationiteration:Ws("Animation","AnimationIteration"),animationstart:Ws("Animation","AnimationStart"),transitionrun:Ws("Transition","TransitionRun"),transitionstart:Ws("Transition","TransitionStart"),transitioncancel:Ws("Transition","TransitionCancel"),transitionend:Ws("Transition","TransitionEnd")},Yo={},sf={};Ui&&(sf=document.createElement("div").style,"AnimationEvent"in window||(delete wr.animationend.animation,delete wr.animationiteration.animation,delete wr.animationstart.animation),"TransitionEvent"in window||delete wr.transitionend.transition);function Ps(t){if(Yo[t])return Yo[t];if(!wr[t])return t;var s=wr[t],r;for(r in s)if(s.hasOwnProperty(r)&&r in sf)return Yo[t]=s[r];return t}var rf=Ps("animationend"),nf=Ps("animationiteration"),lf=Ps("animationstart"),F0=Ps("transitionrun"),G0=Ps("transitionstart"),X0=Ps("transitioncancel"),af=Ps("transitionend"),of=new Map,Fo="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(" ");Fo.push("scrollEnd");function vi(t,s){of.set(t,s),Hs(s,[t])}var Nl=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=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(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},ri=[],Cr=0,Go=0;function Hl(){for(var t=Cr,s=Go=Cr=0;s<t;){var r=ri[s];ri[s++]=null;var a=ri[s];ri[s++]=null;var h=ri[s];ri[s++]=null;var u=ri[s];if(ri[s++]=null,a!==null&&h!==null){var m=a.pending;m===null?h.next=h:(h.next=m.next,m.next=h),a.pending=h}u!==0&&cf(r,h,u)}}function Ul(t,s,r,a){ri[Cr++]=t,ri[Cr++]=s,ri[Cr++]=r,ri[Cr++]=a,Go|=a,t.lanes|=a,t=t.alternate,t!==null&&(t.lanes|=a)}function Xo(t,s,r,a){return Ul(t,s,r,a),Wl(t)}function qs(t,s){return Ul(t,null,null,s),Wl(t)}function cf(t,s,r){t.lanes|=r;var a=t.alternate;a!==null&&(a.lanes|=r);for(var h=!1,u=t.return;u!==null;)u.childLanes|=r,a=u.alternate,a!==null&&(a.childLanes|=r),u.tag===22&&(t=u.stateNode,t===null||t._visibility&1||(h=!0)),t=u,u=u.return;return t.tag===3?(u=t.stateNode,h&&s!==null&&(h=31-Kt(r),t=u.hiddenUpdates,a=t[h],a===null?t[h]=[s]:a.push(s),s.lane=r|536870912),u):null}function Wl(t){if(50<Un)throw Un=0,rh=null,Error(l(185));for(var s=t.return;s!==null;)t=s,s=t.return;return t.tag===3?t.stateNode:null}var kr={};function V0(t,s,r,a){this.tag=t,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Yt(t,s,r,a){return new V0(t,s,r,a)}function Vo(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Wi(t,s){var r=t.alternate;return r===null?(r=Yt(t.tag,s,t.key,t.mode),r.elementType=t.elementType,r.type=t.type,r.stateNode=t.stateNode,r.alternate=t,t.alternate=r):(r.pendingProps=s,r.type=t.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=t.flags&65011712,r.childLanes=t.childLanes,r.lanes=t.lanes,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,s=t.dependencies,r.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},r.sibling=t.sibling,r.index=t.index,r.ref=t.ref,r.refCleanup=t.refCleanup,r}function hf(t,s){t.flags&=65011714;var r=t.alternate;return r===null?(t.childLanes=0,t.lanes=s,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=r.childLanes,t.lanes=r.lanes,t.child=r.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=r.memoizedProps,t.memoizedState=r.memoizedState,t.updateQueue=r.updateQueue,t.type=r.type,s=r.dependencies,t.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),t}function Pl(t,s,r,a,h,u){var m=0;if(a=t,typeof t=="function")Vo(t)&&(m=1);else if(typeof t=="string")m=tx(t,r,ie.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case pe:return t=Yt(31,r,s,h),t.elementType=pe,t.lanes=u,t;case R:return Is(r.children,h,u,s);case z:m=8,h|=24;break;case A:return t=Yt(12,r,s,h|2),t.elementType=A,t.lanes=u,t;case O:return t=Yt(13,r,s,h),t.elementType=O,t.lanes=u,t;case G:return t=Yt(19,r,s,h),t.elementType=G,t.lanes=u,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case j:m=10;break e;case W:m=9;break e;case C:m=11;break e;case Z:m=14;break e;case ae:m=16,a=null;break e}m=29,r=Error(l(130,t===null?"null":typeof t,"")),a=null}return s=Yt(m,r,s,h),s.elementType=t,s.type=a,s.lanes=u,s}function Is(t,s,r,a){return t=Yt(7,t,a,s),t.lanes=r,t}function Zo(t,s,r){return t=Yt(6,t,null,s),t.lanes=r,t}function uf(t){var s=Yt(18,null,null,0);return s.stateNode=t,s}function Qo(t,s,r){return s=Yt(4,t.children!==null?t.children:[],t.key,s),s.lanes=r,s.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},s}var df=new WeakMap;function ni(t,s){if(typeof t=="object"&&t!==null){var r=df.get(t);return r!==void 0?r:(s={value:t,source:s,stack:hd(s)},df.set(t,s),s)}return{value:t,source:s,stack:hd(s)}}var Er=[],Tr=0,ql=null,vn=0,li=[],ai=0,cs=null,ki=1,Ei="";function Pi(t,s){Er[Tr++]=vn,Er[Tr++]=ql,ql=t,vn=s}function ff(t,s,r){li[ai++]=ki,li[ai++]=Ei,li[ai++]=cs,cs=t;var a=ki;t=Ei;var h=32-Kt(a)-1;a&=~(1<<h),r+=1;var u=32-Kt(s)+h;if(30<u){var m=h-h%5;u=(a&(1<<m)-1).toString(32),a>>=m,h-=m,ki=1<<32-Kt(s)+h|r<<h|a,Ei=u+t}else ki=1<<u|r<<h|a,Ei=t}function Jo(t){t.return!==null&&(Pi(t,1),ff(t,1,0))}function ec(t){for(;t===ql;)ql=Er[--Tr],Er[Tr]=null,vn=Er[--Tr],Er[Tr]=null;for(;t===cs;)cs=li[--ai],li[ai]=null,Ei=li[--ai],li[ai]=null,ki=li[--ai],li[ai]=null}function pf(t,s){li[ai++]=ki,li[ai++]=Ei,li[ai++]=cs,ki=s.id,Ei=s.overflow,cs=t}var St=null,qe=null,Ee=!1,hs=null,oi=!1,tc=Error(l(519));function us(t){var s=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw yn(ni(s,t)),tc}function gf(t){var s=t.stateNode,r=t.type,a=t.memoizedProps;switch(s[xt]=t,s[Ot]=a,r){case"dialog":we("cancel",s),we("close",s);break;case"iframe":case"object":case"embed":we("load",s);break;case"video":case"audio":for(r=0;r<Pn.length;r++)we(Pn[r],s);break;case"source":we("error",s);break;case"img":case"image":case"link":we("error",s),we("load",s);break;case"details":we("toggle",s);break;case"input":we("invalid",s),Td(s,a.value,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name,!0);break;case"select":we("invalid",s);break;case"textarea":we("invalid",s),Dd(s,a.value,a.defaultValue,a.children)}r=a.children,typeof r!="string"&&typeof r!="number"&&typeof r!="bigint"||s.textContent===""+r||a.suppressHydrationWarning===!0||Ag(s.textContent,r)?(a.popover!=null&&(we("beforetoggle",s),we("toggle",s)),a.onScroll!=null&&we("scroll",s),a.onScrollEnd!=null&&we("scrollend",s),a.onClick!=null&&(s.onclick=Hi),s=!0):s=!1,s||us(t,!0)}function _f(t){for(St=t.return;St;)switch(St.tag){case 5:case 31:case 13:oi=!1;return;case 27:case 3:oi=!0;return;default:St=St.return}}function Rr(t){if(t!==St)return!1;if(!Ee)return _f(t),Ee=!0,!1;var s=t.tag,r;if((r=s!==3&&s!==27)&&((r=s===5)&&(r=t.type,r=!(r!=="form"&&r!=="button")||yh(t.type,t.memoizedProps)),r=!r),r&&qe&&us(t),_f(t),s===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(l(317));qe=Pg(t)}else if(s===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(l(317));qe=Pg(t)}else s===27?(s=qe,ks(t.type)?(t=Ch,Ch=null,qe=t):qe=s):qe=St?hi(t.stateNode.nextSibling):null;return!0}function Ks(){qe=St=null,Ee=!1}function ic(){var t=hs;return t!==null&&(Ut===null?Ut=t:Ut.push.apply(Ut,t),hs=null),t}function yn(t){hs===null?hs=[t]:hs.push(t)}var sc=T(null),$s=null,qi=null;function ds(t,s,r){ee(sc,s._currentValue),s._currentValue=r}function Ii(t){t._currentValue=sc.current,K(sc)}function rc(t,s,r){for(;t!==null;){var a=t.alternate;if((t.childLanes&s)!==s?(t.childLanes|=s,a!==null&&(a.childLanes|=s)):a!==null&&(a.childLanes&s)!==s&&(a.childLanes|=s),t===r)break;t=t.return}}function nc(t,s,r,a){var h=t.child;for(h!==null&&(h.return=t);h!==null;){var u=h.dependencies;if(u!==null){var m=h.child;u=u.firstContext;e:for(;u!==null;){var y=u;u=h;for(var k=0;k<s.length;k++)if(y.context===s[k]){u.lanes|=r,y=u.alternate,y!==null&&(y.lanes|=r),rc(u.return,r,t),a||(m=null);break e}u=y.next}}else if(h.tag===18){if(m=h.return,m===null)throw Error(l(341));m.lanes|=r,u=m.alternate,u!==null&&(u.lanes|=r),rc(m,r,t),m=null}else m=h.child;if(m!==null)m.return=h;else for(m=h;m!==null;){if(m===t){m=null;break}if(h=m.sibling,h!==null){h.return=m.return,m=h;break}m=m.return}h=m}}function Dr(t,s,r,a){t=null;for(var h=s,u=!1;h!==null;){if(!u){if((h.flags&524288)!==0)u=!0;else if((h.flags&262144)!==0)break}if(h.tag===10){var m=h.alternate;if(m===null)throw Error(l(387));if(m=m.memoizedProps,m!==null){var y=h.type;$t(h.pendingProps.value,m.value)||(t!==null?t.push(y):t=[y])}}else if(h===Se.current){if(m=h.alternate,m===null)throw Error(l(387));m.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(t!==null?t.push(Yn):t=[Yn])}h=h.return}t!==null&&nc(s,t,r,a),s.flags|=262144}function Il(t){for(t=t.firstContext;t!==null;){if(!$t(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function Ys(t){$s=t,qi=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function bt(t){return mf($s,t)}function Kl(t,s){return $s===null&&Ys(t),mf(t,s)}function mf(t,s){var r=s._currentValue;if(s={context:s,memoizedValue:r,next:null},qi===null){if(t===null)throw Error(l(308));qi=s,t.dependencies={lanes:0,firstContext:s},t.flags|=524288}else qi=qi.next=s;return r}var Z0=typeof AbortController<"u"?AbortController:function(){var t=[],s=this.signal={aborted:!1,addEventListener:function(r,a){t.push(a)}};this.abort=function(){s.aborted=!0,t.forEach(function(r){return r()})}},Q0=e.unstable_scheduleCallback,J0=e.unstable_NormalPriority,it={$$typeof:j,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function lc(){return{controller:new Z0,data:new Map,refCount:0}}function xn(t){t.refCount--,t.refCount===0&&Q0(J0,function(){t.controller.abort()})}var Sn=null,ac=0,Br=0,zr=null;function ey(t,s){if(Sn===null){var r=Sn=[];ac=0,Br=hh(),zr={status:"pending",value:void 0,then:function(a){r.push(a)}}}return ac++,s.then(vf,vf),s}function vf(){if(--ac===0&&Sn!==null){zr!==null&&(zr.status="fulfilled");var t=Sn;Sn=null,Br=0,zr=null;for(var s=0;s<t.length;s++)(0,t[s])()}}function ty(t,s){var r=[],a={status:"pending",value:null,reason:null,then:function(h){r.push(h)}};return t.then(function(){a.status="fulfilled",a.value=s;for(var h=0;h<r.length;h++)(0,r[h])(s)},function(h){for(a.status="rejected",a.reason=h,h=0;h<r.length;h++)(0,r[h])(void 0)}),a}var yf=B.S;B.S=function(t,s){ig=qt(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&ey(t,s),yf!==null&&yf(t,s)};var Fs=T(null);function oc(){var t=Fs.current;return t!==null?t:Pe.pooledCache}function $l(t,s){s===null?ee(Fs,Fs.current):ee(Fs,s.pool)}function xf(){var t=oc();return t===null?null:{parent:it._currentValue,pool:t}}var Ar=Error(l(460)),cc=Error(l(474)),Yl=Error(l(542)),Fl={then:function(){}};function Sf(t){return t=t.status,t==="fulfilled"||t==="rejected"}function bf(t,s,r){switch(r=t[r],r===void 0?t.push(s):r!==s&&(s.then(Hi,Hi),s=r),s.status){case"fulfilled":return s.value;case"rejected":throw t=s.reason,Cf(t),t;default:if(typeof s.status=="string")s.then(Hi,Hi);else{if(t=Pe,t!==null&&100<t.shellSuspendCounter)throw Error(l(482));t=s,t.status="pending",t.then(function(a){if(s.status==="pending"){var h=s;h.status="fulfilled",h.value=a}},function(a){if(s.status==="pending"){var h=s;h.status="rejected",h.reason=a}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw t=s.reason,Cf(t),t}throw Xs=s,Ar}}function Gs(t){try{var s=t._init;return s(t._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(Xs=r,Ar):r}}var Xs=null;function wf(){if(Xs===null)throw Error(l(459));var t=Xs;return Xs=null,t}function Cf(t){if(t===Ar||t===Yl)throw Error(l(483))}var Mr=null,bn=0;function Gl(t){var s=bn;return bn+=1,Mr===null&&(Mr=[]),bf(Mr,t,s)}function wn(t,s){s=s.props.ref,t.ref=s!==void 0?s:null}function Xl(t,s){throw s.$$typeof===b?Error(l(525)):(t=Object.prototype.toString.call(s),Error(l(31,t==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":t)))}function kf(t){function s(M,D){if(t){var L=M.deletions;L===null?(M.deletions=[D],M.flags|=16):L.push(D)}}function r(M,D){if(!t)return null;for(;D!==null;)s(M,D),D=D.sibling;return null}function a(M){for(var D=new Map;M!==null;)M.key!==null?D.set(M.key,M):D.set(M.index,M),M=M.sibling;return D}function h(M,D){return M=Wi(M,D),M.index=0,M.sibling=null,M}function u(M,D,L){return M.index=L,t?(L=M.alternate,L!==null?(L=L.index,L<D?(M.flags|=67108866,D):L):(M.flags|=67108866,D)):(M.flags|=1048576,D)}function m(M){return t&&M.alternate===null&&(M.flags|=67108866),M}function y(M,D,L,$){return D===null||D.tag!==6?(D=Zo(L,M.mode,$),D.return=M,D):(D=h(D,L),D.return=M,D)}function k(M,D,L,$){var oe=L.type;return oe===R?P(M,D,L.props.children,$,L.key):D!==null&&(D.elementType===oe||typeof oe=="object"&&oe!==null&&oe.$$typeof===ae&&Gs(oe)===D.type)?(D=h(D,L.props),wn(D,L),D.return=M,D):(D=Pl(L.type,L.key,L.props,null,M.mode,$),wn(D,L),D.return=M,D)}function N(M,D,L,$){return D===null||D.tag!==4||D.stateNode.containerInfo!==L.containerInfo||D.stateNode.implementation!==L.implementation?(D=Qo(L,M.mode,$),D.return=M,D):(D=h(D,L.children||[]),D.return=M,D)}function P(M,D,L,$,oe){return D===null||D.tag!==7?(D=Is(L,M.mode,$,oe),D.return=M,D):(D=h(D,L),D.return=M,D)}function Y(M,D,L){if(typeof D=="string"&&D!==""||typeof D=="number"||typeof D=="bigint")return D=Zo(""+D,M.mode,L),D.return=M,D;if(typeof D=="object"&&D!==null){switch(D.$$typeof){case w:return L=Pl(D.type,D.key,D.props,null,M.mode,L),wn(L,D),L.return=M,L;case S:return D=Qo(D,M.mode,L),D.return=M,D;case ae:return D=Gs(D),Y(M,D,L)}if(Q(D)||V(D))return D=Is(D,M.mode,L,null),D.return=M,D;if(typeof D.then=="function")return Y(M,Gl(D),L);if(D.$$typeof===j)return Y(M,Kl(M,D),L);Xl(M,D)}return null}function H(M,D,L,$){var oe=D!==null?D.key:null;if(typeof L=="string"&&L!==""||typeof L=="number"||typeof L=="bigint")return oe!==null?null:y(M,D,""+L,$);if(typeof L=="object"&&L!==null){switch(L.$$typeof){case w:return L.key===oe?k(M,D,L,$):null;case S:return L.key===oe?N(M,D,L,$):null;case ae:return L=Gs(L),H(M,D,L,$)}if(Q(L)||V(L))return oe!==null?null:P(M,D,L,$,null);if(typeof L.then=="function")return H(M,D,Gl(L),$);if(L.$$typeof===j)return H(M,D,Kl(M,L),$);Xl(M,L)}return null}function U(M,D,L,$,oe){if(typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint")return M=M.get(L)||null,y(D,M,""+$,oe);if(typeof $=="object"&&$!==null){switch($.$$typeof){case w:return M=M.get($.key===null?L:$.key)||null,k(D,M,$,oe);case S:return M=M.get($.key===null?L:$.key)||null,N(D,M,$,oe);case ae:return $=Gs($),U(M,D,L,$,oe)}if(Q($)||V($))return M=M.get(L)||null,P(D,M,$,oe,null);if(typeof $.then=="function")return U(M,D,L,Gl($),oe);if($.$$typeof===j)return U(M,D,L,Kl(D,$),oe);Xl(D,$)}return null}function re(M,D,L,$){for(var oe=null,De=null,le=D,ve=D=0,ke=null;le!==null&&ve<L.length;ve++){le.index>ve?(ke=le,le=null):ke=le.sibling;var Be=H(M,le,L[ve],$);if(Be===null){le===null&&(le=ke);break}t&&le&&Be.alternate===null&&s(M,le),D=u(Be,D,ve),De===null?oe=Be:De.sibling=Be,De=Be,le=ke}if(ve===L.length)return r(M,le),Ee&&Pi(M,ve),oe;if(le===null){for(;ve<L.length;ve++)le=Y(M,L[ve],$),le!==null&&(D=u(le,D,ve),De===null?oe=le:De.sibling=le,De=le);return Ee&&Pi(M,ve),oe}for(le=a(le);ve<L.length;ve++)ke=U(le,M,ve,L[ve],$),ke!==null&&(t&&ke.alternate!==null&&le.delete(ke.key===null?ve:ke.key),D=u(ke,D,ve),De===null?oe=ke:De.sibling=ke,De=ke);return t&&le.forEach(function(Bs){return s(M,Bs)}),Ee&&Pi(M,ve),oe}function ue(M,D,L,$){if(L==null)throw Error(l(151));for(var oe=null,De=null,le=D,ve=D=0,ke=null,Be=L.next();le!==null&&!Be.done;ve++,Be=L.next()){le.index>ve?(ke=le,le=null):ke=le.sibling;var Bs=H(M,le,Be.value,$);if(Bs===null){le===null&&(le=ke);break}t&&le&&Bs.alternate===null&&s(M,le),D=u(Bs,D,ve),De===null?oe=Bs:De.sibling=Bs,De=Bs,le=ke}if(Be.done)return r(M,le),Ee&&Pi(M,ve),oe;if(le===null){for(;!Be.done;ve++,Be=L.next())Be=Y(M,Be.value,$),Be!==null&&(D=u(Be,D,ve),De===null?oe=Be:De.sibling=Be,De=Be);return Ee&&Pi(M,ve),oe}for(le=a(le);!Be.done;ve++,Be=L.next())Be=U(le,M,ve,Be.value,$),Be!==null&&(t&&Be.alternate!==null&&le.delete(Be.key===null?ve:Be.key),D=u(Be,D,ve),De===null?oe=Be:De.sibling=Be,De=Be);return t&&le.forEach(function(dx){return s(M,dx)}),Ee&&Pi(M,ve),oe}function Ue(M,D,L,$){if(typeof L=="object"&&L!==null&&L.type===R&&L.key===null&&(L=L.props.children),typeof L=="object"&&L!==null){switch(L.$$typeof){case w:e:{for(var oe=L.key;D!==null;){if(D.key===oe){if(oe=L.type,oe===R){if(D.tag===7){r(M,D.sibling),$=h(D,L.props.children),$.return=M,M=$;break e}}else if(D.elementType===oe||typeof oe=="object"&&oe!==null&&oe.$$typeof===ae&&Gs(oe)===D.type){r(M,D.sibling),$=h(D,L.props),wn($,L),$.return=M,M=$;break e}r(M,D);break}else s(M,D);D=D.sibling}L.type===R?($=Is(L.props.children,M.mode,$,L.key),$.return=M,M=$):($=Pl(L.type,L.key,L.props,null,M.mode,$),wn($,L),$.return=M,M=$)}return m(M);case S:e:{for(oe=L.key;D!==null;){if(D.key===oe)if(D.tag===4&&D.stateNode.containerInfo===L.containerInfo&&D.stateNode.implementation===L.implementation){r(M,D.sibling),$=h(D,L.children||[]),$.return=M,M=$;break e}else{r(M,D);break}else s(M,D);D=D.sibling}$=Qo(L,M.mode,$),$.return=M,M=$}return m(M);case ae:return L=Gs(L),Ue(M,D,L,$)}if(Q(L))return re(M,D,L,$);if(V(L)){if(oe=V(L),typeof oe!="function")throw Error(l(150));return L=oe.call(L),ue(M,D,L,$)}if(typeof L.then=="function")return Ue(M,D,Gl(L),$);if(L.$$typeof===j)return Ue(M,D,Kl(M,L),$);Xl(M,L)}return typeof L=="string"&&L!==""||typeof L=="number"||typeof L=="bigint"?(L=""+L,D!==null&&D.tag===6?(r(M,D.sibling),$=h(D,L),$.return=M,M=$):(r(M,D),$=Zo(L,M.mode,$),$.return=M,M=$),m(M)):r(M,D)}return function(M,D,L,$){try{bn=0;var oe=Ue(M,D,L,$);return Mr=null,oe}catch(le){if(le===Ar||le===Yl)throw le;var De=Yt(29,le,null,M.mode);return De.lanes=$,De.return=M,De}}}var Vs=kf(!0),Ef=kf(!1),fs=!1;function hc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function uc(t,s){t=t.updateQueue,s.updateQueue===t&&(s.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function ps(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function gs(t,s,r){var a=t.updateQueue;if(a===null)return null;if(a=a.shared,(ze&2)!==0){var h=a.pending;return h===null?s.next=s:(s.next=h.next,h.next=s),a.pending=s,s=Wl(t),cf(t,null,r),s}return Ul(t,a,s,r),Wl(t)}function Cn(t,s,r){if(s=s.updateQueue,s!==null&&(s=s.shared,(r&4194048)!==0)){var a=s.lanes;a&=t.pendingLanes,r|=a,s.lanes=r,_d(t,r)}}function dc(t,s){var r=t.updateQueue,a=t.alternate;if(a!==null&&(a=a.updateQueue,r===a)){var h=null,u=null;if(r=r.firstBaseUpdate,r!==null){do{var m={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};u===null?h=u=m:u=u.next=m,r=r.next}while(r!==null);u===null?h=u=s:u=u.next=s}else h=u=s;r={baseState:a.baseState,firstBaseUpdate:h,lastBaseUpdate:u,shared:a.shared,callbacks:a.callbacks},t.updateQueue=r;return}t=r.lastBaseUpdate,t===null?r.firstBaseUpdate=s:t.next=s,r.lastBaseUpdate=s}var fc=!1;function kn(){if(fc){var t=zr;if(t!==null)throw t}}function En(t,s,r,a){fc=!1;var h=t.updateQueue;fs=!1;var u=h.firstBaseUpdate,m=h.lastBaseUpdate,y=h.shared.pending;if(y!==null){h.shared.pending=null;var k=y,N=k.next;k.next=null,m===null?u=N:m.next=N,m=k;var P=t.alternate;P!==null&&(P=P.updateQueue,y=P.lastBaseUpdate,y!==m&&(y===null?P.firstBaseUpdate=N:y.next=N,P.lastBaseUpdate=k))}if(u!==null){var Y=h.baseState;m=0,P=N=k=null,y=u;do{var H=y.lane&-536870913,U=H!==y.lane;if(U?(Ce&H)===H:(a&H)===H){H!==0&&H===Br&&(fc=!0),P!==null&&(P=P.next={lane:0,tag:y.tag,payload:y.payload,callback:null,next:null});e:{var re=t,ue=y;H=s;var Ue=r;switch(ue.tag){case 1:if(re=ue.payload,typeof re=="function"){Y=re.call(Ue,Y,H);break e}Y=re;break e;case 3:re.flags=re.flags&-65537|128;case 0:if(re=ue.payload,H=typeof re=="function"?re.call(Ue,Y,H):re,H==null)break e;Y=v({},Y,H);break e;case 2:fs=!0}}H=y.callback,H!==null&&(t.flags|=64,U&&(t.flags|=8192),U=h.callbacks,U===null?h.callbacks=[H]:U.push(H))}else U={lane:H,tag:y.tag,payload:y.payload,callback:y.callback,next:null},P===null?(N=P=U,k=Y):P=P.next=U,m|=H;if(y=y.next,y===null){if(y=h.shared.pending,y===null)break;U=y,y=U.next,U.next=null,h.lastBaseUpdate=U,h.shared.pending=null}}while(!0);P===null&&(k=Y),h.baseState=k,h.firstBaseUpdate=N,h.lastBaseUpdate=P,u===null&&(h.shared.lanes=0),xs|=m,t.lanes=m,t.memoizedState=Y}}function Tf(t,s){if(typeof t!="function")throw Error(l(191,t));t.call(s)}function Rf(t,s){var r=t.callbacks;if(r!==null)for(t.callbacks=null,t=0;t<r.length;t++)Tf(r[t],s)}var Or=T(null),Vl=T(0);function Df(t,s){t=Qi,ee(Vl,t),ee(Or,s),Qi=t|s.baseLanes}function pc(){ee(Vl,Qi),ee(Or,Or.current)}function gc(){Qi=Vl.current,K(Or),K(Vl)}var Ft=T(null),ci=null;function _s(t){var s=t.alternate;ee(Je,Je.current&1),ee(Ft,t),ci===null&&(s===null||Or.current!==null||s.memoizedState!==null)&&(ci=t)}function _c(t){ee(Je,Je.current),ee(Ft,t),ci===null&&(ci=t)}function Bf(t){t.tag===22?(ee(Je,Je.current),ee(Ft,t),ci===null&&(ci=t)):ms()}function ms(){ee(Je,Je.current),ee(Ft,Ft.current)}function Gt(t){K(Ft),ci===t&&(ci=null),K(Je)}var Je=T(0);function Zl(t){for(var s=t;s!==null;){if(s.tag===13){var r=s.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||bh(r)||wh(r)))return s}else if(s.tag===19&&(s.memoizedProps.revealOrder==="forwards"||s.memoizedProps.revealOrder==="backwards"||s.memoizedProps.revealOrder==="unstable_legacy-backwards"||s.memoizedProps.revealOrder==="together")){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var Ki=0,me=null,Ne=null,st=null,Ql=!1,jr=!1,Zs=!1,Jl=0,Tn=0,Lr=null,iy=0;function Xe(){throw Error(l(321))}function mc(t,s){if(s===null)return!1;for(var r=0;r<s.length&&r<t.length;r++)if(!$t(t[r],s[r]))return!1;return!0}function vc(t,s,r,a,h,u){return Ki=u,me=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,B.H=t===null||t.memoizedState===null?fp:Mc,Zs=!1,u=r(a,h),Zs=!1,jr&&(u=Af(s,r,a,h)),zf(t),u}function zf(t){B.H=Bn;var s=Ne!==null&&Ne.next!==null;if(Ki=0,st=Ne=me=null,Ql=!1,Tn=0,Lr=null,s)throw Error(l(300));t===null||rt||(t=t.dependencies,t!==null&&Il(t)&&(rt=!0))}function Af(t,s,r,a){me=t;var h=0;do{if(jr&&(Lr=null),Tn=0,jr=!1,25<=h)throw Error(l(301));if(h+=1,st=Ne=null,t.updateQueue!=null){var u=t.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}B.H=pp,u=s(r,a)}while(jr);return u}function sy(){var t=B.H,s=t.useState()[0];return s=typeof s.then=="function"?Rn(s):s,t=t.useState()[0],(Ne!==null?Ne.memoizedState:null)!==t&&(me.flags|=1024),s}function yc(){var t=Jl!==0;return Jl=0,t}function xc(t,s,r){s.updateQueue=t.updateQueue,s.flags&=-2053,t.lanes&=~r}function Sc(t){if(Ql){for(t=t.memoizedState;t!==null;){var s=t.queue;s!==null&&(s.pending=null),t=t.next}Ql=!1}Ki=0,st=Ne=me=null,jr=!1,Tn=Jl=0,Lr=null}function Dt(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return st===null?me.memoizedState=st=t:st=st.next=t,st}function et(){if(Ne===null){var t=me.alternate;t=t!==null?t.memoizedState:null}else t=Ne.next;var s=st===null?me.memoizedState:st.next;if(s!==null)st=s,Ne=t;else{if(t===null)throw me.alternate===null?Error(l(467)):Error(l(310));Ne=t,t={memoizedState:Ne.memoizedState,baseState:Ne.baseState,baseQueue:Ne.baseQueue,queue:Ne.queue,next:null},st===null?me.memoizedState=st=t:st=st.next=t}return st}function ea(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Rn(t){var s=Tn;return Tn+=1,Lr===null&&(Lr=[]),t=bf(Lr,t,s),s=me,(st===null?s.memoizedState:st.next)===null&&(s=s.alternate,B.H=s===null||s.memoizedState===null?fp:Mc),t}function ta(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Rn(t);if(t.$$typeof===j)return bt(t)}throw Error(l(438,String(t)))}function bc(t){var s=null,r=me.updateQueue;if(r!==null&&(s=r.memoCache),s==null){var a=me.alternate;a!==null&&(a=a.updateQueue,a!==null&&(a=a.memoCache,a!=null&&(s={data:a.data.map(function(h){return h.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),r===null&&(r=ea(),me.updateQueue=r),r.memoCache=s,r=s.data[s.index],r===void 0)for(r=s.data[s.index]=Array(t),a=0;a<t;a++)r[a]=Oe;return s.index++,r}function $i(t,s){return typeof s=="function"?s(t):s}function ia(t){var s=et();return wc(s,Ne,t)}function wc(t,s,r){var a=t.queue;if(a===null)throw Error(l(311));a.lastRenderedReducer=r;var h=t.baseQueue,u=a.pending;if(u!==null){if(h!==null){var m=h.next;h.next=u.next,u.next=m}s.baseQueue=h=u,a.pending=null}if(u=t.baseState,h===null)t.memoizedState=u;else{s=h.next;var y=m=null,k=null,N=s,P=!1;do{var Y=N.lane&-536870913;if(Y!==N.lane?(Ce&Y)===Y:(Ki&Y)===Y){var H=N.revertLane;if(H===0)k!==null&&(k=k.next={lane:0,revertLane:0,gesture:null,action:N.action,hasEagerState:N.hasEagerState,eagerState:N.eagerState,next:null}),Y===Br&&(P=!0);else if((Ki&H)===H){N=N.next,H===Br&&(P=!0);continue}else Y={lane:0,revertLane:N.revertLane,gesture:null,action:N.action,hasEagerState:N.hasEagerState,eagerState:N.eagerState,next:null},k===null?(y=k=Y,m=u):k=k.next=Y,me.lanes|=H,xs|=H;Y=N.action,Zs&&r(u,Y),u=N.hasEagerState?N.eagerState:r(u,Y)}else H={lane:Y,revertLane:N.revertLane,gesture:N.gesture,action:N.action,hasEagerState:N.hasEagerState,eagerState:N.eagerState,next:null},k===null?(y=k=H,m=u):k=k.next=H,me.lanes|=Y,xs|=Y;N=N.next}while(N!==null&&N!==s);if(k===null?m=u:k.next=y,!$t(u,t.memoizedState)&&(rt=!0,P&&(r=zr,r!==null)))throw r;t.memoizedState=u,t.baseState=m,t.baseQueue=k,a.lastRenderedState=u}return h===null&&(a.lanes=0),[t.memoizedState,a.dispatch]}function Cc(t){var s=et(),r=s.queue;if(r===null)throw Error(l(311));r.lastRenderedReducer=t;var a=r.dispatch,h=r.pending,u=s.memoizedState;if(h!==null){r.pending=null;var m=h=h.next;do u=t(u,m.action),m=m.next;while(m!==h);$t(u,s.memoizedState)||(rt=!0),s.memoizedState=u,s.baseQueue===null&&(s.baseState=u),r.lastRenderedState=u}return[u,a]}function Mf(t,s,r){var a=me,h=et(),u=Ee;if(u){if(r===void 0)throw Error(l(407));r=r()}else r=s();var m=!$t((Ne||h).memoizedState,r);if(m&&(h.memoizedState=r,rt=!0),h=h.queue,Tc(Lf.bind(null,a,h,t),[t]),h.getSnapshot!==s||m||st!==null&&st.memoizedState.tag&1){if(a.flags|=2048,Nr(9,{destroy:void 0},jf.bind(null,a,h,r,s),null),Pe===null)throw Error(l(349));u||(Ki&127)!==0||Of(a,s,r)}return r}function Of(t,s,r){t.flags|=16384,t={getSnapshot:s,value:r},s=me.updateQueue,s===null?(s=ea(),me.updateQueue=s,s.stores=[t]):(r=s.stores,r===null?s.stores=[t]:r.push(t))}function jf(t,s,r,a){s.value=r,s.getSnapshot=a,Nf(s)&&Hf(t)}function Lf(t,s,r){return r(function(){Nf(s)&&Hf(t)})}function Nf(t){var s=t.getSnapshot;t=t.value;try{var r=s();return!$t(t,r)}catch{return!0}}function Hf(t){var s=qs(t,2);s!==null&&Wt(s,t,2)}function kc(t){var s=Dt();if(typeof t=="function"){var r=t;if(t=r(),Zs){ls(!0);try{r()}finally{ls(!1)}}}return s.memoizedState=s.baseState=t,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:$i,lastRenderedState:t},s}function Uf(t,s,r,a){return t.baseState=r,wc(t,Ne,typeof a=="function"?a:$i)}function ry(t,s,r,a,h){if(na(t))throw Error(l(485));if(t=s.action,t!==null){var u={payload:h,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(m){u.listeners.push(m)}};B.T!==null?r(!0):u.isTransition=!1,a(u),r=s.pending,r===null?(u.next=s.pending=u,Wf(s,u)):(u.next=r.next,s.pending=r.next=u)}}function Wf(t,s){var r=s.action,a=s.payload,h=t.state;if(s.isTransition){var u=B.T,m={};B.T=m;try{var y=r(h,a),k=B.S;k!==null&&k(m,y),Pf(t,s,y)}catch(N){Ec(t,s,N)}finally{u!==null&&m.types!==null&&(u.types=m.types),B.T=u}}else try{u=r(h,a),Pf(t,s,u)}catch(N){Ec(t,s,N)}}function Pf(t,s,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(a){qf(t,s,a)},function(a){return Ec(t,s,a)}):qf(t,s,r)}function qf(t,s,r){s.status="fulfilled",s.value=r,If(s),t.state=r,s=t.pending,s!==null&&(r=s.next,r===s?t.pending=null:(r=r.next,s.next=r,Wf(t,r)))}function Ec(t,s,r){var a=t.pending;if(t.pending=null,a!==null){a=a.next;do s.status="rejected",s.reason=r,If(s),s=s.next;while(s!==a)}t.action=null}function If(t){t=t.listeners;for(var s=0;s<t.length;s++)(0,t[s])()}function Kf(t,s){return s}function $f(t,s){if(Ee){var r=Pe.formState;if(r!==null){e:{var a=me;if(Ee){if(qe){t:{for(var h=qe,u=oi;h.nodeType!==8;){if(!u){h=null;break t}if(h=hi(h.nextSibling),h===null){h=null;break t}}u=h.data,h=u==="F!"||u==="F"?h:null}if(h){qe=hi(h.nextSibling),a=h.data==="F!";break e}}us(a)}a=!1}a&&(s=r[0])}}return r=Dt(),r.memoizedState=r.baseState=s,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kf,lastRenderedState:s},r.queue=a,r=hp.bind(null,me,a),a.dispatch=r,a=kc(!1),u=Ac.bind(null,me,!1,a.queue),a=Dt(),h={state:s,dispatch:null,action:t,pending:null},a.queue=h,r=ry.bind(null,me,h,u,r),h.dispatch=r,a.memoizedState=t,[s,r,!1]}function Yf(t){var s=et();return Ff(s,Ne,t)}function Ff(t,s,r){if(s=wc(t,s,Kf)[0],t=ia($i)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var a=Rn(s)}catch(m){throw m===Ar?Yl:m}else a=s;s=et();var h=s.queue,u=h.dispatch;return r!==s.memoizedState&&(me.flags|=2048,Nr(9,{destroy:void 0},ny.bind(null,h,r),null)),[a,u,t]}function ny(t,s){t.action=s}function Gf(t){var s=et(),r=Ne;if(r!==null)return Ff(s,r,t);et(),s=s.memoizedState,r=et();var a=r.queue.dispatch;return r.memoizedState=t,[s,a,!1]}function Nr(t,s,r,a){return t={tag:t,create:r,deps:a,inst:s,next:null},s=me.updateQueue,s===null&&(s=ea(),me.updateQueue=s),r=s.lastEffect,r===null?s.lastEffect=t.next=t:(a=r.next,r.next=t,t.next=a,s.lastEffect=t),t}function Xf(){return et().memoizedState}function sa(t,s,r,a){var h=Dt();me.flags|=t,h.memoizedState=Nr(1|s,{destroy:void 0},r,a===void 0?null:a)}function ra(t,s,r,a){var h=et();a=a===void 0?null:a;var u=h.memoizedState.inst;Ne!==null&&a!==null&&mc(a,Ne.memoizedState.deps)?h.memoizedState=Nr(s,u,r,a):(me.flags|=t,h.memoizedState=Nr(1|s,u,r,a))}function Vf(t,s){sa(8390656,8,t,s)}function Tc(t,s){ra(2048,8,t,s)}function ly(t){me.flags|=4;var s=me.updateQueue;if(s===null)s=ea(),me.updateQueue=s,s.events=[t];else{var r=s.events;r===null?s.events=[t]:r.push(t)}}function Zf(t){var s=et().memoizedState;return ly({ref:s,nextImpl:t}),function(){if((ze&2)!==0)throw Error(l(440));return s.impl.apply(void 0,arguments)}}function Qf(t,s){return ra(4,2,t,s)}function Jf(t,s){return ra(4,4,t,s)}function ep(t,s){if(typeof s=="function"){t=t();var r=s(t);return function(){typeof r=="function"?r():s(null)}}if(s!=null)return t=t(),s.current=t,function(){s.current=null}}function tp(t,s,r){r=r!=null?r.concat([t]):null,ra(4,4,ep.bind(null,s,t),r)}function Rc(){}function ip(t,s){var r=et();s=s===void 0?null:s;var a=r.memoizedState;return s!==null&&mc(s,a[1])?a[0]:(r.memoizedState=[t,s],t)}function sp(t,s){var r=et();s=s===void 0?null:s;var a=r.memoizedState;if(s!==null&&mc(s,a[1]))return a[0];if(a=t(),Zs){ls(!0);try{t()}finally{ls(!1)}}return r.memoizedState=[a,s],a}function Dc(t,s,r){return r===void 0||(Ki&1073741824)!==0&&(Ce&261930)===0?t.memoizedState=s:(t.memoizedState=r,t=rg(),me.lanes|=t,xs|=t,r)}function rp(t,s,r,a){return $t(r,s)?r:Or.current!==null?(t=Dc(t,r,a),$t(t,s)||(rt=!0),t):(Ki&42)===0||(Ki&1073741824)!==0&&(Ce&261930)===0?(rt=!0,t.memoizedState=r):(t=rg(),me.lanes|=t,xs|=t,s)}function np(t,s,r,a,h){var u=q.p;q.p=u!==0&&8>u?u:8;var m=B.T,y={};B.T=y,Ac(t,!1,s,r);try{var k=h(),N=B.S;if(N!==null&&N(y,k),k!==null&&typeof k=="object"&&typeof k.then=="function"){var P=ty(k,a);Dn(t,s,P,Zt(t))}else Dn(t,s,a,Zt(t))}catch(Y){Dn(t,s,{then:function(){},status:"rejected",reason:Y},Zt())}finally{q.p=u,m!==null&&y.types!==null&&(m.types=y.types),B.T=m}}function ay(){}function Bc(t,s,r,a){if(t.tag!==5)throw Error(l(476));var h=lp(t).queue;np(t,h,s,I,r===null?ay:function(){return ap(t),r(a)})}function lp(t){var s=t.memoizedState;if(s!==null)return s;s={memoizedState:I,baseState:I,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:$i,lastRenderedState:I},next:null};var r={};return s.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:$i,lastRenderedState:r},next:null},t.memoizedState=s,t=t.alternate,t!==null&&(t.memoizedState=s),s}function ap(t){var s=lp(t);s.next===null&&(s=t.alternate.memoizedState),Dn(t,s.next.queue,{},Zt())}function zc(){return bt(Yn)}function op(){return et().memoizedState}function cp(){return et().memoizedState}function oy(t){for(var s=t.return;s!==null;){switch(s.tag){case 24:case 3:var r=Zt();t=ps(r);var a=gs(s,t,r);a!==null&&(Wt(a,s,r),Cn(a,s,r)),s={cache:lc()},t.payload=s;return}s=s.return}}function cy(t,s,r){var a=Zt();r={lane:a,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},na(t)?up(s,r):(r=Xo(t,s,r,a),r!==null&&(Wt(r,t,a),dp(r,s,a)))}function hp(t,s,r){var a=Zt();Dn(t,s,r,a)}function Dn(t,s,r,a){var h={lane:a,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(na(t))up(s,h);else{var u=t.alternate;if(t.lanes===0&&(u===null||u.lanes===0)&&(u=s.lastRenderedReducer,u!==null))try{var m=s.lastRenderedState,y=u(m,r);if(h.hasEagerState=!0,h.eagerState=y,$t(y,m))return Ul(t,s,h,0),Pe===null&&Hl(),!1}catch{}if(r=Xo(t,s,h,a),r!==null)return Wt(r,t,a),dp(r,s,a),!0}return!1}function Ac(t,s,r,a){if(a={lane:2,revertLane:hh(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},na(t)){if(s)throw Error(l(479))}else s=Xo(t,r,a,2),s!==null&&Wt(s,t,2)}function na(t){var s=t.alternate;return t===me||s!==null&&s===me}function up(t,s){jr=Ql=!0;var r=t.pending;r===null?s.next=s:(s.next=r.next,r.next=s),t.pending=s}function dp(t,s,r){if((r&4194048)!==0){var a=s.lanes;a&=t.pendingLanes,r|=a,s.lanes=r,_d(t,r)}}var Bn={readContext:bt,use:ta,useCallback:Xe,useContext:Xe,useEffect:Xe,useImperativeHandle:Xe,useLayoutEffect:Xe,useInsertionEffect:Xe,useMemo:Xe,useReducer:Xe,useRef:Xe,useState:Xe,useDebugValue:Xe,useDeferredValue:Xe,useTransition:Xe,useSyncExternalStore:Xe,useId:Xe,useHostTransitionStatus:Xe,useFormState:Xe,useActionState:Xe,useOptimistic:Xe,useMemoCache:Xe,useCacheRefresh:Xe};Bn.useEffectEvent=Xe;var fp={readContext:bt,use:ta,useCallback:function(t,s){return Dt().memoizedState=[t,s===void 0?null:s],t},useContext:bt,useEffect:Vf,useImperativeHandle:function(t,s,r){r=r!=null?r.concat([t]):null,sa(4194308,4,ep.bind(null,s,t),r)},useLayoutEffect:function(t,s){return sa(4194308,4,t,s)},useInsertionEffect:function(t,s){sa(4,2,t,s)},useMemo:function(t,s){var r=Dt();s=s===void 0?null:s;var a=t();if(Zs){ls(!0);try{t()}finally{ls(!1)}}return r.memoizedState=[a,s],a},useReducer:function(t,s,r){var a=Dt();if(r!==void 0){var h=r(s);if(Zs){ls(!0);try{r(s)}finally{ls(!1)}}}else h=s;return a.memoizedState=a.baseState=h,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:h},a.queue=t,t=t.dispatch=cy.bind(null,me,t),[a.memoizedState,t]},useRef:function(t){var s=Dt();return t={current:t},s.memoizedState=t},useState:function(t){t=kc(t);var s=t.queue,r=hp.bind(null,me,s);return s.dispatch=r,[t.memoizedState,r]},useDebugValue:Rc,useDeferredValue:function(t,s){var r=Dt();return Dc(r,t,s)},useTransition:function(){var t=kc(!1);return t=np.bind(null,me,t.queue,!0,!1),Dt().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,s,r){var a=me,h=Dt();if(Ee){if(r===void 0)throw Error(l(407));r=r()}else{if(r=s(),Pe===null)throw Error(l(349));(Ce&127)!==0||Of(a,s,r)}h.memoizedState=r;var u={value:r,getSnapshot:s};return h.queue=u,Vf(Lf.bind(null,a,u,t),[t]),a.flags|=2048,Nr(9,{destroy:void 0},jf.bind(null,a,u,r,s),null),r},useId:function(){var t=Dt(),s=Pe.identifierPrefix;if(Ee){var r=Ei,a=ki;r=(a&~(1<<32-Kt(a)-1)).toString(32)+r,s="_"+s+"R_"+r,r=Jl++,0<r&&(s+="H"+r.toString(32)),s+="_"}else r=iy++,s="_"+s+"r_"+r.toString(32)+"_";return t.memoizedState=s},useHostTransitionStatus:zc,useFormState:$f,useActionState:$f,useOptimistic:function(t){var s=Dt();s.memoizedState=s.baseState=t;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=r,s=Ac.bind(null,me,!0,r),r.dispatch=s,[t,s]},useMemoCache:bc,useCacheRefresh:function(){return Dt().memoizedState=oy.bind(null,me)},useEffectEvent:function(t){var s=Dt(),r={impl:t};return s.memoizedState=r,function(){if((ze&2)!==0)throw Error(l(440));return r.impl.apply(void 0,arguments)}}},Mc={readContext:bt,use:ta,useCallback:ip,useContext:bt,useEffect:Tc,useImperativeHandle:tp,useInsertionEffect:Qf,useLayoutEffect:Jf,useMemo:sp,useReducer:ia,useRef:Xf,useState:function(){return ia($i)},useDebugValue:Rc,useDeferredValue:function(t,s){var r=et();return rp(r,Ne.memoizedState,t,s)},useTransition:function(){var t=ia($i)[0],s=et().memoizedState;return[typeof t=="boolean"?t:Rn(t),s]},useSyncExternalStore:Mf,useId:op,useHostTransitionStatus:zc,useFormState:Yf,useActionState:Yf,useOptimistic:function(t,s){var r=et();return Uf(r,Ne,t,s)},useMemoCache:bc,useCacheRefresh:cp};Mc.useEffectEvent=Zf;var pp={readContext:bt,use:ta,useCallback:ip,useContext:bt,useEffect:Tc,useImperativeHandle:tp,useInsertionEffect:Qf,useLayoutEffect:Jf,useMemo:sp,useReducer:Cc,useRef:Xf,useState:function(){return Cc($i)},useDebugValue:Rc,useDeferredValue:function(t,s){var r=et();return Ne===null?Dc(r,t,s):rp(r,Ne.memoizedState,t,s)},useTransition:function(){var t=Cc($i)[0],s=et().memoizedState;return[typeof t=="boolean"?t:Rn(t),s]},useSyncExternalStore:Mf,useId:op,useHostTransitionStatus:zc,useFormState:Gf,useActionState:Gf,useOptimistic:function(t,s){var r=et();return Ne!==null?Uf(r,Ne,t,s):(r.baseState=t,[t,r.queue.dispatch])},useMemoCache:bc,useCacheRefresh:cp};pp.useEffectEvent=Zf;function Oc(t,s,r,a){s=t.memoizedState,r=r(a,s),r=r==null?s:v({},s,r),t.memoizedState=r,t.lanes===0&&(t.updateQueue.baseState=r)}var jc={enqueueSetState:function(t,s,r){t=t._reactInternals;var a=Zt(),h=ps(a);h.payload=s,r!=null&&(h.callback=r),s=gs(t,h,a),s!==null&&(Wt(s,t,a),Cn(s,t,a))},enqueueReplaceState:function(t,s,r){t=t._reactInternals;var a=Zt(),h=ps(a);h.tag=1,h.payload=s,r!=null&&(h.callback=r),s=gs(t,h,a),s!==null&&(Wt(s,t,a),Cn(s,t,a))},enqueueForceUpdate:function(t,s){t=t._reactInternals;var r=Zt(),a=ps(r);a.tag=2,s!=null&&(a.callback=s),s=gs(t,a,r),s!==null&&(Wt(s,t,r),Cn(s,t,r))}};function gp(t,s,r,a,h,u,m){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(a,u,m):s.prototype&&s.prototype.isPureReactComponent?!_n(r,a)||!_n(h,u):!0}function _p(t,s,r,a){t=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(r,a),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(r,a),s.state!==t&&jc.enqueueReplaceState(s,s.state,null)}function Qs(t,s){var r=s;if("ref"in s){r={};for(var a in s)a!=="ref"&&(r[a]=s[a])}if(t=t.defaultProps){r===s&&(r=v({},r));for(var h in t)r[h]===void 0&&(r[h]=t[h])}return r}function mp(t){Nl(t)}function vp(t){console.error(t)}function yp(t){Nl(t)}function la(t,s){try{var r=t.onUncaughtError;r(s.value,{componentStack:s.stack})}catch(a){setTimeout(function(){throw a})}}function xp(t,s,r){try{var a=t.onCaughtError;a(r.value,{componentStack:r.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(h){setTimeout(function(){throw h})}}function Lc(t,s,r){return r=ps(r),r.tag=3,r.payload={element:null},r.callback=function(){la(t,s)},r}function Sp(t){return t=ps(t),t.tag=3,t}function bp(t,s,r,a){var h=r.type.getDerivedStateFromError;if(typeof h=="function"){var u=a.value;t.payload=function(){return h(u)},t.callback=function(){xp(s,r,a)}}var m=r.stateNode;m!==null&&typeof m.componentDidCatch=="function"&&(t.callback=function(){xp(s,r,a),typeof h!="function"&&(Ss===null?Ss=new Set([this]):Ss.add(this));var y=a.stack;this.componentDidCatch(a.value,{componentStack:y!==null?y:""})})}function hy(t,s,r,a,h){if(r.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){if(s=r.alternate,s!==null&&Dr(s,r,h,!0),r=Ft.current,r!==null){switch(r.tag){case 31:case 13:return ci===null?va():r.alternate===null&&Ve===0&&(Ve=3),r.flags&=-257,r.flags|=65536,r.lanes=h,a===Fl?r.flags|=16384:(s=r.updateQueue,s===null?r.updateQueue=new Set([a]):s.add(a),ah(t,a,h)),!1;case 22:return r.flags|=65536,a===Fl?r.flags|=16384:(s=r.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([a])},r.updateQueue=s):(r=s.retryQueue,r===null?s.retryQueue=new Set([a]):r.add(a)),ah(t,a,h)),!1}throw Error(l(435,r.tag))}return ah(t,a,h),va(),!1}if(Ee)return s=Ft.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=h,a!==tc&&(t=Error(l(422),{cause:a}),yn(ni(t,r)))):(a!==tc&&(s=Error(l(423),{cause:a}),yn(ni(s,r))),t=t.current.alternate,t.flags|=65536,h&=-h,t.lanes|=h,a=ni(a,r),h=Lc(t.stateNode,a,h),dc(t,h),Ve!==4&&(Ve=2)),!1;var u=Error(l(520),{cause:a});if(u=ni(u,r),Hn===null?Hn=[u]:Hn.push(u),Ve!==4&&(Ve=2),s===null)return!0;a=ni(a,r),r=s;do{switch(r.tag){case 3:return r.flags|=65536,t=h&-h,r.lanes|=t,t=Lc(r.stateNode,a,t),dc(r,t),!1;case 1:if(s=r.type,u=r.stateNode,(r.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||u!==null&&typeof u.componentDidCatch=="function"&&(Ss===null||!Ss.has(u))))return r.flags|=65536,h&=-h,r.lanes|=h,h=Sp(h),bp(h,t,r,a),dc(r,h),!1}r=r.return}while(r!==null);return!1}var Nc=Error(l(461)),rt=!1;function wt(t,s,r,a){s.child=t===null?Ef(s,null,r,a):Vs(s,t.child,r,a)}function wp(t,s,r,a,h){r=r.render;var u=s.ref;if("ref"in a){var m={};for(var y in a)y!=="ref"&&(m[y]=a[y])}else m=a;return Ys(s),a=vc(t,s,r,m,u,h),y=yc(),t!==null&&!rt?(xc(t,s,h),Yi(t,s,h)):(Ee&&y&&Jo(s),s.flags|=1,wt(t,s,a,h),s.child)}function Cp(t,s,r,a,h){if(t===null){var u=r.type;return typeof u=="function"&&!Vo(u)&&u.defaultProps===void 0&&r.compare===null?(s.tag=15,s.type=u,kp(t,s,u,a,h)):(t=Pl(r.type,null,a,s,s.mode,h),t.ref=s.ref,t.return=s,s.child=t)}if(u=t.child,!$c(t,h)){var m=u.memoizedProps;if(r=r.compare,r=r!==null?r:_n,r(m,a)&&t.ref===s.ref)return Yi(t,s,h)}return s.flags|=1,t=Wi(u,a),t.ref=s.ref,t.return=s,s.child=t}function kp(t,s,r,a,h){if(t!==null){var u=t.memoizedProps;if(_n(u,a)&&t.ref===s.ref)if(rt=!1,s.pendingProps=a=u,$c(t,h))(t.flags&131072)!==0&&(rt=!0);else return s.lanes=t.lanes,Yi(t,s,h)}return Hc(t,s,r,a,h)}function Ep(t,s,r,a){var h=a.children,u=t!==null?t.memoizedState:null;if(t===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.mode==="hidden"){if((s.flags&128)!==0){if(u=u!==null?u.baseLanes|r:r,t!==null){for(a=s.child=t.child,h=0;a!==null;)h=h|a.lanes|a.childLanes,a=a.sibling;a=h&~u}else a=0,s.child=null;return Tp(t,s,u,r,a)}if((r&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},t!==null&&$l(s,u!==null?u.cachePool:null),u!==null?Df(s,u):pc(),Bf(s);else return a=s.lanes=536870912,Tp(t,s,u!==null?u.baseLanes|r:r,r,a)}else u!==null?($l(s,u.cachePool),Df(s,u),ms(),s.memoizedState=null):(t!==null&&$l(s,null),pc(),ms());return wt(t,s,h,r),s.child}function zn(t,s){return t!==null&&t.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function Tp(t,s,r,a,h){var u=oc();return u=u===null?null:{parent:it._currentValue,pool:u},s.memoizedState={baseLanes:r,cachePool:u},t!==null&&$l(s,null),pc(),Bf(s),t!==null&&Dr(t,s,a,!0),s.childLanes=h,null}function aa(t,s){return s=ca({mode:s.mode,children:s.children},t.mode),s.ref=t.ref,t.child=s,s.return=t,s}function Rp(t,s,r){return Vs(s,t.child,null,r),t=aa(s,s.pendingProps),t.flags|=2,Gt(s),s.memoizedState=null,t}function uy(t,s,r){var a=s.pendingProps,h=(s.flags&128)!==0;if(s.flags&=-129,t===null){if(Ee){if(a.mode==="hidden")return t=aa(s,a),s.lanes=536870912,zn(null,t);if(_c(s),(t=qe)?(t=Wg(t,oi),t=t!==null&&t.data==="&"?t:null,t!==null&&(s.memoizedState={dehydrated:t,treeContext:cs!==null?{id:ki,overflow:Ei}:null,retryLane:536870912,hydrationErrors:null},r=uf(t),r.return=s,s.child=r,St=s,qe=null)):t=null,t===null)throw us(s);return s.lanes=536870912,null}return aa(s,a)}var u=t.memoizedState;if(u!==null){var m=u.dehydrated;if(_c(s),h)if(s.flags&256)s.flags&=-257,s=Rp(t,s,r);else if(s.memoizedState!==null)s.child=t.child,s.flags|=128,s=null;else throw Error(l(558));else if(rt||Dr(t,s,r,!1),h=(r&t.childLanes)!==0,rt||h){if(a=Pe,a!==null&&(m=md(a,r),m!==0&&m!==u.retryLane))throw u.retryLane=m,qs(t,m),Wt(a,t,m),Nc;va(),s=Rp(t,s,r)}else t=u.treeContext,qe=hi(m.nextSibling),St=s,Ee=!0,hs=null,oi=!1,t!==null&&pf(s,t),s=aa(s,a),s.flags|=4096;return s}return t=Wi(t.child,{mode:a.mode,children:a.children}),t.ref=s.ref,s.child=t,t.return=s,t}function oa(t,s){var r=s.ref;if(r===null)t!==null&&t.ref!==null&&(s.flags|=4194816);else{if(typeof r!="function"&&typeof r!="object")throw Error(l(284));(t===null||t.ref!==r)&&(s.flags|=4194816)}}function Hc(t,s,r,a,h){return Ys(s),r=vc(t,s,r,a,void 0,h),a=yc(),t!==null&&!rt?(xc(t,s,h),Yi(t,s,h)):(Ee&&a&&Jo(s),s.flags|=1,wt(t,s,r,h),s.child)}function Dp(t,s,r,a,h,u){return Ys(s),s.updateQueue=null,r=Af(s,a,r,h),zf(t),a=yc(),t!==null&&!rt?(xc(t,s,u),Yi(t,s,u)):(Ee&&a&&Jo(s),s.flags|=1,wt(t,s,r,u),s.child)}function Bp(t,s,r,a,h){if(Ys(s),s.stateNode===null){var u=kr,m=r.contextType;typeof m=="object"&&m!==null&&(u=bt(m)),u=new r(a,u),s.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=jc,s.stateNode=u,u._reactInternals=s,u=s.stateNode,u.props=a,u.state=s.memoizedState,u.refs={},hc(s),m=r.contextType,u.context=typeof m=="object"&&m!==null?bt(m):kr,u.state=s.memoizedState,m=r.getDerivedStateFromProps,typeof m=="function"&&(Oc(s,r,m,a),u.state=s.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(m=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),m!==u.state&&jc.enqueueReplaceState(u,u.state,null),En(s,a,u,h),kn(),u.state=s.memoizedState),typeof u.componentDidMount=="function"&&(s.flags|=4194308),a=!0}else if(t===null){u=s.stateNode;var y=s.memoizedProps,k=Qs(r,y);u.props=k;var N=u.context,P=r.contextType;m=kr,typeof P=="object"&&P!==null&&(m=bt(P));var Y=r.getDerivedStateFromProps;P=typeof Y=="function"||typeof u.getSnapshotBeforeUpdate=="function",y=s.pendingProps!==y,P||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(y||N!==m)&&_p(s,u,a,m),fs=!1;var H=s.memoizedState;u.state=H,En(s,a,u,h),kn(),N=s.memoizedState,y||H!==N||fs?(typeof Y=="function"&&(Oc(s,r,Y,a),N=s.memoizedState),(k=fs||gp(s,r,k,a,H,N,m))?(P||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(s.flags|=4194308)):(typeof u.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=a,s.memoizedState=N),u.props=a,u.state=N,u.context=m,a=k):(typeof u.componentDidMount=="function"&&(s.flags|=4194308),a=!1)}else{u=s.stateNode,uc(t,s),m=s.memoizedProps,P=Qs(r,m),u.props=P,Y=s.pendingProps,H=u.context,N=r.contextType,k=kr,typeof N=="object"&&N!==null&&(k=bt(N)),y=r.getDerivedStateFromProps,(N=typeof y=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(m!==Y||H!==k)&&_p(s,u,a,k),fs=!1,H=s.memoizedState,u.state=H,En(s,a,u,h),kn();var U=s.memoizedState;m!==Y||H!==U||fs||t!==null&&t.dependencies!==null&&Il(t.dependencies)?(typeof y=="function"&&(Oc(s,r,y,a),U=s.memoizedState),(P=fs||gp(s,r,P,a,H,U,k)||t!==null&&t.dependencies!==null&&Il(t.dependencies))?(N||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(a,U,k),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(a,U,k)),typeof u.componentDidUpdate=="function"&&(s.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof u.componentDidUpdate!="function"||m===t.memoizedProps&&H===t.memoizedState||(s.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||m===t.memoizedProps&&H===t.memoizedState||(s.flags|=1024),s.memoizedProps=a,s.memoizedState=U),u.props=a,u.state=U,u.context=k,a=P):(typeof u.componentDidUpdate!="function"||m===t.memoizedProps&&H===t.memoizedState||(s.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||m===t.memoizedProps&&H===t.memoizedState||(s.flags|=1024),a=!1)}return u=a,oa(t,s),a=(s.flags&128)!==0,u||a?(u=s.stateNode,r=a&&typeof r.getDerivedStateFromError!="function"?null:u.render(),s.flags|=1,t!==null&&a?(s.child=Vs(s,t.child,null,h),s.child=Vs(s,null,r,h)):wt(t,s,r,h),s.memoizedState=u.state,t=s.child):t=Yi(t,s,h),t}function zp(t,s,r,a){return Ks(),s.flags|=256,wt(t,s,r,a),s.child}var Uc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Wc(t){return{baseLanes:t,cachePool:xf()}}function Pc(t,s,r){return t=t!==null?t.childLanes&~r:0,s&&(t|=Vt),t}function Ap(t,s,r){var a=s.pendingProps,h=!1,u=(s.flags&128)!==0,m;if((m=u)||(m=t!==null&&t.memoizedState===null?!1:(Je.current&2)!==0),m&&(h=!0,s.flags&=-129),m=(s.flags&32)!==0,s.flags&=-33,t===null){if(Ee){if(h?_s(s):ms(),(t=qe)?(t=Wg(t,oi),t=t!==null&&t.data!=="&"?t:null,t!==null&&(s.memoizedState={dehydrated:t,treeContext:cs!==null?{id:ki,overflow:Ei}:null,retryLane:536870912,hydrationErrors:null},r=uf(t),r.return=s,s.child=r,St=s,qe=null)):t=null,t===null)throw us(s);return wh(t)?s.lanes=32:s.lanes=536870912,null}var y=a.children;return a=a.fallback,h?(ms(),h=s.mode,y=ca({mode:"hidden",children:y},h),a=Is(a,h,r,null),y.return=s,a.return=s,y.sibling=a,s.child=y,a=s.child,a.memoizedState=Wc(r),a.childLanes=Pc(t,m,r),s.memoizedState=Uc,zn(null,a)):(_s(s),qc(s,y))}var k=t.memoizedState;if(k!==null&&(y=k.dehydrated,y!==null)){if(u)s.flags&256?(_s(s),s.flags&=-257,s=Ic(t,s,r)):s.memoizedState!==null?(ms(),s.child=t.child,s.flags|=128,s=null):(ms(),y=a.fallback,h=s.mode,a=ca({mode:"visible",children:a.children},h),y=Is(y,h,r,null),y.flags|=2,a.return=s,y.return=s,a.sibling=y,s.child=a,Vs(s,t.child,null,r),a=s.child,a.memoizedState=Wc(r),a.childLanes=Pc(t,m,r),s.memoizedState=Uc,s=zn(null,a));else if(_s(s),wh(y)){if(m=y.nextSibling&&y.nextSibling.dataset,m)var N=m.dgst;m=N,a=Error(l(419)),a.stack="",a.digest=m,yn({value:a,source:null,stack:null}),s=Ic(t,s,r)}else if(rt||Dr(t,s,r,!1),m=(r&t.childLanes)!==0,rt||m){if(m=Pe,m!==null&&(a=md(m,r),a!==0&&a!==k.retryLane))throw k.retryLane=a,qs(t,a),Wt(m,t,a),Nc;bh(y)||va(),s=Ic(t,s,r)}else bh(y)?(s.flags|=192,s.child=t.child,s=null):(t=k.treeContext,qe=hi(y.nextSibling),St=s,Ee=!0,hs=null,oi=!1,t!==null&&pf(s,t),s=qc(s,a.children),s.flags|=4096);return s}return h?(ms(),y=a.fallback,h=s.mode,k=t.child,N=k.sibling,a=Wi(k,{mode:"hidden",children:a.children}),a.subtreeFlags=k.subtreeFlags&65011712,N!==null?y=Wi(N,y):(y=Is(y,h,r,null),y.flags|=2),y.return=s,a.return=s,a.sibling=y,s.child=a,zn(null,a),a=s.child,y=t.child.memoizedState,y===null?y=Wc(r):(h=y.cachePool,h!==null?(k=it._currentValue,h=h.parent!==k?{parent:k,pool:k}:h):h=xf(),y={baseLanes:y.baseLanes|r,cachePool:h}),a.memoizedState=y,a.childLanes=Pc(t,m,r),s.memoizedState=Uc,zn(t.child,a)):(_s(s),r=t.child,t=r.sibling,r=Wi(r,{mode:"visible",children:a.children}),r.return=s,r.sibling=null,t!==null&&(m=s.deletions,m===null?(s.deletions=[t],s.flags|=16):m.push(t)),s.child=r,s.memoizedState=null,r)}function qc(t,s){return s=ca({mode:"visible",children:s},t.mode),s.return=t,t.child=s}function ca(t,s){return t=Yt(22,t,null,s),t.lanes=0,t}function Ic(t,s,r){return Vs(s,t.child,null,r),t=qc(s,s.pendingProps.children),t.flags|=2,s.memoizedState=null,t}function Mp(t,s,r){t.lanes|=s;var a=t.alternate;a!==null&&(a.lanes|=s),rc(t.return,s,r)}function Kc(t,s,r,a,h,u){var m=t.memoizedState;m===null?t.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:a,tail:r,tailMode:h,treeForkCount:u}:(m.isBackwards=s,m.rendering=null,m.renderingStartTime=0,m.last=a,m.tail=r,m.tailMode=h,m.treeForkCount=u)}function Op(t,s,r){var a=s.pendingProps,h=a.revealOrder,u=a.tail;a=a.children;var m=Je.current,y=(m&2)!==0;if(y?(m=m&1|2,s.flags|=128):m&=1,ee(Je,m),wt(t,s,a,r),a=Ee?vn:0,!y&&t!==null&&(t.flags&128)!==0)e:for(t=s.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Mp(t,r,s);else if(t.tag===19)Mp(t,r,s);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===s)break e;for(;t.sibling===null;){if(t.return===null||t.return===s)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(h){case"forwards":for(r=s.child,h=null;r!==null;)t=r.alternate,t!==null&&Zl(t)===null&&(h=r),r=r.sibling;r=h,r===null?(h=s.child,s.child=null):(h=r.sibling,r.sibling=null),Kc(s,!1,h,r,u,a);break;case"backwards":case"unstable_legacy-backwards":for(r=null,h=s.child,s.child=null;h!==null;){if(t=h.alternate,t!==null&&Zl(t)===null){s.child=h;break}t=h.sibling,h.sibling=r,r=h,h=t}Kc(s,!0,r,null,u,a);break;case"together":Kc(s,!1,null,null,void 0,a);break;default:s.memoizedState=null}return s.child}function Yi(t,s,r){if(t!==null&&(s.dependencies=t.dependencies),xs|=s.lanes,(r&s.childLanes)===0)if(t!==null){if(Dr(t,s,r,!1),(r&s.childLanes)===0)return null}else return null;if(t!==null&&s.child!==t.child)throw Error(l(153));if(s.child!==null){for(t=s.child,r=Wi(t,t.pendingProps),s.child=r,r.return=s;t.sibling!==null;)t=t.sibling,r=r.sibling=Wi(t,t.pendingProps),r.return=s;r.sibling=null}return s.child}function $c(t,s){return(t.lanes&s)!==0?!0:(t=t.dependencies,!!(t!==null&&Il(t)))}function dy(t,s,r){switch(s.tag){case 3:ot(s,s.stateNode.containerInfo),ds(s,it,t.memoizedState.cache),Ks();break;case 27:case 5:wi(s);break;case 4:ot(s,s.stateNode.containerInfo);break;case 10:ds(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,_c(s),null;break;case 13:var a=s.memoizedState;if(a!==null)return a.dehydrated!==null?(_s(s),s.flags|=128,null):(r&s.child.childLanes)!==0?Ap(t,s,r):(_s(s),t=Yi(t,s,r),t!==null?t.sibling:null);_s(s);break;case 19:var h=(t.flags&128)!==0;if(a=(r&s.childLanes)!==0,a||(Dr(t,s,r,!1),a=(r&s.childLanes)!==0),h){if(a)return Op(t,s,r);s.flags|=128}if(h=s.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),ee(Je,Je.current),a)break;return null;case 22:return s.lanes=0,Ep(t,s,r,s.pendingProps);case 24:ds(s,it,t.memoizedState.cache)}return Yi(t,s,r)}function jp(t,s,r){if(t!==null)if(t.memoizedProps!==s.pendingProps)rt=!0;else{if(!$c(t,r)&&(s.flags&128)===0)return rt=!1,dy(t,s,r);rt=(t.flags&131072)!==0}else rt=!1,Ee&&(s.flags&1048576)!==0&&ff(s,vn,s.index);switch(s.lanes=0,s.tag){case 16:e:{var a=s.pendingProps;if(t=Gs(s.elementType),s.type=t,typeof t=="function")Vo(t)?(a=Qs(t,a),s.tag=1,s=Bp(null,s,t,a,r)):(s.tag=0,s=Hc(null,s,t,a,r));else{if(t!=null){var h=t.$$typeof;if(h===C){s.tag=11,s=wp(null,s,t,a,r);break e}else if(h===Z){s.tag=14,s=Cp(null,s,t,a,r);break e}}throw s=te(t)||t,Error(l(306,s,""))}}return s;case 0:return Hc(t,s,s.type,s.pendingProps,r);case 1:return a=s.type,h=Qs(a,s.pendingProps),Bp(t,s,a,h,r);case 3:e:{if(ot(s,s.stateNode.containerInfo),t===null)throw Error(l(387));a=s.pendingProps;var u=s.memoizedState;h=u.element,uc(t,s),En(s,a,null,r);var m=s.memoizedState;if(a=m.cache,ds(s,it,a),a!==u.cache&&nc(s,[it],r,!0),kn(),a=m.element,u.isDehydrated)if(u={element:a,isDehydrated:!1,cache:m.cache},s.updateQueue.baseState=u,s.memoizedState=u,s.flags&256){s=zp(t,s,a,r);break e}else if(a!==h){h=ni(Error(l(424)),s),yn(h),s=zp(t,s,a,r);break e}else for(t=s.stateNode.containerInfo,t.nodeType===9?t=t.body:t=t.nodeName==="HTML"?t.ownerDocument.body:t,qe=hi(t.firstChild),St=s,Ee=!0,hs=null,oi=!0,r=Ef(s,null,a,r),s.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Ks(),a===h){s=Yi(t,s,r);break e}wt(t,s,a,r)}s=s.child}return s;case 26:return oa(t,s),t===null?(r=Yg(s.type,null,s.pendingProps,null))?s.memoizedState=r:Ee||(r=s.type,t=s.pendingProps,a=ka(de.current).createElement(r),a[xt]=s,a[Ot]=t,Ct(a,r,t),ft(a),s.stateNode=a):s.memoizedState=Yg(s.type,t.memoizedProps,s.pendingProps,t.memoizedState),null;case 27:return wi(s),t===null&&Ee&&(a=s.stateNode=Ig(s.type,s.pendingProps,de.current),St=s,oi=!0,h=qe,ks(s.type)?(Ch=h,qe=hi(a.firstChild)):qe=h),wt(t,s,s.pendingProps.children,r),oa(t,s),t===null&&(s.flags|=4194304),s.child;case 5:return t===null&&Ee&&((h=a=qe)&&(a=qy(a,s.type,s.pendingProps,oi),a!==null?(s.stateNode=a,St=s,qe=hi(a.firstChild),oi=!1,h=!0):h=!1),h||us(s)),wi(s),h=s.type,u=s.pendingProps,m=t!==null?t.memoizedProps:null,a=u.children,yh(h,u)?a=null:m!==null&&yh(h,m)&&(s.flags|=32),s.memoizedState!==null&&(h=vc(t,s,sy,null,null,r),Yn._currentValue=h),oa(t,s),wt(t,s,a,r),s.child;case 6:return t===null&&Ee&&((t=r=qe)&&(r=Iy(r,s.pendingProps,oi),r!==null?(s.stateNode=r,St=s,qe=null,t=!0):t=!1),t||us(s)),null;case 13:return Ap(t,s,r);case 4:return ot(s,s.stateNode.containerInfo),a=s.pendingProps,t===null?s.child=Vs(s,null,a,r):wt(t,s,a,r),s.child;case 11:return wp(t,s,s.type,s.pendingProps,r);case 7:return wt(t,s,s.pendingProps,r),s.child;case 8:return wt(t,s,s.pendingProps.children,r),s.child;case 12:return wt(t,s,s.pendingProps.children,r),s.child;case 10:return a=s.pendingProps,ds(s,s.type,a.value),wt(t,s,a.children,r),s.child;case 9:return h=s.type._context,a=s.pendingProps.children,Ys(s),h=bt(h),a=a(h),s.flags|=1,wt(t,s,a,r),s.child;case 14:return Cp(t,s,s.type,s.pendingProps,r);case 15:return kp(t,s,s.type,s.pendingProps,r);case 19:return Op(t,s,r);case 31:return uy(t,s,r);case 22:return Ep(t,s,r,s.pendingProps);case 24:return Ys(s),a=bt(it),t===null?(h=oc(),h===null&&(h=Pe,u=lc(),h.pooledCache=u,u.refCount++,u!==null&&(h.pooledCacheLanes|=r),h=u),s.memoizedState={parent:a,cache:h},hc(s),ds(s,it,h)):((t.lanes&r)!==0&&(uc(t,s),En(s,null,null,r),kn()),h=t.memoizedState,u=s.memoizedState,h.parent!==a?(h={parent:a,cache:a},s.memoizedState=h,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=h),ds(s,it,a)):(a=u.cache,ds(s,it,a),a!==h.cache&&nc(s,[it],r,!0))),wt(t,s,s.pendingProps.children,r),s.child;case 29:throw s.pendingProps}throw Error(l(156,s.tag))}function Fi(t){t.flags|=4}function Yc(t,s,r,a,h){if((s=(t.mode&32)!==0)&&(s=!1),s){if(t.flags|=16777216,(h&335544128)===h)if(t.stateNode.complete)t.flags|=8192;else if(og())t.flags|=8192;else throw Xs=Fl,cc}else t.flags&=-16777217}function Lp(t,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!Zg(s))if(og())t.flags|=8192;else throw Xs=Fl,cc}function ha(t,s){s!==null&&(t.flags|=4),t.flags&16384&&(s=t.tag!==22?pd():536870912,t.lanes|=s,Pr|=s)}function An(t,s){if(!Ee)switch(t.tailMode){case"hidden":s=t.tail;for(var r=null;s!==null;)s.alternate!==null&&(r=s),s=s.sibling;r===null?t.tail=null:r.sibling=null;break;case"collapsed":r=t.tail;for(var a=null;r!==null;)r.alternate!==null&&(a=r),r=r.sibling;a===null?s||t.tail===null?t.tail=null:t.tail.sibling=null:a.sibling=null}}function Ie(t){var s=t.alternate!==null&&t.alternate.child===t.child,r=0,a=0;if(s)for(var h=t.child;h!==null;)r|=h.lanes|h.childLanes,a|=h.subtreeFlags&65011712,a|=h.flags&65011712,h.return=t,h=h.sibling;else for(h=t.child;h!==null;)r|=h.lanes|h.childLanes,a|=h.subtreeFlags,a|=h.flags,h.return=t,h=h.sibling;return t.subtreeFlags|=a,t.childLanes=r,s}function fy(t,s,r){var a=s.pendingProps;switch(ec(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ie(s),null;case 1:return Ie(s),null;case 3:return r=s.stateNode,a=null,t!==null&&(a=t.memoizedState.cache),s.memoizedState.cache!==a&&(s.flags|=2048),Ii(it),Ae(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(Rr(s)?Fi(s):t===null||t.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,ic())),Ie(s),null;case 26:var h=s.type,u=s.memoizedState;return t===null?(Fi(s),u!==null?(Ie(s),Lp(s,u)):(Ie(s),Yc(s,h,null,a,r))):u?u!==t.memoizedState?(Fi(s),Ie(s),Lp(s,u)):(Ie(s),s.flags&=-16777217):(t=t.memoizedProps,t!==a&&Fi(s),Ie(s),Yc(s,h,t,a,r)),null;case 27:if(Ci(s),r=de.current,h=s.type,t!==null&&s.stateNode!=null)t.memoizedProps!==a&&Fi(s);else{if(!a){if(s.stateNode===null)throw Error(l(166));return Ie(s),null}t=ie.current,Rr(s)?gf(s):(t=Ig(h,a,r),s.stateNode=t,Fi(s))}return Ie(s),null;case 5:if(Ci(s),h=s.type,t!==null&&s.stateNode!=null)t.memoizedProps!==a&&Fi(s);else{if(!a){if(s.stateNode===null)throw Error(l(166));return Ie(s),null}if(u=ie.current,Rr(s))gf(s);else{var m=ka(de.current);switch(u){case 1:u=m.createElementNS("http://www.w3.org/2000/svg",h);break;case 2:u=m.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;default:switch(h){case"svg":u=m.createElementNS("http://www.w3.org/2000/svg",h);break;case"math":u=m.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;case"script":u=m.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof a.is=="string"?m.createElement("select",{is:a.is}):m.createElement("select"),a.multiple?u.multiple=!0:a.size&&(u.size=a.size);break;default:u=typeof a.is=="string"?m.createElement(h,{is:a.is}):m.createElement(h)}}u[xt]=s,u[Ot]=a;e:for(m=s.child;m!==null;){if(m.tag===5||m.tag===6)u.appendChild(m.stateNode);else if(m.tag!==4&&m.tag!==27&&m.child!==null){m.child.return=m,m=m.child;continue}if(m===s)break e;for(;m.sibling===null;){if(m.return===null||m.return===s)break e;m=m.return}m.sibling.return=m.return,m=m.sibling}s.stateNode=u;e:switch(Ct(u,h,a),h){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break e;case"img":a=!0;break e;default:a=!1}a&&Fi(s)}}return Ie(s),Yc(s,s.type,t===null?null:t.memoizedProps,s.pendingProps,r),null;case 6:if(t&&s.stateNode!=null)t.memoizedProps!==a&&Fi(s);else{if(typeof a!="string"&&s.stateNode===null)throw Error(l(166));if(t=de.current,Rr(s)){if(t=s.stateNode,r=s.memoizedProps,a=null,h=St,h!==null)switch(h.tag){case 27:case 5:a=h.memoizedProps}t[xt]=s,t=!!(t.nodeValue===r||a!==null&&a.suppressHydrationWarning===!0||Ag(t.nodeValue,r)),t||us(s,!0)}else t=ka(t).createTextNode(a),t[xt]=s,s.stateNode=t}return Ie(s),null;case 31:if(r=s.memoizedState,t===null||t.memoizedState!==null){if(a=Rr(s),r!==null){if(t===null){if(!a)throw Error(l(318));if(t=s.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(l(557));t[xt]=s}else Ks(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Ie(s),t=!1}else r=ic(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=r),t=!0;if(!t)return s.flags&256?(Gt(s),s):(Gt(s),null);if((s.flags&128)!==0)throw Error(l(558))}return Ie(s),null;case 13:if(a=s.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(h=Rr(s),a!==null&&a.dehydrated!==null){if(t===null){if(!h)throw Error(l(318));if(h=s.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(l(317));h[xt]=s}else Ks(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Ie(s),h=!1}else h=ic(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=h),h=!0;if(!h)return s.flags&256?(Gt(s),s):(Gt(s),null)}return Gt(s),(s.flags&128)!==0?(s.lanes=r,s):(r=a!==null,t=t!==null&&t.memoizedState!==null,r&&(a=s.child,h=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(h=a.alternate.memoizedState.cachePool.pool),u=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(u=a.memoizedState.cachePool.pool),u!==h&&(a.flags|=2048)),r!==t&&r&&(s.child.flags|=8192),ha(s,s.updateQueue),Ie(s),null);case 4:return Ae(),t===null&&ph(s.stateNode.containerInfo),Ie(s),null;case 10:return Ii(s.type),Ie(s),null;case 19:if(K(Je),a=s.memoizedState,a===null)return Ie(s),null;if(h=(s.flags&128)!==0,u=a.rendering,u===null)if(h)An(a,!1);else{if(Ve!==0||t!==null&&(t.flags&128)!==0)for(t=s.child;t!==null;){if(u=Zl(t),u!==null){for(s.flags|=128,An(a,!1),t=u.updateQueue,s.updateQueue=t,ha(s,t),s.subtreeFlags=0,t=r,r=s.child;r!==null;)hf(r,t),r=r.sibling;return ee(Je,Je.current&1|2),Ee&&Pi(s,a.treeForkCount),s.child}t=t.sibling}a.tail!==null&&qt()>ga&&(s.flags|=128,h=!0,An(a,!1),s.lanes=4194304)}else{if(!h)if(t=Zl(u),t!==null){if(s.flags|=128,h=!0,t=t.updateQueue,s.updateQueue=t,ha(s,t),An(a,!0),a.tail===null&&a.tailMode==="hidden"&&!u.alternate&&!Ee)return Ie(s),null}else 2*qt()-a.renderingStartTime>ga&&r!==536870912&&(s.flags|=128,h=!0,An(a,!1),s.lanes=4194304);a.isBackwards?(u.sibling=s.child,s.child=u):(t=a.last,t!==null?t.sibling=u:s.child=u,a.last=u)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=qt(),t.sibling=null,r=Je.current,ee(Je,h?r&1|2:r&1),Ee&&Pi(s,a.treeForkCount),t):(Ie(s),null);case 22:case 23:return Gt(s),gc(),a=s.memoizedState!==null,t!==null?t.memoizedState!==null!==a&&(s.flags|=8192):a&&(s.flags|=8192),a?(r&536870912)!==0&&(s.flags&128)===0&&(Ie(s),s.subtreeFlags&6&&(s.flags|=8192)):Ie(s),r=s.updateQueue,r!==null&&ha(s,r.retryQueue),r=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),a=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(a=s.memoizedState.cachePool.pool),a!==r&&(s.flags|=2048),t!==null&&K(Fs),null;case 24:return r=null,t!==null&&(r=t.memoizedState.cache),s.memoizedState.cache!==r&&(s.flags|=2048),Ii(it),Ie(s),null;case 25:return null;case 30:return null}throw Error(l(156,s.tag))}function py(t,s){switch(ec(s),s.tag){case 1:return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 3:return Ii(it),Ae(),t=s.flags,(t&65536)!==0&&(t&128)===0?(s.flags=t&-65537|128,s):null;case 26:case 27:case 5:return Ci(s),null;case 31:if(s.memoizedState!==null){if(Gt(s),s.alternate===null)throw Error(l(340));Ks()}return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 13:if(Gt(s),t=s.memoizedState,t!==null&&t.dehydrated!==null){if(s.alternate===null)throw Error(l(340));Ks()}return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 19:return K(Je),null;case 4:return Ae(),null;case 10:return Ii(s.type),null;case 22:case 23:return Gt(s),gc(),t!==null&&K(Fs),t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 24:return Ii(it),null;case 25:return null;default:return null}}function Np(t,s){switch(ec(s),s.tag){case 3:Ii(it),Ae();break;case 26:case 27:case 5:Ci(s);break;case 4:Ae();break;case 31:s.memoizedState!==null&&Gt(s);break;case 13:Gt(s);break;case 19:K(Je);break;case 10:Ii(s.type);break;case 22:case 23:Gt(s),gc(),t!==null&&K(Fs);break;case 24:Ii(it)}}function Mn(t,s){try{var r=s.updateQueue,a=r!==null?r.lastEffect:null;if(a!==null){var h=a.next;r=h;do{if((r.tag&t)===t){a=void 0;var u=r.create,m=r.inst;a=u(),m.destroy=a}r=r.next}while(r!==h)}}catch(y){Le(s,s.return,y)}}function vs(t,s,r){try{var a=s.updateQueue,h=a!==null?a.lastEffect:null;if(h!==null){var u=h.next;a=u;do{if((a.tag&t)===t){var m=a.inst,y=m.destroy;if(y!==void 0){m.destroy=void 0,h=s;var k=r,N=y;try{N()}catch(P){Le(h,k,P)}}}a=a.next}while(a!==u)}}catch(P){Le(s,s.return,P)}}function Hp(t){var s=t.updateQueue;if(s!==null){var r=t.stateNode;try{Rf(s,r)}catch(a){Le(t,t.return,a)}}}function Up(t,s,r){r.props=Qs(t.type,t.memoizedProps),r.state=t.memoizedState;try{r.componentWillUnmount()}catch(a){Le(t,s,a)}}function On(t,s){try{var r=t.ref;if(r!==null){switch(t.tag){case 26:case 27:case 5:var a=t.stateNode;break;case 30:a=t.stateNode;break;default:a=t.stateNode}typeof r=="function"?t.refCleanup=r(a):r.current=a}}catch(h){Le(t,s,h)}}function Ti(t,s){var r=t.ref,a=t.refCleanup;if(r!==null)if(typeof a=="function")try{a()}catch(h){Le(t,s,h)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(h){Le(t,s,h)}else r.current=null}function Wp(t){var s=t.type,r=t.memoizedProps,a=t.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":r.autoFocus&&a.focus();break e;case"img":r.src?a.src=r.src:r.srcSet&&(a.srcset=r.srcSet)}}catch(h){Le(t,t.return,h)}}function Fc(t,s,r){try{var a=t.stateNode;Ly(a,t.type,r,s),a[Ot]=s}catch(h){Le(t,t.return,h)}}function Pp(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&ks(t.type)||t.tag===4}function Gc(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Pp(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&ks(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Xc(t,s,r){var a=t.tag;if(a===5||a===6)t=t.stateNode,s?(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r).insertBefore(t,s):(s=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,s.appendChild(t),r=r._reactRootContainer,r!=null||s.onclick!==null||(s.onclick=Hi));else if(a!==4&&(a===27&&ks(t.type)&&(r=t.stateNode,s=null),t=t.child,t!==null))for(Xc(t,s,r),t=t.sibling;t!==null;)Xc(t,s,r),t=t.sibling}function ua(t,s,r){var a=t.tag;if(a===5||a===6)t=t.stateNode,s?r.insertBefore(t,s):r.appendChild(t);else if(a!==4&&(a===27&&ks(t.type)&&(r=t.stateNode),t=t.child,t!==null))for(ua(t,s,r),t=t.sibling;t!==null;)ua(t,s,r),t=t.sibling}function qp(t){var s=t.stateNode,r=t.memoizedProps;try{for(var a=t.type,h=s.attributes;h.length;)s.removeAttributeNode(h[0]);Ct(s,a,r),s[xt]=t,s[Ot]=r}catch(u){Le(t,t.return,u)}}var Gi=!1,nt=!1,Vc=!1,Ip=typeof WeakSet=="function"?WeakSet:Set,pt=null;function gy(t,s){if(t=t.containerInfo,mh=Aa,t=ef(t),Io(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var a=r.getSelection&&r.getSelection();if(a&&a.rangeCount!==0){r=a.anchorNode;var h=a.anchorOffset,u=a.focusNode;a=a.focusOffset;try{r.nodeType,u.nodeType}catch{r=null;break e}var m=0,y=-1,k=-1,N=0,P=0,Y=t,H=null;t:for(;;){for(var U;Y!==r||h!==0&&Y.nodeType!==3||(y=m+h),Y!==u||a!==0&&Y.nodeType!==3||(k=m+a),Y.nodeType===3&&(m+=Y.nodeValue.length),(U=Y.firstChild)!==null;)H=Y,Y=U;for(;;){if(Y===t)break t;if(H===r&&++N===h&&(y=m),H===u&&++P===a&&(k=m),(U=Y.nextSibling)!==null)break;Y=H,H=Y.parentNode}Y=U}r=y===-1||k===-1?null:{start:y,end:k}}else r=null}r=r||{start:0,end:0}}else r=null;for(vh={focusedElem:t,selectionRange:r},Aa=!1,pt=s;pt!==null;)if(s=pt,t=s.child,(s.subtreeFlags&1028)!==0&&t!==null)t.return=s,pt=t;else for(;pt!==null;){switch(s=pt,u=s.alternate,t=s.flags,s.tag){case 0:if((t&4)!==0&&(t=s.updateQueue,t=t!==null?t.events:null,t!==null))for(r=0;r<t.length;r++)h=t[r],h.ref.impl=h.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&u!==null){t=void 0,r=s,h=u.memoizedProps,u=u.memoizedState,a=r.stateNode;try{var re=Qs(r.type,h);t=a.getSnapshotBeforeUpdate(re,u),a.__reactInternalSnapshotBeforeUpdate=t}catch(ue){Le(r,r.return,ue)}}break;case 3:if((t&1024)!==0){if(t=s.stateNode.containerInfo,r=t.nodeType,r===9)Sh(t);else if(r===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":Sh(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(l(163))}if(t=s.sibling,t!==null){t.return=s.return,pt=t;break}pt=s.return}}function Kp(t,s,r){var a=r.flags;switch(r.tag){case 0:case 11:case 15:Vi(t,r),a&4&&Mn(5,r);break;case 1:if(Vi(t,r),a&4)if(t=r.stateNode,s===null)try{t.componentDidMount()}catch(m){Le(r,r.return,m)}else{var h=Qs(r.type,s.memoizedProps);s=s.memoizedState;try{t.componentDidUpdate(h,s,t.__reactInternalSnapshotBeforeUpdate)}catch(m){Le(r,r.return,m)}}a&64&&Hp(r),a&512&&On(r,r.return);break;case 3:if(Vi(t,r),a&64&&(t=r.updateQueue,t!==null)){if(s=null,r.child!==null)switch(r.child.tag){case 27:case 5:s=r.child.stateNode;break;case 1:s=r.child.stateNode}try{Rf(t,s)}catch(m){Le(r,r.return,m)}}break;case 27:s===null&&a&4&&qp(r);case 26:case 5:Vi(t,r),s===null&&a&4&&Wp(r),a&512&&On(r,r.return);break;case 12:Vi(t,r);break;case 31:Vi(t,r),a&4&&Fp(t,r);break;case 13:Vi(t,r),a&4&&Gp(t,r),a&64&&(t=r.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(r=Cy.bind(null,r),Ky(t,r))));break;case 22:if(a=r.memoizedState!==null||Gi,!a){s=s!==null&&s.memoizedState!==null||nt,h=Gi;var u=nt;Gi=a,(nt=s)&&!u?Zi(t,r,(r.subtreeFlags&8772)!==0):Vi(t,r),Gi=h,nt=u}break;case 30:break;default:Vi(t,r)}}function $p(t){var s=t.alternate;s!==null&&(t.alternate=null,$p(s)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(s=t.stateNode,s!==null&&Eo(s)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var $e=null,Lt=!1;function Xi(t,s,r){for(r=r.child;r!==null;)Yp(t,s,r),r=r.sibling}function Yp(t,s,r){if(It&&typeof It.onCommitFiberUnmount=="function")try{It.onCommitFiberUnmount(rn,r)}catch{}switch(r.tag){case 26:nt||Ti(r,s),Xi(t,s,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:nt||Ti(r,s);var a=$e,h=Lt;ks(r.type)&&($e=r.stateNode,Lt=!1),Xi(t,s,r),In(r.stateNode),$e=a,Lt=h;break;case 5:nt||Ti(r,s);case 6:if(a=$e,h=Lt,$e=null,Xi(t,s,r),$e=a,Lt=h,$e!==null)if(Lt)try{($e.nodeType===9?$e.body:$e.nodeName==="HTML"?$e.ownerDocument.body:$e).removeChild(r.stateNode)}catch(u){Le(r,s,u)}else try{$e.removeChild(r.stateNode)}catch(u){Le(r,s,u)}break;case 18:$e!==null&&(Lt?(t=$e,Hg(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,r.stateNode),Xr(t)):Hg($e,r.stateNode));break;case 4:a=$e,h=Lt,$e=r.stateNode.containerInfo,Lt=!0,Xi(t,s,r),$e=a,Lt=h;break;case 0:case 11:case 14:case 15:vs(2,r,s),nt||vs(4,r,s),Xi(t,s,r);break;case 1:nt||(Ti(r,s),a=r.stateNode,typeof a.componentWillUnmount=="function"&&Up(r,s,a)),Xi(t,s,r);break;case 21:Xi(t,s,r);break;case 22:nt=(a=nt)||r.memoizedState!==null,Xi(t,s,r),nt=a;break;default:Xi(t,s,r)}}function Fp(t,s){if(s.memoizedState===null&&(t=s.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Xr(t)}catch(r){Le(s,s.return,r)}}}function Gp(t,s){if(s.memoizedState===null&&(t=s.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Xr(t)}catch(r){Le(s,s.return,r)}}function _y(t){switch(t.tag){case 31:case 13:case 19:var s=t.stateNode;return s===null&&(s=t.stateNode=new Ip),s;case 22:return t=t.stateNode,s=t._retryCache,s===null&&(s=t._retryCache=new Ip),s;default:throw Error(l(435,t.tag))}}function da(t,s){var r=_y(t);s.forEach(function(a){if(!r.has(a)){r.add(a);var h=ky.bind(null,t,a);a.then(h,h)}})}function Nt(t,s){var r=s.deletions;if(r!==null)for(var a=0;a<r.length;a++){var h=r[a],u=t,m=s,y=m;e:for(;y!==null;){switch(y.tag){case 27:if(ks(y.type)){$e=y.stateNode,Lt=!1;break e}break;case 5:$e=y.stateNode,Lt=!1;break e;case 3:case 4:$e=y.stateNode.containerInfo,Lt=!0;break e}y=y.return}if($e===null)throw Error(l(160));Yp(u,m,h),$e=null,Lt=!1,u=h.alternate,u!==null&&(u.return=null),h.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)Xp(s,t),s=s.sibling}var yi=null;function Xp(t,s){var r=t.alternate,a=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:Nt(s,t),Ht(t),a&4&&(vs(3,t,t.return),Mn(3,t),vs(5,t,t.return));break;case 1:Nt(s,t),Ht(t),a&512&&(nt||r===null||Ti(r,r.return)),a&64&&Gi&&(t=t.updateQueue,t!==null&&(a=t.callbacks,a!==null&&(r=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=r===null?a:r.concat(a))));break;case 26:var h=yi;if(Nt(s,t),Ht(t),a&512&&(nt||r===null||Ti(r,r.return)),a&4){var u=r!==null?r.memoizedState:null;if(a=t.memoizedState,r===null)if(a===null)if(t.stateNode===null){e:{a=t.type,r=t.memoizedProps,h=h.ownerDocument||h;t:switch(a){case"title":u=h.getElementsByTagName("title")[0],(!u||u[an]||u[xt]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=h.createElement(a),h.head.insertBefore(u,h.querySelector("head > title"))),Ct(u,a,r),u[xt]=t,ft(u),a=u;break e;case"link":var m=Xg("link","href",h).get(a+(r.href||""));if(m){for(var y=0;y<m.length;y++)if(u=m[y],u.getAttribute("href")===(r.href==null||r.href===""?null:r.href)&&u.getAttribute("rel")===(r.rel==null?null:r.rel)&&u.getAttribute("title")===(r.title==null?null:r.title)&&u.getAttribute("crossorigin")===(r.crossOrigin==null?null:r.crossOrigin)){m.splice(y,1);break t}}u=h.createElement(a),Ct(u,a,r),h.head.appendChild(u);break;case"meta":if(m=Xg("meta","content",h).get(a+(r.content||""))){for(y=0;y<m.length;y++)if(u=m[y],u.getAttribute("content")===(r.content==null?null:""+r.content)&&u.getAttribute("name")===(r.name==null?null:r.name)&&u.getAttribute("property")===(r.property==null?null:r.property)&&u.getAttribute("http-equiv")===(r.httpEquiv==null?null:r.httpEquiv)&&u.getAttribute("charset")===(r.charSet==null?null:r.charSet)){m.splice(y,1);break t}}u=h.createElement(a),Ct(u,a,r),h.head.appendChild(u);break;default:throw Error(l(468,a))}u[xt]=t,ft(u),a=u}t.stateNode=a}else Vg(h,t.type,t.stateNode);else t.stateNode=Gg(h,a,t.memoizedProps);else u!==a?(u===null?r.stateNode!==null&&(r=r.stateNode,r.parentNode.removeChild(r)):u.count--,a===null?Vg(h,t.type,t.stateNode):Gg(h,a,t.memoizedProps)):a===null&&t.stateNode!==null&&Fc(t,t.memoizedProps,r.memoizedProps)}break;case 27:Nt(s,t),Ht(t),a&512&&(nt||r===null||Ti(r,r.return)),r!==null&&a&4&&Fc(t,t.memoizedProps,r.memoizedProps);break;case 5:if(Nt(s,t),Ht(t),a&512&&(nt||r===null||Ti(r,r.return)),t.flags&32){h=t.stateNode;try{vr(h,"")}catch(re){Le(t,t.return,re)}}a&4&&t.stateNode!=null&&(h=t.memoizedProps,Fc(t,h,r!==null?r.memoizedProps:h)),a&1024&&(Vc=!0);break;case 6:if(Nt(s,t),Ht(t),a&4){if(t.stateNode===null)throw Error(l(162));a=t.memoizedProps,r=t.stateNode;try{r.nodeValue=a}catch(re){Le(t,t.return,re)}}break;case 3:if(Ra=null,h=yi,yi=Ea(s.containerInfo),Nt(s,t),yi=h,Ht(t),a&4&&r!==null&&r.memoizedState.isDehydrated)try{Xr(s.containerInfo)}catch(re){Le(t,t.return,re)}Vc&&(Vc=!1,Vp(t));break;case 4:a=yi,yi=Ea(t.stateNode.containerInfo),Nt(s,t),Ht(t),yi=a;break;case 12:Nt(s,t),Ht(t);break;case 31:Nt(s,t),Ht(t),a&4&&(a=t.updateQueue,a!==null&&(t.updateQueue=null,da(t,a)));break;case 13:Nt(s,t),Ht(t),t.child.flags&8192&&t.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(pa=qt()),a&4&&(a=t.updateQueue,a!==null&&(t.updateQueue=null,da(t,a)));break;case 22:h=t.memoizedState!==null;var k=r!==null&&r.memoizedState!==null,N=Gi,P=nt;if(Gi=N||h,nt=P||k,Nt(s,t),nt=P,Gi=N,Ht(t),a&8192)e:for(s=t.stateNode,s._visibility=h?s._visibility&-2:s._visibility|1,h&&(r===null||k||Gi||nt||Js(t)),r=null,s=t;;){if(s.tag===5||s.tag===26){if(r===null){k=r=s;try{if(u=k.stateNode,h)m=u.style,typeof m.setProperty=="function"?m.setProperty("display","none","important"):m.display="none";else{y=k.stateNode;var Y=k.memoizedProps.style,H=Y!=null&&Y.hasOwnProperty("display")?Y.display:null;y.style.display=H==null||typeof H=="boolean"?"":(""+H).trim()}}catch(re){Le(k,k.return,re)}}}else if(s.tag===6){if(r===null){k=s;try{k.stateNode.nodeValue=h?"":k.memoizedProps}catch(re){Le(k,k.return,re)}}}else if(s.tag===18){if(r===null){k=s;try{var U=k.stateNode;h?Ug(U,!0):Ug(k.stateNode,!1)}catch(re){Le(k,k.return,re)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===t)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break e;for(;s.sibling===null;){if(s.return===null||s.return===t)break e;r===s&&(r=null),s=s.return}r===s&&(r=null),s.sibling.return=s.return,s=s.sibling}a&4&&(a=t.updateQueue,a!==null&&(r=a.retryQueue,r!==null&&(a.retryQueue=null,da(t,r))));break;case 19:Nt(s,t),Ht(t),a&4&&(a=t.updateQueue,a!==null&&(t.updateQueue=null,da(t,a)));break;case 30:break;case 21:break;default:Nt(s,t),Ht(t)}}function Ht(t){var s=t.flags;if(s&2){try{for(var r,a=t.return;a!==null;){if(Pp(a)){r=a;break}a=a.return}if(r==null)throw Error(l(160));switch(r.tag){case 27:var h=r.stateNode,u=Gc(t);ua(t,u,h);break;case 5:var m=r.stateNode;r.flags&32&&(vr(m,""),r.flags&=-33);var y=Gc(t);ua(t,y,m);break;case 3:case 4:var k=r.stateNode.containerInfo,N=Gc(t);Xc(t,N,k);break;default:throw Error(l(161))}}catch(P){Le(t,t.return,P)}t.flags&=-3}s&4096&&(t.flags&=-4097)}function Vp(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var s=t;Vp(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),t=t.sibling}}function Vi(t,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)Kp(t,s.alternate,s),s=s.sibling}function Js(t){for(t=t.child;t!==null;){var s=t;switch(s.tag){case 0:case 11:case 14:case 15:vs(4,s,s.return),Js(s);break;case 1:Ti(s,s.return);var r=s.stateNode;typeof r.componentWillUnmount=="function"&&Up(s,s.return,r),Js(s);break;case 27:In(s.stateNode);case 26:case 5:Ti(s,s.return),Js(s);break;case 22:s.memoizedState===null&&Js(s);break;case 30:Js(s);break;default:Js(s)}t=t.sibling}}function Zi(t,s,r){for(r=r&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var a=s.alternate,h=t,u=s,m=u.flags;switch(u.tag){case 0:case 11:case 15:Zi(h,u,r),Mn(4,u);break;case 1:if(Zi(h,u,r),a=u,h=a.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(N){Le(a,a.return,N)}if(a=u,h=a.updateQueue,h!==null){var y=a.stateNode;try{var k=h.shared.hiddenCallbacks;if(k!==null)for(h.shared.hiddenCallbacks=null,h=0;h<k.length;h++)Tf(k[h],y)}catch(N){Le(a,a.return,N)}}r&&m&64&&Hp(u),On(u,u.return);break;case 27:qp(u);case 26:case 5:Zi(h,u,r),r&&a===null&&m&4&&Wp(u),On(u,u.return);break;case 12:Zi(h,u,r);break;case 31:Zi(h,u,r),r&&m&4&&Fp(h,u);break;case 13:Zi(h,u,r),r&&m&4&&Gp(h,u);break;case 22:u.memoizedState===null&&Zi(h,u,r),On(u,u.return);break;case 30:break;default:Zi(h,u,r)}s=s.sibling}}function Zc(t,s){var r=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),t=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(t=s.memoizedState.cachePool.pool),t!==r&&(t!=null&&t.refCount++,r!=null&&xn(r))}function Qc(t,s){t=null,s.alternate!==null&&(t=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==t&&(s.refCount++,t!=null&&xn(t))}function xi(t,s,r,a){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)Zp(t,s,r,a),s=s.sibling}function Zp(t,s,r,a){var h=s.flags;switch(s.tag){case 0:case 11:case 15:xi(t,s,r,a),h&2048&&Mn(9,s);break;case 1:xi(t,s,r,a);break;case 3:xi(t,s,r,a),h&2048&&(t=null,s.alternate!==null&&(t=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==t&&(s.refCount++,t!=null&&xn(t)));break;case 12:if(h&2048){xi(t,s,r,a),t=s.stateNode;try{var u=s.memoizedProps,m=u.id,y=u.onPostCommit;typeof y=="function"&&y(m,s.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(k){Le(s,s.return,k)}}else xi(t,s,r,a);break;case 31:xi(t,s,r,a);break;case 13:xi(t,s,r,a);break;case 23:break;case 22:u=s.stateNode,m=s.alternate,s.memoizedState!==null?u._visibility&2?xi(t,s,r,a):jn(t,s):u._visibility&2?xi(t,s,r,a):(u._visibility|=2,Hr(t,s,r,a,(s.subtreeFlags&10256)!==0||!1)),h&2048&&Zc(m,s);break;case 24:xi(t,s,r,a),h&2048&&Qc(s.alternate,s);break;default:xi(t,s,r,a)}}function Hr(t,s,r,a,h){for(h=h&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var u=t,m=s,y=r,k=a,N=m.flags;switch(m.tag){case 0:case 11:case 15:Hr(u,m,y,k,h),Mn(8,m);break;case 23:break;case 22:var P=m.stateNode;m.memoizedState!==null?P._visibility&2?Hr(u,m,y,k,h):jn(u,m):(P._visibility|=2,Hr(u,m,y,k,h)),h&&N&2048&&Zc(m.alternate,m);break;case 24:Hr(u,m,y,k,h),h&&N&2048&&Qc(m.alternate,m);break;default:Hr(u,m,y,k,h)}s=s.sibling}}function jn(t,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var r=t,a=s,h=a.flags;switch(a.tag){case 22:jn(r,a),h&2048&&Zc(a.alternate,a);break;case 24:jn(r,a),h&2048&&Qc(a.alternate,a);break;default:jn(r,a)}s=s.sibling}}var Ln=8192;function Ur(t,s,r){if(t.subtreeFlags&Ln)for(t=t.child;t!==null;)Qp(t,s,r),t=t.sibling}function Qp(t,s,r){switch(t.tag){case 26:Ur(t,s,r),t.flags&Ln&&t.memoizedState!==null&&ix(r,yi,t.memoizedState,t.memoizedProps);break;case 5:Ur(t,s,r);break;case 3:case 4:var a=yi;yi=Ea(t.stateNode.containerInfo),Ur(t,s,r),yi=a;break;case 22:t.memoizedState===null&&(a=t.alternate,a!==null&&a.memoizedState!==null?(a=Ln,Ln=16777216,Ur(t,s,r),Ln=a):Ur(t,s,r));break;default:Ur(t,s,r)}}function Jp(t){var s=t.alternate;if(s!==null&&(t=s.child,t!==null)){s.child=null;do s=t.sibling,t.sibling=null,t=s;while(t!==null)}}function Nn(t){var s=t.deletions;if((t.flags&16)!==0){if(s!==null)for(var r=0;r<s.length;r++){var a=s[r];pt=a,tg(a,t)}Jp(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)eg(t),t=t.sibling}function eg(t){switch(t.tag){case 0:case 11:case 15:Nn(t),t.flags&2048&&vs(9,t,t.return);break;case 3:Nn(t);break;case 12:Nn(t);break;case 22:var s=t.stateNode;t.memoizedState!==null&&s._visibility&2&&(t.return===null||t.return.tag!==13)?(s._visibility&=-3,fa(t)):Nn(t);break;default:Nn(t)}}function fa(t){var s=t.deletions;if((t.flags&16)!==0){if(s!==null)for(var r=0;r<s.length;r++){var a=s[r];pt=a,tg(a,t)}Jp(t)}for(t=t.child;t!==null;){switch(s=t,s.tag){case 0:case 11:case 15:vs(8,s,s.return),fa(s);break;case 22:r=s.stateNode,r._visibility&2&&(r._visibility&=-3,fa(s));break;default:fa(s)}t=t.sibling}}function tg(t,s){for(;pt!==null;){var r=pt;switch(r.tag){case 0:case 11:case 15:vs(8,r,s);break;case 23:case 22:if(r.memoizedState!==null&&r.memoizedState.cachePool!==null){var a=r.memoizedState.cachePool.pool;a!=null&&a.refCount++}break;case 24:xn(r.memoizedState.cache)}if(a=r.child,a!==null)a.return=r,pt=a;else e:for(r=t;pt!==null;){a=pt;var h=a.sibling,u=a.return;if($p(a),a===r){pt=null;break e}if(h!==null){h.return=u,pt=h;break e}pt=u}}}var my={getCacheForType:function(t){var s=bt(it),r=s.data.get(t);return r===void 0&&(r=t(),s.data.set(t,r)),r},cacheSignal:function(){return bt(it).controller.signal}},vy=typeof WeakMap=="function"?WeakMap:Map,ze=0,Pe=null,be=null,Ce=0,je=0,Xt=null,ys=!1,Wr=!1,Jc=!1,Qi=0,Ve=0,xs=0,er=0,eh=0,Vt=0,Pr=0,Hn=null,Ut=null,th=!1,pa=0,ig=0,ga=1/0,_a=null,Ss=null,ct=0,bs=null,qr=null,Ji=0,ih=0,sh=null,sg=null,Un=0,rh=null;function Zt(){return(ze&2)!==0&&Ce!==0?Ce&-Ce:B.T!==null?hh():vd()}function rg(){if(Vt===0)if((Ce&536870912)===0||Ee){var t=Cl;Cl<<=1,(Cl&3932160)===0&&(Cl=262144),Vt=t}else Vt=536870912;return t=Ft.current,t!==null&&(t.flags|=32),Vt}function Wt(t,s,r){(t===Pe&&(je===2||je===9)||t.cancelPendingCommit!==null)&&(Ir(t,0),ws(t,Ce,Vt,!1)),ln(t,r),((ze&2)===0||t!==Pe)&&(t===Pe&&((ze&2)===0&&(er|=r),Ve===4&&ws(t,Ce,Vt,!1)),Ri(t))}function ng(t,s,r){if((ze&6)!==0)throw Error(l(327));var a=!r&&(s&127)===0&&(s&t.expiredLanes)===0||nn(t,s),h=a?Sy(t,s):lh(t,s,!0),u=a;do{if(h===0){Wr&&!a&&ws(t,s,0,!1);break}else{if(r=t.current.alternate,u&&!yy(r)){h=lh(t,s,!1),u=!1;continue}if(h===2){if(u=s,t.errorRecoveryDisabledLanes&u)var m=0;else m=t.pendingLanes&-536870913,m=m!==0?m:m&536870912?536870912:0;if(m!==0){s=m;e:{var y=t;h=Hn;var k=y.current.memoizedState.isDehydrated;if(k&&(Ir(y,m).flags|=256),m=lh(y,m,!1),m!==2){if(Jc&&!k){y.errorRecoveryDisabledLanes|=u,er|=u,h=4;break e}u=Ut,Ut=h,u!==null&&(Ut===null?Ut=u:Ut.push.apply(Ut,u))}h=m}if(u=!1,h!==2)continue}}if(h===1){Ir(t,0),ws(t,s,0,!0);break}e:{switch(a=t,u=h,u){case 0:case 1:throw Error(l(345));case 4:if((s&4194048)!==s)break;case 6:ws(a,s,Vt,!ys);break e;case 2:Ut=null;break;case 3:case 5:break;default:throw Error(l(329))}if((s&62914560)===s&&(h=pa+300-qt(),10<h)){if(ws(a,s,Vt,!ys),El(a,0,!0)!==0)break e;Ji=s,a.timeoutHandle=Lg(lg.bind(null,a,r,Ut,_a,th,s,Vt,er,Pr,ys,u,"Throttled",-0,0),h);break e}lg(a,r,Ut,_a,th,s,Vt,er,Pr,ys,u,null,-0,0)}}break}while(!0);Ri(t)}function lg(t,s,r,a,h,u,m,y,k,N,P,Y,H,U){if(t.timeoutHandle=-1,Y=s.subtreeFlags,Y&8192||(Y&16785408)===16785408){Y={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Hi},Qp(s,u,Y);var re=(u&62914560)===u?pa-qt():(u&4194048)===u?ig-qt():0;if(re=sx(Y,re),re!==null){Ji=u,t.cancelPendingCommit=re(pg.bind(null,t,s,u,r,a,h,m,y,k,P,Y,null,H,U)),ws(t,u,m,!N);return}}pg(t,s,u,r,a,h,m,y,k)}function yy(t){for(var s=t;;){var r=s.tag;if((r===0||r===11||r===15)&&s.flags&16384&&(r=s.updateQueue,r!==null&&(r=r.stores,r!==null)))for(var a=0;a<r.length;a++){var h=r[a],u=h.getSnapshot;h=h.value;try{if(!$t(u(),h))return!1}catch{return!1}}if(r=s.child,s.subtreeFlags&16384&&r!==null)r.return=s,s=r;else{if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function ws(t,s,r,a){s&=~eh,s&=~er,t.suspendedLanes|=s,t.pingedLanes&=~s,a&&(t.warmLanes|=s),a=t.expirationTimes;for(var h=s;0<h;){var u=31-Kt(h),m=1<<u;a[u]=-1,h&=~m}r!==0&&gd(t,r,s)}function ma(){return(ze&6)===0?(Wn(0),!1):!0}function nh(){if(be!==null){if(je===0)var t=be.return;else t=be,qi=$s=null,Sc(t),Mr=null,bn=0,t=be;for(;t!==null;)Np(t.alternate,t),t=t.return;be=null}}function Ir(t,s){var r=t.timeoutHandle;r!==-1&&(t.timeoutHandle=-1,Uy(r)),r=t.cancelPendingCommit,r!==null&&(t.cancelPendingCommit=null,r()),Ji=0,nh(),Pe=t,be=r=Wi(t.current,null),Ce=s,je=0,Xt=null,ys=!1,Wr=nn(t,s),Jc=!1,Pr=Vt=eh=er=xs=Ve=0,Ut=Hn=null,th=!1,(s&8)!==0&&(s|=s&32);var a=t.entangledLanes;if(a!==0)for(t=t.entanglements,a&=s;0<a;){var h=31-Kt(a),u=1<<h;s|=t[h],a&=~u}return Qi=s,Hl(),r}function ag(t,s){me=null,B.H=Bn,s===Ar||s===Yl?(s=wf(),je=3):s===cc?(s=wf(),je=4):je=s===Nc?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,Xt=s,be===null&&(Ve=1,la(t,ni(s,t.current)))}function og(){var t=Ft.current;return t===null?!0:(Ce&4194048)===Ce?ci===null:(Ce&62914560)===Ce||(Ce&536870912)!==0?t===ci:!1}function cg(){var t=B.H;return B.H=Bn,t===null?Bn:t}function hg(){var t=B.A;return B.A=my,t}function va(){Ve=4,ys||(Ce&4194048)!==Ce&&Ft.current!==null||(Wr=!0),(xs&134217727)===0&&(er&134217727)===0||Pe===null||ws(Pe,Ce,Vt,!1)}function lh(t,s,r){var a=ze;ze|=2;var h=cg(),u=hg();(Pe!==t||Ce!==s)&&(_a=null,Ir(t,s)),s=!1;var m=Ve;e:do try{if(je!==0&&be!==null){var y=be,k=Xt;switch(je){case 8:nh(),m=6;break e;case 3:case 2:case 9:case 6:Ft.current===null&&(s=!0);var N=je;if(je=0,Xt=null,Kr(t,y,k,N),r&&Wr){m=0;break e}break;default:N=je,je=0,Xt=null,Kr(t,y,k,N)}}xy(),m=Ve;break}catch(P){ag(t,P)}while(!0);return s&&t.shellSuspendCounter++,qi=$s=null,ze=a,B.H=h,B.A=u,be===null&&(Pe=null,Ce=0,Hl()),m}function xy(){for(;be!==null;)ug(be)}function Sy(t,s){var r=ze;ze|=2;var a=cg(),h=hg();Pe!==t||Ce!==s?(_a=null,ga=qt()+500,Ir(t,s)):Wr=nn(t,s);e:do try{if(je!==0&&be!==null){s=be;var u=Xt;t:switch(je){case 1:je=0,Xt=null,Kr(t,s,u,1);break;case 2:case 9:if(Sf(u)){je=0,Xt=null,dg(s);break}s=function(){je!==2&&je!==9||Pe!==t||(je=7),Ri(t)},u.then(s,s);break e;case 3:je=7;break e;case 4:je=5;break e;case 7:Sf(u)?(je=0,Xt=null,dg(s)):(je=0,Xt=null,Kr(t,s,u,7));break;case 5:var m=null;switch(be.tag){case 26:m=be.memoizedState;case 5:case 27:var y=be;if(m?Zg(m):y.stateNode.complete){je=0,Xt=null;var k=y.sibling;if(k!==null)be=k;else{var N=y.return;N!==null?(be=N,ya(N)):be=null}break t}}je=0,Xt=null,Kr(t,s,u,5);break;case 6:je=0,Xt=null,Kr(t,s,u,6);break;case 8:nh(),Ve=6;break e;default:throw Error(l(462))}}by();break}catch(P){ag(t,P)}while(!0);return qi=$s=null,B.H=a,B.A=h,ze=r,be!==null?0:(Pe=null,Ce=0,Hl(),Ve)}function by(){for(;be!==null&&!$v();)ug(be)}function ug(t){var s=jp(t.alternate,t,Qi);t.memoizedProps=t.pendingProps,s===null?ya(t):be=s}function dg(t){var s=t,r=s.alternate;switch(s.tag){case 15:case 0:s=Dp(r,s,s.pendingProps,s.type,void 0,Ce);break;case 11:s=Dp(r,s,s.pendingProps,s.type.render,s.ref,Ce);break;case 5:Sc(s);default:Np(r,s),s=be=hf(s,Qi),s=jp(r,s,Qi)}t.memoizedProps=t.pendingProps,s===null?ya(t):be=s}function Kr(t,s,r,a){qi=$s=null,Sc(s),Mr=null,bn=0;var h=s.return;try{if(hy(t,h,s,r,Ce)){Ve=1,la(t,ni(r,t.current)),be=null;return}}catch(u){if(h!==null)throw be=h,u;Ve=1,la(t,ni(r,t.current)),be=null;return}s.flags&32768?(Ee||a===1?t=!0:Wr||(Ce&536870912)!==0?t=!1:(ys=t=!0,(a===2||a===9||a===3||a===6)&&(a=Ft.current,a!==null&&a.tag===13&&(a.flags|=16384))),fg(s,t)):ya(s)}function ya(t){var s=t;do{if((s.flags&32768)!==0){fg(s,ys);return}t=s.return;var r=fy(s.alternate,s,Qi);if(r!==null){be=r;return}if(s=s.sibling,s!==null){be=s;return}be=s=t}while(s!==null);Ve===0&&(Ve=5)}function fg(t,s){do{var r=py(t.alternate,t);if(r!==null){r.flags&=32767,be=r;return}if(r=t.return,r!==null&&(r.flags|=32768,r.subtreeFlags=0,r.deletions=null),!s&&(t=t.sibling,t!==null)){be=t;return}be=t=r}while(t!==null);Ve=6,be=null}function pg(t,s,r,a,h,u,m,y,k){t.cancelPendingCommit=null;do xa();while(ct!==0);if((ze&6)!==0)throw Error(l(327));if(s!==null){if(s===t.current)throw Error(l(177));if(u=s.lanes|s.childLanes,u|=Go,t0(t,r,u,m,y,k),t===Pe&&(be=Pe=null,Ce=0),qr=s,bs=t,Ji=r,ih=u,sh=h,sg=a,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,Ey(bl,function(){return yg(),null})):(t.callbackNode=null,t.callbackPriority=0),a=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||a){a=B.T,B.T=null,h=q.p,q.p=2,m=ze,ze|=4;try{gy(t,s,r)}finally{ze=m,q.p=h,B.T=a}}ct=1,gg(),_g(),mg()}}function gg(){if(ct===1){ct=0;var t=bs,s=qr,r=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||r){r=B.T,B.T=null;var a=q.p;q.p=2;var h=ze;ze|=4;try{Xp(s,t);var u=vh,m=ef(t.containerInfo),y=u.focusedElem,k=u.selectionRange;if(m!==y&&y&&y.ownerDocument&&Jd(y.ownerDocument.documentElement,y)){if(k!==null&&Io(y)){var N=k.start,P=k.end;if(P===void 0&&(P=N),"selectionStart"in y)y.selectionStart=N,y.selectionEnd=Math.min(P,y.value.length);else{var Y=y.ownerDocument||document,H=Y&&Y.defaultView||window;if(H.getSelection){var U=H.getSelection(),re=y.textContent.length,ue=Math.min(k.start,re),Ue=k.end===void 0?ue:Math.min(k.end,re);!U.extend&&ue>Ue&&(m=Ue,Ue=ue,ue=m);var M=Qd(y,ue),D=Qd(y,Ue);if(M&&D&&(U.rangeCount!==1||U.anchorNode!==M.node||U.anchorOffset!==M.offset||U.focusNode!==D.node||U.focusOffset!==D.offset)){var L=Y.createRange();L.setStart(M.node,M.offset),U.removeAllRanges(),ue>Ue?(U.addRange(L),U.extend(D.node,D.offset)):(L.setEnd(D.node,D.offset),U.addRange(L))}}}}for(Y=[],U=y;U=U.parentNode;)U.nodeType===1&&Y.push({element:U,left:U.scrollLeft,top:U.scrollTop});for(typeof y.focus=="function"&&y.focus(),y=0;y<Y.length;y++){var $=Y[y];$.element.scrollLeft=$.left,$.element.scrollTop=$.top}}Aa=!!mh,vh=mh=null}finally{ze=h,q.p=a,B.T=r}}t.current=s,ct=2}}function _g(){if(ct===2){ct=0;var t=bs,s=qr,r=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||r){r=B.T,B.T=null;var a=q.p;q.p=2;var h=ze;ze|=4;try{Kp(t,s.alternate,s)}finally{ze=h,q.p=a,B.T=r}}ct=3}}function mg(){if(ct===4||ct===3){ct=0,Yv();var t=bs,s=qr,r=Ji,a=sg;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?ct=5:(ct=0,qr=bs=null,vg(t,t.pendingLanes));var h=t.pendingLanes;if(h===0&&(Ss=null),Co(r),s=s.stateNode,It&&typeof It.onCommitFiberRoot=="function")try{It.onCommitFiberRoot(rn,s,void 0,(s.current.flags&128)===128)}catch{}if(a!==null){s=B.T,h=q.p,q.p=2,B.T=null;try{for(var u=t.onRecoverableError,m=0;m<a.length;m++){var y=a[m];u(y.value,{componentStack:y.stack})}}finally{B.T=s,q.p=h}}(Ji&3)!==0&&xa(),Ri(t),h=t.pendingLanes,(r&261930)!==0&&(h&42)!==0?t===rh?Un++:(Un=0,rh=t):Un=0,Wn(0)}}function vg(t,s){(t.pooledCacheLanes&=s)===0&&(s=t.pooledCache,s!=null&&(t.pooledCache=null,xn(s)))}function xa(){return gg(),_g(),mg(),yg()}function yg(){if(ct!==5)return!1;var t=bs,s=ih;ih=0;var r=Co(Ji),a=B.T,h=q.p;try{q.p=32>r?32:r,B.T=null,r=sh,sh=null;var u=bs,m=Ji;if(ct=0,qr=bs=null,Ji=0,(ze&6)!==0)throw Error(l(331));var y=ze;if(ze|=4,eg(u.current),Zp(u,u.current,m,r),ze=y,Wn(0,!1),It&&typeof It.onPostCommitFiberRoot=="function")try{It.onPostCommitFiberRoot(rn,u)}catch{}return!0}finally{q.p=h,B.T=a,vg(t,s)}}function xg(t,s,r){s=ni(r,s),s=Lc(t.stateNode,s,2),t=gs(t,s,2),t!==null&&(ln(t,2),Ri(t))}function Le(t,s,r){if(t.tag===3)xg(t,t,r);else for(;s!==null;){if(s.tag===3){xg(s,t,r);break}else if(s.tag===1){var a=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(Ss===null||!Ss.has(a))){t=ni(r,t),r=Sp(2),a=gs(s,r,2),a!==null&&(bp(r,a,s,t),ln(a,2),Ri(a));break}}s=s.return}}function ah(t,s,r){var a=t.pingCache;if(a===null){a=t.pingCache=new vy;var h=new Set;a.set(s,h)}else h=a.get(s),h===void 0&&(h=new Set,a.set(s,h));h.has(r)||(Jc=!0,h.add(r),t=wy.bind(null,t,s,r),s.then(t,t))}function wy(t,s,r){var a=t.pingCache;a!==null&&a.delete(s),t.pingedLanes|=t.suspendedLanes&r,t.warmLanes&=~r,Pe===t&&(Ce&r)===r&&(Ve===4||Ve===3&&(Ce&62914560)===Ce&&300>qt()-pa?(ze&2)===0&&Ir(t,0):eh|=r,Pr===Ce&&(Pr=0)),Ri(t)}function Sg(t,s){s===0&&(s=pd()),t=qs(t,s),t!==null&&(ln(t,s),Ri(t))}function Cy(t){var s=t.memoizedState,r=0;s!==null&&(r=s.retryLane),Sg(t,r)}function ky(t,s){var r=0;switch(t.tag){case 31:case 13:var a=t.stateNode,h=t.memoizedState;h!==null&&(r=h.retryLane);break;case 19:a=t.stateNode;break;case 22:a=t.stateNode._retryCache;break;default:throw Error(l(314))}a!==null&&a.delete(s),Sg(t,r)}function Ey(t,s){return xo(t,s)}var Sa=null,$r=null,oh=!1,ba=!1,ch=!1,Cs=0;function Ri(t){t!==$r&&t.next===null&&($r===null?Sa=$r=t:$r=$r.next=t),ba=!0,oh||(oh=!0,Ry())}function Wn(t,s){if(!ch&&ba){ch=!0;do for(var r=!1,a=Sa;a!==null;){if(t!==0){var h=a.pendingLanes;if(h===0)var u=0;else{var m=a.suspendedLanes,y=a.pingedLanes;u=(1<<31-Kt(42|t)+1)-1,u&=h&~(m&~y),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(r=!0,kg(a,u))}else u=Ce,u=El(a,a===Pe?u:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(u&3)===0||nn(a,u)||(r=!0,kg(a,u));a=a.next}while(r);ch=!1}}function Ty(){bg()}function bg(){ba=oh=!1;var t=0;Cs!==0&&Hy()&&(t=Cs);for(var s=qt(),r=null,a=Sa;a!==null;){var h=a.next,u=wg(a,s);u===0?(a.next=null,r===null?Sa=h:r.next=h,h===null&&($r=r)):(r=a,(t!==0||(u&3)!==0)&&(ba=!0)),a=h}ct!==0&&ct!==5||Wn(t),Cs!==0&&(Cs=0)}function wg(t,s){for(var r=t.suspendedLanes,a=t.pingedLanes,h=t.expirationTimes,u=t.pendingLanes&-62914561;0<u;){var m=31-Kt(u),y=1<<m,k=h[m];k===-1?((y&r)===0||(y&a)!==0)&&(h[m]=e0(y,s)):k<=s&&(t.expiredLanes|=y),u&=~y}if(s=Pe,r=Ce,r=El(t,t===s?r:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),a=t.callbackNode,r===0||t===s&&(je===2||je===9)||t.cancelPendingCommit!==null)return a!==null&&a!==null&&So(a),t.callbackNode=null,t.callbackPriority=0;if((r&3)===0||nn(t,r)){if(s=r&-r,s===t.callbackPriority)return s;switch(a!==null&&So(a),Co(r)){case 2:case 8:r=dd;break;case 32:r=bl;break;case 268435456:r=fd;break;default:r=bl}return a=Cg.bind(null,t),r=xo(r,a),t.callbackPriority=s,t.callbackNode=r,s}return a!==null&&a!==null&&So(a),t.callbackPriority=2,t.callbackNode=null,2}function Cg(t,s){if(ct!==0&&ct!==5)return t.callbackNode=null,t.callbackPriority=0,null;var r=t.callbackNode;if(xa()&&t.callbackNode!==r)return null;var a=Ce;return a=El(t,t===Pe?a:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),a===0?null:(ng(t,a,s),wg(t,qt()),t.callbackNode!=null&&t.callbackNode===r?Cg.bind(null,t):null)}function kg(t,s){if(xa())return null;ng(t,s,!0)}function Ry(){Wy(function(){(ze&6)!==0?xo(ud,Ty):bg()})}function hh(){if(Cs===0){var t=Br;t===0&&(t=wl,wl<<=1,(wl&261888)===0&&(wl=256)),Cs=t}return Cs}function Eg(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Bl(""+t)}function Tg(t,s){var r=s.ownerDocument.createElement("input");return r.name=s.name,r.value=s.value,t.id&&r.setAttribute("form",t.id),s.parentNode.insertBefore(r,s),t=new FormData(t),r.parentNode.removeChild(r),t}function Dy(t,s,r,a,h){if(s==="submit"&&r&&r.stateNode===h){var u=Eg((h[Ot]||null).action),m=a.submitter;m&&(s=(s=m[Ot]||null)?Eg(s.formAction):m.getAttribute("formAction"),s!==null&&(u=s,m=null));var y=new Ol("action","action",null,a,h);t.push({event:y,listeners:[{instance:null,listener:function(){if(a.defaultPrevented){if(Cs!==0){var k=m?Tg(h,m):new FormData(h);Bc(r,{pending:!0,data:k,method:h.method,action:u},null,k)}}else typeof u=="function"&&(y.preventDefault(),k=m?Tg(h,m):new FormData(h),Bc(r,{pending:!0,data:k,method:h.method,action:u},u,k))},currentTarget:h}]})}}for(var uh=0;uh<Fo.length;uh++){var dh=Fo[uh],By=dh.toLowerCase(),zy=dh[0].toUpperCase()+dh.slice(1);vi(By,"on"+zy)}vi(rf,"onAnimationEnd"),vi(nf,"onAnimationIteration"),vi(lf,"onAnimationStart"),vi("dblclick","onDoubleClick"),vi("focusin","onFocus"),vi("focusout","onBlur"),vi(F0,"onTransitionRun"),vi(G0,"onTransitionStart"),vi(X0,"onTransitionCancel"),vi(af,"onTransitionEnd"),_r("onMouseEnter",["mouseout","mouseover"]),_r("onMouseLeave",["mouseout","mouseover"]),_r("onPointerEnter",["pointerout","pointerover"]),_r("onPointerLeave",["pointerout","pointerover"]),Hs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Hs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Hs("onBeforeInput",["compositionend","keypress","textInput","paste"]),Hs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Hs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Hs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Pn="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(" "),Ay=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Pn));function Rg(t,s){s=(s&4)!==0;for(var r=0;r<t.length;r++){var a=t[r],h=a.event;a=a.listeners;e:{var u=void 0;if(s)for(var m=a.length-1;0<=m;m--){var y=a[m],k=y.instance,N=y.currentTarget;if(y=y.listener,k!==u&&h.isPropagationStopped())break e;u=y,h.currentTarget=N;try{u(h)}catch(P){Nl(P)}h.currentTarget=null,u=k}else for(m=0;m<a.length;m++){if(y=a[m],k=y.instance,N=y.currentTarget,y=y.listener,k!==u&&h.isPropagationStopped())break e;u=y,h.currentTarget=N;try{u(h)}catch(P){Nl(P)}h.currentTarget=null,u=k}}}}function we(t,s){var r=s[ko];r===void 0&&(r=s[ko]=new Set);var a=t+"__bubble";r.has(a)||(Dg(s,t,2,!1),r.add(a))}function fh(t,s,r){var a=0;s&&(a|=4),Dg(r,t,a,s)}var wa="_reactListening"+Math.random().toString(36).slice(2);function ph(t){if(!t[wa]){t[wa]=!0,Sd.forEach(function(r){r!=="selectionchange"&&(Ay.has(r)||fh(r,!1,t),fh(r,!0,t))});var s=t.nodeType===9?t:t.ownerDocument;s===null||s[wa]||(s[wa]=!0,fh("selectionchange",!1,s))}}function Dg(t,s,r,a){switch(r_(s)){case 2:var h=lx;break;case 8:h=ax;break;default:h=Dh}r=h.bind(null,s,r,t),h=void 0,!Oo||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(h=!0),a?h!==void 0?t.addEventListener(s,r,{capture:!0,passive:h}):t.addEventListener(s,r,!0):h!==void 0?t.addEventListener(s,r,{passive:h}):t.addEventListener(s,r,!1)}function gh(t,s,r,a,h){var u=a;if((s&1)===0&&(s&2)===0&&a!==null)e:for(;;){if(a===null)return;var m=a.tag;if(m===3||m===4){var y=a.stateNode.containerInfo;if(y===h)break;if(m===4)for(m=a.return;m!==null;){var k=m.tag;if((k===3||k===4)&&m.stateNode.containerInfo===h)return;m=m.return}for(;y!==null;){if(m=fr(y),m===null)return;if(k=m.tag,k===5||k===6||k===26||k===27){a=u=m;continue e}y=y.parentNode}}a=a.return}Md(function(){var N=u,P=Ao(r),Y=[];e:{var H=of.get(t);if(H!==void 0){var U=Ol,re=t;switch(t){case"keypress":if(Al(r)===0)break e;case"keydown":case"keyup":U=k0;break;case"focusin":re="focus",U=Ho;break;case"focusout":re="blur",U=Ho;break;case"beforeblur":case"afterblur":U=Ho;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":U=Ld;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":U=f0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":U=R0;break;case rf:case nf:case lf:U=_0;break;case af:U=B0;break;case"scroll":case"scrollend":U=u0;break;case"wheel":U=A0;break;case"copy":case"cut":case"paste":U=v0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":U=Hd;break;case"toggle":case"beforetoggle":U=O0}var ue=(s&4)!==0,Ue=!ue&&(t==="scroll"||t==="scrollend"),M=ue?H!==null?H+"Capture":null:H;ue=[];for(var D=N,L;D!==null;){var $=D;if(L=$.stateNode,$=$.tag,$!==5&&$!==26&&$!==27||L===null||M===null||($=cn(D,M),$!=null&&ue.push(qn(D,$,L))),Ue)break;D=D.return}0<ue.length&&(H=new U(H,re,null,r,P),Y.push({event:H,listeners:ue}))}}if((s&7)===0){e:{if(H=t==="mouseover"||t==="pointerover",U=t==="mouseout"||t==="pointerout",H&&r!==zo&&(re=r.relatedTarget||r.fromElement)&&(fr(re)||re[dr]))break e;if((U||H)&&(H=P.window===P?P:(H=P.ownerDocument)?H.defaultView||H.parentWindow:window,U?(re=r.relatedTarget||r.toElement,U=N,re=re?fr(re):null,re!==null&&(Ue=c(re),ue=re.tag,re!==Ue||ue!==5&&ue!==27&&ue!==6)&&(re=null)):(U=null,re=N),U!==re)){if(ue=Ld,$="onMouseLeave",M="onMouseEnter",D="mouse",(t==="pointerout"||t==="pointerover")&&(ue=Hd,$="onPointerLeave",M="onPointerEnter",D="pointer"),Ue=U==null?H:on(U),L=re==null?H:on(re),H=new ue($,D+"leave",U,r,P),H.target=Ue,H.relatedTarget=L,$=null,fr(P)===N&&(ue=new ue(M,D+"enter",re,r,P),ue.target=L,ue.relatedTarget=Ue,$=ue),Ue=$,U&&re)t:{for(ue=My,M=U,D=re,L=0,$=M;$;$=ue($))L++;$=0;for(var oe=D;oe;oe=ue(oe))$++;for(;0<L-$;)M=ue(M),L--;for(;0<$-L;)D=ue(D),$--;for(;L--;){if(M===D||D!==null&&M===D.alternate){ue=M;break t}M=ue(M),D=ue(D)}ue=null}else ue=null;U!==null&&Bg(Y,H,U,ue,!1),re!==null&&Ue!==null&&Bg(Y,Ue,re,ue,!0)}}e:{if(H=N?on(N):window,U=H.nodeName&&H.nodeName.toLowerCase(),U==="select"||U==="input"&&H.type==="file")var De=Yd;else if(Kd(H))if(Fd)De=K0;else{De=q0;var le=P0}else U=H.nodeName,!U||U.toLowerCase()!=="input"||H.type!=="checkbox"&&H.type!=="radio"?N&&Bo(N.elementType)&&(De=Yd):De=I0;if(De&&(De=De(t,N))){$d(Y,De,r,P);break e}le&&le(t,H,N),t==="focusout"&&N&&H.type==="number"&&N.memoizedProps.value!=null&&Do(H,"number",H.value)}switch(le=N?on(N):window,t){case"focusin":(Kd(le)||le.contentEditable==="true")&&(br=le,Ko=N,mn=null);break;case"focusout":mn=Ko=br=null;break;case"mousedown":$o=!0;break;case"contextmenu":case"mouseup":case"dragend":$o=!1,tf(Y,r,P);break;case"selectionchange":if(Y0)break;case"keydown":case"keyup":tf(Y,r,P)}var ve;if(Wo)e:{switch(t){case"compositionstart":var ke="onCompositionStart";break e;case"compositionend":ke="onCompositionEnd";break e;case"compositionupdate":ke="onCompositionUpdate";break e}ke=void 0}else Sr?qd(t,r)&&(ke="onCompositionEnd"):t==="keydown"&&r.keyCode===229&&(ke="onCompositionStart");ke&&(Ud&&r.locale!=="ko"&&(Sr||ke!=="onCompositionStart"?ke==="onCompositionEnd"&&Sr&&(ve=Od()):(os=P,jo="value"in os?os.value:os.textContent,Sr=!0)),le=Ca(N,ke),0<le.length&&(ke=new Nd(ke,t,null,r,P),Y.push({event:ke,listeners:le}),ve?ke.data=ve:(ve=Id(r),ve!==null&&(ke.data=ve)))),(ve=L0?N0(t,r):H0(t,r))&&(ke=Ca(N,"onBeforeInput"),0<ke.length&&(le=new Nd("onBeforeInput","beforeinput",null,r,P),Y.push({event:le,listeners:ke}),le.data=ve)),Dy(Y,t,N,r,P)}Rg(Y,s)})}function qn(t,s,r){return{instance:t,listener:s,currentTarget:r}}function Ca(t,s){for(var r=s+"Capture",a=[];t!==null;){var h=t,u=h.stateNode;if(h=h.tag,h!==5&&h!==26&&h!==27||u===null||(h=cn(t,r),h!=null&&a.unshift(qn(t,h,u)),h=cn(t,s),h!=null&&a.push(qn(t,h,u))),t.tag===3)return a;t=t.return}return[]}function My(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Bg(t,s,r,a,h){for(var u=s._reactName,m=[];r!==null&&r!==a;){var y=r,k=y.alternate,N=y.stateNode;if(y=y.tag,k!==null&&k===a)break;y!==5&&y!==26&&y!==27||N===null||(k=N,h?(N=cn(r,u),N!=null&&m.unshift(qn(r,N,k))):h||(N=cn(r,u),N!=null&&m.push(qn(r,N,k)))),r=r.return}m.length!==0&&t.push({event:s,listeners:m})}var Oy=/\r\n?/g,jy=/\u0000|\uFFFD/g;function zg(t){return(typeof t=="string"?t:""+t).replace(Oy,`
|
|
9
|
+
`).replace(jy,"")}function Ag(t,s){return s=zg(s),zg(t)===s}function He(t,s,r,a,h,u){switch(r){case"children":typeof a=="string"?s==="body"||s==="textarea"&&a===""||vr(t,a):(typeof a=="number"||typeof a=="bigint")&&s!=="body"&&vr(t,""+a);break;case"className":Rl(t,"class",a);break;case"tabIndex":Rl(t,"tabindex",a);break;case"dir":case"role":case"viewBox":case"width":case"height":Rl(t,r,a);break;case"style":zd(t,a,u);break;case"data":if(s!=="object"){Rl(t,"data",a);break}case"src":case"href":if(a===""&&(s!=="a"||r!=="href")){t.removeAttribute(r);break}if(a==null||typeof a=="function"||typeof a=="symbol"||typeof a=="boolean"){t.removeAttribute(r);break}a=Bl(""+a),t.setAttribute(r,a);break;case"action":case"formAction":if(typeof a=="function"){t.setAttribute(r,"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 u=="function"&&(r==="formAction"?(s!=="input"&&He(t,s,"name",h.name,h,null),He(t,s,"formEncType",h.formEncType,h,null),He(t,s,"formMethod",h.formMethod,h,null),He(t,s,"formTarget",h.formTarget,h,null)):(He(t,s,"encType",h.encType,h,null),He(t,s,"method",h.method,h,null),He(t,s,"target",h.target,h,null)));if(a==null||typeof a=="symbol"||typeof a=="boolean"){t.removeAttribute(r);break}a=Bl(""+a),t.setAttribute(r,a);break;case"onClick":a!=null&&(t.onclick=Hi);break;case"onScroll":a!=null&&we("scroll",t);break;case"onScrollEnd":a!=null&&we("scrollend",t);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(l(61));if(r=a.__html,r!=null){if(h.children!=null)throw Error(l(60));t.innerHTML=r}}break;case"multiple":t.multiple=a&&typeof a!="function"&&typeof a!="symbol";break;case"muted":t.muted=a&&typeof a!="function"&&typeof a!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(a==null||typeof a=="function"||typeof a=="boolean"||typeof a=="symbol"){t.removeAttribute("xlink:href");break}r=Bl(""+a),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":a!=null&&typeof a!="function"&&typeof a!="symbol"?t.setAttribute(r,""+a):t.removeAttribute(r);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":a&&typeof a!="function"&&typeof a!="symbol"?t.setAttribute(r,""):t.removeAttribute(r);break;case"capture":case"download":a===!0?t.setAttribute(r,""):a!==!1&&a!=null&&typeof a!="function"&&typeof a!="symbol"?t.setAttribute(r,a):t.removeAttribute(r);break;case"cols":case"rows":case"size":case"span":a!=null&&typeof a!="function"&&typeof a!="symbol"&&!isNaN(a)&&1<=a?t.setAttribute(r,a):t.removeAttribute(r);break;case"rowSpan":case"start":a==null||typeof a=="function"||typeof a=="symbol"||isNaN(a)?t.removeAttribute(r):t.setAttribute(r,a);break;case"popover":we("beforetoggle",t),we("toggle",t),Tl(t,"popover",a);break;case"xlinkActuate":Ni(t,"http://www.w3.org/1999/xlink","xlink:actuate",a);break;case"xlinkArcrole":Ni(t,"http://www.w3.org/1999/xlink","xlink:arcrole",a);break;case"xlinkRole":Ni(t,"http://www.w3.org/1999/xlink","xlink:role",a);break;case"xlinkShow":Ni(t,"http://www.w3.org/1999/xlink","xlink:show",a);break;case"xlinkTitle":Ni(t,"http://www.w3.org/1999/xlink","xlink:title",a);break;case"xlinkType":Ni(t,"http://www.w3.org/1999/xlink","xlink:type",a);break;case"xmlBase":Ni(t,"http://www.w3.org/XML/1998/namespace","xml:base",a);break;case"xmlLang":Ni(t,"http://www.w3.org/XML/1998/namespace","xml:lang",a);break;case"xmlSpace":Ni(t,"http://www.w3.org/XML/1998/namespace","xml:space",a);break;case"is":Tl(t,"is",a);break;case"innerText":case"textContent":break;default:(!(2<r.length)||r[0]!=="o"&&r[0]!=="O"||r[1]!=="n"&&r[1]!=="N")&&(r=c0.get(r)||r,Tl(t,r,a))}}function _h(t,s,r,a,h,u){switch(r){case"style":zd(t,a,u);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(l(61));if(r=a.__html,r!=null){if(h.children!=null)throw Error(l(60));t.innerHTML=r}}break;case"children":typeof a=="string"?vr(t,a):(typeof a=="number"||typeof a=="bigint")&&vr(t,""+a);break;case"onScroll":a!=null&&we("scroll",t);break;case"onScrollEnd":a!=null&&we("scrollend",t);break;case"onClick":a!=null&&(t.onclick=Hi);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!bd.hasOwnProperty(r))e:{if(r[0]==="o"&&r[1]==="n"&&(h=r.endsWith("Capture"),s=r.slice(2,h?r.length-7:void 0),u=t[Ot]||null,u=u!=null?u[r]:null,typeof u=="function"&&t.removeEventListener(s,u,h),typeof a=="function")){typeof u!="function"&&u!==null&&(r in t?t[r]=null:t.hasAttribute(r)&&t.removeAttribute(r)),t.addEventListener(s,a,h);break e}r in t?t[r]=a:a===!0?t.setAttribute(r,""):Tl(t,r,a)}}}function Ct(t,s,r){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":we("error",t),we("load",t);var a=!1,h=!1,u;for(u in r)if(r.hasOwnProperty(u)){var m=r[u];if(m!=null)switch(u){case"src":a=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(l(137,s));default:He(t,s,u,m,r,null)}}h&&He(t,s,"srcSet",r.srcSet,r,null),a&&He(t,s,"src",r.src,r,null);return;case"input":we("invalid",t);var y=u=m=h=null,k=null,N=null;for(a in r)if(r.hasOwnProperty(a)){var P=r[a];if(P!=null)switch(a){case"name":h=P;break;case"type":m=P;break;case"checked":k=P;break;case"defaultChecked":N=P;break;case"value":u=P;break;case"defaultValue":y=P;break;case"children":case"dangerouslySetInnerHTML":if(P!=null)throw Error(l(137,s));break;default:He(t,s,a,P,r,null)}}Td(t,u,y,k,N,m,h,!1);return;case"select":we("invalid",t),a=m=u=null;for(h in r)if(r.hasOwnProperty(h)&&(y=r[h],y!=null))switch(h){case"value":u=y;break;case"defaultValue":m=y;break;case"multiple":a=y;default:He(t,s,h,y,r,null)}s=u,r=m,t.multiple=!!a,s!=null?mr(t,!!a,s,!1):r!=null&&mr(t,!!a,r,!0);return;case"textarea":we("invalid",t),u=h=a=null;for(m in r)if(r.hasOwnProperty(m)&&(y=r[m],y!=null))switch(m){case"value":a=y;break;case"defaultValue":h=y;break;case"children":u=y;break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(l(91));break;default:He(t,s,m,y,r,null)}Dd(t,a,h,u);return;case"option":for(k in r)r.hasOwnProperty(k)&&(a=r[k],a!=null)&&(k==="selected"?t.selected=a&&typeof a!="function"&&typeof a!="symbol":He(t,s,k,a,r,null));return;case"dialog":we("beforetoggle",t),we("toggle",t),we("cancel",t),we("close",t);break;case"iframe":case"object":we("load",t);break;case"video":case"audio":for(a=0;a<Pn.length;a++)we(Pn[a],t);break;case"image":we("error",t),we("load",t);break;case"details":we("toggle",t);break;case"embed":case"source":case"link":we("error",t),we("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(N in r)if(r.hasOwnProperty(N)&&(a=r[N],a!=null))switch(N){case"children":case"dangerouslySetInnerHTML":throw Error(l(137,s));default:He(t,s,N,a,r,null)}return;default:if(Bo(s)){for(P in r)r.hasOwnProperty(P)&&(a=r[P],a!==void 0&&_h(t,s,P,a,r,void 0));return}}for(y in r)r.hasOwnProperty(y)&&(a=r[y],a!=null&&He(t,s,y,a,r,null))}function Ly(t,s,r,a){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var h=null,u=null,m=null,y=null,k=null,N=null,P=null;for(U in r){var Y=r[U];if(r.hasOwnProperty(U)&&Y!=null)switch(U){case"checked":break;case"value":break;case"defaultValue":k=Y;default:a.hasOwnProperty(U)||He(t,s,U,null,a,Y)}}for(var H in a){var U=a[H];if(Y=r[H],a.hasOwnProperty(H)&&(U!=null||Y!=null))switch(H){case"type":u=U;break;case"name":h=U;break;case"checked":N=U;break;case"defaultChecked":P=U;break;case"value":m=U;break;case"defaultValue":y=U;break;case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(l(137,s));break;default:U!==Y&&He(t,s,H,U,a,Y)}}Ro(t,m,y,k,N,P,u,h);return;case"select":U=m=y=H=null;for(u in r)if(k=r[u],r.hasOwnProperty(u)&&k!=null)switch(u){case"value":break;case"multiple":U=k;default:a.hasOwnProperty(u)||He(t,s,u,null,a,k)}for(h in a)if(u=a[h],k=r[h],a.hasOwnProperty(h)&&(u!=null||k!=null))switch(h){case"value":H=u;break;case"defaultValue":y=u;break;case"multiple":m=u;default:u!==k&&He(t,s,h,u,a,k)}s=y,r=m,a=U,H!=null?mr(t,!!r,H,!1):!!a!=!!r&&(s!=null?mr(t,!!r,s,!0):mr(t,!!r,r?[]:"",!1));return;case"textarea":U=H=null;for(y in r)if(h=r[y],r.hasOwnProperty(y)&&h!=null&&!a.hasOwnProperty(y))switch(y){case"value":break;case"children":break;default:He(t,s,y,null,a,h)}for(m in a)if(h=a[m],u=r[m],a.hasOwnProperty(m)&&(h!=null||u!=null))switch(m){case"value":H=h;break;case"defaultValue":U=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(l(91));break;default:h!==u&&He(t,s,m,h,a,u)}Rd(t,H,U);return;case"option":for(var re in r)H=r[re],r.hasOwnProperty(re)&&H!=null&&!a.hasOwnProperty(re)&&(re==="selected"?t.selected=!1:He(t,s,re,null,a,H));for(k in a)H=a[k],U=r[k],a.hasOwnProperty(k)&&H!==U&&(H!=null||U!=null)&&(k==="selected"?t.selected=H&&typeof H!="function"&&typeof H!="symbol":He(t,s,k,H,a,U));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 ue in r)H=r[ue],r.hasOwnProperty(ue)&&H!=null&&!a.hasOwnProperty(ue)&&He(t,s,ue,null,a,H);for(N in a)if(H=a[N],U=r[N],a.hasOwnProperty(N)&&H!==U&&(H!=null||U!=null))switch(N){case"children":case"dangerouslySetInnerHTML":if(H!=null)throw Error(l(137,s));break;default:He(t,s,N,H,a,U)}return;default:if(Bo(s)){for(var Ue in r)H=r[Ue],r.hasOwnProperty(Ue)&&H!==void 0&&!a.hasOwnProperty(Ue)&&_h(t,s,Ue,void 0,a,H);for(P in a)H=a[P],U=r[P],!a.hasOwnProperty(P)||H===U||H===void 0&&U===void 0||_h(t,s,P,H,a,U);return}}for(var M in r)H=r[M],r.hasOwnProperty(M)&&H!=null&&!a.hasOwnProperty(M)&&He(t,s,M,null,a,H);for(Y in a)H=a[Y],U=r[Y],!a.hasOwnProperty(Y)||H===U||H==null&&U==null||He(t,s,Y,H,a,U)}function Mg(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Ny(){if(typeof performance.getEntriesByType=="function"){for(var t=0,s=0,r=performance.getEntriesByType("resource"),a=0;a<r.length;a++){var h=r[a],u=h.transferSize,m=h.initiatorType,y=h.duration;if(u&&y&&Mg(m)){for(m=0,y=h.responseEnd,a+=1;a<r.length;a++){var k=r[a],N=k.startTime;if(N>y)break;var P=k.transferSize,Y=k.initiatorType;P&&Mg(Y)&&(k=k.responseEnd,m+=P*(k<y?1:(y-N)/(k-N)))}if(--a,s+=8*(u+m)/(h.duration/1e3),t++,10<t)break}}if(0<t)return s/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var mh=null,vh=null;function ka(t){return t.nodeType===9?t:t.ownerDocument}function Og(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function jg(t,s){if(t===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&s==="foreignObject"?0:t}function yh(t,s){return t==="textarea"||t==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var xh=null;function Hy(){var t=window.event;return t&&t.type==="popstate"?t===xh?!1:(xh=t,!0):(xh=null,!1)}var Lg=typeof setTimeout=="function"?setTimeout:void 0,Uy=typeof clearTimeout=="function"?clearTimeout:void 0,Ng=typeof Promise=="function"?Promise:void 0,Wy=typeof queueMicrotask=="function"?queueMicrotask:typeof Ng<"u"?function(t){return Ng.resolve(null).then(t).catch(Py)}:Lg;function Py(t){setTimeout(function(){throw t})}function ks(t){return t==="head"}function Hg(t,s){var r=s,a=0;do{var h=r.nextSibling;if(t.removeChild(r),h&&h.nodeType===8)if(r=h.data,r==="/$"||r==="/&"){if(a===0){t.removeChild(h),Xr(s);return}a--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")a++;else if(r==="html")In(t.ownerDocument.documentElement);else if(r==="head"){r=t.ownerDocument.head,In(r);for(var u=r.firstChild;u;){var m=u.nextSibling,y=u.nodeName;u[an]||y==="SCRIPT"||y==="STYLE"||y==="LINK"&&u.rel.toLowerCase()==="stylesheet"||r.removeChild(u),u=m}}else r==="body"&&In(t.ownerDocument.body);r=h}while(r);Xr(s)}function Ug(t,s){var r=t;t=0;do{var a=r.nextSibling;if(r.nodeType===1?s?(r._stashedDisplay=r.style.display,r.style.display="none"):(r.style.display=r._stashedDisplay||"",r.getAttribute("style")===""&&r.removeAttribute("style")):r.nodeType===3&&(s?(r._stashedText=r.nodeValue,r.nodeValue=""):r.nodeValue=r._stashedText||""),a&&a.nodeType===8)if(r=a.data,r==="/$"){if(t===0)break;t--}else r!=="$"&&r!=="$?"&&r!=="$~"&&r!=="$!"||t++;r=a}while(r)}function Sh(t){var s=t.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var r=s;switch(s=s.nextSibling,r.nodeName){case"HTML":case"HEAD":case"BODY":Sh(r),Eo(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}t.removeChild(r)}}function qy(t,s,r,a){for(;t.nodeType===1;){var h=r;if(t.nodeName.toLowerCase()!==s.toLowerCase()){if(!a&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(a){if(!t[an])switch(s){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(u=t.getAttribute("rel"),u==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(u!==h.rel||t.getAttribute("href")!==(h.href==null||h.href===""?null:h.href)||t.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin)||t.getAttribute("title")!==(h.title==null?null:h.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(u=t.getAttribute("src"),(u!==(h.src==null?null:h.src)||t.getAttribute("type")!==(h.type==null?null:h.type)||t.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin))&&u&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(s==="input"&&t.type==="hidden"){var u=h.name==null?null:""+h.name;if(h.type==="hidden"&&t.getAttribute("name")===u)return t}else return t;if(t=hi(t.nextSibling),t===null)break}return null}function Iy(t,s,r){if(s==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!r||(t=hi(t.nextSibling),t===null))return null;return t}function Wg(t,s){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!s||(t=hi(t.nextSibling),t===null))return null;return t}function bh(t){return t.data==="$?"||t.data==="$~"}function wh(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function Ky(t,s){var r=t.ownerDocument;if(t.data==="$~")t._reactRetry=s;else if(t.data!=="$?"||r.readyState!=="loading")s();else{var a=function(){s(),r.removeEventListener("DOMContentLoaded",a)};r.addEventListener("DOMContentLoaded",a),t._reactRetry=a}}function hi(t){for(;t!=null;t=t.nextSibling){var s=t.nodeType;if(s===1||s===3)break;if(s===8){if(s=t.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return t}var Ch=null;function Pg(t){t=t.nextSibling;for(var s=0;t;){if(t.nodeType===8){var r=t.data;if(r==="/$"||r==="/&"){if(s===0)return hi(t.nextSibling);s--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||s++}t=t.nextSibling}return null}function qg(t){t=t.previousSibling;for(var s=0;t;){if(t.nodeType===8){var r=t.data;if(r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"){if(s===0)return t;s--}else r!=="/$"&&r!=="/&"||s++}t=t.previousSibling}return null}function Ig(t,s,r){switch(s=ka(r),t){case"html":if(t=s.documentElement,!t)throw Error(l(452));return t;case"head":if(t=s.head,!t)throw Error(l(453));return t;case"body":if(t=s.body,!t)throw Error(l(454));return t;default:throw Error(l(451))}}function In(t){for(var s=t.attributes;s.length;)t.removeAttributeNode(s[0]);Eo(t)}var ui=new Map,Kg=new Set;function Ea(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var es=q.d;q.d={f:$y,r:Yy,D:Fy,C:Gy,L:Xy,m:Vy,X:Qy,S:Zy,M:Jy};function $y(){var t=es.f(),s=ma();return t||s}function Yy(t){var s=pr(t);s!==null&&s.tag===5&&s.type==="form"?ap(s):es.r(t)}var Yr=typeof document>"u"?null:document;function $g(t,s,r){var a=Yr;if(a&&typeof s=="string"&&s){var h=si(s);h='link[rel="'+t+'"][href="'+h+'"]',typeof r=="string"&&(h+='[crossorigin="'+r+'"]'),Kg.has(h)||(Kg.add(h),t={rel:t,crossOrigin:r,href:s},a.querySelector(h)===null&&(s=a.createElement("link"),Ct(s,"link",t),ft(s),a.head.appendChild(s)))}}function Fy(t){es.D(t),$g("dns-prefetch",t,null)}function Gy(t,s){es.C(t,s),$g("preconnect",t,s)}function Xy(t,s,r){es.L(t,s,r);var a=Yr;if(a&&t&&s){var h='link[rel="preload"][as="'+si(s)+'"]';s==="image"&&r&&r.imageSrcSet?(h+='[imagesrcset="'+si(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(h+='[imagesizes="'+si(r.imageSizes)+'"]')):h+='[href="'+si(t)+'"]';var u=h;switch(s){case"style":u=Fr(t);break;case"script":u=Gr(t)}ui.has(u)||(t=v({rel:"preload",href:s==="image"&&r&&r.imageSrcSet?void 0:t,as:s},r),ui.set(u,t),a.querySelector(h)!==null||s==="style"&&a.querySelector(Kn(u))||s==="script"&&a.querySelector($n(u))||(s=a.createElement("link"),Ct(s,"link",t),ft(s),a.head.appendChild(s)))}}function Vy(t,s){es.m(t,s);var r=Yr;if(r&&t){var a=s&&typeof s.as=="string"?s.as:"script",h='link[rel="modulepreload"][as="'+si(a)+'"][href="'+si(t)+'"]',u=h;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=Gr(t)}if(!ui.has(u)&&(t=v({rel:"modulepreload",href:t},s),ui.set(u,t),r.querySelector(h)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector($n(u)))return}a=r.createElement("link"),Ct(a,"link",t),ft(a),r.head.appendChild(a)}}}function Zy(t,s,r){es.S(t,s,r);var a=Yr;if(a&&t){var h=gr(a).hoistableStyles,u=Fr(t);s=s||"default";var m=h.get(u);if(!m){var y={loading:0,preload:null};if(m=a.querySelector(Kn(u)))y.loading=5;else{t=v({rel:"stylesheet",href:t,"data-precedence":s},r),(r=ui.get(u))&&kh(t,r);var k=m=a.createElement("link");ft(k),Ct(k,"link",t),k._p=new Promise(function(N,P){k.onload=N,k.onerror=P}),k.addEventListener("load",function(){y.loading|=1}),k.addEventListener("error",function(){y.loading|=2}),y.loading|=4,Ta(m,s,a)}m={type:"stylesheet",instance:m,count:1,state:y},h.set(u,m)}}}function Qy(t,s){es.X(t,s);var r=Yr;if(r&&t){var a=gr(r).hoistableScripts,h=Gr(t),u=a.get(h);u||(u=r.querySelector($n(h)),u||(t=v({src:t,async:!0},s),(s=ui.get(h))&&Eh(t,s),u=r.createElement("script"),ft(u),Ct(u,"link",t),r.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},a.set(h,u))}}function Jy(t,s){es.M(t,s);var r=Yr;if(r&&t){var a=gr(r).hoistableScripts,h=Gr(t),u=a.get(h);u||(u=r.querySelector($n(h)),u||(t=v({src:t,async:!0,type:"module"},s),(s=ui.get(h))&&Eh(t,s),u=r.createElement("script"),ft(u),Ct(u,"link",t),r.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},a.set(h,u))}}function Yg(t,s,r,a){var h=(h=de.current)?Ea(h):null;if(!h)throw Error(l(446));switch(t){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(s=Fr(r.href),r=gr(h).hoistableStyles,a=r.get(s),a||(a={type:"style",instance:null,count:0,state:null},r.set(s,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){t=Fr(r.href);var u=gr(h).hoistableStyles,m=u.get(t);if(m||(h=h.ownerDocument||h,m={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(t,m),(u=h.querySelector(Kn(t)))&&!u._p&&(m.instance=u,m.state.loading=5),ui.has(t)||(r={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},ui.set(t,r),u||ex(h,t,r,m.state))),s&&a===null)throw Error(l(528,""));return m}if(s&&a!==null)throw Error(l(529,""));return null;case"script":return s=r.async,r=r.src,typeof r=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=Gr(r),r=gr(h).hoistableScripts,a=r.get(s),a||(a={type:"script",instance:null,count:0,state:null},r.set(s,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,t))}}function Fr(t){return'href="'+si(t)+'"'}function Kn(t){return'link[rel="stylesheet"]['+t+"]"}function Fg(t){return v({},t,{"data-precedence":t.precedence,precedence:null})}function ex(t,s,r,a){t.querySelector('link[rel="preload"][as="style"]['+s+"]")?a.loading=1:(s=t.createElement("link"),a.preload=s,s.addEventListener("load",function(){return a.loading|=1}),s.addEventListener("error",function(){return a.loading|=2}),Ct(s,"link",r),ft(s),t.head.appendChild(s))}function Gr(t){return'[src="'+si(t)+'"]'}function $n(t){return"script[async]"+t}function Gg(t,s,r){if(s.count++,s.instance===null)switch(s.type){case"style":var a=t.querySelector('style[data-href~="'+si(r.href)+'"]');if(a)return s.instance=a,ft(a),a;var h=v({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return a=(t.ownerDocument||t).createElement("style"),ft(a),Ct(a,"style",h),Ta(a,r.precedence,t),s.instance=a;case"stylesheet":h=Fr(r.href);var u=t.querySelector(Kn(h));if(u)return s.state.loading|=4,s.instance=u,ft(u),u;a=Fg(r),(h=ui.get(h))&&kh(a,h),u=(t.ownerDocument||t).createElement("link"),ft(u);var m=u;return m._p=new Promise(function(y,k){m.onload=y,m.onerror=k}),Ct(u,"link",a),s.state.loading|=4,Ta(u,r.precedence,t),s.instance=u;case"script":return u=Gr(r.src),(h=t.querySelector($n(u)))?(s.instance=h,ft(h),h):(a=r,(h=ui.get(u))&&(a=v({},r),Eh(a,h)),t=t.ownerDocument||t,h=t.createElement("script"),ft(h),Ct(h,"link",a),t.head.appendChild(h),s.instance=h);case"void":return null;default:throw Error(l(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(a=s.instance,s.state.loading|=4,Ta(a,r.precedence,t));return s.instance}function Ta(t,s,r){for(var a=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=a.length?a[a.length-1]:null,u=h,m=0;m<a.length;m++){var y=a[m];if(y.dataset.precedence===s)u=y;else if(u!==h)break}u?u.parentNode.insertBefore(t,u.nextSibling):(s=r.nodeType===9?r.head:r,s.insertBefore(t,s.firstChild))}function kh(t,s){t.crossOrigin==null&&(t.crossOrigin=s.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=s.referrerPolicy),t.title==null&&(t.title=s.title)}function Eh(t,s){t.crossOrigin==null&&(t.crossOrigin=s.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=s.referrerPolicy),t.integrity==null&&(t.integrity=s.integrity)}var Ra=null;function Xg(t,s,r){if(Ra===null){var a=new Map,h=Ra=new Map;h.set(r,a)}else h=Ra,a=h.get(r),a||(a=new Map,h.set(r,a));if(a.has(t))return a;for(a.set(t,null),r=r.getElementsByTagName(t),h=0;h<r.length;h++){var u=r[h];if(!(u[an]||u[xt]||t==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var m=u.getAttribute(s)||"";m=t+m;var y=a.get(m);y?y.push(u):a.set(m,[u])}}return a}function Vg(t,s,r){t=t.ownerDocument||t,t.head.insertBefore(r,s==="title"?t.querySelector("head > title"):null)}function tx(t,s,r){if(r===1||s.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;return s.rel==="stylesheet"?(t=s.disabled,typeof s.precedence=="string"&&t==null):!0;case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function Zg(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function ix(t,s,r,a){if(r.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var h=Fr(a.href),u=s.querySelector(Kn(h));if(u){s=u._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(t.count++,t=Da.bind(t),s.then(t,t)),r.state.loading|=4,r.instance=u,ft(u);return}u=s.ownerDocument||s,a=Fg(a),(h=ui.get(h))&&kh(a,h),u=u.createElement("link"),ft(u);var m=u;m._p=new Promise(function(y,k){m.onload=y,m.onerror=k}),Ct(u,"link",a),r.instance=u}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(r,s),(s=r.state.preload)&&(r.state.loading&3)===0&&(t.count++,r=Da.bind(t),s.addEventListener("load",r),s.addEventListener("error",r))}}var Th=0;function sx(t,s){return t.stylesheets&&t.count===0&&za(t,t.stylesheets),0<t.count||0<t.imgCount?function(r){var a=setTimeout(function(){if(t.stylesheets&&za(t,t.stylesheets),t.unsuspend){var u=t.unsuspend;t.unsuspend=null,u()}},6e4+s);0<t.imgBytes&&Th===0&&(Th=62500*Ny());var h=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&za(t,t.stylesheets),t.unsuspend)){var u=t.unsuspend;t.unsuspend=null,u()}},(t.imgBytes>Th?50:800)+s);return t.unsuspend=r,function(){t.unsuspend=null,clearTimeout(a),clearTimeout(h)}}:null}function Da(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)za(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Ba=null;function za(t,s){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Ba=new Map,s.forEach(rx,t),Ba=null,Da.call(t))}function rx(t,s){if(!(s.state.loading&4)){var r=Ba.get(t);if(r)var a=r.get(null);else{r=new Map,Ba.set(t,r);for(var h=t.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<h.length;u++){var m=h[u];(m.nodeName==="LINK"||m.getAttribute("media")!=="not all")&&(r.set(m.dataset.precedence,m),a=m)}a&&r.set(null,a)}h=s.instance,m=h.getAttribute("data-precedence"),u=r.get(m)||a,u===a&&r.set(null,h),r.set(m,h),this.count++,a=Da.bind(this),h.addEventListener("load",a),h.addEventListener("error",a),u?u.parentNode.insertBefore(h,u.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(h,t.firstChild)),s.state.loading|=4}}var Yn={$$typeof:j,Provider:null,Consumer:null,_currentValue:I,_currentValue2:I,_threadCount:0};function nx(t,s,r,a,h,u,m,y,k){this.tag=1,this.containerInfo=t,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=bo(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=bo(0),this.hiddenUpdates=bo(null),this.identifierPrefix=a,this.onUncaughtError=h,this.onCaughtError=u,this.onRecoverableError=m,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=k,this.incompleteTransitions=new Map}function Qg(t,s,r,a,h,u,m,y,k,N,P,Y){return t=new nx(t,s,r,m,k,N,P,Y,y),s=1,u===!0&&(s|=24),u=Yt(3,null,null,s),t.current=u,u.stateNode=t,s=lc(),s.refCount++,t.pooledCache=s,s.refCount++,u.memoizedState={element:a,isDehydrated:r,cache:s},hc(u),t}function Jg(t){return t?(t=kr,t):kr}function e_(t,s,r,a,h,u){h=Jg(h),a.context===null?a.context=h:a.pendingContext=h,a=ps(s),a.payload={element:r},u=u===void 0?null:u,u!==null&&(a.callback=u),r=gs(t,a,s),r!==null&&(Wt(r,t,s),Cn(r,t,s))}function t_(t,s){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var r=t.retryLane;t.retryLane=r!==0&&r<s?r:s}}function Rh(t,s){t_(t,s),(t=t.alternate)&&t_(t,s)}function i_(t){if(t.tag===13||t.tag===31){var s=qs(t,67108864);s!==null&&Wt(s,t,67108864),Rh(t,67108864)}}function s_(t){if(t.tag===13||t.tag===31){var s=Zt();s=wo(s);var r=qs(t,s);r!==null&&Wt(r,t,s),Rh(t,s)}}var Aa=!0;function lx(t,s,r,a){var h=B.T;B.T=null;var u=q.p;try{q.p=2,Dh(t,s,r,a)}finally{q.p=u,B.T=h}}function ax(t,s,r,a){var h=B.T;B.T=null;var u=q.p;try{q.p=8,Dh(t,s,r,a)}finally{q.p=u,B.T=h}}function Dh(t,s,r,a){if(Aa){var h=Bh(a);if(h===null)gh(t,s,a,Ma,r),n_(t,a);else if(cx(h,t,s,r,a))a.stopPropagation();else if(n_(t,a),s&4&&-1<ox.indexOf(t)){for(;h!==null;){var u=pr(h);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var m=Ns(u.pendingLanes);if(m!==0){var y=u;for(y.pendingLanes|=2,y.entangledLanes|=2;m;){var k=1<<31-Kt(m);y.entanglements[1]|=k,m&=~k}Ri(u),(ze&6)===0&&(ga=qt()+500,Wn(0))}}break;case 31:case 13:y=qs(u,2),y!==null&&Wt(y,u,2),ma(),Rh(u,2)}if(u=Bh(a),u===null&&gh(t,s,a,Ma,r),u===h)break;h=u}h!==null&&a.stopPropagation()}else gh(t,s,a,null,r)}}function Bh(t){return t=Ao(t),zh(t)}var Ma=null;function zh(t){if(Ma=null,t=fr(t),t!==null){var s=c(t);if(s===null)t=null;else{var r=s.tag;if(r===13){if(t=d(s),t!==null)return t;t=null}else if(r===31){if(t=_(s),t!==null)return t;t=null}else if(r===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;t=null}else s!==t&&(t=null)}}return Ma=t,null}function r_(t){switch(t){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(Fv()){case ud:return 2;case dd:return 8;case bl:case Gv:return 32;case fd:return 268435456;default:return 32}default:return 32}}var Ah=!1,Es=null,Ts=null,Rs=null,Fn=new Map,Gn=new Map,Ds=[],ox="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 n_(t,s){switch(t){case"focusin":case"focusout":Es=null;break;case"dragenter":case"dragleave":Ts=null;break;case"mouseover":case"mouseout":Rs=null;break;case"pointerover":case"pointerout":Fn.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Gn.delete(s.pointerId)}}function Xn(t,s,r,a,h,u){return t===null||t.nativeEvent!==u?(t={blockedOn:s,domEventName:r,eventSystemFlags:a,nativeEvent:u,targetContainers:[h]},s!==null&&(s=pr(s),s!==null&&i_(s)),t):(t.eventSystemFlags|=a,s=t.targetContainers,h!==null&&s.indexOf(h)===-1&&s.push(h),t)}function cx(t,s,r,a,h){switch(s){case"focusin":return Es=Xn(Es,t,s,r,a,h),!0;case"dragenter":return Ts=Xn(Ts,t,s,r,a,h),!0;case"mouseover":return Rs=Xn(Rs,t,s,r,a,h),!0;case"pointerover":var u=h.pointerId;return Fn.set(u,Xn(Fn.get(u)||null,t,s,r,a,h)),!0;case"gotpointercapture":return u=h.pointerId,Gn.set(u,Xn(Gn.get(u)||null,t,s,r,a,h)),!0}return!1}function l_(t){var s=fr(t.target);if(s!==null){var r=c(s);if(r!==null){if(s=r.tag,s===13){if(s=d(r),s!==null){t.blockedOn=s,yd(t.priority,function(){s_(r)});return}}else if(s===31){if(s=_(r),s!==null){t.blockedOn=s,yd(t.priority,function(){s_(r)});return}}else if(s===3&&r.stateNode.current.memoizedState.isDehydrated){t.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Oa(t){if(t.blockedOn!==null)return!1;for(var s=t.targetContainers;0<s.length;){var r=Bh(t.nativeEvent);if(r===null){r=t.nativeEvent;var a=new r.constructor(r.type,r);zo=a,r.target.dispatchEvent(a),zo=null}else return s=pr(r),s!==null&&i_(s),t.blockedOn=r,!1;s.shift()}return!0}function a_(t,s,r){Oa(t)&&r.delete(s)}function hx(){Ah=!1,Es!==null&&Oa(Es)&&(Es=null),Ts!==null&&Oa(Ts)&&(Ts=null),Rs!==null&&Oa(Rs)&&(Rs=null),Fn.forEach(a_),Gn.forEach(a_)}function ja(t,s){t.blockedOn===s&&(t.blockedOn=null,Ah||(Ah=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,hx)))}var La=null;function o_(t){La!==t&&(La=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){La===t&&(La=null);for(var s=0;s<t.length;s+=3){var r=t[s],a=t[s+1],h=t[s+2];if(typeof a!="function"){if(zh(a||r)===null)continue;break}var u=pr(r);u!==null&&(t.splice(s,3),s-=3,Bc(u,{pending:!0,data:h,method:r.method,action:a},a,h))}}))}function Xr(t){function s(k){return ja(k,t)}Es!==null&&ja(Es,t),Ts!==null&&ja(Ts,t),Rs!==null&&ja(Rs,t),Fn.forEach(s),Gn.forEach(s);for(var r=0;r<Ds.length;r++){var a=Ds[r];a.blockedOn===t&&(a.blockedOn=null)}for(;0<Ds.length&&(r=Ds[0],r.blockedOn===null);)l_(r),r.blockedOn===null&&Ds.shift();if(r=(t.ownerDocument||t).$$reactFormReplay,r!=null)for(a=0;a<r.length;a+=3){var h=r[a],u=r[a+1],m=h[Ot]||null;if(typeof u=="function")m||o_(r);else if(m){var y=null;if(u&&u.hasAttribute("formAction")){if(h=u,m=u[Ot]||null)y=m.formAction;else if(zh(h)!==null)continue}else y=m.action;typeof y=="function"?r[a+1]=y:(r.splice(a,3),a-=3),o_(r)}}}function c_(){function t(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(m){return h=m})},focusReset:"manual",scroll:"manual"})}function s(){h!==null&&(h(),h=null),a||setTimeout(r,20)}function r(){if(!a&&!navigation.transition){var u=navigation.currentEntry;u&&u.url!=null&&navigation.navigate(u.url,{state:u.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var a=!1,h=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(r,100),function(){a=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),h!==null&&(h(),h=null)}}}function Mh(t){this._internalRoot=t}Na.prototype.render=Mh.prototype.render=function(t){var s=this._internalRoot;if(s===null)throw Error(l(409));var r=s.current,a=Zt();e_(r,a,t,s,null,null)},Na.prototype.unmount=Mh.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var s=t.containerInfo;e_(t.current,2,null,t,null,null),ma(),s[dr]=null}};function Na(t){this._internalRoot=t}Na.prototype.unstable_scheduleHydration=function(t){if(t){var s=vd();t={blockedOn:null,target:t,priority:s};for(var r=0;r<Ds.length&&s!==0&&s<Ds[r].priority;r++);Ds.splice(r,0,t),r===0&&l_(t)}};var h_=i.version;if(h_!=="19.2.4")throw Error(l(527,h_,"19.2.4"));q.findDOMNode=function(t){var s=t._reactInternals;if(s===void 0)throw typeof t.render=="function"?Error(l(188)):(t=Object.keys(t).join(","),Error(l(268,t)));return t=f(s),t=t!==null?x(t):null,t=t===null?null:t.stateNode,t};var ux={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:B,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ha=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ha.isDisabled&&Ha.supportsFiber)try{rn=Ha.inject(ux),It=Ha}catch{}}return Zn.createRoot=function(t,s){if(!o(t))throw Error(l(299));var r=!1,a="",h=mp,u=vp,m=yp;return s!=null&&(s.unstable_strictMode===!0&&(r=!0),s.identifierPrefix!==void 0&&(a=s.identifierPrefix),s.onUncaughtError!==void 0&&(h=s.onUncaughtError),s.onCaughtError!==void 0&&(u=s.onCaughtError),s.onRecoverableError!==void 0&&(m=s.onRecoverableError)),s=Qg(t,1,!1,null,null,r,a,null,h,u,m,c_),t[dr]=s.current,ph(t),new Mh(s)},Zn.hydrateRoot=function(t,s,r){if(!o(t))throw Error(l(299));var a=!1,h="",u=mp,m=vp,y=yp,k=null;return r!=null&&(r.unstable_strictMode===!0&&(a=!0),r.identifierPrefix!==void 0&&(h=r.identifierPrefix),r.onUncaughtError!==void 0&&(u=r.onUncaughtError),r.onCaughtError!==void 0&&(m=r.onCaughtError),r.onRecoverableError!==void 0&&(y=r.onRecoverableError),r.formState!==void 0&&(k=r.formState)),s=Qg(t,1,!0,s,r??null,a,h,k,u,m,y,c_),s.context=Jg(null),r=s.current,a=Zt(),a=wo(a),h=ps(a),h.callback=null,gs(r,h,a),r=a,s.current.lanes=r,ln(s,r),Ri(s),t[dr]=s.current,ph(t),new Na(s)},Zn.version="19.2.4",Zn}var x_;function Sx(){if(x_)return Lh.exports;x_=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(i){console.error(i)}}return e(),Lh.exports=xx(),Lh.exports}var bx=Sx();const Em="claude-portal",S_="greenhouse-setup",wx=10;function Tm(){const e=localStorage.getItem(Em);if(e)try{return JSON.parse(e)}catch{}const i=localStorage.getItem(S_);if(i)try{const n=JSON.parse(i),l={recentProjects:n.projectDir?[n.projectDir]:[],checklist:{},jobHistory:{}};return Rm(l),localStorage.removeItem(S_),l}catch{}return{recentProjects:[],checklist:{},jobHistory:{}}}function Rm(e){localStorage.setItem(Em,JSON.stringify(e))}function Dm(){return Tm().recentProjects}function Cx(e){const i=Tm();return i.recentProjects=[e,...i.recentProjects.filter(n=>n!==e)].slice(0,wx),Rm(i),i.recentProjects}const Bm=E.createContext(null);function kx({children:e}){const[i,n]=E.useState(null),[l,o]=E.useState(Dm),[c,d]=E.useState(null),[_,g]=E.useState(null),[f,x]=E.useState(!1),[v,b]=E.useState(!0),[w,S]=E.useState("developer"),[R,z]=E.useState(!1),A=E.useCallback(C=>{n(C),o(Cx(C)),d(null),g(null)},[]),W=E.useCallback(()=>{n(null),d(null),g(null),S("developer"),z(!1)},[]),j=E.useCallback((C,O)=>{d(C),g(O)},[]);return p.jsx(Bm.Provider,{value:{path:i,recentProjects:l,gitBranch:c,gitRemote:_,terminalConnected:f,serverConnected:v,mode:w,setMode:S,editingBrain:R,setEditingBrain:z,setProjectPath:A,clearProject:W,setGitInfo:j,setTerminalConnected:x,setServerConnected:b},children:e})}function Et(){const e=E.useContext(Bm);if(!e)throw new Error("useProject must be used within ProjectProvider");return e}const zm=E.createContext(null);function Ex(e){return e.replace(/\x1b\[[?>=!]?[0-9;]*[a-zA-Z]/g,"").replace(/\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)/g,"").replace(/\x1b[()][0-9A-Z]/g,"").replace(/\x1b./g,"").replace(/\r/g,"")}function Tx({children:e}){const i=E.useRef(null),[n,l]=E.useState(!1),[o,c]=E.useState([]),d=E.useRef(!1),_=E.useRef(null),g=E.useRef(null),f=E.useRef(null),x=E.useRef(null),v=E.useRef(null),b=E.useRef(null),w=E.useRef(null),S=E.useCallback(O=>{c(G=>{const Z=[...G,O];return Z.length>100?Z.slice(Z.length-100):Z})},[]),R=E.useCallback((O,G)=>{b.current=O,w.current=G},[]),z=E.useCallback(O=>{const G=i.current;G?.readyState===WebSocket.OPEN&&G.send(JSON.stringify({type:"input",data:O}))},[]),A=E.useCallback(()=>{if(_.current){const O=_.current;_.current=null,setTimeout(()=>z(O+"\r"),300)}},[z]),W=E.useCallback(()=>{d.current||(d.current=!0,l(!0),f.current&&(clearTimeout(f.current),f.current=null),A())},[A]),j=E.useCallback(O=>{d.current?z(O+"\r"):_.current=O},[z]),C=E.useCallback(O=>{i.current&&i.current.close(),f.current&&(clearTimeout(f.current),f.current=null),d.current=!1,l(!1),g.current=null;const G=location.protocol==="https:"?"wss:":"ws:",Z=new WebSocket(`${G}//${location.host}/terminal?cwd=${encodeURIComponent(O)}`);return i.current=Z,Z.onopen=()=>{b.current?.(),setTimeout(()=>{z("claude --dangerously-skip-permissions\r"),g.current=Date.now()},500),f.current=setTimeout(W,15e3)},Z.onmessage=ae=>{let pe;try{pe=JSON.parse(ae.data)}catch{return}if(pe.type==="output"){if(pe.data&&x.current?.(pe.data),!d.current&&g.current&&Date.now()-g.current>2e3){const he=Ex(pe.data||"");(/>\s*$/.test(he)||he.includes("What can I help"))&&W()}}else pe.type==="exit"?v.current?.():pe.type==="error"&&x.current?.(`\r
|
|
10
|
+
[Error: ${pe.data||pe.message||"Unknown error"}]\r
|
|
11
|
+
`)},Z.onclose=()=>w.current?.(),Z},[z,W]);return p.jsx(zm.Provider,{value:{sendPrompt:j,isReady:n,connect:C,wsRef:i,onOutput:x,onExit:v,setConnectionCallbacks:R,outputLines:o,addOutputLine:S},children:e})}function en(){const e=E.useContext(zm);if(!e)throw new Error("useTerminal must be used within TerminalProvider");return e}async function gi(e,i){try{const n=await fetch(e,i);return n.ok?await n.json():null}catch{return null}}function Am(e,i){const n=new URL(e,window.location.origin);return i&&n.searchParams.set("projectPath",i),n.toString()}const oo=[{key:"summarize",name:"Summarize",emoji:"📝",description:"Key points & themes",format:"md",category:"understand",prompt:`create a comprehensive summary covering:
|
|
12
|
+
- Key findings and themes
|
|
13
|
+
- Important data points and numbers
|
|
14
|
+
- Decisions and action items mentioned
|
|
15
|
+
- Any risks or concerns flagged`},{key:"extract",name:"Extract",emoji:"🔍",description:"Pull out specific data",format:"md",category:"understand",prompt:`extract:
|
|
16
|
+
- All action items and tasks (with owners if mentioned)
|
|
17
|
+
- Key dates and deadlines
|
|
18
|
+
- Important contact details
|
|
19
|
+
- Decision points and outcomes`},{key:"review",name:"Review",emoji:"✅",description:"Check for issues",format:"md",category:"understand",prompt:`review the documents for:
|
|
20
|
+
- Completeness and accuracy
|
|
21
|
+
- Compliance with standard practices
|
|
22
|
+
- Inconsistencies or errors
|
|
23
|
+
- Missing information or gaps
|
|
24
|
+
Provide specific findings with references to source documents.`},{key:"draft",name:"Draft",emoji:"📋",description:"Write a new document",format:"md",category:"create",prompt:`draft a new document based on the source material.
|
|
25
|
+
Synthesize the key information into a cohesive, well-structured document with an executive summary, key findings, detailed analysis, and recommendations.`},{key:"analyse",name:"Analyse",emoji:"📈",description:"Trends & recommendations",format:"md",category:"create",prompt:`analyse the documents and create a report covering:
|
|
26
|
+
- Recurring themes and patterns
|
|
27
|
+
- Trends over time (if dates are present)
|
|
28
|
+
- Outliers or anomalies
|
|
29
|
+
- Key insights, implications, and recommendations for next steps`},{key:"compare",name:"Compare",emoji:"⚖️",description:"Differences across docs",format:"md",category:"create",prompt:`create a comparison analysis.
|
|
30
|
+
Identify similarities, differences, contradictions, and gaps across the documents.
|
|
31
|
+
Present findings in a structured format with specific references.`},{key:"transform",name:"Transform",emoji:"🔄",description:"Change format or structure",format:"md",category:"create",prompt:`transform the content into a different format.
|
|
32
|
+
Restructure and reformat the information while preserving all key content. If extracting to a table or spreadsheet format, use CSV with the first row as column headers.`}],Rx=[{key:"understand",label:"Understand",description:"Tell me what's in here"},{key:"create",label:"Create",description:"Make something from this"}],Dx=`IMPORTANT: Do NOT modify, move, rename, or delete any of the original files. Only create new files in the output/ directory.
|
|
33
|
+
If you cannot read a file, note it as skipped in the output with the filename and reason.`,Bx="If the folder has more files than you can process in one pass, focus on the most relevant files based on their names and types, and note which files were not reviewed.";function zx(e){const{folderPath:i,templateKey:n,freeformText:l,context:o,fileCount:c}=e,d=n?oo.find(b=>b.key===n):null,_=d?.format||"md",g=new Date().toISOString().slice(0,10),f=d?.key||"output",x=`${i}/output/${f}-${g}.${_}`,v=[Dx,""];return c>50&&v.push(Bx,""),d&&v.push(`Scan all documents in ${i} and ${d.prompt}`),l&&v.push(d?`
|
|
34
|
+
Also: ${l}`:`Scan all documents in ${i} and ${l}`),o&&v.push("",`Additional instructions: ${o}`),e.styleReference&&(v.push("","Use the following document as a style, tone, and format reference. Match its structure, headings, voice, and level of detail:"),v.push("---BEGIN STYLE REFERENCE---"),v.push(e.styleReference.slice(0,8e3)),v.push("---END STYLE REFERENCE---")),v.push("",`Save the output to ${x}`),v.join(`
|
|
35
|
+
`)}function Ax(e){const i=E.useRef(e);i.current=e;const n=E.useRef(null),l=E.useRef(null),o=E.useCallback(()=>{n.current?.close(),n.current=null,l.current&&(clearTimeout(l.current),l.current=null)},[]),c=E.useCallback((d,_)=>{o();const g=`/api/doc-events?folderPath=${encodeURIComponent(d)}`,f=new EventSource(g);n.current=f,f.addEventListener("output-created",x=>{i.current(JSON.parse(x.data)),o()}),l.current=setTimeout(()=>{o(),_()},600*1e3)},[o]);return E.useEffect(()=>o,[o]),{listen:c,close:o}}const Mm=E.createContext(null);function Mx({children:e}){const[i,n]=E.useState(null),[l,o]=E.useState(null),[c,d]=E.useState(!1),[_,g]=E.useState(null),[f,x]=E.useState(""),[v,b]=E.useState(""),[w,S]=E.useState({status:"empty"}),[R,z]=E.useState(null),[A,W]=E.useState(!1),{sendPrompt:j}=en(),{path:C,mode:O}=Et(),G=E.useCallback(async he=>{let V=await gi(`/api/read-output?path=${encodeURIComponent(he)}`);V||(V=await gi(`/api/read-file?path=${encodeURIComponent(he)}`)),V?(S({status:"complete",...V}),W(!1)):(S({status:"error",message:"Failed to load file"}),W(!1))},[]),Z=Ax(he=>G(he.path)),ae=E.useCallback(async he=>{n(he),d(!0);const V=await gi(`/api/folder-scan?folderPath=${encodeURIComponent(he)}`);o(V||null),d(!1)},[]);E.useEffect(()=>{O==="document"&&C&&!i&&ae(C)},[O,C,i,ae]);const pe=E.useCallback(()=>{n(null),o(null),S({status:"empty"}),W(!1),Z.close()},[Z]),Oe=E.useCallback(async()=>{if(A||!i||!_&&!f.trim())return;if(W(!0),!(await fetch(`/api/ensure-output-dir?folderPath=${encodeURIComponent(i)}`,{method:"POST"})).ok){S({status:"error",message:"Failed to create output directory"}),W(!1);return}const V=l?.summary.total||0,X=zx({folderPath:i,templateKey:_||void 0,freeformText:f.trim()||void 0,context:v.trim()||void 0,styleReference:R||void 0,fileCount:V}),te=_?oo.find(Q=>Q.key===_)?.name||_:"Custom";S({status:"processing",outcome:te,fileCount:V}),Z.listen(i,()=>{S({status:"error",message:"Timed out waiting for output. Check the terminal for details, or try again with fewer files."}),W(!1)}),j(X)},[A,i,_,f,v,R,l,j,Z]);return p.jsx(Mm.Provider,{value:{folderPath:i,folderScan:l,scanLoading:c,scanFolder:ae,clearFolder:pe,selectedOutcome:_,setSelectedOutcome:g,freeformText:f,setFreeformText:x,contextText:v,setContextText:b,styleExampleContent:R,setStyleExampleContent:z,output:w,run:Oe,loadOutput:G,canRun:!!i&&(!!_||!!f.trim())&&!A,isRunning:A},children:e})}function Li(){const e=E.useContext(Mm);if(!e)throw new Error("useDocModeContext must be used within DocModeProvider");return e}function Ox(){const{path:e,setGitInfo:i}=Et();E.useEffect(()=>{e&&gi(Am("/api/project-info",e)).then(n=>{n&&i(n.gitBranch,n.gitRemote)})},[e,i])}function jx({onAllReady:e,onNeedInstall:i}){const[n,l]=E.useState([]),[o,c]=E.useState(!0);E.useEffect(()=>{d()},[]);async function d(){c(!0);const _=await gi("/api/detect");_&&(l(_.tools),_.tools.filter(f=>f.required&&!f.installed).length===0?setTimeout(e,600):i(_.tools)),c(!1)}return p.jsxs("div",{className:"text-center",children:[p.jsx("h2",{className:"text-2xl font-bold text-[var(--text-primary)] mb-3",children:"Getting things ready..."}),p.jsx("p",{className:"text-[var(--text-secondary)] text-base mb-10",children:"Checking what's installed on your machine"}),o?p.jsxs("div",{className:"flex items-center justify-center gap-4 text-[var(--text-secondary)] text-base",children:[p.jsx("div",{className:"w-6 h-6 border-2 border-[#5e17eb]/30 border-t-[#5e17eb] rounded-full animate-spin"}),p.jsx("span",{children:"Scanning..."})]}):p.jsx("div",{className:"space-y-3 text-left",children:n.map(_=>p.jsxs("div",{className:"flex items-center gap-5 px-6 py-5 bg-[var(--bg-secondary)] rounded-2xl border border-[var(--border)]",style:{boxShadow:"0 4px 12px rgba(0,0,0,0.06)"},children:[p.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center text-base font-bold ${_.installed?"bg-[#30d158]/15 text-[#30d158]":"bg-[#ff453a]/15 text-[#ff453a]"}`,children:_.installed?"✓":"✗"}),p.jsx("span",{className:"text-[var(--text-primary)] text-lg font-semibold",children:_.name}),_.version&&p.jsx("span",{className:"text-[var(--text-secondary)] text-sm font-mono ml-auto",children:_.version})]},_.name))})]})}const Lx={node:{steps:["Download from nodejs.org (LTS recommended)","Run the installer and follow the prompts","Restart your terminal after installing"],link:"https://nodejs.org",linkLabel:"Download Node.js"},npm:{steps:["npm comes bundled with Node.js","Install Node.js first and npm will be included"]},git:{steps:["Click Install below","Look for a pop-up on your screen and click 'Install'","Wait for it to finish (this can take a few minutes)","Once done, click Retry below to verify"]},claude:{steps:["Click Install below to download Claude Code","Once installed, you'll sign in when the terminal opens"]}};function Nx({tools:e,onDone:i}){const[n,l]=E.useState(null),[o,c]=E.useState({}),[d,_]=E.useState(null),[g,f]=E.useState(null),[x,v]=E.useState(()=>{const z={};for(const A of e)z[A.id]=A.installed?"done":"pending";return z}),b=e.filter(z=>!z.installed&&z.required);async function w(z){l(z),v(A=>({...A,[z]:"installing"})),c(A=>{const W={...A};return delete W[z],W});try{const A=await fetch(`/api/install/${encodeURIComponent(z)}`,{method:"POST"});if(!A.ok){const O=await A.text().catch(()=>"Server error");c(G=>({...G,[z]:`Install failed (${A.status}): ${O}`})),v(G=>({...G,[z]:"error"})),l(null);return}const W=A.body?.getReader(),j=new TextDecoder;let C=!1;if(W){let O="";for(;;){const{done:G,value:Z}=await W.read();if(G)break;O+=j.decode(Z,{stream:!0});const ae=O.split(`
|
|
36
|
+
`);O=ae.pop()??"";for(const pe of ae)if(pe.startsWith("data: "))try{const Oe=JSON.parse(pe.slice(6));Oe.tool===z&&Oe.status==="done"&&(C=!0),Oe.tool===z&&Oe.status==="error"&&(C=!1,Oe.error&&c(he=>({...he,[z]:Oe.error})))}catch{}}}v(O=>({...O,[z]:C?"done":"error"}))}catch{v(A=>({...A,[z]:"error"}))}l(null)}const S=b.every(z=>x[z.id]==="done"),R=z=>{switch(z){case"done":return{symbol:"✓",color:"#22c55e"};case"error":return{symbol:"✗",color:"#ef4444"};case"installing":return{symbol:"⏳",color:"#f59e0b"};default:return{symbol:"○",color:"#9ca3af"}}};return p.jsxs("div",{className:"space-y-4",children:[p.jsx("h2",{style:{fontSize:"20px",fontWeight:600,color:"var(--text-primary)"},children:"Install missing tools"}),p.jsx("p",{style:{fontSize:"14px",color:"var(--text-secondary)",marginTop:"-8px"},children:"We'll help you get everything set up step by step."}),p.jsx("div",{className:"space-y-2",children:b.map(z=>{const A=Lx[z.id],W=R(x[z.id]),j=d===z.id;return p.jsxs("div",{children:[p.jsx("div",{style:{padding:"16px 20px",background:"var(--bg-secondary)",border:"1px solid var(--border)",borderRadius:j?"12px 12px 0 0":"12px",boxShadow:"0 2px 8px rgba(0,0,0,0.04)"},children:p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[p.jsx("span",{style:{color:W.color,fontSize:"16px"},children:W.symbol}),p.jsx("div",{style:{flex:1},children:p.jsx("span",{style:{color:"var(--text-primary)",fontSize:"15px",fontWeight:500},children:z.name})}),x[z.id]==="pending"&&p.jsxs("div",{style:{display:"flex",gap:"6px"},children:[A&&p.jsx("button",{onClick:()=>_(j?null:z.id),style:{padding:"8px 12px",background:"transparent",color:"#6b7280",fontSize:"12px",fontWeight:500,borderRadius:"8px",border:"1px solid #e5e7eb",cursor:"pointer"},children:"Guide"}),p.jsx("button",{onClick:()=>w(z.id),disabled:n!==null,style:{padding:"8px 16px",background:"#22c55e",color:"#fff",fontSize:"13px",fontWeight:600,borderRadius:"8px",border:"none",cursor:"pointer",opacity:n?.5:1},children:"Install"})]}),x[z.id]==="error"&&p.jsx("button",{onClick:()=>w(z.id),disabled:n!==null,style:{padding:"8px 16px",background:"#ef4444",color:"#fff",fontSize:"13px",fontWeight:600,borderRadius:"8px",border:"none",cursor:"pointer"},children:"Retry"}),x[z.id]==="installing"&&p.jsx("span",{style:{fontSize:"13px",color:"#f59e0b",fontWeight:500},children:"Installing..."})]})}),j&&A&&p.jsxs("div",{style:{padding:"16px 20px",background:"rgba(94, 23, 235, 0.03)",border:"1px solid var(--border)",borderTop:"none",borderRadius:"0 0 12px 12px"},children:[p.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:A.steps.map((C,O)=>p.jsxs("div",{style:{display:"flex",gap:"10px",alignItems:"flex-start"},children:[p.jsx("span",{style:{width:"20px",height:"20px",borderRadius:"50%",background:"#5e17eb",color:"#fff",fontSize:"11px",fontWeight:700,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:O+1}),p.jsx("span",{style:{fontSize:"13px",color:"var(--text-primary)",lineHeight:1.5},children:C})]},O))}),A.link&&p.jsxs("a",{href:A.link,target:"_blank",rel:"noopener noreferrer",style:{display:"inline-block",marginTop:"12px",padding:"8px 16px",background:"#5e17eb",color:"#fff",fontSize:"13px",fontWeight:600,borderRadius:"8px",textDecoration:"none"},children:[A.linkLabel||"Open"," →"]})]}),x[z.id]==="error"&&o[z.id]&&p.jsx("div",{style:{marginTop:"4px",padding:"8px 12px",background:"rgba(239, 68, 68, 0.08)",borderRadius:"8px",fontSize:"12px",color:"#ef4444",lineHeight:1.4,fontFamily:"monospace",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:o[z.id]})]},z.id)})}),S&&p.jsx("button",{onClick:i,style:{width:"100%",padding:"16px",background:"linear-gradient(135deg, #5e17eb, #8b5cf6)",color:"#fff",borderRadius:"12px",fontSize:"16px",fontWeight:700,border:"none",cursor:"pointer",boxShadow:"0 4px 12px rgba(94,23,235,0.3)"},children:"Continue →"})]})}function Hx({onProjectSelected:e,mode:i="developer"}){const n=i==="document",[l,o]=E.useState(n?"open":"choose"),[c,d]=E.useState(""),[_,g]=E.useState(!1),[f,x]=E.useState(""),[v,b]=E.useState(""),[w,S]=E.useState(null),[R,z]=E.useState(!1),A=Dm();async function W(){if(!f.trim())return;z(!0),S(null);const O=await gi("/api/scaffold",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectName:f.trim()})});O?.projectDir?e(O.projectDir):S("Failed to create project"),z(!1)}async function j(){if(!v.trim())return;z(!0),S(null);const O=await gi("/api/scaffold",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectName:v.trim().split("/").pop()?.replace(/\.git$/,"")||"cloned-repo"})});O?.projectDir?e(O.projectDir):S("Failed to clone repository"),z(!1)}const C={padding:"36px",background:"var(--bg-secondary)",borderRadius:"24px",textAlign:"center",border:"1px solid var(--border)",boxShadow:"0 8px 24px rgba(0,0,0,0.08)",cursor:"pointer",transition:"all 0.3s ease"};return l==="choose"?p.jsxs("div",{className:"animate-in",children:[p.jsx("h2",{style:{fontSize:"28px",fontWeight:700,color:"var(--text-primary)",marginBottom:"8px",textAlign:"center"},children:"Choose a folder"}),p.jsx("p",{style:{color:"var(--text-secondary)",fontSize:"17px",marginBottom:"48px",textAlign:"center"},children:"Where would you like to work?"}),A.length>0&&p.jsxs("div",{style:{marginBottom:"48px"},children:[p.jsx("p",{style:{fontSize:"13px",color:"var(--text-secondary)",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:"16px"},children:"Recent"}),p.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:A.map(O=>p.jsx("button",{onClick:()=>e(O),className:"transition-all duration-300 hover:-translate-y-0.5 active:scale-[0.98]",style:{width:"100%",textAlign:"left",padding:"20px 24px",background:"var(--bg-secondary)",borderRadius:"16px",color:"var(--text-primary)",fontSize:"15px",fontFamily:"'SF Mono', Menlo, monospace",border:"1px solid var(--border)",boxShadow:"0 4px 12px rgba(0,0,0,0.06)",cursor:"pointer",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:O},O))})]}),p.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:"20px"},children:[p.jsxs("button",{onClick:async()=>{g(!0);const O=await gi("/api/pick-folder");g(!1),O?.path&&e(O.path)},disabled:_,className:"transition-all duration-300 hover:-translate-y-1 active:scale-[0.97]",style:C,children:[p.jsx("div",{style:{fontSize:"44px",marginBottom:"16px"},children:_?"⏳":"📂"}),p.jsx("div",{style:{color:"var(--text-primary)",fontSize:"16px",fontWeight:700,marginBottom:"6px"},children:_?"Choosing...":"Open existing"}),p.jsx("div",{style:{color:"var(--text-secondary)",fontSize:"14px"},children:"Browse in Finder"})]}),[{m:"create",icon:"✨",label:"Create new",desc:"Start from scratch"},{m:"clone",icon:"📦",label:"Clone repo",desc:"From GitHub"}].map(({m:O,icon:G,label:Z,desc:ae})=>p.jsxs("button",{onClick:()=>o(O),className:"transition-all duration-300 hover:-translate-y-1 active:scale-[0.97]",style:C,children:[p.jsx("div",{style:{fontSize:"44px",marginBottom:"16px"},children:G}),p.jsx("div",{style:{color:"var(--text-primary)",fontSize:"16px",fontWeight:700,marginBottom:"6px"},children:Z}),p.jsx("div",{style:{color:"var(--text-secondary)",fontSize:"14px"},children:ae})]},O))]}),p.jsx("div",{style:{marginTop:"28px",textAlign:"center"},children:p.jsx("button",{onClick:()=>o("open"),className:"transition-colors",style:{color:"var(--text-secondary)",fontSize:"14px",background:"none",border:"none",cursor:"pointer"},children:"Or enter a path manually →"})})]}):p.jsxs("div",{className:"animate-in",children:[!n&&p.jsx("button",{onClick:()=>o("choose"),className:"text-[var(--text-secondary)] text-base hover:text-[var(--text-primary)] transition-colors mb-8 block",children:"← Back"}),l==="open"&&p.jsxs("div",{children:[p.jsx("h2",{style:{fontSize:"28px",fontWeight:700,color:"var(--text-primary)",marginBottom:"8px"},children:n?"What folder can Claude find your work?":"Open existing project"}),p.jsx("p",{style:{color:"var(--text-secondary)",fontSize:"17px",marginBottom:"40px"},children:n?"Browse to the folder with your documents.":"Enter the path to your project."}),n?p.jsx("button",{onClick:async()=>{g(!0);const O=await gi("/api/pick-folder");g(!1),O?.path&&e(O.path)},disabled:_,className:"w-full hover:-translate-y-0.5 transition-all active:scale-[0.98]",style:{padding:"20px",background:"linear-gradient(135deg, #5e17eb, #8b5cf6)",color:"white",borderRadius:"16px",fontSize:"18px",fontWeight:700,border:"none",cursor:"pointer",boxShadow:"0 4px 12px rgba(94,23,235,0.3)",marginBottom:"40px"},children:_?"⏳ Choosing...":"📂 Browse for folder"}):p.jsxs(p.Fragment,{children:[p.jsx("input",{type:"text",value:c,onChange:O=>d(O.target.value),placeholder:"/path/to/your/project",autoFocus:!0,className:"w-full focus:outline-none transition-all",style:{padding:"20px 24px",background:"var(--bg-secondary)",border:"1px solid var(--border)",borderRadius:"16px",color:"var(--text-primary)",fontFamily:"'SF Mono', Menlo, monospace",fontSize:"15px",boxShadow:"0 4px 12px rgba(0,0,0,0.06)",marginBottom:"16px"}}),p.jsx("button",{onClick:()=>c.trim()&&e(c.trim()),disabled:!c.trim(),className:"w-full hover:-translate-y-0.5 disabled:opacity-30 transition-all active:scale-[0.98]",style:{padding:"20px",background:"linear-gradient(135deg, #5e17eb, #8b5cf6)",color:"white",borderRadius:"16px",fontSize:"18px",fontWeight:700,border:"none",cursor:"pointer",boxShadow:"0 4px 12px rgba(94,23,235,0.3)",marginBottom:"40px"},children:"Open project"})]}),n&&A.length>0&&p.jsxs("div",{style:{marginTop:n?"0":"40px"},children:[p.jsx("p",{style:{fontSize:"13px",color:"var(--text-secondary)",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:"16px"},children:"Recent"}),p.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:A.map(O=>p.jsx("button",{onClick:()=>e(O),className:"transition-all duration-200 hover:-translate-y-0.5 active:scale-[0.98]",style:{width:"100%",textAlign:"left",padding:"20px 24px",background:"var(--bg-secondary)",borderRadius:"16px",color:"var(--text-primary)",fontSize:"15px",fontFamily:"'SF Mono', Menlo, monospace",border:"1px solid var(--border)",cursor:"pointer",boxShadow:"0 4px 12px rgba(0,0,0,0.06)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:O},O))})]})]}),l==="create"&&p.jsxs("div",{className:"space-y-6",children:[p.jsx("h2",{className:"text-2xl font-bold text-[var(--text-primary)]",children:"Create new project"}),p.jsx("input",{type:"text",value:f,onChange:O=>x(O.target.value),placeholder:"my-app",autoFocus:!0,className:"w-full px-6 py-5 bg-[var(--bg-secondary)] border border-[var(--border)] rounded-xl text-[var(--text-primary)] font-mono text-base placeholder:text-[#86868b] focus:outline-none focus:border-[#5e17eb]/50 focus:ring-2 focus:ring-[#5e17eb]/10 transition-all",style:{boxShadow:"0 4px 12px rgba(0,0,0,0.06)"}}),p.jsx("button",{onClick:W,disabled:!f.trim()||R,className:"w-full py-5 bg-gradient-to-r from-[#5e17eb] to-[#8b5cf6] text-white rounded-xl text-lg font-bold hover:-translate-y-0.5 disabled:opacity-30 transition-all active:scale-[0.98]",style:{boxShadow:"0 4px 12px rgba(94,23,235,0.3)"},children:R?"Creating...":"Create project"})]}),l==="clone"&&p.jsxs("div",{className:"space-y-6",children:[p.jsx("h2",{className:"text-2xl font-bold text-[var(--text-primary)]",children:"Clone from GitHub"}),p.jsx("input",{type:"text",value:v,onChange:O=>b(O.target.value),placeholder:"https://github.com/user/repo",autoFocus:!0,className:"w-full px-6 py-5 bg-[var(--bg-secondary)] border border-[var(--border)] rounded-xl text-[var(--text-primary)] font-mono text-base placeholder:text-[#86868b] focus:outline-none focus:border-[#5e17eb]/50 focus:ring-2 focus:ring-[#5e17eb]/10 transition-all",style:{boxShadow:"0 4px 12px rgba(0,0,0,0.06)"}}),p.jsx("button",{onClick:j,disabled:!v.trim()||R,className:"w-full py-5 bg-gradient-to-r from-[#5e17eb] to-[#8b5cf6] text-white rounded-xl text-lg font-bold hover:-translate-y-0.5 disabled:opacity-30 transition-all active:scale-[0.98]",style:{boxShadow:"0 4px 12px rgba(94,23,235,0.3)"},children:R?"Cloning...":"Clone repository"})]}),w&&p.jsx("p",{className:"text-[#ff453a] text-base bg-[#ff453a]/10 px-6 py-4 rounded-xl mt-6",children:w})]})}const Wh=[{type:"image-text",title:"Most people:",content:"See a terminal and think...",imageUrl:"https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExMG0wamx1NWUwOGcxN2F6ejBva3p3OW5peG5qdWlrcjI1d3JyM2l0dyZlcD12MV9naWZzX3NlYXJjaCZjdD1n/NRXleEopnqL3a/giphy.gif"},{type:"text",title:"What even is the terminal?",content:"Terminal = using our computer without the mouse"},{type:"text",title:"The magic of Claude Code",content:`Once we set it up, we're no longer actually talking directly to our computer.
|
|
37
|
+
|
|
38
|
+
We're talking to Claude.
|
|
39
|
+
|
|
40
|
+
Who then takes action on our computer.`},{type:"comparison",title:"The difference",content:""},{type:"text",title:"That's it.",content:`You talk. Claude does the work.
|
|
41
|
+
|
|
42
|
+
It reads your files, understands the context, and gets things done — no copy-pasting, no explaining everything twice.`}];function Om({onClose:e}){const[i,n]=E.useState(0),l=Wh[i],o=i===Wh.length-1;return p.jsxs("div",{style:{position:"fixed",inset:0,zIndex:1e3,background:"rgba(0,0,0,0.7)",backdropFilter:"blur(8px)",display:"flex",alignItems:"center",justifyContent:"center",animation:"fadeIn 0.3s ease"},onClick:e,children:[p.jsxs("div",{style:{width:"90%",maxWidth:"800px",maxHeight:"85vh",background:"#f5f5f5",borderRadius:"24px",overflow:"hidden",position:"relative",boxShadow:"0 24px 64px rgba(0,0,0,0.3)"},onClick:c=>c.stopPropagation(),children:[p.jsx("button",{onClick:e,style:{position:"absolute",top:"16px",right:"16px",zIndex:10,width:"36px",height:"36px",borderRadius:"50%",background:"rgba(0,0,0,0.08)",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"18px",color:"#666",transition:"background 0.15s"},children:"✕"}),p.jsxs("div",{style:{padding:"60px 48px 40px",minHeight:"420px",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"},children:[l.type==="image-text"&&p.jsxs(p.Fragment,{children:[p.jsx("h2",{style:{fontSize:"32px",fontWeight:800,color:"#212529",marginBottom:"32px"},children:l.title}),p.jsxs("div",{style:{display:"flex",gap:"24px",alignItems:"center",justifyContent:"center",flexWrap:"wrap"},children:[p.jsx("div",{style:{width:"280px",height:"200px",background:"#1a1a2e",borderRadius:"12px",display:"flex",alignItems:"flex-start",padding:"16px",fontFamily:"'SF Mono', Menlo, monospace",fontSize:"12px",color:"#888",boxShadow:"0 8px 24px rgba(0,0,0,0.15)"},children:p.jsxs("div",{children:[p.jsx("div",{style:{color:"#666",marginBottom:"4px"},children:"Last login: Mon Mar 9"}),p.jsxs("div",{style:{color:"#888"},children:["nichurrell ~ %",p.jsx("span",{style:{animation:"blink 1s infinite"},children:"▋"})]})]})}),p.jsx("span",{style:{fontSize:"36px",fontWeight:800,color:"#212529"},children:"="}),p.jsx("img",{src:l.imageUrl,alt:"Reaction",style:{width:"240px",borderRadius:"12px",boxShadow:"0 8px 24px rgba(0,0,0,0.15)"}})]})]}),l.type==="text"&&p.jsxs(p.Fragment,{children:[p.jsx("h2",{style:{fontSize:"28px",fontWeight:800,color:"#212529",marginBottom:"28px"},children:l.title}),p.jsx("p",{style:{fontSize:"22px",fontWeight:700,color:"#212529",lineHeight:1.6,maxWidth:"600px",whiteSpace:"pre-line"},children:l.content})]}),l.type==="comparison"&&p.jsxs(p.Fragment,{children:[p.jsx("h2",{style:{fontSize:"28px",fontWeight:800,color:"#212529",marginBottom:"32px"},children:l.title}),p.jsxs("div",{style:{display:"flex",gap:"24px",flexWrap:"wrap",justifyContent:"center"},children:[p.jsxs("div",{style:{width:"280px",padding:"24px",borderRadius:"16px",background:"#fff",border:"2px solid #e5e7eb",textAlign:"left"},children:[p.jsx("div",{style:{fontSize:"24px",marginBottom:"12px"},children:"🌐"}),p.jsx("div",{style:{fontSize:"16px",fontWeight:700,color:"#9ca3af",marginBottom:"12px"},children:"AI in a browser"}),p.jsxs("div",{style:{fontSize:"14px",color:"#6b7280",lineHeight:1.8},children:[`"Here's my file..."`,p.jsx("br",{}),'"Remember what I said before..."',p.jsx("br",{}),'"No, the OTHER document..."',p.jsx("br",{}),'"Let me paste it again..."']}),p.jsx("div",{style:{marginTop:"16px",fontSize:"13px",fontWeight:700,color:"#ef4444"},children:"You do the work for the AI"})]}),p.jsxs("div",{style:{width:"280px",padding:"24px",borderRadius:"16px",background:"#fff",border:"2px solid #5e17eb",textAlign:"left",boxShadow:"0 4px 16px rgba(94,23,235,0.12)"},children:[p.jsx("div",{style:{fontSize:"24px",marginBottom:"12px"},children:"⚡"}),p.jsx("div",{style:{fontSize:"16px",fontWeight:700,color:"#5e17eb",marginBottom:"12px"},children:"Claude Code"}),p.jsxs("div",{style:{fontSize:"14px",color:"#6b7280",lineHeight:1.8},children:['"Summarize my meeting notes"',p.jsx("br",{}),p.jsx("span",{style:{color:"#5e17eb",fontWeight:600},children:"→ It reads your files itself"}),p.jsx("br",{}),p.jsx("span",{style:{color:"#5e17eb",fontWeight:600},children:"→ Already knows the context"}),p.jsx("br",{}),p.jsx("span",{style:{color:"#5e17eb",fontWeight:600},children:"→ Just does it"})]}),p.jsx("div",{style:{marginTop:"16px",fontSize:"13px",fontWeight:700,color:"#16a34a"},children:"The AI does the work for you"})]})]})]})]}),p.jsxs("div",{style:{padding:"20px 48px 32px",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[p.jsx("div",{style:{display:"flex",gap:"8px"},children:Wh.map((c,d)=>p.jsx("button",{onClick:()=>n(d),style:{width:d===i?"24px":"8px",height:"8px",borderRadius:"4px",border:"none",cursor:"pointer",background:d===i?"#5e17eb":"#ddd",transition:"all 0.3s"}},d))}),p.jsxs("div",{style:{display:"flex",gap:"12px"},children:[i>0&&p.jsx("button",{onClick:()=>n(i-1),style:{padding:"12px 24px",borderRadius:"12px",background:"white",border:"1px solid #e9ecef",fontSize:"15px",fontWeight:600,color:"#495057",cursor:"pointer",transition:"all 0.2s"},children:"← Back"}),p.jsx("button",{onClick:()=>o?e():n(i+1),style:{padding:"12px 32px",borderRadius:"12px",background:o?"linear-gradient(135deg, #5e17eb, #8b5cf6)":"#212529",border:"none",fontSize:"15px",fontWeight:600,color:"white",cursor:"pointer",transition:"all 0.2s",boxShadow:o?"0 4px 12px rgba(94,23,235,0.3)":"none"},children:o?"Let's go! →":"Next →"})]})]})]}),p.jsx("style",{children:`
|
|
43
|
+
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
|
|
44
|
+
`})]})}function Ux({onComplete:e,onSkip:i}){const[n,l]=E.useState(""),[o,c]=E.useState(!1),[d,_]=E.useState(null),[g,f]=E.useState(null),[x,v]=E.useState(null),[b,w]=E.useState("");async function S(){const A=n.trim();if(!A){_("Please enter a valid website URL (e.g. yourbusiness.com)");return}_(null),c(!0),w("Fetching website...");try{const W=await fetch("/api/brain/scrape",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:A})}),j=await W.json();if(!W.ok){_(j.error||"Scraping failed"),c(!1);return}f(j)}catch{_("Couldn't reach that website. Check the URL and try again.")}c(!1)}function R(A,W){g&&(f({...g,[A]:W}),v(null))}function z(){g&&e(g)}if(g){const A=[{key:"businessName",label:"Business Name",value:g.businessName},{key:"businessTypeLabel",label:"Type",value:g.businessTypeLabel},{key:"description",label:"Description",value:g.description},{key:"location",label:"Location",value:g.location||""},{key:"priceRange",label:"Pricing",value:g.priceRange||""},{key:"website",label:"Website",value:g.website}];return p.jsxs("div",{children:[p.jsx("h3",{style:{fontSize:"18px",fontWeight:700,color:"var(--text-primary)",marginBottom:"4px"},children:"Here's what we found"}),p.jsx("p",{style:{fontSize:"13px",color:"var(--text-secondary)",marginBottom:"20px"},children:"Click any field to edit it."}),p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[A.map(W=>p.jsxs("div",{style:{padding:"12px 16px",borderRadius:"10px",background:"rgba(0,0,0,0.02)",border:"1px solid #e5e7eb",cursor:"pointer"},onClick:()=>v(W.key),children:[p.jsx("div",{style:{fontSize:"11px",color:"#9ca3af",fontWeight:600,marginBottom:"2px"},children:W.label}),x===W.key?p.jsx("input",{autoFocus:!0,defaultValue:W.value,onBlur:j=>R(W.key,j.target.value),onKeyDown:j=>{j.key==="Enter"&&R(W.key,j.target.value)},style:{width:"100%",fontSize:"14px",padding:"4px 0",border:"none",borderBottom:"2px solid #5e17eb",outline:"none",background:"transparent",color:"var(--text-primary)"}}):p.jsx("div",{style:{fontSize:"14px",color:W.value?"var(--text-primary)":"#d1d5db",fontWeight:500},children:W.value||"Not found — click to add"})]},W.key)),Object.keys(g.socialProfiles).length>0&&p.jsxs("div",{style:{padding:"12px 16px",borderRadius:"10px",background:"rgba(0,0,0,0.02)",border:"1px solid #e5e7eb"},children:[p.jsx("div",{style:{fontSize:"11px",color:"#9ca3af",fontWeight:600,marginBottom:"2px"},children:"Social Profiles"}),p.jsx("div",{style:{fontSize:"14px",color:"var(--text-primary)"},children:Object.keys(g.socialProfiles).join(", ")})]})]}),p.jsx("div",{style:{display:"flex",gap:"12px",marginTop:"24px"},children:p.jsx("button",{onClick:z,style:{flex:1,padding:"14px",background:"#5e17eb",color:"#fff",borderRadius:"12px",border:"none",fontSize:"15px",fontWeight:600,cursor:"pointer"},children:"Confirm & Continue"})})]})}return p.jsxs("div",{children:[p.jsx("h3",{style:{fontSize:"18px",fontWeight:700,color:"var(--text-primary)",marginBottom:"4px"},children:"What's your website?"}),p.jsx("p",{style:{fontSize:"13px",color:"var(--text-secondary)",marginBottom:"20px"},children:"We'll scan it and fill in your business details automatically."}),p.jsxs("div",{style:{display:"flex",gap:"8px"},children:[p.jsx("input",{value:n,onChange:A=>{l(A.target.value),_(null)},onKeyDown:A=>{A.key==="Enter"&&S()},placeholder:"yourbusiness.com",disabled:o,style:{flex:1,padding:"12px 16px",fontSize:"15px",borderRadius:"10px",border:"1px solid #e5e7eb",outline:"none",color:"var(--text-primary)",background:"var(--bg-secondary)"}}),p.jsx("button",{onClick:S,disabled:o,style:{padding:"12px 20px",background:"#5e17eb",color:"#fff",borderRadius:"10px",border:"none",fontSize:"14px",fontWeight:600,cursor:o?"not-allowed":"pointer",opacity:o?.6:1,whiteSpace:"nowrap"},children:o?"Scanning...":"Scan my website →"})]}),o&&p.jsx("p",{style:{fontSize:"13px",color:"#8b5cf6",marginTop:"12px"},children:b}),d&&p.jsx("p",{style:{fontSize:"13px",color:"#ef4444",marginTop:"12px"},children:d}),p.jsx("button",{onClick:i,style:{display:"block",marginTop:"20px",background:"none",border:"none",color:"#9ca3af",fontSize:"13px",cursor:"pointer"},children:"Skip this step →"})]})}const Wx=`You are helping me import context from one AI assistant to another. Your job is to go through our past conversations and sum up what you know about me and my business.
|
|
45
|
+
|
|
46
|
+
Please organise what you know into these 4 categories:
|
|
47
|
+
|
|
48
|
+
## BUSINESS
|
|
49
|
+
- Business name
|
|
50
|
+
- What I sell (products/services)
|
|
51
|
+
- My pricing
|
|
52
|
+
- My target audience
|
|
53
|
+
- My location
|
|
54
|
+
- My team size
|
|
55
|
+
- My revenue range
|
|
56
|
+
- What makes my offer unique (dream outcome, guarantees, bonuses)
|
|
57
|
+
- My delivery model (1:1, group, digital, physical)
|
|
58
|
+
|
|
59
|
+
## INDUSTRY
|
|
60
|
+
- My industry/niche
|
|
61
|
+
- Seasonal patterns
|
|
62
|
+
- Common customer objections
|
|
63
|
+
- What triggers people to buy
|
|
64
|
+
- Average customer lifetime value
|
|
65
|
+
|
|
66
|
+
## VOICE
|
|
67
|
+
- How I like to communicate (formal, casual, warm, direct, etc.)
|
|
68
|
+
- Words or phrases I use often
|
|
69
|
+
- Things I'd never say
|
|
70
|
+
- My preferred email/content length
|
|
71
|
+
- My brand personality
|
|
72
|
+
|
|
73
|
+
## COMPETITORS
|
|
74
|
+
- Competitors I've mentioned
|
|
75
|
+
- How I position against them
|
|
76
|
+
- What they do well
|
|
77
|
+
- Where they fall short
|
|
78
|
+
|
|
79
|
+
Only include things you're confident about from our conversations. Skip any category where you don't have information. Be specific — use real names, numbers, and examples from our chats.`;function Px({onComplete:e,onSkip:i}){const[n,l]=E.useState(!1),[o,c]=E.useState(""),[d,_]=E.useState(!1),[g,f]=E.useState(null),[x,v]=E.useState(!1);function b(){navigator.clipboard.writeText(Wx),l(!0),setTimeout(()=>l(!1),2e3)}async function w(){if(o.trim().length<50){f("This doesn't look like a full response. Try pasting the complete reply.");return}_(!0),f(null);try{const S=await fetch("/api/brain/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:o})}),R=await S.json();if(!S.ok){f(R.error),_(!1);return}v(!0),setTimeout(()=>e(o),1500)}catch{f("Import failed. Try again.")}_(!1)}return x?p.jsxs("div",{style:{textAlign:"center",padding:"40px 0"},children:[p.jsx("div",{style:{fontSize:"48px",marginBottom:"16px"},children:"✓"}),p.jsx("p",{style:{fontSize:"16px",fontWeight:600,color:"#16a34a"},children:"Imported successfully"})]}):p.jsxs("div",{children:[p.jsx("h3",{style:{fontSize:"18px",fontWeight:700,color:"var(--text-primary)",marginBottom:"4px"},children:"Import from ChatGPT"}),p.jsx("p",{style:{fontSize:"13px",color:"var(--text-secondary)",marginBottom:"20px"},children:"Copy this prompt, paste it into ChatGPT or Claude, then paste the response below."}),p.jsxs("div",{style:{padding:"12px 16px",borderRadius:"10px",background:"rgba(94,23,235,0.04)",border:"1px solid rgba(94,23,235,0.1)",marginBottom:"20px",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[p.jsx("span",{style:{fontSize:"13px",color:"var(--text-primary)",fontWeight:500},children:"Step 1: Copy this prompt →"}),p.jsx("button",{onClick:b,style:{padding:"6px 14px",borderRadius:"8px",background:n?"#16a34a":"#5e17eb",color:"#fff",fontSize:"12px",fontWeight:600,border:"none",cursor:"pointer"},children:n?"Copied!":"Copy Prompt"})]}),p.jsx("div",{style:{marginBottom:"8px",fontSize:"13px",color:"var(--text-primary)",fontWeight:500},children:"Step 2: Paste the response here"}),p.jsx("textarea",{value:o,onChange:S=>{c(S.target.value),f(null)},rows:8,placeholder:"Paste ChatGPT's response here...",style:{width:"100%",padding:"12px 16px",borderRadius:"10px",border:"1px solid #e5e7eb",fontSize:"13px",resize:"vertical",outline:"none",fontFamily:"inherit",color:"var(--text-primary)",background:"var(--bg-secondary)"}}),g&&p.jsx("p",{style:{fontSize:"13px",color:"#ef4444",marginTop:"8px"},children:g}),p.jsx("button",{onClick:w,disabled:d||o.length<50,style:{marginTop:"16px",padding:"12px 24px",background:"#5e17eb",color:"#fff",borderRadius:"10px",border:"none",fontSize:"14px",fontWeight:600,cursor:d||o.length<50?"not-allowed":"pointer",opacity:d||o.length<50?.5:1},children:d?"Importing...":"Import →"}),p.jsx("button",{onClick:i,style:{display:"block",marginTop:"16px",background:"none",border:"none",color:"#9ca3af",fontSize:"13px",cursor:"pointer"},children:"Skip this step →"})]})}const qx=[".pdf",".docx",".txt",".md",".csv"],Ix=10*1024*1024,Kx=50*1024*1024;function $x({onComplete:e,onSkip:i}){const[n,l]=E.useState([]),[o,c]=E.useState(!1),[d,_]=E.useState(!1),g=E.useRef(null),f=E.useRef(new Map);function x(A){const W=[];let C=n.reduce((O,G)=>O+G.size,0);for(const O of Array.from(A)){const G="."+O.name.split(".").pop()?.toLowerCase();if(!qx.includes(G)){W.push({name:O.name,size:O.size,status:"error",error:`Unsupported file type: ${G}`});continue}if(O.size>Ix){W.push({name:O.name,size:O.size,status:"error",error:"File too large (max 10MB)"});continue}if(C+=O.size,C>Kx){W.push({name:O.name,size:O.size,status:"error",error:"Total upload limit exceeded (50MB)"});continue}f.current.set(O.name,O),W.push({name:O.name,size:O.size,status:"pending"})}l(O=>[...O,...W])}function v(A){A.preventDefault(),_(!1),A.dataTransfer.files.length>0&&x(A.dataTransfer.files)}function b(A){A.target.files&&x(A.target.files)}function w(A){l(W=>W.filter(j=>j.name!==A)),f.current.delete(A)}async function S(){c(!0);let A=!1;for(let W=0;W<n.length;W++){const j=n[W];if(j.status==="pending"){l(C=>C.map((O,G)=>G===W?{...O,status:"uploading"}:O));try{const C=f.current.get(j.name);if(!C){l(Z=>Z.map((ae,pe)=>pe===W?{...ae,status:"error",error:"File not found"}:ae));continue}const O=await C.arrayBuffer(),G=await fetch("/api/brain/documents",{method:"POST",headers:{"Content-Type":"application/octet-stream","X-Filename":j.name},body:O});if(G.ok){const Z=await G.json();l(ae=>ae.map((pe,Oe)=>Oe===W?{...pe,status:"done",message:Z.message||"Saved"}:pe)),A=!0}else{const Z=await G.json();l(ae=>ae.map((pe,Oe)=>Oe===W?{...pe,status:"error",error:Z.error}:pe))}}catch{l(C=>C.map((O,G)=>G===W?{...O,status:"error",error:"Upload failed"}:O))}}}c(!1),A&&e()}const R=n.filter(A=>A.status==="pending").length,z=A=>A<1024?`${A}B`:A<1048576?`${Math.round(A/1024)}KB`:`${(A/1048576).toFixed(1)}MB`;return p.jsxs("div",{children:[p.jsx("h3",{style:{fontSize:"18px",fontWeight:700,color:"var(--text-primary)",marginBottom:"4px"},children:"Drop business documents"}),p.jsx("p",{style:{fontSize:"13px",color:"var(--text-secondary)",marginBottom:"20px"},children:"Proposals, brand guides, competitor research, financial reports — anything about your business."}),p.jsxs("div",{onDragOver:A=>{A.preventDefault(),_(!0)},onDragLeave:()=>_(!1),onDrop:v,onClick:()=>g.current?.click(),style:{border:`2px dashed ${d?"#5e17eb":"#d1d5db"}`,borderRadius:"12px",padding:"32px",textAlign:"center",cursor:"pointer",transition:"all 0.15s",background:d?"rgba(94,23,235,0.04)":"transparent"},children:[p.jsx("div",{style:{fontSize:"32px",marginBottom:"8px"},children:"📄"}),p.jsx("p",{style:{fontSize:"14px",color:"var(--text-primary)",fontWeight:500},children:"Drop files here or click to browse"}),p.jsx("p",{style:{fontSize:"12px",color:"#9ca3af",marginTop:"4px"},children:"PDF, DOCX, TXT, MD, CSV — max 10MB each"})]}),p.jsx("input",{ref:g,type:"file",multiple:!0,accept:".pdf,.docx,.txt,.md,.csv",onChange:b,style:{display:"none"}}),n.length>0&&p.jsx("div",{style:{marginTop:"16px",display:"flex",flexDirection:"column",gap:"6px"},children:n.map((A,W)=>p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 12px",borderRadius:"8px",background:"#fafafa"},children:[p.jsx("span",{style:{fontSize:"12px",color:A.status==="done"?"#16a34a":A.status==="error"?"#ef4444":A.status==="uploading"?"#f59e0b":"#9ca3af"},children:A.status==="done"?"✓":A.status==="error"?"✗":A.status==="uploading"?"⏳":"○"}),p.jsx("span",{style:{flex:1,fontSize:"13px",color:"var(--text-primary)"},children:A.name}),p.jsx("span",{style:{fontSize:"11px",color:"#9ca3af"},children:z(A.size)}),A.status==="pending"&&p.jsx("button",{onClick:j=>{j.stopPropagation(),w(A.name)},style:{background:"none",border:"none",color:"#d1d5db",cursor:"pointer",fontSize:"14px"},children:"×"}),A.status==="done"&&A.message&&p.jsx("span",{style:{fontSize:"11px",color:"#16a34a"},children:A.message}),A.status==="error"&&A.error&&p.jsx("span",{style:{fontSize:"11px",color:"#ef4444"},children:A.error})]},W))}),p.jsxs("div",{style:{display:"flex",gap:"12px",marginTop:"20px"},children:[R>0&&p.jsx("button",{onClick:S,disabled:o,style:{padding:"12px 24px",background:"#5e17eb",color:"#fff",borderRadius:"10px",border:"none",fontSize:"14px",fontWeight:600,cursor:o?"not-allowed":"pointer",opacity:o?.6:1},children:o?"Processing...":`Process ${R} document${R!==1?"s":""} →`}),R===0&&n.length>0&&p.jsx("button",{onClick:e,style:{padding:"12px 24px",background:"#5e17eb",color:"#fff",borderRadius:"10px",border:"none",fontSize:"14px",fontWeight:600,cursor:"pointer"},children:"Continue →"})]}),p.jsx("button",{onClick:i,style:{display:"block",marginTop:"16px",background:"none",border:"none",color:"#9ca3af",fontSize:"13px",cursor:"pointer"},children:"Skip this step →"})]})}const jm=[{label:"CRM",tools:["HubSpot","Salesforce","Pipedrive","Zoho CRM","Monday CRM","Close"]},{label:"Accounting",tools:["Xero","QuickBooks","MYOB","FreshBooks","Wave"]},{label:"Email Marketing",tools:["Mailchimp","ConvertKit","ActiveCampaign","Klaviyo","MailerLite","Resend"]},{label:"Scheduling",tools:["Calendly","Cal.com","Acuity","TidyCal"]},{label:"Social Media",tools:["Later","Buffer","Postiz","Hootsuite","Metricool"]},{label:"Project Management",tools:["Notion","Asana","Trello","ClickUp","Monday","Linear"]},{label:"Communication",tools:["Slack","Microsoft Teams","Discord","Google Chat"]},{label:"Website / Hosting",tools:["WordPress","Shopify","Squarespace","Wix","Webflow","Vercel"]},{label:"Payments",tools:["Stripe","PayPal","Square","Gumroad","Lemon Squeezy"]},{label:"Storage / Files",tools:["Google Drive","Dropbox","OneDrive","Notion"]}],b_=jm.flatMap(e=>e.tools);function Yx({onComplete:e,onSkip:i}){const[n,l]=E.useState(new Set),[o,c]=E.useState(""),[d,_]=E.useState([]);E.useEffect(()=>{fetch("/api/brain-fields?category=business&field=Tools").then(v=>v.json()).then(v=>{if(v.value){const b=v.value.split(",").map(R=>R.trim()).filter(Boolean);new Set(b_.map(R=>R.toLowerCase()));const w=new Set,S=[];for(const R of b){const z=b_.find(A=>A.toLowerCase()===R.toLowerCase());z?w.add(z):(w.add(R),S.push(R))}l(w),_(S)}}).catch(()=>{})},[]);function g(v){l(b=>{const w=new Set(b);return w.has(v)?w.delete(v):w.add(v),w})}function f(){const v=o.trim();v&&(n.has(v)||(l(b=>new Set(b).add(v)),_(b=>[...b,v])),c(""))}function x(){e(Array.from(n))}return p.jsxs("div",{children:[p.jsx("h3",{style:{fontSize:"18px",fontWeight:700,color:"var(--text-primary)",marginBottom:"4px"},children:"What tools does your business use?"}),p.jsx("p",{style:{fontSize:"13px",color:"var(--text-secondary)",marginBottom:"24px"},children:"Select the tools you use — we'll recommend the right AI connections for your workflow."}),p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[jm.map(v=>p.jsxs("div",{children:[p.jsx("div",{style:{fontSize:"11px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em",color:"#9ca3af",marginBottom:"8px"},children:v.label}),p.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:v.tools.map(b=>{const w=n.has(b);return p.jsxs("button",{onClick:()=>g(b),style:{padding:"6px 14px",borderRadius:"20px",fontSize:"13px",fontWeight:500,cursor:"pointer",border:w?"1px solid #5e17eb":"1px solid #e5e7eb",background:w?"rgba(94,23,235,0.08)":"#fff",color:w?"#5e17eb":"#374151",transition:"all 0.15s"},children:[w?"✓ ":"",b]},b)})})]},v.label)),d.length>0&&p.jsxs("div",{children:[p.jsx("div",{style:{fontSize:"11px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em",color:"#9ca3af",marginBottom:"8px"},children:"Your tools"}),p.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:d.map(v=>p.jsxs("button",{onClick:()=>g(v),style:{padding:"6px 14px",borderRadius:"20px",fontSize:"13px",fontWeight:500,cursor:"pointer",border:n.has(v)?"1px solid #5e17eb":"1px solid #e5e7eb",background:n.has(v)?"rgba(94,23,235,0.08)":"#fff",color:n.has(v)?"#5e17eb":"#374151",transition:"all 0.15s"},children:[n.has(v)?"✓ ":"",v]},v))})]}),p.jsxs("div",{style:{display:"flex",gap:"8px"},children:[p.jsx("input",{value:o,onChange:v=>c(v.target.value),onKeyDown:v=>{v.key==="Enter"&&f()},placeholder:"Other tool not listed...",style:{flex:1,padding:"8px 14px",fontSize:"13px",borderRadius:"10px",border:"1px solid #e5e7eb",outline:"none",color:"var(--text-primary)",background:"#fff"}}),p.jsx("button",{onClick:f,style:{padding:"8px 16px",background:"#f3f4f6",color:"#374151",fontSize:"13px",fontWeight:600,borderRadius:"10px",border:"1px solid #e5e7eb",cursor:"pointer"},children:"Add"})]})]}),p.jsx("div",{style:{marginTop:"24px",display:"flex",gap:"12px",alignItems:"center"},children:p.jsx("button",{onClick:x,style:{padding:"12px 24px",background:"#5e17eb",color:"#fff",borderRadius:"10px",border:"none",fontSize:"14px",fontWeight:600,cursor:"pointer"},children:n.size>0?`Save ${n.size} tool${n.size!==1?"s":""} & Continue`:"Continue"})}),p.jsx("button",{onClick:i,style:{display:"block",marginTop:"16px",background:"none",border:"none",color:"#9ca3af",fontSize:"13px",cursor:"pointer"},children:"Skip this step →"})]})}function Lm({onDone:e}){const[i,n]=E.useState("website"),[l,o]=E.useState({website:"active",import:"pending",documents:"pending",tools:"pending",summary:"pending"}),[c,d]=E.useState(null);E.useEffect(()=>{_()},[]);async function _(){try{const O=await(await fetch("/api/brain-status")).json();d(O)}catch{}}function g(C){n(C),o(O=>({...O,[C]:"active"}))}async function f(C){const O={};C.businessName&&(O.Name=String(C.businessName)),C.businessTypeLabel&&(O["Type Label"]=String(C.businessTypeLabel)),C.businessType&&(O.Type=String(C.businessType)),C.description&&(O.Description=String(C.description)),C.location&&(O.Location=String(C.location)),C.website&&(O.Website=String(C.website)),C.priceRange&&(O.Pricing=String(C.priceRange)),C.emailListDetected&&(O["Email List Detected"]=C.emailListDetected?"Yes":"No"),C.socialProfiles&&Object.keys(C.socialProfiles).length>0&&(O["Social Profiles"]=Object.keys(C.socialProfiles).join(", ")),await fetch("/api/brain/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({category:"business",fields:O})}),o(G=>({...G,website:"completed"})),await _(),g("import")}function x(){o(C=>({...C,website:"skipped"})),g("import")}async function v(C){await fetch("/api/brain/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:C})}),o(O=>({...O,import:"completed"})),await _(),g("documents")}function b(){o(C=>({...C,import:"skipped"})),g("documents")}function w(){o(C=>({...C,documents:"completed"})),g("tools"),_()}function S(){o(C=>({...C,documents:"skipped"})),g("tools"),_()}async function R(C){C.length>0&&await fetch("/api/brain/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({category:"business",fields:{Tools:C.join(", ")}})}),o(O=>({...O,tools:"completed"})),await _(),g("summary")}function z(){o(C=>({...C,tools:"skipped"})),g("summary"),_()}const A=[{key:"website",label:"Website",emoji:"🔗"},{key:"import",label:"ChatGPT Export",emoji:"🤖"},{key:"documents",label:"Documents",emoji:"📄"},{key:"tools",label:"Your Tools",emoji:"🔧"}],W=C=>C==="completed"?"✓":C==="skipped"?"○":C==="active"?"●":"○",j=C=>C==="completed"?"#16a34a":C==="active"?"#5e17eb":"#d1d5db";return p.jsxs("div",{style:{display:"flex",gap:"32px",minHeight:"400px",maxHeight:"80vh",overflow:"hidden"},children:[p.jsxs("div",{style:{width:"200px",flexShrink:0,overflowY:"auto"},children:[p.jsx("button",{onClick:e,style:{display:"flex",alignItems:"center",gap:"6px",background:"none",border:"none",cursor:"pointer",color:"#9ca3af",fontSize:"13px",fontWeight:500,marginBottom:"16px",padding:"0"},children:"← Back to home"}),p.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:A.map(C=>p.jsxs("button",{onClick:()=>n(C.key),style:{display:"flex",alignItems:"center",gap:"10px",padding:"12px 14px",borderRadius:"10px",background:i===C.key?"rgba(94,23,235,0.06)":"transparent",border:i===C.key?"1px solid rgba(94,23,235,0.15)":"1px solid transparent",cursor:"pointer",textAlign:"left",width:"100%"},children:[p.jsx("span",{style:{color:j(l[C.key]),fontSize:"14px",fontWeight:700},children:W(l[C.key])}),p.jsxs("span",{style:{fontSize:"13px",fontWeight:600,color:"var(--text-primary)"},children:[C.emoji," ",C.label]})]},C.key))}),p.jsxs("div",{style:{marginTop:"24px",padding:"16px",borderRadius:"12px",background:"rgba(94,23,235,0.04)",border:"1px solid rgba(94,23,235,0.1)"},children:[p.jsxs("div",{style:{fontSize:"28px",fontWeight:800,color:"#5e17eb",textAlign:"center"},children:[c?.completeness??0,"%"]}),p.jsx("div",{style:{fontSize:"11px",color:"#9ca3af",textAlign:"center",marginTop:"2px"},children:"Brain filled"}),p.jsx("div",{style:{background:"#e5e7eb",height:"6px",borderRadius:"3px",marginTop:"8px",overflow:"hidden"},children:p.jsx("div",{style:{background:"#5e17eb",height:"6px",borderRadius:"3px",width:`${c?.completeness??0}%`,transition:"width 0.5s"}})})]}),p.jsx("button",{onClick:e,style:{display:"block",width:"100%",marginTop:"16px",background:"none",border:"none",color:"#9ca3af",fontSize:"12px",cursor:"pointer"},children:"Skip for now →"})]}),p.jsxs("div",{style:{flex:1,overflowY:"auto"},children:[i==="website"&&p.jsx(Ux,{onComplete:f,onSkip:x}),i==="import"&&p.jsx(Px,{onComplete:v,onSkip:b}),i==="documents"&&p.jsx($x,{onComplete:w,onSkip:S}),i==="tools"&&p.jsx(Yx,{onComplete:R,onSkip:z}),i==="summary"&&p.jsxs("div",{children:[p.jsxs("h3",{style:{fontSize:"18px",fontWeight:700,color:"var(--text-primary)",marginBottom:"8px"},children:[c?.businessName?`${c.businessName} — `:"","Brain is ",c?.completeness??0,"% complete"]}),p.jsx("p",{style:{fontSize:"13px",color:"var(--text-secondary)",marginBottom:"24px"},children:"You can add more anytime from the sidebar."}),c?.categories&&Object.entries(c.categories).map(([C,O])=>p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"10px"},children:[p.jsxs("span",{style:{width:"100px",fontSize:"13px",fontWeight:600,color:"var(--text-primary)"},children:[C==="business"?"🏢":C==="industry"?"📊":C==="voice"?"🎙️":"🎯"," ",C.charAt(0).toUpperCase()+C.slice(1)]}),p.jsx("div",{style:{flex:1,background:"#e5e7eb",height:"8px",borderRadius:"4px",overflow:"hidden"},children:p.jsx("div",{style:{background:"#5e17eb",height:"8px",borderRadius:"4px",width:`${O.percent}%`,transition:"width 0.5s"}})}),p.jsxs("span",{style:{fontSize:"12px",color:"#9ca3af",width:"35px",textAlign:"right"},children:[O.percent,"%"]})]},C)),p.jsx("button",{onClick:e,style:{width:"100%",marginTop:"24px",padding:"16px",background:"linear-gradient(135deg, #5e17eb, #8b5cf6)",color:"#fff",borderRadius:"12px",fontSize:"16px",fontWeight:700,border:"none",cursor:"pointer",boxShadow:"0 4px 12px rgba(94,23,235,0.3)"},children:"Done — Start working →"})]})]})]})}function Fx({onProjectSelected:e}){const[i,n]=E.useState("detect"),[l,o]=E.useState([]),[c,d]=E.useState(!1),{setMode:_}=Et(),[g,f]=E.useState("developer");function x(v){f(v),_(v),n(v==="brain"?"brain":"project")}return p.jsxs(p.Fragment,{children:[c&&p.jsx(Om,{onClose:()=>d(!1)}),p.jsxs("div",{style:{height:"100%",background:"var(--bg-primary)",overflowY:"auto"},children:[p.jsxs("div",{className:"animate-in",style:{display:i==="brain"?"none":void 0,maxWidth:"600px",margin:"0 auto",padding:"60px 32px"},children:[p.jsxs("div",{style:{marginBottom:"80px",textAlign:"center"},children:[p.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:"16px",marginBottom:"12px"},children:[p.jsx("div",{style:{width:"48px",height:"48px",borderRadius:"14px",background:"linear-gradient(135deg, #5e17eb, #8b5cf6)",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 12px rgba(94,23,235,0.3)"},children:p.jsx("span",{style:{color:"white",fontSize:"24px",fontWeight:700},children:"C"})}),p.jsx("h1",{style:{fontSize:"40px",fontWeight:800,color:"var(--text-primary)",letterSpacing:"-0.02em"},children:"Claude Portal"})]}),p.jsx("p",{style:{color:"var(--text-secondary)",fontSize:"20px"},children:"Get more done with AI"})]}),i==="detect"&&p.jsx(jx,{onAllReady:()=>n("mode"),onNeedInstall:v=>{o(v),n("install")}}),i==="install"&&p.jsx(Nx,{tools:l,onDone:()=>n("mode")}),i==="mode"&&p.jsxs("div",{className:"animate-in",children:[p.jsx("div",{style:{textAlign:"center",marginBottom:"40px"},children:p.jsx("button",{onClick:()=>d(!0),style:{padding:"14px 28px",borderRadius:"14px",background:"linear-gradient(135deg, rgba(94,23,235,0.08), rgba(139,92,246,0.08))",border:"1px solid rgba(94,23,235,0.2)",color:"#8b5cf6",fontSize:"15px",fontWeight:600,cursor:"pointer",transition:"all 0.2s",display:"inline-flex",alignItems:"center",gap:"8px"},children:"▶ How it works"})}),p.jsx("h2",{style:{fontSize:"28px",fontWeight:700,color:"var(--text-primary)",marginBottom:"8px",textAlign:"center"},children:"How can we help?"}),p.jsx("p",{style:{color:"var(--text-secondary)",fontSize:"17px",marginBottom:"48px",textAlign:"center"},children:"Choose how you'd like to work today"}),p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"24px"},children:[p.jsxs("button",{onClick:()=>x("brain"),className:"group transition-all duration-300 hover:-translate-y-1 active:scale-[0.98]",style:{width:"100%",padding:"40px",background:"var(--bg-secondary)",borderRadius:"24px",textAlign:"left",border:"2px solid #5e17eb",boxShadow:"0 8px 24px rgba(94,23,235,0.12)",cursor:"pointer",position:"relative"},children:[p.jsx("div",{style:{position:"absolute",top:"16px",right:"16px",background:"#5e17eb",color:"white",fontSize:"11px",fontWeight:700,padding:"4px 12px",borderRadius:"20px",letterSpacing:"0.02em"},children:"Start Here"}),p.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"24px"},children:[p.jsx("div",{style:{width:"64px",height:"64px",borderRadius:"16px",background:"linear-gradient(135deg, #5e17eb, #8b5cf6)",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 12px rgba(94,23,235,0.3)",flexShrink:0,fontSize:"32px"},children:"🧠"}),p.jsxs("div",{children:[p.jsx("div",{style:{color:"var(--text-primary)",fontSize:"22px",fontWeight:700,marginBottom:"8px"},children:"Teach AI your business"}),p.jsx("div",{style:{color:"var(--text-secondary)",fontSize:"16px",lineHeight:1.6},children:"Set up once. Every AI session knows your business — name, pricing, audience, voice."})]})]})]}),p.jsx("button",{onClick:()=>x("developer"),className:"group transition-all duration-300 hover:-translate-y-1 active:scale-[0.98]",style:{width:"100%",padding:"40px",background:"var(--bg-secondary)",borderRadius:"24px",textAlign:"left",border:"1px solid var(--border)",boxShadow:"0 8px 24px rgba(0,0,0,0.08)",cursor:"pointer"},children:p.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"24px"},children:[p.jsx("div",{style:{width:"64px",height:"64px",borderRadius:"16px",background:"linear-gradient(135deg, #5e17eb, #8b5cf6)",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 12px rgba(94,23,235,0.3)",flexShrink:0,fontSize:"32px"},children:"🔨"}),p.jsxs("div",{children:[p.jsx("div",{style:{color:"var(--text-primary)",fontSize:"22px",fontWeight:700,marginBottom:"8px"},children:"Build or improve a project"}),p.jsx("div",{style:{color:"var(--text-secondary)",fontSize:"16px",lineHeight:1.6},children:"Create new features, fix bugs, and get guided checklists to ship with confidence."})]})]})}),p.jsx("button",{onClick:()=>x("document"),className:"group transition-all duration-300 hover:-translate-y-1 active:scale-[0.98]",style:{width:"100%",padding:"40px",background:"var(--bg-secondary)",borderRadius:"24px",textAlign:"left",border:"1px solid var(--border)",boxShadow:"0 8px 24px rgba(0,0,0,0.08)",cursor:"pointer"},children:p.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"24px"},children:[p.jsx("div",{style:{width:"64px",height:"64px",borderRadius:"16px",background:"linear-gradient(135deg, #ffdd27, #ffc107)",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 12px rgba(255,221,39,0.3)",flexShrink:0,fontSize:"32px"},children:"📄"}),p.jsxs("div",{children:[p.jsx("div",{style:{color:"var(--text-primary)",fontSize:"22px",fontWeight:700,marginBottom:"8px"},children:"Make your work faster"}),p.jsx("div",{style:{color:"var(--text-secondary)",fontSize:"16px",lineHeight:1.6},children:"Point AI at your documents and get summaries, reports, and analysis — no coding needed."})]})]})})]})]}),i==="project"&&p.jsx(Hx,{onProjectSelected:e,mode:g})]}),i==="brain"&&p.jsx("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",padding:"32px",overflowY:"auto"},children:p.jsx("div",{style:{width:"100%",maxWidth:"800px"},children:p.jsx(Lm,{onDone:()=>n("mode")})})})]})]})}function w_(){const{path:e,gitBranch:i,terminalConnected:n,clearProject:l,mode:o,setMode:c}=Et(),d=o==="document",_=g=>({padding:"10px 20px",borderRadius:"10px",fontSize:"14px",fontWeight:500,border:"none",cursor:"pointer",transition:"all 0.2s",background:g?"white":"transparent",color:g?o==="document"?"#5856d6":"#1d1d1f":"#86868b",boxShadow:g?"0 1px 3px rgba(0,0,0,0.1)":"none"});return p.jsxs("div",{style:{height:"56px",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 24px",borderBottom:"1px solid #e5e7eb",background:"rgba(255,255,255,0.9)",backdropFilter:"blur(20px)",flexShrink:0,transition:"background 0.2s, border-color 0.2s"},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"16px"},children:[d?p.jsx("div",{style:{width:"32px",height:"32px",borderRadius:"10px",background:"linear-gradient(135deg, #5856d6, #af52de)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",fontSize:"15px",fontWeight:700},children:"C"}):p.jsx("div",{style:{width:"12px",height:"12px",borderRadius:"50%",background:"#30d158",boxShadow:"0 0 10px rgba(48,209,88,0.4)"}}),p.jsx("span",{style:{fontFamily:"'SF Mono', Menlo, monospace",fontSize:"13px",color:"#86868b",maxWidth:"200px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e?.split("/").filter(Boolean).pop()||e})]}),p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"20px"},children:[p.jsxs("div",{style:{display:"flex",borderRadius:"12px",padding:"3px",gap:"2px",background:o==="agents"?"rgba(139,92,246,0.08)":d?"rgba(0,0,0,0.04)":"rgba(255,255,255,0.06)"},children:[p.jsx("button",{onClick:()=>c("developer"),style:_(o==="developer"),children:"🔨 Build"}),p.jsx("button",{onClick:()=>c("document"),style:_(o==="document"),children:"📄 Documents"}),p.jsx("button",{onClick:()=>c("agents"),style:{..._(o==="agents"),background:o==="agents"?"#8b5cf6":"transparent",color:o==="agents"?"#fff":"#86868b"},children:"🤖 Agents"})]}),i&&p.jsx("span",{style:{fontSize:"12px",fontFamily:"'SF Mono', Menlo, monospace",color:"#86868b"},children:i}),p.jsx("div",{style:{width:"10px",height:"10px",borderRadius:"50%",background:n?"#30d158":"#ff453a",boxShadow:n?"0 0 6px rgba(48,209,88,0.4)":"none"}}),p.jsx("button",{onClick:l,style:{padding:"8px 16px",borderRadius:"8px",fontSize:"14px",fontWeight:500,border:"none",cursor:"pointer",color:"#86868b",background:"transparent",transition:"all 0.2s"},className:d?"hover:bg-black/[0.04]":"hover:bg-white/[0.06]",children:"Switch"})]})]})}function Gx(){const{serverConnected:e}=Et();return e?null:p.jsxs("div",{className:"px-4 py-2 bg-red-500/10 border-b border-red-500/20 text-red-400 text-sm text-center shrink-0",children:["Server connection lost. Restart with ",p.jsx("code",{className:"mx-1 font-mono",children:"npm run dev"})]})}function Xx({open:e,onToggle:i}){const{mode:n}=Et(),l=n==="document";return p.jsx("div",{style:{width:"52px",display:"flex",flexDirection:"column",alignItems:"center",paddingTop:"20px",borderRight:"1px solid #e5e7eb",background:"#fafafa",flexShrink:0,transition:"background 0.2s"},children:p.jsx("button",{onClick:i,title:"Toggle sidebar",style:{width:"36px",height:"36px",borderRadius:"10px",display:"flex",alignItems:"center",justifyContent:"center",border:"none",cursor:"pointer",transition:"all 0.2s",background:e?l?"rgba(88,86,214,0.1)":"rgba(48,209,88,0.1)":"transparent",color:e?l?"#5856d6":"#30d158":"#86868b"},className:"active:scale-90",children:p.jsx("svg",{width:"18",height:"18",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",children:p.jsx("path",{d:"M2 4h12M2 8h12M2 12h12"})})})})}const Vx={business:{emoji:"🏢",label:"Business"},industry:{emoji:"📊",label:"Industry"},voice:{emoji:"🎙️",label:"Voice"},competitors:{emoji:"🎯",label:"Competitors"}};function Iu(){const{setEditingBrain:e}=Et(),[i,n]=E.useState(null),[l,o]=E.useState(!0),[c,d]=E.useState(!1);return E.useEffect(()=>{fetch("/api/brain-status").then(_=>_.json()).then(_=>{n(_),o(!1)}).catch(()=>o(!1))},[]),l?null:p.jsxs("div",{style:{borderBottom:"1px solid #e5e7eb"},children:[p.jsxs("button",{onClick:()=>d(!c),style:{width:"100%",padding:"16px 20px",display:"flex",alignItems:"center",justifyContent:"space-between",background:"none",border:"none",cursor:"pointer"},children:[p.jsxs("span",{style:{fontWeight:600,fontSize:"14px",color:"#374151",display:"flex",alignItems:"center",gap:"6px"},children:[p.jsx("span",{style:{fontSize:"10px",color:"#9ca3af",transform:c?"rotate(0deg)":"rotate(90deg)",transition:"transform 0.15s",display:"inline-block"},children:"▶"}),"🧠"," ",i?.businessName||"Business Brain"]}),i?.exists?p.jsxs("span",{style:{background:i.completeness>=70?"#dcfce7":"#f3e8ff",color:i.completeness>=70?"#16a34a":"#7c3aed",fontSize:"12px",padding:"3px 10px",borderRadius:"12px",fontWeight:600},children:[i.completeness,"%"]}):p.jsx("span",{style:{background:"#f3f4f6",color:"#9ca3af",fontSize:"12px",padding:"3px 10px",borderRadius:"12px",fontWeight:600},children:"Not set up"})]}),!c&&i?.exists&&i.categories&&p.jsxs("div",{style:{padding:"0 20px 16px"},children:[Object.entries(i.categories).map(([_,g])=>{const f=Vx[_];return f?p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},children:[p.jsxs("span",{style:{fontSize:"12px",width:"90px",display:"flex",alignItems:"center",gap:"4px"},children:[p.jsx("span",{children:f.emoji}),p.jsx("span",{style:{fontWeight:500,color:"#374151"},children:f.label})]}),p.jsx("div",{style:{flex:1,background:"#e5e7eb",height:"6px",borderRadius:"3px",overflow:"hidden"},children:p.jsx("div",{style:{background:g.percent>=70?"#16a34a":"#5e17eb",height:"6px",borderRadius:"3px",width:`${g.percent}%`,transition:"width 0.5s"}})}),p.jsxs("span",{style:{fontSize:"11px",color:"#9ca3af",width:"30px",textAlign:"right"},children:[g.percent,"%"]})]},_):null}),p.jsxs("button",{onClick:()=>e(!0),style:{marginTop:"4px",padding:"6px 14px",borderRadius:"8px",border:"1px solid rgba(94,23,235,0.2)",background:"rgba(94,23,235,0.04)",color:"#5e17eb",fontSize:"12px",fontWeight:600,cursor:"pointer",width:"100%"},children:["Edit Brain ","→"]})]}),!c&&!i?.exists&&p.jsxs("div",{style:{padding:"0 20px 16px"},children:[p.jsx("p",{style:{fontSize:"12px",color:"#9ca3af",marginBottom:"8px"},children:"Set up your Business Brain to give AI your business context automatically."}),p.jsxs("button",{onClick:()=>e(!0),style:{padding:"6px 14px",borderRadius:"8px",border:"1px solid rgba(94,23,235,0.2)",background:"rgba(94,23,235,0.04)",color:"#5e17eb",fontSize:"12px",fontWeight:600,cursor:"pointer",width:"100%"},children:["Set up Brain ","→"]})]})]})}function Zx(e){const{path:i,setServerConnected:n}=Et(),l=E.useRef(e);l.current=e;const o=E.useRef(new Map),c=E.useCallback((d,_)=>{const g=o.current.get(d);g&&clearTimeout(g),o.current.set(d,setTimeout(()=>{l.current(d,_),o.current.delete(d)},400))},[]);E.useEffect(()=>{if(!i)return;const d=`/api/events?projectPath=${encodeURIComponent(i)}`,_=new EventSource(d);return _.addEventListener("health-changed",g=>c("health-changed",JSON.parse(g.data))),_.addEventListener("plan-changed",g=>c("plan-changed",JSON.parse(g.data))),_.addEventListener("push-detected",g=>c("push-detected",JSON.parse(g.data))),_.onopen=()=>n(!0),_.onerror=()=>n(!1),()=>{_.close();for(const g of o.current.values())clearTimeout(g);o.current.clear()}},[i,c,n])}function Qx(){const{path:e}=Et(),[i,n]=E.useState([]),[l,o]=E.useState(!1),c=E.useCallback(async()=>{if(!e)return;o(!0);const d=await gi(Am("/api/health-scan",e));d&&n(d.checks),o(!1)},[e]);return E.useEffect(()=>{c()},[c]),Zx(d=>{d==="health-changed"&&c()}),{checks:i,loading:l,failCount:i.filter(d=>d.status==="fail").length,passCount:i.filter(d=>d.status==="pass").length,rescan:c}}function Jx({label:e,description:i,status:n,fixPrompt:l}){const{sendPrompt:o}=en(),[c,d]=E.useState(!1);if(n==="pass")return null;const _=()=>{!l||c||(o(l),d(!0),setTimeout(()=>d(!1),3e3))};return p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"10px 16px",borderRadius:"8px",transition:"background 0.15s"},children:[p.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",background:"#f59e0b",flexShrink:0}}),p.jsxs("div",{style:{flex:1},children:[p.jsxs("div",{style:{fontSize:"13px",color:"#374151"},children:[e," missing"]}),i&&p.jsx("div",{style:{fontSize:"11px",color:"#9ca3af",marginTop:"1px"},children:i})]}),l&&p.jsx("button",{onClick:_,style:{padding:"6px 14px",background:"#dcfce7",color:"#16a34a",fontSize:"12px",borderRadius:"8px",fontWeight:600,border:c?"1px solid #86efac":"none",cursor:c?"default":"pointer",flexShrink:0,transition:"all 0.15s"},children:c?"✓ Sent":"Fix →"})]})}function eS(){const{checks:e,loading:i,failCount:n,passCount:l}=Qx(),[o,c]=E.useState(!1);return p.jsxs("div",{style:{borderBottom:"1px solid #e5e7eb"},children:[p.jsxs("button",{onClick:()=>c(!o),style:{width:"100%",padding:"16px 20px",display:"flex",alignItems:"center",justifyContent:"space-between",background:"none",border:"none",cursor:"pointer",transition:"background 0.15s"},children:[p.jsxs("span",{style:{fontWeight:600,fontSize:"14px",color:"#374151",display:"flex",alignItems:"center",gap:"6px"},children:[p.jsx("span",{style:{fontSize:"10px",color:"#9ca3af",transform:o?"rotate(0deg)":"rotate(90deg)",transition:"transform 0.15s",display:"inline-block"},children:"▶"}),"Project Health"]}),i?p.jsx("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:p.jsx("span",{style:{fontSize:"12px",color:"#9ca3af"},children:"scanning..."})}):n>0?p.jsxs("span",{style:{background:"#fef3c7",color:"#d97706",fontSize:"12px",padding:"3px 10px",borderRadius:"12px",fontWeight:600},children:[n," issue",n!==1?"s":""]}):p.jsx("span",{style:{background:"#dcfce7",color:"#16a34a",fontSize:"12px",padding:"3px 10px",borderRadius:"12px",fontWeight:600},children:"all good"})]}),!o&&p.jsxs("div",{style:{padding:"0 12px 16px",display:"flex",flexDirection:"column",gap:"2px"},children:[e.filter(d=>d.status==="fail").map(d=>p.jsx(Jx,{label:d.label,description:d.description,status:d.status,fixPrompt:d.fixPrompt},d.id)),l>0&&p.jsxs("p",{style:{fontSize:"12px",color:"#9ca3af",paddingTop:"8px",paddingLeft:"16px"},children:[l," checks passing"]})]})]})}function tS(){const[e,i]=E.useState([]),[n,l]=E.useState(!0),[o,c]=E.useState(!1);E.useEffect(()=>{fetch("/api/cli-status").then(g=>g.json()).then(g=>{i(g.clis||[]),l(!1)}).catch(()=>l(!1))},[]);const d=e.filter(g=>g.connected).length,_=e.filter(g=>!g.connected).length;return p.jsxs("div",{style:{borderBottom:"1px solid #e5e7eb"},children:[p.jsxs("button",{onClick:()=>c(!o),style:{width:"100%",padding:"16px 20px",display:"flex",alignItems:"center",justifyContent:"space-between",background:"none",border:"none",cursor:"pointer",transition:"background 0.15s"},children:[p.jsxs("span",{style:{fontWeight:600,fontSize:"14px",color:"#374151",display:"flex",alignItems:"center",gap:"6px"},children:[p.jsx("span",{style:{fontSize:"10px",color:"#9ca3af",transform:o?"rotate(0deg)":"rotate(90deg)",transition:"transform 0.15s",display:"inline-block"},children:"▶"}),"CLI Connections"]}),n?p.jsx("span",{style:{fontSize:"12px",color:"#9ca3af"},children:"checking..."}):_>0?p.jsxs("span",{style:{background:"#fef3c7",color:"#d97706",fontSize:"12px",padding:"3px 10px",borderRadius:"12px",fontWeight:600},children:[_," disconnected"]}):p.jsx("span",{style:{background:"#dcfce7",color:"#16a34a",fontSize:"12px",padding:"3px 10px",borderRadius:"12px",fontWeight:600},children:"all connected"})]}),!o&&!n&&p.jsxs("div",{style:{padding:"0 12px 16px",display:"flex",flexDirection:"column",gap:"4px"},children:[e.map(g=>p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 12px",borderRadius:"8px",background:g.connected?"rgba(22, 163, 74, 0.04)":"rgba(217, 119, 6, 0.04)"},children:[p.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:g.connected?"#16a34a":"#d97706",flexShrink:0}}),p.jsxs("div",{style:{flex:1,minWidth:0},children:[p.jsx("div",{style:{fontSize:"13px",fontWeight:600,color:"#374151"},children:g.label}),p.jsx("div",{style:{fontSize:"11px",color:g.connected?"#6b7280":"#d97706",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:g.detail})]})]},g.id)),d>0&&_===0&&p.jsx("p",{style:{fontSize:"12px",color:"#9ca3af",paddingTop:"4px",paddingLeft:"12px"},children:"All CLIs authenticated and ready"})]})]})}function iS(){const{sendPrompt:e}=en(),[i,n]=E.useState(!1),[l,o]=E.useState(""),[c,d]=E.useState(""),[_,g]=E.useState(!1),f=l.trim().length>0,x=()=>{if(!f)return;const w=["I want to add a new feature to my app:","",`**What it does:** ${l.trim()}`];c.trim()&&w.push("",`**What success looks like:** ${c.trim()}`),w.push("","Please:","1. Create an implementation plan with numbered steps and files to create/modify","2. Save the plan as a markdown file in docs/plans/","3. Include a testing checklist at the end with specific items to verify","4. Then start building step 1");const S=w.join(`
|
|
80
|
+
`);if(e(S),c.trim()){const R=c.trim().split(/[.\n]/).map(z=>z.trim()).filter(z=>z.length>10);R.length>0&&window.dispatchEvent(new CustomEvent("claude-portal:test-items",{detail:{items:R,feature:l.trim().slice(0,40)}}))}g(!0),setTimeout(()=>{o(""),d(""),g(!1)},2e3)},v={width:"100%",padding:"8px 12px",border:"1px solid #e5e7eb",borderRadius:"8px",fontSize:"12px",fontFamily:"inherit",resize:"none",outline:"none",color:"#374151",background:"#fff",boxSizing:"border-box"},b={fontSize:"12px",fontWeight:500,color:"#6b7280",marginBottom:"4px"};return p.jsxs("div",{style:{borderBottom:"1px solid #e5e7eb"},children:[p.jsx("button",{onClick:()=>n(!i),style:{width:"100%",padding:"16px 20px",display:"flex",alignItems:"center",justifyContent:"space-between",background:"none",border:"none",cursor:"pointer"},children:p.jsxs("span",{style:{fontWeight:600,fontSize:"14px",color:"#374151",display:"flex",alignItems:"center",gap:"6px"},children:[p.jsx("span",{style:{fontSize:"10px",color:"#9ca3af",transform:i?"rotate(0deg)":"rotate(90deg)",transition:"transform 0.15s",display:"inline-block"},children:"▶"}),"Build a Feature"]})}),!i&&p.jsxs("div",{style:{padding:"0 20px 16px",display:"flex",flexDirection:"column",gap:"12px"},children:[p.jsxs("div",{children:[p.jsx("div",{style:b,children:"What do you want to build?"}),p.jsx("textarea",{value:l,onChange:w=>o(w.target.value),rows:3,placeholder:"e.g. A settings page where users can update their profile, change password, and toggle dark mode",style:v})]}),p.jsxs("div",{children:[p.jsxs("div",{style:b,children:["What does success look like? ",p.jsx("span",{style:{color:"#9ca3af",fontWeight:400},children:"(optional)"})]}),p.jsx("textarea",{value:c,onChange:w=>d(w.target.value),rows:3,placeholder:"e.g. The page has a form with current values pre-filled. Save button shows a success toast. Password change requires current password.",style:v})]}),p.jsx("button",{onClick:x,disabled:!f||_,style:{padding:"10px 16px",borderRadius:"10px",border:"none",background:_?"#dcfce7":f?"#22c55e":"#e5e7eb",color:_?"#16a34a":f?"#fff":"#9ca3af",fontSize:"13px",fontWeight:600,cursor:f&&!_?"pointer":"not-allowed",transition:"all 0.15s",width:"100%"},children:_?"✓ Sent to Claude":"Build with Claude Code →"})]})]})}function Nm(e){return`claude-portal-tests-${e}`}function sS(e){try{const i=localStorage.getItem(Nm(e));return i?JSON.parse(i):[]}catch{return[]}}function C_(e,i){localStorage.setItem(Nm(e),JSON.stringify(i))}function rS(){const{path:e}=Et(),[i,n]=E.useState(!1),[l,o]=E.useState([]),[c,d]=E.useState(!1),[_,g]=E.useState("");E.useEffect(()=>{e&&o(sS(e))},[e]),E.useEffect(()=>{const S=R=>{const{items:z,feature:A}=R.detail;if(!z?.length||!e)return;const W=z.map((j,C)=>({id:`auto-${Date.now()}-${C}`,label:j,checked:!1}));o(j=>{const C=[...j,...W];return C_(e,C),C}),n(!1)};return window.addEventListener("claude-portal:test-items",S),()=>window.removeEventListener("claude-portal:test-items",S)},[e]);const f=E.useCallback(S=>{o(R=>{const z=S(R);return e&&C_(e,z),z})},[e]),x=E.useCallback(S=>{f(R=>R.map(z=>z.id===S?{...z,checked:!z.checked}:z))},[f]),v=E.useCallback(S=>{f(R=>R.filter(z=>z.id!==S))},[f]),b=()=>{const S=_.trim();S&&(f(R=>[...R,{id:Date.now().toString(),label:S,checked:!1}]),g(""),d(!1))},w=l.filter(S=>S.checked).length;return p.jsxs("div",{style:{borderBottom:"1px solid #e5e7eb"},children:[p.jsxs("button",{onClick:()=>n(!i),style:{width:"100%",padding:"16px 20px",display:"flex",alignItems:"center",justifyContent:"space-between",background:"none",border:"none",cursor:"pointer"},children:[p.jsxs("span",{style:{fontWeight:600,fontSize:"14px",color:"#374151",display:"flex",alignItems:"center",gap:"6px"},children:[p.jsx("span",{style:{fontSize:"10px",color:"#9ca3af",transform:i?"rotate(0deg)":"rotate(90deg)",transition:"transform 0.15s",display:"inline-block"},children:"▶"}),"Feature Testing"]}),l.length>0&&p.jsxs("span",{style:{background:w===l.length?"#dcfce7":"#f3f4f6",color:w===l.length?"#16a34a":"#6b7280",fontSize:"12px",padding:"3px 10px",borderRadius:"12px",fontWeight:600},children:[w,"/",l.length," tested"]})]}),!i&&p.jsxs("div",{style:{padding:"0 20px 16px",display:"flex",flexDirection:"column",gap:"6px"},children:[l.length===0&&!c&&p.jsx("p",{style:{fontSize:"12px",color:"#9ca3af",lineHeight:"1.5",margin:0},children:"Test items will appear here when Claude creates a plan with a testing section."}),l.map(S=>p.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"8px",padding:"6px 0",fontSize:"12px",color:"#374151"},children:[p.jsx("input",{type:"checkbox",checked:S.checked,onChange:()=>x(S.id),style:{marginTop:"2px",accentColor:"#22c55e",cursor:"pointer"}}),p.jsx("span",{onClick:()=>x(S.id),style:{flex:1,cursor:"pointer",textDecoration:S.checked?"line-through":"none",color:S.checked?"#9ca3af":"#374151"},children:S.label}),p.jsx("button",{onClick:()=>v(S.id),"aria-label":`Remove ${S.label}`,style:{background:"none",border:"none",color:"#d1d5db",cursor:"pointer",fontSize:"11px",padding:"0 2px",flexShrink:0,transition:"color 0.15s"},onMouseEnter:R=>R.currentTarget.style.color="#ef4444",onMouseLeave:R=>R.currentTarget.style.color="#d1d5db",children:"✕"})]},S.id)),c?p.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"4px"},children:[p.jsx("input",{autoFocus:!0,value:_,onChange:S=>g(S.target.value),onKeyDown:S=>{S.key==="Enter"&&b(),S.key==="Escape"&&(d(!1),g(""))},placeholder:"Describe the test...",style:{flex:1,padding:"6px 10px",border:"1px solid #e5e7eb",borderRadius:"6px",fontSize:"12px",outline:"none",color:"#374151"}}),p.jsx("button",{onClick:b,style:{padding:"6px 12px",background:"#22c55e",color:"#fff",border:"none",borderRadius:"6px",fontSize:"12px",fontWeight:600,cursor:"pointer"},children:"Add"})]}):p.jsx("button",{onClick:()=>d(!0),style:{padding:"6px 0",background:"none",border:"none",color:"#22c55e",fontSize:"12px",fontWeight:500,cursor:"pointer",textAlign:"left",marginTop:"4px"},children:"+ Add test item"})]})]})}const Qn=[{id:"bugs",label:"Check for bugs",prompt:"Review all files changed since the last commit for bugs, logic errors, and edge cases. Report what you find."},{id:"diff",label:"Review diff",prompt:"Show me a summary of all changes since the last push — what was added, modified, and removed."},{id:"tests",label:"Run tests",prompt:"Run the test suite and report results. If any tests fail, explain why."},{id:"console",label:"Check console.logs",prompt:"Find any console.log, console.warn, or console.error statements in the changed files that should be removed before pushing."},{id:"build",label:"Build succeeds",prompt:"Run the build command and report if it succeeds. If it fails, explain the errors."},{id:"security",label:"Security check",prompt:"Check the changed files for security issues: hardcoded secrets, SQL injection, XSS vulnerabilities, or exposed API keys."}];function Hm(e){return`claude-portal-prepush-${e}`}function nS(e){try{const i=localStorage.getItem(Hm(e));return i?JSON.parse(i):{}}catch{return{}}}function lS(e,i){localStorage.setItem(Hm(e),JSON.stringify(i))}function aS(){const{path:e}=Et(),{sendPrompt:i}=en(),[n,l]=E.useState(!1),[o,c]=E.useState({});E.useEffect(()=>{e&&c(nS(e))},[e]);const d=E.useCallback(g=>{c(f=>{const x={...f,[g]:!f[g]};return e&&lS(e,x),x})},[e]),_=Qn.filter(g=>o[g.id]).length;return p.jsxs("div",{style:{borderBottom:"1px solid #e5e7eb"},children:[p.jsxs("button",{onClick:()=>l(!n),style:{width:"100%",padding:"16px 20px",display:"flex",alignItems:"center",justifyContent:"space-between",background:"none",border:"none",cursor:"pointer"},children:[p.jsxs("span",{style:{fontWeight:600,fontSize:"14px",color:"#374151",display:"flex",alignItems:"center",gap:"6px"},children:[p.jsx("span",{style:{fontSize:"10px",color:"#9ca3af",transform:n?"rotate(0deg)":"rotate(90deg)",transition:"transform 0.15s",display:"inline-block"},children:"▶"}),"Pre-Push"]}),p.jsxs("span",{style:{background:_===Qn.length?"#dcfce7":"#f3f4f6",color:_===Qn.length?"#16a34a":"#6b7280",fontSize:"12px",padding:"3px 10px",borderRadius:"12px",fontWeight:600},children:[_,"/",Qn.length]})]}),!n&&p.jsx("div",{style:{padding:"0 20px 16px",display:"flex",flexDirection:"column",gap:"4px"},children:Qn.map(g=>p.jsx(oS,{label:g.label,prompt:g.prompt,isChecked:!!o[g.id],onToggle:()=>d(g.id),onRun:()=>i(g.prompt)},g.id))})]})}function oS({label:e,prompt:i,isChecked:n,onToggle:l,onRun:o}){const[c,d]=E.useState(!1),_=()=>{c||(o(),d(!0),setTimeout(()=>d(!1),3e3))};return p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 0"},children:[p.jsx("input",{type:"checkbox",checked:n,onChange:l,style:{accentColor:"#22c55e",flexShrink:0}}),p.jsx("span",{style:{flex:1,fontSize:"12px",color:n?"#9ca3af":"#374151",textDecoration:n?"line-through":"none"},children:e}),p.jsx("button",{onClick:_,style:{padding:"4px 10px",background:"#dcfce7",color:"#16a34a",fontSize:"11px",borderRadius:"6px",fontWeight:600,border:c?"1px solid #86efac":"none",cursor:c?"default":"pointer",flexShrink:0,transition:"all 0.15s"},children:c?"✓ Sent":"Run →"})]})}const tu="claude-portal-future-builds";function cS(e){try{return JSON.parse(localStorage.getItem(tu)||"{}")[e]||[]}catch{return[]}}function hS(e,i){try{const n=JSON.parse(localStorage.getItem(tu)||"{}");n[e]=i,localStorage.setItem(tu,JSON.stringify(n))}catch{}}function uS(){const{path:e}=Et(),[i,n]=E.useState([]),[l,o]=E.useState(!1),[c,d]=E.useState(""),[_,g]=E.useState(null),[f,x]=E.useState("");E.useEffect(()=>{e&&n(cS(e))},[e]);const v=j=>{n(j),e&&hS(e,j)},b=()=>{const j=c.trim();if(!j)return;const C={id:Date.now().toString(),text:j,done:!1,createdAt:Date.now()};v([...i,C]),d("")},w=j=>{v(i.map(C=>C.id===j?{...C,done:!C.done}:C))},S=j=>{v(i.filter(C=>C.id!==j))},R=j=>{g(j.id),x(j.text)},z=j=>{const C=f.trim();C&&(v(i.map(O=>O.id===j?{...O,text:C}:O)),g(null))},A=i.filter(j=>j.done).length,W=i.length;return p.jsxs("div",{style:{borderBottom:"1px solid #e5e7eb"},children:[p.jsxs("button",{onClick:()=>o(!l),style:{width:"100%",padding:"16px 20px",display:"flex",alignItems:"center",justifyContent:"space-between",background:"none",border:"none",cursor:"pointer"},children:[p.jsxs("span",{style:{fontWeight:600,fontSize:"14px",color:"#374151",display:"flex",alignItems:"center",gap:"6px"},children:[p.jsx("span",{style:{fontSize:"10px",color:"#9ca3af",transform:l?"rotate(0deg)":"rotate(90deg)",transition:"transform 0.15s",display:"inline-block"},children:"▶"}),"Future Builds"]}),W>0&&p.jsxs("span",{style:{background:A===W?"#dcfce7":"#f3f4f6",color:A===W?"#16a34a":"#6b7280",fontSize:"12px",padding:"3px 10px",borderRadius:"12px",fontWeight:600},children:[A,"/",W]})]}),!l&&p.jsxs("div",{style:{padding:"0 12px 16px",display:"flex",flexDirection:"column",gap:"4px"},children:[p.jsxs("div",{style:{display:"flex",gap:"6px",marginBottom:"8px"},children:[p.jsx("input",{value:c,onChange:j=>d(j.target.value),onKeyDown:j=>j.key==="Enter"&&b(),placeholder:"Add a feature or idea...",style:{flex:1,padding:"8px 12px",fontSize:"13px",border:"1px solid #e5e7eb",borderRadius:"8px",outline:"none",color:"#374151",background:"#fafafa"}}),p.jsx("button",{onClick:b,style:{padding:"8px 14px",background:"#5e17eb",color:"#fff",fontSize:"13px",fontWeight:600,borderRadius:"8px",border:"none",cursor:"pointer",whiteSpace:"nowrap"},children:"+"})]}),i.map(j=>p.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"8px",padding:"8px 10px",borderRadius:"8px",background:j.done?"rgba(22,163,74,0.04)":"#fafafa",transition:"background 0.15s"},children:[p.jsx("input",{type:"checkbox",checked:j.done,onChange:()=>w(j.id),style:{marginTop:"3px",cursor:"pointer",accentColor:"#5e17eb"}}),_===j.id?p.jsx("input",{value:f,onChange:C=>x(C.target.value),onKeyDown:C=>{C.key==="Enter"&&z(j.id),C.key==="Escape"&&g(null)},onBlur:()=>z(j.id),autoFocus:!0,style:{flex:1,padding:"2px 6px",fontSize:"13px",border:"1px solid #d1d5db",borderRadius:"4px",outline:"none"}}):p.jsx("span",{onDoubleClick:()=>R(j),style:{flex:1,fontSize:"13px",color:j.done?"#9ca3af":"#374151",textDecoration:j.done?"line-through":"none",cursor:"default",lineHeight:1.4},children:j.text}),p.jsx("button",{onClick:()=>S(j.id),style:{background:"none",border:"none",cursor:"pointer",color:"#d1d5db",fontSize:"14px",padding:"0 2px",lineHeight:1,transition:"color 0.15s"},onMouseEnter:C=>C.currentTarget.style.color="#ef4444",onMouseLeave:C=>C.currentTarget.style.color="#d1d5db",children:"×"})]},j.id)),i.length===0&&p.jsx("p",{style:{fontSize:"12px",color:"#9ca3af",textAlign:"center",padding:"12px"},children:"Track features, ideas, and things to build next"})]})]})}function dS(){const{path:e,setProjectPath:i}=Et(),n=e?e.split("/").filter(Boolean).pop():"Project",l=async()=>{const o=await gi("/api/pick-folder");o?.path&&i(o.path)};return p.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"#fff"},children:[p.jsxs("div",{style:{padding:"20px 24px 16px",borderBottom:"1px solid #e5e7eb"},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"6px"},children:[p.jsx("div",{style:{fontSize:"11px",textTransform:"uppercase",letterSpacing:"0.05em",color:"#9ca3af"},children:"Project"}),p.jsx("button",{onClick:l,style:{padding:"4px 10px",borderRadius:"6px",border:"1px solid #e5e7eb",background:"#fff",color:"#6b7280",fontSize:"11px",fontWeight:500,cursor:"pointer",transition:"all 0.15s"},children:"Change"})]}),p.jsx("div",{style:{fontSize:"14px",fontWeight:600,color:"#1a2233",wordBreak:"break-all"},children:n}),e&&p.jsx("div",{style:{fontSize:"11px",color:"#9ca3af",marginTop:"2px",wordBreak:"break-all"},children:e})]}),p.jsxs("div",{style:{flex:1,overflowY:"auto"},children:[p.jsx(Iu,{}),p.jsx(eS,{}),p.jsx(tS,{}),p.jsx(iS,{}),p.jsx(rS,{}),p.jsx(aS,{}),p.jsx(uS,{})]})]})}const fS={pdf:"text-red-500",docx:"text-blue-500",doc:"text-blue-500",xlsx:"text-green-500",xls:"text-green-500",csv:"text-green-600",txt:"text-gray-400",md:"text-gray-400",json:"text-yellow-500",html:"text-orange-500",pptx:"text-pink-500"};function pS(e){const i=e.split(".").pop()?.toLowerCase()||"";return fS[i]||"text-gray-400"}function gS(e){return Object.entries(e).sort((i,n)=>n[1]-i[1]).map(([i,n])=>`${n} ${i}`).join(", ")}function _S(){const{folderPath:e,folderScan:i,scanLoading:n,scanFolder:l,clearFolder:o}=Li(),[c,d]=E.useState(""),[_,g]=E.useState(!1),[f,x]=E.useState(!1),[v,b]=E.useState(!1);async function w(){x(!0);const C=await gi("/api/pick-folder");x(!1),C?.path&&l(C.path)}function S(){const C=c.trim();C&&l(C)}function R(C){C.key==="Enter"&&S()}const z=i?.files||[],A=i?.summary.total||0,W=i?.summary.byType||{},j=z.slice(0,20);return p.jsxs("div",{style:{padding:"16px 20px",display:"flex",flexDirection:"column",gap:"10px",borderBottom:"1px solid var(--border)"},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[p.jsx("div",{style:{width:"24px",height:"24px",borderRadius:"8px",background:"linear-gradient(135deg, #5e17eb, #8b5cf6)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",fontSize:"11px",fontWeight:700,flexShrink:0},children:"1"}),p.jsx("h3",{style:{fontSize:"13px",fontWeight:700,color:"var(--text-primary)"},children:"Choose folder"})]}),e?p.jsxs("div",{className:"rounded-lg border",style:{background:"var(--bg-secondary)",borderColor:"var(--border)",padding:"10px 12px"},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[p.jsx("span",{style:{fontSize:"14px",flexShrink:0},children:"📁"}),p.jsx("span",{style:{fontSize:"13px",fontWeight:600,color:"var(--text-primary)",flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e?.split("/").filter(Boolean).pop()||e}),p.jsxs("span",{style:{fontSize:"11px",padding:"2px 8px",borderRadius:"100px",background:"#eef2ff",color:"#6366f1",fontWeight:600,flexShrink:0,whiteSpace:"nowrap"},children:[A," files"]}),p.jsx("button",{onClick:o,style:{fontSize:"11px",padding:"2px 8px",borderRadius:"100px",border:"1px solid var(--border)",background:"transparent",color:"var(--text-secondary)",cursor:"pointer",flexShrink:0,whiteSpace:"nowrap"},children:"Change"})]}),Object.keys(W).length>0&&p.jsx("p",{style:{fontSize:"11px",color:"var(--text-secondary)",marginTop:"4px"},children:gS(W)}),A>50&&p.jsxs("p",{className:"text-xs text-amber-500 bg-amber-500/10 rounded px-2 py-1",children:["Large folder — processing may take longer for ",A," files."]}),z.length>0&&p.jsxs("div",{children:[p.jsx("button",{onClick:()=>g(C=>!C),className:"text-xs transition-colors",style:{color:"var(--text-secondary)"},children:_?"▲ Hide files":`▼ Show files (${Math.min(20,z.length)} of ${A})`}),_&&p.jsx("ul",{className:"mt-2 space-y-1 max-h-48 overflow-y-auto",children:j.map((C,O)=>p.jsxs("li",{className:"flex items-center gap-2 text-xs",children:[p.jsx("span",{className:`font-mono font-semibold ${pS(C.name)}`,children:C.name.split(".").pop()?.toLowerCase()}),p.jsx("span",{style:{color:"var(--text-primary)"},children:C.name})]},O))})]})]}):p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[p.jsx("button",{onClick:w,disabled:f||n,style:{width:"100%",padding:"16px 20px",borderRadius:"14px",fontSize:"15px",fontWeight:600,background:"linear-gradient(135deg, #5e17eb, #8b5cf6)",color:"white",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",boxShadow:"0 4px 12px rgba(94,23,235,0.3)",opacity:f||n?.5:1,transition:"all 0.2s"},children:f?p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Waiting for selection..."]}):p.jsx(p.Fragment,{children:"📂 Browse for folder"})}),v?p.jsxs("div",{className:"flex gap-2",children:[p.jsx("input",{type:"text",value:c,onChange:C=>d(C.target.value),onKeyDown:R,placeholder:"/path/to/documents",autoFocus:!0,className:"flex-1 px-3 py-2.5 rounded-lg text-sm border outline-none focus:ring-2 focus:ring-indigo-400",style:{background:"var(--bg-secondary)",borderColor:"var(--border)",color:"var(--text-primary)"}}),p.jsx("button",{onClick:S,disabled:!c.trim()||n,className:"px-4 py-2.5 rounded-lg text-sm font-medium bg-indigo-500 text-white hover:bg-indigo-600 disabled:opacity-50 transition-colors",children:n?"...":"Scan"})]}):p.jsx("button",{onClick:()=>b(!0),style:{fontSize:"13px",color:"var(--text-secondary)",background:"none",border:"none",cursor:"pointer",margin:"0 auto",display:"block"},children:"Or enter path manually →"})]})]})}function mS(){const{selectedOutcome:e,setSelectedOutcome:i,freeformText:n,setFreeformText:l}=Li();return p.jsxs("div",{children:[p.jsxs("div",{className:"flex items-center gap-2",style:{marginBottom:"12px"},children:[p.jsx("div",{style:{width:"24px",height:"24px",borderRadius:"8px",background:"linear-gradient(135deg, #6366f1, #a855f7)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",fontSize:"11px",fontWeight:700,flexShrink:0},children:"2"}),p.jsx("h3",{style:{fontSize:"13px",fontWeight:700,color:"var(--text-primary)"},children:"Choose outcome"})]}),Rx.map(o=>{const c=oo.filter(d=>d.category===o.key);return p.jsxs("div",{style:{marginBottom:"12px"},children:[p.jsxs("div",{style:{fontSize:"11px",fontWeight:600,color:"#9ca3af",marginBottom:"6px",textTransform:"uppercase",letterSpacing:"0.04em"},children:[o.label," ",p.jsxs("span",{style:{fontWeight:400,textTransform:"none",letterSpacing:0},children:["— ",o.description]})]}),p.jsx("div",{className:"grid grid-cols-2",style:{gap:"6px"},children:c.map(d=>{const _=e===d.key;return p.jsxs("button",{onClick:()=>i(_?null:d.key),style:{padding:"8px 10px",borderRadius:"10px",border:_?"2px solid #818cf8":"1.5px solid var(--border)",background:_?"#eef2ff":"var(--bg-secondary, #fff)",cursor:"pointer",boxShadow:_?"0 0 0 3px rgba(99,102,241,0.08)":"none",display:"flex",alignItems:"center",gap:"8px",textAlign:"left",transition:"all 0.15s"},children:[p.jsx("span",{style:{fontSize:"15px",flexShrink:0},children:d.emoji}),p.jsxs("div",{style:{minWidth:0},children:[p.jsx("div",{style:{fontSize:"12px",fontWeight:700,color:_?"#4338ca":"var(--text-primary)"},children:d.name}),p.jsx("div",{style:{fontSize:"10px",color:"var(--text-secondary)",lineHeight:1.2},children:d.description})]})]},d.key)})})]},o.key)}),p.jsxs("div",{style:{marginTop:"8px"},children:[p.jsx("div",{style:{fontSize:"11px",fontWeight:500,color:"var(--text-secondary)",marginBottom:"4px"},children:"Or describe what you need:"}),p.jsx("textarea",{value:n,onChange:o=>l(o.target.value),placeholder:"e.g. Find all contract expiry dates and list them by client",rows:2,className:"w-full rounded-lg border outline-none resize-none",style:{padding:"10px 14px",fontSize:"12px",lineHeight:"1.5",background:"var(--bg-secondary)",borderColor:"var(--border)",color:"var(--text-primary)"}})]})]})}const Um="claude-portal-style-templates",Wm=()=>{try{return JSON.parse(localStorage.getItem(Um)||"[]")}catch{return[]}},vS=e=>localStorage.setItem(Um,JSON.stringify(e)),yS=e=>Wm().filter(i=>i.outcomeKey===e);function xS(e){const i=Wm();i.push(e);const n=new Map;for(const o of i){const c=n.get(o.outcomeKey)||[];c.push(o),n.set(o.outcomeKey,c)}const l=[];for(const o of n.values())l.push(...o.slice(-10));vS(l)}const SS={pdf:"📄",md:"📝",docx:"📘",doc:"📘",txt:"📃"},bS=".md,.txt,.csv,.json,.html",Ph=3;function wS(e){return e.split(".").pop()?.toLowerCase()||""}function CS({outcomeKey:e,onContentChange:i}){const[n,l]=E.useState([]),[o,c]=E.useState(null),[d,_]=E.useState(!1),[g,f]=E.useState([]),x=E.useRef(null);E.useEffect(()=>{f(e?yS(e):[]),c(null)},[e]);const v=E.useCallback((j,C)=>{if(C){const O=g.find(G=>G.id===C);if(O){i(O.content);return}}if(j.length>0){const O=j.map(G=>G.content).join(`
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
`);i(O)}else i(null)},[i,g]),b=E.useRef(!1);E.useEffect(()=>{if(!b.current){b.current=!0;return}v(n,o)},[n,o,v]);const w=E.useCallback(async j=>{const C=Array.from(j),O=[];for(const G of C){const Z=G.name.split(".").pop()?.toLowerCase()||"";if(["pdf","docx","doc"].includes(Z))continue;const ae=await G.text();O.push({name:G.name,content:ae})}O.length!==0&&(l(G=>{const Z=Ph-G.length;return Z<=0?G:[...G,...O.slice(0,Z)]}),c(null))},[]),S=E.useCallback(j=>{j.preventDefault(),_(!1),j.dataTransfer.files.length>0&&w(j.dataTransfer.files)},[w]),R=E.useCallback(j=>{j.target.files&&j.target.files.length>0&&w(j.target.files),j.target.value=""},[w]),z=E.useCallback(j=>{l(C=>C.filter((O,G)=>G!==j))},[]),A=E.useCallback(j=>{c(C=>C===j?null:j),l([])},[]),W=n.length>0||o!==null;return p.jsxs("div",{className:"space-y-3",children:[p.jsxs("div",{className:"flex items-center gap-2",style:{marginBottom:"8px"},children:[p.jsx("div",{className:"flex items-center justify-center text-white text-xs font-bold flex-shrink-0",style:{width:"24px",height:"24px",borderRadius:"8px",background:"linear-gradient(135deg, #6366f1, #a855f7)"},children:"✦"}),p.jsx("h3",{className:"text-sm font-semibold",style:{color:"var(--text-primary)"},children:"Show Claude an example"}),p.jsx("span",{className:"text-xs italic",style:{color:"var(--text-secondary)"},children:"optional"})]}),n.map((j,C)=>{const O=wS(j.name),G=SS[O]||"📄",Z=j.content.slice(0,80).replace(/\n/g," "),ae={pdf:"#fef2f2",md:"#f0f9ff",docx:"#eff6ff",doc:"#eff6ff",txt:"#f8fafc"};return p.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border",style:{padding:"10px 12px",background:"var(--bg-secondary)",borderColor:"var(--border)"},children:[p.jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:"32px",height:"32px",borderRadius:"8px",background:ae[O]||"#f8fafc",fontSize:"16px"},children:G}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsx("div",{className:"text-xs font-semibold truncate",style:{color:"var(--text-primary)"},children:j.name}),p.jsx("div",{className:"text-xs truncate",style:{color:"var(--text-secondary)",fontSize:"10px",marginTop:"1px"},children:Z})]}),p.jsx("button",{onClick:()=>z(C),"aria-label":`Remove ${j.name}`,className:"flex items-center justify-center flex-shrink-0 border rounded-md transition-colors hover:bg-red-50 hover:border-red-300 hover:text-red-600",style:{width:"20px",height:"20px",borderColor:"var(--border)",color:"var(--text-secondary)",background:"transparent",cursor:"pointer",fontSize:"10px"},children:"✕"})]},C)}),n.length<Ph&&p.jsxs("div",{onDragOver:j=>{j.preventDefault(),_(!0)},onDragLeave:()=>_(!1),onDrop:S,onClick:()=>x.current?.click(),className:"relative text-center cursor-pointer transition-all rounded-xl",style:{border:`2px dashed ${d?"#818cf8":"#c7d2fe"}`,borderRadius:"10px",padding:"12px",background:d?"#eef2ff":"transparent"},children:[p.jsx("input",{ref:x,type:"file",multiple:!0,accept:bS,onChange:R,style:{position:"absolute",inset:0,opacity:0,cursor:"pointer"}}),p.jsx("div",{style:{fontSize:"18px",marginBottom:"4px",opacity:.7},children:"📎"}),p.jsxs("div",{style:{fontSize:"11px",color:"#64748b",fontWeight:500,lineHeight:1.4},children:[p.jsx("strong",{style:{color:"#6366f1"},children:"Drop a document"})," to use as a style reference"]}),p.jsx("div",{style:{fontSize:"10px",color:"#94a3b8",marginTop:"2px"},children:"MD, TXT, CSV, JSON, HTML — up to 3"})]}),n.length>0&&p.jsxs("div",{className:"text-right",style:{fontSize:"10px",color:"#94a3b8"},children:[n.length," of ",Ph," examples attached"]}),g.length>0&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex items-center gap-2",style:{margin:"12px 0 8px"},children:[p.jsx("div",{className:"flex-1",style:{height:"1px",background:"var(--border)"}}),p.jsx("span",{style:{fontSize:"10px",color:"#94a3b8",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",whiteSpace:"nowrap"},children:"or use a saved style"}),p.jsx("div",{className:"flex-1",style:{height:"1px",background:"var(--border)"}})]}),p.jsx("div",{className:"flex flex-wrap gap-1.5",children:g.map(j=>{const C=o===j.id;return p.jsxs("button",{onClick:()=>A(j.id),className:"inline-flex items-center gap-1 rounded-lg text-xs transition-colors",style:{padding:"5px 10px",border:`1px solid ${C?"#818cf8":"var(--border)"}`,background:C?"#eef2ff":"transparent",color:C?"#4338ca":"var(--text-secondary)",cursor:"pointer",fontWeight:500},children:[p.jsx("span",{style:{fontSize:"12px"},children:"⭐"})," ",j.name]},j.id)})})]}),W&&p.jsx("div",{className:"rounded-lg",style:{fontSize:"10px",color:"#6366f1",background:"#eef2ff",border:"1px solid #e0e7ff",borderRadius:"8px",padding:"6px 10px"},children:"✨ Claude will match the tone, structure, and formatting of your example"})]})}function kS(){const{contextText:e,setContextText:i,canRun:n,run:l,selectedOutcome:o,folderScan:c,isRunning:d}=Li(),_=o?oo.find(f=>f.key===o)?.name||o:"Custom",g=c?.summary.total||0;return p.jsxs("div",{className:"space-y-2",children:[p.jsxs("div",{className:"flex items-center gap-2",style:{marginBottom:"8px"},children:[p.jsx("div",{className:"flex-shrink-0",style:{width:"24px",height:"24px",borderRadius:"8px",background:"linear-gradient(135deg, #5e17eb, #8b5cf6)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",fontSize:"11px",fontWeight:700},children:"3"}),p.jsx("h3",{style:{fontSize:"13px",fontWeight:700,color:"var(--text-primary)"},children:"Additional context"})]}),p.jsx("textarea",{value:e,onChange:f=>i(f.target.value),placeholder:"Any extra instructions, e.g. focus on Q4, ignore drafts, output in French…",rows:2,className:"w-full rounded-lg border outline-none focus:ring-2 focus:ring-indigo-400 resize-none",style:{padding:"10px 14px",fontSize:"12px",lineHeight:"1.5",background:"var(--bg-secondary)",borderColor:"var(--border)",color:"var(--text-primary)"}}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx("button",{onClick:l,disabled:!n,className:"w-full rounded-lg text-sm font-semibold text-white shadow-lg disabled:opacity-40 disabled:cursor-not-allowed transition-all",style:{padding:"12px 16px",background:"linear-gradient(135deg, #7c3aed, #a855f7)"},children:d?"⏳ Working...":`✨ Go — ${_} ${g} documents`}),p.jsx("p",{className:"text-xs text-center",style:{color:"var(--text-secondary)"},children:"Claude will scan your files and create the output"})]})]})}function ES(){const{selectedOutcome:e}=Li(),[i,n]=E.useState([]),[l,o]=E.useState(!0),[c,d]=E.useState(!0);E.useEffect(()=>{const v=e?`/api/mcp-status?outcome=${e}`:"/api/mcp-status";fetch(v).then(b=>b.json()).then(b=>{n(b.mcps||[]),o(!1)}).catch(()=>o(!1))},[e]);const _=i.filter(v=>v.relevant),g=_.filter(v=>v.installed).length,f=_.length,x={};for(const v of _)x[v.category]||(x[v.category]=[]),x[v.category].push(v);return p.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--border)"},children:[p.jsxs("button",{onClick:()=>d(!c),style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",background:"none",border:"none",cursor:"pointer",padding:0},children:[p.jsxs("span",{style:{fontWeight:600,fontSize:"13px",color:"var(--text-primary)",display:"flex",alignItems:"center",gap:"6px"},children:[p.jsx("span",{style:{fontSize:"10px",color:"#9ca3af",transform:c?"rotate(0deg)":"rotate(90deg)",transition:"transform 0.15s",display:"inline-block"},children:"▶"}),"Superpowers (MCPs)"]}),l?p.jsx("span",{style:{fontSize:"11px",color:"#9ca3af"},children:"checking..."}):p.jsxs("span",{style:{background:g===f?"rgba(22,163,74,0.1)":"rgba(139,92,246,0.1)",color:g===f?"#16a34a":"#8b5cf6",fontSize:"11px",padding:"2px 8px",borderRadius:"10px",fontWeight:600},children:[g,"/",f," active"]})]}),!c&&!l&&p.jsxs("div",{style:{marginTop:"12px",display:"flex",flexDirection:"column",gap:"12px"},children:[Object.entries(x).map(([v,b])=>p.jsxs("div",{children:[p.jsx("div",{style:{fontSize:"10px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em",color:"#9ca3af",marginBottom:"6px"},children:b[0].categoryLabel}),p.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:b.map(w=>p.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"10px",padding:"8px 10px",borderRadius:"8px",background:w.installed?"rgba(22, 163, 74, 0.04)":"rgba(0, 0, 0, 0.02)"},children:[p.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"50%",marginTop:"4px",background:w.installed?"#16a34a":"#d4d4d8",flexShrink:0}}),p.jsxs("div",{style:{flex:1,minWidth:0},children:[p.jsxs("div",{style:{fontSize:"12px",fontWeight:600,color:w.installed?"var(--text-primary)":"#6b7280",display:"flex",alignItems:"center",gap:"6px"},children:[w.name,w.recommended&&p.jsx("span",{style:{fontSize:"9px",fontWeight:700,padding:"1px 6px",borderRadius:"8px",background:w.installed?"#dcfce7":"#fef3c7",color:w.installed?"#16a34a":"#d97706"},children:w.installed?"Connected":"For your tools"})]}),p.jsx("div",{style:{fontSize:"11px",color:"#9ca3af",marginTop:"1px"},children:w.description}),!w.installed&&w.installHint&&p.jsx("div",{style:{fontSize:"10px",color:"#8b5cf6",marginTop:"4px",fontFamily:"'SF Mono', monospace",background:"rgba(139,92,246,0.06)",padding:"3px 6px",borderRadius:"4px",wordBreak:"break-all"},children:w.installHint})]})]},w.id))})]},v)),_.length===0&&p.jsx("p",{style:{fontSize:"12px",color:"#9ca3af",textAlign:"center",padding:"8px"},children:"Select an outcome to see recommended MCPs"})]})]})}function TS(){const{folderPath:e,selectedOutcome:i,setStyleExampleContent:n}=Li(),[l,o]=E.useState(!1);return p.jsxs("div",{className:"h-full overflow-y-auto",style:{background:"var(--bg-sidebar)"},children:[l&&p.jsx(Om,{onClose:()=>o(!1)}),p.jsx("div",{style:{padding:"20px 28px 0"},children:p.jsx("button",{onClick:()=>o(!0),style:{width:"100%",padding:"12px 20px",borderRadius:"12px",background:"linear-gradient(135deg, rgba(94,23,235,0.06), rgba(139,92,246,0.06))",border:"1px solid rgba(94,23,235,0.15)",color:"#8b5cf6",fontSize:"14px",fontWeight:600,cursor:"pointer",transition:"all 0.2s",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"},children:"▶ How it works"})}),p.jsx(_S,{}),p.jsx(Iu,{}),e&&p.jsxs(p.Fragment,{children:[p.jsx("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--border)"},children:p.jsx(mS,{})}),p.jsx("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--border)"},children:p.jsx(CS,{outcomeKey:i,onContentChange:n})}),p.jsx(ES,{}),p.jsx("div",{style:{padding:"16px 20px",paddingBottom:"24px"},children:p.jsx(kS,{})})]})]})}function RS({open:e}){const{mode:i}=Et(),n=i==="document";return p.jsx("div",{style:{width:e?"340px":"0px",overflow:e?"auto":"hidden",borderRight:"1px solid #e5e7eb",background:"#fff",flexShrink:0,transition:"width 0.2s ease"},children:p.jsx("div",{style:{width:"340px",height:"100%"},children:n?p.jsx(TS,{}):p.jsx(dS,{})})})}var Pm=Object.defineProperty,DS=Object.getOwnPropertyDescriptor,BS=(e,i)=>{for(var n in i)Pm(e,n,{get:i[n],enumerable:!0})},Qe=(e,i,n,l)=>{for(var o=l>1?void 0:l?DS(i,n):i,c=e.length-1,d;c>=0;c--)(d=e[c])&&(o=(l?d(i,n,o):d(o))||o);return l&&o&&Pm(i,n,o),o},se=(e,i)=>(n,l)=>i(n,l,e),k_="Terminal input",iu={get:()=>k_,set:e=>k_=e},E_="Too much output to announce, navigate to rows manually to read",su={get:()=>E_,set:e=>E_=e};function zS(e){return e.replace(/\r?\n/g,"\r")}function AS(e,i){return i?"\x1B[200~"+e+"\x1B[201~":e}function MS(e,i){e.clipboardData&&e.clipboardData.setData("text/plain",i.selectionText),e.preventDefault()}function OS(e,i,n,l){if(e.stopPropagation(),e.clipboardData){let o=e.clipboardData.getData("text/plain");qm(o,i,n,l)}}function qm(e,i,n,l){e=zS(e),e=AS(e,n.decPrivateModes.bracketedPasteMode&&l.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),i.value=""}function Im(e,i,n){let l=n.getBoundingClientRect(),o=e.clientX-l.left-10,c=e.clientY-l.top-10;i.style.width="20px",i.style.height="20px",i.style.left=`${o}px`,i.style.top=`${c}px`,i.style.zIndex="1000",i.focus()}function T_(e,i,n,l,o){Im(e,i,n),o&&l.rightClickSelect(e),i.value=l.selectionText,i.select()}function Os(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function co(e,i=0,n=e.length){let l="";for(let o=i;o<n;++o){let c=e[o];c>65535?(c-=65536,l+=String.fromCharCode((c>>10)+55296)+String.fromCharCode(c%1024+56320)):l+=String.fromCharCode(c)}return l}var jS=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,i){let n=e.length;if(!n)return 0;let l=0,o=0;if(this._interim){let c=e.charCodeAt(o++);56320<=c&&c<=57343?i[l++]=(this._interim-55296)*1024+c-56320+65536:(i[l++]=this._interim,i[l++]=c),this._interim=0}for(let c=o;c<n;++c){let d=e.charCodeAt(c);if(55296<=d&&d<=56319){if(++c>=n)return this._interim=d,l;let _=e.charCodeAt(c);56320<=_&&_<=57343?i[l++]=(d-55296)*1024+_-56320+65536:(i[l++]=d,i[l++]=_);continue}d!==65279&&(i[l++]=d)}return l}},LS=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,i){let n=e.length;if(!n)return 0;let l=0,o,c,d,_,g=0,f=0;if(this.interim[0]){let b=!1,w=this.interim[0];w&=(w&224)===192?31:(w&240)===224?15:7;let S=0,R;for(;(R=this.interim[++S]&63)&&S<4;)w<<=6,w|=R;let z=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,A=z-S;for(;f<A;){if(f>=n)return 0;if(R=e[f++],(R&192)!==128){f--,b=!0;break}else this.interim[S++]=R,w<<=6,w|=R&63}b||(z===2?w<128?f--:i[l++]=w:z===3?w<2048||w>=55296&&w<=57343||w===65279||(i[l++]=w):w<65536||w>1114111||(i[l++]=w)),this.interim.fill(0)}let x=n-4,v=f;for(;v<n;){for(;v<x&&!((o=e[v])&128)&&!((c=e[v+1])&128)&&!((d=e[v+2])&128)&&!((_=e[v+3])&128);)i[l++]=o,i[l++]=c,i[l++]=d,i[l++]=_,v+=4;if(o=e[v++],o<128)i[l++]=o;else if((o&224)===192){if(v>=n)return this.interim[0]=o,l;if(c=e[v++],(c&192)!==128){v--;continue}if(g=(o&31)<<6|c&63,g<128){v--;continue}i[l++]=g}else if((o&240)===224){if(v>=n)return this.interim[0]=o,l;if(c=e[v++],(c&192)!==128){v--;continue}if(v>=n)return this.interim[0]=o,this.interim[1]=c,l;if(d=e[v++],(d&192)!==128){v--;continue}if(g=(o&15)<<12|(c&63)<<6|d&63,g<2048||g>=55296&&g<=57343||g===65279)continue;i[l++]=g}else if((o&248)===240){if(v>=n)return this.interim[0]=o,l;if(c=e[v++],(c&192)!==128){v--;continue}if(v>=n)return this.interim[0]=o,this.interim[1]=c,l;if(d=e[v++],(d&192)!==128){v--;continue}if(v>=n)return this.interim[0]=o,this.interim[1]=c,this.interim[2]=d,l;if(_=e[v++],(_&192)!==128){v--;continue}if(g=(o&7)<<18|(c&63)<<12|(d&63)<<6|_&63,g<65536||g>1114111)continue;i[l++]=g}}return l}},Km="",js=" ",ml=class $m{constructor(){this.fg=0,this.bg=0,this.extended=new Ja}static toColorRGB(i){return[i>>>16&255,i>>>8&255,i&255]}static fromColorRGB(i){return(i[0]&255)<<16|(i[1]&255)<<8|i[2]&255}clone(){let i=new $m;return i.fg=this.fg,i.bg=this.bg,i.extended=this.extended.clone(),i}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}},Ja=class Ym{constructor(i=0,n=0){this._ext=0,this._urlId=0,this._ext=i,this._urlId=n}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(i){this._ext=i}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(i){this._ext&=-469762049,this._ext|=i<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(i){this._ext&=-67108864,this._ext|=i&67108863}get urlId(){return this._urlId}set urlId(i){this._urlId=i}get underlineVariantOffset(){let i=(this._ext&3758096384)>>29;return i<0?i^4294967288:i}set underlineVariantOffset(i){this._ext&=536870911,this._ext|=i<<29&3758096384}clone(){return new Ym(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},_i=class Fm extends ml{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Ja,this.combinedData=""}static fromCharData(i){let n=new Fm;return n.setFromCharData(i),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Os(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(i){this.fg=i[0],this.bg=0;let n=!1;if(i[1].length>2)n=!0;else if(i[1].length===2){let l=i[1].charCodeAt(0);if(55296<=l&&l<=56319){let o=i[1].charCodeAt(1);56320<=o&&o<=57343?this.content=(l-55296)*1024+o-56320+65536|i[2]<<22:n=!0}else n=!0}else this.content=i[1].charCodeAt(0)|i[2]<<22;n&&(this.combinedData=i[1],this.content=2097152|i[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},R_="di$target",ru="di$dependencies",qh=new Map;function NS(e){return e[ru]||[]}function yt(e){if(qh.has(e))return qh.get(e);let i=function(n,l,o){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");HS(i,n,o)};return i._id=e,qh.set(e,i),i}function HS(e,i,n){i[R_]===i?i[ru].push({id:e,index:n}):(i[ru]=[{id:e,index:n}],i[R_]=i)}var At=yt("BufferService"),Gm=yt("CoreMouseService"),hr=yt("CoreService"),US=yt("CharsetService"),Ku=yt("InstantiationService"),Xm=yt("LogService"),Mt=yt("OptionsService"),Vm=yt("OscLinkService"),WS=yt("UnicodeService"),vl=yt("DecorationService"),nu=class{constructor(e,i,n){this._bufferService=e,this._optionsService=i,this._oscLinkService=n}provideLinks(e,i){let n=this._bufferService.buffer.lines.get(e-1);if(!n){i(void 0);return}let l=[],o=this._optionsService.rawOptions.linkHandler,c=new _i,d=n.getTrimmedLength(),_=-1,g=-1,f=!1;for(let x=0;x<d;x++)if(!(g===-1&&!n.hasContent(x))){if(n.loadCell(x,c),c.hasExtendedAttrs()&&c.extended.urlId)if(g===-1){g=x,_=c.extended.urlId;continue}else f=c.extended.urlId!==_;else g!==-1&&(f=!0);if(f||g!==-1&&x===d-1){let v=this._oscLinkService.getLinkData(_)?.uri;if(v){let b={start:{x:g+1,y:e},end:{x:x+(!f&&x===d-1?1:0),y:e}},w=!1;if(!o?.allowNonHttpProtocols)try{let S=new URL(v);["http:","https:"].includes(S.protocol)||(w=!0)}catch{w=!0}w||l.push({text:v,range:b,activate:(S,R)=>o?o.activate(S,R,b):PS(S,R),hover:(S,R)=>o?.hover?.(S,R,b),leave:(S,R)=>o?.leave?.(S,R,b)})}f=!1,c.hasExtendedAttrs()&&c.extended.urlId?(g=x,_=c.extended.urlId):(g=-1,_=-1)}}i(l)}};nu=Qe([se(0,At),se(1,Mt),se(2,Vm)],nu);function PS(e,i){if(confirm(`Do you want to navigate to ${i}?
|
|
85
|
+
|
|
86
|
+
WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=i}else console.warn("Opening link blocked as opener could not be cleared")}}var ho=yt("CharSizeService"),rs=yt("CoreBrowserService"),$u=yt("MouseService"),ns=yt("RenderService"),qS=yt("SelectionService"),Zm=yt("CharacterJoinerService"),tn=yt("ThemeService"),Qm=yt("LinkProviderService"),IS=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?D_.isErrorNoTelemetry(e)?new D_(e.message+`
|
|
87
|
+
|
|
88
|
+
`+e.stack):new Error(e.message+`
|
|
89
|
+
|
|
90
|
+
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(i=>{i(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)}},KS=new IS;function Ya(e){$S(e)||KS.onUnexpectedError(e)}var lu="Canceled";function $S(e){return e instanceof YS?!0:e instanceof Error&&e.name===lu&&e.message===lu}var YS=class extends Error{constructor(){super(lu),this.name=this.message}};function FS(e){return new Error(`Illegal argument: ${e}`)}var D_=class au extends Error{constructor(i){super(i),this.name="CodeExpectedError"}static fromError(i){if(i instanceof au)return i;let n=new au;return n.message=i.message,n.stack=i.stack,n}static isErrorNoTelemetry(i){return i.name==="CodeExpectedError"}},ou=class Jm extends Error{constructor(i){super(i||"An unexpected bug occurred."),Object.setPrototypeOf(this,Jm.prototype)}};function Qt(e,i=0){return e[e.length-(1+i)]}var GS;(e=>{function i(c){return c<0}e.isLessThan=i;function n(c){return c<=0}e.isLessThanOrEqual=n;function l(c){return c>0}e.isGreaterThan=l;function o(c){return c===0}e.isNeitherLessOrGreaterThan=o,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(GS||={});function XS(e,i){let n=this,l=!1,o;return function(){return l||(l=!0,i||(o=e.apply(n,arguments))),o}}var ev;(e=>{function i(C){return C&&typeof C=="object"&&typeof C[Symbol.iterator]=="function"}e.is=i;let n=Object.freeze([]);function l(){return n}e.empty=l;function*o(C){yield C}e.single=o;function c(C){return i(C)?C:o(C)}e.wrap=c;function d(C){return C||n}e.from=d;function*_(C){for(let O=C.length-1;O>=0;O--)yield C[O]}e.reverse=_;function g(C){return!C||C[Symbol.iterator]().next().done===!0}e.isEmpty=g;function f(C){return C[Symbol.iterator]().next().value}e.first=f;function x(C,O){let G=0;for(let Z of C)if(O(Z,G++))return!0;return!1}e.some=x;function v(C,O){for(let G of C)if(O(G))return G}e.find=v;function*b(C,O){for(let G of C)O(G)&&(yield G)}e.filter=b;function*w(C,O){let G=0;for(let Z of C)yield O(Z,G++)}e.map=w;function*S(C,O){let G=0;for(let Z of C)yield*O(Z,G++)}e.flatMap=S;function*R(...C){for(let O of C)yield*O}e.concat=R;function z(C,O,G){let Z=G;for(let ae of C)Z=O(Z,ae);return Z}e.reduce=z;function*A(C,O,G=C.length){for(O<0&&(O+=C.length),G<0?G+=C.length:G>C.length&&(G=C.length);O<G;O++)yield C[O]}e.slice=A;function W(C,O=Number.POSITIVE_INFINITY){let G=[];if(O===0)return[G,C];let Z=C[Symbol.iterator]();for(let ae=0;ae<O;ae++){let pe=Z.next();if(pe.done)return[G,e.empty()];G.push(pe.value)}return[G,{[Symbol.iterator](){return Z}}]}e.consume=W;async function j(C){let O=[];for await(let G of C)O.push(G);return Promise.resolve(O)}e.asyncToArray=j})(ev||={});function ar(e){if(ev.is(e)){let i=[];for(let n of e)if(n)try{n.dispose()}catch(l){i.push(l)}if(i.length===1)throw i[0];if(i.length>1)throw new AggregateError(i,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function VS(...e){return Ye(()=>ar(e))}function Ye(e){return{dispose:XS(()=>{e()})}}var tv=class iv{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{ar(this._toDispose)}finally{this._toDispose.clear()}}add(i){if(!i)return i;if(i===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?iv.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(i),i}delete(i){if(i){if(i===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(i),i.dispose()}}deleteAndLeak(i){i&&this._toDispose.has(i)&&(this._toDispose.delete(i),void 0)}};tv.DISABLE_DISPOSED_WARNING=!1;var Ls=tv,xe=class{constructor(){this._store=new Ls,this._store}dispose(){this._store.dispose()}_register(i){if(i===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(i)}};xe.None=Object.freeze({dispose(){}});var Jr=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(i){this._isDisposed||i===this._value||(this._value?.dispose(),this._value=i)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let i=this._value;return this._value=void 0,i}},ss=typeof window=="object"?window:globalThis,cu=class hu{constructor(i){this.element=i,this.next=hu.Undefined,this.prev=hu.Undefined}};cu.Undefined=new cu(void 0);var Fe=cu,B_=class{constructor(){this._first=Fe.Undefined,this._last=Fe.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Fe.Undefined}clear(){let e=this._first;for(;e!==Fe.Undefined;){let i=e.next;e.prev=Fe.Undefined,e.next=Fe.Undefined,e=i}this._first=Fe.Undefined,this._last=Fe.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,i){let n=new Fe(e);if(this._first===Fe.Undefined)this._first=n,this._last=n;else if(i){let o=this._last;this._last=n,n.prev=o,o.next=n}else{let o=this._first;this._first=n,n.next=o,o.prev=n}this._size+=1;let l=!1;return()=>{l||(l=!0,this._remove(n))}}shift(){if(this._first!==Fe.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Fe.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Fe.Undefined&&e.next!==Fe.Undefined){let i=e.prev;i.next=e.next,e.next.prev=i}else e.prev===Fe.Undefined&&e.next===Fe.Undefined?(this._first=Fe.Undefined,this._last=Fe.Undefined):e.next===Fe.Undefined?(this._last=this._last.prev,this._last.next=Fe.Undefined):e.prev===Fe.Undefined&&(this._first=this._first.next,this._first.prev=Fe.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Fe.Undefined;)yield e.element,e=e.next}},ZS=globalThis.performance&&typeof globalThis.performance.now=="function",QS=class sv{static create(i){return new sv(i)}constructor(i){this._now=ZS&&i===!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}},kt;(e=>{e.None=()=>xe.None;function i(V,X){return v(V,()=>{},0,void 0,!0,void 0,X)}e.defer=i;function n(V){return(X,te=null,Q)=>{let B=!1,q;return q=V(I=>{if(!B)return q?q.dispose():B=!0,X.call(te,I)},null,Q),B&&q.dispose(),q}}e.once=n;function l(V,X,te){return f((Q,B=null,q)=>V(I=>Q.call(B,X(I)),null,q),te)}e.map=l;function o(V,X,te){return f((Q,B=null,q)=>V(I=>{X(I),Q.call(B,I)},null,q),te)}e.forEach=o;function c(V,X,te){return f((Q,B=null,q)=>V(I=>X(I)&&Q.call(B,I),null,q),te)}e.filter=c;function d(V){return V}e.signal=d;function _(...V){return(X,te=null,Q)=>{let B=VS(...V.map(q=>q(I=>X.call(te,I))));return x(B,Q)}}e.any=_;function g(V,X,te,Q){let B=te;return l(V,q=>(B=X(B,q),B),Q)}e.reduce=g;function f(V,X){let te,Q={onWillAddFirstListener(){te=V(B.fire,B)},onDidRemoveLastListener(){te?.dispose()}},B=new J(Q);return X?.add(B),B.event}function x(V,X){return X instanceof Array?X.push(V):X&&X.add(V),V}function v(V,X,te=100,Q=!1,B=!1,q,I){let ne,ge,T,K=0,ee,ie={leakWarningThreshold:q,onWillAddFirstListener(){ne=V(de=>{K++,ge=X(ge,de),Q&&!T&&(ce.fire(ge),ge=void 0),ee=()=>{let Se=ge;ge=void 0,T=void 0,(!Q||K>1)&&ce.fire(Se),K=0},typeof te=="number"?(clearTimeout(T),T=setTimeout(ee,te)):T===void 0&&(T=0,queueMicrotask(ee))})},onWillRemoveListener(){B&&K>0&&ee?.()},onDidRemoveLastListener(){ee=void 0,ne.dispose()}},ce=new J(ie);return I?.add(ce),ce.event}e.debounce=v;function b(V,X=0,te){return e.debounce(V,(Q,B)=>Q?(Q.push(B),Q):[B],X,void 0,!0,void 0,te)}e.accumulate=b;function w(V,X=(Q,B)=>Q===B,te){let Q=!0,B;return c(V,q=>{let I=Q||!X(q,B);return Q=!1,B=q,I},te)}e.latch=w;function S(V,X,te){return[e.filter(V,X,te),e.filter(V,Q=>!X(Q),te)]}e.split=S;function R(V,X=!1,te=[],Q){let B=te.slice(),q=V(ge=>{B?B.push(ge):ne.fire(ge)});Q&&Q.add(q);let I=()=>{B?.forEach(ge=>ne.fire(ge)),B=null},ne=new J({onWillAddFirstListener(){q||(q=V(ge=>ne.fire(ge)),Q&&Q.add(q))},onDidAddFirstListener(){B&&(X?setTimeout(I):I())},onDidRemoveLastListener(){q&&q.dispose(),q=null}});return Q&&Q.add(ne),ne.event}e.buffer=R;function z(V,X){return(te,Q,B)=>{let q=X(new W);return V(function(I){let ne=q.evaluate(I);ne!==A&&te.call(Q,ne)},void 0,B)}}e.chain=z;let A=Symbol("HaltChainable");class W{constructor(){this.steps=[]}map(X){return this.steps.push(X),this}forEach(X){return this.steps.push(te=>(X(te),te)),this}filter(X){return this.steps.push(te=>X(te)?te:A),this}reduce(X,te){let Q=te;return this.steps.push(B=>(Q=X(Q,B),Q)),this}latch(X=(te,Q)=>te===Q){let te=!0,Q;return this.steps.push(B=>{let q=te||!X(B,Q);return te=!1,Q=B,q?B:A}),this}evaluate(X){for(let te of this.steps)if(X=te(X),X===A)break;return X}}function j(V,X,te=Q=>Q){let Q=(...ne)=>I.fire(te(...ne)),B=()=>V.on(X,Q),q=()=>V.removeListener(X,Q),I=new J({onWillAddFirstListener:B,onDidRemoveLastListener:q});return I.event}e.fromNodeEventEmitter=j;function C(V,X,te=Q=>Q){let Q=(...ne)=>I.fire(te(...ne)),B=()=>V.addEventListener(X,Q),q=()=>V.removeEventListener(X,Q),I=new J({onWillAddFirstListener:B,onDidRemoveLastListener:q});return I.event}e.fromDOMEventEmitter=C;function O(V){return new Promise(X=>n(V)(X))}e.toPromise=O;function G(V){let X=new J;return V.then(te=>{X.fire(te)},()=>{X.fire(void 0)}).finally(()=>{X.dispose()}),X.event}e.fromPromise=G;function Z(V,X){return V(te=>X.fire(te))}e.forward=Z;function ae(V,X,te){return X(te),V(Q=>X(Q))}e.runAndSubscribe=ae;class pe{constructor(X,te){this._observable=X,this._counter=0,this._hasChanged=!1;let Q={onWillAddFirstListener:()=>{X.addObserver(this)},onDidRemoveLastListener:()=>{X.removeObserver(this)}};this.emitter=new J(Q),te&&te.add(this.emitter)}beginUpdate(X){this._counter++}handlePossibleChange(X){}handleChange(X,te){this._hasChanged=!0}endUpdate(X){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Oe(V,X){return new pe(V,X).emitter.event}e.fromObservable=Oe;function he(V){return(X,te,Q)=>{let B=0,q=!1,I={beginUpdate(){B++},endUpdate(){B--,B===0&&(V.reportChanges(),q&&(q=!1,X.call(te)))},handlePossibleChange(){},handleChange(){q=!0}};V.addObserver(I),V.reportChanges();let ne={dispose(){V.removeObserver(I)}};return Q instanceof Ls?Q.add(ne):Array.isArray(Q)&&Q.push(ne),ne}}e.fromObservableLight=he})(kt||={});var uu=class du{constructor(i){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${i}_${du._idPool++}`,du.all.add(this)}start(i){this._stopWatch=new QS,this.listenerCount=i}stop(){if(this._stopWatch){let i=this._stopWatch.elapsed();this.durations.push(i),this.elapsedOverall+=i,this.invocationCount+=1,this._stopWatch=void 0}}};uu.all=new Set,uu._idPool=0;var JS=uu,eb=-1,rv=class nv{constructor(i,n,l=(nv._idPool++).toString(16).padStart(3,"0")){this._errorHandler=i,this.threshold=n,this.name=l,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(i,n){let l=this.threshold;if(l<=0||n<l)return;this._stacks||(this._stacks=new Map);let o=this._stacks.get(i.value)||0;if(this._stacks.set(i.value,o+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=l*.5;let[c,d]=this.getMostFrequentStack(),_=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${d}):`;console.warn(_),console.warn(c);let g=new sb(_,c);this._errorHandler(g)}return()=>{let c=this._stacks.get(i.value)||0;this._stacks.set(i.value,c-1)}}getMostFrequentStack(){if(!this._stacks)return;let i,n=0;for(let[l,o]of this._stacks)(!i||n<o)&&(i=[l,o],n=o);return i}};rv._idPool=1;var tb=rv,ib=class lv{constructor(i){this.value=i}static create(){let i=new Error;return new lv(i.stack??"")}print(){console.warn(this.value.split(`
|
|
91
|
+
`).slice(2).join(`
|
|
92
|
+
`))}},sb=class extends Error{constructor(e,i){super(e),this.name="ListenerLeakError",this.stack=i}},rb=class extends Error{constructor(e,i){super(e),this.name="ListenerRefusalError",this.stack=i}},nb=0,Ih=class{constructor(e){this.value=e,this.id=nb++}},lb=2,ab,J=class{constructor(i){this._size=0,this._options=i,this._leakageMon=this._options?.leakWarningThreshold?new tb(i?.onListenerError??Ya,this._options?.leakWarningThreshold??eb):void 0,this._perfMon=this._options?._profName?new JS(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(i,n,l)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let _=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(_);let g=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],f=new rb(`${_}. HINT: Stack shows most frequent listener (${g[1]}-times)`,g[0]);return(this._options?.onListenerError||Ya)(f),xe.None}if(this._disposed)return xe.None;n&&(i=i.bind(n));let o=new Ih(i),c;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(o.stack=ib.create(),c=this._leakageMon.check(o.stack,this._size+1)),this._listeners?this._listeners instanceof Ih?(this._deliveryQueue??=new ob,this._listeners=[this._listeners,o]):this._listeners.push(o):(this._options?.onWillAddFirstListener?.(this),this._listeners=o,this._options?.onDidAddFirstListener?.(this)),this._size++;let d=Ye(()=>{c?.(),this._removeListener(o)});return l instanceof Ls?l.add(d):Array.isArray(l)&&l.push(d),d},this._event}_removeListener(i){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let n=this._listeners,l=n.indexOf(i);if(l===-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--,n[l]=void 0;let o=this._deliveryQueue.current===this;if(this._size*lb<=n.length){let c=0;for(let d=0;d<n.length;d++)n[d]?n[c++]=n[d]:o&&(this._deliveryQueue.end--,c<this._deliveryQueue.i&&this._deliveryQueue.i--);n.length=c}}_deliver(i,n){if(!i)return;let l=this._options?.onListenerError||Ya;if(!l){i.value(n);return}try{i.value(n)}catch(o){l(o)}}_deliverQueue(i){let n=i.current._listeners;for(;i.i<i.end;)this._deliver(n[i.i++],i.value);i.reset()}fire(i){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof Ih)this._deliver(this._listeners,i);else{let n=this._deliveryQueue;n.enqueue(this,i,this._listeners.length),this._deliverQueue(n)}this._perfMon?.stop()}hasListeners(){return this._size>0}},ob=class{constructor(){this.i=-1,this.end=0}enqueue(e,i,n){this.i=0,this.end=n,this.current=e,this.value=i}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},fu=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new J,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new J,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(i){return this.mapWindowIdToZoomLevel.get(this.getWindowId(i))??0}setZoomLevel(i,n){if(this.getZoomLevel(n)===i)return;let l=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(l,i),this._onDidChangeZoomLevel.fire(l)}getZoomFactor(i){return this.mapWindowIdToZoomFactor.get(this.getWindowId(i))??1}setZoomFactor(i,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),i)}setFullscreen(i,n){if(this.isFullscreen(n)===i)return;let l=this.getWindowId(n);this.mapWindowIdToFullScreen.set(l,i),this._onDidChangeFullscreen.fire(l)}isFullscreen(i){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(i))}getWindowId(i){return i.vscodeWindowId}};fu.INSTANCE=new fu;var Yu=fu;function cb(e,i,n){typeof i=="string"&&(i=e.matchMedia(i)),i.addEventListener("change",n)}Yu.INSTANCE.onDidChangeZoomLevel;function hb(e){return Yu.INSTANCE.getZoomFactor(e)}Yu.INSTANCE.onDidChangeFullscreen;var sn=typeof navigator=="object"?navigator.userAgent:"",pu=sn.indexOf("Firefox")>=0,ub=sn.indexOf("AppleWebKit")>=0,Fu=sn.indexOf("Chrome")>=0,db=!Fu&&sn.indexOf("Safari")>=0;sn.indexOf("Electron/")>=0;sn.indexOf("Android")>=0;var Kh=!1;if(typeof ss.matchMedia=="function"){let e=ss.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),i=ss.matchMedia("(display-mode: fullscreen)");Kh=e.matches,cb(ss,e,({matches:n})=>{Kh&&i.matches||(Kh=n)})}var Qr="en",gu=!1,_u=!1,Fa=!1,av=!1,Ua,Ga=Qr,z_=Qr,fb,is,lr=globalThis,ei;typeof lr.vscode<"u"&&typeof lr.vscode.process<"u"?ei=lr.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(ei=process);var pb=typeof ei?.versions?.electron=="string",gb=pb&&ei?.type==="renderer";if(typeof ei=="object"){gu=ei.platform==="win32",_u=ei.platform==="darwin",Fa=ei.platform==="linux",Fa&&ei.env.SNAP&&ei.env.SNAP_REVISION,ei.env.CI||ei.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Ua=Qr,Ga=Qr;let e=ei.env.VSCODE_NLS_CONFIG;if(e)try{let i=JSON.parse(e);Ua=i.userLocale,z_=i.osLocale,Ga=i.resolvedLanguage||Qr,fb=i.languagePack?.translationsConfigFile}catch{}av=!0}else typeof navigator=="object"&&!gb?(is=navigator.userAgent,gu=is.indexOf("Windows")>=0,_u=is.indexOf("Macintosh")>=0,(is.indexOf("Macintosh")>=0||is.indexOf("iPad")>=0||is.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Fa=is.indexOf("Linux")>=0,is?.indexOf("Mobi")>=0,Ga=globalThis._VSCODE_NLS_LANGUAGE||Qr,Ua=navigator.language.toLowerCase(),z_=Ua):console.error("Unable to resolve platform.");var ov=gu,Oi=_u,_b=Fa,A_=av,ji=is,zs=Ga,mb;(e=>{function i(){return zs}e.value=i;function n(){return zs.length===2?zs==="en":zs.length>=3?zs[0]==="e"&&zs[1]==="n"&&zs[2]==="-":!1}e.isDefaultVariant=n;function l(){return zs==="en"}e.isDefault=l})(mb||={});var vb=typeof lr.postMessage=="function"&&!lr.importScripts;(()=>{if(vb){let e=[];lr.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let l=0,o=e.length;l<o;l++){let c=e[l];if(c.id===n.data.vscodeScheduleAsyncWork){e.splice(l,1),c.callback();return}}});let i=0;return n=>{let l=++i;e.push({id:l,callback:n}),lr.postMessage({vscodeScheduleAsyncWork:l},"*")}}return e=>setTimeout(e)})();var yb=!!(ji&&ji.indexOf("Chrome")>=0);ji&&ji.indexOf("Firefox")>=0;!yb&&ji&&ji.indexOf("Safari")>=0;ji&&ji.indexOf("Edg/")>=0;ji&&ji.indexOf("Android")>=0;var Vr=typeof navigator=="object"?navigator:{};A_||document.queryCommandSupported&&document.queryCommandSupported("copy")||Vr&&Vr.clipboard&&Vr.clipboard.writeText,A_||Vr&&Vr.clipboard&&Vr.clipboard.readText;var Gu=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,i){this._keyCodeToStr[e]=i,this._strToKeyCode[i.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},$h=new Gu,M_=new Gu,O_=new Gu,xb=new Array(230),cv;(e=>{function i(_){return $h.keyCodeToStr(_)}e.toString=i;function n(_){return $h.strToKeyCode(_)}e.fromString=n;function l(_){return M_.keyCodeToStr(_)}e.toUserSettingsUS=l;function o(_){return O_.keyCodeToStr(_)}e.toUserSettingsGeneral=o;function c(_){return M_.strToKeyCode(_)||O_.strToKeyCode(_)}e.fromUserSettings=c;function d(_){if(_>=98&&_<=113)return null;switch(_){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return $h.keyCodeToStr(_)}e.toElectronAccelerator=d})(cv||={});var Sb=class hv{constructor(i,n,l,o,c){this.ctrlKey=i,this.shiftKey=n,this.altKey=l,this.metaKey=o,this.keyCode=c}equals(i){return i instanceof hv&&this.ctrlKey===i.ctrlKey&&this.shiftKey===i.shiftKey&&this.altKey===i.altKey&&this.metaKey===i.metaKey&&this.keyCode===i.keyCode}getHashCode(){let i=this.ctrlKey?"1":"0",n=this.shiftKey?"1":"0",l=this.altKey?"1":"0",o=this.metaKey?"1":"0";return`K${i}${n}${l}${o}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new bb([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},bb=class{constructor(e){if(e.length===0)throw FS("chords");this.chords=e}getHashCode(){let e="";for(let i=0,n=this.chords.length;i<n;i++)i!==0&&(e+=";"),e+=this.chords[i].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let i=0;i<this.chords.length;i++)if(!this.chords[i].equals(e.chords[i]))return!1;return!0}};function wb(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return cv.fromString(n)}let i=e.keyCode;if(i===3)return 7;if(pu)switch(i){case 59:return 85;case 60:if(_b)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Oi)return 57;break}else if(ub&&(Oi&&i===93||!Oi&&i===92))return 57;return xb[i]||0}var Cb=Oi?256:2048,kb=512,Eb=1024,Tb=Oi?2048:256,j_=class{constructor(e){this._standardKeyboardEventBrand=!0;let i=e;this.browserEvent=i,this.target=i.target,this.ctrlKey=i.ctrlKey,this.shiftKey=i.shiftKey,this.altKey=i.altKey,this.metaKey=i.metaKey,this.altGraphKey=i.getModifierState?.("AltGraph"),this.keyCode=wb(i),this.code=i.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 i=0;return this.ctrlKey&&(i|=Cb),this.altKey&&(i|=kb),this.shiftKey&&(i|=Eb),this.metaKey&&(i|=Tb),i|=e,i}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new Sb(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},L_=new WeakMap;function Rb(e){if(!e.parent||e.parent===e)return null;try{let i=e.location,n=e.parent.location;if(i.origin!=="null"&&n.origin!=="null"&&i.origin!==n.origin)return null}catch{return null}return e.parent}var Db=class{static getSameOriginWindowChain(e){let i=L_.get(e);if(!i){i=[],L_.set(e,i);let n=e,l;do l=Rb(n),l?i.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):i.push({window:new WeakRef(n),iframeElement:null}),n=l;while(n)}return i.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,i){if(!i||e===i)return{top:0,left:0};let n=0,l=0,o=this.getSameOriginWindowChain(e);for(let c of o){let d=c.window.deref();if(n+=d?.scrollY??0,l+=d?.scrollX??0,d===i||!c.iframeElement)break;let _=c.iframeElement.getBoundingClientRect();n+=_.top,l+=_.left}return{top:n,left:l}}},Wa=class{constructor(i,n){this.timestamp=Date.now(),this.browserEvent=n,this.leftButton=n.button===0,this.middleButton=n.button===1,this.rightButton=n.button===2,this.buttons=n.buttons,this.target=n.target,this.detail=n.detail||1,n.type==="dblclick"&&(this.detail=2),this.ctrlKey=n.ctrlKey,this.shiftKey=n.shiftKey,this.altKey=n.altKey,this.metaKey=n.metaKey,typeof n.pageX=="number"?(this.posx=n.pageX,this.posy=n.pageY):(this.posx=n.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=n.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let l=Db.getPositionOfChildWindowRelativeToAncestorWindow(i,n.view);this.posx-=l.left,this.posy-=l.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},N_=class{constructor(e,i=0,n=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=i;let l=!1;if(Fu){let o=navigator.userAgent.match(/Chrome\/(\d+)/);l=(o?parseInt(o[1]):123)<=122}if(e){let o=e,c=e,d=e.view?.devicePixelRatio||1;if(typeof o.wheelDeltaY<"u")l?this.deltaY=o.wheelDeltaY/(120*d):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 _=e;_.deltaMode===_.DOM_DELTA_LINE?pu&&!Oi?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")db&&ov?this.deltaX=-(o.wheelDeltaX/120):l?this.deltaX=o.wheelDeltaX/(120*d):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 _=e;_.deltaMode===_.DOM_DELTA_LINE?pu&&!Oi?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(l?this.deltaY=e.wheelDelta/(120*d):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},uv=Object.freeze(function(e,i){let n=setTimeout(e.bind(i),0);return{dispose(){clearTimeout(n)}}}),Bb;(e=>{function i(n){return n===e.None||n===e.Cancelled||n instanceof zb?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=i,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:kt.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:uv})})(Bb||={});var zb=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?uv:(this._emitter||(this._emitter=new J),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Xu=class{constructor(i,n){this._isDisposed=!1,this._token=-1,typeof i=="function"&&typeof n=="number"&&this.setIfNotSet(i,n)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(i,n){if(this._isDisposed)throw new ou("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,i()},n)}setIfNotSet(i,n){if(this._isDisposed)throw new ou("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,i()},n))}},Ab=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,i,n=globalThis){if(this.isDisposed)throw new ou("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let l=n.setInterval(()=>{e()},i);this.disposable=Ye(()=>{n.clearInterval(l),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},Mb;(e=>{async function i(l){let o,c=await Promise.all(l.map(d=>d.then(_=>_,_=>{o||(o=_)})));if(typeof o<"u")throw o;return c}e.settled=i;function n(l){return new Promise(async(o,c)=>{try{await l(o,c)}catch(d){c(d)}})}e.withAsyncBody=n})(Mb||={});var H_=class fi{static fromArray(i){return new fi(n=>{n.emitMany(i)})}static fromPromise(i){return new fi(async n=>{n.emitMany(await i)})}static fromPromises(i){return new fi(async n=>{await Promise.all(i.map(async l=>n.emitOne(await l)))})}static merge(i){return new fi(async n=>{await Promise.all(i.map(async l=>{for await(let o of l)n.emitOne(o)}))})}constructor(i,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new J,queueMicrotask(async()=>{let l={emitOne:o=>this.emitOne(o),emitMany:o=>this.emitMany(o),reject:o=>this.reject(o)};try{await Promise.resolve(i(l)),this.resolve()}catch(o){this.reject(o)}finally{l.emitOne=void 0,l.emitMany=void 0,l.reject=void 0}})}[Symbol.asyncIterator](){let i=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(i<this._results.length)return{done:!1,value:this._results[i++]};if(this._state===1)return{done:!0,value:void 0};await kt.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(i,n){return new fi(async l=>{for await(let o of i)l.emitOne(n(o))})}map(i){return fi.map(this,i)}static filter(i,n){return new fi(async l=>{for await(let o of i)n(o)&&l.emitOne(o)})}filter(i){return fi.filter(this,i)}static coalesce(i){return fi.filter(i,n=>!!n)}coalesce(){return fi.coalesce(this)}static async toPromise(i){let n=[];for await(let l of i)n.push(l);return n}toPromise(){return fi.toPromise(this)}emitOne(i){this._state===0&&(this._results.push(i),this._onStateChanged.fire())}emitMany(i){this._state===0&&(this._results=this._results.concat(i),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(i){this._state===0&&(this._state=2,this._error=i,this._onStateChanged.fire())}};H_.EMPTY=H_.fromArray([]);var{getWindow:Mi,getWindowId:Ob,onDidRegisterWindow:jb}=(function(){let e=new Map,i={window:ss,disposables:new Ls};e.set(ss.vscodeWindowId,i);let n=new J,l=new J,o=new J;function c(d,_){return(typeof d=="number"?e.get(d):void 0)??(_?i:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:o.event,onDidUnregisterWindow:l.event,registerWindow(d){if(e.has(d.vscodeWindowId))return xe.None;let _=new Ls,g={window:d,disposables:_.add(new Ls)};return e.set(d.vscodeWindowId,g),_.add(Ye(()=>{e.delete(d.vscodeWindowId),l.fire(d)})),_.add(fe(d,gt.BEFORE_UNLOAD,()=>{o.fire(d)})),n.fire(g),_},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(d){return d.vscodeWindowId},hasWindow(d){return e.has(d)},getWindowById:c,getWindow(d){let _=d;if(_?.ownerDocument?.defaultView)return _.ownerDocument.defaultView.window;let g=d;return g?.view?g.view.window:ss},getDocument(d){return Mi(d).document}}})(),Lb=class{constructor(e,i,n,l){this._node=e,this._type=i,this._handler=n,this._options=l||!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 fe(e,i,n,l){return new Lb(e,i,n,l)}var U_=function(e,i,n,l){return fe(e,i,n,l)},Vu,Nb=class extends Ab{constructor(e){super(),this.defaultTarget=e&&Mi(e)}cancelAndSet(e,i,n){return super.cancelAndSet(e,i,n??this.defaultTarget)}},W_=class{constructor(e,i=0){this._runner=e,this.priority=i,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Ya(e)}}static sort(e,i){return i.priority-e.priority}};(function(){let e=new Map,i=new Map,n=new Map,l=new Map,o=c=>{n.set(c,!1);let d=e.get(c)??[];for(i.set(c,d),e.set(c,[]),l.set(c,!0);d.length>0;)d.sort(W_.sort),d.shift().execute();l.set(c,!1)};Vu=(c,d,_=0)=>{let g=Ob(c),f=new W_(d,_),x=e.get(g);return x||(x=[],e.set(g,x)),x.push(f),n.get(g)||(n.set(g,!0),c.requestAnimationFrame(()=>o(g))),f}})();function Hb(e){let i=e.getBoundingClientRect(),n=Mi(e);return{left:i.left+n.scrollX,top:i.top+n.scrollY,width:i.width,height:i.height}}var gt={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"},Ub=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 i=Pt(e);this._maxWidth!==i&&(this._maxWidth=i,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let i=Pt(e);this._width!==i&&(this._width=i,this.domNode.style.width=this._width)}setHeight(e){let i=Pt(e);this._height!==i&&(this._height=i,this.domNode.style.height=this._height)}setTop(e){let i=Pt(e);this._top!==i&&(this._top=i,this.domNode.style.top=this._top)}setLeft(e){let i=Pt(e);this._left!==i&&(this._left=i,this.domNode.style.left=this._left)}setBottom(e){let i=Pt(e);this._bottom!==i&&(this._bottom=i,this.domNode.style.bottom=this._bottom)}setRight(e){let i=Pt(e);this._right!==i&&(this._right=i,this.domNode.style.right=this._right)}setPaddingTop(e){let i=Pt(e);this._paddingTop!==i&&(this._paddingTop=i,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let i=Pt(e);this._paddingLeft!==i&&(this._paddingLeft=i,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let i=Pt(e);this._paddingBottom!==i&&(this._paddingBottom=i,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let i=Pt(e);this._paddingRight!==i&&(this._paddingRight=i,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 i=Pt(e);this._fontSize!==i&&(this._fontSize=i,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 i=Pt(e);this._lineHeight!==i&&(this._lineHeight=i,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let i=Pt(e);this._letterSpacing!==i&&(this._letterSpacing=i,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,i){this.domNode.classList.toggle(e,i),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,i){this.domNode.setAttribute(e,i)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function Pt(e){return typeof e=="number"?`${e}px`:e}function fl(e){return new Ub(e)}var dv=class{constructor(){this._hooks=new Ls,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,i){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(i)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,i,n,l,o){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=l,this._onStopCallback=o;let c=e;try{e.setPointerCapture(i),this._hooks.add(Ye(()=>{try{e.releasePointerCapture(i)}catch{}}))}catch{c=Mi(e)}this._hooks.add(fe(c,gt.POINTER_MOVE,d=>{if(d.buttons!==n){this.stopMonitoring(!0);return}d.preventDefault(),this._pointerMoveCallback(d)})),this._hooks.add(fe(c,gt.POINTER_UP,d=>this.stopMonitoring(!0)))}};function Wb(e,i,n){let l=null,o=null;if(typeof n.value=="function"?(l="value",o=n.value,o.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(l="get",o=n.get),!o)throw new Error("not supported");let c=`$memoize$${i}`;n[l]=function(...d){return this.hasOwnProperty(c)||Object.defineProperty(this,c,{configurable:!1,enumerable:!1,writable:!1,value:o.apply(this,d)}),this[c]}}var zi;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(zi||={});var al=class Rt extends xe{constructor(){super(),this.dispatched=!1,this.targets=new B_,this.ignoreTargets=new B_,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(kt.runAndSubscribe(jb,({window:i,disposables:n})=>{n.add(fe(i.document,"touchstart",l=>this.onTouchStart(l),{passive:!1})),n.add(fe(i.document,"touchend",l=>this.onTouchEnd(i,l))),n.add(fe(i.document,"touchmove",l=>this.onTouchMove(l),{passive:!1}))},{window:ss,disposables:this._store}))}static addTarget(i){if(!Rt.isTouchDevice())return xe.None;Rt.INSTANCE||(Rt.INSTANCE=new Rt);let n=Rt.INSTANCE.targets.push(i);return Ye(n)}static ignoreTarget(i){if(!Rt.isTouchDevice())return xe.None;Rt.INSTANCE||(Rt.INSTANCE=new Rt);let n=Rt.INSTANCE.ignoreTargets.push(i);return Ye(n)}static isTouchDevice(){return"ontouchstart"in ss||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(i){let n=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let l=0,o=i.targetTouches.length;l<o;l++){let c=i.targetTouches.item(l);this.activeTouches[c.identifier]={id:c.identifier,initialTarget:c.target,initialTimeStamp:n,initialPageX:c.pageX,initialPageY:c.pageY,rollingTimestamps:[n],rollingPageX:[c.pageX],rollingPageY:[c.pageY]};let d=this.newGestureEvent(zi.Start,c.target);d.pageX=c.pageX,d.pageY=c.pageY,this.dispatchEvent(d)}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}onTouchEnd(i,n){let l=Date.now(),o=Object.keys(this.activeTouches).length;for(let c=0,d=n.changedTouches.length;c<d;c++){let _=n.changedTouches.item(c);if(!this.activeTouches.hasOwnProperty(String(_.identifier))){console.warn("move of an UNKNOWN touch",_);continue}let g=this.activeTouches[_.identifier],f=Date.now()-g.initialTimeStamp;if(f<Rt.HOLD_DELAY&&Math.abs(g.initialPageX-Qt(g.rollingPageX))<30&&Math.abs(g.initialPageY-Qt(g.rollingPageY))<30){let x=this.newGestureEvent(zi.Tap,g.initialTarget);x.pageX=Qt(g.rollingPageX),x.pageY=Qt(g.rollingPageY),this.dispatchEvent(x)}else if(f>=Rt.HOLD_DELAY&&Math.abs(g.initialPageX-Qt(g.rollingPageX))<30&&Math.abs(g.initialPageY-Qt(g.rollingPageY))<30){let x=this.newGestureEvent(zi.Contextmenu,g.initialTarget);x.pageX=Qt(g.rollingPageX),x.pageY=Qt(g.rollingPageY),this.dispatchEvent(x)}else if(o===1){let x=Qt(g.rollingPageX),v=Qt(g.rollingPageY),b=Qt(g.rollingTimestamps)-g.rollingTimestamps[0],w=x-g.rollingPageX[0],S=v-g.rollingPageY[0],R=[...this.targets].filter(z=>g.initialTarget instanceof Node&&z.contains(g.initialTarget));this.inertia(i,R,l,Math.abs(w)/b,w>0?1:-1,x,Math.abs(S)/b,S>0?1:-1,v)}this.dispatchEvent(this.newGestureEvent(zi.End,g.initialTarget)),delete this.activeTouches[_.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(i,n){let l=document.createEvent("CustomEvent");return l.initEvent(i,!1,!0),l.initialTarget=n,l.tapCount=0,l}dispatchEvent(i){if(i.type===zi.Tap){let n=new Date().getTime(),l=0;n-this._lastSetTapCountTime>Rt.CLEAR_TAP_COUNT_TIME?l=1:l=2,this._lastSetTapCountTime=n,i.tapCount=l}else(i.type===zi.Change||i.type===zi.Contextmenu)&&(this._lastSetTapCountTime=0);if(i.initialTarget instanceof Node){for(let l of this.ignoreTargets)if(l.contains(i.initialTarget))return;let n=[];for(let l of this.targets)if(l.contains(i.initialTarget)){let o=0,c=i.initialTarget;for(;c&&c!==l;)o++,c=c.parentElement;n.push([o,l])}n.sort((l,o)=>l[0]-o[0]);for(let[l,o]of n)o.dispatchEvent(i),this.dispatched=!0}}inertia(i,n,l,o,c,d,_,g,f){this.handle=Vu(i,()=>{let x=Date.now(),v=x-l,b=0,w=0,S=!0;o+=Rt.SCROLL_FRICTION*v,_+=Rt.SCROLL_FRICTION*v,o>0&&(S=!1,b=c*o*v),_>0&&(S=!1,w=g*_*v);let R=this.newGestureEvent(zi.Change);R.translationX=b,R.translationY=w,n.forEach(z=>z.dispatchEvent(R)),S||this.inertia(i,n,x,o,c,d+b,_,g,f+w)})}onTouchMove(i){let n=Date.now();for(let l=0,o=i.changedTouches.length;l<o;l++){let c=i.changedTouches.item(l);if(!this.activeTouches.hasOwnProperty(String(c.identifier))){console.warn("end of an UNKNOWN touch",c);continue}let d=this.activeTouches[c.identifier],_=this.newGestureEvent(zi.Change,d.initialTarget);_.translationX=c.pageX-Qt(d.rollingPageX),_.translationY=c.pageY-Qt(d.rollingPageY),_.pageX=c.pageX,_.pageY=c.pageY,this.dispatchEvent(_),d.rollingPageX.length>3&&(d.rollingPageX.shift(),d.rollingPageY.shift(),d.rollingTimestamps.shift()),d.rollingPageX.push(c.pageX),d.rollingPageY.push(c.pageY),d.rollingTimestamps.push(n)}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}};al.SCROLL_FRICTION=-.005,al.HOLD_DELAY=700,al.CLEAR_TAP_COUNT_TIME=400,Qe([Wb],al,"isTouchDevice",1);var Pb=al,Zu=class extends xe{onclick(e,i){this._register(fe(e,gt.CLICK,n=>i(new Wa(Mi(e),n))))}onmousedown(e,i){this._register(fe(e,gt.MOUSE_DOWN,n=>i(new Wa(Mi(e),n))))}onmouseover(e,i){this._register(fe(e,gt.MOUSE_OVER,n=>i(new Wa(Mi(e),n))))}onmouseleave(e,i){this._register(fe(e,gt.MOUSE_LEAVE,n=>i(new Wa(Mi(e),n))))}onkeydown(e,i){this._register(fe(e,gt.KEY_DOWN,n=>i(new j_(n))))}onkeyup(e,i){this._register(fe(e,gt.KEY_UP,n=>i(new j_(n))))}oninput(e,i){this._register(fe(e,gt.INPUT,i))}onblur(e,i){this._register(fe(e,gt.BLUR,i))}onfocus(e,i){this._register(fe(e,gt.FOCUS,i))}onchange(e,i){this._register(fe(e,gt.CHANGE,i))}ignoreGesture(e){return Pb.ignoreTarget(e)}},P_=11,qb=class extends Zu{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=P_+"px",this.domNode.style.height=P_+"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 dv),this._register(U_(this.bgDomNode,gt.POINTER_DOWN,i=>this._arrowPointerDown(i))),this._register(U_(this.domNode,gt.POINTER_DOWN,i=>this._arrowPointerDown(i))),this._pointerdownRepeatTimer=this._register(new Nb),this._pointerdownScheduleRepeatTimer=this._register(new Xu)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let i=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Mi(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(i,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},Ib=class mu{constructor(i,n,l,o,c,d,_){this._forceIntegerValues=i,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,l=l|0,o=o|0,c=c|0,d=d|0,_=_|0),this.rawScrollLeft=o,this.rawScrollTop=_,n<0&&(n=0),o+n>l&&(o=l-n),o<0&&(o=0),c<0&&(c=0),_+c>d&&(_=d-c),_<0&&(_=0),this.width=n,this.scrollWidth=l,this.scrollLeft=o,this.height=c,this.scrollHeight=d,this.scrollTop=_}equals(i){return this.rawScrollLeft===i.rawScrollLeft&&this.rawScrollTop===i.rawScrollTop&&this.width===i.width&&this.scrollWidth===i.scrollWidth&&this.scrollLeft===i.scrollLeft&&this.height===i.height&&this.scrollHeight===i.scrollHeight&&this.scrollTop===i.scrollTop}withScrollDimensions(i,n){return new mu(this._forceIntegerValues,typeof i.width<"u"?i.width:this.width,typeof i.scrollWidth<"u"?i.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof i.height<"u"?i.height:this.height,typeof i.scrollHeight<"u"?i.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(i){return new mu(this._forceIntegerValues,this.width,this.scrollWidth,typeof i.scrollLeft<"u"?i.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof i.scrollTop<"u"?i.scrollTop:this.rawScrollTop)}createScrollEvent(i,n){let l=this.width!==i.width,o=this.scrollWidth!==i.scrollWidth,c=this.scrollLeft!==i.scrollLeft,d=this.height!==i.height,_=this.scrollHeight!==i.scrollHeight,g=this.scrollTop!==i.scrollTop;return{inSmoothScrolling:n,oldWidth:i.width,oldScrollWidth:i.scrollWidth,oldScrollLeft:i.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:i.height,oldScrollHeight:i.scrollHeight,oldScrollTop:i.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:l,scrollWidthChanged:o,scrollLeftChanged:c,heightChanged:d,scrollHeightChanged:_,scrollTopChanged:g}}},Kb=class extends xe{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new J),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new Ib(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,i){let n=this._state.withScrollDimensions(e,i);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let i=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(i,!1)}setScrollPositionSmooth(e,i){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 l;i?l=new I_(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):l=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=l}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=I_.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(),i=this._state.withScrollPosition(e);if(this._setState(i,!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,i){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,i)))}},q_=class{constructor(e,i,n){this.scrollLeft=e,this.scrollTop=i,this.isDone=n}};function Yh(e,i){let n=i-e;return function(l){return e+n*Fb(l)}}function $b(e,i,n){return function(l){return l<n?e(l/n):i((l-n)/(1-n))}}var I_=class vu{constructor(i,n,l,o){this.from=i,this.to=n,this.duration=o,this.startTime=l,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(i,n,l){if(Math.abs(i-n)>2.5*l){let o,c;return i<n?(o=i+.75*l,c=n-.75*l):(o=i-.75*l,c=n+.75*l),$b(Yh(i,o),Yh(c,n),.33)}return Yh(i,n)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(i){this.to=i.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(i){let n=(i-this.startTime)/this.duration;if(n<1){let l=this.scrollLeft(n),o=this.scrollTop(n);return new q_(l,o,!1)}return new q_(this.to.scrollLeft,this.to.scrollTop,!0)}combine(i,n,l){return vu.start(i,n,l)}static start(i,n,l){l=l+10;let o=Date.now()-10;return new vu(i,n,o,l)}};function Yb(e){return Math.pow(e,3)}function Fb(e){return 1-Yb(1-e)}var Gb=class extends xe{constructor(e,i,n){super(),this._visibility=e,this._visibleClassName=i,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Xu)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?" fade":"")))}},Xb=140,fv=class extends Zu{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 Gb(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new dv),this._shouldRender=!0,this.domNode=fl(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(fe(this.domNode.domNode,gt.POINTER_DOWN,i=>this._domNodePointerDown(i)))}_createArrow(e){let i=this._register(new qb(e));this.domNode.domNode.appendChild(i.bgDomNode),this.domNode.domNode.appendChild(i.domNode)}_createSlider(e,i,n,l){this.slider=fl(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(i),typeof n=="number"&&this.slider.setWidth(n),typeof l=="number"&&this.slider.setHeight(l),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(fe(this.slider.domNode,gt.POINTER_DOWN,o=>{o.button===0&&(o.preventDefault(),this._sliderPointerDown(o))})),this.onclick(this.slider.domNode,o=>{o.leftButton&&o.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 i=this.domNode.domNode.getClientRects()[0].top,n=i+this._scrollbarState.getSliderPosition(),l=i+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),o=this._sliderPointerPosition(e);n<=o&&o<=l?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let i,n;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")i=e.offsetX,n=e.offsetY;else{let o=Hb(this.domNode.domNode);i=e.pageX-o.left,n=e.pageY-o.top}let l=this._pointerDownRelativePosition(i,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(l):this._scrollbarState.getDesiredScrollPositionFromOffset(l)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let i=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),l=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,o=>{let c=this._sliderOrthogonalPointerPosition(o),d=Math.abs(c-n);if(ov&&d>Xb){this._setDesiredScrollPositionNow(l.getScrollPosition());return}let _=this._sliderPointerPosition(o)-i;this._setDesiredScrollPositionNow(l.getDesiredScrollPositionFromDelta(_))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let i={};this.writeScrollPosition(i,e),this._scrollable.setScrollPositionNow(i)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},pv=class yu{constructor(i,n,l,o,c,d){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(l),this._arrowSize=Math.round(i),this._visibleSize=o,this._scrollSize=c,this._scrollPosition=d,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new yu(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(i){let n=Math.round(i);return this._visibleSize!==n?(this._visibleSize=n,this._refreshComputedValues(),!0):!1}setScrollSize(i){let n=Math.round(i);return this._scrollSize!==n?(this._scrollSize=n,this._refreshComputedValues(),!0):!1}setScrollPosition(i){let n=Math.round(i);return this._scrollPosition!==n?(this._scrollPosition=n,this._refreshComputedValues(),!0):!1}setScrollbarSize(i){this._scrollbarSize=Math.round(i)}setOppositeScrollbarSize(i){this._oppositeScrollbarSize=Math.round(i)}static _computeValues(i,n,l,o,c){let d=Math.max(0,l-i),_=Math.max(0,d-2*n),g=o>0&&o>l;if(!g)return{computedAvailableSize:Math.round(d),computedIsNeeded:g,computedSliderSize:Math.round(_),computedSliderRatio:0,computedSliderPosition:0};let f=Math.round(Math.max(20,Math.floor(l*_/o))),x=(_-f)/(o-l),v=c*x;return{computedAvailableSize:Math.round(d),computedIsNeeded:g,computedSliderSize:Math.round(f),computedSliderRatio:x,computedSliderPosition:Math.round(v)}}_refreshComputedValues(){let i=yu._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=i.computedAvailableSize,this._computedIsNeeded=i.computedIsNeeded,this._computedSliderSize=i.computedSliderSize,this._computedSliderRatio=i.computedSliderRatio,this._computedSliderPosition=i.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(i){if(!this._computedIsNeeded)return 0;let n=i-this._arrowSize-this._computedSliderSize/2;return Math.round(n/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(i){if(!this._computedIsNeeded)return 0;let n=i-this._arrowSize,l=this._scrollPosition;return n<this._computedSliderPosition?l-=this._visibleSize:l+=this._visibleSize,l}getDesiredScrollPositionFromDelta(i){if(!this._computedIsNeeded)return 0;let n=this._computedSliderPosition+i;return Math.round(n/this._computedSliderRatio)}},Vb=class extends fv{constructor(e,i,n){let l=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:i.lazyRender,host:n,scrollbarState:new pv(i.horizontalHasArrows?i.arrowSize:0,i.horizontal===2?0:i.horizontalScrollbarSize,i.vertical===2?0:i.verticalScrollbarSize,l.width,l.scrollWidth,o.scrollLeft),visibility:i.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:i.scrollByPage}),i.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((i.horizontalScrollbarSize-i.horizontalSliderSize)/2),0,void 0,i.horizontalSliderSize)}_updateSlider(e,i){this.slider.setWidth(e),this.slider.setLeft(i)}_renderDomNode(e,i){this.domNode.setWidth(e),this.domNode.setHeight(i),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,i){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,i){e.scrollLeft=i}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}},Zb=class extends fv{constructor(e,i,n){let l=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:i.lazyRender,host:n,scrollbarState:new pv(i.verticalHasArrows?i.arrowSize:0,i.vertical===2?0:i.verticalScrollbarSize,0,l.height,l.scrollHeight,o.scrollTop),visibility:i.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:i.scrollByPage}),i.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((i.verticalScrollbarSize-i.verticalSliderSize)/2),i.verticalSliderSize,void 0)}_updateSlider(e,i){this.slider.setHeight(e),this.slider.setTop(i)}_renderDomNode(e,i){this.domNode.setWidth(i),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,i){return i}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,i){e.scrollTop=i}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},Qb=500,K_=50,Jb=class{constructor(e,i,n){this.timestamp=e,this.deltaX=i,this.deltaY=n,this.score=0}},xu=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let i=1,n=0,l=1,o=this._rear;do{let c=o===this._front?i:Math.pow(2,-l);if(i-=c,n+=this._memory[o].score*c,o===this._front)break;o=(this._capacity+o-1)%this._capacity,l++}while(!0);return n<=.5}acceptStandardWheelEvent(i){if(Fu){let n=Mi(i.browserEvent),l=hb(n);this.accept(Date.now(),i.deltaX*l,i.deltaY*l)}else this.accept(Date.now(),i.deltaX,i.deltaY)}accept(i,n,l){let o=null,c=new Jb(i,n,l);this._front===-1&&this._rear===-1?(this._memory[0]=c,this._front=0,this._rear=0):(o=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=c),c.score=this._computeScore(c,o)}_computeScore(i,n){if(Math.abs(i.deltaX)>0&&Math.abs(i.deltaY)>0)return 1;let l=.5;if((!this._isAlmostInt(i.deltaX)||!this._isAlmostInt(i.deltaY))&&(l+=.25),n){let o=Math.abs(i.deltaX),c=Math.abs(i.deltaY),d=Math.abs(n.deltaX),_=Math.abs(n.deltaY),g=Math.max(Math.min(o,d),1),f=Math.max(Math.min(c,_),1),x=Math.max(o,d),v=Math.max(c,_);x%g===0&&v%f===0&&(l-=.5)}return Math.min(Math.max(l,0),1)}_isAlmostInt(i){return Math.abs(Math.round(i)-i)<.01}};xu.INSTANCE=new xu;var e1=xu,t1=class extends Zu{constructor(e,i,n){super(),this._onScroll=this._register(new J),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new J),this.onWillScroll=this._onWillScroll.event,this._options=s1(i),this._scrollable=n,this._register(this._scrollable.onScroll(o=>{this._onWillScroll.fire(o),this._onDidScroll(o),this._onScroll.fire(o)}));let l={onMouseWheel:o=>this._onMouseWheel(o),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new Zb(this._scrollable,this._options,l)),this._horizontalScrollbar=this._register(new Vb(this._scrollable,this._options,l)),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=fl(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=fl(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=fl(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,o=>this._onMouseOver(o)),this.onmouseleave(this._listenOnDomNode,o=>this._onMouseLeave(o)),this._hideTimeout=this._register(new Xu),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=ar(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,Oi&&(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 N_(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=ar(this._mouseWheelToDispose),e)){let i=n=>{this._onMouseWheel(new N_(n))};this._mouseWheelToDispose.push(fe(this._listenOnDomNode,gt.MOUSE_WHEEL,i,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let i=e1.INSTANCE;i.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 d=!Oi&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||d)&&!c&&(c=o,o=0),e.browserEvent&&e.browserEvent.altKey&&(c=c*this._options.fastScrollSensitivity,o=o*this._options.fastScrollSensitivity);let _=this._scrollable.getFutureScrollPosition(),g={};if(o){let f=K_*o,x=_.scrollTop-(f<0?Math.floor(f):Math.ceil(f));this._verticalScrollbar.writeScrollPosition(g,x)}if(c){let f=K_*c,x=_.scrollLeft-(f<0?Math.floor(f):Math.ceil(f));this._horizontalScrollbar.writeScrollPosition(g,x)}g=this._scrollable.validateScrollPosition(g),(_.scrollLeft!==g.scrollLeft||_.scrollTop!==g.scrollTop)&&(this._options.mouseWheelSmoothScroll&&i.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(g):this._scrollable.setScrollPositionNow(g),n=!0)}let l=n;!l&&this._options.alwaysConsumeMouseWheel&&(l=!0),!l&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(l=!0),l&&(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(),i=e.scrollTop>0,n=e.scrollLeft>0,l=n?" left":"",o=i?" top":"",c=n||i?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${l}`),this._topShadowDomNode.setClassName(`shadow${o}`),this._topLeftShadowDomNode.setClassName(`shadow${c}${o}${l}`)}}_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(),Qb)}},i1=class extends t1{constructor(e,i,n){super(e,i,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function s1(e){let i={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 i.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:i.horizontalScrollbarSize,i.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:i.verticalScrollbarSize,Oi&&(i.className+=" mac"),i}var Su=class extends xe{constructor(e,i,n,l,o,c,d,_){super(),this._bufferService=n,this._optionsService=d,this._renderService=_,this._onRequestScrollLines=this._register(new J),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let g=this._register(new Kb({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:f=>Vu(l.window,f)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{g.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new i1(i,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},g)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(o.onProtocolChange(f=>{this._scrollableElement.updateOptions({handleMouseWheel:!(f&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(kt.runAndSubscribe(c.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=c.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Ye(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=l.mainDocument.createElement("style"),i.appendChild(this._styleElement),this._register(Ye(()=>this._styleElement.remove())),this._register(kt.runAndSubscribe(c.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${c.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${c.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${c.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
93
|
+
`)})),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(f=>this._handleScroll(f)))}scrollLines(e){let i=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:i.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,i){i&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!i,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let i=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=i-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=i,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};Su=Qe([se(2,At),se(3,rs),se(4,Gm),se(5,tn),se(6,Mt),se(7,ns)],Su);var bu=class extends xe{constructor(e,i,n,l,o){super(),this._screenElement=e,this._bufferService=i,this._coreBrowserService=n,this._decorationService=l,this._renderService=o,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(c=>this._removeDecoration(c))),this._register(Ye(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let i=this._coreBrowserService.mainDocument.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer",e?.options?.layer==="top"),i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,i.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(e,i),i}_refreshStyle(e){let i=e.marker.line-this._bufferService.buffers.active.ydisp;if(i<0||i>=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=`${i*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,i=e.element){if(!i)return;let n=e.options.x??0;(e.options.anchor||"left")==="right"?i.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:"":i.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};bu=Qe([se(1,At),se(2,rs),se(3,vl),se(4,ns)],bu);var r1=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 i of this._zones)if(i.color===e.options.overviewRulerOptions.color&&i.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(i,e.marker.line))return;if(this._lineAdjacentToZone(i,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(i,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,i){return i>=e.startBufferLine&&i<=e.endBufferLine}_lineAdjacentToZone(e,i,n){return i>=e.startBufferLine-this._linePadding[n||"full"]&&i<=e.endBufferLine+this._linePadding[n||"full"]}_addLineToZone(e,i){e.startBufferLine=Math.min(e.startBufferLine,i),e.endBufferLine=Math.max(e.endBufferLine,i)}},Di={full:0,left:0,center:0,right:0},As={full:0,left:0,center:0,right:0},Jn={full:0,left:0,center:0,right:0},eo=class extends xe{constructor(e,i,n,l,o,c,d,_){super(),this._viewportElement=e,this._screenElement=i,this._bufferService=n,this._decorationService=l,this._renderService=o,this._optionsService=c,this._themeService=d,this._coreBrowserService=_,this._colorZoneStore=new r1,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(Ye(()=>this._canvas?.remove()));let g=this._canvas.getContext("2d");if(g)this._ctx=g;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),i=Math.ceil((this._canvas.width-1)/3);As.full=this._canvas.width,As.left=e,As.center=i,As.right=e,this._refreshDrawHeightConstants(),Jn.full=1,Jn.left=1,Jn.center=1+As.left,Jn.right=1+As.left+As.center}_refreshDrawHeightConstants(){Di.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,i=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);Di.left=i,Di.center=i,Di.right=i}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Di.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Di.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Di.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Di.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 i of this._decorationService.decorations)this._colorZoneStore.addDecoration(i);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let i of e)i.position!=="full"&&this._renderColorZone(i);for(let i of e)i.position==="full"&&this._renderColorZone(i);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(Jn[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Di[e.position||"full"]/2),As[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Di[e.position||"full"]))}_queueRefresh(e,i){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=i||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};eo=Qe([se(2,At),se(3,vl),se(4,ns),se(5,Mt),se(6,tn),se(7,rs)],eo);var F;(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=`
|
|
94
|
+
`,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=""))(F||={});var Xa;(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=""))(Xa||={});var gv;(e=>e.ST=`${F.ESC}\\`)(gv||={});var wu=class{constructor(e,i,n,l,o,c){this._textarea=e,this._compositionView=i,this._bufferService=n,this._optionsService=l,this._coreService=o,this._renderService=c,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let i={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let n;i.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(i.start,this._compositionPosition.start):n=this._textarea.value.substring(i.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;let i=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(i,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let i=this._textarea.value,n=i.replace(e,"");this._dataAlreadySent=n,i.length>e.length?this._coreService.triggerDataEvent(n,!0):i.length<e.length?this._coreService.triggerDataEvent(`${F.DEL}`,!0):i.length===e.length&&i!==e&&this._coreService.triggerDataEvent(i,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let i=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,l=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,o=i*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=o+"px",this._compositionView.style.top=l+"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 c=this._compositionView.getBoundingClientRect();this._textarea.style.left=o+"px",this._textarea.style.top=l+"px",this._textarea.style.width=Math.max(c.width,1)+"px",this._textarea.style.height=Math.max(c.height,1)+"px",this._textarea.style.lineHeight=c.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};wu=Qe([se(2,At),se(3,Mt),se(4,hr),se(5,ns)],wu);var _t=0,mt=0,vt=0,Ze=0,$_={css:"#00000000",rgba:0},at;(e=>{function i(o,c,d,_){return _!==void 0?`#${tr(o)}${tr(c)}${tr(d)}${tr(_)}`:`#${tr(o)}${tr(c)}${tr(d)}`}e.toCss=i;function n(o,c,d,_=255){return(o<<24|c<<16|d<<8|_)>>>0}e.toRgba=n;function l(o,c,d,_){return{css:e.toCss(o,c,d,_),rgba:e.toRgba(o,c,d,_)}}e.toColor=l})(at||={});var Ke;(e=>{function i(g,f){if(Ze=(f.rgba&255)/255,Ze===1)return{css:f.css,rgba:f.rgba};let x=f.rgba>>24&255,v=f.rgba>>16&255,b=f.rgba>>8&255,w=g.rgba>>24&255,S=g.rgba>>16&255,R=g.rgba>>8&255;_t=w+Math.round((x-w)*Ze),mt=S+Math.round((v-S)*Ze),vt=R+Math.round((b-R)*Ze);let z=at.toCss(_t,mt,vt),A=at.toRgba(_t,mt,vt);return{css:z,rgba:A}}e.blend=i;function n(g){return(g.rgba&255)===255}e.isOpaque=n;function l(g,f,x){let v=Va.ensureContrastRatio(g.rgba,f.rgba,x);if(v)return at.toColor(v>>24&255,v>>16&255,v>>8&255)}e.ensureContrastRatio=l;function o(g){let f=(g.rgba|255)>>>0;return[_t,mt,vt]=Va.toChannels(f),{css:at.toCss(_t,mt,vt),rgba:f}}e.opaque=o;function c(g,f){return Ze=Math.round(f*255),[_t,mt,vt]=Va.toChannels(g.rgba),{css:at.toCss(_t,mt,vt,Ze),rgba:at.toRgba(_t,mt,vt,Ze)}}e.opacity=c;function d(g,f){return Ze=g.rgba&255,c(g,Ze*f/255)}e.multiplyOpacity=d;function _(g){return[g.rgba>>24&255,g.rgba>>16&255,g.rgba>>8&255]}e.toColorRGB=_})(Ke||={});var Ge;(e=>{let i,n;try{let o=document.createElement("canvas");o.width=1,o.height=1;let c=o.getContext("2d",{willReadFrequently:!0});c&&(i=c,i.globalCompositeOperation="copy",n=i.createLinearGradient(0,0,1,1))}catch{}function l(o){if(o.match(/#[\da-f]{3,8}/i))switch(o.length){case 4:return _t=parseInt(o.slice(1,2).repeat(2),16),mt=parseInt(o.slice(2,3).repeat(2),16),vt=parseInt(o.slice(3,4).repeat(2),16),at.toColor(_t,mt,vt);case 5:return _t=parseInt(o.slice(1,2).repeat(2),16),mt=parseInt(o.slice(2,3).repeat(2),16),vt=parseInt(o.slice(3,4).repeat(2),16),Ze=parseInt(o.slice(4,5).repeat(2),16),at.toColor(_t,mt,vt,Ze);case 7:return{css:o,rgba:(parseInt(o.slice(1),16)<<8|255)>>>0};case 9:return{css:o,rgba:parseInt(o.slice(1),16)>>>0}}let c=o.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(c)return _t=parseInt(c[1]),mt=parseInt(c[2]),vt=parseInt(c[3]),Ze=Math.round((c[5]===void 0?1:parseFloat(c[5]))*255),at.toColor(_t,mt,vt,Ze);if(!i||!n)throw new Error("css.toColor: Unsupported css format");if(i.fillStyle=n,i.fillStyle=o,typeof i.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(i.fillRect(0,0,1,1),[_t,mt,vt,Ze]=i.getImageData(0,0,1,1).data,Ze!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:at.toRgba(_t,mt,vt,Ze),css:o}}e.toColor=l})(Ge||={});var Bt;(e=>{function i(l){return n(l>>16&255,l>>8&255,l&255)}e.relativeLuminance=i;function n(l,o,c){let d=l/255,_=o/255,g=c/255,f=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),x=_<=.03928?_/12.92:Math.pow((_+.055)/1.055,2.4),v=g<=.03928?g/12.92:Math.pow((g+.055)/1.055,2.4);return f*.2126+x*.7152+v*.0722}e.relativeLuminance2=n})(Bt||={});var Va;(e=>{function i(d,_){if(Ze=(_&255)/255,Ze===1)return _;let g=_>>24&255,f=_>>16&255,x=_>>8&255,v=d>>24&255,b=d>>16&255,w=d>>8&255;return _t=v+Math.round((g-v)*Ze),mt=b+Math.round((f-b)*Ze),vt=w+Math.round((x-w)*Ze),at.toRgba(_t,mt,vt)}e.blend=i;function n(d,_,g){let f=Bt.relativeLuminance(d>>8),x=Bt.relativeLuminance(_>>8);if(ts(f,x)<g){if(x<f){let w=l(d,_,g),S=ts(f,Bt.relativeLuminance(w>>8));if(S<g){let R=o(d,_,g),z=ts(f,Bt.relativeLuminance(R>>8));return S>z?w:R}return w}let v=o(d,_,g),b=ts(f,Bt.relativeLuminance(v>>8));if(b<g){let w=l(d,_,g),S=ts(f,Bt.relativeLuminance(w>>8));return b>S?v:w}return v}}e.ensureContrastRatio=n;function l(d,_,g){let f=d>>24&255,x=d>>16&255,v=d>>8&255,b=_>>24&255,w=_>>16&255,S=_>>8&255,R=ts(Bt.relativeLuminance2(b,w,S),Bt.relativeLuminance2(f,x,v));for(;R<g&&(b>0||w>0||S>0);)b-=Math.max(0,Math.ceil(b*.1)),w-=Math.max(0,Math.ceil(w*.1)),S-=Math.max(0,Math.ceil(S*.1)),R=ts(Bt.relativeLuminance2(b,w,S),Bt.relativeLuminance2(f,x,v));return(b<<24|w<<16|S<<8|255)>>>0}e.reduceLuminance=l;function o(d,_,g){let f=d>>24&255,x=d>>16&255,v=d>>8&255,b=_>>24&255,w=_>>16&255,S=_>>8&255,R=ts(Bt.relativeLuminance2(b,w,S),Bt.relativeLuminance2(f,x,v));for(;R<g&&(b<255||w<255||S<255);)b=Math.min(255,b+Math.ceil((255-b)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),S=Math.min(255,S+Math.ceil((255-S)*.1)),R=ts(Bt.relativeLuminance2(b,w,S),Bt.relativeLuminance2(f,x,v));return(b<<24|w<<16|S<<8|255)>>>0}e.increaseLuminance=o;function c(d){return[d>>24&255,d>>16&255,d>>8&255,d&255]}e.toChannels=c})(Va||={});function tr(e){let i=e.toString(16);return i.length<2?"0"+i:i}function ts(e,i){return e<i?(i+.05)/(e+.05):(e+.05)/(i+.05)}var n1=class extends ml{constructor(e,i,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=i,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()]}},to=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new _i}register(e){let i={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(i),i.id}deregister(e){for(let i=0;i<this._characterJoiners.length;i++)if(this._characterJoiners[i].id===e)return this._characterJoiners.splice(i,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let i=this._bufferService.buffer.lines.get(e);if(!i||i.length===0)return[];let n=[],l=i.translateToString(!0),o=0,c=0,d=0,_=i.getFg(0),g=i.getBg(0);for(let f=0;f<i.getTrimmedLength();f++)if(i.loadCell(f,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==_||this._workCell.bg!==g){if(f-o>1){let x=this._getJoinedRanges(l,d,c,i,o);for(let v=0;v<x.length;v++)n.push(x[v])}o=f,d=c,_=this._workCell.fg,g=this._workCell.bg}c+=this._workCell.getChars().length||js.length}if(this._bufferService.cols-o>1){let f=this._getJoinedRanges(l,d,c,i,o);for(let x=0;x<f.length;x++)n.push(f[x])}return n}_getJoinedRanges(e,i,n,l,o){let c=e.substring(i,n),d=[];try{d=this._characterJoiners[0].handler(c)}catch(_){console.error(_)}for(let _=1;_<this._characterJoiners.length;_++)try{let g=this._characterJoiners[_].handler(c);for(let f=0;f<g.length;f++)to._mergeRanges(d,g[f])}catch(g){console.error(g)}return this._stringRangesToCellRanges(d,l,o),d}_stringRangesToCellRanges(e,i,n){let l=0,o=!1,c=0,d=e[l];if(d){for(let _=n;_<this._bufferService.cols;_++){let g=i.getWidth(_),f=i.getString(_).length||js.length;if(g!==0){if(!o&&d[0]<=c&&(d[0]=_,o=!0),d[1]<=c){if(d[1]=_,d=e[++l],!d)break;d[0]<=c?(d[0]=_,o=!0):o=!1}c+=f}}d&&(d[1]=this._bufferService.cols)}}static _mergeRanges(e,i){let n=!1;for(let l=0;l<e.length;l++){let o=e[l];if(n){if(i[1]<=o[0])return e[l-1][1]=i[1],e;if(i[1]<=o[1])return e[l-1][1]=Math.max(i[1],o[1]),e.splice(l,1),e;e.splice(l,1),l--}else{if(i[1]<=o[0])return e.splice(l,0,i),e;if(i[1]<=o[1])return o[0]=Math.min(i[0],o[0]),e;i[0]<o[1]&&(o[0]=Math.min(i[0],o[0]),n=!0);continue}}return n?e[e.length-1][1]=i[1]:e.push(i),e}};to=Qe([se(0,At)],to);function l1(e){return 57508<=e&&e<=57558}function a1(e){return 9472<=e&&e<=9631}function o1(e){return l1(e)||a1(e)}function c1(){return{css:{canvas:Pa(),cell:Pa()},device:{canvas:Pa(),cell:Pa(),char:{width:0,height:0,left:0,top:0}}}}function Pa(){return{width:0,height:0}}var Cu=class{constructor(e,i,n,l,o,c,d){this._document=e,this._characterJoinerService=i,this._optionsService=n,this._coreBrowserService=l,this._coreService=o,this._decorationService=c,this._themeService=d,this._workCell=new _i,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,i,n){this._selectionStart=e,this._selectionEnd=i,this._columnSelectMode=n}createRow(e,i,n,l,o,c,d,_,g,f,x){let v=[],b=this._characterJoinerService.getJoinedCharacters(i),w=this._themeService.colors,S=e.getNoBgTrimmedLength();n&&S<c+1&&(S=c+1);let R,z=0,A="",W=0,j=0,C=0,O=0,G=!1,Z=0,ae=!1,pe=0,Oe=0,he=[],V=f!==-1&&x!==-1;for(let X=0;X<S;X++){e.loadCell(X,this._workCell);let te=this._workCell.getWidth();if(te===0)continue;let Q=!1,B=X>=Oe,q=X,I=this._workCell;if(b.length>0&&X===b[0][0]&&B){let Re=b.shift(),mi=this._isCellInSelection(Re[0],i);for(W=Re[0]+1;W<Re[1];W++)B&&=mi===this._isCellInSelection(W,i);B&&=!n||c<Re[0]||c>=Re[1],B?(Q=!0,I=new n1(this._workCell,e.translateToString(!0,Re[0],Re[1]),Re[1]-Re[0]),q=Re[1]-1,te=I.getWidth()):Oe=Re[1]}let ne=this._isCellInSelection(X,i),ge=n&&X===c,T=V&&X>=f&&X<=x,K=!1;this._decorationService.forEachDecorationAtCell(X,i,void 0,Re=>{K=!0});let ee=I.getChars()||js;if(ee===" "&&(I.isUnderline()||I.isOverline())&&(ee=" "),pe=te*_-g.get(ee,I.isBold(),I.isItalic()),!R)R=this._document.createElement("span");else if(z&&(ne&&ae||!ne&&!ae&&I.bg===j)&&(ne&&ae&&w.selectionForeground||I.fg===C)&&I.extended.ext===O&&T===G&&pe===Z&&!ge&&!Q&&!K&&B){I.isInvisible()?A+=js:A+=ee,z++;continue}else z&&(R.textContent=A),R=this._document.createElement("span"),z=0,A="";if(j=I.bg,C=I.fg,O=I.extended.ext,G=T,Z=pe,ae=ne,Q&&c>=X&&c<=q&&(c=X),!this._coreService.isCursorHidden&&ge&&this._coreService.isCursorInitialized){if(he.push("xterm-cursor"),this._coreBrowserService.isFocused)d&&he.push("xterm-cursor-blink"),he.push(l==="bar"?"xterm-cursor-bar":l==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(o)switch(o){case"outline":he.push("xterm-cursor-outline");break;case"block":he.push("xterm-cursor-block");break;case"bar":he.push("xterm-cursor-bar");break;case"underline":he.push("xterm-cursor-underline");break}}if(I.isBold()&&he.push("xterm-bold"),I.isItalic()&&he.push("xterm-italic"),I.isDim()&&he.push("xterm-dim"),I.isInvisible()?A=js:A=I.getChars()||js,I.isUnderline()&&(he.push(`xterm-underline-${I.extended.underlineStyle}`),A===" "&&(A=" "),!I.isUnderlineColorDefault()))if(I.isUnderlineColorRGB())R.style.textDecorationColor=`rgb(${ml.toColorRGB(I.getUnderlineColor()).join(",")})`;else{let Re=I.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&I.isBold()&&Re<8&&(Re+=8),R.style.textDecorationColor=w.ansi[Re].css}I.isOverline()&&(he.push("xterm-overline"),A===" "&&(A=" ")),I.isStrikethrough()&&he.push("xterm-strikethrough"),T&&(R.style.textDecoration="underline");let ie=I.getFgColor(),ce=I.getFgColorMode(),de=I.getBgColor(),Se=I.getBgColorMode(),ot=!!I.isInverse();if(ot){let Re=ie;ie=de,de=Re;let mi=ce;ce=Se,Se=mi}let Ae,wi,Ci=!1;this._decorationService.forEachDecorationAtCell(X,i,void 0,Re=>{Re.options.layer!=="top"&&Ci||(Re.backgroundColorRGB&&(Se=50331648,de=Re.backgroundColorRGB.rgba>>8&16777215,Ae=Re.backgroundColorRGB),Re.foregroundColorRGB&&(ce=50331648,ie=Re.foregroundColorRGB.rgba>>8&16777215,wi=Re.foregroundColorRGB),Ci=Re.options.layer==="top")}),!Ci&&ne&&(Ae=this._coreBrowserService.isFocused?w.selectionBackgroundOpaque:w.selectionInactiveBackgroundOpaque,de=Ae.rgba>>8&16777215,Se=50331648,Ci=!0,w.selectionForeground&&(ce=50331648,ie=w.selectionForeground.rgba>>8&16777215,wi=w.selectionForeground)),Ci&&he.push("xterm-decoration-top");let ti;switch(Se){case 16777216:case 33554432:ti=w.ansi[de],he.push(`xterm-bg-${de}`);break;case 50331648:ti=at.toColor(de>>16,de>>8&255,de&255),this._addStyle(R,`background-color:#${Y_((de>>>0).toString(16),"0",6)}`);break;default:ot?(ti=w.foreground,he.push("xterm-bg-257")):ti=w.background}switch(Ae||I.isDim()&&(Ae=Ke.multiplyOpacity(ti,.5)),ce){case 16777216:case 33554432:I.isBold()&&ie<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ie+=8),this._applyMinimumContrast(R,ti,w.ansi[ie],I,Ae,void 0)||he.push(`xterm-fg-${ie}`);break;case 50331648:let Re=at.toColor(ie>>16&255,ie>>8&255,ie&255);this._applyMinimumContrast(R,ti,Re,I,Ae,wi)||this._addStyle(R,`color:#${Y_(ie.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(R,ti,w.foreground,I,Ae,wi)||ot&&he.push("xterm-fg-257")}he.length&&(R.className=he.join(" "),he.length=0),!ge&&!Q&&!K&&B?z++:R.textContent=A,pe!==this.defaultSpacing&&(R.style.letterSpacing=`${pe}px`),v.push(R),X=q}return R&&z&&(R.textContent=A),v}_applyMinimumContrast(e,i,n,l,o,c){if(this._optionsService.rawOptions.minimumContrastRatio===1||o1(l.getCode()))return!1;let d=this._getContrastCache(l),_;if(!o&&!c&&(_=d.getColor(i.rgba,n.rgba)),_===void 0){let g=this._optionsService.rawOptions.minimumContrastRatio/(l.isDim()?2:1);_=Ke.ensureContrastRatio(o||i,c||n,g),d.setColor((o||i).rgba,(c||n).rgba,_??null)}return _?(this._addStyle(e,`color:${_.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,i){e.setAttribute("style",`${e.getAttribute("style")||""}${i};`)}_isCellInSelection(e,i){let n=this._selectionStart,l=this._selectionEnd;return!n||!l?!1:this._columnSelectMode?n[0]<=l[0]?e>=n[0]&&i>=n[1]&&e<l[0]&&i<=l[1]:e<n[0]&&i>=n[1]&&e>=l[0]&&i<=l[1]:i>n[1]&&i<l[1]||n[1]===l[1]&&i===n[1]&&e>=n[0]&&e<l[0]||n[1]<l[1]&&i===l[1]&&e<l[0]||n[1]<l[1]&&i===n[1]&&e>=n[0]}};Cu=Qe([se(1,Zm),se(2,Mt),se(3,rs),se(4,hr),se(5,vl),se(6,tn)],Cu);function Y_(e,i,n){for(;e.length<n;)e=i+e;return e}var h1=class{constructor(e,i){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 l=e.createElement("span");l.classList.add("xterm-char-measure-element"),l.style.fontWeight="bold";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontStyle="italic";let c=e.createElement("span");c.classList.add("xterm-char-measure-element"),c.style.fontWeight="bold",c.style.fontStyle="italic",this._measureElements=[n,l,o,c],this._container.appendChild(n),this._container.appendChild(l),this._container.appendChild(o),this._container.appendChild(c),i.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,i,n,l){e===this._font&&i===this._fontSize&&n===this._weight&&l===this._weightBold||(this._font=e,this._fontSize=i,this._weight=n,this._weightBold=l,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${l}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${l}`,this.clear())}get(e,i,n){let l=0;if(!i&&!n&&e.length===1&&(l=e.charCodeAt(0))<256){if(this._flat[l]!==-9999)return this._flat[l];let d=this._measure(e,0);return d>0&&(this._flat[l]=d),d}let o=e;i&&(o+="B"),n&&(o+="I");let c=this._holey.get(o);if(c===void 0){let d=0;i&&(d|=1),n&&(d|=2),c=this._measure(e,d),c>0&&this._holey.set(o,c)}return c}_measure(e,i){let n=this._measureElements[i];return n.textContent=e.repeat(32),n.offsetWidth/32}},u1=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,i,n,l=!1){if(this.selectionStart=i,this.selectionEnd=n,!i||!n||i[0]===n[0]&&i[1]===n[1]){this.clear();return}let o=e.buffers.active.ydisp,c=i[1]-o,d=n[1]-o,_=Math.max(c,0),g=Math.min(d,e.rows-1);if(_>=e.rows||g<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=l,this.viewportStartRow=c,this.viewportEndRow=d,this.viewportCappedStartRow=_,this.viewportCappedEndRow=g,this.startCol=i[0],this.endCol=n[0]}isCellSelected(e,i,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?i>=this.startCol&&n>=this.viewportCappedStartRow&&i<this.endCol&&n<=this.viewportCappedEndRow:i<this.startCol&&n>=this.viewportCappedStartRow&&i>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&i>=this.startCol&&i<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&i<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&i>=this.startCol):!1}};function d1(){return new u1}var Fh="xterm-dom-renderer-owner-",di="xterm-rows",qa="xterm-fg-",F_="xterm-bg-",el="xterm-focus",Ia="xterm-selection",f1=1,ku=class extends xe{constructor(e,i,n,l,o,c,d,_,g,f,x,v,b,w){super(),this._terminal=e,this._document=i,this._element=n,this._screenElement=l,this._viewportElement=o,this._helperContainer=c,this._linkifier2=d,this._charSizeService=g,this._optionsService=f,this._bufferService=x,this._coreService=v,this._coreBrowserService=b,this._themeService=w,this._terminalClass=f1++,this._rowElements=[],this._selectionRenderModel=d1(),this.onRequestRedraw=this._register(new J).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(di),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(Ia),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=c1(),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=_.createInstance(Cu,document),this._element.classList.add(Fh+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(Ye(()=>{this._element.classList.remove(Fh+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new h1(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 i=`${this._terminalSelector} .${di} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=i,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 i=`${this._terminalSelector} .${di} { 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}`;i+=`${this._terminalSelector} .${di} .xterm-dim { color: ${Ke.multiplyOpacity(e.foreground,.5).css};}`,i+=`${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}`,l=`blink_bar_${this._terminalClass}`,o=`blink_block_${this._terminalClass}`;i+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,i+=`@keyframes ${l} { 50% { box-shadow: none; }}`,i+=`@keyframes ${o} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,i+=`${this._terminalSelector} .${di}.${el} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${di}.${el} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${l} 1s step-end infinite;}${this._terminalSelector} .${di}.${el} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${o} 1s step-end infinite;}${this._terminalSelector} .${di} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${di} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${di} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${di} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${di} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,i+=`${this._terminalSelector} .${Ia} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Ia} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Ia} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[c,d]of e.ansi.entries())i+=`${this._terminalSelector} .${qa}${c} { color: ${d.css}; }${this._terminalSelector} .${qa}${c}.xterm-dim { color: ${Ke.multiplyOpacity(d,.5).css}; }${this._terminalSelector} .${F_}${c} { background-color: ${d.css}; }`;i+=`${this._terminalSelector} .${qa}257 { color: ${Ke.opaque(e.background).css}; }${this._terminalSelector} .${qa}257.xterm-dim { color: ${Ke.multiplyOpacity(Ke.opaque(e.background),.5).css}; }${this._terminalSelector} .${F_}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=i}_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,i){for(let n=this._rowElements.length;n<=i;n++){let l=this._document.createElement("div");this._rowContainer.appendChild(l),this._rowElements.push(l)}for(;this._rowElements.length>i;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,i){this._refreshRowElements(e,i),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(el),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(el),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,i,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,i,n),this.renderRows(0,this._bufferService.rows-1),!e||!i||(this._selectionRenderModel.update(this._terminal,e,i,n),!this._selectionRenderModel.hasSelection))return;let l=this._selectionRenderModel.viewportStartRow,o=this._selectionRenderModel.viewportEndRow,c=this._selectionRenderModel.viewportCappedStartRow,d=this._selectionRenderModel.viewportCappedEndRow,_=this._document.createDocumentFragment();if(n){let g=e[0]>i[0];_.appendChild(this._createSelectionElement(c,g?i[0]:e[0],g?e[0]:i[0],d-c+1))}else{let g=l===c?e[0]:0,f=c===o?i[0]:this._bufferService.cols;_.appendChild(this._createSelectionElement(c,g,f));let x=d-c-1;if(_.appendChild(this._createSelectionElement(c+1,0,this._bufferService.cols,x)),c!==d){let v=o===d?i[0]:this._bufferService.cols;_.appendChild(this._createSelectionElement(d,0,v))}}this._selectionContainer.appendChild(_)}_createSelectionElement(e,i,n,l=1){let o=this._document.createElement("div"),c=i*this.dimensions.css.cell.width,d=this.dimensions.css.cell.width*(n-i);return c+d>this.dimensions.css.canvas.width&&(d=this.dimensions.css.canvas.width-c),o.style.height=`${l*this.dimensions.css.cell.height}px`,o.style.top=`${e*this.dimensions.css.cell.height}px`,o.style.left=`${c}px`,o.style.width=`${d}px`,o}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,i){let n=this._bufferService.buffer,l=n.ybase+n.y,o=Math.min(n.x,this._bufferService.cols-1),c=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,d=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,_=this._optionsService.rawOptions.cursorInactiveStyle;for(let g=e;g<=i;g++){let f=g+n.ydisp,x=this._rowElements[g],v=n.lines.get(f);if(!x||!v)break;x.replaceChildren(...this._rowFactory.createRow(v,f,f===l,d,_,o,c,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Fh}${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,i,n,l,o,c){n<0&&(e=0),l<0&&(i=0);let d=this._bufferService.rows-1;n=Math.max(Math.min(n,d),0),l=Math.max(Math.min(l,d),0),o=Math.min(o,this._bufferService.cols);let _=this._bufferService.buffer,g=_.ybase+_.y,f=Math.min(_.x,o-1),x=this._optionsService.rawOptions.cursorBlink,v=this._optionsService.rawOptions.cursorStyle,b=this._optionsService.rawOptions.cursorInactiveStyle;for(let w=n;w<=l;++w){let S=w+_.ydisp,R=this._rowElements[w],z=_.lines.get(S);if(!R||!z)break;R.replaceChildren(...this._rowFactory.createRow(z,S,S===g,v,b,f,x,this.dimensions.css.cell.width,this._widthCache,c?w===n?e:0:-1,c?(w===l?i:o)-1:-1))}}};ku=Qe([se(7,Ku),se(8,ho),se(9,Mt),se(10,At),se(11,hr),se(12,rs),se(13,tn)],ku);var Eu=class extends xe{constructor(e,i,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new J),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new g1(this._optionsService))}catch{this._measureStrategy=this._register(new p1(e,i,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())}};Eu=Qe([se(2,Mt)],Eu);var _v=class extends xe{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,i){e!==void 0&&e>0&&i!==void 0&&i>0&&(this._result.width=e,this._result.height=i)}},p1=class extends _v{constructor(e,i,n){super(),this._document=e,this._parentElement=i,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}},g1=class extends _v{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let i=this._ctx.measureText("W");if(!("width"in i&&"fontBoundingBoxAscent"in i&&"fontBoundingBoxDescent"in i))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}},_1=class extends xe{constructor(e,i,n){super(),this._textarea=e,this._window=i,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new m1(this._window)),this._onDprChange=this._register(new J),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new J),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(l=>this._screenDprMonitor.setWindow(l))),this._register(kt.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(fe(this._textarea,"focus",()=>this._isFocused=!0)),this._register(fe(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}},m1=class extends xe{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Jr),this._onDprChange=this._register(new J),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Ye(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=fe(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},v1=class extends xe{constructor(){super(),this.linkProviders=[],this._register(Ye(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let i=this.linkProviders.indexOf(e);i!==-1&&this.linkProviders.splice(i,1)}}}};function Qu(e,i,n){let l=n.getBoundingClientRect(),o=e.getComputedStyle(n),c=parseInt(o.getPropertyValue("padding-left")),d=parseInt(o.getPropertyValue("padding-top"));return[i.clientX-l.left-c,i.clientY-l.top-d]}function y1(e,i,n,l,o,c,d,_,g){if(!c)return;let f=Qu(e,i,n);if(f)return f[0]=Math.ceil((f[0]+(g?d/2:0))/d),f[1]=Math.ceil(f[1]/_),f[0]=Math.min(Math.max(f[0],1),l+(g?1:0)),f[1]=Math.min(Math.max(f[1],1),o),f}var Tu=class{constructor(e,i){this._renderService=e,this._charSizeService=i}getCoords(e,i,n,l,o){return y1(window,e,i,n,l,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,o)}getMouseReportCoords(e,i){let n=Qu(window,e,i);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])}}};Tu=Qe([se(0,ns),se(1,ho)],Tu);var x1=class{constructor(e,i){this._renderCallback=e,this._coreBrowserService=i,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,i,n){this._rowCount=n,e=e!==void 0?e:0,i=i!==void 0?i: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,i):i,!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),i=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,i),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},mv={};BS(mv,{getSafariVersion:()=>b1,isChromeOS:()=>Sv,isFirefox:()=>vv,isIpad:()=>w1,isIphone:()=>C1,isLegacyEdge:()=>S1,isLinux:()=>Ju,isMac:()=>io,isNode:()=>uo,isSafari:()=>yv,isWindows:()=>xv});var uo=typeof process<"u"&&"title"in process,yl=uo?"node":navigator.userAgent,xl=uo?"node":navigator.platform,vv=yl.includes("Firefox"),S1=yl.includes("Edge"),yv=/^((?!chrome|android).)*safari/i.test(yl);function b1(){if(!yv)return 0;let e=yl.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var io=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(xl),w1=xl==="iPad",C1=xl==="iPhone",xv=["Windows","Win16","Win32","WinCE"].includes(xl),Ju=xl.indexOf("Linux")>=0,Sv=/\bCrOS\b/.test(yl),bv=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 i=0,n=0,l=e.timeRemaining(),o=0;for(;this._i<this._tasks.length;){if(i=performance.now(),this._tasks[this._i]()||this._i++,i=Math.max(1,performance.now()-i),n=Math.max(i,n),o=e.timeRemaining(),n*1.5>o){l-i<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(l-i))}ms`),this._start();return}l=o}this.clear()}},k1=class extends bv{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let i=performance.now()+e;return{timeRemaining:()=>Math.max(0,i-performance.now())}}},E1=class extends bv{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},so=!uo&&"requestIdleCallback"in window?E1:k1,T1=class{constructor(){this._queue=new so}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Ru=class extends xe{constructor(e,i,n,l,o,c,d,_,g){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=l,this._coreService=o,this._coreBrowserService=_,this._renderer=this._register(new Jr),this._pausedResizeTask=new T1,this._observerDisposable=this._register(new Jr),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 J),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new J),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new J),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new J),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new x1((f,x)=>this._renderRows(f,x),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new R1(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Ye(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(d.onResize(()=>this._fullRefresh())),this._register(d.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(c.onDecorationRegistered(()=>this._fullRefresh())),this._register(c.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(d.cols,d.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(d.buffer.y,d.buffer.y,!0))),this._register(g.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,i),this._register(this._coreBrowserService.onWindowChange(f=>this._registerIntersectionObserver(f,i)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,i){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(l=>this._handleIntersectionChange(l[l.length-1]),{threshold:0});n.observe(i),this._observerDisposable.value=Ye(()=>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,i,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,i);return}let l=this._syncOutputHandler.flush();l&&(e=Math.min(e,l.start),i=Math.max(i,l.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,i,this._rowCount)}_renderRows(e,i){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,i);return}e=Math.min(e,this._rowCount-1),i=Math.min(i,this._rowCount-1),this._renderer.value.renderRows(e,i),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:i}),this._onRender.fire({start:e,end:i}),this._isNextRenderRedrawOnly=!0}}resize(e,i){this._rowCount=i,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(i=>this.refreshRows(i.start,i.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,i){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,i)):this._renderer.value.handleResize(e,i),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,i,n){this._selectionState.start=e,this._selectionState.end=i,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,i,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};Ru=Qe([se(2,Mt),se(3,ho),se(4,hr),se(5,vl),se(6,At),se(7,rs),se(8,tn)],Ru);var R1=class{constructor(e,i,n){this._coreBrowserService=e,this._coreService=i,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,i){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,i)):(this._start=e,this._end=i,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 D1(e,i,n,l){let o=n.buffer.x,c=n.buffer.y;if(!n.buffer.hasScrollback)return A1(o,c,e,i,n,l)+fo(c,i,n,l)+M1(o,c,e,i,n,l);let d;if(c===i)return d=o>e?"D":"C",gl(Math.abs(o-e),pl(d,l));d=c>i?"D":"C";let _=Math.abs(c-i),g=z1(c>i?e:o,n)+(_-1)*n.cols+1+B1(c>i?o:e);return gl(g,pl(d,l))}function B1(e,i){return e-1}function z1(e,i){return i.cols-e}function A1(e,i,n,l,o,c){return fo(i,l,o,c).length===0?"":gl(Cv(e,i,e,i-or(i,o),!1,o).length,pl("D",c))}function fo(e,i,n,l){let o=e-or(e,n),c=i-or(i,n),d=Math.abs(o-c)-O1(e,i,n);return gl(d,pl(wv(e,i),l))}function M1(e,i,n,l,o,c){let d;fo(i,l,o,c).length>0?d=l-or(l,o):d=i;let _=l,g=j1(e,i,n,l,o,c);return gl(Cv(e,d,n,_,g==="C",o).length,pl(g,c))}function O1(e,i,n){let l=0,o=e-or(e,n),c=i-or(i,n);for(let d=0;d<Math.abs(o-c);d++){let _=wv(e,i)==="A"?-1:1;n.buffer.lines.get(o+_*d)?.isWrapped&&l++}return l}function or(e,i){let n=0,l=i.buffer.lines.get(e),o=l?.isWrapped;for(;o&&e>=0&&e<i.rows;)n++,l=i.buffer.lines.get(--e),o=l?.isWrapped;return n}function j1(e,i,n,l,o,c){let d;return fo(n,l,o,c).length>0?d=l-or(l,o):d=i,e<n&&d<=l||e>=n&&d<l?"C":"D"}function wv(e,i){return e>i?"A":"B"}function Cv(e,i,n,l,o,c){let d=e,_=i,g="";for(;(d!==n||_!==l)&&_>=0&&_<c.buffer.lines.length;)d+=o?1:-1,o&&d>c.cols-1?(g+=c.buffer.translateBufferLineToString(_,!1,e,d),d=0,e=0,_++):!o&&d<0&&(g+=c.buffer.translateBufferLineToString(_,!1,0,e+1),d=c.cols-1,e=d,_--);return g+c.buffer.translateBufferLineToString(_,!1,e,d)}function pl(e,i){let n=i?"O":"[";return F.ESC+n+e}function gl(e,i){e=Math.floor(e);let n="";for(let l=0;l<e;l++)n+=i;return n}var L1=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,i=this.selectionEnd;return!e||!i?!1:e[1]>i[1]||e[1]===i[1]&&e[0]>i[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 G_(e,i){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 i*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var Gh=50,N1=15,H1=50,U1=500,W1=" ",P1=new RegExp(W1,"g"),Du=class extends xe{constructor(e,i,n,l,o,c,d,_,g){super(),this._element=e,this._screenElement=i,this._linkifier=n,this._bufferService=l,this._coreService=o,this._mouseService=c,this._optionsService=d,this._renderService=_,this._coreBrowserService=g,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new _i,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new J),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new J),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new J),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new J),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=f=>this._handleMouseMove(f),this._mouseUpListener=f=>this._handleMouseUp(f),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(f=>this._handleTrim(f)),this._register(this._bufferService.buffers.onBufferActivate(f=>this._handleBufferActivate(f))),this.enable(),this._model=new L1(this._bufferService),this._activeSelectionMode=0,this._register(Ye(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(f=>{f.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,i=this._model.finalSelectionEnd;return!e||!i?!1:e[0]!==i[0]||e[1]!==i[1]}get selectionText(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;if(!e||!i)return"";let n=this._bufferService.buffer,l=[];if(this._activeSelectionMode===3){if(e[0]===i[0])return"";let o=e[0]<i[0]?e[0]:i[0],c=e[0]<i[0]?i[0]:e[0];for(let d=e[1];d<=i[1];d++){let _=n.translateBufferLineToString(d,!0,o,c);l.push(_)}}else{let o=e[1]===i[1]?i[0]:void 0;l.push(n.translateBufferLineToString(e[1],!0,e[0],o));for(let c=e[1]+1;c<=i[1]-1;c++){let d=n.lines.get(c),_=n.translateBufferLineToString(c,!0);d?.isWrapped?l[l.length-1]+=_:l.push(_)}if(e[1]!==i[1]){let c=n.lines.get(i[1]),d=n.translateBufferLineToString(i[1],!0,0,i[0]);c&&c.isWrapped?l[l.length-1]+=d:l.push(d)}}return l.map(o=>o.replace(P1," ")).join(xv?`\r
|
|
95
|
+
`:`
|
|
96
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Ju&&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 i=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,l=this._model.finalSelectionEnd;return!n||!l||!i?!1:this._areCoordsInSelection(i,n,l)}isCellInSelection(e,i){let n=this._model.finalSelectionStart,l=this._model.finalSelectionEnd;return!n||!l?!1:this._areCoordsInSelection([e,i],n,l)}_areCoordsInSelection(e,i,n){return e[1]>i[1]&&e[1]<n[1]||i[1]===n[1]&&e[1]===i[1]&&e[0]>=i[0]&&e[0]<n[0]||i[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||i[1]<n[1]&&e[1]===i[1]&&e[0]>=i[0]}_selectWordAtCursor(e,i){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=G_(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let l=this._getMouseBufferCoords(e);return l?(this._selectWordAt(l,i),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,i){this._model.clearSelection(),e=Math.max(e,0),i=Math.min(i,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,i],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let i=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(i)return i[0]--,i[1]--,i[1]+=this._bufferService.buffer.ydisp,i}_getMouseEventScrollAmount(e){let i=Qu(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return i>=0&&i<=n?0:(i>n&&(i-=n),i=Math.min(Math.max(i,-Gh),Gh),i/=Gh,i/Math.abs(i)+Math.round(i*(N1-1)))}shouldForceSelection(e){return io?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(),H1)}_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 i=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);i&&i.length!==this._model.selectionStart[0]&&i.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let i=this._getMouseBufferCoords(e);i&&(this._activeSelectionMode=2,this._selectLineAt(i[1]))}shouldColumnSelect(e){return e.altKey&&!(io&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let i=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 l=n.lines.get(this._model.selectionEnd[1]);l&&l.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!i||i[0]!==this._model.selectionEnd[0]||i[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 i=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&i<U1&&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 l=D1(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(l,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd,n=!!e&&!!i&&(e[0]!==i[0]||e[1]!==i[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,i,n);return}!e||!i||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||i[0]!==this._oldSelectionEnd[0]||i[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,i,n)}_fireOnSelectionChange(e,i,n){this._oldSelectionStart=e,this._oldSelectionEnd=i,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(i=>this._handleTrim(i))}_convertViewportColToCharacterIndex(e,i){let n=i;for(let l=0;i>=l;l++){let o=e.loadCell(l,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:o>1&&i!==l&&(n+=o-1)}return n}setSelection(e,i,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,i],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,i,n=!0,l=!0){if(e[0]>=this._bufferService.cols)return;let o=this._bufferService.buffer,c=o.lines.get(e[1]);if(!c)return;let d=o.translateBufferLineToString(e[1],!1),_=this._convertViewportColToCharacterIndex(c,e[0]),g=_,f=e[0]-_,x=0,v=0,b=0,w=0;if(d.charAt(_)===" "){for(;_>0&&d.charAt(_-1)===" ";)_--;for(;g<d.length&&d.charAt(g+1)===" ";)g++}else{let z=e[0],A=e[0];c.getWidth(z)===0&&(x++,z--),c.getWidth(A)===2&&(v++,A++);let W=c.getString(A).length;for(W>1&&(w+=W-1,g+=W-1);z>0&&_>0&&!this._isCharWordSeparator(c.loadCell(z-1,this._workCell));){c.loadCell(z-1,this._workCell);let j=this._workCell.getChars().length;this._workCell.getWidth()===0?(x++,z--):j>1&&(b+=j-1,_-=j-1),_--,z--}for(;A<c.length&&g+1<d.length&&!this._isCharWordSeparator(c.loadCell(A+1,this._workCell));){c.loadCell(A+1,this._workCell);let j=this._workCell.getChars().length;this._workCell.getWidth()===2?(v++,A++):j>1&&(w+=j-1,g+=j-1),g++,A++}}g++;let S=_+f-x+b,R=Math.min(this._bufferService.cols,g-_+x+v-b-w);if(!(!i&&d.slice(_,g).trim()==="")){if(n&&S===0&&c.getCodePoint(0)!==32){let z=o.lines.get(e[1]-1);if(z&&c.isWrapped&&z.getCodePoint(this._bufferService.cols-1)!==32){let A=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(A){let W=this._bufferService.cols-A.start;S-=W,R+=W}}}if(l&&S+R===this._bufferService.cols&&c.getCodePoint(this._bufferService.cols-1)!==32){let z=o.lines.get(e[1]+1);if(z?.isWrapped&&z.getCodePoint(0)!==32){let A=this._getWordAt([0,e[1]+1],!1,!1,!0);A&&(R+=A.length)}}return{start:S,length:R}}}_selectWordAt(e,i){let n=this._getWordAt(e,i);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 i=this._getWordAt(e,!0);if(i){let n=e[1];for(;i.start<0;)i.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;i.start+i.length>this._bufferService.cols;)i.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?i.start:i.start+i.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let i=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:i.first},end:{x:this._bufferService.cols-1,y:i.last}};this._model.selectionStart=[0,i.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=G_(n,this._bufferService.cols)}};Du=Qe([se(3,At),se(4,hr),se(5,$u),se(6,Mt),se(7,ns),se(8,rs)],Du);var X_=class{constructor(){this._data={}}set(e,i,n){this._data[e]||(this._data[e]={}),this._data[e][i]=n}get(e,i){return this._data[e]?this._data[e][i]:void 0}clear(){this._data={}}},V_=class{constructor(){this._color=new X_,this._css=new X_}setCss(e,i,n){this._css.set(e,i,n)}getCss(e,i){return this._css.get(e,i)}setColor(e,i,n){this._color.set(e,i,n)}getColor(e,i){return this._color.get(e,i)}clear(){this._color.clear(),this._css.clear()}},ht=Object.freeze((()=>{let e=[Ge.toColor("#2e3436"),Ge.toColor("#cc0000"),Ge.toColor("#4e9a06"),Ge.toColor("#c4a000"),Ge.toColor("#3465a4"),Ge.toColor("#75507b"),Ge.toColor("#06989a"),Ge.toColor("#d3d7cf"),Ge.toColor("#555753"),Ge.toColor("#ef2929"),Ge.toColor("#8ae234"),Ge.toColor("#fce94f"),Ge.toColor("#729fcf"),Ge.toColor("#ad7fa8"),Ge.toColor("#34e2e2"),Ge.toColor("#eeeeec")],i=[0,95,135,175,215,255];for(let n=0;n<216;n++){let l=i[n/36%6|0],o=i[n/6%6|0],c=i[n%6];e.push({css:at.toCss(l,o,c),rgba:at.toRgba(l,o,c)})}for(let n=0;n<24;n++){let l=8+n*10;e.push({css:at.toCss(l,l,l),rgba:at.toRgba(l,l,l)})}return e})()),ir=Ge.toColor("#ffffff"),ol=Ge.toColor("#000000"),Z_=Ge.toColor("#ffffff"),Q_=ol,tl={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},q1=ir,Bu=class extends xe{constructor(e){super(),this._optionsService=e,this._contrastCache=new V_,this._halfContrastCache=new V_,this._onChangeColors=this._register(new J),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:ir,background:ol,cursor:Z_,cursorAccent:Q_,selectionForeground:void 0,selectionBackgroundTransparent:tl,selectionBackgroundOpaque:Ke.blend(ol,tl),selectionInactiveBackgroundTransparent:tl,selectionInactiveBackgroundOpaque:Ke.blend(ol,tl),scrollbarSliderBackground:Ke.opacity(ir,.2),scrollbarSliderHoverBackground:Ke.opacity(ir,.4),scrollbarSliderActiveBackground:Ke.opacity(ir,.5),overviewRulerBorder:ir,ansi:ht.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 i=this._colors;if(i.foreground=We(e.foreground,ir),i.background=We(e.background,ol),i.cursor=Ke.blend(i.background,We(e.cursor,Z_)),i.cursorAccent=Ke.blend(i.background,We(e.cursorAccent,Q_)),i.selectionBackgroundTransparent=We(e.selectionBackground,tl),i.selectionBackgroundOpaque=Ke.blend(i.background,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundTransparent=We(e.selectionInactiveBackground,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundOpaque=Ke.blend(i.background,i.selectionInactiveBackgroundTransparent),i.selectionForeground=e.selectionForeground?We(e.selectionForeground,$_):void 0,i.selectionForeground===$_&&(i.selectionForeground=void 0),Ke.isOpaque(i.selectionBackgroundTransparent)&&(i.selectionBackgroundTransparent=Ke.opacity(i.selectionBackgroundTransparent,.3)),Ke.isOpaque(i.selectionInactiveBackgroundTransparent)&&(i.selectionInactiveBackgroundTransparent=Ke.opacity(i.selectionInactiveBackgroundTransparent,.3)),i.scrollbarSliderBackground=We(e.scrollbarSliderBackground,Ke.opacity(i.foreground,.2)),i.scrollbarSliderHoverBackground=We(e.scrollbarSliderHoverBackground,Ke.opacity(i.foreground,.4)),i.scrollbarSliderActiveBackground=We(e.scrollbarSliderActiveBackground,Ke.opacity(i.foreground,.5)),i.overviewRulerBorder=We(e.overviewRulerBorder,q1),i.ansi=ht.slice(),i.ansi[0]=We(e.black,ht[0]),i.ansi[1]=We(e.red,ht[1]),i.ansi[2]=We(e.green,ht[2]),i.ansi[3]=We(e.yellow,ht[3]),i.ansi[4]=We(e.blue,ht[4]),i.ansi[5]=We(e.magenta,ht[5]),i.ansi[6]=We(e.cyan,ht[6]),i.ansi[7]=We(e.white,ht[7]),i.ansi[8]=We(e.brightBlack,ht[8]),i.ansi[9]=We(e.brightRed,ht[9]),i.ansi[10]=We(e.brightGreen,ht[10]),i.ansi[11]=We(e.brightYellow,ht[11]),i.ansi[12]=We(e.brightBlue,ht[12]),i.ansi[13]=We(e.brightMagenta,ht[13]),i.ansi[14]=We(e.brightCyan,ht[14]),i.ansi[15]=We(e.brightWhite,ht[15]),e.extendedAnsi){let n=Math.min(i.ansi.length-16,e.extendedAnsi.length);for(let l=0;l<n;l++)i.ansi[l+16]=We(e.extendedAnsi[l],ht[l+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 i=0;i<this._restoreColors.ansi.length;++i)this._colors.ansi[i]=this._restoreColors.ansi[i];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()}}};Bu=Qe([se(0,Mt)],Bu);function We(e,i){if(e!==void 0)try{return Ge.toColor(e)}catch{}return i}var I1=class{constructor(...e){this._entries=new Map;for(let[i,n]of e)this.set(i,n)}set(e,i){let n=this._entries.get(e);return this._entries.set(e,i),n}forEach(e){for(let[i,n]of this._entries.entries())e(i,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},K1=class{constructor(){this._services=new I1,this._services.set(Ku,this)}setService(e,i){this._services.set(e,i)}getService(e){return this._services.get(e)}createInstance(e,...i){let n=NS(e).sort((c,d)=>c.index-d.index),l=[];for(let c of n){let d=this._services.get(c.id);if(!d)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${c.id._id}.`);l.push(d)}let o=n.length>0?n[0].index:i.length;if(i.length!==o)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${o+1} conflicts with ${i.length} static arguments`);return new e(...i,...l)}},$1={trace:0,debug:1,info:2,warn:3,error:4,off:5},Y1="xterm.js: ",zu=class extends xe{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=$1[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let i=0;i<e.length;i++)typeof e[i]=="function"&&(e[i]=e[i]())}_log(e,i,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?"":Y1)+i,...n)}trace(e,...i){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,i)}debug(e,...i){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,i)}info(e,...i){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,i)}warn(e,...i){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,i)}error(e,...i){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,i)}};zu=Qe([se(0,Mt)],zu);var J_=class extends xe{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new J),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new J),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new J),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 i=new Array(e);for(let n=0;n<Math.min(e,this.length);n++)i[n]=this._array[this._getCyclicIndex(n)];this._array=i,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let i=this._length;i<e;i++)this._array[i]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,i){this._array[this._getCyclicIndex(e)]=i}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,i,...n){if(i){for(let l=e;l<this._length-i;l++)this._array[this._getCyclicIndex(l)]=this._array[this._getCyclicIndex(l+i)];this._length-=i,this.onDeleteEmitter.fire({index:e,amount:i})}for(let l=this._length-1;l>=e;l--)this._array[this._getCyclicIndex(l+n.length)]=this._array[this._getCyclicIndex(l)];for(let l=0;l<n.length;l++)this._array[this._getCyclicIndex(e+l)]=n[l];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let l=this._length+n.length-this._maxLength;this._startIndex+=l,this._length=this._maxLength,this.onTrimEmitter.fire(l)}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,i,n){if(!(i<=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 o=i-1;o>=0;o--)this.set(e+o+n,this.get(e+o));let l=e+i+n-this._length;if(l>0)for(this._length+=l;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let l=0;l<i;l++)this.set(e+l+n,this.get(e+l))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},ye=3,lt=Object.freeze(new ml),Ka=0,Xh=2,cl=class kv{constructor(i,n,l=!1){this.isWrapped=l,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(i*ye);let o=n||_i.fromCharData([0,Km,1,0]);for(let c=0;c<i;++c)this.setCell(c,o);this.length=i}get(i){let n=this._data[i*ye+0],l=n&2097151;return[this._data[i*ye+1],n&2097152?this._combined[i]:l?Os(l):"",n>>22,n&2097152?this._combined[i].charCodeAt(this._combined[i].length-1):l]}set(i,n){this._data[i*ye+1]=n[0],n[1].length>1?(this._combined[i]=n[1],this._data[i*ye+0]=i|2097152|n[2]<<22):this._data[i*ye+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(i){return this._data[i*ye+0]>>22}hasWidth(i){return this._data[i*ye+0]&12582912}getFg(i){return this._data[i*ye+1]}getBg(i){return this._data[i*ye+2]}hasContent(i){return this._data[i*ye+0]&4194303}getCodePoint(i){let n=this._data[i*ye+0];return n&2097152?this._combined[i].charCodeAt(this._combined[i].length-1):n&2097151}isCombined(i){return this._data[i*ye+0]&2097152}getString(i){let n=this._data[i*ye+0];return n&2097152?this._combined[i]:n&2097151?Os(n&2097151):""}isProtected(i){return this._data[i*ye+2]&536870912}loadCell(i,n){return Ka=i*ye,n.content=this._data[Ka+0],n.fg=this._data[Ka+1],n.bg=this._data[Ka+2],n.content&2097152&&(n.combinedData=this._combined[i]),n.bg&268435456&&(n.extended=this._extendedAttrs[i]),n}setCell(i,n){n.content&2097152&&(this._combined[i]=n.combinedData),n.bg&268435456&&(this._extendedAttrs[i]=n.extended),this._data[i*ye+0]=n.content,this._data[i*ye+1]=n.fg,this._data[i*ye+2]=n.bg}setCellFromCodepoint(i,n,l,o){o.bg&268435456&&(this._extendedAttrs[i]=o.extended),this._data[i*ye+0]=n|l<<22,this._data[i*ye+1]=o.fg,this._data[i*ye+2]=o.bg}addCodepointToCell(i,n,l){let o=this._data[i*ye+0];o&2097152?this._combined[i]+=Os(n):o&2097151?(this._combined[i]=Os(o&2097151)+Os(n),o&=-2097152,o|=2097152):o=n|1<<22,l&&(o&=-12582913,o|=l<<22),this._data[i*ye+0]=o}insertCells(i,n,l){if(i%=this.length,i&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,l),n<this.length-i){let o=new _i;for(let c=this.length-i-n-1;c>=0;--c)this.setCell(i+n+c,this.loadCell(i+c,o));for(let c=0;c<n;++c)this.setCell(i+c,l)}else for(let o=i;o<this.length;++o)this.setCell(o,l);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,l)}deleteCells(i,n,l){if(i%=this.length,n<this.length-i){let o=new _i;for(let c=0;c<this.length-i-n;++c)this.setCell(i+c,this.loadCell(i+n+c,o));for(let c=this.length-n;c<this.length;++c)this.setCell(c,l)}else for(let o=i;o<this.length;++o)this.setCell(o,l);i&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,l),this.getWidth(i)===0&&!this.hasContent(i)&&this.setCellFromCodepoint(i,0,1,l)}replaceCells(i,n,l,o=!1){if(o){for(i&&this.getWidth(i-1)===2&&!this.isProtected(i-1)&&this.setCellFromCodepoint(i-1,0,1,l),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,l);i<n&&i<this.length;)this.isProtected(i)||this.setCell(i,l),i++;return}for(i&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,l),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,l);i<n&&i<this.length;)this.setCell(i++,l)}resize(i,n){if(i===this.length)return this._data.length*4*Xh<this._data.buffer.byteLength;let l=i*ye;if(i>this.length){if(this._data.buffer.byteLength>=l*4)this._data=new Uint32Array(this._data.buffer,0,l);else{let o=new Uint32Array(l);o.set(this._data),this._data=o}for(let o=this.length;o<i;++o)this.setCell(o,n)}else{this._data=this._data.subarray(0,l);let o=Object.keys(this._combined);for(let d=0;d<o.length;d++){let _=parseInt(o[d],10);_>=i&&delete this._combined[_]}let c=Object.keys(this._extendedAttrs);for(let d=0;d<c.length;d++){let _=parseInt(c[d],10);_>=i&&delete this._extendedAttrs[_]}}return this.length=i,l*4*Xh<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Xh<this._data.buffer.byteLength){let i=new Uint32Array(this._data.length);return i.set(this._data),this._data=i,1}return 0}fill(i,n=!1){if(n){for(let l=0;l<this.length;++l)this.isProtected(l)||this.setCell(l,i);return}this._combined={},this._extendedAttrs={};for(let l=0;l<this.length;++l)this.setCell(l,i)}copyFrom(i){this.length!==i.length?this._data=new Uint32Array(i._data):this._data.set(i._data),this.length=i.length,this._combined={};for(let n in i._combined)this._combined[n]=i._combined[n];this._extendedAttrs={};for(let n in i._extendedAttrs)this._extendedAttrs[n]=i._extendedAttrs[n];this.isWrapped=i.isWrapped}clone(){let i=new kv(0);i._data=new Uint32Array(this._data),i.length=this.length;for(let n in this._combined)i._combined[n]=this._combined[n];for(let n in this._extendedAttrs)i._extendedAttrs[n]=this._extendedAttrs[n];return i.isWrapped=this.isWrapped,i}getTrimmedLength(){for(let i=this.length-1;i>=0;--i)if(this._data[i*ye+0]&4194303)return i+(this._data[i*ye+0]>>22);return 0}getNoBgTrimmedLength(){for(let i=this.length-1;i>=0;--i)if(this._data[i*ye+0]&4194303||this._data[i*ye+2]&50331648)return i+(this._data[i*ye+0]>>22);return 0}copyCellsFrom(i,n,l,o,c){let d=i._data;if(c)for(let g=o-1;g>=0;g--){for(let f=0;f<ye;f++)this._data[(l+g)*ye+f]=d[(n+g)*ye+f];d[(n+g)*ye+2]&268435456&&(this._extendedAttrs[l+g]=i._extendedAttrs[n+g])}else for(let g=0;g<o;g++){for(let f=0;f<ye;f++)this._data[(l+g)*ye+f]=d[(n+g)*ye+f];d[(n+g)*ye+2]&268435456&&(this._extendedAttrs[l+g]=i._extendedAttrs[n+g])}let _=Object.keys(i._combined);for(let g=0;g<_.length;g++){let f=parseInt(_[g],10);f>=n&&(this._combined[f-n+l]=i._combined[f])}}translateToString(i,n,l,o){n=n??0,l=l??this.length,i&&(l=Math.min(l,this.getTrimmedLength())),o&&(o.length=0);let c="";for(;n<l;){let d=this._data[n*ye+0],_=d&2097151,g=d&2097152?this._combined[n]:_?Os(_):js;if(c+=g,o)for(let f=0;f<g.length;++f)o.push(n);n+=d>>22||1}return o&&o.push(n),c}};function F1(e,i,n,l,o,c){let d=[];for(let _=0;_<e.length-1;_++){let g=_,f=e.get(++g);if(!f.isWrapped)continue;let x=[e.get(_)];for(;g<e.length&&f.isWrapped;)x.push(f),f=e.get(++g);if(!c&&l>=_&&l<g){_+=x.length-1;continue}let v=0,b=_l(x,v,i),w=1,S=0;for(;w<x.length;){let z=_l(x,w,i),A=z-S,W=n-b,j=Math.min(A,W);x[v].copyCellsFrom(x[w],S,b,j,!1),b+=j,b===n&&(v++,b=0),S+=j,S===z&&(w++,S=0),b===0&&v!==0&&x[v-1].getWidth(n-1)===2&&(x[v].copyCellsFrom(x[v-1],n-1,b++,1,!1),x[v-1].setCell(n-1,o))}x[v].replaceCells(b,n,o);let R=0;for(let z=x.length-1;z>0&&(z>v||x[z].getTrimmedLength()===0);z--)R++;R>0&&(d.push(_+x.length-R),d.push(R)),_+=x.length-1}return d}function G1(e,i){let n=[],l=0,o=i[l],c=0;for(let d=0;d<e.length;d++)if(o===d){let _=i[++l];e.onDeleteEmitter.fire({index:d-c,amount:_}),d+=_-1,c+=_,o=i[++l]}else n.push(d);return{layout:n,countRemoved:c}}function X1(e,i){let n=[];for(let l=0;l<i.length;l++)n.push(e.get(i[l]));for(let l=0;l<n.length;l++)e.set(l,n[l]);e.length=i.length}function V1(e,i,n){let l=[],o=e.map((g,f)=>_l(e,f,i)).reduce((g,f)=>g+f),c=0,d=0,_=0;for(;_<o;){if(o-_<n){l.push(o-_);break}c+=n;let g=_l(e,d,i);c>g&&(c-=g,d++);let f=e[d].getWidth(c-1)===2;f&&c--;let x=f?n-1:n;l.push(x),_+=x}return l}function _l(e,i,n){if(i===e.length-1)return e[i].getTrimmedLength();let l=!e[i].hasContent(n-1)&&e[i].getWidth(n-1)===1,o=e[i+1].getWidth(0)===2;return l&&o?n-1:n}var Ev=class Tv{constructor(i){this.line=i,this.isDisposed=!1,this._disposables=[],this._id=Tv._nextId++,this._onDispose=this.register(new J),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),ar(this._disposables),this._disposables.length=0)}register(i){return this._disposables.push(i),i}};Ev._nextId=1;var Z1=Ev,dt={},sr=dt.B;dt[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:"≥","{":"π","|":"≠","}":"£","~":"·"};dt.A={"#":"£"};dt.B=void 0;dt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};dt.C=dt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};dt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};dt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};dt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};dt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};dt.E=dt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};dt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};dt.H=dt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};dt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var em=4294967295,tm=class{constructor(e,i,n){this._hasScrollback=e,this._optionsService=i,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=lt.clone(),this.savedCharset=sr,this.markers=[],this._nullCell=_i.fromCharData([0,Km,1,0]),this._whitespaceCell=_i.fromCharData([0,js,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new so,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new J_(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 Ja),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 Ja),this._whitespaceCell}getBlankLine(e,i){return new cl(this._bufferService.cols,this.getNullCell(e),i)}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 i=e+this._optionsService.rawOptions.scrollback;return i>em?em:i}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=lt);let i=this._rows;for(;i--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new J_(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,i){let n=this.getNullCell(lt),l=0,o=this._getCorrectBufferLength(i);if(o>this.lines.maxLength&&(this.lines.maxLength=o),this.lines.length>0){if(this._cols<e)for(let d=0;d<this.lines.length;d++)l+=+this.lines.get(d).resize(e,n);let c=0;if(this._rows<i)for(let d=this._rows;d<i;d++)this.lines.length<i+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new cl(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+c+1?(this.ybase--,c++,this.ydisp>0&&this.ydisp--):this.lines.push(new cl(e,n)));else for(let d=this._rows;d>i;d--)this.lines.length>i+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(o<this.lines.maxLength){let d=this.lines.length-o;d>0&&(this.lines.trimStart(d),this.ybase=Math.max(this.ybase-d,0),this.ydisp=Math.max(this.ydisp-d,0),this.savedY=Math.max(this.savedY-d,0)),this.lines.maxLength=o}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,i-1),c&&(this.y+=c),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=i-1,this._isReflowEnabled&&(this._reflow(e,i),this._cols>e))for(let c=0;c<this.lines.length;c++)l+=+this.lines.get(c).resize(e,n);this._cols=e,this._rows=i,this._memoryCleanupQueue.clear(),l>.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 i=0;for(;this._memoryCleanupPosition<this.lines.length;)if(i+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),i>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,i){this._cols!==e&&(e>this._cols?this._reflowLarger(e,i):this._reflowSmaller(e,i))}_reflowLarger(e,i){let n=this._optionsService.rawOptions.reflowCursorLine,l=F1(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(lt),n);if(l.length>0){let o=G1(this.lines,l);X1(this.lines,o.layout),this._reflowLargerAdjustViewport(e,i,o.countRemoved)}}_reflowLargerAdjustViewport(e,i,n){let l=this.getNullCell(lt),o=n;for(;o-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<i&&this.lines.push(new cl(e,l))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,i){let n=this._optionsService.rawOptions.reflowCursorLine,l=this.getNullCell(lt),o=[],c=0;for(let d=this.lines.length-1;d>=0;d--){let _=this.lines.get(d);if(!_||!_.isWrapped&&_.getTrimmedLength()<=e)continue;let g=[_];for(;_.isWrapped&&d>0;)_=this.lines.get(--d),g.unshift(_);if(!n){let j=this.ybase+this.y;if(j>=d&&j<d+g.length)continue}let f=g[g.length-1].getTrimmedLength(),x=V1(g,this._cols,e),v=x.length-g.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 w=[];for(let j=0;j<v;j++){let C=this.getBlankLine(lt,!0);w.push(C)}w.length>0&&(o.push({start:d+g.length+c,newLines:w}),c+=w.length),g.push(...w);let S=x.length-1,R=x[S];R===0&&(S--,R=x[S]);let z=g.length-v-1,A=f;for(;z>=0;){let j=Math.min(A,R);if(g[S]===void 0)break;if(g[S].copyCellsFrom(g[z],A-j,R-j,j,!0),R-=j,R===0&&(S--,R=x[S]),A-=j,A===0){z--;let C=Math.max(z,0);A=_l(g,C,this._cols)}}for(let j=0;j<g.length;j++)x[j]<e&&g[j].setCell(x[j],l);let W=v-b;for(;W-- >0;)this.ybase===0?this.y<i-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+c)-i&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+v,this.ybase+i-1)}if(o.length>0){let d=[],_=[];for(let R=0;R<this.lines.length;R++)_.push(this.lines.get(R));let g=this.lines.length,f=g-1,x=0,v=o[x];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+c);let b=0;for(let R=Math.min(this.lines.maxLength-1,g+c-1);R>=0;R--)if(v&&v.start>f+b){for(let z=v.newLines.length-1;z>=0;z--)this.lines.set(R--,v.newLines[z]);R++,d.push({index:f+1,amount:v.newLines.length}),b+=v.newLines.length,v=o[++x]}else this.lines.set(R,_[f--]);let w=0;for(let R=d.length-1;R>=0;R--)d[R].index+=w,this.lines.onInsertEmitter.fire(d[R]),w+=d[R].amount;let S=Math.max(0,g+c-this.lines.maxLength);S>0&&this.lines.onTrimEmitter.fire(S)}}translateBufferLineToString(e,i,n=0,l){let o=this.lines.get(e);return o?o.translateToString(i,n,l):""}getWrappedRangeForLine(e){let i=e,n=e;for(;i>0&&this.lines.get(i).isWrapped;)i--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:i,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 i=0;i<this.markers.length;i++)this.markers[i].line===e&&(this.markers[i].dispose(),this.markers.splice(i--,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 i=new Z1(e);return this.markers.push(i),i.register(this.lines.onTrim(n=>{i.line-=n,i.line<0&&i.dispose()})),i.register(this.lines.onInsert(n=>{i.line>=n.index&&(i.line+=n.amount)})),i.register(this.lines.onDelete(n=>{i.line>=n.index&&i.line<n.index+n.amount&&i.dispose(),i.line>n.index&&(i.line-=n.amount)})),i.register(i.onDispose(()=>this._removeMarker(i))),i}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},Q1=class extends xe{constructor(e,i){super(),this._optionsService=e,this._bufferService=i,this._onBufferActivate=this._register(new J),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 tm(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new tm(!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,i){this._normal.resize(e,i),this._alt.resize(e,i),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},Rv=2,Dv=1,Au=class extends xe{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new J),this.onResize=this._onResize.event,this._onScroll=this._register(new J),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,Rv),this.rows=Math.max(e.rawOptions.rows||0,Dv),this.buffers=this._register(new Q1(e,this)),this._register(this.buffers.onBufferActivate(i=>{this._onScroll.fire(i.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,i){let n=this.cols!==e,l=this.rows!==i;this.cols=e,this.rows=i,this.buffers.resize(e,i),this._onResize.fire({cols:e,rows:i,colsChanged:n,rowsChanged:l})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,i=!1){let n=this.buffer,l;l=this._cachedBlankLine,(!l||l.length!==this.cols||l.getFg(0)!==e.fg||l.getBg(0)!==e.bg)&&(l=n.getBlankLine(e,i),this._cachedBlankLine=l),l.isWrapped=i;let o=n.ybase+n.scrollTop,c=n.ybase+n.scrollBottom;if(n.scrollTop===0){let d=n.lines.isFull;c===n.lines.length-1?d?n.lines.recycle().copyFrom(l):n.lines.push(l.clone()):n.lines.splice(c+1,0,l.clone()),d?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let d=c-o+1;n.lines.shiftElements(o+1,d-1,-1),n.lines.set(c,l.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,i){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 l=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),l!==n.ydisp&&(i||this._onScroll.fire(n.ydisp))}};Au=Qe([se(0,Mt)],Au);var Zr={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:io,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},J1=["normal","bold","100","200","300","400","500","600","700","800","900"],ew=class extends xe{constructor(e){super(),this._onOptionChange=this._register(new J),this.onOptionChange=this._onOptionChange.event;let i={...Zr};for(let n in e)if(n in i)try{let l=e[n];i[n]=this._sanitizeAndValidateOption(n,l)}catch(l){console.error(l)}this.rawOptions=i,this.options={...i},this._setupOptions(),this._register(Ye(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,i){return this.onOptionChange(n=>{n===e&&i(this.rawOptions[e])})}onMultipleOptionChange(e,i){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&i()})}_setupOptions(){let e=n=>{if(!(n in Zr))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},i=(n,l)=>{if(!(n in Zr))throw new Error(`No option with key "${n}"`);l=this._sanitizeAndValidateOption(n,l),this.rawOptions[n]!==l&&(this.rawOptions[n]=l,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let l={get:e.bind(this,n),set:i.bind(this,n)};Object.defineProperty(this.options,n,l)}}_sanitizeAndValidateOption(e,i){switch(e){case"cursorStyle":if(i||(i=Zr[e]),!tw(i))throw new Error(`"${i}" is not a valid value for ${e}`);break;case"wordSeparator":i||(i=Zr[e]);break;case"fontWeight":case"fontWeightBold":if(typeof i=="number"&&1<=i&&i<=1e3)break;i=J1.includes(i)?i:Zr[e];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw new Error(`${e} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(i*10)/10));break;case"scrollback":if(i=Math.min(i,4294967295),i<0)throw new Error(`${e} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&i!==0)throw new Error(`${e} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{};break}return i}};function tw(e){return e==="block"||e==="underline"||e==="bar"}function hl(e,i=5){if(typeof e!="object")return e;let n=Array.isArray(e)?[]:{};for(let l in e)n[l]=i<=1?e[l]:e[l]&&hl(e[l],i-1);return n}var im=Object.freeze({insertMode:!1}),sm=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Mu=class extends xe{constructor(e,i,n){super(),this._bufferService=e,this._logService=i,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new J),this.onData=this._onData.event,this._onUserInput=this._register(new J),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new J),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new J),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=hl(im),this.decPrivateModes=hl(sm)}reset(){this.modes=hl(im),this.decPrivateModes=hl(sm)}triggerDataEvent(e,i=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;i&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),i&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(l=>l.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(i=>i.charCodeAt(0))),this._onBinary.fire(e))}};Mu=Qe([se(0,At),se(1,Xm),se(2,Mt)],Mu);var rm={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 Vh(e,i){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&&!i&&(n|=3)),n}var Zh=String.fromCharCode,nm={DEFAULT:e=>{let i=[Vh(e,!1)+32,e.col+32,e.row+32];return i[0]>255||i[1]>255||i[2]>255?"":`\x1B[M${Zh(i[0])}${Zh(i[1])}${Zh(i[2])}`},SGR:e=>{let i=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Vh(e,!0)};${e.col};${e.row}${i}`},SGR_PIXELS:e=>{let i=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Vh(e,!0)};${e.x};${e.y}${i}`}},Ou=class extends xe{constructor(e,i,n){super(),this._bufferService=e,this._coreService=i,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new J),this.onProtocolChange=this._onProtocolChange.event;for(let l of Object.keys(rm))this.addProtocol(l,rm[l]);for(let l of Object.keys(nm))this.addEncoding(l,nm[l]);this.reset()}addProtocol(e,i){this._protocols[e]=i}addEncoding(e,i){this._encodings[e]=i}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,i,n){if(e.deltaY===0||e.shiftKey||i===void 0||n===void 0)return 0;let l=i/n,o=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(o/=l+0,Math.abs(e.deltaY)<50&&(o*=.3),this._wheelPartialScroll+=o,o=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(o*=this._bufferService.rows),o}_applyScrollModifier(e,i){return i.altKey||i.ctrlKey||i.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 i=this._encodings[this._activeEncoding](e);return i&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(i):this._coreService.triggerDataEvent(i,!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,i,n){if(n){if(e.x!==i.x||e.y!==i.y)return!1}else if(e.col!==i.col||e.row!==i.row)return!1;return!(e.button!==i.button||e.action!==i.action||e.ctrl!==i.ctrl||e.alt!==i.alt||e.shift!==i.shift)}};Ou=Qe([se(0,At),se(1,hr),se(2,Mt)],Ou);var Qh=[[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]],iw=[[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]],ut;function sw(e,i){let n=0,l=i.length-1,o;if(e<i[0][0]||e>i[l][1])return!1;for(;l>=n;)if(o=n+l>>1,e>i[o][1])n=o+1;else if(e<i[o][0])l=o-1;else return!0;return!1}var rw=class{constructor(){if(this.version="6",!ut){ut=new Uint8Array(65536),ut.fill(1),ut[0]=0,ut.fill(0,1,32),ut.fill(0,127,160),ut.fill(2,4352,4448),ut[9001]=2,ut[9002]=2,ut.fill(2,11904,42192),ut[12351]=1,ut.fill(2,44032,55204),ut.fill(2,63744,64256),ut.fill(2,65040,65050),ut.fill(2,65072,65136),ut.fill(2,65280,65377),ut.fill(2,65504,65511);for(let e=0;e<Qh.length;++e)ut.fill(0,Qh[e][0],Qh[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?ut[e]:sw(e,iw)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,i){let n=this.wcwidth(e),l=n===0&&i!==0;if(l){let o=nr.extractWidth(i);o===0?l=!1:o>n&&(n=o)}return nr.createPropertyValue(0,n,l)}},nr=class Za{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new J,this.onChange=this._onChange.event;let i=new rw;this.register(i),this._active=i.version,this._activeProvider=i}static extractShouldJoin(i){return(i&1)!==0}static extractWidth(i){return i>>1&3}static extractCharKind(i){return i>>3}static createPropertyValue(i,n,l=!1){return(i&16777215)<<3|(n&3)<<1|(l?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(i){if(!this._providers[i])throw new Error(`unknown Unicode version "${i}"`);this._active=i,this._activeProvider=this._providers[i],this._onChange.fire(i)}register(i){this._providers[i.version]=i}wcwidth(i){return this._activeProvider.wcwidth(i)}getStringCellWidth(i){let n=0,l=0,o=i.length;for(let c=0;c<o;++c){let d=i.charCodeAt(c);if(55296<=d&&d<=56319){if(++c>=o)return n+this.wcwidth(d);let f=i.charCodeAt(c);56320<=f&&f<=57343?d=(d-55296)*1024+f-56320+65536:n+=this.wcwidth(f)}let _=this.charProperties(d,l),g=Za.extractWidth(_);Za.extractShouldJoin(_)&&(g-=Za.extractWidth(l)),n+=g,l=_}return n}charProperties(i,n){return this._activeProvider.charProperties(i,n)}},nw=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,i){this._charsets[e]=i,this.glevel===e&&(this.charset=i)}};function lm(e){let i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&i&&(n.isWrapped=i[3]!==0&&i[3]!==32)}var il=2147483647,lw=256,Bv=class ju{constructor(i=32,n=32){if(this.maxLength=i,this.maxSubParamsLength=n,n>lw)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(i),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(i),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(i){let n=new ju;if(!i.length)return n;for(let l=Array.isArray(i[0])?1:0;l<i.length;++l){let o=i[l];if(Array.isArray(o))for(let c=0;c<o.length;++c)n.addSubParam(o[c]);else n.addParam(o)}return n}clone(){let i=new ju(this.maxLength,this.maxSubParamsLength);return i.params.set(this.params),i.length=this.length,i._subParams.set(this._subParams),i._subParamsLength=this._subParamsLength,i._subParamsIdx.set(this._subParamsIdx),i._rejectDigits=this._rejectDigits,i._rejectSubDigits=this._rejectSubDigits,i._digitIsSub=this._digitIsSub,i}toArray(){let i=[];for(let n=0;n<this.length;++n){i.push(this.params[n]);let l=this._subParamsIdx[n]>>8,o=this._subParamsIdx[n]&255;o-l>0&&i.push(Array.prototype.slice.call(this._subParams,l,o))}return i}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(i){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(i<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=i>il?il:i}addSubParam(i){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(i<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=i>il?il:i,this._subParamsIdx[this.length-1]++}}hasSubParams(i){return(this._subParamsIdx[i]&255)-(this._subParamsIdx[i]>>8)>0}getSubParams(i){let n=this._subParamsIdx[i]>>8,l=this._subParamsIdx[i]&255;return l-n>0?this._subParams.subarray(n,l):null}getSubParamsAll(){let i={};for(let n=0;n<this.length;++n){let l=this._subParamsIdx[n]>>8,o=this._subParamsIdx[n]&255;o-l>0&&(i[n]=this._subParams.slice(l,o))}return i}addDigit(i){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let l=this._digitIsSub?this._subParams:this.params,o=l[n-1];l[n-1]=~o?Math.min(o*10+i,il):i}},sl=[],aw=class{constructor(){this._state=0,this._active=sl,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,i){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(i),{dispose:()=>{let l=n.indexOf(i);l!==-1&&n.splice(l,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=sl}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=sl,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||sl,!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,i,n){if(!this._active.length)this._handlerFb(this._id,"PUT",co(e,i,n));else for(let l=this._active.length-1;l>=0;l--)this._active[l].put(e,i,n)}start(){this.reset(),this._state=1}put(e,i,n){if(this._state!==3){if(this._state===1)for(;i<n;){let l=e[i++];if(l===59){this._state=2,this._start();break}if(l<48||57<l){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+l-48}this._state===2&&n-i>0&&this._put(e,i,n)}}end(e,i=!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,l=this._active.length-1,o=!1;if(this._stack.paused&&(l=this._stack.loopPosition-1,n=i,o=this._stack.fallThrough,this._stack.paused=!1),!o&&n===!1){for(;l>=0&&(n=this._active[l].end(e),n!==!0);l--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=l,this._stack.fallThrough=!1,n;l--}for(;l>=0;l--)if(n=this._active[l].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=l,this._stack.fallThrough=!0,n}this._active=sl,this._id=-1,this._state=0}}},Jt=class{constructor(i){this._handler=i,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(i,n,l){this._hitLimit||(this._data+=co(i,n,l),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(i){let n=!1;if(this._hitLimit)n=!1;else if(i&&(n=this._handler(this._data),n instanceof Promise))return n.then(l=>(this._data="",this._hitLimit=!1,l));return this._data="",this._hitLimit=!1,n}},rl=[],ow=class{constructor(){this._handlers=Object.create(null),this._active=rl,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=rl}registerHandler(e,i){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(i),{dispose:()=>{let l=n.indexOf(i);l!==-1&&n.splice(l,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=rl,this._ident=0}hook(e,i){if(this.reset(),this._ident=e,this._active=this._handlers[e]||rl,!this._active.length)this._handlerFb(this._ident,"HOOK",i);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(i)}put(e,i,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",co(e,i,n));else for(let l=this._active.length-1;l>=0;l--)this._active[l].put(e,i,n)}unhook(e,i=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,l=this._active.length-1,o=!1;if(this._stack.paused&&(l=this._stack.loopPosition-1,n=i,o=this._stack.fallThrough,this._stack.paused=!1),!o&&n===!1){for(;l>=0&&(n=this._active[l].unhook(e),n!==!0);l--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=l,this._stack.fallThrough=!1,n;l--}for(;l>=0;l--)if(n=this._active[l].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=l,this._stack.fallThrough=!0,n}this._active=rl,this._ident=0}},ul=new Bv;ul.addParam(0);var am=class{constructor(e){this._handler=e,this._data="",this._params=ul,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():ul,this._data="",this._hitLimit=!1}put(e,i,n){this._hitLimit||(this._data+=co(e,i,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let i=!1;if(this._hitLimit)i=!1;else if(e&&(i=this._handler(this._data,this._params),i instanceof Promise))return i.then(n=>(this._params=ul,this._data="",this._hitLimit=!1,n));return this._params=ul,this._data="",this._hitLimit=!1,i}},cw=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,i){this.table.fill(e<<4|i)}add(e,i,n,l){this.table[i<<8|e]=n<<4|l}addMany(e,i,n,l){for(let o=0;o<e.length;o++)this.table[i<<8|e[o]]=n<<4|l}},pi=160,hw=(function(){let e=new cw(4095),i=Array.apply(null,Array(256)).map((_,g)=>g),n=(_,g)=>i.slice(_,g),l=n(32,127),o=n(0,24);o.push(25),o.push.apply(o,n(28,32));let c=n(0,14),d;e.setDefault(1,0),e.addMany(l,0,2,0);for(d in c)e.addMany([24,26,153,154],d,3,0),e.addMany(n(128,144),d,3,0),e.addMany(n(144,152),d,3,0),e.add(156,d,0,0),e.add(27,d,11,1),e.add(157,d,4,8),e.addMany([152,158,159],d,0,7),e.add(155,d,11,3),e.add(144,d,11,9);return e.addMany(o,0,3,0),e.addMany(o,1,3,1),e.add(127,1,0,1),e.addMany(o,8,0,8),e.addMany(o,3,3,3),e.add(127,3,0,3),e.addMany(o,4,3,4),e.add(127,4,0,4),e.addMany(o,6,3,6),e.addMany(o,5,3,5),e.add(127,5,0,5),e.addMany(o,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(l,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(l,7,0,7),e.addMany(o,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(o,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(o,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(o,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(o,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(o,13,13,13),e.addMany(l,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(pi,0,2,0),e.add(pi,8,5,8),e.add(pi,6,0,6),e.add(pi,11,0,11),e.add(pi,13,13,13),e})(),uw=class extends xe{constructor(e=hw){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 Bv,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(i,n,l)=>{},this._executeHandlerFb=i=>{},this._csiHandlerFb=(i,n)=>{},this._escHandlerFb=i=>{},this._errorHandlerFb=i=>i,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(Ye(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new aw),this._dcsParser=this._register(new ow),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,i=[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 o=0;o<e.intermediates.length;++o){let c=e.intermediates.charCodeAt(o);if(32>c||c>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=c}}if(e.final.length!==1)throw new Error("final must be a single byte");let l=e.final.charCodeAt(0);if(i[0]>l||l>i[1])throw new Error(`final must be in range ${i[0]} .. ${i[1]}`);return n<<=8,n|=l,n}identToString(e){let i=[];for(;e;)i.push(String.fromCharCode(e&255)),e>>=8;return i.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,i){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let l=this._escHandlers[n];return l.push(i),{dispose:()=>{let o=l.indexOf(i);o!==-1&&l.splice(o,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,i){this._executeHandlers[e.charCodeAt(0)]=i}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,i){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let l=this._csiHandlers[n];return l.push(i),{dispose:()=>{let o=l.indexOf(i);o!==-1&&l.splice(o,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,i){return this._dcsParser.registerHandler(this._identifier(e),i)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,i){return this._oscParser.registerHandler(e,i)}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,i,n,l,o){this._parseStack.state=e,this._parseStack.handlers=i,this._parseStack.handlerPos=n,this._parseStack.transition=l,this._parseStack.chunkPos=o}parse(e,i,n){let l=0,o=0,c=0,d;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,c=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 _=this._parseStack.handlers,g=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&g>-1){for(;g>=0&&(d=_[g](this._params),d!==!0);g--)if(d instanceof Promise)return this._parseStack.handlerPos=g,d}this._parseStack.handlers=[];break;case 4:if(n===!1&&g>-1){for(;g>=0&&(d=_[g](),d!==!0);g--)if(d instanceof Promise)return this._parseStack.handlerPos=g,d}this._parseStack.handlers=[];break;case 6:if(l=e[this._parseStack.chunkPos],d=this._dcsParser.unhook(l!==24&&l!==26,n),d)return d;l===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(l=e[this._parseStack.chunkPos],d=this._oscParser.end(l!==24&&l!==26,n),d)return d;l===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,c=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let _=c;_<i;++_){switch(l=e[_],o=this._transitions.table[this.currentState<<8|(l<160?l:pi)],o>>4){case 2:for(let b=_+1;;++b){if(b>=i||(l=e[b])<32||l>126&&l<pi){this._printHandler(e,_,b),_=b-1;break}if(++b>=i||(l=e[b])<32||l>126&&l<pi){this._printHandler(e,_,b),_=b-1;break}if(++b>=i||(l=e[b])<32||l>126&&l<pi){this._printHandler(e,_,b),_=b-1;break}if(++b>=i||(l=e[b])<32||l>126&&l<pi){this._printHandler(e,_,b),_=b-1;break}}break;case 3:this._executeHandlers[l]?this._executeHandlers[l]():this._executeHandlerFb(l),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:_,code:l,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let g=this._csiHandlers[this._collect<<8|l],f=g?g.length-1:-1;for(;f>=0&&(d=g[f](this._params),d!==!0);f--)if(d instanceof Promise)return this._preserveStack(3,g,f,o,_),d;f<0&&this._csiHandlerFb(this._collect<<8|l,this._params),this.precedingJoinState=0;break;case 8:do switch(l){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(l-48)}while(++_<i&&(l=e[_])>47&&l<60);_--;break;case 9:this._collect<<=8,this._collect|=l;break;case 10:let x=this._escHandlers[this._collect<<8|l],v=x?x.length-1:-1;for(;v>=0&&(d=x[v](),d!==!0);v--)if(d instanceof Promise)return this._preserveStack(4,x,v,o,_),d;v<0&&this._escHandlerFb(this._collect<<8|l),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|l,this._params);break;case 13:for(let b=_+1;;++b)if(b>=i||(l=e[b])===24||l===26||l===27||l>127&&l<pi){this._dcsParser.put(e,_,b),_=b-1;break}break;case 14:if(d=this._dcsParser.unhook(l!==24&&l!==26),d)return this._preserveStack(6,[],0,o,_),d;l===27&&(o|=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=_+1;;b++)if(b>=i||(l=e[b])<32||l>127&&l<pi){this._oscParser.put(e,_,b),_=b-1;break}break;case 6:if(d=this._oscParser.end(l!==24&&l!==26),d)return this._preserveStack(5,[],0,o,_),d;l===27&&(o|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=o&15}}},dw=/^([\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})$/,fw=/^[\da-f]+$/;function om(e){if(!e)return;let i=e.toLowerCase();if(i.indexOf("rgb:")===0){i=i.slice(4);let n=dw.exec(i);if(n){let l=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/l*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/l*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/l*255)]}}else if(i.indexOf("#")===0&&(i=i.slice(1),fw.exec(i)&&[3,6,9,12].includes(i.length))){let n=i.length/3,l=[0,0,0];for(let o=0;o<3;++o){let c=parseInt(i.slice(n*o,n*o+n),16);l[o]=n===1?c<<4:n===2?c:n===3?c>>4:c>>8}return l}}function Jh(e,i){let n=e.toString(16),l=n.length<2?"0"+n:n;switch(i){case 4:return n[0];case 8:return l;case 12:return(l+l).slice(0,3);default:return l+l}}function pw(e,i=16){let[n,l,o]=e;return`rgb:${Jh(n,i)}/${Jh(l,i)}/${Jh(o,i)}`}var gw={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Ms=131072,cm=10;function hm(e,i){if(e>24)return i.setWinLines||!1;switch(e){case 1:return!!i.restoreWin;case 2:return!!i.minimizeWin;case 3:return!!i.setWinPosition;case 4:return!!i.setWinSizePixels;case 5:return!!i.raiseWin;case 6:return!!i.lowerWin;case 7:return!!i.refreshWin;case 8:return!!i.setWinSizeChars;case 9:return!!i.maximizeWin;case 10:return!!i.fullscreenWin;case 11:return!!i.getWinState;case 13:return!!i.getWinPosition;case 14:return!!i.getWinSizePixels;case 15:return!!i.getScreenSizePixels;case 16:return!!i.getCellSizePixels;case 18:return!!i.getWinSizeChars;case 19:return!!i.getScreenSizeChars;case 20:return!!i.getIconTitle;case 21:return!!i.getWinTitle;case 22:return!!i.pushTitle;case 23:return!!i.popTitle;case 24:return!!i.setWinLines}return!1}var um=5e3,dm=0,_w=class extends xe{constructor(e,i,n,l,o,c,d,_,g=new uw){super(),this._bufferService=e,this._charsetService=i,this._coreService=n,this._logService=l,this._optionsService=o,this._oscLinkService=c,this._coreMouseService=d,this._unicodeService=_,this._parser=g,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new jS,this._utf8Decoder=new LS,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=lt.clone(),this._eraseAttrDataInternal=lt.clone(),this._onRequestBell=this._register(new J),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new J),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new J),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new J),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new J),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new J),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new J),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new J),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new J),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new J),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new J),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new J),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new J),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 Lu(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(f=>this._activeBuffer=f.activeBuffer)),this._parser.setCsiHandlerFallback((f,x)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(f),params:x.toArray()})}),this._parser.setEscHandlerFallback(f=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(f)})}),this._parser.setExecuteHandlerFallback(f=>{this._logService.debug("Unknown EXECUTE code: ",{code:f})}),this._parser.setOscHandlerFallback((f,x,v)=>{this._logService.debug("Unknown OSC code: ",{identifier:f,action:x,data:v})}),this._parser.setDcsHandlerFallback((f,x,v)=>{x==="HOOK"&&(v=v.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(f),action:x,payload:v})}),this._parser.setPrintHandler((f,x,v)=>this.print(f,x,v)),this._parser.registerCsiHandler({final:"@"},f=>this.insertChars(f)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},f=>this.scrollLeft(f)),this._parser.registerCsiHandler({final:"A"},f=>this.cursorUp(f)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},f=>this.scrollRight(f)),this._parser.registerCsiHandler({final:"B"},f=>this.cursorDown(f)),this._parser.registerCsiHandler({final:"C"},f=>this.cursorForward(f)),this._parser.registerCsiHandler({final:"D"},f=>this.cursorBackward(f)),this._parser.registerCsiHandler({final:"E"},f=>this.cursorNextLine(f)),this._parser.registerCsiHandler({final:"F"},f=>this.cursorPrecedingLine(f)),this._parser.registerCsiHandler({final:"G"},f=>this.cursorCharAbsolute(f)),this._parser.registerCsiHandler({final:"H"},f=>this.cursorPosition(f)),this._parser.registerCsiHandler({final:"I"},f=>this.cursorForwardTab(f)),this._parser.registerCsiHandler({final:"J"},f=>this.eraseInDisplay(f,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},f=>this.eraseInDisplay(f,!0)),this._parser.registerCsiHandler({final:"K"},f=>this.eraseInLine(f,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},f=>this.eraseInLine(f,!0)),this._parser.registerCsiHandler({final:"L"},f=>this.insertLines(f)),this._parser.registerCsiHandler({final:"M"},f=>this.deleteLines(f)),this._parser.registerCsiHandler({final:"P"},f=>this.deleteChars(f)),this._parser.registerCsiHandler({final:"S"},f=>this.scrollUp(f)),this._parser.registerCsiHandler({final:"T"},f=>this.scrollDown(f)),this._parser.registerCsiHandler({final:"X"},f=>this.eraseChars(f)),this._parser.registerCsiHandler({final:"Z"},f=>this.cursorBackwardTab(f)),this._parser.registerCsiHandler({final:"`"},f=>this.charPosAbsolute(f)),this._parser.registerCsiHandler({final:"a"},f=>this.hPositionRelative(f)),this._parser.registerCsiHandler({final:"b"},f=>this.repeatPrecedingCharacter(f)),this._parser.registerCsiHandler({final:"c"},f=>this.sendDeviceAttributesPrimary(f)),this._parser.registerCsiHandler({prefix:">",final:"c"},f=>this.sendDeviceAttributesSecondary(f)),this._parser.registerCsiHandler({final:"d"},f=>this.linePosAbsolute(f)),this._parser.registerCsiHandler({final:"e"},f=>this.vPositionRelative(f)),this._parser.registerCsiHandler({final:"f"},f=>this.hVPosition(f)),this._parser.registerCsiHandler({final:"g"},f=>this.tabClear(f)),this._parser.registerCsiHandler({final:"h"},f=>this.setMode(f)),this._parser.registerCsiHandler({prefix:"?",final:"h"},f=>this.setModePrivate(f)),this._parser.registerCsiHandler({final:"l"},f=>this.resetMode(f)),this._parser.registerCsiHandler({prefix:"?",final:"l"},f=>this.resetModePrivate(f)),this._parser.registerCsiHandler({final:"m"},f=>this.charAttributes(f)),this._parser.registerCsiHandler({final:"n"},f=>this.deviceStatus(f)),this._parser.registerCsiHandler({prefix:"?",final:"n"},f=>this.deviceStatusPrivate(f)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},f=>this.softReset(f)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},f=>this.setCursorStyle(f)),this._parser.registerCsiHandler({final:"r"},f=>this.setScrollRegion(f)),this._parser.registerCsiHandler({final:"s"},f=>this.saveCursor(f)),this._parser.registerCsiHandler({final:"t"},f=>this.windowOptions(f)),this._parser.registerCsiHandler({final:"u"},f=>this.restoreCursor(f)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},f=>this.insertColumns(f)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},f=>this.deleteColumns(f)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},f=>this.selectProtected(f)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},f=>this.requestMode(f,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},f=>this.requestMode(f,!1)),this._parser.setExecuteHandler(F.BEL,()=>this.bell()),this._parser.setExecuteHandler(F.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(F.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(F.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(F.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(F.BS,()=>this.backspace()),this._parser.setExecuteHandler(F.HT,()=>this.tab()),this._parser.setExecuteHandler(F.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(F.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Xa.IND,()=>this.index()),this._parser.setExecuteHandler(Xa.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Xa.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Jt(f=>(this.setTitle(f),this.setIconName(f),!0))),this._parser.registerOscHandler(1,new Jt(f=>this.setIconName(f))),this._parser.registerOscHandler(2,new Jt(f=>this.setTitle(f))),this._parser.registerOscHandler(4,new Jt(f=>this.setOrReportIndexedColor(f))),this._parser.registerOscHandler(8,new Jt(f=>this.setHyperlink(f))),this._parser.registerOscHandler(10,new Jt(f=>this.setOrReportFgColor(f))),this._parser.registerOscHandler(11,new Jt(f=>this.setOrReportBgColor(f))),this._parser.registerOscHandler(12,new Jt(f=>this.setOrReportCursorColor(f))),this._parser.registerOscHandler(104,new Jt(f=>this.restoreIndexedColor(f))),this._parser.registerOscHandler(110,new Jt(f=>this.restoreFgColor(f))),this._parser.registerOscHandler(111,new Jt(f=>this.restoreBgColor(f))),this._parser.registerOscHandler(112,new Jt(f=>this.restoreCursorColor(f))),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 f in dt)this._parser.registerEscHandler({intermediates:"(",final:f},()=>this.selectCharset("("+f)),this._parser.registerEscHandler({intermediates:")",final:f},()=>this.selectCharset(")"+f)),this._parser.registerEscHandler({intermediates:"*",final:f},()=>this.selectCharset("*"+f)),this._parser.registerEscHandler({intermediates:"+",final:f},()=>this.selectCharset("+"+f)),this._parser.registerEscHandler({intermediates:"-",final:f},()=>this.selectCharset("-"+f)),this._parser.registerEscHandler({intermediates:".",final:f},()=>this.selectCharset("."+f)),this._parser.registerEscHandler({intermediates:"/",final:f},()=>this.selectCharset("/"+f));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(f=>(this._logService.error("Parsing error: ",f),f)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new am((f,x)=>this.requestStatusString(f,x)))}getAttrData(){return this._curAttrData}_preserveStack(e,i,n,l){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=i,this._parseStack.decodedLength=n,this._parseStack.position=l}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((i,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),um))]).catch(i=>{if(i!=="#SLOW_TIMEOUT")throw i;console.warn(`async parser handler taking longer than ${um} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,i){let n,l=this._activeBuffer.x,o=this._activeBuffer.y,c=0,d=this._parseStack.paused;if(d){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,i))return this._logSlowResolvingAsync(n),n;l=this._parseStack.cursorStartX,o=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Ms&&(c=this._parseStack.position+Ms)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,f=>String.fromCharCode(f)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(f=>f.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Ms&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Ms))),d||this._dirtyRowTracker.clearRange(),e.length>Ms)for(let f=c;f<e.length;f+=Ms){let x=f+Ms<e.length?f+Ms:e.length,v=typeof e=="string"?this._stringDecoder.decode(e.substring(f,x),this._parseBuffer):this._utf8Decoder.decode(e.subarray(f,x),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,v))return this._preserveStack(l,o,v,f),this._logSlowResolvingAsync(n),n}else if(!d){let f=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,f))return this._preserveStack(l,o,f,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==l||this._activeBuffer.y!==o)&&this._onCursorMove.fire();let _=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),g=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);g<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(g,this._bufferService.rows-1),end:Math.min(_,this._bufferService.rows-1)})}print(e,i,n){let l,o,c=this._charsetService.charset,d=this._optionsService.rawOptions.screenReaderMode,_=this._bufferService.cols,g=this._coreService.decPrivateModes.wraparound,f=this._coreService.modes.insertMode,x=this._curAttrData,v=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-i>0&&v.getWidth(this._activeBuffer.x-1)===2&&v.setCellFromCodepoint(this._activeBuffer.x-1,0,1,x);let b=this._parser.precedingJoinState;for(let w=i;w<n;++w){if(l=e[w],l<127&&c){let A=c[String.fromCharCode(l)];A&&(l=A.charCodeAt(0))}let S=this._unicodeService.charProperties(l,b);o=nr.extractWidth(S);let R=nr.extractShouldJoin(S),z=R?nr.extractWidth(b):0;if(b=S,d&&this._onA11yChar.fire(Os(l)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+o-z>_){if(g){let A=v,W=this._activeBuffer.x-z;for(this._activeBuffer.x=z,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),z>0&&v instanceof cl&&v.copyCellsFrom(A,W,0,z,!1);W<_;)A.setCellFromCodepoint(W++,0,1,x)}else if(this._activeBuffer.x=_-1,o===2)continue}if(R&&this._activeBuffer.x){let A=v.getWidth(this._activeBuffer.x-1)?1:2;v.addCodepointToCell(this._activeBuffer.x-A,l,o);for(let W=o-z;--W>=0;)v.setCellFromCodepoint(this._activeBuffer.x++,0,0,x);continue}if(f&&(v.insertCells(this._activeBuffer.x,o-z,this._activeBuffer.getNullCell(x)),v.getWidth(_-1)===2&&v.setCellFromCodepoint(_-1,0,1,x)),v.setCellFromCodepoint(this._activeBuffer.x++,l,o,x),o>0)for(;--o;)v.setCellFromCodepoint(this._activeBuffer.x++,0,0,x)}this._parser.precedingJoinState=b,this._activeBuffer.x<_&&n-i>0&&v.getWidth(this._activeBuffer.x)===0&&!v.hasContent(this._activeBuffer.x)&&v.setCellFromCodepoint(this._activeBuffer.x,0,1,x),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,i){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>hm(n.params[0],this._optionsService.rawOptions.windowOptions)?i(n):!0):this._parser.registerCsiHandler(e,i)}registerDcsHandler(e,i){return this._parser.registerDcsHandler(e,new am(i))}registerEscHandler(e,i){return this._parser.registerEscHandler(e,i)}registerOscHandler(e,i){return this._parser.registerOscHandler(e,new Jt(i))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,i){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+i):(this._activeBuffer.x=e,this._activeBuffer.y=i),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,i){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+i)}cursorUp(e){let i=this._activeBuffer.y-this._activeBuffer.scrollTop;return i>=0?this._moveCursor(0,-Math.min(i,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let i=this._activeBuffer.scrollBottom-this._activeBuffer.y;return i>=0?this._moveCursor(0,Math.min(i,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 i=e.params[0];return i===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:i===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let i=e.params[0]||1;for(;i--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let i=e.params[0]||1;for(;i--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let i=e.params[0];return i===1&&(this._curAttrData.bg|=536870912),(i===2||i===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,i,n,l=!1,o=!1){let c=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);c.replaceCells(i,n,this._activeBuffer.getNullCell(this._eraseAttrData()),o),l&&(c.isWrapped=!1)}_resetBufferLine(e,i=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),i),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,i=!1){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,i);n<this._bufferService.rows;n++)this._resetBufferLine(n,i);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,i),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,i);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.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,i);this._dirtyRowTracker.markDirty(0)}break;case 3:let l=this._activeBuffer.lines.length-this._bufferService.rows;l>0&&(this._activeBuffer.lines.trimStart(l),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-l,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-l,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,i=!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,i);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,i);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,i);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let i=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,l=this._bufferService.rows-1-this._activeBuffer.scrollBottom,o=this._bufferService.rows-1+this._activeBuffer.ybase-l+1;for(;i--;)this._activeBuffer.lines.splice(o-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 i=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,l;for(l=this._bufferService.rows-1-this._activeBuffer.scrollBottom,l=this._bufferService.rows-1+this._activeBuffer.ybase-l;i--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(l,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 i=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return i&&(i.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 i=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return i&&(i.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let i=e.params[0]||1;for(;i--;)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 i=e.params[0]||1;for(;i--;)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(lt));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 i=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let l=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);l.deleteCells(0,i,this._activeBuffer.getNullCell(this._eraseAttrData())),l.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 i=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let l=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);l.insertCells(0,i,this._activeBuffer.getNullCell(this._eraseAttrData())),l.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 i=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let l=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);l.insertCells(this._activeBuffer.x,i,this._activeBuffer.getNullCell(this._eraseAttrData())),l.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 i=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let l=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);l.deleteCells(this._activeBuffer.x,i,this._activeBuffer.getNullCell(this._eraseAttrData())),l.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return i&&(i.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 i=this._parser.precedingJoinState;if(!i)return!0;let n=e.params[0]||1,l=nr.extractWidth(i),o=this._activeBuffer.x-l,c=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(o),d=new Uint32Array(c.length*n),_=0;for(let f=0;f<c.length;){let x=c.codePointAt(f)||0;d[_++]=x,f+=x>65535?2:1}let g=_;for(let f=1;f<n;++f)d.copyWithin(g,0,_),g+=_;return this.print(d,0,g),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(F.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(F.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(F.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(F.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(F.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let i=0;i<e.length;i++)switch(e.params[i]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let i=0;i<e.length;i++)switch(e.params[i]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,sr),this._charsetService.setgCharset(1,sr),this._charsetService.setgCharset(2,sr),this._charsetService.setgCharset(3,sr);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 i=0;i<e.length;i++)switch(e.params[i]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let i=0;i<e.length;i++)switch(e.params[i]){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[i]===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,i){let n;(R=>(R[R.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",R[R.SET=1]="SET",R[R.RESET=2]="RESET",R[R.PERMANENTLY_SET=3]="PERMANENTLY_SET",R[R.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(n||={});let l=this._coreService.decPrivateModes,{activeProtocol:o,activeEncoding:c}=this._coreMouseService,d=this._coreService,{buffers:_,cols:g}=this._bufferService,{active:f,alt:x}=_,v=this._optionsService.rawOptions,b=(R,z)=>(d.triggerDataEvent(`${F.ESC}[${i?"":"?"}${R};${z}$y`),!0),w=R=>R?1:2,S=e.params[0];return i?S===2?b(S,4):S===4?b(S,w(d.modes.insertMode)):S===12?b(S,3):S===20?b(S,w(v.convertEol)):b(S,0):S===1?b(S,w(l.applicationCursorKeys)):S===3?b(S,v.windowOptions.setWinLines?g===80?2:g===132?1:0:0):S===6?b(S,w(l.origin)):S===7?b(S,w(l.wraparound)):S===8?b(S,3):S===9?b(S,w(o==="X10")):S===12?b(S,w(v.cursorBlink)):S===25?b(S,w(!d.isCursorHidden)):S===45?b(S,w(l.reverseWraparound)):S===66?b(S,w(l.applicationKeypad)):S===67?b(S,4):S===1e3?b(S,w(o==="VT200")):S===1002?b(S,w(o==="DRAG")):S===1003?b(S,w(o==="ANY")):S===1004?b(S,w(l.sendFocus)):S===1005?b(S,4):S===1006?b(S,w(c==="SGR")):S===1015?b(S,4):S===1016?b(S,w(c==="SGR_PIXELS")):S===1048?b(S,1):S===47||S===1047||S===1049?b(S,w(f===x)):S===2004?b(S,w(l.bracketedPasteMode)):S===2026?b(S,w(l.synchronizedOutput)):b(S,0)}_updateAttrColor(e,i,n,l,o){return i===2?(e|=50331648,e&=-16777216,e|=ml.fromColorRGB([n,l,o])):i===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,i,n){let l=[0,0,-1,0,0,0],o=0,c=0;do{if(l[c+o]=e.params[i+c],e.hasSubParams(i+c)){let d=e.getSubParams(i+c),_=0;do l[1]===5&&(o=1),l[c+_+1+o]=d[_];while(++_<d.length&&_+c+1+o<l.length);break}if(l[1]===5&&c+o>=2||l[1]===2&&c+o>=5)break;l[1]&&(o=1)}while(++c+i<e.length&&c+o<l.length);for(let d=2;d<l.length;++d)l[d]===-1&&(l[d]=0);switch(l[0]){case 38:n.fg=this._updateAttrColor(n.fg,l[1],l[3],l[4],l[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,l[1],l[3],l[4],l[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,l[1],l[3],l[4],l[5])}return c}_processUnderline(e,i){i.extended=i.extended.clone(),(!~e||e>5)&&(e=1),i.extended.underlineStyle=e,i.fg|=268435456,e===0&&(i.fg&=-268435457),i.updateExtended()}_processSGR0(e){e.fg=lt.fg,e.bg=lt.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 i=e.length,n,l=this._curAttrData;for(let o=0;o<i;o++)n=e.params[o],n>=30&&n<=37?(l.fg&=-50331904,l.fg|=16777216|n-30):n>=40&&n<=47?(l.bg&=-50331904,l.bg|=16777216|n-40):n>=90&&n<=97?(l.fg&=-50331904,l.fg|=16777216|n-90|8):n>=100&&n<=107?(l.bg&=-50331904,l.bg|=16777216|n-100|8):n===0?this._processSGR0(l):n===1?l.fg|=134217728:n===3?l.bg|=67108864:n===4?(l.fg|=268435456,this._processUnderline(e.hasSubParams(o)?e.getSubParams(o)[0]:1,l)):n===5?l.fg|=536870912:n===7?l.fg|=67108864:n===8?l.fg|=1073741824:n===9?l.fg|=2147483648:n===2?l.bg|=134217728:n===21?this._processUnderline(2,l):n===22?(l.fg&=-134217729,l.bg&=-134217729):n===23?l.bg&=-67108865:n===24?(l.fg&=-268435457,this._processUnderline(0,l)):n===25?l.fg&=-536870913:n===27?l.fg&=-67108865:n===28?l.fg&=-1073741825:n===29?l.fg&=2147483647:n===39?(l.fg&=-67108864,l.fg|=lt.fg&16777215):n===49?(l.bg&=-67108864,l.bg|=lt.bg&16777215):n===38||n===48||n===58?o+=this._extractColor(e,o,l):n===53?l.bg|=1073741824:n===55?l.bg&=-1073741825:n===59?(l.extended=l.extended.clone(),l.extended.underlineColor=-1,l.updateExtended()):n===100?(l.fg&=-67108864,l.fg|=lt.fg&16777215,l.bg&=-67108864,l.bg|=lt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${F.ESC}[0n`);break;case 6:let i=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${F.ESC}[${i};${n}R`);break}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let i=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${F.ESC}[?${i};${n}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=lt.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 i=e.length===0?1:e.params[0];if(i===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(i){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=i%2===1;this._coreService.decPrivateModes.cursorBlink=n}return!0}setScrollRegion(e){let i=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>i&&(this._activeBuffer.scrollTop=i-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!hm(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let i=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:i!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${F.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(i===0||i===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>cm&&this._windowTitleStack.shift()),(i===0||i===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>cm&&this._iconNameStack.shift());break;case 23:(i===0||i===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(i===0||i===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 i=[],n=e.split(";");for(;n.length>1;){let l=n.shift(),o=n.shift();if(/^\d+$/.exec(l)){let c=parseInt(l);if(fm(c))if(o==="?")i.push({type:0,index:c});else{let d=om(o);d&&i.push({type:1,index:c,color:d})}}}return i.length&&this._onColor.fire(i),!0}setHyperlink(e){let i=e.indexOf(";");if(i===-1)return!0;let n=e.slice(0,i).trim(),l=e.slice(i+1);return l?this._createHyperlink(n,l):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,i){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),l,o=n.findIndex(c=>c.startsWith("id="));return o!==-1&&(l=n[o].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:l,uri:i}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,i){let n=e.split(";");for(let l=0;l<n.length&&!(i>=this._specialColors.length);++l,++i)if(n[l]==="?")this._onColor.fire([{type:0,index:this._specialColors[i]}]);else{let o=om(n[l]);o&&this._onColor.fire([{type:1,index:this._specialColors[i],color:o}])}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 i=[],n=e.split(";");for(let l=0;l<n.length;++l)if(/^\d+$/.exec(n[l])){let o=parseInt(n[l]);fm(o)&&i.push({type:2,index:o})}return i.length&&this._onColor.fire(i),!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,sr),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(gw[e[0]],dt[e[1]]||sr),!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=lt.clone(),this._eraseAttrDataInternal=lt.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 _i;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let i=0;i<this._bufferService.rows;++i){let n=this._activeBuffer.ybase+this._activeBuffer.y+i,l=this._activeBuffer.lines.get(n);l&&(l.fill(e),l.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,i){let n=d=>(this._coreService.triggerDataEvent(`${F.ESC}${d}${F.ESC}\\`),!0),l=this._bufferService.buffer,o=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${l.scrollTop+1};${l.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[o.cursorStyle]-(o.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,i){this._dirtyRowTracker.markRangeDirty(e,i)}},Lu=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,i){e>i&&(dm=e,e=i,i=dm),e<this.start&&(this.start=e),i>this.end&&(this.end=i)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Lu=Qe([se(0,At)],Lu);function fm(e){return 0<=e&&e<256}var mw=5e7,pm=12,vw=50,yw=class extends xe{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 J),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,i){if(i!==void 0&&this._syncCalls>i){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 l=this._callbacks.shift();l&&l()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,i){if(this._pendingData>mw)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(i),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(i)}_innerWrite(e=0,i=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let l=this._writeBuffer[this._bufferOffset],o=this._action(l,i);if(o){let d=_=>performance.now()-n>=pm?setTimeout(()=>this._innerWrite(0,_)):this._innerWrite(n,_);o.catch(_=>(queueMicrotask(()=>{throw _}),Promise.resolve(!1))).then(d);return}let c=this._callbacks[this._bufferOffset];if(c&&c(),this._bufferOffset++,this._pendingData-=l.length,performance.now()-n>=pm)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>vw&&(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()}},Nu=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let i=this._bufferService.buffer;if(e.id===void 0){let _=i.addMarker(i.ybase+i.y),g={data:e,id:this._nextId++,lines:[_]};return _.onDispose(()=>this._removeMarkerFromLink(g,_)),this._dataByLinkId.set(g.id,g),g.id}let n=e,l=this._getEntryIdKey(n),o=this._entriesWithId.get(l);if(o)return this.addLineToLink(o.id,i.ybase+i.y),o.id;let c=i.addMarker(i.ybase+i.y),d={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[c]};return c.onDispose(()=>this._removeMarkerFromLink(d,c)),this._entriesWithId.set(d.key,d),this._dataByLinkId.set(d.id,d),d.id}addLineToLink(e,i){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(l=>l.line!==i)){let l=this._bufferService.buffer.addMarker(i);n.lines.push(l),l.onDispose(()=>this._removeMarkerFromLink(n,l))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,i){let n=e.lines.indexOf(i);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)))}};Nu=Qe([se(0,At)],Nu);var gm=!1,xw=class extends xe{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Jr),this._onBinary=this._register(new J),this.onBinary=this._onBinary.event,this._onData=this._register(new J),this.onData=this._onData.event,this._onLineFeed=this._register(new J),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new J),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new J),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new J),this._instantiationService=new K1,this.optionsService=this._register(new ew(e)),this._instantiationService.setService(Mt,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Au)),this._instantiationService.setService(At,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(zu)),this._instantiationService.setService(Xm,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Mu)),this._instantiationService.setService(hr,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Ou)),this._instantiationService.setService(Gm,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(nr)),this._instantiationService.setService(WS,this.unicodeService),this._charsetService=this._instantiationService.createInstance(nw),this._instantiationService.setService(US,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Nu),this._instantiationService.setService(Vm,this._oscLinkService),this._inputHandler=this._register(new _w(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(kt.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(kt.forward(this._bufferService.onResize,this._onResize)),this._register(kt.forward(this.coreService.onData,this._onData)),this._register(kt.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 yw((i,n)=>this._inputHandler.parse(i,n))),this._register(kt.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new J),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let i in e)this.optionsService.options[i]=e[i]}write(e,i){this._writeBuffer.write(e,i)}writeSync(e,i){this._logService.logLevel<=3&&!gm&&(this._logService.warn("writeSync is unreliable and will be removed soon."),gm=!0),this._writeBuffer.writeSync(e,i)}input(e,i=!0){this.coreService.triggerDataEvent(e,i)}resize(e,i){isNaN(e)||isNaN(i)||(e=Math.max(e,Rv),i=Math.max(i,Dv),this._bufferService.resize(e,i))}scroll(e,i=!1){this._bufferService.scroll(e,i)}scrollLines(e,i){this._bufferService.scrollLines(e,i)}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 i=e-this._bufferService.buffer.ydisp;i!==0&&this.scrollLines(i)}registerEscHandler(e,i){return this._inputHandler.registerEscHandler(e,i)}registerDcsHandler(e,i){return this._inputHandler.registerDcsHandler(e,i)}registerCsiHandler(e,i){return this._inputHandler.registerCsiHandler(e,i)}registerOscHandler(e,i){return this._inputHandler.registerOscHandler(e,i)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,i=this.optionsService.rawOptions.windowsPty;i&&i.buildNumber!==void 0&&i.buildNumber!==void 0?e=i.backend==="conpty"&&i.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(lm.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(lm(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Ye(()=>{for(let i of e)i.dispose()})}}},Sw={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 bw(e,i,n,l){let o={type:0,cancel:!1,key:void 0},c=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?i?o.key=F.ESC+"OA":o.key=F.ESC+"[A":e.key==="UIKeyInputLeftArrow"?i?o.key=F.ESC+"OD":o.key=F.ESC+"[D":e.key==="UIKeyInputRightArrow"?i?o.key=F.ESC+"OC":o.key=F.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(i?o.key=F.ESC+"OB":o.key=F.ESC+"[B");break;case 8:o.key=e.ctrlKey?"\b":F.DEL,e.altKey&&(o.key=F.ESC+o.key);break;case 9:if(e.shiftKey){o.key=F.ESC+"[Z";break}o.key=F.HT,o.cancel=!0;break;case 13:o.key=e.altKey?F.ESC+F.CR:F.CR,o.cancel=!0;break;case 27:o.key=F.ESC,e.altKey&&(o.key=F.ESC+F.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;c?o.key=F.ESC+"[1;"+(c+1)+"D":i?o.key=F.ESC+"OD":o.key=F.ESC+"[D";break;case 39:if(e.metaKey)break;c?o.key=F.ESC+"[1;"+(c+1)+"C":i?o.key=F.ESC+"OC":o.key=F.ESC+"[C";break;case 38:if(e.metaKey)break;c?o.key=F.ESC+"[1;"+(c+1)+"A":i?o.key=F.ESC+"OA":o.key=F.ESC+"[A";break;case 40:if(e.metaKey)break;c?o.key=F.ESC+"[1;"+(c+1)+"B":i?o.key=F.ESC+"OB":o.key=F.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(o.key=F.ESC+"[2~");break;case 46:c?o.key=F.ESC+"[3;"+(c+1)+"~":o.key=F.ESC+"[3~";break;case 36:c?o.key=F.ESC+"[1;"+(c+1)+"H":i?o.key=F.ESC+"OH":o.key=F.ESC+"[H";break;case 35:c?o.key=F.ESC+"[1;"+(c+1)+"F":i?o.key=F.ESC+"OF":o.key=F.ESC+"[F";break;case 33:e.shiftKey?o.type=2:e.ctrlKey?o.key=F.ESC+"[5;"+(c+1)+"~":o.key=F.ESC+"[5~";break;case 34:e.shiftKey?o.type=3:e.ctrlKey?o.key=F.ESC+"[6;"+(c+1)+"~":o.key=F.ESC+"[6~";break;case 112:c?o.key=F.ESC+"[1;"+(c+1)+"P":o.key=F.ESC+"OP";break;case 113:c?o.key=F.ESC+"[1;"+(c+1)+"Q":o.key=F.ESC+"OQ";break;case 114:c?o.key=F.ESC+"[1;"+(c+1)+"R":o.key=F.ESC+"OR";break;case 115:c?o.key=F.ESC+"[1;"+(c+1)+"S":o.key=F.ESC+"OS";break;case 116:c?o.key=F.ESC+"[15;"+(c+1)+"~":o.key=F.ESC+"[15~";break;case 117:c?o.key=F.ESC+"[17;"+(c+1)+"~":o.key=F.ESC+"[17~";break;case 118:c?o.key=F.ESC+"[18;"+(c+1)+"~":o.key=F.ESC+"[18~";break;case 119:c?o.key=F.ESC+"[19;"+(c+1)+"~":o.key=F.ESC+"[19~";break;case 120:c?o.key=F.ESC+"[20;"+(c+1)+"~":o.key=F.ESC+"[20~";break;case 121:c?o.key=F.ESC+"[21;"+(c+1)+"~":o.key=F.ESC+"[21~";break;case 122:c?o.key=F.ESC+"[23;"+(c+1)+"~":o.key=F.ESC+"[23~";break;case 123:c?o.key=F.ESC+"[24;"+(c+1)+"~":o.key=F.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?o.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?o.key=F.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?o.key=F.DEL:e.keyCode===219?o.key=F.ESC:e.keyCode===220?o.key=F.FS:e.keyCode===221&&(o.key=F.GS);else if((!n||l)&&e.altKey&&!e.metaKey){let d=Sw[e.keyCode]?.[e.shiftKey?1:0];if(d)o.key=F.ESC+d;else if(e.keyCode>=65&&e.keyCode<=90){let _=e.ctrlKey?e.keyCode-64:e.keyCode+32,g=String.fromCharCode(_);e.shiftKey&&(g=g.toUpperCase()),o.key=F.ESC+g}else if(e.keyCode===32)o.key=F.ESC+(e.ctrlKey?F.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let _=e.code.slice(3,4);e.shiftKey||(_=_.toLowerCase()),o.key=F.ESC+_,o.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(o.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?o.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(o.key=F.US),e.key==="@"&&(o.key=F.NUL));break}return o}var tt=0,ww=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new so,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new so,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((o,c)=>this._getKey(o)-this._getKey(c)),i=0,n=0,l=new Array(this._array.length+this._insertedValues.length);for(let o=0;o<l.length;o++)n>=this._array.length||this._getKey(e[i])<=this._getKey(this._array[n])?(l[o]=e[i],i++):l[o]=this._array[n++];this._array=l,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 i=this._getKey(e);if(i===void 0||(tt=this._search(i),tt===-1)||this._getKey(this._array[tt])!==i)return!1;do if(this._array[tt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(tt),!0;while(++tt<this._array.length&&this._getKey(this._array[tt])===i);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((o,c)=>o-c),i=0,n=new Array(this._array.length-e.length),l=0;for(let o=0;o<this._array.length;o++)e[i]===o?i++:n[l++]=this._array[o];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&&(tt=this._search(e),!(tt<0||tt>=this._array.length)&&this._getKey(this._array[tt])===e))do yield this._array[tt];while(++tt<this._array.length&&this._getKey(this._array[tt])===e)}forEachByKey(e,i){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(tt=this._search(e),!(tt<0||tt>=this._array.length)&&this._getKey(this._array[tt])===e))do i(this._array[tt]);while(++tt<this._array.length&&this._getKey(this._array[tt])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let i=0,n=this._array.length-1;for(;n>=i;){let l=i+n>>1,o=this._getKey(this._array[l]);if(o>e)n=l-1;else if(o<e)i=l+1;else{for(;l>0&&this._getKey(this._array[l-1])===e;)l--;return l}}return i}},eu=0,_m=0,Cw=class extends xe{constructor(){super(),this._decorations=new ww(e=>e?.marker.line),this._onDecorationRegistered=this._register(new J),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new J),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Ye(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let i=new kw(e);if(i){let n=i.marker.onDispose(()=>i.dispose()),l=i.onDispose(()=>{l.dispose(),i&&(this._decorations.delete(i)&&this._onDecorationRemoved.fire(i),n.dispose())});this._decorations.insert(i),this._onDecorationRegistered.fire(i)}return i}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,i,n){let l=0,o=0;for(let c of this._decorations.getKeyIterator(i))l=c.options.x??0,o=l+(c.options.width??1),e>=l&&e<o&&(!n||(c.options.layer??"bottom")===n)&&(yield c)}forEachDecorationAtCell(e,i,n,l){this._decorations.forEachByKey(i,o=>{eu=o.options.x??0,_m=eu+(o.options.width??1),e>=eu&&e<_m&&(!n||(o.options.layer??"bottom")===n)&&l(o)})}},kw=class extends Ls{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new J),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new J),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=Ge.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Ge.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},Ew=1e3,Tw=class{constructor(e,i=Ew){this._renderCallback=e,this._debounceThresholdMS=i,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,i,n){this._rowCount=n,e=e!==void 0?e:0,i=i!==void 0?i: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,i):i;let l=performance.now();if(l-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=l,this._innerRefresh();else if(!this._additionalRefreshRequested){let o=l-this._lastRefreshMs,c=this._debounceThresholdMS-o;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},c)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),i=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,i)}},mm=20,ro=class extends xe{constructor(e,i,n,l){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=l,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let o=this._coreBrowserService.mainDocument;this._accessibilityContainer=o.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=o.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let c=0;c<this._terminal.rows;c++)this._rowElements[c]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[c]);if(this._topBoundaryFocusListener=c=>this._handleBoundaryFocus(c,0),this._bottomBoundaryFocusListener=c=>this._handleBoundaryFocus(c,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=o.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new Tw(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(c=>this._handleResize(c.rows))),this._register(this._terminal.onRender(c=>this._refreshRows(c.start,c.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(c=>this._handleChar(c))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
97
|
+
`))),this._register(this._terminal.onA11yTab(c=>this._handleTab(c))),this._register(this._terminal.onKey(c=>this._handleKey(c.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(fe(o,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Ye(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let i=0;i<e;i++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<mm+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
98
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===mm+1&&(this._liveRegion.textContent+=su.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,i){this._liveRegionDebouncer.refresh(e,i,this._terminal.rows)}_renderRows(e,i){let n=this._terminal.buffer,l=n.lines.length.toString();for(let o=e;o<=i;o++){let c=n.lines.get(n.ydisp+o),d=[],_=c?.translateToString(!0,void 0,void 0,d)||"",g=(n.ydisp+o+1).toString(),f=this._rowElements[o];f&&(_.length===0?(f.textContent=" ",this._rowColumns.set(f,[0,1])):(f.textContent=_,this._rowColumns.set(f,d)),f.setAttribute("aria-posinset",g),f.setAttribute("aria-setsize",l),this._alignRowWidth(f))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,i){let n=e.target,l=this._rowElements[i===0?1:this._rowElements.length-2],o=n.getAttribute("aria-posinset"),c=i===0?"1":`${this._terminal.buffer.lines.length}`;if(o===c||e.relatedTarget!==l)return;let d,_;if(i===0?(d=n,_=this._rowElements.pop(),this._rowContainer.removeChild(_)):(d=this._rowElements.shift(),_=n,this._rowContainer.removeChild(d)),d.removeEventListener("focus",this._topBoundaryFocusListener),_.removeEventListener("focus",this._bottomBoundaryFocusListener),i===0){let g=this._createAccessibilityTreeNode();this._rowElements.unshift(g),this._rowContainer.insertAdjacentElement("afterbegin",g)}else{let g=this._createAccessibilityTreeNode();this._rowElements.push(g),this._rowContainer.appendChild(g)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(i===0?-1:1),this._rowElements[i===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let i={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((i.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||i.node===n.node&&i.offset>n.offset)&&([i,n]=[n,i]),i.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(i={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(i.node))return;let l=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(l)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:l,offset:l.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let o=({node:_,offset:g})=>{let f=_ instanceof Text?_.parentNode:_,x=parseInt(f?.getAttribute("aria-posinset"),10)-1;if(isNaN(x))return console.warn("row is invalid. Race condition?"),null;let v=this._rowColumns.get(f);if(!v)return console.warn("columns is null. Race condition?"),null;let b=g<v.length?v[g]:v.slice(-1)[0]+1;return b>=this._terminal.cols&&(++x,b=0),{row:x,column:b}},c=o(i),d=o(n);if(!(!c||!d)){if(c.row>d.row||c.row===d.row&&c.column>=d.column)throw new Error("invalid range");this._terminal.select(c.column,c.row,(d.row-c.row)*this._terminal.cols-c.column+d.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let i=this._rowContainer.children.length;i<this._terminal.rows;i++)this._rowElements[i]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[i]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform="";let i=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let l=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${l/i})`}};ro=Qe([se(1,Ku),se(2,rs),se(3,ns)],ro);var Hu=class extends xe{constructor(e,i,n,l,o){super(),this._element=e,this._mouseService=i,this._renderService=n,this._bufferService=l,this._linkProviderService=o,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new J),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new J),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Ye(()=>{ar(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(fe(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(fe(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(fe(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(fe(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let i=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!i)return;this._isMouseOut=!1;let n=e.composedPath();for(let l=0;l<n.length;l++){let o=n[l];if(o.classList.contains("xterm"))break;if(o.classList.contains("xterm-hover"))return}(!this._lastBufferCell||i.x!==this._lastBufferCell.x||i.y!==this._lastBufferCell.y)&&(this._handleHover(i),this._lastBufferCell=i)}_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,i){(!this._activeProviderReplies||!i)&&(this._activeProviderReplies?.forEach(l=>{l?.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[l,o]of this._linkProviderService.linkProviders.entries())i?this._activeProviderReplies?.get(l)&&(n=this._checkLinkProviderResult(l,e,n)):o.provideLinks(e.y,c=>{if(this._isMouseOut)return;let d=c?.map(_=>({link:_}));this._activeProviderReplies?.set(l,d),n=this._checkLinkProviderResult(l,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,i){let n=new Set;for(let l=0;l<i.size;l++){let o=i.get(l);if(o)for(let c=0;c<o.length;c++){let d=o[c],_=d.link.range.start.y<e?0:d.link.range.start.x,g=d.link.range.end.y>e?this._bufferService.cols:d.link.range.end.x;for(let f=_;f<=g;f++){if(n.has(f)){o.splice(c--,1);break}n.add(f)}}}}_checkLinkProviderResult(e,i,n){if(!this._activeProviderReplies)return n;let l=this._activeProviderReplies.get(e),o=!1;for(let c=0;c<e;c++)(!this._activeProviderReplies.has(c)||this._activeProviderReplies.get(c))&&(o=!0);if(!o&&l){let c=l.find(d=>this._linkAtPosition(d.link,i));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 d=this._activeProviderReplies.get(c)?.find(_=>this._linkAtPosition(_.link,i));if(d){n=!0,this._handleNewLink(d);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let i=this._positionFromMouseEvent(e,this._element,this._mouseService);i&&this._mouseDownLink&&Rw(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,i)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,i){!this._currentLink||!this._lastMouseEvent||(!e||!i||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=i)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,ar(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let i=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);i&&this._linkAtPosition(e.link,i)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:n=>{this._currentLink?.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:()=>this._currentLink?.state?.decorations.underline,set:n=>{this._currentLink?.state&&this._currentLink?.state?.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 l=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,o=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=l&&this._currentLink.link.range.end.y<=o&&(this._clearCurrentLink(l,o),this._lastMouseEvent)){let c=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);c&&this._askForLink(c,!1)}})))}_linkHover(e,i,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),i.hover&&i.hover(n,i.text)}_fireUnderlineEvent(e,i){let n=e.range,l=this._bufferService.buffer.ydisp,o=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-l-1,n.end.x,n.end.y-l-1,void 0);(i?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(o)}_linkLeave(e,i,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),i.leave&&i.leave(n,i.text)}_linkAtPosition(e,i){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,l=e.range.end.y*this._bufferService.cols+e.range.end.x,o=i.y*this._bufferService.cols+i.x;return n<=o&&o<=l}_positionFromMouseEvent(e,i,n){let l=n.getCoords(e,i,this._bufferService.cols,this._bufferService.rows);if(l)return{x:l[0],y:l[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,i,n,l,o){return{x1:e,y1:i,x2:n,y2:l,cols:this._bufferService.cols,fg:o}}};Hu=Qe([se(1,$u),se(2,ns),se(3,At),se(4,Qm)],Hu);function Rw(e,i){return e.text===i.text&&e.range.start.x===i.range.start.x&&e.range.start.y===i.range.start.y&&e.range.end.x===i.range.end.x&&e.range.end.y===i.range.end.y}var Dw=class extends xw{constructor(e={}){super(e),this._linkifier=this._register(new Jr),this.browser=mv,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Jr),this._onCursorMove=this._register(new J),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new J),this.onKey=this._onKey.event,this._onRender=this._register(new J),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new J),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new J),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new J),this.onBell=this._onBell.event,this._onFocus=this._register(new J),this._onBlur=this._register(new J),this._onA11yCharEmitter=this._register(new J),this._onA11yTabEmitter=this._register(new J),this._onWillOpen=this._register(new J),this._setup(),this._decorationService=this._instantiationService.createInstance(Cw),this._instantiationService.setService(vl,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(v1),this._instantiationService.setService(Qm,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(nu)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(i=>this.refresh(i?.start??0,i?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(i=>this._reportWindowsOptions(i))),this._register(this._inputHandler.onColor(i=>this._handleColorEvent(i))),this._register(kt.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(kt.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(kt.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(kt.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(i=>this._afterResize(i.cols,i.rows))),this._register(Ye(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let i of e){let n,l="";switch(i.index){case 256:n="foreground",l="10";break;case 257:n="background",l="11";break;case 258:n="cursor",l="12";break;default:n="ansi",l="4;"+i.index}switch(i.type){case 0:let o=Ke.toColorRGB(n==="ansi"?this._themeService.colors.ansi[i.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${F.ESC}]${l};${pw(o)}${gv.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(c=>c.ansi[i.index]=at.toColor(...i.color));else{let c=n;this._themeService.modifyColors(d=>d[c]=at.toColor(...i.color))}break;case 2:this._themeService.restoreColor(i.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(ro,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(F.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(F.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,i=this.buffer.lines.get(e);if(!i)return;let n=Math.min(this.buffer.x,this.cols-1),l=this._renderService.dimensions.css.cell.height,o=i.getWidth(n),c=this._renderService.dimensions.css.cell.width*o,d=this.buffer.y*this._renderService.dimensions.css.cell.height,_=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=_+"px",this.textarea.style.top=d+"px",this.textarea.style.width=c+"px",this.textarea.style.height=l+"px",this.textarea.style.lineHeight=l+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(fe(this.element,"copy",i=>{this.hasSelection()&&MS(i,this._selectionService)}));let e=i=>OS(i,this.textarea,this.coreService,this.optionsService);this._register(fe(this.textarea,"paste",e)),this._register(fe(this.element,"paste",e)),vv?this._register(fe(this.element,"mousedown",i=>{i.button===2&&T_(i,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(fe(this.element,"contextmenu",i=>{T_(i,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Ju&&this._register(fe(this.element,"auxclick",i=>{i.button===1&&Im(i,this.textarea,this.screenElement)}))}_bindKeys(){this._register(fe(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(fe(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(fe(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(fe(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(fe(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(fe(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(fe(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let i=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),i.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(fe(this.screenElement,"mousemove",o=>this.updateCursorStyle(o))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),i.appendChild(this.screenElement);let n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",iu.get()),Sv||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(_1,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(rs,this._coreBrowserService),this._register(fe(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(fe(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Eu,this._document,this._helperContainer),this._instantiationService.setService(ho,this._charSizeService),this._themeService=this._instantiationService.createInstance(Bu),this._instantiationService.setService(tn,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(to),this._instantiationService.setService(Zm,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Ru,this.rows,this.screenElement)),this._instantiationService.setService(ns,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(wu,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Tu),this._instantiationService.setService($u,this._mouseService);let l=this._linkifier.value=this._register(this._instantiationService.createInstance(Hu,this.screenElement));this.element.appendChild(i);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(Su,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(Du,this.element,this.screenElement,l)),this._instantiationService.setService(qS,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(kt.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(bu,this.screenElement)),this._register(fe(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(ro,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(eo,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(eo,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(ku,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,i=this.element;function n(c){let d=e._mouseService.getMouseReportCoords(c,e.screenElement);if(!d)return!1;let _,g;switch(c.overrideType||c.type){case"mousemove":g=32,c.buttons===void 0?(_=3,c.button!==void 0&&(_=c.button<3?c.button:3)):_=c.buttons&1?0:c.buttons&4?1:c.buttons&2?2:3;break;case"mouseup":g=0,_=c.button<3?c.button:3;break;case"mousedown":g=1,_=c.button<3?c.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(c)===!1)return!1;let f=c.deltaY;if(f===0||e.coreMouseService.consumeWheelEvent(c,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;g=f<0?0:1,_=4;break;default:return!1}return g===void 0||_===void 0||_>4?!1:e.coreMouseService.triggerMouseEvent({col:d.col,row:d.row,x:d.x,y:d.y,button:_,action:g,ctrl:c.ctrlKey,alt:c.altKey,shift:c.shiftKey})}let l={mouseup:null,wheel:null,mousedrag:null,mousemove:null},o={mouseup:c=>(n(c),c.buttons||(this._document.removeEventListener("mouseup",l.mouseup),l.mousedrag&&this._document.removeEventListener("mousemove",l.mousedrag)),this.cancel(c)),wheel:c=>(n(c),this.cancel(c,!0)),mousedrag:c=>{c.buttons&&n(c)},mousemove:c=>{c.buttons||n(c)}};this._register(this.coreMouseService.onProtocolChange(c=>{c?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(c)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),c&8?l.mousemove||(i.addEventListener("mousemove",o.mousemove),l.mousemove=o.mousemove):(i.removeEventListener("mousemove",l.mousemove),l.mousemove=null),c&16?l.wheel||(i.addEventListener("wheel",o.wheel,{passive:!1}),l.wheel=o.wheel):(i.removeEventListener("wheel",l.wheel),l.wheel=null),c&2?l.mouseup||(l.mouseup=o.mouseup):(this._document.removeEventListener("mouseup",l.mouseup),l.mouseup=null),c&4?l.mousedrag||(l.mousedrag=o.mousedrag):(this._document.removeEventListener("mousemove",l.mousedrag),l.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(fe(i,"mousedown",c=>{if(c.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(c)))return n(c),l.mouseup&&this._document.addEventListener("mouseup",l.mouseup),l.mousedrag&&this._document.addEventListener("mousemove",l.mousedrag),this.cancel(c)})),this._register(fe(i,"wheel",c=>{if(!l.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(c)===!1)return!1;if(!this.buffer.hasScrollback){if(c.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(c,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(c,!0);let d=F.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(c.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(d,!0),this.cancel(c,!0)}}},{passive:!1}))}refresh(e,i){this._renderService?.refreshRows(e,i)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,i){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,i),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 i=e-this._bufferService.buffer.ydisp;i!==0&&this.scrollLines(i)}paste(e){qm(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 i=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),i}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,i,n){this._selectionService.setSelection(e,i,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(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,i){this._selectionService?.selectLines(e,i)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let i=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!i&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!i&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let n=bw(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let l=this.rows-1;return this.scrollLines(n.type===2?-l:l),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===F.ETX||n.key===F.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,i){let n=e.isMac&&!this.options.macOptionIsMeta&&i.altKey&&!i.ctrlKey&&!i.metaKey||e.isWindows&&i.altKey&&i.ctrlKey&&!i.metaKey||e.isWindows&&i.getModifierState("AltGraph");return i.type==="keypress"?n:n&&(!i.keyCode||i.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(Bw(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let i;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)i=e.charCode;else if(e.which===null||e.which===void 0)i=e.keyCode;else if(e.which!==0&&e.charCode!==0)i=e.which;else return!1;return!i||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(i=String.fromCharCode(i),this._onKey.fire({key:i,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i,!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 i=e.data;return this.coreService.triggerDataEvent(i,!0),this.cancel(e),!0}return!1}resize(e,i){if(e===this.cols&&i===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,i)}_afterResize(e,i){this._charSizeService?.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(lt));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(F.ESC+"[I"):this.coreService.triggerDataEvent(F.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let i=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${F.ESC}[4;${n};${i}t`);break;case 1:let l=this._renderService.dimensions.css.cell.width.toFixed(0),o=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${F.ESC}[6;${o};${l}t`);break}}cancel(e,i){if(!(!this.options.cancelEvents&&!i))return e.preventDefault(),e.stopPropagation(),!1}};function Bw(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var zw=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,i){let n={instance:i,dispose:i.dispose,isDisposed:!1};this._addons.push(n),i.dispose=()=>this._wrappedAddonDispose(n),i.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let i=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){i=n;break}if(i===-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(i,1)}},Aw=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,i){if(!(e<0||e>=this._line.length))return i?(this._line.loadCell(e,i),i):this._line.loadCell(e,new _i)}translateToString(e,i,n){return this._line.translateToString(e,i,n)}},vm=class{constructor(e,i){this._buffer=e,this.type=i}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 i=this._buffer.lines.get(e);if(i)return new Aw(i)}getNullCell(){return new _i}},Mw=class extends xe{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new J),this.onBufferChange=this._onBufferChange.event,this._normal=new vm(this._core.buffers.normal,"normal"),this._alternate=new vm(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)}},Ow=class{constructor(e){this._core=e}registerCsiHandler(e,i){return this._core.registerCsiHandler(e,n=>i(n.toArray()))}addCsiHandler(e,i){return this.registerCsiHandler(e,i)}registerDcsHandler(e,i){return this._core.registerDcsHandler(e,(n,l)=>i(n,l.toArray()))}addDcsHandler(e,i){return this.registerDcsHandler(e,i)}registerEscHandler(e,i){return this._core.registerEscHandler(e,i)}addEscHandler(e,i){return this.registerEscHandler(e,i)}registerOscHandler(e,i){return this._core.registerOscHandler(e,i)}addOscHandler(e,i){return this.registerOscHandler(e,i)}},jw=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}},Lw=["cols","rows"],Bi=0,Nw=class extends xe{constructor(e){super(),this._core=this._register(new Dw(e)),this._addonManager=this._register(new zw),this._publicOptions={...this._core.options};let i=l=>this._core.options[l],n=(l,o)=>{this._checkReadonlyOptions(l),this._core.options[l]=o};for(let l in this._core.options){let o={get:i.bind(this,l),set:n.bind(this,l)};Object.defineProperty(this._publicOptions,l,o)}}_checkReadonlyOptions(e){if(Lw.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 Ow(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new jw(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 Mw(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,i="none";switch(this._core.coreMouseService.activeProtocol){case"X10":i="x10";break;case"VT200":i="vt200";break;case"DRAG":i="drag";break;case"ANY":i="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:i,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 i in e)this._publicOptions[i]=e[i]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,i=!0){this._core.input(e,i)}resize(e,i){this._verifyIntegers(e,i),this._core.resize(e,i)}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,i,n){this._verifyIntegers(e,i,n),this._core.select(e,i,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,i){this._verifyIntegers(e,i),this._core.selectLines(e,i)}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,i){this._core.write(e,i)}writeln(e,i){this._core.write(e),this._core.write(`\r
|
|
99
|
+
`,i)}paste(e){this._core.paste(e)}refresh(e,i){this._verifyIntegers(e,i),this._core.refresh(e,i)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return iu.get()},set promptLabel(e){iu.set(e)},get tooMuchOutput(){return su.get()},set tooMuchOutput(e){su.set(e)}}}_verifyIntegers(...e){for(Bi of e)if(Bi===1/0||isNaN(Bi)||Bi%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Bi of e)if(Bi&&(Bi===1/0||isNaN(Bi)||Bi%1!==0||Bi<0))throw new Error("This API only accepts positive integers")}};var Hw=2,Uw=1,Ww=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let i=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(i._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let i=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),l=parseInt(n.getPropertyValue("height")),o=Math.max(0,parseInt(n.getPropertyValue("width"))),c=window.getComputedStyle(this._terminal.element),d={top:parseInt(c.getPropertyValue("padding-top")),bottom:parseInt(c.getPropertyValue("padding-bottom")),right:parseInt(c.getPropertyValue("padding-right")),left:parseInt(c.getPropertyValue("padding-left"))},_=d.top+d.bottom,g=d.right+d.left,f=l-_,x=o-g-i;return{cols:Math.max(Hw,Math.floor(x/e.css.cell.width)),rows:Math.max(Uw,Math.floor(f/e.css.cell.height))}}};var Pw=class{constructor(i,n,l,o={}){this._terminal=i,this._regex=n,this._handler=l,this._options=o}provideLinks(i,n){let l=Iw.computeLink(i,this._regex,this._terminal,this._handler);n(this._addCallbacks(l))}_addCallbacks(i){return i.map(n=>(n.leave=this._options.leave,n.hover=(l,o)=>{if(this._options.hover){let{range:c}=n;this._options.hover(l,o,c)}},n))}};function qw(e){try{let i=new URL(e),n=i.password&&i.username?`${i.protocol}//${i.username}:${i.password}@${i.host}`:i.username?`${i.protocol}//${i.username}@${i.host}`:`${i.protocol}//${i.host}`;return e.toLocaleLowerCase().startsWith(n.toLocaleLowerCase())}catch{return!1}}var Iw=class Qa{static computeLink(i,n,l,o){let c=new RegExp(n.source,(n.flags||"")+"g"),[d,_]=Qa._getWindowedLineStrings(i-1,l),g=d.join(""),f,x=[];for(;f=c.exec(g);){let v=f[0];if(!qw(v))continue;let[b,w]=Qa._mapStrIdx(l,_,0,f.index),[S,R]=Qa._mapStrIdx(l,b,w,v.length);if(b===-1||w===-1||S===-1||R===-1)continue;let z={start:{x:w+1,y:b+1},end:{x:R,y:S+1}};x.push({range:z,text:v,activate:o})}return x}static _getWindowedLineStrings(i,n){let l,o=i,c=i,d=0,_="",g=[];if(l=n.buffer.active.getLine(i)){let f=l.translateToString(!0);if(l.isWrapped&&f[0]!==" "){for(d=0;(l=n.buffer.active.getLine(--o))&&d<2048&&(_=l.translateToString(!0),d+=_.length,g.push(_),!(!l.isWrapped||_.indexOf(" ")!==-1)););g.reverse()}for(g.push(f),d=0;(l=n.buffer.active.getLine(++c))&&l.isWrapped&&d<2048&&(_=l.translateToString(!0),d+=_.length,g.push(_),_.indexOf(" ")===-1););}return[g,o]}static _mapStrIdx(i,n,l,o){let c=i.buffer.active,d=c.getNullCell(),_=l;for(;o;){let g=c.getLine(n);if(!g)return[-1,-1];for(let f=_;f<g.length;++f){g.getCell(f,d);let x=d.getChars();if(d.getWidth()&&(o-=x.length||1,f===g.length-1&&x==="")){let v=c.getLine(n+1);v&&v.isWrapped&&(v.getCell(0,d),d.getWidth()===2&&(o+=1))}if(o<0)return[n,f]}n++,_=0}return[n,_]}},Kw=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function $w(e,i){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=i}else console.warn("Opening link blocked as opener could not be cleared")}var Yw=class{constructor(i=$w,n={}){this._handler=i,this._options=n}activate(i){this._terminal=i;let n=this._options,l=n.urlRegex||Kw;this._linkProvider=this._terminal.registerLinkProvider(new Pw(this._terminal,l,this._handler,n))}dispose(){this._linkProvider?.dispose()}};function Fw(){const e=E.useRef(null),{connect:i,wsRef:n,onOutput:l,onExit:o,setConnectionCallbacks:c,addOutputLine:d}=en(),{path:_,setTerminalConnected:g}=Et();return E.useEffect(()=>{if(!e.current||!_)return;const f=new Nw({theme:{background:"#1a1a2e",foreground:"#e0e0e0",cursor:"#4ade80",selectionBackground:"rgba(74, 222, 128, 0.3)"},fontFamily:"'Inconsolata', 'Menlo', 'Courier New', monospace",fontSize:14,cursorBlink:!0}),x=new Ww;f.loadAddon(x),f.loadAddon(new Yw),f.open(e.current),x.fit(),l.current=w=>{f.write(w),w.replace(/\x1b\[[?>=!]?[0-9;]*[a-zA-Z]/g,"").replace(/\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)/g,"").replace(/\x1b[()][0-9A-Z]/g,"").replace(/\x1b./g,"").replace(/\r/g,"").split(`
|
|
100
|
+
`).map(z=>z.trim()).filter(z=>z.length>0).filter(z=>!z.match(/^\(thinking\)$/)).forEach(z=>d(z))},o.current=()=>f.writeln(`\r
|
|
101
|
+
[Process exited. Refresh to restart]`),c(()=>g(!0),()=>{g(!1),f.writeln(`\r
|
|
102
|
+
[Connection lost]`)});const v=i(_);f.onData(w=>{v?.readyState===WebSocket.OPEN&&v.send(JSON.stringify({type:"input",data:w}))});const b=new ResizeObserver(()=>{x.fit(),v?.readyState===WebSocket.OPEN&&v.send(JSON.stringify({type:"resize",cols:f.cols,rows:f.rows}))});return b.observe(e.current),()=>{b.disconnect(),f.dispose(),v?.close()}},[_]),p.jsx("div",{ref:e,className:"h-full w-full"})}function Gw(){const[e,i]=E.useState(!1),[n,l]=E.useState(!1),{sendPrompt:o}=en(),c=()=>{o("Run the dev server for this project so I can preview it in the browser. Use npm run dev or the appropriate command. IMPORTANT: Make sure it runs on port 5173 — the preview panel is connected to that port. If the framework defaults to a different port, configure it to use 5173 (e.g. --port 5173)."),l(!0),setTimeout(()=>{i(!0),l(!1)},4e3)},d=()=>{i(!1),setTimeout(()=>i(!0),100)};return e?p.jsxs("div",{className:"h-full flex flex-col",style:{background:"#f8fafc"},children:[p.jsxs("div",{style:{padding:"8px 16px",borderBottom:"1px solid #e5e7eb",display:"flex",alignItems:"center",justifyContent:"space-between",flexShrink:0,background:"#fff"},children:[p.jsx("span",{style:{fontSize:"12px",color:"#9ca3af",fontFamily:"'SF Mono', monospace"},children:"localhost:5173 (errors → terminal)"}),p.jsx("button",{onClick:d,style:{padding:"4px 10px",borderRadius:"6px",border:"1px solid #e5e7eb",background:"#fff",color:"#6b7280",fontSize:"12px",cursor:"pointer"},children:"↻ Refresh"})]}),p.jsx("iframe",{src:"/api/dev-preview/?port=5173",style:{flex:1,border:"none",width:"100%"},sandbox:"allow-scripts allow-same-origin allow-forms allow-popups",title:"Live Preview"})]}):p.jsx("div",{className:"h-full flex items-center justify-center",style:{background:"#f8fafc"},children:p.jsxs("div",{className:"text-center",children:[p.jsx("div",{className:"text-3xl mb-3",children:"🌐"}),p.jsx("div",{style:{color:"#374151",fontSize:"15px",fontWeight:600,marginBottom:"4px"},children:"Live Preview"}),p.jsx("div",{style:{color:"#9ca3af",fontSize:"12px",marginBottom:"20px"},children:"localhost:5173"}),p.jsx("button",{onClick:c,disabled:n,style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:n?"#e5e7eb":"#22c55e",color:n?"#9ca3af":"#fff",fontSize:"14px",fontWeight:600,cursor:n?"not-allowed":"pointer",transition:"all 0.15s"},children:n?"⏳ Starting...":"▶ View Tool"}),p.jsx("div",{style:{color:"#9ca3af",fontSize:"11px",marginTop:"10px"},children:"Starts the dev server and shows your app here"})]})})}function ed(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ur=ed();function zv(e){ur=e}var rr={exec:()=>null};function Te(e,i=""){let n=typeof e=="string"?e:e.source,l={replace:(o,c)=>{let d=typeof c=="string"?c:c.source;return d=d.replace(zt.caret,"$1"),n=n.replace(o,d),l},getRegex:()=>new RegExp(n,i)};return l}var Xw=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),zt={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}>`)},Vw=/^(?:[ \t]*(?:\n|$))+/,Zw=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Qw=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Sl=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Jw=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,td=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Av=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Mv=Te(Av).replace(/bull/g,td).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),eC=Te(Av).replace(/bull/g,td).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),id=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,tC=/^[^\n]+/,sd=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,iC=Te(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",sd).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),sC=Te(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,td).getRegex(),po="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",rd=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,rC=Te("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",rd).replace("tag",po).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ov=Te(id).replace("hr",Sl).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",po).getRegex(),nC=Te(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ov).getRegex(),nd={blockquote:nC,code:Zw,def:iC,fences:Qw,heading:Jw,hr:Sl,html:rC,lheading:Mv,list:sC,newline:Vw,paragraph:Ov,table:rr,text:tC},ym=Te("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Sl).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",po).getRegex(),lC={...nd,lheading:eC,table:ym,paragraph:Te(id).replace("hr",Sl).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ym).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",po).getRegex()},aC={...nd,html:Te(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",rd).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:rr,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Te(id).replace("hr",Sl).replace("heading",` *#{1,6} *[^
|
|
103
|
+
]`).replace("lheading",Mv).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},oC=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,cC=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,jv=/^( {2,}|\\)\n(?!\s*$)/,hC=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,go=/[\p{P}\p{S}]/u,ld=/[\s\p{P}\p{S}]/u,Lv=/[^\s\p{P}\p{S}]/u,uC=Te(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,ld).getRegex(),Nv=/(?!~)[\p{P}\p{S}]/u,dC=/(?!~)[\s\p{P}\p{S}]/u,fC=/(?:[^\s\p{P}\p{S}]|~)/u,Hv=/(?![*_])[\p{P}\p{S}]/u,pC=/(?![*_])[\s\p{P}\p{S}]/u,gC=/(?:[^\s\p{P}\p{S}]|[*_])/u,_C=Te(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Xw?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Uv=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,mC=Te(Uv,"u").replace(/punct/g,go).getRegex(),vC=Te(Uv,"u").replace(/punct/g,Nv).getRegex(),Wv="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",yC=Te(Wv,"gu").replace(/notPunctSpace/g,Lv).replace(/punctSpace/g,ld).replace(/punct/g,go).getRegex(),xC=Te(Wv,"gu").replace(/notPunctSpace/g,fC).replace(/punctSpace/g,dC).replace(/punct/g,Nv).getRegex(),SC=Te("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Lv).replace(/punctSpace/g,ld).replace(/punct/g,go).getRegex(),bC=Te(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Hv).getRegex(),wC="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",CC=Te(wC,"gu").replace(/notPunctSpace/g,gC).replace(/punctSpace/g,pC).replace(/punct/g,Hv).getRegex(),kC=Te(/\\(punct)/,"gu").replace(/punct/g,go).getRegex(),EC=Te(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),TC=Te(rd).replace("(?:-->|$)","-->").getRegex(),RC=Te("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",TC).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),no=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,DC=Te(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",no).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Pv=Te(/^!?\[(label)\]\[(ref)\]/).replace("label",no).replace("ref",sd).getRegex(),qv=Te(/^!?\[(ref)\](?:\[\])?/).replace("ref",sd).getRegex(),BC=Te("reflink|nolink(?!\\()","g").replace("reflink",Pv).replace("nolink",qv).getRegex(),xm=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,ad={_backpedal:rr,anyPunctuation:kC,autolink:EC,blockSkip:_C,br:jv,code:cC,del:rr,delLDelim:rr,delRDelim:rr,emStrongLDelim:mC,emStrongRDelimAst:yC,emStrongRDelimUnd:SC,escape:oC,link:DC,nolink:qv,punctuation:uC,reflink:Pv,reflinkSearch:BC,tag:RC,text:hC,url:rr},zC={...ad,link:Te(/^!?\[(label)\]\((.*?)\)/).replace("label",no).getRegex(),reflink:Te(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",no).getRegex()},Uu={...ad,emStrongRDelimAst:xC,emStrongLDelim:vC,delLDelim:bC,delRDelim:CC,url:Te(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",xm).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Te(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",xm).getRegex()},AC={...Uu,br:Te(jv).replace("{2,}","*").getRegex(),text:Te(Uu.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},$a={normal:nd,gfm:lC,pedantic:aC},nl={normal:ad,gfm:Uu,breaks:AC,pedantic:zC},MC={"&":"&","<":"<",">":">",'"':""","'":"'"},Sm=e=>MC[e];function Ai(e,i){if(i){if(zt.escapeTest.test(e))return e.replace(zt.escapeReplace,Sm)}else if(zt.escapeTestNoEncode.test(e))return e.replace(zt.escapeReplaceNoEncode,Sm);return e}function bm(e){try{e=encodeURI(e).replace(zt.percentDecode,"%")}catch{return null}return e}function wm(e,i){let n=e.replace(zt.findPipe,(c,d,_)=>{let g=!1,f=d;for(;--f>=0&&_[f]==="\\";)g=!g;return g?"|":" |"}),l=n.split(zt.splitPipe),o=0;if(l[0].trim()||l.shift(),l.length>0&&!l.at(-1)?.trim()&&l.pop(),i)if(l.length>i)l.splice(i);else for(;l.length<i;)l.push("");for(;o<l.length;o++)l[o]=l[o].trim().replace(zt.slashPipe,"|");return l}function ll(e,i,n){let l=e.length;if(l===0)return"";let o=0;for(;o<l&&e.charAt(l-o-1)===i;)o++;return e.slice(0,l-o)}function OC(e,i){if(e.indexOf(i[1])===-1)return-1;let n=0;for(let l=0;l<e.length;l++)if(e[l]==="\\")l++;else if(e[l]===i[0])n++;else if(e[l]===i[1]&&(n--,n<0))return l;return n>0?-2:-1}function jC(e,i=0){let n=i,l="";for(let o of e)if(o===" "){let c=4-n%4;l+=" ".repeat(c),n+=c}else l+=o,n++;return l}function Cm(e,i,n,l,o){let c=i.href,d=i.title||null,_=e[1].replace(o.other.outputLinkReplace,"$1");l.state.inLink=!0;let g={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:c,title:d,text:_,tokens:l.inlineTokens(_)};return l.state.inLink=!1,g}function LC(e,i,n){let l=e.match(n.other.indentCodeCompensation);if(l===null)return i;let o=l[1];return i.split(`
|
|
104
|
+
`).map(c=>{let d=c.match(n.other.beginningSpace);if(d===null)return c;let[_]=d;return _.length>=o.length?c.slice(o.length):c}).join(`
|
|
105
|
+
`)}var lo=class{options;rules;lexer;constructor(e){this.options=e||ur}space(e){let i=this.rules.block.newline.exec(e);if(i&&i[0].length>0)return{type:"space",raw:i[0]}}code(e){let i=this.rules.block.code.exec(e);if(i){let n=i[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:i[0],codeBlockStyle:"indented",text:this.options.pedantic?n:ll(n,`
|
|
106
|
+
`)}}}fences(e){let i=this.rules.block.fences.exec(e);if(i){let n=i[0],l=LC(n,i[3]||"",this.rules);return{type:"code",raw:n,lang:i[2]?i[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):i[2],text:l}}}heading(e){let i=this.rules.block.heading.exec(e);if(i){let n=i[2].trim();if(this.rules.other.endingHash.test(n)){let l=ll(n,"#");(this.options.pedantic||!l||this.rules.other.endingSpaceChar.test(l))&&(n=l.trim())}return{type:"heading",raw:i[0],depth:i[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let i=this.rules.block.hr.exec(e);if(i)return{type:"hr",raw:ll(i[0],`
|
|
107
|
+
`)}}blockquote(e){let i=this.rules.block.blockquote.exec(e);if(i){let n=ll(i[0],`
|
|
108
|
+
`).split(`
|
|
109
|
+
`),l="",o="",c=[];for(;n.length>0;){let d=!1,_=[],g;for(g=0;g<n.length;g++)if(this.rules.other.blockquoteStart.test(n[g]))_.push(n[g]),d=!0;else if(!d)_.push(n[g]);else break;n=n.slice(g);let f=_.join(`
|
|
110
|
+
`),x=f.replace(this.rules.other.blockquoteSetextReplace,`
|
|
111
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");l=l?`${l}
|
|
112
|
+
${f}`:f,o=o?`${o}
|
|
113
|
+
${x}`:x;let v=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(x,c,!0),this.lexer.state.top=v,n.length===0)break;let b=c.at(-1);if(b?.type==="code")break;if(b?.type==="blockquote"){let w=b,S=w.raw+`
|
|
114
|
+
`+n.join(`
|
|
115
|
+
`),R=this.blockquote(S);c[c.length-1]=R,l=l.substring(0,l.length-w.raw.length)+R.raw,o=o.substring(0,o.length-w.text.length)+R.text;break}else if(b?.type==="list"){let w=b,S=w.raw+`
|
|
116
|
+
`+n.join(`
|
|
117
|
+
`),R=this.list(S);c[c.length-1]=R,l=l.substring(0,l.length-b.raw.length)+R.raw,o=o.substring(0,o.length-w.raw.length)+R.raw,n=S.substring(c.at(-1).raw.length).split(`
|
|
118
|
+
`);continue}}return{type:"blockquote",raw:l,tokens:c,text:o}}}list(e){let i=this.rules.block.list.exec(e);if(i){let n=i[1].trim(),l=n.length>1,o={type:"list",raw:"",ordered:l,start:l?+n.slice(0,-1):"",loose:!1,items:[]};n=l?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=l?n:"[*+-]");let c=this.rules.other.listItemRegex(n),d=!1;for(;e;){let g=!1,f="",x="";if(!(i=c.exec(e))||this.rules.block.hr.test(e))break;f=i[0],e=e.substring(f.length);let v=jC(i[2].split(`
|
|
119
|
+
`,1)[0],i[1].length),b=e.split(`
|
|
120
|
+
`,1)[0],w=!v.trim(),S=0;if(this.options.pedantic?(S=2,x=v.trimStart()):w?S=i[1].length+1:(S=v.search(this.rules.other.nonSpaceChar),S=S>4?1:S,x=v.slice(S),S+=i[1].length),w&&this.rules.other.blankLine.test(b)&&(f+=b+`
|
|
121
|
+
`,e=e.substring(b.length+1),g=!0),!g){let R=this.rules.other.nextBulletRegex(S),z=this.rules.other.hrRegex(S),A=this.rules.other.fencesBeginRegex(S),W=this.rules.other.headingBeginRegex(S),j=this.rules.other.htmlBeginRegex(S),C=this.rules.other.blockquoteBeginRegex(S);for(;e;){let O=e.split(`
|
|
122
|
+
`,1)[0],G;if(b=O,this.options.pedantic?(b=b.replace(this.rules.other.listReplaceNesting," "),G=b):G=b.replace(this.rules.other.tabCharGlobal," "),A.test(b)||W.test(b)||j.test(b)||C.test(b)||R.test(b)||z.test(b))break;if(G.search(this.rules.other.nonSpaceChar)>=S||!b.trim())x+=`
|
|
123
|
+
`+G.slice(S);else{if(w||v.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||A.test(v)||W.test(v)||z.test(v))break;x+=`
|
|
124
|
+
`+b}w=!b.trim(),f+=O+`
|
|
125
|
+
`,e=e.substring(O.length+1),v=G.slice(S)}}o.loose||(d?o.loose=!0:this.rules.other.doubleBlankLine.test(f)&&(d=!0)),o.items.push({type:"list_item",raw:f,task:!!this.options.gfm&&this.rules.other.listIsTask.test(x),loose:!1,text:x,tokens:[]}),o.raw+=f}let _=o.items.at(-1);if(_)_.raw=_.raw.trimEnd(),_.text=_.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let g of o.items){if(this.lexer.state.top=!1,g.tokens=this.lexer.blockTokens(g.text,[]),g.task){if(g.text=g.text.replace(this.rules.other.listReplaceTask,""),g.tokens[0]?.type==="text"||g.tokens[0]?.type==="paragraph"){g.tokens[0].raw=g.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),g.tokens[0].text=g.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let x=this.lexer.inlineQueue.length-1;x>=0;x--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[x].src)){this.lexer.inlineQueue[x].src=this.lexer.inlineQueue[x].src.replace(this.rules.other.listReplaceTask,"");break}}let f=this.rules.other.listTaskCheckbox.exec(g.raw);if(f){let x={type:"checkbox",raw:f[0]+" ",checked:f[0]!=="[ ]"};g.checked=x.checked,o.loose?g.tokens[0]&&["paragraph","text"].includes(g.tokens[0].type)&&"tokens"in g.tokens[0]&&g.tokens[0].tokens?(g.tokens[0].raw=x.raw+g.tokens[0].raw,g.tokens[0].text=x.raw+g.tokens[0].text,g.tokens[0].tokens.unshift(x)):g.tokens.unshift({type:"paragraph",raw:x.raw,text:x.raw,tokens:[x]}):g.tokens.unshift(x)}}if(!o.loose){let f=g.tokens.filter(v=>v.type==="space"),x=f.length>0&&f.some(v=>this.rules.other.anyLine.test(v.raw));o.loose=x}}if(o.loose)for(let g of o.items){g.loose=!0;for(let f of g.tokens)f.type==="text"&&(f.type="paragraph")}return o}}html(e){let i=this.rules.block.html.exec(e);if(i)return{type:"html",block:!0,raw:i[0],pre:i[1]==="pre"||i[1]==="script"||i[1]==="style",text:i[0]}}def(e){let i=this.rules.block.def.exec(e);if(i){let n=i[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),l=i[2]?i[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",o=i[3]?i[3].substring(1,i[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):i[3];return{type:"def",tag:n,raw:i[0],href:l,title:o}}}table(e){let i=this.rules.block.table.exec(e);if(!i||!this.rules.other.tableDelimiter.test(i[2]))return;let n=wm(i[1]),l=i[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=i[3]?.trim()?i[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
126
|
+
`):[],c={type:"table",raw:i[0],header:[],align:[],rows:[]};if(n.length===l.length){for(let d of l)this.rules.other.tableAlignRight.test(d)?c.align.push("right"):this.rules.other.tableAlignCenter.test(d)?c.align.push("center"):this.rules.other.tableAlignLeft.test(d)?c.align.push("left"):c.align.push(null);for(let d=0;d<n.length;d++)c.header.push({text:n[d],tokens:this.lexer.inline(n[d]),header:!0,align:c.align[d]});for(let d of o)c.rows.push(wm(d,c.header.length).map((_,g)=>({text:_,tokens:this.lexer.inline(_),header:!1,align:c.align[g]})));return c}}lheading(e){let i=this.rules.block.lheading.exec(e);if(i)return{type:"heading",raw:i[0],depth:i[2].charAt(0)==="="?1:2,text:i[1],tokens:this.lexer.inline(i[1])}}paragraph(e){let i=this.rules.block.paragraph.exec(e);if(i){let n=i[1].charAt(i[1].length-1)===`
|
|
127
|
+
`?i[1].slice(0,-1):i[1];return{type:"paragraph",raw:i[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let i=this.rules.block.text.exec(e);if(i)return{type:"text",raw:i[0],text:i[0],tokens:this.lexer.inline(i[0])}}escape(e){let i=this.rules.inline.escape.exec(e);if(i)return{type:"escape",raw:i[0],text:i[1]}}tag(e){let i=this.rules.inline.tag.exec(e);if(i)return!this.lexer.state.inLink&&this.rules.other.startATag.test(i[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(i[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(i[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(i[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:i[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:i[0]}}link(e){let i=this.rules.inline.link.exec(e);if(i){let n=i[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let c=ll(n.slice(0,-1),"\\");if((n.length-c.length)%2===0)return}else{let c=OC(i[2],"()");if(c===-2)return;if(c>-1){let d=(i[0].indexOf("!")===0?5:4)+i[1].length+c;i[2]=i[2].substring(0,c),i[0]=i[0].substring(0,d).trim(),i[3]=""}}let l=i[2],o="";if(this.options.pedantic){let c=this.rules.other.pedanticHrefTitle.exec(l);c&&(l=c[1],o=c[3])}else o=i[3]?i[3].slice(1,-1):"";return l=l.trim(),this.rules.other.startAngleBracket.test(l)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?l=l.slice(1):l=l.slice(1,-1)),Cm(i,{href:l&&l.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},i[0],this.lexer,this.rules)}}reflink(e,i){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let l=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),o=i[l.toLowerCase()];if(!o){let c=n[0].charAt(0);return{type:"text",raw:c,text:c}}return Cm(n,o,n[0],this.lexer,this.rules)}}emStrong(e,i,n=""){let l=this.rules.inline.emStrongLDelim.exec(e);if(!(!l||l[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(l[1]||l[2])||!n||this.rules.inline.punctuation.exec(n))){let o=[...l[0]].length-1,c,d,_=o,g=0,f=l[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(f.lastIndex=0,i=i.slice(-1*e.length+o);(l=f.exec(i))!=null;){if(c=l[1]||l[2]||l[3]||l[4]||l[5]||l[6],!c)continue;if(d=[...c].length,l[3]||l[4]){_+=d;continue}else if((l[5]||l[6])&&o%3&&!((o+d)%3)){g+=d;continue}if(_-=d,_>0)continue;d=Math.min(d,d+_+g);let x=[...l[0]][0].length,v=e.slice(0,o+l.index+x+d);if(Math.min(o,d)%2){let w=v.slice(1,-1);return{type:"em",raw:v,text:w,tokens:this.lexer.inlineTokens(w)}}let b=v.slice(2,-2);return{type:"strong",raw:v,text:b,tokens:this.lexer.inlineTokens(b)}}}}codespan(e){let i=this.rules.inline.code.exec(e);if(i){let n=i[2].replace(this.rules.other.newLineCharGlobal," "),l=this.rules.other.nonSpaceChar.test(n),o=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return l&&o&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:i[0],text:n}}}br(e){let i=this.rules.inline.br.exec(e);if(i)return{type:"br",raw:i[0]}}del(e,i,n=""){let l=this.rules.inline.delLDelim.exec(e);if(l&&(!l[1]||!n||this.rules.inline.punctuation.exec(n))){let o=[...l[0]].length-1,c,d,_=o,g=this.rules.inline.delRDelim;for(g.lastIndex=0,i=i.slice(-1*e.length+o);(l=g.exec(i))!=null;){if(c=l[1]||l[2]||l[3]||l[4]||l[5]||l[6],!c||(d=[...c].length,d!==o))continue;if(l[3]||l[4]){_+=d;continue}if(_-=d,_>0)continue;d=Math.min(d,d+_);let f=[...l[0]][0].length,x=e.slice(0,o+l.index+f+d),v=x.slice(o,-o);return{type:"del",raw:x,text:v,tokens:this.lexer.inlineTokens(v)}}}}autolink(e){let i=this.rules.inline.autolink.exec(e);if(i){let n,l;return i[2]==="@"?(n=i[1],l="mailto:"+n):(n=i[1],l=n),{type:"link",raw:i[0],text:n,href:l,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let i;if(i=this.rules.inline.url.exec(e)){let n,l;if(i[2]==="@")n=i[0],l="mailto:"+n;else{let o;do o=i[0],i[0]=this.rules.inline._backpedal.exec(i[0])?.[0]??"";while(o!==i[0]);n=i[0],i[1]==="www."?l="http://"+i[0]:l=i[0]}return{type:"link",raw:i[0],text:n,href:l,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let i=this.rules.inline.text.exec(e);if(i){let n=this.lexer.state.inRawBlock;return{type:"text",raw:i[0],text:i[0],escaped:n}}}},Si=class Wu{tokens;options;state;inlineQueue;tokenizer;constructor(i){this.tokens=[],this.tokens.links=Object.create(null),this.options=i||ur,this.options.tokenizer=this.options.tokenizer||new lo,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:zt,block:$a.normal,inline:nl.normal};this.options.pedantic?(n.block=$a.pedantic,n.inline=nl.pedantic):this.options.gfm&&(n.block=$a.gfm,this.options.breaks?n.inline=nl.breaks:n.inline=nl.gfm),this.tokenizer.rules=n}static get rules(){return{block:$a,inline:nl}}static lex(i,n){return new Wu(n).lex(i)}static lexInline(i,n){return new Wu(n).inlineTokens(i)}lex(i){i=i.replace(zt.carriageReturn,`
|
|
128
|
+
`),this.blockTokens(i,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let l=this.inlineQueue[n];this.inlineTokens(l.src,l.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(i,n=[],l=!1){for(this.options.pedantic&&(i=i.replace(zt.tabCharGlobal," ").replace(zt.spaceLine,""));i;){let o;if(this.options.extensions?.block?.some(d=>(o=d.call({lexer:this},i,n))?(i=i.substring(o.raw.length),n.push(o),!0):!1))continue;if(o=this.tokenizer.space(i)){i=i.substring(o.raw.length);let d=n.at(-1);o.raw.length===1&&d!==void 0?d.raw+=`
|
|
129
|
+
`:n.push(o);continue}if(o=this.tokenizer.code(i)){i=i.substring(o.raw.length);let d=n.at(-1);d?.type==="paragraph"||d?.type==="text"?(d.raw+=(d.raw.endsWith(`
|
|
130
|
+
`)?"":`
|
|
131
|
+
`)+o.raw,d.text+=`
|
|
132
|
+
`+o.text,this.inlineQueue.at(-1).src=d.text):n.push(o);continue}if(o=this.tokenizer.fences(i)){i=i.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.heading(i)){i=i.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.hr(i)){i=i.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.blockquote(i)){i=i.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.list(i)){i=i.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.html(i)){i=i.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.def(i)){i=i.substring(o.raw.length);let d=n.at(-1);d?.type==="paragraph"||d?.type==="text"?(d.raw+=(d.raw.endsWith(`
|
|
133
|
+
`)?"":`
|
|
134
|
+
`)+o.raw,d.text+=`
|
|
135
|
+
`+o.raw,this.inlineQueue.at(-1).src=d.text):this.tokens.links[o.tag]||(this.tokens.links[o.tag]={href:o.href,title:o.title},n.push(o));continue}if(o=this.tokenizer.table(i)){i=i.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.lheading(i)){i=i.substring(o.raw.length),n.push(o);continue}let c=i;if(this.options.extensions?.startBlock){let d=1/0,_=i.slice(1),g;this.options.extensions.startBlock.forEach(f=>{g=f.call({lexer:this},_),typeof g=="number"&&g>=0&&(d=Math.min(d,g))}),d<1/0&&d>=0&&(c=i.substring(0,d+1))}if(this.state.top&&(o=this.tokenizer.paragraph(c))){let d=n.at(-1);l&&d?.type==="paragraph"?(d.raw+=(d.raw.endsWith(`
|
|
136
|
+
`)?"":`
|
|
137
|
+
`)+o.raw,d.text+=`
|
|
138
|
+
`+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=d.text):n.push(o),l=c.length!==i.length,i=i.substring(o.raw.length);continue}if(o=this.tokenizer.text(i)){i=i.substring(o.raw.length);let d=n.at(-1);d?.type==="text"?(d.raw+=(d.raw.endsWith(`
|
|
139
|
+
`)?"":`
|
|
140
|
+
`)+o.raw,d.text+=`
|
|
141
|
+
`+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=d.text):n.push(o);continue}if(i){let d="Infinite loop on byte: "+i.charCodeAt(0);if(this.options.silent){console.error(d);break}else throw new Error(d)}}return this.state.top=!0,n}inline(i,n=[]){return this.inlineQueue.push({src:i,tokens:n}),n}inlineTokens(i,n=[]){let l=i,o=null;if(this.tokens.links){let g=Object.keys(this.tokens.links);if(g.length>0)for(;(o=this.tokenizer.rules.inline.reflinkSearch.exec(l))!=null;)g.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(o=this.tokenizer.rules.inline.anyPunctuation.exec(l))!=null;)l=l.slice(0,o.index)+"++"+l.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let c;for(;(o=this.tokenizer.rules.inline.blockSkip.exec(l))!=null;)c=o[2]?o[2].length:0,l=l.slice(0,o.index+c)+"["+"a".repeat(o[0].length-c-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);l=this.options.hooks?.emStrongMask?.call({lexer:this},l)??l;let d=!1,_="";for(;i;){d||(_=""),d=!1;let g;if(this.options.extensions?.inline?.some(x=>(g=x.call({lexer:this},i,n))?(i=i.substring(g.raw.length),n.push(g),!0):!1))continue;if(g=this.tokenizer.escape(i)){i=i.substring(g.raw.length),n.push(g);continue}if(g=this.tokenizer.tag(i)){i=i.substring(g.raw.length),n.push(g);continue}if(g=this.tokenizer.link(i)){i=i.substring(g.raw.length),n.push(g);continue}if(g=this.tokenizer.reflink(i,this.tokens.links)){i=i.substring(g.raw.length);let x=n.at(-1);g.type==="text"&&x?.type==="text"?(x.raw+=g.raw,x.text+=g.text):n.push(g);continue}if(g=this.tokenizer.emStrong(i,l,_)){i=i.substring(g.raw.length),n.push(g);continue}if(g=this.tokenizer.codespan(i)){i=i.substring(g.raw.length),n.push(g);continue}if(g=this.tokenizer.br(i)){i=i.substring(g.raw.length),n.push(g);continue}if(g=this.tokenizer.del(i,l,_)){i=i.substring(g.raw.length),n.push(g);continue}if(g=this.tokenizer.autolink(i)){i=i.substring(g.raw.length),n.push(g);continue}if(!this.state.inLink&&(g=this.tokenizer.url(i))){i=i.substring(g.raw.length),n.push(g);continue}let f=i;if(this.options.extensions?.startInline){let x=1/0,v=i.slice(1),b;this.options.extensions.startInline.forEach(w=>{b=w.call({lexer:this},v),typeof b=="number"&&b>=0&&(x=Math.min(x,b))}),x<1/0&&x>=0&&(f=i.substring(0,x+1))}if(g=this.tokenizer.inlineText(f)){i=i.substring(g.raw.length),g.raw.slice(-1)!=="_"&&(_=g.raw.slice(-1)),d=!0;let x=n.at(-1);x?.type==="text"?(x.raw+=g.raw,x.text+=g.text):n.push(g);continue}if(i){let x="Infinite loop on byte: "+i.charCodeAt(0);if(this.options.silent){console.error(x);break}else throw new Error(x)}}return n}},ao=class{options;parser;constructor(e){this.options=e||ur}space(e){return""}code({text:e,lang:i,escaped:n}){let l=(i||"").match(zt.notSpaceStart)?.[0],o=e.replace(zt.endingNewline,"")+`
|
|
142
|
+
`;return l?'<pre><code class="language-'+Ai(l)+'">'+(n?o:Ai(o,!0))+`</code></pre>
|
|
143
|
+
`:"<pre><code>"+(n?o:Ai(o,!0))+`</code></pre>
|
|
144
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
145
|
+
${this.parser.parse(e)}</blockquote>
|
|
146
|
+
`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:i}){return`<h${i}>${this.parser.parseInline(e)}</h${i}>
|
|
147
|
+
`}hr(e){return`<hr>
|
|
148
|
+
`}list(e){let i=e.ordered,n=e.start,l="";for(let d=0;d<e.items.length;d++){let _=e.items[d];l+=this.listitem(_)}let o=i?"ol":"ul",c=i&&n!==1?' start="'+n+'"':"";return"<"+o+c+`>
|
|
149
|
+
`+l+"</"+o+`>
|
|
150
|
+
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
151
|
+
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
152
|
+
`}table(e){let i="",n="";for(let o=0;o<e.header.length;o++)n+=this.tablecell(e.header[o]);i+=this.tablerow({text:n});let l="";for(let o=0;o<e.rows.length;o++){let c=e.rows[o];n="";for(let d=0;d<c.length;d++)n+=this.tablecell(c[d]);l+=this.tablerow({text:n})}return l&&(l=`<tbody>${l}</tbody>`),`<table>
|
|
153
|
+
<thead>
|
|
154
|
+
`+i+`</thead>
|
|
155
|
+
`+l+`</table>
|
|
156
|
+
`}tablerow({text:e}){return`<tr>
|
|
157
|
+
${e}</tr>
|
|
158
|
+
`}tablecell(e){let i=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+i+`</${n}>
|
|
159
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Ai(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:i,tokens:n}){let l=this.parser.parseInline(n),o=bm(e);if(o===null)return l;e=o;let c='<a href="'+e+'"';return i&&(c+=' title="'+Ai(i)+'"'),c+=">"+l+"</a>",c}image({href:e,title:i,text:n,tokens:l}){l&&(n=this.parser.parseInline(l,this.parser.textRenderer));let o=bm(e);if(o===null)return Ai(n);e=o;let c=`<img src="${e}" alt="${Ai(n)}"`;return i&&(c+=` title="${Ai(i)}"`),c+=">",c}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Ai(e.text)}},od=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},bi=class Pu{options;renderer;textRenderer;constructor(i){this.options=i||ur,this.options.renderer=this.options.renderer||new ao,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new od}static parse(i,n){return new Pu(n).parse(i)}static parseInline(i,n){return new Pu(n).parseInline(i)}parse(i){let n="";for(let l=0;l<i.length;l++){let o=i[l];if(this.options.extensions?.renderers?.[o.type]){let d=o,_=this.options.extensions.renderers[d.type].call({parser:this},d);if(_!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(d.type)){n+=_||"";continue}}let c=o;switch(c.type){case"space":{n+=this.renderer.space(c);break}case"hr":{n+=this.renderer.hr(c);break}case"heading":{n+=this.renderer.heading(c);break}case"code":{n+=this.renderer.code(c);break}case"table":{n+=this.renderer.table(c);break}case"blockquote":{n+=this.renderer.blockquote(c);break}case"list":{n+=this.renderer.list(c);break}case"checkbox":{n+=this.renderer.checkbox(c);break}case"html":{n+=this.renderer.html(c);break}case"def":{n+=this.renderer.def(c);break}case"paragraph":{n+=this.renderer.paragraph(c);break}case"text":{n+=this.renderer.text(c);break}default:{let d='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return n}parseInline(i,n=this.renderer){let l="";for(let o=0;o<i.length;o++){let c=i[o];if(this.options.extensions?.renderers?.[c.type]){let _=this.options.extensions.renderers[c.type].call({parser:this},c);if(_!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(c.type)){l+=_||"";continue}}let d=c;switch(d.type){case"escape":{l+=n.text(d);break}case"html":{l+=n.html(d);break}case"link":{l+=n.link(d);break}case"image":{l+=n.image(d);break}case"checkbox":{l+=n.checkbox(d);break}case"strong":{l+=n.strong(d);break}case"em":{l+=n.em(d);break}case"codespan":{l+=n.codespan(d);break}case"br":{l+=n.br(d);break}case"del":{l+=n.del(d);break}case"text":{l+=n.text(d);break}default:{let _='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(_),"";throw new Error(_)}}}return l}},dl=class{options;block;constructor(e){this.options=e||ur}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?Si.lex:Si.lexInline}provideParser(){return this.block?bi.parse:bi.parseInline}},NC=class{defaults=ed();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=bi;Renderer=ao;TextRenderer=od;Lexer=Si;Tokenizer=lo;Hooks=dl;constructor(...e){this.use(...e)}walkTokens(e,i){let n=[];for(let l of e)switch(n=n.concat(i.call(this,l)),l.type){case"table":{let o=l;for(let c of o.header)n=n.concat(this.walkTokens(c.tokens,i));for(let c of o.rows)for(let d of c)n=n.concat(this.walkTokens(d.tokens,i));break}case"list":{let o=l;n=n.concat(this.walkTokens(o.items,i));break}default:{let o=l;this.defaults.extensions?.childTokens?.[o.type]?this.defaults.extensions.childTokens[o.type].forEach(c=>{let d=o[c].flat(1/0);n=n.concat(this.walkTokens(d,i))}):o.tokens&&(n=n.concat(this.walkTokens(o.tokens,i)))}}return n}use(...e){let i=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let l={...n};if(l.async=this.defaults.async||l.async||!1,n.extensions&&(n.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){let c=i.renderers[o.name];c?i.renderers[o.name]=function(...d){let _=o.renderer.apply(this,d);return _===!1&&(_=c.apply(this,d)),_}:i.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let c=i[o.level];c?c.unshift(o.tokenizer):i[o.level]=[o.tokenizer],o.start&&(o.level==="block"?i.startBlock?i.startBlock.push(o.start):i.startBlock=[o.start]:o.level==="inline"&&(i.startInline?i.startInline.push(o.start):i.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(i.childTokens[o.name]=o.childTokens)}),l.extensions=i),n.renderer){let o=this.defaults.renderer||new ao(this.defaults);for(let c in n.renderer){if(!(c in o))throw new Error(`renderer '${c}' does not exist`);if(["options","parser"].includes(c))continue;let d=c,_=n.renderer[d],g=o[d];o[d]=(...f)=>{let x=_.apply(o,f);return x===!1&&(x=g.apply(o,f)),x||""}}l.renderer=o}if(n.tokenizer){let o=this.defaults.tokenizer||new lo(this.defaults);for(let c in n.tokenizer){if(!(c in o))throw new Error(`tokenizer '${c}' does not exist`);if(["options","rules","lexer"].includes(c))continue;let d=c,_=n.tokenizer[d],g=o[d];o[d]=(...f)=>{let x=_.apply(o,f);return x===!1&&(x=g.apply(o,f)),x}}l.tokenizer=o}if(n.hooks){let o=this.defaults.hooks||new dl;for(let c in n.hooks){if(!(c in o))throw new Error(`hook '${c}' does not exist`);if(["options","block"].includes(c))continue;let d=c,_=n.hooks[d],g=o[d];dl.passThroughHooks.has(c)?o[d]=f=>{if(this.defaults.async&&dl.passThroughHooksRespectAsync.has(c))return(async()=>{let v=await _.call(o,f);return g.call(o,v)})();let x=_.call(o,f);return g.call(o,x)}:o[d]=(...f)=>{if(this.defaults.async)return(async()=>{let v=await _.apply(o,f);return v===!1&&(v=await g.apply(o,f)),v})();let x=_.apply(o,f);return x===!1&&(x=g.apply(o,f)),x}}l.hooks=o}if(n.walkTokens){let o=this.defaults.walkTokens,c=n.walkTokens;l.walkTokens=function(d){let _=[];return _.push(c.call(this,d)),o&&(_=_.concat(o.call(this,d))),_}}this.defaults={...this.defaults,...l}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,i){return Si.lex(e,i??this.defaults)}parser(e,i){return bi.parse(e,i??this.defaults)}parseMarkdown(e){return(i,n)=>{let l={...n},o={...this.defaults,...l},c=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&l.async===!1)return c(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof i>"u"||i===null)return c(new Error("marked(): input parameter is undefined or null"));if(typeof i!="string")return c(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(i)+", string expected"));if(o.hooks&&(o.hooks.options=o,o.hooks.block=e),o.async)return(async()=>{let d=o.hooks?await o.hooks.preprocess(i):i,_=await(o.hooks?await o.hooks.provideLexer():e?Si.lex:Si.lexInline)(d,o),g=o.hooks?await o.hooks.processAllTokens(_):_;o.walkTokens&&await Promise.all(this.walkTokens(g,o.walkTokens));let f=await(o.hooks?await o.hooks.provideParser():e?bi.parse:bi.parseInline)(g,o);return o.hooks?await o.hooks.postprocess(f):f})().catch(c);try{o.hooks&&(i=o.hooks.preprocess(i));let d=(o.hooks?o.hooks.provideLexer():e?Si.lex:Si.lexInline)(i,o);o.hooks&&(d=o.hooks.processAllTokens(d)),o.walkTokens&&this.walkTokens(d,o.walkTokens);let _=(o.hooks?o.hooks.provideParser():e?bi.parse:bi.parseInline)(d,o);return o.hooks&&(_=o.hooks.postprocess(_)),_}catch(d){return c(d)}}}onError(e,i){return n=>{if(n.message+=`
|
|
160
|
+
Please report this to https://github.com/markedjs/marked.`,e){let l="<p>An error occurred:</p><pre>"+Ai(n.message+"",!0)+"</pre>";return i?Promise.resolve(l):l}if(i)return Promise.reject(n);throw n}}},cr=new NC;function Me(e,i){return cr.parse(e,i)}Me.options=Me.setOptions=function(e){return cr.setOptions(e),Me.defaults=cr.defaults,zv(Me.defaults),Me};Me.getDefaults=ed;Me.defaults=ur;Me.use=function(...e){return cr.use(...e),Me.defaults=cr.defaults,zv(Me.defaults),Me};Me.walkTokens=function(e,i){return cr.walkTokens(e,i)};Me.parseInline=cr.parseInline;Me.Parser=bi;Me.parser=bi.parse;Me.Renderer=ao;Me.TextRenderer=od;Me.Lexer=Si;Me.lexer=Si.lex;Me.Tokenizer=lo;Me.Hooks=dl;Me.parse=Me;Me.options;Me.setOptions;Me.use;Me.walkTokens;Me.parseInline;bi.parse;Si.lex;function HC(e){return e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"").replace(/\bon\w+\s*=\s*"[^"]*"/gi,"").replace(/\bon\w+\s*=\s*'[^']*'/gi,"").replace(/javascript\s*:/gi,"")}function km(e){const i=[];let n="",l=!1;for(const o of e){if(o==='"'){l=!l;continue}if(o===","&&!l){i.push(n.trim()),n="";continue}n+=o}return i.push(n.trim()),i}function UC({content:e}){const i=e.trim().split(`
|
|
161
|
+
`).filter(Boolean);if(i.length===0)return p.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:"Empty CSV"});const n=km(i[0]),l=i.slice(1).map(o=>km(o));return p.jsx("div",{className:"overflow-auto",children:p.jsxs("table",{className:"text-sm border-collapse w-full",children:[p.jsx("thead",{children:p.jsx("tr",{children:n.map((o,c)=>p.jsx("th",{className:"border border-[var(--border)] px-3 py-1.5 text-left font-semibold bg-[var(--bg-sidebar)] text-[var(--text-primary)]",children:o.trim()},c))})}),p.jsx("tbody",{children:l.map((o,c)=>p.jsx("tr",{className:"even:bg-[var(--bg-sidebar)]",children:o.map((d,_)=>p.jsx("td",{className:"border border-[var(--border)] px-3 py-1.5 text-[var(--text-primary)]",children:d.trim()},_))},c))})]})})}const _o="h-full bg-[var(--bg-secondary)] flex flex-col";function WC({output:e}){return e.status==="empty"?p.jsx(qC,{}):e.status==="processing"?p.jsx(IC,{outcome:e.outcome,fileCount:e.fileCount}):e.status==="error"?p.jsx(KC,{message:e.message}):p.jsx(PC,{output:e})}function PC({output:e}){const{selectedOutcome:i}=Li(),[n,l]=E.useState(!1),[o,c]=E.useState(""),[d,_]=E.useState(null),g=e.path.split("/").pop()||e.path,f=e.path.endsWith(".csv"),x=()=>{navigator.clipboard.writeText(e.content)},v=()=>{const w=new Blob([e.content],{type:"text/plain"}),S=URL.createObjectURL(w),R=document.createElement("a");R.href=S,R.download=g,R.click(),URL.revokeObjectURL(S)},b=()=>{if(d||!o.trim())return;const w=o.trim();xS({id:crypto.randomUUID(),name:w,outcomeKey:i||"custom",content:e.content,createdAt:Date.now()}),_(w)};return p.jsxs("div",{className:`${_o}`,children:[p.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-[var(--border)] shrink-0",children:[p.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)] truncate",children:g}),p.jsxs("div",{className:"flex gap-2 ml-2 shrink-0",children:[p.jsx("button",{onClick:x,"aria-label":"Copy output to clipboard",className:"text-xs px-3 py-1 rounded border border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-sidebar)] transition-colors",children:"Copy"}),p.jsx("button",{onClick:v,"aria-label":"Download output file",className:"text-xs px-3 py-1 rounded border border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-sidebar)] transition-colors",children:"Download"})]})]}),p.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 min-h-0",children:f?p.jsx(UC,{content:e.content}):p.jsx("div",{className:"output-prose",dangerouslySetInnerHTML:{__html:HC(Me.parse(e.content,{async:!1}))}})}),p.jsxs("div",{className:"shrink-0 px-4 py-1.5 border-t border-[var(--border)] text-xs text-green-600",children:["✓ Saved to ",e.path]}),p.jsx("div",{className:"shrink-0 px-4 py-2 border-t border-[var(--border)]",children:d?p.jsxs("p",{className:"text-xs text-indigo-600 font-medium",children:["⭐ Saved as ‘",d,"’"]}):n?p.jsxs("div",{className:"flex gap-2",children:[p.jsx("input",{type:"text",value:o,onChange:w=>c(w.target.value),placeholder:"Template name...",className:"flex-1 text-xs px-2 py-1 rounded border border-[var(--border)] bg-[var(--bg-secondary)] text-[var(--text-primary)] outline-none focus:ring-1 focus:ring-indigo-400",autoFocus:!0,onKeyDown:w=>{w.key==="Enter"&&b()}}),p.jsx("button",{onClick:b,className:"text-xs px-3 py-1 rounded bg-indigo-600 text-white font-medium hover:bg-indigo-700 transition-colors",children:"Save"})]}):p.jsx("button",{onClick:()=>l(!0),className:"w-full text-xs py-2 rounded-lg border border-dashed transition-colors hover:border-indigo-400 hover:text-indigo-600",style:{borderColor:"var(--border)",color:"var(--text-secondary)",background:"transparent",cursor:"pointer"},children:"⭐ Like this style? Save it as a template"})})]})}function qC(){const{loadOutput:e}=Li(),[i,n]=E.useState(!1),l=async()=>{n(!0);try{const c=await(await fetch("/api/pick-file")).json();if(c?.path){const _=await(await fetch(`/api/read-file?path=${encodeURIComponent(c.path)}`)).json();(_?.content||_?.binary)&&await e(c.path)}}catch{}n(!1)};return p.jsxs("div",{className:`${_o} items-center justify-center gap-3`,children:[p.jsx("span",{className:"text-4xl",children:"📄"}),p.jsx("p",{className:"text-base font-medium text-[var(--text-primary)]",children:"Your output will appear here"}),p.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:"Pick a folder and outcome, then hit Go"}),p.jsx("button",{onClick:l,disabled:i,style:{padding:"8px 20px",borderRadius:"10px",border:"1px solid var(--border)",background:"transparent",color:"var(--text-secondary)",fontSize:"13px",fontWeight:500,cursor:i?"not-allowed":"pointer",marginTop:"8px",transition:"all 0.15s"},children:i?"Opening...":"📂 Open a document"})]})}function IC({outcome:e,fileCount:i}){const{folderPath:n,loadOutput:l}=Li(),[o,c]=E.useState(!1),d=async()=>{if(n){c(!0);try{const g=await(await fetch(`/api/latest-output?folderPath=${encodeURIComponent(n)}`)).json();g?.path&&await l(g.path)}catch{}c(!1)}};return p.jsxs("div",{className:`${_o} items-center justify-center gap-2`,children:[p.jsx("span",{className:"text-4xl animate-pulse",children:"⏳"}),p.jsxs("p",{className:"text-base font-medium text-[var(--text-primary)]",children:[e," — ",i," documents..."]}),p.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:"Claude is working — check the terminal for progress"}),p.jsx("button",{onClick:d,disabled:o,style:{padding:"8px 18px",borderRadius:"8px",border:"1px solid var(--border)",background:"transparent",color:"var(--text-secondary)",fontSize:"12px",fontWeight:500,cursor:o?"not-allowed":"pointer",marginTop:"12px"},children:o?"Checking...":"Check if done"})]})}function KC({message:e}){const{folderPath:i,loadOutput:n}=Li(),[l,o]=E.useState(!1),[c,d]=E.useState(!1),_=async()=>{if(i){o(!0),d(!1);try{const f=await(await fetch(`/api/latest-output?folderPath=${encodeURIComponent(i)}`)).json();f?.path?await n(f.path):d(!0)}catch{d(!0)}o(!1)}};return p.jsxs("div",{className:`${_o} items-center justify-center gap-3`,children:[p.jsx("span",{className:"text-4xl",children:"⚠️"}),p.jsx("p",{style:{fontSize:"13px",color:"#dc2626",textAlign:"center",maxWidth:"300px"},children:e}),p.jsx("button",{onClick:_,disabled:l,style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:"#6366f1",color:"#fff",fontSize:"14px",fontWeight:600,cursor:l?"not-allowed":"pointer",opacity:l?.6:1,marginTop:"8px"},children:l?"Checking...":"Check for output"}),c&&p.jsx("p",{style:{fontSize:"12px",color:"#f59e0b",textAlign:"center"},children:"No output file found yet. Claude may still be working — try again in a moment."}),p.jsx("p",{style:{fontSize:"11px",color:"#9ca3af",textAlign:"center"},children:"Click to check if Claude has finished writing the output file"})]})}const Iv=E.createContext(null);function $C({children:e}){const[i,n]=E.useState("zarlo"),[l,o]=E.useState([]),[c,d]=E.useState([]),[_,g]=E.useState(!1),[f,x]=E.useState(null),v=E.useRef(null);E.useEffect(()=>{fetch("/api/agent-config").then(W=>W.json()).then(W=>x(W.hasApiKey)).catch(()=>x(!1))},[]),E.useEffect(()=>{fetch(`/api/agent-history?agentId=${i}`).then(W=>W.json()).then(W=>o(W.messages||[])).catch(()=>o([])),fetch(`/api/agent-tasks?agentId=${i}`).then(W=>W.json()).then(W=>d(W.tasks||[])).catch(()=>d([]))},[i]);const b=E.useCallback(async W=>{W!==i&&(await fetch("/api/agent-history",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agentId:i,messages:l})}).catch(()=>{}),n(W))},[i,l]),w=E.useCallback(async W=>{if(_||!W.trim())return;const j={role:"user",content:W.trim(),timestamp:Date.now()},C=[...l,j];o(C),g(!0);const O={role:"assistant",content:"",timestamp:Date.now()};o(G=>[...G,O]);try{const G=new AbortController;v.current=G;const ae=(await fetch("/api/agent-chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agentId:i,message:W.trim(),history:C.slice(0,-1)}),signal:G.signal})).body?.getReader(),pe=new TextDecoder;let Oe="";if(ae){let V="";for(;;){const{done:X,value:te}=await ae.read();if(X)break;V+=pe.decode(te,{stream:!0});const Q=V.split(`
|
|
162
|
+
`);V=Q.pop()??"";for(const B of Q)if(B.startsWith("data: "))try{const q=JSON.parse(B.slice(6));q.delta&&(Oe+=q.delta,o(I=>{const ne=[...I];return ne[ne.length-1]={...ne[ne.length-1],content:Oe},ne})),q.error&&o(I=>{const ne=[...I];return ne[ne.length-1]={role:"assistant",content:`Error: ${q.error}`,timestamp:Date.now()},ne})}catch{}}}const he=[...C,{role:"assistant",content:Oe,timestamp:Date.now()}];o(he),fetch("/api/agent-history",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agentId:i,messages:he})}).catch(()=>{})}catch(G){G.name!=="AbortError"&&o(Z=>{const ae=[...Z];return ae[ae.length-1]={role:"assistant",content:"Failed to get a response. Check your API key and try again.",timestamp:Date.now()},ae})}g(!1),v.current=null},[i,l,_]),S=E.useCallback(W=>{const j={id:`t-${Date.now()}`,title:W,status:"pending",createdAt:Date.now()},C=[...c,j];d(C),fetch("/api/agent-tasks",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agentId:i,tasks:C})}).catch(()=>{})},[i,c]),R=E.useCallback(W=>{const j=c.map(C=>C.id===W?{...C,status:C.status==="done"?"pending":"done",completedAt:C.status==="pending"?Date.now():void 0}:C);d(j),fetch("/api/agent-tasks",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agentId:i,tasks:j})}).catch(()=>{})},[i,c]),z=E.useCallback(W=>{const j=c.filter(C=>C.id!==W);d(j),fetch("/api/agent-tasks",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agentId:i,tasks:j})}).catch(()=>{})},[i,c]),A=E.useCallback(async W=>{try{if((await fetch("/api/agent-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:W})})).ok)return x(!0),!0}catch{}return!1},[]);return p.jsx(Iv.Provider,{value:{activeAgent:i,setActiveAgent:b,messages:l,tasks:c,isStreaming:_,hasApiKey:f,sendMessage:w,addTask:S,toggleTask:R,deleteTask:z,saveApiKey:A},children:e})}function cd(){const e=E.useContext(Iv);if(!e)throw new Error("useAgents must be used within AgentsProvider");return e}const YC=[{id:"zarlo",name:"Zarlo",role:"Strategy & Research",color:"#8b5cf6",initial:"Z"},{id:"perry",name:"Perry",role:"Offer Specialist",color:"#3b82f6",initial:"P"}];function FC(){const{activeAgent:e,setActiveAgent:i,tasks:n,addTask:l,toggleTask:o,deleteTask:c}=cd(),[d,_]=E.useState("");function g(){const f=d.trim();f&&(l(f),_(""))}return p.jsxs("div",{style:{width:"280px",flexShrink:0,background:"#fff",borderRight:"1px solid #e5e7eb",display:"flex",flexDirection:"column",height:"100%",overflowY:"auto"},children:[p.jsxs("div",{style:{padding:"20px",borderBottom:"1px solid #e5e7eb"},children:[p.jsx("div",{style:{fontSize:"11px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em",color:"#9ca3af",marginBottom:"12px"},children:"Team"}),p.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:YC.map(f=>{const x=e===f.id;return p.jsxs("button",{onClick:()=>i(f.id),style:{display:"flex",alignItems:"center",gap:"12px",padding:"10px 12px",borderRadius:"10px",background:x?`${f.color}08`:"transparent",border:"none",cursor:"pointer",width:"100%",textAlign:"left",borderLeft:x?`3px solid ${f.color}`:"3px solid transparent",transition:"all 0.15s"},children:[p.jsx("div",{style:{width:"36px",height:"36px",borderRadius:"50%",background:f.color,color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"15px",fontWeight:700,flexShrink:0},children:f.initial}),p.jsxs("div",{children:[p.jsx("div",{style:{fontSize:"14px",fontWeight:600,color:"#1a1a2e"},children:f.name}),p.jsx("div",{style:{fontSize:"11px",color:"#9ca3af"},children:f.role})]})]},f.id)})})]}),p.jsxs("div",{style:{padding:"20px",borderBottom:"1px solid #e5e7eb",flex:1},children:[p.jsx("div",{style:{fontSize:"11px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em",color:"#9ca3af",marginBottom:"12px"},children:"Tasks"}),p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:[n.map(f=>p.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"8px",padding:"6px 8px",borderRadius:"6px",background:f.status==="done"?"rgba(22,163,74,0.04)":"transparent"},children:[p.jsx("input",{type:"checkbox",checked:f.status==="done",onChange:()=>o(f.id),style:{marginTop:"3px",cursor:"pointer",accentColor:"#5e17eb"}}),p.jsx("span",{style:{flex:1,fontSize:"13px",color:f.status==="done"?"#9ca3af":"#374151",textDecoration:f.status==="done"?"line-through":"none",lineHeight:1.4},children:f.title}),p.jsx("button",{onClick:()=>c(f.id),style:{background:"none",border:"none",color:"#d1d5db",cursor:"pointer",fontSize:"14px",padding:"0 2px",lineHeight:1},onMouseEnter:x=>x.currentTarget.style.color="#ef4444",onMouseLeave:x=>x.currentTarget.style.color="#d1d5db",children:"×"})]},f.id)),n.length===0&&p.jsx("p",{style:{fontSize:"12px",color:"#d1d5db",textAlign:"center",padding:"8px 0"},children:"No tasks yet"}),p.jsx("div",{style:{display:"flex",gap:"6px",marginTop:"8px"},children:p.jsx("input",{value:d,onChange:f=>_(f.target.value),onKeyDown:f=>{f.key==="Enter"&&g()},placeholder:"+ Add task",style:{flex:1,padding:"6px 10px",fontSize:"12px",borderRadius:"6px",border:"1px solid #e5e7eb",outline:"none",background:"#fafafa"}})})]})]}),p.jsx(Iu,{})]})}function GC(e){return e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"").replace(/\bon\w+\s*=\s*"[^"]*"/gi,"").replace(/javascript\s*:/gi,"")}function XC({message:e,agentName:i,agentColor:n}){const l=e.role==="user",o=E.useMemo(()=>{if(l)return null;try{return GC(Me.parse(e.content,{async:!1}))}catch{return e.content}},[e.content,l]);return l?p.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginBottom:"12px"},children:p.jsx("div",{style:{maxWidth:"75%",padding:"12px 16px",background:"#5e17eb",color:"#fff",borderRadius:"16px 16px 4px 16px",fontSize:"14px",lineHeight:1.6,whiteSpace:"pre-wrap"},children:e.content})}):p.jsxs("div",{style:{display:"flex",gap:"10px",marginBottom:"12px",alignItems:"flex-start"},children:[p.jsx("div",{style:{width:"28px",height:"28px",borderRadius:"50%",background:n||"#8b5cf6",color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"12px",fontWeight:700,flexShrink:0,marginTop:"2px"},children:i?.[0]||"A"}),p.jsxs("div",{style:{maxWidth:"75%"},children:[p.jsx("div",{style:{fontSize:"12px",fontWeight:600,color:n||"#8b5cf6",marginBottom:"4px"},children:i||"Agent"}),e.content?p.jsx("div",{style:{padding:"12px 16px",background:"#fff",color:"#1a1a2e",borderRadius:"4px 16px 16px 16px",fontSize:"14px",lineHeight:1.6,border:"1px solid #e5e7eb"},children:o?p.jsx("div",{className:"output-prose",dangerouslySetInnerHTML:{__html:o}}):p.jsx("span",{style:{whiteSpace:"pre-wrap"},children:e.content})}):p.jsx("div",{style:{padding:"12px 16px",background:"#fff",borderRadius:"4px 16px 16px 16px",border:"1px solid #e5e7eb"},children:p.jsx("div",{style:{display:"flex",gap:"4px"},children:[0,1,2].map(c=>p.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",background:n||"#8b5cf6",opacity:.4,animation:`typingDot 1.4s ease-in-out ${c*.2}s infinite`}},c))})})]})]})}function VC(){const{saveApiKey:e}=cd(),[i,n]=E.useState(""),[l,o]=E.useState(!1),[c,d]=E.useState(!1),[_,g]=E.useState(null);async function f(){if(!i.trim()||!i.startsWith("sk-")){g("API key should start with sk-");return}d(!0),g(null),await e(i.trim())||g("Failed to save key"),d(!1)}return p.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",background:"#fefcf9"},children:p.jsxs("div",{style:{maxWidth:"420px",width:"100%",padding:"40px",background:"#fff",borderRadius:"24px",border:"1px solid #e5e7eb",boxShadow:"0 8px 24px rgba(0,0,0,0.06)"},children:[p.jsxs("div",{style:{textAlign:"center",marginBottom:"24px"},children:[p.jsx("div",{style:{fontSize:"40px",marginBottom:"12px"},children:"🔑"}),p.jsx("h2",{style:{fontSize:"20px",fontWeight:700,color:"#1a1a2e",marginBottom:"8px"},children:"Connect to Claude"}),p.jsx("p",{style:{fontSize:"14px",color:"#6b7280"},children:"Paste your Anthropic API key to start chatting with agents"})]}),p.jsxs("div",{style:{position:"relative",marginBottom:"16px"},children:[p.jsx("input",{type:l?"text":"password",value:i,onChange:x=>{n(x.target.value),g(null)},onKeyDown:x=>{x.key==="Enter"&&f()},placeholder:"sk-ant-...",style:{width:"100%",padding:"12px 48px 12px 16px",fontSize:"14px",borderRadius:"12px",border:"1px solid #e5e7eb",outline:"none",fontFamily:"'SF Mono', monospace",background:"#fafafa"}}),p.jsx("button",{onClick:()=>o(!l),style:{position:"absolute",right:"12px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:"pointer",color:"#9ca3af",fontSize:"13px"},children:l?"Hide":"Show"})]}),_&&p.jsx("p",{style:{fontSize:"13px",color:"#ef4444",marginBottom:"12px"},children:_}),p.jsx("button",{onClick:f,disabled:c||!i.trim(),style:{width:"100%",padding:"14px",background:"#5e17eb",color:"#fff",borderRadius:"12px",border:"none",fontSize:"15px",fontWeight:600,cursor:c?"not-allowed":"pointer",opacity:c||!i.trim()?.6:1},children:c?"Saving...":"Save & Connect"}),p.jsx("a",{href:"https://console.anthropic.com/settings/keys",target:"_blank",rel:"noopener noreferrer",style:{display:"block",textAlign:"center",marginTop:"16px",fontSize:"13px",color:"#8b5cf6",textDecoration:"none"},children:"Get an API key at console.anthropic.com →"})]})})}const ZC={zarlo:{name:"Zarlo",role:"Strategy & Research",color:"#8b5cf6"},perry:{name:"Perry",role:"Offer Specialist",color:"#3b82f6"}};function QC(){const{activeAgent:e,messages:i,isStreaming:n,hasApiKey:l,sendMessage:o}=cd(),[c,d]=E.useState(""),_=E.useRef(null),g=E.useRef(null),f=ZC[e];if(E.useEffect(()=>{_.current?.scrollIntoView({behavior:"smooth"})},[i]),E.useEffect(()=>{g.current?.focus()},[e]),l===null)return null;if(l===!1)return p.jsx(VC,{});function x(){!c.trim()||n||(o(c),d(""),g.current&&(g.current.style.height="auto"))}function v(w){w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),x())}function b(w){d(w.target.value);const S=w.target;S.style.height="auto",S.style.height=Math.min(S.scrollHeight,150)+"px"}return p.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",background:"#fefcf9",height:"100%"},children:[p.jsxs("div",{style:{padding:"16px 24px",borderBottom:"1px solid #e5e7eb",display:"flex",alignItems:"center",gap:"12px",background:"#fff",flexShrink:0},children:[p.jsx("div",{style:{width:"10px",height:"10px",borderRadius:"50%",background:f.color}}),p.jsxs("div",{children:[p.jsxs("div",{style:{fontSize:"15px",fontWeight:600,color:"#1a1a2e"},children:["Chat with ",f.name]}),p.jsx("div",{style:{fontSize:"12px",color:"#9ca3af"},children:f.role})]})]}),p.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"24px",minHeight:0},children:[i.length===0&&p.jsxs("div",{style:{textAlign:"center",padding:"60px 20px",color:"#9ca3af"},children:[p.jsx("div",{style:{fontSize:"40px",marginBottom:"12px"},children:e==="zarlo"?"💜":"💙"}),p.jsxs("p",{style:{fontSize:"15px",fontWeight:500,marginBottom:"4px"},children:["Start a conversation with ",f.name]}),p.jsx("p",{style:{fontSize:"13px"},children:e==="zarlo"?"Ask about strategy, research, or business direction":"Ask about offers, pricing, guarantees, or value stacks"})]}),i.map((w,S)=>p.jsx(XC,{message:w,agentName:w.role==="assistant"?f.name:void 0,agentColor:w.role==="assistant"?f.color:void 0},S)),p.jsx("div",{ref:_})]}),p.jsx("div",{style:{padding:"16px 24px",borderTop:"1px solid #e5e7eb",background:"#fff",flexShrink:0},children:p.jsxs("div",{style:{display:"flex",gap:"10px",alignItems:"flex-end"},children:[p.jsx("textarea",{ref:g,value:c,onChange:b,onKeyDown:v,disabled:n,placeholder:n?`${f.name} is thinking...`:`Message ${f.name}...`,rows:1,style:{flex:1,padding:"12px 16px",fontSize:"14px",borderRadius:"12px",border:"1px solid #e5e7eb",outline:"none",resize:"none",fontFamily:"inherit",background:n?"#f9fafb":"#fff",color:"#1a1a2e",lineHeight:1.5,maxHeight:"150px",animation:n?"pulse 2s ease-in-out infinite":"none"}}),p.jsx("button",{onClick:x,disabled:n||!c.trim(),style:{padding:"12px 20px",background:"#5e17eb",color:"#fff",borderRadius:"12px",border:"none",fontSize:"14px",fontWeight:600,cursor:n||!c.trim()?"not-allowed":"pointer",opacity:n||!c.trim()?.5:1,flexShrink:0},children:"Send"})]})}),p.jsx("style",{children:`
|
|
163
|
+
@keyframes pulse {
|
|
164
|
+
0%, 100% { opacity: 1; }
|
|
165
|
+
50% { opacity: 0.7; }
|
|
166
|
+
}
|
|
167
|
+
@keyframes typingDot {
|
|
168
|
+
0%, 100% { opacity: 0.3; }
|
|
169
|
+
50% { opacity: 1; }
|
|
170
|
+
}
|
|
171
|
+
`})]})}function JC(){return p.jsx($C,{children:p.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[p.jsx(FC,{}),p.jsx(QC,{})]})})}function e2(){const[e,i]=E.useState(!0),{mode:n}=Et(),l=Li();return Ox(),E.useEffect(()=>(n==="document"?document.documentElement.classList.add("doc-mode"):document.documentElement.classList.remove("doc-mode"),()=>document.documentElement.classList.remove("doc-mode")),[n]),n==="agents"?p.jsxs("div",{style:{height:"100%",display:"flex",flexDirection:"column"},children:[p.jsx(w_,{}),p.jsx(JC,{})]}):p.jsxs("div",{className:"h-full flex flex-col",style:{background:"#f8fafc"},children:[p.jsx(w_,{}),p.jsx(Gx,{}),p.jsxs("div",{className:"flex-1 flex min-h-0",children:[p.jsx(Xx,{open:e,onToggle:()=>i(!e)}),p.jsx(RS,{open:e}),p.jsxs("div",{className:"flex-1 flex min-w-0",children:[p.jsx("div",{className:"flex-1 min-w-0 flex flex-col",style:{background:"#1a1a2e"},children:p.jsx(Fw,{})}),p.jsx("div",{style:{width:"45%",flexShrink:0,borderLeft:"1px solid #e5e7eb"},children:n==="developer"?p.jsx(Gw,{}):p.jsx(WC,{output:l.output})})]})]})]})}function t2(){return p.jsx(Mx,{children:p.jsx(e2,{})})}function i2(){const{path:e,editingBrain:i,setEditingBrain:n,setProjectPath:l}=Et();return i&&e?p.jsx("div",{className:"h-full flex items-center justify-center",style:{background:"var(--bg-primary)"},children:p.jsx("div",{className:"w-full max-w-[600px] px-8",children:p.jsx(Lm,{onDone:()=>n(!1)})})}):e?p.jsx(t2,{}):p.jsx(Fx,{onProjectSelected:l})}function s2(){return p.jsx(kx,{children:p.jsx(Tx,{children:p.jsx(i2,{})})})}bx.createRoot(document.getElementById("root")).render(p.jsx(E.StrictMode,{children:p.jsx(s2,{})}));
|