nomoreide 0.1.55 → 0.1.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,215 @@
1
+ (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))n(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&n(u)}).observe(document,{childList:!0,subtree:!0});function s(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function n(o){if(o.ep)return;o.ep=!0;const l=s(o);fetch(o.href,l)}})();function VA(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Rp={exports:{}},xc={};var By;function GA(){if(By)return xc;By=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function s(n,o,l){var u=null;if(l!==void 0&&(u=""+l),o.key!==void 0&&(u=""+o.key),"key"in o){l={};for(var h in o)h!=="key"&&(l[h]=o[h])}else l=o;return o=l.ref,{$$typeof:e,type:n,key:u,ref:o!==void 0?o:null,props:l}}return xc.Fragment=t,xc.jsx=s,xc.jsxs=s,xc}var Iy;function WA(){return Iy||(Iy=1,Rp.exports=GA()),Rp.exports}var r=WA(),Mp={exports:{}},Ge={};var Py;function KA(){if(Py)return Ge;Py=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),x=Symbol.iterator;function _(L){return L===null||typeof L!="object"?null:(L=x&&L[x]||L["@@iterator"],typeof L=="function"?L:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,k={};function C(L,Q,re){this.props=L,this.context=Q,this.refs=k,this.updater=re||S}C.prototype.isReactComponent={},C.prototype.setState=function(L,Q){if(typeof L!="object"&&typeof L!="function"&&L!=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,L,Q,"setState")},C.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function T(){}T.prototype=C.prototype;function E(L,Q,re){this.props=L,this.context=Q,this.refs=k,this.updater=re||S}var j=E.prototype=new T;j.constructor=E,w(j,C.prototype),j.isPureReactComponent=!0;var M=Array.isArray;function z(){}var O={H:null,A:null,T:null,S:null},A=Object.prototype.hasOwnProperty;function D(L,Q,re){var he=re.ref;return{$$typeof:e,type:L,key:Q,ref:he!==void 0?he:null,props:re}}function B(L,Q){return D(L.type,Q,L.props)}function P(L){return typeof L=="object"&&L!==null&&L.$$typeof===e}function H(L){var Q={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(re){return Q[re]})}var $=/\/+/g;function q(L,Q){return typeof L=="object"&&L!==null&&L.key!=null?H(""+L.key):Q.toString(36)}function V(L){switch(L.status){case"fulfilled":return L.value;case"rejected":throw L.reason;default:switch(typeof L.status=="string"?L.then(z,z):(L.status="pending",L.then(function(Q){L.status==="pending"&&(L.status="fulfilled",L.value=Q)},function(Q){L.status==="pending"&&(L.status="rejected",L.reason=Q)})),L.status){case"fulfilled":return L.value;case"rejected":throw L.reason}}throw L}function I(L,Q,re,he,fe){var pe=typeof L;(pe==="undefined"||pe==="boolean")&&(L=null);var we=!1;if(L===null)we=!0;else switch(pe){case"bigint":case"string":case"number":we=!0;break;case"object":switch(L.$$typeof){case e:case t:we=!0;break;case p:return we=L._init,I(we(L._payload),Q,re,he,fe)}}if(we)return fe=fe(L),we=he===""?"."+q(L,0):he,M(fe)?(re="",we!=null&&(re=we.replace($,"$&/")+"/"),I(fe,Q,re,"",function(We){return We})):fe!=null&&(P(fe)&&(fe=B(fe,re+(fe.key==null||L&&L.key===fe.key?"":(""+fe.key).replace($,"$&/")+"/")+we)),Q.push(fe)),1;we=0;var Le=he===""?".":he+":";if(M(L))for(var ve=0;ve<L.length;ve++)he=L[ve],pe=Le+q(he,ve),we+=I(he,Q,re,pe,fe);else if(ve=_(L),typeof ve=="function")for(L=ve.call(L),ve=0;!(he=L.next()).done;)he=he.value,pe=Le+q(he,ve++),we+=I(he,Q,re,pe,fe);else if(pe==="object"){if(typeof L.then=="function")return I(V(L),Q,re,he,fe);throw Q=String(L),Error("Objects are not valid as a React child (found: "+(Q==="[object Object]"?"object with keys {"+Object.keys(L).join(", ")+"}":Q)+"). If you meant to render a collection of children, use an array instead.")}return we}function W(L,Q,re){if(L==null)return L;var he=[],fe=0;return I(L,he,"","",function(pe){return Q.call(re,pe,fe++)}),he}function Z(L){if(L._status===-1){var Q=L._result;Q=Q(),Q.then(function(re){(L._status===0||L._status===-1)&&(L._status=1,L._result=re)},function(re){(L._status===0||L._status===-1)&&(L._status=2,L._result=re)}),L._status===-1&&(L._status=0,L._result=Q)}if(L._status===1)return L._result.default;throw L._result}var K=typeof reportError=="function"?reportError:function(L){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof L=="object"&&L!==null&&typeof L.message=="string"?String(L.message):String(L),error:L});if(!window.dispatchEvent(Q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",L);return}console.error(L)},te={map:W,forEach:function(L,Q,re){W(L,function(){Q.apply(this,arguments)},re)},count:function(L){var Q=0;return W(L,function(){Q++}),Q},toArray:function(L){return W(L,function(Q){return Q})||[]},only:function(L){if(!P(L))throw Error("React.Children.only expected to receive a single React element child.");return L}};return Ge.Activity=g,Ge.Children=te,Ge.Component=C,Ge.Fragment=s,Ge.Profiler=o,Ge.PureComponent=E,Ge.StrictMode=n,Ge.Suspense=m,Ge.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,Ge.__COMPILER_RUNTIME={__proto__:null,c:function(L){return O.H.useMemoCache(L)}},Ge.cache=function(L){return function(){return L.apply(null,arguments)}},Ge.cacheSignal=function(){return null},Ge.cloneElement=function(L,Q,re){if(L==null)throw Error("The argument must be a React element, but you passed "+L+".");var he=w({},L.props),fe=L.key;if(Q!=null)for(pe in Q.key!==void 0&&(fe=""+Q.key),Q)!A.call(Q,pe)||pe==="key"||pe==="__self"||pe==="__source"||pe==="ref"&&Q.ref===void 0||(he[pe]=Q[pe]);var pe=arguments.length-2;if(pe===1)he.children=re;else if(1<pe){for(var we=Array(pe),Le=0;Le<pe;Le++)we[Le]=arguments[Le+2];he.children=we}return D(L.type,fe,he)},Ge.createContext=function(L){return L={$$typeof:u,_currentValue:L,_currentValue2:L,_threadCount:0,Provider:null,Consumer:null},L.Provider=L,L.Consumer={$$typeof:l,_context:L},L},Ge.createElement=function(L,Q,re){var he,fe={},pe=null;if(Q!=null)for(he in Q.key!==void 0&&(pe=""+Q.key),Q)A.call(Q,he)&&he!=="key"&&he!=="__self"&&he!=="__source"&&(fe[he]=Q[he]);var we=arguments.length-2;if(we===1)fe.children=re;else if(1<we){for(var Le=Array(we),ve=0;ve<we;ve++)Le[ve]=arguments[ve+2];fe.children=Le}if(L&&L.defaultProps)for(he in we=L.defaultProps,we)fe[he]===void 0&&(fe[he]=we[he]);return D(L,pe,fe)},Ge.createRef=function(){return{current:null}},Ge.forwardRef=function(L){return{$$typeof:h,render:L}},Ge.isValidElement=P,Ge.lazy=function(L){return{$$typeof:p,_payload:{_status:-1,_result:L},_init:Z}},Ge.memo=function(L,Q){return{$$typeof:d,type:L,compare:Q===void 0?null:Q}},Ge.startTransition=function(L){var Q=O.T,re={};O.T=re;try{var he=L(),fe=O.S;fe!==null&&fe(re,he),typeof he=="object"&&he!==null&&typeof he.then=="function"&&he.then(z,K)}catch(pe){K(pe)}finally{Q!==null&&re.types!==null&&(Q.types=re.types),O.T=Q}},Ge.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()},Ge.use=function(L){return O.H.use(L)},Ge.useActionState=function(L,Q,re){return O.H.useActionState(L,Q,re)},Ge.useCallback=function(L,Q){return O.H.useCallback(L,Q)},Ge.useContext=function(L){return O.H.useContext(L)},Ge.useDebugValue=function(){},Ge.useDeferredValue=function(L,Q){return O.H.useDeferredValue(L,Q)},Ge.useEffect=function(L,Q){return O.H.useEffect(L,Q)},Ge.useEffectEvent=function(L){return O.H.useEffectEvent(L)},Ge.useId=function(){return O.H.useId()},Ge.useImperativeHandle=function(L,Q,re){return O.H.useImperativeHandle(L,Q,re)},Ge.useInsertionEffect=function(L,Q){return O.H.useInsertionEffect(L,Q)},Ge.useLayoutEffect=function(L,Q){return O.H.useLayoutEffect(L,Q)},Ge.useMemo=function(L,Q){return O.H.useMemo(L,Q)},Ge.useOptimistic=function(L,Q){return O.H.useOptimistic(L,Q)},Ge.useReducer=function(L,Q,re){return O.H.useReducer(L,Q,re)},Ge.useRef=function(L){return O.H.useRef(L)},Ge.useState=function(L){return O.H.useState(L)},Ge.useSyncExternalStore=function(L,Q,re){return O.H.useSyncExternalStore(L,Q,re)},Ge.useTransition=function(){return O.H.useTransition()},Ge.version="19.2.6",Ge}var $y;function Hb(){return $y||($y=1,Mp.exports=KA()),Mp.exports}var y=Hb(),Dp={exports:{}},vc={},Op={exports:{}},Lp={};var Hy;function YA(){return Hy||(Hy=1,(function(e){function t(I,W){var Z=I.length;I.push(W);e:for(;0<Z;){var K=Z-1>>>1,te=I[K];if(0<o(te,W))I[K]=W,I[Z]=te,Z=K;else break e}}function s(I){return I.length===0?null:I[0]}function n(I){if(I.length===0)return null;var W=I[0],Z=I.pop();if(Z!==W){I[0]=Z;e:for(var K=0,te=I.length,L=te>>>1;K<L;){var Q=2*(K+1)-1,re=I[Q],he=Q+1,fe=I[he];if(0>o(re,Z))he<te&&0>o(fe,re)?(I[K]=fe,I[he]=Z,K=he):(I[K]=re,I[Q]=Z,K=Q);else if(he<te&&0>o(fe,Z))I[K]=fe,I[he]=Z,K=he;else break e}}return W}function o(I,W){var Z=I.sortIndex-W.sortIndex;return Z!==0?Z:I.id-W.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var u=Date,h=u.now();e.unstable_now=function(){return u.now()-h}}var m=[],d=[],p=1,g=null,x=3,_=!1,S=!1,w=!1,k=!1,C=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function j(I){for(var W=s(d);W!==null;){if(W.callback===null)n(d);else if(W.startTime<=I)n(d),W.sortIndex=W.expirationTime,t(m,W);else break;W=s(d)}}function M(I){if(w=!1,j(I),!S)if(s(m)!==null)S=!0,z||(z=!0,H());else{var W=s(d);W!==null&&V(M,W.startTime-I)}}var z=!1,O=-1,A=5,D=-1;function B(){return k?!0:!(e.unstable_now()-D<A)}function P(){if(k=!1,z){var I=e.unstable_now();D=I;var W=!0;try{e:{S=!1,w&&(w=!1,T(O),O=-1),_=!0;var Z=x;try{t:{for(j(I),g=s(m);g!==null&&!(g.expirationTime>I&&B());){var K=g.callback;if(typeof K=="function"){g.callback=null,x=g.priorityLevel;var te=K(g.expirationTime<=I);if(I=e.unstable_now(),typeof te=="function"){g.callback=te,j(I),W=!0;break t}g===s(m)&&n(m),j(I)}else n(m);g=s(m)}if(g!==null)W=!0;else{var L=s(d);L!==null&&V(M,L.startTime-I),W=!1}}break e}finally{g=null,x=Z,_=!1}W=void 0}}finally{W?H():z=!1}}}var H;if(typeof E=="function")H=function(){E(P)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,q=$.port2;$.port1.onmessage=P,H=function(){q.postMessage(null)}}else H=function(){C(P,0)};function V(I,W){O=C(function(){I(e.unstable_now())},W)}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(I){I.callback=null},e.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<I?Math.floor(1e3/I):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function(I){switch(x){case 1:case 2:case 3:var W=3;break;default:W=x}var Z=x;x=W;try{return I()}finally{x=Z}},e.unstable_requestPaint=function(){k=!0},e.unstable_runWithPriority=function(I,W){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var Z=x;x=I;try{return W()}finally{x=Z}},e.unstable_scheduleCallback=function(I,W,Z){var K=e.unstable_now();switch(typeof Z=="object"&&Z!==null?(Z=Z.delay,Z=typeof Z=="number"&&0<Z?K+Z:K):Z=K,I){case 1:var te=-1;break;case 2:te=250;break;case 5:te=1073741823;break;case 4:te=1e4;break;default:te=5e3}return te=Z+te,I={id:p++,callback:W,priorityLevel:I,startTime:Z,expirationTime:te,sortIndex:-1},Z>K?(I.sortIndex=Z,t(d,I),s(m)===null&&I===s(d)&&(w?(T(O),O=-1):w=!0,V(M,Z-K))):(I.sortIndex=te,t(m,I),S||_||(S=!0,z||(z=!0,H()))),I},e.unstable_shouldYield=B,e.unstable_wrapCallback=function(I){var W=x;return function(){var Z=x;x=W;try{return I.apply(this,arguments)}finally{x=Z}}}})(Lp)),Lp}var Uy;function XA(){return Uy||(Uy=1,Op.exports=YA()),Op.exports}var zp={exports:{}},Fs={};var Fy;function ZA(){if(Fy)return Fs;Fy=1;var e=Hb();function t(m){var d="https://react.dev/errors/"+m;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)d+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+m+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(){}var n={d:{f:s,r:function(){throw Error(t(522))},D:s,C:s,L:s,m:s,X:s,S:s,M:s},p:0,findDOMNode:null},o=Symbol.for("react.portal");function l(m,d,p){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:g==null?null:""+g,children:m,containerInfo:d,implementation:p}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(m,d){if(m==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return Fs.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,Fs.createPortal=function(m,d){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(t(299));return l(m,d,null,p)},Fs.flushSync=function(m){var d=u.T,p=n.p;try{if(u.T=null,n.p=2,m)return m()}finally{u.T=d,n.p=p,n.d.f()}},Fs.preconnect=function(m,d){typeof m=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,n.d.C(m,d))},Fs.prefetchDNS=function(m){typeof m=="string"&&n.d.D(m)},Fs.preinit=function(m,d){if(typeof m=="string"&&d&&typeof d.as=="string"){var p=d.as,g=h(p,d.crossOrigin),x=typeof d.integrity=="string"?d.integrity:void 0,_=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;p==="style"?n.d.S(m,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:g,integrity:x,fetchPriority:_}):p==="script"&&n.d.X(m,{crossOrigin:g,integrity:x,fetchPriority:_,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},Fs.preinitModule=function(m,d){if(typeof m=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var p=h(d.as,d.crossOrigin);n.d.M(m,{crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&n.d.M(m)},Fs.preload=function(m,d){if(typeof m=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var p=d.as,g=h(p,d.crossOrigin);n.d.L(m,p,{crossOrigin:g,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},Fs.preloadModule=function(m,d){if(typeof m=="string")if(d){var p=h(d.as,d.crossOrigin);n.d.m(m,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else n.d.m(m)},Fs.requestFormReset=function(m){n.d.r(m)},Fs.unstable_batchedUpdates=function(m,d){return m(d)},Fs.useFormState=function(m,d,p){return u.H.useFormState(m,d,p)},Fs.useFormStatus=function(){return u.H.useHostTransitionStatus()},Fs.version="19.2.6",Fs}var qy;function wN(){if(qy)return zp.exports;qy=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),zp.exports=ZA(),zp.exports}var Vy;function QA(){if(Vy)return vc;Vy=1;var e=XA(),t=Hb(),s=wN();function n(i){var a="https://react.dev/errors/"+i;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)a+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+i+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function l(i){var a=i,c=i;if(i.alternate)for(;a.return;)a=a.return;else{i=a;do a=i,(a.flags&4098)!==0&&(c=a.return),i=a.return;while(i)}return a.tag===3?c:null}function u(i){if(i.tag===13){var a=i.memoizedState;if(a===null&&(i=i.alternate,i!==null&&(a=i.memoizedState)),a!==null)return a.dehydrated}return null}function h(i){if(i.tag===31){var a=i.memoizedState;if(a===null&&(i=i.alternate,i!==null&&(a=i.memoizedState)),a!==null)return a.dehydrated}return null}function m(i){if(l(i)!==i)throw Error(n(188))}function d(i){var a=i.alternate;if(!a){if(a=l(i),a===null)throw Error(n(188));return a!==i?null:i}for(var c=i,f=a;;){var b=c.return;if(b===null)break;var v=b.alternate;if(v===null){if(f=b.return,f!==null){c=f;continue}break}if(b.child===v.child){for(v=b.child;v;){if(v===c)return m(b),i;if(v===f)return m(b),a;v=v.sibling}throw Error(n(188))}if(c.return!==f.return)c=b,f=v;else{for(var N=!1,R=b.child;R;){if(R===c){N=!0,c=b,f=v;break}if(R===f){N=!0,f=b,c=v;break}R=R.sibling}if(!N){for(R=v.child;R;){if(R===c){N=!0,c=v,f=b;break}if(R===f){N=!0,f=v,c=b;break}R=R.sibling}if(!N)throw Error(n(189))}}if(c.alternate!==f)throw Error(n(190))}if(c.tag!==3)throw Error(n(188));return c.stateNode.current===c?i:a}function p(i){var a=i.tag;if(a===5||a===26||a===27||a===6)return i;for(i=i.child;i!==null;){if(a=p(i),a!==null)return a;i=i.sibling}return null}var g=Object.assign,x=Symbol.for("react.element"),_=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),E=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),z=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),D=Symbol.for("react.activity"),B=Symbol.for("react.memo_cache_sentinel"),P=Symbol.iterator;function H(i){return i===null||typeof i!="object"?null:(i=P&&i[P]||i["@@iterator"],typeof i=="function"?i:null)}var $=Symbol.for("react.client.reference");function q(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===$?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case w:return"Fragment";case C:return"Profiler";case k:return"StrictMode";case M:return"Suspense";case z:return"SuspenseList";case D:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case S:return"Portal";case E:return i.displayName||"Context";case T:return(i._context.displayName||"Context")+".Consumer";case j:var a=i.render;return i=i.displayName,i||(i=a.displayName||a.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case O:return a=i.displayName||null,a!==null?a:q(i.type)||"Memo";case A:a=i._payload,i=i._init;try{return q(i(a))}catch{}}return null}var V=Array.isArray,I=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z={pending:!1,data:null,method:null,action:null},K=[],te=-1;function L(i){return{current:i}}function Q(i){0>te||(i.current=K[te],K[te]=null,te--)}function re(i,a){te++,K[te]=i.current,i.current=a}var he=L(null),fe=L(null),pe=L(null),we=L(null);function Le(i,a){switch(re(pe,a),re(fe,i),re(he,null),a.nodeType){case 9:case 11:i=(i=a.documentElement)&&(i=i.namespaceURI)?ay(i):0;break;default:if(i=a.tagName,a=a.namespaceURI)a=ay(a),i=oy(a,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}Q(he),re(he,i)}function ve(){Q(he),Q(fe),Q(pe)}function We(i){i.memoizedState!==null&&re(we,i);var a=he.current,c=oy(a,i.type);a!==c&&(re(fe,i),re(he,c))}function ge(i){fe.current===i&&(Q(he),Q(fe)),we.current===i&&(Q(we),mc._currentValue=Z)}var Te,Re;function Pt(i){if(Te===void 0)try{throw Error()}catch(c){var a=c.stack.trim().match(/\n( *(at )?)/);Te=a&&a[1]||"",Re=-1<c.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+Te+i+Re}var Pi=!1;function ii(i,a){if(!i||Pi)return"";Pi=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var f={DetermineComponentFrameRoot:function(){try{if(a){var ue=function(){throw Error()};if(Object.defineProperty(ue.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ue,[])}catch(ne){var se=ne}Reflect.construct(i,[],ue)}else{try{ue.call()}catch(ne){se=ne}i.call(ue.prototype)}}else{try{throw Error()}catch(ne){se=ne}(ue=i())&&typeof ue.catch=="function"&&ue.catch(function(){})}}catch(ne){if(ne&&se&&typeof ne.stack=="string")return[ne.stack,se.stack]}return[null,null]}};f.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var b=Object.getOwnPropertyDescriptor(f.DetermineComponentFrameRoot,"name");b&&b.configurable&&Object.defineProperty(f.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var v=f.DetermineComponentFrameRoot(),N=v[0],R=v[1];if(N&&R){var U=N.split(`
4
+ `),ee=R.split(`
5
+ `);for(b=f=0;f<U.length&&!U[f].includes("DetermineComponentFrameRoot");)f++;for(;b<ee.length&&!ee[b].includes("DetermineComponentFrameRoot");)b++;if(f===U.length||b===ee.length)for(f=U.length-1,b=ee.length-1;1<=f&&0<=b&&U[f]!==ee[b];)b--;for(;1<=f&&0<=b;f--,b--)if(U[f]!==ee[b]){if(f!==1||b!==1)do if(f--,b--,0>b||U[f]!==ee[b]){var ae=`
6
+ `+U[f].replace(" at new "," at ");return i.displayName&&ae.includes("<anonymous>")&&(ae=ae.replace("<anonymous>",i.displayName)),ae}while(1<=f&&0<=b);break}}}finally{Pi=!1,Error.prepareStackTrace=c}return(c=i?i.displayName||i.name:"")?Pt(c):""}function kr(i,a){switch(i.tag){case 26:case 27:case 5:return Pt(i.type);case 16:return Pt("Lazy");case 13:return i.child!==a&&a!==null?Pt("Suspense Fallback"):Pt("Suspense");case 19:return Pt("SuspenseList");case 0:case 15:return ii(i.type,!1);case 11:return ii(i.type.render,!1);case 1:return ii(i.type,!0);case 31:return Pt("Activity");default:return""}}function $i(i){try{var a="",c=null;do a+=kr(i,c),c=i,i=i.return;while(i);return a}catch(f){return`
7
+ Error generating stack: `+f.message+`
8
+ `+f.stack}}var Hi=Object.prototype.hasOwnProperty,_e=e.unstable_scheduleCallback,ft=e.unstable_cancelCallback,bn=e.unstable_shouldYield,Ts=e.unstable_requestPaint,gt=e.unstable_now,ri=e.unstable_getCurrentPriorityLevel,fs=e.unstable_ImmediatePriority,Ui=e.unstable_UserBlockingPriority,Fi=e.unstable_NormalPriority,oo=e.unstable_LowPriority,Nr=e.unstable_IdlePriority,wl=e.log,lo=e.unstable_setDisableYieldValue,qi=null,ys=null;function Dn(i){if(typeof wl=="function"&&lo(i),ys&&typeof ys.setStrictMode=="function")try{ys.setStrictMode(qi,i)}catch{}}var As=Math.clz32?Math.clz32:co,kl=Math.log,ga=Math.LN2;function co(i){return i>>>=0,i===0?32:31-(kl(i)/ga|0)|0}var lt=256,ai=262144,xn=4194304;function $s(i){var a=i&42;if(a!==0)return a;switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function F(i,a,c){var f=i.pendingLanes;if(f===0)return 0;var b=0,v=i.suspendedLanes,N=i.pingedLanes;i=i.warmLanes;var R=f&134217727;return R!==0?(f=R&~v,f!==0?b=$s(f):(N&=R,N!==0?b=$s(N):c||(c=R&~i,c!==0&&(b=$s(c))))):(R=f&~v,R!==0?b=$s(R):N!==0?b=$s(N):c||(c=f&~i,c!==0&&(b=$s(c)))),b===0?0:a!==0&&a!==b&&(a&v)===0&&(v=b&-b,c=a&-a,v>=c||v===32&&(c&4194048)!==0)?a:b}function oe(i,a){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&a)===0}function ye(i,a){switch(i){case 1:case 2:case 4:case 8:case 64:return a+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 a+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 qe(){var i=xn;return xn<<=1,(xn&62914560)===0&&(xn=4194304),i}function Rt(i){for(var a=[],c=0;31>c;c++)a.push(i);return a}function Nt(i,a){i.pendingLanes|=a,a!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function Me(i,a,c,f,b,v){var N=i.pendingLanes;i.pendingLanes=c,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=c,i.entangledLanes&=c,i.errorRecoveryDisabledLanes&=c,i.shellSuspendCounter=0;var R=i.entanglements,U=i.expirationTimes,ee=i.hiddenUpdates;for(c=N&~c;0<c;){var ae=31-As(c),ue=1<<ae;R[ae]=0,U[ae]=-1;var se=ee[ae];if(se!==null)for(ee[ae]=null,ae=0;ae<se.length;ae++){var ne=se[ae];ne!==null&&(ne.lane&=-536870913)}c&=~ue}f!==0&&Ne(i,f,0),v!==0&&b===0&&i.tag!==0&&(i.suspendedLanes|=v&~(N&~a))}function Ne(i,a,c){i.pendingLanes|=a,i.suspendedLanes&=~a;var f=31-As(a);i.entangledLanes|=a,i.entanglements[f]=i.entanglements[f]|1073741824|c&261930}function Fe(i,a){var c=i.entangledLanes|=a;for(i=i.entanglements;c;){var f=31-As(c),b=1<<f;b&a|i[f]&a&&(i[f]|=a),c&=~b}}function Yt(i,a){var c=a&-a;return c=(c&42)!==0?1:zt(c),(c&(i.suspendedLanes|a))!==0?0:c}function zt(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function Vi(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function uo(){var i=W.p;return i!==0?i:(i=window.event,i===void 0?32:Ay(i.type))}function ho(i,a){var c=W.p;try{return W.p=i,a()}finally{W.p=c}}var _i=Math.random().toString(36).slice(2),Xt="__reactFiber$"+_i,Hs="__reactProps$"+_i,Cr="__reactContainer$"+_i,Nl="__reactEvents$"+_i,ju="__reactListeners$"+_i,fo="__reactHandles$"+_i,Tu="__reactResources$"+_i,ba="__reactMarker$"+_i;function Cl(i){delete i[Xt],delete i[Hs],delete i[Nl],delete i[ju],delete i[fo]}function Ks(i){var a=i[Xt];if(a)return a;for(var c=i.parentNode;c;){if(a=c[Cr]||c[Xt]){if(c=a.alternate,a.child!==null||c!==null&&c.child!==null)for(i=my(i);i!==null;){if(c=i[Xt])return c;i=my(i)}return a}i=c,c=i.parentNode}return null}function Gi(i){if(i=i[Xt]||i[Cr]){var a=i.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return i}return null}function Er(i){var a=i.tag;if(a===5||a===26||a===27||a===6)return i.stateNode;throw Error(n(33))}function jr(i){var a=i[Tu];return a||(a=i[Tu]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function ts(i){i[ba]=!0}var Au=new Set,xa={};function Wi(i,a){me(i,a),me(i+"Capture",a)}function me(i,a){for(xa[i]=a,i=0;i<a.length;i++)Au.add(a[i])}var Be=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]*$"),et={},bt={};function Zt(i){return Hi.call(bt,i)?!0:Hi.call(et,i)?!1:Be.test(i)?bt[i]=!0:(et[i]=!0,!1)}function Us(i,a,c){if(Zt(a))if(c===null)i.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":i.removeAttribute(a);return;case"boolean":var f=a.toLowerCase().slice(0,5);if(f!=="data-"&&f!=="aria-"){i.removeAttribute(a);return}}i.setAttribute(a,""+c)}}function vn(i,a,c){if(c===null)i.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(a);return}i.setAttribute(a,""+c)}}function an(i,a,c,f){if(f===null)i.removeAttribute(c);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(c);return}i.setAttributeNS(a,c,""+f)}}function jt(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function _n(i){var a=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function Ru(i,a,c){var f=Object.getOwnPropertyDescriptor(i.constructor.prototype,a);if(!i.hasOwnProperty(a)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var b=f.get,v=f.set;return Object.defineProperty(i,a,{configurable:!0,get:function(){return b.call(this)},set:function(N){c=""+N,v.call(this,N)}}),Object.defineProperty(i,a,{enumerable:f.enumerable}),{getValue:function(){return c},setValue:function(N){c=""+N},stopTracking:function(){i._valueTracker=null,delete i[a]}}}}function mo(i){if(!i._valueTracker){var a=_n(i)?"checked":"value";i._valueTracker=Ru(i,a,""+i[a])}}function El(i){if(!i)return!1;var a=i._valueTracker;if(!a)return!0;var c=a.getValue(),f="";return i&&(f=_n(i)?i.checked?"true":"false":i.value),i=f,i!==c?(a.setValue(i),!0):!1}function po(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var Af=/[\n"\\]/g;function on(i){return i.replace(Af,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function jl(i,a,c,f,b,v,N,R){i.name="",N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?i.type=N:i.removeAttribute("type"),a!=null?N==="number"?(a===0&&i.value===""||i.value!=a)&&(i.value=""+jt(a)):i.value!==""+jt(a)&&(i.value=""+jt(a)):N!=="submit"&&N!=="reset"||i.removeAttribute("value"),a!=null?go(i,N,jt(a)):c!=null?go(i,N,jt(c)):f!=null&&i.removeAttribute("value"),b==null&&v!=null&&(i.defaultChecked=!!v),b!=null&&(i.checked=b&&typeof b!="function"&&typeof b!="symbol"),R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"?i.name=""+jt(R):i.removeAttribute("name")}function va(i,a,c,f,b,v,N,R){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(i.type=v),a!=null||c!=null){if(!(v!=="submit"&&v!=="reset"||a!=null)){mo(i);return}c=c!=null?""+jt(c):"",a=a!=null?""+jt(a):c,R||a===i.value||(i.value=a),i.defaultValue=a}f=f??b,f=typeof f!="function"&&typeof f!="symbol"&&!!f,i.checked=R?i.checked:!!f,i.defaultChecked=!!f,N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"&&(i.name=N),mo(i)}function go(i,a,c){a==="number"&&po(i.ownerDocument)===i||i.defaultValue===""+c||(i.defaultValue=""+c)}function Rs(i,a,c,f){if(i=i.options,a){a={};for(var b=0;b<c.length;b++)a["$"+c[b]]=!0;for(c=0;c<i.length;c++)b=a.hasOwnProperty("$"+i[c].value),i[c].selected!==b&&(i[c].selected=b),b&&f&&(i[c].defaultSelected=!0)}else{for(c=""+jt(c),a=null,b=0;b<i.length;b++){if(i[b].value===c){i[b].selected=!0,f&&(i[b].defaultSelected=!0);return}a!==null||i[b].disabled||(a=i[b])}a!==null&&(a.selected=!0)}}function Mu(i,a,c){if(a!=null&&(a=""+jt(a),a!==i.value&&(i.value=a),c==null)){i.defaultValue!==a&&(i.defaultValue=a);return}i.defaultValue=c!=null?""+jt(c):""}function bo(i,a,c,f){if(a==null){if(f!=null){if(c!=null)throw Error(n(92));if(V(f)){if(1<f.length)throw Error(n(93));f=f[0]}c=f}c==null&&(c=""),a=c}c=jt(a),i.defaultValue=c,f=i.textContent,f===c&&f!==""&&f!==null&&(i.value=f),mo(i)}function Ue(i,a){if(a){var c=i.firstChild;if(c&&c===i.lastChild&&c.nodeType===3){c.nodeValue=a;return}}i.textContent=a}var Du=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 ss(i,a,c){var f=a.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?f?i.setProperty(a,""):a==="float"?i.cssFloat="":i[a]="":f?i.setProperty(a,c):typeof c!="number"||c===0||Du.has(a)?a==="float"?i.cssFloat=c:i[a]=(""+c).trim():i[a]=c+"px"}function xt(i,a,c){if(a!=null&&typeof a!="object")throw Error(n(62));if(i=i.style,c!=null){for(var f in c)!c.hasOwnProperty(f)||a!=null&&a.hasOwnProperty(f)||(f.indexOf("--")===0?i.setProperty(f,""):f==="float"?i.cssFloat="":i[f]="");for(var b in a)f=a[b],a.hasOwnProperty(b)&&c[b]!==f&&ss(i,b,f)}else for(var v in a)a.hasOwnProperty(v)&&ss(i,v,a[v])}function Tr(i){if(i.indexOf("-")===-1)return!1;switch(i){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ki=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"]]),Tl=/^[\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 Ar(i){return Tl.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function xe(){}var De=null;function Ke(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var it=null,$t=null;function On(i){var a=Gi(i);if(a&&(i=a.stateNode)){var c=i[Hs]||null;e:switch(i=a.stateNode,a.type){case"input":if(jl(i,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),a=c.name,c.type==="radio"&&a!=null){for(c=i;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+on(""+a)+'"][type="radio"]'),a=0;a<c.length;a++){var f=c[a];if(f!==i&&f.form===i.form){var b=f[Hs]||null;if(!b)throw Error(n(90));jl(f,b.value,b.defaultValue,b.defaultValue,b.checked,b.defaultChecked,b.type,b.name)}}for(a=0;a<c.length;a++)f=c[a],f.form===i.form&&El(f)}break e;case"textarea":Mu(i,c.value,c.defaultValue);break e;case"select":a=c.value,a!=null&&Rs(i,!!c.multiple,a,!1)}}}var Al=!1;function Ou(i,a,c){if(Al)return i(a,c);Al=!0;try{var f=i(a);return f}finally{if(Al=!1,(it!==null||$t!==null)&&(yd(),it&&(a=it,i=$t,$t=it=null,On(a),i)))for(a=0;a<i.length;a++)On(i[a])}}function Rl(i,a){var c=i.stateNode;if(c===null)return null;var f=c[Hs]||null;if(f===null)return null;c=f[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(i=i.type,f=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!f;break e;default:i=!1}if(i)return null;if(c&&typeof c!="function")throw Error(n(231,a,typeof c));return c}var Yi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Rf=!1;if(Yi)try{var Ml={};Object.defineProperty(Ml,"passive",{get:function(){Rf=!0}}),window.addEventListener("test",Ml,Ml),window.removeEventListener("test",Ml,Ml)}catch{Rf=!1}var Rr=null,Mf=null,Lu=null;function ov(){if(Lu)return Lu;var i,a=Mf,c=a.length,f,b="value"in Rr?Rr.value:Rr.textContent,v=b.length;for(i=0;i<c&&a[i]===b[i];i++);var N=c-i;for(f=1;f<=N&&a[c-f]===b[v-f];f++);return Lu=b.slice(i,1<f?1-f:void 0)}function zu(i){var a=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&a===13&&(i=13)):i=a,i===10&&(i=13),32<=i||i===13?i:0}function Bu(){return!0}function lv(){return!1}function ln(i){function a(c,f,b,v,N){this._reactName=c,this._targetInst=b,this.type=f,this.nativeEvent=v,this.target=N,this.currentTarget=null;for(var R in i)i.hasOwnProperty(R)&&(c=i[R],this[R]=c?c(v):v[R]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?Bu:lv,this.isPropagationStopped=lv,this}return g(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=Bu)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Bu)},persist:function(){},isPersistent:Bu}),a}var _a={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Iu=ln(_a),Dl=g({},_a,{view:0,detail:0}),Fj=ln(Dl),Df,Of,Ol,Pu=g({},Dl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:zf,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==Ol&&(Ol&&i.type==="mousemove"?(Df=i.screenX-Ol.screenX,Of=i.screenY-Ol.screenY):Of=Df=0,Ol=i),Df)},movementY:function(i){return"movementY"in i?i.movementY:Of}}),cv=ln(Pu),qj=g({},Pu,{dataTransfer:0}),Vj=ln(qj),Gj=g({},Dl,{relatedTarget:0}),Lf=ln(Gj),Wj=g({},_a,{animationName:0,elapsedTime:0,pseudoElement:0}),Kj=ln(Wj),Yj=g({},_a,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),Xj=ln(Yj),Zj=g({},_a,{data:0}),uv=ln(Zj),Qj={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Jj={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"},eT={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function tT(i){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(i):(i=eT[i])?!!a[i]:!1}function zf(){return tT}var sT=g({},Dl,{key:function(i){if(i.key){var a=Qj[i.key]||i.key;if(a!=="Unidentified")return a}return i.type==="keypress"?(i=zu(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?Jj[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:zf,charCode:function(i){return i.type==="keypress"?zu(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?zu(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),nT=ln(sT),iT=g({},Pu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),dv=ln(iT),rT=g({},Dl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:zf}),aT=ln(rT),oT=g({},_a,{propertyName:0,elapsedTime:0,pseudoElement:0}),lT=ln(oT),cT=g({},Pu,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),uT=ln(cT),dT=g({},_a,{newState:0,oldState:0}),hT=ln(dT),fT=[9,13,27,32],Bf=Yi&&"CompositionEvent"in window,Ll=null;Yi&&"documentMode"in document&&(Ll=document.documentMode);var mT=Yi&&"TextEvent"in window&&!Ll,hv=Yi&&(!Bf||Ll&&8<Ll&&11>=Ll),fv=" ",mv=!1;function pv(i,a){switch(i){case"keyup":return fT.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function gv(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var xo=!1;function pT(i,a){switch(i){case"compositionend":return gv(a);case"keypress":return a.which!==32?null:(mv=!0,fv);case"textInput":return i=a.data,i===fv&&mv?null:i;default:return null}}function gT(i,a){if(xo)return i==="compositionend"||!Bf&&pv(i,a)?(i=ov(),Lu=Mf=Rr=null,xo=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return hv&&a.locale!=="ko"?null:a.data;default:return null}}var bT={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 bv(i){var a=i&&i.nodeName&&i.nodeName.toLowerCase();return a==="input"?!!bT[i.type]:a==="textarea"}function xv(i,a,c,f){it?$t?$t.push(f):$t=[f]:it=f,a=jd(a,"onChange"),0<a.length&&(c=new Iu("onChange","change",null,c,f),i.push({event:c,listeners:a}))}var zl=null,Bl=null;function xT(i){ey(i,0)}function $u(i){var a=Er(i);if(El(a))return i}function vv(i,a){if(i==="change")return a}var _v=!1;if(Yi){var If;if(Yi){var Pf="oninput"in document;if(!Pf){var yv=document.createElement("div");yv.setAttribute("oninput","return;"),Pf=typeof yv.oninput=="function"}If=Pf}else If=!1;_v=If&&(!document.documentMode||9<document.documentMode)}function Sv(){zl&&(zl.detachEvent("onpropertychange",wv),Bl=zl=null)}function wv(i){if(i.propertyName==="value"&&$u(Bl)){var a=[];xv(a,Bl,i,Ke(i)),Ou(xT,a)}}function vT(i,a,c){i==="focusin"?(Sv(),zl=a,Bl=c,zl.attachEvent("onpropertychange",wv)):i==="focusout"&&Sv()}function _T(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return $u(Bl)}function yT(i,a){if(i==="click")return $u(a)}function ST(i,a){if(i==="input"||i==="change")return $u(a)}function wT(i,a){return i===a&&(i!==0||1/i===1/a)||i!==i&&a!==a}var yn=typeof Object.is=="function"?Object.is:wT;function Il(i,a){if(yn(i,a))return!0;if(typeof i!="object"||i===null||typeof a!="object"||a===null)return!1;var c=Object.keys(i),f=Object.keys(a);if(c.length!==f.length)return!1;for(f=0;f<c.length;f++){var b=c[f];if(!Hi.call(a,b)||!yn(i[b],a[b]))return!1}return!0}function kv(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function Nv(i,a){var c=kv(i);i=0;for(var f;c;){if(c.nodeType===3){if(f=i+c.textContent.length,i<=a&&f>=a)return{node:c,offset:a-i};i=f}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=kv(c)}}function Cv(i,a){return i&&a?i===a?!0:i&&i.nodeType===3?!1:a&&a.nodeType===3?Cv(i,a.parentNode):"contains"in i?i.contains(a):i.compareDocumentPosition?!!(i.compareDocumentPosition(a)&16):!1:!1}function Ev(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var a=po(i.document);a instanceof i.HTMLIFrameElement;){try{var c=typeof a.contentWindow.location.href=="string"}catch{c=!1}if(c)i=a.contentWindow;else break;a=po(i.document)}return a}function $f(i){var a=i&&i.nodeName&&i.nodeName.toLowerCase();return a&&(a==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||a==="textarea"||i.contentEditable==="true")}var kT=Yi&&"documentMode"in document&&11>=document.documentMode,vo=null,Hf=null,Pl=null,Uf=!1;function jv(i,a,c){var f=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Uf||vo==null||vo!==po(f)||(f=vo,"selectionStart"in f&&$f(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),Pl&&Il(Pl,f)||(Pl=f,f=jd(Hf,"onSelect"),0<f.length&&(a=new Iu("onSelect","select",null,a,c),i.push({event:a,listeners:f}),a.target=vo)))}function ya(i,a){var c={};return c[i.toLowerCase()]=a.toLowerCase(),c["Webkit"+i]="webkit"+a,c["Moz"+i]="moz"+a,c}var _o={animationend:ya("Animation","AnimationEnd"),animationiteration:ya("Animation","AnimationIteration"),animationstart:ya("Animation","AnimationStart"),transitionrun:ya("Transition","TransitionRun"),transitionstart:ya("Transition","TransitionStart"),transitioncancel:ya("Transition","TransitionCancel"),transitionend:ya("Transition","TransitionEnd")},Ff={},Tv={};Yi&&(Tv=document.createElement("div").style,"AnimationEvent"in window||(delete _o.animationend.animation,delete _o.animationiteration.animation,delete _o.animationstart.animation),"TransitionEvent"in window||delete _o.transitionend.transition);function Sa(i){if(Ff[i])return Ff[i];if(!_o[i])return i;var a=_o[i],c;for(c in a)if(a.hasOwnProperty(c)&&c in Tv)return Ff[i]=a[c];return i}var Av=Sa("animationend"),Rv=Sa("animationiteration"),Mv=Sa("animationstart"),NT=Sa("transitionrun"),CT=Sa("transitionstart"),ET=Sa("transitioncancel"),Dv=Sa("transitionend"),Ov=new Map,qf="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(" ");qf.push("scrollEnd");function oi(i,a){Ov.set(i,a),Wi(a,[i])}var Hu=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},Ln=[],yo=0,Vf=0;function Uu(){for(var i=yo,a=Vf=yo=0;a<i;){var c=Ln[a];Ln[a++]=null;var f=Ln[a];Ln[a++]=null;var b=Ln[a];Ln[a++]=null;var v=Ln[a];if(Ln[a++]=null,f!==null&&b!==null){var N=f.pending;N===null?b.next=b:(b.next=N.next,N.next=b),f.pending=b}v!==0&&Lv(c,b,v)}}function Fu(i,a,c,f){Ln[yo++]=i,Ln[yo++]=a,Ln[yo++]=c,Ln[yo++]=f,Vf|=f,i.lanes|=f,i=i.alternate,i!==null&&(i.lanes|=f)}function Gf(i,a,c,f){return Fu(i,a,c,f),qu(i)}function wa(i,a){return Fu(i,null,null,a),qu(i)}function Lv(i,a,c){i.lanes|=c;var f=i.alternate;f!==null&&(f.lanes|=c);for(var b=!1,v=i.return;v!==null;)v.childLanes|=c,f=v.alternate,f!==null&&(f.childLanes|=c),v.tag===22&&(i=v.stateNode,i===null||i._visibility&1||(b=!0)),i=v,v=v.return;return i.tag===3?(v=i.stateNode,b&&a!==null&&(b=31-As(c),i=v.hiddenUpdates,f=i[b],f===null?i[b]=[a]:f.push(a),a.lane=c|536870912),v):null}function qu(i){if(50<oc)throw oc=0,tp=null,Error(n(185));for(var a=i.return;a!==null;)i=a,a=i.return;return i.tag===3?i.stateNode:null}var So={};function jT(i,a,c,f){this.tag=i,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Sn(i,a,c,f){return new jT(i,a,c,f)}function Wf(i){return i=i.prototype,!(!i||!i.isReactComponent)}function Xi(i,a){var c=i.alternate;return c===null?(c=Sn(i.tag,a,i.key,i.mode),c.elementType=i.elementType,c.type=i.type,c.stateNode=i.stateNode,c.alternate=i,i.alternate=c):(c.pendingProps=a,c.type=i.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=i.flags&65011712,c.childLanes=i.childLanes,c.lanes=i.lanes,c.child=i.child,c.memoizedProps=i.memoizedProps,c.memoizedState=i.memoizedState,c.updateQueue=i.updateQueue,a=i.dependencies,c.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},c.sibling=i.sibling,c.index=i.index,c.ref=i.ref,c.refCleanup=i.refCleanup,c}function zv(i,a){i.flags&=65011714;var c=i.alternate;return c===null?(i.childLanes=0,i.lanes=a,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=c.childLanes,i.lanes=c.lanes,i.child=c.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=c.memoizedProps,i.memoizedState=c.memoizedState,i.updateQueue=c.updateQueue,i.type=c.type,a=c.dependencies,i.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),i}function Vu(i,a,c,f,b,v){var N=0;if(f=i,typeof i=="function")Wf(i)&&(N=1);else if(typeof i=="string")N=DA(i,c,he.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case D:return i=Sn(31,c,a,b),i.elementType=D,i.lanes=v,i;case w:return ka(c.children,b,v,a);case k:N=8,b|=24;break;case C:return i=Sn(12,c,a,b|2),i.elementType=C,i.lanes=v,i;case M:return i=Sn(13,c,a,b),i.elementType=M,i.lanes=v,i;case z:return i=Sn(19,c,a,b),i.elementType=z,i.lanes=v,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case E:N=10;break e;case T:N=9;break e;case j:N=11;break e;case O:N=14;break e;case A:N=16,f=null;break e}N=29,c=Error(n(130,i===null?"null":typeof i,"")),f=null}return a=Sn(N,c,a,b),a.elementType=i,a.type=f,a.lanes=v,a}function ka(i,a,c,f){return i=Sn(7,i,f,a),i.lanes=c,i}function Kf(i,a,c){return i=Sn(6,i,null,a),i.lanes=c,i}function Bv(i){var a=Sn(18,null,null,0);return a.stateNode=i,a}function Yf(i,a,c){return a=Sn(4,i.children!==null?i.children:[],i.key,a),a.lanes=c,a.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},a}var Iv=new WeakMap;function zn(i,a){if(typeof i=="object"&&i!==null){var c=Iv.get(i);return c!==void 0?c:(a={value:i,source:a,stack:$i(a)},Iv.set(i,a),a)}return{value:i,source:a,stack:$i(a)}}var wo=[],ko=0,Gu=null,$l=0,Bn=[],In=0,Mr=null,yi=1,Si="";function Zi(i,a){wo[ko++]=$l,wo[ko++]=Gu,Gu=i,$l=a}function Pv(i,a,c){Bn[In++]=yi,Bn[In++]=Si,Bn[In++]=Mr,Mr=i;var f=yi;i=Si;var b=32-As(f)-1;f&=~(1<<b),c+=1;var v=32-As(a)+b;if(30<v){var N=b-b%5;v=(f&(1<<N)-1).toString(32),f>>=N,b-=N,yi=1<<32-As(a)+b|c<<b|f,Si=v+i}else yi=1<<v|c<<b|f,Si=i}function Xf(i){i.return!==null&&(Zi(i,1),Pv(i,1,0))}function Zf(i){for(;i===Gu;)Gu=wo[--ko],wo[ko]=null,$l=wo[--ko],wo[ko]=null;for(;i===Mr;)Mr=Bn[--In],Bn[In]=null,Si=Bn[--In],Bn[In]=null,yi=Bn[--In],Bn[In]=null}function $v(i,a){Bn[In++]=yi,Bn[In++]=Si,Bn[In++]=Mr,yi=a.id,Si=a.overflow,Mr=i}var Ms=null,Mt=null,ot=!1,Dr=null,Pn=!1,Qf=Error(n(519));function Or(i){var a=Error(n(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Hl(zn(a,i)),Qf}function Hv(i){var a=i.stateNode,c=i.type,f=i.memoizedProps;switch(a[Xt]=i,a[Hs]=f,c){case"dialog":nt("cancel",a),nt("close",a);break;case"iframe":case"object":case"embed":nt("load",a);break;case"video":case"audio":for(c=0;c<cc.length;c++)nt(cc[c],a);break;case"source":nt("error",a);break;case"img":case"image":case"link":nt("error",a),nt("load",a);break;case"details":nt("toggle",a);break;case"input":nt("invalid",a),va(a,f.value,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name,!0);break;case"select":nt("invalid",a);break;case"textarea":nt("invalid",a),bo(a,f.value,f.defaultValue,f.children)}c=f.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||a.textContent===""+c||f.suppressHydrationWarning===!0||iy(a.textContent,c)?(f.popover!=null&&(nt("beforetoggle",a),nt("toggle",a)),f.onScroll!=null&&nt("scroll",a),f.onScrollEnd!=null&&nt("scrollend",a),f.onClick!=null&&(a.onclick=xe),a=!0):a=!1,a||Or(i,!0)}function Uv(i){for(Ms=i.return;Ms;)switch(Ms.tag){case 5:case 31:case 13:Pn=!1;return;case 27:case 3:Pn=!0;return;default:Ms=Ms.return}}function No(i){if(i!==Ms)return!1;if(!ot)return Uv(i),ot=!0,!1;var a=i.tag,c;if((c=a!==3&&a!==27)&&((c=a===5)&&(c=i.type,c=!(c!=="form"&&c!=="button")||gp(i.type,i.memoizedProps)),c=!c),c&&Mt&&Or(i),Uv(i),a===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(n(317));Mt=fy(i)}else if(a===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(n(317));Mt=fy(i)}else a===27?(a=Mt,Kr(i.type)?(i=yp,yp=null,Mt=i):Mt=a):Mt=Ms?Hn(i.stateNode.nextSibling):null;return!0}function Na(){Mt=Ms=null,ot=!1}function Jf(){var i=Dr;return i!==null&&(hn===null?hn=i:hn.push.apply(hn,i),Dr=null),i}function Hl(i){Dr===null?Dr=[i]:Dr.push(i)}var em=L(null),Ca=null,Qi=null;function Lr(i,a,c){re(em,a._currentValue),a._currentValue=c}function Ji(i){i._currentValue=em.current,Q(em)}function tm(i,a,c){for(;i!==null;){var f=i.alternate;if((i.childLanes&a)!==a?(i.childLanes|=a,f!==null&&(f.childLanes|=a)):f!==null&&(f.childLanes&a)!==a&&(f.childLanes|=a),i===c)break;i=i.return}}function sm(i,a,c,f){var b=i.child;for(b!==null&&(b.return=i);b!==null;){var v=b.dependencies;if(v!==null){var N=b.child;v=v.firstContext;e:for(;v!==null;){var R=v;v=b;for(var U=0;U<a.length;U++)if(R.context===a[U]){v.lanes|=c,R=v.alternate,R!==null&&(R.lanes|=c),tm(v.return,c,i),f||(N=null);break e}v=R.next}}else if(b.tag===18){if(N=b.return,N===null)throw Error(n(341));N.lanes|=c,v=N.alternate,v!==null&&(v.lanes|=c),tm(N,c,i),N=null}else N=b.child;if(N!==null)N.return=b;else for(N=b;N!==null;){if(N===i){N=null;break}if(b=N.sibling,b!==null){b.return=N.return,N=b;break}N=N.return}b=N}}function Co(i,a,c,f){i=null;for(var b=a,v=!1;b!==null;){if(!v){if((b.flags&524288)!==0)v=!0;else if((b.flags&262144)!==0)break}if(b.tag===10){var N=b.alternate;if(N===null)throw Error(n(387));if(N=N.memoizedProps,N!==null){var R=b.type;yn(b.pendingProps.value,N.value)||(i!==null?i.push(R):i=[R])}}else if(b===we.current){if(N=b.alternate,N===null)throw Error(n(387));N.memoizedState.memoizedState!==b.memoizedState.memoizedState&&(i!==null?i.push(mc):i=[mc])}b=b.return}i!==null&&sm(a,i,c,f),a.flags|=262144}function Wu(i){for(i=i.firstContext;i!==null;){if(!yn(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function Ea(i){Ca=i,Qi=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function Ds(i){return Fv(Ca,i)}function Ku(i,a){return Ca===null&&Ea(i),Fv(i,a)}function Fv(i,a){var c=a._currentValue;if(a={context:a,memoizedValue:c,next:null},Qi===null){if(i===null)throw Error(n(308));Qi=a,i.dependencies={lanes:0,firstContext:a},i.flags|=524288}else Qi=Qi.next=a;return c}var TT=typeof AbortController<"u"?AbortController:function(){var i=[],a=this.signal={aborted:!1,addEventListener:function(c,f){i.push(f)}};this.abort=function(){a.aborted=!0,i.forEach(function(c){return c()})}},AT=e.unstable_scheduleCallback,RT=e.unstable_NormalPriority,ns={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function nm(){return{controller:new TT,data:new Map,refCount:0}}function Ul(i){i.refCount--,i.refCount===0&&AT(RT,function(){i.controller.abort()})}var Fl=null,im=0,Eo=0,jo=null;function MT(i,a){if(Fl===null){var c=Fl=[];im=0,Eo=op(),jo={status:"pending",value:void 0,then:function(f){c.push(f)}}}return im++,a.then(qv,qv),a}function qv(){if(--im===0&&Fl!==null){jo!==null&&(jo.status="fulfilled");var i=Fl;Fl=null,Eo=0,jo=null;for(var a=0;a<i.length;a++)(0,i[a])()}}function DT(i,a){var c=[],f={status:"pending",value:null,reason:null,then:function(b){c.push(b)}};return i.then(function(){f.status="fulfilled",f.value=a;for(var b=0;b<c.length;b++)(0,c[b])(a)},function(b){for(f.status="rejected",f.reason=b,b=0;b<c.length;b++)(0,c[b])(void 0)}),f}var Vv=I.S;I.S=function(i,a){j_=gt(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&MT(i,a),Vv!==null&&Vv(i,a)};var ja=L(null);function rm(){var i=ja.current;return i!==null?i:Ct.pooledCache}function Yu(i,a){a===null?re(ja,ja.current):re(ja,a.pool)}function Gv(){var i=rm();return i===null?null:{parent:ns._currentValue,pool:i}}var To=Error(n(460)),am=Error(n(474)),Xu=Error(n(542)),Zu={then:function(){}};function Wv(i){return i=i.status,i==="fulfilled"||i==="rejected"}function Kv(i,a,c){switch(c=i[c],c===void 0?i.push(a):c!==a&&(a.then(xe,xe),a=c),a.status){case"fulfilled":return a.value;case"rejected":throw i=a.reason,Xv(i),i;default:if(typeof a.status=="string")a.then(xe,xe);else{if(i=Ct,i!==null&&100<i.shellSuspendCounter)throw Error(n(482));i=a,i.status="pending",i.then(function(f){if(a.status==="pending"){var b=a;b.status="fulfilled",b.value=f}},function(f){if(a.status==="pending"){var b=a;b.status="rejected",b.reason=f}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw i=a.reason,Xv(i),i}throw Aa=a,To}}function Ta(i){try{var a=i._init;return a(i._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(Aa=c,To):c}}var Aa=null;function Yv(){if(Aa===null)throw Error(n(459));var i=Aa;return Aa=null,i}function Xv(i){if(i===To||i===Xu)throw Error(n(483))}var Ao=null,ql=0;function Qu(i){var a=ql;return ql+=1,Ao===null&&(Ao=[]),Kv(Ao,i,a)}function Vl(i,a){a=a.props.ref,i.ref=a!==void 0?a:null}function Ju(i,a){throw a.$$typeof===x?Error(n(525)):(i=Object.prototype.toString.call(a),Error(n(31,i==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":i)))}function Zv(i){function a(X,G){if(i){var J=X.deletions;J===null?(X.deletions=[G],X.flags|=16):J.push(G)}}function c(X,G){if(!i)return null;for(;G!==null;)a(X,G),G=G.sibling;return null}function f(X){for(var G=new Map;X!==null;)X.key!==null?G.set(X.key,X):G.set(X.index,X),X=X.sibling;return G}function b(X,G){return X=Xi(X,G),X.index=0,X.sibling=null,X}function v(X,G,J){return X.index=J,i?(J=X.alternate,J!==null?(J=J.index,J<G?(X.flags|=67108866,G):J):(X.flags|=67108866,G)):(X.flags|=1048576,G)}function N(X){return i&&X.alternate===null&&(X.flags|=67108866),X}function R(X,G,J,le){return G===null||G.tag!==6?(G=Kf(J,X.mode,le),G.return=X,G):(G=b(G,J),G.return=X,G)}function U(X,G,J,le){var Pe=J.type;return Pe===w?ae(X,G,J.props.children,le,J.key):G!==null&&(G.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===A&&Ta(Pe)===G.type)?(G=b(G,J.props),Vl(G,J),G.return=X,G):(G=Vu(J.type,J.key,J.props,null,X.mode,le),Vl(G,J),G.return=X,G)}function ee(X,G,J,le){return G===null||G.tag!==4||G.stateNode.containerInfo!==J.containerInfo||G.stateNode.implementation!==J.implementation?(G=Yf(J,X.mode,le),G.return=X,G):(G=b(G,J.children||[]),G.return=X,G)}function ae(X,G,J,le,Pe){return G===null||G.tag!==7?(G=ka(J,X.mode,le,Pe),G.return=X,G):(G=b(G,J),G.return=X,G)}function ue(X,G,J){if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return G=Kf(""+G,X.mode,J),G.return=X,G;if(typeof G=="object"&&G!==null){switch(G.$$typeof){case _:return J=Vu(G.type,G.key,G.props,null,X.mode,J),Vl(J,G),J.return=X,J;case S:return G=Yf(G,X.mode,J),G.return=X,G;case A:return G=Ta(G),ue(X,G,J)}if(V(G)||H(G))return G=ka(G,X.mode,J,null),G.return=X,G;if(typeof G.then=="function")return ue(X,Qu(G),J);if(G.$$typeof===E)return ue(X,Ku(X,G),J);Ju(X,G)}return null}function se(X,G,J,le){var Pe=G!==null?G.key:null;if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return Pe!==null?null:R(X,G,""+J,le);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case _:return J.key===Pe?U(X,G,J,le):null;case S:return J.key===Pe?ee(X,G,J,le):null;case A:return J=Ta(J),se(X,G,J,le)}if(V(J)||H(J))return Pe!==null?null:ae(X,G,J,le,null);if(typeof J.then=="function")return se(X,G,Qu(J),le);if(J.$$typeof===E)return se(X,G,Ku(X,J),le);Ju(X,J)}return null}function ne(X,G,J,le,Pe){if(typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint")return X=X.get(J)||null,R(G,X,""+le,Pe);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case _:return X=X.get(le.key===null?J:le.key)||null,U(G,X,le,Pe);case S:return X=X.get(le.key===null?J:le.key)||null,ee(G,X,le,Pe);case A:return le=Ta(le),ne(X,G,J,le,Pe)}if(V(le)||H(le))return X=X.get(J)||null,ae(G,X,le,Pe,null);if(typeof le.then=="function")return ne(X,G,J,Qu(le),Pe);if(le.$$typeof===E)return ne(X,G,J,Ku(G,le),Pe);Ju(G,le)}return null}function je(X,G,J,le){for(var Pe=null,ut=null,Oe=G,Xe=G=0,at=null;Oe!==null&&Xe<J.length;Xe++){Oe.index>Xe?(at=Oe,Oe=null):at=Oe.sibling;var dt=se(X,Oe,J[Xe],le);if(dt===null){Oe===null&&(Oe=at);break}i&&Oe&&dt.alternate===null&&a(X,Oe),G=v(dt,G,Xe),ut===null?Pe=dt:ut.sibling=dt,ut=dt,Oe=at}if(Xe===J.length)return c(X,Oe),ot&&Zi(X,Xe),Pe;if(Oe===null){for(;Xe<J.length;Xe++)Oe=ue(X,J[Xe],le),Oe!==null&&(G=v(Oe,G,Xe),ut===null?Pe=Oe:ut.sibling=Oe,ut=Oe);return ot&&Zi(X,Xe),Pe}for(Oe=f(Oe);Xe<J.length;Xe++)at=ne(Oe,X,Xe,J[Xe],le),at!==null&&(i&&at.alternate!==null&&Oe.delete(at.key===null?Xe:at.key),G=v(at,G,Xe),ut===null?Pe=at:ut.sibling=at,ut=at);return i&&Oe.forEach(function(Jr){return a(X,Jr)}),ot&&Zi(X,Xe),Pe}function He(X,G,J,le){if(J==null)throw Error(n(151));for(var Pe=null,ut=null,Oe=G,Xe=G=0,at=null,dt=J.next();Oe!==null&&!dt.done;Xe++,dt=J.next()){Oe.index>Xe?(at=Oe,Oe=null):at=Oe.sibling;var Jr=se(X,Oe,dt.value,le);if(Jr===null){Oe===null&&(Oe=at);break}i&&Oe&&Jr.alternate===null&&a(X,Oe),G=v(Jr,G,Xe),ut===null?Pe=Jr:ut.sibling=Jr,ut=Jr,Oe=at}if(dt.done)return c(X,Oe),ot&&Zi(X,Xe),Pe;if(Oe===null){for(;!dt.done;Xe++,dt=J.next())dt=ue(X,dt.value,le),dt!==null&&(G=v(dt,G,Xe),ut===null?Pe=dt:ut.sibling=dt,ut=dt);return ot&&Zi(X,Xe),Pe}for(Oe=f(Oe);!dt.done;Xe++,dt=J.next())dt=ne(Oe,X,Xe,dt.value,le),dt!==null&&(i&&dt.alternate!==null&&Oe.delete(dt.key===null?Xe:dt.key),G=v(dt,G,Xe),ut===null?Pe=dt:ut.sibling=dt,ut=dt);return i&&Oe.forEach(function(qA){return a(X,qA)}),ot&&Zi(X,Xe),Pe}function wt(X,G,J,le){if(typeof J=="object"&&J!==null&&J.type===w&&J.key===null&&(J=J.props.children),typeof J=="object"&&J!==null){switch(J.$$typeof){case _:e:{for(var Pe=J.key;G!==null;){if(G.key===Pe){if(Pe=J.type,Pe===w){if(G.tag===7){c(X,G.sibling),le=b(G,J.props.children),le.return=X,X=le;break e}}else if(G.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===A&&Ta(Pe)===G.type){c(X,G.sibling),le=b(G,J.props),Vl(le,J),le.return=X,X=le;break e}c(X,G);break}else a(X,G);G=G.sibling}J.type===w?(le=ka(J.props.children,X.mode,le,J.key),le.return=X,X=le):(le=Vu(J.type,J.key,J.props,null,X.mode,le),Vl(le,J),le.return=X,X=le)}return N(X);case S:e:{for(Pe=J.key;G!==null;){if(G.key===Pe)if(G.tag===4&&G.stateNode.containerInfo===J.containerInfo&&G.stateNode.implementation===J.implementation){c(X,G.sibling),le=b(G,J.children||[]),le.return=X,X=le;break e}else{c(X,G);break}else a(X,G);G=G.sibling}le=Yf(J,X.mode,le),le.return=X,X=le}return N(X);case A:return J=Ta(J),wt(X,G,J,le)}if(V(J))return je(X,G,J,le);if(H(J)){if(Pe=H(J),typeof Pe!="function")throw Error(n(150));return J=Pe.call(J),He(X,G,J,le)}if(typeof J.then=="function")return wt(X,G,Qu(J),le);if(J.$$typeof===E)return wt(X,G,Ku(X,J),le);Ju(X,J)}return typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint"?(J=""+J,G!==null&&G.tag===6?(c(X,G.sibling),le=b(G,J),le.return=X,X=le):(c(X,G),le=Kf(J,X.mode,le),le.return=X,X=le),N(X)):c(X,G)}return function(X,G,J,le){try{ql=0;var Pe=wt(X,G,J,le);return Ao=null,Pe}catch(Oe){if(Oe===To||Oe===Xu)throw Oe;var ut=Sn(29,Oe,null,X.mode);return ut.lanes=le,ut.return=X,ut}}}var Ra=Zv(!0),Qv=Zv(!1),zr=!1;function om(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function lm(i,a){i=i.updateQueue,a.updateQueue===i&&(a.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function Br(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function Ir(i,a,c){var f=i.updateQueue;if(f===null)return null;if(f=f.shared,(mt&2)!==0){var b=f.pending;return b===null?a.next=a:(a.next=b.next,b.next=a),f.pending=a,a=qu(i),Lv(i,null,c),a}return Fu(i,f,a,c),qu(i)}function Gl(i,a,c){if(a=a.updateQueue,a!==null&&(a=a.shared,(c&4194048)!==0)){var f=a.lanes;f&=i.pendingLanes,c|=f,a.lanes=c,Fe(i,c)}}function cm(i,a){var c=i.updateQueue,f=i.alternate;if(f!==null&&(f=f.updateQueue,c===f)){var b=null,v=null;if(c=c.firstBaseUpdate,c!==null){do{var N={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};v===null?b=v=N:v=v.next=N,c=c.next}while(c!==null);v===null?b=v=a:v=v.next=a}else b=v=a;c={baseState:f.baseState,firstBaseUpdate:b,lastBaseUpdate:v,shared:f.shared,callbacks:f.callbacks},i.updateQueue=c;return}i=c.lastBaseUpdate,i===null?c.firstBaseUpdate=a:i.next=a,c.lastBaseUpdate=a}var um=!1;function Wl(){if(um){var i=jo;if(i!==null)throw i}}function Kl(i,a,c,f){um=!1;var b=i.updateQueue;zr=!1;var v=b.firstBaseUpdate,N=b.lastBaseUpdate,R=b.shared.pending;if(R!==null){b.shared.pending=null;var U=R,ee=U.next;U.next=null,N===null?v=ee:N.next=ee,N=U;var ae=i.alternate;ae!==null&&(ae=ae.updateQueue,R=ae.lastBaseUpdate,R!==N&&(R===null?ae.firstBaseUpdate=ee:R.next=ee,ae.lastBaseUpdate=U))}if(v!==null){var ue=b.baseState;N=0,ae=ee=U=null,R=v;do{var se=R.lane&-536870913,ne=se!==R.lane;if(ne?(rt&se)===se:(f&se)===se){se!==0&&se===Eo&&(um=!0),ae!==null&&(ae=ae.next={lane:0,tag:R.tag,payload:R.payload,callback:null,next:null});e:{var je=i,He=R;se=a;var wt=c;switch(He.tag){case 1:if(je=He.payload,typeof je=="function"){ue=je.call(wt,ue,se);break e}ue=je;break e;case 3:je.flags=je.flags&-65537|128;case 0:if(je=He.payload,se=typeof je=="function"?je.call(wt,ue,se):je,se==null)break e;ue=g({},ue,se);break e;case 2:zr=!0}}se=R.callback,se!==null&&(i.flags|=64,ne&&(i.flags|=8192),ne=b.callbacks,ne===null?b.callbacks=[se]:ne.push(se))}else ne={lane:se,tag:R.tag,payload:R.payload,callback:R.callback,next:null},ae===null?(ee=ae=ne,U=ue):ae=ae.next=ne,N|=se;if(R=R.next,R===null){if(R=b.shared.pending,R===null)break;ne=R,R=ne.next,ne.next=null,b.lastBaseUpdate=ne,b.shared.pending=null}}while(!0);ae===null&&(U=ue),b.baseState=U,b.firstBaseUpdate=ee,b.lastBaseUpdate=ae,v===null&&(b.shared.lanes=0),Fr|=N,i.lanes=N,i.memoizedState=ue}}function Jv(i,a){if(typeof i!="function")throw Error(n(191,i));i.call(a)}function e1(i,a){var c=i.callbacks;if(c!==null)for(i.callbacks=null,i=0;i<c.length;i++)Jv(c[i],a)}var Ro=L(null),ed=L(0);function t1(i,a){i=lr,re(ed,i),re(Ro,a),lr=i|a.baseLanes}function dm(){re(ed,lr),re(Ro,Ro.current)}function hm(){lr=ed.current,Q(Ro),Q(ed)}var wn=L(null),$n=null;function Pr(i){var a=i.alternate;re(Qt,Qt.current&1),re(wn,i),$n===null&&(a===null||Ro.current!==null||a.memoizedState!==null)&&($n=i)}function fm(i){re(Qt,Qt.current),re(wn,i),$n===null&&($n=i)}function s1(i){i.tag===22?(re(Qt,Qt.current),re(wn,i),$n===null&&($n=i)):$r()}function $r(){re(Qt,Qt.current),re(wn,wn.current)}function kn(i){Q(wn),$n===i&&($n=null),Q(Qt)}var Qt=L(0);function td(i){for(var a=i;a!==null;){if(a.tag===13){var c=a.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||vp(c)||_p(c)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===i)break;for(;a.sibling===null;){if(a.return===null||a.return===i)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var er=0,Ye=null,yt=null,is=null,sd=!1,Mo=!1,Ma=!1,nd=0,Yl=0,Do=null,OT=0;function qt(){throw Error(n(321))}function mm(i,a){if(a===null)return!1;for(var c=0;c<a.length&&c<i.length;c++)if(!yn(i[c],a[c]))return!1;return!0}function pm(i,a,c,f,b,v){return er=v,Ye=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,I.H=i===null||i.memoizedState===null?P1:Am,Ma=!1,v=c(f,b),Ma=!1,Mo&&(v=i1(a,c,f,b)),n1(i),v}function n1(i){I.H=Ql;var a=yt!==null&&yt.next!==null;if(er=0,is=yt=Ye=null,sd=!1,Yl=0,Do=null,a)throw Error(n(300));i===null||rs||(i=i.dependencies,i!==null&&Wu(i)&&(rs=!0))}function i1(i,a,c,f){Ye=i;var b=0;do{if(Mo&&(Do=null),Yl=0,Mo=!1,25<=b)throw Error(n(301));if(b+=1,is=yt=null,i.updateQueue!=null){var v=i.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}I.H=$1,v=a(c,f)}while(Mo);return v}function LT(){var i=I.H,a=i.useState()[0];return a=typeof a.then=="function"?Xl(a):a,i=i.useState()[0],(yt!==null?yt.memoizedState:null)!==i&&(Ye.flags|=1024),a}function gm(){var i=nd!==0;return nd=0,i}function bm(i,a,c){a.updateQueue=i.updateQueue,a.flags&=-2053,i.lanes&=~c}function xm(i){if(sd){for(i=i.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}sd=!1}er=0,is=yt=Ye=null,Mo=!1,Yl=nd=0,Do=null}function Ys(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return is===null?Ye.memoizedState=is=i:is=is.next=i,is}function Jt(){if(yt===null){var i=Ye.alternate;i=i!==null?i.memoizedState:null}else i=yt.next;var a=is===null?Ye.memoizedState:is.next;if(a!==null)is=a,yt=i;else{if(i===null)throw Ye.alternate===null?Error(n(467)):Error(n(310));yt=i,i={memoizedState:yt.memoizedState,baseState:yt.baseState,baseQueue:yt.baseQueue,queue:yt.queue,next:null},is===null?Ye.memoizedState=is=i:is=is.next=i}return is}function id(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Xl(i){var a=Yl;return Yl+=1,Do===null&&(Do=[]),i=Kv(Do,i,a),a=Ye,(is===null?a.memoizedState:is.next)===null&&(a=a.alternate,I.H=a===null||a.memoizedState===null?P1:Am),i}function rd(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return Xl(i);if(i.$$typeof===E)return Ds(i)}throw Error(n(438,String(i)))}function vm(i){var a=null,c=Ye.updateQueue;if(c!==null&&(a=c.memoCache),a==null){var f=Ye.alternate;f!==null&&(f=f.updateQueue,f!==null&&(f=f.memoCache,f!=null&&(a={data:f.data.map(function(b){return b.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),c===null&&(c=id(),Ye.updateQueue=c),c.memoCache=a,c=a.data[a.index],c===void 0)for(c=a.data[a.index]=Array(i),f=0;f<i;f++)c[f]=B;return a.index++,c}function tr(i,a){return typeof a=="function"?a(i):a}function ad(i){var a=Jt();return _m(a,yt,i)}function _m(i,a,c){var f=i.queue;if(f===null)throw Error(n(311));f.lastRenderedReducer=c;var b=i.baseQueue,v=f.pending;if(v!==null){if(b!==null){var N=b.next;b.next=v.next,v.next=N}a.baseQueue=b=v,f.pending=null}if(v=i.baseState,b===null)i.memoizedState=v;else{a=b.next;var R=N=null,U=null,ee=a,ae=!1;do{var ue=ee.lane&-536870913;if(ue!==ee.lane?(rt&ue)===ue:(er&ue)===ue){var se=ee.revertLane;if(se===0)U!==null&&(U=U.next={lane:0,revertLane:0,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null}),ue===Eo&&(ae=!0);else if((er&se)===se){ee=ee.next,se===Eo&&(ae=!0);continue}else ue={lane:0,revertLane:ee.revertLane,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},U===null?(R=U=ue,N=v):U=U.next=ue,Ye.lanes|=se,Fr|=se;ue=ee.action,Ma&&c(v,ue),v=ee.hasEagerState?ee.eagerState:c(v,ue)}else se={lane:ue,revertLane:ee.revertLane,gesture:ee.gesture,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},U===null?(R=U=se,N=v):U=U.next=se,Ye.lanes|=ue,Fr|=ue;ee=ee.next}while(ee!==null&&ee!==a);if(U===null?N=v:U.next=R,!yn(v,i.memoizedState)&&(rs=!0,ae&&(c=jo,c!==null)))throw c;i.memoizedState=v,i.baseState=N,i.baseQueue=U,f.lastRenderedState=v}return b===null&&(f.lanes=0),[i.memoizedState,f.dispatch]}function ym(i){var a=Jt(),c=a.queue;if(c===null)throw Error(n(311));c.lastRenderedReducer=i;var f=c.dispatch,b=c.pending,v=a.memoizedState;if(b!==null){c.pending=null;var N=b=b.next;do v=i(v,N.action),N=N.next;while(N!==b);yn(v,a.memoizedState)||(rs=!0),a.memoizedState=v,a.baseQueue===null&&(a.baseState=v),c.lastRenderedState=v}return[v,f]}function r1(i,a,c){var f=Ye,b=Jt(),v=ot;if(v){if(c===void 0)throw Error(n(407));c=c()}else c=a();var N=!yn((yt||b).memoizedState,c);if(N&&(b.memoizedState=c,rs=!0),b=b.queue,km(l1.bind(null,f,b,i),[i]),b.getSnapshot!==a||N||is!==null&&is.memoizedState.tag&1){if(f.flags|=2048,Oo(9,{destroy:void 0},o1.bind(null,f,b,c,a),null),Ct===null)throw Error(n(349));v||(er&127)!==0||a1(f,a,c)}return c}function a1(i,a,c){i.flags|=16384,i={getSnapshot:a,value:c},a=Ye.updateQueue,a===null?(a=id(),Ye.updateQueue=a,a.stores=[i]):(c=a.stores,c===null?a.stores=[i]:c.push(i))}function o1(i,a,c,f){a.value=c,a.getSnapshot=f,c1(a)&&u1(i)}function l1(i,a,c){return c(function(){c1(a)&&u1(i)})}function c1(i){var a=i.getSnapshot;i=i.value;try{var c=a();return!yn(i,c)}catch{return!0}}function u1(i){var a=wa(i,2);a!==null&&fn(a,i,2)}function Sm(i){var a=Ys();if(typeof i=="function"){var c=i;if(i=c(),Ma){Dn(!0);try{c()}finally{Dn(!1)}}}return a.memoizedState=a.baseState=i,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:tr,lastRenderedState:i},a}function d1(i,a,c,f){return i.baseState=c,_m(i,yt,typeof f=="function"?f:tr)}function zT(i,a,c,f,b){if(cd(i))throw Error(n(485));if(i=a.action,i!==null){var v={payload:b,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(N){v.listeners.push(N)}};I.T!==null?c(!0):v.isTransition=!1,f(v),c=a.pending,c===null?(v.next=a.pending=v,h1(a,v)):(v.next=c.next,a.pending=c.next=v)}}function h1(i,a){var c=a.action,f=a.payload,b=i.state;if(a.isTransition){var v=I.T,N={};I.T=N;try{var R=c(b,f),U=I.S;U!==null&&U(N,R),f1(i,a,R)}catch(ee){wm(i,a,ee)}finally{v!==null&&N.types!==null&&(v.types=N.types),I.T=v}}else try{v=c(b,f),f1(i,a,v)}catch(ee){wm(i,a,ee)}}function f1(i,a,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(f){m1(i,a,f)},function(f){return wm(i,a,f)}):m1(i,a,c)}function m1(i,a,c){a.status="fulfilled",a.value=c,p1(a),i.state=c,a=i.pending,a!==null&&(c=a.next,c===a?i.pending=null:(c=c.next,a.next=c,h1(i,c)))}function wm(i,a,c){var f=i.pending;if(i.pending=null,f!==null){f=f.next;do a.status="rejected",a.reason=c,p1(a),a=a.next;while(a!==f)}i.action=null}function p1(i){i=i.listeners;for(var a=0;a<i.length;a++)(0,i[a])()}function g1(i,a){return a}function b1(i,a){if(ot){var c=Ct.formState;if(c!==null){e:{var f=Ye;if(ot){if(Mt){t:{for(var b=Mt,v=Pn;b.nodeType!==8;){if(!v){b=null;break t}if(b=Hn(b.nextSibling),b===null){b=null;break t}}v=b.data,b=v==="F!"||v==="F"?b:null}if(b){Mt=Hn(b.nextSibling),f=b.data==="F!";break e}}Or(f)}f=!1}f&&(a=c[0])}}return c=Ys(),c.memoizedState=c.baseState=a,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:g1,lastRenderedState:a},c.queue=f,c=z1.bind(null,Ye,f),f.dispatch=c,f=Sm(!1),v=Tm.bind(null,Ye,!1,f.queue),f=Ys(),b={state:a,dispatch:null,action:i,pending:null},f.queue=b,c=zT.bind(null,Ye,b,v,c),b.dispatch=c,f.memoizedState=i,[a,c,!1]}function x1(i){var a=Jt();return v1(a,yt,i)}function v1(i,a,c){if(a=_m(i,a,g1)[0],i=ad(tr)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var f=Xl(a)}catch(N){throw N===To?Xu:N}else f=a;a=Jt();var b=a.queue,v=b.dispatch;return c!==a.memoizedState&&(Ye.flags|=2048,Oo(9,{destroy:void 0},BT.bind(null,b,c),null)),[f,v,i]}function BT(i,a){i.action=a}function _1(i){var a=Jt(),c=yt;if(c!==null)return v1(a,c,i);Jt(),a=a.memoizedState,c=Jt();var f=c.queue.dispatch;return c.memoizedState=i,[a,f,!1]}function Oo(i,a,c,f){return i={tag:i,create:c,deps:f,inst:a,next:null},a=Ye.updateQueue,a===null&&(a=id(),Ye.updateQueue=a),c=a.lastEffect,c===null?a.lastEffect=i.next=i:(f=c.next,c.next=i,i.next=f,a.lastEffect=i),i}function y1(){return Jt().memoizedState}function od(i,a,c,f){var b=Ys();Ye.flags|=i,b.memoizedState=Oo(1|a,{destroy:void 0},c,f===void 0?null:f)}function ld(i,a,c,f){var b=Jt();f=f===void 0?null:f;var v=b.memoizedState.inst;yt!==null&&f!==null&&mm(f,yt.memoizedState.deps)?b.memoizedState=Oo(a,v,c,f):(Ye.flags|=i,b.memoizedState=Oo(1|a,v,c,f))}function S1(i,a){od(8390656,8,i,a)}function km(i,a){ld(2048,8,i,a)}function IT(i){Ye.flags|=4;var a=Ye.updateQueue;if(a===null)a=id(),Ye.updateQueue=a,a.events=[i];else{var c=a.events;c===null?a.events=[i]:c.push(i)}}function w1(i){var a=Jt().memoizedState;return IT({ref:a,nextImpl:i}),function(){if((mt&2)!==0)throw Error(n(440));return a.impl.apply(void 0,arguments)}}function k1(i,a){return ld(4,2,i,a)}function N1(i,a){return ld(4,4,i,a)}function C1(i,a){if(typeof a=="function"){i=i();var c=a(i);return function(){typeof c=="function"?c():a(null)}}if(a!=null)return i=i(),a.current=i,function(){a.current=null}}function E1(i,a,c){c=c!=null?c.concat([i]):null,ld(4,4,C1.bind(null,a,i),c)}function Nm(){}function j1(i,a){var c=Jt();a=a===void 0?null:a;var f=c.memoizedState;return a!==null&&mm(a,f[1])?f[0]:(c.memoizedState=[i,a],i)}function T1(i,a){var c=Jt();a=a===void 0?null:a;var f=c.memoizedState;if(a!==null&&mm(a,f[1]))return f[0];if(f=i(),Ma){Dn(!0);try{i()}finally{Dn(!1)}}return c.memoizedState=[f,a],f}function Cm(i,a,c){return c===void 0||(er&1073741824)!==0&&(rt&261930)===0?i.memoizedState=a:(i.memoizedState=c,i=A_(),Ye.lanes|=i,Fr|=i,c)}function A1(i,a,c,f){return yn(c,a)?c:Ro.current!==null?(i=Cm(i,c,f),yn(i,a)||(rs=!0),i):(er&42)===0||(er&1073741824)!==0&&(rt&261930)===0?(rs=!0,i.memoizedState=c):(i=A_(),Ye.lanes|=i,Fr|=i,a)}function R1(i,a,c,f,b){var v=W.p;W.p=v!==0&&8>v?v:8;var N=I.T,R={};I.T=R,Tm(i,!1,a,c);try{var U=b(),ee=I.S;if(ee!==null&&ee(R,U),U!==null&&typeof U=="object"&&typeof U.then=="function"){var ae=DT(U,f);Zl(i,a,ae,En(i))}else Zl(i,a,f,En(i))}catch(ue){Zl(i,a,{then:function(){},status:"rejected",reason:ue},En())}finally{W.p=v,N!==null&&R.types!==null&&(N.types=R.types),I.T=N}}function PT(){}function Em(i,a,c,f){if(i.tag!==5)throw Error(n(476));var b=M1(i).queue;R1(i,b,a,Z,c===null?PT:function(){return D1(i),c(f)})}function M1(i){var a=i.memoizedState;if(a!==null)return a;a={memoizedState:Z,baseState:Z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:tr,lastRenderedState:Z},next:null};var c={};return a.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:tr,lastRenderedState:c},next:null},i.memoizedState=a,i=i.alternate,i!==null&&(i.memoizedState=a),a}function D1(i){var a=M1(i);a.next===null&&(a=i.alternate.memoizedState),Zl(i,a.next.queue,{},En())}function jm(){return Ds(mc)}function O1(){return Jt().memoizedState}function L1(){return Jt().memoizedState}function $T(i){for(var a=i.return;a!==null;){switch(a.tag){case 24:case 3:var c=En();i=Br(c);var f=Ir(a,i,c);f!==null&&(fn(f,a,c),Gl(f,a,c)),a={cache:nm()},i.payload=a;return}a=a.return}}function HT(i,a,c){var f=En();c={lane:f,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},cd(i)?B1(a,c):(c=Gf(i,a,c,f),c!==null&&(fn(c,i,f),I1(c,a,f)))}function z1(i,a,c){var f=En();Zl(i,a,c,f)}function Zl(i,a,c,f){var b={lane:f,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(cd(i))B1(a,b);else{var v=i.alternate;if(i.lanes===0&&(v===null||v.lanes===0)&&(v=a.lastRenderedReducer,v!==null))try{var N=a.lastRenderedState,R=v(N,c);if(b.hasEagerState=!0,b.eagerState=R,yn(R,N))return Fu(i,a,b,0),Ct===null&&Uu(),!1}catch{}if(c=Gf(i,a,b,f),c!==null)return fn(c,i,f),I1(c,a,f),!0}return!1}function Tm(i,a,c,f){if(f={lane:2,revertLane:op(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},cd(i)){if(a)throw Error(n(479))}else a=Gf(i,c,f,2),a!==null&&fn(a,i,2)}function cd(i){var a=i.alternate;return i===Ye||a!==null&&a===Ye}function B1(i,a){Mo=sd=!0;var c=i.pending;c===null?a.next=a:(a.next=c.next,c.next=a),i.pending=a}function I1(i,a,c){if((c&4194048)!==0){var f=a.lanes;f&=i.pendingLanes,c|=f,a.lanes=c,Fe(i,c)}}var Ql={readContext:Ds,use:rd,useCallback:qt,useContext:qt,useEffect:qt,useImperativeHandle:qt,useLayoutEffect:qt,useInsertionEffect:qt,useMemo:qt,useReducer:qt,useRef:qt,useState:qt,useDebugValue:qt,useDeferredValue:qt,useTransition:qt,useSyncExternalStore:qt,useId:qt,useHostTransitionStatus:qt,useFormState:qt,useActionState:qt,useOptimistic:qt,useMemoCache:qt,useCacheRefresh:qt};Ql.useEffectEvent=qt;var P1={readContext:Ds,use:rd,useCallback:function(i,a){return Ys().memoizedState=[i,a===void 0?null:a],i},useContext:Ds,useEffect:S1,useImperativeHandle:function(i,a,c){c=c!=null?c.concat([i]):null,od(4194308,4,C1.bind(null,a,i),c)},useLayoutEffect:function(i,a){return od(4194308,4,i,a)},useInsertionEffect:function(i,a){od(4,2,i,a)},useMemo:function(i,a){var c=Ys();a=a===void 0?null:a;var f=i();if(Ma){Dn(!0);try{i()}finally{Dn(!1)}}return c.memoizedState=[f,a],f},useReducer:function(i,a,c){var f=Ys();if(c!==void 0){var b=c(a);if(Ma){Dn(!0);try{c(a)}finally{Dn(!1)}}}else b=a;return f.memoizedState=f.baseState=b,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:b},f.queue=i,i=i.dispatch=HT.bind(null,Ye,i),[f.memoizedState,i]},useRef:function(i){var a=Ys();return i={current:i},a.memoizedState=i},useState:function(i){i=Sm(i);var a=i.queue,c=z1.bind(null,Ye,a);return a.dispatch=c,[i.memoizedState,c]},useDebugValue:Nm,useDeferredValue:function(i,a){var c=Ys();return Cm(c,i,a)},useTransition:function(){var i=Sm(!1);return i=R1.bind(null,Ye,i.queue,!0,!1),Ys().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,a,c){var f=Ye,b=Ys();if(ot){if(c===void 0)throw Error(n(407));c=c()}else{if(c=a(),Ct===null)throw Error(n(349));(rt&127)!==0||a1(f,a,c)}b.memoizedState=c;var v={value:c,getSnapshot:a};return b.queue=v,S1(l1.bind(null,f,v,i),[i]),f.flags|=2048,Oo(9,{destroy:void 0},o1.bind(null,f,v,c,a),null),c},useId:function(){var i=Ys(),a=Ct.identifierPrefix;if(ot){var c=Si,f=yi;c=(f&~(1<<32-As(f)-1)).toString(32)+c,a="_"+a+"R_"+c,c=nd++,0<c&&(a+="H"+c.toString(32)),a+="_"}else c=OT++,a="_"+a+"r_"+c.toString(32)+"_";return i.memoizedState=a},useHostTransitionStatus:jm,useFormState:b1,useActionState:b1,useOptimistic:function(i){var a=Ys();a.memoizedState=a.baseState=i;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=c,a=Tm.bind(null,Ye,!0,c),c.dispatch=a,[i,a]},useMemoCache:vm,useCacheRefresh:function(){return Ys().memoizedState=$T.bind(null,Ye)},useEffectEvent:function(i){var a=Ys(),c={impl:i};return a.memoizedState=c,function(){if((mt&2)!==0)throw Error(n(440));return c.impl.apply(void 0,arguments)}}},Am={readContext:Ds,use:rd,useCallback:j1,useContext:Ds,useEffect:km,useImperativeHandle:E1,useInsertionEffect:k1,useLayoutEffect:N1,useMemo:T1,useReducer:ad,useRef:y1,useState:function(){return ad(tr)},useDebugValue:Nm,useDeferredValue:function(i,a){var c=Jt();return A1(c,yt.memoizedState,i,a)},useTransition:function(){var i=ad(tr)[0],a=Jt().memoizedState;return[typeof i=="boolean"?i:Xl(i),a]},useSyncExternalStore:r1,useId:O1,useHostTransitionStatus:jm,useFormState:x1,useActionState:x1,useOptimistic:function(i,a){var c=Jt();return d1(c,yt,i,a)},useMemoCache:vm,useCacheRefresh:L1};Am.useEffectEvent=w1;var $1={readContext:Ds,use:rd,useCallback:j1,useContext:Ds,useEffect:km,useImperativeHandle:E1,useInsertionEffect:k1,useLayoutEffect:N1,useMemo:T1,useReducer:ym,useRef:y1,useState:function(){return ym(tr)},useDebugValue:Nm,useDeferredValue:function(i,a){var c=Jt();return yt===null?Cm(c,i,a):A1(c,yt.memoizedState,i,a)},useTransition:function(){var i=ym(tr)[0],a=Jt().memoizedState;return[typeof i=="boolean"?i:Xl(i),a]},useSyncExternalStore:r1,useId:O1,useHostTransitionStatus:jm,useFormState:_1,useActionState:_1,useOptimistic:function(i,a){var c=Jt();return yt!==null?d1(c,yt,i,a):(c.baseState=i,[i,c.queue.dispatch])},useMemoCache:vm,useCacheRefresh:L1};$1.useEffectEvent=w1;function Rm(i,a,c,f){a=i.memoizedState,c=c(f,a),c=c==null?a:g({},a,c),i.memoizedState=c,i.lanes===0&&(i.updateQueue.baseState=c)}var Mm={enqueueSetState:function(i,a,c){i=i._reactInternals;var f=En(),b=Br(f);b.payload=a,c!=null&&(b.callback=c),a=Ir(i,b,f),a!==null&&(fn(a,i,f),Gl(a,i,f))},enqueueReplaceState:function(i,a,c){i=i._reactInternals;var f=En(),b=Br(f);b.tag=1,b.payload=a,c!=null&&(b.callback=c),a=Ir(i,b,f),a!==null&&(fn(a,i,f),Gl(a,i,f))},enqueueForceUpdate:function(i,a){i=i._reactInternals;var c=En(),f=Br(c);f.tag=2,a!=null&&(f.callback=a),a=Ir(i,f,c),a!==null&&(fn(a,i,c),Gl(a,i,c))}};function H1(i,a,c,f,b,v,N){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(f,v,N):a.prototype&&a.prototype.isPureReactComponent?!Il(c,f)||!Il(b,v):!0}function U1(i,a,c,f){i=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(c,f),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(c,f),a.state!==i&&Mm.enqueueReplaceState(a,a.state,null)}function Da(i,a){var c=a;if("ref"in a){c={};for(var f in a)f!=="ref"&&(c[f]=a[f])}if(i=i.defaultProps){c===a&&(c=g({},c));for(var b in i)c[b]===void 0&&(c[b]=i[b])}return c}function F1(i){Hu(i)}function q1(i){console.error(i)}function V1(i){Hu(i)}function ud(i,a){try{var c=i.onUncaughtError;c(a.value,{componentStack:a.stack})}catch(f){setTimeout(function(){throw f})}}function G1(i,a,c){try{var f=i.onCaughtError;f(c.value,{componentStack:c.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(b){setTimeout(function(){throw b})}}function Dm(i,a,c){return c=Br(c),c.tag=3,c.payload={element:null},c.callback=function(){ud(i,a)},c}function W1(i){return i=Br(i),i.tag=3,i}function K1(i,a,c,f){var b=c.type.getDerivedStateFromError;if(typeof b=="function"){var v=f.value;i.payload=function(){return b(v)},i.callback=function(){G1(a,c,f)}}var N=c.stateNode;N!==null&&typeof N.componentDidCatch=="function"&&(i.callback=function(){G1(a,c,f),typeof b!="function"&&(qr===null?qr=new Set([this]):qr.add(this));var R=f.stack;this.componentDidCatch(f.value,{componentStack:R!==null?R:""})})}function UT(i,a,c,f,b){if(c.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){if(a=c.alternate,a!==null&&Co(a,c,b,!0),c=wn.current,c!==null){switch(c.tag){case 31:case 13:return $n===null?Sd():c.alternate===null&&Vt===0&&(Vt=3),c.flags&=-257,c.flags|=65536,c.lanes=b,f===Zu?c.flags|=16384:(a=c.updateQueue,a===null?c.updateQueue=new Set([f]):a.add(f),ip(i,f,b)),!1;case 22:return c.flags|=65536,f===Zu?c.flags|=16384:(a=c.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([f])},c.updateQueue=a):(c=a.retryQueue,c===null?a.retryQueue=new Set([f]):c.add(f)),ip(i,f,b)),!1}throw Error(n(435,c.tag))}return ip(i,f,b),Sd(),!1}if(ot)return a=wn.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=b,f!==Qf&&(i=Error(n(422),{cause:f}),Hl(zn(i,c)))):(f!==Qf&&(a=Error(n(423),{cause:f}),Hl(zn(a,c))),i=i.current.alternate,i.flags|=65536,b&=-b,i.lanes|=b,f=zn(f,c),b=Dm(i.stateNode,f,b),cm(i,b),Vt!==4&&(Vt=2)),!1;var v=Error(n(520),{cause:f});if(v=zn(v,c),ac===null?ac=[v]:ac.push(v),Vt!==4&&(Vt=2),a===null)return!0;f=zn(f,c),c=a;do{switch(c.tag){case 3:return c.flags|=65536,i=b&-b,c.lanes|=i,i=Dm(c.stateNode,f,i),cm(c,i),!1;case 1:if(a=c.type,v=c.stateNode,(c.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(qr===null||!qr.has(v))))return c.flags|=65536,b&=-b,c.lanes|=b,b=W1(b),K1(b,i,c,f),cm(c,b),!1}c=c.return}while(c!==null);return!1}var Om=Error(n(461)),rs=!1;function Os(i,a,c,f){a.child=i===null?Qv(a,null,c,f):Ra(a,i.child,c,f)}function Y1(i,a,c,f,b){c=c.render;var v=a.ref;if("ref"in f){var N={};for(var R in f)R!=="ref"&&(N[R]=f[R])}else N=f;return Ea(a),f=pm(i,a,c,N,v,b),R=gm(),i!==null&&!rs?(bm(i,a,b),sr(i,a,b)):(ot&&R&&Xf(a),a.flags|=1,Os(i,a,f,b),a.child)}function X1(i,a,c,f,b){if(i===null){var v=c.type;return typeof v=="function"&&!Wf(v)&&v.defaultProps===void 0&&c.compare===null?(a.tag=15,a.type=v,Z1(i,a,v,f,b)):(i=Vu(c.type,null,f,a,a.mode,b),i.ref=a.ref,i.return=a,a.child=i)}if(v=i.child,!Um(i,b)){var N=v.memoizedProps;if(c=c.compare,c=c!==null?c:Il,c(N,f)&&i.ref===a.ref)return sr(i,a,b)}return a.flags|=1,i=Xi(v,f),i.ref=a.ref,i.return=a,a.child=i}function Z1(i,a,c,f,b){if(i!==null){var v=i.memoizedProps;if(Il(v,f)&&i.ref===a.ref)if(rs=!1,a.pendingProps=f=v,Um(i,b))(i.flags&131072)!==0&&(rs=!0);else return a.lanes=i.lanes,sr(i,a,b)}return Lm(i,a,c,f,b)}function Q1(i,a,c,f){var b=f.children,v=i!==null?i.memoizedState:null;if(i===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.mode==="hidden"){if((a.flags&128)!==0){if(v=v!==null?v.baseLanes|c:c,i!==null){for(f=a.child=i.child,b=0;f!==null;)b=b|f.lanes|f.childLanes,f=f.sibling;f=b&~v}else f=0,a.child=null;return J1(i,a,v,c,f)}if((c&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},i!==null&&Yu(a,v!==null?v.cachePool:null),v!==null?t1(a,v):dm(),s1(a);else return f=a.lanes=536870912,J1(i,a,v!==null?v.baseLanes|c:c,c,f)}else v!==null?(Yu(a,v.cachePool),t1(a,v),$r(),a.memoizedState=null):(i!==null&&Yu(a,null),dm(),$r());return Os(i,a,b,c),a.child}function Jl(i,a){return i!==null&&i.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function J1(i,a,c,f,b){var v=rm();return v=v===null?null:{parent:ns._currentValue,pool:v},a.memoizedState={baseLanes:c,cachePool:v},i!==null&&Yu(a,null),dm(),s1(a),i!==null&&Co(i,a,f,!0),a.childLanes=b,null}function dd(i,a){return a=fd({mode:a.mode,children:a.children},i.mode),a.ref=i.ref,i.child=a,a.return=i,a}function e_(i,a,c){return Ra(a,i.child,null,c),i=dd(a,a.pendingProps),i.flags|=2,kn(a),a.memoizedState=null,i}function FT(i,a,c){var f=a.pendingProps,b=(a.flags&128)!==0;if(a.flags&=-129,i===null){if(ot){if(f.mode==="hidden")return i=dd(a,f),a.lanes=536870912,Jl(null,i);if(fm(a),(i=Mt)?(i=hy(i,Pn),i=i!==null&&i.data==="&"?i:null,i!==null&&(a.memoizedState={dehydrated:i,treeContext:Mr!==null?{id:yi,overflow:Si}:null,retryLane:536870912,hydrationErrors:null},c=Bv(i),c.return=a,a.child=c,Ms=a,Mt=null)):i=null,i===null)throw Or(a);return a.lanes=536870912,null}return dd(a,f)}var v=i.memoizedState;if(v!==null){var N=v.dehydrated;if(fm(a),b)if(a.flags&256)a.flags&=-257,a=e_(i,a,c);else if(a.memoizedState!==null)a.child=i.child,a.flags|=128,a=null;else throw Error(n(558));else if(rs||Co(i,a,c,!1),b=(c&i.childLanes)!==0,rs||b){if(f=Ct,f!==null&&(N=Yt(f,c),N!==0&&N!==v.retryLane))throw v.retryLane=N,wa(i,N),fn(f,i,N),Om;Sd(),a=e_(i,a,c)}else i=v.treeContext,Mt=Hn(N.nextSibling),Ms=a,ot=!0,Dr=null,Pn=!1,i!==null&&$v(a,i),a=dd(a,f),a.flags|=4096;return a}return i=Xi(i.child,{mode:f.mode,children:f.children}),i.ref=a.ref,a.child=i,i.return=a,i}function hd(i,a){var c=a.ref;if(c===null)i!==null&&i.ref!==null&&(a.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(n(284));(i===null||i.ref!==c)&&(a.flags|=4194816)}}function Lm(i,a,c,f,b){return Ea(a),c=pm(i,a,c,f,void 0,b),f=gm(),i!==null&&!rs?(bm(i,a,b),sr(i,a,b)):(ot&&f&&Xf(a),a.flags|=1,Os(i,a,c,b),a.child)}function t_(i,a,c,f,b,v){return Ea(a),a.updateQueue=null,c=i1(a,f,c,b),n1(i),f=gm(),i!==null&&!rs?(bm(i,a,v),sr(i,a,v)):(ot&&f&&Xf(a),a.flags|=1,Os(i,a,c,v),a.child)}function s_(i,a,c,f,b){if(Ea(a),a.stateNode===null){var v=So,N=c.contextType;typeof N=="object"&&N!==null&&(v=Ds(N)),v=new c(f,v),a.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=Mm,a.stateNode=v,v._reactInternals=a,v=a.stateNode,v.props=f,v.state=a.memoizedState,v.refs={},om(a),N=c.contextType,v.context=typeof N=="object"&&N!==null?Ds(N):So,v.state=a.memoizedState,N=c.getDerivedStateFromProps,typeof N=="function"&&(Rm(a,c,N,f),v.state=a.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(N=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),N!==v.state&&Mm.enqueueReplaceState(v,v.state,null),Kl(a,f,v,b),Wl(),v.state=a.memoizedState),typeof v.componentDidMount=="function"&&(a.flags|=4194308),f=!0}else if(i===null){v=a.stateNode;var R=a.memoizedProps,U=Da(c,R);v.props=U;var ee=v.context,ae=c.contextType;N=So,typeof ae=="object"&&ae!==null&&(N=Ds(ae));var ue=c.getDerivedStateFromProps;ae=typeof ue=="function"||typeof v.getSnapshotBeforeUpdate=="function",R=a.pendingProps!==R,ae||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(R||ee!==N)&&U1(a,v,f,N),zr=!1;var se=a.memoizedState;v.state=se,Kl(a,f,v,b),Wl(),ee=a.memoizedState,R||se!==ee||zr?(typeof ue=="function"&&(Rm(a,c,ue,f),ee=a.memoizedState),(U=zr||H1(a,c,U,f,se,ee,N))?(ae||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"&&(a.flags|=4194308)):(typeof v.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=f,a.memoizedState=ee),v.props=f,v.state=ee,v.context=N,f=U):(typeof v.componentDidMount=="function"&&(a.flags|=4194308),f=!1)}else{v=a.stateNode,lm(i,a),N=a.memoizedProps,ae=Da(c,N),v.props=ae,ue=a.pendingProps,se=v.context,ee=c.contextType,U=So,typeof ee=="object"&&ee!==null&&(U=Ds(ee)),R=c.getDerivedStateFromProps,(ee=typeof R=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(N!==ue||se!==U)&&U1(a,v,f,U),zr=!1,se=a.memoizedState,v.state=se,Kl(a,f,v,b),Wl();var ne=a.memoizedState;N!==ue||se!==ne||zr||i!==null&&i.dependencies!==null&&Wu(i.dependencies)?(typeof R=="function"&&(Rm(a,c,R,f),ne=a.memoizedState),(ae=zr||H1(a,c,ae,f,se,ne,U)||i!==null&&i.dependencies!==null&&Wu(i.dependencies))?(ee||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(f,ne,U),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(f,ne,U)),typeof v.componentDidUpdate=="function"&&(a.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof v.componentDidUpdate!="function"||N===i.memoizedProps&&se===i.memoizedState||(a.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||N===i.memoizedProps&&se===i.memoizedState||(a.flags|=1024),a.memoizedProps=f,a.memoizedState=ne),v.props=f,v.state=ne,v.context=U,f=ae):(typeof v.componentDidUpdate!="function"||N===i.memoizedProps&&se===i.memoizedState||(a.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||N===i.memoizedProps&&se===i.memoizedState||(a.flags|=1024),f=!1)}return v=f,hd(i,a),f=(a.flags&128)!==0,v||f?(v=a.stateNode,c=f&&typeof c.getDerivedStateFromError!="function"?null:v.render(),a.flags|=1,i!==null&&f?(a.child=Ra(a,i.child,null,b),a.child=Ra(a,null,c,b)):Os(i,a,c,b),a.memoizedState=v.state,i=a.child):i=sr(i,a,b),i}function n_(i,a,c,f){return Na(),a.flags|=256,Os(i,a,c,f),a.child}var zm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Bm(i){return{baseLanes:i,cachePool:Gv()}}function Im(i,a,c){return i=i!==null?i.childLanes&~c:0,a&&(i|=Cn),i}function i_(i,a,c){var f=a.pendingProps,b=!1,v=(a.flags&128)!==0,N;if((N=v)||(N=i!==null&&i.memoizedState===null?!1:(Qt.current&2)!==0),N&&(b=!0,a.flags&=-129),N=(a.flags&32)!==0,a.flags&=-33,i===null){if(ot){if(b?Pr(a):$r(),(i=Mt)?(i=hy(i,Pn),i=i!==null&&i.data!=="&"?i:null,i!==null&&(a.memoizedState={dehydrated:i,treeContext:Mr!==null?{id:yi,overflow:Si}:null,retryLane:536870912,hydrationErrors:null},c=Bv(i),c.return=a,a.child=c,Ms=a,Mt=null)):i=null,i===null)throw Or(a);return _p(i)?a.lanes=32:a.lanes=536870912,null}var R=f.children;return f=f.fallback,b?($r(),b=a.mode,R=fd({mode:"hidden",children:R},b),f=ka(f,b,c,null),R.return=a,f.return=a,R.sibling=f,a.child=R,f=a.child,f.memoizedState=Bm(c),f.childLanes=Im(i,N,c),a.memoizedState=zm,Jl(null,f)):(Pr(a),Pm(a,R))}var U=i.memoizedState;if(U!==null&&(R=U.dehydrated,R!==null)){if(v)a.flags&256?(Pr(a),a.flags&=-257,a=$m(i,a,c)):a.memoizedState!==null?($r(),a.child=i.child,a.flags|=128,a=null):($r(),R=f.fallback,b=a.mode,f=fd({mode:"visible",children:f.children},b),R=ka(R,b,c,null),R.flags|=2,f.return=a,R.return=a,f.sibling=R,a.child=f,Ra(a,i.child,null,c),f=a.child,f.memoizedState=Bm(c),f.childLanes=Im(i,N,c),a.memoizedState=zm,a=Jl(null,f));else if(Pr(a),_p(R)){if(N=R.nextSibling&&R.nextSibling.dataset,N)var ee=N.dgst;N=ee,f=Error(n(419)),f.stack="",f.digest=N,Hl({value:f,source:null,stack:null}),a=$m(i,a,c)}else if(rs||Co(i,a,c,!1),N=(c&i.childLanes)!==0,rs||N){if(N=Ct,N!==null&&(f=Yt(N,c),f!==0&&f!==U.retryLane))throw U.retryLane=f,wa(i,f),fn(N,i,f),Om;vp(R)||Sd(),a=$m(i,a,c)}else vp(R)?(a.flags|=192,a.child=i.child,a=null):(i=U.treeContext,Mt=Hn(R.nextSibling),Ms=a,ot=!0,Dr=null,Pn=!1,i!==null&&$v(a,i),a=Pm(a,f.children),a.flags|=4096);return a}return b?($r(),R=f.fallback,b=a.mode,U=i.child,ee=U.sibling,f=Xi(U,{mode:"hidden",children:f.children}),f.subtreeFlags=U.subtreeFlags&65011712,ee!==null?R=Xi(ee,R):(R=ka(R,b,c,null),R.flags|=2),R.return=a,f.return=a,f.sibling=R,a.child=f,Jl(null,f),f=a.child,R=i.child.memoizedState,R===null?R=Bm(c):(b=R.cachePool,b!==null?(U=ns._currentValue,b=b.parent!==U?{parent:U,pool:U}:b):b=Gv(),R={baseLanes:R.baseLanes|c,cachePool:b}),f.memoizedState=R,f.childLanes=Im(i,N,c),a.memoizedState=zm,Jl(i.child,f)):(Pr(a),c=i.child,i=c.sibling,c=Xi(c,{mode:"visible",children:f.children}),c.return=a,c.sibling=null,i!==null&&(N=a.deletions,N===null?(a.deletions=[i],a.flags|=16):N.push(i)),a.child=c,a.memoizedState=null,c)}function Pm(i,a){return a=fd({mode:"visible",children:a},i.mode),a.return=i,i.child=a}function fd(i,a){return i=Sn(22,i,null,a),i.lanes=0,i}function $m(i,a,c){return Ra(a,i.child,null,c),i=Pm(a,a.pendingProps.children),i.flags|=2,a.memoizedState=null,i}function r_(i,a,c){i.lanes|=a;var f=i.alternate;f!==null&&(f.lanes|=a),tm(i.return,a,c)}function Hm(i,a,c,f,b,v){var N=i.memoizedState;N===null?i.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:f,tail:c,tailMode:b,treeForkCount:v}:(N.isBackwards=a,N.rendering=null,N.renderingStartTime=0,N.last=f,N.tail=c,N.tailMode=b,N.treeForkCount=v)}function a_(i,a,c){var f=a.pendingProps,b=f.revealOrder,v=f.tail;f=f.children;var N=Qt.current,R=(N&2)!==0;if(R?(N=N&1|2,a.flags|=128):N&=1,re(Qt,N),Os(i,a,f,c),f=ot?$l:0,!R&&i!==null&&(i.flags&128)!==0)e:for(i=a.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&r_(i,c,a);else if(i.tag===19)r_(i,c,a);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===a)break e;for(;i.sibling===null;){if(i.return===null||i.return===a)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(b){case"forwards":for(c=a.child,b=null;c!==null;)i=c.alternate,i!==null&&td(i)===null&&(b=c),c=c.sibling;c=b,c===null?(b=a.child,a.child=null):(b=c.sibling,c.sibling=null),Hm(a,!1,b,c,v,f);break;case"backwards":case"unstable_legacy-backwards":for(c=null,b=a.child,a.child=null;b!==null;){if(i=b.alternate,i!==null&&td(i)===null){a.child=b;break}i=b.sibling,b.sibling=c,c=b,b=i}Hm(a,!0,c,null,v,f);break;case"together":Hm(a,!1,null,null,void 0,f);break;default:a.memoizedState=null}return a.child}function sr(i,a,c){if(i!==null&&(a.dependencies=i.dependencies),Fr|=a.lanes,(c&a.childLanes)===0)if(i!==null){if(Co(i,a,c,!1),(c&a.childLanes)===0)return null}else return null;if(i!==null&&a.child!==i.child)throw Error(n(153));if(a.child!==null){for(i=a.child,c=Xi(i,i.pendingProps),a.child=c,c.return=a;i.sibling!==null;)i=i.sibling,c=c.sibling=Xi(i,i.pendingProps),c.return=a;c.sibling=null}return a.child}function Um(i,a){return(i.lanes&a)!==0?!0:(i=i.dependencies,!!(i!==null&&Wu(i)))}function qT(i,a,c){switch(a.tag){case 3:Le(a,a.stateNode.containerInfo),Lr(a,ns,i.memoizedState.cache),Na();break;case 27:case 5:We(a);break;case 4:Le(a,a.stateNode.containerInfo);break;case 10:Lr(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,fm(a),null;break;case 13:var f=a.memoizedState;if(f!==null)return f.dehydrated!==null?(Pr(a),a.flags|=128,null):(c&a.child.childLanes)!==0?i_(i,a,c):(Pr(a),i=sr(i,a,c),i!==null?i.sibling:null);Pr(a);break;case 19:var b=(i.flags&128)!==0;if(f=(c&a.childLanes)!==0,f||(Co(i,a,c,!1),f=(c&a.childLanes)!==0),b){if(f)return a_(i,a,c);a.flags|=128}if(b=a.memoizedState,b!==null&&(b.rendering=null,b.tail=null,b.lastEffect=null),re(Qt,Qt.current),f)break;return null;case 22:return a.lanes=0,Q1(i,a,c,a.pendingProps);case 24:Lr(a,ns,i.memoizedState.cache)}return sr(i,a,c)}function o_(i,a,c){if(i!==null)if(i.memoizedProps!==a.pendingProps)rs=!0;else{if(!Um(i,c)&&(a.flags&128)===0)return rs=!1,qT(i,a,c);rs=(i.flags&131072)!==0}else rs=!1,ot&&(a.flags&1048576)!==0&&Pv(a,$l,a.index);switch(a.lanes=0,a.tag){case 16:e:{var f=a.pendingProps;if(i=Ta(a.elementType),a.type=i,typeof i=="function")Wf(i)?(f=Da(i,f),a.tag=1,a=s_(null,a,i,f,c)):(a.tag=0,a=Lm(null,a,i,f,c));else{if(i!=null){var b=i.$$typeof;if(b===j){a.tag=11,a=Y1(null,a,i,f,c);break e}else if(b===O){a.tag=14,a=X1(null,a,i,f,c);break e}}throw a=q(i)||i,Error(n(306,a,""))}}return a;case 0:return Lm(i,a,a.type,a.pendingProps,c);case 1:return f=a.type,b=Da(f,a.pendingProps),s_(i,a,f,b,c);case 3:e:{if(Le(a,a.stateNode.containerInfo),i===null)throw Error(n(387));f=a.pendingProps;var v=a.memoizedState;b=v.element,lm(i,a),Kl(a,f,null,c);var N=a.memoizedState;if(f=N.cache,Lr(a,ns,f),f!==v.cache&&sm(a,[ns],c,!0),Wl(),f=N.element,v.isDehydrated)if(v={element:f,isDehydrated:!1,cache:N.cache},a.updateQueue.baseState=v,a.memoizedState=v,a.flags&256){a=n_(i,a,f,c);break e}else if(f!==b){b=zn(Error(n(424)),a),Hl(b),a=n_(i,a,f,c);break e}else for(i=a.stateNode.containerInfo,i.nodeType===9?i=i.body:i=i.nodeName==="HTML"?i.ownerDocument.body:i,Mt=Hn(i.firstChild),Ms=a,ot=!0,Dr=null,Pn=!0,c=Qv(a,null,f,c),a.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(Na(),f===b){a=sr(i,a,c);break e}Os(i,a,f,c)}a=a.child}return a;case 26:return hd(i,a),i===null?(c=xy(a.type,null,a.pendingProps,null))?a.memoizedState=c:ot||(c=a.type,i=a.pendingProps,f=Td(pe.current).createElement(c),f[Xt]=a,f[Hs]=i,Ls(f,c,i),ts(f),a.stateNode=f):a.memoizedState=xy(a.type,i.memoizedProps,a.pendingProps,i.memoizedState),null;case 27:return We(a),i===null&&ot&&(f=a.stateNode=py(a.type,a.pendingProps,pe.current),Ms=a,Pn=!0,b=Mt,Kr(a.type)?(yp=b,Mt=Hn(f.firstChild)):Mt=b),Os(i,a,a.pendingProps.children,c),hd(i,a),i===null&&(a.flags|=4194304),a.child;case 5:return i===null&&ot&&((b=f=Mt)&&(f=_A(f,a.type,a.pendingProps,Pn),f!==null?(a.stateNode=f,Ms=a,Mt=Hn(f.firstChild),Pn=!1,b=!0):b=!1),b||Or(a)),We(a),b=a.type,v=a.pendingProps,N=i!==null?i.memoizedProps:null,f=v.children,gp(b,v)?f=null:N!==null&&gp(b,N)&&(a.flags|=32),a.memoizedState!==null&&(b=pm(i,a,LT,null,null,c),mc._currentValue=b),hd(i,a),Os(i,a,f,c),a.child;case 6:return i===null&&ot&&((i=c=Mt)&&(c=yA(c,a.pendingProps,Pn),c!==null?(a.stateNode=c,Ms=a,Mt=null,i=!0):i=!1),i||Or(a)),null;case 13:return i_(i,a,c);case 4:return Le(a,a.stateNode.containerInfo),f=a.pendingProps,i===null?a.child=Ra(a,null,f,c):Os(i,a,f,c),a.child;case 11:return Y1(i,a,a.type,a.pendingProps,c);case 7:return Os(i,a,a.pendingProps,c),a.child;case 8:return Os(i,a,a.pendingProps.children,c),a.child;case 12:return Os(i,a,a.pendingProps.children,c),a.child;case 10:return f=a.pendingProps,Lr(a,a.type,f.value),Os(i,a,f.children,c),a.child;case 9:return b=a.type._context,f=a.pendingProps.children,Ea(a),b=Ds(b),f=f(b),a.flags|=1,Os(i,a,f,c),a.child;case 14:return X1(i,a,a.type,a.pendingProps,c);case 15:return Z1(i,a,a.type,a.pendingProps,c);case 19:return a_(i,a,c);case 31:return FT(i,a,c);case 22:return Q1(i,a,c,a.pendingProps);case 24:return Ea(a),f=Ds(ns),i===null?(b=rm(),b===null&&(b=Ct,v=nm(),b.pooledCache=v,v.refCount++,v!==null&&(b.pooledCacheLanes|=c),b=v),a.memoizedState={parent:f,cache:b},om(a),Lr(a,ns,b)):((i.lanes&c)!==0&&(lm(i,a),Kl(a,null,null,c),Wl()),b=i.memoizedState,v=a.memoizedState,b.parent!==f?(b={parent:f,cache:f},a.memoizedState=b,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=b),Lr(a,ns,f)):(f=v.cache,Lr(a,ns,f),f!==b.cache&&sm(a,[ns],c,!0))),Os(i,a,a.pendingProps.children,c),a.child;case 29:throw a.pendingProps}throw Error(n(156,a.tag))}function nr(i){i.flags|=4}function Fm(i,a,c,f,b){if((a=(i.mode&32)!==0)&&(a=!1),a){if(i.flags|=16777216,(b&335544128)===b)if(i.stateNode.complete)i.flags|=8192;else if(O_())i.flags|=8192;else throw Aa=Zu,am}else i.flags&=-16777217}function l_(i,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!wy(a))if(O_())i.flags|=8192;else throw Aa=Zu,am}function md(i,a){a!==null&&(i.flags|=4),i.flags&16384&&(a=i.tag!==22?qe():536870912,i.lanes|=a,Io|=a)}function ec(i,a){if(!ot)switch(i.tailMode){case"hidden":a=i.tail;for(var c=null;a!==null;)a.alternate!==null&&(c=a),a=a.sibling;c===null?i.tail=null:c.sibling=null;break;case"collapsed":c=i.tail;for(var f=null;c!==null;)c.alternate!==null&&(f=c),c=c.sibling;f===null?a||i.tail===null?i.tail=null:i.tail.sibling=null:f.sibling=null}}function Dt(i){var a=i.alternate!==null&&i.alternate.child===i.child,c=0,f=0;if(a)for(var b=i.child;b!==null;)c|=b.lanes|b.childLanes,f|=b.subtreeFlags&65011712,f|=b.flags&65011712,b.return=i,b=b.sibling;else for(b=i.child;b!==null;)c|=b.lanes|b.childLanes,f|=b.subtreeFlags,f|=b.flags,b.return=i,b=b.sibling;return i.subtreeFlags|=f,i.childLanes=c,a}function VT(i,a,c){var f=a.pendingProps;switch(Zf(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Dt(a),null;case 1:return Dt(a),null;case 3:return c=a.stateNode,f=null,i!==null&&(f=i.memoizedState.cache),a.memoizedState.cache!==f&&(a.flags|=2048),Ji(ns),ve(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(i===null||i.child===null)&&(No(a)?nr(a):i===null||i.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Jf())),Dt(a),null;case 26:var b=a.type,v=a.memoizedState;return i===null?(nr(a),v!==null?(Dt(a),l_(a,v)):(Dt(a),Fm(a,b,null,f,c))):v?v!==i.memoizedState?(nr(a),Dt(a),l_(a,v)):(Dt(a),a.flags&=-16777217):(i=i.memoizedProps,i!==f&&nr(a),Dt(a),Fm(a,b,i,f,c)),null;case 27:if(ge(a),c=pe.current,b=a.type,i!==null&&a.stateNode!=null)i.memoizedProps!==f&&nr(a);else{if(!f){if(a.stateNode===null)throw Error(n(166));return Dt(a),null}i=he.current,No(a)?Hv(a):(i=py(b,f,c),a.stateNode=i,nr(a))}return Dt(a),null;case 5:if(ge(a),b=a.type,i!==null&&a.stateNode!=null)i.memoizedProps!==f&&nr(a);else{if(!f){if(a.stateNode===null)throw Error(n(166));return Dt(a),null}if(v=he.current,No(a))Hv(a);else{var N=Td(pe.current);switch(v){case 1:v=N.createElementNS("http://www.w3.org/2000/svg",b);break;case 2:v=N.createElementNS("http://www.w3.org/1998/Math/MathML",b);break;default:switch(b){case"svg":v=N.createElementNS("http://www.w3.org/2000/svg",b);break;case"math":v=N.createElementNS("http://www.w3.org/1998/Math/MathML",b);break;case"script":v=N.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof f.is=="string"?N.createElement("select",{is:f.is}):N.createElement("select"),f.multiple?v.multiple=!0:f.size&&(v.size=f.size);break;default:v=typeof f.is=="string"?N.createElement(b,{is:f.is}):N.createElement(b)}}v[Xt]=a,v[Hs]=f;e:for(N=a.child;N!==null;){if(N.tag===5||N.tag===6)v.appendChild(N.stateNode);else if(N.tag!==4&&N.tag!==27&&N.child!==null){N.child.return=N,N=N.child;continue}if(N===a)break e;for(;N.sibling===null;){if(N.return===null||N.return===a)break e;N=N.return}N.sibling.return=N.return,N=N.sibling}a.stateNode=v;e:switch(Ls(v,b,f),b){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}f&&nr(a)}}return Dt(a),Fm(a,a.type,i===null?null:i.memoizedProps,a.pendingProps,c),null;case 6:if(i&&a.stateNode!=null)i.memoizedProps!==f&&nr(a);else{if(typeof f!="string"&&a.stateNode===null)throw Error(n(166));if(i=pe.current,No(a)){if(i=a.stateNode,c=a.memoizedProps,f=null,b=Ms,b!==null)switch(b.tag){case 27:case 5:f=b.memoizedProps}i[Xt]=a,i=!!(i.nodeValue===c||f!==null&&f.suppressHydrationWarning===!0||iy(i.nodeValue,c)),i||Or(a,!0)}else i=Td(i).createTextNode(f),i[Xt]=a,a.stateNode=i}return Dt(a),null;case 31:if(c=a.memoizedState,i===null||i.memoizedState!==null){if(f=No(a),c!==null){if(i===null){if(!f)throw Error(n(318));if(i=a.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(n(557));i[Xt]=a}else Na(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Dt(a),i=!1}else c=Jf(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=c),i=!0;if(!i)return a.flags&256?(kn(a),a):(kn(a),null);if((a.flags&128)!==0)throw Error(n(558))}return Dt(a),null;case 13:if(f=a.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(b=No(a),f!==null&&f.dehydrated!==null){if(i===null){if(!b)throw Error(n(318));if(b=a.memoizedState,b=b!==null?b.dehydrated:null,!b)throw Error(n(317));b[Xt]=a}else Na(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Dt(a),b=!1}else b=Jf(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=b),b=!0;if(!b)return a.flags&256?(kn(a),a):(kn(a),null)}return kn(a),(a.flags&128)!==0?(a.lanes=c,a):(c=f!==null,i=i!==null&&i.memoizedState!==null,c&&(f=a.child,b=null,f.alternate!==null&&f.alternate.memoizedState!==null&&f.alternate.memoizedState.cachePool!==null&&(b=f.alternate.memoizedState.cachePool.pool),v=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(v=f.memoizedState.cachePool.pool),v!==b&&(f.flags|=2048)),c!==i&&c&&(a.child.flags|=8192),md(a,a.updateQueue),Dt(a),null);case 4:return ve(),i===null&&dp(a.stateNode.containerInfo),Dt(a),null;case 10:return Ji(a.type),Dt(a),null;case 19:if(Q(Qt),f=a.memoizedState,f===null)return Dt(a),null;if(b=(a.flags&128)!==0,v=f.rendering,v===null)if(b)ec(f,!1);else{if(Vt!==0||i!==null&&(i.flags&128)!==0)for(i=a.child;i!==null;){if(v=td(i),v!==null){for(a.flags|=128,ec(f,!1),i=v.updateQueue,a.updateQueue=i,md(a,i),a.subtreeFlags=0,i=c,c=a.child;c!==null;)zv(c,i),c=c.sibling;return re(Qt,Qt.current&1|2),ot&&Zi(a,f.treeForkCount),a.child}i=i.sibling}f.tail!==null&&gt()>vd&&(a.flags|=128,b=!0,ec(f,!1),a.lanes=4194304)}else{if(!b)if(i=td(v),i!==null){if(a.flags|=128,b=!0,i=i.updateQueue,a.updateQueue=i,md(a,i),ec(f,!0),f.tail===null&&f.tailMode==="hidden"&&!v.alternate&&!ot)return Dt(a),null}else 2*gt()-f.renderingStartTime>vd&&c!==536870912&&(a.flags|=128,b=!0,ec(f,!1),a.lanes=4194304);f.isBackwards?(v.sibling=a.child,a.child=v):(i=f.last,i!==null?i.sibling=v:a.child=v,f.last=v)}return f.tail!==null?(i=f.tail,f.rendering=i,f.tail=i.sibling,f.renderingStartTime=gt(),i.sibling=null,c=Qt.current,re(Qt,b?c&1|2:c&1),ot&&Zi(a,f.treeForkCount),i):(Dt(a),null);case 22:case 23:return kn(a),hm(),f=a.memoizedState!==null,i!==null?i.memoizedState!==null!==f&&(a.flags|=8192):f&&(a.flags|=8192),f?(c&536870912)!==0&&(a.flags&128)===0&&(Dt(a),a.subtreeFlags&6&&(a.flags|=8192)):Dt(a),c=a.updateQueue,c!==null&&md(a,c.retryQueue),c=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(c=i.memoizedState.cachePool.pool),f=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(f=a.memoizedState.cachePool.pool),f!==c&&(a.flags|=2048),i!==null&&Q(ja),null;case 24:return c=null,i!==null&&(c=i.memoizedState.cache),a.memoizedState.cache!==c&&(a.flags|=2048),Ji(ns),Dt(a),null;case 25:return null;case 30:return null}throw Error(n(156,a.tag))}function GT(i,a){switch(Zf(a),a.tag){case 1:return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 3:return Ji(ns),ve(),i=a.flags,(i&65536)!==0&&(i&128)===0?(a.flags=i&-65537|128,a):null;case 26:case 27:case 5:return ge(a),null;case 31:if(a.memoizedState!==null){if(kn(a),a.alternate===null)throw Error(n(340));Na()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 13:if(kn(a),i=a.memoizedState,i!==null&&i.dehydrated!==null){if(a.alternate===null)throw Error(n(340));Na()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 19:return Q(Qt),null;case 4:return ve(),null;case 10:return Ji(a.type),null;case 22:case 23:return kn(a),hm(),i!==null&&Q(ja),i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 24:return Ji(ns),null;case 25:return null;default:return null}}function c_(i,a){switch(Zf(a),a.tag){case 3:Ji(ns),ve();break;case 26:case 27:case 5:ge(a);break;case 4:ve();break;case 31:a.memoizedState!==null&&kn(a);break;case 13:kn(a);break;case 19:Q(Qt);break;case 10:Ji(a.type);break;case 22:case 23:kn(a),hm(),i!==null&&Q(ja);break;case 24:Ji(ns)}}function tc(i,a){try{var c=a.updateQueue,f=c!==null?c.lastEffect:null;if(f!==null){var b=f.next;c=b;do{if((c.tag&i)===i){f=void 0;var v=c.create,N=c.inst;f=v(),N.destroy=f}c=c.next}while(c!==b)}}catch(R){_t(a,a.return,R)}}function Hr(i,a,c){try{var f=a.updateQueue,b=f!==null?f.lastEffect:null;if(b!==null){var v=b.next;f=v;do{if((f.tag&i)===i){var N=f.inst,R=N.destroy;if(R!==void 0){N.destroy=void 0,b=a;var U=c,ee=R;try{ee()}catch(ae){_t(b,U,ae)}}}f=f.next}while(f!==v)}}catch(ae){_t(a,a.return,ae)}}function u_(i){var a=i.updateQueue;if(a!==null){var c=i.stateNode;try{e1(a,c)}catch(f){_t(i,i.return,f)}}}function d_(i,a,c){c.props=Da(i.type,i.memoizedProps),c.state=i.memoizedState;try{c.componentWillUnmount()}catch(f){_t(i,a,f)}}function sc(i,a){try{var c=i.ref;if(c!==null){switch(i.tag){case 26:case 27:case 5:var f=i.stateNode;break;case 30:f=i.stateNode;break;default:f=i.stateNode}typeof c=="function"?i.refCleanup=c(f):c.current=f}}catch(b){_t(i,a,b)}}function wi(i,a){var c=i.ref,f=i.refCleanup;if(c!==null)if(typeof f=="function")try{f()}catch(b){_t(i,a,b)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(b){_t(i,a,b)}else c.current=null}function h_(i){var a=i.type,c=i.memoizedProps,f=i.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":c.autoFocus&&f.focus();break e;case"img":c.src?f.src=c.src:c.srcSet&&(f.srcset=c.srcSet)}}catch(b){_t(i,i.return,b)}}function qm(i,a,c){try{var f=i.stateNode;mA(f,i.type,c,a),f[Hs]=a}catch(b){_t(i,i.return,b)}}function f_(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&Kr(i.type)||i.tag===4}function Vm(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||f_(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&Kr(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function Gm(i,a,c){var f=i.tag;if(f===5||f===6)i=i.stateNode,a?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(i,a):(a=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,a.appendChild(i),c=c._reactRootContainer,c!=null||a.onclick!==null||(a.onclick=xe));else if(f!==4&&(f===27&&Kr(i.type)&&(c=i.stateNode,a=null),i=i.child,i!==null))for(Gm(i,a,c),i=i.sibling;i!==null;)Gm(i,a,c),i=i.sibling}function pd(i,a,c){var f=i.tag;if(f===5||f===6)i=i.stateNode,a?c.insertBefore(i,a):c.appendChild(i);else if(f!==4&&(f===27&&Kr(i.type)&&(c=i.stateNode),i=i.child,i!==null))for(pd(i,a,c),i=i.sibling;i!==null;)pd(i,a,c),i=i.sibling}function m_(i){var a=i.stateNode,c=i.memoizedProps;try{for(var f=i.type,b=a.attributes;b.length;)a.removeAttributeNode(b[0]);Ls(a,f,c),a[Xt]=i,a[Hs]=c}catch(v){_t(i,i.return,v)}}var ir=!1,as=!1,Wm=!1,p_=typeof WeakSet=="function"?WeakSet:Set,Ss=null;function WT(i,a){if(i=i.containerInfo,mp=zd,i=Ev(i),$f(i)){if("selectionStart"in i)var c={start:i.selectionStart,end:i.selectionEnd};else e:{c=(c=i.ownerDocument)&&c.defaultView||window;var f=c.getSelection&&c.getSelection();if(f&&f.rangeCount!==0){c=f.anchorNode;var b=f.anchorOffset,v=f.focusNode;f=f.focusOffset;try{c.nodeType,v.nodeType}catch{c=null;break e}var N=0,R=-1,U=-1,ee=0,ae=0,ue=i,se=null;t:for(;;){for(var ne;ue!==c||b!==0&&ue.nodeType!==3||(R=N+b),ue!==v||f!==0&&ue.nodeType!==3||(U=N+f),ue.nodeType===3&&(N+=ue.nodeValue.length),(ne=ue.firstChild)!==null;)se=ue,ue=ne;for(;;){if(ue===i)break t;if(se===c&&++ee===b&&(R=N),se===v&&++ae===f&&(U=N),(ne=ue.nextSibling)!==null)break;ue=se,se=ue.parentNode}ue=ne}c=R===-1||U===-1?null:{start:R,end:U}}else c=null}c=c||{start:0,end:0}}else c=null;for(pp={focusedElem:i,selectionRange:c},zd=!1,Ss=a;Ss!==null;)if(a=Ss,i=a.child,(a.subtreeFlags&1028)!==0&&i!==null)i.return=a,Ss=i;else for(;Ss!==null;){switch(a=Ss,v=a.alternate,i=a.flags,a.tag){case 0:if((i&4)!==0&&(i=a.updateQueue,i=i!==null?i.events:null,i!==null))for(c=0;c<i.length;c++)b=i[c],b.ref.impl=b.nextImpl;break;case 11:case 15:break;case 1:if((i&1024)!==0&&v!==null){i=void 0,c=a,b=v.memoizedProps,v=v.memoizedState,f=c.stateNode;try{var je=Da(c.type,b);i=f.getSnapshotBeforeUpdate(je,v),f.__reactInternalSnapshotBeforeUpdate=i}catch(He){_t(c,c.return,He)}}break;case 3:if((i&1024)!==0){if(i=a.stateNode.containerInfo,c=i.nodeType,c===9)xp(i);else if(c===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":xp(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(n(163))}if(i=a.sibling,i!==null){i.return=a.return,Ss=i;break}Ss=a.return}}function g_(i,a,c){var f=c.flags;switch(c.tag){case 0:case 11:case 15:ar(i,c),f&4&&tc(5,c);break;case 1:if(ar(i,c),f&4)if(i=c.stateNode,a===null)try{i.componentDidMount()}catch(N){_t(c,c.return,N)}else{var b=Da(c.type,a.memoizedProps);a=a.memoizedState;try{i.componentDidUpdate(b,a,i.__reactInternalSnapshotBeforeUpdate)}catch(N){_t(c,c.return,N)}}f&64&&u_(c),f&512&&sc(c,c.return);break;case 3:if(ar(i,c),f&64&&(i=c.updateQueue,i!==null)){if(a=null,c.child!==null)switch(c.child.tag){case 27:case 5:a=c.child.stateNode;break;case 1:a=c.child.stateNode}try{e1(i,a)}catch(N){_t(c,c.return,N)}}break;case 27:a===null&&f&4&&m_(c);case 26:case 5:ar(i,c),a===null&&f&4&&h_(c),f&512&&sc(c,c.return);break;case 12:ar(i,c);break;case 31:ar(i,c),f&4&&v_(i,c);break;case 13:ar(i,c),f&4&&__(i,c),f&64&&(i=c.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(c=sA.bind(null,c),SA(i,c))));break;case 22:if(f=c.memoizedState!==null||ir,!f){a=a!==null&&a.memoizedState!==null||as,b=ir;var v=as;ir=f,(as=a)&&!v?or(i,c,(c.subtreeFlags&8772)!==0):ar(i,c),ir=b,as=v}break;case 30:break;default:ar(i,c)}}function b_(i){var a=i.alternate;a!==null&&(i.alternate=null,b_(a)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(a=i.stateNode,a!==null&&Cl(a)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var Bt=null,cn=!1;function rr(i,a,c){for(c=c.child;c!==null;)x_(i,a,c),c=c.sibling}function x_(i,a,c){if(ys&&typeof ys.onCommitFiberUnmount=="function")try{ys.onCommitFiberUnmount(qi,c)}catch{}switch(c.tag){case 26:as||wi(c,a),rr(i,a,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:as||wi(c,a);var f=Bt,b=cn;Kr(c.type)&&(Bt=c.stateNode,cn=!1),rr(i,a,c),dc(c.stateNode),Bt=f,cn=b;break;case 5:as||wi(c,a);case 6:if(f=Bt,b=cn,Bt=null,rr(i,a,c),Bt=f,cn=b,Bt!==null)if(cn)try{(Bt.nodeType===9?Bt.body:Bt.nodeName==="HTML"?Bt.ownerDocument.body:Bt).removeChild(c.stateNode)}catch(v){_t(c,a,v)}else try{Bt.removeChild(c.stateNode)}catch(v){_t(c,a,v)}break;case 18:Bt!==null&&(cn?(i=Bt,uy(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,c.stateNode),Go(i)):uy(Bt,c.stateNode));break;case 4:f=Bt,b=cn,Bt=c.stateNode.containerInfo,cn=!0,rr(i,a,c),Bt=f,cn=b;break;case 0:case 11:case 14:case 15:Hr(2,c,a),as||Hr(4,c,a),rr(i,a,c);break;case 1:as||(wi(c,a),f=c.stateNode,typeof f.componentWillUnmount=="function"&&d_(c,a,f)),rr(i,a,c);break;case 21:rr(i,a,c);break;case 22:as=(f=as)||c.memoizedState!==null,rr(i,a,c),as=f;break;default:rr(i,a,c)}}function v_(i,a){if(a.memoizedState===null&&(i=a.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{Go(i)}catch(c){_t(a,a.return,c)}}}function __(i,a){if(a.memoizedState===null&&(i=a.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{Go(i)}catch(c){_t(a,a.return,c)}}function KT(i){switch(i.tag){case 31:case 13:case 19:var a=i.stateNode;return a===null&&(a=i.stateNode=new p_),a;case 22:return i=i.stateNode,a=i._retryCache,a===null&&(a=i._retryCache=new p_),a;default:throw Error(n(435,i.tag))}}function gd(i,a){var c=KT(i);a.forEach(function(f){if(!c.has(f)){c.add(f);var b=nA.bind(null,i,f);f.then(b,b)}})}function un(i,a){var c=a.deletions;if(c!==null)for(var f=0;f<c.length;f++){var b=c[f],v=i,N=a,R=N;e:for(;R!==null;){switch(R.tag){case 27:if(Kr(R.type)){Bt=R.stateNode,cn=!1;break e}break;case 5:Bt=R.stateNode,cn=!1;break e;case 3:case 4:Bt=R.stateNode.containerInfo,cn=!0;break e}R=R.return}if(Bt===null)throw Error(n(160));x_(v,N,b),Bt=null,cn=!1,v=b.alternate,v!==null&&(v.return=null),b.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)y_(a,i),a=a.sibling}var li=null;function y_(i,a){var c=i.alternate,f=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:un(a,i),dn(i),f&4&&(Hr(3,i,i.return),tc(3,i),Hr(5,i,i.return));break;case 1:un(a,i),dn(i),f&512&&(as||c===null||wi(c,c.return)),f&64&&ir&&(i=i.updateQueue,i!==null&&(f=i.callbacks,f!==null&&(c=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=c===null?f:c.concat(f))));break;case 26:var b=li;if(un(a,i),dn(i),f&512&&(as||c===null||wi(c,c.return)),f&4){var v=c!==null?c.memoizedState:null;if(f=i.memoizedState,c===null)if(f===null)if(i.stateNode===null){e:{f=i.type,c=i.memoizedProps,b=b.ownerDocument||b;t:switch(f){case"title":v=b.getElementsByTagName("title")[0],(!v||v[ba]||v[Xt]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=b.createElement(f),b.head.insertBefore(v,b.querySelector("head > title"))),Ls(v,f,c),v[Xt]=i,ts(v),f=v;break e;case"link":var N=yy("link","href",b).get(f+(c.href||""));if(N){for(var R=0;R<N.length;R++)if(v=N[R],v.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&v.getAttribute("rel")===(c.rel==null?null:c.rel)&&v.getAttribute("title")===(c.title==null?null:c.title)&&v.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){N.splice(R,1);break t}}v=b.createElement(f),Ls(v,f,c),b.head.appendChild(v);break;case"meta":if(N=yy("meta","content",b).get(f+(c.content||""))){for(R=0;R<N.length;R++)if(v=N[R],v.getAttribute("content")===(c.content==null?null:""+c.content)&&v.getAttribute("name")===(c.name==null?null:c.name)&&v.getAttribute("property")===(c.property==null?null:c.property)&&v.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&v.getAttribute("charset")===(c.charSet==null?null:c.charSet)){N.splice(R,1);break t}}v=b.createElement(f),Ls(v,f,c),b.head.appendChild(v);break;default:throw Error(n(468,f))}v[Xt]=i,ts(v),f=v}i.stateNode=f}else Sy(b,i.type,i.stateNode);else i.stateNode=_y(b,f,i.memoizedProps);else v!==f?(v===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):v.count--,f===null?Sy(b,i.type,i.stateNode):_y(b,f,i.memoizedProps)):f===null&&i.stateNode!==null&&qm(i,i.memoizedProps,c.memoizedProps)}break;case 27:un(a,i),dn(i),f&512&&(as||c===null||wi(c,c.return)),c!==null&&f&4&&qm(i,i.memoizedProps,c.memoizedProps);break;case 5:if(un(a,i),dn(i),f&512&&(as||c===null||wi(c,c.return)),i.flags&32){b=i.stateNode;try{Ue(b,"")}catch(je){_t(i,i.return,je)}}f&4&&i.stateNode!=null&&(b=i.memoizedProps,qm(i,b,c!==null?c.memoizedProps:b)),f&1024&&(Wm=!0);break;case 6:if(un(a,i),dn(i),f&4){if(i.stateNode===null)throw Error(n(162));f=i.memoizedProps,c=i.stateNode;try{c.nodeValue=f}catch(je){_t(i,i.return,je)}}break;case 3:if(Md=null,b=li,li=Ad(a.containerInfo),un(a,i),li=b,dn(i),f&4&&c!==null&&c.memoizedState.isDehydrated)try{Go(a.containerInfo)}catch(je){_t(i,i.return,je)}Wm&&(Wm=!1,S_(i));break;case 4:f=li,li=Ad(i.stateNode.containerInfo),un(a,i),dn(i),li=f;break;case 12:un(a,i),dn(i);break;case 31:un(a,i),dn(i),f&4&&(f=i.updateQueue,f!==null&&(i.updateQueue=null,gd(i,f)));break;case 13:un(a,i),dn(i),i.child.flags&8192&&i.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(xd=gt()),f&4&&(f=i.updateQueue,f!==null&&(i.updateQueue=null,gd(i,f)));break;case 22:b=i.memoizedState!==null;var U=c!==null&&c.memoizedState!==null,ee=ir,ae=as;if(ir=ee||b,as=ae||U,un(a,i),as=ae,ir=ee,dn(i),f&8192)e:for(a=i.stateNode,a._visibility=b?a._visibility&-2:a._visibility|1,b&&(c===null||U||ir||as||Oa(i)),c=null,a=i;;){if(a.tag===5||a.tag===26){if(c===null){U=c=a;try{if(v=U.stateNode,b)N=v.style,typeof N.setProperty=="function"?N.setProperty("display","none","important"):N.display="none";else{R=U.stateNode;var ue=U.memoizedProps.style,se=ue!=null&&ue.hasOwnProperty("display")?ue.display:null;R.style.display=se==null||typeof se=="boolean"?"":(""+se).trim()}}catch(je){_t(U,U.return,je)}}}else if(a.tag===6){if(c===null){U=a;try{U.stateNode.nodeValue=b?"":U.memoizedProps}catch(je){_t(U,U.return,je)}}}else if(a.tag===18){if(c===null){U=a;try{var ne=U.stateNode;b?dy(ne,!0):dy(U.stateNode,!1)}catch(je){_t(U,U.return,je)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===i)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===i)break e;for(;a.sibling===null;){if(a.return===null||a.return===i)break e;c===a&&(c=null),a=a.return}c===a&&(c=null),a.sibling.return=a.return,a=a.sibling}f&4&&(f=i.updateQueue,f!==null&&(c=f.retryQueue,c!==null&&(f.retryQueue=null,gd(i,c))));break;case 19:un(a,i),dn(i),f&4&&(f=i.updateQueue,f!==null&&(i.updateQueue=null,gd(i,f)));break;case 30:break;case 21:break;default:un(a,i),dn(i)}}function dn(i){var a=i.flags;if(a&2){try{for(var c,f=i.return;f!==null;){if(f_(f)){c=f;break}f=f.return}if(c==null)throw Error(n(160));switch(c.tag){case 27:var b=c.stateNode,v=Vm(i);pd(i,v,b);break;case 5:var N=c.stateNode;c.flags&32&&(Ue(N,""),c.flags&=-33);var R=Vm(i);pd(i,R,N);break;case 3:case 4:var U=c.stateNode.containerInfo,ee=Vm(i);Gm(i,ee,U);break;default:throw Error(n(161))}}catch(ae){_t(i,i.return,ae)}i.flags&=-3}a&4096&&(i.flags&=-4097)}function S_(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var a=i;S_(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),i=i.sibling}}function ar(i,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)g_(i,a.alternate,a),a=a.sibling}function Oa(i){for(i=i.child;i!==null;){var a=i;switch(a.tag){case 0:case 11:case 14:case 15:Hr(4,a,a.return),Oa(a);break;case 1:wi(a,a.return);var c=a.stateNode;typeof c.componentWillUnmount=="function"&&d_(a,a.return,c),Oa(a);break;case 27:dc(a.stateNode);case 26:case 5:wi(a,a.return),Oa(a);break;case 22:a.memoizedState===null&&Oa(a);break;case 30:Oa(a);break;default:Oa(a)}i=i.sibling}}function or(i,a,c){for(c=c&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var f=a.alternate,b=i,v=a,N=v.flags;switch(v.tag){case 0:case 11:case 15:or(b,v,c),tc(4,v);break;case 1:if(or(b,v,c),f=v,b=f.stateNode,typeof b.componentDidMount=="function")try{b.componentDidMount()}catch(ee){_t(f,f.return,ee)}if(f=v,b=f.updateQueue,b!==null){var R=f.stateNode;try{var U=b.shared.hiddenCallbacks;if(U!==null)for(b.shared.hiddenCallbacks=null,b=0;b<U.length;b++)Jv(U[b],R)}catch(ee){_t(f,f.return,ee)}}c&&N&64&&u_(v),sc(v,v.return);break;case 27:m_(v);case 26:case 5:or(b,v,c),c&&f===null&&N&4&&h_(v),sc(v,v.return);break;case 12:or(b,v,c);break;case 31:or(b,v,c),c&&N&4&&v_(b,v);break;case 13:or(b,v,c),c&&N&4&&__(b,v);break;case 22:v.memoizedState===null&&or(b,v,c),sc(v,v.return);break;case 30:break;default:or(b,v,c)}a=a.sibling}}function Km(i,a){var c=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(c=i.memoizedState.cachePool.pool),i=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(i=a.memoizedState.cachePool.pool),i!==c&&(i!=null&&i.refCount++,c!=null&&Ul(c))}function Ym(i,a){i=null,a.alternate!==null&&(i=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==i&&(a.refCount++,i!=null&&Ul(i))}function ci(i,a,c,f){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)w_(i,a,c,f),a=a.sibling}function w_(i,a,c,f){var b=a.flags;switch(a.tag){case 0:case 11:case 15:ci(i,a,c,f),b&2048&&tc(9,a);break;case 1:ci(i,a,c,f);break;case 3:ci(i,a,c,f),b&2048&&(i=null,a.alternate!==null&&(i=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==i&&(a.refCount++,i!=null&&Ul(i)));break;case 12:if(b&2048){ci(i,a,c,f),i=a.stateNode;try{var v=a.memoizedProps,N=v.id,R=v.onPostCommit;typeof R=="function"&&R(N,a.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(U){_t(a,a.return,U)}}else ci(i,a,c,f);break;case 31:ci(i,a,c,f);break;case 13:ci(i,a,c,f);break;case 23:break;case 22:v=a.stateNode,N=a.alternate,a.memoizedState!==null?v._visibility&2?ci(i,a,c,f):nc(i,a):v._visibility&2?ci(i,a,c,f):(v._visibility|=2,Lo(i,a,c,f,(a.subtreeFlags&10256)!==0||!1)),b&2048&&Km(N,a);break;case 24:ci(i,a,c,f),b&2048&&Ym(a.alternate,a);break;default:ci(i,a,c,f)}}function Lo(i,a,c,f,b){for(b=b&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var v=i,N=a,R=c,U=f,ee=N.flags;switch(N.tag){case 0:case 11:case 15:Lo(v,N,R,U,b),tc(8,N);break;case 23:break;case 22:var ae=N.stateNode;N.memoizedState!==null?ae._visibility&2?Lo(v,N,R,U,b):nc(v,N):(ae._visibility|=2,Lo(v,N,R,U,b)),b&&ee&2048&&Km(N.alternate,N);break;case 24:Lo(v,N,R,U,b),b&&ee&2048&&Ym(N.alternate,N);break;default:Lo(v,N,R,U,b)}a=a.sibling}}function nc(i,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var c=i,f=a,b=f.flags;switch(f.tag){case 22:nc(c,f),b&2048&&Km(f.alternate,f);break;case 24:nc(c,f),b&2048&&Ym(f.alternate,f);break;default:nc(c,f)}a=a.sibling}}var ic=8192;function zo(i,a,c){if(i.subtreeFlags&ic)for(i=i.child;i!==null;)k_(i,a,c),i=i.sibling}function k_(i,a,c){switch(i.tag){case 26:zo(i,a,c),i.flags&ic&&i.memoizedState!==null&&OA(c,li,i.memoizedState,i.memoizedProps);break;case 5:zo(i,a,c);break;case 3:case 4:var f=li;li=Ad(i.stateNode.containerInfo),zo(i,a,c),li=f;break;case 22:i.memoizedState===null&&(f=i.alternate,f!==null&&f.memoizedState!==null?(f=ic,ic=16777216,zo(i,a,c),ic=f):zo(i,a,c));break;default:zo(i,a,c)}}function N_(i){var a=i.alternate;if(a!==null&&(i=a.child,i!==null)){a.child=null;do a=i.sibling,i.sibling=null,i=a;while(i!==null)}}function rc(i){var a=i.deletions;if((i.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var f=a[c];Ss=f,E_(f,i)}N_(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)C_(i),i=i.sibling}function C_(i){switch(i.tag){case 0:case 11:case 15:rc(i),i.flags&2048&&Hr(9,i,i.return);break;case 3:rc(i);break;case 12:rc(i);break;case 22:var a=i.stateNode;i.memoizedState!==null&&a._visibility&2&&(i.return===null||i.return.tag!==13)?(a._visibility&=-3,bd(i)):rc(i);break;default:rc(i)}}function bd(i){var a=i.deletions;if((i.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var f=a[c];Ss=f,E_(f,i)}N_(i)}for(i=i.child;i!==null;){switch(a=i,a.tag){case 0:case 11:case 15:Hr(8,a,a.return),bd(a);break;case 22:c=a.stateNode,c._visibility&2&&(c._visibility&=-3,bd(a));break;default:bd(a)}i=i.sibling}}function E_(i,a){for(;Ss!==null;){var c=Ss;switch(c.tag){case 0:case 11:case 15:Hr(8,c,a);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var f=c.memoizedState.cachePool.pool;f!=null&&f.refCount++}break;case 24:Ul(c.memoizedState.cache)}if(f=c.child,f!==null)f.return=c,Ss=f;else e:for(c=i;Ss!==null;){f=Ss;var b=f.sibling,v=f.return;if(b_(f),f===c){Ss=null;break e}if(b!==null){b.return=v,Ss=b;break e}Ss=v}}}var YT={getCacheForType:function(i){var a=Ds(ns),c=a.data.get(i);return c===void 0&&(c=i(),a.data.set(i,c)),c},cacheSignal:function(){return Ds(ns).controller.signal}},XT=typeof WeakMap=="function"?WeakMap:Map,mt=0,Ct=null,st=null,rt=0,vt=0,Nn=null,Ur=!1,Bo=!1,Xm=!1,lr=0,Vt=0,Fr=0,La=0,Zm=0,Cn=0,Io=0,ac=null,hn=null,Qm=!1,xd=0,j_=0,vd=1/0,_d=null,qr=null,ms=0,Vr=null,Po=null,cr=0,Jm=0,ep=null,T_=null,oc=0,tp=null;function En(){return(mt&2)!==0&&rt!==0?rt&-rt:I.T!==null?op():uo()}function A_(){if(Cn===0)if((rt&536870912)===0||ot){var i=ai;ai<<=1,(ai&3932160)===0&&(ai=262144),Cn=i}else Cn=536870912;return i=wn.current,i!==null&&(i.flags|=32),Cn}function fn(i,a,c){(i===Ct&&(vt===2||vt===9)||i.cancelPendingCommit!==null)&&($o(i,0),Gr(i,rt,Cn,!1)),Nt(i,c),((mt&2)===0||i!==Ct)&&(i===Ct&&((mt&2)===0&&(La|=c),Vt===4&&Gr(i,rt,Cn,!1)),ki(i))}function R_(i,a,c){if((mt&6)!==0)throw Error(n(327));var f=!c&&(a&127)===0&&(a&i.expiredLanes)===0||oe(i,a),b=f?JT(i,a):np(i,a,!0),v=f;do{if(b===0){Bo&&!f&&Gr(i,a,0,!1);break}else{if(c=i.current.alternate,v&&!ZT(c)){b=np(i,a,!1),v=!1;continue}if(b===2){if(v=a,i.errorRecoveryDisabledLanes&v)var N=0;else N=i.pendingLanes&-536870913,N=N!==0?N:N&536870912?536870912:0;if(N!==0){a=N;e:{var R=i;b=ac;var U=R.current.memoizedState.isDehydrated;if(U&&($o(R,N).flags|=256),N=np(R,N,!1),N!==2){if(Xm&&!U){R.errorRecoveryDisabledLanes|=v,La|=v,b=4;break e}v=hn,hn=b,v!==null&&(hn===null?hn=v:hn.push.apply(hn,v))}b=N}if(v=!1,b!==2)continue}}if(b===1){$o(i,0),Gr(i,a,0,!0);break}e:{switch(f=i,v=b,v){case 0:case 1:throw Error(n(345));case 4:if((a&4194048)!==a)break;case 6:Gr(f,a,Cn,!Ur);break e;case 2:hn=null;break;case 3:case 5:break;default:throw Error(n(329))}if((a&62914560)===a&&(b=xd+300-gt(),10<b)){if(Gr(f,a,Cn,!Ur),F(f,0,!0)!==0)break e;cr=a,f.timeoutHandle=ly(M_.bind(null,f,c,hn,_d,Qm,a,Cn,La,Io,Ur,v,"Throttled",-0,0),b);break e}M_(f,c,hn,_d,Qm,a,Cn,La,Io,Ur,v,null,-0,0)}}break}while(!0);ki(i)}function M_(i,a,c,f,b,v,N,R,U,ee,ae,ue,se,ne){if(i.timeoutHandle=-1,ue=a.subtreeFlags,ue&8192||(ue&16785408)===16785408){ue={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:xe},k_(a,v,ue);var je=(v&62914560)===v?xd-gt():(v&4194048)===v?j_-gt():0;if(je=LA(ue,je),je!==null){cr=v,i.cancelPendingCommit=je($_.bind(null,i,a,v,c,f,b,N,R,U,ae,ue,null,se,ne)),Gr(i,v,N,!ee);return}}$_(i,a,v,c,f,b,N,R,U)}function ZT(i){for(var a=i;;){var c=a.tag;if((c===0||c===11||c===15)&&a.flags&16384&&(c=a.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var f=0;f<c.length;f++){var b=c[f],v=b.getSnapshot;b=b.value;try{if(!yn(v(),b))return!1}catch{return!1}}if(c=a.child,a.subtreeFlags&16384&&c!==null)c.return=a,a=c;else{if(a===i)break;for(;a.sibling===null;){if(a.return===null||a.return===i)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Gr(i,a,c,f){a&=~Zm,a&=~La,i.suspendedLanes|=a,i.pingedLanes&=~a,f&&(i.warmLanes|=a),f=i.expirationTimes;for(var b=a;0<b;){var v=31-As(b),N=1<<v;f[v]=-1,b&=~N}c!==0&&Ne(i,c,a)}function yd(){return(mt&6)===0?(lc(0),!1):!0}function sp(){if(st!==null){if(vt===0)var i=st.return;else i=st,Qi=Ca=null,xm(i),Ao=null,ql=0,i=st;for(;i!==null;)c_(i.alternate,i),i=i.return;st=null}}function $o(i,a){var c=i.timeoutHandle;c!==-1&&(i.timeoutHandle=-1,bA(c)),c=i.cancelPendingCommit,c!==null&&(i.cancelPendingCommit=null,c()),cr=0,sp(),Ct=i,st=c=Xi(i.current,null),rt=a,vt=0,Nn=null,Ur=!1,Bo=oe(i,a),Xm=!1,Io=Cn=Zm=La=Fr=Vt=0,hn=ac=null,Qm=!1,(a&8)!==0&&(a|=a&32);var f=i.entangledLanes;if(f!==0)for(i=i.entanglements,f&=a;0<f;){var b=31-As(f),v=1<<b;a|=i[b],f&=~v}return lr=a,Uu(),c}function D_(i,a){Ye=null,I.H=Ql,a===To||a===Xu?(a=Yv(),vt=3):a===am?(a=Yv(),vt=4):vt=a===Om?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,Nn=a,st===null&&(Vt=1,ud(i,zn(a,i.current)))}function O_(){var i=wn.current;return i===null?!0:(rt&4194048)===rt?$n===null:(rt&62914560)===rt||(rt&536870912)!==0?i===$n:!1}function L_(){var i=I.H;return I.H=Ql,i===null?Ql:i}function z_(){var i=I.A;return I.A=YT,i}function Sd(){Vt=4,Ur||(rt&4194048)!==rt&&wn.current!==null||(Bo=!0),(Fr&134217727)===0&&(La&134217727)===0||Ct===null||Gr(Ct,rt,Cn,!1)}function np(i,a,c){var f=mt;mt|=2;var b=L_(),v=z_();(Ct!==i||rt!==a)&&(_d=null,$o(i,a)),a=!1;var N=Vt;e:do try{if(vt!==0&&st!==null){var R=st,U=Nn;switch(vt){case 8:sp(),N=6;break e;case 3:case 2:case 9:case 6:wn.current===null&&(a=!0);var ee=vt;if(vt=0,Nn=null,Ho(i,R,U,ee),c&&Bo){N=0;break e}break;default:ee=vt,vt=0,Nn=null,Ho(i,R,U,ee)}}QT(),N=Vt;break}catch(ae){D_(i,ae)}while(!0);return a&&i.shellSuspendCounter++,Qi=Ca=null,mt=f,I.H=b,I.A=v,st===null&&(Ct=null,rt=0,Uu()),N}function QT(){for(;st!==null;)B_(st)}function JT(i,a){var c=mt;mt|=2;var f=L_(),b=z_();Ct!==i||rt!==a?(_d=null,vd=gt()+500,$o(i,a)):Bo=oe(i,a);e:do try{if(vt!==0&&st!==null){a=st;var v=Nn;t:switch(vt){case 1:vt=0,Nn=null,Ho(i,a,v,1);break;case 2:case 9:if(Wv(v)){vt=0,Nn=null,I_(a);break}a=function(){vt!==2&&vt!==9||Ct!==i||(vt=7),ki(i)},v.then(a,a);break e;case 3:vt=7;break e;case 4:vt=5;break e;case 7:Wv(v)?(vt=0,Nn=null,I_(a)):(vt=0,Nn=null,Ho(i,a,v,7));break;case 5:var N=null;switch(st.tag){case 26:N=st.memoizedState;case 5:case 27:var R=st;if(N?wy(N):R.stateNode.complete){vt=0,Nn=null;var U=R.sibling;if(U!==null)st=U;else{var ee=R.return;ee!==null?(st=ee,wd(ee)):st=null}break t}}vt=0,Nn=null,Ho(i,a,v,5);break;case 6:vt=0,Nn=null,Ho(i,a,v,6);break;case 8:sp(),Vt=6;break e;default:throw Error(n(462))}}eA();break}catch(ae){D_(i,ae)}while(!0);return Qi=Ca=null,I.H=f,I.A=b,mt=c,st!==null?0:(Ct=null,rt=0,Uu(),Vt)}function eA(){for(;st!==null&&!bn();)B_(st)}function B_(i){var a=o_(i.alternate,i,lr);i.memoizedProps=i.pendingProps,a===null?wd(i):st=a}function I_(i){var a=i,c=a.alternate;switch(a.tag){case 15:case 0:a=t_(c,a,a.pendingProps,a.type,void 0,rt);break;case 11:a=t_(c,a,a.pendingProps,a.type.render,a.ref,rt);break;case 5:xm(a);default:c_(c,a),a=st=zv(a,lr),a=o_(c,a,lr)}i.memoizedProps=i.pendingProps,a===null?wd(i):st=a}function Ho(i,a,c,f){Qi=Ca=null,xm(a),Ao=null,ql=0;var b=a.return;try{if(UT(i,b,a,c,rt)){Vt=1,ud(i,zn(c,i.current)),st=null;return}}catch(v){if(b!==null)throw st=b,v;Vt=1,ud(i,zn(c,i.current)),st=null;return}a.flags&32768?(ot||f===1?i=!0:Bo||(rt&536870912)!==0?i=!1:(Ur=i=!0,(f===2||f===9||f===3||f===6)&&(f=wn.current,f!==null&&f.tag===13&&(f.flags|=16384))),P_(a,i)):wd(a)}function wd(i){var a=i;do{if((a.flags&32768)!==0){P_(a,Ur);return}i=a.return;var c=VT(a.alternate,a,lr);if(c!==null){st=c;return}if(a=a.sibling,a!==null){st=a;return}st=a=i}while(a!==null);Vt===0&&(Vt=5)}function P_(i,a){do{var c=GT(i.alternate,i);if(c!==null){c.flags&=32767,st=c;return}if(c=i.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!a&&(i=i.sibling,i!==null)){st=i;return}st=i=c}while(i!==null);Vt=6,st=null}function $_(i,a,c,f,b,v,N,R,U){i.cancelPendingCommit=null;do kd();while(ms!==0);if((mt&6)!==0)throw Error(n(327));if(a!==null){if(a===i.current)throw Error(n(177));if(v=a.lanes|a.childLanes,v|=Vf,Me(i,c,v,N,R,U),i===Ct&&(st=Ct=null,rt=0),Po=a,Vr=i,cr=c,Jm=v,ep=b,T_=f,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,iA(Fi,function(){return V_(),null})):(i.callbackNode=null,i.callbackPriority=0),f=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||f){f=I.T,I.T=null,b=W.p,W.p=2,N=mt,mt|=4;try{WT(i,a,c)}finally{mt=N,W.p=b,I.T=f}}ms=1,H_(),U_(),F_()}}function H_(){if(ms===1){ms=0;var i=Vr,a=Po,c=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||c){c=I.T,I.T=null;var f=W.p;W.p=2;var b=mt;mt|=4;try{y_(a,i);var v=pp,N=Ev(i.containerInfo),R=v.focusedElem,U=v.selectionRange;if(N!==R&&R&&R.ownerDocument&&Cv(R.ownerDocument.documentElement,R)){if(U!==null&&$f(R)){var ee=U.start,ae=U.end;if(ae===void 0&&(ae=ee),"selectionStart"in R)R.selectionStart=ee,R.selectionEnd=Math.min(ae,R.value.length);else{var ue=R.ownerDocument||document,se=ue&&ue.defaultView||window;if(se.getSelection){var ne=se.getSelection(),je=R.textContent.length,He=Math.min(U.start,je),wt=U.end===void 0?He:Math.min(U.end,je);!ne.extend&&He>wt&&(N=wt,wt=He,He=N);var X=Nv(R,He),G=Nv(R,wt);if(X&&G&&(ne.rangeCount!==1||ne.anchorNode!==X.node||ne.anchorOffset!==X.offset||ne.focusNode!==G.node||ne.focusOffset!==G.offset)){var J=ue.createRange();J.setStart(X.node,X.offset),ne.removeAllRanges(),He>wt?(ne.addRange(J),ne.extend(G.node,G.offset)):(J.setEnd(G.node,G.offset),ne.addRange(J))}}}}for(ue=[],ne=R;ne=ne.parentNode;)ne.nodeType===1&&ue.push({element:ne,left:ne.scrollLeft,top:ne.scrollTop});for(typeof R.focus=="function"&&R.focus(),R=0;R<ue.length;R++){var le=ue[R];le.element.scrollLeft=le.left,le.element.scrollTop=le.top}}zd=!!mp,pp=mp=null}finally{mt=b,W.p=f,I.T=c}}i.current=a,ms=2}}function U_(){if(ms===2){ms=0;var i=Vr,a=Po,c=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||c){c=I.T,I.T=null;var f=W.p;W.p=2;var b=mt;mt|=4;try{g_(i,a.alternate,a)}finally{mt=b,W.p=f,I.T=c}}ms=3}}function F_(){if(ms===4||ms===3){ms=0,Ts();var i=Vr,a=Po,c=cr,f=T_;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?ms=5:(ms=0,Po=Vr=null,q_(i,i.pendingLanes));var b=i.pendingLanes;if(b===0&&(qr=null),Vi(c),a=a.stateNode,ys&&typeof ys.onCommitFiberRoot=="function")try{ys.onCommitFiberRoot(qi,a,void 0,(a.current.flags&128)===128)}catch{}if(f!==null){a=I.T,b=W.p,W.p=2,I.T=null;try{for(var v=i.onRecoverableError,N=0;N<f.length;N++){var R=f[N];v(R.value,{componentStack:R.stack})}}finally{I.T=a,W.p=b}}(cr&3)!==0&&kd(),ki(i),b=i.pendingLanes,(c&261930)!==0&&(b&42)!==0?i===tp?oc++:(oc=0,tp=i):oc=0,lc(0)}}function q_(i,a){(i.pooledCacheLanes&=a)===0&&(a=i.pooledCache,a!=null&&(i.pooledCache=null,Ul(a)))}function kd(){return H_(),U_(),F_(),V_()}function V_(){if(ms!==5)return!1;var i=Vr,a=Jm;Jm=0;var c=Vi(cr),f=I.T,b=W.p;try{W.p=32>c?32:c,I.T=null,c=ep,ep=null;var v=Vr,N=cr;if(ms=0,Po=Vr=null,cr=0,(mt&6)!==0)throw Error(n(331));var R=mt;if(mt|=4,C_(v.current),w_(v,v.current,N,c),mt=R,lc(0,!1),ys&&typeof ys.onPostCommitFiberRoot=="function")try{ys.onPostCommitFiberRoot(qi,v)}catch{}return!0}finally{W.p=b,I.T=f,q_(i,a)}}function G_(i,a,c){a=zn(c,a),a=Dm(i.stateNode,a,2),i=Ir(i,a,2),i!==null&&(Nt(i,2),ki(i))}function _t(i,a,c){if(i.tag===3)G_(i,i,c);else for(;a!==null;){if(a.tag===3){G_(a,i,c);break}else if(a.tag===1){var f=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(qr===null||!qr.has(f))){i=zn(c,i),c=W1(2),f=Ir(a,c,2),f!==null&&(K1(c,f,a,i),Nt(f,2),ki(f));break}}a=a.return}}function ip(i,a,c){var f=i.pingCache;if(f===null){f=i.pingCache=new XT;var b=new Set;f.set(a,b)}else b=f.get(a),b===void 0&&(b=new Set,f.set(a,b));b.has(c)||(Xm=!0,b.add(c),i=tA.bind(null,i,a,c),a.then(i,i))}function tA(i,a,c){var f=i.pingCache;f!==null&&f.delete(a),i.pingedLanes|=i.suspendedLanes&c,i.warmLanes&=~c,Ct===i&&(rt&c)===c&&(Vt===4||Vt===3&&(rt&62914560)===rt&&300>gt()-xd?(mt&2)===0&&$o(i,0):Zm|=c,Io===rt&&(Io=0)),ki(i)}function W_(i,a){a===0&&(a=qe()),i=wa(i,a),i!==null&&(Nt(i,a),ki(i))}function sA(i){var a=i.memoizedState,c=0;a!==null&&(c=a.retryLane),W_(i,c)}function nA(i,a){var c=0;switch(i.tag){case 31:case 13:var f=i.stateNode,b=i.memoizedState;b!==null&&(c=b.retryLane);break;case 19:f=i.stateNode;break;case 22:f=i.stateNode._retryCache;break;default:throw Error(n(314))}f!==null&&f.delete(a),W_(i,c)}function iA(i,a){return _e(i,a)}var Nd=null,Uo=null,rp=!1,Cd=!1,ap=!1,Wr=0;function ki(i){i!==Uo&&i.next===null&&(Uo===null?Nd=Uo=i:Uo=Uo.next=i),Cd=!0,rp||(rp=!0,aA())}function lc(i,a){if(!ap&&Cd){ap=!0;do for(var c=!1,f=Nd;f!==null;){if(i!==0){var b=f.pendingLanes;if(b===0)var v=0;else{var N=f.suspendedLanes,R=f.pingedLanes;v=(1<<31-As(42|i)+1)-1,v&=b&~(N&~R),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(c=!0,Z_(f,v))}else v=rt,v=F(f,f===Ct?v:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(v&3)===0||oe(f,v)||(c=!0,Z_(f,v));f=f.next}while(c);ap=!1}}function rA(){K_()}function K_(){Cd=rp=!1;var i=0;Wr!==0&&gA()&&(i=Wr);for(var a=gt(),c=null,f=Nd;f!==null;){var b=f.next,v=Y_(f,a);v===0?(f.next=null,c===null?Nd=b:c.next=b,b===null&&(Uo=c)):(c=f,(i!==0||(v&3)!==0)&&(Cd=!0)),f=b}ms!==0&&ms!==5||lc(i),Wr!==0&&(Wr=0)}function Y_(i,a){for(var c=i.suspendedLanes,f=i.pingedLanes,b=i.expirationTimes,v=i.pendingLanes&-62914561;0<v;){var N=31-As(v),R=1<<N,U=b[N];U===-1?((R&c)===0||(R&f)!==0)&&(b[N]=ye(R,a)):U<=a&&(i.expiredLanes|=R),v&=~R}if(a=Ct,c=rt,c=F(i,i===a?c:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),f=i.callbackNode,c===0||i===a&&(vt===2||vt===9)||i.cancelPendingCommit!==null)return f!==null&&f!==null&&ft(f),i.callbackNode=null,i.callbackPriority=0;if((c&3)===0||oe(i,c)){if(a=c&-c,a===i.callbackPriority)return a;switch(f!==null&&ft(f),Vi(c)){case 2:case 8:c=Ui;break;case 32:c=Fi;break;case 268435456:c=Nr;break;default:c=Fi}return f=X_.bind(null,i),c=_e(c,f),i.callbackPriority=a,i.callbackNode=c,a}return f!==null&&f!==null&&ft(f),i.callbackPriority=2,i.callbackNode=null,2}function X_(i,a){if(ms!==0&&ms!==5)return i.callbackNode=null,i.callbackPriority=0,null;var c=i.callbackNode;if(kd()&&i.callbackNode!==c)return null;var f=rt;return f=F(i,i===Ct?f:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),f===0?null:(R_(i,f,a),Y_(i,gt()),i.callbackNode!=null&&i.callbackNode===c?X_.bind(null,i):null)}function Z_(i,a){if(kd())return null;R_(i,a,!0)}function aA(){xA(function(){(mt&6)!==0?_e(fs,rA):K_()})}function op(){if(Wr===0){var i=Eo;i===0&&(i=lt,lt<<=1,(lt&261888)===0&&(lt=256)),Wr=i}return Wr}function Q_(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:Ar(""+i)}function J_(i,a){var c=a.ownerDocument.createElement("input");return c.name=a.name,c.value=a.value,i.id&&c.setAttribute("form",i.id),a.parentNode.insertBefore(c,a),i=new FormData(i),c.parentNode.removeChild(c),i}function oA(i,a,c,f,b){if(a==="submit"&&c&&c.stateNode===b){var v=Q_((b[Hs]||null).action),N=f.submitter;N&&(a=(a=N[Hs]||null)?Q_(a.formAction):N.getAttribute("formAction"),a!==null&&(v=a,N=null));var R=new Iu("action","action",null,f,b);i.push({event:R,listeners:[{instance:null,listener:function(){if(f.defaultPrevented){if(Wr!==0){var U=N?J_(b,N):new FormData(b);Em(c,{pending:!0,data:U,method:b.method,action:v},null,U)}}else typeof v=="function"&&(R.preventDefault(),U=N?J_(b,N):new FormData(b),Em(c,{pending:!0,data:U,method:b.method,action:v},v,U))},currentTarget:b}]})}}for(var lp=0;lp<qf.length;lp++){var cp=qf[lp],lA=cp.toLowerCase(),cA=cp[0].toUpperCase()+cp.slice(1);oi(lA,"on"+cA)}oi(Av,"onAnimationEnd"),oi(Rv,"onAnimationIteration"),oi(Mv,"onAnimationStart"),oi("dblclick","onDoubleClick"),oi("focusin","onFocus"),oi("focusout","onBlur"),oi(NT,"onTransitionRun"),oi(CT,"onTransitionStart"),oi(ET,"onTransitionCancel"),oi(Dv,"onTransitionEnd"),me("onMouseEnter",["mouseout","mouseover"]),me("onMouseLeave",["mouseout","mouseover"]),me("onPointerEnter",["pointerout","pointerover"]),me("onPointerLeave",["pointerout","pointerover"]),Wi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Wi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Wi("onBeforeInput",["compositionend","keypress","textInput","paste"]),Wi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Wi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Wi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var cc="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(" "),uA=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(cc));function ey(i,a){a=(a&4)!==0;for(var c=0;c<i.length;c++){var f=i[c],b=f.event;f=f.listeners;e:{var v=void 0;if(a)for(var N=f.length-1;0<=N;N--){var R=f[N],U=R.instance,ee=R.currentTarget;if(R=R.listener,U!==v&&b.isPropagationStopped())break e;v=R,b.currentTarget=ee;try{v(b)}catch(ae){Hu(ae)}b.currentTarget=null,v=U}else for(N=0;N<f.length;N++){if(R=f[N],U=R.instance,ee=R.currentTarget,R=R.listener,U!==v&&b.isPropagationStopped())break e;v=R,b.currentTarget=ee;try{v(b)}catch(ae){Hu(ae)}b.currentTarget=null,v=U}}}}function nt(i,a){var c=a[Nl];c===void 0&&(c=a[Nl]=new Set);var f=i+"__bubble";c.has(f)||(ty(a,i,2,!1),c.add(f))}function up(i,a,c){var f=0;a&&(f|=4),ty(c,i,f,a)}var Ed="_reactListening"+Math.random().toString(36).slice(2);function dp(i){if(!i[Ed]){i[Ed]=!0,Au.forEach(function(c){c!=="selectionchange"&&(uA.has(c)||up(c,!1,i),up(c,!0,i))});var a=i.nodeType===9?i:i.ownerDocument;a===null||a[Ed]||(a[Ed]=!0,up("selectionchange",!1,a))}}function ty(i,a,c,f){switch(Ay(a)){case 2:var b=IA;break;case 8:b=PA;break;default:b=Cp}c=b.bind(null,a,c,i),b=void 0,!Rf||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(b=!0),f?b!==void 0?i.addEventListener(a,c,{capture:!0,passive:b}):i.addEventListener(a,c,!0):b!==void 0?i.addEventListener(a,c,{passive:b}):i.addEventListener(a,c,!1)}function hp(i,a,c,f,b){var v=f;if((a&1)===0&&(a&2)===0&&f!==null)e:for(;;){if(f===null)return;var N=f.tag;if(N===3||N===4){var R=f.stateNode.containerInfo;if(R===b)break;if(N===4)for(N=f.return;N!==null;){var U=N.tag;if((U===3||U===4)&&N.stateNode.containerInfo===b)return;N=N.return}for(;R!==null;){if(N=Ks(R),N===null)return;if(U=N.tag,U===5||U===6||U===26||U===27){f=v=N;continue e}R=R.parentNode}}f=f.return}Ou(function(){var ee=v,ae=Ke(c),ue=[];e:{var se=Ov.get(i);if(se!==void 0){var ne=Iu,je=i;switch(i){case"keypress":if(zu(c)===0)break e;case"keydown":case"keyup":ne=nT;break;case"focusin":je="focus",ne=Lf;break;case"focusout":je="blur",ne=Lf;break;case"beforeblur":case"afterblur":ne=Lf;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ne=cv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ne=Vj;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ne=aT;break;case Av:case Rv:case Mv:ne=Kj;break;case Dv:ne=lT;break;case"scroll":case"scrollend":ne=Fj;break;case"wheel":ne=uT;break;case"copy":case"cut":case"paste":ne=Xj;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ne=dv;break;case"toggle":case"beforetoggle":ne=hT}var He=(a&4)!==0,wt=!He&&(i==="scroll"||i==="scrollend"),X=He?se!==null?se+"Capture":null:se;He=[];for(var G=ee,J;G!==null;){var le=G;if(J=le.stateNode,le=le.tag,le!==5&&le!==26&&le!==27||J===null||X===null||(le=Rl(G,X),le!=null&&He.push(uc(G,le,J))),wt)break;G=G.return}0<He.length&&(se=new ne(se,je,null,c,ae),ue.push({event:se,listeners:He}))}}if((a&7)===0){e:{if(se=i==="mouseover"||i==="pointerover",ne=i==="mouseout"||i==="pointerout",se&&c!==De&&(je=c.relatedTarget||c.fromElement)&&(Ks(je)||je[Cr]))break e;if((ne||se)&&(se=ae.window===ae?ae:(se=ae.ownerDocument)?se.defaultView||se.parentWindow:window,ne?(je=c.relatedTarget||c.toElement,ne=ee,je=je?Ks(je):null,je!==null&&(wt=l(je),He=je.tag,je!==wt||He!==5&&He!==27&&He!==6)&&(je=null)):(ne=null,je=ee),ne!==je)){if(He=cv,le="onMouseLeave",X="onMouseEnter",G="mouse",(i==="pointerout"||i==="pointerover")&&(He=dv,le="onPointerLeave",X="onPointerEnter",G="pointer"),wt=ne==null?se:Er(ne),J=je==null?se:Er(je),se=new He(le,G+"leave",ne,c,ae),se.target=wt,se.relatedTarget=J,le=null,Ks(ae)===ee&&(He=new He(X,G+"enter",je,c,ae),He.target=J,He.relatedTarget=wt,le=He),wt=le,ne&&je)t:{for(He=dA,X=ne,G=je,J=0,le=X;le;le=He(le))J++;le=0;for(var Pe=G;Pe;Pe=He(Pe))le++;for(;0<J-le;)X=He(X),J--;for(;0<le-J;)G=He(G),le--;for(;J--;){if(X===G||G!==null&&X===G.alternate){He=X;break t}X=He(X),G=He(G)}He=null}else He=null;ne!==null&&sy(ue,se,ne,He,!1),je!==null&&wt!==null&&sy(ue,wt,je,He,!0)}}e:{if(se=ee?Er(ee):window,ne=se.nodeName&&se.nodeName.toLowerCase(),ne==="select"||ne==="input"&&se.type==="file")var ut=vv;else if(bv(se))if(_v)ut=ST;else{ut=_T;var Oe=vT}else ne=se.nodeName,!ne||ne.toLowerCase()!=="input"||se.type!=="checkbox"&&se.type!=="radio"?ee&&Tr(ee.elementType)&&(ut=vv):ut=yT;if(ut&&(ut=ut(i,ee))){xv(ue,ut,c,ae);break e}Oe&&Oe(i,se,ee),i==="focusout"&&ee&&se.type==="number"&&ee.memoizedProps.value!=null&&go(se,"number",se.value)}switch(Oe=ee?Er(ee):window,i){case"focusin":(bv(Oe)||Oe.contentEditable==="true")&&(vo=Oe,Hf=ee,Pl=null);break;case"focusout":Pl=Hf=vo=null;break;case"mousedown":Uf=!0;break;case"contextmenu":case"mouseup":case"dragend":Uf=!1,jv(ue,c,ae);break;case"selectionchange":if(kT)break;case"keydown":case"keyup":jv(ue,c,ae)}var Xe;if(Bf)e:{switch(i){case"compositionstart":var at="onCompositionStart";break e;case"compositionend":at="onCompositionEnd";break e;case"compositionupdate":at="onCompositionUpdate";break e}at=void 0}else xo?pv(i,c)&&(at="onCompositionEnd"):i==="keydown"&&c.keyCode===229&&(at="onCompositionStart");at&&(hv&&c.locale!=="ko"&&(xo||at!=="onCompositionStart"?at==="onCompositionEnd"&&xo&&(Xe=ov()):(Rr=ae,Mf="value"in Rr?Rr.value:Rr.textContent,xo=!0)),Oe=jd(ee,at),0<Oe.length&&(at=new uv(at,i,null,c,ae),ue.push({event:at,listeners:Oe}),Xe?at.data=Xe:(Xe=gv(c),Xe!==null&&(at.data=Xe)))),(Xe=mT?pT(i,c):gT(i,c))&&(at=jd(ee,"onBeforeInput"),0<at.length&&(Oe=new uv("onBeforeInput","beforeinput",null,c,ae),ue.push({event:Oe,listeners:at}),Oe.data=Xe)),oA(ue,i,ee,c,ae)}ey(ue,a)})}function uc(i,a,c){return{instance:i,listener:a,currentTarget:c}}function jd(i,a){for(var c=a+"Capture",f=[];i!==null;){var b=i,v=b.stateNode;if(b=b.tag,b!==5&&b!==26&&b!==27||v===null||(b=Rl(i,c),b!=null&&f.unshift(uc(i,b,v)),b=Rl(i,a),b!=null&&f.push(uc(i,b,v))),i.tag===3)return f;i=i.return}return[]}function dA(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function sy(i,a,c,f,b){for(var v=a._reactName,N=[];c!==null&&c!==f;){var R=c,U=R.alternate,ee=R.stateNode;if(R=R.tag,U!==null&&U===f)break;R!==5&&R!==26&&R!==27||ee===null||(U=ee,b?(ee=Rl(c,v),ee!=null&&N.unshift(uc(c,ee,U))):b||(ee=Rl(c,v),ee!=null&&N.push(uc(c,ee,U)))),c=c.return}N.length!==0&&i.push({event:a,listeners:N})}var hA=/\r\n?/g,fA=/\u0000|\uFFFD/g;function ny(i){return(typeof i=="string"?i:""+i).replace(hA,`
9
+ `).replace(fA,"")}function iy(i,a){return a=ny(a),ny(i)===a}function St(i,a,c,f,b,v){switch(c){case"children":typeof f=="string"?a==="body"||a==="textarea"&&f===""||Ue(i,f):(typeof f=="number"||typeof f=="bigint")&&a!=="body"&&Ue(i,""+f);break;case"className":vn(i,"class",f);break;case"tabIndex":vn(i,"tabindex",f);break;case"dir":case"role":case"viewBox":case"width":case"height":vn(i,c,f);break;case"style":xt(i,f,v);break;case"data":if(a!=="object"){vn(i,"data",f);break}case"src":case"href":if(f===""&&(a!=="a"||c!=="href")){i.removeAttribute(c);break}if(f==null||typeof f=="function"||typeof f=="symbol"||typeof f=="boolean"){i.removeAttribute(c);break}f=Ar(""+f),i.setAttribute(c,f);break;case"action":case"formAction":if(typeof f=="function"){i.setAttribute(c,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof v=="function"&&(c==="formAction"?(a!=="input"&&St(i,a,"name",b.name,b,null),St(i,a,"formEncType",b.formEncType,b,null),St(i,a,"formMethod",b.formMethod,b,null),St(i,a,"formTarget",b.formTarget,b,null)):(St(i,a,"encType",b.encType,b,null),St(i,a,"method",b.method,b,null),St(i,a,"target",b.target,b,null)));if(f==null||typeof f=="symbol"||typeof f=="boolean"){i.removeAttribute(c);break}f=Ar(""+f),i.setAttribute(c,f);break;case"onClick":f!=null&&(i.onclick=xe);break;case"onScroll":f!=null&&nt("scroll",i);break;case"onScrollEnd":f!=null&&nt("scrollend",i);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(n(61));if(c=f.__html,c!=null){if(b.children!=null)throw Error(n(60));i.innerHTML=c}}break;case"multiple":i.multiple=f&&typeof f!="function"&&typeof f!="symbol";break;case"muted":i.muted=f&&typeof f!="function"&&typeof f!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(f==null||typeof f=="function"||typeof f=="boolean"||typeof f=="symbol"){i.removeAttribute("xlink:href");break}c=Ar(""+f),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":f!=null&&typeof f!="function"&&typeof f!="symbol"?i.setAttribute(c,""+f):i.removeAttribute(c);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":f&&typeof f!="function"&&typeof f!="symbol"?i.setAttribute(c,""):i.removeAttribute(c);break;case"capture":case"download":f===!0?i.setAttribute(c,""):f!==!1&&f!=null&&typeof f!="function"&&typeof f!="symbol"?i.setAttribute(c,f):i.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":f!=null&&typeof f!="function"&&typeof f!="symbol"&&!isNaN(f)&&1<=f?i.setAttribute(c,f):i.removeAttribute(c);break;case"rowSpan":case"start":f==null||typeof f=="function"||typeof f=="symbol"||isNaN(f)?i.removeAttribute(c):i.setAttribute(c,f);break;case"popover":nt("beforetoggle",i),nt("toggle",i),Us(i,"popover",f);break;case"xlinkActuate":an(i,"http://www.w3.org/1999/xlink","xlink:actuate",f);break;case"xlinkArcrole":an(i,"http://www.w3.org/1999/xlink","xlink:arcrole",f);break;case"xlinkRole":an(i,"http://www.w3.org/1999/xlink","xlink:role",f);break;case"xlinkShow":an(i,"http://www.w3.org/1999/xlink","xlink:show",f);break;case"xlinkTitle":an(i,"http://www.w3.org/1999/xlink","xlink:title",f);break;case"xlinkType":an(i,"http://www.w3.org/1999/xlink","xlink:type",f);break;case"xmlBase":an(i,"http://www.w3.org/XML/1998/namespace","xml:base",f);break;case"xmlLang":an(i,"http://www.w3.org/XML/1998/namespace","xml:lang",f);break;case"xmlSpace":an(i,"http://www.w3.org/XML/1998/namespace","xml:space",f);break;case"is":Us(i,"is",f);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=Ki.get(c)||c,Us(i,c,f))}}function fp(i,a,c,f,b,v){switch(c){case"style":xt(i,f,v);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(n(61));if(c=f.__html,c!=null){if(b.children!=null)throw Error(n(60));i.innerHTML=c}}break;case"children":typeof f=="string"?Ue(i,f):(typeof f=="number"||typeof f=="bigint")&&Ue(i,""+f);break;case"onScroll":f!=null&&nt("scroll",i);break;case"onScrollEnd":f!=null&&nt("scrollend",i);break;case"onClick":f!=null&&(i.onclick=xe);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!xa.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(b=c.endsWith("Capture"),a=c.slice(2,b?c.length-7:void 0),v=i[Hs]||null,v=v!=null?v[c]:null,typeof v=="function"&&i.removeEventListener(a,v,b),typeof f=="function")){typeof v!="function"&&v!==null&&(c in i?i[c]=null:i.hasAttribute(c)&&i.removeAttribute(c)),i.addEventListener(a,f,b);break e}c in i?i[c]=f:f===!0?i.setAttribute(c,""):Us(i,c,f)}}}function Ls(i,a,c){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":nt("error",i),nt("load",i);var f=!1,b=!1,v;for(v in c)if(c.hasOwnProperty(v)){var N=c[v];if(N!=null)switch(v){case"src":f=!0;break;case"srcSet":b=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(n(137,a));default:St(i,a,v,N,c,null)}}b&&St(i,a,"srcSet",c.srcSet,c,null),f&&St(i,a,"src",c.src,c,null);return;case"input":nt("invalid",i);var R=v=N=b=null,U=null,ee=null;for(f in c)if(c.hasOwnProperty(f)){var ae=c[f];if(ae!=null)switch(f){case"name":b=ae;break;case"type":N=ae;break;case"checked":U=ae;break;case"defaultChecked":ee=ae;break;case"value":v=ae;break;case"defaultValue":R=ae;break;case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(n(137,a));break;default:St(i,a,f,ae,c,null)}}va(i,v,R,U,ee,N,b,!1);return;case"select":nt("invalid",i),f=N=v=null;for(b in c)if(c.hasOwnProperty(b)&&(R=c[b],R!=null))switch(b){case"value":v=R;break;case"defaultValue":N=R;break;case"multiple":f=R;default:St(i,a,b,R,c,null)}a=v,c=N,i.multiple=!!f,a!=null?Rs(i,!!f,a,!1):c!=null&&Rs(i,!!f,c,!0);return;case"textarea":nt("invalid",i),v=b=f=null;for(N in c)if(c.hasOwnProperty(N)&&(R=c[N],R!=null))switch(N){case"value":f=R;break;case"defaultValue":b=R;break;case"children":v=R;break;case"dangerouslySetInnerHTML":if(R!=null)throw Error(n(91));break;default:St(i,a,N,R,c,null)}bo(i,f,b,v);return;case"option":for(U in c)c.hasOwnProperty(U)&&(f=c[U],f!=null)&&(U==="selected"?i.selected=f&&typeof f!="function"&&typeof f!="symbol":St(i,a,U,f,c,null));return;case"dialog":nt("beforetoggle",i),nt("toggle",i),nt("cancel",i),nt("close",i);break;case"iframe":case"object":nt("load",i);break;case"video":case"audio":for(f=0;f<cc.length;f++)nt(cc[f],i);break;case"image":nt("error",i),nt("load",i);break;case"details":nt("toggle",i);break;case"embed":case"source":case"link":nt("error",i),nt("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ee in c)if(c.hasOwnProperty(ee)&&(f=c[ee],f!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":throw Error(n(137,a));default:St(i,a,ee,f,c,null)}return;default:if(Tr(a)){for(ae in c)c.hasOwnProperty(ae)&&(f=c[ae],f!==void 0&&fp(i,a,ae,f,c,void 0));return}}for(R in c)c.hasOwnProperty(R)&&(f=c[R],f!=null&&St(i,a,R,f,c,null))}function mA(i,a,c,f){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var b=null,v=null,N=null,R=null,U=null,ee=null,ae=null;for(ne in c){var ue=c[ne];if(c.hasOwnProperty(ne)&&ue!=null)switch(ne){case"checked":break;case"value":break;case"defaultValue":U=ue;default:f.hasOwnProperty(ne)||St(i,a,ne,null,f,ue)}}for(var se in f){var ne=f[se];if(ue=c[se],f.hasOwnProperty(se)&&(ne!=null||ue!=null))switch(se){case"type":v=ne;break;case"name":b=ne;break;case"checked":ee=ne;break;case"defaultChecked":ae=ne;break;case"value":N=ne;break;case"defaultValue":R=ne;break;case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(n(137,a));break;default:ne!==ue&&St(i,a,se,ne,f,ue)}}jl(i,N,R,U,ee,ae,v,b);return;case"select":ne=N=R=se=null;for(v in c)if(U=c[v],c.hasOwnProperty(v)&&U!=null)switch(v){case"value":break;case"multiple":ne=U;default:f.hasOwnProperty(v)||St(i,a,v,null,f,U)}for(b in f)if(v=f[b],U=c[b],f.hasOwnProperty(b)&&(v!=null||U!=null))switch(b){case"value":se=v;break;case"defaultValue":R=v;break;case"multiple":N=v;default:v!==U&&St(i,a,b,v,f,U)}a=R,c=N,f=ne,se!=null?Rs(i,!!c,se,!1):!!f!=!!c&&(a!=null?Rs(i,!!c,a,!0):Rs(i,!!c,c?[]:"",!1));return;case"textarea":ne=se=null;for(R in c)if(b=c[R],c.hasOwnProperty(R)&&b!=null&&!f.hasOwnProperty(R))switch(R){case"value":break;case"children":break;default:St(i,a,R,null,f,b)}for(N in f)if(b=f[N],v=c[N],f.hasOwnProperty(N)&&(b!=null||v!=null))switch(N){case"value":se=b;break;case"defaultValue":ne=b;break;case"children":break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(n(91));break;default:b!==v&&St(i,a,N,b,f,v)}Mu(i,se,ne);return;case"option":for(var je in c)se=c[je],c.hasOwnProperty(je)&&se!=null&&!f.hasOwnProperty(je)&&(je==="selected"?i.selected=!1:St(i,a,je,null,f,se));for(U in f)se=f[U],ne=c[U],f.hasOwnProperty(U)&&se!==ne&&(se!=null||ne!=null)&&(U==="selected"?i.selected=se&&typeof se!="function"&&typeof se!="symbol":St(i,a,U,se,f,ne));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var He in c)se=c[He],c.hasOwnProperty(He)&&se!=null&&!f.hasOwnProperty(He)&&St(i,a,He,null,f,se);for(ee in f)if(se=f[ee],ne=c[ee],f.hasOwnProperty(ee)&&se!==ne&&(se!=null||ne!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(n(137,a));break;default:St(i,a,ee,se,f,ne)}return;default:if(Tr(a)){for(var wt in c)se=c[wt],c.hasOwnProperty(wt)&&se!==void 0&&!f.hasOwnProperty(wt)&&fp(i,a,wt,void 0,f,se);for(ae in f)se=f[ae],ne=c[ae],!f.hasOwnProperty(ae)||se===ne||se===void 0&&ne===void 0||fp(i,a,ae,se,f,ne);return}}for(var X in c)se=c[X],c.hasOwnProperty(X)&&se!=null&&!f.hasOwnProperty(X)&&St(i,a,X,null,f,se);for(ue in f)se=f[ue],ne=c[ue],!f.hasOwnProperty(ue)||se===ne||se==null&&ne==null||St(i,a,ue,se,f,ne)}function ry(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function pA(){if(typeof performance.getEntriesByType=="function"){for(var i=0,a=0,c=performance.getEntriesByType("resource"),f=0;f<c.length;f++){var b=c[f],v=b.transferSize,N=b.initiatorType,R=b.duration;if(v&&R&&ry(N)){for(N=0,R=b.responseEnd,f+=1;f<c.length;f++){var U=c[f],ee=U.startTime;if(ee>R)break;var ae=U.transferSize,ue=U.initiatorType;ae&&ry(ue)&&(U=U.responseEnd,N+=ae*(U<R?1:(R-ee)/(U-ee)))}if(--f,a+=8*(v+N)/(b.duration/1e3),i++,10<i)break}}if(0<i)return a/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var mp=null,pp=null;function Td(i){return i.nodeType===9?i:i.ownerDocument}function ay(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function oy(i,a){if(i===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&a==="foreignObject"?0:i}function gp(i,a){return i==="textarea"||i==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var bp=null;function gA(){var i=window.event;return i&&i.type==="popstate"?i===bp?!1:(bp=i,!0):(bp=null,!1)}var ly=typeof setTimeout=="function"?setTimeout:void 0,bA=typeof clearTimeout=="function"?clearTimeout:void 0,cy=typeof Promise=="function"?Promise:void 0,xA=typeof queueMicrotask=="function"?queueMicrotask:typeof cy<"u"?function(i){return cy.resolve(null).then(i).catch(vA)}:ly;function vA(i){setTimeout(function(){throw i})}function Kr(i){return i==="head"}function uy(i,a){var c=a,f=0;do{var b=c.nextSibling;if(i.removeChild(c),b&&b.nodeType===8)if(c=b.data,c==="/$"||c==="/&"){if(f===0){i.removeChild(b),Go(a);return}f--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")f++;else if(c==="html")dc(i.ownerDocument.documentElement);else if(c==="head"){c=i.ownerDocument.head,dc(c);for(var v=c.firstChild;v;){var N=v.nextSibling,R=v.nodeName;v[ba]||R==="SCRIPT"||R==="STYLE"||R==="LINK"&&v.rel.toLowerCase()==="stylesheet"||c.removeChild(v),v=N}}else c==="body"&&dc(i.ownerDocument.body);c=b}while(c);Go(a)}function dy(i,a){var c=i;i=0;do{var f=c.nextSibling;if(c.nodeType===1?a?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(a?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),f&&f.nodeType===8)if(c=f.data,c==="/$"){if(i===0)break;i--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||i++;c=f}while(c)}function xp(i){var a=i.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var c=a;switch(a=a.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":xp(c),Cl(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}i.removeChild(c)}}function _A(i,a,c,f){for(;i.nodeType===1;){var b=c;if(i.nodeName.toLowerCase()!==a.toLowerCase()){if(!f&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(f){if(!i[ba])switch(a){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(v=i.getAttribute("rel"),v==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(v!==b.rel||i.getAttribute("href")!==(b.href==null||b.href===""?null:b.href)||i.getAttribute("crossorigin")!==(b.crossOrigin==null?null:b.crossOrigin)||i.getAttribute("title")!==(b.title==null?null:b.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(v=i.getAttribute("src"),(v!==(b.src==null?null:b.src)||i.getAttribute("type")!==(b.type==null?null:b.type)||i.getAttribute("crossorigin")!==(b.crossOrigin==null?null:b.crossOrigin))&&v&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(a==="input"&&i.type==="hidden"){var v=b.name==null?null:""+b.name;if(b.type==="hidden"&&i.getAttribute("name")===v)return i}else return i;if(i=Hn(i.nextSibling),i===null)break}return null}function yA(i,a,c){if(a==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!c||(i=Hn(i.nextSibling),i===null))return null;return i}function hy(i,a){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!a||(i=Hn(i.nextSibling),i===null))return null;return i}function vp(i){return i.data==="$?"||i.data==="$~"}function _p(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function SA(i,a){var c=i.ownerDocument;if(i.data==="$~")i._reactRetry=a;else if(i.data!=="$?"||c.readyState!=="loading")a();else{var f=function(){a(),c.removeEventListener("DOMContentLoaded",f)};c.addEventListener("DOMContentLoaded",f),i._reactRetry=f}}function Hn(i){for(;i!=null;i=i.nextSibling){var a=i.nodeType;if(a===1||a===3)break;if(a===8){if(a=i.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return i}var yp=null;function fy(i){i=i.nextSibling;for(var a=0;i;){if(i.nodeType===8){var c=i.data;if(c==="/$"||c==="/&"){if(a===0)return Hn(i.nextSibling);a--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||a++}i=i.nextSibling}return null}function my(i){i=i.previousSibling;for(var a=0;i;){if(i.nodeType===8){var c=i.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(a===0)return i;a--}else c!=="/$"&&c!=="/&"||a++}i=i.previousSibling}return null}function py(i,a,c){switch(a=Td(c),i){case"html":if(i=a.documentElement,!i)throw Error(n(452));return i;case"head":if(i=a.head,!i)throw Error(n(453));return i;case"body":if(i=a.body,!i)throw Error(n(454));return i;default:throw Error(n(451))}}function dc(i){for(var a=i.attributes;a.length;)i.removeAttributeNode(a[0]);Cl(i)}var Un=new Map,gy=new Set;function Ad(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var ur=W.d;W.d={f:wA,r:kA,D:NA,C:CA,L:EA,m:jA,X:AA,S:TA,M:RA};function wA(){var i=ur.f(),a=yd();return i||a}function kA(i){var a=Gi(i);a!==null&&a.tag===5&&a.type==="form"?D1(a):ur.r(i)}var Fo=typeof document>"u"?null:document;function by(i,a,c){var f=Fo;if(f&&typeof a=="string"&&a){var b=on(a);b='link[rel="'+i+'"][href="'+b+'"]',typeof c=="string"&&(b+='[crossorigin="'+c+'"]'),gy.has(b)||(gy.add(b),i={rel:i,crossOrigin:c,href:a},f.querySelector(b)===null&&(a=f.createElement("link"),Ls(a,"link",i),ts(a),f.head.appendChild(a)))}}function NA(i){ur.D(i),by("dns-prefetch",i,null)}function CA(i,a){ur.C(i,a),by("preconnect",i,a)}function EA(i,a,c){ur.L(i,a,c);var f=Fo;if(f&&i&&a){var b='link[rel="preload"][as="'+on(a)+'"]';a==="image"&&c&&c.imageSrcSet?(b+='[imagesrcset="'+on(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(b+='[imagesizes="'+on(c.imageSizes)+'"]')):b+='[href="'+on(i)+'"]';var v=b;switch(a){case"style":v=qo(i);break;case"script":v=Vo(i)}Un.has(v)||(i=g({rel:"preload",href:a==="image"&&c&&c.imageSrcSet?void 0:i,as:a},c),Un.set(v,i),f.querySelector(b)!==null||a==="style"&&f.querySelector(hc(v))||a==="script"&&f.querySelector(fc(v))||(a=f.createElement("link"),Ls(a,"link",i),ts(a),f.head.appendChild(a)))}}function jA(i,a){ur.m(i,a);var c=Fo;if(c&&i){var f=a&&typeof a.as=="string"?a.as:"script",b='link[rel="modulepreload"][as="'+on(f)+'"][href="'+on(i)+'"]',v=b;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=Vo(i)}if(!Un.has(v)&&(i=g({rel:"modulepreload",href:i},a),Un.set(v,i),c.querySelector(b)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(fc(v)))return}f=c.createElement("link"),Ls(f,"link",i),ts(f),c.head.appendChild(f)}}}function TA(i,a,c){ur.S(i,a,c);var f=Fo;if(f&&i){var b=jr(f).hoistableStyles,v=qo(i);a=a||"default";var N=b.get(v);if(!N){var R={loading:0,preload:null};if(N=f.querySelector(hc(v)))R.loading=5;else{i=g({rel:"stylesheet",href:i,"data-precedence":a},c),(c=Un.get(v))&&Sp(i,c);var U=N=f.createElement("link");ts(U),Ls(U,"link",i),U._p=new Promise(function(ee,ae){U.onload=ee,U.onerror=ae}),U.addEventListener("load",function(){R.loading|=1}),U.addEventListener("error",function(){R.loading|=2}),R.loading|=4,Rd(N,a,f)}N={type:"stylesheet",instance:N,count:1,state:R},b.set(v,N)}}}function AA(i,a){ur.X(i,a);var c=Fo;if(c&&i){var f=jr(c).hoistableScripts,b=Vo(i),v=f.get(b);v||(v=c.querySelector(fc(b)),v||(i=g({src:i,async:!0},a),(a=Un.get(b))&&wp(i,a),v=c.createElement("script"),ts(v),Ls(v,"link",i),c.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},f.set(b,v))}}function RA(i,a){ur.M(i,a);var c=Fo;if(c&&i){var f=jr(c).hoistableScripts,b=Vo(i),v=f.get(b);v||(v=c.querySelector(fc(b)),v||(i=g({src:i,async:!0,type:"module"},a),(a=Un.get(b))&&wp(i,a),v=c.createElement("script"),ts(v),Ls(v,"link",i),c.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},f.set(b,v))}}function xy(i,a,c,f){var b=(b=pe.current)?Ad(b):null;if(!b)throw Error(n(446));switch(i){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(a=qo(c.href),c=jr(b).hoistableStyles,f=c.get(a),f||(f={type:"style",instance:null,count:0,state:null},c.set(a,f)),f):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){i=qo(c.href);var v=jr(b).hoistableStyles,N=v.get(i);if(N||(b=b.ownerDocument||b,N={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(i,N),(v=b.querySelector(hc(i)))&&!v._p&&(N.instance=v,N.state.loading=5),Un.has(i)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},Un.set(i,c),v||MA(b,i,c,N.state))),a&&f===null)throw Error(n(528,""));return N}if(a&&f!==null)throw Error(n(529,""));return null;case"script":return a=c.async,c=c.src,typeof c=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=Vo(c),c=jr(b).hoistableScripts,f=c.get(a),f||(f={type:"script",instance:null,count:0,state:null},c.set(a,f)),f):{type:"void",instance:null,count:0,state:null};default:throw Error(n(444,i))}}function qo(i){return'href="'+on(i)+'"'}function hc(i){return'link[rel="stylesheet"]['+i+"]"}function vy(i){return g({},i,{"data-precedence":i.precedence,precedence:null})}function MA(i,a,c,f){i.querySelector('link[rel="preload"][as="style"]['+a+"]")?f.loading=1:(a=i.createElement("link"),f.preload=a,a.addEventListener("load",function(){return f.loading|=1}),a.addEventListener("error",function(){return f.loading|=2}),Ls(a,"link",c),ts(a),i.head.appendChild(a))}function Vo(i){return'[src="'+on(i)+'"]'}function fc(i){return"script[async]"+i}function _y(i,a,c){if(a.count++,a.instance===null)switch(a.type){case"style":var f=i.querySelector('style[data-href~="'+on(c.href)+'"]');if(f)return a.instance=f,ts(f),f;var b=g({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return f=(i.ownerDocument||i).createElement("style"),ts(f),Ls(f,"style",b),Rd(f,c.precedence,i),a.instance=f;case"stylesheet":b=qo(c.href);var v=i.querySelector(hc(b));if(v)return a.state.loading|=4,a.instance=v,ts(v),v;f=vy(c),(b=Un.get(b))&&Sp(f,b),v=(i.ownerDocument||i).createElement("link"),ts(v);var N=v;return N._p=new Promise(function(R,U){N.onload=R,N.onerror=U}),Ls(v,"link",f),a.state.loading|=4,Rd(v,c.precedence,i),a.instance=v;case"script":return v=Vo(c.src),(b=i.querySelector(fc(v)))?(a.instance=b,ts(b),b):(f=c,(b=Un.get(v))&&(f=g({},c),wp(f,b)),i=i.ownerDocument||i,b=i.createElement("script"),ts(b),Ls(b,"link",f),i.head.appendChild(b),a.instance=b);case"void":return null;default:throw Error(n(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(f=a.instance,a.state.loading|=4,Rd(f,c.precedence,i));return a.instance}function Rd(i,a,c){for(var f=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),b=f.length?f[f.length-1]:null,v=b,N=0;N<f.length;N++){var R=f[N];if(R.dataset.precedence===a)v=R;else if(v!==b)break}v?v.parentNode.insertBefore(i,v.nextSibling):(a=c.nodeType===9?c.head:c,a.insertBefore(i,a.firstChild))}function Sp(i,a){i.crossOrigin==null&&(i.crossOrigin=a.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=a.referrerPolicy),i.title==null&&(i.title=a.title)}function wp(i,a){i.crossOrigin==null&&(i.crossOrigin=a.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=a.referrerPolicy),i.integrity==null&&(i.integrity=a.integrity)}var Md=null;function yy(i,a,c){if(Md===null){var f=new Map,b=Md=new Map;b.set(c,f)}else b=Md,f=b.get(c),f||(f=new Map,b.set(c,f));if(f.has(i))return f;for(f.set(i,null),c=c.getElementsByTagName(i),b=0;b<c.length;b++){var v=c[b];if(!(v[ba]||v[Xt]||i==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var N=v.getAttribute(a)||"";N=i+N;var R=f.get(N);R?R.push(v):f.set(N,[v])}}return f}function Sy(i,a,c){i=i.ownerDocument||i,i.head.insertBefore(c,a==="title"?i.querySelector("head > title"):null)}function DA(i,a,c){if(c===1||a.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;return a.rel==="stylesheet"?(i=a.disabled,typeof a.precedence=="string"&&i==null):!0;case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function wy(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function OA(i,a,c,f){if(c.type==="stylesheet"&&(typeof f.media!="string"||matchMedia(f.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var b=qo(f.href),v=a.querySelector(hc(b));if(v){a=v._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(i.count++,i=Dd.bind(i),a.then(i,i)),c.state.loading|=4,c.instance=v,ts(v);return}v=a.ownerDocument||a,f=vy(f),(b=Un.get(b))&&Sp(f,b),v=v.createElement("link"),ts(v);var N=v;N._p=new Promise(function(R,U){N.onload=R,N.onerror=U}),Ls(v,"link",f),c.instance=v}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(c,a),(a=c.state.preload)&&(c.state.loading&3)===0&&(i.count++,c=Dd.bind(i),a.addEventListener("load",c),a.addEventListener("error",c))}}var kp=0;function LA(i,a){return i.stylesheets&&i.count===0&&Ld(i,i.stylesheets),0<i.count||0<i.imgCount?function(c){var f=setTimeout(function(){if(i.stylesheets&&Ld(i,i.stylesheets),i.unsuspend){var v=i.unsuspend;i.unsuspend=null,v()}},6e4+a);0<i.imgBytes&&kp===0&&(kp=62500*pA());var b=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&Ld(i,i.stylesheets),i.unsuspend)){var v=i.unsuspend;i.unsuspend=null,v()}},(i.imgBytes>kp?50:800)+a);return i.unsuspend=c,function(){i.unsuspend=null,clearTimeout(f),clearTimeout(b)}}:null}function Dd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ld(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var Od=null;function Ld(i,a){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Od=new Map,a.forEach(zA,i),Od=null,Dd.call(i))}function zA(i,a){if(!(a.state.loading&4)){var c=Od.get(i);if(c)var f=c.get(null);else{c=new Map,Od.set(i,c);for(var b=i.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<b.length;v++){var N=b[v];(N.nodeName==="LINK"||N.getAttribute("media")!=="not all")&&(c.set(N.dataset.precedence,N),f=N)}f&&c.set(null,f)}b=a.instance,N=b.getAttribute("data-precedence"),v=c.get(N)||f,v===f&&c.set(null,b),c.set(N,b),this.count++,f=Dd.bind(this),b.addEventListener("load",f),b.addEventListener("error",f),v?v.parentNode.insertBefore(b,v.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(b,i.firstChild)),a.state.loading|=4}}var mc={$$typeof:E,Provider:null,Consumer:null,_currentValue:Z,_currentValue2:Z,_threadCount:0};function BA(i,a,c,f,b,v,N,R,U){this.tag=1,this.containerInfo=i,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Rt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Rt(0),this.hiddenUpdates=Rt(null),this.identifierPrefix=f,this.onUncaughtError=b,this.onCaughtError=v,this.onRecoverableError=N,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=U,this.incompleteTransitions=new Map}function ky(i,a,c,f,b,v,N,R,U,ee,ae,ue){return i=new BA(i,a,c,N,U,ee,ae,ue,R),a=1,v===!0&&(a|=24),v=Sn(3,null,null,a),i.current=v,v.stateNode=i,a=nm(),a.refCount++,i.pooledCache=a,a.refCount++,v.memoizedState={element:f,isDehydrated:c,cache:a},om(v),i}function Ny(i){return i?(i=So,i):So}function Cy(i,a,c,f,b,v){b=Ny(b),f.context===null?f.context=b:f.pendingContext=b,f=Br(a),f.payload={element:c},v=v===void 0?null:v,v!==null&&(f.callback=v),c=Ir(i,f,a),c!==null&&(fn(c,i,a),Gl(c,i,a))}function Ey(i,a){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var c=i.retryLane;i.retryLane=c!==0&&c<a?c:a}}function Np(i,a){Ey(i,a),(i=i.alternate)&&Ey(i,a)}function jy(i){if(i.tag===13||i.tag===31){var a=wa(i,67108864);a!==null&&fn(a,i,67108864),Np(i,67108864)}}function Ty(i){if(i.tag===13||i.tag===31){var a=En();a=zt(a);var c=wa(i,a);c!==null&&fn(c,i,a),Np(i,a)}}var zd=!0;function IA(i,a,c,f){var b=I.T;I.T=null;var v=W.p;try{W.p=2,Cp(i,a,c,f)}finally{W.p=v,I.T=b}}function PA(i,a,c,f){var b=I.T;I.T=null;var v=W.p;try{W.p=8,Cp(i,a,c,f)}finally{W.p=v,I.T=b}}function Cp(i,a,c,f){if(zd){var b=Ep(f);if(b===null)hp(i,a,f,Bd,c),Ry(i,f);else if(HA(b,i,a,c,f))f.stopPropagation();else if(Ry(i,f),a&4&&-1<$A.indexOf(i)){for(;b!==null;){var v=Gi(b);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var N=$s(v.pendingLanes);if(N!==0){var R=v;for(R.pendingLanes|=2,R.entangledLanes|=2;N;){var U=1<<31-As(N);R.entanglements[1]|=U,N&=~U}ki(v),(mt&6)===0&&(vd=gt()+500,lc(0))}}break;case 31:case 13:R=wa(v,2),R!==null&&fn(R,v,2),yd(),Np(v,2)}if(v=Ep(f),v===null&&hp(i,a,f,Bd,c),v===b)break;b=v}b!==null&&f.stopPropagation()}else hp(i,a,f,null,c)}}function Ep(i){return i=Ke(i),jp(i)}var Bd=null;function jp(i){if(Bd=null,i=Ks(i),i!==null){var a=l(i);if(a===null)i=null;else{var c=a.tag;if(c===13){if(i=u(a),i!==null)return i;i=null}else if(c===31){if(i=h(a),i!==null)return i;i=null}else if(c===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;i=null}else a!==i&&(i=null)}}return Bd=i,null}function Ay(i){switch(i){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ri()){case fs:return 2;case Ui:return 8;case Fi:case oo:return 32;case Nr:return 268435456;default:return 32}default:return 32}}var Tp=!1,Yr=null,Xr=null,Zr=null,pc=new Map,gc=new Map,Qr=[],$A="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 Ry(i,a){switch(i){case"focusin":case"focusout":Yr=null;break;case"dragenter":case"dragleave":Xr=null;break;case"mouseover":case"mouseout":Zr=null;break;case"pointerover":case"pointerout":pc.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":gc.delete(a.pointerId)}}function bc(i,a,c,f,b,v){return i===null||i.nativeEvent!==v?(i={blockedOn:a,domEventName:c,eventSystemFlags:f,nativeEvent:v,targetContainers:[b]},a!==null&&(a=Gi(a),a!==null&&jy(a)),i):(i.eventSystemFlags|=f,a=i.targetContainers,b!==null&&a.indexOf(b)===-1&&a.push(b),i)}function HA(i,a,c,f,b){switch(a){case"focusin":return Yr=bc(Yr,i,a,c,f,b),!0;case"dragenter":return Xr=bc(Xr,i,a,c,f,b),!0;case"mouseover":return Zr=bc(Zr,i,a,c,f,b),!0;case"pointerover":var v=b.pointerId;return pc.set(v,bc(pc.get(v)||null,i,a,c,f,b)),!0;case"gotpointercapture":return v=b.pointerId,gc.set(v,bc(gc.get(v)||null,i,a,c,f,b)),!0}return!1}function My(i){var a=Ks(i.target);if(a!==null){var c=l(a);if(c!==null){if(a=c.tag,a===13){if(a=u(c),a!==null){i.blockedOn=a,ho(i.priority,function(){Ty(c)});return}}else if(a===31){if(a=h(c),a!==null){i.blockedOn=a,ho(i.priority,function(){Ty(c)});return}}else if(a===3&&c.stateNode.current.memoizedState.isDehydrated){i.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}i.blockedOn=null}function Id(i){if(i.blockedOn!==null)return!1;for(var a=i.targetContainers;0<a.length;){var c=Ep(i.nativeEvent);if(c===null){c=i.nativeEvent;var f=new c.constructor(c.type,c);De=f,c.target.dispatchEvent(f),De=null}else return a=Gi(c),a!==null&&jy(a),i.blockedOn=c,!1;a.shift()}return!0}function Dy(i,a,c){Id(i)&&c.delete(a)}function UA(){Tp=!1,Yr!==null&&Id(Yr)&&(Yr=null),Xr!==null&&Id(Xr)&&(Xr=null),Zr!==null&&Id(Zr)&&(Zr=null),pc.forEach(Dy),gc.forEach(Dy)}function Pd(i,a){i.blockedOn===a&&(i.blockedOn=null,Tp||(Tp=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,UA)))}var $d=null;function Oy(i){$d!==i&&($d=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){$d===i&&($d=null);for(var a=0;a<i.length;a+=3){var c=i[a],f=i[a+1],b=i[a+2];if(typeof f!="function"){if(jp(f||c)===null)continue;break}var v=Gi(c);v!==null&&(i.splice(a,3),a-=3,Em(v,{pending:!0,data:b,method:c.method,action:f},f,b))}}))}function Go(i){function a(U){return Pd(U,i)}Yr!==null&&Pd(Yr,i),Xr!==null&&Pd(Xr,i),Zr!==null&&Pd(Zr,i),pc.forEach(a),gc.forEach(a);for(var c=0;c<Qr.length;c++){var f=Qr[c];f.blockedOn===i&&(f.blockedOn=null)}for(;0<Qr.length&&(c=Qr[0],c.blockedOn===null);)My(c),c.blockedOn===null&&Qr.shift();if(c=(i.ownerDocument||i).$$reactFormReplay,c!=null)for(f=0;f<c.length;f+=3){var b=c[f],v=c[f+1],N=b[Hs]||null;if(typeof v=="function")N||Oy(c);else if(N){var R=null;if(v&&v.hasAttribute("formAction")){if(b=v,N=v[Hs]||null)R=N.formAction;else if(jp(b)!==null)continue}else R=N.action;typeof R=="function"?c[f+1]=R:(c.splice(f,3),f-=3),Oy(c)}}}function Ly(){function i(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(N){return b=N})},focusReset:"manual",scroll:"manual"})}function a(){b!==null&&(b(),b=null),f||setTimeout(c,20)}function c(){if(!f&&!navigation.transition){var v=navigation.currentEntry;v&&v.url!=null&&navigation.navigate(v.url,{state:v.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var f=!1,b=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(c,100),function(){f=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),b!==null&&(b(),b=null)}}}function Ap(i){this._internalRoot=i}Hd.prototype.render=Ap.prototype.render=function(i){var a=this._internalRoot;if(a===null)throw Error(n(409));var c=a.current,f=En();Cy(c,f,i,a,null,null)},Hd.prototype.unmount=Ap.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var a=i.containerInfo;Cy(i.current,2,null,i,null,null),yd(),a[Cr]=null}};function Hd(i){this._internalRoot=i}Hd.prototype.unstable_scheduleHydration=function(i){if(i){var a=uo();i={blockedOn:null,target:i,priority:a};for(var c=0;c<Qr.length&&a!==0&&a<Qr[c].priority;c++);Qr.splice(c,0,i),c===0&&My(i)}};var zy=t.version;if(zy!=="19.2.6")throw Error(n(527,zy,"19.2.6"));W.findDOMNode=function(i){var a=i._reactInternals;if(a===void 0)throw typeof i.render=="function"?Error(n(188)):(i=Object.keys(i).join(","),Error(n(268,i)));return i=d(a),i=i!==null?p(i):null,i=i===null?null:i.stateNode,i};var FA={bundleType:0,version:"19.2.6",rendererPackageName:"react-dom",currentDispatcherRef:I,reconcilerVersion:"19.2.6"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ud=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ud.isDisabled&&Ud.supportsFiber)try{qi=Ud.inject(FA),ys=Ud}catch{}}return vc.createRoot=function(i,a){if(!o(i))throw Error(n(299));var c=!1,f="",b=F1,v=q1,N=V1;return a!=null&&(a.unstable_strictMode===!0&&(c=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(b=a.onUncaughtError),a.onCaughtError!==void 0&&(v=a.onCaughtError),a.onRecoverableError!==void 0&&(N=a.onRecoverableError)),a=ky(i,1,!1,null,null,c,f,null,b,v,N,Ly),i[Cr]=a.current,dp(i),new Ap(a)},vc.hydrateRoot=function(i,a,c){if(!o(i))throw Error(n(299));var f=!1,b="",v=F1,N=q1,R=V1,U=null;return c!=null&&(c.unstable_strictMode===!0&&(f=!0),c.identifierPrefix!==void 0&&(b=c.identifierPrefix),c.onUncaughtError!==void 0&&(v=c.onUncaughtError),c.onCaughtError!==void 0&&(N=c.onCaughtError),c.onRecoverableError!==void 0&&(R=c.onRecoverableError),c.formState!==void 0&&(U=c.formState)),a=ky(i,1,!0,a,c??null,f,b,U,v,N,R,Ly),a.context=Ny(null),c=a.current,f=En(),f=zt(f),b=Br(f),b.callback=null,Ir(c,b,f),c=f,a.current.lanes=c,Nt(a,c),ki(a),i[Cr]=a.current,dp(i),new Hd(a)},vc.version="19.2.6",vc}var Gy;function JA(){if(Gy)return Dp.exports;Gy=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Dp.exports=QA(),Dp.exports}var kN=JA();const NN=(...e)=>e.filter((t,s,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===s).join(" ").trim();const e4=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const t4=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,s,n)=>n?n.toUpperCase():s.toLowerCase());const Wy=e=>{const t=t4(e);return t.charAt(0).toUpperCase()+t.slice(1)};var Bp={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const s4=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},n4=y.createContext({}),i4=()=>y.useContext(n4),r4=y.forwardRef(({color:e,size:t,strokeWidth:s,absoluteStrokeWidth:n,className:o="",children:l,iconNode:u,...h},m)=>{const{size:d=24,strokeWidth:p=2,absoluteStrokeWidth:g=!1,color:x="currentColor",className:_=""}=i4()??{},S=n??g?Number(s??p)*24/Number(t??d):s??p;return y.createElement("svg",{ref:m,...Bp,width:t??d??Bp.width,height:t??d??Bp.height,stroke:e??x,strokeWidth:S,className:NN("lucide",_,o),...!l&&!s4(h)&&{"aria-hidden":"true"},...h},[...u.map(([w,k])=>y.createElement(w,k)),...Array.isArray(l)?l:[l]])});const ce=(e,t)=>{const s=y.forwardRef(({className:n,...o},l)=>y.createElement(r4,{ref:l,iconNode:t,className:NN(`lucide-${e4(Wy(e))}`,`lucide-${e}`,n),...o}));return s.displayName=Wy(e),s};const a4=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Ka=ce("activity",a4);const o4=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],uf=ce("arrow-down",o4);const l4=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],hu=ce("arrow-left",l4);const c4=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],df=ce("arrow-up",c4);const u4=[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",key:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]],d4=ce("blocks",u4);const h4=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],f4=ce("book-open",h4);const m4=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],p4=ce("bot",m4);const g4=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],CN=ce("box",g4);const b4=[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]],x4=ce("braces",b4);const v4=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],EN=ce("brain",v4);const _4=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],y4=ce("calendar",_4);const S4=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],w4=ce("camera",S4);const k4=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],tn=ce("check",k4);const N4=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Mn=ce("chevron-down",N4);const C4=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],E4=ce("chevron-left",C4);const j4=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Jn=ce("chevron-right",j4);const T4=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],hf=ce("chevron-up",T4);const A4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Ub=ce("circle-alert",A4);const R4=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],ff=ce("circle-check-big",R4);const M4=[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]],D4=ce("circle-dashed",M4);const O4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],L4=ce("circle-dot",O4);const z4=[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],B4=ce("circle-play",z4);const I4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Fb=ce("circle-x",I4);const P4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Qc=ce("circle",P4);const $4=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],jN=ce("code-xml",$4);const H4=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Th=ce("copy",H4);const U4=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],F4=ce("corner-down-left",U4);const q4=[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],V4=ce("corner-down-right",q4);const G4=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],W4=ce("cpu",G4);const K4=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],Zn=ce("database",K4);const Y4=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],TN=ce("download",Y4);const X4=[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Z4=ce("earth",X4);const Q4=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],AN=ce("ellipsis",Q4);const J4=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],br=ce("external-link",J4);const eR=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],RN=ce("eye-off",eR);const tR=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],qb=ce("eye",tR);const sR=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],MN=ce("file-code-corner",sR);const nR=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]],iR=ce("file-diff",nR);const rR=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],DN=ce("file-exclamation-point",rR);const aR=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]],oR=ce("file-spreadsheet",aR);const lR=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Vb=ce("file-text",lR);const cR=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],ON=ce("file",cR);const uR=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],dR=ce("flask-conical",uR);const hR=[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]],Gb=ce("folder-git-2",hR);const fR=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],mf=ce("folder-open",fR);const mR=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],LN=ce("folder-plus",mR);const pR=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],so=ce("folder",pR);const gR=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],bR=ce("funnel",gR);const xR=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],zN=ce("gauge",xR);const vR=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],sn=ce("git-branch",vR);const _R=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]],yR=ce("git-commit-horizontal",_R);const SR=[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]],Ky=ce("git-fork",SR);const wR=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]],Wb=ce("git-merge",wR);const kR=[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 9v12",key:"1sc30k"}],["path",{d:"m21 3-6 6",key:"16nqsk"}],["path",{d:"m21 9-6-6",key:"9j17rh"}],["path",{d:"M18 11.5V15",key:"65xf6f"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}]],NR=ce("git-pull-request-closed",kR);const CR=[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 9v12",key:"1sc30k"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v3",key:"1jb6z3"}],["path",{d:"M18 15v6",key:"9wciyi"}],["path",{d:"M21 18h-6",key:"139f0c"}]],ER=ce("git-pull-request-create",CR);const jR=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]],BN=ce("git-pull-request",jR);const TR=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],AR=ce("grip-vertical",TR);const RR=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],MR=ce("heart",RR);const DR=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],OR=ce("history",DR);const LR=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],zR=ce("image",LR);const BR=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],Ah=ce("inbox",BR);const IR=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],IN=ce("key-round",IR);const PR=[["path",{d:"M10 5h11",key:"1hkqpe"}],["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 19h11",key:"14g2nv"}],["path",{d:"m3 10 3-3-3-3",key:"i7pm08"}],["path",{d:"m3 20 3-3-3-3",key:"20gx1n"}]],$R=ce("list-collapse",PR);const HR=[["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"M3 10a2 2 0 0 0 2 2h3",key:"1npucw"}],["path",{d:"M3 5v12a2 2 0 0 0 2 2h3",key:"x1gjn2"}]],UR=ce("list-tree",HR);const FR=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],ht=ce("loader-circle",FR);const qR=[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]],Yy=ce("loader",qR);const VR=[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]],GR=ce("lock-keyhole",VR);const WR=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],PN=ce("lock-open",WR);const KR=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],YR=ce("lock",KR);const XR=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],$N=ce("maximize-2",XR);const ZR=[["path",{d:"M12 12v-2",key:"fwoke6"}],["path",{d:"M12 18v-2",key:"qj6yno"}],["path",{d:"M16 12v-2",key:"heuere"}],["path",{d:"M16 18v-2",key:"s1ct0w"}],["path",{d:"M2 11h1.5",key:"15p63e"}],["path",{d:"M20 18v-2",key:"12ehxp"}],["path",{d:"M20.5 11H22",key:"khsy7a"}],["path",{d:"M4 18v-2",key:"1c3oqr"}],["path",{d:"M8 12v-2",key:"1mwtfd"}],["path",{d:"M8 18v-2",key:"qcmpov"}],["rect",{x:"2",y:"6",width:"20",height:"10",rx:"2",key:"1qcswk"}]],QR=ce("memory-stick",ZR);const JR=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],eM=ce("message-circle-warning",JR);const tM=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M12 8v6",key:"1ib9pf"}],["path",{d:"M9 11h6",key:"1fldmi"}]],HN=ce("message-square-plus",tM);const sM=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],nM=ce("message-square",sM);const iM=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],UN=ce("minimize-2",iM);const rM=[["path",{d:"M5 12h14",key:"1ays0h"}]],aM=ce("minus",rM);const oM=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],lM=ce("moon",oM);const cM=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],uM=ce("network",cM);const dM=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],hM=ce("palette",dM);const fM=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],mM=ce("panel-left-close",fM);const pM=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],gM=ce("panel-left-open",pM);const bM=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],xM=ce("panel-left",bM);const vM=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]],_M=ce("panel-top",vM);const yM=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],SM=ce("paperclip",yM);const wM=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],kM=ce("pen-line",wM);const NM=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],ll=ce("pencil",NM);const CM=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],vr=ce("play",CM);const EM=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]],FN=ce("plug",EM);const jM=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],hs=ce("plus",jM);const TM=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],AM=ce("radio",TM);const RM=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],_r=ce("refresh-cw",RM);const MM=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],fu=ce("rotate-ccw",MM);const DM=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],qN=ce("save",DM);const OM=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],VN=ce("scroll-text",OM);const LM=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],zM=ce("search",LM);const BM=[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]],IM=ce("send-horizontal",BM);const PM=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],GN=ce("server",PM);const $M=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],HM=ce("settings-2",$M);const UM=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],WN=ce("shield-alert",UM);const FM=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],qM=ce("shield-check",FM);const VM=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}],["path",{d:"M12 17h.01",key:"p32p05"}]],KN=ce("shield-question-mark",VM);const GM=[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]],YN=ce("skip-forward",GM);const WM=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],pi=ce("sparkles",WM);const KM=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],YM=ce("square-terminal",KM);const XM=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],cl=ce("square",XM);const ZM=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],QM=ce("sun",ZM);const JM=[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",key:"gugj83"}]],XN=ce("table-2",JM);const e6=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],pl=ce("terminal",e6);const t6=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],yr=ce("trash-2",t6);const s6=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],mu=ce("triangle-alert",s6);const n6=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Kb=ce("upload",n6);const i6=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],r6=ce("user",i6);const a6=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],o6=ce("wand-sparkles",a6);const l6=[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]],c6=ce("webhook",l6);const u6=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],d6=ce("wrench",u6);const h6=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ft=ce("x",h6);const f6=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],m6=ce("zap",f6);class ZN extends Error{conflict;constructor(t,s){super(t),this.name="PortConflictResponseError",this.conflict=s}}async function Se(e,t){const s=await fetch(e,t),n=await s.json().catch(()=>{});if(!s.ok)throw s.status===409&&n?.conflict?.code==="PORT_IN_USE"?new ZN(n?.error||"Port already in use",n.conflict):new Error(n?.error||s.statusText);return n}async function en(e,t){const s=new URLSearchParams;for(const[n,o]of Object.entries(t))o!==void 0&&String(o).trim()&&s.set(n,String(o));await Se(e,{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:s})}async function ei(e,t){const s=new URLSearchParams;for(const[n,o]of Object.entries(t))o!==void 0&&String(o).trim()&&s.set(n,String(o));return Se(e,{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:s})}async function QN(){return(await Se("/api/agent")).agent}async function p6(e){return(await Se(`/api/agent/mcp-status?agent=${encodeURIComponent(e)}`)).statuses}async function g6(){return(await Se("/api/agent/usage")).usage}async function b6(){return(await Se("/api/agent/claude-settings")).settings}async function x6(e){return(await Se("/api/agent/claude-settings",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})).settings}async function v6(){const e=await Se("/api/agent/chat/status");return{configured:e.configured,approvals:e.approvals,provider:e.provider}}async function _6(e,t,s){await Se("/api/agent/chat/approve",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sessionId:e,requestId:t,decision:s})})}async function y6(e,t,s,n,o){const l=await fetch("/api/agent/chat",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({message:e,resumeSessionId:t,autoApprove:o}),signal:n});if(!l.ok||!l.body){const d=await l.json().catch(()=>{});throw new Error(d?.error||l.statusText||"Agent request failed")}const u=l.body.getReader(),h=new TextDecoder;let m="";for(;;){const{done:d,value:p}=await u.read();if(d)break;m+=h.decode(p,{stream:!0});let g=m.indexOf(`
10
+
11
+ `);for(;g!==-1;){const x=m.slice(0,g);m=m.slice(g+2);const _=x.split(`
12
+ `).find(S=>S.startsWith("data:"));if(_){const S=_.slice(5).trim();if(S)try{s(JSON.parse(S))}catch{}}g=m.indexOf(`
13
+
14
+ `)}}}async function JN(){return(await Se("/api/databases")).connections}async function S6(){return(await Se("/api/databases/detect")).detected}async function w6(e){await ei("/api/databases",e)}async function k6(e){return ei("/api/databases/test",e)}async function N6(e){await Se(`/api/databases/${encodeURIComponent(e)}`,{method:"DELETE"})}async function eC(e){return(await Se(`/api/databases/${encodeURIComponent(e)}/tables`)).tables}async function C6(e,t,s=100){return ei(`/api/databases/${encodeURIComponent(e)}/query`,{sql:t,limit:s})}async function E6(e,t){await ei(`/api/databases/${encodeURIComponent(e)}/write-access`,{unlocked:String(t)})}async function Xy(e,t,s){return ei(`/api/databases/${encodeURIComponent(e)}/execute`,{sql:t,mode:s})}async function j6(e,t,s=100,n=0){return Se(`/api/databases/${encodeURIComponent(e)}/rows?table=${encodeURIComponent(t)}&limit=${s}&offset=${n}`)}async function tC(e=100){return(await Se(`/api/errors?limit=${e}`)).incidents}async function T6(e){return Se(`/api/errors/${e}/prompt`)}async function A6(e=200){return(await Se(`/api/git/graph?limit=${e}`)).commits}async function R6(e,t){const s=new URLSearchParams({hash:e});t&&s.set("file",t);const n=await fetch(`/api/git/commit?${s.toString()}`);if(!n.ok){const o=await n.json().catch(()=>({error:n.statusText}));throw new Error(o.error||"Unable to load commit diff")}return n.text()}async function M6(e){return(await Se(`/api/git/commit/files?hash=${encodeURIComponent(e)}`)).files}async function D6(){return(await Se("/api/git/files")).files}async function O6(){return(await Se("/api/git/file-sizes")).files}async function L6(e){const t=await Se(`/api/git/file?path=${encodeURIComponent(e)}`);return{content:t.content,truncated:t.truncated,binary:t.binary,size:t.size}}async function z6(e,t){await Se("/api/git/file",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({path:e,content:t})})}async function sC(e,t){const s=new URLSearchParams({file:e});t&&s.set("repo",t);const n=await fetch(`/api/git/diff?${s.toString()}`);if(!n.ok){const o=await n.json().catch(()=>({error:n.statusText}));throw new Error(o.error||"Unable to load diff")}return n.text()}async function Ip(){const e=await Se("/api/git/overview"),t=e.repos??[],s=e.board??t.map(n=>n.name);return{repos:t,board:s}}async function Zy(e){return(await Se("/api/git/board",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({names:e})})).board}async function Yb(e,t){await Se("/api/git/stage",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t?{paths:e,repo:t}:{paths:e})})}async function nC(e,t){await Se("/api/git/unstage",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t?{paths:e,repo:t}:{paths:e})})}async function iC(e,t){return(await ei("/api/git/commit",{message:e,...t?{repo:t}:{}})).output}async function pf(e){const t=await ei("/api/git/push",e?{repo:e}:{});return{output:t.output,branch:t.branch,setUpstream:t.setUpstream}}async function B6(){const e=await ei("/api/git/default-branch/pull",{});return{output:e.output,branch:e.branch}}async function I6(e){return(await ei("/api/git/branches",{name:e})).output}async function P6(e){await Se(`/api/git/repositories/${encodeURIComponent(e)}`,{method:"DELETE"})}async function $6(){return Se("/api/github/token")}async function H6(){return await Se("/api/github/oauth/start",{method:"POST"})}async function U6(e){const t=await Se("/api/github/oauth/poll",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({device_code:e})});return{done:t.done,slowDown:t.slowDown}}async function F6(e,t){const s=new URLSearchParams({host:e,token:t});await Se("/api/github/token",{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:s})}async function q6(e){await Se(`/api/github/token/${encodeURIComponent(e)}`,{method:"DELETE"})}async function V6(){const e=await Se("/api/github/branches");return{repository:e.repository,defaultBranch:e.defaultBranch,currentBranch:e.currentBranch,branches:e.branches}}async function Pp(e="open",t=1){return(await Se(`/api/github/prs?state=${e}&page=${t}`)).prs}async function G6(e){return(await Se(`/api/github/prs/${e}`)).pr}async function W6(e){const t=await fetch(`/api/github/prs/${e}/diff`);if(!t.ok){const s=await t.json().catch(()=>({error:t.statusText}));throw new Error(s.error||"Unable to load PR diff")}return t.text()}async function K6(e){return(await Se(`/api/github/prs/${e}/review`)).cockpit}async function Y6(){return(await Se("/api/github/pr-template")).template}async function X6(e){return(await Se("/api/github/prs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})).pr}async function Z6(e,t={}){const s=await Se(`/api/github/prs/${e}/merge`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({method:t.method??"squash",...t})});return{merged:s.merged,sha:s.sha,message:s.message}}async function $p(e="open",t=1){return(await Se(`/api/github/issues?state=${e}&page=${t}`)).issues}async function Q6(e){return(await Se(`/api/github/issues/${e}`)).issue}async function J6(e){return(await Se(`/api/github/issues/${e}/comments`)).comments}async function e8(e,t){return(await Se(`/api/github/issues/${e}/comments`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({body:t})})).comment}async function t8(e){return(await Se(`/api/github/ci/${encodeURIComponent(e)}`)).status}async function m0(e,t=1){const s=new URLSearchParams({page:String(t)});return e&&s.set("branch",e),(await Se(`/api/github/runs?${s}`)).runs}async function s8(e){return(await Se(`/api/github/runs/${e}/jobs`)).jobs}async function n8(){return(await Se("/api/log-sources")).sources}async function i8(e){return(await ei("/api/log-sources",e)).sources}async function rC(e,t={}){const s=new URLSearchParams;return s.set("lines",String(t.lines??500)),t.since&&s.set("since",t.since),t.until&&s.set("until",t.until),t.grep&&s.set("grep",t.grep),t.level&&s.set("level",t.level),t.cursor&&s.set("cursor",t.cursor),t.before&&s.set("before",t.before),(await Se(`/api/log-sources/${encodeURIComponent(e)}/logs?${s.toString()}`)).logs}const Xb={"content-type":"application/json"};async function r8(e){const t=await Se("/api/onboard/scan",{method:"POST",headers:Xb,body:JSON.stringify({url:e})});return{profile:t.profile,proposals:t.proposals,databases:t.databases??[]}}async function a8(e,t,s){const n=s?{name:s.name,engine:s.engine,url:s.url}:void 0;await Se("/api/onboard/register",{method:"POST",headers:Xb,body:JSON.stringify({...e,start:t,database:n})})}async function o8(e,t){const s=await fetch("/api/onboard/install/stream",{method:"POST",headers:Xb,body:JSON.stringify(e)});if(!s.ok||!s.body){const u=await s.json().catch(()=>{});t.onError(u?.error||s.statusText);return}const n=s.body.getReader(),o=new TextDecoder;let l="";for(;;){const{done:u,value:h}=await n.read();if(u)break;l+=o.decode(h,{stream:!0});const m=l.split(`
15
+
16
+ `);l=m.pop()??"";for(const d of m)l8(d,t)}}function l8(e,t){let s="message",n="";for(const o of e.split(`
17
+ `))o.startsWith("event:")?s=o.slice(6).trim():o.startsWith("data:")&&(n+=o.slice(5).trim());if(n)try{const o=JSON.parse(n);s==="output"?t.onLine(o):s==="done"?t.onDone(o.exitCode??null):s==="error"&&t.onError(o.error??"Install failed.")}catch{}}async function c8(){return Se("/api/dashboard")}async function u8(e){await Se(`/api/services/${encodeURIComponent(e)}`,{method:"DELETE"})}async function d8(e,t,s){t.includes(s)||await en("/api/bundles",{name:e,originalName:e,services:[...t,s].join(",")})}async function h8(e,t,s){t.includes(s)&&await en("/api/bundles",{name:e,originalName:e,services:t.filter(n=>n!==s).join(",")})}async function aC(e,{files:t=!1}={}){const s=new URLSearchParams({path:e});return t&&s.set("files","1"),Se(`/api/fs/directories?${s.toString()}`)}async function oC(e,t={}){const s=new URLSearchParams;s.set("lines",String(t.lines??500)),t.since&&s.set("since",t.since),t.until&&s.set("until",t.until),t.grep&&s.set("grep",t.grep),t.level&&s.set("level",t.level),t.cursor&&s.set("cursor",t.cursor),t.before&&s.set("before",t.before);const n=await Se(`/api/services/${encodeURIComponent(e)}/logs?${s.toString()}`);return{logs:n.logs,queryable:!!n.queryable}}async function f8(e,t){const s=t?`?path=${encodeURIComponent(t)}`:"";return Se(`/api/services/${encodeURIComponent(e)}/config-browse${s}`)}async function m8(e){const t=await Se(`/api/services/${encodeURIComponent(e)}/config-files`);return{cwd:t.cwd,files:t.files}}async function Qy(e,t){return Se(`/api/services/${encodeURIComponent(e)}/config-file?path=${encodeURIComponent(t)}`)}async function p8(e,t,s){return Se(`/api/services/${encodeURIComponent(e)}/config-file?path=${encodeURIComponent(t)}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({entries:s})})}async function g8(e,t,s){return Se(`/api/services/${encodeURIComponent(e)}/config-file?path=${encodeURIComponent(t)}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({content:s})})}async function b8(e){return(await Se(`/api/services/${encodeURIComponent(e)}/metrics`)).metrics}async function x8(e){return ei("/api/services/test",e)}async function v8(e,t){return ei(`/api/services/${encodeURIComponent(e)}/test`,t?{pattern:t}:{})}async function lC(e){const t=await fetch(e);if(!t.ok){const s=await t.json().catch(()=>({error:t.statusText}));throw new Error(s.error||"Request failed")}return t.text()}async function _8(){return(await Se("/api/snapshots")).snapshots}async function y8(e){return(await Se("/api/snapshots",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({label:e})})).snapshot}async function S8(e,t){return(await Se(`/api/snapshots/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({label:t})})).snapshot}async function w8(e){await Se(`/api/snapshots/${encodeURIComponent(e)}`,{method:"DELETE"})}async function k8(e){return(await Se(`/api/snapshots/${encodeURIComponent(e)}/files`)).files}async function N8(e,t){const s=t?`?path=${encodeURIComponent(t)}`:"";return lC(`/api/snapshots/${encodeURIComponent(e)}/diff${s}`)}async function C8(e){return Se(`/api/snapshots/${encodeURIComponent(e)}/restore`,{method:"POST"})}async function E8(){return(await Se("/api/agent/change-sets")).sessions}async function j8(e){return Se(`/api/agent/change-sets/${encodeURIComponent(e)}`)}async function T8(e,t){const s=t?`?path=${encodeURIComponent(t)}`:"";return lC(`/api/agent/change-sets/${encodeURIComponent(e)}/diff${s}`)}async function A8(e){return Se(`/api/agent/change-sets/${encodeURIComponent(e)}/restore`,{method:"POST"})}async function R8(){return(await Se("/api/terminal/sessions")).sessions}async function mh(e){return(await Se("/api/terminal/sessions",{method:"POST",...e?.serviceName?{headers:{"content-type":"application/json"},body:JSON.stringify({serviceName:e.serviceName})}:{}})).session}async function M8(e){await Se(`/api/terminal/sessions/${encodeURIComponent(e)}`,{method:"DELETE"})}async function D8(){return(await Se("/api/workflows")).workflows}async function O8(e){return(await Se("/api/workflows",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})).workflows}async function L8(e){return(await Se(`/api/workflows/${encodeURIComponent(e)}`,{method:"DELETE"})).workflows}async function Hp(){return(await Se("/api/git/status")).status}function cC(e){var t,s,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(s=cC(e[t]))&&(n&&(n+=" "),n+=s)}else for(s in e)e[s]&&(n&&(n+=" "),n+=s);return n}function Jc(){for(var e,t,s=0,n="",o=arguments.length;s<o;s++)(e=arguments[s])&&(t=cC(e))&&(n&&(n+=" "),n+=t);return n}const Jy=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,eS=Jc,uC=(e,t)=>s=>{var n;if(t?.variants==null)return eS(e,s?.class,s?.className);const{variants:o,defaultVariants:l}=t,u=Object.keys(o).map(d=>{const p=s?.[d],g=l?.[d];if(p===null)return null;const x=Jy(p)||Jy(g);return o[d][x]}),h=s&&Object.entries(s).reduce((d,p)=>{let[g,x]=p;return x===void 0||(d[g]=x),d},{}),m=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((d,p)=>{let{class:g,className:x,..._}=p;return Object.entries(_).every(S=>{let[w,k]=S;return Array.isArray(k)?k.includes({...l,...h}[w]):{...l,...h}[w]===k})?[...d,g,x]:d},[]);return eS(e,u,m,s?.class,s?.className)},z8=(e,t)=>{const s=new Array(e.length+t.length);for(let n=0;n<e.length;n++)s[n]=e[n];for(let n=0;n<t.length;n++)s[e.length+n]=t[n];return s},B8=(e,t)=>({classGroupId:e,validator:t}),dC=(e=new Map,t=null,s)=>({nextPart:e,validators:t,classGroupId:s}),Rh="-",tS=[],I8="arbitrary..",P8=e=>{const t=H8(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return $8(u);const h=u.split(Rh),m=h[0]===""&&h.length>1?1:0;return hC(h,m,t)},getConflictingClassGroupIds:(u,h)=>{if(h){const m=n[u],d=s[u];return m?d?z8(d,m):m:d||tS}return s[u]||tS}}},hC=(e,t,s)=>{if(e.length-t===0)return s.classGroupId;const o=e[t],l=s.nextPart.get(o);if(l){const d=hC(e,t+1,l);if(d)return d}const u=s.validators;if(u===null)return;const h=t===0?e.join(Rh):e.slice(t).join(Rh),m=u.length;for(let d=0;d<m;d++){const p=u[d];if(p.validator(h))return p.classGroupId}},$8=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),s=t.indexOf(":"),n=t.slice(0,s);return n?I8+n:void 0})(),H8=e=>{const{theme:t,classGroups:s}=e;return U8(s,t)},U8=(e,t)=>{const s=dC();for(const n in e){const o=e[n];Zb(o,s,n,t)}return s},Zb=(e,t,s,n)=>{const o=e.length;for(let l=0;l<o;l++){const u=e[l];F8(u,t,s,n)}},F8=(e,t,s,n)=>{if(typeof e=="string"){q8(e,t,s);return}if(typeof e=="function"){V8(e,t,s,n);return}G8(e,t,s,n)},q8=(e,t,s)=>{const n=e===""?t:fC(t,e);n.classGroupId=s},V8=(e,t,s,n)=>{if(W8(e)){Zb(e(n),t,s,n);return}t.validators===null&&(t.validators=[]),t.validators.push(B8(s,e))},G8=(e,t,s,n)=>{const o=Object.entries(e),l=o.length;for(let u=0;u<l;u++){const[h,m]=o[u];Zb(m,fC(t,h),s,n)}},fC=(e,t)=>{let s=e;const n=t.split(Rh),o=n.length;for(let l=0;l<o;l++){const u=n[l];let h=s.nextPart.get(u);h||(h=dC(),s.nextPart.set(u,h)),s=h}return s},W8=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,K8=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,s=Object.create(null),n=Object.create(null);const o=(l,u)=>{s[l]=u,t++,t>e&&(t=0,n=s,s=Object.create(null))};return{get(l){let u=s[l];if(u!==void 0)return u;if((u=n[l])!==void 0)return o(l,u),u},set(l,u){l in s?s[l]=u:o(l,u)}}},p0="!",sS=":",Y8=[],nS=(e,t,s,n,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:s,maybePostfixModifierPosition:n,isExternal:o}),X8=e=>{const{prefix:t,experimentalParseClassName:s}=e;let n=o=>{const l=[];let u=0,h=0,m=0,d;const p=o.length;for(let w=0;w<p;w++){const k=o[w];if(u===0&&h===0){if(k===sS){l.push(o.slice(m,w)),m=w+1;continue}if(k==="/"){d=w;continue}}k==="["?u++:k==="]"?u--:k==="("?h++:k===")"&&h--}const g=l.length===0?o:o.slice(m);let x=g,_=!1;g.endsWith(p0)?(x=g.slice(0,-1),_=!0):g.startsWith(p0)&&(x=g.slice(1),_=!0);const S=d&&d>m?d-m:void 0;return nS(l,_,x,S)};if(t){const o=t+sS,l=n;n=u=>u.startsWith(o)?l(u.slice(o.length)):nS(Y8,!1,u,void 0,!0)}if(s){const o=n;n=l=>s({className:l,parseClassName:o})}return n},Z8=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((s,n)=>{t.set(s,1e6+n)}),s=>{const n=[];let o=[];for(let l=0;l<s.length;l++){const u=s[l],h=u[0]==="[",m=t.has(u);h||m?(o.length>0&&(o.sort(),n.push(...o),o=[]),n.push(u)):o.push(u)}return o.length>0&&(o.sort(),n.push(...o)),n}},Q8=e=>({cache:K8(e.cacheSize),parseClassName:X8(e),sortModifiers:Z8(e),postfixLookupClassGroupIds:J8(e),...P8(e)}),J8=e=>{const t=Object.create(null),s=e.postfixLookupClassGroups;if(s)for(let n=0;n<s.length;n++)t[s[n]]=!0;return t},eD=/\s+/,tD=(e,t)=>{const{parseClassName:s,getClassGroupId:n,getConflictingClassGroupIds:o,sortModifiers:l,postfixLookupClassGroupIds:u}=t,h=[],m=e.trim().split(eD);let d="";for(let p=m.length-1;p>=0;p-=1){const g=m[p],{isExternal:x,modifiers:_,hasImportantModifier:S,baseClassName:w,maybePostfixModifierPosition:k}=s(g);if(x){d=g+(d.length>0?" "+d:d);continue}let C=!!k,T;if(C){const O=w.substring(0,k);T=n(O);const A=T&&u[T]?n(w):void 0;A&&A!==T&&(T=A,C=!1)}else T=n(w);if(!T){if(!C){d=g+(d.length>0?" "+d:d);continue}if(T=n(w),!T){d=g+(d.length>0?" "+d:d);continue}C=!1}const E=_.length===0?"":_.length===1?_[0]:l(_).join(":"),j=S?E+p0:E,M=j+T;if(h.indexOf(M)>-1)continue;h.push(M);const z=o(T,C);for(let O=0;O<z.length;++O){const A=z[O];h.push(j+A)}d=g+(d.length>0?" "+d:d)}return d},sD=(...e)=>{let t=0,s,n,o="";for(;t<e.length;)(s=e[t++])&&(n=mC(s))&&(o&&(o+=" "),o+=n);return o},mC=e=>{if(typeof e=="string")return e;let t,s="";for(let n=0;n<e.length;n++)e[n]&&(t=mC(e[n]))&&(s&&(s+=" "),s+=t);return s},nD=(e,...t)=>{let s,n,o,l;const u=m=>{const d=t.reduce((p,g)=>g(p),e());return s=Q8(d),n=s.cache.get,o=s.cache.set,l=h,h(m)},h=m=>{const d=n(m);if(d)return d;const p=tD(m,s);return o(m,p),p};return l=u,(...m)=>l(sD(...m))},iD=[],ps=e=>{const t=s=>s[e]||iD;return t.isThemeGetter=!0,t},pC=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,gC=/^\((?:(\w[\w-]*):)?(.+)\)$/i,rD=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,aD=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,oD=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,lD=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,cD=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,uD=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ea=e=>rD.test(e),Qe=e=>!!e&&!Number.isNaN(Number(e)),Ni=e=>!!e&&Number.isInteger(Number(e)),Up=e=>e.endsWith("%")&&Qe(e.slice(0,-1)),dr=e=>aD.test(e),bC=()=>!0,dD=e=>oD.test(e)&&!lD.test(e),Qb=()=>!1,hD=e=>cD.test(e),fD=e=>uD.test(e),mD=e=>!Ce(e)&&!Ee(e),pD=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),gD=e=>ma(e,_C,Qb),Ce=e=>pC.test(e),za=e=>ma(e,yC,dD),iS=e=>ma(e,kD,Qe),bD=e=>ma(e,wC,bC),xD=e=>ma(e,SC,Qb),rS=e=>ma(e,xC,Qb),vD=e=>ma(e,vC,fD),Fd=e=>ma(e,kC,hD),Ee=e=>gC.test(e),_c=e=>no(e,yC),_D=e=>no(e,SC),aS=e=>no(e,xC),yD=e=>no(e,_C),SD=e=>no(e,vC),qd=e=>no(e,kC,!0),wD=e=>no(e,wC,!0),ma=(e,t,s)=>{const n=pC.exec(e);return n?n[1]?t(n[1]):s(n[2]):!1},no=(e,t,s=!1)=>{const n=gC.exec(e);return n?n[1]?t(n[1]):s:!1},xC=e=>e==="position"||e==="percentage",vC=e=>e==="image"||e==="url",_C=e=>e==="length"||e==="size"||e==="bg-size",yC=e=>e==="length",kD=e=>e==="number",SC=e=>e==="family-name",wC=e=>e==="number"||e==="weight",kC=e=>e==="shadow",ND=()=>{const e=ps("color"),t=ps("font"),s=ps("text"),n=ps("font-weight"),o=ps("tracking"),l=ps("leading"),u=ps("breakpoint"),h=ps("container"),m=ps("spacing"),d=ps("radius"),p=ps("shadow"),g=ps("inset-shadow"),x=ps("text-shadow"),_=ps("drop-shadow"),S=ps("blur"),w=ps("perspective"),k=ps("aspect"),C=ps("ease"),T=ps("animate"),E=()=>["auto","avoid","all","avoid-page","page","left","right","column"],j=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],M=()=>[...j(),Ee,Ce],z=()=>["auto","hidden","clip","visible","scroll"],O=()=>["auto","contain","none"],A=()=>[Ee,Ce,m],D=()=>[ea,"full","auto",...A()],B=()=>[Ni,"none","subgrid",Ee,Ce],P=()=>["auto",{span:["full",Ni,Ee,Ce]},Ni,Ee,Ce],H=()=>[Ni,"auto",Ee,Ce],$=()=>["auto","min","max","fr",Ee,Ce],q=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],V=()=>["start","end","center","stretch","center-safe","end-safe"],I=()=>["auto",...A()],W=()=>[ea,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...A()],Z=()=>[ea,"screen","full","dvw","lvw","svw","min","max","fit",...A()],K=()=>[ea,"screen","full","lh","dvh","lvh","svh","min","max","fit",...A()],te=()=>[e,Ee,Ce],L=()=>[...j(),aS,rS,{position:[Ee,Ce]}],Q=()=>["no-repeat",{repeat:["","x","y","space","round"]}],re=()=>["auto","cover","contain",yD,gD,{size:[Ee,Ce]}],he=()=>[Up,_c,za],fe=()=>["","none","full",d,Ee,Ce],pe=()=>["",Qe,_c,za],we=()=>["solid","dashed","dotted","double"],Le=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ve=()=>[Qe,Up,aS,rS],We=()=>["","none",S,Ee,Ce],ge=()=>["none",Qe,Ee,Ce],Te=()=>["none",Qe,Ee,Ce],Re=()=>[Qe,Ee,Ce],Pt=()=>[ea,"full",...A()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[dr],breakpoint:[dr],color:[bC],container:[dr],"drop-shadow":[dr],ease:["in","out","in-out"],font:[mD],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[dr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[dr],shadow:[dr],spacing:["px",Qe],text:[dr],"text-shadow":[dr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ea,Ce,Ee,k]}],container:["container"],"container-type":[{"@container":["","normal","size",Ee,Ce]}],"container-named":[pD],columns:[{columns:[Qe,Ce,Ee,h]}],"break-after":[{"break-after":E()}],"break-before":[{"break-before":E()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:M()}],overflow:[{overflow:z()}],"overflow-x":[{"overflow-x":z()}],"overflow-y":[{"overflow-y":z()}],overscroll:[{overscroll:O()}],"overscroll-x":[{"overscroll-x":O()}],"overscroll-y":[{"overscroll-y":O()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:D()}],"inset-x":[{"inset-x":D()}],"inset-y":[{"inset-y":D()}],start:[{"inset-s":D(),start:D()}],end:[{"inset-e":D(),end:D()}],"inset-bs":[{"inset-bs":D()}],"inset-be":[{"inset-be":D()}],top:[{top:D()}],right:[{right:D()}],bottom:[{bottom:D()}],left:[{left:D()}],visibility:["visible","invisible","collapse"],z:[{z:[Ni,"auto",Ee,Ce]}],basis:[{basis:[ea,"full","auto",h,...A()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Qe,ea,"auto","initial","none",Ce]}],grow:[{grow:["",Qe,Ee,Ce]}],shrink:[{shrink:["",Qe,Ee,Ce]}],order:[{order:[Ni,"first","last","none",Ee,Ce]}],"grid-cols":[{"grid-cols":B()}],"col-start-end":[{col:P()}],"col-start":[{"col-start":H()}],"col-end":[{"col-end":H()}],"grid-rows":[{"grid-rows":B()}],"row-start-end":[{row:P()}],"row-start":[{"row-start":H()}],"row-end":[{"row-end":H()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":$()}],"auto-rows":[{"auto-rows":$()}],gap:[{gap:A()}],"gap-x":[{"gap-x":A()}],"gap-y":[{"gap-y":A()}],"justify-content":[{justify:[...q(),"normal"]}],"justify-items":[{"justify-items":[...V(),"normal"]}],"justify-self":[{"justify-self":["auto",...V()]}],"align-content":[{content:["normal",...q()]}],"align-items":[{items:[...V(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...V(),{baseline:["","last"]}]}],"place-content":[{"place-content":q()}],"place-items":[{"place-items":[...V(),"baseline"]}],"place-self":[{"place-self":["auto",...V()]}],p:[{p:A()}],px:[{px:A()}],py:[{py:A()}],ps:[{ps:A()}],pe:[{pe:A()}],pbs:[{pbs:A()}],pbe:[{pbe:A()}],pt:[{pt:A()}],pr:[{pr:A()}],pb:[{pb:A()}],pl:[{pl:A()}],m:[{m:I()}],mx:[{mx:I()}],my:[{my:I()}],ms:[{ms:I()}],me:[{me:I()}],mbs:[{mbs:I()}],mbe:[{mbe:I()}],mt:[{mt:I()}],mr:[{mr:I()}],mb:[{mb:I()}],ml:[{ml:I()}],"space-x":[{"space-x":A()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":A()}],"space-y-reverse":["space-y-reverse"],size:[{size:W()}],"inline-size":[{inline:["auto",...Z()]}],"min-inline-size":[{"min-inline":["auto",...Z()]}],"max-inline-size":[{"max-inline":["none",...Z()]}],"block-size":[{block:["auto",...K()]}],"min-block-size":[{"min-block":["auto",...K()]}],"max-block-size":[{"max-block":["none",...K()]}],w:[{w:[h,"screen",...W()]}],"min-w":[{"min-w":[h,"screen","none",...W()]}],"max-w":[{"max-w":[h,"screen","none","prose",{screen:[u]},...W()]}],h:[{h:["screen","lh",...W()]}],"min-h":[{"min-h":["screen","lh","none",...W()]}],"max-h":[{"max-h":["screen","lh",...W()]}],"font-size":[{text:["base",s,_c,za]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,wD,bD]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Up,Ce]}],"font-family":[{font:[_D,xD,t]}],"font-features":[{"font-features":[Ce]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,Ee,Ce]}],"line-clamp":[{"line-clamp":[Qe,"none",Ee,iS]}],leading:[{leading:[l,...A()]}],"list-image":[{"list-image":["none",Ee,Ce]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ee,Ce]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:te()}],"text-color":[{text:te()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...we(),"wavy"]}],"text-decoration-thickness":[{decoration:[Qe,"from-font","auto",Ee,za]}],"text-decoration-color":[{decoration:te()}],"underline-offset":[{"underline-offset":[Qe,"auto",Ee,Ce]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:A()}],"tab-size":[{tab:[Ni,Ee,Ce]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ee,Ce]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ee,Ce]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:Q()}],"bg-size":[{bg:re()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ni,Ee,Ce],radial:["",Ee,Ce],conic:[Ni,Ee,Ce]},SD,vD]}],"bg-color":[{bg:te()}],"gradient-from-pos":[{from:he()}],"gradient-via-pos":[{via:he()}],"gradient-to-pos":[{to:he()}],"gradient-from":[{from:te()}],"gradient-via":[{via:te()}],"gradient-to":[{to:te()}],rounded:[{rounded:fe()}],"rounded-s":[{"rounded-s":fe()}],"rounded-e":[{"rounded-e":fe()}],"rounded-t":[{"rounded-t":fe()}],"rounded-r":[{"rounded-r":fe()}],"rounded-b":[{"rounded-b":fe()}],"rounded-l":[{"rounded-l":fe()}],"rounded-ss":[{"rounded-ss":fe()}],"rounded-se":[{"rounded-se":fe()}],"rounded-ee":[{"rounded-ee":fe()}],"rounded-es":[{"rounded-es":fe()}],"rounded-tl":[{"rounded-tl":fe()}],"rounded-tr":[{"rounded-tr":fe()}],"rounded-br":[{"rounded-br":fe()}],"rounded-bl":[{"rounded-bl":fe()}],"border-w":[{border:pe()}],"border-w-x":[{"border-x":pe()}],"border-w-y":[{"border-y":pe()}],"border-w-s":[{"border-s":pe()}],"border-w-e":[{"border-e":pe()}],"border-w-bs":[{"border-bs":pe()}],"border-w-be":[{"border-be":pe()}],"border-w-t":[{"border-t":pe()}],"border-w-r":[{"border-r":pe()}],"border-w-b":[{"border-b":pe()}],"border-w-l":[{"border-l":pe()}],"divide-x":[{"divide-x":pe()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":pe()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...we(),"hidden","none"]}],"divide-style":[{divide:[...we(),"hidden","none"]}],"border-color":[{border:te()}],"border-color-x":[{"border-x":te()}],"border-color-y":[{"border-y":te()}],"border-color-s":[{"border-s":te()}],"border-color-e":[{"border-e":te()}],"border-color-bs":[{"border-bs":te()}],"border-color-be":[{"border-be":te()}],"border-color-t":[{"border-t":te()}],"border-color-r":[{"border-r":te()}],"border-color-b":[{"border-b":te()}],"border-color-l":[{"border-l":te()}],"divide-color":[{divide:te()}],"outline-style":[{outline:[...we(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Qe,Ee,Ce]}],"outline-w":[{outline:["",Qe,_c,za]}],"outline-color":[{outline:te()}],shadow:[{shadow:["","none",p,qd,Fd]}],"shadow-color":[{shadow:te()}],"inset-shadow":[{"inset-shadow":["none",g,qd,Fd]}],"inset-shadow-color":[{"inset-shadow":te()}],"ring-w":[{ring:pe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:te()}],"ring-offset-w":[{"ring-offset":[Qe,za]}],"ring-offset-color":[{"ring-offset":te()}],"inset-ring-w":[{"inset-ring":pe()}],"inset-ring-color":[{"inset-ring":te()}],"text-shadow":[{"text-shadow":["none",x,qd,Fd]}],"text-shadow-color":[{"text-shadow":te()}],opacity:[{opacity:[Qe,Ee,Ce]}],"mix-blend":[{"mix-blend":[...Le(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Le()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Qe]}],"mask-image-linear-from-pos":[{"mask-linear-from":ve()}],"mask-image-linear-to-pos":[{"mask-linear-to":ve()}],"mask-image-linear-from-color":[{"mask-linear-from":te()}],"mask-image-linear-to-color":[{"mask-linear-to":te()}],"mask-image-t-from-pos":[{"mask-t-from":ve()}],"mask-image-t-to-pos":[{"mask-t-to":ve()}],"mask-image-t-from-color":[{"mask-t-from":te()}],"mask-image-t-to-color":[{"mask-t-to":te()}],"mask-image-r-from-pos":[{"mask-r-from":ve()}],"mask-image-r-to-pos":[{"mask-r-to":ve()}],"mask-image-r-from-color":[{"mask-r-from":te()}],"mask-image-r-to-color":[{"mask-r-to":te()}],"mask-image-b-from-pos":[{"mask-b-from":ve()}],"mask-image-b-to-pos":[{"mask-b-to":ve()}],"mask-image-b-from-color":[{"mask-b-from":te()}],"mask-image-b-to-color":[{"mask-b-to":te()}],"mask-image-l-from-pos":[{"mask-l-from":ve()}],"mask-image-l-to-pos":[{"mask-l-to":ve()}],"mask-image-l-from-color":[{"mask-l-from":te()}],"mask-image-l-to-color":[{"mask-l-to":te()}],"mask-image-x-from-pos":[{"mask-x-from":ve()}],"mask-image-x-to-pos":[{"mask-x-to":ve()}],"mask-image-x-from-color":[{"mask-x-from":te()}],"mask-image-x-to-color":[{"mask-x-to":te()}],"mask-image-y-from-pos":[{"mask-y-from":ve()}],"mask-image-y-to-pos":[{"mask-y-to":ve()}],"mask-image-y-from-color":[{"mask-y-from":te()}],"mask-image-y-to-color":[{"mask-y-to":te()}],"mask-image-radial":[{"mask-radial":[Ee,Ce]}],"mask-image-radial-from-pos":[{"mask-radial-from":ve()}],"mask-image-radial-to-pos":[{"mask-radial-to":ve()}],"mask-image-radial-from-color":[{"mask-radial-from":te()}],"mask-image-radial-to-color":[{"mask-radial-to":te()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":j()}],"mask-image-conic-pos":[{"mask-conic":[Qe]}],"mask-image-conic-from-pos":[{"mask-conic-from":ve()}],"mask-image-conic-to-pos":[{"mask-conic-to":ve()}],"mask-image-conic-from-color":[{"mask-conic-from":te()}],"mask-image-conic-to-color":[{"mask-conic-to":te()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:Q()}],"mask-size":[{mask:re()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ee,Ce]}],filter:[{filter:["","none",Ee,Ce]}],blur:[{blur:We()}],brightness:[{brightness:[Qe,Ee,Ce]}],contrast:[{contrast:[Qe,Ee,Ce]}],"drop-shadow":[{"drop-shadow":["","none",_,qd,Fd]}],"drop-shadow-color":[{"drop-shadow":te()}],grayscale:[{grayscale:["",Qe,Ee,Ce]}],"hue-rotate":[{"hue-rotate":[Qe,Ee,Ce]}],invert:[{invert:["",Qe,Ee,Ce]}],saturate:[{saturate:[Qe,Ee,Ce]}],sepia:[{sepia:["",Qe,Ee,Ce]}],"backdrop-filter":[{"backdrop-filter":["","none",Ee,Ce]}],"backdrop-blur":[{"backdrop-blur":We()}],"backdrop-brightness":[{"backdrop-brightness":[Qe,Ee,Ce]}],"backdrop-contrast":[{"backdrop-contrast":[Qe,Ee,Ce]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Qe,Ee,Ce]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Qe,Ee,Ce]}],"backdrop-invert":[{"backdrop-invert":["",Qe,Ee,Ce]}],"backdrop-opacity":[{"backdrop-opacity":[Qe,Ee,Ce]}],"backdrop-saturate":[{"backdrop-saturate":[Qe,Ee,Ce]}],"backdrop-sepia":[{"backdrop-sepia":["",Qe,Ee,Ce]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":A()}],"border-spacing-x":[{"border-spacing-x":A()}],"border-spacing-y":[{"border-spacing-y":A()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ee,Ce]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Qe,"initial",Ee,Ce]}],ease:[{ease:["linear","initial",C,Ee,Ce]}],delay:[{delay:[Qe,Ee,Ce]}],animate:[{animate:["none",T,Ee,Ce]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,Ee,Ce]}],"perspective-origin":[{"perspective-origin":M()}],rotate:[{rotate:ge()}],"rotate-x":[{"rotate-x":ge()}],"rotate-y":[{"rotate-y":ge()}],"rotate-z":[{"rotate-z":ge()}],scale:[{scale:Te()}],"scale-x":[{"scale-x":Te()}],"scale-y":[{"scale-y":Te()}],"scale-z":[{"scale-z":Te()}],"scale-3d":["scale-3d"],skew:[{skew:Re()}],"skew-x":[{"skew-x":Re()}],"skew-y":[{"skew-y":Re()}],transform:[{transform:[Ee,Ce,"","none","gpu","cpu"]}],"transform-origin":[{origin:M()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Pt()}],"translate-x":[{"translate-x":Pt()}],"translate-y":[{"translate-y":Pt()}],"translate-z":[{"translate-z":Pt()}],"translate-none":["translate-none"],zoom:[{zoom:[Ni,Ee,Ce]}],accent:[{accent:te()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:te()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ee,Ce]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":te()}],"scrollbar-track-color":[{"scrollbar-track":te()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":A()}],"scroll-mx":[{"scroll-mx":A()}],"scroll-my":[{"scroll-my":A()}],"scroll-ms":[{"scroll-ms":A()}],"scroll-me":[{"scroll-me":A()}],"scroll-mbs":[{"scroll-mbs":A()}],"scroll-mbe":[{"scroll-mbe":A()}],"scroll-mt":[{"scroll-mt":A()}],"scroll-mr":[{"scroll-mr":A()}],"scroll-mb":[{"scroll-mb":A()}],"scroll-ml":[{"scroll-ml":A()}],"scroll-p":[{"scroll-p":A()}],"scroll-px":[{"scroll-px":A()}],"scroll-py":[{"scroll-py":A()}],"scroll-ps":[{"scroll-ps":A()}],"scroll-pe":[{"scroll-pe":A()}],"scroll-pbs":[{"scroll-pbs":A()}],"scroll-pbe":[{"scroll-pbe":A()}],"scroll-pt":[{"scroll-pt":A()}],"scroll-pr":[{"scroll-pr":A()}],"scroll-pb":[{"scroll-pb":A()}],"scroll-pl":[{"scroll-pl":A()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ee,Ce]}],fill:[{fill:["none",...te()]}],"stroke-w":[{stroke:[Qe,_c,za,iS]}],stroke:[{stroke:["none",...te()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},CD=nD(ND);function ie(...e){return CD(Jc(e))}const ED=uC("inline-flex h-9 shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-md border border-transparent px-3 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",outline:"border-border bg-background hover:bg-muted",ghost:"hover:bg-muted",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90"},size:{default:"h-9 px-3",sm:"h-8 px-2.5 text-xs",icon:"size-9 p-0","icon-sm":"size-7 p-0"}},defaultVariants:{variant:"default",size:"default"}});function Y({className:e,variant:t,size:s,...n}){return r.jsx("button",{className:ie(ED({variant:t,size:s,className:e})),...n})}const NC=y.createContext({});function jD(e){const t=y.useRef(null);return t.current===null&&(t.current=e()),t.current}const TD=typeof window<"u",AD=TD?y.useLayoutEffect:y.useEffect,Jb=y.createContext(null);function ex(e,t){e.indexOf(t)===-1&&e.push(t)}function Mh(e,t){const s=e.indexOf(t);s>-1&&e.splice(s,1)}const zi=(e,t,s)=>s>t?t:s<e?e:s;let tx=()=>{};const da={},CC=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function EC(e){return typeof e=="object"&&e!==null}const jC=e=>/^0[^.\s]+$/u.test(e);function TC(e){let t;return()=>(t===void 0&&(t=e()),t)}const Yn=e=>e,RD=(e,t)=>s=>t(e(s)),pu=(...e)=>e.reduce(RD),eu=(e,t,s)=>{const n=t-e;return n===0?1:(s-e)/n};class sx{constructor(){this.subscriptions=[]}add(t){return ex(this.subscriptions,t),()=>Mh(this.subscriptions,t)}notify(t,s,n){const o=this.subscriptions.length;if(o)if(o===1)this.subscriptions[0](t,s,n);else for(let l=0;l<o;l++){const u=this.subscriptions[l];u&&u(t,s,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Rn=e=>e*1e3,Kn=e=>e/1e3;function AC(e,t){return t?e*(1e3/t):0}const RC=(e,t,s)=>(((1-3*s+3*t)*e+(3*s-6*t))*e+3*t)*e,MD=1e-7,DD=12;function OD(e,t,s,n,o){let l,u,h=0;do u=t+(s-t)/2,l=RC(u,n,o)-e,l>0?s=u:t=u;while(Math.abs(l)>MD&&++h<DD);return u}function gu(e,t,s,n){if(e===t&&s===n)return Yn;const o=l=>OD(l,0,1,e,s);return l=>l===0||l===1?l:RC(o(l),t,n)}const MC=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,DC=e=>t=>1-e(1-t),OC=gu(.33,1.53,.69,.99),nx=DC(OC),LC=MC(nx),zC=e=>e>=1?1:(e*=2)<1?.5*nx(e):.5*(2-Math.pow(2,-10*(e-1))),ix=e=>1-Math.sin(Math.acos(e)),BC=DC(ix),IC=MC(ix),LD=gu(.42,0,1,1),zD=gu(0,0,.58,1),PC=gu(.42,0,.58,1),BD=e=>Array.isArray(e)&&typeof e[0]!="number",$C=e=>Array.isArray(e)&&typeof e[0]=="number",ID={linear:Yn,easeIn:LD,easeInOut:PC,easeOut:zD,circIn:ix,circInOut:IC,circOut:BC,backIn:nx,backInOut:LC,backOut:OC,anticipate:zC},PD=e=>typeof e=="string",oS=e=>{if($C(e)){tx(e.length===4);const[t,s,n,o]=e;return gu(t,s,n,o)}else if(PD(e))return ID[e];return e},Vd=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function $D(e,t){let s=new Set,n=new Set,o=!1,l=!1;const u=new WeakSet;let h={delta:0,timestamp:0,isProcessing:!1};function m(p){u.has(p)&&(d.schedule(p),e()),p(h)}const d={schedule:(p,g=!1,x=!1)=>{const S=x&&o?s:n;return g&&u.add(p),S.add(p),p},cancel:p=>{n.delete(p),u.delete(p)},process:p=>{if(h=p,o){l=!0;return}o=!0;const g=s;s=n,n=g,s.forEach(m),s.clear(),o=!1,l&&(l=!1,d.process(p))}};return d}const HD=40;function HC(e,t){let s=!1,n=!0;const o={delta:0,timestamp:0,isProcessing:!1},l=()=>s=!0,u=Vd.reduce((E,j)=>(E[j]=$D(l),E),{}),{setup:h,read:m,resolveKeyframes:d,preUpdate:p,update:g,preRender:x,render:_,postRender:S}=u,w=()=>{const E=da.useManualTiming,j=E?o.timestamp:performance.now();s=!1,E||(o.delta=n?1e3/60:Math.max(Math.min(j-o.timestamp,HD),1)),o.timestamp=j,o.isProcessing=!0,h.process(o),m.process(o),d.process(o),p.process(o),g.process(o),x.process(o),_.process(o),S.process(o),o.isProcessing=!1,s&&t&&(n=!1,e(w))},k=()=>{s=!0,n=!0,o.isProcessing||e(w)};return{schedule:Vd.reduce((E,j)=>{const M=u[j];return E[j]=(z,O=!1,A=!1)=>(s||k(),M.schedule(z,O,A)),E},{}),cancel:E=>{for(let j=0;j<Vd.length;j++)u[Vd[j]].cancel(E)},state:o,steps:u}}const{schedule:Et,cancel:ha,state:zs,steps:Fp}=HC(typeof requestAnimationFrame<"u"?requestAnimationFrame:Yn,!0);let ph;function UD(){ph=void 0}const Qs={now:()=>(ph===void 0&&Qs.set(zs.isProcessing||da.useManualTiming?zs.timestamp:performance.now()),ph),set:e=>{ph=e,queueMicrotask(UD)}},UC=e=>t=>typeof t=="string"&&t.startsWith(e),FC=UC("--"),FD=UC("var(--"),rx=e=>FD(e)?qD.test(e.split("/*")[0].trim()):!1,qD=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function lS(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const gl={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},tu={...gl,transform:e=>zi(0,1,e)},Gd={...gl,default:1},qc=e=>Math.round(e*1e5)/1e5,ax=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function VD(e){return e==null}const GD=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,ox=(e,t)=>s=>!!(typeof s=="string"&&GD.test(s)&&s.startsWith(e)||t&&!VD(s)&&Object.prototype.hasOwnProperty.call(s,t)),qC=(e,t,s)=>n=>{if(typeof n!="string")return n;const[o,l,u,h]=n.match(ax);return{[e]:parseFloat(o),[t]:parseFloat(l),[s]:parseFloat(u),alpha:h!==void 0?parseFloat(h):1}},WD=e=>zi(0,255,e),qp={...gl,transform:e=>Math.round(WD(e))},Va={test:ox("rgb","red"),parse:qC("red","green","blue"),transform:({red:e,green:t,blue:s,alpha:n=1})=>"rgba("+qp.transform(e)+", "+qp.transform(t)+", "+qp.transform(s)+", "+qc(tu.transform(n))+")"};function KD(e){let t="",s="",n="",o="";return e.length>5?(t=e.substring(1,3),s=e.substring(3,5),n=e.substring(5,7),o=e.substring(7,9)):(t=e.substring(1,2),s=e.substring(2,3),n=e.substring(3,4),o=e.substring(4,5),t+=t,s+=s,n+=n,o+=o),{red:parseInt(t,16),green:parseInt(s,16),blue:parseInt(n,16),alpha:o?parseInt(o,16)/255:1}}const g0={test:ox("#"),parse:KD,transform:Va.transform},bu=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),ra=bu("deg"),Di=bu("%"),Ae=bu("px"),YD=bu("vh"),XD=bu("vw"),cS={...Di,parse:e=>Di.parse(e)/100,transform:e=>Di.transform(e*100)},el={test:ox("hsl","hue"),parse:qC("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:s,alpha:n=1})=>"hsla("+Math.round(e)+", "+Di.transform(qc(t))+", "+Di.transform(qc(s))+", "+qc(tu.transform(n))+")"},ls={test:e=>Va.test(e)||g0.test(e)||el.test(e),parse:e=>Va.test(e)?Va.parse(e):el.test(e)?el.parse(e):g0.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Va.transform(e):el.transform(e),getAnimatableNone:e=>{const t=ls.parse(e);return t.alpha=0,ls.transform(t)}},ZD=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function QD(e){return isNaN(e)&&typeof e=="string"&&(e.match(ax)?.length||0)+(e.match(ZD)?.length||0)>0}const VC="number",GC="color",JD="var",eO="var(",uS="${}",tO=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function ul(e){const t=e.toString(),s=[],n={color:[],number:[],var:[]},o=[];let l=0;const h=t.replace(tO,m=>(ls.test(m)?(n.color.push(l),o.push(GC),s.push(ls.parse(m))):m.startsWith(eO)?(n.var.push(l),o.push(JD),s.push(m)):(n.number.push(l),o.push(VC),s.push(parseFloat(m))),++l,uS)).split(uS);return{values:s,split:h,indexes:n,types:o}}function sO(e){return ul(e).values}function WC({split:e,types:t}){const s=e.length;return n=>{let o="";for(let l=0;l<s;l++)if(o+=e[l],n[l]!==void 0){const u=t[l];u===VC?o+=qc(n[l]):u===GC?o+=ls.transform(n[l]):o+=n[l]}return o}}function nO(e){return WC(ul(e))}const iO=e=>typeof e=="number"?0:ls.test(e)?ls.getAnimatableNone(e):e,rO=(e,t)=>typeof e=="number"?t?.trim().endsWith("/")?e:0:iO(e);function aO(e){const t=ul(e);return WC(t)(t.values.map((n,o)=>rO(n,t.split[o])))}const mi={test:QD,parse:sO,createTransformer:nO,getAnimatableNone:aO};function Vp(e,t,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?e+(t-e)*6*s:s<1/2?t:s<2/3?e+(t-e)*(2/3-s)*6:e}function oO({hue:e,saturation:t,lightness:s,alpha:n}){e/=360,t/=100,s/=100;let o=0,l=0,u=0;if(!t)o=l=u=s;else{const h=s<.5?s*(1+t):s+t-s*t,m=2*s-h;o=Vp(m,h,e+1/3),l=Vp(m,h,e),u=Vp(m,h,e-1/3)}return{red:Math.round(o*255),green:Math.round(l*255),blue:Math.round(u*255),alpha:n}}function Dh(e,t){return s=>s>0?t:e}const Lt=(e,t,s)=>e+(t-e)*s,Gp=(e,t,s)=>{const n=e*e,o=s*(t*t-n)+n;return o<0?0:Math.sqrt(o)},lO=[g0,Va,el],cO=e=>lO.find(t=>t.test(e));function dS(e){const t=cO(e);if(!t)return!1;let s=t.parse(e);return t===el&&(s=oO(s)),s}const hS=(e,t)=>{const s=dS(e),n=dS(t);if(!s||!n)return Dh(e,t);const o={...s};return l=>(o.red=Gp(s.red,n.red,l),o.green=Gp(s.green,n.green,l),o.blue=Gp(s.blue,n.blue,l),o.alpha=Lt(s.alpha,n.alpha,l),Va.transform(o))},b0=new Set(["none","hidden"]);function uO(e,t){return b0.has(e)?s=>s<=0?e:t:s=>s>=1?t:e}function dO(e,t){return s=>Lt(e,t,s)}function lx(e){return typeof e=="number"?dO:typeof e=="string"?rx(e)?Dh:ls.test(e)?hS:mO:Array.isArray(e)?KC:typeof e=="object"?ls.test(e)?hS:hO:Dh}function KC(e,t){const s=[...e],n=s.length,o=e.map((l,u)=>lx(l)(l,t[u]));return l=>{for(let u=0;u<n;u++)s[u]=o[u](l);return s}}function hO(e,t){const s={...e,...t},n={};for(const o in s)e[o]!==void 0&&t[o]!==void 0&&(n[o]=lx(e[o])(e[o],t[o]));return o=>{for(const l in n)s[l]=n[l](o);return s}}function fO(e,t){const s=[],n={color:0,var:0,number:0};for(let o=0;o<t.values.length;o++){const l=t.types[o],u=e.indexes[l][n[l]],h=e.values[u]??0;s[o]=h,n[l]++}return s}const mO=(e,t)=>{const s=mi.createTransformer(t),n=ul(e),o=ul(t);return n.indexes.var.length===o.indexes.var.length&&n.indexes.color.length===o.indexes.color.length&&n.indexes.number.length>=o.indexes.number.length?b0.has(e)&&!o.values.length||b0.has(t)&&!n.values.length?uO(e,t):pu(KC(fO(n,o),o.values),s):Dh(e,t)};function YC(e,t,s){return typeof e=="number"&&typeof t=="number"&&typeof s=="number"?Lt(e,t,s):lx(e)(e,t)}const pO=e=>{const t=({timestamp:s})=>e(s);return{start:(s=!0)=>Et.update(t,s),stop:()=>ha(t),now:()=>zs.isProcessing?zs.timestamp:Qs.now()}},XC=(e,t,s=10)=>{let n="";const o=Math.max(Math.round(t/s),2);for(let l=0;l<o;l++)n+=Math.round(e(l/(o-1))*1e4)/1e4+", ";return`linear(${n.substring(0,n.length-2)})`},Oh=2e4;function cx(e){let t=0;const s=50;let n=e.next(t);for(;!n.done&&t<Oh;)t+=s,n=e.next(t);return t>=Oh?1/0:t}function gO(e,t=100,s){const n=s({...e,keyframes:[0,t]}),o=Math.min(cx(n),Oh);return{type:"keyframes",ease:l=>n.next(o*l).value/t,duration:Kn(o)}}const Gt={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function x0(e,t){return e*Math.sqrt(1-t*t)}const bO=12;function xO(e,t,s){let n=s;for(let o=1;o<bO;o++)n=n-e(n)/t(n);return n}const Wp=.001;function vO({duration:e=Gt.duration,bounce:t=Gt.bounce,velocity:s=Gt.velocity,mass:n=Gt.mass}){let o,l,u=1-t;u=zi(Gt.minDamping,Gt.maxDamping,u),e=zi(Gt.minDuration,Gt.maxDuration,Kn(e)),u<1?(o=d=>{const p=d*u,g=p*e,x=p-s,_=x0(d,u),S=Math.exp(-g);return Wp-x/_*S},l=d=>{const g=d*u*e,x=g*s+s,_=Math.pow(u,2)*Math.pow(d,2)*e,S=Math.exp(-g),w=x0(Math.pow(d,2),u);return(-o(d)+Wp>0?-1:1)*((x-_)*S)/w}):(o=d=>{const p=Math.exp(-d*e),g=(d-s)*e+1;return-Wp+p*g},l=d=>{const p=Math.exp(-d*e),g=(s-d)*(e*e);return p*g});const h=5/e,m=xO(o,l,h);if(e=Rn(e),isNaN(m))return{stiffness:Gt.stiffness,damping:Gt.damping,duration:e};{const d=Math.pow(m,2)*n;return{stiffness:d,damping:u*2*Math.sqrt(n*d),duration:e}}}const _O=["duration","bounce"],yO=["stiffness","damping","mass"];function fS(e,t){return t.some(s=>e[s]!==void 0)}function SO(e){let t={velocity:Gt.velocity,stiffness:Gt.stiffness,damping:Gt.damping,mass:Gt.mass,isResolvedFromDuration:!1,...e};if(!fS(e,yO)&&fS(e,_O))if(t.velocity=0,e.visualDuration){const s=e.visualDuration,n=2*Math.PI/(s*1.2),o=n*n,l=2*zi(.05,1,1-(e.bounce||0))*Math.sqrt(o);t={...t,mass:Gt.mass,stiffness:o,damping:l}}else{const s=vO({...e,velocity:0});t={...t,...s,mass:Gt.mass},t.isResolvedFromDuration=!0}return t}function Lh(e=Gt.visualDuration,t=Gt.bounce){const s=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:n,restDelta:o}=s;const l=s.keyframes[0],u=s.keyframes[s.keyframes.length-1],h={done:!1,value:l},{stiffness:m,damping:d,mass:p,duration:g,velocity:x,isResolvedFromDuration:_}=SO({...s,velocity:-Kn(s.velocity||0)}),S=x||0,w=d/(2*Math.sqrt(m*p)),k=u-l,C=Kn(Math.sqrt(m/p)),T=Math.abs(k)<5;n||(n=T?Gt.restSpeed.granular:Gt.restSpeed.default),o||(o=T?Gt.restDelta.granular:Gt.restDelta.default);let E,j,M,z,O,A;if(w<1)M=x0(C,w),z=(S+w*C*k)/M,E=B=>{const P=Math.exp(-w*C*B);return u-P*(z*Math.sin(M*B)+k*Math.cos(M*B))},O=w*C*z+k*M,A=w*C*k-z*M,j=B=>Math.exp(-w*C*B)*(O*Math.sin(M*B)+A*Math.cos(M*B));else if(w===1){E=P=>u-Math.exp(-C*P)*(k+(S+C*k)*P);const B=S+C*k;j=P=>Math.exp(-C*P)*(C*B*P-S)}else{const B=C*Math.sqrt(w*w-1);E=q=>{const V=Math.exp(-w*C*q),I=Math.min(B*q,300);return u-V*((S+w*C*k)*Math.sinh(I)+B*k*Math.cosh(I))/B};const P=(S+w*C*k)/B,H=w*C*P-k*B,$=w*C*k-P*B;j=q=>{const V=Math.exp(-w*C*q),I=Math.min(B*q,300);return V*(H*Math.sinh(I)+$*Math.cosh(I))}}const D={calculatedDuration:_&&g||null,velocity:B=>Rn(j(B)),next:B=>{if(!_&&w<1){const H=Math.exp(-w*C*B),$=Math.sin(M*B),q=Math.cos(M*B),V=u-H*(z*$+k*q),I=Rn(H*(O*$+A*q));return h.done=Math.abs(I)<=n&&Math.abs(u-V)<=o,h.value=h.done?u:V,h}const P=E(B);if(_)h.done=B>=g;else{const H=Rn(j(B));h.done=Math.abs(H)<=n&&Math.abs(u-P)<=o}return h.value=h.done?u:P,h},toString:()=>{const B=Math.min(cx(D),Oh),P=XC(H=>D.next(B*H).value,B,30);return B+"ms "+P},toTransition:()=>{}};return D}Lh.applyToOptions=e=>{const t=gO(e,100,Lh);return e.ease=t.ease,e.duration=Rn(t.duration),e.type="keyframes",e};const wO=5;function ZC(e,t,s){const n=Math.max(t-wO,0);return AC(s-e(n),t-n)}function v0({keyframes:e,velocity:t=0,power:s=.8,timeConstant:n=325,bounceDamping:o=10,bounceStiffness:l=500,modifyTarget:u,min:h,max:m,restDelta:d=.5,restSpeed:p}){const g=e[0],x={done:!1,value:g},_=A=>h!==void 0&&A<h||m!==void 0&&A>m,S=A=>h===void 0?m:m===void 0||Math.abs(h-A)<Math.abs(m-A)?h:m;let w=s*t;const k=g+w,C=u===void 0?k:u(k);C!==k&&(w=C-g);const T=A=>-w*Math.exp(-A/n),E=A=>C+T(A),j=A=>{const D=T(A),B=E(A);x.done=Math.abs(D)<=d,x.value=x.done?C:B};let M,z;const O=A=>{_(x.value)&&(M=A,z=Lh({keyframes:[x.value,S(x.value)],velocity:ZC(E,A,x.value),damping:o,stiffness:l,restDelta:d,restSpeed:p}))};return O(0),{calculatedDuration:null,next:A=>{let D=!1;return!z&&M===void 0&&(D=!0,j(A),O(A)),M!==void 0&&A>=M?z.next(A-M):(!D&&j(A),x)}}}function kO(e,t,s){const n=[],o=s||da.mix||YC,l=e.length-1;for(let u=0;u<l;u++){let h=o(e[u],e[u+1]);if(t){const m=Array.isArray(t)?t[u]||Yn:t;h=pu(m,h)}n.push(h)}return n}function NO(e,t,{clamp:s=!0,ease:n,mixer:o}={}){const l=e.length;if(tx(l===t.length),l===1)return()=>t[0];if(l===2&&t[0]===t[1])return()=>t[1];const u=e[0]===e[1];e[0]>e[l-1]&&(e=[...e].reverse(),t=[...t].reverse());const h=kO(t,n,o),m=h.length,d=p=>{if(u&&p<e[0])return t[0];let g=0;if(m>1)for(;g<e.length-2&&!(p<e[g+1]);g++);const x=eu(e[g],e[g+1],p);return h[g](x)};return s?p=>d(zi(e[0],e[l-1],p)):d}function CO(e,t){const s=e[e.length-1];for(let n=1;n<=t;n++){const o=eu(0,t,n);e.push(Lt(s,1,o))}}function EO(e){const t=[0];return CO(t,e.length-1),t}function jO(e,t){return e.map(s=>s*t)}function TO(e,t){return e.map(()=>t||PC).splice(0,e.length-1)}function Vc({duration:e=300,keyframes:t,times:s,ease:n="easeInOut"}){const o=BD(n)?n.map(oS):oS(n),l={done:!1,value:t[0]},u=jO(s&&s.length===t.length?s:EO(t),e),h=NO(u,t,{ease:Array.isArray(o)?o:TO(t,o)});return{calculatedDuration:e,next:m=>(l.value=h(m),l.done=m>=e,l)}}const AO=e=>e!==null;function gf(e,{repeat:t,repeatType:s="loop"},n,o=1){const l=e.filter(AO),h=o<0||t&&s!=="loop"&&t%2===1?0:l.length-1;return!h||n===void 0?l[h]:n}const RO={decay:v0,inertia:v0,tween:Vc,keyframes:Vc,spring:Lh};function QC(e){typeof e.type=="string"&&(e.type=RO[e.type])}class ux{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,s){return this.finished.then(t,s)}}const MO=e=>e/100;class zh extends ux{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{const{motionValue:s}=this.options;s&&s.updatedAt!==Qs.now()&&this.tick(Qs.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;QC(t);const{type:s=Vc,repeat:n=0,repeatDelay:o=0,repeatType:l,velocity:u=0}=t;let{keyframes:h}=t;const m=s||Vc;m!==Vc&&typeof h[0]!="number"&&(this.mixKeyframes=pu(MO,YC(h[0],h[1])),h=[0,100]);const d=m({...t,keyframes:h});l==="mirror"&&(this.mirroredGenerator=m({...t,keyframes:[...h].reverse(),velocity:-u})),d.calculatedDuration===null&&(d.calculatedDuration=cx(d));const{calculatedDuration:p}=d;this.calculatedDuration=p,this.resolvedDuration=p+o,this.totalDuration=this.resolvedDuration*(n+1)-o,this.generator=d}updateTime(t){const s=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=s}tick(t,s=!1){const{generator:n,totalDuration:o,mixKeyframes:l,mirroredGenerator:u,resolvedDuration:h,calculatedDuration:m}=this;if(this.startTime===null)return n.next(0);const{delay:d=0,keyframes:p,repeat:g,repeatType:x,repeatDelay:_,type:S,onUpdate:w,finalKeyframe:k}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-o/this.speed,this.startTime)),s?this.currentTime=t:this.updateTime(t);const C=this.currentTime-d*(this.playbackSpeed>=0?1:-1),T=this.playbackSpeed>=0?C<0:C>o;this.currentTime=Math.max(C,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=o);let E=this.currentTime,j=n;if(g){const A=Math.min(this.currentTime,o)/h;let D=Math.floor(A),B=A%1;!B&&A>=1&&(B=1),B===1&&D--,D=Math.min(D,g+1),D%2&&(x==="reverse"?(B=1-B,_&&(B-=_/h)):x==="mirror"&&(j=u)),E=zi(0,1,B)*h}let M;T?(this.delayState.value=p[0],M=this.delayState):M=j.next(E),l&&!T&&(M.value=l(M.value));let{done:z}=M;!T&&m!==null&&(z=this.playbackSpeed>=0?this.currentTime>=o:this.currentTime<=0);const O=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&z);return O&&S!==v0&&(M.value=gf(p,this.options,k,this.speed)),w&&w(M.value),O&&this.finish(),M}then(t,s){return this.finished.then(t,s)}get duration(){return Kn(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Kn(t)}get time(){return Kn(this.currentTime)}set time(t){t=Rn(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}getGeneratorVelocity(){const t=this.currentTime;if(t<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(t);const s=this.generator.next(t).value;return ZC(n=>this.generator.next(n).value,t,s)}get speed(){return this.playbackSpeed}set speed(t){const s=this.playbackSpeed!==t;s&&this.driver&&this.updateTime(Qs.now()),this.playbackSpeed=t,s&&this.driver&&(this.time=Kn(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=pO,startTime:s}=this.options;this.driver||(this.driver=t(o=>this.tick(o))),this.options.onPlay?.();const n=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=n):this.holdTime!==null?this.startTime=n-this.holdTime:this.startTime||(this.startTime=s??n),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Qs.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}function DO(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Ga=e=>e*180/Math.PI,_0=e=>{const t=Ga(Math.atan2(e[1],e[0]));return y0(t)},OO={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:_0,rotateZ:_0,skewX:e=>Ga(Math.atan(e[1])),skewY:e=>Ga(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},y0=e=>(e=e%360,e<0&&(e+=360),e),mS=_0,pS=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),gS=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),LO={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:pS,scaleY:gS,scale:e=>(pS(e)+gS(e))/2,rotateX:e=>y0(Ga(Math.atan2(e[6],e[5]))),rotateY:e=>y0(Ga(Math.atan2(-e[2],e[0]))),rotateZ:mS,rotate:mS,skewX:e=>Ga(Math.atan(e[4])),skewY:e=>Ga(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function S0(e){return e.includes("scale")?1:0}function w0(e,t){if(!e||e==="none")return S0(t);const s=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let n,o;if(s)n=LO,o=s;else{const h=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);n=OO,o=h}if(!o)return S0(t);const l=n[t],u=o[1].split(",").map(BO);return typeof l=="function"?l(u):u[l]}const zO=(e,t)=>{const{transform:s="none"}=getComputedStyle(e);return w0(s,t)};function BO(e){return parseFloat(e.trim())}const bl=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],xl=new Set(bl),bS=e=>e===gl||e===Ae,IO=new Set(["x","y","z"]),PO=bl.filter(e=>!IO.has(e));function $O(e){const t=[];return PO.forEach(s=>{const n=e.getValue(s);n!==void 0&&(t.push([s,n.get()]),n.set(s.startsWith("scale")?1:0))}),t}const oa={width:({x:e},{paddingLeft:t="0",paddingRight:s="0",boxSizing:n})=>{const o=e.max-e.min;return n==="border-box"?o:o-parseFloat(t)-parseFloat(s)},height:({y:e},{paddingTop:t="0",paddingBottom:s="0",boxSizing:n})=>{const o=e.max-e.min;return n==="border-box"?o:o-parseFloat(t)-parseFloat(s)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>w0(t,"x"),y:(e,{transform:t})=>w0(t,"y")};oa.translateX=oa.x;oa.translateY=oa.y;const Ya=new Set;let k0=!1,N0=!1,C0=!1;function JC(){if(N0){const e=Array.from(Ya).filter(n=>n.needsMeasurement),t=new Set(e.map(n=>n.element)),s=new Map;t.forEach(n=>{const o=$O(n);o.length&&(s.set(n,o),n.render())}),e.forEach(n=>n.measureInitialState()),t.forEach(n=>{n.render();const o=s.get(n);o&&o.forEach(([l,u])=>{n.getValue(l)?.set(u)})}),e.forEach(n=>n.measureEndState()),e.forEach(n=>{n.suspendedScrollY!==void 0&&window.scrollTo(0,n.suspendedScrollY)})}N0=!1,k0=!1,Ya.forEach(e=>e.complete(C0)),Ya.clear()}function eE(){Ya.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(N0=!0)})}function HO(){C0=!0,eE(),JC(),C0=!1}class dx{constructor(t,s,n,o,l,u=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=s,this.name=n,this.motionValue=o,this.element=l,this.isAsync=u}scheduleResolve(){this.state="scheduled",this.isAsync?(Ya.add(this),k0||(k0=!0,Et.read(eE),Et.resolveKeyframes(JC))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:s,element:n,motionValue:o}=this;if(t[0]===null){const l=o?.get(),u=t[t.length-1];if(l!==void 0)t[0]=l;else if(n&&s){const h=n.readValue(s,u);h!=null&&(t[0]=h)}t[0]===void 0&&(t[0]=u),o&&l===void 0&&o.set(t[0])}DO(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Ya.delete(this)}cancel(){this.state==="scheduled"&&(Ya.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const UO=e=>e.startsWith("--");function tE(e,t,s){UO(t)?e.style.setProperty(t,s):e.style[t]=s}const FO={};function sE(e,t){const s=TC(e);return()=>FO[t]??s()}const qO=sE(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),nE=sE(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Dc=([e,t,s,n])=>`cubic-bezier(${e}, ${t}, ${s}, ${n})`,xS={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Dc([0,.65,.55,1]),circOut:Dc([.55,0,1,.45]),backIn:Dc([.31,.01,.66,-.59]),backOut:Dc([.33,1.53,.69,.99])};function iE(e,t){if(e)return typeof e=="function"?nE()?XC(e,t):"ease-out":$C(e)?Dc(e):Array.isArray(e)?e.map(s=>iE(s,t)||xS.easeOut):xS[e]}function VO(e,t,s,{delay:n=0,duration:o=300,repeat:l=0,repeatType:u="loop",ease:h="easeOut",times:m}={},d=void 0){const p={[t]:s};m&&(p.offset=m);const g=iE(h,o);Array.isArray(g)&&(p.easing=g);const x={delay:n,duration:o,easing:Array.isArray(g)?"linear":g,fill:"both",iterations:l+1,direction:u==="reverse"?"alternate":"normal"};return d&&(x.pseudoElement=d),e.animate(p,x)}function rE(e){return typeof e=="function"&&"applyToOptions"in e}function GO({type:e,...t}){return rE(e)&&nE()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class aE extends ux{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:s,name:n,keyframes:o,pseudoElement:l,allowFlatten:u=!1,finalKeyframe:h,onComplete:m}=t;this.isPseudoElement=!!l,this.allowFlatten=u,this.options=t,tx(typeof t.type!="string");const d=GO(t);this.animation=VO(s,n,o,d,l),d.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!l){const p=gf(o,this.options,h,this.speed);this.updateMotionValue&&this.updateMotionValue(p),tE(s,n,p),this.animation.cancel()}m?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const t=this.options?.element;!this.isPseudoElement&&t?.isConnected&&this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return Kn(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Kn(t)}get time(){return Kn(Number(this.animation.currentTime)||0)}set time(t){const s=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Rn(t),s&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,rangeStart:s,rangeEnd:n,observe:o}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&qO()?(this.animation.timeline=t,s&&(this.animation.rangeStart=s),n&&(this.animation.rangeEnd=n),Yn):o(this)}}const oE={anticipate:zC,backInOut:LC,circInOut:IC};function WO(e){return e in oE}function KO(e){typeof e.ease=="string"&&WO(e.ease)&&(e.ease=oE[e.ease])}const Kp=10;class YO extends aE{constructor(t){KO(t),QC(t),super(t),t.startTime!==void 0&&t.autoplay!==!1&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:s,onUpdate:n,onComplete:o,element:l,...u}=this.options;if(!s)return;if(t!==void 0){s.set(t);return}const h=new zh({...u,autoplay:!1}),m=Math.max(Kp,Qs.now()-this.startTime),d=zi(0,Kp,m-Kp),p=h.sample(m).value,{name:g}=this.options;l&&g&&tE(l,g,p),s.setWithVelocity(h.sample(Math.max(0,m-d)).value,p,d),h.stop()}}const vS=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(mi.test(e)||e==="0")&&!e.startsWith("url("));function XO(e){const t=e[0];if(e.length===1)return!0;for(let s=0;s<e.length;s++)if(e[s]!==t)return!0}function ZO(e,t,s,n){const o=e[0];if(o===null)return!1;if(t==="display"||t==="visibility")return!0;const l=e[e.length-1],u=vS(o,t),h=vS(l,t);return!u||!h?!1:XO(e)||(s==="spring"||rE(s))&&n}function E0(e){e.duration=0,e.type="keyframes"}const lE=new Set(["opacity","clipPath","filter","transform"]),QO=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function JO(e){for(let t=0;t<e.length;t++)if(typeof e[t]=="string"&&QO.test(e[t]))return!0;return!1}const e7=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),t7=TC(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function s7(e){const{motionValue:t,name:s,repeatDelay:n,repeatType:o,damping:l,type:u,keyframes:h}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:d,transformTemplate:p}=t.owner.getProps();return t7()&&s&&(lE.has(s)||e7.has(s)&&JO(h))&&(s!=="transform"||!p)&&!d&&!n&&o!=="mirror"&&l!==0&&u!=="inertia"}const n7=40;class i7 extends ux{constructor({autoplay:t=!0,delay:s=0,type:n="keyframes",repeat:o=0,repeatDelay:l=0,repeatType:u="loop",keyframes:h,name:m,motionValue:d,element:p,...g}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=Qs.now();const x={autoplay:t,delay:s,type:n,repeat:o,repeatDelay:l,repeatType:u,name:m,motionValue:d,element:p,...g},_=p?.KeyframeResolver||dx;this.keyframeResolver=new _(h,(S,w,k)=>this.onKeyframesResolved(S,w,x,!k),m,d,p),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,s,n,o){this.keyframeResolver=void 0;const{name:l,type:u,velocity:h,delay:m,isHandoff:d,onUpdate:p}=n;this.resolvedAt=Qs.now();let g=!0;ZO(t,l,u,h)||(g=!1,(da.instantAnimations||!m)&&p?.(gf(t,n,s)),t[0]=t[t.length-1],E0(n),n.repeat=0);const _={startTime:o?this.resolvedAt?this.resolvedAt-this.createdAt>n7?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:s,...n,keyframes:t},S=g&&!d&&s7(_),w=_.motionValue?.owner?.current;let k;if(S)try{k=new YO({..._,element:w})}catch{k=new zh(_)}else k=new zh(_);k.finished.then(()=>{this.notifyFinished()}).catch(Yn),this.pendingTimeline&&(this.stopTimeline=k.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=k}get finished(){return this._animation?this.animation.finished:this._finished}then(t,s){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),HO()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}function cE(e,t,s,n=0,o=1){const l=Array.from(e).sort((d,p)=>d.sortNodePosition(p)).indexOf(t),u=e.size,h=(u-1)*n;return typeof s=="function"?s(l,u):o===1?l*n:h-l*n}const r7=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function a7(e){const t=r7.exec(e);if(!t)return[,];const[,s,n,o]=t;return[`--${s??n}`,o]}function uE(e,t,s=1){const[n,o]=a7(e);if(!n)return;const l=window.getComputedStyle(t).getPropertyValue(n);if(l){const u=l.trim();return CC(u)?parseFloat(u):u}return rx(o)?uE(o,t,s+1):o}const o7={type:"spring",stiffness:500,damping:25,restSpeed:10},l7=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),c7={type:"keyframes",duration:.8},u7={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},d7=(e,{keyframes:t})=>t.length>2?c7:xl.has(e)?e.startsWith("scale")?l7(t[1]):o7:u7;function dE(e,t){if(e?.inherit&&t){const{inherit:s,...n}=e;return{...t,...n}}return e}function hx(e,t){const s=e?.[t]??e?.default??e;return s!==e?dE(s,e):s}const h7=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function f7(e){for(const t in e)if(!h7.has(t))return!0;return!1}const fx=(e,t,s,n={},o,l)=>u=>{const h=hx(n,e)||{},m=h.delay||n.delay||0;let{elapsed:d=0}=n;d=d-Rn(m);const p={keyframes:Array.isArray(s)?s:[null,s],ease:"easeOut",velocity:t.getVelocity(),...h,delay:-d,onUpdate:x=>{t.set(x),h.onUpdate&&h.onUpdate(x)},onComplete:()=>{u(),h.onComplete&&h.onComplete()},name:e,motionValue:t,element:l?void 0:o};f7(h)||Object.assign(p,d7(e,p)),p.duration&&(p.duration=Rn(p.duration)),p.repeatDelay&&(p.repeatDelay=Rn(p.repeatDelay)),p.from!==void 0&&(p.keyframes[0]=p.from);let g=!1;if((p.type===!1||p.duration===0&&!p.repeatDelay)&&(E0(p),p.delay===0&&(g=!0)),(da.instantAnimations||da.skipAnimations||o?.shouldSkipAnimations)&&(g=!0,E0(p),p.delay=0),p.allowFlatten=!h.type&&!h.ease,g&&!l&&t.get()!==void 0){const x=gf(p.keyframes,h);if(x!==void 0){Et.update(()=>{p.onUpdate(x),p.onComplete()});return}}return h.isSync?new zh(p):new i7(p)};function _S(e){const t=[{},{}];return e?.values.forEach((s,n)=>{t[0][n]=s.get(),t[1][n]=s.getVelocity()}),t}function mx(e,t,s,n){if(typeof t=="function"){const[o,l]=_S(n);t=t(s!==void 0?s:e.custom,o,l)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[o,l]=_S(n);t=t(s!==void 0?s:e.custom,o,l)}return t}function Xa(e,t,s){const n=e.getProps();return mx(n,t,s!==void 0?s:n.custom,e)}const hE=new Set(["width","height","top","left","right","bottom",...bl]),yS=30,m7=e=>!isNaN(parseFloat(e));class p7{constructor(t,s={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=n=>{const o=Qs.now();if(this.updatedAt!==o&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(n),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const l of this.dependents)l.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=s.owner}setCurrent(t){this.current=t,this.updatedAt=Qs.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=m7(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,s){this.events[t]||(this.events[t]=new sx);const n=this.events[t].add(s);return t==="change"?()=>{n(),Et.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,s){this.passiveEffect=t,this.stopPassiveEffect=s}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,s,n){this.set(s),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-n}jump(t,s=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,s&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Qs.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>yS)return 0;const s=Math.min(this.updatedAt-this.prevUpdatedAt,yS);return AC(parseFloat(this.current)-parseFloat(this.prevFrameValue),s)}start(t){return this.stop(),new Promise(s=>{this.hasAnimated=!0,this.animation=t(s),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function dl(e,t){return new p7(e,t)}const j0=e=>Array.isArray(e);function g7(e,t,s){e.hasValue(t)?e.getValue(t).set(s):e.addValue(t,dl(s))}function b7(e){return j0(e)?e[e.length-1]||0:e}function x7(e,t){const s=Xa(e,t);let{transitionEnd:n={},transition:o={},...l}=s||{};l={...l,...n};for(const u in l){const h=b7(l[u]);g7(e,u,h)}}const Is=e=>!!(e&&e.getVelocity);function v7(e){return!!(Is(e)&&e.add)}function T0(e,t){const s=e.getValue("willChange");if(v7(s))return s.add(t);if(!s&&da.WillChange){const n=new da.WillChange("auto");e.addValue("willChange",n),n.add(t)}}function px(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const _7="framerAppearId",fE="data-"+px(_7);function mE(e){return e.props[fE]}function y7({protectedKeys:e,needsAnimating:t},s){const n=e.hasOwnProperty(s)&&t[s]!==!0;return t[s]=!1,n}function pE(e,t,{delay:s=0,transitionOverride:n,type:o}={}){let{transition:l,transitionEnd:u,...h}=t;const m=e.getDefaultTransition();l=l?dE(l,m):m;const d=l?.reduceMotion;n&&(l=n);const p=[],g=o&&e.animationState&&e.animationState.getState()[o];for(const x in h){const _=e.getValue(x,e.latestValues[x]??null),S=h[x];if(S===void 0||g&&y7(g,x))continue;const w={delay:s,...hx(l||{},x)},k=_.get();if(k!==void 0&&!_.isAnimating()&&!Array.isArray(S)&&S===k&&!w.velocity){Et.update(()=>_.set(S));continue}let C=!1;if(window.MotionHandoffAnimation){const j=mE(e);if(j){const M=window.MotionHandoffAnimation(j,x,Et);M!==null&&(w.startTime=M,C=!0)}}T0(e,x);const T=d??e.shouldReduceMotion;_.start(fx(x,_,S,T&&hE.has(x)?{type:!1}:w,e,C));const E=_.animation;E&&p.push(E)}if(u){const x=()=>Et.update(()=>{u&&x7(e,u)});p.length?Promise.all(p).then(x):x()}return p}function A0(e,t,s={}){const n=Xa(e,t,s.type==="exit"?e.presenceContext?.custom:void 0);let{transition:o=e.getDefaultTransition()||{}}=n||{};s.transitionOverride&&(o=s.transitionOverride);const l=n?()=>Promise.all(pE(e,n,s)):()=>Promise.resolve(),u=e.variantChildren&&e.variantChildren.size?(m=0)=>{const{delayChildren:d=0,staggerChildren:p,staggerDirection:g}=o;return S7(e,t,m,d,p,g,s)}:()=>Promise.resolve(),{when:h}=o;if(h){const[m,d]=h==="beforeChildren"?[l,u]:[u,l];return m().then(()=>d())}else return Promise.all([l(),u(s.delay)])}function S7(e,t,s=0,n=0,o=0,l=1,u){const h=[];for(const m of e.variantChildren)m.notify("AnimationStart",t),h.push(A0(m,t,{...u,delay:s+(typeof n=="function"?0:n)+cE(e.variantChildren,m,n,o,l)}).then(()=>m.notify("AnimationComplete",t)));return Promise.all(h)}function w7(e,t,s={}){e.notify("AnimationStart",t);let n;if(Array.isArray(t)){const o=t.map(l=>A0(e,l,s));n=Promise.all(o)}else if(typeof t=="string")n=A0(e,t,s);else{const o=typeof t=="function"?Xa(e,t,s.custom):t;n=Promise.all(pE(e,o,s))}return n.then(()=>{e.notify("AnimationComplete",t)})}const k7={test:e=>e==="auto",parse:e=>e},gE=e=>t=>t.test(e),bE=[gl,Ae,Di,ra,XD,YD,k7],SS=e=>bE.find(gE(e));function N7(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||jC(e):!0}const C7=new Set(["brightness","contrast","saturate","opacity"]);function E7(e){const[t,s]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[n]=s.match(ax)||[];if(!n)return e;const o=s.replace(n,"");let l=C7.has(t)?1:0;return n!==s&&(l*=100),t+"("+l+o+")"}const j7=/\b([a-z-]*)\(.*?\)/gu,R0={...mi,getAnimatableNone:e=>{const t=e.match(j7);return t?t.map(E7).join(" "):e}},M0={...mi,getAnimatableNone:e=>{const t=mi.parse(e);return mi.createTransformer(e)(t.map(n=>typeof n=="number"?0:typeof n=="object"?{...n,alpha:1}:n))}},wS={...gl,transform:Math.round},T7={rotate:ra,rotateX:ra,rotateY:ra,rotateZ:ra,scale:Gd,scaleX:Gd,scaleY:Gd,scaleZ:Gd,skew:ra,skewX:ra,skewY:ra,distance:Ae,translateX:Ae,translateY:Ae,translateZ:Ae,x:Ae,y:Ae,z:Ae,perspective:Ae,transformPerspective:Ae,opacity:tu,originX:cS,originY:cS,originZ:Ae},gx={borderWidth:Ae,borderTopWidth:Ae,borderRightWidth:Ae,borderBottomWidth:Ae,borderLeftWidth:Ae,borderRadius:Ae,borderTopLeftRadius:Ae,borderTopRightRadius:Ae,borderBottomRightRadius:Ae,borderBottomLeftRadius:Ae,width:Ae,maxWidth:Ae,height:Ae,maxHeight:Ae,top:Ae,right:Ae,bottom:Ae,left:Ae,inset:Ae,insetBlock:Ae,insetBlockStart:Ae,insetBlockEnd:Ae,insetInline:Ae,insetInlineStart:Ae,insetInlineEnd:Ae,padding:Ae,paddingTop:Ae,paddingRight:Ae,paddingBottom:Ae,paddingLeft:Ae,paddingBlock:Ae,paddingBlockStart:Ae,paddingBlockEnd:Ae,paddingInline:Ae,paddingInlineStart:Ae,paddingInlineEnd:Ae,margin:Ae,marginTop:Ae,marginRight:Ae,marginBottom:Ae,marginLeft:Ae,marginBlock:Ae,marginBlockStart:Ae,marginBlockEnd:Ae,marginInline:Ae,marginInlineStart:Ae,marginInlineEnd:Ae,fontSize:Ae,backgroundPositionX:Ae,backgroundPositionY:Ae,...T7,zIndex:wS,fillOpacity:tu,strokeOpacity:tu,numOctaves:wS},A7={...gx,color:ls,backgroundColor:ls,outlineColor:ls,fill:ls,stroke:ls,borderColor:ls,borderTopColor:ls,borderRightColor:ls,borderBottomColor:ls,borderLeftColor:ls,filter:R0,WebkitFilter:R0,mask:M0,WebkitMask:M0},xE=e=>A7[e],R7=new Set([R0,M0]);function vE(e,t){let s=xE(e);return R7.has(s)||(s=mi),s.getAnimatableNone?s.getAnimatableNone(t):void 0}const M7=new Set(["auto","none","0"]);function D7(e,t,s){let n=0,o;for(;n<e.length&&!o;){const l=e[n];typeof l=="string"&&!M7.has(l)&&ul(l).values.length&&(o=e[n]),n++}if(o&&s)for(const l of t)e[l]=vE(s,o)}class O7 extends dx{constructor(t,s,n,o,l){super(t,s,n,o,l,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:s,name:n}=this;if(!s||!s.current)return;super.readKeyframes();for(let p=0;p<t.length;p++){let g=t[p];if(typeof g=="string"&&(g=g.trim(),rx(g))){const x=uE(g,s.current);x!==void 0&&(t[p]=x),p===t.length-1&&(this.finalKeyframe=g)}}if(this.resolveNoneKeyframes(),!hE.has(n)||t.length!==2)return;const[o,l]=t,u=SS(o),h=SS(l),m=lS(o),d=lS(l);if(m!==d&&oa[n]){this.needsMeasurement=!0;return}if(u!==h)if(bS(u)&&bS(h))for(let p=0;p<t.length;p++){const g=t[p];typeof g=="string"&&(t[p]=parseFloat(g))}else oa[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:s}=this,n=[];for(let o=0;o<t.length;o++)(t[o]===null||N7(t[o]))&&n.push(o);n.length&&D7(t,n,s)}measureInitialState(){const{element:t,unresolvedKeyframes:s,name:n}=this;if(!t||!t.current)return;n==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=oa[n](t.measureViewportBox(),window.getComputedStyle(t.current)),s[0]=this.measuredOrigin;const o=s[s.length-1];o!==void 0&&t.getValue(n,o).jump(o,!1)}measureEndState(){const{element:t,name:s,unresolvedKeyframes:n}=this;if(!t||!t.current)return;const o=t.getValue(s);o&&o.jump(this.measuredOrigin,!1);const l=n.length-1,u=n[l];n[l]=oa[s](t.measureViewportBox(),window.getComputedStyle(t.current)),u!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=u),this.removedTransforms?.length&&this.removedTransforms.forEach(([h,m])=>{t.getValue(h).set(m)}),this.resolveNoneKeyframes()}}function _E(e,t,s){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let n=document;const o=s?.[e]??n.querySelectorAll(e);return o?Array.from(o):[]}return Array.from(e).filter(n=>n!=null)}const yE=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function L7(e){return EC(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}const{schedule:bx}=HC(queueMicrotask,!1),di={x:!1,y:!1};function SE(){return di.x||di.y}function z7(e){return e==="x"||e==="y"?di[e]?null:(di[e]=!0,()=>{di[e]=!1}):di.x||di.y?null:(di.x=di.y=!0,()=>{di.x=di.y=!1})}function wE(e,t){const s=_E(e),n=new AbortController,o={passive:!0,...t,signal:n.signal};return[s,o,()=>n.abort()]}function B7(e){return!(e.pointerType==="touch"||SE())}function I7(e,t,s={}){const[n,o,l]=wE(e,s);return n.forEach(u=>{let h=!1,m=!1,d;const p=()=>{u.removeEventListener("pointerleave",S)},g=k=>{d&&(d(k),d=void 0),p()},x=k=>{h=!1,window.removeEventListener("pointerup",x),window.removeEventListener("pointercancel",x),m&&(m=!1,g(k))},_=()=>{h=!0,window.addEventListener("pointerup",x,o),window.addEventListener("pointercancel",x,o)},S=k=>{if(k.pointerType!=="touch"){if(h){m=!0;return}g(k)}},w=k=>{if(!B7(k))return;m=!1;const C=t(u,k);typeof C=="function"&&(d=C,u.addEventListener("pointerleave",S,o))};u.addEventListener("pointerenter",w,o),u.addEventListener("pointerdown",_,o)}),l}const kE=(e,t)=>t?e===t?!0:kE(e,t.parentElement):!1,xx=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,P7=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function $7(e){return P7.has(e.tagName)||e.isContentEditable===!0}const H7=new Set(["INPUT","SELECT","TEXTAREA"]);function U7(e){return H7.has(e.tagName)||e.isContentEditable===!0}const gh=new WeakSet;function kS(e){return t=>{t.key==="Enter"&&e(t)}}function Yp(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const F7=(e,t)=>{const s=e.currentTarget;if(!s)return;const n=kS(()=>{if(gh.has(s))return;Yp(s,"down");const o=kS(()=>{Yp(s,"up")}),l=()=>Yp(s,"cancel");s.addEventListener("keyup",o,t),s.addEventListener("blur",l,t)});s.addEventListener("keydown",n,t),s.addEventListener("blur",()=>s.removeEventListener("keydown",n),t)};function NS(e){return xx(e)&&!SE()}const CS=new WeakSet;function q7(e,t,s={}){const[n,o,l]=wE(e,s),u=h=>{const m=h.currentTarget;if(!NS(h)||CS.has(h))return;gh.add(m),s.stopPropagation&&CS.add(h);const d=t(m,h),p=(_,S)=>{window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",x),gh.has(m)&&gh.delete(m),NS(_)&&typeof d=="function"&&d(_,{success:S})},g=_=>{p(_,m===window||m===document||s.useGlobalTarget||kE(m,_.target))},x=_=>{p(_,!1)};window.addEventListener("pointerup",g,o),window.addEventListener("pointercancel",x,o)};return n.forEach(h=>{(s.useGlobalTarget?window:h).addEventListener("pointerdown",u,o),L7(h)&&(h.addEventListener("focus",d=>F7(d,o)),!$7(h)&&!h.hasAttribute("tabindex")&&(h.tabIndex=0))}),l}function vx(e){return EC(e)&&"ownerSVGElement"in e}const bh=new WeakMap;let xh;const NE=(e,t,s)=>(n,o)=>o&&o[0]?o[0][e+"Size"]:vx(n)&&"getBBox"in n?n.getBBox()[t]:n[s],V7=NE("inline","width","offsetWidth"),G7=NE("block","height","offsetHeight");function W7({target:e,borderBoxSize:t}){bh.get(e)?.forEach(s=>{s(e,{get width(){return V7(e,t)},get height(){return G7(e,t)}})})}function K7(e){e.forEach(W7)}function Y7(){typeof ResizeObserver>"u"||(xh=new ResizeObserver(K7))}function X7(e,t){xh||Y7();const s=_E(e);return s.forEach(n=>{let o=bh.get(n);o||(o=new Set,bh.set(n,o)),o.add(t),xh?.observe(n)}),()=>{s.forEach(n=>{const o=bh.get(n);o?.delete(t),o?.size||xh?.unobserve(n)})}}const vh=new Set;let tl;function Z7(){tl=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};vh.forEach(t=>t(e))},window.addEventListener("resize",tl)}function Q7(e){return vh.add(e),tl||Z7(),()=>{vh.delete(e),!vh.size&&typeof tl=="function"&&(window.removeEventListener("resize",tl),tl=void 0)}}function ES(e,t){return typeof e=="function"?Q7(e):X7(e,t)}function J7(e){return vx(e)&&e.tagName==="svg"}const eL=[...bE,ls,mi],tL=e=>eL.find(gE(e)),jS=()=>({translate:0,scale:1,origin:0,originPoint:0}),sl=()=>({x:jS(),y:jS()}),TS=()=>({min:0,max:0}),xs=()=>({x:TS(),y:TS()}),sL=new WeakMap;function bf(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function su(e){return typeof e=="string"||Array.isArray(e)}const _x=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],yx=["initial",..._x];function xf(e){return bf(e.animate)||yx.some(t=>su(e[t]))}function CE(e){return!!(xf(e)||e.variants)}function nL(e,t,s){for(const n in t){const o=t[n],l=s[n];if(Is(o))e.addValue(n,o);else if(Is(l))e.addValue(n,dl(o,{owner:e}));else if(l!==o)if(e.hasValue(n)){const u=e.getValue(n);u.liveStyle===!0?u.jump(o):u.hasAnimated||u.set(o)}else{const u=e.getStaticValue(n);e.addValue(n,dl(u!==void 0?u:o,{owner:e}))}}for(const n in s)t[n]===void 0&&e.removeValue(n);return t}const D0={current:null},EE={current:!1},iL=typeof window<"u";function rL(){if(EE.current=!0,!!iL)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>D0.current=e.matches;e.addEventListener("change",t),t()}else D0.current=!1}const AS=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Bh={};function jE(e){Bh=e}function aL(){return Bh}class oL{scrapeMotionValuesFromProps(t,s,n){return{}}constructor({parent:t,props:s,presenceContext:n,reducedMotionConfig:o,skipAnimations:l,blockInitialAnimation:u,visualState:h},m={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=dx,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const _=Qs.now();this.renderScheduledAt<_&&(this.renderScheduledAt=_,Et.render(this.render,!1,!0))};const{latestValues:d,renderState:p}=h;this.latestValues=d,this.baseTarget={...d},this.initialValues=s.initial?{...d}:{},this.renderState=p,this.parent=t,this.props=s,this.presenceContext=n,this.depth=t?t.depth+1:0,this.reducedMotionConfig=o,this.skipAnimationsConfig=l,this.options=m,this.blockInitialAnimation=!!u,this.isControllingVariants=xf(s),this.isVariantNode=CE(s),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:g,...x}=this.scrapeMotionValuesFromProps(s,{},this);for(const _ in x){const S=x[_];d[_]!==void 0&&Is(S)&&S.set(d[_])}}mount(t){if(this.hasBeenMounted)for(const s in this.initialValues)this.values.get(s)?.jump(this.initialValues[s]),this.latestValues[s]=this.initialValues[s];this.current=t,sL.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((s,n)=>this.bindToMotionValue(n,s)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(EE.current||rL(),this.shouldReduceMotion=D0.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),ha(this.notifyUpdate),ha(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const s=this.features[t];s&&(s.unmount(),s.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,s){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),s.accelerate&&lE.has(t)&&this.current instanceof HTMLElement){const{factory:u,keyframes:h,times:m,ease:d,duration:p}=s.accelerate,g=new aE({element:this.current,name:t,keyframes:h,times:m,ease:d,duration:Rn(p)}),x=u(g);this.valueSubscriptions.set(t,()=>{x(),g.cancel()});return}const n=xl.has(t);n&&this.onBindTransform&&this.onBindTransform();const o=s.on("change",u=>{this.latestValues[t]=u,this.props.onUpdate&&Et.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let l;typeof window<"u"&&window.MotionCheckAppearSync&&(l=window.MotionCheckAppearSync(this,t,s)),this.valueSubscriptions.set(t,()=>{o(),l&&l(),s.owner&&s.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Bh){const s=Bh[t];if(!s)continue;const{isEnabled:n,Feature:o}=s;if(!this.features[t]&&o&&n(this.props)&&(this.features[t]=new o(this)),this.features[t]){const l=this.features[t];l.isMounted?l.update():(l.mount(),l.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):xs()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,s){this.latestValues[t]=s}update(t,s){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=s;for(let n=0;n<AS.length;n++){const o=AS[n];this.propEventSubscriptions[o]&&(this.propEventSubscriptions[o](),delete this.propEventSubscriptions[o]);const l="on"+o,u=t[l];u&&(this.propEventSubscriptions[o]=this.on(o,u))}this.prevMotionValues=nL(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const s=this.getClosestVariantNode();if(s)return s.variantChildren&&s.variantChildren.add(t),()=>s.variantChildren.delete(t)}addValue(t,s){const n=this.values.get(t);s!==n&&(n&&this.removeValue(t),this.bindToMotionValue(t,s),this.values.set(t,s),this.latestValues[t]=s.get())}removeValue(t){this.values.delete(t);const s=this.valueSubscriptions.get(t);s&&(s(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,s){if(this.props.values&&this.props.values[t])return this.props.values[t];let n=this.values.get(t);return n===void 0&&s!==void 0&&(n=dl(s===null?void 0:s,{owner:this}),this.addValue(t,n)),n}readValue(t,s){let n=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return n!=null&&(typeof n=="string"&&(CC(n)||jC(n))?n=parseFloat(n):!tL(n)&&mi.test(s)&&(n=vE(t,s)),this.setBaseTarget(t,Is(n)?n.get():n)),Is(n)?n.get():n}setBaseTarget(t,s){this.baseTarget[t]=s}getBaseTarget(t){const{initial:s}=this.props;let n;if(typeof s=="string"||typeof s=="object"){const l=mx(this.props,s,this.presenceContext?.custom);l&&(n=l[t])}if(s&&n!==void 0)return n;const o=this.getBaseTargetFromProps(this.props,t);return o!==void 0&&!Is(o)?o:this.initialValues[t]!==void 0&&n===void 0?void 0:this.baseTarget[t]}on(t,s){return this.events[t]||(this.events[t]=new sx),this.events[t].add(s)}notify(t,...s){this.events[t]&&this.events[t].notify(...s)}scheduleRenderMicrotask(){bx.render(this.render)}}class TE extends oL{constructor(){super(...arguments),this.KeyframeResolver=O7}sortInstanceNodePosition(t,s){return t.compareDocumentPosition(s)&2?1:-1}getBaseTargetFromProps(t,s){const n=t.style;return n?n[s]:void 0}removeValueFromRenderState(t,{vars:s,style:n}){delete s[t],delete n[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Is(t)&&(this.childSubscription=t.on("change",s=>{this.current&&(this.current.textContent=`${s}`)}))}}class pa{constructor(t){this.isMounted=!1,this.node=t}update(){}}function AE({top:e,left:t,right:s,bottom:n}){return{x:{min:t,max:s},y:{min:e,max:n}}}function lL({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function cL(e,t){if(!t)return e;const s=t({x:e.left,y:e.top}),n=t({x:e.right,y:e.bottom});return{top:s.y,left:s.x,bottom:n.y,right:n.x}}function Xp(e){return e===void 0||e===1}function O0({scale:e,scaleX:t,scaleY:s}){return!Xp(e)||!Xp(t)||!Xp(s)}function Ha(e){return O0(e)||RE(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function RE(e){return RS(e.x)||RS(e.y)}function RS(e){return e&&e!=="0%"}function Ih(e,t,s){const n=e-s,o=t*n;return s+o}function MS(e,t,s,n,o){return o!==void 0&&(e=Ih(e,o,n)),Ih(e,s,n)+t}function L0(e,t=0,s=1,n,o){e.min=MS(e.min,t,s,n,o),e.max=MS(e.max,t,s,n,o)}function ME(e,{x:t,y:s}){L0(e.x,t.translate,t.scale,t.originPoint),L0(e.y,s.translate,s.scale,s.originPoint)}const DS=.999999999999,OS=1.0000000000001;function uL(e,t,s,n=!1){const o=s.length;if(!o)return;t.x=t.y=1;let l,u;for(let h=0;h<o;h++){l=s[h],u=l.projectionDelta;const{visualElement:m}=l.options;m&&m.props.style&&m.props.style.display==="contents"||(n&&l.options.layoutScroll&&l.scroll&&l!==l.root&&(Ri(e.x,-l.scroll.offset.x),Ri(e.y,-l.scroll.offset.y)),u&&(t.x*=u.x.scale,t.y*=u.y.scale,ME(e,u)),n&&Ha(l.latestValues)&&_h(e,l.latestValues,l.layout?.layoutBox))}t.x<OS&&t.x>DS&&(t.x=1),t.y<OS&&t.y>DS&&(t.y=1)}function Ri(e,t){e.min+=t,e.max+=t}function LS(e,t,s,n,o=.5){const l=Lt(e.min,e.max,o);L0(e,t,s,l,n)}function zS(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function _h(e,t,s){const n=s??e;LS(e.x,zS(t.x,n.x),t.scaleX,t.scale,t.originX),LS(e.y,zS(t.y,n.y),t.scaleY,t.scale,t.originY)}function DE(e,t){return AE(cL(e.getBoundingClientRect(),t))}function dL(e,t,s){const n=DE(e,s),{scroll:o}=t;return o&&(Ri(n.x,o.offset.x),Ri(n.y,o.offset.y)),n}const hL={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},fL=bl.length;function mL(e,t,s){let n="",o=!0;for(let l=0;l<fL;l++){const u=bl[l],h=e[u];if(h===void 0)continue;let m=!0;if(typeof h=="number")m=h===(u.startsWith("scale")?1:0);else{const d=parseFloat(h);m=u.startsWith("scale")?d===1:d===0}if(!m||s){const d=yE(h,gx[u]);if(!m){o=!1;const p=hL[u]||u;n+=`${p}(${d}) `}s&&(t[u]=d)}}return n=n.trim(),s?n=s(t,o?"":n):o&&(n="none"),n}function Sx(e,t,s){const{style:n,vars:o,transformOrigin:l}=e;let u=!1,h=!1;for(const m in t){const d=t[m];if(xl.has(m)){u=!0;continue}else if(FC(m)){o[m]=d;continue}else{const p=yE(d,gx[m]);m.startsWith("origin")?(h=!0,l[m]=p):n[m]=p}}if(t.transform||(u||s?n.transform=mL(t,e.transform,s):n.transform&&(n.transform="none")),h){const{originX:m="50%",originY:d="50%",originZ:p=0}=l;n.transformOrigin=`${m} ${d} ${p}`}}function OE(e,{style:t,vars:s},n,o){const l=e.style;let u;for(u in t)l[u]=t[u];o?.applyProjectionStyles(l,n);for(u in s)l.setProperty(u,s[u])}function BS(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const yc={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Ae.test(e))e=parseFloat(e);else return e;const s=BS(e,t.target.x),n=BS(e,t.target.y);return`${s}% ${n}%`}},pL={correct:(e,{treeScale:t,projectionDelta:s})=>{const n=e,o=mi.parse(e);if(o.length>5)return n;const l=mi.createTransformer(e),u=typeof o[0]!="number"?1:0,h=s.x.scale*t.x,m=s.y.scale*t.y;o[0+u]/=h,o[1+u]/=m;const d=Lt(h,m,.5);return typeof o[2+u]=="number"&&(o[2+u]/=d),typeof o[3+u]=="number"&&(o[3+u]/=d),l(o)}},z0={borderRadius:{...yc,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:yc,borderTopRightRadius:yc,borderBottomLeftRadius:yc,borderBottomRightRadius:yc,boxShadow:pL};function LE(e,{layout:t,layoutId:s}){return xl.has(e)||e.startsWith("origin")||(t||s!==void 0)&&(!!z0[e]||e==="opacity")}function wx(e,t,s){const n=e.style,o=t?.style,l={};if(!n)return l;for(const u in n)(Is(n[u])||o&&Is(o[u])||LE(u,e)||s?.getValue(u)?.liveStyle!==void 0)&&(l[u]=n[u]);return l}function gL(e){return window.getComputedStyle(e)}class bL extends TE{constructor(){super(...arguments),this.type="html",this.renderInstance=OE}readValueFromInstance(t,s){if(xl.has(s))return this.projection?.isProjecting?S0(s):zO(t,s);{const n=gL(t),o=(FC(s)?n.getPropertyValue(s):n[s])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(t,{transformPagePoint:s}){return DE(t,s)}build(t,s,n){Sx(t,s,n.transformTemplate)}scrapeMotionValuesFromProps(t,s,n){return wx(t,s,n)}}const xL={offset:"stroke-dashoffset",array:"stroke-dasharray"},vL={offset:"strokeDashoffset",array:"strokeDasharray"};function _L(e,t,s=1,n=0,o=!0){e.pathLength=1;const l=o?xL:vL;e[l.offset]=`${-n}`,e[l.array]=`${t} ${s}`}const yL=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function zE(e,{attrX:t,attrY:s,attrScale:n,pathLength:o,pathSpacing:l=1,pathOffset:u=0,...h},m,d,p){if(Sx(e,h,d),m){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:g,style:x}=e;g.transform&&(x.transform=g.transform,delete g.transform),(x.transform||g.transformOrigin)&&(x.transformOrigin=g.transformOrigin??"50% 50%",delete g.transformOrigin),x.transform&&(x.transformBox=p?.transformBox??"fill-box",delete g.transformBox);for(const _ of yL)g[_]!==void 0&&(x[_]=g[_],delete g[_]);t!==void 0&&(g.x=t),s!==void 0&&(g.y=s),n!==void 0&&(g.scale=n),o!==void 0&&_L(g,o,l,u,!1)}const BE=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),IE=e=>typeof e=="string"&&e.toLowerCase()==="svg";function SL(e,t,s,n){OE(e,t,void 0,n);for(const o in t.attrs)e.setAttribute(BE.has(o)?o:px(o),t.attrs[o])}function PE(e,t,s){const n=wx(e,t,s);for(const o in e)if(Is(e[o])||Is(t[o])){const l=bl.indexOf(o)!==-1?"attr"+o.charAt(0).toUpperCase()+o.substring(1):o;n[l]=e[o]}return n}class wL extends TE{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=xs}getBaseTargetFromProps(t,s){return t[s]}readValueFromInstance(t,s){if(xl.has(s)){const n=xE(s);return n&&n.default||0}return s=BE.has(s)?s:px(s),t.getAttribute(s)}scrapeMotionValuesFromProps(t,s,n){return PE(t,s,n)}build(t,s,n){zE(t,s,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(t,s,n,o){SL(t,s,n,o)}mount(t){this.isSVGTag=IE(t.tagName),super.mount(t)}}const kL=yx.length;function $E(e){if(!e)return;if(!e.isControllingVariants){const s=e.parent?$E(e.parent)||{}:{};return e.props.initial!==void 0&&(s.initial=e.props.initial),s}const t={};for(let s=0;s<kL;s++){const n=yx[s],o=e.props[n];(su(o)||o===!1)&&(t[n]=o)}return t}function HE(e,t){if(!Array.isArray(t))return!1;const s=t.length;if(s!==e.length)return!1;for(let n=0;n<s;n++)if(t[n]!==e[n])return!1;return!0}const NL=[..._x].reverse(),CL=_x.length;function EL(e){return t=>Promise.all(t.map(({animation:s,options:n})=>w7(e,s,n)))}function jL(e){let t=EL(e),s=IS(),n=!0,o=!1;const l=d=>(p,g)=>{const x=Xa(e,g,d==="exit"?e.presenceContext?.custom:void 0);if(x){const{transition:_,transitionEnd:S,...w}=x;p={...p,...w,...S}}return p};function u(d){t=d(e)}function h(d){const{props:p}=e,g=$E(e.parent)||{},x=[],_=new Set;let S={},w=1/0;for(let C=0;C<CL;C++){const T=NL[C],E=s[T],j=p[T]!==void 0?p[T]:g[T],M=su(j),z=T===d?E.isActive:null;z===!1&&(w=C);let O=j===g[T]&&j!==p[T]&&M;if(O&&(n||o)&&e.manuallyAnimateOnMount&&(O=!1),E.protectedKeys={...S},!E.isActive&&z===null||!j&&!E.prevProp||bf(j)||typeof j=="boolean")continue;if(T==="exit"&&E.isActive&&z!==!0){E.prevResolvedValues&&(S={...S,...E.prevResolvedValues});continue}const A=TL(E.prevProp,j);let D=A||T===d&&E.isActive&&!O&&M||C>w&&M,B=!1;const P=Array.isArray(j)?j:[j];let H=P.reduce(l(T),{});z===!1&&(H={});const{prevResolvedValues:$={}}=E,q={...$,...H},V=Z=>{D=!0,_.has(Z)&&(B=!0,_.delete(Z)),E.needsAnimating[Z]=!0;const K=e.getValue(Z);K&&(K.liveStyle=!1)};for(const Z in q){const K=H[Z],te=$[Z];if(S.hasOwnProperty(Z))continue;let L=!1;j0(K)&&j0(te)?L=!HE(K,te):L=K!==te,L?K!=null?V(Z):_.add(Z):K!==void 0&&_.has(Z)?V(Z):E.protectedKeys[Z]=!0}E.prevProp=j,E.prevResolvedValues=H,E.isActive&&(S={...S,...H}),(n||o)&&e.blockInitialAnimation&&(D=!1);const I=O&&A;D&&(!I||B)&&x.push(...P.map(Z=>{const K={type:T};if(typeof Z=="string"&&(n||o)&&!I&&e.manuallyAnimateOnMount&&e.parent){const{parent:te}=e,L=Xa(te,Z);if(te.enteringChildren&&L){const{delayChildren:Q}=L.transition||{};K.delay=cE(te.enteringChildren,e,Q)}}return{animation:Z,options:K}}))}if(_.size){const C={};if(typeof p.initial!="boolean"){const T=Xa(e,Array.isArray(p.initial)?p.initial[0]:p.initial);T&&T.transition&&(C.transition=T.transition)}_.forEach(T=>{const E=e.getBaseTarget(T),j=e.getValue(T);j&&(j.liveStyle=!0),C[T]=E??null}),x.push({animation:C})}let k=!!x.length;return n&&(p.initial===!1||p.initial===p.animate)&&!e.manuallyAnimateOnMount&&(k=!1),n=!1,o=!1,k?t(x):Promise.resolve()}function m(d,p){if(s[d].isActive===p)return Promise.resolve();e.variantChildren?.forEach(x=>x.animationState?.setActive(d,p)),s[d].isActive=p;const g=h(d);for(const x in s)s[x].protectedKeys={};return g}return{animateChanges:h,setActive:m,setAnimateFunction:u,getState:()=>s,reset:()=>{s=IS(),o=!0}}}function TL(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!HE(t,e):!1}function Ba(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function IS(){return{animate:Ba(!0),whileInView:Ba(),whileHover:Ba(),whileTap:Ba(),whileDrag:Ba(),whileFocus:Ba(),exit:Ba()}}function B0(e,t){e.min=t.min,e.max=t.max}function ui(e,t){B0(e.x,t.x),B0(e.y,t.y)}function PS(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const UE=1e-4,AL=1-UE,RL=1+UE,FE=.01,ML=0-FE,DL=0+FE;function Js(e){return e.max-e.min}function OL(e,t,s){return Math.abs(e-t)<=s}function $S(e,t,s,n=.5){e.origin=n,e.originPoint=Lt(t.min,t.max,e.origin),e.scale=Js(s)/Js(t),e.translate=Lt(s.min,s.max,e.origin)-e.originPoint,(e.scale>=AL&&e.scale<=RL||isNaN(e.scale))&&(e.scale=1),(e.translate>=ML&&e.translate<=DL||isNaN(e.translate))&&(e.translate=0)}function Gc(e,t,s,n){$S(e.x,t.x,s.x,n?n.originX:void 0),$S(e.y,t.y,s.y,n?n.originY:void 0)}function HS(e,t,s,n=0){const o=n?Lt(s.min,s.max,n):s.min;e.min=o+t.min,e.max=e.min+Js(t)}function LL(e,t,s,n){HS(e.x,t.x,s.x,n?.x),HS(e.y,t.y,s.y,n?.y)}function US(e,t,s,n=0){const o=n?Lt(s.min,s.max,n):s.min;e.min=t.min-o,e.max=e.min+Js(t)}function Ph(e,t,s,n){US(e.x,t.x,s.x,n?.x),US(e.y,t.y,s.y,n?.y)}function FS(e,t,s,n,o){return e-=t,e=Ih(e,1/s,n),o!==void 0&&(e=Ih(e,1/o,n)),e}function zL(e,t=0,s=1,n=.5,o,l=e,u=e){if(Di.test(t)&&(t=parseFloat(t),t=Lt(u.min,u.max,t/100)-u.min),typeof t!="number")return;let h=Lt(l.min,l.max,n);e===l&&(h-=t),e.min=FS(e.min,t,s,h,o),e.max=FS(e.max,t,s,h,o)}function qS(e,t,[s,n,o],l,u){zL(e,t[s],t[n],t[o],t.scale,l,u)}const BL=["x","scaleX","originX"],IL=["y","scaleY","originY"];function VS(e,t,s,n){qS(e.x,t,BL,s?s.x:void 0,n?n.x:void 0),qS(e.y,t,IL,s?s.y:void 0,n?n.y:void 0)}function GS(e){return e.translate===0&&e.scale===1}function qE(e){return GS(e.x)&&GS(e.y)}function WS(e,t){return e.min===t.min&&e.max===t.max}function PL(e,t){return WS(e.x,t.x)&&WS(e.y,t.y)}function KS(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function VE(e,t){return KS(e.x,t.x)&&KS(e.y,t.y)}function YS(e){return Js(e.x)/Js(e.y)}function XS(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Ai(e){return[e("x"),e("y")]}function $L(e,t,s){let n="";const o=e.x.translate/t.x,l=e.y.translate/t.y,u=s?.z||0;if((o||l||u)&&(n=`translate3d(${o}px, ${l}px, ${u}px) `),(t.x!==1||t.y!==1)&&(n+=`scale(${1/t.x}, ${1/t.y}) `),s){const{transformPerspective:d,rotate:p,rotateX:g,rotateY:x,skewX:_,skewY:S}=s;d&&(n=`perspective(${d}px) ${n}`),p&&(n+=`rotate(${p}deg) `),g&&(n+=`rotateX(${g}deg) `),x&&(n+=`rotateY(${x}deg) `),_&&(n+=`skewX(${_}deg) `),S&&(n+=`skewY(${S}deg) `)}const h=e.x.scale*t.x,m=e.y.scale*t.y;return(h!==1||m!==1)&&(n+=`scale(${h}, ${m})`),n||"none"}const GE=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],HL=GE.length,ZS=e=>typeof e=="string"?parseFloat(e):e,QS=e=>typeof e=="number"||Ae.test(e);function UL(e,t,s,n,o,l){o?(e.opacity=Lt(0,s.opacity??1,FL(n)),e.opacityExit=Lt(t.opacity??1,0,qL(n))):l&&(e.opacity=Lt(t.opacity??1,s.opacity??1,n));for(let u=0;u<HL;u++){const h=GE[u];let m=JS(t,h),d=JS(s,h);if(m===void 0&&d===void 0)continue;m||(m=0),d||(d=0),m===0||d===0||QS(m)===QS(d)?(e[h]=Math.max(Lt(ZS(m),ZS(d),n),0),(Di.test(d)||Di.test(m))&&(e[h]+="%")):e[h]=d}(t.rotate||s.rotate)&&(e.rotate=Lt(t.rotate||0,s.rotate||0,n))}function JS(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const FL=WE(0,.5,BC),qL=WE(.5,.95,Yn);function WE(e,t,s){return n=>n<e?0:n>t?1:s(eu(e,t,n))}function VL(e,t,s){const n=Is(e)?e:dl(e);return n.start(fx("",n,t,s)),n.animation}function nu(e,t,s,n={passive:!0}){return e.addEventListener(t,s,n),()=>e.removeEventListener(t,s)}const GL=(e,t)=>e.depth-t.depth;class WL{constructor(){this.children=[],this.isDirty=!1}add(t){ex(this.children,t),this.isDirty=!0}remove(t){Mh(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(GL),this.isDirty=!1,this.children.forEach(t)}}function KL(e,t){const s=Qs.now(),n=({timestamp:o})=>{const l=o-s;l>=t&&(ha(n),e(l-t))};return Et.setup(n,!0),()=>ha(n)}function yh(e){return Is(e)?e.get():e}class YL{constructor(){this.members=[]}add(t){ex(this.members,t);for(let s=this.members.length-1;s>=0;s--){const n=this.members[s];if(n===t||n===this.lead||n===this.prevLead)continue;const o=n.instance;(!o||o.isConnected===!1)&&!n.snapshot&&(Mh(this.members,n),n.unmount())}t.scheduleRender()}remove(t){if(Mh(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const s=this.members[this.members.length-1];s&&this.promote(s)}}relegate(t){for(let s=this.members.indexOf(t)-1;s>=0;s--){const n=this.members[s];if(n.isPresent!==!1&&n.instance?.isConnected!==!1)return this.promote(n),!0}return!1}promote(t,s){const n=this.lead;if(t!==n&&(this.prevLead=n,this.lead=t,t.show(),n)){n.updateSnapshot(),t.scheduleRender();const{layoutDependency:o}=n.options,{layoutDependency:l}=t.options;(o===void 0||o!==l)&&(t.resumeFrom=n,s&&(n.preserveOpacity=!0),n.snapshot&&(t.snapshot=n.snapshot,t.snapshot.latestValues=n.animationValues||n.latestValues),t.root?.isUpdating&&(t.isLayoutDirty=!0)),t.options.crossfade===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(t=>{t.options.onExitComplete?.(),t.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(t=>t.instance&&t.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}}const Sh={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Zp=["","X","Y","Z"],XL=1e3;let ZL=0;function Qp(e,t,s,n){const{latestValues:o}=t;o[e]&&(s[e]=o[e],t.setStaticValue(e,0),n&&(n[e]=0))}function KE(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const s=mE(t);if(window.MotionHasOptimisedAnimation(s,"transform")){const{layout:o,layoutId:l}=e.options;window.MotionCancelOptimisedAnimation(s,"transform",Et,!(o||l))}const{parent:n}=e;n&&!n.hasCheckedOptimisedAppear&&KE(n)}function YE({attachResizeListener:e,defaultParent:t,measureScroll:s,checkIsScrollRoot:n,resetTransform:o}){return class{constructor(u={},h=t?.()){this.id=ZL++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(e9),this.nodes.forEach(a9),this.nodes.forEach(o9),this.nodes.forEach(t9)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=u,this.root=h?h.root||h:this,this.path=h?[...h.path,h]:[],this.parent=h,this.depth=h?h.depth+1:0;for(let m=0;m<this.path.length;m++)this.path[m].shouldResetTransform=!0;this.root===this&&(this.nodes=new WL)}addEventListener(u,h){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new sx),this.eventHandlers.get(u).add(h)}notifyListeners(u,...h){const m=this.eventHandlers.get(u);m&&m.notify(...h)}hasListeners(u){return this.eventHandlers.has(u)}mount(u){if(this.instance)return;this.isSVG=vx(u)&&!J7(u),this.instance=u;const{layoutId:h,layout:m,visualElement:d}=this.options;if(d&&!d.current&&d.mount(u),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(m||h)&&(this.isLayoutDirty=!0),e){let p,g=0;const x=()=>this.root.updateBlockedByResize=!1;Et.read(()=>{g=window.innerWidth}),e(u,()=>{const _=window.innerWidth;_!==g&&(g=_,this.root.updateBlockedByResize=!0,p&&p(),p=KL(x,250),Sh.hasAnimatedSinceResize&&(Sh.hasAnimatedSinceResize=!1,this.nodes.forEach(sw)))})}h&&this.root.registerSharedNode(h,this),this.options.animate!==!1&&d&&(h||m)&&this.addEventListener("didUpdate",({delta:p,hasLayoutChanged:g,hasRelativeLayoutChanged:x,layout:_})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const S=this.options.transition||d.getDefaultTransition()||h9,{onLayoutAnimationStart:w,onLayoutAnimationComplete:k}=d.getProps(),C=!this.targetLayout||!VE(this.targetLayout,_),T=!g&&x;if(this.options.layoutRoot||this.resumeFrom||T||g&&(C||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const E={...hx(S,"layout"),onPlay:w,onComplete:k};(d.shouldReduceMotion||this.options.layoutRoot)&&(E.delay=0,E.type=!1),this.startAnimation(E),this.setAnimationOrigin(p,T)}else g||sw(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=_})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const u=this.getStack();u&&u.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),ha(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(l9),this.animationId++)}getTransformTemplate(){const{visualElement:u}=this.options;return u&&u.getProps().transformTemplate}willUpdate(u=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&KE(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let p=0;p<this.path.length;p++){const g=this.path[p];g.shouldResetTransform=!0,(typeof g.latestValues.x=="string"||typeof g.latestValues.y=="string")&&(g.isLayoutDirty=!0),g.updateScroll("snapshot"),g.options.layoutRoot&&g.willUpdate(!1)}const{layoutId:h,layout:m}=this.options;if(h===void 0&&!m)return;const d=this.getTransformTemplate();this.prevTransformTemplateValue=d?d(this.latestValues,""):void 0,this.updateSnapshot(),u&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const m=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),m&&this.nodes.forEach(n9),this.nodes.forEach(ew);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(tw);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(i9),this.nodes.forEach(r9),this.nodes.forEach(QL),this.nodes.forEach(JL)):this.nodes.forEach(tw),this.clearAllSnapshots();const h=Qs.now();zs.delta=zi(0,1e3/60,h-zs.timestamp),zs.timestamp=h,zs.isProcessing=!0,Fp.update.process(zs),Fp.preRender.process(zs),Fp.render.process(zs),zs.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,bx.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(s9),this.sharedNodes.forEach(c9)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Et.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Et.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Js(this.snapshot.measuredBox.x)&&!Js(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let m=0;m<this.path.length;m++)this.path[m].updateScroll();const u=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=xs()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:h}=this.options;h&&h.notify("LayoutMeasure",this.layout.layoutBox,u?u.layoutBox:void 0)}updateScroll(u="measure"){let h=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===u&&(h=!1),h&&this.instance){const m=n(this.instance);this.scroll={animationId:this.root.animationId,phase:u,isRoot:m,offset:s(this.instance),wasRoot:this.scroll?this.scroll.isRoot:m}}}resetTransform(){if(!o)return;const u=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,h=this.projectionDelta&&!qE(this.projectionDelta),m=this.getTransformTemplate(),d=m?m(this.latestValues,""):void 0,p=d!==this.prevTransformTemplateValue;u&&this.instance&&(h||Ha(this.latestValues)||p)&&(o(this.instance,d),this.shouldResetTransform=!1,this.scheduleRender())}measure(u=!0){const h=this.measurePageBox();let m=this.removeElementScroll(h);return u&&(m=this.removeTransform(m)),f9(m),{animationId:this.root.animationId,measuredBox:h,layoutBox:m,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:u}=this.options;if(!u)return xs();const h=u.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(m9))){const{scroll:d}=this.root;d&&(Ri(h.x,d.offset.x),Ri(h.y,d.offset.y))}return h}removeElementScroll(u){const h=xs();if(ui(h,u),this.scroll?.wasRoot)return h;for(let m=0;m<this.path.length;m++){const d=this.path[m],{scroll:p,options:g}=d;d!==this.root&&p&&g.layoutScroll&&(p.wasRoot&&ui(h,u),Ri(h.x,p.offset.x),Ri(h.y,p.offset.y))}return h}applyTransform(u,h=!1,m){const d=m||xs();ui(d,u);for(let p=0;p<this.path.length;p++){const g=this.path[p];!h&&g.options.layoutScroll&&g.scroll&&g!==g.root&&(Ri(d.x,-g.scroll.offset.x),Ri(d.y,-g.scroll.offset.y)),Ha(g.latestValues)&&_h(d,g.latestValues,g.layout?.layoutBox)}return Ha(this.latestValues)&&_h(d,this.latestValues,this.layout?.layoutBox),d}removeTransform(u){const h=xs();ui(h,u);for(let m=0;m<this.path.length;m++){const d=this.path[m];if(!Ha(d.latestValues))continue;let p;d.instance&&(O0(d.latestValues)&&d.updateSnapshot(),p=xs(),ui(p,d.measurePageBox())),VS(h,d.latestValues,d.snapshot?.layoutBox,p)}return Ha(this.latestValues)&&VS(h,this.latestValues),h}setTargetDelta(u){this.targetDelta=u,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(u){this.options={...this.options,...u,crossfade:u.crossfade!==void 0?u.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==zs.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(u=!1){const h=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=h.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=h.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=h.isSharedProjectionDirty);const m=!!this.resumingFrom||this!==h;if(!(u||m&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:p,layoutId:g}=this.options;if(!this.layout||!(p||g))return;this.resolvedRelativeTargetAt=zs.timestamp;const x=this.getClosestProjectingParent();x&&this.linkedParentVersion!==x.layoutVersion&&!x.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&x&&x.layout?this.createRelativeTarget(x,this.layout.layoutBox,x.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=xs(),this.targetWithTransforms=xs()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),LL(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):ui(this.target,this.layout.layoutBox),ME(this.target,this.targetDelta)):ui(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&x&&!!x.resumingFrom==!!this.resumingFrom&&!x.options.layoutScroll&&x.target&&this.animationProgress!==1?this.createRelativeTarget(x,this.target,x.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||O0(this.parent.latestValues)||RE(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(u,h,m){this.relativeParent=u,this.linkedParentVersion=u.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=xs(),this.relativeTargetOrigin=xs(),Ph(this.relativeTargetOrigin,h,m,this.options.layoutAnchor||void 0),ui(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const u=this.getLead(),h=!!this.resumingFrom||this!==u;let m=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(m=!1),h&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(m=!1),this.resolvedRelativeTargetAt===zs.timestamp&&(m=!1),m)return;const{layout:d,layoutId:p}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(d||p))return;ui(this.layoutCorrected,this.layout.layoutBox);const g=this.treeScale.x,x=this.treeScale.y;uL(this.layoutCorrected,this.treeScale,this.path,h),u.layout&&!u.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(u.target=u.layout.layoutBox,u.targetWithTransforms=xs());const{target:_}=u;if(!_){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(PS(this.prevProjectionDelta.x,this.projectionDelta.x),PS(this.prevProjectionDelta.y,this.projectionDelta.y)),Gc(this.projectionDelta,this.layoutCorrected,_,this.latestValues),(this.treeScale.x!==g||this.treeScale.y!==x||!XS(this.projectionDelta.x,this.prevProjectionDelta.x)||!XS(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",_))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(u=!0){if(this.options.visualElement?.scheduleRender(),u){const h=this.getStack();h&&h.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=sl(),this.projectionDelta=sl(),this.projectionDeltaWithTransform=sl()}setAnimationOrigin(u,h=!1){const m=this.snapshot,d=m?m.latestValues:{},p={...this.latestValues},g=sl();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!h;const x=xs(),_=m?m.source:void 0,S=this.layout?this.layout.source:void 0,w=_!==S,k=this.getStack(),C=!k||k.members.length<=1,T=!!(w&&!C&&this.options.crossfade===!0&&!this.path.some(d9));this.animationProgress=0;let E;this.mixTargetDelta=j=>{const M=j/1e3;nw(g.x,u.x,M),nw(g.y,u.y,M),this.setTargetDelta(g),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Ph(x,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),u9(this.relativeTarget,this.relativeTargetOrigin,x,M),E&&PL(this.relativeTarget,E)&&(this.isProjectionDirty=!1),E||(E=xs()),ui(E,this.relativeTarget)),w&&(this.animationValues=p,UL(p,d,this.latestValues,M,T,C)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=M},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(u){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(ha(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Et.update(()=>{Sh.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=dl(0)),this.motionValue.jump(0,!1),this.currentAnimation=VL(this.motionValue,[0,1e3],{...u,velocity:0,isSync:!0,onUpdate:h=>{this.mixTargetDelta(h),u.onUpdate&&u.onUpdate(h)},onStop:()=>{},onComplete:()=>{u.onComplete&&u.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const u=this.getStack();u&&u.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(XL),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const u=this.getLead();let{targetWithTransforms:h,target:m,layout:d,latestValues:p}=u;if(!(!h||!m||!d)){if(this!==u&&this.layout&&d&&XE(this.options.animationType,this.layout.layoutBox,d.layoutBox)){m=this.target||xs();const g=Js(this.layout.layoutBox.x);m.x.min=u.target.x.min,m.x.max=m.x.min+g;const x=Js(this.layout.layoutBox.y);m.y.min=u.target.y.min,m.y.max=m.y.min+x}ui(h,m),_h(h,p),Gc(this.projectionDeltaWithTransform,this.layoutCorrected,h,p)}}registerSharedNode(u,h){this.sharedNodes.has(u)||this.sharedNodes.set(u,new YL),this.sharedNodes.get(u).add(h);const d=h.options.initialPromotionConfig;h.promote({transition:d?d.transition:void 0,preserveFollowOpacity:d&&d.shouldPreserveFollowOpacity?d.shouldPreserveFollowOpacity(h):void 0})}isLead(){const u=this.getStack();return u?u.lead===this:!0}getLead(){const{layoutId:u}=this.options;return u?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:u}=this.options;return u?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:u}=this.options;if(u)return this.root.sharedNodes.get(u)}promote({needsReset:u,transition:h,preserveFollowOpacity:m}={}){const d=this.getStack();d&&d.promote(this,m),u&&(this.projectionDelta=void 0,this.needsReset=!0),h&&this.setOptions({transition:h})}relegate(){const u=this.getStack();return u?u.relegate(this):!1}resetSkewAndRotation(){const{visualElement:u}=this.options;if(!u)return;let h=!1;const{latestValues:m}=u;if((m.z||m.rotate||m.rotateX||m.rotateY||m.rotateZ||m.skewX||m.skewY)&&(h=!0),!h)return;const d={};m.z&&Qp("z",u,d,this.animationValues);for(let p=0;p<Zp.length;p++)Qp(`rotate${Zp[p]}`,u,d,this.animationValues),Qp(`skew${Zp[p]}`,u,d,this.animationValues);u.render();for(const p in d)u.setStaticValue(p,d[p]),this.animationValues&&(this.animationValues[p]=d[p]);u.scheduleRender()}applyProjectionStyles(u,h){if(!this.instance||this.isSVG)return;if(!this.isVisible){u.visibility="hidden";return}const m=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,u.visibility="",u.opacity="",u.pointerEvents=yh(h?.pointerEvents)||"",u.transform=m?m(this.latestValues,""):"none";return}const d=this.getLead();if(!this.projectionDelta||!this.layout||!d.target){this.options.layoutId&&(u.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,u.pointerEvents=yh(h?.pointerEvents)||""),this.hasProjected&&!Ha(this.latestValues)&&(u.transform=m?m({},""):"none",this.hasProjected=!1);return}u.visibility="";const p=d.animationValues||d.latestValues;this.applyTransformsToTarget();let g=$L(this.projectionDeltaWithTransform,this.treeScale,p);m&&(g=m(p,g)),u.transform=g;const{x,y:_}=this.projectionDelta;u.transformOrigin=`${x.origin*100}% ${_.origin*100}% 0`,d.animationValues?u.opacity=d===this?p.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:p.opacityExit:u.opacity=d===this?p.opacity!==void 0?p.opacity:"":p.opacityExit!==void 0?p.opacityExit:0;for(const S in z0){if(p[S]===void 0)continue;const{correct:w,applyTo:k,isCSSVariable:C}=z0[S],T=g==="none"?p[S]:w(p[S],d);if(k){const E=k.length;for(let j=0;j<E;j++)u[k[j]]=T}else C?this.options.visualElement.renderState.vars[S]=T:u[S]=T}this.options.layoutId&&(u.pointerEvents=d===this?yh(h?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(u=>u.currentAnimation?.stop()),this.root.nodes.forEach(ew),this.root.sharedNodes.clear()}}}function QL(e){e.updateLayout()}function JL(e){const t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:n}=e.layout,{animationType:o}=e.options,l=t.source!==e.layout.source;if(o==="size")Ai(p=>{const g=l?t.measuredBox[p]:t.layoutBox[p],x=Js(g);g.min=s[p].min,g.max=g.min+x});else if(o==="x"||o==="y"){const p=o==="x"?"y":"x";B0(l?t.measuredBox[p]:t.layoutBox[p],s[p])}else XE(o,t.layoutBox,s)&&Ai(p=>{const g=l?t.measuredBox[p]:t.layoutBox[p],x=Js(s[p]);g.max=g.min+x,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[p].max=e.relativeTarget[p].min+x)});const u=sl();Gc(u,s,t.layoutBox);const h=sl();l?Gc(h,e.applyTransform(n,!0),t.measuredBox):Gc(h,s,t.layoutBox);const m=!qE(u);let d=!1;if(!e.resumeFrom){const p=e.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:g,layout:x}=p;if(g&&x){const _=e.options.layoutAnchor||void 0,S=xs();Ph(S,t.layoutBox,g.layoutBox,_);const w=xs();Ph(w,s,x.layoutBox,_),VE(S,w)||(d=!0),p.options.layoutRoot&&(e.relativeTarget=w,e.relativeTargetOrigin=S,e.relativeParent=p)}}}e.notifyListeners("didUpdate",{layout:s,snapshot:t,delta:h,layoutDelta:u,hasLayoutChanged:m,hasRelativeLayoutChanged:d})}else if(e.isLead()){const{onExitComplete:s}=e.options;s&&s()}e.options.transition=void 0}function e9(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function t9(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function s9(e){e.clearSnapshot()}function ew(e){e.clearMeasurements()}function n9(e){e.isLayoutDirty=!0,e.updateLayout()}function tw(e){e.isLayoutDirty=!1}function i9(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function r9(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function sw(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function a9(e){e.resolveTargetDelta()}function o9(e){e.calcProjection()}function l9(e){e.resetSkewAndRotation()}function c9(e){e.removeLeadSnapshot()}function nw(e,t,s){e.translate=Lt(t.translate,0,s),e.scale=Lt(t.scale,1,s),e.origin=t.origin,e.originPoint=t.originPoint}function iw(e,t,s,n){e.min=Lt(t.min,s.min,n),e.max=Lt(t.max,s.max,n)}function u9(e,t,s,n){iw(e.x,t.x,s.x,n),iw(e.y,t.y,s.y,n)}function d9(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const h9={duration:.45,ease:[.4,0,.1,1]},rw=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),aw=rw("applewebkit/")&&!rw("chrome/")?Math.round:Yn;function ow(e){e.min=aw(e.min),e.max=aw(e.max)}function f9(e){ow(e.x),ow(e.y)}function XE(e,t,s){return e==="position"||e==="preserve-aspect"&&!OL(YS(t),YS(s),.2)}function m9(e){return e!==e.root&&e.scroll?.wasRoot}const p9=YE({attachResizeListener:(e,t)=>nu(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),Jp={current:void 0},ZE=YE({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Jp.current){const e=new p9({});e.mount(window),e.setOptions({layoutScroll:!0}),Jp.current=e}return Jp.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),QE=y.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function g9(e=!0){const t=y.useContext(Jb);if(t===null)return[!0,null];const{isPresent:s,onExitComplete:n,register:o}=t,l=y.useId();y.useEffect(()=>{if(e)return o(l)},[e]);const u=y.useCallback(()=>e&&n&&n(l),[l,n,e]);return!s&&n?[!1,u]:[!0]}const JE=y.createContext({strict:!1}),lw={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let cw=!1;function b9(){if(cw)return;const e={};for(const t in lw)e[t]={isEnabled:s=>lw[t].some(n=>!!s[n])};jE(e),cw=!0}function e3(){return b9(),aL()}function x9(e){const t=e3();for(const s in e)t[s]={...t[s],...e[s]};jE(t)}const v9=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function $h(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||v9.has(e)}let t3=e=>!$h(e);function _9(e){typeof e=="function"&&(t3=t=>t.startsWith("on")?!$h(t):e(t))}try{_9(require("@emotion/is-prop-valid").default)}catch{}function y9(e,t,s){const n={};for(const o in e)o==="values"&&typeof e.values=="object"||Is(e[o])||(t3(o)||s===!0&&$h(o)||!t&&!$h(o)||e.draggable&&o.startsWith("onDrag"))&&(n[o]=e[o]);return n}const vf=y.createContext({});function S9(e,t){if(xf(e)){const{initial:s,animate:n}=e;return{initial:s===!1||su(s)?s:void 0,animate:su(n)?n:void 0}}return e.inherit!==!1?t:{}}function w9(e){const{initial:t,animate:s}=S9(e,y.useContext(vf));return y.useMemo(()=>({initial:t,animate:s}),[uw(t),uw(s)])}function uw(e){return Array.isArray(e)?e.join(" "):e}const kx=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function s3(e,t,s){for(const n in t)!Is(t[n])&&!LE(n,s)&&(e[n]=t[n])}function k9({transformTemplate:e},t){return y.useMemo(()=>{const s=kx();return Sx(s,t,e),Object.assign({},s.vars,s.style)},[t])}function N9(e,t){const s=e.style||{},n={};return s3(n,s,e),Object.assign(n,k9(e,t)),n}function C9(e,t){const s={},n=N9(e,t);return e.drag&&e.dragListener!==!1&&(s.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(s.tabIndex=0),s.style=n,s}const n3=()=>({...kx(),attrs:{}});function E9(e,t,s,n){const o=y.useMemo(()=>{const l=n3();return zE(l,t,IE(n),e.transformTemplate,e.style),{...l.attrs,style:{...l.style}}},[t]);if(e.style){const l={};s3(l,e.style,e),o.style={...l,...o.style}}return o}const j9=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Nx(e){return typeof e!="string"||e.includes("-")?!1:!!(j9.indexOf(e)>-1||/[A-Z]/u.test(e))}function T9(e,t,s,{latestValues:n},o,l=!1,u){const m=(u??Nx(e)?E9:C9)(t,n,o,e),d=y9(t,typeof e=="string",l),p=e!==y.Fragment?{...d,...m,ref:s}:{},{children:g}=t,x=y.useMemo(()=>Is(g)?g.get():g,[g]);return y.createElement(e,{...p,children:x})}function A9({scrapeMotionValuesFromProps:e,createRenderState:t},s,n,o){return{latestValues:R9(s,n,o,e),renderState:t()}}function R9(e,t,s,n){const o={},l=n(e,{});for(const x in l)o[x]=yh(l[x]);let{initial:u,animate:h}=e;const m=xf(e),d=CE(e);t&&d&&!m&&e.inherit!==!1&&(u===void 0&&(u=t.initial),h===void 0&&(h=t.animate));let p=s?s.initial===!1:!1;p=p||u===!1;const g=p?h:u;if(g&&typeof g!="boolean"&&!bf(g)){const x=Array.isArray(g)?g:[g];for(let _=0;_<x.length;_++){const S=mx(e,x[_]);if(S){const{transitionEnd:w,transition:k,...C}=S;for(const T in C){let E=C[T];if(Array.isArray(E)){const j=p?E.length-1:0;E=E[j]}E!==null&&(o[T]=E)}for(const T in w)o[T]=w[T]}}}return o}const i3=e=>(t,s)=>{const n=y.useContext(vf),o=y.useContext(Jb),l=()=>A9(e,t,n,o);return s?l():jD(l)},M9=i3({scrapeMotionValuesFromProps:wx,createRenderState:kx}),D9=i3({scrapeMotionValuesFromProps:PE,createRenderState:n3}),O9=Symbol.for("motionComponentSymbol");function L9(e,t,s){const n=y.useRef(s);y.useInsertionEffect(()=>{n.current=s});const o=y.useRef(null);return y.useCallback(l=>{l&&e.onMount?.(l);const u=n.current;if(typeof u=="function")if(l){const h=u(l);typeof h=="function"&&(o.current=h)}else o.current?(o.current(),o.current=null):u(l);else u&&(u.current=l);t&&(l?t.mount(l):t.unmount())},[t])}const r3=y.createContext({});function Qo(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function z9(e,t,s,n,o,l){const{visualElement:u}=y.useContext(vf),h=y.useContext(JE),m=y.useContext(Jb),d=y.useContext(QE),p=d.reducedMotion,g=d.skipAnimations,x=y.useRef(null),_=y.useRef(!1);n=n||h.renderer,!x.current&&n&&(x.current=n(e,{visualState:t,parent:u,props:s,presenceContext:m,blockInitialAnimation:m?m.initial===!1:!1,reducedMotionConfig:p,skipAnimations:g,isSVG:l}),_.current&&x.current&&(x.current.manuallyAnimateOnMount=!0));const S=x.current,w=y.useContext(r3);S&&!S.projection&&o&&(S.type==="html"||S.type==="svg")&&B9(x.current,s,o,w);const k=y.useRef(!1);y.useInsertionEffect(()=>{S&&k.current&&S.update(s,m)});const C=s[fE],T=y.useRef(!!C&&typeof window<"u"&&!window.MotionHandoffIsComplete?.(C)&&window.MotionHasOptimisedAnimation?.(C));return AD(()=>{_.current=!0,S&&(k.current=!0,window.MotionIsMounted=!0,S.updateFeatures(),S.scheduleRenderMicrotask(),T.current&&S.animationState&&S.animationState.animateChanges())}),y.useEffect(()=>{S&&(!T.current&&S.animationState&&S.animationState.animateChanges(),T.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(C)}),T.current=!1),S.enteringChildren=void 0)}),S}function B9(e,t,s,n){const{layoutId:o,layout:l,drag:u,dragConstraints:h,layoutScroll:m,layoutRoot:d,layoutAnchor:p,layoutCrossfade:g}=t;e.projection=new s(e.latestValues,t["data-framer-portal-id"]?void 0:a3(e.parent)),e.projection.setOptions({layoutId:o,layout:l,alwaysMeasureLayout:!!u||h&&Qo(h),visualElement:e,animationType:typeof l=="string"?l:"both",initialPromotionConfig:n,crossfade:g,layoutScroll:m,layoutRoot:d,layoutAnchor:p})}function a3(e){if(e)return e.options.allowProjection!==!1?e.projection:a3(e.parent)}function eg(e,{forwardMotionProps:t=!1,type:s}={},n,o){n&&x9(n);const l=s?s==="svg":Nx(e),u=l?D9:M9;function h(d,p){let g;const x={...y.useContext(QE),...d,layoutId:I9(d)},{isStatic:_}=x,S=w9(d),w=u(d,_);if(!_&&typeof window<"u"){P9();const k=$9(x);g=k.MeasureLayout,S.visualElement=z9(e,w,x,o,k.ProjectionNode,l)}return r.jsxs(vf.Provider,{value:S,children:[g&&S.visualElement?r.jsx(g,{visualElement:S.visualElement,...x}):null,T9(e,d,L9(w,S.visualElement,p),w,_,t,l)]})}h.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const m=y.forwardRef(h);return m[O9]=e,m}function I9({layoutId:e}){const t=y.useContext(NC).id;return t&&e!==void 0?t+"-"+e:e}function P9(e,t){y.useContext(JE).strict}function $9(e){const t=e3(),{drag:s,layout:n}=t;if(!s&&!n)return{};const o={...s,...n};return{MeasureLayout:s?.isEnabled(e)||n?.isEnabled(e)?o.MeasureLayout:void 0,ProjectionNode:o.ProjectionNode}}function H9(e,t){if(typeof Proxy>"u")return eg;const s=new Map,n=(l,u)=>eg(l,u,e,t),o=(l,u)=>n(l,u);return new Proxy(o,{get:(l,u)=>u==="create"?n:(s.has(u)||s.set(u,eg(u,void 0,e,t)),s.get(u))})}const U9=(e,t)=>t.isSVG??Nx(e)?new wL(t):new bL(t,{allowProjection:e!==y.Fragment});class F9 extends pa{constructor(t){super(t),t.animationState||(t.animationState=jL(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();bf(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:s}=this.node.prevProps||{};t!==s&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let q9=0;class V9 extends pa{constructor(){super(...arguments),this.id=q9++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:s}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===n)return;if(t&&n===!1){if(this.isExitComplete){const{initial:l,custom:u}=this.node.getProps();if(typeof l=="string"){const h=Xa(this.node,l,u);if(h){const{transition:m,transitionEnd:d,...p}=h;for(const g in p)this.node.getValue(g)?.jump(p[g])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const o=this.node.animationState.setActive("exit",!t);s&&!t&&o.then(()=>{this.isExitComplete=!0,s(this.id)})}mount(){const{register:t,onExitComplete:s}=this.node.presenceContext||{};s&&s(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const G9={animation:{Feature:F9},exit:{Feature:V9}};function xu(e){return{point:{x:e.pageX,y:e.pageY}}}const W9=e=>t=>xx(t)&&e(t,xu(t));function Wc(e,t,s,n){return nu(e,t,W9(s),n)}const o3=({current:e})=>e?e.ownerDocument.defaultView:null,dw=(e,t)=>Math.abs(e-t);function K9(e,t){const s=dw(e.x,t.x),n=dw(e.y,t.y);return Math.sqrt(s**2+n**2)}const hw=new Set(["auto","scroll"]);class l3{constructor(t,s,{transformPagePoint:n,contextWindow:o=window,dragSnapToOrigin:l=!1,distanceThreshold:u=3,element:h}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=_=>{this.handleScroll(_.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Wd(this.lastRawMoveEventInfo,this.transformPagePoint));const _=tg(this.lastMoveEventInfo,this.history),S=this.startEvent!==null,w=K9(_.offset,{x:0,y:0})>=this.distanceThreshold;if(!S&&!w)return;const{point:k}=_,{timestamp:C}=zs;this.history.push({...k,timestamp:C});const{onStart:T,onMove:E}=this.handlers;S||(T&&T(this.lastMoveEvent,_),this.startEvent=this.lastMoveEvent),E&&E(this.lastMoveEvent,_)},this.handlePointerMove=(_,S)=>{this.lastMoveEvent=_,this.lastRawMoveEventInfo=S,this.lastMoveEventInfo=Wd(S,this.transformPagePoint),Et.update(this.updatePoint,!0)},this.handlePointerUp=(_,S)=>{this.end();const{onEnd:w,onSessionEnd:k,resumeAnimation:C}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&C&&C(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const T=tg(_.type==="pointercancel"?this.lastMoveEventInfo:Wd(S,this.transformPagePoint),this.history);this.startEvent&&w&&w(_,T),k&&k(_,T)},!xx(t))return;this.dragSnapToOrigin=l,this.handlers=s,this.transformPagePoint=n,this.distanceThreshold=u,this.contextWindow=o||window;const m=xu(t),d=Wd(m,this.transformPagePoint),{point:p}=d,{timestamp:g}=zs;this.history=[{...p,timestamp:g}];const{onSessionStart:x}=s;x&&x(t,tg(d,this.history)),this.removeListeners=pu(Wc(this.contextWindow,"pointermove",this.handlePointerMove),Wc(this.contextWindow,"pointerup",this.handlePointerUp),Wc(this.contextWindow,"pointercancel",this.handlePointerUp)),h&&this.startScrollTracking(h)}startScrollTracking(t){let s=t.parentElement;for(;s;){const n=getComputedStyle(s);(hw.has(n.overflowX)||hw.has(n.overflowY))&&this.scrollPositions.set(s,{x:s.scrollLeft,y:s.scrollTop}),s=s.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const s=this.scrollPositions.get(t);if(!s)return;const n=t===window,o=n?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},l={x:o.x-s.x,y:o.y-s.y};l.x===0&&l.y===0||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=l.x,this.lastMoveEventInfo.point.y+=l.y):this.history.length>0&&(this.history[0].x-=l.x,this.history[0].y-=l.y),this.scrollPositions.set(t,o),Et.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),ha(this.updatePoint)}}function Wd(e,t){return t?{point:t(e.point)}:e}function fw(e,t){return{x:e.x-t.x,y:e.y-t.y}}function tg({point:e},t){return{point:e,delta:fw(e,c3(t)),offset:fw(e,Y9(t)),velocity:X9(t,.1)}}function Y9(e){return e[0]}function c3(e){return e[e.length-1]}function X9(e,t){if(e.length<2)return{x:0,y:0};let s=e.length-1,n=null;const o=c3(e);for(;s>=0&&(n=e[s],!(o.timestamp-n.timestamp>Rn(t)));)s--;if(!n)return{x:0,y:0};n===e[0]&&e.length>2&&o.timestamp-n.timestamp>Rn(t)*2&&(n=e[1]);const l=Kn(o.timestamp-n.timestamp);if(l===0)return{x:0,y:0};const u={x:(o.x-n.x)/l,y:(o.y-n.y)/l};return u.x===1/0&&(u.x=0),u.y===1/0&&(u.y=0),u}function Z9(e,{min:t,max:s},n){return t!==void 0&&e<t?e=n?Lt(t,e,n.min):Math.max(e,t):s!==void 0&&e>s&&(e=n?Lt(s,e,n.max):Math.min(e,s)),e}function mw(e,t,s){return{min:t!==void 0?e.min+t:void 0,max:s!==void 0?e.max+s-(e.max-e.min):void 0}}function Q9(e,{top:t,left:s,bottom:n,right:o}){return{x:mw(e.x,s,o),y:mw(e.y,t,n)}}function pw(e,t){let s=t.min-e.min,n=t.max-e.max;return t.max-t.min<e.max-e.min&&([s,n]=[n,s]),{min:s,max:n}}function J9(e,t){return{x:pw(e.x,t.x),y:pw(e.y,t.y)}}function ez(e,t){let s=.5;const n=Js(e),o=Js(t);return o>n?s=eu(t.min,t.max-n,e.min):n>o&&(s=eu(e.min,e.max-o,t.min)),zi(0,1,s)}function tz(e,t){const s={};return t.min!==void 0&&(s.min=t.min-e.min),t.max!==void 0&&(s.max=t.max-e.min),s}const I0=.35;function sz(e=I0){return e===!1?e=0:e===!0&&(e=I0),{x:gw(e,"left","right"),y:gw(e,"top","bottom")}}function gw(e,t,s){return{min:bw(e,t),max:bw(e,s)}}function bw(e,t){return typeof e=="number"?e:e[t]||0}const nz=new WeakMap;class iz{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=xs(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:s=!1,distanceThreshold:n}={}){const{presenceContext:o}=this.visualElement;if(o&&o.isPresent===!1)return;const l=g=>{s&&this.snapToCursor(xu(g).point),this.stopAnimation()},u=(g,x)=>{const{drag:_,dragPropagation:S,onDragStart:w}=this.getProps();if(_&&!S&&(this.openDragLock&&this.openDragLock(),this.openDragLock=z7(_),!this.openDragLock))return;this.latestPointerEvent=g,this.latestPanInfo=x,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Ai(C=>{let T=this.getAxisMotionValue(C).get()||0;if(Di.test(T)){const{projection:E}=this.visualElement;if(E&&E.layout){const j=E.layout.layoutBox[C];j&&(T=Js(j)*(parseFloat(T)/100))}}this.originPoint[C]=T}),w&&Et.update(()=>w(g,x),!1,!0),T0(this.visualElement,"transform");const{animationState:k}=this.visualElement;k&&k.setActive("whileDrag",!0)},h=(g,x)=>{this.latestPointerEvent=g,this.latestPanInfo=x;const{dragPropagation:_,dragDirectionLock:S,onDirectionLock:w,onDrag:k}=this.getProps();if(!_&&!this.openDragLock)return;const{offset:C}=x;if(S&&this.currentDirection===null){this.currentDirection=az(C),this.currentDirection!==null&&w&&w(this.currentDirection);return}this.updateAxis("x",x.point,C),this.updateAxis("y",x.point,C),this.visualElement.render(),k&&Et.update(()=>k(g,x),!1,!0)},m=(g,x)=>{this.latestPointerEvent=g,this.latestPanInfo=x,this.stop(g,x),this.latestPointerEvent=null,this.latestPanInfo=null},d=()=>{const{dragSnapToOrigin:g}=this.getProps();(g||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:p}=this.getProps();this.panSession=new l3(t,{onSessionStart:l,onStart:u,onMove:h,onSessionEnd:m,resumeAnimation:d},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:p,distanceThreshold:n,contextWindow:o3(this.visualElement),element:this.visualElement.current})}stop(t,s){const n=t||this.latestPointerEvent,o=s||this.latestPanInfo,l=this.isDragging;if(this.cancel(),!l||!o||!n)return;const{velocity:u}=o;this.startAnimation(u);const{onDragEnd:h}=this.getProps();h&&Et.postRender(()=>h(n,o))}cancel(){this.isDragging=!1;const{projection:t,animationState:s}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),s&&s.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(t,s,n){const{drag:o}=this.getProps();if(!n||!Kd(t,o,this.currentDirection))return;const l=this.getAxisMotionValue(t);let u=this.originPoint[t]+n[t];this.constraints&&this.constraints[t]&&(u=Z9(u,this.constraints[t],this.elastic[t])),l.set(u)}resolveConstraints(){const{dragConstraints:t,dragElastic:s}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,o=this.constraints;t&&Qo(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&n?this.constraints=Q9(n.layoutBox,t):this.constraints=!1,this.elastic=sz(s),o!==this.constraints&&!Qo(t)&&n&&this.constraints&&!this.hasMutatedConstraints&&Ai(l=>{this.constraints!==!1&&this.getAxisMotionValue(l)&&(this.constraints[l]=tz(n.layoutBox[l],this.constraints[l]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:s}=this.getProps();if(!t||!Qo(t))return!1;const n=t.current,{projection:o}=this.visualElement;if(!o||!o.layout)return!1;const l=dL(n,o.root,this.visualElement.getTransformPagePoint());let u=J9(o.layout.layoutBox,l);if(s){const h=s(lL(u));this.hasMutatedConstraints=!!h,h&&(u=AE(h))}return u}startAnimation(t){const{drag:s,dragMomentum:n,dragElastic:o,dragTransition:l,dragSnapToOrigin:u,onDragTransitionEnd:h}=this.getProps(),m=this.constraints||{},d=Ai(p=>{if(!Kd(p,s,this.currentDirection))return;let g=m&&m[p]||{};(u===!0||u===p)&&(g={min:0,max:0});const x=o?200:1e6,_=o?40:1e7,S={type:"inertia",velocity:n?t[p]:0,bounceStiffness:x,bounceDamping:_,timeConstant:750,restDelta:1,restSpeed:10,...l,...g};return this.startAxisValueAnimation(p,S)});return Promise.all(d).then(h)}startAxisValueAnimation(t,s){const n=this.getAxisMotionValue(t);return T0(this.visualElement,t),n.start(fx(t,n,0,s,this.visualElement,!1))}stopAnimation(){Ai(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const s=`_drag${t.toUpperCase()}`,n=this.visualElement.getProps(),o=n[s];return o||this.visualElement.getValue(t,(n.initial?n.initial[t]:void 0)||0)}snapToCursor(t){Ai(s=>{const{drag:n}=this.getProps();if(!Kd(s,n,this.currentDirection))return;const{projection:o}=this.visualElement,l=this.getAxisMotionValue(s);if(o&&o.layout){const{min:u,max:h}=o.layout.layoutBox[s],m=l.get()||0;l.set(t[s]-Lt(u,h,.5)+m)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:s}=this.getProps(),{projection:n}=this.visualElement;if(!Qo(s)||!n||!this.constraints)return;this.stopAnimation();const o={x:0,y:0};Ai(u=>{const h=this.getAxisMotionValue(u);if(h&&this.constraints!==!1){const m=h.get();o[u]=ez({min:m,max:m},this.constraints[u])}});const{transformTemplate:l}=this.visualElement.getProps();this.visualElement.current.style.transform=l?l({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),Ai(u=>{if(!Kd(u,t,null))return;const h=this.getAxisMotionValue(u),{min:m,max:d}=this.constraints[u];h.set(Lt(m,d,o[u]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;nz.set(this.visualElement,this);const t=this.visualElement.current,s=Wc(t,"pointerdown",d=>{const{drag:p,dragListener:g=!0}=this.getProps(),x=d.target,_=x!==t&&U7(x);p&&g&&!_&&this.start(d)});let n;const o=()=>{const{dragConstraints:d}=this.getProps();Qo(d)&&d.current&&(this.constraints=this.resolveRefConstraints(),n||(n=rz(t,d.current,()=>this.scalePositionWithinConstraints())))},{projection:l}=this.visualElement,u=l.addEventListener("measure",o);l&&!l.layout&&(l.root&&l.root.updateScroll(),l.updateLayout()),Et.read(o);const h=nu(window,"resize",()=>this.scalePositionWithinConstraints()),m=l.addEventListener("didUpdate",(({delta:d,hasLayoutChanged:p})=>{this.isDragging&&p&&(Ai(g=>{const x=this.getAxisMotionValue(g);x&&(this.originPoint[g]+=d[g].translate,x.set(x.get()+d[g].translate))}),this.visualElement.render())}));return()=>{h(),s(),u(),m&&m(),n&&n()}}getProps(){const t=this.visualElement.getProps(),{drag:s=!1,dragDirectionLock:n=!1,dragPropagation:o=!1,dragConstraints:l=!1,dragElastic:u=I0,dragMomentum:h=!0}=t;return{...t,drag:s,dragDirectionLock:n,dragPropagation:o,dragConstraints:l,dragElastic:u,dragMomentum:h}}}function xw(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function rz(e,t,s){const n=ES(e,xw(s)),o=ES(t,xw(s));return()=>{n(),o()}}function Kd(e,t,s){return(t===!0||t===e)&&(s===null||s===e)}function az(e,t=10){let s=null;return Math.abs(e.y)>t?s="y":Math.abs(e.x)>t&&(s="x"),s}class oz extends pa{constructor(t){super(t),this.removeGroupControls=Yn,this.removeListeners=Yn,this.controls=new iz(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Yn}update(){const{dragControls:t}=this.node.getProps(),{dragControls:s}=this.node.prevProps||{};t!==s&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const sg=e=>(t,s)=>{e&&Et.update(()=>e(t,s),!1,!0)};class lz extends pa{constructor(){super(...arguments),this.removePointerDownListener=Yn}onPointerDown(t){this.session=new l3(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:o3(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:s,onPan:n,onPanEnd:o}=this.node.getProps();return{onSessionStart:sg(t),onStart:sg(s),onMove:sg(n),onEnd:(l,u)=>{delete this.session,o&&Et.postRender(()=>o(l,u))}}}mount(){this.removePointerDownListener=Wc(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let ng=!1;class cz extends y.Component{componentDidMount(){const{visualElement:t,layoutGroup:s,switchLayoutGroup:n,layoutId:o}=this.props,{projection:l}=t;l&&(s.group&&s.group.add(l),n&&n.register&&o&&n.register(l),ng&&l.root.didUpdate(),l.addEventListener("animationComplete",()=>{this.safeToRemove()}),l.setOptions({...l.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Sh.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:s,visualElement:n,drag:o,isPresent:l}=this.props,{projection:u}=n;return u&&(u.isPresent=l,t.layoutDependency!==s&&u.setOptions({...u.options,layoutDependency:s}),ng=!0,o||t.layoutDependency!==s||s===void 0||t.isPresent!==l?u.willUpdate():this.safeToRemove(),t.isPresent!==l&&(l?u.promote():u.relegate()||Et.postRender(()=>{const h=u.getStack();(!h||!h.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:t,layoutAnchor:s}=this.props,{projection:n}=t;n&&(n.options.layoutAnchor=s,n.root.didUpdate(),bx.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:s,switchLayoutGroup:n}=this.props,{projection:o}=t;ng=!0,o&&(o.scheduleCheckAfterUnmount(),s&&s.group&&s.group.remove(o),n&&n.deregister&&n.deregister(o))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function u3(e){const[t,s]=g9(),n=y.useContext(NC);return r.jsx(cz,{...e,layoutGroup:n,switchLayoutGroup:y.useContext(r3),isPresent:t,safeToRemove:s})}const uz={pan:{Feature:lz},drag:{Feature:oz,ProjectionNode:ZE,MeasureLayout:u3}};function vw(e,t,s){const{props:n}=e;e.animationState&&n.whileHover&&e.animationState.setActive("whileHover",s==="Start");const o="onHover"+s,l=n[o];l&&Et.postRender(()=>l(t,xu(t)))}class dz extends pa{mount(){const{current:t}=this.node;t&&(this.unmount=I7(t,(s,n)=>(vw(this.node,n,"Start"),o=>vw(this.node,o,"End"))))}unmount(){}}class hz extends pa{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=pu(nu(this.node.current,"focus",()=>this.onFocus()),nu(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function _w(e,t,s){const{props:n}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&n.whileTap&&e.animationState.setActive("whileTap",s==="Start");const o="onTap"+(s==="End"?"":s),l=n[o];l&&Et.postRender(()=>l(t,xu(t)))}class fz extends pa{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:s,propagate:n}=this.node.props;this.unmount=q7(t,(o,l)=>(_w(this.node,l,"Start"),(u,{success:h})=>_w(this.node,u,h?"End":"Cancel")),{useGlobalTarget:s,stopPropagation:n?.tap===!1})}unmount(){}}const P0=new WeakMap,ig=new WeakMap,mz=e=>{const t=P0.get(e.target);t&&t(e)},pz=e=>{e.forEach(mz)};function gz({root:e,...t}){const s=e||document;ig.has(s)||ig.set(s,{});const n=ig.get(s),o=JSON.stringify(t);return n[o]||(n[o]=new IntersectionObserver(pz,{root:e,...t})),n[o]}function bz(e,t,s){const n=gz(t);return P0.set(e,s),n.observe(e),()=>{P0.delete(e),n.unobserve(e)}}const xz={some:0,all:1};class vz extends pa{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();const{viewport:t={}}=this.node.getProps(),{root:s,margin:n,amount:o="some",once:l}=t,u={root:s?s.current:void 0,rootMargin:n,threshold:typeof o=="number"?o:xz[o]},h=m=>{const{isIntersecting:d}=m;if(this.isInView===d||(this.isInView=d,l&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:p,onViewportLeave:g}=this.node.getProps(),x=d?p:g;x&&x(m)};this.stopObserver=bz(this.node.current,u,h)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:s}=this.node;["amount","margin","root"].some(_z(t,s))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}}function _z({viewport:e={}},{viewport:t={}}={}){return s=>e[s]!==t[s]}const yz={inView:{Feature:vz},tap:{Feature:fz},focus:{Feature:hz},hover:{Feature:dz}},Sz={layout:{ProjectionNode:ZE,MeasureLayout:u3}},wz={...G9,...yz,...uz,...Sz},rg=H9(wz,U9),ze=({label:e,children:t,variant:s="primary",size:n="medium",icon:o,onClick:l,removable:u=!1,className:h,maxWidth:m,appearance:d,onRemove:p,isLoading:g=!1})=>{const x=kz(s),_=d??(s==="outline"?"outline":"solid"),S=e??t,w=!!l,k={primary:{solid:"border border-transparent bg-primary text-primary-foreground dark:border-zinc-700/80 dark:bg-zinc-900/80 dark:text-zinc-100",outline:"border-2 border-primary/60 text-foreground dark:border-zinc-700/80 dark:bg-zinc-900/80 dark:text-zinc-100",subtle:"border border-transparent bg-primary/15 text-foreground dark:border-zinc-700/70 dark:bg-zinc-900/70 dark:text-zinc-200"},secondary:{solid:"border border-transparent bg-secondary text-secondary-foreground dark:border-zinc-700/80 dark:bg-zinc-900/80 dark:text-zinc-200",outline:"border-2 border-border bg-card text-foreground dark:border-zinc-700/80 dark:bg-zinc-900/80 dark:text-zinc-200",subtle:"border border-border bg-muted text-foreground dark:border-zinc-700/70 dark:bg-zinc-900/70 dark:text-zinc-200"},success:{solid:"border border-transparent bg-emerald-600 text-white dark:border-emerald-400/30 dark:bg-emerald-500/15 dark:text-emerald-300",outline:"border-2 border-emerald-600 text-emerald-700 dark:border-emerald-400/40 dark:bg-emerald-500/10 dark:text-emerald-300",subtle:"border border-transparent bg-emerald-500/15 text-emerald-700 dark:border-emerald-400/25 dark:bg-emerald-500/15 dark:text-emerald-300"},warning:{solid:"border border-transparent bg-amber-500 text-white dark:border-amber-400/30 dark:bg-amber-500/15 dark:text-amber-300",outline:"border-2 border-amber-500 text-amber-700 dark:border-amber-400/40 dark:bg-amber-500/10 dark:text-amber-300",subtle:"border border-transparent bg-amber-500/15 text-amber-700 dark:border-amber-400/25 dark:bg-amber-500/15 dark:text-amber-300"},error:{solid:"border border-transparent bg-destructive text-destructive-foreground dark:border-red-400/30 dark:bg-red-500/15 dark:text-red-300",outline:"border-2 border-destructive text-destructive dark:border-red-400/40 dark:bg-red-500/10 dark:text-red-300",subtle:"border border-transparent bg-destructive/20 text-destructive dark:border-red-400/25 dark:bg-red-500/15 dark:text-red-300"}},C={small:"text-xs px-2 py-1",medium:"text-xs px-2.5 py-1",large:"text-sm px-3 py-1.5"},T=j=>{j.stopPropagation(),l?.()},E=j=>{j.stopPropagation(),p?.()};return r.jsxs(rg.div,{initial:{opacity:0,scale:.95,y:8,filter:"blur(8px)"},animate:{opacity:1,scale:1,y:0,filter:"blur(0px)"},transition:{duration:.32,ease:"easeInOut",type:"spring"},whileHover:{scale:w?1.04:1,transition:{duration:.2,ease:"easeInOut",type:"spring"}},onClick:T,style:{maxWidth:m},className:ie("inline-flex max-w-full items-center gap-1.5 rounded-lg font-medium shadow-[0_0_16px_rgba(0,0,0,0.14)] backdrop-blur-sm",k[x][_],C[n],w&&"cursor-pointer",h),children:[g?r.jsx(rg.div,{animate:{rotate:360},transition:{duration:1,ease:"linear",repeat:1/0},className:"flex-shrink-0",children:r.jsx(ht,{className:"size-3.5"})}):o&&r.jsx("span",{className:"flex-shrink-0",children:o}),r.jsx("span",{className:"min-w-0 truncate",children:S}),u&&r.jsx(rg.button,{initial:{opacity:0,scale:.95,filter:"blur(8px)"},animate:{opacity:1,scale:1,filter:"blur(0px)"},whileHover:{scale:1.1,opacity:1,transition:{duration:.2,ease:"easeInOut",type:"spring"}},className:"flex items-center justify-center rounded-md bg-foreground/15 p-1 opacity-70 hover:opacity-100",onClick:E,type:"button",children:r.jsx(Ft,{className:"size-3.5"})})]})};function kz(e){return e==="danger"?"error":e==="default"||e==="outline"?"primary":e}const Nz=uC("rounded-lg border p-4 text-sm has-[>svg]:flex has-[>svg]:items-start has-[>svg]:gap-2.5 [&>svg]:mt-0.5 [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"border-border bg-card text-card-foreground",muted:"border-border bg-muted text-muted-foreground",destructive:"border-destructive/40 bg-destructive/10 text-destructive dark:text-red-300"}},defaultVariants:{variant:"default"}});function $e({className:e,variant:t,...s}){return r.jsx("div",{className:ie(Nz({variant:t,className:e})),...s})}function d3({className:e,...t}){return r.jsx("h5",{className:ie("mb-1 font-medium leading-none",e),...t})}function h3({className:e,...t}){return r.jsx("p",{className:ie("leading-5",e),...t})}function Hh(e){return ie("group/header-action inline-flex h-7 w-7 items-center overflow-hidden rounded-md text-xs font-medium text-muted-foreground transition-[width,background-color,color] duration-200 hover:w-24 hover:bg-muted hover:text-foreground focus:w-24 focus:bg-muted focus:text-foreground focus-visible:w-24 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",e)}function Uh(e){return ie("flex size-7 shrink-0 items-center justify-center [&_svg]:size-4 [&_svg]:shrink-0",e)}function Fh(e){return ie("max-w-0 overflow-hidden whitespace-nowrap text-left opacity-0 transition-[max-width,opacity] duration-200 group-hover/header-action:max-w-20 group-hover/header-action:opacity-100 group-focus/header-action:max-w-20 group-focus/header-action:opacity-100",e)}function gi({className:e,...t}){return r.jsx("div",{className:ie("rounded-lg border border-border bg-card text-card-foreground",e),...t})}function bi({className:e,...t}){return r.jsx("div",{className:ie("grid gap-1.5 p-4",e),...t})}function xi({className:e,...t}){return r.jsx("h3",{className:ie("text-sm font-semibold tracking-tight",e),...t})}function Ii({className:e,...t}){return r.jsx("p",{className:ie("text-sm text-muted-foreground",e),...t})}function vi({className:e,...t}){return r.jsx("div",{className:ie("p-4 pt-0",e),...t})}const yw=100;function Cz(){const[e,t]=y.useState([]),[s,n]=y.useState(!1),o=y.useRef(new Set);y.useEffect(()=>{const u=new EventSource("/api/agent/tool-calls/stream");return u.addEventListener("open",()=>n(!0)),u.addEventListener("error",()=>n(!1)),u.addEventListener("tool-call",h=>{try{const m=JSON.parse(h.data);t(d=>{if(o.current.has(m.id))return d;o.current.add(m.id);const p=[...d,m];return p.length>yw&&p.splice(0,p.length-yw),p})}catch{}}),()=>{u.close()}},[]);const l=[...e].reverse();return r.jsxs(gi,{className:"min-w-0 rounded-none border-0 border-b border-border bg-transparent",children:[r.jsxs(bi,{className:"border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ka,{className:"size-4 text-muted-foreground"}),r.jsx(xi,{children:"Live MCP Tool Calls"}),r.jsx(ze,{variant:"outline",size:"small",children:e.length})]}),r.jsx(ze,{variant:"outline",size:"small",icon:r.jsx("span",{className:ie("inline-block size-1.5 rounded-full",s?"animate-pulse bg-emerald-500":"bg-muted-foreground/60")}),children:s?"live":"reconnecting…"})]}),r.jsx(Ii,{className:"text-xs",children:"Streamed from this NoMoreIDE MCP server. Newest at the top."})]}),r.jsx(vi,{className:"p-0",children:l.length?r.jsx("ul",{className:"max-h-96 divide-y divide-border overflow-auto",children:l.map(u=>r.jsxs("li",{className:"px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"truncate font-mono text-xs font-semibold",children:u.tool}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2 font-mono text-[10px] text-muted-foreground",children:[r.jsxs("span",{children:[u.durationMs," ms"]}),r.jsx(ze,{variant:u.status==="ok"?"success":"error",appearance:"outline",size:"small",children:u.status})]})]}),u.args?r.jsx("div",{className:"mt-0.5 truncate font-mono text-[11px] text-muted-foreground",children:u.args}):null,u.error?r.jsx("div",{className:"mt-0.5 font-mono text-[11px] text-destructive",children:u.error}):null,r.jsx("div",{className:"mt-0.5 font-mono text-[10px] text-muted-foreground/80",children:new Date(u.startedAt).toLocaleTimeString()})]},u.id))}):r.jsx("p",{className:"px-3 py-4 text-xs text-muted-foreground",children:"No tool calls yet. Invoke a NoMoreIDE MCP tool from your agent and it will appear here."})})]})}function Ez({agent:e}){return r.jsxs(r.Fragment,{children:[r.jsx(Cz,{}),r.jsxs(gi,{className:"min-w-0 rounded-none border-0 bg-transparent",children:[r.jsxs(bi,{className:"border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(mf,{className:"size-4 text-muted-foreground"}),r.jsx(xi,{children:"Recent Projects"})]}),r.jsx(ze,{variant:"outline",size:"small",children:e.projects.length})]}),r.jsx(Ii,{className:"text-xs",children:"Most recently active projects known to the agent."})]}),r.jsx(vi,{className:"p-0",children:e.projects.length?r.jsx("ul",{className:"divide-y divide-border",children:e.projects.map(t=>r.jsxs("li",{className:ie("flex items-start justify-between gap-3 px-3 py-2",t.current&&"bg-primary/5"),children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"truncate font-mono text-xs font-semibold",children:t.path}),t.current?r.jsx(ze,{variant:"outline",size:"small",children:"current"}):null]}),t.lastSessionFirstPrompt?r.jsx("p",{className:"mt-0.5 truncate text-[11px] text-muted-foreground",children:t.lastSessionFirstPrompt}):null]}),r.jsxs("div",{className:"shrink-0 text-right font-mono text-[10px] text-muted-foreground",children:[t.mcpServerCount?r.jsxs("div",{children:[t.mcpServerCount," mcp"]}):null,t.lastSessionModified?r.jsx("div",{children:jz(t.lastSessionModified)}):null]})]},t.path))}):r.jsx("p",{className:"px-3 py-4 text-xs text-muted-foreground",children:"No known projects."})})]})]})}function jz(e){const t=Date.parse(e);return Number.isNaN(t)?e:new Date(t).toLocaleString()}function vl({className:e}){return r.jsx("svg",{className:ie("size-3.5",e),viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:r.jsx("path",{d:"m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z"})})}function vu({className:e}){return r.jsx("svg",{className:ie("size-3.5",e),viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":!0,children:r.jsx("path",{d:"M11.248 18.25q-.825 0-1.568-.314a4.3 4.3 0 0 1-1.32-.874 4 4 0 0 1-1.304.214 4 4 0 0 1-2.046-.544 4.27 4.27 0 0 1-1.518-1.485 4 4 0 0 1-.56-2.095q0-.48.131-1.04A4.4 4.4 0 0 1 2.04 10.71a4.07 4.07 0 0 1 .017-3.4 4.2 4.2 0 0 1 1.056-1.418 3.8 3.8 0 0 1 1.6-.842 3.9 3.9 0 0 1 .76-1.683q.593-.759 1.451-1.188a4.04 4.04 0 0 1 1.832-.429q.825 0 1.567.313.742.314 1.32.875a4 4 0 0 1 1.304-.215q1.106 0 2.046.545a4.14 4.14 0 0 1 1.501 1.485q.578.941.578 2.095 0 .48-.132 1.04.66.61 1.023 1.419.363.792.363 1.666 0 .892-.38 1.717a4.3 4.3 0 0 1-1.072 1.435 3.8 3.8 0 0 1-1.584.825 3.8 3.8 0 0 1-.775 1.683 4.06 4.06 0 0 1-1.436 1.188 4.04 4.04 0 0 1-1.832.429m-4.076-2.062q.825 0 1.435-.347l3.103-1.782a.36.36 0 0 0 .164-.313v-1.42L7.881 14.62a.67.67 0 0 1-.726 0l-3.118-1.798a.5.5 0 0 1-.017.115v.198q0 .841.396 1.551.413.693 1.139 1.089a3.2 3.2 0 0 0 1.617.412m.165-2.69a.4.4 0 0 0 .181.05q.083 0 .165-.05l1.238-.71-3.977-2.31a.7.7 0 0 1-.363-.643v-3.58q-.825.362-1.32 1.122a2.9 2.9 0 0 0-.495 1.65q0 .809.413 1.55.412.743 1.072 1.123zm3.91 3.663q.875 0 1.585-.396a2.96 2.96 0 0 0 1.534-2.64v-3.564a.32.32 0 0 0-.165-.297l-1.254-.726v4.604a.7.7 0 0 1-.363.643l-3.119 1.799a3 3 0 0 0 1.783.577m.627-6.039V8.878L10.01 7.822 8.129 8.878v2.244l1.881 1.056zM7.057 5.859a.7.7 0 0 1 .363-.644l3.119-1.798a3 3 0 0 0-1.782-.578q-.874 0-1.584.396A2.96 2.96 0 0 0 6.05 4.324a3.07 3.07 0 0 0-.396 1.551v3.547q0 .199.165.314l1.237.726zm8.383 7.887q.825-.364 1.303-1.123.495-.758.495-1.65a3.15 3.15 0 0 0-.412-1.55q-.413-.743-1.073-1.123l-3.086-1.782q-.099-.065-.181-.049a.3.3 0 0 0-.165.05l-1.238.692 3.993 2.327a.6.6 0 0 1 .264.264.64.64 0 0 1 .1.363zm-3.317-8.382a.63.63 0 0 1 .726 0l3.135 1.831v-.297q0-.792-.396-1.501a2.86 2.86 0 0 0-1.105-1.155q-.71-.43-1.65-.43-.825 0-1.436.347L8.294 5.941a.36.36 0 0 0-.165.314v1.418z"})})}function Tz({className:e}){return r.jsx("svg",{className:ie("size-3.5",e),viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:r.jsx("path",{d:"M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81"})})}const Az=800;function _u({activeHunkIndex:e=0,diff:t}){const s=Rz(t),n=y.useRef(null),o=y.useRef([]),[l,u]=y.useState(!1),h=y.useMemo(()=>s.reduce((d,p)=>Math.max(d,p.content.length),0),[s]),m=h>Az;if(y.useEffect(()=>{u(!1)},[t]),y.useEffect(()=>{if(m&&!l)return;const d=o.current[e],p=n.current;!d||!p||p.scrollTo({top:Math.max(d.offsetTop-8,0),behavior:"smooth"})},[e,t,m,l]),m&&!l){const d=s.filter(g=>g.kind==="add").length,p=s.filter(g=>g.kind==="delete").length;return r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-card p-6",children:r.jsxs("div",{className:"max-w-sm space-y-3 text-center",children:[r.jsx("p",{className:"text-[13px] font-medium text-foreground",children:"Diff hidden for this data file"}),r.jsxs("p",{className:"text-[12px] text-muted-foreground",children:["Rows run up to ",h.toLocaleString()," characters, so this looks like a CSV, log, or other data dump rather than source code."]}),r.jsxs("p",{className:"font-mono text-[11px]",children:[r.jsxs("span",{className:"text-emerald-700",children:["+",d]})," ",r.jsxs("span",{className:"text-red-700",children:["-",p]})," lines changed"]}),r.jsx(Y,{onClick:()=>u(!0),size:"sm",type:"button",variant:"outline",children:"Show diff anyway"})]})})}return r.jsx("div",{className:"absolute inset-0 overflow-auto bg-card text-xs leading-6 text-foreground",ref:n,children:r.jsx("div",{className:"min-w-full font-mono",children:s.map((d,p)=>r.jsxs("div",{className:ie("grid grid-cols-[3rem_3rem_minmax(0,1fr)]",d.kind==="add"&&"bg-emerald-50 text-emerald-800 dark:bg-emerald-500/15 dark:text-emerald-300",d.kind==="delete"&&"bg-red-50 text-red-800 dark:bg-red-500/15 dark:text-red-300",Sw(s,p)&&d.hunkIndex===e&&"outline outline-1 outline-offset-[-1px] outline-primary/35"),ref:d.hunkIndex!==null&&Sw(s,p)?g=>{o.current[d.hunkIndex??0]=g}:void 0,children:[r.jsx(ww,{value:d.oldLine}),r.jsx(ww,{value:d.newLine}),r.jsx("span",{className:"min-w-0 whitespace-pre-wrap break-all px-2",children:d.content||" "})]},`${p}-${d.content}`))})})}function f3(e){return e.split(`
18
+ `).reduce((t,s)=>(s.startsWith("@@")?t.hunks+=1:s.startsWith("+")&&!s.startsWith("+++")?t.additions+=1:s.startsWith("-")&&!s.startsWith("---")&&(t.deletions+=1),t),{additions:0,deletions:0,hunks:0})}function Rz(e){const t=Mz(e);return t.some(s=>s.kind==="hunk")?t.filter(s=>s.kind!=="meta"&&s.kind!=="hunk"):t}function Mz(e){let t=null,s=null,n=null;return e.split(`
19
+ `).map(o=>{if(Dz(o))return t=null,s=null,n=null,{content:o,hunkIndex:n,kind:"meta",oldLine:null,newLine:null};if(o.startsWith("@@")){const u=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(o);return u&&(t=Number(u[1]),s=Number(u[2])),n=(n??-1)+1,{content:o,hunkIndex:n,kind:"hunk",oldLine:null,newLine:null}}if(t===null||s===null)return{content:o,hunkIndex:null,kind:"meta",oldLine:null,newLine:null};if(o.startsWith("\\ No newline"))return{content:o,hunkIndex:n,kind:"meta",oldLine:null,newLine:null};if(o.startsWith("+")&&!o.startsWith("+++")){const u={content:o,hunkIndex:n,kind:"add",oldLine:null,newLine:s};return s+=1,u}if(o.startsWith("-")&&!o.startsWith("---")){const u={content:o,hunkIndex:n,kind:"delete",oldLine:t,newLine:null};return t+=1,u}const l={content:o,hunkIndex:n,kind:"context",oldLine:t,newLine:s};return t+=1,s+=1,l})}function Sw(e,t){const s=e[t]?.hunkIndex;if(s===null)return!1;const n=e.findIndex(o=>o.hunkIndex===s&&(o.kind==="add"||o.kind==="delete"));return n!==-1?n===t:e.findIndex(o=>o.hunkIndex===s)===t}function Dz(e){return e.startsWith("diff --git ")||e.startsWith("index ")||e.startsWith("--- ")||e.startsWith("+++ ")||e.startsWith("new file mode ")||e.startsWith("deleted file mode ")||e.startsWith("old mode ")||e.startsWith("new mode ")||e.startsWith("similarity index ")||e.startsWith("rename from ")||e.startsWith("rename to ")||e.startsWith("Binary files ")}function ww({value:e}){return r.jsx("span",{className:ie("select-none border-r border-border/70 px-2 text-right text-muted-foreground",e===null&&"text-transparent"),children:e??"-"})}function Oz(){const[e,t]=y.useState([]),[s,n]=y.useState(""),[o,l]=y.useState(null),[u,h]=y.useState(!1),[m,d]=y.useState(null),p=y.useCallback(async()=>{try{const k=await _8();t(k),n(C=>C&&k.some(T=>T.sha===C)?C:k[0]?.sha??""),l(null)}catch(k){l(k instanceof Error?k.message:String(k))}},[]);y.useEffect(()=>{p()},[p]);async function g(){h(!0),d(null);try{const k=await y8("manual snapshot");await p(),n(k.sha),d(`Snapshot ${k.sha.slice(0,7)} created.`)}catch(k){l(k instanceof Error?k.message:String(k))}finally{h(!1)}}async function x(k,C){h(!0),d(null);try{const T=await S8(k,C);await p(),n(T.sha),d(`Snapshot renamed to “${T.label}”.`)}catch(T){l(T instanceof Error?T.message:String(T))}finally{h(!1)}}async function _(k){h(!0),d(null);try{await w8(k),await p(),d(`Snapshot ${k.slice(0,7)} deleted.`)}catch(C){l(C instanceof Error?C.message:String(C))}finally{h(!1)}}async function S(k){h(!0),d(null);try{const C=await C8(k);await p(),d(`Restored ${C.restoredFiles} file(s)`+(C.deletedPaths.length?`, removed ${C.deletedPaths.length} added since`:"")+`. Undo via pre-restore snapshot ${C.preRestore.sha.slice(0,7)}.`)}catch(C){l(C instanceof Error?C.message:String(C))}finally{h(!1)}}const w=e.find(k=>k.sha===s);return r.jsxs("div",{className:"grid h-full min-h-0 overflow-hidden bg-card/85 xl:grid-cols-[320px_minmax(0,1fr)]",children:[r.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden border-r border-border",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-2",children:[r.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-semibold",children:[r.jsx(OR,{className:"size-3.5"}),"Snapshots"]}),r.jsxs(Y,{disabled:u,onClick:()=>{g()},size:"sm",type:"button",children:[r.jsx(w4,{className:"size-3.5"}),"Snapshot now"]})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:o?r.jsxs($e,{variant:"destructive",className:"m-3",children:[r.jsx(Ub,{}),r.jsxs("div",{className:"min-w-0",children:[r.jsx(d3,{children:"Couldn’t load snapshots"}),r.jsx(h3,{className:"break-words",children:o})]})]}):e.length===0?r.jsx($e,{variant:"muted",className:"m-3 border-dashed",children:"No snapshots yet. Take one before risky changes, or let agent sessions create them automatically."}):r.jsx("ul",{children:e.map(k=>r.jsx(Lz,{busy:u,onDelete:_,onRename:x,onSelect:n,selected:k.sha===s,snapshot:k},k.ref))})})]}),r.jsxs("section",{className:"flex min-h-0 min-w-0 flex-col",children:[m?r.jsx($e,{variant:"muted",className:"m-3 mb-0",children:m}):null,w?r.jsx(zz,{busy:u,onRestore:S,snapshot:w}):r.jsx("div",{className:"p-4",children:r.jsx($e,{variant:"muted",className:"border-dashed p-12 text-center",children:"Select a snapshot to compare it with the current working tree."})})]})]})}function Lz({busy:e,onDelete:t,onRename:s,onSelect:n,selected:o,snapshot:l}){const[u,h]=y.useState(!1),[m,d]=y.useState(l.label),[p,g]=y.useState(!1);function x(){d(l.label),h(!0)}function _(){const S=m.trim();h(!1),S&&S!==l.label&&s(l.sha,S)}return r.jsx("li",{className:ie("group relative border-b border-border/60 transition-colors",o?"bg-background":"hover:bg-muted/50"),children:u?r.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-2",children:[r.jsx("input",{ref:S=>S?.focus(),value:m,onChange:S=>d(S.target.value),onKeyDown:S=>{S.key==="Enter"&&_(),S.key==="Escape"&&h(!1)},className:"min-w-0 flex-1 rounded border border-border bg-background px-1.5 py-1 text-xs","aria-label":"Snapshot label"}),r.jsx(Y,{disabled:e,onClick:_,size:"icon-sm",type:"button",variant:"ghost",children:r.jsx(tn,{className:"size-3.5"})}),r.jsx(Y,{onClick:()=>h(!1),size:"icon-sm",type:"button",variant:"ghost",children:r.jsx(Ft,{className:"size-3.5"})})]}):r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",onClick:()=>n(l.sha),className:"w-full px-3 py-2 pr-16 text-left",children:[r.jsx("span",{className:"block truncate text-xs font-medium",children:l.label}),r.jsxs("span",{className:"mt-0.5 flex items-center gap-2 text-[10px] text-muted-foreground",children:[r.jsx("span",{className:"font-mono",children:l.sha.slice(0,7)}),r.jsx("span",{children:new Date(l.createdAt).toLocaleString()})]})]}),r.jsx("div",{className:"absolute right-2 top-1.5 flex items-center gap-0.5",children:p?r.jsxs(r.Fragment,{children:[r.jsx(Y,{disabled:e,onClick:()=>{g(!1),t(l.sha)},size:"icon-sm",title:"Confirm delete",type:"button",variant:"ghost",className:"text-red-600 hover:text-red-600",children:r.jsx(tn,{className:"size-3.5"})}),r.jsx(Y,{onClick:()=>g(!1),size:"icon-sm",title:"Cancel",type:"button",variant:"ghost",children:r.jsx(Ft,{className:"size-3.5"})})]}):r.jsxs("span",{className:"hidden items-center gap-0.5 group-hover:flex",children:[r.jsx(Y,{disabled:e,onClick:x,size:"icon-sm",title:"Rename snapshot",type:"button",variant:"ghost",children:r.jsx(ll,{className:"size-3.5"})}),r.jsx(Y,{disabled:e,onClick:()=>g(!0),size:"icon-sm",title:"Delete snapshot",type:"button",variant:"ghost",className:"text-muted-foreground hover:text-red-600",children:r.jsx(yr,{className:"size-3.5"})})]})})]})})}function zz({busy:e,onRestore:t,snapshot:s}){const[n,o]=y.useState([]),[l,u]=y.useState(""),[h,m]=y.useState(""),[d,p]=y.useState(null),[g,x]=y.useState(!1);return y.useEffect(()=>{let _=!0;return x(!1),p(null),k8(s.sha).then(S=>{_&&(o(S),u(w=>w&&S.some(k=>k.path===w)?w:S[0]?.path??""))}).catch(S=>{_&&p(S instanceof Error?S.message:String(S))}),()=>{_=!1}},[s.sha]),y.useEffect(()=>{if(!l){m("");return}let _=!0;return N8(s.sha,l).then(S=>{_&&m(S)}).catch(S=>{_&&p(S instanceof Error?S.message:String(S))}),()=>{_=!1}},[s.sha,l]),r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:s.label}),r.jsx("p",{className:"text-[10px] text-muted-foreground",children:n.length?`${n.length} file(s) differ from the current working tree.`:"Identical to the current working tree."})]}),g?r.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[r.jsx(Y,{disabled:e,onClick:()=>{x(!1),t(s.sha)},size:"sm",type:"button",variant:"destructive",children:"Confirm restore"}),r.jsx(Y,{onClick:()=>x(!1),size:"sm",type:"button",variant:"outline",children:"Cancel"})]}):r.jsxs(Y,{disabled:e||n.length===0,onClick:()=>x(!0),size:"sm",title:"Reset the working tree to this snapshot (a pre-restore snapshot is taken first)",type:"button",variant:"outline",children:[r.jsx(fu,{className:"size-3.5"}),"Restore…"]})]}),r.jsx(m3,{diff:h,error:d,files:n,onSelectPath:u,selectedPath:l})]})}function m3({diff:e,error:t,files:s,onSelectPath:n,selectedPath:o}){return t?r.jsx("div",{className:"p-4",children:r.jsxs($e,{variant:"destructive",children:[r.jsx(Ub,{}),r.jsxs("div",{className:"min-w-0",children:[r.jsx(d3,{children:"Couldn’t load this snapshot"}),r.jsx(h3,{className:"break-words",children:t})]})]})}):r.jsxs("div",{className:"grid min-h-0 flex-1 xl:grid-cols-[260px_minmax(0,1fr)]",children:[r.jsx("ul",{className:"min-h-0 overflow-auto border-r border-border",children:s.map(l=>r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>n(l.path),className:ie("flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors",l.path===o?"bg-background":"hover:bg-muted/50"),children:[r.jsx("span",{className:ie("w-3 shrink-0 font-mono text-[10px]",l.status==="A"&&"text-emerald-600",l.status==="D"&&"text-red-600",l.status==="M"&&"text-amber-600"),children:l.status}),r.jsx("span",{className:"truncate",children:l.path})]})},l.path))}),r.jsx("div",{className:"relative min-h-0 min-w-0",children:o?r.jsx(_u,{diff:e||"No diff for this file."}):r.jsx("div",{className:"p-4",children:r.jsx($e,{variant:"muted",className:"border-dashed p-8 text-center",children:"Select a file to see how it differs from the snapshot."})})})]})}function Bz(){const[e,t]=y.useState([]),[s,n]=y.useState(""),[o,l]=y.useState(null),[u,h]=y.useState(null),[m,d]=y.useState(!1),p=y.useCallback(async()=>{try{const x=await E8();t(x),n(_=>_&&x.some(S=>S.id===_)?_:x[0]?.id??""),l(null)}catch(x){l(x instanceof Error?x.message:String(x))}},[]);y.useEffect(()=>{p()},[p]);async function g(x){d(!0),h(null);try{const _=await A8(x);await p(),h(`Restored ${_.restoredFiles} file(s)`+(_.deletedPaths.length?`, removed ${_.deletedPaths.length} created by the session`:"")+`. Undo via pre-restore snapshot ${_.preRestore.sha.slice(0,7)} in Git → Snapshots.`)}catch(_){l(_ instanceof Error?_.message:String(_))}finally{d(!1)}}return e.length===0?r.jsx("div",{className:"p-4",children:r.jsx($e,{variant:"muted",className:"border-dashed p-8 text-center",children:o??"No agent sessions recorded yet. Sessions appear here once an agent calls a nomoreide MCP tool; each one starts with a working-tree snapshot you can roll back to."})}):r.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[u?r.jsx($e,{variant:"muted",className:"m-3 mb-0",children:u}):null,r.jsxs("div",{className:"grid min-h-0 flex-1 xl:grid-cols-[280px_minmax(0,1fr)]",children:[r.jsx("aside",{className:"min-h-0 overflow-auto border-r border-border",children:r.jsx("ul",{children:e.map(x=>r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>n(x.id),className:ie("w-full border-b border-border/60 px-3 py-2 text-left transition-colors",x.id===s?"bg-background":"hover:bg-muted/50"),children:[r.jsx("span",{className:"block truncate text-xs font-medium",children:new Date(x.startedAt).toLocaleString()}),r.jsxs("span",{className:"mt-0.5 flex items-center gap-2 text-[10px] text-muted-foreground",children:[r.jsxs("span",{children:[x.toolCount," tool call(s)"]}),x.snapshotSha?r.jsx("span",{className:"font-mono",children:x.snapshotSha.slice(0,7)}):r.jsx("span",{children:"no snapshot"})]})]})},x.id))})}),r.jsx("section",{className:"flex min-h-0 min-w-0 flex-col",children:s?r.jsx(Iz,{busy:m,id:s,onRestore:g}):null})]})]})}function Iz({busy:e,id:t,onRestore:s}){const[n,o]=y.useState(null),[l,u]=y.useState([]),[h,m]=y.useState(""),[d,p]=y.useState(""),[g,x]=y.useState(null),[_,S]=y.useState(!1);return y.useEffect(()=>{let w=!0;return S(!1),x(null),j8(t).then(k=>{w&&(o(k.session),u(k.files),m(C=>C&&k.files.some(T=>T.path===C)?C:k.files[0]?.path??""))}).catch(k=>{w&&x(k instanceof Error?k.message:String(k))}),()=>{w=!1}},[t]),y.useEffect(()=>{if(!h){p("");return}let w=!0;return T8(t,h).then(k=>{w&&p(k)}).catch(k=>{w&&x(k instanceof Error?k.message:String(k))}),()=>{w=!1}},[t,h]),r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:l.length?`${l.length} file(s) changed since this session started`:"No working-tree changes since this session started"}),r.jsx("p",{className:"truncate text-[10px] text-muted-foreground",children:n?.repoPath??""})]}),n?.snapshotSha?_?r.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[r.jsx(Y,{disabled:e,onClick:()=>{S(!1),s(t)},size:"sm",type:"button",variant:"destructive",children:"Confirm restore"}),r.jsx(Y,{onClick:()=>S(!1),size:"sm",type:"button",variant:"outline",children:"Cancel"})]}):r.jsxs(Y,{disabled:e||l.length===0,onClick:()=>S(!0),size:"sm",title:"Reset the working tree to before this session (a pre-restore snapshot is taken first)",type:"button",variant:"outline",children:[r.jsx(fu,{className:"size-3.5"}),"Restore to before this session…"]}):null]}),r.jsx(m3,{diff:d,error:g,files:l,onSelectPath:m,selectedPath:h})]})}let kw=0;const Nw=()=>(kw+=1,`t${Date.now()}-${kw}`);function Pz(){const[e,t]=y.useState([]),[s,n]=y.useState(!1),[o,l]=y.useState(null),[u,h]=y.useState(null),[m,d]=y.useState(null),[p,g]=y.useState([]),x=y.useRef(null),_=y.useRef(void 0),S=y.useRef(void 0);y.useEffect(()=>{v6().then(E=>{h(E.configured),d(E.provider)}).catch(()=>h(!1))},[]);const w=y.useCallback(async(E,j)=>{g(z=>z.filter(O=>O.requestId!==E));const M=S.current??_.current;if(M)try{await _6(M,E,j)}catch{}},[]),k=y.useCallback(()=>{x.current?.abort(),x.current=null,n(!1)},[]),C=y.useCallback(async(E,j)=>{const M=E.trim();if(!M||s)return;l(null);const z={id:Nw(),createdAt:Date.now(),role:"user",text:M,label:j?.label,tools:[]},O=Nw(),A={id:O,createdAt:Date.now(),role:"assistant",text:"",tools:[]};t(P=>[...P,z,A]);const D=P=>t(H=>H.map($=>$.id===O?P($):$)),B=new AbortController;x.current=B,n(!0);try{await y6(M,j?.isolated?void 0:_.current,P=>{switch(P.type){case"session":S.current=P.sessionId,j?.isolated||(_.current=P.sessionId);break;case"text":D(H=>({...H,text:H.text+P.text}));break;case"tool_use":D(H=>({...H,tools:[...H.tools,{id:P.id,name:P.name,input:P.input,status:"running"}]}));break;case"tool_result":D(H=>({...H,tools:H.tools.map($=>$.id===P.id?{...$,preview:P.preview,isError:P.isError,status:"done"}:$)}));break;case"approval_request":g(H=>[...H,{requestId:P.requestId,name:P.name,input:P.input}]);break;case"error":l(P.message);break;case"done":break}},B.signal,j?.autoApprove)}catch(P){B.signal.aborted||l(P instanceof Error?P.message:String(P))}finally{x.current=null,n(!1)}},[s]),T=y.useCallback(()=>{k(),_.current=void 0,S.current=void 0,t([]),g([]),l(null)},[k]);return{turns:e,streaming:s,error:o,configured:u,provider:m,approvals:p,send:C,stop:k,clear:T,respond:w}}const p3=y.createContext(null);function $z({children:e}){const t=Pz(),{streaming:s}=t,[n,o]=y.useState(!1),[l,u]=y.useState(""),[h,m]=y.useState(null),[d,p]=y.useState(0),[g,x]=y.useState(0),[_,S]=y.useState(!1),w=y.useRef([]),k=y.useCallback(()=>p(D=>D+1),[]),C=y.useCallback(()=>x(D=>D+1),[]),T=y.useCallback((D,B)=>(C(),t.send(D,B)),[t,C]),E=y.useCallback(()=>m(null),[]),j=y.useCallback(()=>{o(!0),S(!0)},[]),M=y.useCallback(D=>{o(!0),u(B=>B.trim()?`${B.replace(/\s*$/,"")}
20
+ ${D}`:D),k()},[k]);y.useEffect(()=>{if(s)return;const D=w.current.shift();D&&T(D.prompt,{label:D.label,autoApprove:D.autoApprove,isolated:D.isolated})},[s,T]);const z=y.useCallback(({prompt:D,source:B,mode:P="send",label:H,autoApprove:$,background:q,isolated:V})=>(q||o(!0),m(B??null),C(),P==="draft"?(u(D),k(),{queued:!1}):s?(w.current.push({prompt:D,label:H,autoApprove:$,isolated:V}),{queued:!0}):(T(D,{label:H,autoApprove:$,isolated:V}),{queued:!1})),[s,T,k,C]),O=y.useCallback(()=>{w.current=[],m(null),t.clear()},[t]),A={...t,send:T,clear:O,open:n,setOpen:o,draft:l,setDraft:u,insertPath:M,activeSource:h,clearSource:E,focusNonce:d,stickNonce:g,sendToAgent:z,onboarding:_,setOnboarding:S,startOnboard:j};return r.jsx(p3.Provider,{value:A,children:e})}function At(){const e=y.useContext(p3);if(!e)throw new Error("useAgentDock must be used within an AgentProvider");return e}function Hz(e){const t=Math.max(0,Math.floor(e/6e4));if(t<60)return`${t}m`;const s=Math.floor(t/60),n=t%60;return`${s}h ${String(n).padStart(2,"0")}m`}function Uz(e,t=Date.now()){const s=e[0],n=s?t-s.createdAt:0,o=e.length,l=n>=60*6e4||o>=30,u=n>=30*6e4||o>=16,h=l?"heavy":u?"long":"fresh";return{durationLabel:s?Hz(n):"0m",recommendation:h==="fresh"?null:"Consider starting a new chat for a cleaner context.",status:h,statusLabel:h==="heavy"?"Heavy context":h==="long"?"Long":"Fresh",turnCount:o}}function Fz({now:e,onNewChat:t,turns:s}){const[n,o]=y.useState(()=>Date.now());y.useEffect(()=>{const h=window.setInterval(()=>o(Date.now()),3e4);return()=>window.clearInterval(h)},[]);const l=Uz(s,e??n),u=s.length>0;return r.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-border bg-background/55 px-3 py-2 text-xs",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx(eM,{className:ie("size-4 shrink-0",l.status==="heavy"?"text-amber-500":l.status==="long"?"text-yellow-500":"text-muted-foreground")}),r.jsx("span",{className:"font-medium",children:"Conversation"}),r.jsx("span",{className:"font-mono text-muted-foreground",children:u?l.durationLabel:"not started"}),u?r.jsxs("span",{className:"font-mono text-muted-foreground",children:[l.turnCount," turns"]}):null]}),r.jsx(ze,{appearance:l.status==="fresh"?"subtle":"solid",size:"small",variant:l.status==="heavy"?"warning":l.status==="long"?"secondary":"outline",children:l.statusLabel}),l.recommendation?r.jsx("span",{className:"min-w-0 flex-1 text-muted-foreground",children:l.recommendation}):r.jsx("span",{className:"min-w-0 flex-1 text-muted-foreground",children:"Short chats usually give the agent cleaner context."}),r.jsxs(Y,{className:"h-7 gap-1.5 px-2 text-xs",disabled:!u,onClick:t,size:"sm",type:"button",variant:"outline",children:[r.jsx(fu,{className:"size-3.5"}),"New chat"]})]})}function qz({agent:e,agentId:t}){const s=e.project.instructionFileName??(e.project.claudeMdPath?"CLAUDE.md":void 0),n=e.project.instructionFilePreview??e.project.claudeMdPreview,o=e.project.memoryFiles.length+(s?1:0);return r.jsxs(gi,{className:"min-w-0 rounded-none border-0 bg-transparent",children:[r.jsxs(bi,{className:"border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(EN,{className:"size-4 text-muted-foreground"}),r.jsx(xi,{children:"Project Memory"})]}),r.jsx(ze,{variant:"outline",size:"small",children:o})]}),r.jsx(Ii,{className:"truncate text-xs",children:e.project.memoryDir??(t==="codex"?"No Codex memory directory found for this project.":"No memory directory found for this project.")})]}),r.jsxs(vi,{className:"space-y-2 p-3",children:[s?r.jsx(Cw,{title:s,preview:n,defaultOpen:!0}):null,e.project.memoryFiles.length?e.project.memoryFiles.map(l=>r.jsx(Cw,{title:l.name,subtitle:`${l.size} B`,preview:l.preview,defaultOpen:l.name==="MEMORY.md"},l.path)):s?null:r.jsx("p",{className:"text-xs text-muted-foreground",children:"No memory files persisted yet for this project."})]})]})}function Cw({title:e,subtitle:t,preview:s,defaultOpen:n=!1}){const[o,l]=y.useState(n);return r.jsxs("div",{className:"rounded-md border border-border bg-background/40",children:[r.jsxs("button",{type:"button",onClick:()=>l(!o),className:"flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-xs font-semibold",children:[r.jsx(Jn,{className:ie("size-3.5 text-muted-foreground transition-transform",o&&"rotate-90")}),r.jsx("span",{children:e}),t?r.jsx("span",{className:"font-mono text-[10px] font-normal text-muted-foreground",children:t}):null]}),o&&s?r.jsx("pre",{className:"max-h-64 overflow-auto whitespace-pre-wrap border-t border-border px-2.5 py-2 font-mono text-[11px] leading-relaxed text-muted-foreground",children:s}):null]})}const Vz=[{animationDelay:"-1.2s",transform:"rotate(.0001deg) translate(146%)"},{animationDelay:"-1.1s",transform:"rotate(30deg) translate(146%)"},{animationDelay:"-1.0s",transform:"rotate(60deg) translate(146%)"},{animationDelay:"-0.9s",transform:"rotate(90deg) translate(146%)"},{animationDelay:"-0.8s",transform:"rotate(120deg) translate(146%)"},{animationDelay:"-0.7s",transform:"rotate(150deg) translate(146%)"},{animationDelay:"-0.6s",transform:"rotate(180deg) translate(146%)"},{animationDelay:"-0.5s",transform:"rotate(210deg) translate(146%)"},{animationDelay:"-0.4s",transform:"rotate(240deg) translate(146%)"},{animationDelay:"-0.3s",transform:"rotate(270deg) translate(146%)"},{animationDelay:"-0.2s",transform:"rotate(300deg) translate(146%)"},{animationDelay:"-0.1s",transform:"rotate(330deg) translate(146%)"}],Gz=({size:e=20,color:t="#8f8f8f"})=>r.jsx("div",{style:{width:e,height:e},children:r.jsx("div",{className:"relative left-1/2 top-1/2",style:{width:e,height:e},children:Vz.map(s=>r.jsx("div",{className:"absolute -left-[10%] -top-[3.9%] h-[8%] w-[24%] animate-fade-spin rounded-[5px]",style:{backgroundColor:t,...s}},s.transform))})}),Wz=[{tiny:"px-1.5 h-6 text-sm",small:"px-1.5 h-8 text-sm",medium:"px-2.5 h-10 text-sm",large:"px-3.5 h-12 text-base"},{tiny:"w-6 h-6 text-sm",small:"w-8 h-8 text-sm",medium:"w-10 h-10 text-sm",large:"w-12 h-12 text-base"}],Kz={primary:"bg-gray-1000 hover:bg-gray-1000-h text-background-100 fill-background-100",secondary:"bg-background-100 hover:bg-gray-alpha-200 text-gray-1000 fill-gray-1000 border border-gray-alpha-400",tertiary:"bg-none hover:bg-gray-alpha-200 text-gray-1000 fill-gray-1000",error:"bg-red-800 hover:bg-red-900 text-white fill-white",warning:"bg-amber-800 hover:bg-amber-850 text-black fill-black"},Yz={square:{tiny:"rounded",small:"rounded-md",medium:"rounded-md",large:"rounded-lg"},circle:{tiny:"rounded-[100%]",small:"rounded-[100%]",medium:"rounded-[100%]",large:"rounded-[100%]"},rounded:{tiny:"rounded-[100px]",small:"rounded-[100px]",medium:"rounded-[100px]",large:"rounded-[100px]"}},Yd=({size:e="medium",type:t="primary",variant:s="styled",shape:n="square",svgOnly:o=!1,children:l,prefix:u,suffix:h,shadow:m=!1,loading:d=!1,disabled:p=!1,fullWidth:g=!1,className:x,..._})=>r.jsxs("button",{disabled:p,tabIndex:0,className:Jc("flex items-center justify-center gap-0.5 duration-150",Wz[+o][e],p||d?"cursor-not-allowed border border-gray-400 bg-gray-100 text-gray-700":Kz[t],Yz[n][e],m&&"shadow-border-small border-none",g&&"w-full",s==="unstyled"?"h-fit bg-transparent px-0 text-gray-1000 outline-none hover:bg-transparent":"focus:shadow-focus-ring focus:outline-0",x),type:"button",..._,children:[d?r.jsx(Gz,{size:e==="large"?24:16}):u,r.jsx("span",{className:Jc("relative overflow-hidden overflow-ellipsis whitespace-nowrap font-sans",e!=="tiny"&&s!=="unstyled"&&"px-1.5"),children:l}),!d&&h]}),Xz=({className:e})=>r.jsx("svg",{height:"16",strokeLinejoin:"round",viewBox:"0 0 16 16",width:"16",className:e,children:r.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.4697 13.5303L13 14.0607L14.0607 13L13.5303 12.4697L9.06065 7.99999L13.5303 3.53032L14.0607 2.99999L13 1.93933L12.4697 2.46966L7.99999 6.93933L3.53032 2.46966L2.99999 1.93933L1.93933 2.99999L2.46966 3.53032L6.93933 7.99999L2.46966 12.4697L1.93933 13L2.99999 14.0607L3.53032 13.5303L7.99999 9.06065L12.4697 13.5303Z"})}),Zz=()=>r.jsx("svg",{height:"16",strokeLinejoin:"round",viewBox:"0 0 16 16",width:"16",className:"fill-gray-1000",children:r.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.5 8C13.5 4.96643 11.0257 2.5 7.96452 2.5C5.42843 2.5 3.29365 4.19393 2.63724 6.5H5.25H6V8H5.25H0.75C0.335787 8 0 7.66421 0 7.25V2.75V2H1.5V2.75V5.23347C2.57851 2.74164 5.06835 1 7.96452 1C11.8461 1 15 4.13001 15 8C15 11.87 11.8461 15 7.96452 15C5.62368 15 3.54872 13.8617 2.27046 12.1122L1.828 11.5066L3.03915 10.6217L3.48161 11.2273C4.48831 12.6051 6.12055 13.5 7.96452 13.5C11.0257 13.5 13.5 11.0336 13.5 8Z"})});let ag=null,Qz=0;const cs={toasts:[],listeners:new Set,add(e,t,s,n,o,l){const u=Qz++,h={id:u,text:e,preserve:s,action:n,onAction:o,onUndoAction:l,type:t};if(!h.preserve){h.remaining=3e3,h.start=Date.now();const m=()=>{this.toasts=this.toasts.filter(d=>d.id!==u),this.notify()};h.timeout=setTimeout(m,h.remaining),h.pause=()=>{h.timeout&&(clearTimeout(h.timeout),h.timeout=void 0,h.remaining-=Date.now()-h.start)},h.resume=()=>{h.timeout||(h.start=Date.now(),h.timeout=setTimeout(m,h.remaining))}}this.toasts.push(h),this.notify()},remove(e){cs.toasts=cs.toasts.filter(t=>t.id!==e),cs.notify()},subscribe(e){return cs.listeners.add(e),()=>{cs.listeners.delete(e)}},notify(){cs.listeners.forEach(e=>{e()})}},Jz=()=>{const[e,t]=y.useState([]),[s,n]=y.useState([]),[o,l]=y.useState(!1),u=S=>w=>{w&&S.measuredHeight==null&&(S.measuredHeight=w.getBoundingClientRect().height,cs.notify())};y.useEffect(()=>(t([...cs.toasts]),cs.subscribe(()=>{t([...cs.toasts])})),[]),y.useEffect(()=>{const S=e.filter(w=>!s.includes(w.id)).map(w=>w.id);S.length>0&&requestAnimationFrame(()=>{n(w=>[...w,...S])})},[s,e]);const m=Math.max(0,e.length-3),d=(S,w)=>{if(S===w-1)return"none";const k=w-1-S;let C=e[w-1]?.measuredHeight||63;for(let j=w-1;j>S;j--)o?C+=(e[j-1]?.measuredHeight||63)+10:C+=20;const T=-k,E=o?1:1-.05*k;return`translate3d(0, calc(100% - ${C}px), ${T}px) scale(${E})`},p=()=>{l(!0),cs.toasts.forEach(S=>{S.pause?.()})},g=()=>{l(!1),cs.toasts.forEach(S=>{S.resume?.()})},_=e.slice(m).reduce((S,w)=>S+(w.measuredHeight??63),0);return r.jsx("div",{className:"pointer-events-none fixed bottom-4 right-4 z-[9999] w-[min(420px,calc(100vw-2rem))]",style:{height:_},children:r.jsx("div",{className:"pointer-events-auto relative w-full",style:{height:_},onMouseEnter:p,onMouseLeave:g,children:e.map((S,w)=>{const k=w>=m;return r.jsx("div",{ref:u(S),className:Jc("absolute bottom-0 right-0 h-fit rounded-xl p-4 leading-[21px] shadow-menu",{message:"bg-geist-background text-gray-1000",success:"bg-blue-700 text-contrast-fg",warning:"bg-amber-800 text-gray-1000 dark:text-gray-100",error:"bg-red-800 text-contrast-fg"}[S.type],k?"opacity-100":"opacity-0",w<m&&"pointer-events-none"),style:{width:"100%",transition:"all .35s cubic-bezier(.25,.75,.6,.98)",transform:s.includes(S.id)?d(w,e.length):"translate3d(0, 100%, 150px) scale(1)"},children:r.jsxs("div",{className:"flex flex-col items-center justify-between text-[.875rem]",children:[r.jsxs("div",{className:"flex h-full w-full items-center justify-between gap-4",children:[r.jsx("span",{children:S.text}),!S.action&&r.jsxs("div",{className:"flex gap-1",children:[S.onUndoAction&&r.jsx(Yd,{type:"tertiary",svgOnly:!0,size:"small",onClick:()=>{S.onUndoAction?.(),cs.remove(S.id)},children:r.jsx(Zz,{})}),r.jsx(Yd,{type:"tertiary",svgOnly:!0,size:"small",onClick:()=>cs.remove(S.id),children:r.jsx(Xz,{className:{message:"fill-gray-1000",success:"fill-contrast-fg",warning:"fill-gray-1000 dark:fill-gray-100",error:"fill-contrast-fg"}[S.type]})})]})]}),S.action&&r.jsxs("div",{className:"flex w-full items-center justify-end gap-2",children:[r.jsx(Yd,{type:"tertiary",size:"small",onClick:()=>cs.remove(S.id),children:"Dismiss"}),r.jsx(Yd,{type:"primary",size:"small",onClick:()=>{S.onAction?.(),cs.remove(S.id)},children:S.action})]})]})},S.id)})})})},Xd=()=>{if(ag)return;const e=document.createElement("div");e.className="fixed bottom-4 right-4 z-[9999]",document.body.appendChild(e),ag=kN.createRoot(e),ag.render(r.jsx(Jz,{}))},Es=()=>({message:y.useCallback(({text:e,preserve:t,action:s,onAction:n,onUndoAction:o})=>{Xd(),cs.add(e,"message",t,s,n,o)},[]),success:y.useCallback(e=>{Xd(),cs.add(e,"success")},[]),warning:y.useCallback(e=>{Xd(),cs.add(e,"warning")},[]),error:y.useCallback(e=>{Xd(),cs.add(e,"error")},[])});function eB({usage:e}){const t=e.inputTokens+e.cacheCreationInputTokens+e.cacheReadInputTokens,s=t>0?e.cacheReadInputTokens/t*100:0;return r.jsxs("div",{className:"rounded-md border border-border",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-border px-3 py-1.5",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(vl,{className:"size-3.5 text-amber-700"}),r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Claude Code · last session"}),e.sessionId?r.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:e.sessionId.slice(0,8)}):null]}),r.jsxs("span",{className:"font-mono text-sm font-semibold text-emerald-700",children:["$",e.costUSD.toFixed(4)]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-x-3 gap-y-1.5 px-3 py-2 text-[11px] sm:grid-cols-4",children:[r.jsx(Vs,{label:"Input",value:Gn(e.inputTokens)}),r.jsx(Vs,{label:"Output",value:Gn(e.outputTokens)}),r.jsx(Vs,{label:"Cache read",value:Gn(e.cacheReadInputTokens)}),r.jsx(Vs,{label:"Cache create",value:Gn(e.cacheCreationInputTokens)}),r.jsx(Vs,{label:"Lines +",value:String(e.linesAdded)}),r.jsx(Vs,{label:"Lines −",value:String(e.linesRemoved)}),r.jsx(Vs,{label:"Wall",value:jw(e.durationMs)}),r.jsx(Vs,{label:"API",value:jw(e.apiDurationMs)})]}),r.jsxs("div",{className:"border-t border-border px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between text-[11px] text-muted-foreground",children:[r.jsx("span",{children:"Cache read share of input"}),r.jsxs("span",{className:"font-mono",children:[s.toFixed(1),"%"]})]}),r.jsx("div",{className:"mt-1 h-1.5 overflow-hidden rounded-full bg-muted",children:r.jsx("div",{className:"h-full bg-emerald-500",style:{width:`${Math.min(100,s).toFixed(2)}%`}})})]}),e.fiveHour||e.weekly?r.jsxs("div",{className:"space-y-2 border-t border-border px-3 py-2",children:[r.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Rate limits"}),e.fiveHour?r.jsx(qh,{label:"5h block",window:e.fiveHour}):null,e.weekly?r.jsx(qh,{label:"This week",window:e.weekly}):null]}):null,e.models.length?r.jsxs("div",{className:"space-y-1 border-t border-border px-3 py-2",children:[r.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:"By model"}),e.models.map(n=>r.jsxs("div",{className:"flex items-center justify-between gap-2 font-mono text-[11px]",children:[r.jsx("span",{className:"truncate",children:n.model}),r.jsxs("span",{className:"shrink-0 text-muted-foreground",children:[Gn(n.inputTokens+n.outputTokens)," tok ·"," ",r.jsxs("span",{className:"text-emerald-700",children:["$",n.costUSD.toFixed(4)]})]})]},n.model))]}):null]})}function tB({usage:e}){const t=e.inputTokens>0?e.cachedInputTokens/e.inputTokens*100:0,s=e.contextWindow&&e.contextWindow>0?e.lastTotalTokens/e.contextWindow*100:0;return r.jsxs("div",{className:"rounded-md border border-border",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-1.5",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(vu,{className:"size-3.5 text-foreground"}),r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Codex · last session"})]}),e.timestamp?r.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:new Date(e.timestamp).toLocaleString()}):null]}),r.jsxs("div",{className:"grid grid-cols-2 gap-x-3 gap-y-1.5 px-3 py-2 text-[11px] sm:grid-cols-4",children:[r.jsx(Vs,{label:"Input",value:Gn(e.inputTokens)}),r.jsx(Vs,{label:"Output",value:Gn(e.outputTokens)}),r.jsx(Vs,{label:"Cache read",value:Gn(e.cachedInputTokens)}),r.jsx(Vs,{label:"Reasoning",value:Gn(e.reasoningOutputTokens)}),r.jsx(Vs,{label:"Total",value:Gn(e.totalTokens)}),r.jsx(Vs,{label:"Last turn",value:Gn(e.lastTotalTokens)}),r.jsx(Vs,{label:"Context",value:e.contextWindow?Gn(e.contextWindow):"n/a"}),r.jsx(Vs,{label:"Cost",value:"n/a"})]}),r.jsxs("div",{className:"space-y-2 border-t border-border px-3 py-2",children:[r.jsx(Ew,{label:"Cache read share of input",value:t,tone:"bg-emerald-500"}),e.contextWindow?r.jsx(Ew,{label:"Last turn context share",value:s,tone:"bg-sky-500"}):null]}),e.primary||e.secondary?r.jsxs("div",{className:"space-y-2 border-t border-border px-3 py-2",children:[r.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Rate limits"}),e.primary?r.jsx(qh,{label:"5h window",window:e.primary}):null,e.secondary?r.jsx(qh,{label:"Weekly window",window:e.secondary}):null]}):null]})}function Ew({label:e,value:t,tone:s}){const n=Math.min(100,Math.max(0,t));return r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between text-[11px] text-muted-foreground",children:[r.jsx("span",{children:e}),r.jsxs("span",{className:"font-mono",children:[n.toFixed(1),"%"]})]}),r.jsx("div",{className:"mt-1 h-1.5 overflow-hidden rounded-full bg-muted",children:r.jsx("div",{className:ie("h-full",s),style:{width:`${n.toFixed(2)}%`}})})]})}function qh({label:e,window:t}){const s=Math.min(100,Math.max(0,t.usedPercent)),n=t.resetsAtUnix?new Date(t.resetsAtUnix*1e3).toLocaleString():null,o=s>=90?"bg-red-500":s>=70?"bg-amber-500":"bg-emerald-500";return r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between text-[11px]",children:[r.jsx("span",{className:"text-muted-foreground",children:e}),r.jsxs("span",{className:"font-mono",children:[s.toFixed(1),"%"]})]}),r.jsx("div",{className:"mt-1 h-1.5 overflow-hidden rounded-full bg-muted",children:r.jsx("div",{className:ie("h-full",o),style:{width:`${s.toFixed(2)}%`}})}),n?r.jsxs("div",{className:"mt-0.5 font-mono text-[10px] text-muted-foreground",children:["resets ",n]}):null]})}function Vs({label:e,value:t}){return r.jsxs("div",{children:[r.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:e}),r.jsx("div",{className:"font-mono text-xs font-semibold",children:t})]})}function Gn(e){return e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function jw(e){if(!e)return"0s";if(e<1e3)return`${e}ms`;const t=e/1e3;if(t<60)return`${t.toFixed(1)}s`;const s=Math.floor(t/60),n=Math.round(t-s*60);return`${s}m ${n}s`}function sB(e=1e4){const[t,s]=y.useState(null),[n,o]=y.useState(null);return y.useEffect(()=>{let l=!0;const u=()=>{g6().then(m=>{l&&(s(m),o(null))}).catch(m=>{l&&o(m instanceof Error?m.message:String(m))})};u();const h=window.setInterval(u,e);return()=>{l=!1,window.clearInterval(h)}},[e]),{usage:t,error:n}}const nB={"claude-code":{label:"Claude Code",icon:r.jsx(vl,{})},codex:{label:"Codex",icon:r.jsx(vu,{})}};function iB({agent:e,agentId:t,isDetected:s}){const{usage:n,error:o}=sB(),l=nB[t],u=t==="codex";return r.jsxs(gi,{className:"min-w-0 rounded-none border-0 bg-transparent",children:[r.jsxs(bi,{className:"border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx(zN,{className:"size-4 text-muted-foreground"}),r.jsx(xi,{children:u?"Token Usage & Rate Limits":"Token & Cost Usage"}),r.jsx(ze,{variant:"outline",size:"small",icon:l.icon,children:l.label}),s?r.jsx(ze,{variant:"outline",size:"small",children:"active session"}):r.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Not the active agent in this session"}),u?null:r.jsx(rB,{className:"ml-auto"})]}),r.jsxs(Ii,{className:"truncate text-xs",children:[u?r.jsxs(r.Fragment,{children:["Session metrics from ",r.jsx("code",{className:"font-mono",children:"~/.codex/sessions"})]}):r.jsxs(r.Fragment,{children:["Last-session metrics from ",r.jsx("code",{className:"font-mono",children:"~/.claude.json"})]})," · ",r.jsx("span",{className:"font-mono",children:e.project.cwd})]})]}),r.jsxs(vi,{className:"p-3",children:[o?r.jsx("p",{className:"text-xs text-destructive",children:o}):null,u?n?.codex?r.jsx(tB,{usage:n.codex}):o?null:r.jsx(Tw,{agent:"Codex CLI"}):n?.claude?r.jsx(eB,{usage:n.claude}):o?null:r.jsx(Tw,{agent:"Claude Code"})]})]})}function rB({className:e}){const[t,s]=y.useState(!0),[n,o]=y.useState(!0),[l,u]=y.useState(!1),h=Es();y.useEffect(()=>{let d=!0;return b6().then(p=>d&&s(p.coAuthorWithClaude)).catch(()=>{}).finally(()=>d&&o(!1)),()=>{d=!1}},[]);const m=async()=>{const d=!t;u(!0),s(d);try{const p=await x6({coAuthorWithClaude:d});s(p.coAuthorWithClaude),h.success(p.coAuthorWithClaude?"Claude co-author trailer enabled for commits":"Claude co-author trailer disabled for commits")}catch(p){s(!d),h.error(p instanceof Error?p.message:"Failed to update setting")}finally{u(!1)}};return r.jsxs(Y,{type:"button",variant:t?"default":"outline",size:"sm",onClick:m,disabled:n||l,"aria-pressed":t,title:t?"Claude will be added as commit co-author. Click to disable.":"Co-author trailer disabled. Click to enable.",className:ie("gap-1.5",e),children:[r.jsx(vl,{className:"size-3.5"}),"Co-author"]})}function Tw({agent:e}){return r.jsxs("p",{className:"text-xs text-muted-foreground",children:["No usage data yet. Run a session with ",e," in this project."]})}const Aw=["I want to add a new service to NoMoreIDE. Walk me through it one step at a time —","ask a single question per message and give me options to choose from where it helps.","","Whenever you offer me a set of choices, end that message with a fenced block","labelled `options`, one choice per line, so I can click them. For example:","```options","Local","Docker Compose","SSH (remote)","```","","When the answer is free text (not a pick-list), always show a concrete example","in the question so I know the format — e.g. ask for the SSH host as","'What SSH host alias should I use? (for example: `devbox`)', the command as","'(for example: `npm run dev`)', the directory as '(for example: `/srv/app`)',","and the name as '(for example: `backend`)'. Never ask for a value without an example.","","1. First ask whether it's local, a Docker Compose service, or remote over SSH.","2. For local or Docker: ask which folder it lives in — and remind me I can click"," the paperclip (attach) button at the bottom-left of this chat to browse and"," insert the folder path. Then look inside it (package.json scripts,"," docker-compose.yml, go.mod, etc.) and propose the start command and port —"," confirm with me, don't assume."," For SSH: ask for the host alias, the remote command, and the remote directory.","3. Confirm a short name for it.","","Once I've confirmed everything, register it by running the nomoreide CLI:",' nomoreide add service <name> --command "<cmd>" --cwd "<dir>" [--port <n>] [--description "<text>"]'," Docker: --kind docker-compose --compose-service <svc> [--compose-file <file>] --cwd <dir>",' SSH: --kind ssh --host <alias> --command "<cmd>" --cwd "<remote dir>"',"After it registers successfully, end your final message with the service name in a","fenced `service` block so I get Start / Open buttons for it, e.g.:","```service","backend","```"].join(`
21
+ `),aB=["I want to connect a database to NoMoreIDE so I can browse it in the Database tab.","Walk me through it one step at a time — ask a single question per message and give","me options to choose from where it helps.","","Whenever you offer me a set of choices, end that message with a fenced block","labelled `options`, one choice per line, so I can click them. For example:","```options","Postgres","MySQL","SQLite","```","","First, look at what's already here before asking me to type things:","- Call `nomoreide_list_services` and check for a database service (a docker-compose"," or local service using a postgres / pgvector / mysql / mariadb image).","- If I just onboarded a repo, prefer the database it exposed.","","Then confirm the connection details with me: engine, host, port, user, password,","and database name. When the answer is free text, show a concrete example in the","question — e.g. the host as '(for example: `127.0.0.1`)' and the port as","'(for example: `5432`)'. For a docker-compose database, use the published host","port (the left side of a `5433:5432` mapping), not the in-container port.","","Once I've confirmed everything, register it with the `nomoreide_register_database`","tool — pass name, engine (postgres|mysql|sqlite), and a connection url, e.g.","`postgres://user:password@127.0.0.1:5433/dbname` (or an absolute file path for","sqlite). After it registers, tell me it's ready to browse in the Database tab."].join(`
22
+ `);function oB(e){const t=e?.trim();return[t?`Onboard this repository into NoMoreIDE and get it running: ${t}`:"I want to add a project to NoMoreIDE from a Git URL. First ask me for the repository URL (for example: `https://github.com/owner/repo`).","","Then set it up end-to-end yourself — don't make me fill in a form:","1. Call the `nomoreide_onboard_repo` tool with the URL to clone and analyze it."," It returns the clone path, a profile (manifests, Docker/compose, env keys,"," README excerpt), and ranked proposals with install-command hints.","2. Pick the best proposal straight from that result. Trust the profile — don't"," crawl the repo with Read/Glob/Grep or shell file reads; it already has what"," you need. Only ask me if it's genuinely ambiguous (e.g. several equally-likely"," apps in a monorepo) — otherwise choose sensible defaults.","3. Install dependencies if needed (run the install command in the clone path).","4. Register it with `nomoreide_register_service` using the returned clone path as"," the cwd, then register it as a git repo with `nomoreide_git_register_repository`"," so it shows in the Git tab."," If the onboard result includes any `databases`, register each one with"," `nomoreide_register_database` (use its name, engine, and url) so it shows in the"," Database tab.","5. Start it with `nomoreide_start_service` and confirm it came up (check its logs).","","Keep me posted as you go, but keep decisions to yourself unless you're truly stuck.","When it's running, end your message with the service name in a fenced `service`","block so I get Start / Open buttons for it, e.g.:","```service","backend","```"].join(`
23
+ `)}function lB(e){return e.map(t=>`- ${t.name}: ${t.dataType}${t.primaryKey?" (PK)":""}${t.nullable?"":" NOT NULL"}`).join(`
24
+ `)}function g3(e){return e?.length?["## Table schema",lB(e),""].join(`
25
+ `):""}const b3="Your prompt: ";function cB(e,t,s,n,o){return[`I'm looking at a row in my ${t} database (connection "${e}", table \`${s.qualifiedName}\`).`,"",g3(n),"## Row","```json",JSON.stringify(o,null,2),"```","",b3].join(`
26
+ `)}function Rw(e,t,s){const n=s?.engine?`my ${s.engine} database (connection "${e}")`:`my database (connection "${e}")`,o=[`I'm looking at the table \`${t.qualifiedName}\` in ${n}.`,""],l=g3(s?.columns);return l&&o.push(l),o.push(b3),o.join(`
27
+ `)}function uB(e,t,s){const n=s.engine?`${s.engine} `:"",o=(s.tables??[]).map(u=>u.qualifiedName).filter(Boolean),l=[`Write one ${n}SQL statement for the database connection "${e}".`,"","What it should do:",t.trim(),""];return o.length?(l.push("Tables in this database:"),l.push(o.map(u=>`- ${u}`).join(`
28
+ `)),l.push("Inspect a table's columns with the database tools if you need its exact schema.")):l.push("Use the database tools to inspect the available tables and columns before writing the query."),l.push(""),l.push("Rules:"),s.unlocked?l.push("- This connection is unlocked for writes, so INSERT/UPDATE/DELETE/DDL are allowed if that's what was asked for."):l.push("- This connection is read-only. Return a SELECT (or other read) statement only — never a write."),l.push("- Return exactly one statement."),l.push("- Output ONLY the statement inside a single ```sql code fence — no explanation before or after."),l.join(`
29
+ `)}function dB(e,t,s,n){return[`This ${t?`${t} `:""}query against the database connection "${e}" failed.`,"","Statement:","```sql",s.trim(),"```","","Error returned by the database:","```",n.trim(),"```","","Explain what's wrong and why, then give a corrected statement in a ```sql code fence.","Use the database tools to check the actual schema if the fix depends on it."].join(`
30
+ `)}function hB({absolutePath:e,lines:t,relativePath:s}){return[`Please structurally split this large file and preserve behavior: ${s}`,"",`Absolute path: ${e}`,`Current size: ${t.toLocaleString()} lines`,"","First read the file and nearby imports/tests, then propose the smallest safe decomposition.","Prefer extracting cohesive responsibilities into focused modules over mechanical slicing.","Keep public APIs stable where possible, update imports, and run the relevant tests after editing."].join(`
31
+ `)}function fB(e,t){return[`About commit \`${e.hash.slice(0,7)}\` — "${e.subject}" by ${e.author}:`,"",t,"",`Run \`git show ${e.hash}\` to see the diff if you need it.`].join(`
32
+ `)}function mB(e){const t=["Write a concise Git commit message for my currently staged changes.","","- Inspect the staged diff yourself (`git diff --cached` or the `nomoreide_git_staged_diff` tool).","- Use a conventional-commit style subject (≤ 72 chars), then a short body if it helps.","- Reply with ONLY the commit message in a code block so I can copy it — don't commit it yourself."];return e.branch&&t.push("",`Branch: \`${e.branch}\``),e.stagedFiles.length&&(t.push("","Staged files:",...e.stagedFiles.slice(0,40).map(s=>`- ${s}`)),e.stagedFiles.length>40&&t.push(`- …and ${e.stagedFiles.length-40} more`)),t.join(`
33
+ `)}function pB(e){return[`I have ${e.fileCount} uncommitted change${e.fileCount===1?"":"s"}${e.branch?` on \`${e.branch}\``:""}.`,"","Review the working tree (`git status` + `git diff`), stage the changes that belong together, and commit them with a clear conventional-commit message. Ask me before committing anything that looks unintended (secrets, debug code, unrelated files)."].join(`
34
+ `)}function gB(e){return[`My branch${e.branch?` \`${e.branch}\``:""} is ${e.behind} commit${e.behind===1?"":"s"} behind ${e.upstream??"its upstream"}.`,"","Pull and rebase onto the upstream. If there are conflicts, walk me through resolving them — don't force anything or discard my work."].join(`
35
+ `)}function bB(e){return[`The latest CI run (\`${e.runName}\`)${e.branch?` on \`${e.branch}\``:""} failed: ${e.url}`,"","Figure out why it failed (check the workflow logs / the relevant test or build step), then fix the underlying issue in the code. Explain what was wrong before you change anything."].join(`
36
+ `)}function xB(e){return["I have these ungrouped services in NoMoreIDE and I'd like to organise them into groups","(groups let me start/stop related services together):","",e.length?e.map(s=>{const n=[`- ${s.name}`];return s.command&&n.push(`command: \`${s.command}\``),s.cwd&&n.push(`cwd: \`${s.cwd}\``),typeof s.port=="number"&&n.push(`port: ${s.port}`),s.description&&n.push(s.description),n.join(" — ")}).join(`
37
+ `):"- (none — all services are already grouped)","","Look at their names, commands, directories and ports and propose how to group them —","for example a frontend + backend that share a repo, or services that boot together.","Group only the ones that genuinely belong together; it's fine to leave some ungrouped.","","Present your proposal as a short list of `group name → services` and end that message","with a fenced `options` block so I can confirm, e.g.:","```options","Yes, create these groups","Let me adjust them first","```","","Do NOT create anything until I confirm. Once I say yes, register each group by running:"," nomoreide add bundle <group-name> <service> <service> ...","Then tell me which groups you created."].join(`
38
+ `)}function vB({service:e,context:t}){return[`Here's the current debug context for my \`${e}\` service. Take a look at its`,"state and recent logs, tell me what stands out, and help me fix anything that's wrong.","",t].join(`
39
+ `)}function Mw(){return{serviceNames:[],databaseNames:[],errorIds:[],repositoryPaths:[]}}function _B(e){return e.serviceNames.length>0||e.databaseNames.length>0||e.errorIds.length>0||e.repositoryPaths.length>0}function yB({dashboard:e,databases:t,incidents:s,note:n,selection:o}){const l=[wB(e,o.serviceNames),kB(t,o.databaseNames),NB(s,o.errorIds),CB(e,o.repositoryPaths)].filter(Boolean);return["Diagnose this NoMoreIDE workspace context.","Use the selected services, databases, incidents, and repositories together. Tell me what stands out, likely root causes, and the safest next steps.","",`Workspace: ${e.cwd}`,n?.trim()?`Extra user context:
40
+ ${n.trim()}`:null,"",l.join(`
41
+
42
+ ---
43
+
44
+ `)].filter(Boolean).join(`
45
+ `)}function SB({note:e,selection:t}){const s=[Zd(t.serviceNames.length,"service"),Zd(t.databaseNames.length,"database"),Zd(t.errorIds.length,"error"),Zd(t.repositoryPaths.length,"repo")].filter(Boolean),n=e?.trim().replace(/\s+/g," ");return n?`Diagnose: ${s.join(", ")}. Note: ${n.slice(0,80)}`:`Diagnose: ${s.join(", ")}`}function wB(e,t){return t.length?["Services",t.map(n=>{const o=e.config.services.find(m=>m.name===n),l=e.runtime.services[n],u=e.health[n],h=e.logs.filter(m=>m.service===n).slice(-8).map(m=>`${m.timestamp} ${m.stream}: ${m.text}`);return[`Service: ${n}`,o?.kind?`kind: ${o.kind}`:null,o?.command?`command: ${o.command}`:null,o?.cwd?`cwd: ${o.cwd}`:null,o?.port?`port: ${o.port}`:null,l?`state: ${l.state}`:"state: unknown",l?.pid?`pid: ${l.pid}`:null,l?.url?`url: ${l.url}`:null,l?.exitCode!==void 0&&l.exitCode!==null?`exitCode: ${l.exitCode}`:null,u?`health: ${u.status} - ${u.summary}`:null,u?.agentContext?`agent debug context:
46
+ ${u.agentContext}`:null,h.length?`recent logs:
47
+ ${h.join(`
48
+ `)}`:null].filter(Boolean).join(`
49
+ `)}).join(`
50
+
51
+ `)].join(`
52
+ `):null}function kB(e,t){return t.length?["Databases",t.map(n=>{const o=e.find(l=>l.name===n);return[`Database: ${n}`,o?.engine?`engine: ${o.engine}`:null,o?.url?`url: ${o.url}`:null].filter(Boolean).join(`
53
+ `)}).join(`
54
+
55
+ `)].join(`
56
+ `):null}function NB(e,t){return t.length?["Error Inbox",t.map(n=>{const o=e.find(l=>l.id===n);return o?[`Incident #${o.id}`,`service: ${o.service}`,`level: ${o.level}`,`title: ${o.title}`,o.file?`file: ${o.file}${o.line?`:${o.line}`:""}`:null,`count: ${o.count}`,`firstSeen: ${o.firstSeen}`,`lastSeen: ${o.lastSeen}`,o.logExcerpt.length?`log excerpt:
57
+ ${o.logExcerpt.join(`
58
+ `)}`:null].filter(Boolean).join(`
59
+ `):`Incident #${n}`}).join(`
60
+
61
+ `)].join(`
62
+ `):null}function CB(e,t){if(!t.length)return null;const s=EB(e),n=e.git.selectedRepository?.path??e.git.cwd,o=e.git.status?.files.map(u=>`${u.index}${u.workingTree}: ${u.path}`)??[];return["Git Repositories",t.map(u=>{const h=s.find(d=>d.path===u),m=u===n;return[`Repository: ${h?.name??u.split("/").pop()??u}`,`path: ${u}`,m?"current: yes":"current: no",m?o.length?`changed files:
63
+ ${o.join(`
64
+ `)}`:"changed files: none":"changed files: not loaded for this repository in the current dashboard view"].join(`
65
+ `)}).join(`
66
+
67
+ `)].join(`
68
+ `)}function EB(e){return e.config.gitRepositories.length?e.config.gitRepositories:e.git.selectedRepository?[e.git.selectedRepository]:[{name:e.git.cwd.split("/").pop()??"repository",path:e.git.cwd}]}function Zd(e,t){return e?`${e} ${t}${e===1?"":"s"}`:null}function _f(e){return e==="codex"?"Codex":"Claude Code"}function jB(e,t){const s=e==="codex"?"`~/.codex/skills/<name>/SKILL.md` (user) or `.codex/skills/<name>/SKILL.md` (project)":"`~/.claude/skills/<name>/SKILL.md` (user) or `.claude/skills/<name>/SKILL.md` (project)";return[`Add a new skill for ${_f(e)} from this:`,"",t,"",`Scaffold it at ${s} with valid frontmatter (\`name\`, \`description\`) and a short body, then confirm it's discovered. If the input is a URL or repo, fetch and adapt it.`].join(`
69
+ `)}function TB(e){return[`Remove the ${e.scope} skill \`${e.name}\`${e.path?` (at \`${e.path}\`)`:""}.`,"","Delete its directory and confirm it's no longer registered. Check nothing else references it first."].join(`
70
+ `)}function AB(e){const t=[`I'm looking at the ${e.scope} skill \`${e.name}\`${e.path?` (at \`${e.path}\`)`:""}.`];return e.description&&t.push("",`Its description: ${e.description}`),t.push("","My question: "),t.join(`
71
+ `)}function RB(e,t){const s=e==="codex"?"by adding an `[mcp_servers.<name>]` section to `~/.codex/config.toml`":"with `claude mcp add` (or by editing `~/.claude.json`)";return[`Register a new MCP server for ${_f(e)} from this:`,"",t,"",`Set it up ${s}, then verify it connects. Parse the name, command/URL, and any env/args from the input above.`].join(`
72
+ `)}function MB(e,t){const s=t==="codex"?`Remove the \`[mcp_servers.${e.name}]\` section from \`~/.codex/config.toml\`.`:`Run \`claude mcp remove ${e.name}\` (scope: ${e.scope}).`;return[`Remove the ${e.scope} MCP server \`${e.name}\`.`,"",`${s} Then confirm it no longer appears in the server list.`].join(`
73
+ `)}function DB(e){const t=[`I'm looking at the ${e.scope} MCP server \`${e.name}\`.`],s=e.command?[e.command,...e.args??[]].join(" "):e.url??e.type;return s&&t.push("",`It points at: \`${s}\``),t.push("","My question: "),t.join(`
74
+ `)}function OB(e,t){return[`Install a plugin for ${_f(e)} from this:`,"",t,"","Use the `/plugin` command or `claude plugin install <name>@<marketplace>` (add the marketplace first if needed), then confirm its skills, commands, and MCP servers are available."].join(`
75
+ `)}function LB(e){const t=e.marketplace?` (from \`${e.marketplace}\`)`:"";return[`Uninstall the plugin \`${e.name}\`${t}.`,"","Use `claude plugin uninstall` or the `/plugin` command, then confirm its skills, commands, and MCP servers are gone."].join(`
76
+ `)}function zB(e){const t=[`I'm looking at the plugin \`${e.name}\`${e.marketplace?` from \`${e.marketplace}\``:""}${e.version?` (v${e.version})`:""}.`];e.description&&t.push("",e.description);const s=[];return e.skills.length&&s.push(`skills: ${e.skills.join(", ")}`),e.commands.length&&s.push(`commands: ${e.commands.join(", ")}`),e.agents.length&&s.push(`agents: ${e.agents.join(", ")}`),e.mcpServers.length&&s.push(`MCP servers: ${e.mcpServers.join(", ")}`),s.length&&(t.push("","It contributes —"),t.push(...s.map(n=>`- ${n}`))),t.push("","My question: "),t.join(`
77
+ `)}function BB(e,t){const s=e==="codex"?"`~/.codex/config.toml` if this Codex version supports hooks":"`~/.claude/settings.json` (user) or `.claude/settings.json` (project)";return[`Add a hook for ${_f(e)} from this:`,"",t,"",`Configure it in ${s}. Pick the correct hook event, matcher, command, and scope from the request, then confirm it appears in the agent tools view.`].join(`
78
+ `)}function IB(e){const t=e.matcher?` with matcher \`${e.matcher}\``:"",s=e.command?` running \`${e.command}\``:"";return[`Remove the ${e.scope} \`${e.event}\` hook${t}${s}.`,"",`Edit \`${e.settingsPath}\`, remove only that hook entry, and confirm it no longer appears in the hooks list.`].join(`
79
+ `)}function PB(e){const t=[`I'm looking at the ${e.scope} \`${e.event}\` hook in \`${e.settingsPath}\`.`];return e.matcher&&t.push("",`Matcher: \`${e.matcher}\``),e.type&&t.push(`Type: \`${e.type}\``),e.command&&t.push(`Command: \`${e.command}\``),t.push("","My question: "),t.join(`
80
+ `)}function x3({id:e,className:t}){return e==="codex"?r.jsx(vu,{className:ie("text-foreground",t)}):e==="gemini"?r.jsx(Tz,{className:ie("text-[#1A73E8]",t)}):r.jsx(vl,{className:ie("text-[#D97757]",t)})}function Tt({className:e}){const{provider:t}=At();return r.jsx(x3,{id:t?.id,className:e})}function hl({onAsk:e,label:t,className:s}){const{provider:n}=At(),o=t??`Ask ${n?.label??"Claude"}`;return r.jsx("button",{"aria-label":o,className:ie("flex size-6 items-center justify-center rounded-md opacity-0 transition-all duration-150 hover:bg-muted group-hover:opacity-100",s),onClick:e,title:o,type:"button",children:r.jsx(x3,{id:n?.id,className:"size-3.5"})})}function yu({placeholder:e,onSubmit:t,onCancel:s,className:n}){const[o,l]=y.useState(""),u=()=>{const m=o.trim();m&&t(m)},h=y.useCallback(m=>{m?.focus()},[]);return r.jsxs("form",{className:ie("flex items-center gap-1.5 rounded-md border border-primary/40 bg-primary/5 px-1.5 py-1",n),onSubmit:m=>{m.preventDefault(),u()},children:[r.jsx(hl,{className:"size-5 opacity-100",label:"Send to the agent",onAsk:u}),r.jsx("input",{ref:h,className:"min-w-0 flex-1 bg-transparent text-xs outline-none placeholder:text-muted-foreground",onChange:m=>l(m.target.value),onKeyDown:m=>{m.key==="Escape"&&s()},placeholder:e,value:o}),r.jsx(Y,{type:"submit",size:"icon",className:"size-6",disabled:!o.trim(),title:"Send",children:r.jsx(tn,{className:"size-3.5"})}),r.jsx(Y,{type:"button",size:"icon",variant:"ghost",className:"size-6",onClick:s,"aria-label":"Cancel",title:"Cancel",children:r.jsx(Ft,{className:"size-3.5"})})]})}function yf({label:e,onClick:t}){return r.jsxs(Y,{type:"button",variant:"ghost",size:"sm",className:"h-6 gap-1 px-1.5 text-[11px] font-medium",onClick:t,title:e,"aria-label":e,children:[r.jsx(hs,{className:"size-3.5"}),"Add"]})}function Sf({askLabel:e,removeLabel:t,onAsk:s,onRemove:n}){return r.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[r.jsx(hl,{label:e,onAsk:s}),r.jsx($B,{label:t,onConfirm:n})]})}function $B({label:e,onConfirm:t}){const[s,n]=y.useState(!1);return s?r.jsxs("span",{className:"flex items-center gap-0.5",children:[r.jsx("button",{type:"button","aria-label":e,title:e,onClick:()=>{n(!1),t()},className:"flex size-6 items-center justify-center rounded-md text-emerald-600 transition-colors hover:bg-emerald-500/10",children:r.jsx(tn,{className:"size-3.5"})}),r.jsx("button",{type:"button","aria-label":"Cancel",title:"Cancel",onClick:()=>n(!1),className:"flex size-6 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted",children:r.jsx(Ft,{className:"size-3.5"})})]}):r.jsx("button",{type:"button","aria-label":e,title:e,onClick:()=>n(!0),className:"flex size-6 items-center justify-center rounded-md text-muted-foreground opacity-0 transition-all duration-150 hover:bg-destructive/10 hover:text-destructive group-hover:opacity-100",children:r.jsx(yr,{className:"size-3.5"})})}function HB({agent:e,agentId:t,alternateHooks:s}){const{sendToAgent:n}=At(),[o,l]=y.useState(!1),u=e.hooks??[];function h(p){l(!1),n({prompt:BB(t,p),source:{type:"agent-hook",label:"New hook"},label:`Add hook: ${p}`})}function m(p){n({prompt:PB(p),source:{type:"agent-hook",label:`${p.event} hook`},mode:"draft"})}function d(p){n({prompt:IB(p),source:{type:"agent-hook",label:`Remove ${p.event}`},label:`Remove hook: ${p.event}`})}return r.jsxs(gi,{className:"min-w-0 rounded-none border-0 border-t border-border bg-transparent md:border-l lg:border-t-0",children:[r.jsxs(bi,{className:"border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(c6,{className:"size-4 text-muted-foreground"}),r.jsx(xi,{children:"Hooks"})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(ze,{variant:"outline",size:"small",children:u.length}),r.jsx(yf,{label:"Add a hook with AI",onClick:()=>l(p=>!p)})]})]}),o?r.jsx(yu,{className:"mt-1.5",placeholder:"Describe the event, matcher, and command…",onSubmit:h,onCancel:()=>l(!1)}):r.jsx(Ii,{className:"text-xs",children:t==="codex"?"Codex hooks from ~/.codex/hooks.json, with state from ~/.codex/config.toml.":"PreToolUse, PostToolUse, and other Claude Code hooks from user and project settings."})]}),r.jsx(vi,{className:"p-0",children:u.length?r.jsx("ul",{className:"divide-y divide-border",children:u.map(p=>r.jsxs("li",{className:"group px-3 py-2 hover:bg-muted/40",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[r.jsx("span",{className:"min-w-0 truncate font-mono text-xs font-semibold",title:p.event,children:p.event}),r.jsx(Sf,{askLabel:`Ask AI about the ${p.event} hook`,removeLabel:`Remove the ${p.event} hook`,onAsk:()=>m(p),onRemove:()=>d(p)})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[r.jsx(FB,{hook:p}),r.jsx(qB,{hook:p}),r.jsx(ze,{variant:"outline",size:"small",children:p.scope})]})]}),r.jsx("div",{className:"mt-1 truncate font-mono text-[11px] text-muted-foreground",title:Dw(p),children:Dw(p)})]},p.id))}):r.jsx(UB,{agentId:t,alternateHooks:s})})]})}function UB({agentId:e,alternateHooks:t}){const s=e==="codex"?"Codex":"Claude Code";return r.jsxs("p",{className:"px-3 py-4 text-xs text-muted-foreground",children:["No ",s," hooks configured.",t?.count?r.jsxs(r.Fragment,{children:[" ",t.agentLabel," has ",t.count," hook",t.count===1?"":"s","; switch agents above to view them."]}):null]})}function FB({hook:e}){return e.status==="enabled"?r.jsx(ze,{variant:"success",appearance:"subtle",size:"small",children:"Enabled"}):e.status==="disabled"?r.jsx(ze,{variant:"error",appearance:"subtle",size:"small",children:"Disabled"}):r.jsx(ze,{variant:"warning",appearance:"subtle",size:"small",children:"Default"})}function qB({hook:e}){return e.trusted===void 0?null:r.jsx(ze,{variant:e.trusted?"success":"warning",appearance:"subtle",size:"small",children:e.trusted?"Trusted":"Untrusted"})}function VB(e){return e.command?e.command:e.type??e.settingsPath}function Dw(e){return`${e.matcher?`matcher ${e.matcher} · `:""}${VB(e)}`}function GB({agent:e,agentId:t}){const{sendToAgent:s}=At(),[n,o]=y.useState([]),[l,u]=y.useState(!1),[h,m]=y.useState(!1),d=y.useCallback(async()=>{u(!0);try{o(await p6(t))}catch{o([])}finally{u(!1)}},[t]);y.useEffect(()=>{d()},[d]);const p=y.useMemo(()=>{const w={};for(const k of n)w[k.name]=k.state;return w},[n]),g=y.useMemo(()=>{const w=new Set(e.mcpServers.map(C=>C.name)),k=n.filter(C=>!w.has(C.name)).map(C=>({name:C.name,scope:"user",synthetic:!0}));return[...e.mcpServers,...k]},[e.mcpServers,n]);function x(w){m(!1),s({prompt:RB(t,w),source:{type:"agent-mcp",label:"New MCP server"},label:`Add MCP server: ${w}`})}function _(w){s({prompt:DB(w),source:{type:"agent-mcp",label:`${w.name} server`},mode:"draft"})}function S(w){s({prompt:MB(w,t),source:{type:"agent-mcp",label:`Remove ${w.name}`},label:`Remove MCP server: ${w.name}`})}return r.jsxs(gi,{className:"min-w-0 rounded-none border-0 bg-transparent md:border-l md:border-border",children:[r.jsxs(bi,{className:"border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(FN,{className:"size-4 text-muted-foreground"}),r.jsx(xi,{children:"MCP Servers"})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(ze,{variant:"outline",size:"small",children:g.length}),r.jsx(Y,{type:"button",variant:"ghost",size:"icon",className:"size-6",onClick:()=>{d()},disabled:l,title:"Re-check authentication status","aria-label":"Re-check authentication status",children:r.jsx(_r,{className:l?"animate-spin":void 0})}),r.jsx(yf,{label:"Register an MCP server with AI",onClick:()=>m(w=>!w)})]})]}),h?r.jsx(yu,{className:"mt-1.5",placeholder:"Paste the MCP install command or URL…",onSubmit:x,onCancel:()=>m(!1)}):r.jsxs(Ii,{className:"text-xs",children:["From"," ",r.jsx("code",{className:"font-mono",children:t==="codex"?"~/.codex/config.toml":"~/.claude.json"}),t==="codex"?"":" + claude.ai connectors",". Status via"," ",r.jsxs("code",{className:"font-mono",children:[t==="codex"?"codex":"claude"," mcp list"]})," ","(fresh health check)."]})]}),r.jsx(vi,{className:"p-0",children:g.length?r.jsx("ul",{className:"divide-y divide-border",children:g.map(w=>r.jsxs("li",{className:"group px-3 py-2 hover:bg-muted/40",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[r.jsx("span",{className:"min-w-0 truncate font-mono text-xs font-semibold",title:w.name,children:w.name}),r.jsx(Sf,{askLabel:`Ask AI about the ${w.name} server`,removeLabel:`Remove the ${w.name} server`,onAsk:()=>_(w),onRemove:()=>S(w)})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[r.jsx(KB,{state:p[w.name],loading:l}),r.jsx(ze,{variant:"outline",size:"small",children:w.synthetic?"connector":w.scope})]})]}),r.jsx("div",{className:"mt-1 truncate font-mono text-[11px] text-muted-foreground",title:w.synthetic?"claude.ai managed connector":Ow(w),children:w.synthetic?"claude.ai managed connector":Ow(w)})]},`${w.scope}:${w.name}`))}):r.jsx("p",{className:"px-3 py-4 text-xs text-muted-foreground",children:"No MCP servers configured."})})]})}const WB={connected:{label:"Connected",dot:"bg-emerald-500"},"needs-auth":{label:"Needs auth",dot:"bg-amber-500"},failed:{label:"Failed",dot:"bg-red-500"},"no-auth":{label:"local",dot:"bg-muted-foreground/50"}};function KB({state:e,loading:t}){if(!e)return t?r.jsx(ht,{className:"size-3 animate-spin text-muted-foreground"}):null;const s=e==="unknown"?void 0:WB[e];return s?r.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[r.jsx("span",{className:ie("size-1.5 shrink-0 rounded-full",s.dot),"aria-hidden":!0}),s.label]}):null}function Ow(e){return e.command?[e.command,...e.args??[]].join(" "):e.url??e.type??"-"}function YB({agent:e,agentId:t}){const{sendToAgent:s}=At(),[n,o]=y.useState(!1),l=e.plugins??[];function u(d){o(!1),s({prompt:OB(t,d),source:{type:"agent-plugin",label:"New plugin"},label:`Install plugin: ${d}`})}function h(d){s({prompt:zB(d),source:{type:"agent-plugin",label:`${d.name} plugin`},mode:"draft"})}function m(d){s({prompt:LB(d),source:{type:"agent-plugin",label:`Remove ${d.name}`},label:`Uninstall plugin: ${d.name}`})}return r.jsxs(gi,{className:"min-w-0 rounded-none border-0 border-t border-border bg-transparent lg:border-l lg:border-t-0",children:[r.jsxs(bi,{className:"border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(d4,{className:"size-4 text-muted-foreground"}),r.jsx(xi,{children:"Plugins"})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(ze,{variant:"outline",size:"small",children:l.length}),r.jsx(yf,{label:"Install a plugin with AI",onClick:()=>o(d=>!d)})]})]}),n?r.jsx(yu,{className:"mt-1.5",placeholder:"Paste a plugin name, marketplace, or install command…",onSubmit:u,onCancel:()=>o(!1)}):r.jsx(Ii,{className:"text-xs",children:t==="codex"?"Codex doesn't expose an installed-plugin registry here yet.":"Installed from marketplaces (~/.claude/plugins). Each bundles skills, commands, agents, and MCP servers."})]}),r.jsx(vi,{className:"p-0",children:l.length?r.jsx("ul",{className:"divide-y divide-border",children:l.map(d=>r.jsxs("li",{className:"group px-3 py-2 hover:bg-muted/40",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[r.jsx("span",{className:"min-w-0 truncate font-mono text-xs font-semibold",title:d.name,children:d.name}),r.jsx(Sf,{askLabel:`Ask AI about the ${d.name} plugin`,removeLabel:`Uninstall the ${d.name} plugin`,onAsk:()=>h(d),onRemove:()=>m(d)})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[d.version&&d.version!=="unknown"?r.jsxs(ze,{variant:"outline",size:"small",children:["v",d.version]}):null,d.marketplace?r.jsx(ze,{variant:"outline",size:"small",children:d.marketplace}):null]})]}),d.description?r.jsx("p",{className:"mt-1 truncate text-[11px] text-muted-foreground",title:d.description,children:d.description}):null,r.jsx(XB,{plugin:d})]},`${d.name}@${d.marketplace??""}`))}):r.jsx("p",{className:"px-3 py-4 text-xs text-muted-foreground",children:"No plugins installed."})})]})}function XB({plugin:e}){const t=[];return e.skills.length&&t.push(`${e.skills.length} skill${Qd(e.skills.length)}`),e.commands.length&&t.push(`${e.commands.length} command${Qd(e.commands.length)}`),e.agents.length&&t.push(`${e.agents.length} agent${Qd(e.agents.length)}`),e.mcpServers.length&&t.push(`${e.mcpServers.length} MCP server${Qd(e.mcpServers.length)}`),t.length?r.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1",children:t.map(s=>r.jsx("span",{className:"rounded-full bg-muted px-2 py-0.5 text-[10px] text-muted-foreground",children:s},s))}):null}function Qd(e){return e===1?"":"s"}function ZB({agent:e,agentId:t}){const{sendToAgent:s}=At(),[n,o]=y.useState(!1);function l(m){o(!1),s({prompt:jB(t,m),source:{type:"agent-skill",label:"New skill"},label:`Add skill: ${m}`})}function u(m){s({prompt:AB(m),source:{type:"agent-skill",label:`${m.name} skill`},mode:"draft"})}function h(m){s({prompt:TB(m),source:{type:"agent-skill",label:`Remove ${m.name}`},label:`Remove skill: ${m.name}`})}return r.jsxs(gi,{className:"min-w-0 rounded-none border-0 bg-transparent",children:[r.jsxs(bi,{className:"border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(pi,{className:"size-4 text-muted-foreground"}),r.jsx(xi,{children:"Skills"})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(ze,{variant:"outline",size:"small",children:e.skills.length}),r.jsx(yf,{label:"Add a skill with AI",onClick:()=>o(m=>!m)})]})]}),n?r.jsx(yu,{className:"mt-1.5",placeholder:"Paste a skill URL/repo, or describe the skill…",onSubmit:l,onCancel:()=>o(!1)}):r.jsx(Ii,{className:"text-xs",children:t==="codex"?"User, project, and system skills discovered for Codex.":"User and project skills discovered for the active agent."})]}),r.jsx(vi,{className:"p-0",children:e.skills.length?r.jsx("ul",{className:"divide-y divide-border",children:e.skills.map(m=>r.jsxs("li",{className:"group px-3 py-2 hover:bg-muted/40",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[r.jsx("span",{className:"min-w-0 truncate font-mono text-xs font-semibold",title:m.name,children:m.name}),r.jsx(Sf,{askLabel:`Ask AI about the ${m.name} skill`,removeLabel:`Remove the ${m.name} skill`,onAsk:()=>u(m),onRemove:()=>h(m)})]}),r.jsx("div",{className:"flex shrink-0 items-center gap-1.5",children:r.jsx(ze,{variant:"outline",size:"small",children:m.scope})})]}),m.description?r.jsx("p",{className:"mt-1 truncate text-[11px] text-muted-foreground",title:m.description,children:m.description}):null]},`${m.scope}:${m.name}`))}):r.jsx("p",{className:"px-3 py-4 text-xs text-muted-foreground",children:"No skills found."})})]})}function QB({agent:e,agentId:t,alternateHooks:s}){return r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4",children:[r.jsx(ZB,{agent:e,agentId:t}),r.jsx(GB,{agent:e,agentId:t}),r.jsx(YB,{agent:e,agentId:t}),r.jsx(HB,{agent:e,agentId:t,alternateHooks:s})]})}const JB=[{id:"claude-code",label:"Claude Code",icon:r.jsx(vl,{className:"size-4"})},{id:"codex",label:"Codex",icon:r.jsx(vu,{className:"size-4"})}],eI=[{id:"overview",label:"Overview",icon:r.jsx(zN,{className:"size-3.5"})},{id:"memory",label:"Memory",icon:r.jsx(EN,{className:"size-3.5"})},{id:"tools",label:"Skills, MCPs, Plugins & Hooks",icon:r.jsx(FN,{className:"size-3.5"})},{id:"activity",label:"Activity",icon:r.jsx(Ka,{className:"size-3.5"})},{id:"changes",label:"Changes",icon:r.jsx(iR,{className:"size-3.5"})}];function tI(){const[e,t]=y.useState(null),[s,n]=y.useState(null),[o,l]=y.useState("claude-code"),[u,h]=y.useState("overview"),{clear:m,turns:d}=At();if(y.useEffect(()=>{let x=!0;return QN().then(_=>{x&&(t(_),_.detected.name==="codex"&&l("codex"))}).catch(_=>{x&&n(_ instanceof Error?_.message:String(_))}),()=>{x=!1}},[]),s)return r.jsx("div",{className:"h-full overflow-auto bg-card/85 p-4",children:r.jsxs($e,{variant:"muted",className:"border-destructive/40 text-destructive",children:["Failed to load agent info: ",s]})});if(!e)return r.jsx("div",{className:"h-full overflow-auto bg-card/85 p-4",children:r.jsx($e,{variant:"muted",children:"Loading agent info…"})});const p=e.agents?.[o]??e,g=o==="codex"?{agentLabel:"Claude Code",count:e.agents["claude-code"].hooks.length}:{agentLabel:"Codex",count:e.agents.codex.hooks.length};return r.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/85",children:[r.jsx("div",{className:"flex shrink-0 items-center gap-2 border-b border-border bg-card/90 px-3 py-2",children:JB.map(x=>{const _=o===x.id,S=e.detected.name===x.id;return r.jsxs("button",{type:"button",onClick:()=>l(x.id),className:ie("flex items-center gap-2 rounded-lg border px-3 py-1.5 text-xs font-medium transition-colors",_?"border-border bg-background text-foreground shadow-sm":"border-transparent text-muted-foreground hover:bg-muted/60 hover:text-foreground"),children:[x.icon,x.label,S?r.jsx("span",{className:"size-1.5 rounded-full bg-emerald-500","aria-hidden":!0}):null]},x.id)})}),r.jsx("div",{className:"flex shrink-0 items-center gap-1 border-b border-border bg-card/90 px-3",children:eI.map(x=>r.jsxs("button",{type:"button",onClick:()=>h(x.id),className:ie("relative flex items-center gap-1.5 px-2.5 py-2 text-xs font-medium transition-colors",u===x.id?"text-foreground":"text-muted-foreground hover:text-foreground"),children:[x.icon,x.label,u===x.id?r.jsx("span",{className:"absolute inset-x-1 -bottom-px h-0.5 bg-primary"}):null]},x.id))}),r.jsx(Fz,{onNewChat:m,turns:d}),r.jsxs("div",{className:"min-h-0 flex-1 overflow-auto",children:[u==="overview"?r.jsx(iB,{agent:p,agentId:o,isDetected:e.detected.name===o}):null,u==="memory"?r.jsx(qz,{agent:p,agentId:o}):null,u==="tools"?r.jsx(QB,{agent:p,agentId:o,alternateHooks:g}):null,u==="activity"?r.jsx(Ez,{agent:p,agentId:o}):null,u==="changes"?r.jsx(Bz,{}):null]})]})}var io=wN();function Qn({children:e,icon:t,onClose:s,title:n,size:o="md"}){return y.useEffect(()=>{function l(u){u.key==="Escape"&&s()}return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[s]),io.createPortal(r.jsx("div",{className:"fixed inset-0 z-[1000] grid place-items-center bg-black/35 px-4",onMouseDown:s,children:r.jsxs("div",{"aria-modal":"true",className:`flex max-h-[min(820px,calc(100vh-2rem))] w-full flex-col overflow-hidden rounded-lg border border-border bg-card shadow-xl ${o==="xl"?"max-w-[min(1400px,calc(100vw-2rem))]":o==="lg"?"max-w-3xl":"max-w-lg"}`,onMouseDown:l=>l.stopPropagation(),role:"dialog",children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[r.jsx("div",{className:"flex size-8 items-center justify-center rounded-md border border-border bg-background text-foreground [&_svg]:size-4",children:t}),r.jsx("h2",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:n}),r.jsx(Y,{"aria-label":"Close dialog",onClick:s,size:"icon",type:"button",variant:"ghost",children:r.jsx(Ft,{})})]}),r.jsx("div",{className:"min-h-0 overflow-auto p-4",children:e})]})}),document.body)}function tt({className:e,type:t,...s}){return r.jsx("input",{type:t,className:ie("flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),...s})}const sI={top:"bottom-full left-1/2 mb-1.5 -translate-x-1/2",bottom:"top-full left-1/2 mt-1.5 -translate-x-1/2",left:"right-full top-1/2 mr-1.5 -translate-y-1/2",right:"left-full top-1/2 ml-1.5 -translate-y-1/2"};function al({label:e,children:t,side:s="bottom",className:n}){return r.jsxs("span",{className:ie("group/tt relative inline-flex",n),children:[t,r.jsx("span",{role:"tooltip",className:ie("pointer-events-none absolute z-[1100] whitespace-nowrap rounded-md bg-foreground px-2 py-1 text-xs font-medium text-background shadow-md","opacity-0 transition-opacity duration-150 group-hover/tt:opacity-100",sI[s]),children:e})]})}const Cx="application/x-nomoreide-path";function Su(e,t){return`${e.replace(/\/+$/,"")}/${t.replace(/^\/+/,"")}`}function v3(e,t){e.setData(Cx,t)}function Lw(e){return e.types.includes(Cx)}function nI(e){return e.getData(Cx)||null}function _3(e){return{draggable:!0,onDragStart:t=>{v3(t.dataTransfer,e),t.dataTransfer.effectAllowed="copy"}}}const ti='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>',si='</title><path d="',ni='"/></svg>',iI={title:".NET",slug:"dotnet",get svg(){return ti+".NET"+si+this.path+ni},path:"M24 8.77h-2.468v7.565h-1.425V8.77h-2.462V7.53H24zm-6.852 7.565h-4.821V7.53h4.63v1.24h-3.205v2.494h2.953v1.234h-2.953v2.604h3.396zm-6.708 0H8.882L4.78 9.863a2.896 2.896 0 0 1-.258-.51h-.036c.032.189.048.592.048 1.21v5.772H3.157V7.53h1.659l3.965 6.32c.167.261.275.442.323.54h.024c-.04-.233-.06-.629-.06-1.185V7.529h1.372zm-8.703-.693a.868.829 0 0 1-.869.829.868.829 0 0 1-.868-.83.868.829 0 0 1 .868-.828.868.829 0 0 1 .869.829Z",source:"https://github.com/dotnet/brand/blob/c7d0f51b8ec59531332d05fb27a5b758a7a3d689/logo/dotnet-logo.svg",hex:"512BD4",guidelines:"https://github.com/dotnet/brand/blob/c7d0f51b8ec59531332d05fb27a5b758a7a3d689/dotnet-styleGuide-2024.pdf",license:{type:"CC0-1.0",url:"https://spdx.org/licenses/CC0-1.0"}},rI={title:"Bun",slug:"bun",get svg(){return ti+"Bun"+si+this.path+ni},path:"M12 22.596c6.628 0 12-4.338 12-9.688 0-3.318-2.057-6.248-5.219-7.986-1.286-.715-2.297-1.357-3.139-1.89C14.058 2.025 13.08 1.404 12 1.404c-1.097 0-2.334.785-3.966 1.821a49.92 49.92 0 0 1-2.816 1.697C2.057 6.66 0 9.59 0 12.908c0 5.35 5.372 9.687 12 9.687v.001ZM10.599 4.715c.334-.759.503-1.58.498-2.409 0-.145.202-.187.23-.029.658 2.783-.902 4.162-2.057 4.624-.124.048-.199-.121-.103-.209a5.763 5.763 0 0 0 1.432-1.977Zm2.058-.102a5.82 5.82 0 0 0-.782-2.306v-.016c-.069-.123.086-.263.185-.172 1.962 2.111 1.307 4.067.556 5.051-.082.103-.23-.003-.189-.126a5.85 5.85 0 0 0 .23-2.431Zm1.776-.561a5.727 5.727 0 0 0-1.612-1.806v-.014c-.112-.085-.024-.274.114-.218 2.595 1.087 2.774 3.18 2.459 4.407a.116.116 0 0 1-.049.071.11.11 0 0 1-.153-.026.122.122 0 0 1-.022-.083 5.891 5.891 0 0 0-.737-2.331Zm-5.087.561c-.617.546-1.282.76-2.063 1-.117 0-.195-.078-.156-.181 1.752-.909 2.376-1.649 2.999-2.778 0 0 .155-.118.188.085 0 .304-.349 1.329-.968 1.874Zm4.945 11.237a2.957 2.957 0 0 1-.937 1.553c-.346.346-.8.565-1.286.62a2.178 2.178 0 0 1-1.327-.62 2.955 2.955 0 0 1-.925-1.553.244.244 0 0 1 .064-.198.234.234 0 0 1 .193-.069h3.965a.226.226 0 0 1 .19.07c.05.053.073.125.063.197Zm-5.458-2.176a1.862 1.862 0 0 1-2.384-.245 1.98 1.98 0 0 1-.233-2.447c.207-.319.503-.566.848-.713a1.84 1.84 0 0 1 1.092-.11c.366.075.703.261.967.531a1.98 1.98 0 0 1 .408 2.114 1.931 1.931 0 0 1-.698.869v.001Zm8.495.005a1.86 1.86 0 0 1-2.381-.253 1.964 1.964 0 0 1-.547-1.366c0-.384.11-.76.32-1.079.207-.319.503-.567.849-.713a1.844 1.844 0 0 1 1.093-.108c.367.076.704.262.968.534a1.98 1.98 0 0 1 .4 2.117 1.932 1.932 0 0 1-.702.868Z",source:"https://bun.sh/press-kit",hex:"000000"},aI={title:"Deno",slug:"deno",get svg(){return ti+"Deno"+si+this.path+ni},path:"M1.105 18.02A11.9 11.9 0 0 1 0 12.985q0-.698.078-1.376a12 12 0 0 1 .231-1.34A12 12 0 0 1 4.025 4.02a12 12 0 0 1 5.46-2.771 12 12 0 0 1 3.428-.23c1.452.112 2.825.477 4.077 1.05a12 12 0 0 1 2.78 1.774 12.02 12.02 0 0 1 4.053 7.078A12 12 0 0 1 24 12.985q0 .454-.036.914a12 12 0 0 1-.728 3.305 12 12 0 0 1-2.38 3.875c-1.33 1.357-3.02 1.962-4.43 1.936a4.4 4.4 0 0 1-2.724-1.024c-.99-.853-1.391-1.83-1.53-2.919a5 5 0 0 1 .128-1.518c.105-.38.37-1.116.76-1.437-.455-.197-1.04-.624-1.226-.829-.045-.05-.04-.13 0-.183a.155.155 0 0 1 .177-.053c.392.134.869.267 1.372.35.66.111 1.484.25 2.317.292 2.03.1 4.153-.813 4.812-2.627s.403-3.609-1.96-4.685-3.454-2.356-5.363-3.128c-1.247-.505-2.636-.205-4.06.582-3.838 2.121-7.277 8.822-5.69 15.032a.191.191 0 0 1-.315.19 12 12 0 0 1-1.25-1.634 12 12 0 0 1-.769-1.404M11.57 6.087c.649-.051 1.214.501 1.31 1.236.13.979-.228 1.99-1.41 2.013-1.01.02-1.315-.997-1.248-1.614.066-.616.574-1.575 1.35-1.635",source:"https://github.com/denoland/docs/blob/5dee713844c7447f80acd4093caa9d350d80bf36/static/img/logo.svg",hex:"000000",guidelines:"https://deno.com/brand",license:{type:"MIT",url:"https://spdx.org/licenses/MIT"}},oI={title:"Docker",slug:"docker",get svg(){return ti+"Docker"+si+this.path+ni},path:"M13.983 11.078h2.119a.186.186 0 00.186-.185V9.006a.186.186 0 00-.186-.186h-2.119a.185.185 0 00-.185.185v1.888c0 .102.083.185.185.185m-2.954-5.43h2.118a.186.186 0 00.186-.186V3.574a.186.186 0 00-.186-.185h-2.118a.185.185 0 00-.185.185v1.888c0 .102.082.185.185.185m0 2.716h2.118a.187.187 0 00.186-.186V6.29a.186.186 0 00-.186-.185h-2.118a.185.185 0 00-.185.185v1.887c0 .102.082.185.185.186m-2.93 0h2.12a.186.186 0 00.184-.186V6.29a.185.185 0 00-.185-.185H8.1a.185.185 0 00-.185.185v1.887c0 .102.083.185.185.186m-2.964 0h2.119a.186.186 0 00.185-.186V6.29a.185.185 0 00-.185-.185H5.136a.186.186 0 00-.186.185v1.887c0 .102.084.185.186.186m5.893 2.715h2.118a.186.186 0 00.186-.185V9.006a.186.186 0 00-.186-.186h-2.118a.185.185 0 00-.185.185v1.888c0 .102.082.185.185.185m-2.93 0h2.12a.185.185 0 00.184-.185V9.006a.185.185 0 00-.184-.186h-2.12a.185.185 0 00-.184.185v1.888c0 .102.083.185.185.185m-2.964 0h2.119a.185.185 0 00.185-.185V9.006a.185.185 0 00-.184-.186h-2.12a.186.186 0 00-.186.186v1.887c0 .102.084.185.186.185m-2.92 0h2.12a.185.185 0 00.184-.185V9.006a.185.185 0 00-.184-.186h-2.12a.185.185 0 00-.184.185v1.888c0 .102.082.185.185.185M23.763 9.89c-.065-.051-.672-.51-1.954-.51-.338.001-.676.03-1.01.087-.248-1.7-1.653-2.53-1.716-2.566l-.344-.199-.226.327c-.284.438-.49.922-.612 1.43-.23.97-.09 1.882.403 2.661-.595.332-1.55.413-1.744.42H.751a.751.751 0 00-.75.748 11.376 11.376 0 00.692 4.062c.545 1.428 1.355 2.48 2.41 3.124 1.18.723 3.1 1.137 5.275 1.137.983.003 1.963-.086 2.93-.266a12.248 12.248 0 003.823-1.389c.98-.567 1.86-1.288 2.61-2.136 1.252-1.418 1.998-2.997 2.553-4.4h.221c1.372 0 2.215-.549 2.68-1.009.309-.293.55-.65.707-1.046l.098-.288Z",source:"https://www.docker.com/company/newsroom/media-resources",hex:"2496ED"},lI={title:"Go",slug:"go",get svg(){return ti+"Go"+si+this.path+ni},path:"M1.811 10.231c-.047 0-.058-.023-.035-.059l.246-.315c.023-.035.081-.058.128-.058h4.172c.046 0 .058.035.035.07l-.199.303c-.023.036-.082.07-.117.07zM.047 11.306c-.047 0-.059-.023-.035-.058l.245-.316c.023-.035.082-.058.129-.058h5.328c.047 0 .07.035.058.07l-.093.28c-.012.047-.058.07-.105.07zm2.828 1.075c-.047 0-.059-.035-.035-.07l.163-.292c.023-.035.07-.07.117-.07h2.337c.047 0 .07.035.07.082l-.023.28c0 .047-.047.082-.082.082zm12.129-2.36c-.736.187-1.239.327-1.963.514-.176.046-.187.058-.34-.117-.174-.199-.303-.327-.548-.444-.737-.362-1.45-.257-2.115.175-.795.514-1.204 1.274-1.192 2.22.011.935.654 1.706 1.577 1.835.795.105 1.46-.175 1.987-.77.105-.13.198-.27.315-.434H10.47c-.245 0-.304-.152-.222-.35.152-.362.432-.97.596-1.274a.315.315 0 01.292-.187h4.253c-.023.316-.023.631-.07.947a4.983 4.983 0 01-.958 2.29c-.841 1.11-1.94 1.8-3.33 1.986-1.145.152-2.209-.07-3.143-.77-.865-.655-1.356-1.52-1.484-2.595-.152-1.274.222-2.419.993-3.424.83-1.086 1.928-1.776 3.272-2.02 1.098-.2 2.15-.07 3.096.571.62.41 1.063.97 1.356 1.648.07.105.023.164-.117.2m3.868 6.461c-1.064-.024-2.034-.328-2.852-1.029a3.665 3.665 0 01-1.262-2.255c-.21-1.32.152-2.489.947-3.529.853-1.122 1.881-1.706 3.272-1.95 1.192-.21 2.314-.095 3.33.595.923.63 1.496 1.484 1.648 2.605.198 1.578-.257 2.863-1.344 3.962-.771.783-1.718 1.273-2.805 1.495-.315.06-.63.07-.934.106zm2.78-4.72c-.011-.153-.011-.27-.034-.387-.21-1.157-1.274-1.81-2.384-1.554-1.087.245-1.788.935-2.045 2.033-.21.912.234 1.835 1.075 2.21.643.28 1.285.244 1.905-.07.923-.48 1.425-1.228 1.484-2.233z",source:"https://blog.golang.org/go-brand",hex:"00ADD8",guidelines:"https://blog.golang.org/go-brand"},cI={title:"Node.js",slug:"nodedotjs",get svg(){return ti+"Node.js"+si+this.path+ni},path:"M11.998,24c-0.321,0-0.641-0.084-0.922-0.247l-2.936-1.737c-0.438-0.245-0.224-0.332-0.08-0.383 c0.585-0.203,0.703-0.25,1.328-0.604c0.065-0.037,0.151-0.023,0.218,0.017l2.256,1.339c0.082,0.045,0.197,0.045,0.272,0l8.795-5.076 c0.082-0.047,0.134-0.141,0.134-0.238V6.921c0-0.099-0.053-0.192-0.137-0.242l-8.791-5.072c-0.081-0.047-0.189-0.047-0.271,0 L3.075,6.68C2.99,6.729,2.936,6.825,2.936,6.921v10.15c0,0.097,0.054,0.189,0.139,0.235l2.409,1.392 c1.307,0.654,2.108-0.116,2.108-0.89V7.787c0-0.142,0.114-0.253,0.256-0.253h1.115c0.139,0,0.255,0.112,0.255,0.253v10.021 c0,1.745-0.95,2.745-2.604,2.745c-0.508,0-0.909,0-2.026-0.551L2.28,18.675c-0.57-0.329-0.922-0.945-0.922-1.604V6.921 c0-0.659,0.353-1.275,0.922-1.603l8.795-5.082c0.557-0.315,1.296-0.315,1.848,0l8.794,5.082c0.57,0.329,0.924,0.944,0.924,1.603 v10.15c0,0.659-0.354,1.273-0.924,1.604l-8.794,5.078C12.643,23.916,12.324,24,11.998,24z M19.099,13.993 c0-1.9-1.284-2.406-3.987-2.763c-2.731-0.361-3.009-0.548-3.009-1.187c0-0.528,0.235-1.233,2.258-1.233 c1.807,0,2.473,0.389,2.747,1.607c0.024,0.115,0.129,0.199,0.247,0.199h1.141c0.071,0,0.138-0.031,0.186-0.081 c0.048-0.054,0.074-0.123,0.067-0.196c-0.177-2.098-1.571-3.076-4.388-3.076c-2.508,0-4.004,1.058-4.004,2.833 c0,1.925,1.488,2.457,3.895,2.695c2.88,0.282,3.103,0.703,3.103,1.269c0,0.983-0.789,1.402-2.642,1.402 c-2.327,0-2.839-0.584-3.011-1.742c-0.02-0.124-0.126-0.215-0.253-0.215h-1.137c-0.141,0-0.254,0.112-0.254,0.253 c0,1.482,0.806,3.248,4.655,3.248C17.501,17.007,19.099,15.91,19.099,13.993z",source:"https://nodejs.org/en/about/branding",hex:"5FA04E",guidelines:"https://nodejs.org/en/about/branding"},uI={title:"npm",slug:"npm",get svg(){return ti+"npm"+si+this.path+ni},path:"M1.763 0C.786 0 0 .786 0 1.763v20.474C0 23.214.786 24 1.763 24h20.474c.977 0 1.763-.786 1.763-1.763V1.763C24 .786 23.214 0 22.237 0zM5.13 5.323l13.837.019-.009 13.836h-3.464l.01-10.382h-3.456L12.04 19.17H5.113z",source:"https://www.npmjs.com",hex:"CB3837",guidelines:"https://docs.npmjs.com/policies/logos-and-usage"},dI={title:"pnpm",slug:"pnpm",get svg(){return ti+"pnpm"+si+this.path+ni},path:"M0 0v7.5h7.5V0zm8.25 0v7.5h7.498V0zm8.25 0v7.5H24V0zM2 2h3.5v3.5H2zm8.25 0h3.498v3.5H10.25zm8.25 0H22v3.5h-3.5zM8.25 8.25v7.5h7.498v-7.5zm8.25 0v7.5H24v-7.5zm2 2H22v3.5h-3.5zM0 16.5V24h7.5v-7.5zm8.25 0V24h7.498v-7.5zm8.25 0V24H24v-7.5z",source:"https://pnpm.io/logos",hex:"F69220"},hI={title:"Python",slug:"python",get svg(){return ti+"Python"+si+this.path+ni},path:"M14.25.18l.9.2.73.26.59.3.45.32.34.34.25.34.16.33.1.3.04.26.02.2-.01.13V8.5l-.05.63-.13.55-.21.46-.26.38-.3.31-.33.25-.35.19-.35.14-.33.1-.3.07-.26.04-.21.02H8.77l-.69.05-.59.14-.5.22-.41.27-.33.32-.27.35-.2.36-.15.37-.1.35-.07.32-.04.27-.02.21v3.06H3.17l-.21-.03-.28-.07-.32-.12-.35-.18-.36-.26-.36-.36-.35-.46-.32-.59-.28-.73-.21-.88-.14-1.05-.05-1.23.06-1.22.16-1.04.24-.87.32-.71.36-.57.4-.44.42-.33.42-.24.4-.16.36-.1.32-.05.24-.01h.16l.06.01h8.16v-.83H6.18l-.01-2.75-.02-.37.05-.34.11-.31.17-.28.25-.26.31-.23.38-.2.44-.18.51-.15.58-.12.64-.1.71-.06.77-.04.84-.02 1.27.05zm-6.3 1.98l-.23.33-.08.41.08.41.23.34.33.22.41.09.41-.09.33-.22.23-.34.08-.41-.08-.41-.23-.33-.33-.22-.41-.09-.41.09zm13.09 3.95l.28.06.32.12.35.18.36.27.36.35.35.47.32.59.28.73.21.88.14 1.04.05 1.23-.06 1.23-.16 1.04-.24.86-.32.71-.36.57-.4.45-.42.33-.42.24-.4.16-.36.09-.32.05-.24.02-.16-.01h-8.22v.82h5.84l.01 2.76.02.36-.05.34-.11.31-.17.29-.25.25-.31.24-.38.2-.44.17-.51.15-.58.13-.64.09-.71.07-.77.04-.84.01-1.27-.04-1.07-.14-.9-.2-.73-.25-.59-.3-.45-.33-.34-.34-.25-.34-.16-.33-.1-.3-.04-.25-.02-.2.01-.13v-5.34l.05-.64.13-.54.21-.46.26-.38.3-.32.33-.24.35-.2.35-.14.33-.1.3-.06.26-.04.21-.02.13-.01h5.84l.69-.05.59-.14.5-.21.41-.28.33-.32.27-.35.2-.36.15-.36.1-.35.07-.32.04-.28.02-.21V6.07h2.09l.14.01zm-6.47 14.25l-.23.33-.08.41.08.41.23.33.33.23.41.08.41-.08.33-.23.23-.33.08-.41-.08-.41-.23-.33-.33-.23-.41-.08-.41.08z",source:"https://www.python.org/community/logos/",hex:"3776AB",guidelines:"https://www.python.org/community/logos/"},zw={title:"Rust",slug:"rust",get svg(){return ti+"Rust"+si+this.path+ni},path:"M23.8346 11.7033l-1.0073-.6236a13.7268 13.7268 0 00-.0283-.2936l.8656-.8069a.3483.3483 0 00-.1154-.578l-1.1066-.414a8.4958 8.4958 0 00-.087-.2856l.6904-.9587a.3462.3462 0 00-.2257-.5446l-1.1663-.1894a9.3574 9.3574 0 00-.1407-.2622l.49-1.0761a.3437.3437 0 00-.0274-.3361.3486.3486 0 00-.3006-.154l-1.1845.0416a6.7444 6.7444 0 00-.1873-.2268l.2723-1.153a.3472.3472 0 00-.417-.4172l-1.1532.2724a14.0183 14.0183 0 00-.2278-.1873l.0415-1.1845a.3442.3442 0 00-.49-.328l-1.076.491c-.0872-.0476-.1742-.0952-.2623-.1407l-.1903-1.1673A.3483.3483 0 0016.256.955l-.9597.6905a8.4867 8.4867 0 00-.2855-.086l-.414-1.1066a.3483.3483 0 00-.5781-.1154l-.8069.8666a9.2936 9.2936 0 00-.2936-.0284L12.2946.1683a.3462.3462 0 00-.5892 0l-.6236 1.0073a13.7383 13.7383 0 00-.2936.0284L9.9803.3374a.3462.3462 0 00-.578.1154l-.4141 1.1065c-.0962.0274-.1903.0567-.2855.086L7.744.955a.3483.3483 0 00-.5447.2258L7.009 2.348a9.3574 9.3574 0 00-.2622.1407l-1.0762-.491a.3462.3462 0 00-.49.328l.0416 1.1845a7.9826 7.9826 0 00-.2278.1873L3.8413 3.425a.3472.3472 0 00-.4171.4171l.2713 1.1531c-.0628.075-.1255.1509-.1863.2268l-1.1845-.0415a.3462.3462 0 00-.328.49l.491 1.0761a9.167 9.167 0 00-.1407.2622l-1.1662.1894a.3483.3483 0 00-.2258.5446l.6904.9587a13.303 13.303 0 00-.087.2855l-1.1065.414a.3483.3483 0 00-.1155.5781l.8656.807a9.2936 9.2936 0 00-.0283.2935l-1.0073.6236a.3442.3442 0 000 .5892l1.0073.6236c.008.0982.0182.1964.0283.2936l-.8656.8079a.3462.3462 0 00.1155.578l1.1065.4141c.0273.0962.0567.1914.087.2855l-.6904.9587a.3452.3452 0 00.2268.5447l1.1662.1893c.0456.088.0922.1751.1408.2622l-.491 1.0762a.3462.3462 0 00.328.49l1.1834-.0415c.0618.0769.1235.1528.1873.2277l-.2713 1.1541a.3462.3462 0 00.4171.4161l1.153-.2713c.075.0638.151.1255.2279.1863l-.0415 1.1845a.3442.3442 0 00.49.327l1.0761-.49c.087.0486.1741.0951.2622.1407l.1903 1.1662a.3483.3483 0 00.5447.2268l.9587-.6904a9.299 9.299 0 00.2855.087l.414 1.1066a.3452.3452 0 00.5781.1154l.8079-.8656c.0972.0111.1954.0203.2936.0294l.6236 1.0073a.3472.3472 0 00.5892 0l.6236-1.0073c.0982-.0091.1964-.0183.2936-.0294l.8069.8656a.3483.3483 0 00.578-.1154l.4141-1.1066a8.4626 8.4626 0 00.2855-.087l.9587.6904a.3452.3452 0 00.5447-.2268l.1903-1.1662c.088-.0456.1751-.0931.2622-.1407l1.0762.49a.3472.3472 0 00.49-.327l-.0415-1.1845a6.7267 6.7267 0 00.2267-.1863l1.1531.2713a.3472.3472 0 00.4171-.416l-.2713-1.1542c.0628-.0749.1255-.1508.1863-.2278l1.1845.0415a.3442.3442 0 00.328-.49l-.49-1.076c.0475-.0872.0951-.1742.1407-.2623l1.1662-.1893a.3483.3483 0 00.2258-.5447l-.6904-.9587.087-.2855 1.1066-.414a.3462.3462 0 00.1154-.5781l-.8656-.8079c.0101-.0972.0202-.1954.0283-.2936l1.0073-.6236a.3442.3442 0 000-.5892zm-6.7413 8.3551a.7138.7138 0 01.2986-1.396.714.714 0 11-.2997 1.396zm-.3422-2.3142a.649.649 0 00-.7715.5l-.3573 1.6685c-1.1035.501-2.3285.7795-3.6193.7795a8.7368 8.7368 0 01-3.6951-.814l-.3574-1.6684a.648.648 0 00-.7714-.499l-1.473.3158a8.7216 8.7216 0 01-.7613-.898h7.1676c.081 0 .1356-.0141.1356-.088v-2.536c0-.074-.0536-.0881-.1356-.0881h-2.0966v-1.6077h2.2677c.2065 0 1.1065.0587 1.394 1.2088.0901.3533.2875 1.5044.4232 1.8729.1346.413.6833 1.2381 1.2685 1.2381h3.5716a.7492.7492 0 00.1296-.0131 8.7874 8.7874 0 01-.8119.9526zM6.8369 20.024a.714.714 0 11-.2997-1.396.714.714 0 01.2997 1.396zM4.1177 8.9972a.7137.7137 0 11-1.304.5791.7137.7137 0 011.304-.579zm-.8352 1.9813l1.5347-.6824a.65.65 0 00.33-.8585l-.3158-.7147h1.2432v5.6025H3.5669a8.7753 8.7753 0 01-.2834-3.348zm6.7343-.5437V8.7836h2.9601c.153 0 1.0792.1772 1.0792.8697 0 .575-.7107.7815-1.2948.7815zm10.7574 1.4862c0 .2187-.008.4363-.0243.651h-.9c-.09 0-.1265.0586-.1265.1477v.413c0 .973-.5487 1.1846-1.0296 1.2382-.4576.0517-.9648-.1913-1.0275-.4717-.2704-1.5186-.7198-1.8436-1.4305-2.4034.8817-.5599 1.799-1.386 1.799-2.4915 0-1.1936-.819-1.9458-1.3769-2.3153-.7825-.5163-1.6491-.6195-1.883-.6195H5.4682a8.7651 8.7651 0 014.907-2.7699l1.0974 1.151a.648.648 0 00.9182.0213l1.227-1.1743a8.7753 8.7753 0 016.0044 4.2762l-.8403 1.8982a.652.652 0 00.33.8585l1.6178.7188c.0283.2875.0425.577.0425.8717zm-9.3006-9.5993a.7128.7128 0 11.984 1.0316.7137.7137 0 01-.984-1.0316zm8.3389 6.71a.7107.7107 0 01.9395-.3625.7137.7137 0 11-.9405.3635z",source:"https://www.rust-lang.org",hex:"000000",guidelines:"https://www.rust-lang.org/policies/media-guide",license:{type:"CC-BY-SA-4.0",url:"https://spdx.org/licenses/CC-BY-SA-4.0"}},fI={title:"Vite",slug:"vite",get svg(){return ti+"Vite"+si+this.path+ni},path:"M13.056 23.238a.57.57 0 0 1-1.02-.355v-5.202c0-.63-.512-1.143-1.144-1.143H5.148a.57.57 0 0 1-.464-.903l3.777-5.29c.54-.753 0-1.804-.93-1.804H.57a.574.574 0 0 1-.543-.746.6.6 0 0 1 .08-.157L5.008.78a.57.57 0 0 1 .467-.24h14.589a.57.57 0 0 1 .466.903l-3.778 5.29c-.54.755 0 1.806.93 1.806h5.745c.238 0 .424.138.513.322a.56.56 0 0 1-.063.603z",source:"https://github.com/voidzero-dev/community-design-resources/blob/55902097229cf01cf2a4ceb376f992f5cf306756/brand-assets/vite/vite-icon-color-bracketless.svg",hex:"9135FF"},mI={title:"Yarn",slug:"yarn",get svg(){return ti+"Yarn"+si+this.path+ni},path:"M12 0C5.375 0 0 5.375 0 12s5.375 12 12 12 12-5.375 12-12S18.625 0 12 0zm.768 4.105c.183 0 .363.053.525.157.125.083.287.185.755 1.154.31-.088.468-.042.551-.019.204.056.366.19.463.375.477.917.542 2.553.334 3.605-.241 1.232-.755 2.029-1.131 2.576.324.329.778.899 1.117 1.825.278.774.31 1.478.273 2.015a5.51 5.51 0 0 0 .602-.329c.593-.366 1.487-.917 2.553-.931.714-.009 1.269.445 1.353 1.103a1.23 1.23 0 0 1-.945 1.362c-.649.158-.95.278-1.821.843-1.232.797-2.539 1.242-3.012 1.39a1.686 1.686 0 0 1-.704.343c-.737.181-3.266.315-3.466.315h-.046c-.783 0-1.214-.241-1.45-.491-.658.329-1.51.19-2.122-.134a1.078 1.078 0 0 1-.58-1.153 1.243 1.243 0 0 1-.153-.195c-.162-.25-.528-.936-.454-1.946.056-.723.556-1.367.88-1.71a5.522 5.522 0 0 1 .408-2.256c.306-.727.885-1.348 1.32-1.737-.32-.537-.644-1.367-.329-2.21.227-.602.412-.936.82-1.08h-.005c.199-.074.389-.153.486-.259a3.418 3.418 0 0 1 2.298-1.103c.037-.093.079-.185.125-.283.31-.658.639-1.029 1.024-1.168a.94.94 0 0 1 .328-.06zm.006.7c-.507.016-1.001 1.519-1.001 1.519s-1.27-.204-2.266.871c-.199.218-.468.334-.746.44-.079.028-.176.023-.417.672-.371.991.625 2.094.625 2.094s-1.186.839-1.626 1.881c-.486 1.144-.338 2.261-.338 2.261s-.843.732-.899 1.487c-.051.663.139 1.2.343 1.515.227.343.51.176.51.176s-.561.653-.037.931c.477.25 1.283.394 1.71-.037.31-.31.371-1.001.486-1.283.028-.065.12.111.209.199.097.093.264.195.264.195s-.755.324-.445 1.066c.102.246.468.403 1.066.398.222-.005 2.664-.139 3.313-.296.375-.088.505-.283.505-.283s1.566-.431 2.998-1.357c.917-.598 1.293-.76 2.034-.936.612-.148.57-1.098-.241-1.084-.839.009-1.575.44-2.196.825-1.163.718-1.742.672-1.742.672l-.018-.032c-.079-.13.371-1.293-.134-2.678-.547-1.515-1.413-1.881-1.344-1.997.297-.5 1.038-1.297 1.334-2.78.176-.899.13-2.377-.269-3.151-.074-.144-.732.241-.732.241s-.616-1.371-.788-1.483a.271.271 0 0 0-.157-.046z",source:"https://github.com/yarnpkg/assets/blob/76d30ca2aebed5b73ea8131d972218fb860bd32d/yarn-kitten-circle.svg",hex:"2C8EBB",guidelines:"https://github.com/yarnpkg/assets/tree/76d30ca2aebed5b73ea8131d972218fb860bd32d",license:{type:"CC-BY-4.0",url:"https://spdx.org/licenses/CC-BY-4.0"}};function pI(e){const t=e.toLowerCase();return/\bvite\b/.test(t)?mn.vite:/\bcargo\s+/.test(t)?mn.cargo:/\brustc\b/.test(t)?mn.rust:/\bdotnet\b/.test(t)?mn.dotnet:/\bdocker(?:\s+compose|-compose|\s+)/.test(t)?mn.docker:/\bpython3?\b|\buvicorn\b|\bfastapi\b/.test(t)?mn.python:/\bgo\s+(run|test|build)\b|\bair\b/.test(t)?mn.go:/\bbun\b/.test(t)?mn.bun:/\bdeno\b/.test(t)?mn.deno:/\bpnpm\b/.test(t)?mn.pnpm:/\byarn\b/.test(t)?mn.yarn:/\bnpm\b/.test(t)?mn.npm:/\bnode\b/.test(t)?mn.node:mn.generic}const mn={bun:{kind:"bun",label:"Bun"},cargo:{kind:"cargo",label:"Cargo"},deno:{kind:"deno",label:"Deno"},dotnet:{kind:"dotnet",label:".NET"},docker:{kind:"docker",label:"Docker"},generic:{kind:"generic",label:"Process"},go:{kind:"go",label:"Go"},node:{kind:"node",label:"Node"},npm:{kind:"npm",label:"npm"},pnpm:{kind:"pnpm",label:"pnpm"},python:{kind:"python",label:"Python"},rust:{kind:"rust",label:"Rust"},vite:{kind:"vite",label:"Vite"},yarn:{kind:"yarn",label:"Yarn"}};function Ex({command:e,compact:t}){const s=pI(e),n=gI[s.kind];return r.jsx("span",{"aria-label":`${s.label} process`,className:ie("inline-flex shrink-0 items-center justify-center rounded-md border bg-card shadow-sm dark:border-zinc-700/80 dark:bg-zinc-100",t?"size-6":"size-7",n?"border-border":"border-border bg-muted text-muted-foreground dark:bg-zinc-100 dark:text-zinc-700"),style:n?{color:`#${n.hex}`}:void 0,title:s.label,children:n?r.jsx("svg",{"aria-hidden":"true",className:t?"size-3.5":"size-4",fill:"currentColor",role:"img",viewBox:"0 0 24 24",children:r.jsx("path",{d:n.path})}):r.jsx(pl,{className:t?"size-3.5":"size-4"})})}const gI={bun:rI,cargo:zw,deno:aI,dotnet:iI,docker:oI,generic:null,go:lI,node:cI,npm:uI,pnpm:dI,python:hI,rust:zw,vite:fI,yarn:mI};function qn({className:e,...t}){return r.jsx("label",{className:ie("grid gap-1.5 text-xs font-medium text-muted-foreground",e),...t})}const bI=[{label:"npm",command:"npm run dev",description:"Node dev server"},{label:"pnpm",command:"pnpm dev",description:"pnpm dev server"},{label:"yarn",command:"yarn dev",description:"Yarn dev server"},{label:"bun",command:"bun dev",description:"Bun dev server"},{label:"Deno",command:"deno task dev",description:"Deno dev task"},{label:"Vite",badgeCommand:"vite",command:"npm run dev -- --host 127.0.0.1",description:"Vite app"},{label:"Go",command:"go run .",description:"Go app"},{label:"Rust",command:"cargo run",description:"Rust app"},{label:".NET",command:"dotnet watch run",description:".NET app"},{label:"Python",command:"python manage.py runserver",description:"Python app"},{label:"Docker",command:"docker compose up",description:"Docker Compose stack"}],Bw=[{value:"local",label:"Local",hint:"Run a command in a local working directory."},{value:"docker-compose",label:"Docker Compose",hint:"Bring up a service defined in a docker-compose.yml file."},{value:"ssh",label:"SSH (remote)",hint:"Run a command on a remote host using your local ~/.ssh/config + ssh-agent."}];function xI({result:e}){const t=[...e.stdout,...e.stderr].slice(0,4);return r.jsxs($e,{variant:e.ok?"default":"destructive",children:[r.jsx("div",{className:"font-medium",children:e.ok?"Command test passed":"Command test failed"}),r.jsx("div",{className:"mt-1 text-xs",children:e.message}),t.length?r.jsx("pre",{className:"mt-2 max-h-24 overflow-auto rounded-md bg-background/80 p-2 font-mono text-[11px] leading-4",children:t.join(`
81
+ `)}):null]})}function jx({active:e,baseUrl:t,compact:s=!1,onRefresh:n,onStarted:o,restartAction:l,solidStart:u=!1,targetLabel:h}){return e?r.jsxs(r.Fragment,{children:[r.jsx(og,{compact:s,intent:"restart",icon:r.jsx(fu,{}),label:"Restart",action:l,targetLabel:h,url:`${t}/restart`,onRefresh:n,onSuccess:o}),r.jsx(og,{compact:s,intent:"stop",icon:r.jsx(cl,{}),label:"Stop",targetLabel:h,url:`${t}/stop`,onRefresh:n})]}):r.jsx(og,{compact:s,intent:u?"startSolid":"start",icon:r.jsx(vr,{}),label:"Start",targetLabel:h,url:`${t}/start`,onRefresh:n,onSuccess:o})}function Vh(e,t,s){const n=s instanceof Error?s.message:String(s);return`${e} failed for ${t}: ${n}`}function og({action:e,compact:t=!1,intent:s="neutral",icon:n,label:o,targetLabel:l,url:u,onRefresh:h,onSuccess:m}){const[d,p]=y.useState(!1),[g,x]=y.useState(null),{error:_,success:S}=Es();async function w(C={}){p(!0);try{e?await e():await en(u,C),S(`${o} requested for ${l}.`),await h(),x(null),m?.()}catch(T){T instanceof ZN?x(T.conflict):_(Vh(o,l,T))}finally{p(!1)}}const k=r.jsxs(Y,{"aria-label":o,className:`${_I[s]} ${t?"size-7":""}`.trim(),disabled:d,onClick:()=>w(),size:t?"icon":"sm",variant:"outline",children:[n,t?null:o]});return r.jsxs(r.Fragment,{children:[t?r.jsx(al,{label:o,children:k}):k,g?r.jsx(vI,{busy:d,conflict:g,onCancel:()=>x(null),onKillAndStart:()=>w({strategy:"killHolder"}),targetLabel:l}):null]})}function vI({busy:e,conflict:t,onCancel:s,onKillAndStart:n,targetLabel:o}){const l=t.holder,u=`http://localhost:${t.port}/`;return r.jsx(Qn,{icon:r.jsx(m6,{}),onClose:e?()=>{}:s,title:`Port ${t.port} is already in use`,children:r.jsxs("div",{className:"space-y-3 p-4 text-sm",children:[r.jsxs("p",{children:[r.jsx("span",{className:"font-medium",children:o})," wants port"," ",r.jsx("span",{className:"font-mono",children:t.port}),", but it's already held by:"]}),r.jsx("pre",{className:"overflow-auto whitespace-pre-wrap rounded border border-border bg-background p-3 font-mono text-xs",children:l?`pid ${l.pid}${l.pgid?` (pgid ${l.pgid})`:""}
82
+ ${l.command}`:"unknown process"}),r.jsxs("div",{className:"flex flex-wrap justify-end gap-2 pt-2",children:[r.jsx(Y,{onClick:s,size:"sm",type:"button",variant:"outline",disabled:e,children:"Cancel"}),r.jsxs(Y,{onClick:()=>window.open(u,"_blank","noopener,noreferrer"),size:"sm",type:"button",variant:"outline",disabled:e,children:[r.jsx(br,{}),"Open in browser"]}),r.jsx(Y,{className:"border-red-600 bg-red-600 text-white hover:bg-red-700",disabled:e||!l,onClick:n,size:"sm",type:"button",children:"Stop holder & start"})]})]})})}const _I={neutral:"",restart:"border-amber-600 bg-amber-600 text-white hover:bg-amber-700",start:"",startSolid:"border-emerald-600 bg-emerald-600 text-white hover:bg-emerald-700",stop:"border-red-600 bg-red-600 text-white hover:bg-red-700"};function yI({cwd:e,onRefresh:t,onSaved:s,initialService:n}){const{error:o,success:l}=Es(),u=!!n,[h,m]=y.useState(n?.kind??"local"),[d,p]=y.useState(n?.name??""),[g,x]=y.useState(n?.command??""),[_,S]=y.useState(n?.cwd??e),[w,k]=y.useState(n?.port?String(n.port):""),[C,T]=y.useState(n?.description??""),[E,j]=y.useState(n?.composeFile??""),[M,z]=y.useState(n?.composeService??""),[O,A]=y.useState(n?.host??""),[D,B]=y.useState(null),[P,H]=y.useState(!1);y.useEffect(()=>{B(null)},[g,_,w,h]);function $(){p(""),x(""),S(e),k(""),T(""),j(""),z(""),A(""),B(null)}async function q(I){I.preventDefault();try{const W={name:d,kind:h,cwd:_,port:w,description:C};(h==="local"||h==="ssh")&&(W.command=g),h==="docker-compose"&&(W.composeFile=E,W.composeService=M),h==="ssh"&&(W.host=O),await en("/api/services",W),u||$(),l(u?`${d} updated.`:`${d} added.`),await t(),s?.()}catch(W){o(Vh(u?"Update service":"Add service",d||"service",W))}}async function V(){if(!g.trim()){o("Test command failed for service: command is required.");return}H(!0);try{B(await x8({command:g,cwd:_,port:w}))}catch(I){o(Vh("Test command",d||"service",I))}finally{H(!1)}}return{editing:u,kind:h,setKind:m,name:d,setName:p,command:g,setCommand:x,formCwd:_,setFormCwd:S,port:w,setPort:k,description:C,setDescription:T,composeFile:E,setComposeFile:j,composeService:M,setComposeService:z,host:O,setHost:A,testResult:D,testing:P,submit:q,testCommand:V}}function Iw({cwd:e,onRefresh:t,onSaved:s,initialService:n}){const{editing:o,kind:l,setKind:u,name:h,setName:m,command:d,setCommand:p,formCwd:g,setFormCwd:x,port:_,setPort:S,description:w,setDescription:k,composeFile:C,setComposeFile:T,composeService:E,setComposeService:j,host:M,setHost:z,testResult:O,testing:A,submit:D,testCommand:B}=yI({cwd:e,onRefresh:t,onSaved:s,initialService:n}),P=Bw.find(V=>V.value===l),H=l==="local"&&d.trim().length>0&&g.trim().length>0,$="grid gap-2 rounded-md border border-border bg-muted/30 p-3",q="px-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground";return r.jsxs("form",{className:"grid gap-3",onSubmit:D,children:[r.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[r.jsxs("fieldset",{className:`${$} sm:col-span-2`,children:[r.jsx("legend",{className:q,children:"Step 1 · Service kind"}),r.jsx("div",{className:"grid grid-cols-3 gap-1.5",children:Bw.map(V=>r.jsx(Y,{className:"justify-center",disabled:o,onClick:()=>u(V.value),size:"sm",type:"button",variant:l===V.value?"default":"outline",children:V.label},V.value))}),r.jsx("p",{className:"text-[11px] text-muted-foreground",children:P.hint})]}),r.jsxs("div",{className:"grid gap-3 sm:col-start-1 sm:row-start-2 sm:self-start",children:[r.jsxs("fieldset",{className:$,children:[r.jsx("legend",{className:q,children:"Step 2 · Identity"}),r.jsxs(qn,{children:["Name",r.jsx(tt,{className:"h-8 text-sm",name:"name",onChange:V=>m(V.target.value),placeholder:"backend",readOnly:o,required:!0,value:h}),o?r.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Name is the service key and can't be changed here."}):null]}),r.jsxs(qn,{children:["Description",r.jsx(tt,{className:"h-8 text-sm",name:"description",onChange:V=>k(V.target.value),placeholder:"API server",value:w})]})]}),r.jsxs("fieldset",{className:$,children:[r.jsx("legend",{className:q,children:"Step 4 · Networking (optional)"}),r.jsxs(qn,{children:["Port",r.jsx(tt,{className:"h-8 text-sm",inputMode:"numeric",name:"port",onChange:V=>S(V.target.value),placeholder:"3001",value:_})]})]})]}),l==="local"?r.jsxs("fieldset",{className:`${$} sm:col-start-2 sm:row-start-2 sm:self-start`,children:[r.jsx("legend",{className:q,children:"Step 3 · Local command"}),r.jsx("div",{className:"grid grid-cols-2 gap-1.5 sm:grid-cols-4",children:bI.map(V=>r.jsxs(Y,{className:"justify-start gap-1.5",onClick:()=>{p(V.command),k(V.description)},size:"sm",type:"button",variant:"outline",children:[r.jsx(Ex,{command:V.badgeCommand??V.command,compact:!0}),r.jsx("span",{className:"truncate",children:V.label})]},V.label))}),r.jsxs(qn,{children:["Command",r.jsx(tt,{className:"h-8 font-mono text-sm",name:"command",onChange:V=>p(V.target.value),placeholder:"npm run dev",required:!0,value:d})]}),r.jsxs(qn,{children:["Working Directory",r.jsx(tt,{className:"h-8 font-mono text-sm",name:"cwd",onChange:V=>x(V.target.value),required:!0,value:g})]})]}):null,l==="docker-compose"?r.jsxs("fieldset",{className:`${$} sm:col-start-2 sm:row-start-2 sm:self-start`,children:[r.jsx("legend",{className:q,children:"Step 3 · Docker Compose target"}),r.jsxs(qn,{children:["Compose Service",r.jsx(tt,{className:"h-8 font-mono text-sm",name:"composeService",onChange:V=>j(V.target.value),placeholder:"api",required:!0,value:E})]}),r.jsxs(qn,{children:["Compose File (optional)",r.jsx(tt,{className:"h-8 font-mono text-sm",name:"composeFile",onChange:V=>T(V.target.value),placeholder:"docker-compose.yml",value:C})]}),r.jsxs(qn,{children:["Working Directory (where compose file lives)",r.jsx(tt,{className:"h-8 font-mono text-sm",name:"cwd",onChange:V=>x(V.target.value),required:!0,value:g})]})]}):null,l==="ssh"?r.jsxs("fieldset",{className:`${$} sm:col-start-2 sm:row-start-2 sm:self-start`,children:[r.jsx("legend",{className:q,children:"Step 3 · SSH connection"}),r.jsxs(qn,{children:["SSH Host (alias from ~/.ssh/config)",r.jsx(tt,{className:"h-8 font-mono text-sm",name:"host",onChange:V=>z(V.target.value),placeholder:"devbox",required:!0,value:M})]}),r.jsxs(qn,{children:["Remote Command",r.jsx(tt,{className:"h-8 font-mono text-sm",name:"command",onChange:V=>p(V.target.value),placeholder:"npm run dev",required:!0,value:d})]}),r.jsxs(qn,{children:["Remote Working Directory",r.jsx(tt,{className:"h-8 font-mono text-sm",name:"cwd",onChange:V=>x(V.target.value),placeholder:"/srv/app",required:!0,value:g})]}),r.jsxs($e,{variant:"muted",children:[r.jsx("div",{className:"font-medium",children:"SSH key handling"}),r.jsxs("div",{className:"mt-1 text-xs",children:["NoMoreIDE never stores key files. Add a ",r.jsxs("code",{children:["Host ",M||"&lt;alias&gt;"]})," entry to",r.jsx("code",{children:" ~/.ssh/config"})," with ",r.jsx("code",{children:"HostName"}),", ",r.jsx("code",{children:"User"}),", and"," ",r.jsx("code",{children:"IdentityFile ~/.ssh/your-key.pem"})," (chmod 0600). Make sure"," ",r.jsx("code",{children:"ssh-agent"})," is running or your key is loaded (",r.jsx("code",{children:"ssh-add ~/.ssh/your-key.pem"}),"). NoMoreIDE will run"," ",r.jsxs("code",{children:["ssh ",M||"&lt;alias&gt;"]})," using that config."]})]})]}):null]}),O?r.jsx(xI,{result:O}):null,r.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[l==="local"?r.jsxs(Y,{disabled:A||!H,onClick:B,type:"button",variant:"outline",children:[r.jsx(pl,{}),A?"Testing...":"Test Command"]}):null,r.jsx(Y,{type:"submit",children:o?"Save Service":"Add Service"})]})]})}function y3({initialName:e="",initialServices:t=[],onSaved:s,onRefresh:n,originalName:o,services:l,submitLabel:u="Save Group"}){const{error:h,success:m}=Es();async function d(p){p.preventDefault();const g=p.currentTarget,x=new FormData(g),_=String(x.get("name")??""),S=x.getAll("services").map(w=>String(w)).filter(Boolean);try{await en("/api/bundles",{name:_,originalName:o,services:S.join(",")}),g.reset(),m(`${_} group saved.`),await n(),s?.()}catch(w){h(Vh("Save group",_||"group",w))}}return r.jsxs("form",{className:"grid gap-2.5",onSubmit:d,children:[r.jsxs(qn,{children:["Group name",r.jsx(tt,{className:"h-8 text-sm",defaultValue:e,name:"name",placeholder:"full-stack",required:!0})]}),r.jsxs("fieldset",{className:"grid gap-1.5",children:[r.jsx("legend",{className:"text-xs font-medium",children:"Services"}),l.length?l.map(p=>r.jsxs("label",{className:"flex items-center gap-2 overflow-hidden rounded-md border border-border px-2.5 py-1.5 text-sm",children:[r.jsx("input",{className:"size-4 shrink-0 accent-primary",defaultChecked:t.includes(p.name),name:"services",type:"checkbox",value:p.name}),r.jsx(Ex,{command:p.command??"",compact:!0}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-sm font-medium",children:p.name}),r.jsx("span",{className:"block truncate font-mono text-[11px] text-muted-foreground",children:p.command??p.kind??""})]})]},p.name)):r.jsx($e,{variant:"muted",children:"All services are already grouped, or none registered."})]}),r.jsx(Y,{className:"h-8",disabled:!l.length,type:"submit",children:u})]})}function SI({allServices:e,group:t,onRefresh:s,ports:n,services:o,health:l,statuses:u,timeline:h,selectedService:m,onSelectService:d,onDropService:p}){const[g,x]=y.useState(!1),[_,S]=y.useState(!1),[w,k]=y.useState(!1),C=o.some(j=>Kc(u[j.name]?.state));function T(j){!p||!j.dataTransfer.types.includes(iu)||(j.preventDefault(),j.dataTransfer.dropEffect="copy",k(!0))}function E(j){if(!p)return;j.preventDefault(),k(!1);const M=j.dataTransfer.getData(iu);M&&p(M)}return r.jsxs("section",{className:ie("transition-colors",w&&"bg-primary/5 outline-dashed outline-2 -outline-offset-2 outline-primary/60"),onDragOver:T,onDragLeave:()=>k(!1),onDrop:E,children:[r.jsxs("div",{className:"flex items-center gap-1.5 bg-muted/35 px-3 py-1.5",children:[r.jsxs("button",{"aria-expanded":!_,className:"flex min-w-0 flex-1 cursor-pointer items-center gap-1.5 text-left",onClick:()=>S(j=>!j),type:"button",children:[r.jsx(Mn,{className:ie("size-3.5 shrink-0 text-muted-foreground transition-transform",_&&"-rotate-90")}),r.jsx("span",{className:"truncate text-sm font-medium",children:t.name}),t.services.length?r.jsx(ze,{size:"small",variant:"secondary",children:t.services.length}):null]}),r.jsx(al,{label:"Edit group",children:r.jsx(Y,{"aria-expanded":g,"aria-label":`Edit ${t.name}`,className:"size-7",onClick:()=>x(j=>!j),size:"icon",type:"button",variant:"ghost",children:r.jsx(ll,{})})}),r.jsx(jx,{active:C,baseUrl:`/api/bundles/${encodeURIComponent(t.name)}`,compact:!0,restartAction:async()=>{await en(`/api/bundles/${encodeURIComponent(t.name)}/stop`,{}),await en(`/api/bundles/${encodeURIComponent(t.name)}/start`,{})},solidStart:!0,targetLabel:`group ${t.name}`,onRefresh:s,onStarted:()=>{const j=o[0];j&&d(j.name)}})]}),g?r.jsx("div",{className:"border-t border-border bg-background/65 p-3",children:r.jsx(y3,{initialName:t.name,initialServices:t.services,onRefresh:s,onSaved:()=>x(!1),originalName:t.name,services:e,submitLabel:"Save Group"})}):null,_?null:r.jsx("div",{className:"divide-y divide-border border-t border-border bg-background/45",children:o.length?o.map(j=>r.jsx(S3,{service:j,status:u[j.name],health:l[j.name],ports:n,onRefresh:s,timeline:h,selected:m===j.name,onSelect:()=>d(j.name)},j.name)):r.jsx($e,{variant:"muted",className:"m-4",children:"This group does not match any registered services."})})]})}function S3({service:e,status:t,onRefresh:s,selected:n=!1,onSelect:o}){const l=t?.state??"stopped",u=Kc(l),[h,m]=y.useState(!1);return r.jsxs("div",{"aria-selected":n,draggable:!0,onDragStart:d=>{d.dataTransfer.setData(iu,e.name),e.cwd&&v3(d.dataTransfer,e.cwd),d.dataTransfer.effectAllowed="copyMove",m(!0)},onDragEnd:()=>m(!1),className:ie("group grid cursor-pointer grid-cols-[1.75rem_minmax(0,1fr)_auto_auto] items-center gap-2 border-l-2 px-3 py-1.5 transition-colors",h&&"opacity-50",n?"border-l-primary bg-primary/10":"border-l-transparent hover:bg-muted"),onClick:o,role:"option",children:[r.jsx(Ex,{command:e.command??""}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"truncate text-sm font-medium",children:e.name}),r.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[r.jsx(wI,{kind:e.kind}),e.port?r.jsxs("span",{children:[":",e.port]}):null]})]}),r.jsx(Tx,{state:l}),r.jsx("span",{className:"flex items-center gap-1",onClick:d=>d.stopPropagation(),children:r.jsx(jx,{active:u,baseUrl:`/api/services/${encodeURIComponent(e.name)}`,compact:!0,targetLabel:e.name,onRefresh:s,onStarted:o})})]})}const iu="application/x-nomoreide-service",Pw={local:{label:"local",className:"border-border bg-muted text-muted-foreground"},"docker-compose":{label:"docker",className:"border-sky-500/40 bg-sky-500/10 text-sky-700 dark:text-sky-300"},ssh:{label:"ssh",className:"border-violet-500/40 bg-violet-500/10 text-violet-700 dark:text-violet-300"}};function wI({kind:e}){const t=Pw[e??"local"]??Pw.local;return r.jsx("span",{className:ie("rounded border px-1 py-px text-[9px] font-semibold uppercase leading-none tracking-wide",t.className),children:t.label})}function Kc(e){return e==="running"||e==="starting"}function kI(e){return`http://127.0.0.1:${e}`}function Tx({state:e}){return r.jsx(ze,{variant:e==="running"?"success":e==="exited"?"danger":e==="starting"?"warning":"outline",className:ie(e==="running"&&"font-mono"),children:e})}function NI({data:e}){const[t,s]=y.useState(!1),[n,o]=y.useState(()=>Mw()),[l,u]=y.useState(""),[h,m]=y.useState([]),[d,p]=y.useState([]),[g,x]=y.useState(null),{sendToAgent:_}=At();y.useEffect(()=>{if(!t)return;let E=!0;return x(null),Promise.allSettled([JN(),tC(20)]).then(j=>{if(!E)return;const[M,z]=j;M.status==="fulfilled"&&m(M.value),z.status==="fulfilled"&&p(z.value),j.filter(A=>A.status==="rejected").length&&x("Some AI context could not be loaded. You can still send available context.")}),()=>{E=!1}},[t]);const S=y.useMemo(()=>CI(e),[e]),w=_B(n),k=y.useMemo(()=>n.serviceNames.length+n.databaseNames.length+n.errorIds.length+n.repositoryPaths.length,[n]);function C(E,j){o(M=>{const z=M[E],O=z.includes(j)?z.filter(A=>A!==j):[...z,j];return{...M,[E]:O}})}function T(){w&&(_({prompt:yB({dashboard:e,databases:h,incidents:d,note:l,selection:n}),source:{type:"workspace-context",label:"AI Diagnose"},label:SB({note:l,selection:n})}),s(!1),u(""),o(Mw()))}return r.jsxs(r.Fragment,{children:[r.jsxs("button",{"aria-label":"Open AI Diagnose",className:Hh(),onClick:()=>s(!0),title:"Open AI Diagnose",type:"button",children:[r.jsx("span",{className:Uh(),children:r.jsx(Tt,{className:"size-4"})}),r.jsx("span",{className:Fh(),children:"Diagnose"})]}),t?r.jsx(Qn,{icon:r.jsx(Tt,{}),onClose:()=>s(!1),size:"xl",title:"AI Diagnose",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium",children:"Pick the context the agent should inspect"}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Combine services, databases, incidents, and repositories into one focused prompt."})]}),r.jsxs(ze,{variant:k?"secondary":"outline",children:[k," selected"]})]}),g?r.jsx($e,{variant:"muted",children:g}):null,r.jsxs("div",{className:"grid min-h-0 gap-3 overflow-hidden lg:grid-cols-4",children:[r.jsx(Jd,{count:e.config.services.length,icon:r.jsx(GN,{}),title:"Services",children:r.jsx("div",{className:"grid gap-2",children:e.config.services.map(E=>{const j=n.serviceNames.includes(E.name),M=e.runtime.services[E.name],z=e.health[E.name];return r.jsxs(eh,{selected:j,onClick:()=>C("serviceNames",E.name),children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate font-semibold",children:E.name}),r.jsx("span",{className:"shrink-0",children:r.jsx(Tx,{state:M?.state??"stopped"})})]}),r.jsxs("span",{className:"mt-1 flex flex-wrap gap-1.5 text-[11px] text-muted-foreground",children:[E.kind?r.jsx("span",{children:E.kind}):null,E.port?r.jsxs("span",{children:[":",E.port]}):null,z?.status?r.jsx("span",{children:z.status}):null]})]},E.name)})})}),r.jsx(Jd,{count:h.length,icon:r.jsx(Zn,{}),title:"Databases",children:h.length?r.jsx("div",{className:"grid gap-2",children:h.map(E=>r.jsxs(eh,{selected:n.databaseNames.includes(E.name),onClick:()=>C("databaseNames",E.name),children:[r.jsx("span",{className:"truncate font-semibold",children:E.name}),r.jsx("span",{className:"mt-1 block truncate text-[11px] text-muted-foreground",children:E.engine})]},E.name))}):r.jsx($w,{text:"No database connections detected."})}),r.jsx(Jd,{count:d.length,icon:r.jsx(Ah,{}),title:"Error Inbox",children:d.length?r.jsx("div",{className:"grid gap-2",children:d.map(E=>r.jsxs(eh,{selected:n.errorIds.includes(E.id),onClick:()=>C("errorIds",E.id),children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate font-semibold",children:E.title}),r.jsx(ze,{appearance:"subtle",size:"small",variant:E.level==="error"?"danger":"secondary",children:E.level})]}),r.jsxs("span",{className:"mt-1 block min-w-0 truncate font-mono text-[11px] text-muted-foreground",children:[E.service," x",E.count]})]},E.id))}):r.jsx($w,{text:"No recent incidents."})}),r.jsx(Jd,{count:S.length,icon:r.jsx(sn,{}),title:"Git Repositories",children:r.jsx("div",{className:"grid gap-2",children:S.map(E=>{const j=n.repositoryPaths.includes(E.path),M=E.path===(e.git.selectedRepository?.path??e.git.cwd),z=M?e.git.status?.files.length??0:void 0;return r.jsxs(eh,{selected:j,onClick:()=>C("repositoryPaths",E.path),children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate font-semibold",children:E.name}),M?r.jsx(ze,{className:"shrink-0",size:"small",variant:"outline",children:"current"}):null]}),r.jsx("span",{className:"mt-1 block min-w-0 truncate font-mono text-[11px] text-muted-foreground",children:E.path}),z!==void 0?r.jsx("span",{className:"mt-1 block truncate text-[11px] text-muted-foreground",children:z?`${z} changed file${z===1?"":"s"}`:"No changed files"}):null]},E.path)})})})]}),r.jsxs("label",{className:"block space-y-2",children:[r.jsx("span",{className:"text-sm font-medium",children:"Extra context"}),r.jsx("textarea",{className:"min-h-24 w-full resize-y rounded-md border border-border bg-background px-3 py-2 text-sm outline-none transition-colors placeholder:text-muted-foreground focus:border-foreground/40 focus:ring-2 focus:ring-ring",onChange:E=>u(E.target.value),placeholder:"Example: checkout is failing after login, API exits when DB is selected...",value:l})]}),r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[r.jsx(Y,{onClick:()=>s(!1),type:"button",variant:"outline",children:"Cancel"}),r.jsxs(Y,{className:"gap-2",disabled:!w,onClick:T,type:"button",children:[r.jsx(IM,{className:"size-4"}),"Send"]})]})]})}):null]})}function Jd({children:e,count:t,icon:s,title:n}){return r.jsxs("section",{className:"flex max-h-[min(520px,calc(100vh-18rem))] min-h-0 min-w-0 flex-col space-y-2 rounded-md border border-border bg-background/45 p-3",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-sm font-semibold",children:[r.jsx("span",{className:"flex size-6 items-center justify-center rounded-md border border-border bg-background text-muted-foreground [&_svg]:size-3.5",children:s}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:n}),r.jsx(ze,{className:"shrink-0",size:"small",variant:"outline",children:t})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-auto pr-1",children:e})]})}function eh({children:e,onClick:t,selected:s}){return r.jsx("button",{"aria-pressed":s,className:ie("min-h-16 min-w-0 rounded-md border p-3 text-left text-sm transition-colors",s?"border-primary bg-primary/10 text-foreground":"border-border bg-background hover:border-foreground/30 hover:bg-muted/60"),onClick:t,type:"button",children:e})}function $w({text:e}){return r.jsx("div",{className:"rounded-md border border-dashed border-border bg-background/60 px-3 py-3 text-xs text-muted-foreground",children:e})}function CI(e){return e.config.gitRepositories.length?e.config.gitRepositories:e.git.selectedRepository?[e.git.selectedRepository]:[{name:e.git.cwd.split("/").pop()??"repository",path:e.git.cwd}]}function EI(e){const t=AI(e.capabilities);return t?`${e.prompt}
83
+
84
+ ${t}`:e.prompt}function jI({workflowName:e,step:t,status:s,error:n,previousOutput:o,output:l}){const u=["Debug this stuck NoMoreIDE workflow step.","",`Workflow: ${e}`,`Step: ${t.title}`,`Step id: ${t.id}`,`Kind: ${t.kind}`,`Status: ${s}`,"","Step instruction:",RI(t)];return n?.trim()&&u.push("","Runner error:",n.trim()),o?.trim()&&u.push("","Previous step output:",o.trim()),l?.trim()&&u.push("","This step output:",l.trim()),u.push("","Diagnose why the step is stuck, name the smallest safe next action, and tell me whether I should retry, edit the workflow, or stop."),u.join(`
85
+ `)}function TI({workflowName:e,error:t}){return["Recover this NoMoreIDE PR workflow from the default branch guard.","",`Workflow: ${e}`,t?.trim()?`Runner error: ${t.trim()}`:"","","The user approved reading the minimum file diffs needed by clicking the workflow recovery button.","First call `nomoreide_git_status` to see the changed files and current branch.","Inspect only the minimum needed with `nomoreide_git_diff` to understand the change.","Then recommend a concise branch name based on the changes.","Do not create the branch or ask the user to create it; the workflow panel will ask the user and run the branch creation.","Reply with a short rationale and this exact parseable line:","BRANCH_NAME: <branch-name>"].filter(Boolean).join(`
86
+ `)}function AI(e){if(!e)return"";const t=[th("Skills",e.skills),th("MCP servers",e.mcpServers),th("Plugins",e.plugins),th("Hooks/context",e.hooks)].filter(Boolean);return t.length?["Use these selected capabilities if they are available and relevant:",...t,"If a selected capability is unavailable, say so briefly and continue with the best fallback."].join(`
87
+ `):""}function th(e,t){const s=Array.from(new Set((t??[]).map(n=>n.trim()).filter(Boolean)));return s.length?`- ${e}: ${s.join(", ")}`:""}function RI(e){return e.kind==="agent"?e.prompt:e.kind==="gate"?`Gate: ${e.message}`:`Action: ${e.op}`}const Hw=/^[ \t>*_-]*WORKFLOW_STATUS:\s*(ok|blocked)\b[ \t]*[—–:-]?[ \t]*(.*)$/im,MI=/^[ \t>*_-]*BRANCH_NAME:\s*`?([A-Za-z0-9][A-Za-z0-9._/-]{0,127})`?\s*$/im,DI=/^[A-Za-z0-9][A-Za-z0-9._/-]{0,127}$/;function OI(e){const t=e.match(Hw);if(t){const s=t[1].toLowerCase()==="blocked",n=t[2]?.trim()||void 0;return{output:e.replace(Hw,"").trim(),blocked:s,reason:s?n:void 0}}return{output:e,blocked:LI(e)}}function LI(e){return/\bi can'?t\b|\bcannot\b|\bunable\b|\bnot able\b|\bwon'?t\b|\bwant me to\b|\bdid you mean\b|\bshould i\b|\bneed (?:you|your|more)\b|\binstead of merging\b/i.test(e)}function zI(e){const t=e.match(MI);if(t&&Uw(t[1]))return t[1];const s=e.match(/^#+\s*Recommended branch name\b([\s\S]*)$/im)?.[1]??e;for(const n of s.matchAll(/`([^`\s]+)`/g)){const o=n[1].trim();if(Uw(o))return o}return null}function Uw(e){return!(!DI.test(e)||e==="main"||e==="master"||e.includes("..")||e.endsWith(".")||e.endsWith("/"))}const BI="\n\nWhen you're finished, end your reply with a line that's exactly `WORKFLOW_STATUS: ok` if you completed this step, or `WORKFLOW_STATUS: blocked` followed by a short reason if you could NOT complete it or you need my input. The workflow runner reads this line.";function II(e){const{sendToAgent:t,streaming:s,turns:n}=At(),[o,l]=y.useState(null),u=y.useRef(n);y.useEffect(()=>{u.current=n},[n]);const h=y.useRef(o);y.useEffect(()=>{h.current=o},[o]);const m=y.useRef(!1),d=y.useRef(!1),p=y.useRef(null),g=y.useRef(null),x=y.useRef(!1);y.useEffect(()=>{if(s)x.current=!0;else if(x.current&&g.current){const A=g.current;g.current=null,A()}},[s]);const _=y.useCallback(()=>new Promise(A=>{p.current=A}),[]),S=y.useCallback(()=>new Promise(A=>{let D=!1;const B=()=>{D||(D=!0,clearTimeout(P),g.current=null,A())};g.current=B;const P=setTimeout(()=>{x.current||B()},8e3)}),[]),w=y.useCallback(async A=>{const D=await Hp();return A==="committed"?D.files.length===0:A==="pushed"?D.ahead===0:!0},[]),k=y.useCallback(async(A,D,B)=>{if(A.op==="assert-pr-branch"){UI(await Hp());return}if(A.op==="push"){await pf();return}if(A.op==="checkout-default-and-pull"){await B6();return}if(A.op==="commit"){const P=await Hp();if(!P.files.length)throw new Error("Nothing to commit — the working tree is clean.");const H=HI(P.files);H.length&&await Yb(H),await iC($I(B,D,P.files));return}throw new Error(`Unknown action: ${A.op}`)},[]),C=y.useCallback(async(A,D,B)=>{if(m.current)return;m.current=!0,d.current=!1;const P=B?.index??0,H=A.steps.map((I,W)=>B&&W<P?B.statuses[W]??"pending":"pending"),$=A.steps.map((I,W)=>B?.outputs[W]??""),q=(I,W,Z)=>{H[I]=W,l(K=>K&&{...K,index:I,statuses:[...H],outputs:[...$],...Z})};l({workflow:A,startedAt:B?.startedAt??Date.now(),index:P,statuses:[...H],outputs:[...$],error:null,outcome:"running"});const V=I=>{m.current=!1,l(W=>W&&{...W,outcome:I,endedAt:Date.now()})};for(let I=P;I<A.steps.length;I++){const W=A.steps[I];if(W.kind==="gate"){q(I,"waiting");const K=await _();if(p.current=null,K==="stop"){q(I,"skipped"),V("stopped");return}q(I,K==="skip"?"skipped":"done");continue}if(W.kind==="action"){q(I,"running");try{await k(W,I,$),q(I,"done"),e?.()}catch(K){if(W.op==="assert-pr-branch"){q(I,"blocked",{error:Fw(K)}),V("blocked");return}q(I,"failed",{error:Fw(K)}),V("failed");return}if(d.current)return V("stopped");continue}q(I,"running"),x.current=!1,t({prompt:EI(W)+BI,source:{type:"workflow",label:`${A.name}: ${W.title}`},mode:"send",label:W.title,autoApprove:D,background:!0,isolated:W.isolated}),await S(),e?.();const Z=OI(PI(u.current));if($[I]=Z.output||"(no reply — see the dock)",Z.blocked){q(I,"blocked",{error:Z.reason?`Paused — ${Z.reason} Fix it (Debug with AI in the dock if you like), then Resume workflow to retry this step.`:"Paused — this step needs your input. Fix it (Debug with AI in the dock if you like), then Resume workflow to retry this step."}),V("blocked");return}if(W.verify&&!await w(W.verify).catch(()=>!1)){q(I,"failed",{error:W.verify==="committed"?"Expected the working tree to be clean after this step, but it isn't. Stopping before the next step.":"Expected the branch to be pushed (no commits ahead), but it isn't. Stopping."}),V("failed");return}if(q(I,"done"),d.current)return V("stopped")}V("done")},[e,k,t,w,S,_]),T=y.useCallback((A,D=!1)=>C(A,D),[C]),E=y.useCallback((A=!1)=>{const D=h.current;!D||D.outcome==="running"||m.current||C(D.workflow,A,{index:D.index,statuses:D.statuses,outputs:D.outputs,startedAt:D.startedAt})},[C]),j=y.useCallback(()=>p.current?.("approve"),[]),M=y.useCallback(()=>p.current?.("skip"),[]),z=y.useCallback(()=>{d.current=!0,p.current?.("stop")},[]),O=y.useCallback(()=>{m.current||l(null)},[]);return{run:o,start:T,resume:E,approve:j,skip:M,stop:z,dismiss:O,isRunning:!!o&&o.outcome==="running"}}function Fw(e){return e instanceof Error?e.message:String(e)}function PI(e){for(let t=e.length-1;t>=0;t--)if(e[t].role==="assistant")return e[t].text.trim();return""}function $I(e,t,s){return e[t-1]?.trim()||qI(s)}function HI(e){return e.some(s=>s.index.trim()&&s.index!=="?")?[]:e.map(s=>s.path)}function UI(e){const t=e.branch.trim();if(!t)throw new Error("Create or switch to a feature branch before opening a PR — detached HEAD cannot be used as a PR branch.");if(!FI(t))return;const n=e.files.length>0?"Create or switch to a feature branch before committing these changes.":"Pull the default branch if needed, then create or switch to a feature branch.";throw new Error(`Create or switch to a feature branch before opening a PR. Current branch is ${t}. ${n}`)}function FI(e){return e==="main"||e==="master"}function qI(e){const t=e.map(s=>s.path.split("/").pop()||s.path);return t.length===1?`Update ${t[0]}`:t.length<=3?`Update ${t.join(", ")}`:`Update ${t.slice(0,3).join(", ")} +${t.length-3} more`}const w3=y.createContext(null);function VI({onRefresh:e,children:t}){const s=II(e);return r.jsx(w3.Provider,{value:s,children:t})}function GI(){const e=y.useContext(w3);if(!e)throw new Error("useWorkflowRun must be used within a WorkflowRunProvider");return e}function WI({git:e,onRefresh:t}){const{sendToAgent:s}=At(),[n,o]=y.useState(!1),[l,u]=y.useState(null),[h,m]=y.useState(null),d=e.status,p=d?.branch||void 0,g=d?.files.length??0,x=d?.ahead??0,_=d?.behind??0;y.useEffect(()=>{if(!p){m(null);return}let k=!0;return m0(p,1).then(C=>{if(!k)return;const T=C[0];m(T&&KI(T)?T:null)}).catch(()=>{k&&m(null)}),()=>{k=!1}},[p]);const S=y.useMemo(()=>g>0||x>0||_>0||!!h,[g,x,_,h]);if(!d||!S)return null;async function w(){o(!0),u(null);try{await pf(),t?.()}catch(k){u(k instanceof Error?k.message:String(k))}finally{o(!1)}}return r.jsx("div",{className:"mx-auto mb-2 w-full max-w-4xl",children:r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 rounded-md border border-border bg-muted/40 px-2 py-1.5 text-[11px]",children:[r.jsxs("span",{className:"mr-0.5 inline-flex items-center gap-1 font-medium text-muted-foreground",children:[r.jsx(Tt,{className:"size-3.5"}),p??"git"]}),g>0?r.jsx(sh,{icon:r.jsx(yR,{className:"size-3"}),label:`Commit ${g} change${g===1?"":"s"}`,ai:!0,onClick:()=>s({prompt:pB({branch:p,fileCount:g}),source:{type:"git-situation",label:"uncommitted changes"},mode:"send",label:`Commit ${g} uncommitted change${g===1?"":"s"}`})}):null,_>0?r.jsx(sh,{icon:r.jsx(uf,{className:"size-3"}),label:`Pull ${_} behind`,ai:!0,onClick:()=>s({prompt:gB({branch:p,behind:_,upstream:d.upstream}),source:{type:"git-situation",label:"behind upstream"},mode:"send",label:`Pull & rebase (${_} behind)`})}):null,x>0?r.jsx(sh,{icon:n?r.jsx(ht,{className:"size-3 animate-spin"}):r.jsx(Kb,{className:"size-3"}),label:`Push ${x}`,disabled:n,onClick:()=>{w()}}):null,h?r.jsx(sh,{danger:!0,icon:r.jsx(mu,{className:"size-3"}),label:"Fix failing CI",ai:!0,onClick:()=>s({prompt:bB({branch:p,runName:h.name,url:h.html_url}),source:{type:"git-situation",label:"failing CI"},mode:"send",label:`Fix failing CI: ${h.name}`})}):null,l?r.jsx("span",{className:"text-destructive",children:l}):null]})})}function sh({ai:e,danger:t,disabled:s,icon:n,label:o,onClick:l}){return r.jsxs("button",{className:ie("inline-flex items-center gap-1 rounded-full border px-2 py-0.5 font-medium transition-colors disabled:opacity-50",t?"border-destructive/40 bg-destructive/5 text-destructive hover:bg-destructive/10":"border-border bg-background text-foreground hover:bg-muted"),disabled:s,onClick:l,type:"button",children:[n,o,e?r.jsx(Tt,{className:"size-3 opacity-70"}):null]})}function KI(e){return e.status==="completed"&&e.conclusion!==null&&!["success","neutral","skipped"].includes(e.conclusion)}const YI=new Set(["c","cpp","cs","go","java","js","jsx","kt","mjs","py","rs","swift","ts","tsx"]),XI=new Set([".env",".gitignore","components.json","dockerfile","package.json","tsconfig.json","vite.config.ts"]),ZI=new Set(["conf","config","ini","toml","yaml","yml"]),QI=new Set(["csv","json","sql","xml"]),JI=new Set(["md","mdx","rst","txt"]),eP=new Set(["gif","jpeg","jpg","png","svg","webp"]),tP=new Set(["package-lock.json","pnpm-lock.yaml","yarn.lock"]),sP=new Set(["css","less","sass","scss"]);function nP(e){const t=e.split("/").pop()?.toLowerCase()??e.toLowerCase(),s=t.includes(".")?t.split(".").pop()??"":"";return tP.has(t)||t.endsWith(".lock")?"lock":iP(t)?"test":XI.has(t)||ZI.has(s)?"config":sP.has(s)?"style":eP.has(s)?"image":JI.has(s)?"document":QI.has(s)?"data":YI.has(s)?"code":"generic"}function iP(e){return e.includes(".test.")||e.includes(".spec.")||e.endsWith("_test.go")}function Ax({path:e,className:t}){const s=nP(e),n=rP[s];return r.jsx(n,{"aria-label":`${s} file`,className:ie("size-3.5 shrink-0",aP[s],t)})}const rP={code:MN,config:HM,data:Zn,document:Vb,generic:ON,image:zR,lock:GR,style:hM,test:dR},aP={code:"text-sky-600",config:"text-zinc-600",data:"text-emerald-700",document:"text-blue-700",generic:"text-muted-foreground",image:"text-fuchsia-700",lock:"text-amber-700",style:"text-rose-700",test:"text-violet-700"};function oP(e){const t=e.lastIndexOf(".");return t>0?e.slice(t):""}function lP({onPick:e,onClose:t}){const[s,n]=y.useState(""),[o,l]=y.useState(null),[u,h]=y.useState(null),[m,d]=y.useState(!1),p=y.useRef(null),g=o?o.parent!==o.path:!1;return y.useEffect(()=>{function x(_){p.current&&!p.current.contains(_.target)&&t()}return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[t]),y.useEffect(()=>{let x=!0;return d(!0),h(null),aC(s,{files:!0}).then(_=>x&&l(_)).catch(_=>x&&h(_ instanceof Error?_.message:String(_))).finally(()=>x&&d(!1)),()=>{x=!1}},[s]),r.jsxs("div",{ref:p,className:"absolute bottom-full left-2 z-10 mb-2 w-[22rem] max-w-[calc(100vw-1rem)] overflow-hidden rounded-md border border-border bg-card shadow-lg",children:[r.jsxs("div",{className:"flex items-center gap-1 border-b border-border px-2 py-1.5",children:[r.jsx(Y,{"aria-label":"Parent folder",className:"size-7",disabled:!g,onClick:()=>o&&n(o.parent),size:"icon",type:"button",variant:"ghost",children:r.jsx(hf,{})}),r.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-muted-foreground",title:o?.path,children:o?.path??"…"}),m?r.jsx(ht,{className:"size-3.5 animate-spin text-muted-foreground"}):null,o?r.jsxs(Y,{className:"h-7 px-2 text-[11px]",onClick:()=>e(o.path),size:"sm",title:"Attach this folder",type:"button",variant:"outline",children:[r.jsx(V4,{})," This folder"]}):null,r.jsx(Y,{"aria-label":"Close",className:"size-7",onClick:t,size:"icon",type:"button",variant:"ghost",children:r.jsx(Ft,{})})]}),r.jsx("div",{className:"max-h-64 overflow-auto p-1",children:u?r.jsx($e,{variant:"destructive",className:"m-1",children:u}):o&&o.entries.length===0?r.jsx($e,{variant:"muted",className:"m-1 text-center",children:"Empty folder."}):o?.entries.map(x=>{const _=x.isDir?"":oP(x.name);return r.jsxs("button",{className:"flex w-full items-center gap-1.5 rounded-sm px-2 py-1 text-left text-[12px] hover:bg-muted",onClick:()=>x.isDir?n(x.path):e(x.path),title:x.path,type:"button",children:[x.isDir?r.jsx(so,{className:"size-3.5 shrink-0 text-amber-600"}):r.jsx(Ax,{path:x.path}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:x.name}),_?r.jsx("span",{className:"shrink-0 rounded bg-muted px-1 font-mono text-[10px] text-muted-foreground",children:_}):null]},x.path)})})]})}const cP=/```options[^\n]*\n([\s\S]*?)```/g,uP=/```service[^\n]*\n([\s\S]*?)```/g,dP=/```sql-write[^\S\n]*([^\n]*)\n([\s\S]*?)```/g,hP=/```(?:options|service|sql-write)[^\n]*\n[\s\S]*$/;function fP(e){const t=[];let s=null,n=null,o=e.replace(cP,(l,u)=>{for(const h of u.split(`
88
+ `)){const m=h.replace(/^[-*\d.)\s]+/,"").trim();m&&t.push(m)}return""});return o=o.replace(uP,(l,u)=>{const h=u.split(`
89
+ `).map(m=>m.trim()).find(Boolean);return h&&(s=h),""}),o=o.replace(dP,(l,u,h)=>{const m=h.trim();return m&&(n={connection:u.trim(),sql:m}),""}),o=o.replace(hP,""),{body:o.trim(),options:t,service:s,sqlWrite:n}}function mP({options:e,disabled:t,onChoose:s}){return r.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.map(n=>r.jsx(Y,{className:"h-7",disabled:t,onClick:()=>s(n),size:"sm",type:"button",variant:"outline",children:n},n))})}function pP({service:e,onStart:t,onOpen:s}){return r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 rounded-md border border-border bg-muted/30 px-2 py-1.5",children:[r.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["Added ",r.jsx("span",{className:"font-medium text-foreground",children:e})]}),r.jsxs("div",{className:"ml-auto flex gap-1.5",children:[r.jsxs(Y,{className:"h-7",onClick:()=>t(e),size:"sm",type:"button",children:[r.jsx(vr,{})," Start"]}),s?r.jsxs(Y,{className:"h-7",onClick:()=>s(e),size:"sm",type:"button",variant:"outline",children:[r.jsx(br,{})," Open"]}):null]})]})}function gP({proposal:e,onOpen:t}){return r.jsxs("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/[0.06] px-2.5 py-2",children:[r.jsxs("div",{className:"mb-1.5 flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[r.jsx(Zn,{className:"size-3.5 text-amber-600 dark:text-amber-400"}),r.jsxs("span",{children:["Proposed write",e.connection?r.jsxs(r.Fragment,{children:[" ","on ",r.jsx("span",{className:"font-medium text-foreground",children:e.connection})]}):null," ","— runs in the console after you unlock and preview."]})]}),r.jsx("pre",{className:"mb-2 max-h-28 overflow-auto rounded bg-background px-2 py-1.5 font-mono text-[11px] text-foreground",children:e.sql}),r.jsxs(Y,{className:"h-7 w-full bg-amber-600 text-white hover:bg-amber-600/90",onClick:()=>t(e.connection,e.sql),size:"sm",type:"button",children:[r.jsx(br,{})," Open in SQL console"]})]})}function Rx(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ro=Rx();function k3(e){ro=e}var qa={exec:()=>null};function Wo(e){let t=[];return s=>{let n=Math.max(0,Math.min(3,s-1)),o=t[n];return o||(o=e(n),t[n]=o),o}}function ct(e,t=""){let s=typeof e=="string"?e:e.source,n={replace:(o,l)=>{let u=typeof l=="string"?l:l.source;return u=u.replace(Gs.caret,"$1"),s=s.replace(o,u),n},getRegex:()=>new RegExp(s,t)};return n}var bP=((e="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+e)}catch{return!1}})(),Gs={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:Wo(e=>new RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Wo(e=>new RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Wo(e=>new RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Wo(e=>new RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Wo(e=>new RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:Wo(e=>new RegExp(`^ {0,${e}}>`))},xP=/^(?:[ \t]*(?:\n|$))+/,vP=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,_P=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,wu=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,yP=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Mx=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,N3=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,C3=ct(N3).replace(/bull/g,Mx).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(),SP=ct(N3).replace(/bull/g,Mx).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(),Dx=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,wP=/^[^\n]+/,Ox=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,kP=ct(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ox).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),NP=ct(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Mx).getRegex(),wf="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",Lx=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,CP=ct("^ {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",Lx).replace("tag",wf).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),E3=ct(Dx).replace("hr",wu).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",wf).getRegex(),EP=ct(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",E3).getRegex(),zx={blockquote:EP,code:vP,def:kP,fences:_P,heading:yP,hr:wu,html:CP,lheading:C3,list:NP,newline:xP,paragraph:E3,table:qa,text:wP},qw=ct("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",wu).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",wf).getRegex(),jP={...zx,lheading:SP,table:qw,paragraph:ct(Dx).replace("hr",wu).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",qw).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",wf).getRegex()},TP={...zx,html:ct(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Lx).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:qa,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ct(Dx).replace("hr",wu).replace("heading",` *#{1,6} *[^
90
+ ]`).replace("lheading",C3).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},AP=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,RP=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,j3=/^( {2,}|\\)\n(?!\s*$)/,MP=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,_l=/[\p{P}\p{S}]/u,kf=/[\s\p{P}\p{S}]/u,Bx=/[^\s\p{P}\p{S}]/u,DP=ct(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,kf).getRegex(),T3=/(?!~)[\p{P}\p{S}]/u,OP=/(?!~)[\s\p{P}\p{S}]/u,LP=/(?:[^\s\p{P}\p{S}]|~)/u,zP=ct(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",bP?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),A3=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,BP=ct(A3,"u").replace(/punct/g,_l).getRegex(),IP=ct(A3,"u").replace(/punct/g,T3).getRegex(),R3="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",PP=ct(R3,"gu").replace(/notPunctSpace/g,Bx).replace(/punctSpace/g,kf).replace(/punct/g,_l).getRegex(),$P=ct(R3,"gu").replace(/notPunctSpace/g,LP).replace(/punctSpace/g,OP).replace(/punct/g,T3).getRegex(),HP=ct("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Bx).replace(/punctSpace/g,kf).replace(/punct/g,_l).getRegex(),UP=ct(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,_l).getRegex(),FP="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",qP=ct(FP,"gu").replace(/notPunctSpace/g,Bx).replace(/punctSpace/g,kf).replace(/punct/g,_l).getRegex(),VP=ct(/\\(punct)/,"gu").replace(/punct/g,_l).getRegex(),GP=ct(/^<(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(),WP=ct(Lx).replace("(?:-->|$)","-->").getRegex(),KP=ct("^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",WP).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Gh=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,YP=ct(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Gh).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),M3=ct(/^!?\[(label)\]\[(ref)\]/).replace("label",Gh).replace("ref",Ox).getRegex(),D3=ct(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ox).getRegex(),XP=ct("reflink|nolink(?!\\()","g").replace("reflink",M3).replace("nolink",D3).getRegex(),Vw=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ix={_backpedal:qa,anyPunctuation:VP,autolink:GP,blockSkip:zP,br:j3,code:RP,del:qa,delLDelim:qa,delRDelim:qa,emStrongLDelim:BP,emStrongRDelimAst:PP,emStrongRDelimUnd:HP,escape:AP,link:YP,nolink:D3,punctuation:DP,reflink:M3,reflinkSearch:XP,tag:KP,text:MP,url:qa},ZP={...Ix,link:ct(/^!?\[(label)\]\((.*?)\)/).replace("label",Gh).getRegex(),reflink:ct(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Gh).getRegex()},$0={...Ix,emStrongRDelimAst:$P,emStrongLDelim:IP,delLDelim:UP,delRDelim:qP,url:ct(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Vw).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:ct(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Vw).getRegex()},QP={...$0,br:ct(j3).replace("{2,}","*").getRegex(),text:ct($0.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},nh={normal:zx,gfm:jP,pedantic:TP},Sc={normal:Ix,gfm:$0,breaks:QP,pedantic:ZP},JP={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Gw=e=>JP[e];function ji(e,t){if(t){if(Gs.escapeTest.test(e))return e.replace(Gs.escapeReplace,Gw)}else if(Gs.escapeTestNoEncode.test(e))return e.replace(Gs.escapeReplaceNoEncode,Gw);return e}function Ww(e){try{e=encodeURI(e).replace(Gs.percentDecode,"%")}catch{return null}return e}function Kw(e,t){let s=e.replace(Gs.findPipe,(l,u,h)=>{let m=!1,d=u;for(;--d>=0&&h[d]==="\\";)m=!m;return m?"|":" |"}),n=s.split(Gs.splitPipe),o=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;o<n.length;o++)n[o]=n[o].trim().replace(Gs.slashPipe,"|");return n}function ta(e,t,s){let n=e.length;if(n===0)return"";let o=0;for(;o<n&&e.charAt(n-o-1)===t;)o++;return e.slice(0,n-o)}function Yw(e){let t=e.split(`
91
+ `),s=t.length-1;for(;s>=0&&Gs.blankLine.test(t[s]);)s--;return t.length-s<=2?e:t.slice(0,s+1).join(`
92
+ `)}function e$(e,t){if(e.indexOf(t[1])===-1)return-1;let s=0;for(let n=0;n<e.length;n++)if(e[n]==="\\")n++;else if(e[n]===t[0])s++;else if(e[n]===t[1]&&(s--,s<0))return n;return s>0?-2:-1}function t$(e,t=0){let s=t,n="";for(let o of e)if(o===" "){let l=4-s%4;n+=" ".repeat(l),s+=l}else n+=o,s++;return n}function Xw(e,t,s,n,o){let l=t.href,u=t.title||null,h=e[1].replace(o.other.outputLinkReplace,"$1");n.state.inLink=!0;let m={type:e[0].charAt(0)==="!"?"image":"link",raw:s,href:l,title:u,text:h,tokens:n.inlineTokens(h)};return n.state.inLink=!1,m}function s$(e,t,s){let n=e.match(s.other.indentCodeCompensation);if(n===null)return t;let o=n[1];return t.split(`
93
+ `).map(l=>{let u=l.match(s.other.beginningSpace);if(u===null)return l;let[h]=u;return h.length>=o.length?l.slice(o.length):l}).join(`
94
+ `)}var Wh=class{options;rules;lexer;constructor(e){this.options=e||ro}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let s=this.options.pedantic?t[0]:Yw(t[0]),n=s.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:s,codeBlockStyle:"indented",text:n}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let s=t[0],n=s$(s,t[3]||"",this.rules);return{type:"code",raw:s,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let s=t[2].trim();if(this.rules.other.endingHash.test(s)){let n=ta(s,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(s=n.trim())}return{type:"heading",raw:ta(t[0],`
95
+ `),depth:t[1].length,text:s,tokens:this.lexer.inline(s)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:ta(t[0],`
96
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let s=ta(t[0],`
97
+ `).split(`
98
+ `),n="",o="",l=[];for(;s.length>0;){let u=!1,h=[],m;for(m=0;m<s.length;m++)if(this.rules.other.blockquoteStart.test(s[m]))h.push(s[m]),u=!0;else if(!u)h.push(s[m]);else break;s=s.slice(m);let d=h.join(`
99
+ `),p=d.replace(this.rules.other.blockquoteSetextReplace,`
100
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}
101
+ ${d}`:d,o=o?`${o}
102
+ ${p}`:p;let g=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,l,!0),this.lexer.state.top=g,s.length===0)break;let x=l.at(-1);if(x?.type==="code")break;if(x?.type==="blockquote"){let _=x,S=_.raw+`
103
+ `+s.join(`
104
+ `),w=this.blockquote(S);l[l.length-1]=w,n=n.substring(0,n.length-_.raw.length)+w.raw,o=o.substring(0,o.length-_.text.length)+w.text;break}else if(x?.type==="list"){let _=x,S=_.raw+`
105
+ `+s.join(`
106
+ `),w=this.list(S);l[l.length-1]=w,n=n.substring(0,n.length-x.raw.length)+w.raw,o=o.substring(0,o.length-_.raw.length)+w.raw,s=S.substring(l.at(-1).raw.length).split(`
107
+ `);continue}}return{type:"blockquote",raw:n,tokens:l,text:o}}}list(e){let t=this.rules.block.list.exec(e);if(t){let s=t[1].trim(),n=s.length>1,o={type:"list",raw:"",ordered:n,start:n?+s.slice(0,-1):"",loose:!1,items:[]};s=n?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=n?s:"[*+-]");let l=this.rules.other.listItemRegex(s),u=!1;for(;e;){let m=!1,d="",p="";if(!(t=l.exec(e))||this.rules.block.hr.test(e))break;d=t[0],e=e.substring(d.length);let g=t$(t[2].split(`
108
+ `,1)[0],t[1].length),x=e.split(`
109
+ `,1)[0],_=!g.trim(),S=0;if(this.options.pedantic?(S=2,p=g.trimStart()):_?S=t[1].length+1:(S=g.search(this.rules.other.nonSpaceChar),S=S>4?1:S,p=g.slice(S),S+=t[1].length),_&&this.rules.other.blankLine.test(x)&&(d+=x+`
110
+ `,e=e.substring(x.length+1),m=!0),!m){let w=this.rules.other.nextBulletRegex(S),k=this.rules.other.hrRegex(S),C=this.rules.other.fencesBeginRegex(S),T=this.rules.other.headingBeginRegex(S),E=this.rules.other.htmlBeginRegex(S),j=this.rules.other.blockquoteBeginRegex(S);for(;e;){let M=e.split(`
111
+ `,1)[0],z;if(x=M,this.options.pedantic?(x=x.replace(this.rules.other.listReplaceNesting," "),z=x):z=x.replace(this.rules.other.tabCharGlobal," "),C.test(x)||T.test(x)||E.test(x)||j.test(x)||w.test(x)||k.test(x))break;if(z.search(this.rules.other.nonSpaceChar)>=S||!x.trim())p+=`
112
+ `+z.slice(S);else{if(_||g.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||C.test(g)||T.test(g)||k.test(g))break;p+=`
113
+ `+x}_=!x.trim(),d+=M+`
114
+ `,e=e.substring(M.length+1),g=z.slice(S)}}o.loose||(u?o.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(u=!0)),o.items.push({type:"list_item",raw:d,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]}),o.raw+=d}let h=o.items.at(-1);if(h)h.raw=h.raw.trimEnd(),h.text=h.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let m of o.items){this.lexer.state.top=!1,m.tokens=this.lexer.blockTokens(m.text,[]);let d=m.tokens[0];if(m.task&&(d?.type==="text"||d?.type==="paragraph")){m.text=m.text.replace(this.rules.other.listReplaceTask,""),d.raw=d.raw.replace(this.rules.other.listReplaceTask,""),d.text=d.text.replace(this.rules.other.listReplaceTask,"");for(let g=this.lexer.inlineQueue.length-1;g>=0;g--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[g].src)){this.lexer.inlineQueue[g].src=this.lexer.inlineQueue[g].src.replace(this.rules.other.listReplaceTask,"");break}let p=this.rules.other.listTaskCheckbox.exec(m.raw);if(p){let g={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};m.checked=g.checked,o.loose?m.tokens[0]&&["paragraph","text"].includes(m.tokens[0].type)&&"tokens"in m.tokens[0]&&m.tokens[0].tokens?(m.tokens[0].raw=g.raw+m.tokens[0].raw,m.tokens[0].text=g.raw+m.tokens[0].text,m.tokens[0].tokens.unshift(g)):m.tokens.unshift({type:"paragraph",raw:g.raw,text:g.raw,tokens:[g]}):m.tokens.unshift(g)}}else m.task&&(m.task=!1);if(!o.loose){let p=m.tokens.filter(x=>x.type==="space"),g=p.length>0&&p.some(x=>this.rules.other.anyLine.test(x.raw));o.loose=g}}if(o.loose)for(let m of o.items){m.loose=!0;for(let d of m.tokens)d.type==="text"&&(d.type="paragraph")}return o}}html(e){let t=this.rules.block.html.exec(e);if(t){let s=Yw(t[0]);return{type:"html",block:!0,raw:s,pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:s}}}def(e){let t=this.rules.block.def.exec(e);if(t){let s=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",o=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:s,raw:ta(t[0],`
115
+ `),href:n,title:o}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let s=Kw(t[1]),n=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
116
+ `):[],l={type:"table",raw:ta(t[0],`
117
+ `),header:[],align:[],rows:[]};if(s.length===n.length){for(let u of n)this.rules.other.tableAlignRight.test(u)?l.align.push("right"):this.rules.other.tableAlignCenter.test(u)?l.align.push("center"):this.rules.other.tableAlignLeft.test(u)?l.align.push("left"):l.align.push(null);for(let u=0;u<s.length;u++)l.header.push({text:s[u],tokens:this.lexer.inline(s[u]),header:!0,align:l.align[u]});for(let u of o)l.rows.push(Kw(u,l.header.length).map((h,m)=>({text:h,tokens:this.lexer.inline(h),header:!1,align:l.align[m]})));return l}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let s=t[1].trim();return{type:"heading",raw:ta(t[0],`
118
+ `),depth:t[2].charAt(0)==="="?1:2,text:s,tokens:this.lexer.inline(s)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let s=t[1].charAt(t[1].length-1)===`
119
+ `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:s,tokens:this.lexer.inline(s)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let s=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(s)){if(!this.rules.other.endAngleBracket.test(s))return;let l=ta(s.slice(0,-1),"\\");if((s.length-l.length)%2===0)return}else{let l=e$(t[2],"()");if(l===-2)return;if(l>-1){let u=(t[0].indexOf("!")===0?5:4)+t[1].length+l;t[2]=t[2].substring(0,l),t[0]=t[0].substring(0,u).trim(),t[3]=""}}let n=t[2],o="";if(this.options.pedantic){let l=this.rules.other.pedanticHrefTitle.exec(n);l&&(n=l[1],o=l[3])}else o=t[3]?t[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(s)?n=n.slice(1):n=n.slice(1,-1)),Xw(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let s;if((s=this.rules.inline.reflink.exec(e))||(s=this.rules.inline.nolink.exec(e))){let n=(s[2]||s[1]).replace(this.rules.other.multipleSpaceGlobal," "),o=t[n.toLowerCase()];if(!o){let l=s[0].charAt(0);return{type:"text",raw:l,text:l}}return Xw(s,o,s[0],this.lexer,this.rules)}}emStrong(e,t,s=""){let n=this.rules.inline.emStrongLDelim.exec(e);if(!(!n||!n[1]&&!n[2]&&!n[3]&&!n[4]||n[4]&&s.match(this.rules.other.unicodeAlphaNumeric))&&(!(n[1]||n[3])||!s||this.rules.inline.punctuation.exec(s))){let o=[...n[0]].length-1,l,u,h=o,m=0,d=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+o);(n=d.exec(t))!==null;){if(l=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!l)continue;if(u=[...l].length,n[3]||n[4]){h+=u;continue}else if((n[5]||n[6])&&o%3&&!((o+u)%3)){m+=u;continue}if(h-=u,h>0)continue;u=Math.min(u,u+h+m);let p=[...n[0]][0].length,g=e.slice(0,o+n.index+p+u);if(Math.min(o,u)%2){let _=g.slice(1,-1);return{type:"em",raw:g,text:_,tokens:this.lexer.inlineTokens(_)}}let x=g.slice(2,-2);return{type:"strong",raw:g,text:x,tokens:this.lexer.inlineTokens(x)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let s=t[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(s),o=this.rules.other.startingSpaceChar.test(s)&&this.rules.other.endingSpaceChar.test(s);return n&&o&&(s=s.substring(1,s.length-1)),{type:"codespan",raw:t[0],text:s}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,s=""){let n=this.rules.inline.delLDelim.exec(e);if(n&&(!n[1]||!s||this.rules.inline.punctuation.exec(s))){let o=[...n[0]].length-1,l,u,h=o,m=this.rules.inline.delRDelim;for(m.lastIndex=0,t=t.slice(-1*e.length+o);(n=m.exec(t))!==null;){if(l=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!l||(u=[...l].length,u!==o))continue;if(n[3]||n[4]){h+=u;continue}if(h-=u,h>0)continue;u=Math.min(u,u+h);let d=[...n[0]][0].length,p=e.slice(0,o+n.index+d+u),g=p.slice(o,-o);return{type:"del",raw:p,text:g,tokens:this.lexer.inlineTokens(g)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let s,n;return t[2]==="@"?(s=t[1],n="mailto:"+s):(s=t[1],n=s),{type:"link",raw:t[0],text:s,href:n,tokens:[{type:"text",raw:s,text:s}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let s,n;if(t[2]==="@")s=t[0],n="mailto:"+s;else{let o;do o=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(o!==t[0]);s=t[0],t[1]==="www."?n="http://"+t[0]:n=t[0]}return{type:"link",raw:t[0],text:s,href:n,tokens:[{type:"text",raw:s,text:s}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let s=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:s}}}},hi=class H0{tokens;options;state;inlineQueue;tokenizer;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||ro,this.options.tokenizer=this.options.tokenizer||new Wh,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 s={other:Gs,block:nh.normal,inline:Sc.normal};this.options.pedantic?(s.block=nh.pedantic,s.inline=Sc.pedantic):this.options.gfm&&(s.block=nh.gfm,this.options.breaks?s.inline=Sc.breaks:s.inline=Sc.gfm),this.tokenizer.rules=s}static get rules(){return{block:nh,inline:Sc}}static lex(t,s){return new H0(s).lex(t)}static lexInline(t,s){return new H0(s).inlineTokens(t)}lex(t){t=t.replace(Gs.carriageReturn,`
120
+ `),this.blockTokens(t,this.tokens);for(let s=0;s<this.inlineQueue.length;s++){let n=this.inlineQueue[s];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,s=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(t=t.replace(Gs.tabCharGlobal," ").replace(Gs.spaceLine,""));let o=1/0;for(;t;){if(t.length<o)o=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}let l;if(this.options.extensions?.block?.some(h=>(l=h.call({lexer:this},t,s))?(t=t.substring(l.raw.length),s.push(l),!0):!1))continue;if(l=this.tokenizer.space(t)){t=t.substring(l.raw.length);let h=s.at(-1);l.raw.length===1&&h!==void 0?h.raw+=`
121
+ `:s.push(l);continue}if(l=this.tokenizer.code(t)){t=t.substring(l.raw.length);let h=s.at(-1);h?.type==="paragraph"||h?.type==="text"?(h.raw+=(h.raw.endsWith(`
122
+ `)?"":`
123
+ `)+l.raw,h.text+=`
124
+ `+l.text,this.inlineQueue.at(-1).src=h.text):s.push(l);continue}if(l=this.tokenizer.fences(t)){t=t.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.heading(t)){t=t.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.hr(t)){t=t.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.blockquote(t)){t=t.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.list(t)){t=t.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.html(t)){t=t.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.def(t)){t=t.substring(l.raw.length);let h=s.at(-1);h?.type==="paragraph"||h?.type==="text"?(h.raw+=(h.raw.endsWith(`
125
+ `)?"":`
126
+ `)+l.raw,h.text+=`
127
+ `+l.raw,this.inlineQueue.at(-1).src=h.text):this.tokens.links[l.tag]||(this.tokens.links[l.tag]={href:l.href,title:l.title},s.push(l));continue}if(l=this.tokenizer.table(t)){t=t.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.lheading(t)){t=t.substring(l.raw.length),s.push(l);continue}let u=t;if(this.options.extensions?.startBlock){let h=1/0,m=t.slice(1),d;this.options.extensions.startBlock.forEach(p=>{d=p.call({lexer:this},m),typeof d=="number"&&d>=0&&(h=Math.min(h,d))}),h<1/0&&h>=0&&(u=t.substring(0,h+1))}if(this.state.top&&(l=this.tokenizer.paragraph(u))){let h=s.at(-1);n&&h?.type==="paragraph"?(h.raw+=(h.raw.endsWith(`
128
+ `)?"":`
129
+ `)+l.raw,h.text+=`
130
+ `+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):s.push(l),n=u.length!==t.length,t=t.substring(l.raw.length);continue}if(l=this.tokenizer.text(t)){t=t.substring(l.raw.length);let h=s.at(-1);h?.type==="text"?(h.raw+=(h.raw.endsWith(`
131
+ `)?"":`
132
+ `)+l.raw,h.text+=`
133
+ `+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):s.push(l);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return this.state.top=!0,s}inline(t,s=[]){return this.inlineQueue.push({src:t,tokens:s}),s}inlineTokens(t,s=[]){this.tokenizer.lexer=this;let n=t,o=null;if(this.tokens.links){let d=Object.keys(this.tokens.links);if(d.length>0)for(;(o=this.tokenizer.rules.inline.reflinkSearch.exec(n))!==null;)d.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(o=this.tokenizer.rules.inline.anyPunctuation.exec(n))!==null;)n=n.slice(0,o.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let l;for(;(o=this.tokenizer.rules.inline.blockSkip.exec(n))!==null;)l=o[2]?o[2].length:0,n=n.slice(0,o.index+l)+"["+"a".repeat(o[0].length-l-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let u=!1,h="",m=1/0;for(;t;){if(t.length<m)m=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}u||(h=""),u=!1;let d;if(this.options.extensions?.inline?.some(g=>(d=g.call({lexer:this},t,s))?(t=t.substring(d.raw.length),s.push(d),!0):!1))continue;if(d=this.tokenizer.escape(t)){t=t.substring(d.raw.length),s.push(d);continue}if(d=this.tokenizer.tag(t)){t=t.substring(d.raw.length),s.push(d);continue}if(d=this.tokenizer.link(t)){t=t.substring(d.raw.length),s.push(d);continue}if(d=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(d.raw.length);let g=s.at(-1);d.type==="text"&&g?.type==="text"?(g.raw+=d.raw,g.text+=d.text):s.push(d);continue}if(d=this.tokenizer.emStrong(t,n,h)){t=t.substring(d.raw.length),s.push(d);continue}if(d=this.tokenizer.codespan(t)){t=t.substring(d.raw.length),s.push(d);continue}if(d=this.tokenizer.br(t)){t=t.substring(d.raw.length),s.push(d);continue}if(d=this.tokenizer.del(t,n,h)){t=t.substring(d.raw.length),s.push(d);continue}if(d=this.tokenizer.autolink(t)){t=t.substring(d.raw.length),s.push(d);continue}if(!this.state.inLink&&(d=this.tokenizer.url(t))){t=t.substring(d.raw.length),s.push(d);continue}let p=t;if(this.options.extensions?.startInline){let g=1/0,x=t.slice(1),_;this.options.extensions.startInline.forEach(S=>{_=S.call({lexer:this},x),typeof _=="number"&&_>=0&&(g=Math.min(g,_))}),g<1/0&&g>=0&&(p=t.substring(0,g+1))}if(d=this.tokenizer.inlineText(p)){t=t.substring(d.raw.length),d.raw.slice(-1)!=="_"&&(h=d.raw.slice(-1)),u=!0;let g=s.at(-1);g?.type==="text"?(g.raw+=d.raw,g.text+=d.text):s.push(d);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return s}infiniteLoopError(t){let s="Infinite loop on byte: "+t;if(this.options.silent)console.error(s);else throw new Error(s)}},Kh=class{options;parser;constructor(e){this.options=e||ro}space(e){return""}code({text:e,lang:t,escaped:s}){let n=(t||"").match(Gs.notSpaceStart)?.[0],o=e.replace(Gs.endingNewline,"")+`
134
+ `;return n?'<pre><code class="language-'+ji(n)+'">'+(s?o:ji(o,!0))+`</code></pre>
135
+ `:"<pre><code>"+(s?o:ji(o,!0))+`</code></pre>
136
+ `}blockquote({tokens:e}){return`<blockquote>
137
+ ${this.parser.parse(e)}</blockquote>
138
+ `}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
139
+ `}hr(e){return`<hr>
140
+ `}list(e){let t=e.ordered,s=e.start,n="";for(let u=0;u<e.items.length;u++){let h=e.items[u];n+=this.listitem(h)}let o=t?"ol":"ul",l=t&&s!==1?' start="'+s+'"':"";return"<"+o+l+`>
141
+ `+n+"</"+o+`>
142
+ `}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
143
+ `}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
144
+ `}table(e){let t="",s="";for(let o=0;o<e.header.length;o++)s+=this.tablecell(e.header[o]);t+=this.tablerow({text:s});let n="";for(let o=0;o<e.rows.length;o++){let l=e.rows[o];s="";for(let u=0;u<l.length;u++)s+=this.tablecell(l[u]);n+=this.tablerow({text:s})}return n&&(n=`<tbody>${n}</tbody>`),`<table>
145
+ <thead>
146
+ `+t+`</thead>
147
+ `+n+`</table>
148
+ `}tablerow({text:e}){return`<tr>
149
+ ${e}</tr>
150
+ `}tablecell(e){let t=this.parser.parseInline(e.tokens),s=e.header?"th":"td";return(e.align?`<${s} align="${e.align}">`:`<${s}>`)+t+`</${s}>
151
+ `}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>${ji(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:s}){let n=this.parser.parseInline(s),o=Ww(e);if(o===null)return n;e=o;let l='<a href="'+e+'"';return t&&(l+=' title="'+ji(t)+'"'),l+=">"+n+"</a>",l}image({href:e,title:t,text:s,tokens:n}){n&&(s=this.parser.parseInline(n,this.parser.textRenderer));let o=Ww(e);if(o===null)return ji(s);e=o;let l=`<img src="${e}" alt="${ji(s)}"`;return t&&(l+=` title="${ji(t)}"`),l+=">",l}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:ji(e.text)}},Px=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}checkbox({raw:t}){return t}},fi=class U0{options;renderer;textRenderer;constructor(t){this.options=t||ro,this.options.renderer=this.options.renderer||new Kh,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Px}static parse(t,s){return new U0(s).parse(t)}static parseInline(t,s){return new U0(s).parseInline(t)}parse(t){this.renderer.parser=this;let s="";for(let n=0;n<t.length;n++){let o=t[n];if(this.options.extensions?.renderers?.[o.type]){let u=o,h=this.options.extensions.renderers[u.type].call({parser:this},u);if(h!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(u.type)){s+=h||"";continue}}let l=o;switch(l.type){case"space":{s+=this.renderer.space(l);break}case"hr":{s+=this.renderer.hr(l);break}case"heading":{s+=this.renderer.heading(l);break}case"code":{s+=this.renderer.code(l);break}case"table":{s+=this.renderer.table(l);break}case"blockquote":{s+=this.renderer.blockquote(l);break}case"list":{s+=this.renderer.list(l);break}case"checkbox":{s+=this.renderer.checkbox(l);break}case"html":{s+=this.renderer.html(l);break}case"def":{s+=this.renderer.def(l);break}case"paragraph":{s+=this.renderer.paragraph(l);break}case"text":{s+=this.renderer.text(l);break}default:{let u='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return s}parseInline(t,s=this.renderer){this.renderer.parser=this;let n="";for(let o=0;o<t.length;o++){let l=t[o];if(this.options.extensions?.renderers?.[l.type]){let h=this.options.extensions.renderers[l.type].call({parser:this},l);if(h!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){n+=h||"";continue}}let u=l;switch(u.type){case"escape":{n+=s.text(u);break}case"html":{n+=s.html(u);break}case"link":{n+=s.link(u);break}case"image":{n+=s.image(u);break}case"checkbox":{n+=s.checkbox(u);break}case"strong":{n+=s.strong(u);break}case"em":{n+=s.em(u);break}case"codespan":{n+=s.codespan(u);break}case"br":{n+=s.br(u);break}case"del":{n+=s.del(u);break}case"text":{n+=s.text(u);break}default:{let h='Token with "'+u.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return n}},Oc=class{options;block;constructor(e){this.options=e||ro}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(e=this.block){return e?hi.lex:hi.lexInline}provideParser(e=this.block){return e?fi.parse:fi.parseInline}},n$=class{defaults=Rx();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=fi;Renderer=Kh;TextRenderer=Px;Lexer=hi;Tokenizer=Wh;Hooks=Oc;constructor(...t){this.use(...t)}walkTokens(t,s){let n=[];for(let o of t)switch(n=n.concat(s.call(this,o)),o.type){case"table":{let l=o;for(let u of l.header)n=n.concat(this.walkTokens(u.tokens,s));for(let u of l.rows)for(let h of u)n=n.concat(this.walkTokens(h.tokens,s));break}case"list":{let l=o;n=n.concat(this.walkTokens(l.items,s));break}default:{let l=o;this.defaults.extensions?.childTokens?.[l.type]?this.defaults.extensions.childTokens[l.type].forEach(u=>{let h=l[u].flat(1/0);n=n.concat(this.walkTokens(h,s))}):l.tokens&&(n=n.concat(this.walkTokens(l.tokens,s)))}}return n}use(...t){let s=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{let o={...n};if(o.async=this.defaults.async||o.async||!1,n.extensions&&(n.extensions.forEach(l=>{if(!l.name)throw new Error("extension name required");if("renderer"in l){let u=s.renderers[l.name];u?s.renderers[l.name]=function(...h){let m=l.renderer.apply(this,h);return m===!1&&(m=u.apply(this,h)),m}:s.renderers[l.name]=l.renderer}if("tokenizer"in l){if(!l.level||l.level!=="block"&&l.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let u=s[l.level];u?u.unshift(l.tokenizer):s[l.level]=[l.tokenizer],l.start&&(l.level==="block"?s.startBlock?s.startBlock.push(l.start):s.startBlock=[l.start]:l.level==="inline"&&(s.startInline?s.startInline.push(l.start):s.startInline=[l.start]))}"childTokens"in l&&l.childTokens&&(s.childTokens[l.name]=l.childTokens)}),o.extensions=s),n.renderer){let l=this.defaults.renderer||new Kh(this.defaults);for(let u in n.renderer){if(!(u in l))throw new Error(`renderer '${u}' does not exist`);if(["options","parser"].includes(u))continue;let h=u,m=n.renderer[h],d=l[h];l[h]=(...p)=>{let g=m.apply(l,p);return g===!1&&(g=d.apply(l,p)),g||""}}o.renderer=l}if(n.tokenizer){let l=this.defaults.tokenizer||new Wh(this.defaults);for(let u in n.tokenizer){if(!(u in l))throw new Error(`tokenizer '${u}' does not exist`);if(["options","rules","lexer"].includes(u))continue;let h=u,m=n.tokenizer[h],d=l[h];l[h]=(...p)=>{let g=m.apply(l,p);return g===!1&&(g=d.apply(l,p)),g}}o.tokenizer=l}if(n.hooks){let l=this.defaults.hooks||new Oc;for(let u in n.hooks){if(!(u in l))throw new Error(`hook '${u}' does not exist`);if(["options","block"].includes(u))continue;let h=u,m=n.hooks[h],d=l[h];Oc.passThroughHooks.has(u)?l[h]=p=>{if(this.defaults.async&&Oc.passThroughHooksRespectAsync.has(u))return(async()=>{let x=await m.call(l,p);return d.call(l,x)})();let g=m.call(l,p);return d.call(l,g)}:l[h]=(...p)=>{if(this.defaults.async)return(async()=>{let x=await m.apply(l,p);return x===!1&&(x=await d.apply(l,p)),x})();let g=m.apply(l,p);return g===!1&&(g=d.apply(l,p)),g}}o.hooks=l}if(n.walkTokens){let l=this.defaults.walkTokens,u=n.walkTokens;o.walkTokens=function(h){let m=[];return m.push(u.call(this,h)),l&&(m=m.concat(l.call(this,h))),m}}this.defaults={...this.defaults,...o}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,s){return hi.lex(t,s??this.defaults)}parser(t,s){return fi.parse(t,s??this.defaults)}parseMarkdown(t){return(s,n)=>{let o={...n},l={...this.defaults,...o},u=this.onError(!!l.silent,!!l.async);if(this.defaults.async===!0&&o.async===!1)return u(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 s>"u"||s===null)return u(new Error("marked(): input parameter is undefined or null"));if(typeof s!="string")return u(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected"));if(l.hooks&&(l.hooks.options=l,l.hooks.block=t),l.async)return(async()=>{let h=l.hooks?await l.hooks.preprocess(s):s,m=await(l.hooks?await l.hooks.provideLexer(t):t?hi.lex:hi.lexInline)(h,l),d=l.hooks?await l.hooks.processAllTokens(m):m;l.walkTokens&&await Promise.all(this.walkTokens(d,l.walkTokens));let p=await(l.hooks?await l.hooks.provideParser(t):t?fi.parse:fi.parseInline)(d,l);return l.hooks?await l.hooks.postprocess(p):p})().catch(u);try{l.hooks&&(s=l.hooks.preprocess(s));let h=(l.hooks?l.hooks.provideLexer(t):t?hi.lex:hi.lexInline)(s,l);l.hooks&&(h=l.hooks.processAllTokens(h)),l.walkTokens&&this.walkTokens(h,l.walkTokens);let m=(l.hooks?l.hooks.provideParser(t):t?fi.parse:fi.parseInline)(h,l);return l.hooks&&(m=l.hooks.postprocess(m)),m}catch(h){return u(h)}}}onError(t,s){return n=>{if(n.message+=`
152
+ Please report this to https://github.com/markedjs/marked.`,t){let o="<p>An error occurred:</p><pre>"+ji(n.message+"",!0)+"</pre>";return s?Promise.resolve(o):o}if(s)return Promise.reject(n);throw n}}},Ja=new n$;function pt(e,t){return Ja.parse(e,t)}pt.options=pt.setOptions=function(e){return Ja.setOptions(e),pt.defaults=Ja.defaults,k3(pt.defaults),pt};pt.getDefaults=Rx;pt.defaults=ro;pt.use=function(...e){return Ja.use(...e),pt.defaults=Ja.defaults,k3(pt.defaults),pt};pt.walkTokens=function(e,t){return Ja.walkTokens(e,t)};pt.parseInline=Ja.parseInline;pt.Parser=fi;pt.parser=fi.parse;pt.Renderer=Kh;pt.TextRenderer=Px;pt.Lexer=hi;pt.lexer=hi.lex;pt.Tokenizer=Wh;pt.Hooks=Oc;pt.parse=pt;pt.options;pt.setOptions;pt.use;pt.walkTokens;pt.parseInline;fi.parse;hi.lex;function i$(e){return e.replace(/<\/?(script|style|iframe|object|embed)\b[^>]*>/gi,"").replace(/\son\w+\s*=\s*("[^"]*"|'[^']*'|[^\s>]+)/gi,"").replace(/(href|src)\s*=\s*("|')\s*javascript:[^"']*\2/gi,"$1=$2#$2")}function r$({content:e}){const t=y.useMemo(()=>{const s=pt.parse(e,{async:!1,gfm:!0,breaks:!0});return i$(s)},[e]);return r.jsx("div",{className:"chat-md",dangerouslySetInnerHTML:{__html:t}})}function a$(e){return Math.min(e,Math.max(1,Math.ceil(e/22)))}function o$(e){const[t,s]=y.useState(e),n=y.useRef(e),o=y.useRef(e);return o.current=e,y.useEffect(()=>{e.startsWith(n.current)||(n.current=e,s(e))},[e]),y.useEffect(()=>{if(n.current.length>=o.current.length)return;const l=requestAnimationFrame(()=>{const u=o.current,h=u.slice(0,n.current.length+a$(u.length-n.current.length));n.current=h,s(h)});return()=>cancelAnimationFrame(l)},[t,e]),t}function l$(){return r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",role:"status",children:[r.jsx(ht,{className:"size-3.5 animate-spin"}),r.jsx("span",{children:"Thinking…"})]})}function c$({onOpenAgentPage:e,onOpenService:t,onOpenSqlConsole:s,git:n,onGitRefresh:o}){const{error:l,success:u}=Es(),{turns:h,streaming:m,error:d,configured:p,provider:g,approvals:x,send:_,stop:S,clear:w,respond:k,open:C,setOpen:T,draft:E,setDraft:j,insertPath:M,activeSource:z,clearSource:O,focusNonce:A,stickNonce:D,sendToAgent:B,onboarding:P,setOnboarding:H}=At(),[$,q]=y.useState(""),[V,I]=y.useState(!1),[W,Z]=y.useState(!1),[K,te]=y.useState(!1),[L,Q]=y.useState(null),[re,he]=y.useState(!1),fe=y.useRef(null),pe=y.useRef(null),we=y.useRef(null),Le=y.useRef(null);y.useEffect(()=>{if(!C||P)return;let _e=0,ft=0;const bn=()=>{const Ts=pe.current;if(!Ts||E&&Ts.value!==E){ft++<10&&(_e=requestAnimationFrame(bn));return}Ts.focus();const gt=Ts.value.length;Ts.setSelectionRange(gt,gt),Ts.scrollTop=Ts.scrollHeight};return _e=requestAnimationFrame(bn),()=>cancelAnimationFrame(_e)},[C,A,P]),y.useLayoutEffect(()=>{const _e=pe.current;_e&&(_e.style.height="auto",_e.style.height=`${_e.scrollHeight}px`)},[E]),y.useEffect(()=>{!C||!P||requestAnimationFrame(()=>we.current?.focus())},[C,P]),y.useEffect(()=>{if(!C)return;const _e=ft=>{Le.current?.contains(ft.target)||T(!1)};return document.addEventListener("pointerdown",_e),()=>document.removeEventListener("pointerdown",_e)},[C,T]),y.useEffect(()=>{const _e=bn=>{bn.dataTransfer&&Lw(bn.dataTransfer)&&I(!0)},ft=()=>{I(!1),Z(!1)};return document.addEventListener("dragstart",_e),document.addEventListener("dragend",ft),document.addEventListener("drop",ft),()=>{document.removeEventListener("dragstart",_e),document.removeEventListener("dragend",ft),document.removeEventListener("drop",ft)}},[]);const ve=y.useRef(!0);function We(){const _e=fe.current;_e&&(ve.current=_e.scrollHeight-_e.scrollTop-_e.clientHeight<48)}y.useEffect(()=>{const _e=fe.current;_e&&ve.current&&(_e.scrollTop=_e.scrollHeight)},[h,C]),y.useEffect(()=>{ve.current=!0;const _e=fe.current;if(!_e)return;const ft=requestAnimationFrame(()=>{_e.scrollTop=_e.scrollHeight});return()=>cancelAnimationFrame(ft)},[D]);async function ge(){const _e=E;j(""),ve.current=!0,await _(_e)}function Te(_e){_e.trim()&&(j(""),H(!1),q(""),ve.current=!0,B({prompt:oB(_e),source:{type:"repo-onboard",label:"Onboard repo"},label:`Onboard and run this repo: ${_e}`}))}function Re(_e){ve.current=!0,_(_e)}async function Pt(_e){try{await en(`/api/services/${encodeURIComponent(_e)}/start`,{}),u(`Starting ${_e}…`)}catch(ft){l(ft instanceof Error?ft.message:`Could not start ${_e}.`)}}function Pi(_e){_e.key==="Enter"&&!_e.shiftKey&&(_e.preventDefault(),ge())}function ii(_e){Lw(_e.dataTransfer)&&(_e.preventDefault(),_e.dataTransfer.dropEffect="copy",C||T(!0),Z(!0))}function kr(_e){_e.currentTarget.contains(_e.relatedTarget)||Z(!1)}function $i(_e){Z(!1);const ft=nI(_e.dataTransfer);ft&&(_e.preventDefault(),M(ft))}function Hi(_e){if(!C)return;_e.preventDefault(),_e.currentTarget.setPointerCapture(_e.pointerId),he(!0);const ft=160,bn=window.innerHeight-48;function Ts(ri){const fs=window.innerHeight-ri.clientY;Q(Math.max(ft,Math.min(bn,fs)))}function gt(){he(!1),window.removeEventListener("pointermove",Ts),window.removeEventListener("pointerup",gt)}window.addEventListener("pointermove",Ts),window.addEventListener("pointerup",gt)}return r.jsx("div",{ref:Le,className:ie("fixed inset-x-0 bottom-0 z-50 flex flex-col border-t border-border bg-card/95 shadow-[0_-8px_24px_-12px_rgba(0,0,0,0.25)] backdrop-blur",re?"select-none":"transition-[height] duration-200",C?L===null?"h-[50vh]":"":V?"h-12":"h-9",V&&!W&&"border-primary/60 bg-primary/5",W&&"outline-dashed outline-2 -outline-offset-2 outline-primary/70"),style:C&&L!==null?{height:L}:void 0,onDragOver:ii,onDragLeave:kr,onDrop:$i,children:C?r.jsxs(r.Fragment,{children:[r.jsx("div",{"aria-hidden":!0,className:"absolute inset-x-0 -top-1 z-10 h-2 cursor-ns-resize",onDoubleClick:()=>Q(null),onPointerDown:Hi}),r.jsxs("div",{className:"pointer-events-none absolute inset-x-0 top-0 z-20 flex items-start justify-between gap-2 px-2 pt-1.5",children:[r.jsxs("div",{className:"pointer-events-auto flex items-center gap-2",children:[r.jsx(Zw,{provider:g,className:"size-4 text-primary"}),r.jsx("span",{className:"text-sm font-medium",children:g?.label??"Agent"}),z?r.jsxs("span",{className:"flex items-center gap-1 rounded-full border border-primary/30 bg-primary/10 px-2 py-0.5 text-[11px] text-primary",children:[r.jsx(pi,{className:"size-3"}),r.jsx("span",{className:"max-w-40 truncate",children:z.label}),r.jsx("button",{"aria-label":"Clear source",className:"opacity-60 hover:opacity-100",onClick:O,type:"button",children:r.jsx(Ft,{className:"size-3"})})]}):null]}),r.jsxs("div",{className:"pointer-events-auto flex items-center gap-1",children:[e?r.jsx(Y,{"aria-label":"Open agent page",className:"size-7",onClick:e,size:"icon",title:"Open the full agent page",type:"button",variant:"ghost",children:r.jsx(_M,{})}):null,r.jsx(Y,{"aria-label":"Clear conversation",className:"size-7",disabled:h.length===0,onClick:w,size:"icon",title:"Clear conversation",type:"button",variant:"ghost",children:r.jsx(yr,{})}),r.jsx(Y,{"aria-label":"Collapse agent",className:"size-7",onClick:()=>T(!1),size:"icon",title:"Collapse",type:"button",variant:"ghost",children:r.jsx(Mn,{})})]})]}),r.jsx("div",{ref:fe,className:"min-h-0 flex-1 overflow-auto px-3 py-3",onScroll:We,children:r.jsxs("div",{className:"mx-auto w-full max-w-4xl space-y-3",children:[h.length===0?r.jsx(u$,{configured:p,provider:g,onOnboard:()=>H(!0)}):h.map((_e,ft)=>r.jsx(m$,{turn:_e,streaming:m&&ft===h.length-1,isLast:ft===h.length-1,onChoose:Re,onStartService:Pt,onOpenService:t,onOpenSqlConsole:s},_e.id)),d?r.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-xs text-destructive",children:[r.jsx(mu,{className:"mt-px size-3.5 shrink-0"}),r.jsx("span",{className:"min-w-0 break-words",children:d})]}):null]})}),x.length>0?r.jsx("div",{className:"shrink-0 space-y-1.5 border-t border-amber-500/25 bg-amber-500/[0.04] px-3 py-2",children:x.map(_e=>r.jsx(g$,{prompt:_e,onRespond:k},_e.requestId))}):null,r.jsxs("div",{className:ie("relative shrink-0 p-2 transition-colors",V&&"bg-primary/5"),children:[n?r.jsx(WI,{git:n,onRefresh:o}):null,K?r.jsx(lP,{onClose:()=>te(!1),onPick:_e=>{te(!1),M(_e)}}):null,r.jsxs("div",{className:"mx-auto w-full max-w-4xl",children:[P?r.jsxs("form",{className:"mb-2 flex items-center gap-2 rounded-md border border-primary/40 bg-primary/5 p-1.5",onSubmit:_e=>{_e.preventDefault(),Te($)},children:[r.jsx(sn,{className:"size-4 shrink-0 text-primary"}),r.jsx("input",{ref:we,className:"min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground",onChange:_e=>q(_e.target.value),placeholder:"Paste a repo URL — e.g. https://github.com/owner/repo",value:$}),r.jsx(Y,{disabled:!$.trim(),size:"sm",type:"submit",children:"Onboard"}),r.jsx(Y,{"aria-label":"Cancel onboarding",className:"size-7",onClick:()=>{H(!1),q("")},size:"icon",type:"button",variant:"ghost",children:r.jsx(Ft,{})})]}):h$(E)&&!m?r.jsxs("button",{className:"mb-2 flex w-full items-center gap-2 rounded-md border border-primary/40 bg-primary/5 px-3 py-1.5 text-left text-xs text-primary transition-colors hover:bg-primary/10",onClick:()=>Te(E),type:"button",children:[r.jsx(sn,{className:"size-3.5 shrink-0"}),r.jsxs("span",{className:"min-w-0 flex-1 truncate",children:["Onboard ",r.jsx("span",{className:"font-mono",children:E.trim()})," as a service"]}),r.jsx(F4,{className:"size-3.5 shrink-0 opacity-60"})]}):null,r.jsxs("div",{className:"flex items-end gap-1.5 rounded-2xl border border-border bg-background px-1.5 py-1.5 shadow-sm transition-colors hover:border-foreground/25 focus-within:border-foreground/40 focus-within:ring-1 focus-within:ring-ring",children:[r.jsx(Y,{"aria-label":"Attach a file or folder",className:"size-8 shrink-0 rounded-full text-muted-foreground hover:text-foreground",disabled:p===!1,onClick:()=>te(!0),size:"icon",title:"Attach a file or folder",type:"button",variant:K?"secondary":"ghost",children:r.jsx(SM,{})}),r.jsx("textarea",{ref:pe,className:"max-h-32 min-h-8 flex-1 resize-none self-center overflow-y-auto bg-transparent px-1 py-1.5 text-sm outline-none placeholder:text-muted-foreground",disabled:p===!1,onChange:_e=>j(_e.target.value),onKeyDown:Pi,placeholder:p===!1?`${g?.label??"Agent"} (\`${g?.commandName??"agent"}\`) is not installed`:`Ask ${g?.label??"the agent"} anything about this project...`,rows:1,value:E}),m?r.jsx(Y,{"aria-label":"Stop generating",className:"size-8 shrink-0 rounded-full",onClick:S,size:"icon",title:"Stop",type:"button",variant:"secondary",children:r.jsx(cl,{className:"size-3.5 fill-current"})}):r.jsx(Y,{"aria-label":"Send message",className:"size-8 shrink-0 rounded-full",disabled:!E.trim()||p===!1,onClick:()=>{ge()},size:"icon",title:"Send",type:"button",children:r.jsx(df,{className:"size-4"})})]})]})]})]}):r.jsx("button",{className:ie("flex h-full w-full items-center gap-2 px-3 text-left text-sm hover:bg-muted/50",V?"font-medium text-primary":"text-muted-foreground"),onClick:()=>T(!0),type:"button",children:V?r.jsxs(r.Fragment,{children:[r.jsx(TN,{className:"size-4 animate-bounce text-primary"}),r.jsx("span",{children:"Drop here to add it to your message"})]}):r.jsxs(r.Fragment,{children:[r.jsx(Zw,{provider:g,className:"size-4 text-primary"}),m?r.jsxs("span",{className:"flex items-center gap-2 text-foreground",children:[r.jsx(ht,{className:"size-3.5 animate-spin"})," ",g?.label??"Agent"," is thinking…"]}):r.jsxs("span",{children:["Ask ",g?.label??"the agent","..."]}),r.jsx("span",{className:"ml-auto text-xs text-muted-foreground/70",children:"click to expand"})]})})})}function Zw({provider:e,className:t}){return e?.id==="claude"?r.jsx(vl,{className:t}):e?.id==="codex"?r.jsx(vu,{className:t}):r.jsx(pi,{className:t})}function u$({configured:e,provider:t,onOnboard:s}){return e===!1?r.jsxs("div",{className:"rounded-md border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground",children:["This dock runs the ",r.jsx("code",{className:"font-mono",children:t?.commandName??"agent"})," ","CLI. ",t?.installHint??"Install the active agent CLI, then reload."]}):r.jsxs("div",{className:"space-y-2 text-xs text-muted-foreground",children:[r.jsx("p",{children:t?.intro??'This is the active agent, running in your workspace with full tools - e.g. "restart the api and tail its logs", "what changed in git and why?", "fix the failing test".'}),r.jsxs("button",{className:"inline-flex items-center gap-1.5 rounded-full border border-primary/40 bg-primary/5 px-2.5 py-1 text-primary transition-colors hover:bg-primary/10",onClick:s,type:"button",children:[r.jsx(sn,{className:"size-3.5"}),"Onboard a repo from a URL"]})]})}const d$=/^(?:https?:\/\/|git@|ssh:\/\/)\S+$/i;function h$(e){const t=e.trim();return t.includes(`
153
+ `)||t.includes(" ")||!d$.test(t)?!1:/github\.com|gitlab\.|bitbucket\.|\.git$/i.test(t)}function f$({turn:e}){const[t,s]=y.useState(!1),n=!!e.label&&e.label!==e.text,o=n&&!t?e.label:e.text;return r.jsx("div",{className:"flex justify-end",children:r.jsxs("div",{className:"flex max-w-[85%] flex-col items-end gap-0.5",children:[r.jsx("div",{className:"whitespace-pre-wrap break-words rounded-2xl rounded-br-sm bg-muted px-3.5 py-2 text-sm text-foreground",children:o}),n?r.jsxs("button",{className:"flex items-center gap-0.5 px-1 text-[11px] text-muted-foreground transition-colors hover:text-foreground",onClick:()=>s(l=>!l),type:"button",children:[t?r.jsx(hf,{className:"size-3"}):r.jsx(Mn,{className:"size-3"}),t?"Hide full prompt":"Show full prompt"]}):null]})})}function m$({turn:e,streaming:t,isLast:s,onChoose:n,onStartService:o,onOpenService:l,onOpenSqlConsole:u}){const h=o$(e.text);if(e.role==="user")return r.jsx(f$,{turn:e});const{body:m,options:d,service:p,sqlWrite:g}=fP(h);return r.jsxs("div",{className:"space-y-1.5",children:[e.tools.map(x=>r.jsx(p$,{tool:x},x.id)),m?r.jsx("div",{className:"break-words px-0.5 text-sm text-foreground",children:r.jsx(r$,{content:m})}):null,d.length>0&&s&&!t?r.jsx(mP,{options:d,onChoose:n}):null,p&&!t?r.jsx(pP,{service:p,onStart:o,onOpen:l}):null,g&&u&&!t?r.jsx(gP,{proposal:g,onOpen:u}):null,t&&!m?r.jsx(l$,{}):null]})}function p$({tool:e}){const t=O3(e.input);return r.jsxs("div",{className:ie("inline-flex max-w-[85%] items-center gap-1.5 rounded-md border px-2 py-1 font-mono text-[11px]",e.isError?"border-destructive/40 bg-destructive/5 text-destructive":"border-border bg-background text-muted-foreground"),children:[e.status==="running"?r.jsx(ht,{className:"size-3 animate-spin"}):r.jsx(d6,{className:"size-3"}),r.jsx("span",{className:"font-semibold",children:e.name}),t?r.jsx("span",{className:"truncate",children:t}):null]})}function g$({prompt:e,onRespond:t}){const s=O3(e.input).slice(0,140);return r.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-amber-500/30 bg-amber-500/5 px-2.5 py-2 text-xs",children:[r.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-md bg-amber-500/15 text-amber-600 dark:text-amber-400",children:r.jsx(WN,{className:"size-4"})}),r.jsxs("div",{className:"min-w-0 flex-1 leading-tight",children:[r.jsx("div",{className:"mb-0.5 text-[10px] font-semibold uppercase tracking-wider text-amber-600 dark:text-amber-400/90",children:"Permission needed"}),r.jsxs("div",{className:"truncate font-mono text-[11px]",children:[r.jsx("span",{className:"font-semibold text-foreground",children:e.name}),s?r.jsx("span",{className:"ml-1 text-muted-foreground",children:s}):null]})]}),r.jsxs(Y,{className:"h-7 gap-1 text-muted-foreground hover:border-destructive/40 hover:bg-destructive/10 hover:text-destructive",onClick:()=>t(e.requestId,"deny"),size:"sm",type:"button",variant:"outline",children:[r.jsx(Ft,{className:"size-3.5"})," Deny"]}),r.jsxs(Y,{className:"h-7 gap-1",onClick:()=>t(e.requestId,"allow"),size:"sm",type:"button",children:[r.jsx(tn,{className:"size-3.5"})," Allow"]})]})}function O3(e){return!e||typeof e!="object"?"":Object.values(e).filter(s=>s!==void 0&&s!=="").map(s=>String(s)).join(" ")}const lg={host:"",port:"",user:"",password:"",database:"",ssl:!1},b$="localhost";function F0(e,t,{includePassword:s=!0}={}){const n=e==="mysql"?"mysql":"postgres",o=t.host.trim()||b$,l=t.port.trim(),u=t.database.trim().replace(/^\//,""),h=t.user.trim(),m=s&&t.password,d=h?`${encodeURIComponent(h)}${m?`:${encodeURIComponent(t.password)}`:""}@`:"",p=l?`:${l}`:"",g=e==="postgres"&&t.ssl?"?sslmode=require":"";return`${n}://${d}${o}${p}/${u}${g}`}function q0(e){if(!e.trim())return null;let t;try{t=new URL(e.trim())}catch{return null}return{host:t.hostname,port:t.port,user:Qw(t.username),password:Qw(t.password),database:t.pathname.replace(/^\//,""),ssl:t.searchParams.get("sslmode")==="require"||t.searchParams.has("ssl")}}function x$(e){const t=/^([a-z0-9+]+):\/\//i.exec(e.trim());if(!t)return null;const s=t[1].toLowerCase();return s.startsWith("postgres")?"postgres":s.startsWith("mysql")?"mysql":s.startsWith("sqlite")||s==="file"?"sqlite":null}function Qw(e){try{return decodeURIComponent(e)}catch{return e}}const v$=[{value:"postgres",label:"Postgres"},{value:"mysql",label:"MySQL"},{value:"sqlite",label:"SQLite"}];function _$({onClose:e,onSaved:t,initial:s}){const{error:n,success:o}=Es(),l=!!s,u=y.useMemo(()=>y$(s),[s]),[h,m]=y.useState(u.engine),[d,p]=y.useState(u.name),[g,x]=y.useState(u.url),[_,S]=y.useState(u.fields),[w,k]=y.useState([]),[C,T]=y.useState({status:"idle"}),[E,j]=y.useState(!1),[M,z]=y.useState(!1);y.useEffect(()=>{l||S6().then(k).catch(()=>k([]))},[l]);const O=h==="sqlite",A=O?g.trim():F0(h,_),D=O?!!g.trim():!!(_.host.trim()&&_.database.trim());function B(){T({status:"idle"})}function P(K,te){return F0(K,te,{includePassword:!1})}function H(K){m(K),B(),K!=="sqlite"&&x(P(K,_))}function $(K){const te={..._,...K};S(te),x(P(h,te)),B()}function q(K){B();const te=x$(K),L=te??h;te&&te!==h&&m(te);const Q=te==="sqlite"?null:q0(K);if(!Q){x(K);return}Q.password?(S(Q),x(P(L,Q))):(S({...Q,password:_.password}),x(K))}function V(K){m(K.engine);const te=K.engine==="sqlite"?null:q0(K.url);te?(S(te),x(P(K.engine,te))):x(K.url),B(),d.trim()||p(S$(K))}function I(){return d.trim()?O?g.trim()?null:"Database file path is required.":_.host.trim()?_.database.trim()?null:"Database name is required.":"Host is required.":"Name is required."}async function W(){if(D){j(!0),B();try{const K=await k6({engine:h,url:A});T(K.ok?{status:"ok",message:"Connected"}:{status:"fail",message:K.error??"Connection failed"})}catch(K){T({status:"fail",message:K instanceof Error?K.message:String(K)})}finally{j(!1)}}}async function Z(){const K=I();if(K){n(K);return}z(!0);try{await w6({name:d.trim(),engine:h,url:A}),o(`Saved connection "${d.trim()}".`),t(),e()}catch(te){n(te instanceof Error?te.message:String(te))}finally{z(!1)}}return r.jsx(Qn,{icon:r.jsx(Zn,{}),onClose:e,title:l?"Edit database connection":"Add database connection",children:r.jsxs("div",{className:"flex flex-col gap-4",children:[w.length>0?r.jsxs("section",{children:[r.jsxs("p",{className:"mb-1.5 flex items-center gap-1.5 text-xs font-medium text-muted-foreground",children:[r.jsx(o6,{className:"size-3.5"}),"Found in your services"]}),r.jsx("div",{className:"flex flex-wrap gap-1.5",children:w.map(K=>r.jsxs("button",{type:"button",onClick:()=>V(K),className:"group flex items-center gap-1.5 rounded-md border border-border bg-background px-2 py-1 text-left text-xs transition-colors hover:border-primary hover:bg-muted",title:K.maskedUrl,children:[r.jsx(ze,{variant:"outline",size:"small",children:K.engine}),r.jsx("span",{className:"font-mono",children:K.service}),r.jsxs("span",{className:"font-mono text-muted-foreground",children:["·",K.key]})]},`${K.service}:${K.key}`))})]}):null,r.jsxs("section",{children:[r.jsx("p",{className:"mb-1.5 text-xs font-medium text-muted-foreground",children:"Engine"}),r.jsx("div",{className:"flex gap-1.5",children:v$.map(K=>r.jsx(Y,{size:"sm",variant:h===K.value?"default":"outline",onClick:()=>H(K.value),disabled:l,type:"button",children:K.label},K.value))})]}),r.jsxs("label",{className:"flex flex-col gap-1.5",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Name"}),r.jsx(tt,{value:d,onChange:K=>p(K.target.value),placeholder:"e.g. shop-db",disabled:l}),l?r.jsx("span",{className:"text-[11px] text-muted-foreground",children:"The name identifies the connection and can't be changed here."}):null]}),O?null:r.jsxs("section",{className:"flex flex-col gap-3",children:[r.jsxs("div",{className:"flex gap-3",children:[r.jsxs("label",{className:"flex flex-1 flex-col gap-1.5",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Host"}),r.jsx(tt,{value:_.host,onChange:K=>$({host:K.target.value}),placeholder:"localhost",className:"font-mono text-xs"})]}),r.jsxs("label",{className:"flex w-24 flex-col gap-1.5",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Port"}),r.jsx(tt,{value:_.port,onChange:K=>$({port:K.target.value}),placeholder:h==="mysql"?"3306":"5432",className:"font-mono text-xs"})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsxs("label",{className:"flex flex-1 flex-col gap-1.5",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"User"}),r.jsx(tt,{value:_.user,onChange:K=>$({user:K.target.value}),placeholder:"postgres",className:"font-mono text-xs"})]}),r.jsxs("label",{className:"flex flex-1 flex-col gap-1.5",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Password"}),r.jsx(tt,{type:"password",value:_.password,onChange:K=>$({password:K.target.value}),placeholder:l?"leave blank to keep current":"••••••••",className:"font-mono text-xs"})]})]}),r.jsxs("label",{className:"flex flex-col gap-1.5",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Database"}),r.jsx(tt,{value:_.database,onChange:K=>$({database:K.target.value}),placeholder:"app",className:"font-mono text-xs"})]}),h==="postgres"?r.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("input",{type:"checkbox",checked:_.ssl,onChange:K=>$({ssl:K.target.checked}),className:"size-3.5 accent-primary"}),"Require SSL (adds ",r.jsx("span",{className:"font-mono",children:"?sslmode=require"}),")"]}):null]}),r.jsxs("label",{className:"flex flex-col gap-1.5",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:O?"Database file path":"Connection URL"}),r.jsx(tt,{value:g,onChange:K=>q(K.target.value),placeholder:O?"/abs/path/to/app.db":h==="mysql"?"mysql://user:pass@host:3306/db":"postgres://user:pass@host:5432/db",className:"font-mono text-xs"}),r.jsx("span",{className:"text-[11px] text-muted-foreground",children:O?"Read-only. Stored like a secret and masked in the UI and API.":"Synced with the fields above; the password stays in its field and is never shown here. Stored like a secret and masked in the UI and API."})]}),C.status!=="idle"?r.jsxs("div",{className:`flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 text-xs ${C.status==="ok"?"border-emerald-500/40 text-emerald-600 dark:text-emerald-400":"border-destructive/40 text-destructive"}`,children:[C.status==="ok"?r.jsx(tn,{className:"size-3.5"}):r.jsx(Ft,{className:"size-3.5"}),r.jsx("span",{className:"break-all font-mono",children:C.message})]}):null,r.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-border pt-3",children:[r.jsxs(Y,{variant:"outline",size:"sm",onClick:()=>{W()},disabled:E||!D,type:"button",children:[E?r.jsx(ht,{className:"animate-spin"}):null,"Test connection"]}),r.jsxs(Y,{size:"sm",onClick:()=>{Z()},disabled:M,type:"button",children:[M?r.jsx(ht,{className:"animate-spin"}):null,l?"Save changes":"Save"]})]})]})})}function y$(e){if(!e)return{engine:"postgres",name:"",fields:lg,url:""};if(e.engine==="sqlite")return{engine:"sqlite",name:e.name,fields:lg,url:e.url};const t=q0(e.url),s=t?{...t,password:""}:lg;return{engine:e.engine,name:e.name,fields:s,url:F0(e.engine,s,{includePassword:!1})}}function S$(e){try{const s=new URL(e.url).pathname.replace(/^\//,"");if(s)return`${e.service}-${s}`}catch{}return`${e.service}-${e.engine}`}function w$({connections:e,selected:t,onSelect:s,onAdd:n,onEdit:o,onRemove:l}){const[u,h]=y.useState(!1),m=y.useRef(null),d=e.find(p=>p.name===t);return y.useEffect(()=>{if(!u)return;function p(g){m.current&&g.target instanceof Node&&!m.current.contains(g.target)&&h(!1)}return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[u]),r.jsxs("div",{className:"relative z-50 flex items-center gap-2",ref:m,children:[r.jsxs(Y,{className:"max-w-[240px] justify-start gap-2 rounded-md border-border bg-card",onClick:()=>h(p=>!p),size:"sm",type:"button",variant:"outline",children:[r.jsx(Zn,{className:"text-muted-foreground"}),r.jsx("span",{className:"truncate",children:d?.name??"Select connection"}),d?r.jsx(ze,{variant:"outline",size:"small",children:d.engine}):null,r.jsx(Mn,{className:ie("ml-auto transition-transform",u&&"rotate-180")})]}),u?r.jsxs("div",{className:"absolute right-0 top-10 z-50 w-[min(420px,calc(100vw-2rem))] overflow-hidden rounded-lg border border-border bg-card shadow-lg",children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[r.jsx(Zn,{className:"size-3.5 text-muted-foreground"}),r.jsx("div",{className:"text-xs font-semibold",children:"Connections"}),r.jsx(ze,{className:"ml-auto",variant:"outline",size:"small",children:e.length})]}),r.jsx("div",{className:"max-h-72 overflow-auto",children:e.length?r.jsx("div",{className:"divide-y divide-border",children:e.map(p=>{const g=p.name===t;return r.jsxs("div",{className:ie("group grid w-full grid-cols-[1fr_auto_auto_auto] items-center gap-2 px-3 py-1.5 text-left transition-colors hover:bg-muted",g&&"bg-muted/70"),children:[r.jsxs("button",{className:"min-w-0 text-left",onClick:()=>{s(p.name),h(!1)},type:"button",children:[r.jsx("span",{className:"block truncate text-sm font-medium leading-tight",children:p.name}),r.jsx("span",{className:"block truncate font-mono text-[10px] leading-tight text-muted-foreground",children:p.url})]}),g?r.jsx(tn,{className:"size-3.5"}):r.jsx("span",{className:"size-3.5"}),r.jsx(Y,{"aria-label":`Edit ${p.name}`,className:"size-6 opacity-0 transition-opacity group-hover:opacity-100",onClick:()=>{o(p),h(!1)},size:"icon",title:`Edit ${p.name}`,type:"button",variant:"ghost",children:r.jsx(ll,{className:"size-3.5"})}),r.jsx(Y,{"aria-label":`Remove ${p.name}`,className:"size-6 opacity-0 transition-opacity group-hover:opacity-100",onClick:()=>l(p.name),size:"icon",title:`Remove ${p.name}`,type:"button",variant:"ghost",children:r.jsx(yr,{className:"size-3.5 text-destructive"})})]},p.name)})}):r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"No saved connections yet."})}),r.jsx("div",{className:"border-t border-border bg-muted/20 p-2",children:r.jsxs(Y,{className:"w-full",onClick:()=>{n(),h(!1)},size:"sm",type:"button",children:[r.jsx(hs,{className:"size-3"}),"Add connection"]})})]}):null]})}function k$({onAddManual:e,onAddWithAi:t}){const[s,n]=y.useState(!1),o=y.useRef(null);y.useEffect(()=>{if(!s)return;function u(h){o.current&&h.target instanceof Node&&!o.current.contains(h.target)&&n(!1)}return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]);function l(u){n(!1),u()}return r.jsxs("div",{className:"relative",ref:o,children:[r.jsxs(Y,{"aria-label":"Add database connection",onClick:()=>n(u=>!u),size:"sm",type:"button",children:[r.jsx(hs,{className:"size-3.5"}),"Add"]}),s?r.jsxs("div",{className:"absolute right-0 top-9 z-50 w-56 overflow-hidden rounded-lg border border-border bg-card shadow-lg",children:[r.jsxs("button",{className:"flex w-full items-center gap-2 px-3 py-2 text-left text-sm transition-colors hover:bg-muted",onClick:()=>l(e),type:"button",children:[r.jsx(Zn,{className:"size-3.5 text-muted-foreground"}),"Add connection"]}),r.jsxs("button",{className:"flex w-full items-center gap-2 border-t border-border px-3 py-2 text-left text-sm transition-colors hover:bg-muted",onClick:()=>l(t),type:"button",children:[r.jsx(pi,{className:"size-3.5 text-muted-foreground"}),"Add with AI"]})]}):null]})}function N$(){const[e,t]=y.useState([]),[s,n]=y.useState(!0),[o,l]=y.useState(null),u=y.useCallback(async()=>{n(!0),l(null);try{t(await JN())}catch(h){l(h instanceof Error?h.message:String(h))}finally{n(!1)}},[]);return y.useEffect(()=>{u()},[u]),{connections:e,loading:s,error:o,refresh:u}}const L3=[50,100,500,1e3];function C$(e){const[t,s]=y.useState(null),[n,o]=y.useState(null),[l,u]=y.useState(!1);y.useEffect(()=>{s(null),o(null)},[e]);const h=y.useCallback(async(d,p)=>{if(!(!e||!d.trim())){u(!0),o(null);try{s(await C6(e,d,p))}catch(g){s(null),o(g instanceof Error?g.message:String(g))}finally{u(!1)}}},[e]),m=y.useCallback(()=>{s(null),o(null)},[]);return{result:t,error:n,running:l,run:h,reset:m}}const E$=["select","show","explain","pragma","describe","desc"];function j$(e){const t=/^\s*([a-z]+)/i.exec(e)?.[1]?.toLowerCase()??"";return E$.includes(t)}function T$(e){const[t,s]=y.useState(null),[n,o]=y.useState(null),[l,u]=y.useState(null),[h,m]=y.useState(!1),[d,p]=y.useState(!1);y.useEffect(()=>{s(null),o(null),u(null)},[e]);const g=y.useCallback(async w=>{if(!(!e||!w.trim())){m(!0),u(null),o(null);try{const k=await Xy(e,w,"preview");s({sql:w,preview:k})}catch(k){u(k instanceof Error?k.message:String(k))}finally{m(!1)}}},[e]),x=y.useCallback(async()=>{if(!e||!t)return null;p(!0),u(null);try{const w=await Xy(e,t.sql,"commit");return o(w),s(null),w}catch(w){return s(null),u(w instanceof Error?w.message:String(w)),null}finally{p(!1)}},[e,t]),_=y.useCallback(()=>s(null),[]),S=y.useCallback(()=>{s(null),o(null),u(null)},[]);return{pending:t,committed:n,error:l,previewing:h,committing:d,preview:g,commit:x,cancel:_,reset:S}}function A$(e,t){const[s,n]=y.useState(!1),o=y.useCallback(async l=>{if(e){n(!0);try{await E6(e,l),t()}finally{n(!1)}}},[e,t]);return{updating:s,setUnlocked:o}}function R$(e){const[t,s]=y.useState([]),[n,o]=y.useState(null),[l,u]=y.useState(null),[h,m]=y.useState(null),[d,p]=y.useState(null),[g,x]=y.useState(!1),[_,S]=y.useState(!1),[w,k]=y.useState(100),[C,T]=y.useState(0);y.useEffect(()=>{T(0)},[e,n]),y.useEffect(()=>{if(s([]),o(null),u(null),m(null),p(null),!e)return;let A=!1;return x(!0),eC(e).then(D=>{A||(s(D),o(D[0]?.qualifiedName??null))}).catch(D=>{A||m(D instanceof Error?D.message:String(D))}).finally(()=>{A||x(!1)}),()=>{A=!0}},[e]),y.useEffect(()=>{if(u(null),p(null),!e||!n)return;let A=!1;return S(!0),j6(e,n,w,C).then(D=>{A||u(D)}).catch(D=>{A||p(D instanceof Error?D.message:String(D))}).finally(()=>{A||S(!1)}),()=>{A=!0}},[e,n,w,C]);const E=C>0,j=l?l.rowCount===w:!1;function M(A){k(A),T(0)}function z(){j&&T(A=>A+w)}function O(){T(A=>Math.max(0,A-w))}return{tables:t,selectedTable:n,setSelectedTable:o,sample:l,tablesError:h,rowsError:d,loadingTables:g,loadingRows:_,limit:w,offset:C,canPrev:E,canNext:j,changePageSize:M,nextPage:z,prevPage:O}}function M$(e,t,s,n){const{sendToAgent:o,streaming:l,turns:u}=At(),[h,m]=y.useState(!1),[d,p]=y.useState(null),g=y.useRef(u);y.useEffect(()=>{g.current=u},[u]);const x=y.useRef(!1),_=y.useRef(null);return y.useEffect(()=>{if(l)x.current=!0;else if(x.current&&_.current){const w=_.current;_.current=null,w()}},[l]),{generate:y.useCallback(async w=>{if(!e||!w.trim()||h)return;m(!0),p(null);let k=[];try{k=await eC(e)}catch{k=[]}x.current=!1;const C=new Promise(T=>{let E=!1;const j=()=>{E||(E=!0,clearTimeout(M),_.current=null,T())};_.current=j;const M=setTimeout(()=>{x.current||j()},8e3)});o({prompt:uB(e,w,{engine:t,tables:k,unlocked:s}),source:{type:"database-sql-generate",label:"Generate SQL"},label:`Generate SQL: ${w}`,background:!0});try{await C;const T=O$(D$(g.current));T?n(T):p("The agent didn't return a SQL block — open the dock to see its reply.")}finally{m(!1)}},[e,t,s,h,n,o]),generating:h,error:d}}function D$(e){for(let t=e.length-1;t>=0;t--)if(e[t].role==="assistant")return e[t].text.trim();return""}function O$(e){if(!e)return null;const s=/```(?:sql)?\s*\n?([\s\S]*?)```/i.exec(e)?.[1]?.trim();return s||null}function z3({items:e,label:t="More actions",className:s}){const[n,o]=y.useState(!1),[l,u]=y.useState({top:0,right:0}),h=y.useRef(null),m=y.useRef(null);function d(){const p=h.current?.getBoundingClientRect();p&&u({top:p.bottom+4,right:window.innerWidth-p.right}),o(g=>!g)}return y.useEffect(()=>{if(!n)return;function p(_){const S=_.target;h.current?.contains(S)||m.current?.contains(S)||o(!1)}function g(_){_.key==="Escape"&&o(!1)}const x=()=>o(!1);return document.addEventListener("mousedown",p),document.addEventListener("keydown",g),window.addEventListener("scroll",x,!0),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",g),window.removeEventListener("scroll",x,!0)}},[n]),r.jsxs(r.Fragment,{children:[r.jsx("button",{"aria-label":t,className:ie("flex size-6 items-center justify-center rounded-md text-muted-foreground opacity-0 transition-all duration-150 hover:bg-muted hover:text-foreground group-hover:opacity-100",n&&"opacity-100",s),onClick:d,ref:h,title:t,type:"button",children:r.jsx(AN,{className:"size-3.5"})}),n?io.createPortal(r.jsx("div",{className:"fixed z-50 min-w-44 overflow-hidden rounded-md border border-border bg-card p-1 shadow-md",ref:m,style:{top:l.top,right:l.right},children:e.map(p=>r.jsxs("button",{className:"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-xs text-foreground transition-colors hover:bg-muted",onClick:()=>{o(!1),p.onSelect()},type:"button",children:[p.icon?r.jsx("span",{className:"text-muted-foreground",children:p.icon}):null,p.label]},p.label))}),document.body):null]})}function L$({connection:e,sample:t}){const{sendToAgent:s}=At(),{success:n,error:o}=Es(),l=t.columns.map(p=>p.name);function u(p){s({prompt:cB(e,t.engine,t.table,t.columns,p),source:{type:"database-row",label:`${t.table} row`},mode:"draft"})}async function h(p,g){try{await navigator.clipboard.writeText(p),n(`Copied ${g}.`)}catch(x){o(x instanceof Error?x.message:String(x))}}function m(p){const g=x=>{const _=Yc(x);return/[",\n]/.test(_)?`"${_.replace(/"/g,'""')}"`:_};return`${l.join(",")}
154
+ ${l.map(x=>g(p[x])).join(",")}`}function d(p){const g=_=>_==null?"NULL":typeof _=="number"||typeof _=="boolean"?String(_):`'${(typeof _=="object"?JSON.stringify(_):String(_)).replace(/'/g,"''")}'`,x=l.map(_=>g(p[_])).join(", ");return`INSERT INTO ${t.table} (${l.join(", ")}) VALUES (${x});`}return t.columns.length===0?r.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"This table has no columns."}):r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:r.jsxs("table",{className:"w-max min-w-full border-collapse text-left font-mono text-[11px]",children:[r.jsx("thead",{className:"sticky top-0 z-10 bg-card",children:r.jsxs("tr",{className:"border-b border-border",children:[t.columns.map(p=>r.jsxs("th",{className:"whitespace-nowrap px-3 py-2 font-semibold text-foreground",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[p.primaryKey?r.jsx(IN,{className:"size-3 text-amber-500"}):null,p.name]}),r.jsx("span",{className:"block text-[10px] font-normal text-muted-foreground",children:p.dataType})]},p.name)),r.jsx("th",{className:"sticky right-0 z-20 w-16 border-l border-border bg-card px-2 py-2"})]})}),r.jsxs("tbody",{children:[t.rows.map((p,g)=>r.jsxs("tr",{className:"group border-b border-border/60 hover:bg-muted/40",children:[t.columns.map(x=>r.jsx("td",{className:"max-w-[320px] truncate px-3 py-1 align-top text-muted-foreground",title:Yc(p[x.name]),children:Yc(p[x.name])},x.name)),r.jsx("td",{className:"sticky right-0 z-[1] border-l border-border/60 bg-card px-2 py-1 align-top before:pointer-events-none before:absolute before:inset-0 before:bg-muted/40 before:opacity-0 group-hover:before:opacity-100",children:r.jsxs("div",{className:"relative z-[1] flex items-center justify-end gap-0.5",children:[r.jsx(hl,{label:"Ask AI about this row",onAsk:()=>u(p)}),r.jsx(z3,{label:"Row actions",items:[{label:"Copy as JSON",icon:r.jsx(x4,{className:"size-3.5"}),onSelect:()=>{h(JSON.stringify(p,null,2),"row as JSON")}},{label:"Copy as CSV",icon:r.jsx(oR,{className:"size-3.5"}),onSelect:()=>{h(m(p),"row as CSV")}},{label:"Copy as SQL INSERT",icon:r.jsx(Zn,{className:"size-3.5"}),onSelect:()=>{h(d(p),"INSERT statement")}}]})]})})]},g)),t.rows.length===0?r.jsx("tr",{children:r.jsx("td",{colSpan:t.columns.length+1,className:"px-3 py-6 text-center text-muted-foreground",children:"No rows."})}):null]})]})})}function Yc(e){return e==null?"NULL":typeof e=="object"?JSON.stringify(e):String(e)}function z$({connection:e,busy:t,onConfirm:s,onClose:n}){return r.jsx(Qn,{icon:r.jsx(WN,{className:"text-amber-500"}),onClose:n,title:`Unlock writes on "${e}"?`,children:r.jsxs("div",{className:"flex flex-col gap-4 text-sm",children:[r.jsxs("p",{className:"text-muted-foreground",children:["This lets the SQL console run statements that ",r.jsx("strong",{children:"change data"})," ","— ",r.jsx("span",{className:"font-mono",children:"INSERT"}),","," ",r.jsx("span",{className:"font-mono",children:"UPDATE"}),","," ",r.jsx("span",{className:"font-mono",children:"DELETE"}),", and DDL like"," ",r.jsx("span",{className:"font-mono",children:"DROP"}),". Writes still preview their affected rows before they commit, but an unlocked connection can modify or destroy real data."]}),r.jsx("p",{className:"text-muted-foreground",children:"The lock stays open for this connection until you re-lock it. It is never shared with the AI agent."}),r.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-border pt-3",children:[r.jsx(Y,{variant:"outline",size:"sm",onClick:n,type:"button",children:"Cancel"}),r.jsxs(Y,{size:"sm",onClick:s,disabled:t,type:"button",children:[t?r.jsx(ht,{className:"animate-spin"}):r.jsx(PN,{}),"Unlock writes"]})]})]})})}function B$({sql:e,preview:t,busy:s,onConfirm:n,onClose:o}){return r.jsx(Qn,{icon:r.jsx(mu,{className:"text-amber-500"}),onClose:o,title:"Confirm write",children:r.jsxs("div",{className:"flex flex-col gap-4 text-sm",children:[r.jsx("pre",{className:"max-h-40 overflow-auto rounded-md border border-border bg-muted/40 px-3 py-2 font-mono text-[11px] whitespace-pre-wrap",children:e}),t.previewUnavailable?r.jsx("p",{className:"rounded-md border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-[13px] text-amber-700 dark:text-amber-300",children:"This statement can’t be previewed — DDL commits immediately on this engine and cannot be rolled back. Running it applies the change at once."}):r.jsxs("p",{className:"text-muted-foreground",children:["This will affect"," ",r.jsx("strong",{className:"text-foreground tabular-nums",children:t.affectedRows??0})," ","row",t.affectedRows===1?"":"s",". The preview ran in a transaction that was rolled back — nothing has changed yet."]}),r.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-border pt-3",children:[r.jsx(Y,{variant:"outline",size:"sm",onClick:o,type:"button",children:"Cancel"}),r.jsxs(Y,{size:"sm",className:"bg-amber-600 text-white hover:bg-amber-600/90",onClick:n,disabled:s,type:"button",children:[s?r.jsx(ht,{className:"animate-spin"}):null,"Run & commit"]})]})]})})}function I$({connection:e,engine:t,unlocked:s,seed:n,onWriteAccessChange:o}){const{success:l}=Es(),{sendToAgent:u}=At(),h=C$(e),m=T$(e),d=A$(e,o),[p,g]=y.useState(n?.sql??""),[x,_]=y.useState(100),S=n?.nonce;y.useEffect(()=>{n&&g(n.sql)},[S]);const[w,k]=y.useState(!1),C=M$(e,t,s,g),T=p.trim().length>0&&!j$(p),E=s&&T,j=T&&!s,M=h.running||m.previewing;function z(){if(p.trim()){if(j){k(!0);return}E?(h.reset(),m.preview(p)):(m.reset(),h.run(p,x))}}function O(B){(B.metaKey||B.ctrlKey)&&B.key==="Enter"&&(B.preventDefault(),z())}function A(B){u({prompt:dB(e,t,p,B),source:{type:"database-sql-debug",label:"Debug SQL"},label:"Debug this SQL error"})}async function D(){const B=await m.commit();if(B?.committed){const P=B.affectedRows??0;l(`Committed — ${P} row${P===1?"":"s"} affected.`)}}return r.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[r.jsxs("div",{className:"shrink-0 border-b border-border p-2",children:[r.jsx(P$,{generate:C}),r.jsx("textarea",{value:p,onChange:B=>g(B.target.value),onKeyDown:O,spellCheck:!1,placeholder:s?"SELECT … / INSERT … / UPDATE … (Cmd/Ctrl+Enter to run)":"SELECT * FROM … (read-only — Cmd/Ctrl+Enter to run)",className:"h-24 w-full resize-y rounded-md border border-border bg-background px-2 py-1.5 font-mono text-[12px] outline-none focus:border-ring"}),r.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[r.jsx($$,{unlocked:s,updating:d.updating,onUnlock:()=>k(!0),onLock:()=>{d.setUnlocked(!1)}}),r.jsxs("div",{className:"flex items-center gap-2",children:[E?null:r.jsx("select",{"aria-label":"Max rows",className:"rounded-md border border-border bg-background px-1.5 py-1 text-[11px]",value:x,onChange:B=>_(Number(B.target.value)),children:L3.map(B=>r.jsxs("option",{value:B,children:[B," rows"]},B))}),r.jsxs(Y,{size:"sm",className:ie("h-7 px-3",E&&"bg-amber-600 text-white hover:bg-amber-600/90"),onClick:z,disabled:M||!p.trim(),type:"button",children:[M?r.jsx(ht,{className:"size-3.5 animate-spin"}):r.jsx(vr,{className:"size-3.5"}),E?"Preview write":"Run"]})]})]})]}),r.jsx(H$,{read:h,write:m,onDebug:A}),w?r.jsx(z$,{connection:e,busy:d.updating,onConfirm:async()=>{await d.setUnlocked(!0),k(!1)},onClose:()=>k(!1)}):null,m.pending?r.jsx(B$,{sql:m.pending.sql,preview:m.pending.preview,busy:m.committing,onConfirm:()=>{D()},onClose:m.cancel}):null]})}function P$({generate:e}){const[t,s]=y.useState("");function n(){const l=t.trim();!l||e.generating||e.generate(l)}function o(l){l.key==="Enter"&&(l.preventDefault(),n())}return r.jsxs("div",{className:"mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Tt,{className:"pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2"}),r.jsx("input",{value:t,onChange:l=>s(l.target.value),onKeyDown:o,disabled:e.generating,placeholder:"Describe the query in plain English — AI writes the SQL below",className:"h-8 w-full rounded-md border border-border bg-background pl-7 pr-2 text-[12px] outline-none focus:border-ring disabled:opacity-60"})]}),r.jsxs(Y,{size:"sm",variant:"outline",className:"h-8 px-3",onClick:n,disabled:e.generating||!t.trim(),type:"button",children:[e.generating?r.jsx(ht,{className:"size-3.5 animate-spin"}):r.jsx(Tt,{className:"size-3.5"}),e.generating?"Generating…":"Ask AI"]})]}),e.error?r.jsx("p",{className:"mt-1 text-[11px] text-amber-600 dark:text-amber-400",children:e.error}):null]})}function $$({unlocked:e,updating:t,onUnlock:s,onLock:n}){return r.jsxs("button",{type:"button",onClick:e?n:s,disabled:t,className:ie("flex items-center gap-1.5 rounded-md border px-2 py-1 text-[11px] font-medium transition-colors",e?"border-amber-500/50 text-amber-600 hover:bg-amber-500/10 dark:text-amber-400":"border-border text-muted-foreground hover:text-foreground"),title:e?"Writes unlocked — click to lock":"Read-only — click to unlock writes",children:[t?r.jsx(ht,{className:"size-3.5 animate-spin"}):e?r.jsx(PN,{className:"size-3.5"}):r.jsx(YR,{className:"size-3.5"}),e?"Writes unlocked":"Read-only"]})}function H$({read:e,write:t,onDebug:s}){const n=t.error??e.error;return r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:n?r.jsxs("div",{className:"space-y-3 p-4",children:[r.jsx("p",{className:"whitespace-pre-wrap font-mono text-[12px] text-destructive",children:n}),r.jsxs(Y,{size:"sm",variant:"outline",className:"h-7 px-3",onClick:()=>s(n),type:"button",children:[r.jsx(Tt,{className:"size-3.5"}),"Debug with AI"]})]}):t.committed?r.jsx(U$,{outcome:t.committed}):e.result?r.jsx(B3,{columns:e.result.columns,rows:e.result.rows,truncated:e.result.truncated}):r.jsx("div",{className:"flex h-full items-center justify-center p-8 text-center text-sm text-muted-foreground",children:"Write a query and run it to see results here."})})}function U$({outcome:e}){if(!e)return null;const t=e.affectedRows??0;return r.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-1.5 border-b border-border bg-emerald-500/10 px-3 py-1.5 text-[12px] text-emerald-700 dark:text-emerald-400",children:[r.jsx(tn,{className:"size-3.5"}),"Committed — ",t," row",t===1?"":"s"," affected."]}),e.rows&&e.rows.length>0&&e.columns?r.jsx(B3,{columns:e.columns,rows:e.rows}):null]})}function B3({columns:e,rows:t,truncated:s=!1}){return e.length===0?r.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"Query ran successfully — no columns returned."}):r.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[s?r.jsxs("div",{className:"flex shrink-0 items-center gap-1.5 border-b border-border bg-amber-500/10 px-3 py-1.5 text-[11px] text-amber-600 dark:text-amber-400",children:[r.jsx(mu,{className:"size-3.5"}),"Showing the first ",t.length," rows — add a LIMIT to narrow the result."]}):null,r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:r.jsxs("table",{className:"w-max min-w-full border-collapse text-left font-mono text-[11px]",children:[r.jsx("thead",{className:"sticky top-0 z-10 bg-card",children:r.jsx("tr",{className:"border-b border-border",children:e.map(n=>r.jsx("th",{className:"whitespace-nowrap px-3 py-2 font-semibold text-foreground",children:n.name},n.name))})}),r.jsxs("tbody",{children:[t.map((n,o)=>r.jsx("tr",{className:"border-b border-border/60 hover:bg-muted/40",children:e.map(l=>r.jsx("td",{className:"max-w-[320px] truncate px-3 py-1 align-top text-muted-foreground",title:Yc(n[l.name]),children:Yc(n[l.name])},l.name))},o)),t.length===0?r.jsx("tr",{children:r.jsx("td",{colSpan:e.length,className:"px-3 py-6 text-center text-muted-foreground",children:"No rows."})}):null]})]})})]})}function F$({staged:e,onStageConsumed:t}={}){const{connections:s,loading:n,error:o,refresh:l}=N$(),{error:u,success:h}=Es(),{sendToAgent:m}=At(),[d,p]=y.useState(null),[g,x]=y.useState("browse"),[_,S]=y.useState(null),[w,k]=y.useState(null);y.useEffect(()=>{e&&(e.connection&&p(e.connection),x("query"),k({sql:e.sql,nonce:e.nonce}),t?.())},[e?.nonce]);function C(){m({prompt:aB,source:{type:"database-setup",label:"Add a database"},label:"Help me connect a database, one step at a time."})}y.useEffect(()=>{if(s.length===0){p(null);return}p(j=>j&&s.some(M=>M.name===j)?j:s[0].name)},[s]);async function T(j){try{await N6(j),h(`Removed connection "${j}".`),await l()}catch(M){u(M instanceof Error?M.message:String(M))}}function E(j){S({mode:"edit",target:j})}return r.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/85",children:[r.jsxs("header",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Zn,{className:"size-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm font-semibold",children:"Databases"}),n&&s.length===0?r.jsx(ht,{className:"size-3.5 animate-spin text-muted-foreground"}):null]}),r.jsxs("div",{className:"flex items-center gap-2",children:[d?r.jsx(q$,{mode:g,onChange:x}):null,r.jsx(w$,{connections:s,selected:d,onSelect:p,onAdd:()=>S({mode:"add"}),onEdit:E,onRemove:j=>{T(j)}}),r.jsx(k$,{onAddManual:()=>S({mode:"add"}),onAddWithAi:C})]})]}),r.jsx("div",{className:"min-h-0 flex-1",children:o?r.jsx("div",{className:"p-4",children:r.jsx($e,{variant:"muted",className:"border-destructive/40 text-destructive",children:o})}):d?g==="query"?r.jsx(I$,{connection:d,engine:s.find(j=>j.name===d)?.engine,unlocked:s.find(j=>j.name===d)?.writeUnlocked??!1,seed:w,onWriteAccessChange:l},d):r.jsx(V$,{connection:d}):r.jsx(G$,{onAdd:()=>S({mode:"add"}),onAddWithAi:C})}),_?r.jsx(_$,{initial:_.mode==="edit"?_.target:void 0,onClose:()=>S(null),onSaved:l}):null]})}function q$({mode:e,onChange:t}){const s=[{value:"browse",label:"Browse",icon:XN},{value:"query",label:"SQL",icon:pl}];return r.jsx("div",{className:"flex items-center rounded-md border border-border p-0.5",children:s.map(n=>{const o=n.icon;return r.jsxs("button",{type:"button",onClick:()=>t(n.value),className:ie("flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium transition-colors",e===n.value?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"),children:[r.jsx(o,{className:"size-3.5"}),n.label]},n.value)})})}function V$({connection:e}){const{sendToAgent:t}=At(),{tables:s,selectedTable:n,setSelectedTable:o,sample:l,tablesError:u,rowsError:h,loadingTables:m,loadingRows:d,limit:p,offset:g,canPrev:x,canNext:_,changePageSize:S,nextPage:w,prevPage:k}=R$(e);function C(E){t({prompt:Rw(e,E.table,{engine:E.engine,columns:E.columns}),source:{type:"database-table",label:`${E.table.name} table`},mode:"draft"})}function T(E){t({prompt:Rw(e,E),source:{type:"database-table",label:`${E.name} table`},mode:"draft"})}return r.jsxs("div",{className:"flex h-full min-h-0",children:[r.jsxs("div",{className:"flex w-56 shrink-0 flex-col border-r border-border",children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[r.jsx(XN,{className:"size-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm font-semibold",children:"Tables"}),r.jsx(ze,{variant:"outline",size:"small",children:s.length}),m?r.jsx(ht,{className:"size-3.5 animate-spin"}):null]}),u?r.jsx("div",{className:"p-3",children:r.jsx($e,{variant:"muted",className:"border-destructive/40 text-destructive",children:u})}):r.jsxs("ul",{className:"min-h-0 flex-1 overflow-auto",children:[s.map(E=>r.jsxs("li",{className:ie("group flex items-center gap-1 pr-1 transition-colors hover:bg-muted/50",E.qualifiedName===n&&"bg-muted/70"),children:[r.jsx("button",{type:"button",onClick:()=>o(E.qualifiedName),className:ie("min-w-0 flex-1 truncate px-3 py-1.5 text-left font-mono text-[11px]",E.qualifiedName===n&&"font-semibold"),children:E.qualifiedName}),r.jsx(hl,{label:`Ask AI about \`${E.qualifiedName}\``,onAsk:()=>T(E)})]},E.qualifiedName)),!m&&s.length===0?r.jsx("li",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No tables."}):null]})]}),r.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[r.jsxs("div",{className:"group flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-2",children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[r.jsx("span",{className:"truncate font-mono text-xs font-semibold",children:n??"Select a table"}),l?r.jsx(hl,{label:`Ask AI about \`${l.table.qualifiedName}\``,onAsk:()=>C(l)}):null]}),l?r.jsxs("div",{className:"flex shrink-0 items-center gap-2 text-[11px] text-muted-foreground",children:[r.jsx("span",{className:"tabular-nums",children:l.rowCount===0?"no rows":`rows ${g+1}–${g+l.rowCount}`}),r.jsx("select",{"aria-label":"Rows per page",className:"rounded-md border border-border bg-background px-1.5 py-0.5 text-[11px]",value:p,onChange:E=>S(Number(E.target.value)),children:L3.map(E=>r.jsxs("option",{value:E,children:[E," / page"]},E))}),r.jsx(Y,{size:"sm",variant:"outline",className:"h-6 px-2",onClick:k,disabled:!x,type:"button",children:"Prev"}),r.jsx(Y,{size:"sm",variant:"outline",className:"h-6 px-2",onClick:w,disabled:!_,type:"button",children:"Next"})]}):null]}),h?r.jsx("div",{className:"p-4",children:r.jsx($e,{variant:"muted",className:"border-destructive/40 text-destructive",children:h})}):d?r.jsxs("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:[r.jsx(ht,{className:"mr-2 size-4 animate-spin"}),"Loading rows…"]}):l?r.jsx(L$,{connection:e,sample:l}):r.jsx("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:"Pick a table to sample its rows."})]})]})}function G$({onAdd:e,onAddWithAi:t}){return r.jsx("div",{className:"flex h-full items-center justify-center p-8 text-center",children:r.jsxs("div",{className:"max-w-sm",children:[r.jsx(Zn,{className:"mx-auto size-8 text-muted-foreground/50"}),r.jsx("p",{className:"mt-3 text-sm font-medium",children:"No connections yet"}),r.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Add a read-only Postgres, MySQL, or SQLite connection to browse tables and sample rows. NoMoreIDE can auto-detect connection strings from your services' ",r.jsx("code",{children:".env"})," files."]}),r.jsxs("div",{className:"mt-4 flex items-center justify-center gap-2",children:[r.jsxs(Y,{size:"sm",onClick:e,type:"button",children:[r.jsx(hs,{}),"Add connection"]}),r.jsxs(Y,{size:"sm",variant:"outline",onClick:t,type:"button",children:[r.jsx(pi,{}),"Add with AI"]})]})]})})}function W$({incident:e}){const{error:t}=Es(),{sendToAgent:s}=At(),[n,o]=y.useState(!1);async function l(){o(!0);try{const{prompt:u}=await T6(e.id);s({prompt:u,source:{type:"error",label:`${e.service} — ${e.level}`},label:`Help me debug this ${e.level} in \`${e.service}\`: ${e.title}`})}catch(u){t(u instanceof Error?u.message:String(u))}finally{o(!1)}}return r.jsxs("div",{className:"flex h-full min-h-0 min-w-0 flex-col",children:[r.jsxs("div",{className:"shrink-0 border-b border-border px-4 py-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx(ze,{variant:e.level==="error"?"danger":"secondary",appearance:"subtle",size:"small",children:e.level}),r.jsx("span",{className:"truncate font-mono text-xs font-semibold",children:e.service}),e.count>1?r.jsxs(ze,{variant:"outline",size:"small",children:["×",e.count]}):null]}),r.jsxs(Y,{onClick:()=>{l()},disabled:n,size:"sm",variant:"outline",children:[r.jsx(Tt,{className:"size-3.5"}),n?"Sending…":"Fix with AI"]})]}),r.jsx("p",{className:"mt-1.5 break-words font-mono text-xs text-foreground",children:e.title}),e.file?r.jsxs("p",{className:"mt-1 flex items-center gap-1.5 font-mono text-[11px] text-muted-foreground",children:[r.jsx(DN,{className:"size-3.5"}),e.file,e.line?`:${e.line}`:""]}):null,r.jsxs("p",{className:"mt-1 font-mono text-[10px] text-muted-foreground/80",children:["first ",new Date(e.firstSeen).toLocaleString()," · last"," ",new Date(e.lastSeen).toLocaleTimeString()]})]}),r.jsxs("div",{className:"min-h-0 flex-1 overflow-auto p-4",children:[r.jsx("p",{className:"mb-1.5 text-xs font-medium text-muted-foreground",children:"Log excerpt"}),r.jsx("pre",{className:"overflow-x-auto rounded-md border border-border bg-muted/40 p-3 font-mono text-[11px] leading-relaxed",children:e.logExcerpt.join(`
155
+ `)}),r.jsx("p",{className:"mt-3 text-[11px] text-muted-foreground",children:`"Fix with AI" sends the agent this excerpt with the affected file's diff and the last 40 log lines, so it can start debugging right away.`})]})]})}function Jw(e){return[...e].sort((t,s)=>t.lastSeen<s.lastSeen?1:t.lastSeen>s.lastSeen?-1:s.id-t.id)}function K$(){const[e,t]=y.useState([]),[s,n]=y.useState(!1),[o,l]=y.useState(null),u=y.useCallback(h=>{t(m=>Jw([...m.filter(d=>d.id!==h.id),h]))},[]);return y.useEffect(()=>{let h=!0;tC().then(d=>{h&&t(Jw(d))}).catch(d=>{h&&l(d instanceof Error?d.message:String(d))});const m=new EventSource("/api/errors/stream");return m.addEventListener("open",()=>n(!0)),m.addEventListener("error",()=>n(!1)),m.addEventListener("incident",d=>{try{const p=JSON.parse(d.data);u(p)}catch{}}),()=>{h=!1,m.close()}},[u]),{incidents:e,connected:s,error:o}}function Y$(){const{incidents:e,connected:t,error:s}=K$(),[n,o]=y.useState(null);y.useEffect(()=>{if(e.length===0){o(null);return}o(u=>u!==null&&e.some(h=>h.id===u)?u:e[0].id)},[e]);const l=y.useMemo(()=>e.find(u=>u.id===n)??null,[e,n]);return r.jsxs("div",{className:"flex h-full min-h-0 bg-card/85",children:[r.jsxs("div",{className:"flex w-72 shrink-0 flex-col border-r border-border",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ah,{className:"size-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm font-semibold",children:"Incidents"}),r.jsx(ze,{variant:"outline",size:"small",children:e.length})]}),r.jsx(ze,{variant:"outline",size:"small",icon:r.jsx("span",{className:ie("inline-block size-1.5 rounded-full",t?"animate-pulse bg-emerald-500":"bg-muted-foreground/60")}),children:t?"live":"reconnecting…"})]}),r.jsx("ul",{className:"min-h-0 flex-1 divide-y divide-border overflow-auto",children:e.map(u=>r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>o(u.id),className:ie("flex w-full flex-col gap-1 px-3 py-2 text-left transition-colors hover:bg-muted/50",u.id===n&&"bg-muted/70"),children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"truncate font-mono text-[11px] font-semibold",children:u.service}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[u.count>1?r.jsxs(ze,{variant:"outline",size:"small",children:["×",u.count]}):null,r.jsx(ze,{variant:u.level==="error"?"danger":"secondary",appearance:"subtle",size:"small",children:u.level})]})]}),r.jsx("span",{className:"truncate font-mono text-[11px] text-muted-foreground",children:u.title}),r.jsx("span",{className:"font-mono text-[10px] text-muted-foreground/70",children:new Date(u.lastSeen).toLocaleTimeString()})]})},u.id))})]}),r.jsx("div",{className:"min-h-0 min-w-0 flex-1",children:s?r.jsx("div",{className:"p-4",children:r.jsxs($e,{variant:"muted",className:"border-destructive/40 text-destructive",children:["Failed to load incidents: ",s]})}):l?r.jsx(W$,{incident:l}):r.jsx("div",{className:"flex h-full items-center justify-center p-8 text-center",children:r.jsxs("div",{className:"max-w-sm",children:[r.jsx(Ah,{className:"mx-auto size-8 text-muted-foreground/50"}),r.jsx("p",{className:"mt-3 text-sm font-medium",children:"No incidents yet"}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Errors and stack traces from your running services land here automatically. Each one becomes a one-click prompt for your agent."})]})})})]})}function Yh({label:e}){return r.jsx($e,{variant:"muted",className:"m-4 text-center",children:e})}const X$=900*1e3,Lc=12,cg=200;function Z$({events:e}){const[t,s]=y.useState(null),[n,o]=y.useState(null),{rows:l,windowStart:u,windowEnd:h}=y.useMemo(()=>Q$(e),[e]),m=t?l.find(d=>d.service===t)??null:null;return r.jsxs(r.Fragment,{children:[r.jsxs(gi,{className:"rounded-none border-0 border-b border-border bg-transparent",children:[r.jsxs(bi,{className:"border-b border-border px-3 py-2",children:[r.jsxs(xi,{className:"flex items-center gap-2",children:[r.jsx(Ka,{className:"size-3.5"}),"Runtime Monitor"]}),r.jsx(Ii,{className:"text-xs",children:e.length===0?"No events yet":`${e.length} event${e.length===1?"":"s"} · last 15 min`})]}),r.jsx(vi,{className:"p-0",children:l.length===0?r.jsx(Yh,{label:"No runtime timeline events yet."}):r.jsxs("div",{className:"divide-y divide-border",children:[l.map(d=>r.jsx(eH,{onClick:()=>s(d.service),row:d,windowEnd:h,windowStart:u},d.service)),r.jsxs("div",{className:"flex justify-between px-3 py-1.5 font-mono text-[10px] text-muted-foreground",children:[r.jsx("span",{children:Xh(u)}),r.jsx("span",{children:"now"})]})]})})]}),m?r.jsx(Qn,{icon:r.jsx(Ka,{}),onClose:()=>s(null),title:m.service,children:r.jsx(sH,{onSelect:o,row:m})}):null,n?r.jsx(Qn,{icon:r.jsx(Ka,{}),onClose:()=>o(null),title:n.title,children:r.jsx(nH,{event:n})}):null]})}function Q$(e){const t=Date.now(),s=t,n=t-X$;let o=e.filter(m=>{if(m.kind==="service.http")return!1;const d=new Date(m.timestamp).getTime();return!Number.isNaN(d)&&d>=n});o.length===0&&e.length>0?o=e.slice(-cg):o.length>cg&&(o=o.slice(-cg));const l=new Map;for(const m of o){const d=m.service||"·system",p=l.get(d)??[];p.push(m),l.set(d,p)}const u=Math.max(s-n,1);return{rows:Array.from(l.entries()).map(([m,d])=>{const p=[...d].sort((T,E)=>T.timestamp.localeCompare(E.timestamp)),g=new Array(Lc).fill(0),x=new Array(Lc).fill(null);for(const T of p){const E=new Date(T.timestamp).getTime(),j=Math.max(n,Math.min(s,E)),M=Math.min(Lc-1,Math.floor((j-n)/u*Lc));g[M]+=1;const z=x[M];x[M]=J$(z,T.severity)}const _=p.filter(T=>T.severity==="error").length,S=p.filter(T=>T.severity==="warning").length,w=p.length-_-S,k=[...p].reverse().find(T=>T.severity!=="info")??null,C=_>0?"error":S>0?"warning":"info";return{service:m,events:p,errors:_,warnings:S,infos:w,buckets:g,bucketSeverity:x,lastNotable:k,worstSeverity:C}}).sort((m,d)=>{const p=x=>x.errors*1e3+x.warnings,g=p(d)-p(m);return g!==0?g:m.service.localeCompare(d.service)}),windowStart:n,windowEnd:s}}function J$(e,t){return e==="error"||t==="error"?"error":e==="warning"||t==="warning"?"warning":"info"}function eH({onClick:e,row:t,windowEnd:s,windowStart:n}){const o=Math.max(1,...t.buckets);return r.jsxs("button",{className:"timeline-service-row block w-full px-3 py-2 text-left transition-colors hover:bg-muted/40 focus:outline-none focus-visible:bg-muted/40","data-testid":"timeline-service-row",onClick:e,type:"button",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("span",{className:ie("size-2 shrink-0 rounded-full",I3(t.worstSeverity))}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium text-foreground",dir:"rtl",children:r.jsx("bdi",{children:t.service})}),t.errors>0?r.jsxs("span",{className:"rounded bg-red-500/15 px-1 font-mono text-[10px] text-red-500",children:[t.errors,"E"]}):null,t.warnings>0?r.jsxs("span",{className:"rounded bg-amber-500/15 px-1 font-mono text-[10px] text-amber-500",children:[t.warnings,"W"]}):null,r.jsx(Jn,{className:"size-3 text-muted-foreground"})]}),r.jsx("div",{className:"timeline-density mt-1.5 grid h-3 gap-px","data-testid":"timeline-density",style:{gridTemplateColumns:`repeat(${Lc}, minmax(0, 1fr))`},children:t.buckets.map((l,u)=>r.jsx(tH,{count:l,max:o,severity:t.bucketSeverity[u]},u))}),t.lastNotable?r.jsx("div",{className:"mt-1 truncate font-mono text-[10px] text-muted-foreground",children:t.lastNotable.detail??t.lastNotable.title}):r.jsxs("div",{className:"mt-1 truncate text-[10px] text-muted-foreground",children:[t.infos," info ",t.infos===1?"event":"events"]}),r.jsxs("div",{className:"mt-0.5 flex justify-between font-mono text-[9px] text-muted-foreground/60",children:[r.jsx("span",{children:Xh(n)}),r.jsx("span",{children:Xh(s)})]})]})}function tH({count:e,max:t,severity:s}){if(e===0)return r.jsx("span",{className:"rounded-sm bg-border/60"});const n=Math.min(1,.35+e/t*.65);return r.jsx("span",{className:ie("rounded-sm",iH(s)),style:{opacity:n},title:`${e} event${e===1?"":"s"}`})}function sH({onSelect:e,row:t}){const s=[...t.events].sort((n,o)=>o.timestamp.localeCompare(n.timestamp));return r.jsxs("div",{className:"flex max-h-[480px] flex-col overflow-hidden",children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-4 py-2 text-xs text-muted-foreground",children:[r.jsxs("span",{children:[t.events.length," events"]}),r.jsx("span",{children:"·"}),r.jsxs("span",{children:[t.errors," error",t.errors===1?"":"s"]}),r.jsx("span",{children:"·"}),r.jsxs("span",{children:[t.warnings," warning",t.warnings===1?"":"s"]})]}),r.jsx("ul",{className:"min-h-0 divide-y divide-border overflow-auto",children:s.map(n=>r.jsx("li",{children:r.jsxs("button",{className:"block w-full px-4 py-2 text-left hover:bg-muted/40 focus:outline-none focus-visible:bg-muted/40",onClick:()=>e(n),type:"button",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:ie("size-2 shrink-0 rounded-full",I3(n.severity))}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium text-foreground",children:n.title}),r.jsx("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:Xh(n.timestamp)})]}),n.detail?r.jsx("div",{className:"mt-1 truncate font-mono text-[10px] text-muted-foreground",children:n.detail}):null]})},n.id))})]})}function nH({event:e}){const t=new Date(e.timestamp);return r.jsxs("div",{className:"space-y-3 p-4 text-sm",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:ie("rounded px-1.5 py-0.5 font-mono text-[10px] uppercase text-white",rH(e.severity)),children:e.severity}),r.jsx("span",{className:"rounded border border-border bg-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:e.kind}),e.service?r.jsx("span",{className:"rounded border border-border bg-background px-1.5 py-0.5 font-mono text-[10px] text-foreground",children:e.service}):null]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-xs text-muted-foreground",children:"When"}),r.jsx("div",{className:"font-mono text-xs",children:Number.isNaN(t.getTime())?e.timestamp:t.toLocaleString()})]}),e.detail?r.jsxs("div",{children:[r.jsx("div",{className:"text-xs text-muted-foreground",children:"Detail"}),r.jsx("pre",{className:"mt-1 max-h-72 overflow-auto whitespace-pre-wrap rounded border border-border bg-background p-3 font-mono text-xs",children:e.detail})]}):null]})}function I3(e){return e==="error"?"bg-red-500":e==="warning"?"bg-amber-500":"bg-zinc-400"}function iH(e){return e==="error"?"bg-red-500":e==="warning"?"bg-amber-500":"bg-zinc-500"}function rH(e){return e==="error"?"bg-red-600":e==="warning"?"bg-amber-600":"bg-zinc-700"}function Xh(e){const t=typeof e=="number"?new Date(e):new Date(e);return Number.isNaN(t.getTime())?"--:--:--":t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function aH({onOnboardRepo:e,onOnboardWithAi:t,onCreateService:s,onCreateWithAi:n}){return r.jsx("div",{className:"flex h-full min-h-0 items-center justify-center overflow-auto bg-card/85 p-6",children:r.jsxs("div",{className:"w-full max-w-xl space-y-6",children:[r.jsxs("div",{className:"space-y-2 text-center",children:[r.jsx("h2",{className:"text-xl font-semibold",children:"Set up your first service"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"NoMoreIDE runs and watches your services so you don't have to babysit terminals. Add your first one to get started — or let the agent do it for you."})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(e2,{icon:r.jsx(sn,{className:"size-5"}),title:"Add from GitHub",description:"Point at a repo — we detect how to run it and register it for you.",onClick:e,onAi:t,aiTitle:"Onboard with AI — the agent clones, detects and runs it for you"}),r.jsx(e2,{icon:r.jsx(hs,{className:"size-5"}),title:"Create a service",description:"Define the command, working directory and port yourself.",onClick:s,onAi:n,aiTitle:"Set up with AI — the agent walks you through it, one step at a time"})]})]})})}function e2({icon:e,title:t,description:s,onClick:n,onAi:o,aiTitle:l}){return r.jsxs("div",{className:"group flex items-stretch overflow-hidden rounded-lg border border-border bg-card shadow-sm transition-colors hover:border-foreground/20",children:[r.jsxs("button",{className:"flex flex-1 items-start gap-3 px-4 py-4 text-left hover:bg-muted/60",onClick:n,type:"button",children:[r.jsx("span",{className:"mt-0.5 shrink-0 text-muted-foreground",children:e}),r.jsxs("span",{className:"min-w-0 space-y-1",children:[r.jsx("span",{className:"block text-sm font-semibold",children:t}),r.jsx("span",{className:"block text-xs text-muted-foreground",children:s})]})]}),r.jsxs("button",{className:"flex shrink-0 items-center gap-1.5 border-l border-border px-4 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground",onClick:o,title:l,type:"button",children:[r.jsx(Tt,{className:"size-4 shrink-0"}),"AI"]})]})}function oH({health:e}){if(!e)return null;const t=e.processTree,s=e.status==="healthy"||e.status==="unknown"?void 0:dH(e.summary);return r.jsxs("div",{className:"mt-1.5 grid min-w-0 gap-2 text-[11px] text-muted-foreground sm:grid-cols-[minmax(0,1fr)_auto] sm:items-center",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsxs("span",{className:ie("inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md px-2.5 font-medium",lH(e.status)),children:[r.jsx("span",{className:"inline-flex shrink-0",children:r.jsx(Ka,{className:"size-3"})}),r.jsx("span",{className:"whitespace-nowrap",children:e.status})]}),s?r.jsx("span",{className:"min-w-0 truncate",children:s}):null]}),t?r.jsxs("div",{className:"health-metrics flex min-w-max items-center gap-2 font-mono sm:justify-end",children:[r.jsxs("span",{className:"inline-flex items-center gap-1 font-mono",children:[r.jsx(W4,{className:"size-3"}),t.processCount," ",t.processCount===1?"process":"processes"]}),r.jsxs("span",{children:[uH(t.cpuPercent)," CPU"]}),r.jsxs("span",{className:"inline-flex items-center gap-1 font-mono",children:[r.jsx(QR,{className:"size-3"}),cH(t.rssMb)," RAM"]})]}):null]})}function lH(e){return e==="healthy"?"bg-emerald-600 text-white":e==="warning"?"bg-amber-600 text-white":e==="unhealthy"?"bg-red-600 text-white":"bg-zinc-700 text-white"}function cH(e){return Number.isInteger(e)?`${e} MB`:`${e.toFixed(1)} MB`}function uH(e){return`${e.toFixed(1)}%`}function dH(e){return e.replace(/^Recent error log:\s*/i,"Recent stderr: ").replace(/:\s*\d+(?:\.\d+)? MB RSS\.?$/i,"").replace(/\s+RSS\.?$/i,"")}function hH({ports:e}){const t=e.filter(n=>n.state==="occupied").length,s=e.filter(n=>n.state==="managed").length;return r.jsxs(gi,{className:"rounded-none border-0 border-b border-border bg-transparent",children:[r.jsxs(bi,{className:"border-b border-border px-3 py-2",children:[r.jsxs(xi,{className:"flex items-center gap-2",children:[r.jsx(uM,{className:"size-3.5"}),"Ports"]}),r.jsxs(Ii,{className:"text-xs",children:[s," managed, ",t," occupied by other"]})]}),r.jsx(vi,{className:"p-0",children:e.length?r.jsx("div",{className:"divide-y divide-border",children:e.map(n=>r.jsxs("div",{className:"grid grid-cols-[1fr_auto] items-center gap-2 px-3 py-2",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"font-mono text-xs",children:[":",n.port]}),r.jsx("div",{className:"truncate text-[11px] text-muted-foreground",children:n.services.join(", ")||"Unassigned"}),n.urls[0]?r.jsx("div",{className:"truncate font-mono text-[10px] text-muted-foreground",children:n.urls[0]}):null]}),r.jsx(fH,{port:n})]},n.port))}):r.jsx(Yh,{label:"No configured ports yet."})})]})}function fH({compact:e,port:t}){const s=t.state==="managed"?"managed":t.state==="occupied"?"occupied by other":"available",n=t.state==="managed"?"success":t.state==="occupied"?"warning":"outline";return r.jsx(ze,{className:ie(e&&"max-w-36 truncate"),variant:n,children:s})}function mH({onChange:e,value:t}){return r.jsxs("label",{className:"relative block",children:[r.jsx(zM,{className:"pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground"}),r.jsx(tt,{"aria-label":"Search logs",className:"h-8 w-44 pl-7 text-xs",onChange:s=>e(s.target.value),placeholder:"Search logs",value:t})]})}function pH({className:e,containerRef:t,emptyText:s,logs:n,query:o}){return r.jsx("div",{className:ie("h-full max-w-full overflow-auto bg-background font-mono text-[11px] leading-5 dark:bg-zinc-950",e),ref:t,role:"log",children:n.length?n.map((l,u)=>r.jsxs("div",{className:ie("grid min-w-max grid-cols-[168px_minmax(420px,1fr)] gap-2 border-b border-border/45 px-3 py-0.5 dark:border-zinc-800/80",l.stream==="stderr"?"bg-red-50/70 text-red-800 dark:bg-red-950/35 dark:text-red-100":"bg-emerald-50/35 text-zinc-800 dark:bg-zinc-950 dark:text-zinc-200 dark:odd:bg-zinc-900/45"),children:[r.jsx("span",{className:"text-muted-foreground dark:text-zinc-500",children:l.timestamp}),r.jsxs("span",{className:"whitespace-pre-wrap break-words",children:[l.stream==="stderr"?r.jsx("span",{className:"mr-2 rounded bg-red-100 px-1 font-semibold uppercase text-red-700 dark:bg-red-500/15 dark:text-red-300 dark:ring-1 dark:ring-red-400/20",children:"stderr"}):null,bH(l.text,o)]})]},`${l.timestamp}-${l.stream}-${u}`)):r.jsx("div",{className:"p-3 text-muted-foreground",children:s})})}function gH(e){return`${e.timestamp} ${e.stream} ${e.text}`}function bH(e,t){const s=t.trim();if(!s)return e;const n=e.toLowerCase(),o=s.toLowerCase(),l=[];let u=0,h=n.indexOf(o);for(;h!==-1;){h>u&&l.push(e.slice(u,h));const m=h+s.length;l.push(r.jsx("mark",{className:"rounded bg-amber-200 px-0.5 text-amber-950 dark:bg-amber-400/20 dark:text-amber-200",children:e.slice(h,m)},`${h}-${m}`)),u=m,h=n.indexOf(o,u)}return u<e.length&&l.push(e.slice(u)),l}function t2(e){return`${e.kind}:${e.name}`}function xH(e,t=!1,s={}){const[n,o]=y.useState(),[l,u]=y.useState(),[h,m]=y.useState(e.kind==="source"),d=JSON.stringify(s);return y.useEffect(()=>{o(void 0),u(void 0);let p=!1;const g=async()=>{try{if(e.kind==="service"){const _=await oC(e.name,s);p||(o(_.logs),m(_.queryable),u(void 0))}else{const _=await rC(e.name,s);p||(o(_),m(!0),u(void 0))}}catch(_){p||u(_ instanceof Error?_.message:String(_))}};g();const x=window.setInterval(g,t?1e3:2e3);return()=>{p=!0,window.clearInterval(x)}},[e.kind,e.name,t,d]),{logs:n,error:l,queryable:h}}const vH=[{label:"Live tail",value:""},{label:"Last 15 min",value:"15 min ago"},{label:"Last hour",value:"1 hour ago"},{label:"Today",value:"today"},{label:"Last 24h",value:"1 day ago"},{label:"Last 7 days",value:"7 days ago"}];function P3({target:e,query:t,setQuery:s,streaming:n,setStreaming:o,hideStdout:l,setHideStdout:u,fill:h=!1,leading:m,trailing:d}){const p=e.kind==="source",[g,x]=y.useState(""),[_,S]=y.useState(""),[w,k]=y.useState(t);y.useEffect(()=>{const K=window.setTimeout(()=>k(t),300);return()=>window.clearTimeout(K)},[t]);const C=y.useMemo(()=>{const K={};g&&(K.since=g),_&&(K.level=_);const te=w.trim();return te&&(K.grep=te),K},[g,_,w]),{logs:T,error:E,queryable:j}=xH(e,n,C),M=p||j,z=y.useRef(null),O=y.useRef(!0),[A,D]=y.useState([]),[B,P]=y.useState(!1),H=JSON.stringify(C);y.useEffect(()=>{D([])},[H,e.kind,e.name]);const $=y.useMemo(()=>{const K=T??[];if(A.length===0)return K;const te=new Set(A.map(L=>L.cursor).filter(Boolean));return[...A,...K.filter(L=>!L.cursor||!te.has(L.cursor))]},[T,A]),q=(A[0]??(T??[])[0])?.cursor;async function V(){if(!(!M||!q||B)){P(!0),O.current=!1;try{const K={...C,before:q,lines:200},te=e.kind==="source"?await rC(e.name,K):(await oC(e.name,K)).logs;te.length&&D(L=>{const Q=new Set(L.map(he=>he.cursor).filter(Boolean));return[...te.filter(he=>!he.cursor||!Q.has(he.cursor)),...L]})}finally{P(!1)}}}const I=t.trim().toLowerCase(),W=y.useMemo(()=>{let K=$;return l&&(K=K.filter(te=>te.stream==="stderr")),I&&(K=K.filter(te=>gH(te).toLowerCase().includes(I))),K},[$,l,I]);y.useEffect(()=>{const K=z.current;if(!K)return;const te=()=>{const L=K.scrollHeight-K.scrollTop-K.clientHeight;O.current=L<40};return te(),K.addEventListener("scroll",te,{passive:!0}),()=>K.removeEventListener("scroll",te)},[]),y.useEffect(()=>{if(!n||!O.current||W.length===0)return;const K=z.current;K&&(K.scrollTop=K.scrollHeight)},[n,W]);const Z=T?I?`No log lines match "${t.trim()}".`:l?"No stderr output captured.":"No log entries.":"Loading…";return r.jsxs("div",{className:h?"flex h-full min-h-0 flex-col gap-2":"flex flex-col gap-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[m,r.jsx(mH,{onChange:s,value:t}),M?r.jsxs(r.Fragment,{children:[r.jsx("select",{"aria-label":"Time range",className:"h-8 rounded-md border border-border bg-background px-2 text-xs",onChange:K=>x(K.target.value),value:g,children:vH.map(K=>r.jsx("option",{value:K.value,children:K.label},K.label))}),r.jsxs("select",{"aria-label":"Level",className:"h-8 rounded-md border border-border bg-background px-2 text-xs",onChange:K=>S(K.target.value),value:_,children:[r.jsx("option",{value:"",children:"All levels"}),r.jsx("option",{value:"warn",children:"Warnings+"}),r.jsx("option",{value:"error",children:"Errors"})]})]}):r.jsxs(s2,{active:l,activeClassName:"border-amber-600 bg-amber-50 text-amber-700 dark:border-amber-400/40 dark:bg-amber-500/15 dark:text-amber-300",onClick:()=>u(!l),children:[r.jsx(bR,{}),"Errors only"]}),r.jsxs(s2,{active:n,activeClassName:"border-emerald-600 bg-emerald-50 text-emerald-700 dark:border-emerald-400/40 dark:bg-emerald-500/15 dark:text-emerald-300",onClick:()=>o(!n),children:[r.jsx(AM,{}),n?"Streaming":"Stream"]}),M&&q?r.jsxs(Y,{disabled:B,onClick:()=>{V()},size:"sm",type:"button",variant:"outline",children:[r.jsx(hf,{}),B?"Loading…":"Load older"]}):null,d?r.jsx("div",{className:"ml-auto flex items-center gap-2",children:d}):null]}),E?r.jsx("div",{className:"text-red-600",children:E}):null,r.jsx(pH,{className:ie("rounded border border-border/60",h?"min-h-0 flex-1":"max-h-80"),containerRef:z,emptyText:Z,logs:W,query:t})]})}function s2({active:e,activeClassName:t,children:s,onClick:n}){return r.jsx(Y,{"aria-pressed":e,className:e?t:void 0,onClick:n,size:"sm",type:"button",variant:"outline",children:s})}function _H(e,t){return e.kind===t.kind&&e.name===t.name}function yH({options:e,target:t,onChange:s,className:n}){const o=e.findIndex(u=>_H(u.target,t)),l=[...new Set(e.map(u=>u.group))];return r.jsx("select",{"aria-label":"Log source",className:n??"h-8 max-w-44 rounded-md border border-border bg-background px-2 text-xs",onChange:u=>s(e[Number(u.target.value)].target),value:String(o),children:l.map(u=>r.jsx("optgroup",{label:u,children:e.map((h,m)=>h.group===u?r.jsx("option",{value:String(m),children:h.label},`${h.group}:${h.label}`):null)},u))})}function SH({serviceName:e}){const[t,s]=y.useState(""),[n,o]=y.useState(!1),[l,u]=y.useState(!1),[h,m]=y.useState(!1),d=r.jsx(P3,{fill:!0,hideStdout:l,query:t,setHideStdout:u,setQuery:s,setStreaming:o,streaming:n,target:{kind:"service",name:e},trailing:r.jsxs(Y,{onClick:()=>m(p=>!p),size:"sm",type:"button",variant:"outline",children:[h?r.jsx(UN,{}):r.jsx($N,{}),h?"Exit":"Expand"]})});return h?r.jsx($x,{onClose:()=>m(!1),title:`Logs — ${e}`,children:d}):r.jsx("div",{className:"h-[60vh] min-h-[24rem]",children:d})}function $x({title:e,onClose:t,children:s,maxWidthClass:n="max-w-6xl"}){return y.useEffect(()=>{function o(l){l.key==="Escape"&&t()}return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[t]),io.createPortal(r.jsx("div",{className:"fixed inset-0 z-[1000] bg-black/40 p-4 sm:p-8",onMouseDown:t,children:r.jsxs("div",{"aria-modal":"true",className:`mx-auto flex h-full ${n} flex-col overflow-hidden rounded-lg border border-border bg-card text-xs shadow-xl`,onMouseDown:o=>o.stopPropagation(),role:"dialog",children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-2",children:[r.jsx("h2",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:e}),r.jsx(Y,{"aria-label":"Close logs",onClick:t,size:"icon",type:"button",variant:"ghost",children:r.jsx(Ft,{})})]}),r.jsx("div",{className:"min-h-0 flex-1 p-3",children:s})]})}),document.body)}const wH={journald:"Queries `journalctl -u <unit>` — time range, text, and level filter server-side. Add a host to run it over SSH.",docker:"Queries `docker logs <container>` — time window server-side. Add a host to run it over SSH.",ssh:"Reads via `ssh <host> tail -n 500 <path>` using your ~/.ssh/config + ssh-agent.",file:"Tails an absolute file path on this machine.",command:"Runs the command and treats its output as the log (kubectl logs, …)."};function kH({onClose:e,onAdded:t}){const[s,n]=y.useState(""),[o,l]=y.useState("journald"),[u,h]=y.useState(""),[m,d]=y.useState(""),[p,g]=y.useState(""),[x,_]=y.useState(""),[S,w]=y.useState(""),[k,C]=y.useState(""),[T,E]=y.useState(),[j,M]=y.useState(!1);async function z(){M(!0),E(void 0);try{const O={name:s.trim(),kind:"command"};o==="file"?(O.kind="file",O.path=m.trim()):o==="ssh"?(O.kind="ssh",O.host=u.trim(),O.path=m.trim()):o==="command"?(O.kind="command",O.command=p.trim(),x.trim()&&(O.cwd=x.trim())):o==="journald"?(O.driver="journald",O.unit=S.trim(),u.trim()&&(O.host=u.trim())):o==="docker"&&(O.driver="docker",O.container=k.trim(),u.trim()&&(O.host=u.trim()));const A=await i8(O);t(A,O.name),e()}catch(O){E(O instanceof Error?O.message:String(O))}finally{M(!1)}}return r.jsx(Qn,{icon:r.jsx(VN,{}),onClose:e,size:"md",title:"Add log source",children:r.jsxs("form",{className:"flex flex-col gap-3 p-4 text-xs",onSubmit:O=>{O.preventDefault(),z()},children:[r.jsx(hr,{label:"Name",children:r.jsx(tt,{autoFocus:!0,onChange:O=>n(O.target.value),placeholder:"PROD",value:s})}),r.jsxs(hr,{label:"Type",children:[r.jsxs("select",{className:"h-9 w-full rounded-md border border-border bg-background px-2 text-xs",onChange:O=>l(O.target.value),value:o,children:[r.jsx("option",{value:"journald",children:"systemd journal (journald)"}),r.jsx("option",{value:"docker",children:"Docker container"}),r.jsx("option",{value:"ssh",children:"Remote file (SSH)"}),r.jsx("option",{value:"file",children:"Local file"}),r.jsx("option",{value:"command",children:"Command"})]}),r.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:wH[o]})]}),o==="journald"||o==="docker"?r.jsx(hr,{label:"Host (optional — leave blank to run locally)",children:r.jsx(tt,{onChange:O=>h(O.target.value),placeholder:"jobjourney-prod (an alias from ~/.ssh/config)",value:u})}):null,o==="journald"?r.jsx(hr,{label:"Unit",children:r.jsx(tt,{onChange:O=>w(O.target.value),placeholder:"jobjourney",value:S})}):null,o==="docker"?r.jsx(hr,{label:"Container",children:r.jsx(tt,{onChange:O=>C(O.target.value),placeholder:"brainctl-api",value:k})}):null,o==="ssh"?r.jsx(hr,{label:"Host",children:r.jsx(tt,{onChange:O=>h(O.target.value),placeholder:"prod (an alias from ~/.ssh/config)",value:u})}):null,o==="file"||o==="ssh"?r.jsx(hr,{label:o==="ssh"?"Remote path":"File path",children:r.jsx(tt,{onChange:O=>d(O.target.value),placeholder:"/var/log/app/out.log",value:m})}):null,o==="command"?r.jsxs(r.Fragment,{children:[r.jsx(hr,{label:"Command",children:r.jsx(tt,{onChange:O=>g(O.target.value),placeholder:"kubectl logs -l app=myapp --tail 500",value:p})}),r.jsx(hr,{label:"Working directory (optional)",children:r.jsx(tt,{onChange:O=>_(O.target.value),placeholder:"/srv/app",value:x})})]}):null,T?r.jsx("div",{className:"text-red-600",children:T}):null,r.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[r.jsx(Y,{onClick:e,size:"sm",type:"button",variant:"outline",children:"Cancel"}),r.jsx(Y,{disabled:j||!s.trim(),size:"sm",type:"submit",children:j?"Saving…":"Add source"})]})]})})}function hr({label:e,children:t}){return r.jsxs("label",{className:"flex flex-col gap-1",children:[r.jsx("span",{className:"font-medium text-muted-foreground",children:e}),t]})}const n2=4;function NH({services:e,initialService:t,onClose:s}){const[n,o]=y.useState([]),[l,u]=y.useState(!1),[h,m]=y.useState(()=>[0]),[d,p]=y.useState(()=>{const E=t?{kind:"service",name:t}:e[0]?{kind:"service",name:e[0]}:void 0;return E?{0:E}:{}}),g=y.useRef(1);y.useEffect(()=>{let E=!1;return n8().then(j=>{E||o(j)}),()=>{E=!0}},[]);const x=[...e.map(E=>({target:{kind:"service",name:E},label:E,group:"Services"})),...n.map(E=>({target:{kind:"source",name:E.name},label:E.name,group:"Log sources"}))],_=x.map(E=>E.target);function S(){if(h.length>=n2||_.length===0)return;const E=g.current++,j=new Set(Object.values(d).map(t2)),M=_.find(z=>!j.has(t2(z)))??_[0];m(z=>[...z,E]),p(z=>({...z,[E]:M}))}function w(E){m(j=>j.filter(M=>M!==E)),p(j=>{const M={...j};return delete M[E],M})}function k(E,j){p(M=>({...M,[E]:j}))}function C(E,j){o(E);const M=h[0];M!==void 0&&k(M,{kind:"source",name:j})}const T=r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{children:"Logs"}),r.jsxs(Y,{onClick:()=>u(!0),size:"sm",type:"button",variant:"outline",children:[r.jsx(hs,{}),"Add source"]}),r.jsxs(Y,{disabled:h.length>=n2||_.length===0,onClick:S,size:"sm",type:"button",variant:"outline",children:[r.jsx(hs,{}),"Add pane"]})]});return r.jsxs(r.Fragment,{children:[r.jsx($x,{maxWidthClass:"max-w-[1500px]",onClose:s,title:T,children:_.length===0?r.jsx("div",{className:"grid h-full place-items-center text-center text-muted-foreground",children:r.jsxs("div",{children:[r.jsx("p",{children:"No services or log sources yet."}),r.jsxs(Y,{className:"mt-2",onClick:()=>u(!0),size:"sm",type:"button",children:[r.jsx(hs,{}),"Add a log source"]})]})}):r.jsx("div",{className:ie("grid h-full min-h-0 gap-3",h.length>1?"lg:grid-cols-2":"grid-cols-1",h.length>2?"lg:grid-rows-2":"grid-rows-1"),children:h.map(E=>r.jsx(CH,{onChangeTarget:j=>k(E,j),onRemove:h.length>1?()=>w(E):void 0,options:x,target:d[E]??_[0]},E))})}),l?r.jsx(kH,{onAdded:C,onClose:()=>u(!1)}):null]})}function CH({options:e,target:t,onChangeTarget:s,onRemove:n}){const[o,l]=y.useState(""),[u,h]=y.useState(!0),[m,d]=y.useState(!1);return r.jsx("div",{className:"flex min-h-0 min-w-0 flex-col rounded-lg border border-border bg-background/60 p-2",children:r.jsx(P3,{fill:!0,hideStdout:m,leading:r.jsx(yH,{onChange:s,options:e,target:t}),query:o,setHideStdout:d,setQuery:l,setStreaming:h,streaming:u,target:t,trailing:n?r.jsx(Y,{"aria-label":"Remove pane",onClick:n,size:"icon",type:"button",variant:"ghost",children:r.jsx(Ft,{})}):void 0})})}function EH({rows:e,revealAll:t,onAdd:s,onRemove:n,onUpdate:o}){return e.length===0?r.jsxs("div",{className:"text-muted-foreground",children:["No variables yet."," ",r.jsx("button",{className:"underline",onClick:s,type:"button",children:"Add one"}),"."]}):r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full font-mono text-[11px]",children:[r.jsx("thead",{className:"text-left text-muted-foreground",children:r.jsxs("tr",{children:[r.jsx("th",{className:"py-1 pr-3",children:"Key"}),r.jsx("th",{className:"py-1 pr-3",children:"Value"}),r.jsx("th",{className:"py-1 w-8"})]})}),r.jsx("tbody",{children:e.map((l,u)=>{const h=!l.reveal&&!t;return r.jsxs("tr",{className:"border-t border-border/40",children:[r.jsx("td",{className:"py-1 pr-3 align-top",children:r.jsx("input",{className:"w-full rounded border border-border/60 bg-background px-1.5 py-0.5 font-mono",onChange:m=>o(u,{key:m.target.value}),placeholder:"KEY",spellCheck:!1,value:l.key})}),r.jsx("td",{className:"py-1 pr-3 align-top",children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("input",{className:"w-full rounded border border-border/60 bg-background px-1.5 py-0.5 font-mono",onChange:m=>o(u,{value:m.target.value}),spellCheck:!1,type:h?"password":"text",value:l.value}),r.jsx("button",{className:"text-muted-foreground hover:text-foreground",onClick:()=>o(u,{reveal:!l.reveal}),title:l.reveal||t?"Hide":"Reveal",type:"button",children:l.reveal||t?r.jsx(RN,{size:14}):r.jsx(qb,{size:14})})]})}),r.jsx("td",{className:"py-1 align-top",children:r.jsx("button",{className:"text-muted-foreground hover:text-red-600",onClick:()=>n(u),type:"button",children:r.jsx(yr,{size:14})})})]},u)})})]})})}function jH({serviceName:e,onClose:t,onPick:s}){const[n,o]=y.useState(),[l,u]=y.useState(),[h,m]=y.useState(!0),[d,p]=y.useState();y.useEffect(()=>{let _=!1;return m(!0),u(void 0),(async()=>{try{const S=await f8(e,d);_||o(S)}catch(S){_||u(S instanceof Error?S.message:String(S))}finally{_||m(!1)}})(),()=>{_=!0}},[e,d]);function g(_){if(_.kind==="directory"){p(_.relativePath);return}_.supported&&s(_.relativePath)}function x(){if(!n||n.isRoot)return;const _=n.relativePath,S=_.includes("/")?_.slice(0,_.lastIndexOf("/")):"";p(S||void 0)}return r.jsx(Qn,{icon:r.jsx(mf,{}),onClose:t,size:"lg",title:"Pick a config file",children:r.jsxs("div",{className:"flex flex-col gap-2 p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[r.jsxs(Y,{disabled:!n||n.isRoot,onClick:x,size:"sm",type:"button",variant:"outline",children:[r.jsx(hf,{})," Up"]}),r.jsx("code",{className:"truncate rounded bg-muted px-2 py-1 font-mono",children:n?.relativePath||"./"})]}),l?r.jsx("div",{className:"text-red-600",children:l}):h?r.jsx("div",{className:"text-muted-foreground",children:"Loading…"}):!n||n.entries.length===0?r.jsx("div",{className:"text-muted-foreground",children:"Empty directory."}):r.jsx("div",{className:"max-h-[50vh] overflow-auto rounded border border-border/60",children:r.jsx("ul",{className:"divide-y divide-border/40",children:n.entries.map(_=>{const S=_.kind==="directory",w=S||_.supported;return r.jsx("li",{children:r.jsxs("button",{className:ie("flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs",w?"hover:bg-muted":"cursor-not-allowed text-muted-foreground"),disabled:!w,onClick:()=>g(_),type:"button",children:[S?r.jsx(so,{size:14}):r.jsx(ON,{size:14}),r.jsx("span",{className:"flex-1 truncate font-mono",children:_.name}),!S&&_.format?r.jsx(ze,{size:"small",variant:"secondary",children:_.format}):null]})},_.relativePath)})})}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Only ",r.jsx("code",{children:".env*"}),", ",r.jsx("code",{children:"appsettings*.json"}),", and"," ",r.jsx("code",{children:"application*.yml"})," can be selected. Other files are shown disabled."]})]})})}function $3(e){if(!e.trim())return e;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function TH(e){const{error:t,success:s}=Es(),[n,o]=y.useState([]),[l,u]=y.useState(),[h,m]=y.useState(),[d,p]=y.useState(!0),[g,x]=y.useState(!1),[_,S]=y.useState(!1),[w,k]=y.useState(!1),[C,T]=y.useState();y.useEffect(()=>{let B=!1;return p(!0),T(void 0),(async()=>{try{const P=await m8(e);if(B)return;o(P.files),P.files.length>0?u(H=>H??P.files[0].path):(u(void 0),m(void 0))}catch(P){B||T(P instanceof Error?P.message:String(P))}finally{B||p(!1)}})(),()=>{B=!0}},[e]);const E=y.useCallback(async B=>{x(!0),T(void 0);try{const P=await Qy(e,B),H={path:P.path,relativePath:P.relativePath,format:P.format};P.format==="env"?m({info:H,exists:P.exists,rows:P.entries.map($=>({...$,reveal:!1}))}):m({info:H,exists:P.exists,text:P.format==="json"?$3(P.content):P.content}),k(!1)}catch(P){T(P instanceof Error?P.message:String(P))}finally{x(!1)}},[e]);y.useEffect(()=>{l&&E(l)},[l,E]);function j(B,P){m(H=>{if(!H?.rows)return H;const $=H.rows.map((q,V)=>V===B?{...q,...P}:q);return{...H,rows:$}}),k(!0)}function M(){m(B=>B?.rows?{...B,rows:[...B.rows,{key:"",value:"",secret:!1,reveal:!0}]}:B),k(!0)}function z(B){m(P=>P?.rows?{...P,rows:P.rows.filter((H,$)=>$!==B)}:P),k(!0)}function O(B){m(P=>P&&{...P,text:B}),k(!0)}async function A(){if(h){S(!0);try{if(h.info.format==="env"&&h.rows){const B=await p8(e,h.info.path,h.rows.map(P=>({key:P.key.trim(),value:P.value})));m({info:{path:B.path,relativePath:B.relativePath,format:B.format},exists:B.exists,rows:B.entries.map(P=>({...P,reveal:!1}))}),s(`Saved ${B.entries.length} entries to ${B.relativePath}.`)}else if(h.text!==void 0){const B=await g8(e,h.info.path,h.text);m({info:{path:B.path,relativePath:B.relativePath,format:B.format},exists:B.exists,text:B.content}),s(`Saved ${B.relativePath}.`)}k(!1)}catch(B){t(B instanceof Error?B.message:String(B))}finally{S(!1)}}}async function D(B){try{const P=await Qy(e,B),H={path:P.path,relativePath:P.relativePath,format:P.format};return o($=>$.some(q=>q.path===H.path)?$:[...$,H]),u(H.path),s(`Loaded ${H.relativePath}.`),!0}catch(P){return t(P instanceof Error?P.message:String(P)),!1}}return{files:n,selectedPath:l,setSelectedPath:u,loaded:h,loadingList:d,loadingFile:g,saving:_,dirty:w,error:C,addRow:M,removeRow:z,updateRow:j,updateText:O,save:A,pickFile:D}}function AH({serviceName:e}){const{files:t,selectedPath:s,setSelectedPath:n,loaded:o,loadingList:l,loadingFile:u,saving:h,dirty:m,error:d,addRow:p,removeRow:g,updateRow:x,updateText:_,save:S,pickFile:w}=TH(e),[k,C]=y.useState(!1),[T,E]=y.useState(!1);return l?r.jsx("div",{className:"text-muted-foreground",children:"Loading…"}):d&&!o?r.jsx("div",{className:"text-red-600",children:d}):r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:"text-muted-foreground",children:"File:"}),t.length>0?r.jsx("select",{className:"rounded border border-border/60 bg-background px-1.5 py-0.5 font-mono text-xs",onChange:j=>n(j.target.value),value:s??"",children:t.map(j=>r.jsxs("option",{value:j.path,children:[j.relativePath," [",j.format,"]"]},j.path))}):r.jsx("span",{className:"text-muted-foreground",children:"none detected"}),r.jsxs(Y,{onClick:()=>E(!0),size:"sm",type:"button",variant:"outline",children:[r.jsx(mf,{})," Browse files"]}),o?r.jsx("code",{className:"rounded bg-background px-1.5 py-0.5 font-mono text-muted-foreground",children:o.info.path}):null]}),r.jsxs("div",{className:"flex items-center gap-1",children:[o?.info.format==="env"?r.jsxs(r.Fragment,{children:[r.jsxs(Y,{onClick:()=>C(j=>!j),size:"sm",type:"button",variant:"outline",children:[k?r.jsx(RN,{}):r.jsx(qb,{}),k?"Hide secrets":"Reveal secrets"]}),r.jsxs(Y,{onClick:p,size:"sm",type:"button",variant:"outline",children:[r.jsx(hs,{})," Add"]})]}):null,r.jsxs(Y,{disabled:!m||h||!o,onClick:S,size:"sm",type:"button",children:[r.jsx(qN,{})," ",h?"Saving…":"Save"]})]})]}),d&&!o?r.jsx("div",{className:"text-red-600",children:d}):o?.info.format==="env"&&o.rows?r.jsx("div",{className:ie(u&&"opacity-60 transition-opacity"),children:r.jsx(EH,{revealAll:k,rows:o.rows,onAdd:p,onRemove:g,onUpdate:x})}):o?.text!==void 0?r.jsxs("div",{className:ie("space-y-1",u&&"opacity-60 transition-opacity"),children:[o.info.format==="json"?r.jsx("div",{className:"flex justify-end",children:r.jsx(Y,{onClick:()=>_($3(o.text??"")),size:"sm",type:"button",variant:"outline",children:"Format JSON"})}):null,r.jsx("textarea",{className:"min-h-[300px] w-full rounded border border-border/60 bg-background p-2 font-mono text-[11px] leading-relaxed",onChange:j=>_(j.target.value),spellCheck:!1,value:o.text})]}):u?r.jsx("div",{className:"text-muted-foreground",children:"Loading file…"}):null,o?r.jsxs("p",{className:"text-muted-foreground",children:[o.info.format==="env"?"Comments and blank lines are preserved.":o.info.format==="json"?"JSON is validated on save.":"YAML is saved as raw text."," ","The running process won't see changes until you restart it."]}):null,T?r.jsx(jH,{onClose:()=>E(!1),onPick:j=>{w(j).then(M=>{M&&E(!1)})},serviceName:e}):null]})}function RH({serviceName:e,status:t,timeline:s,onRefresh:n}){const{error:o,success:l}=Es(),[u,h]=y.useState(!1),m=t?.inspector,d=t?.state==="running",p=y.useMemo(()=>s.filter(_=>_.kind==="service.http"&&_.service===e).map(_=>{const S=_.data??{};return{id:S.id??_.id,startedAt:_.timestamp,method:S.method??"?",path:S.path??"?",status:S.status??0,durationMs:S.durationMs??0,reqBytes:S.reqBytes??0,resBytes:S.resBytes??0}}).slice(-500).reverse(),[s,e]);async function g(_){h(!0);try{await en(`/api/services/${encodeURIComponent(e)}/inspector`,{enabled:_?"true":"false"}),await n(),l(_?`HTTP inspector started for ${e}.`:`HTTP inspector stopped for ${e}.`)}catch(S){o(S instanceof Error?S.message:String(S))}finally{h(!1)}}if(!d)return r.jsx("div",{className:"text-muted-foreground",children:"Service is not running."});if(!m?.enabled)return r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-muted-foreground",children:"The HTTP inspector starts a local proxy that forwards traffic to this service and records every request. Hit the inspect URL instead of the original port to see requests appear here. The service itself is not touched."}),r.jsxs(Y,{disabled:u,onClick:()=>g(!0),size:"sm",type:"button",children:[r.jsx(vr,{})," Start HTTP inspector"]})]});const x=m.port?`http://127.0.0.1:${m.port}`:void 0;return r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:"text-muted-foreground",children:"Inspect URL:"}),x?r.jsxs(r.Fragment,{children:[r.jsx("code",{className:"rounded bg-background px-1.5 py-0.5 font-mono",children:x}),r.jsxs(Y,{onClick:()=>{navigator.clipboard.writeText(x),l("Copied inspect URL.")},size:"sm",type:"button",variant:"outline",children:[r.jsx(Th,{})," Copy"]}),r.jsx(Y,{onClick:()=>window.open(x,"_blank","noopener,noreferrer"),size:"sm",type:"button",variant:"outline",children:"Open"})]}):r.jsx("span",{className:"text-muted-foreground",children:"starting…"}),r.jsxs("span",{className:"text-muted-foreground",children:["→ upstream :",m.upstreamPort??"?"]}),r.jsxs(Y,{disabled:u,onClick:()=>g(!1),size:"sm",type:"button",variant:"outline",children:[r.jsx(cl,{})," Stop"]})]}),p.length===0?r.jsx("div",{className:"text-muted-foreground",children:"No requests captured yet. Hit the inspect URL in your browser to see traffic."}):r.jsx("div",{className:"max-h-80 overflow-auto",children:r.jsxs("table",{className:"w-full font-mono text-[11px]",children:[r.jsx("thead",{className:"sticky top-0 bg-muted/60 text-left text-muted-foreground",children:r.jsxs("tr",{children:[r.jsx("th",{className:"py-1 pr-3",children:"Time"}),r.jsx("th",{className:"py-1 pr-3",children:"Method"}),r.jsx("th",{className:"py-1 pr-3",children:"Path"}),r.jsx("th",{className:"py-1 pr-3 text-right",children:"Status"}),r.jsx("th",{className:"py-1 pr-3 text-right",children:"Size"}),r.jsx("th",{className:"py-1 pr-3 text-right",children:"ms"})]})}),r.jsx("tbody",{children:p.map(_=>r.jsxs("tr",{className:"border-t border-border/40",children:[r.jsx("td",{className:"py-1 pr-3 text-muted-foreground",children:new Date(_.startedAt).toLocaleTimeString()}),r.jsx("td",{className:"py-1 pr-3",children:_.method}),r.jsx("td",{className:"py-1 pr-3 truncate max-w-[40ch]",children:_.path}),r.jsx("td",{className:ie("py-1 pr-3 text-right",MH(_.status)),children:_.status}),r.jsx("td",{className:"py-1 pr-3 text-right text-muted-foreground",children:DH(_.resBytes)}),r.jsx("td",{className:"py-1 pr-3 text-right",children:_.durationMs.toFixed(1)})]},_.id))})]})})]})}function MH(e){return e>=500?"text-red-600 dark:text-red-400":e>=400?"text-amber-600 dark:text-amber-400":e>=300?"text-zinc-500":e>=200?"text-emerald-600 dark:text-emerald-400":"text-muted-foreground"}function DH(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function OH({serviceName:e}){const[t,s]=y.useState(null),[n,o]=y.useState(null),[l,u]=y.useState(()=>Date.now());return y.useEffect(()=>{let h=!1;async function m(){try{const p=await b8(e);h||(s(p),u(Date.now()),o(null))}catch(p){h||o(p instanceof Error?p.message:String(p))}}m();const d=setInterval(()=>{m()},3e3);return()=>{h=!0,clearInterval(d)}},[e]),n?r.jsxs("p",{className:"text-destructive",children:["Failed to load metrics: ",n]}):t?t.samples.length===0?r.jsx("p",{className:"text-muted-foreground",children:"No samples yet. Metrics start collecting once the service is running."}):r.jsx(LH,{series:t,now:l}):r.jsx("p",{className:"text-muted-foreground",children:"Loading metrics…"})}function LH({series:e,now:t}){const{samples:s}=e,n=y.useMemo(()=>i2(s,m=>m.cpu),[s]),o=y.useMemo(()=>i2(s,m=>m.rss),[s]),l=e.startedAt?new Date(e.startedAt):null,u=l?t-l.getTime():null,h=s.length>1?s[s.length-1].t-s[0].t:0;return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:[r.jsx(ih,{accent:"#22c55e",label:"CPU",value:`${n.last.toFixed(1)}%`,sub:`peak ${n.max.toFixed(1)}% · avg ${n.avg.toFixed(1)}%`}),r.jsx(ih,{accent:"#3b82f6",label:"Memory",value:ug(o.last),sub:`peak ${ug(o.max)} · avg ${ug(o.avg)}`}),r.jsx(ih,{accent:"#a855f7",label:"Uptime",value:u!=null?o2(u):"—",sub:l?`since ${l.toLocaleTimeString()}`:"not running"}),r.jsx(ih,{accent:"#f59e0b",label:"Samples",value:String(s.length),sub:h?`over ${o2(h)}`:"collecting…"})]}),r.jsx(a2,{label:"CPU",samples:s,pick:m=>m.cpu,summary:n,color:"#22c55e",suffix:"%",unit:"percent"}),r.jsx(a2,{label:"Memory (RSS)",samples:s,pick:m=>m.rss,summary:o,color:"#3b82f6",suffix:" MB",unit:"mb"})]})}function i2(e,t){const s=e.map(t),n=s.reduce((o,l)=>o+l,0);return{last:s[s.length-1],max:Math.max(...s),min:Math.min(...s),avg:n/s.length}}function ih({accent:e,label:t,value:s,sub:n}){return r.jsxs("div",{className:"rounded-lg border border-border bg-card px-3 py-2",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full",style:{backgroundColor:e}}),r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:t})]}),r.jsx("div",{className:"mt-1 font-mono text-lg leading-none tabular-nums",children:s}),r.jsx("div",{className:"mt-1 truncate font-mono text-[10px] text-muted-foreground",children:n})]})}const Ko=160,r2=44,zH=20;function a2({label:e,samples:t,pick:s,summary:n,color:o,suffix:l,unit:u}){const h=y.useMemo(()=>`metric-grad-${u}-${Math.random().toString(36).slice(2,8)}`,[u]),m=t.map(s),d=Math.max(...m,u==="percent"?10:1),p=BH(d),g=0,x=p-g||1,_=t[0].t,S=t[t.length-1].t,w=Math.max(1,S-_),k=B=>(B-_)/w*1e3,C=B=>(1-(B-g)/x)*1e3,T=t.map(B=>`${k(B.t).toFixed(1)},${C(s(B)).toFixed(1)}`),E=`M0,1000 L${T.join(" L")} L1000,1000 Z`,j=`M${T.join(" L")}`,M=k(S),z=C(n.last),O=C(n.avg),A=[1,.75,.5,.25,0],D=5;return r.jsxs("figure",{className:"space-y-1",children:[r.jsxs("figcaption",{className:"flex items-baseline justify-between",children:[r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:e}),r.jsxs("span",{className:"font-mono text-[11px] text-muted-foreground",children:["now ",r.jsxs("span",{className:"text-foreground",children:[n.last.toFixed(1),l]}),r.jsx("span",{className:"mx-1.5",children:"·"}),"peak ",n.max.toFixed(1),l,r.jsx("span",{className:"mx-1.5",children:"·"}),"avg ",n.avg.toFixed(1),l]})]}),r.jsxs("div",{className:"rounded-lg border border-border bg-card p-2",children:[r.jsxs("div",{className:"flex",children:[r.jsx("div",{className:"relative flex shrink-0 flex-col justify-between text-right font-mono text-[10px] text-muted-foreground",style:{width:r2,height:Ko},children:A.map(B=>r.jsx("span",{className:"pr-1 leading-none",children:IH(g+B*x,u)},B))}),r.jsxs("div",{className:"relative min-w-0 flex-1",style:{height:Ko},children:[A.map((B,P)=>r.jsx("div",{className:"pointer-events-none absolute inset-x-0 border-t border-border/40",style:{top:`${B===1?0:B===0?Ko-1:(1-B)*Ko}px`,borderStyle:P===A.length-1?"solid":"dashed"}},B)),r.jsx("div",{className:"pointer-events-none absolute inset-x-0 border-t border-dashed",style:{top:`${O/1e3*Ko}px`,borderColor:o,opacity:.4}}),r.jsxs("svg",{"aria-label":e,className:"absolute inset-0 h-full w-full",preserveAspectRatio:"none",role:"img",viewBox:"0 0 1000 1000",children:[r.jsx("defs",{children:r.jsxs("linearGradient",{id:h,x1:"0",x2:"0",y1:"0",y2:"1",children:[r.jsx("stop",{offset:"0%",stopColor:o,stopOpacity:.35}),r.jsx("stop",{offset:"100%",stopColor:o,stopOpacity:.02})]})}),r.jsx("path",{d:E,fill:`url(#${h})`}),r.jsx("path",{d:j,fill:"none",stroke:o,strokeWidth:2,vectorEffect:"non-scaling-stroke",strokeLinejoin:"round",strokeLinecap:"round"})]}),r.jsx("span",{className:"pointer-events-none absolute z-10 block h-2.5 w-2.5 -translate-x-1/2 -translate-y-1/2 rounded-full ring-2 ring-card",style:{left:`${M/1e3*100}%`,top:`${z/1e3*Ko}px`,backgroundColor:o,boxShadow:`0 0 0 4px ${o}33`}})]})]}),r.jsx("div",{className:"flex font-mono text-[10px] text-muted-foreground",style:{height:zH,paddingLeft:r2},children:r.jsx("div",{className:"relative flex-1",children:Array.from({length:D+1},(B,P)=>{const H=P/D,$=_+H*w;return r.jsx("span",{className:"absolute top-1 whitespace-nowrap",style:{left:`${H*100}%`,transform:P===0?"translateX(0)":P===D?"translateX(-100%)":"translateX(-50%)"},children:PH($-S)},P)})})})]})]})}function BH(e){if(e<=1)return 1;const t=Math.pow(10,Math.floor(Math.log10(e))),s=e/t;return(s<=1?1:s<=2?2:s<=5?5:10)*t}function IH(e,t){return t==="percent"?`${e.toFixed(0)}%`:e>=1024?`${(e/1024).toFixed(1)}G`:`${e.toFixed(0)}M`}function ug(e){return e>=1024?`${(e/1024).toFixed(2)} GB`:`${e.toFixed(0)} MB`}function o2(e){const t=Math.max(0,Math.round(e/1e3));if(t<60)return`${t}s`;const s=Math.floor(t/60);if(s<60)return`${s}m ${t%60}s`;const n=Math.floor(s/60);return n<24?`${n}h ${s%60}m`:`${Math.floor(n/24)}d ${n%24}h`}function PH(e){const t=Math.round(e/1e3);if(t===0)return"now";if(Math.abs(t)<60)return`${t}s`;const n=Math.round(t/60);return Math.abs(n)<60?`${n}m`:`${Math.round(n/60)}h`}function $H({rows:e}){if(e.length===0)return r.jsx("div",{className:"text-muted-foreground",children:"No process tree (service not running)."});const t=[...e].sort((n,o)=>o.cpuPercent-n.cpuPercent),s=new Set(e.map(n=>n.pid));return r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full font-mono text-[11px]",children:[r.jsx("thead",{className:"text-left text-muted-foreground",children:r.jsxs("tr",{children:[r.jsx("th",{className:"py-1 pr-3",children:"PID"}),r.jsx("th",{className:"py-1 pr-3",children:"PPID"}),r.jsx("th",{className:"py-1 pr-3 text-right",children:"CPU%"}),r.jsx("th",{className:"py-1 pr-3 text-right",children:"RSS MB"}),r.jsx("th",{className:"py-1",children:"Command"})]})}),r.jsx("tbody",{children:t.map(n=>{const o=s.has(n.ppid);return r.jsxs("tr",{className:"border-t border-border/40",children:[r.jsx("td",{className:"py-1 pr-3",children:n.pid}),r.jsx("td",{className:"py-1 pr-3 text-muted-foreground",children:n.ppid}),r.jsx("td",{className:"py-1 pr-3 text-right",children:n.cpuPercent.toFixed(1)}),r.jsx("td",{className:"py-1 pr-3 text-right",children:n.rssMb.toFixed(1)}),r.jsx("td",{className:ie("py-1 truncate max-w-[60ch]",o&&"pl-4"),children:n.command})]},n.pid)})})]})})}var HH=2,UH=1,FH=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,s=window.getComputedStyle(this._terminal.element.parentElement),n=parseInt(s.getPropertyValue("height")),o=Math.max(0,parseInt(s.getPropertyValue("width"))),l=window.getComputedStyle(this._terminal.element),u={top:parseInt(l.getPropertyValue("padding-top")),bottom:parseInt(l.getPropertyValue("padding-bottom")),right:parseInt(l.getPropertyValue("padding-right")),left:parseInt(l.getPropertyValue("padding-left"))},h=u.top+u.bottom,m=u.right+u.left,d=n-h,p=o-m-t;return{cols:Math.max(HH,Math.floor(p/e.css.cell.width)),rows:Math.max(UH,Math.floor(d/e.css.cell.height))}}};var H3=Object.defineProperty,qH=Object.getOwnPropertyDescriptor,VH=(e,t)=>{for(var s in t)H3(e,s,{get:t[s],enumerable:!0})},Kt=(e,t,s,n)=>{for(var o=n>1?void 0:n?qH(t,s):t,l=e.length-1,u;l>=0;l--)(u=e[l])&&(o=(n?u(t,s,o):u(o))||o);return n&&o&&H3(t,s,o),o},ke=(e,t)=>(s,n)=>t(s,n,e),l2="Terminal input",V0={get:()=>l2,set:e=>l2=e},c2="Too much output to announce, navigate to rows manually to read",G0={get:()=>c2,set:e=>c2=e};function GH(e){return e.replace(/\r?\n/g,"\r")}function WH(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function KH(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function YH(e,t,s,n){if(e.stopPropagation(),e.clipboardData){let o=e.clipboardData.getData("text/plain");U3(o,t,s,n)}}function U3(e,t,s,n){e=GH(e),e=WH(e,s.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(e,!0),t.value=""}function F3(e,t,s){let n=s.getBoundingClientRect(),o=e.clientX-n.left-10,l=e.clientY-n.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${o}px`,t.style.top=`${l}px`,t.style.zIndex="1000",t.focus()}function u2(e,t,s,n,o){F3(e,t,s),o&&n.rightClickSelect(e),t.value=n.selectionText,t.select()}function aa(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Nf(e,t=0,s=e.length){let n="";for(let o=t;o<s;++o){let l=e[o];l>65535?(l-=65536,n+=String.fromCharCode((l>>10)+55296)+String.fromCharCode(l%1024+56320)):n+=String.fromCharCode(l)}return n}var XH=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let s=e.length;if(!s)return 0;let n=0,o=0;if(this._interim){let l=e.charCodeAt(o++);56320<=l&&l<=57343?t[n++]=(this._interim-55296)*1024+l-56320+65536:(t[n++]=this._interim,t[n++]=l),this._interim=0}for(let l=o;l<s;++l){let u=e.charCodeAt(l);if(55296<=u&&u<=56319){if(++l>=s)return this._interim=u,n;let h=e.charCodeAt(l);56320<=h&&h<=57343?t[n++]=(u-55296)*1024+h-56320+65536:(t[n++]=u,t[n++]=h);continue}u!==65279&&(t[n++]=u)}return n}},ZH=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let s=e.length;if(!s)return 0;let n=0,o,l,u,h,m=0,d=0;if(this.interim[0]){let x=!1,_=this.interim[0];_&=(_&224)===192?31:(_&240)===224?15:7;let S=0,w;for(;(w=this.interim[++S]&63)&&S<4;)_<<=6,_|=w;let k=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,C=k-S;for(;d<C;){if(d>=s)return 0;if(w=e[d++],(w&192)!==128){d--,x=!0;break}else this.interim[S++]=w,_<<=6,_|=w&63}x||(k===2?_<128?d--:t[n++]=_:k===3?_<2048||_>=55296&&_<=57343||_===65279||(t[n++]=_):_<65536||_>1114111||(t[n++]=_)),this.interim.fill(0)}let p=s-4,g=d;for(;g<s;){for(;g<p&&!((o=e[g])&128)&&!((l=e[g+1])&128)&&!((u=e[g+2])&128)&&!((h=e[g+3])&128);)t[n++]=o,t[n++]=l,t[n++]=u,t[n++]=h,g+=4;if(o=e[g++],o<128)t[n++]=o;else if((o&224)===192){if(g>=s)return this.interim[0]=o,n;if(l=e[g++],(l&192)!==128){g--;continue}if(m=(o&31)<<6|l&63,m<128){g--;continue}t[n++]=m}else if((o&240)===224){if(g>=s)return this.interim[0]=o,n;if(l=e[g++],(l&192)!==128){g--;continue}if(g>=s)return this.interim[0]=o,this.interim[1]=l,n;if(u=e[g++],(u&192)!==128){g--;continue}if(m=(o&15)<<12|(l&63)<<6|u&63,m<2048||m>=55296&&m<=57343||m===65279)continue;t[n++]=m}else if((o&248)===240){if(g>=s)return this.interim[0]=o,n;if(l=e[g++],(l&192)!==128){g--;continue}if(g>=s)return this.interim[0]=o,this.interim[1]=l,n;if(u=e[g++],(u&192)!==128){g--;continue}if(g>=s)return this.interim[0]=o,this.interim[1]=l,this.interim[2]=u,n;if(h=e[g++],(h&192)!==128){g--;continue}if(m=(o&7)<<18|(l&63)<<12|(u&63)<<6|h&63,m<65536||m>1114111)continue;t[n++]=m}}return n}},q3="",la=" ",ku=class V3{constructor(){this.fg=0,this.bg=0,this.extended=new Zh}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new V3;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Zh=class G3{constructor(t=0,s=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=s}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new G3(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Xn=class W3 extends ku{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Zh,this.combinedData=""}static fromCharData(t){let s=new W3;return s.setFromCharData(t),s}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?aa(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let s=!1;if(t[1].length>2)s=!0;else if(t[1].length===2){let n=t[1].charCodeAt(0);if(55296<=n&&n<=56319){let o=t[1].charCodeAt(1);56320<=o&&o<=57343?this.content=(n-55296)*1024+o-56320+65536|t[2]<<22:s=!0}else s=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;s&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},d2="di$target",W0="di$dependencies",dg=new Map;function QH(e){return e[W0]||[]}function js(e){if(dg.has(e))return dg.get(e);let t=function(s,n,o){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");JH(t,s,o)};return t._id=e,dg.set(e,t),t}function JH(e,t,s){t[d2]===t?t[W0].push({id:e,index:s}):(t[W0]=[{id:e,index:s}],t[d2]=t)}var nn=js("BufferService"),K3=js("CoreMouseService"),ao=js("CoreService"),eU=js("CharsetService"),Hx=js("InstantiationService"),Y3=js("LogService"),rn=js("OptionsService"),X3=js("OscLinkService"),tU=js("UnicodeService"),Nu=js("DecorationService"),K0=class{constructor(e,t,s){this._bufferService=e,this._optionsService=t,this._oscLinkService=s}provideLinks(e,t){let s=this._bufferService.buffer.lines.get(e-1);if(!s){t(void 0);return}let n=[],o=this._optionsService.rawOptions.linkHandler,l=new Xn,u=s.getTrimmedLength(),h=-1,m=-1,d=!1;for(let p=0;p<u;p++)if(!(m===-1&&!s.hasContent(p))){if(s.loadCell(p,l),l.hasExtendedAttrs()&&l.extended.urlId)if(m===-1){m=p,h=l.extended.urlId;continue}else d=l.extended.urlId!==h;else m!==-1&&(d=!0);if(d||m!==-1&&p===u-1){let g=this._oscLinkService.getLinkData(h)?.uri;if(g){let x={start:{x:m+1,y:e},end:{x:p+(!d&&p===u-1?1:0),y:e}},_=!1;if(!o?.allowNonHttpProtocols)try{let S=new URL(g);["http:","https:"].includes(S.protocol)||(_=!0)}catch{_=!0}_||n.push({text:g,range:x,activate:(S,w)=>o?o.activate(S,w,x):sU(S,w),hover:(S,w)=>o?.hover?.(S,w,x),leave:(S,w)=>o?.leave?.(S,w,x)})}d=!1,l.hasExtendedAttrs()&&l.extended.urlId?(m=p,h=l.extended.urlId):(m=-1,h=-1)}}t(n)}};K0=Kt([ke(0,nn),ke(1,rn),ke(2,X3)],K0);function sU(e,t){if(confirm(`Do you want to navigate to ${t}?
156
+
157
+ WARNING: This link could potentially be dangerous`)){let s=window.open();if(s){try{s.opener=null}catch{}s.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var Cf=js("CharSizeService"),Sr=js("CoreBrowserService"),Ux=js("MouseService"),wr=js("RenderService"),nU=js("SelectionService"),Z3=js("CharacterJoinerService"),yl=js("ThemeService"),Q3=js("LinkProviderService"),iU=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?h2.isErrorNoTelemetry(e)?new h2(e.message+`
158
+
159
+ `+e.stack):new Error(e.message+`
160
+
161
+ `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},rU=new iU;function wh(e){aU(e)||rU.onUnexpectedError(e)}var Y0="Canceled";function aU(e){return e instanceof oU?!0:e instanceof Error&&e.name===Y0&&e.message===Y0}var oU=class extends Error{constructor(){super(Y0),this.name=this.message}};function lU(e){return new Error(`Illegal argument: ${e}`)}var h2=class X0 extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof X0)return t;let s=new X0;return s.message=t.message,s.stack=t.stack,s}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Z0=class J3 extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,J3.prototype)}};function jn(e,t=0){return e[e.length-(1+t)]}var cU;(e=>{function t(l){return l<0}e.isLessThan=t;function s(l){return l<=0}e.isLessThanOrEqual=s;function n(l){return l>0}e.isGreaterThan=n;function o(l){return l===0}e.isNeitherLessOrGreaterThan=o,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(cU||={});function uU(e,t){let s=this,n=!1,o;return function(){return n||(n=!0,t||(o=e.apply(s,arguments))),o}}var e5;(e=>{function t(j){return j&&typeof j=="object"&&typeof j[Symbol.iterator]=="function"}e.is=t;let s=Object.freeze([]);function n(){return s}e.empty=n;function*o(j){yield j}e.single=o;function l(j){return t(j)?j:o(j)}e.wrap=l;function u(j){return j||s}e.from=u;function*h(j){for(let M=j.length-1;M>=0;M--)yield j[M]}e.reverse=h;function m(j){return!j||j[Symbol.iterator]().next().done===!0}e.isEmpty=m;function d(j){return j[Symbol.iterator]().next().value}e.first=d;function p(j,M){let z=0;for(let O of j)if(M(O,z++))return!0;return!1}e.some=p;function g(j,M){for(let z of j)if(M(z))return z}e.find=g;function*x(j,M){for(let z of j)M(z)&&(yield z)}e.filter=x;function*_(j,M){let z=0;for(let O of j)yield M(O,z++)}e.map=_;function*S(j,M){let z=0;for(let O of j)yield*M(O,z++)}e.flatMap=S;function*w(...j){for(let M of j)yield*M}e.concat=w;function k(j,M,z){let O=z;for(let A of j)O=M(O,A);return O}e.reduce=k;function*C(j,M,z=j.length){for(M<0&&(M+=j.length),z<0?z+=j.length:z>j.length&&(z=j.length);M<z;M++)yield j[M]}e.slice=C;function T(j,M=Number.POSITIVE_INFINITY){let z=[];if(M===0)return[z,j];let O=j[Symbol.iterator]();for(let A=0;A<M;A++){let D=O.next();if(D.done)return[z,e.empty()];z.push(D.value)}return[z,{[Symbol.iterator](){return O}}]}e.consume=T;async function E(j){let M=[];for await(let z of j)M.push(z);return Promise.resolve(M)}e.asyncToArray=E})(e5||={});function eo(e){if(e5.is(e)){let t=[];for(let s of e)if(s)try{s.dispose()}catch(n){t.push(n)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function dU(...e){return It(()=>eo(e))}function It(e){return{dispose:uU(()=>{e()})}}var t5=class s5{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{eo(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?s5.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};t5.DISABLE_DISPOSED_WARNING=!1;var ca=t5,Je=class{constructor(){this._store=new ca,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};Je.None=Object.freeze({dispose(){}});var fl=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},pr=typeof window=="object"?window:globalThis,Q0=class J0{constructor(t){this.element=t,this.next=J0.Undefined,this.prev=J0.Undefined}};Q0.Undefined=new Q0(void 0);var Ht=Q0,f2=class{constructor(){this._first=Ht.Undefined,this._last=Ht.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Ht.Undefined}clear(){let e=this._first;for(;e!==Ht.Undefined;){let t=e.next;e.prev=Ht.Undefined,e.next=Ht.Undefined,e=t}this._first=Ht.Undefined,this._last=Ht.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let s=new Ht(e);if(this._first===Ht.Undefined)this._first=s,this._last=s;else if(t){let o=this._last;this._last=s,s.prev=o,o.next=s}else{let o=this._first;this._first=s,s.next=o,o.prev=s}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(s))}}shift(){if(this._first!==Ht.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Ht.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Ht.Undefined&&e.next!==Ht.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Ht.Undefined&&e.next===Ht.Undefined?(this._first=Ht.Undefined,this._last=Ht.Undefined):e.next===Ht.Undefined?(this._last=this._last.prev,this._last.next=Ht.Undefined):e.prev===Ht.Undefined&&(this._first=this._first.next,this._first.prev=Ht.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Ht.Undefined;)yield e.element,e=e.next}},hU=globalThis.performance&&typeof globalThis.performance.now=="function",fU=class n5{static create(t){return new n5(t)}constructor(t){this._now=hU&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Bs;(e=>{e.None=()=>Je.None;function t(H,$){return g(H,()=>{},0,void 0,!0,void 0,$)}e.defer=t;function s(H){return($,q=null,V)=>{let I=!1,W;return W=H(Z=>{if(!I)return W?W.dispose():I=!0,$.call(q,Z)},null,V),I&&W.dispose(),W}}e.once=s;function n(H,$,q){return d((V,I=null,W)=>H(Z=>V.call(I,$(Z)),null,W),q)}e.map=n;function o(H,$,q){return d((V,I=null,W)=>H(Z=>{$(Z),V.call(I,Z)},null,W),q)}e.forEach=o;function l(H,$,q){return d((V,I=null,W)=>H(Z=>$(Z)&&V.call(I,Z),null,W),q)}e.filter=l;function u(H){return H}e.signal=u;function h(...H){return($,q=null,V)=>{let I=dU(...H.map(W=>W(Z=>$.call(q,Z))));return p(I,V)}}e.any=h;function m(H,$,q,V){let I=q;return n(H,W=>(I=$(I,W),I),V)}e.reduce=m;function d(H,$){let q,V={onWillAddFirstListener(){q=H(I.fire,I)},onDidRemoveLastListener(){q?.dispose()}},I=new be(V);return $?.add(I),I.event}function p(H,$){return $ instanceof Array?$.push(H):$&&$.add(H),H}function g(H,$,q=100,V=!1,I=!1,W,Z){let K,te,L,Q=0,re,he={leakWarningThreshold:W,onWillAddFirstListener(){K=H(pe=>{Q++,te=$(te,pe),V&&!L&&(fe.fire(te),te=void 0),re=()=>{let we=te;te=void 0,L=void 0,(!V||Q>1)&&fe.fire(we),Q=0},typeof q=="number"?(clearTimeout(L),L=setTimeout(re,q)):L===void 0&&(L=0,queueMicrotask(re))})},onWillRemoveListener(){I&&Q>0&&re?.()},onDidRemoveLastListener(){re=void 0,K.dispose()}},fe=new be(he);return Z?.add(fe),fe.event}e.debounce=g;function x(H,$=0,q){return e.debounce(H,(V,I)=>V?(V.push(I),V):[I],$,void 0,!0,void 0,q)}e.accumulate=x;function _(H,$=(V,I)=>V===I,q){let V=!0,I;return l(H,W=>{let Z=V||!$(W,I);return V=!1,I=W,Z},q)}e.latch=_;function S(H,$,q){return[e.filter(H,$,q),e.filter(H,V=>!$(V),q)]}e.split=S;function w(H,$=!1,q=[],V){let I=q.slice(),W=H(te=>{I?I.push(te):K.fire(te)});V&&V.add(W);let Z=()=>{I?.forEach(te=>K.fire(te)),I=null},K=new be({onWillAddFirstListener(){W||(W=H(te=>K.fire(te)),V&&V.add(W))},onDidAddFirstListener(){I&&($?setTimeout(Z):Z())},onDidRemoveLastListener(){W&&W.dispose(),W=null}});return V&&V.add(K),K.event}e.buffer=w;function k(H,$){return(q,V,I)=>{let W=$(new T);return H(function(Z){let K=W.evaluate(Z);K!==C&&q.call(V,K)},void 0,I)}}e.chain=k;let C=Symbol("HaltChainable");class T{constructor(){this.steps=[]}map($){return this.steps.push($),this}forEach($){return this.steps.push(q=>($(q),q)),this}filter($){return this.steps.push(q=>$(q)?q:C),this}reduce($,q){let V=q;return this.steps.push(I=>(V=$(V,I),V)),this}latch($=(q,V)=>q===V){let q=!0,V;return this.steps.push(I=>{let W=q||!$(I,V);return q=!1,V=I,W?I:C}),this}evaluate($){for(let q of this.steps)if($=q($),$===C)break;return $}}function E(H,$,q=V=>V){let V=(...K)=>Z.fire(q(...K)),I=()=>H.on($,V),W=()=>H.removeListener($,V),Z=new be({onWillAddFirstListener:I,onDidRemoveLastListener:W});return Z.event}e.fromNodeEventEmitter=E;function j(H,$,q=V=>V){let V=(...K)=>Z.fire(q(...K)),I=()=>H.addEventListener($,V),W=()=>H.removeEventListener($,V),Z=new be({onWillAddFirstListener:I,onDidRemoveLastListener:W});return Z.event}e.fromDOMEventEmitter=j;function M(H){return new Promise($=>s(H)($))}e.toPromise=M;function z(H){let $=new be;return H.then(q=>{$.fire(q)},()=>{$.fire(void 0)}).finally(()=>{$.dispose()}),$.event}e.fromPromise=z;function O(H,$){return H(q=>$.fire(q))}e.forward=O;function A(H,$,q){return $(q),H(V=>$(V))}e.runAndSubscribe=A;class D{constructor($,q){this._observable=$,this._counter=0,this._hasChanged=!1;let V={onWillAddFirstListener:()=>{$.addObserver(this)},onDidRemoveLastListener:()=>{$.removeObserver(this)}};this.emitter=new be(V),q&&q.add(this.emitter)}beginUpdate($){this._counter++}handlePossibleChange($){}handleChange($,q){this._hasChanged=!0}endUpdate($){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function B(H,$){return new D(H,$).emitter.event}e.fromObservable=B;function P(H){return($,q,V)=>{let I=0,W=!1,Z={beginUpdate(){I++},endUpdate(){I--,I===0&&(H.reportChanges(),W&&(W=!1,$.call(q)))},handlePossibleChange(){},handleChange(){W=!0}};H.addObserver(Z),H.reportChanges();let K={dispose(){H.removeObserver(Z)}};return V instanceof ca?V.add(K):Array.isArray(V)&&V.push(K),K}}e.fromObservableLight=P})(Bs||={});var eb=class tb{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${tb._idPool++}`,tb.all.add(this)}start(t){this._stopWatch=new fU,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};eb.all=new Set,eb._idPool=0;var mU=eb,pU=-1,i5=class r5{constructor(t,s,n=(r5._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=s,this.name=n,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,s){let n=this.threshold;if(n<=0||s<n)return;this._stacks||(this._stacks=new Map);let o=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,o+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=n*.5;let[l,u]=this.getMostFrequentStack(),h=`[${this.name}] potential listener LEAK detected, having ${s} listeners already. MOST frequent listener (${u}):`;console.warn(h),console.warn(l);let m=new xU(h,l);this._errorHandler(m)}return()=>{let l=this._stacks.get(t.value)||0;this._stacks.set(t.value,l-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,s=0;for(let[n,o]of this._stacks)(!t||s<o)&&(t=[n,o],s=o);return t}};i5._idPool=1;var gU=i5,bU=class a5{constructor(t){this.value=t}static create(){let t=new Error;return new a5(t.stack??"")}print(){console.warn(this.value.split(`
162
+ `).slice(2).join(`
163
+ `))}},xU=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},vU=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},_U=0,hg=class{constructor(e){this.value=e,this.id=_U++}},yU=2,SU,be=class{constructor(e){this._size=0,this._options=e,this._leakageMon=this._options?.leakWarningThreshold?new gU(e?.onListenerError??wh,this._options?.leakWarningThreshold??pU):void 0,this._perfMon=this._options?._profName?new mU(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,s)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let u=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(u);let h=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],m=new vU(`${u}. HINT: Stack shows most frequent listener (${h[1]}-times)`,h[0]);return(this._options?.onListenerError||wh)(m),Je.None}if(this._disposed)return Je.None;t&&(e=e.bind(t));let n=new hg(e),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(n.stack=bU.create(),o=this._leakageMon.check(n.stack,this._size+1)),this._listeners?this._listeners instanceof hg?(this._deliveryQueue??=new wU,this._listeners=[this._listeners,n]):this._listeners.push(n):(this._options?.onWillAddFirstListener?.(this),this._listeners=n,this._options?.onDidAddFirstListener?.(this)),this._size++;let l=It(()=>{o?.(),this._removeListener(n)});return s instanceof ca?s.add(l):Array.isArray(s)&&s.push(l),l},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,s=t.indexOf(e);if(s===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[s]=void 0;let n=this._deliveryQueue.current===this;if(this._size*yU<=t.length){let o=0;for(let l=0;l<t.length;l++)t[l]?t[o++]=t[l]:n&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=o}}_deliver(e,t){if(!e)return;let s=this._options?.onListenerError||wh;if(!s){e.value(t);return}try{e.value(t)}catch(n){s(n)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof hg)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},wU=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,s){this.i=0,this.end=s,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},sb=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new be,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new be,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,s){if(this.getZoomLevel(s)===t)return;let n=this.getWindowId(s);this.mapWindowIdToZoomLevel.set(n,t),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,s){this.mapWindowIdToZoomFactor.set(this.getWindowId(s),t)}setFullscreen(t,s){if(this.isFullscreen(s)===t)return;let n=this.getWindowId(s);this.mapWindowIdToFullScreen.set(n,t),this._onDidChangeFullscreen.fire(n)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};sb.INSTANCE=new sb;var Fx=sb;function kU(e,t,s){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",s)}Fx.INSTANCE.onDidChangeZoomLevel;function NU(e){return Fx.INSTANCE.getZoomFactor(e)}Fx.INSTANCE.onDidChangeFullscreen;var Sl=typeof navigator=="object"?navigator.userAgent:"",nb=Sl.indexOf("Firefox")>=0,CU=Sl.indexOf("AppleWebKit")>=0,qx=Sl.indexOf("Chrome")>=0,EU=!qx&&Sl.indexOf("Safari")>=0;Sl.indexOf("Electron/")>=0;Sl.indexOf("Android")>=0;var fg=!1;if(typeof pr.matchMedia=="function"){let e=pr.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=pr.matchMedia("(display-mode: fullscreen)");fg=e.matches,kU(pr,e,({matches:s})=>{fg&&t.matches||(fg=s)})}var nl="en",ib=!1,rb=!1,kh=!1,o5=!1,rh,Nh=nl,m2=nl,jU,mr,Za=globalThis,An;typeof Za.vscode<"u"&&typeof Za.vscode.process<"u"?An=Za.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(An=process);var TU=typeof An?.versions?.electron=="string",AU=TU&&An?.type==="renderer";if(typeof An=="object"){ib=An.platform==="win32",rb=An.platform==="darwin",kh=An.platform==="linux",kh&&An.env.SNAP&&An.env.SNAP_REVISION,An.env.CI||An.env.BUILD_ARTIFACTSTAGINGDIRECTORY,rh=nl,Nh=nl;let e=An.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);rh=t.userLocale,m2=t.osLocale,Nh=t.resolvedLanguage||nl,jU=t.languagePack?.translationsConfigFile}catch{}o5=!0}else typeof navigator=="object"&&!AU?(mr=navigator.userAgent,ib=mr.indexOf("Windows")>=0,rb=mr.indexOf("Macintosh")>=0,(mr.indexOf("Macintosh")>=0||mr.indexOf("iPad")>=0||mr.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,kh=mr.indexOf("Linux")>=0,mr?.indexOf("Mobi")>=0,Nh=globalThis._VSCODE_NLS_LANGUAGE||nl,rh=navigator.language.toLowerCase(),m2=rh):console.error("Unable to resolve platform.");var l5=ib,Oi=rb,RU=kh,p2=o5,Bi=mr,sa=Nh,MU;(e=>{function t(){return sa}e.value=t;function s(){return sa.length===2?sa==="en":sa.length>=3?sa[0]==="e"&&sa[1]==="n"&&sa[2]==="-":!1}e.isDefaultVariant=s;function n(){return sa==="en"}e.isDefault=n})(MU||={});var DU=typeof Za.postMessage=="function"&&!Za.importScripts;(()=>{if(DU){let e=[];Za.addEventListener("message",s=>{if(s.data&&s.data.vscodeScheduleAsyncWork)for(let n=0,o=e.length;n<o;n++){let l=e[n];if(l.id===s.data.vscodeScheduleAsyncWork){e.splice(n,1),l.callback();return}}});let t=0;return s=>{let n=++t;e.push({id:n,callback:s}),Za.postMessage({vscodeScheduleAsyncWork:n},"*")}}return e=>setTimeout(e)})();var OU=!!(Bi&&Bi.indexOf("Chrome")>=0);Bi&&Bi.indexOf("Firefox")>=0;!OU&&Bi&&Bi.indexOf("Safari")>=0;Bi&&Bi.indexOf("Edg/")>=0;Bi&&Bi.indexOf("Android")>=0;var Yo=typeof navigator=="object"?navigator:{};p2||document.queryCommandSupported&&document.queryCommandSupported("copy")||Yo&&Yo.clipboard&&Yo.clipboard.writeText,p2||Yo&&Yo.clipboard&&Yo.clipboard.readText;var Vx=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},mg=new Vx,g2=new Vx,b2=new Vx,LU=new Array(230),c5;(e=>{function t(h){return mg.keyCodeToStr(h)}e.toString=t;function s(h){return mg.strToKeyCode(h)}e.fromString=s;function n(h){return g2.keyCodeToStr(h)}e.toUserSettingsUS=n;function o(h){return b2.keyCodeToStr(h)}e.toUserSettingsGeneral=o;function l(h){return g2.strToKeyCode(h)||b2.strToKeyCode(h)}e.fromUserSettings=l;function u(h){if(h>=98&&h<=113)return null;switch(h){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return mg.keyCodeToStr(h)}e.toElectronAccelerator=u})(c5||={});var zU=class u5{constructor(t,s,n,o,l){this.ctrlKey=t,this.shiftKey=s,this.altKey=n,this.metaKey=o,this.keyCode=l}equals(t){return t instanceof u5&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",s=this.shiftKey?"1":"0",n=this.altKey?"1":"0",o=this.metaKey?"1":"0";return`K${t}${s}${n}${o}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new BU([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},BU=class{constructor(e){if(e.length===0)throw lU("chords");this.chords=e}getHashCode(){let e="";for(let t=0,s=this.chords.length;t<s;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function IU(e){if(e.charCode){let s=String.fromCharCode(e.charCode).toUpperCase();return c5.fromString(s)}let t=e.keyCode;if(t===3)return 7;if(nb)switch(t){case 59:return 85;case 60:if(RU)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(CU&&(Oi&&t===93||!Oi&&t===92))return 57;return LU[t]||0}var PU=Oi?256:2048,$U=512,HU=1024,UU=Oi?2048:256,x2=class{constructor(e){this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=t.getModifierState?.("AltGraph"),this.keyCode=IU(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=PU),this.altKey&&(t|=$U),this.shiftKey&&(t|=HU),this.metaKey&&(t|=UU),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new zU(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},v2=new WeakMap;function FU(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,s=e.parent.location;if(t.origin!=="null"&&s.origin!=="null"&&t.origin!==s.origin)return null}catch{return null}return e.parent}var qU=class{static getSameOriginWindowChain(e){let t=v2.get(e);if(!t){t=[],v2.set(e,t);let s=e,n;do n=FU(s),n?t.push({window:new WeakRef(s),iframeElement:s.frameElement||null}):t.push({window:new WeakRef(s),iframeElement:null}),s=n;while(s)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let s=0,n=0,o=this.getSameOriginWindowChain(e);for(let l of o){let u=l.window.deref();if(s+=u?.scrollY??0,n+=u?.scrollX??0,u===t||!l.iframeElement)break;let h=l.iframeElement.getBoundingClientRect();s+=h.top,n+=h.left}return{top:s,left:n}}},ah=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let s=qU.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=s.left,this.posy-=s.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},_2=class{constructor(e,t=0,s=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=s,this.deltaX=t;let n=!1;if(qx){let o=navigator.userAgent.match(/Chrome\/(\d+)/);n=(o?parseInt(o[1]):123)<=122}if(e){let o=e,l=e,u=e.view?.devicePixelRatio||1;if(typeof o.wheelDeltaY<"u")n?this.deltaY=o.wheelDeltaY/(120*u):this.deltaY=o.wheelDeltaY/120;else if(typeof l.VERTICAL_AXIS<"u"&&l.axis===l.VERTICAL_AXIS)this.deltaY=-l.detail/3;else if(e.type==="wheel"){let h=e;h.deltaMode===h.DOM_DELTA_LINE?nb&&!Oi?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")EU&&l5?this.deltaX=-(o.wheelDeltaX/120):n?this.deltaX=o.wheelDeltaX/(120*u):this.deltaX=o.wheelDeltaX/120;else if(typeof l.HORIZONTAL_AXIS<"u"&&l.axis===l.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let h=e;h.deltaMode===h.DOM_DELTA_LINE?nb&&!Oi?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(n?this.deltaY=e.wheelDelta/(120*u):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},d5=Object.freeze(function(e,t){let s=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(s)}}}),VU;(e=>{function t(s){return s===e.None||s===e.Cancelled||s instanceof GU?!0:!s||typeof s!="object"?!1:typeof s.isCancellationRequested=="boolean"&&typeof s.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Bs.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:d5})})(VU||={});var GU=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?d5:(this._emitter||(this._emitter=new be),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Gx=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new Z0("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Z0("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},WU=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,s=globalThis){if(this.isDisposed)throw new Z0("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let n=s.setInterval(()=>{e()},t);this.disposable=It(()=>{s.clearInterval(n),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},KU;(e=>{async function t(n){let o,l=await Promise.all(n.map(u=>u.then(h=>h,h=>{o||(o=h)})));if(typeof o<"u")throw o;return l}e.settled=t;function s(n){return new Promise(async(o,l)=>{try{await n(o,l)}catch(u){l(u)}})}e.withAsyncBody=s})(KU||={});var y2=class Vn{static fromArray(t){return new Vn(s=>{s.emitMany(t)})}static fromPromise(t){return new Vn(async s=>{s.emitMany(await t)})}static fromPromises(t){return new Vn(async s=>{await Promise.all(t.map(async n=>s.emitOne(await n)))})}static merge(t){return new Vn(async s=>{await Promise.all(t.map(async n=>{for await(let o of n)s.emitOne(o)}))})}constructor(t,s){this._state=0,this._results=[],this._error=null,this._onReturn=s,this._onStateChanged=new be,queueMicrotask(async()=>{let n={emitOne:o=>this.emitOne(o),emitMany:o=>this.emitMany(o),reject:o=>this.reject(o)};try{await Promise.resolve(t(n)),this.resolve()}catch(o){this.reject(o)}finally{n.emitOne=void 0,n.emitMany=void 0,n.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Bs.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,s){return new Vn(async n=>{for await(let o of t)n.emitOne(s(o))})}map(t){return Vn.map(this,t)}static filter(t,s){return new Vn(async n=>{for await(let o of t)s(o)&&n.emitOne(o)})}filter(t){return Vn.filter(this,t)}static coalesce(t){return Vn.filter(t,s=>!!s)}coalesce(){return Vn.coalesce(this)}static async toPromise(t){let s=[];for await(let n of t)s.push(n);return s}toPromise(){return Vn.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};y2.EMPTY=y2.fromArray([]);var{getWindow:Mi,getWindowId:YU,onDidRegisterWindow:XU}=(function(){let e=new Map,t={window:pr,disposables:new ca};e.set(pr.vscodeWindowId,t);let s=new be,n=new be,o=new be;function l(u,h){return(typeof u=="number"?e.get(u):void 0)??(h?t:void 0)}return{onDidRegisterWindow:s.event,onWillUnregisterWindow:o.event,onDidUnregisterWindow:n.event,registerWindow(u){if(e.has(u.vscodeWindowId))return Je.None;let h=new ca,m={window:u,disposables:h.add(new ca)};return e.set(u.vscodeWindowId,m),h.add(It(()=>{e.delete(u.vscodeWindowId),n.fire(u)})),h.add(Ve(u,ws.BEFORE_UNLOAD,()=>{o.fire(u)})),s.fire(m),h},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(u){return u.vscodeWindowId},hasWindow(u){return e.has(u)},getWindowById:l,getWindow(u){let h=u;if(h?.ownerDocument?.defaultView)return h.ownerDocument.defaultView.window;let m=u;return m?.view?m.view.window:pr},getDocument(u){return Mi(u).document}}})(),ZU=class{constructor(e,t,s,n){this._node=e,this._type=t,this._handler=s,this._options=n||!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 Ve(e,t,s,n){return new ZU(e,t,s,n)}var S2=function(e,t,s,n){return Ve(e,t,s,n)},Wx,QU=class extends WU{constructor(e){super(),this.defaultTarget=e&&Mi(e)}cancelAndSet(e,t,s){return super.cancelAndSet(e,t,s??this.defaultTarget)}},w2=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){wh(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,s=new Map,n=new Map,o=l=>{s.set(l,!1);let u=e.get(l)??[];for(t.set(l,u),e.set(l,[]),n.set(l,!0);u.length>0;)u.sort(w2.sort),u.shift().execute();n.set(l,!1)};Wx=(l,u,h=0)=>{let m=YU(l),d=new w2(u,h),p=e.get(m);return p||(p=[],e.set(m,p)),p.push(d),s.get(m)||(s.set(m,!0),l.requestAnimationFrame(()=>o(m))),d}})();function JU(e){let t=e.getBoundingClientRect(),s=Mi(e);return{left:t.left+s.scrollX,top:t.top+s.scrollY,width:t.width,height:t.height}}var ws={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"},eF=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=pn(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=pn(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=pn(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=pn(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=pn(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=pn(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=pn(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=pn(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=pn(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=pn(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=pn(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=pn(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=pn(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=pn(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function pn(e){return typeof e=="number"?`${e}px`:e}function Xc(e){return new eF(e)}var h5=class{constructor(){this._hooks=new ca,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let s=this._onStopCallback;this._onStopCallback=null,e&&s&&s(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,s,n,o){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=n,this._onStopCallback=o;let l=e;try{e.setPointerCapture(t),this._hooks.add(It(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{l=Mi(e)}this._hooks.add(Ve(l,ws.POINTER_MOVE,u=>{if(u.buttons!==s){this.stopMonitoring(!0);return}u.preventDefault(),this._pointerMoveCallback(u)})),this._hooks.add(Ve(l,ws.POINTER_UP,u=>this.stopMonitoring(!0)))}};function tF(e,t,s){let n=null,o=null;if(typeof s.value=="function"?(n="value",o=s.value,o.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof s.get=="function"&&(n="get",o=s.get),!o)throw new Error("not supported");let l=`$memoize$${t}`;s[n]=function(...u){return this.hasOwnProperty(l)||Object.defineProperty(this,l,{configurable:!1,enumerable:!1,writable:!1,value:o.apply(this,u)}),this[l]}}var Ti;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Ti||={});var zc=class qs extends Je{constructor(){super(),this.dispatched=!1,this.targets=new f2,this.ignoreTargets=new f2,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Bs.runAndSubscribe(XU,({window:t,disposables:s})=>{s.add(Ve(t.document,"touchstart",n=>this.onTouchStart(n),{passive:!1})),s.add(Ve(t.document,"touchend",n=>this.onTouchEnd(t,n))),s.add(Ve(t.document,"touchmove",n=>this.onTouchMove(n),{passive:!1}))},{window:pr,disposables:this._store}))}static addTarget(t){if(!qs.isTouchDevice())return Je.None;qs.INSTANCE||(qs.INSTANCE=new qs);let s=qs.INSTANCE.targets.push(t);return It(s)}static ignoreTarget(t){if(!qs.isTouchDevice())return Je.None;qs.INSTANCE||(qs.INSTANCE=new qs);let s=qs.INSTANCE.ignoreTargets.push(t);return It(s)}static isTouchDevice(){return"ontouchstart"in pr||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let s=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let n=0,o=t.targetTouches.length;n<o;n++){let l=t.targetTouches.item(n);this.activeTouches[l.identifier]={id:l.identifier,initialTarget:l.target,initialTimeStamp:s,initialPageX:l.pageX,initialPageY:l.pageY,rollingTimestamps:[s],rollingPageX:[l.pageX],rollingPageY:[l.pageY]};let u=this.newGestureEvent(Ti.Start,l.target);u.pageX=l.pageX,u.pageY=l.pageY,this.dispatchEvent(u)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,s){let n=Date.now(),o=Object.keys(this.activeTouches).length;for(let l=0,u=s.changedTouches.length;l<u;l++){let h=s.changedTouches.item(l);if(!this.activeTouches.hasOwnProperty(String(h.identifier))){console.warn("move of an UNKNOWN touch",h);continue}let m=this.activeTouches[h.identifier],d=Date.now()-m.initialTimeStamp;if(d<qs.HOLD_DELAY&&Math.abs(m.initialPageX-jn(m.rollingPageX))<30&&Math.abs(m.initialPageY-jn(m.rollingPageY))<30){let p=this.newGestureEvent(Ti.Tap,m.initialTarget);p.pageX=jn(m.rollingPageX),p.pageY=jn(m.rollingPageY),this.dispatchEvent(p)}else if(d>=qs.HOLD_DELAY&&Math.abs(m.initialPageX-jn(m.rollingPageX))<30&&Math.abs(m.initialPageY-jn(m.rollingPageY))<30){let p=this.newGestureEvent(Ti.Contextmenu,m.initialTarget);p.pageX=jn(m.rollingPageX),p.pageY=jn(m.rollingPageY),this.dispatchEvent(p)}else if(o===1){let p=jn(m.rollingPageX),g=jn(m.rollingPageY),x=jn(m.rollingTimestamps)-m.rollingTimestamps[0],_=p-m.rollingPageX[0],S=g-m.rollingPageY[0],w=[...this.targets].filter(k=>m.initialTarget instanceof Node&&k.contains(m.initialTarget));this.inertia(t,w,n,Math.abs(_)/x,_>0?1:-1,p,Math.abs(S)/x,S>0?1:-1,g)}this.dispatchEvent(this.newGestureEvent(Ti.End,m.initialTarget)),delete this.activeTouches[h.identifier]}this.dispatched&&(s.preventDefault(),s.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,s){let n=document.createEvent("CustomEvent");return n.initEvent(t,!1,!0),n.initialTarget=s,n.tapCount=0,n}dispatchEvent(t){if(t.type===Ti.Tap){let s=new Date().getTime(),n=0;s-this._lastSetTapCountTime>qs.CLEAR_TAP_COUNT_TIME?n=1:n=2,this._lastSetTapCountTime=s,t.tapCount=n}else(t.type===Ti.Change||t.type===Ti.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let n of this.ignoreTargets)if(n.contains(t.initialTarget))return;let s=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let o=0,l=t.initialTarget;for(;l&&l!==n;)o++,l=l.parentElement;s.push([o,n])}s.sort((n,o)=>n[0]-o[0]);for(let[n,o]of s)o.dispatchEvent(t),this.dispatched=!0}}inertia(t,s,n,o,l,u,h,m,d){this.handle=Wx(t,()=>{let p=Date.now(),g=p-n,x=0,_=0,S=!0;o+=qs.SCROLL_FRICTION*g,h+=qs.SCROLL_FRICTION*g,o>0&&(S=!1,x=l*o*g),h>0&&(S=!1,_=m*h*g);let w=this.newGestureEvent(Ti.Change);w.translationX=x,w.translationY=_,s.forEach(k=>k.dispatchEvent(w)),S||this.inertia(t,s,p,o,l,u+x,h,m,d+_)})}onTouchMove(t){let s=Date.now();for(let n=0,o=t.changedTouches.length;n<o;n++){let l=t.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("end of an UNKNOWN touch",l);continue}let u=this.activeTouches[l.identifier],h=this.newGestureEvent(Ti.Change,u.initialTarget);h.translationX=l.pageX-jn(u.rollingPageX),h.translationY=l.pageY-jn(u.rollingPageY),h.pageX=l.pageX,h.pageY=l.pageY,this.dispatchEvent(h),u.rollingPageX.length>3&&(u.rollingPageX.shift(),u.rollingPageY.shift(),u.rollingTimestamps.shift()),u.rollingPageX.push(l.pageX),u.rollingPageY.push(l.pageY),u.rollingTimestamps.push(s)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};zc.SCROLL_FRICTION=-.005,zc.HOLD_DELAY=700,zc.CLEAR_TAP_COUNT_TIME=400,Kt([tF],zc,"isTouchDevice",1);var sF=zc,Kx=class extends Je{onclick(e,t){this._register(Ve(e,ws.CLICK,s=>t(new ah(Mi(e),s))))}onmousedown(e,t){this._register(Ve(e,ws.MOUSE_DOWN,s=>t(new ah(Mi(e),s))))}onmouseover(e,t){this._register(Ve(e,ws.MOUSE_OVER,s=>t(new ah(Mi(e),s))))}onmouseleave(e,t){this._register(Ve(e,ws.MOUSE_LEAVE,s=>t(new ah(Mi(e),s))))}onkeydown(e,t){this._register(Ve(e,ws.KEY_DOWN,s=>t(new x2(s))))}onkeyup(e,t){this._register(Ve(e,ws.KEY_UP,s=>t(new x2(s))))}oninput(e,t){this._register(Ve(e,ws.INPUT,t))}onblur(e,t){this._register(Ve(e,ws.BLUR,t))}onfocus(e,t){this._register(Ve(e,ws.FOCUS,t))}onchange(e,t){this._register(Ve(e,ws.CHANGE,t))}ignoreGesture(e){return sF.ignoreTarget(e)}},k2=11,nF=class extends Kx{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=k2+"px",this.domNode.style.height=k2+"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 h5),this._register(S2(this.bgDomNode,ws.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(S2(this.domNode,ws.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new QU),this._pointerdownScheduleRepeatTimer=this._register(new Gx)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Mi(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,s=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},iF=class ab{constructor(t,s,n,o,l,u,h){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(s=s|0,n=n|0,o=o|0,l=l|0,u=u|0,h=h|0),this.rawScrollLeft=o,this.rawScrollTop=h,s<0&&(s=0),o+s>n&&(o=n-s),o<0&&(o=0),l<0&&(l=0),h+l>u&&(h=u-l),h<0&&(h=0),this.width=s,this.scrollWidth=n,this.scrollLeft=o,this.height=l,this.scrollHeight=u,this.scrollTop=h}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,s){return new ab(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,s?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,s?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new ab(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,s){let n=this.width!==t.width,o=this.scrollWidth!==t.scrollWidth,l=this.scrollLeft!==t.scrollLeft,u=this.height!==t.height,h=this.scrollHeight!==t.scrollHeight,m=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:s,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:o,scrollLeftChanged:l,heightChanged:u,scrollHeightChanged:h,scrollTopChanged:m}}},rF=class extends Je{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new be),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new iF(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let s=this._state.withScrollDimensions(e,t);this._setState(s,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let s=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===s.scrollLeft&&this._smoothScrolling.to.scrollTop===s.scrollTop)return;let n;t?n=new C2(this._smoothScrolling.from,s,this._smoothScrolling.startTime,this._smoothScrolling.duration):n=this._smoothScrolling.combine(this._state,s,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=n}else{let s=this._state.withScrollPosition(e);this._smoothScrolling=C2.start(this._state,s,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let s=this._state;s.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(s,t)))}},N2=class{constructor(e,t,s){this.scrollLeft=e,this.scrollTop=t,this.isDone=s}};function pg(e,t){let s=t-e;return function(n){return e+s*lF(n)}}function aF(e,t,s){return function(n){return n<s?e(n/s):t((n-s)/(1-s))}}var C2=class ob{constructor(t,s,n,o){this.from=t,this.to=s,this.duration=o,this.startTime=n,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,s,n){if(Math.abs(t-s)>2.5*n){let o,l;return t<s?(o=t+.75*n,l=s-.75*n):(o=t-.75*n,l=s+.75*n),aF(pg(t,o),pg(l,s),.33)}return pg(t,s)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let s=(t-this.startTime)/this.duration;if(s<1){let n=this.scrollLeft(s),o=this.scrollTop(s);return new N2(n,o,!1)}return new N2(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,s,n){return ob.start(t,s,n)}static start(t,s,n){n=n+10;let o=Date.now()-10;return new ob(t,s,o,n)}};function oF(e){return Math.pow(e,3)}function lF(e){return 1-oF(1-e)}var cF=class extends Je{constructor(e,t,s){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=s,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Gx)}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":"")))}},uF=140,f5=class extends Kx{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 cF(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new h5),this._shouldRender=!0,this.domNode=Xc(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(Ve(this.domNode.domNode,ws.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new nF(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,s,n){this.slider=Xc(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof s=="number"&&this.slider.setWidth(s),typeof n=="number"&&this.slider.setHeight(n),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Ve(this.slider.domNode,ws.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 t=this.domNode.domNode.getClientRects()[0].top,s=t+this._scrollbarState.getSliderPosition(),n=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),o=this._sliderPointerPosition(e);s<=o&&o<=n?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,s;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,s=e.offsetY;else{let o=JU(this.domNode.domNode);t=e.pageX-o.left,s=e.pageY-o.top}let n=this._pointerDownRelativePosition(t,s);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(n):this._scrollbarState.getDesiredScrollPositionFromOffset(n)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),s=this._sliderOrthogonalPointerPosition(e),n=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,o=>{let l=this._sliderOrthogonalPointerPosition(o),u=Math.abs(l-s);if(l5&&u>uF){this._setDesiredScrollPositionNow(n.getScrollPosition());return}let h=this._sliderPointerPosition(o)-t;this._setDesiredScrollPositionNow(n.getDesiredScrollPositionFromDelta(h))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},m5=class lb{constructor(t,s,n,o,l,u){this._scrollbarSize=Math.round(s),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(t),this._visibleSize=o,this._scrollSize=l,this._scrollPosition=u,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new lb(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let s=Math.round(t);return this._visibleSize!==s?(this._visibleSize=s,this._refreshComputedValues(),!0):!1}setScrollSize(t){let s=Math.round(t);return this._scrollSize!==s?(this._scrollSize=s,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let s=Math.round(t);return this._scrollPosition!==s?(this._scrollPosition=s,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,s,n,o,l){let u=Math.max(0,n-t),h=Math.max(0,u-2*s),m=o>0&&o>n;if(!m)return{computedAvailableSize:Math.round(u),computedIsNeeded:m,computedSliderSize:Math.round(h),computedSliderRatio:0,computedSliderPosition:0};let d=Math.round(Math.max(20,Math.floor(n*h/o))),p=(h-d)/(o-n),g=l*p;return{computedAvailableSize:Math.round(u),computedIsNeeded:m,computedSliderSize:Math.round(d),computedSliderRatio:p,computedSliderPosition:Math.round(g)}}_refreshComputedValues(){let t=lb._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let s=t-this._arrowSize-this._computedSliderSize/2;return Math.round(s/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let s=t-this._arrowSize,n=this._scrollPosition;return s<this._computedSliderPosition?n-=this._visibleSize:n+=this._visibleSize,n}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let s=this._computedSliderPosition+t;return Math.round(s/this._computedSliderRatio)}},dF=class extends f5{constructor(e,t,s){let n=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:s,scrollbarState:new m5(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,n.width,n.scrollWidth,o.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},hF=class extends f5{constructor(e,t,s){let n=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:s,scrollbarState:new m5(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,n.height,n.scrollHeight,o.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},fF=500,E2=50,mF=class{constructor(e,t,s){this.timestamp=e,this.deltaX=t,this.deltaY=s,this.score=0}},cb=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,s=0,n=1,o=this._rear;do{let l=o===this._front?t:Math.pow(2,-n);if(t-=l,s+=this._memory[o].score*l,o===this._front)break;o=(this._capacity+o-1)%this._capacity,n++}while(!0);return s<=.5}acceptStandardWheelEvent(t){if(qx){let s=Mi(t.browserEvent),n=NU(s);this.accept(Date.now(),t.deltaX*n,t.deltaY*n)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,s,n){let o=null,l=new mF(t,s,n);this._front===-1&&this._rear===-1?(this._memory[0]=l,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]=l),l.score=this._computeScore(l,o)}_computeScore(t,s){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(n+=.25),s){let o=Math.abs(t.deltaX),l=Math.abs(t.deltaY),u=Math.abs(s.deltaX),h=Math.abs(s.deltaY),m=Math.max(Math.min(o,u),1),d=Math.max(Math.min(l,h),1),p=Math.max(o,u),g=Math.max(l,h);p%m===0&&g%d===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};cb.INSTANCE=new cb;var pF=cb,gF=class extends Kx{constructor(e,t,s){super(),this._onScroll=this._register(new be),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new be),this.onWillScroll=this._onWillScroll.event,this._options=xF(t),this._scrollable=s,this._register(this._scrollable.onScroll(o=>{this._onWillScroll.fire(o),this._onDidScroll(o),this._onScroll.fire(o)}));let n={onMouseWheel:o=>this._onMouseWheel(o),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new hF(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new dF(this._scrollable,this._options,n)),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=Xc(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Xc(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Xc(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 Gx),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=eo(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 _2(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=eo(this._mouseWheelToDispose),e)){let t=s=>{this._onMouseWheel(new _2(s))};this._mouseWheelToDispose.push(Ve(this._listenOnDomNode,ws.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=pF.INSTANCE;t.acceptStandardWheelEvent(e);let s=!1;if(e.deltaY||e.deltaX){let o=e.deltaY*this._options.mouseWheelScrollSensitivity,l=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&l+o===0?l=o=0:Math.abs(o)>=Math.abs(l)?l=0:o=0),this._options.flipAxes&&([o,l]=[l,o]);let u=!Oi&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||u)&&!l&&(l=o,o=0),e.browserEvent&&e.browserEvent.altKey&&(l=l*this._options.fastScrollSensitivity,o=o*this._options.fastScrollSensitivity);let h=this._scrollable.getFutureScrollPosition(),m={};if(o){let d=E2*o,p=h.scrollTop-(d<0?Math.floor(d):Math.ceil(d));this._verticalScrollbar.writeScrollPosition(m,p)}if(l){let d=E2*l,p=h.scrollLeft-(d<0?Math.floor(d):Math.ceil(d));this._horizontalScrollbar.writeScrollPosition(m,p)}m=this._scrollable.validateScrollPosition(m),(h.scrollLeft!==m.scrollLeft||h.scrollTop!==m.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(m):this._scrollable.setScrollPositionNow(m),s=!0)}let n=s;!n&&this._options.alwaysConsumeMouseWheel&&(n=!0),!n&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(n=!0),n&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,s=e.scrollLeft>0,n=s?" left":"",o=t?" top":"",l=s||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${n}`),this._topShadowDomNode.setClassName(`shadow${o}`),this._topLeftShadowDomNode.setClassName(`shadow${l}${o}${n}`)}}_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(),fF)}},bF=class extends gF{constructor(e,t,s){super(e,t,s)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function xF(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,Oi&&(t.className+=" mac"),t}var ub=class extends Je{constructor(e,t,s,n,o,l,u,h){super(),this._bufferService=s,this._optionsService=u,this._renderService=h,this._onRequestScrollLines=this._register(new be),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let m=this._register(new rF({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:d=>Wx(n.window,d)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{m.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new bF(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},m)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(o.onProtocolChange(d=>{this._scrollableElement.updateOptions({handleMouseWheel:!(d&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Bs.runAndSubscribe(l.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=l.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(It(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=n.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(It(()=>this._styleElement.remove())),this._register(Bs.runAndSubscribe(l.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${l.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${l.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${l.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
164
+ `)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(d=>this._handleScroll(d)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),s=t-this._bufferService.buffer.ydisp;s!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(s)),this._isHandlingScroll=!1}};ub=Kt([ke(2,nn),ke(3,Sr),ke(4,K3),ke(5,yl),ke(6,rn),ke(7,wr)],ub);var db=class extends Je{constructor(e,t,s,n,o){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=s,this._decorationService=n,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(l=>this._removeDecoration(l))),this._register(It(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",e?.options?.layer==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let s=e.options.x??0;return s&&s>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let s=this._decorationElements.get(e);s||(s=this._createElement(e),e.element=s,this._decorationElements.set(e,s),this._container.appendChild(s),e.onDispose(()=>{this._decorationElements.delete(e),s.remove()})),s.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(s.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,s.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,s.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,s.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(s)}}_refreshXPosition(e,t=e.element){if(!t)return;let s=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=s?`${s*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=s?`${s*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};db=Kt([ke(1,nn),ke(2,Sr),ke(3,Nu),ke(4,wr)],db);var vF=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,s){return t>=e.startBufferLine-this._linePadding[s||"full"]&&t<=e.endBufferLine+this._linePadding[s||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Ci={full:0,left:0,center:0,right:0},na={full:0,left:0,center:0,right:0},wc={full:0,left:0,center:0,right:0},Qh=class extends Je{constructor(e,t,s,n,o,l,u,h){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=s,this._decorationService=n,this._renderService=o,this._optionsService=l,this._themeService=u,this._coreBrowserService=h,this._colorZoneStore=new vF,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(It(()=>this._canvas?.remove()));let m=this._canvas.getContext("2d");if(m)this._ctx=m;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);na.full=this._canvas.width,na.left=e,na.center=t,na.right=e,this._refreshDrawHeightConstants(),wc.full=1,wc.left=1,wc.center=1+na.left,wc.right=1+na.left+na.center}_refreshDrawHeightConstants(){Ci.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);Ci.left=t,Ci.center=t,Ci.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ci.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ci.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ci.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ci.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(wc[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Ci[e.position||"full"]/2),na[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Ci[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};Qh=Kt([ke(2,nn),ke(3,Nu),ke(4,wr),ke(5,rn),ke(6,yl),ke(7,Sr)],Qh);var de;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
165
+ `,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(de||={});var Ch;(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="Ÿ"))(Ch||={});var p5;(e=>e.ST=`${de.ESC}\\`)(p5||={});var hb=class{constructor(e,t,s,n,o,l){this._textarea=e,this._compositionView=t,this._bufferService=s,this._optionsService=n,this._coreService=o,this._renderService=l,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let s;t.start+=this._dataAlreadySent.length,this._isComposing?s=this._textarea.value.substring(t.start,this._compositionPosition.start):s=this._textarea.value.substring(t.start),s.length>0&&this._coreService.triggerDataEvent(s,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,s=t.replace(e,"");this._dataAlreadySent=s,t.length>e.length?this._coreService.triggerDataEvent(s,!0):t.length<e.length?this._coreService.triggerDataEvent(`${de.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),s=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,o=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=o+"px",this._compositionView.style.top=n+"px",this._compositionView.style.height=s+"px",this._compositionView.style.lineHeight=s+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let l=this._compositionView.getBoundingClientRect();this._textarea.style.left=o+"px",this._textarea.style.top=n+"px",this._textarea.style.width=Math.max(l.width,1)+"px",this._textarea.style.height=Math.max(l.height,1)+"px",this._textarea.style.lineHeight=l.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};hb=Kt([ke(2,nn),ke(3,rn),ke(4,ao),ke(5,wr)],hb);var ks=0,Ns=0,Cs=0,Wt=0,j2={css:"#00000000",rgba:0},us;(e=>{function t(o,l,u,h){return h!==void 0?`#${Ia(o)}${Ia(l)}${Ia(u)}${Ia(h)}`:`#${Ia(o)}${Ia(l)}${Ia(u)}`}e.toCss=t;function s(o,l,u,h=255){return(o<<24|l<<16|u<<8|h)>>>0}e.toRgba=s;function n(o,l,u,h){return{css:e.toCss(o,l,u,h),rgba:e.toRgba(o,l,u,h)}}e.toColor=n})(us||={});var Ot;(e=>{function t(m,d){if(Wt=(d.rgba&255)/255,Wt===1)return{css:d.css,rgba:d.rgba};let p=d.rgba>>24&255,g=d.rgba>>16&255,x=d.rgba>>8&255,_=m.rgba>>24&255,S=m.rgba>>16&255,w=m.rgba>>8&255;ks=_+Math.round((p-_)*Wt),Ns=S+Math.round((g-S)*Wt),Cs=w+Math.round((x-w)*Wt);let k=us.toCss(ks,Ns,Cs),C=us.toRgba(ks,Ns,Cs);return{css:k,rgba:C}}e.blend=t;function s(m){return(m.rgba&255)===255}e.isOpaque=s;function n(m,d,p){let g=Eh.ensureContrastRatio(m.rgba,d.rgba,p);if(g)return us.toColor(g>>24&255,g>>16&255,g>>8&255)}e.ensureContrastRatio=n;function o(m){let d=(m.rgba|255)>>>0;return[ks,Ns,Cs]=Eh.toChannels(d),{css:us.toCss(ks,Ns,Cs),rgba:d}}e.opaque=o;function l(m,d){return Wt=Math.round(d*255),[ks,Ns,Cs]=Eh.toChannels(m.rgba),{css:us.toCss(ks,Ns,Cs,Wt),rgba:us.toRgba(ks,Ns,Cs,Wt)}}e.opacity=l;function u(m,d){return Wt=m.rgba&255,l(m,Wt*d/255)}e.multiplyOpacity=u;function h(m){return[m.rgba>>24&255,m.rgba>>16&255,m.rgba>>8&255]}e.toColorRGB=h})(Ot||={});var Ut;(e=>{let t,s;try{let o=document.createElement("canvas");o.width=1,o.height=1;let l=o.getContext("2d",{willReadFrequently:!0});l&&(t=l,t.globalCompositeOperation="copy",s=t.createLinearGradient(0,0,1,1))}catch{}function n(o){if(o.match(/#[\da-f]{3,8}/i))switch(o.length){case 4:return ks=parseInt(o.slice(1,2).repeat(2),16),Ns=parseInt(o.slice(2,3).repeat(2),16),Cs=parseInt(o.slice(3,4).repeat(2),16),us.toColor(ks,Ns,Cs);case 5:return ks=parseInt(o.slice(1,2).repeat(2),16),Ns=parseInt(o.slice(2,3).repeat(2),16),Cs=parseInt(o.slice(3,4).repeat(2),16),Wt=parseInt(o.slice(4,5).repeat(2),16),us.toColor(ks,Ns,Cs,Wt);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 l=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(l)return ks=parseInt(l[1]),Ns=parseInt(l[2]),Cs=parseInt(l[3]),Wt=Math.round((l[5]===void 0?1:parseFloat(l[5]))*255),us.toColor(ks,Ns,Cs,Wt);if(!t||!s)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=s,t.fillStyle=o,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[ks,Ns,Cs,Wt]=t.getImageData(0,0,1,1).data,Wt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:us.toRgba(ks,Ns,Cs,Wt),css:o}}e.toColor=n})(Ut||={});var Xs;(e=>{function t(n){return s(n>>16&255,n>>8&255,n&255)}e.relativeLuminance=t;function s(n,o,l){let u=n/255,h=o/255,m=l/255,d=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),p=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),g=m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4);return d*.2126+p*.7152+g*.0722}e.relativeLuminance2=s})(Xs||={});var Eh;(e=>{function t(u,h){if(Wt=(h&255)/255,Wt===1)return h;let m=h>>24&255,d=h>>16&255,p=h>>8&255,g=u>>24&255,x=u>>16&255,_=u>>8&255;return ks=g+Math.round((m-g)*Wt),Ns=x+Math.round((d-x)*Wt),Cs=_+Math.round((p-_)*Wt),us.toRgba(ks,Ns,Cs)}e.blend=t;function s(u,h,m){let d=Xs.relativeLuminance(u>>8),p=Xs.relativeLuminance(h>>8);if(fr(d,p)<m){if(p<d){let _=n(u,h,m),S=fr(d,Xs.relativeLuminance(_>>8));if(S<m){let w=o(u,h,m),k=fr(d,Xs.relativeLuminance(w>>8));return S>k?_:w}return _}let g=o(u,h,m),x=fr(d,Xs.relativeLuminance(g>>8));if(x<m){let _=n(u,h,m),S=fr(d,Xs.relativeLuminance(_>>8));return x>S?g:_}return g}}e.ensureContrastRatio=s;function n(u,h,m){let d=u>>24&255,p=u>>16&255,g=u>>8&255,x=h>>24&255,_=h>>16&255,S=h>>8&255,w=fr(Xs.relativeLuminance2(x,_,S),Xs.relativeLuminance2(d,p,g));for(;w<m&&(x>0||_>0||S>0);)x-=Math.max(0,Math.ceil(x*.1)),_-=Math.max(0,Math.ceil(_*.1)),S-=Math.max(0,Math.ceil(S*.1)),w=fr(Xs.relativeLuminance2(x,_,S),Xs.relativeLuminance2(d,p,g));return(x<<24|_<<16|S<<8|255)>>>0}e.reduceLuminance=n;function o(u,h,m){let d=u>>24&255,p=u>>16&255,g=u>>8&255,x=h>>24&255,_=h>>16&255,S=h>>8&255,w=fr(Xs.relativeLuminance2(x,_,S),Xs.relativeLuminance2(d,p,g));for(;w<m&&(x<255||_<255||S<255);)x=Math.min(255,x+Math.ceil((255-x)*.1)),_=Math.min(255,_+Math.ceil((255-_)*.1)),S=Math.min(255,S+Math.ceil((255-S)*.1)),w=fr(Xs.relativeLuminance2(x,_,S),Xs.relativeLuminance2(d,p,g));return(x<<24|_<<16|S<<8|255)>>>0}e.increaseLuminance=o;function l(u){return[u>>24&255,u>>16&255,u>>8&255,u&255]}e.toChannels=l})(Eh||={});function Ia(e){let t=e.toString(16);return t.length<2?"0"+t:t}function fr(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var _F=class extends ku{constructor(e,t,s){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=s}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Jh=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Xn}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let s=[],n=t.translateToString(!0),o=0,l=0,u=0,h=t.getFg(0),m=t.getBg(0);for(let d=0;d<t.getTrimmedLength();d++)if(t.loadCell(d,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==h||this._workCell.bg!==m){if(d-o>1){let p=this._getJoinedRanges(n,u,l,t,o);for(let g=0;g<p.length;g++)s.push(p[g])}o=d,u=l,h=this._workCell.fg,m=this._workCell.bg}l+=this._workCell.getChars().length||la.length}if(this._bufferService.cols-o>1){let d=this._getJoinedRanges(n,u,l,t,o);for(let p=0;p<d.length;p++)s.push(d[p])}return s}_getJoinedRanges(e,t,s,n,o){let l=e.substring(t,s),u=[];try{u=this._characterJoiners[0].handler(l)}catch(h){console.error(h)}for(let h=1;h<this._characterJoiners.length;h++)try{let m=this._characterJoiners[h].handler(l);for(let d=0;d<m.length;d++)Jh._mergeRanges(u,m[d])}catch(m){console.error(m)}return this._stringRangesToCellRanges(u,n,o),u}_stringRangesToCellRanges(e,t,s){let n=0,o=!1,l=0,u=e[n];if(u){for(let h=s;h<this._bufferService.cols;h++){let m=t.getWidth(h),d=t.getString(h).length||la.length;if(m!==0){if(!o&&u[0]<=l&&(u[0]=h,o=!0),u[1]<=l){if(u[1]=h,u=e[++n],!u)break;u[0]<=l?(u[0]=h,o=!0):o=!1}l+=d}}u&&(u[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let s=!1;for(let n=0;n<e.length;n++){let o=e[n];if(s){if(t[1]<=o[0])return e[n-1][1]=t[1],e;if(t[1]<=o[1])return e[n-1][1]=Math.max(t[1],o[1]),e.splice(n,1),e;e.splice(n,1),n--}else{if(t[1]<=o[0])return e.splice(n,0,t),e;if(t[1]<=o[1])return o[0]=Math.min(t[0],o[0]),e;t[0]<o[1]&&(o[0]=Math.min(t[0],o[0]),s=!0);continue}}return s?e[e.length-1][1]=t[1]:e.push(t),e}};Jh=Kt([ke(0,nn)],Jh);function yF(e){return 57508<=e&&e<=57558}function SF(e){return 9472<=e&&e<=9631}function wF(e){return yF(e)||SF(e)}function kF(){return{css:{canvas:oh(),cell:oh()},device:{canvas:oh(),cell:oh(),char:{width:0,height:0,left:0,top:0}}}}function oh(){return{width:0,height:0}}var fb=class{constructor(e,t,s,n,o,l,u){this._document=e,this._characterJoinerService=t,this._optionsService=s,this._coreBrowserService=n,this._coreService=o,this._decorationService=l,this._themeService=u,this._workCell=new Xn,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,s){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=s}createRow(e,t,s,n,o,l,u,h,m,d,p){let g=[],x=this._characterJoinerService.getJoinedCharacters(t),_=this._themeService.colors,S=e.getNoBgTrimmedLength();s&&S<l+1&&(S=l+1);let w,k=0,C="",T=0,E=0,j=0,M=0,z=!1,O=0,A=!1,D=0,B=0,P=[],H=d!==-1&&p!==-1;for(let $=0;$<S;$++){e.loadCell($,this._workCell);let q=this._workCell.getWidth();if(q===0)continue;let V=!1,I=$>=B,W=$,Z=this._workCell;if(x.length>0&&$===x[0][0]&&I){let Re=x.shift(),Pt=this._isCellInSelection(Re[0],t);for(T=Re[0]+1;T<Re[1];T++)I&&=Pt===this._isCellInSelection(T,t);I&&=!s||l<Re[0]||l>=Re[1],I?(V=!0,Z=new _F(this._workCell,e.translateToString(!0,Re[0],Re[1]),Re[1]-Re[0]),W=Re[1]-1,q=Z.getWidth()):B=Re[1]}let K=this._isCellInSelection($,t),te=s&&$===l,L=H&&$>=d&&$<=p,Q=!1;this._decorationService.forEachDecorationAtCell($,t,void 0,Re=>{Q=!0});let re=Z.getChars()||la;if(re===" "&&(Z.isUnderline()||Z.isOverline())&&(re=" "),D=q*h-m.get(re,Z.isBold(),Z.isItalic()),!w)w=this._document.createElement("span");else if(k&&(K&&A||!K&&!A&&Z.bg===E)&&(K&&A&&_.selectionForeground||Z.fg===j)&&Z.extended.ext===M&&L===z&&D===O&&!te&&!V&&!Q&&I){Z.isInvisible()?C+=la:C+=re,k++;continue}else k&&(w.textContent=C),w=this._document.createElement("span"),k=0,C="";if(E=Z.bg,j=Z.fg,M=Z.extended.ext,z=L,O=D,A=K,V&&l>=$&&l<=W&&(l=$),!this._coreService.isCursorHidden&&te&&this._coreService.isCursorInitialized){if(P.push("xterm-cursor"),this._coreBrowserService.isFocused)u&&P.push("xterm-cursor-blink"),P.push(n==="bar"?"xterm-cursor-bar":n==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(o)switch(o){case"outline":P.push("xterm-cursor-outline");break;case"block":P.push("xterm-cursor-block");break;case"bar":P.push("xterm-cursor-bar");break;case"underline":P.push("xterm-cursor-underline");break}}if(Z.isBold()&&P.push("xterm-bold"),Z.isItalic()&&P.push("xterm-italic"),Z.isDim()&&P.push("xterm-dim"),Z.isInvisible()?C=la:C=Z.getChars()||la,Z.isUnderline()&&(P.push(`xterm-underline-${Z.extended.underlineStyle}`),C===" "&&(C=" "),!Z.isUnderlineColorDefault()))if(Z.isUnderlineColorRGB())w.style.textDecorationColor=`rgb(${ku.toColorRGB(Z.getUnderlineColor()).join(",")})`;else{let Re=Z.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Z.isBold()&&Re<8&&(Re+=8),w.style.textDecorationColor=_.ansi[Re].css}Z.isOverline()&&(P.push("xterm-overline"),C===" "&&(C=" ")),Z.isStrikethrough()&&P.push("xterm-strikethrough"),L&&(w.style.textDecoration="underline");let he=Z.getFgColor(),fe=Z.getFgColorMode(),pe=Z.getBgColor(),we=Z.getBgColorMode(),Le=!!Z.isInverse();if(Le){let Re=he;he=pe,pe=Re;let Pt=fe;fe=we,we=Pt}let ve,We,ge=!1;this._decorationService.forEachDecorationAtCell($,t,void 0,Re=>{Re.options.layer!=="top"&&ge||(Re.backgroundColorRGB&&(we=50331648,pe=Re.backgroundColorRGB.rgba>>8&16777215,ve=Re.backgroundColorRGB),Re.foregroundColorRGB&&(fe=50331648,he=Re.foregroundColorRGB.rgba>>8&16777215,We=Re.foregroundColorRGB),ge=Re.options.layer==="top")}),!ge&&K&&(ve=this._coreBrowserService.isFocused?_.selectionBackgroundOpaque:_.selectionInactiveBackgroundOpaque,pe=ve.rgba>>8&16777215,we=50331648,ge=!0,_.selectionForeground&&(fe=50331648,he=_.selectionForeground.rgba>>8&16777215,We=_.selectionForeground)),ge&&P.push("xterm-decoration-top");let Te;switch(we){case 16777216:case 33554432:Te=_.ansi[pe],P.push(`xterm-bg-${pe}`);break;case 50331648:Te=us.toColor(pe>>16,pe>>8&255,pe&255),this._addStyle(w,`background-color:#${T2((pe>>>0).toString(16),"0",6)}`);break;default:Le?(Te=_.foreground,P.push("xterm-bg-257")):Te=_.background}switch(ve||Z.isDim()&&(ve=Ot.multiplyOpacity(Te,.5)),fe){case 16777216:case 33554432:Z.isBold()&&he<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(he+=8),this._applyMinimumContrast(w,Te,_.ansi[he],Z,ve,void 0)||P.push(`xterm-fg-${he}`);break;case 50331648:let Re=us.toColor(he>>16&255,he>>8&255,he&255);this._applyMinimumContrast(w,Te,Re,Z,ve,We)||this._addStyle(w,`color:#${T2(he.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(w,Te,_.foreground,Z,ve,We)||Le&&P.push("xterm-fg-257")}P.length&&(w.className=P.join(" "),P.length=0),!te&&!V&&!Q&&I?k++:w.textContent=C,D!==this.defaultSpacing&&(w.style.letterSpacing=`${D}px`),g.push(w),$=W}return w&&k&&(w.textContent=C),g}_applyMinimumContrast(e,t,s,n,o,l){if(this._optionsService.rawOptions.minimumContrastRatio===1||wF(n.getCode()))return!1;let u=this._getContrastCache(n),h;if(!o&&!l&&(h=u.getColor(t.rgba,s.rgba)),h===void 0){let m=this._optionsService.rawOptions.minimumContrastRatio/(n.isDim()?2:1);h=Ot.ensureContrastRatio(o||t,l||s,m),u.setColor((o||t).rgba,(l||s).rgba,h??null)}return h?(this._addStyle(e,`color:${h.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let s=this._selectionStart,n=this._selectionEnd;return!s||!n?!1:this._columnSelectMode?s[0]<=n[0]?e>=s[0]&&t>=s[1]&&e<n[0]&&t<=n[1]:e<s[0]&&t>=s[1]&&e>=n[0]&&t<=n[1]:t>s[1]&&t<n[1]||s[1]===n[1]&&t===s[1]&&e>=s[0]&&e<n[0]||s[1]<n[1]&&t===n[1]&&e<n[0]||s[1]<n[1]&&t===s[1]&&e>=s[0]}};fb=Kt([ke(1,Z3),ke(2,rn),ke(3,Sr),ke(4,ao),ke(5,Nu),ke(6,yl)],fb);function T2(e,t,s){for(;e.length<s;)e=t+e;return e}var NF=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let s=e.createElement("span");s.classList.add("xterm-char-measure-element");let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontStyle="italic";let l=e.createElement("span");l.classList.add("xterm-char-measure-element"),l.style.fontWeight="bold",l.style.fontStyle="italic",this._measureElements=[s,n,o,l],this._container.appendChild(s),this._container.appendChild(n),this._container.appendChild(o),this._container.appendChild(l),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,s,n){e===this._font&&t===this._fontSize&&s===this._weight&&n===this._weightBold||(this._font=e,this._fontSize=t,this._weight=s,this._weightBold=n,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${s}`,this._measureElements[1].style.fontWeight=`${n}`,this._measureElements[2].style.fontWeight=`${s}`,this._measureElements[3].style.fontWeight=`${n}`,this.clear())}get(e,t,s){let n=0;if(!t&&!s&&e.length===1&&(n=e.charCodeAt(0))<256){if(this._flat[n]!==-9999)return this._flat[n];let u=this._measure(e,0);return u>0&&(this._flat[n]=u),u}let o=e;t&&(o+="B"),s&&(o+="I");let l=this._holey.get(o);if(l===void 0){let u=0;t&&(u|=1),s&&(u|=2),l=this._measure(e,u),l>0&&this._holey.set(o,l)}return l}_measure(e,t){let s=this._measureElements[t];return s.textContent=e.repeat(32),s.offsetWidth/32}},CF=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,s,n=!1){if(this.selectionStart=t,this.selectionEnd=s,!t||!s||t[0]===s[0]&&t[1]===s[1]){this.clear();return}let o=e.buffers.active.ydisp,l=t[1]-o,u=s[1]-o,h=Math.max(l,0),m=Math.min(u,e.rows-1);if(h>=e.rows||m<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=n,this.viewportStartRow=l,this.viewportEndRow=u,this.viewportCappedStartRow=h,this.viewportCappedEndRow=m,this.startCol=t[0],this.endCol=s[0]}isCellSelected(e,t,s){return this.hasSelection?(s-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&s>=this.viewportCappedStartRow&&t<this.endCol&&s<=this.viewportCappedEndRow:t<this.startCol&&s>=this.viewportCappedStartRow&&t>=this.endCol&&s<=this.viewportCappedEndRow:s>this.viewportStartRow&&s<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&s===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportStartRow&&t>=this.startCol):!1}};function EF(){return new CF}var gg="xterm-dom-renderer-owner-",Fn="xterm-rows",lh="xterm-fg-",A2="xterm-bg-",kc="xterm-focus",ch="xterm-selection",jF=1,mb=class extends Je{constructor(e,t,s,n,o,l,u,h,m,d,p,g,x,_){super(),this._terminal=e,this._document=t,this._element=s,this._screenElement=n,this._viewportElement=o,this._helperContainer=l,this._linkifier2=u,this._charSizeService=m,this._optionsService=d,this._bufferService=p,this._coreService=g,this._coreBrowserService=x,this._themeService=_,this._terminalClass=jF++,this._rowElements=[],this._selectionRenderModel=EF(),this.onRequestRedraw=this._register(new be).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Fn),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(ch),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=kF(),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=h.createInstance(fb,document),this._element.classList.add(gg+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(It(()=>{this._element.classList.remove(gg+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new NF(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let s of this._rowElements)s.style.width=`${this.dimensions.css.canvas.width}px`,s.style.height=`${this.dimensions.css.cell.height}px`,s.style.lineHeight=`${this.dimensions.css.cell.height}px`,s.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Fn} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${Fn} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${Fn} .xterm-dim { color: ${Ot.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let s=`blink_underline_${this._terminalClass}`,n=`blink_bar_${this._terminalClass}`,o=`blink_block_${this._terminalClass}`;t+=`@keyframes ${s} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${n} { 50% { box-shadow: none; }}`,t+=`@keyframes ${o} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Fn}.${kc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${Fn}.${kc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Fn}.${kc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${o} 1s step-end infinite;}${this._terminalSelector} .${Fn} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Fn} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Fn} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Fn} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Fn} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${ch} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${ch} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${ch} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[l,u]of e.ansi.entries())t+=`${this._terminalSelector} .${lh}${l} { color: ${u.css}; }${this._terminalSelector} .${lh}${l}.xterm-dim { color: ${Ot.multiplyOpacity(u,.5).css}; }${this._terminalSelector} .${A2}${l} { background-color: ${u.css}; }`;t+=`${this._terminalSelector} .${lh}257 { color: ${Ot.opaque(e.background).css}; }${this._terminalSelector} .${lh}257.xterm-dim { color: ${Ot.multiplyOpacity(Ot.opaque(e.background),.5).css}; }${this._terminalSelector} .${A2}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let s=this._rowElements.length;s<=t;s++){let n=this._document.createElement("div");this._rowContainer.appendChild(n),this._rowElements.push(n)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(kc),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(kc),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,s){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,s),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,s),!this._selectionRenderModel.hasSelection))return;let n=this._selectionRenderModel.viewportStartRow,o=this._selectionRenderModel.viewportEndRow,l=this._selectionRenderModel.viewportCappedStartRow,u=this._selectionRenderModel.viewportCappedEndRow,h=this._document.createDocumentFragment();if(s){let m=e[0]>t[0];h.appendChild(this._createSelectionElement(l,m?t[0]:e[0],m?e[0]:t[0],u-l+1))}else{let m=n===l?e[0]:0,d=l===o?t[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(l,m,d));let p=u-l-1;if(h.appendChild(this._createSelectionElement(l+1,0,this._bufferService.cols,p)),l!==u){let g=o===u?t[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(u,0,g))}}this._selectionContainer.appendChild(h)}_createSelectionElement(e,t,s,n=1){let o=this._document.createElement("div"),l=t*this.dimensions.css.cell.width,u=this.dimensions.css.cell.width*(s-t);return l+u>this.dimensions.css.canvas.width&&(u=this.dimensions.css.canvas.width-l),o.style.height=`${n*this.dimensions.css.cell.height}px`,o.style.top=`${e*this.dimensions.css.cell.height}px`,o.style.left=`${l}px`,o.style.width=`${u}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,t){let s=this._bufferService.buffer,n=s.ybase+s.y,o=Math.min(s.x,this._bufferService.cols-1),l=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,u=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,h=this._optionsService.rawOptions.cursorInactiveStyle;for(let m=e;m<=t;m++){let d=m+s.ydisp,p=this._rowElements[m],g=s.lines.get(d);if(!p||!g)break;p.replaceChildren(...this._rowFactory.createRow(g,d,d===n,u,h,o,l,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${gg}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,s,n,o,l){s<0&&(e=0),n<0&&(t=0);let u=this._bufferService.rows-1;s=Math.max(Math.min(s,u),0),n=Math.max(Math.min(n,u),0),o=Math.min(o,this._bufferService.cols);let h=this._bufferService.buffer,m=h.ybase+h.y,d=Math.min(h.x,o-1),p=this._optionsService.rawOptions.cursorBlink,g=this._optionsService.rawOptions.cursorStyle,x=this._optionsService.rawOptions.cursorInactiveStyle;for(let _=s;_<=n;++_){let S=_+h.ydisp,w=this._rowElements[_],k=h.lines.get(S);if(!w||!k)break;w.replaceChildren(...this._rowFactory.createRow(k,S,S===m,g,x,d,p,this.dimensions.css.cell.width,this._widthCache,l?_===s?e:0:-1,l?(_===n?t:o)-1:-1))}}};mb=Kt([ke(7,Hx),ke(8,Cf),ke(9,rn),ke(10,nn),ke(11,ao),ke(12,Sr),ke(13,yl)],mb);var pb=class extends Je{constructor(e,t,s){super(),this._optionsService=s,this.width=0,this.height=0,this._onCharSizeChange=this._register(new be),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new AF(this._optionsService))}catch{this._measureStrategy=this._register(new TF(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};pb=Kt([ke(2,rn)],pb);var g5=class extends Je{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},TF=class extends g5{constructor(e,t,s){super(),this._document=e,this._parentElement=t,this._optionsService=s,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},AF=class extends g5{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},RF=class extends Je{constructor(e,t,s){super(),this._textarea=e,this._window=t,this.mainDocument=s,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new MF(this._window)),this._onDprChange=this._register(new be),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new be),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(n=>this._screenDprMonitor.setWindow(n))),this._register(Bs.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Ve(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Ve(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}},MF=class extends Je{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new fl),this._onDprChange=this._register(new be),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(It(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Ve(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)}},DF=class extends Je{constructor(){super(),this.linkProviders=[],this._register(It(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function Yx(e,t,s){let n=s.getBoundingClientRect(),o=e.getComputedStyle(s),l=parseInt(o.getPropertyValue("padding-left")),u=parseInt(o.getPropertyValue("padding-top"));return[t.clientX-n.left-l,t.clientY-n.top-u]}function OF(e,t,s,n,o,l,u,h,m){if(!l)return;let d=Yx(e,t,s);if(d)return d[0]=Math.ceil((d[0]+(m?u/2:0))/u),d[1]=Math.ceil(d[1]/h),d[0]=Math.min(Math.max(d[0],1),n+(m?1:0)),d[1]=Math.min(Math.max(d[1],1),o),d}var gb=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,s,n,o){return OF(window,e,t,s,n,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,o)}getMouseReportCoords(e,t){let s=Yx(window,e,t);if(this._charSizeService.hasValidSize)return s[0]=Math.min(Math.max(s[0],0),this._renderService.dimensions.css.canvas.width-1),s[1]=Math.min(Math.max(s[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(s[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(s[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(s[0]),y:Math.floor(s[1])}}};gb=Kt([ke(0,wr),ke(1,Cf)],gb);var LF=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,s){this._rowCount=s,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},b5={};VH(b5,{getSafariVersion:()=>BF,isChromeOS:()=>y5,isFirefox:()=>x5,isIpad:()=>IF,isIphone:()=>PF,isLegacyEdge:()=>zF,isLinux:()=>Xx,isMac:()=>ef,isNode:()=>Ef,isSafari:()=>v5,isWindows:()=>_5});var Ef=typeof process<"u"&&"title"in process,Cu=Ef?"node":navigator.userAgent,Eu=Ef?"node":navigator.platform,x5=Cu.includes("Firefox"),zF=Cu.includes("Edge"),v5=/^((?!chrome|android).)*safari/i.test(Cu);function BF(){if(!v5)return 0;let e=Cu.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var ef=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Eu),IF=Eu==="iPad",PF=Eu==="iPhone",_5=["Windows","Win16","Win32","WinCE"].includes(Eu),Xx=Eu.indexOf("Linux")>=0,y5=/\bCrOS\b/.test(Cu),S5=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,s=0,n=e.timeRemaining(),o=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),s=Math.max(t,s),o=e.timeRemaining(),s*1.5>o){n-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-t))}ms`),this._start();return}n=o}this.clear()}},$F=class extends S5{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},HF=class extends S5{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},tf=!Ef&&"requestIdleCallback"in window?HF:$F,UF=class{constructor(){this._queue=new tf}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},bb=class extends Je{constructor(e,t,s,n,o,l,u,h,m){super(),this._rowCount=e,this._optionsService=s,this._charSizeService=n,this._coreService=o,this._coreBrowserService=h,this._renderer=this._register(new fl),this._pausedResizeTask=new UF,this._observerDisposable=this._register(new fl),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new be),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new be),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new be),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new be),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new LF((d,p)=>this._renderRows(d,p),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new FF(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(It(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(u.onResize(()=>this._fullRefresh())),this._register(u.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(l.onDecorationRegistered(()=>this._fullRefresh())),this._register(l.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(u.cols,u.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(u.buffer.y,u.buffer.y,!0))),this._register(m.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(d=>this._registerIntersectionObserver(d,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let s=new e.IntersectionObserver(n=>this._handleIntersectionChange(n[n.length-1]),{threshold:0});s.observe(t),this._observerDisposable.value=It(()=>s.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,s=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let n=this._syncOutputHandler.flush();n&&(e=Math.min(e,n.start),t=Math.max(t,n.end)),s||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,s){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=s,this._renderer.value?.handleSelectionChanged(e,t,s)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};bb=Kt([ke(2,rn),ke(3,Cf),ke(4,ao),ke(5,Nu),ke(6,nn),ke(7,Sr),ke(8,yl)],bb);var FF=class{constructor(e,t,s){this._coreBrowserService=e,this._coreService=t,this._onTimeout=s,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function qF(e,t,s,n){let o=s.buffer.x,l=s.buffer.y;if(!s.buffer.hasScrollback)return WF(o,l,e,t,s,n)+jf(l,t,s,n)+KF(o,l,e,t,s,n);let u;if(l===t)return u=o>e?"D":"C",au(Math.abs(o-e),ru(u,n));u=l>t?"D":"C";let h=Math.abs(l-t),m=GF(l>t?e:o,s)+(h-1)*s.cols+1+VF(l>t?o:e);return au(m,ru(u,n))}function VF(e,t){return e-1}function GF(e,t){return t.cols-e}function WF(e,t,s,n,o,l){return jf(t,n,o,l).length===0?"":au(k5(e,t,e,t-to(t,o),!1,o).length,ru("D",l))}function jf(e,t,s,n){let o=e-to(e,s),l=t-to(t,s),u=Math.abs(o-l)-YF(e,t,s);return au(u,ru(w5(e,t),n))}function KF(e,t,s,n,o,l){let u;jf(t,n,o,l).length>0?u=n-to(n,o):u=t;let h=n,m=XF(e,t,s,n,o,l);return au(k5(e,u,s,h,m==="C",o).length,ru(m,l))}function YF(e,t,s){let n=0,o=e-to(e,s),l=t-to(t,s);for(let u=0;u<Math.abs(o-l);u++){let h=w5(e,t)==="A"?-1:1;s.buffer.lines.get(o+h*u)?.isWrapped&&n++}return n}function to(e,t){let s=0,n=t.buffer.lines.get(e),o=n?.isWrapped;for(;o&&e>=0&&e<t.rows;)s++,n=t.buffer.lines.get(--e),o=n?.isWrapped;return s}function XF(e,t,s,n,o,l){let u;return jf(s,n,o,l).length>0?u=n-to(n,o):u=t,e<s&&u<=n||e>=s&&u<n?"C":"D"}function w5(e,t){return e>t?"A":"B"}function k5(e,t,s,n,o,l){let u=e,h=t,m="";for(;(u!==s||h!==n)&&h>=0&&h<l.buffer.lines.length;)u+=o?1:-1,o&&u>l.cols-1?(m+=l.buffer.translateBufferLineToString(h,!1,e,u),u=0,e=0,h++):!o&&u<0&&(m+=l.buffer.translateBufferLineToString(h,!1,0,e+1),u=l.cols-1,e=u,h--);return m+l.buffer.translateBufferLineToString(h,!1,e,u)}function ru(e,t){let s=t?"O":"[";return de.ESC+s+e}function au(e,t){e=Math.floor(e);let s="";for(let n=0;n<e;n++)s+=t;return s}var ZF=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function R2(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var bg=50,QF=15,JF=50,eq=500,tq=" ",sq=new RegExp(tq,"g"),xb=class extends Je{constructor(e,t,s,n,o,l,u,h,m){super(),this._element=e,this._screenElement=t,this._linkifier=s,this._bufferService=n,this._coreService=o,this._mouseService=l,this._optionsService=u,this._renderService=h,this._coreBrowserService=m,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Xn,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new be),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new be),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new be),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new be),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=d=>this._handleMouseMove(d),this._mouseUpListener=d=>this._handleMouseUp(d),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(d=>this._handleTrim(d)),this._register(this._bufferService.buffers.onBufferActivate(d=>this._handleBufferActivate(d))),this.enable(),this._model=new ZF(this._bufferService),this._activeSelectionMode=0,this._register(It(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(d=>{d.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let s=this._bufferService.buffer,n=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let o=e[0]<t[0]?e[0]:t[0],l=e[0]<t[0]?t[0]:e[0];for(let u=e[1];u<=t[1];u++){let h=s.translateBufferLineToString(u,!0,o,l);n.push(h)}}else{let o=e[1]===t[1]?t[0]:void 0;n.push(s.translateBufferLineToString(e[1],!0,e[0],o));for(let l=e[1]+1;l<=t[1]-1;l++){let u=s.lines.get(l),h=s.translateBufferLineToString(l,!0);u?.isWrapped?n[n.length-1]+=h:n.push(h)}if(e[1]!==t[1]){let l=s.lines.get(t[1]),u=s.translateBufferLineToString(t[1],!0,0,t[0]);l&&l.isWrapped?n[n.length-1]+=u:n.push(u)}}return n.map(o=>o.replace(sq," ")).join(_5?`\r
166
+ `:`
167
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Xx&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),s=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!s||!n||!t?!1:this._areCoordsInSelection(t,s,n)}isCellInSelection(e,t){let s=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!s||!n?!1:this._areCoordsInSelection([e,t],s,n)}_areCoordsInSelection(e,t,s){return e[1]>t[1]&&e[1]<s[1]||t[1]===s[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<s[0]||t[1]<s[1]&&e[1]===s[1]&&e[0]<s[0]||t[1]<s[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let s=this._linkifier.currentLink?.link?.range;if(s)return this._model.selectionStart=[s.start.x-1,s.start.y-1],this._model.selectionStartLength=R2(s,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let n=this._getMouseBufferCoords(e);return n?(this._selectWordAt(n,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=Yx(this._coreBrowserService.window,e,this._screenElement)[1],s=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=s?0:(t>s&&(t-=s),t=Math.min(Math.max(t,-bg),bg),t/=bg,t/Math.abs(t)+Math.round(t*(QF-1)))}shouldForceSelection(e){return ef?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(),JF)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(ef&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let s=this._bufferService.buffer;if(this._model.selectionEnd[1]<s.lines.length){let n=s.lines.get(this._model.selectionEnd[1]);n&&n.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<eq&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let s=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(s&&s[0]!==void 0&&s[1]!==void 0){let n=qF(s[0]-1,s[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(n,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,s=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!s){this._oldHasSelection&&this._fireOnSelectionChange(e,t,s);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,s)}_fireOnSelectionChange(e,t,s){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=s,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let s=t;for(let n=0;t>=n;n++){let o=e.loadCell(n,this._workCell).getChars().length;this._workCell.getWidth()===0?s--:o>1&&t!==n&&(s+=o-1)}return s}setSelection(e,t,s){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=s,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,s=!0,n=!0){if(e[0]>=this._bufferService.cols)return;let o=this._bufferService.buffer,l=o.lines.get(e[1]);if(!l)return;let u=o.translateBufferLineToString(e[1],!1),h=this._convertViewportColToCharacterIndex(l,e[0]),m=h,d=e[0]-h,p=0,g=0,x=0,_=0;if(u.charAt(h)===" "){for(;h>0&&u.charAt(h-1)===" ";)h--;for(;m<u.length&&u.charAt(m+1)===" ";)m++}else{let k=e[0],C=e[0];l.getWidth(k)===0&&(p++,k--),l.getWidth(C)===2&&(g++,C++);let T=l.getString(C).length;for(T>1&&(_+=T-1,m+=T-1);k>0&&h>0&&!this._isCharWordSeparator(l.loadCell(k-1,this._workCell));){l.loadCell(k-1,this._workCell);let E=this._workCell.getChars().length;this._workCell.getWidth()===0?(p++,k--):E>1&&(x+=E-1,h-=E-1),h--,k--}for(;C<l.length&&m+1<u.length&&!this._isCharWordSeparator(l.loadCell(C+1,this._workCell));){l.loadCell(C+1,this._workCell);let E=this._workCell.getChars().length;this._workCell.getWidth()===2?(g++,C++):E>1&&(_+=E-1,m+=E-1),m++,C++}}m++;let S=h+d-p+x,w=Math.min(this._bufferService.cols,m-h+p+g-x-_);if(!(!t&&u.slice(h,m).trim()==="")){if(s&&S===0&&l.getCodePoint(0)!==32){let k=o.lines.get(e[1]-1);if(k&&l.isWrapped&&k.getCodePoint(this._bufferService.cols-1)!==32){let C=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(C){let T=this._bufferService.cols-C.start;S-=T,w+=T}}}if(n&&S+w===this._bufferService.cols&&l.getCodePoint(this._bufferService.cols-1)!==32){let k=o.lines.get(e[1]+1);if(k?.isWrapped&&k.getCodePoint(0)!==32){let C=this._getWordAt([0,e[1]+1],!1,!1,!0);C&&(w+=C.length)}}return{start:S,length:w}}}_selectWordAt(e,t){let s=this._getWordAt(e,t);if(s){for(;s.start<0;)s.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[s.start,e[1]],this._model.selectionStartLength=s.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let s=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,s--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,s++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,s]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),s={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=R2(s,this._bufferService.cols)}};xb=Kt([ke(3,nn),ke(4,ao),ke(5,Ux),ke(6,rn),ke(7,wr),ke(8,Sr)],xb);var M2=class{constructor(){this._data={}}set(e,t,s){this._data[e]||(this._data[e]={}),this._data[e][t]=s}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},D2=class{constructor(){this._color=new M2,this._css=new M2}setCss(e,t,s){this._css.set(e,t,s)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,s){this._color.set(e,t,s)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},gs=Object.freeze((()=>{let e=[Ut.toColor("#2e3436"),Ut.toColor("#cc0000"),Ut.toColor("#4e9a06"),Ut.toColor("#c4a000"),Ut.toColor("#3465a4"),Ut.toColor("#75507b"),Ut.toColor("#06989a"),Ut.toColor("#d3d7cf"),Ut.toColor("#555753"),Ut.toColor("#ef2929"),Ut.toColor("#8ae234"),Ut.toColor("#fce94f"),Ut.toColor("#729fcf"),Ut.toColor("#ad7fa8"),Ut.toColor("#34e2e2"),Ut.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let s=0;s<216;s++){let n=t[s/36%6|0],o=t[s/6%6|0],l=t[s%6];e.push({css:us.toCss(n,o,l),rgba:us.toRgba(n,o,l)})}for(let s=0;s<24;s++){let n=8+s*10;e.push({css:us.toCss(n,n,n),rgba:us.toRgba(n,n,n)})}return e})()),Ua=Ut.toColor("#ffffff"),Bc=Ut.toColor("#000000"),O2=Ut.toColor("#ffffff"),L2=Bc,Nc={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},nq=Ua,vb=class extends Je{constructor(e){super(),this._optionsService=e,this._contrastCache=new D2,this._halfContrastCache=new D2,this._onChangeColors=this._register(new be),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Ua,background:Bc,cursor:O2,cursorAccent:L2,selectionForeground:void 0,selectionBackgroundTransparent:Nc,selectionBackgroundOpaque:Ot.blend(Bc,Nc),selectionInactiveBackgroundTransparent:Nc,selectionInactiveBackgroundOpaque:Ot.blend(Bc,Nc),scrollbarSliderBackground:Ot.opacity(Ua,.2),scrollbarSliderHoverBackground:Ot.opacity(Ua,.4),scrollbarSliderActiveBackground:Ot.opacity(Ua,.5),overviewRulerBorder:Ua,ansi:gs.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=kt(e.foreground,Ua),t.background=kt(e.background,Bc),t.cursor=Ot.blend(t.background,kt(e.cursor,O2)),t.cursorAccent=Ot.blend(t.background,kt(e.cursorAccent,L2)),t.selectionBackgroundTransparent=kt(e.selectionBackground,Nc),t.selectionBackgroundOpaque=Ot.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=kt(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Ot.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?kt(e.selectionForeground,j2):void 0,t.selectionForeground===j2&&(t.selectionForeground=void 0),Ot.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Ot.opacity(t.selectionBackgroundTransparent,.3)),Ot.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Ot.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=kt(e.scrollbarSliderBackground,Ot.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=kt(e.scrollbarSliderHoverBackground,Ot.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=kt(e.scrollbarSliderActiveBackground,Ot.opacity(t.foreground,.5)),t.overviewRulerBorder=kt(e.overviewRulerBorder,nq),t.ansi=gs.slice(),t.ansi[0]=kt(e.black,gs[0]),t.ansi[1]=kt(e.red,gs[1]),t.ansi[2]=kt(e.green,gs[2]),t.ansi[3]=kt(e.yellow,gs[3]),t.ansi[4]=kt(e.blue,gs[4]),t.ansi[5]=kt(e.magenta,gs[5]),t.ansi[6]=kt(e.cyan,gs[6]),t.ansi[7]=kt(e.white,gs[7]),t.ansi[8]=kt(e.brightBlack,gs[8]),t.ansi[9]=kt(e.brightRed,gs[9]),t.ansi[10]=kt(e.brightGreen,gs[10]),t.ansi[11]=kt(e.brightYellow,gs[11]),t.ansi[12]=kt(e.brightBlue,gs[12]),t.ansi[13]=kt(e.brightMagenta,gs[13]),t.ansi[14]=kt(e.brightCyan,gs[14]),t.ansi[15]=kt(e.brightWhite,gs[15]),e.extendedAnsi){let s=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let n=0;n<s;n++)t.ansi[n+16]=kt(e.extendedAnsi[n],gs[n+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};vb=Kt([ke(0,rn)],vb);function kt(e,t){if(e!==void 0)try{return Ut.toColor(e)}catch{}return t}var iq=class{constructor(...e){this._entries=new Map;for(let[t,s]of e)this.set(t,s)}set(e,t){let s=this._entries.get(e);return this._entries.set(e,t),s}forEach(e){for(let[t,s]of this._entries.entries())e(t,s)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},rq=class{constructor(){this._services=new iq,this._services.set(Hx,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let s=QH(e).sort((l,u)=>l.index-u.index),n=[];for(let l of s){let u=this._services.get(l.id);if(!u)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${l.id._id}.`);n.push(u)}let o=s.length>0?s[0].index:t.length;if(t.length!==o)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${o+1} conflicts with ${t.length} static arguments`);return new e(...t,...n)}},aq={trace:0,debug:1,info:2,warn:3,error:4,off:5},oq="xterm.js: ",_b=class extends Je{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=aq[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,s){this._evalLazyOptionalParams(s),e.call(console,(this._optionsService.options.logger?"":oq)+t,...s)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};_b=Kt([ke(0,rn)],_b);var z2=class extends Je{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new be),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new be),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new be),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let s=0;s<Math.min(e,this.length);s++)t[s]=this._array[this._getCyclicIndex(s)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...s){if(t){for(let n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let n=this._length-1;n>=e;n--)this._array[this._getCyclicIndex(n+s.length)]=this._array[this._getCyclicIndex(n)];for(let n=0;n<s.length;n++)this._array[this._getCyclicIndex(e+n)]=s[n];if(s.length&&this.onInsertEmitter.fire({index:e,amount:s.length}),this._length+s.length>this._maxLength){let n=this._length+s.length-this._maxLength;this._startIndex+=n,this._length=this._maxLength,this.onTrimEmitter.fire(n)}else this._length+=s.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,s){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+s<0)throw new Error("Cannot shift elements in list beyond index 0");if(s>0){for(let o=t-1;o>=0;o--)this.set(e+o+s,this.get(e+o));let n=e+t+s-this._length;if(n>0)for(this._length+=n;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let n=0;n<t;n++)this.set(e+n+s,this.get(e+n))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Ze=3,os=Object.freeze(new ku),uh=0,xg=2,Ic=class N5{constructor(t,s,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Ze);let o=s||Xn.fromCharData([0,q3,1,0]);for(let l=0;l<t;++l)this.setCell(l,o);this.length=t}get(t){let s=this._data[t*Ze+0],n=s&2097151;return[this._data[t*Ze+1],s&2097152?this._combined[t]:n?aa(n):"",s>>22,s&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n]}set(t,s){this._data[t*Ze+1]=s[0],s[1].length>1?(this._combined[t]=s[1],this._data[t*Ze+0]=t|2097152|s[2]<<22):this._data[t*Ze+0]=s[1].charCodeAt(0)|s[2]<<22}getWidth(t){return this._data[t*Ze+0]>>22}hasWidth(t){return this._data[t*Ze+0]&12582912}getFg(t){return this._data[t*Ze+1]}getBg(t){return this._data[t*Ze+2]}hasContent(t){return this._data[t*Ze+0]&4194303}getCodePoint(t){let s=this._data[t*Ze+0];return s&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):s&2097151}isCombined(t){return this._data[t*Ze+0]&2097152}getString(t){let s=this._data[t*Ze+0];return s&2097152?this._combined[t]:s&2097151?aa(s&2097151):""}isProtected(t){return this._data[t*Ze+2]&536870912}loadCell(t,s){return uh=t*Ze,s.content=this._data[uh+0],s.fg=this._data[uh+1],s.bg=this._data[uh+2],s.content&2097152&&(s.combinedData=this._combined[t]),s.bg&268435456&&(s.extended=this._extendedAttrs[t]),s}setCell(t,s){s.content&2097152&&(this._combined[t]=s.combinedData),s.bg&268435456&&(this._extendedAttrs[t]=s.extended),this._data[t*Ze+0]=s.content,this._data[t*Ze+1]=s.fg,this._data[t*Ze+2]=s.bg}setCellFromCodepoint(t,s,n,o){o.bg&268435456&&(this._extendedAttrs[t]=o.extended),this._data[t*Ze+0]=s|n<<22,this._data[t*Ze+1]=o.fg,this._data[t*Ze+2]=o.bg}addCodepointToCell(t,s,n){let o=this._data[t*Ze+0];o&2097152?this._combined[t]+=aa(s):o&2097151?(this._combined[t]=aa(o&2097151)+aa(s),o&=-2097152,o|=2097152):o=s|1<<22,n&&(o&=-12582913,o|=n<<22),this._data[t*Ze+0]=o}insertCells(t,s,n){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),s<this.length-t){let o=new Xn;for(let l=this.length-t-s-1;l>=0;--l)this.setCell(t+s+l,this.loadCell(t+l,o));for(let l=0;l<s;++l)this.setCell(t+l,n)}else for(let o=t;o<this.length;++o)this.setCell(o,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(t,s,n){if(t%=this.length,s<this.length-t){let o=new Xn;for(let l=0;l<this.length-t-s;++l)this.setCell(t+l,this.loadCell(t+s+l,o));for(let l=this.length-s;l<this.length;++l)this.setCell(l,n)}else for(let o=t;o<this.length;++o)this.setCell(o,n);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,n)}replaceCells(t,s,n,o=!1){if(o){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,n),s<this.length&&this.getWidth(s-1)===2&&!this.isProtected(s)&&this.setCellFromCodepoint(s,0,1,n);t<s&&t<this.length;)this.isProtected(t)||this.setCell(t,n),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),s<this.length&&this.getWidth(s-1)===2&&this.setCellFromCodepoint(s,0,1,n);t<s&&t<this.length;)this.setCell(t++,n)}resize(t,s){if(t===this.length)return this._data.length*4*xg<this._data.buffer.byteLength;let n=t*Ze;if(t>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let o=new Uint32Array(n);o.set(this._data),this._data=o}for(let o=this.length;o<t;++o)this.setCell(o,s)}else{this._data=this._data.subarray(0,n);let o=Object.keys(this._combined);for(let u=0;u<o.length;u++){let h=parseInt(o[u],10);h>=t&&delete this._combined[h]}let l=Object.keys(this._extendedAttrs);for(let u=0;u<l.length;u++){let h=parseInt(l[u],10);h>=t&&delete this._extendedAttrs[h]}}return this.length=t,n*4*xg<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*xg<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,s=!1){if(s){for(let n=0;n<this.length;++n)this.isProtected(n)||this.setCell(n,t);return}this._combined={},this._extendedAttrs={};for(let n=0;n<this.length;++n)this.setCell(n,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let s in t._combined)this._combined[s]=t._combined[s];this._extendedAttrs={};for(let s in t._extendedAttrs)this._extendedAttrs[s]=t._extendedAttrs[s];this.isWrapped=t.isWrapped}clone(){let t=new N5(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let s in this._combined)t._combined[s]=this._combined[s];for(let s in this._extendedAttrs)t._extendedAttrs[s]=this._extendedAttrs[s];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Ze+0]&4194303)return t+(this._data[t*Ze+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Ze+0]&4194303||this._data[t*Ze+2]&50331648)return t+(this._data[t*Ze+0]>>22);return 0}copyCellsFrom(t,s,n,o,l){let u=t._data;if(l)for(let m=o-1;m>=0;m--){for(let d=0;d<Ze;d++)this._data[(n+m)*Ze+d]=u[(s+m)*Ze+d];u[(s+m)*Ze+2]&268435456&&(this._extendedAttrs[n+m]=t._extendedAttrs[s+m])}else for(let m=0;m<o;m++){for(let d=0;d<Ze;d++)this._data[(n+m)*Ze+d]=u[(s+m)*Ze+d];u[(s+m)*Ze+2]&268435456&&(this._extendedAttrs[n+m]=t._extendedAttrs[s+m])}let h=Object.keys(t._combined);for(let m=0;m<h.length;m++){let d=parseInt(h[m],10);d>=s&&(this._combined[d-s+n]=t._combined[d])}}translateToString(t,s,n,o){s=s??0,n=n??this.length,t&&(n=Math.min(n,this.getTrimmedLength())),o&&(o.length=0);let l="";for(;s<n;){let u=this._data[s*Ze+0],h=u&2097151,m=u&2097152?this._combined[s]:h?aa(h):la;if(l+=m,o)for(let d=0;d<m.length;++d)o.push(s);s+=u>>22||1}return o&&o.push(s),l}};function lq(e,t,s,n,o,l){let u=[];for(let h=0;h<e.length-1;h++){let m=h,d=e.get(++m);if(!d.isWrapped)continue;let p=[e.get(h)];for(;m<e.length&&d.isWrapped;)p.push(d),d=e.get(++m);if(!l&&n>=h&&n<m){h+=p.length-1;continue}let g=0,x=ou(p,g,t),_=1,S=0;for(;_<p.length;){let k=ou(p,_,t),C=k-S,T=s-x,E=Math.min(C,T);p[g].copyCellsFrom(p[_],S,x,E,!1),x+=E,x===s&&(g++,x=0),S+=E,S===k&&(_++,S=0),x===0&&g!==0&&p[g-1].getWidth(s-1)===2&&(p[g].copyCellsFrom(p[g-1],s-1,x++,1,!1),p[g-1].setCell(s-1,o))}p[g].replaceCells(x,s,o);let w=0;for(let k=p.length-1;k>0&&(k>g||p[k].getTrimmedLength()===0);k--)w++;w>0&&(u.push(h+p.length-w),u.push(w)),h+=p.length-1}return u}function cq(e,t){let s=[],n=0,o=t[n],l=0;for(let u=0;u<e.length;u++)if(o===u){let h=t[++n];e.onDeleteEmitter.fire({index:u-l,amount:h}),u+=h-1,l+=h,o=t[++n]}else s.push(u);return{layout:s,countRemoved:l}}function uq(e,t){let s=[];for(let n=0;n<t.length;n++)s.push(e.get(t[n]));for(let n=0;n<s.length;n++)e.set(n,s[n]);e.length=t.length}function dq(e,t,s){let n=[],o=e.map((m,d)=>ou(e,d,t)).reduce((m,d)=>m+d),l=0,u=0,h=0;for(;h<o;){if(o-h<s){n.push(o-h);break}l+=s;let m=ou(e,u,t);l>m&&(l-=m,u++);let d=e[u].getWidth(l-1)===2;d&&l--;let p=d?s-1:s;n.push(p),h+=p}return n}function ou(e,t,s){if(t===e.length-1)return e[t].getTrimmedLength();let n=!e[t].hasContent(s-1)&&e[t].getWidth(s-1)===1,o=e[t+1].getWidth(0)===2;return n&&o?s-1:s}var C5=class E5{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=E5._nextId++,this._onDispose=this.register(new be),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),eo(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};C5._nextId=1;var hq=C5,_s={},Fa=_s.B;_s[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:"≥","{":"π","|":"≠","}":"£","~":"·"};_s.A={"#":"£"};_s.B=void 0;_s[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};_s.C=_s[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};_s.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};_s.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};_s.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};_s.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};_s.E=_s[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};_s.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};_s.H=_s[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};_s["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var B2=4294967295,I2=class{constructor(e,t,s){this._hasScrollback=e,this._optionsService=t,this._bufferService=s,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=os.clone(),this.savedCharset=Fa,this.markers=[],this._nullCell=Xn.fromCharData([0,q3,1,0]),this._whitespaceCell=Xn.fromCharData([0,la,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new tf,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new z2(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 Zh),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 Zh),this._whitespaceCell}getBlankLine(e,t){return new Ic(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>B2?B2:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=os);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new z2(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let s=this.getNullCell(os),n=0,o=this._getCorrectBufferLength(t);if(o>this.lines.maxLength&&(this.lines.maxLength=o),this.lines.length>0){if(this._cols<e)for(let u=0;u<this.lines.length;u++)n+=+this.lines.get(u).resize(e,s);let l=0;if(this._rows<t)for(let u=this._rows;u<t;u++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new Ic(e,s)):this.ybase>0&&this.lines.length<=this.ybase+this.y+l+1?(this.ybase--,l++,this.ydisp>0&&this.ydisp--):this.lines.push(new Ic(e,s)));else for(let u=this._rows;u>t;u--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(o<this.lines.maxLength){let u=this.lines.length-o;u>0&&(this.lines.trimStart(u),this.ybase=Math.max(this.ybase-u,0),this.ydisp=Math.max(this.ydisp-u,0),this.savedY=Math.max(this.savedY-u,0)),this.lines.maxLength=o}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),l&&(this.y+=l),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let l=0;l<this.lines.length;l++)n+=+this.lines.get(l).resize(e,s);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),n>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let s=this._optionsService.rawOptions.reflowCursorLine,n=lq(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(os),s);if(n.length>0){let o=cq(this.lines,n);uq(this.lines,o.layout),this._reflowLargerAdjustViewport(e,t,o.countRemoved)}}_reflowLargerAdjustViewport(e,t,s){let n=this.getNullCell(os),o=s;for(;o-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Ic(e,n))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-s,0)}_reflowSmaller(e,t){let s=this._optionsService.rawOptions.reflowCursorLine,n=this.getNullCell(os),o=[],l=0;for(let u=this.lines.length-1;u>=0;u--){let h=this.lines.get(u);if(!h||!h.isWrapped&&h.getTrimmedLength()<=e)continue;let m=[h];for(;h.isWrapped&&u>0;)h=this.lines.get(--u),m.unshift(h);if(!s){let E=this.ybase+this.y;if(E>=u&&E<u+m.length)continue}let d=m[m.length-1].getTrimmedLength(),p=dq(m,this._cols,e),g=p.length-m.length,x;this.ybase===0&&this.y!==this.lines.length-1?x=Math.max(0,this.y-this.lines.maxLength+g):x=Math.max(0,this.lines.length-this.lines.maxLength+g);let _=[];for(let E=0;E<g;E++){let j=this.getBlankLine(os,!0);_.push(j)}_.length>0&&(o.push({start:u+m.length+l,newLines:_}),l+=_.length),m.push(..._);let S=p.length-1,w=p[S];w===0&&(S--,w=p[S]);let k=m.length-g-1,C=d;for(;k>=0;){let E=Math.min(C,w);if(m[S]===void 0)break;if(m[S].copyCellsFrom(m[k],C-E,w-E,E,!0),w-=E,w===0&&(S--,w=p[S]),C-=E,C===0){k--;let j=Math.max(k,0);C=ou(m,j,this._cols)}}for(let E=0;E<m.length;E++)p[E]<e&&m[E].setCell(p[E],n);let T=g-x;for(;T-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+l)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+g,this.ybase+t-1)}if(o.length>0){let u=[],h=[];for(let w=0;w<this.lines.length;w++)h.push(this.lines.get(w));let m=this.lines.length,d=m-1,p=0,g=o[p];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+l);let x=0;for(let w=Math.min(this.lines.maxLength-1,m+l-1);w>=0;w--)if(g&&g.start>d+x){for(let k=g.newLines.length-1;k>=0;k--)this.lines.set(w--,g.newLines[k]);w++,u.push({index:d+1,amount:g.newLines.length}),x+=g.newLines.length,g=o[++p]}else this.lines.set(w,h[d--]);let _=0;for(let w=u.length-1;w>=0;w--)u[w].index+=_,this.lines.onInsertEmitter.fire(u[w]),_+=u[w].amount;let S=Math.max(0,m+l-this.lines.maxLength);S>0&&this.lines.onTrimEmitter.fire(S)}}translateBufferLineToString(e,t,s=0,n){let o=this.lines.get(e);return o?o.translateToString(t,s,n):""}getWrappedRangeForLine(e){let t=e,s=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;s+1<this.lines.length&&this.lines.get(s+1).isWrapped;)s++;return{first:t,last:s}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new hq(e);return this.markers.push(t),t.register(this.lines.onTrim(s=>{t.line-=s,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(s=>{t.line>=s.index&&(t.line+=s.amount)})),t.register(this.lines.onDelete(s=>{t.line>=s.index&&t.line<s.index+s.amount&&t.dispose(),t.line>s.index&&(t.line-=s.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},fq=class extends Je{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new be),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new I2(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new I2(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},j5=2,T5=1,yb=class extends Je{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new be),this.onResize=this._onResize.event,this._onScroll=this._register(new be),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,j5),this.rows=Math.max(e.rawOptions.rows||0,T5),this.buffers=this._register(new fq(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let s=this.cols!==e,n=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:s,rowsChanged:n})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let s=this.buffer,n;n=this._cachedBlankLine,(!n||n.length!==this.cols||n.getFg(0)!==e.fg||n.getBg(0)!==e.bg)&&(n=s.getBlankLine(e,t),this._cachedBlankLine=n),n.isWrapped=t;let o=s.ybase+s.scrollTop,l=s.ybase+s.scrollBottom;if(s.scrollTop===0){let u=s.lines.isFull;l===s.lines.length-1?u?s.lines.recycle().copyFrom(n):s.lines.push(n.clone()):s.lines.splice(l+1,0,n.clone()),u?this.isUserScrolling&&(s.ydisp=Math.max(s.ydisp-1,0)):(s.ybase++,this.isUserScrolling||s.ydisp++)}else{let u=l-o+1;s.lines.shiftElements(o+1,u-1,-1),s.lines.set(l,n.clone())}this.isUserScrolling||(s.ydisp=s.ybase),this._onScroll.fire(s.ydisp)}scrollLines(e,t){let s=this.buffer;if(e<0){if(s.ydisp===0)return;this.isUserScrolling=!0}else e+s.ydisp>=s.ybase&&(this.isUserScrolling=!1);let n=s.ydisp;s.ydisp=Math.max(Math.min(s.ydisp+e,s.ybase),0),n!==s.ydisp&&(t||this._onScroll.fire(s.ydisp))}};yb=Kt([ke(0,rn)],yb);var Xo={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:ef,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},mq=["normal","bold","100","200","300","400","500","600","700","800","900"],pq=class extends Je{constructor(e){super(),this._onOptionChange=this._register(new be),this.onOptionChange=this._onOptionChange.event;let t={...Xo};for(let s in e)if(s in t)try{let n=e[s];t[s]=this._sanitizeAndValidateOption(s,n)}catch(n){console.error(n)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(It(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(s=>{s===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(s=>{e.indexOf(s)!==-1&&t()})}_setupOptions(){let e=s=>{if(!(s in Xo))throw new Error(`No option with key "${s}"`);return this.rawOptions[s]},t=(s,n)=>{if(!(s in Xo))throw new Error(`No option with key "${s}"`);n=this._sanitizeAndValidateOption(s,n),this.rawOptions[s]!==n&&(this.rawOptions[s]=n,this._onOptionChange.fire(s))};for(let s in this.rawOptions){let n={get:e.bind(this,s),set:t.bind(this,s)};Object.defineProperty(this.options,s,n)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=Xo[e]),!gq(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Xo[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=mq.includes(t)?t:Xo[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function gq(e){return e==="block"||e==="underline"||e==="bar"}function Pc(e,t=5){if(typeof e!="object")return e;let s=Array.isArray(e)?[]:{};for(let n in e)s[n]=t<=1?e[n]:e[n]&&Pc(e[n],t-1);return s}var P2=Object.freeze({insertMode:!1}),$2=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Sb=class extends Je{constructor(e,t,s){super(),this._bufferService=e,this._logService=t,this._optionsService=s,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new be),this.onData=this._onData.event,this._onUserInput=this._register(new be),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new be),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new be),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Pc(P2),this.decPrivateModes=Pc($2)}reset(){this.modes=Pc(P2),this.decPrivateModes=Pc($2)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let s=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&s.ybase!==s.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(n=>n.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};Sb=Kt([ke(0,nn),ke(1,Y3),ke(2,rn)],Sb);var H2={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 vg(e,t){let s=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(s|=64,s|=e.action):(s|=e.button&3,e.button&4&&(s|=64),e.button&8&&(s|=128),e.action===32?s|=32:e.action===0&&!t&&(s|=3)),s}var _g=String.fromCharCode,U2={DEFAULT:e=>{let t=[vg(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${_g(t[0])}${_g(t[1])}${_g(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${vg(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${vg(e,!0)};${e.x};${e.y}${t}`}},wb=class extends Je{constructor(e,t,s){super(),this._bufferService=e,this._coreService=t,this._optionsService=s,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new be),this.onProtocolChange=this._onProtocolChange.event;for(let n of Object.keys(H2))this.addProtocol(n,H2[n]);for(let n of Object.keys(U2))this.addEncoding(n,U2[n]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,s){if(e.deltaY===0||e.shiftKey||t===void 0||s===void 0)return 0;let n=t/s,o=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(o/=n+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,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,s){if(s){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};wb=Kt([ke(0,nn),ke(1,ao),ke(2,rn)],wb);var yg=[[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]],bq=[[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]],bs;function xq(e,t){let s=0,n=t.length-1,o;if(e<t[0][0]||e>t[n][1])return!1;for(;n>=s;)if(o=s+n>>1,e>t[o][1])s=o+1;else if(e<t[o][0])n=o-1;else return!0;return!1}var vq=class{constructor(){if(this.version="6",!bs){bs=new Uint8Array(65536),bs.fill(1),bs[0]=0,bs.fill(0,1,32),bs.fill(0,127,160),bs.fill(2,4352,4448),bs[9001]=2,bs[9002]=2,bs.fill(2,11904,42192),bs[12351]=1,bs.fill(2,44032,55204),bs.fill(2,63744,64256),bs.fill(2,65040,65050),bs.fill(2,65072,65136),bs.fill(2,65280,65377),bs.fill(2,65504,65511);for(let e=0;e<yg.length;++e)bs.fill(0,yg[e][0],yg[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?bs[e]:xq(e,bq)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let s=this.wcwidth(e),n=s===0&&t!==0;if(n){let o=Wa.extractWidth(t);o===0?n=!1:o>s&&(s=o)}return Wa.createPropertyValue(0,s,n)}},Wa=class jh{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new be,this.onChange=this._onChange.event;let t=new vq;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,s,n=!1){return(t&16777215)<<3|(s&3)<<1|(n?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let s=0,n=0,o=t.length;for(let l=0;l<o;++l){let u=t.charCodeAt(l);if(55296<=u&&u<=56319){if(++l>=o)return s+this.wcwidth(u);let d=t.charCodeAt(l);56320<=d&&d<=57343?u=(u-55296)*1024+d-56320+65536:s+=this.wcwidth(d)}let h=this.charProperties(u,n),m=jh.extractWidth(h);jh.extractShouldJoin(h)&&(m-=jh.extractWidth(n)),s+=m,n=h}return s}charProperties(t,s){return this._activeProvider.charProperties(t,s)}},_q=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function F2(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),s=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);s&&t&&(s.isWrapped=t[3]!==0&&t[3]!==32)}var Cc=2147483647,yq=256,A5=class kb{constructor(t=32,s=32){if(this.maxLength=t,this.maxSubParamsLength=s,s>yq)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(s),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let s=new kb;if(!t.length)return s;for(let n=Array.isArray(t[0])?1:0;n<t.length;++n){let o=t[n];if(Array.isArray(o))for(let l=0;l<o.length;++l)s.addSubParam(o[l]);else s.addParam(o)}return s}clone(){let t=new kb(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let s=0;s<this.length;++s){t.push(this.params[s]);let n=this._subParamsIdx[s]>>8,o=this._subParamsIdx[s]&255;o-n>0&&t.push(Array.prototype.slice.call(this._subParams,n,o))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>Cc?Cc:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>Cc?Cc:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let s=this._subParamsIdx[t]>>8,n=this._subParamsIdx[t]&255;return n-s>0?this._subParams.subarray(s,n):null}getSubParamsAll(){let t={};for(let s=0;s<this.length;++s){let n=this._subParamsIdx[s]>>8,o=this._subParamsIdx[s]&255;o-n>0&&(t[s]=this._subParams.slice(n,o))}return t}addDigit(t){let s;if(this._rejectDigits||!(s=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,o=n[s-1];n[s-1]=~o?Math.min(o*10+t,Cc):t}},Ec=[],Sq=class{constructor(){this._state=0,this._active=Ec,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let s=this._handlers[e];return s.push(t),{dispose:()=>{let n=s.indexOf(t);n!==-1&&s.splice(n,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=Ec}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=Ec,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Ec,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,s){if(!this._active.length)this._handlerFb(this._id,"PUT",Nf(e,t,s));else for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,s)}start(){this.reset(),this._state=1}put(e,t,s){if(this._state!==3){if(this._state===1)for(;t<s;){let n=e[t++];if(n===59){this._state=2,this._start();break}if(n<48||57<n){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+n-48}this._state===2&&s-t>0&&this._put(e,t,s)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let s=!1,n=this._active.length-1,o=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,s=t,o=this._stack.fallThrough,this._stack.paused=!1),!o&&s===!1){for(;n>=0&&(s=this._active[n].end(e),s!==!0);n--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,s;n--}for(;n>=0;n--)if(s=this._active[n].end(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,s}this._active=Ec,this._id=-1,this._state=0}}},Tn=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,s){this._hitLimit||(this._data+=Nf(e,t,s),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(s=>(this._data="",this._hitLimit=!1,s));return this._data="",this._hitLimit=!1,t}},jc=[],wq=class{constructor(){this._handlers=Object.create(null),this._active=jc,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=jc}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let s=this._handlers[e];return s.push(t),{dispose:()=>{let n=s.indexOf(t);n!==-1&&s.splice(n,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=jc,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||jc,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let s=this._active.length-1;s>=0;s--)this._active[s].hook(t)}put(e,t,s){if(!this._active.length)this._handlerFb(this._ident,"PUT",Nf(e,t,s));else for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,s)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let s=!1,n=this._active.length-1,o=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,s=t,o=this._stack.fallThrough,this._stack.paused=!1),!o&&s===!1){for(;n>=0&&(s=this._active[n].unhook(e),s!==!0);n--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,s;n--}for(;n>=0;n--)if(s=this._active[n].unhook(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,s}this._active=jc,this._ident=0}},$c=new A5;$c.addParam(0);var q2=class{constructor(e){this._handler=e,this._data="",this._params=$c,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():$c,this._data="",this._hitLimit=!1}put(e,t,s){this._hitLimit||(this._data+=Nf(e,t,s),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(s=>(this._params=$c,this._data="",this._hitLimit=!1,s));return this._params=$c,this._data="",this._hitLimit=!1,t}},kq=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,s,n){this.table[t<<8|e]=s<<4|n}addMany(e,t,s,n){for(let o=0;o<e.length;o++)this.table[t<<8|e[o]]=s<<4|n}},Wn=160,Nq=(function(){let e=new kq(4095),t=Array.apply(null,Array(256)).map((h,m)=>m),s=(h,m)=>t.slice(h,m),n=s(32,127),o=s(0,24);o.push(25),o.push.apply(o,s(28,32));let l=s(0,14),u;e.setDefault(1,0),e.addMany(n,0,2,0);for(u in l)e.addMany([24,26,153,154],u,3,0),e.addMany(s(128,144),u,3,0),e.addMany(s(144,152),u,3,0),e.add(156,u,0,0),e.add(27,u,11,1),e.add(157,u,4,8),e.addMany([152,158,159],u,0,7),e.add(155,u,11,3),e.add(144,u,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(n,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(s(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(n,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(s(64,127),3,7,0),e.addMany(s(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(s(48,60),4,8,4),e.addMany(s(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(s(32,64),6,0,6),e.add(127,6,0,6),e.addMany(s(64,127),6,0,0),e.addMany(s(32,48),3,9,5),e.addMany(s(32,48),5,9,5),e.addMany(s(48,64),5,0,6),e.addMany(s(64,127),5,7,0),e.addMany(s(32,48),4,9,5),e.addMany(s(32,48),1,9,2),e.addMany(s(32,48),2,9,2),e.addMany(s(48,127),2,10,0),e.addMany(s(48,80),1,10,0),e.addMany(s(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(s(96,127),1,10,0),e.add(80,1,11,9),e.addMany(o,9,0,9),e.add(127,9,0,9),e.addMany(s(28,32),9,0,9),e.addMany(s(32,48),9,9,12),e.addMany(s(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(o,11,0,11),e.addMany(s(32,128),11,0,11),e.addMany(s(28,32),11,0,11),e.addMany(o,10,0,10),e.add(127,10,0,10),e.addMany(s(28,32),10,0,10),e.addMany(s(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(s(32,48),10,9,12),e.addMany(o,12,0,12),e.add(127,12,0,12),e.addMany(s(28,32),12,0,12),e.addMany(s(32,48),12,9,12),e.addMany(s(48,64),12,0,11),e.addMany(s(64,127),12,12,13),e.addMany(s(64,127),10,12,13),e.addMany(s(64,127),9,12,13),e.addMany(o,13,13,13),e.addMany(n,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Wn,0,2,0),e.add(Wn,8,5,8),e.add(Wn,6,0,6),e.add(Wn,11,0,11),e.add(Wn,13,13,13),e})(),Cq=class extends Je{constructor(e=Nq){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 A5,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,s,n)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,s)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(It(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new Sq),this._dcsParser=this._register(new wq),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let s=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(s=e.prefix.charCodeAt(0),s&&60>s||s>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let o=0;o<e.intermediates.length;++o){let l=e.intermediates.charCodeAt(o);if(32>l||l>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");s<<=8,s|=l}}if(e.final.length!==1)throw new Error("final must be a single byte");let n=e.final.charCodeAt(0);if(t[0]>n||n>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return s<<=8,s|=n,s}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let s=this._identifier(e,[48,126]);this._escHandlers[s]===void 0&&(this._escHandlers[s]=[]);let n=this._escHandlers[s];return n.push(t),{dispose:()=>{let o=n.indexOf(t);o!==-1&&n.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,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let s=this._identifier(e);this._csiHandlers[s]===void 0&&(this._csiHandlers[s]=[]);let n=this._csiHandlers[s];return n.push(t),{dispose:()=>{let o=n.indexOf(t);o!==-1&&n.splice(o,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,s,n,o){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=s,this._parseStack.transition=n,this._parseStack.chunkPos=o}parse(e,t,s){let n=0,o=0,l=0,u;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,l=this._parseStack.chunkPos+1;else{if(s===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let h=this._parseStack.handlers,m=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(s===!1&&m>-1){for(;m>=0&&(u=h[m](this._params),u!==!0);m--)if(u instanceof Promise)return this._parseStack.handlerPos=m,u}this._parseStack.handlers=[];break;case 4:if(s===!1&&m>-1){for(;m>=0&&(u=h[m](),u!==!0);m--)if(u instanceof Promise)return this._parseStack.handlerPos=m,u}this._parseStack.handlers=[];break;case 6:if(n=e[this._parseStack.chunkPos],u=this._dcsParser.unhook(n!==24&&n!==26,s),u)return u;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(n=e[this._parseStack.chunkPos],u=this._oscParser.end(n!==24&&n!==26,s),u)return u;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,l=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let h=l;h<t;++h){switch(n=e[h],o=this._transitions.table[this.currentState<<8|(n<160?n:Wn)],o>>4){case 2:for(let x=h+1;;++x){if(x>=t||(n=e[x])<32||n>126&&n<Wn){this._printHandler(e,h,x),h=x-1;break}if(++x>=t||(n=e[x])<32||n>126&&n<Wn){this._printHandler(e,h,x),h=x-1;break}if(++x>=t||(n=e[x])<32||n>126&&n<Wn){this._printHandler(e,h,x),h=x-1;break}if(++x>=t||(n=e[x])<32||n>126&&n<Wn){this._printHandler(e,h,x),h=x-1;break}}break;case 3:this._executeHandlers[n]?this._executeHandlers[n]():this._executeHandlerFb(n),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:h,code:n,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let m=this._csiHandlers[this._collect<<8|n],d=m?m.length-1:-1;for(;d>=0&&(u=m[d](this._params),u!==!0);d--)if(u instanceof Promise)return this._preserveStack(3,m,d,o,h),u;d<0&&this._csiHandlerFb(this._collect<<8|n,this._params),this.precedingJoinState=0;break;case 8:do switch(n){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(n-48)}while(++h<t&&(n=e[h])>47&&n<60);h--;break;case 9:this._collect<<=8,this._collect|=n;break;case 10:let p=this._escHandlers[this._collect<<8|n],g=p?p.length-1:-1;for(;g>=0&&(u=p[g](),u!==!0);g--)if(u instanceof Promise)return this._preserveStack(4,p,g,o,h),u;g<0&&this._escHandlerFb(this._collect<<8|n),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|n,this._params);break;case 13:for(let x=h+1;;++x)if(x>=t||(n=e[x])===24||n===26||n===27||n>127&&n<Wn){this._dcsParser.put(e,h,x),h=x-1;break}break;case 14:if(u=this._dcsParser.unhook(n!==24&&n!==26),u)return this._preserveStack(6,[],0,o,h),u;n===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 x=h+1;;x++)if(x>=t||(n=e[x])<32||n>127&&n<Wn){this._oscParser.put(e,h,x),h=x-1;break}break;case 6:if(u=this._oscParser.end(n!==24&&n!==26),u)return this._preserveStack(5,[],0,o,h),u;n===27&&(o|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=o&15}}},Eq=/^([\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})$/,jq=/^[\da-f]+$/;function V2(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let s=Eq.exec(t);if(s){let n=s[1]?15:s[4]?255:s[7]?4095:65535;return[Math.round(parseInt(s[1]||s[4]||s[7]||s[10],16)/n*255),Math.round(parseInt(s[2]||s[5]||s[8]||s[11],16)/n*255),Math.round(parseInt(s[3]||s[6]||s[9]||s[12],16)/n*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),jq.exec(t)&&[3,6,9,12].includes(t.length))){let s=t.length/3,n=[0,0,0];for(let o=0;o<3;++o){let l=parseInt(t.slice(s*o,s*o+s),16);n[o]=s===1?l<<4:s===2?l:s===3?l>>4:l>>8}return n}}function Sg(e,t){let s=e.toString(16),n=s.length<2?"0"+s:s;switch(t){case 4:return s[0];case 8:return n;case 12:return(n+n).slice(0,3);default:return n+n}}function Tq(e,t=16){let[s,n,o]=e;return`rgb:${Sg(s,t)}/${Sg(n,t)}/${Sg(o,t)}`}var Aq={"(":0,")":1,"*":2,"+":3,"-":1,".":2},ia=131072,G2=10;function W2(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var K2=5e3,Y2=0,Rq=class extends Je{constructor(e,t,s,n,o,l,u,h,m=new Cq){super(),this._bufferService=e,this._charsetService=t,this._coreService=s,this._logService=n,this._optionsService=o,this._oscLinkService=l,this._coreMouseService=u,this._unicodeService=h,this._parser=m,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new XH,this._utf8Decoder=new ZH,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=os.clone(),this._eraseAttrDataInternal=os.clone(),this._onRequestBell=this._register(new be),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new be),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new be),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new be),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new be),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new be),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new be),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new be),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new be),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new be),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new be),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new be),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new be),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new Nb(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(d=>this._activeBuffer=d.activeBuffer)),this._parser.setCsiHandlerFallback((d,p)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(d),params:p.toArray()})}),this._parser.setEscHandlerFallback(d=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(d)})}),this._parser.setExecuteHandlerFallback(d=>{this._logService.debug("Unknown EXECUTE code: ",{code:d})}),this._parser.setOscHandlerFallback((d,p,g)=>{this._logService.debug("Unknown OSC code: ",{identifier:d,action:p,data:g})}),this._parser.setDcsHandlerFallback((d,p,g)=>{p==="HOOK"&&(g=g.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(d),action:p,payload:g})}),this._parser.setPrintHandler((d,p,g)=>this.print(d,p,g)),this._parser.registerCsiHandler({final:"@"},d=>this.insertChars(d)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},d=>this.scrollLeft(d)),this._parser.registerCsiHandler({final:"A"},d=>this.cursorUp(d)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},d=>this.scrollRight(d)),this._parser.registerCsiHandler({final:"B"},d=>this.cursorDown(d)),this._parser.registerCsiHandler({final:"C"},d=>this.cursorForward(d)),this._parser.registerCsiHandler({final:"D"},d=>this.cursorBackward(d)),this._parser.registerCsiHandler({final:"E"},d=>this.cursorNextLine(d)),this._parser.registerCsiHandler({final:"F"},d=>this.cursorPrecedingLine(d)),this._parser.registerCsiHandler({final:"G"},d=>this.cursorCharAbsolute(d)),this._parser.registerCsiHandler({final:"H"},d=>this.cursorPosition(d)),this._parser.registerCsiHandler({final:"I"},d=>this.cursorForwardTab(d)),this._parser.registerCsiHandler({final:"J"},d=>this.eraseInDisplay(d,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},d=>this.eraseInDisplay(d,!0)),this._parser.registerCsiHandler({final:"K"},d=>this.eraseInLine(d,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},d=>this.eraseInLine(d,!0)),this._parser.registerCsiHandler({final:"L"},d=>this.insertLines(d)),this._parser.registerCsiHandler({final:"M"},d=>this.deleteLines(d)),this._parser.registerCsiHandler({final:"P"},d=>this.deleteChars(d)),this._parser.registerCsiHandler({final:"S"},d=>this.scrollUp(d)),this._parser.registerCsiHandler({final:"T"},d=>this.scrollDown(d)),this._parser.registerCsiHandler({final:"X"},d=>this.eraseChars(d)),this._parser.registerCsiHandler({final:"Z"},d=>this.cursorBackwardTab(d)),this._parser.registerCsiHandler({final:"`"},d=>this.charPosAbsolute(d)),this._parser.registerCsiHandler({final:"a"},d=>this.hPositionRelative(d)),this._parser.registerCsiHandler({final:"b"},d=>this.repeatPrecedingCharacter(d)),this._parser.registerCsiHandler({final:"c"},d=>this.sendDeviceAttributesPrimary(d)),this._parser.registerCsiHandler({prefix:">",final:"c"},d=>this.sendDeviceAttributesSecondary(d)),this._parser.registerCsiHandler({final:"d"},d=>this.linePosAbsolute(d)),this._parser.registerCsiHandler({final:"e"},d=>this.vPositionRelative(d)),this._parser.registerCsiHandler({final:"f"},d=>this.hVPosition(d)),this._parser.registerCsiHandler({final:"g"},d=>this.tabClear(d)),this._parser.registerCsiHandler({final:"h"},d=>this.setMode(d)),this._parser.registerCsiHandler({prefix:"?",final:"h"},d=>this.setModePrivate(d)),this._parser.registerCsiHandler({final:"l"},d=>this.resetMode(d)),this._parser.registerCsiHandler({prefix:"?",final:"l"},d=>this.resetModePrivate(d)),this._parser.registerCsiHandler({final:"m"},d=>this.charAttributes(d)),this._parser.registerCsiHandler({final:"n"},d=>this.deviceStatus(d)),this._parser.registerCsiHandler({prefix:"?",final:"n"},d=>this.deviceStatusPrivate(d)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},d=>this.softReset(d)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},d=>this.setCursorStyle(d)),this._parser.registerCsiHandler({final:"r"},d=>this.setScrollRegion(d)),this._parser.registerCsiHandler({final:"s"},d=>this.saveCursor(d)),this._parser.registerCsiHandler({final:"t"},d=>this.windowOptions(d)),this._parser.registerCsiHandler({final:"u"},d=>this.restoreCursor(d)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},d=>this.insertColumns(d)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},d=>this.deleteColumns(d)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},d=>this.selectProtected(d)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},d=>this.requestMode(d,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},d=>this.requestMode(d,!1)),this._parser.setExecuteHandler(de.BEL,()=>this.bell()),this._parser.setExecuteHandler(de.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(de.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(de.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(de.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(de.BS,()=>this.backspace()),this._parser.setExecuteHandler(de.HT,()=>this.tab()),this._parser.setExecuteHandler(de.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(de.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Ch.IND,()=>this.index()),this._parser.setExecuteHandler(Ch.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Ch.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Tn(d=>(this.setTitle(d),this.setIconName(d),!0))),this._parser.registerOscHandler(1,new Tn(d=>this.setIconName(d))),this._parser.registerOscHandler(2,new Tn(d=>this.setTitle(d))),this._parser.registerOscHandler(4,new Tn(d=>this.setOrReportIndexedColor(d))),this._parser.registerOscHandler(8,new Tn(d=>this.setHyperlink(d))),this._parser.registerOscHandler(10,new Tn(d=>this.setOrReportFgColor(d))),this._parser.registerOscHandler(11,new Tn(d=>this.setOrReportBgColor(d))),this._parser.registerOscHandler(12,new Tn(d=>this.setOrReportCursorColor(d))),this._parser.registerOscHandler(104,new Tn(d=>this.restoreIndexedColor(d))),this._parser.registerOscHandler(110,new Tn(d=>this.restoreFgColor(d))),this._parser.registerOscHandler(111,new Tn(d=>this.restoreBgColor(d))),this._parser.registerOscHandler(112,new Tn(d=>this.restoreCursorColor(d))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let d in _s)this._parser.registerEscHandler({intermediates:"(",final:d},()=>this.selectCharset("("+d)),this._parser.registerEscHandler({intermediates:")",final:d},()=>this.selectCharset(")"+d)),this._parser.registerEscHandler({intermediates:"*",final:d},()=>this.selectCharset("*"+d)),this._parser.registerEscHandler({intermediates:"+",final:d},()=>this.selectCharset("+"+d)),this._parser.registerEscHandler({intermediates:"-",final:d},()=>this.selectCharset("-"+d)),this._parser.registerEscHandler({intermediates:".",final:d},()=>this.selectCharset("."+d)),this._parser.registerEscHandler({intermediates:"/",final:d},()=>this.selectCharset("/"+d));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(d=>(this._logService.error("Parsing error: ",d),d)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new q2((d,p)=>this.requestStatusString(d,p)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,s,n){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=s,this._parseStack.position=n}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,s)=>setTimeout(()=>s("#SLOW_TIMEOUT"),K2))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${K2} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let s,n=this._activeBuffer.x,o=this._activeBuffer.y,l=0,u=this._parseStack.paused;if(u){if(s=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(s),s;n=this._parseStack.cursorStartX,o=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>ia&&(l=this._parseStack.position+ia)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,d=>String.fromCharCode(d)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(d=>d.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<ia&&(this._parseBuffer=new Uint32Array(Math.min(e.length,ia))),u||this._dirtyRowTracker.clearRange(),e.length>ia)for(let d=l;d<e.length;d+=ia){let p=d+ia<e.length?d+ia:e.length,g=typeof e=="string"?this._stringDecoder.decode(e.substring(d,p),this._parseBuffer):this._utf8Decoder.decode(e.subarray(d,p),this._parseBuffer);if(s=this._parser.parse(this._parseBuffer,g))return this._preserveStack(n,o,g,d),this._logSlowResolvingAsync(s),s}else if(!u){let d=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(s=this._parser.parse(this._parseBuffer,d))return this._preserveStack(n,o,d,0),this._logSlowResolvingAsync(s),s}(this._activeBuffer.x!==n||this._activeBuffer.y!==o)&&this._onCursorMove.fire();let h=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),m=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);m<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(m,this._bufferService.rows-1),end:Math.min(h,this._bufferService.rows-1)})}print(e,t,s){let n,o,l=this._charsetService.charset,u=this._optionsService.rawOptions.screenReaderMode,h=this._bufferService.cols,m=this._coreService.decPrivateModes.wraparound,d=this._coreService.modes.insertMode,p=this._curAttrData,g=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&s-t>0&&g.getWidth(this._activeBuffer.x-1)===2&&g.setCellFromCodepoint(this._activeBuffer.x-1,0,1,p);let x=this._parser.precedingJoinState;for(let _=t;_<s;++_){if(n=e[_],n<127&&l){let C=l[String.fromCharCode(n)];C&&(n=C.charCodeAt(0))}let S=this._unicodeService.charProperties(n,x);o=Wa.extractWidth(S);let w=Wa.extractShouldJoin(S),k=w?Wa.extractWidth(x):0;if(x=S,u&&this._onA11yChar.fire(aa(n)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+o-k>h){if(m){let C=g,T=this._activeBuffer.x-k;for(this._activeBuffer.x=k,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),g=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),k>0&&g instanceof Ic&&g.copyCellsFrom(C,T,0,k,!1);T<h;)C.setCellFromCodepoint(T++,0,1,p)}else if(this._activeBuffer.x=h-1,o===2)continue}if(w&&this._activeBuffer.x){let C=g.getWidth(this._activeBuffer.x-1)?1:2;g.addCodepointToCell(this._activeBuffer.x-C,n,o);for(let T=o-k;--T>=0;)g.setCellFromCodepoint(this._activeBuffer.x++,0,0,p);continue}if(d&&(g.insertCells(this._activeBuffer.x,o-k,this._activeBuffer.getNullCell(p)),g.getWidth(h-1)===2&&g.setCellFromCodepoint(h-1,0,1,p)),g.setCellFromCodepoint(this._activeBuffer.x++,n,o,p),o>0)for(;--o;)g.setCellFromCodepoint(this._activeBuffer.x++,0,0,p)}this._parser.precedingJoinState=x,this._activeBuffer.x<h&&s-t>0&&g.getWidth(this._activeBuffer.x)===0&&!g.hasContent(this._activeBuffer.x)&&g.setCellFromCodepoint(this._activeBuffer.x,0,1,p),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,s=>W2(s.params[0],this._optionsService.rawOptions.windowOptions)?t(s):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new q2(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Tn(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,s,n=!1,o=!1){let l=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);l.replaceCells(t,s,this._activeBuffer.getNullCell(this._eraseAttrData()),o),n&&(l.isWrapped=!1)}_resetBufferLine(e,t=!1){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s&&(s.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),s.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let s;switch(e.params[0]){case 0:for(s=this._activeBuffer.y,this._dirtyRowTracker.markDirty(s),this._eraseInBufferLine(s++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);s<this._bufferService.rows;s++)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(s);break;case 1:for(s=this._activeBuffer.y,this._dirtyRowTracker.markDirty(s),this._eraseInBufferLine(s,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(s+1).isWrapped=!1);s--;)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(s=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,s-1);s--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+s)?.getTrimmedLength(););for(;s>=0;s--)this._bufferService.scroll(this._eraseAttrData())}else{for(s=this._bufferService.rows,this._dirtyRowTracker.markDirty(s-1);s--;)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let n=this._activeBuffer.lines.length-this._bufferService.rows;n>0&&(this._activeBuffer.lines.trimStart(n),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-n,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-n,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let s=this._activeBuffer.ybase+this._activeBuffer.y,n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,o=this._bufferService.rows-1+this._activeBuffer.ybase-n+1;for(;t--;)this._activeBuffer.lines.splice(o-1,1),this._activeBuffer.lines.splice(s,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let s=this._activeBuffer.ybase+this._activeBuffer.y,n;for(n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,n=this._bufferService.rows-1+this._activeBuffer.ybase-n;t--;)this._activeBuffer.lines.splice(s,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}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(os));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);n.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);n.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);n.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);n.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let s=e.params[0]||1,n=Wa.extractWidth(t),o=this._activeBuffer.x-n,l=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(o),u=new Uint32Array(l.length*s),h=0;for(let d=0;d<l.length;){let p=l.codePointAt(d)||0;u[h++]=p,d+=p>65535?2:1}let m=h;for(let d=1;d<s;++d)u.copyWithin(m,0,h),m+=h;return this.print(u,0,m),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(de.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(de.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(de.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(de.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(de.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,Fa),this._charsetService.setgCharset(1,Fa),this._charsetService.setgCharset(2,Fa),this._charsetService.setgCharset(3,Fa);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){let s;(w=>(w[w.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",w[w.SET=1]="SET",w[w.RESET=2]="RESET",w[w.PERMANENTLY_SET=3]="PERMANENTLY_SET",w[w.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(s||={});let n=this._coreService.decPrivateModes,{activeProtocol:o,activeEncoding:l}=this._coreMouseService,u=this._coreService,{buffers:h,cols:m}=this._bufferService,{active:d,alt:p}=h,g=this._optionsService.rawOptions,x=(w,k)=>(u.triggerDataEvent(`${de.ESC}[${t?"":"?"}${w};${k}$y`),!0),_=w=>w?1:2,S=e.params[0];return t?S===2?x(S,4):S===4?x(S,_(u.modes.insertMode)):S===12?x(S,3):S===20?x(S,_(g.convertEol)):x(S,0):S===1?x(S,_(n.applicationCursorKeys)):S===3?x(S,g.windowOptions.setWinLines?m===80?2:m===132?1:0:0):S===6?x(S,_(n.origin)):S===7?x(S,_(n.wraparound)):S===8?x(S,3):S===9?x(S,_(o==="X10")):S===12?x(S,_(g.cursorBlink)):S===25?x(S,_(!u.isCursorHidden)):S===45?x(S,_(n.reverseWraparound)):S===66?x(S,_(n.applicationKeypad)):S===67?x(S,4):S===1e3?x(S,_(o==="VT200")):S===1002?x(S,_(o==="DRAG")):S===1003?x(S,_(o==="ANY")):S===1004?x(S,_(n.sendFocus)):S===1005?x(S,4):S===1006?x(S,_(l==="SGR")):S===1015?x(S,4):S===1016?x(S,_(l==="SGR_PIXELS")):S===1048?x(S,1):S===47||S===1047||S===1049?x(S,_(d===p)):S===2004?x(S,_(n.bracketedPasteMode)):S===2026?x(S,_(n.synchronizedOutput)):x(S,0)}_updateAttrColor(e,t,s,n,o){return t===2?(e|=50331648,e&=-16777216,e|=ku.fromColorRGB([s,n,o])):t===5&&(e&=-50331904,e|=33554432|s&255),e}_extractColor(e,t,s){let n=[0,0,-1,0,0,0],o=0,l=0;do{if(n[l+o]=e.params[t+l],e.hasSubParams(t+l)){let u=e.getSubParams(t+l),h=0;do n[1]===5&&(o=1),n[l+h+1+o]=u[h];while(++h<u.length&&h+l+1+o<n.length);break}if(n[1]===5&&l+o>=2||n[1]===2&&l+o>=5)break;n[1]&&(o=1)}while(++l+t<e.length&&l+o<n.length);for(let u=2;u<n.length;++u)n[u]===-1&&(n[u]=0);switch(n[0]){case 38:s.fg=this._updateAttrColor(s.fg,n[1],n[3],n[4],n[5]);break;case 48:s.bg=this._updateAttrColor(s.bg,n[1],n[3],n[4],n[5]);break;case 58:s.extended=s.extended.clone(),s.extended.underlineColor=this._updateAttrColor(s.extended.underlineColor,n[1],n[3],n[4],n[5])}return l}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=os.fg,e.bg=os.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,s,n=this._curAttrData;for(let o=0;o<t;o++)s=e.params[o],s>=30&&s<=37?(n.fg&=-50331904,n.fg|=16777216|s-30):s>=40&&s<=47?(n.bg&=-50331904,n.bg|=16777216|s-40):s>=90&&s<=97?(n.fg&=-50331904,n.fg|=16777216|s-90|8):s>=100&&s<=107?(n.bg&=-50331904,n.bg|=16777216|s-100|8):s===0?this._processSGR0(n):s===1?n.fg|=134217728:s===3?n.bg|=67108864:s===4?(n.fg|=268435456,this._processUnderline(e.hasSubParams(o)?e.getSubParams(o)[0]:1,n)):s===5?n.fg|=536870912:s===7?n.fg|=67108864:s===8?n.fg|=1073741824:s===9?n.fg|=2147483648:s===2?n.bg|=134217728:s===21?this._processUnderline(2,n):s===22?(n.fg&=-134217729,n.bg&=-134217729):s===23?n.bg&=-67108865:s===24?(n.fg&=-268435457,this._processUnderline(0,n)):s===25?n.fg&=-536870913:s===27?n.fg&=-67108865:s===28?n.fg&=-1073741825:s===29?n.fg&=2147483647:s===39?(n.fg&=-67108864,n.fg|=os.fg&16777215):s===49?(n.bg&=-67108864,n.bg|=os.bg&16777215):s===38||s===48||s===58?o+=this._extractColor(e,o,n):s===53?n.bg|=1073741824:s===55?n.bg&=-1073741825:s===59?(n.extended=n.extended.clone(),n.extended.underlineColor=-1,n.updateExtended()):s===100?(n.fg&=-67108864,n.fg|=os.fg&16777215,n.bg&=-67108864,n.bg|=os.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",s);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${de.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,s=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${de.ESC}[${t};${s}R`);break}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let t=this._activeBuffer.y+1,s=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${de.ESC}[?${t};${s}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=os.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let s=t%2===1;this._coreService.decPrivateModes.cursorBlink=s}return!0}setScrollRegion(e){let t=e.params[0]||1,s;return(e.length<2||(s=e.params[1])>this._bufferService.rows||s===0)&&(s=this._bufferService.rows),s>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=s-1,this._setCursor(0,0)),!0}windowOptions(e){if(!W2(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${de.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>G2&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>G2&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],s=e.split(";");for(;s.length>1;){let n=s.shift(),o=s.shift();if(/^\d+$/.exec(n)){let l=parseInt(n);if(X2(l))if(o==="?")t.push({type:0,index:l});else{let u=V2(o);u&&t.push({type:1,index:l,color:u})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let s=e.slice(0,t).trim(),n=e.slice(t+1);return n?this._createHyperlink(s,n):s.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let s=e.split(":"),n,o=s.findIndex(l=>l.startsWith("id="));return o!==-1&&(n=s[o].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:n,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let s=e.split(";");for(let n=0;n<s.length&&!(t>=this._specialColors.length);++n,++t)if(s[n]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let o=V2(s[n]);o&&this._onColor.fire([{type:1,index:this._specialColors[t],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 t=[],s=e.split(";");for(let n=0;n<s.length;++n)if(/^\d+$/.exec(s[n])){let o=parseInt(s[n]);X2(o)&&t.push({type:2,index:o})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,Fa),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(Aq[e[0]],_s[e[1]]||Fa),!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=os.clone(),this._eraseAttrDataInternal=os.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 Xn;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let s=this._activeBuffer.ybase+this._activeBuffer.y+t,n=this._activeBuffer.lines.get(s);n&&(n.fill(e),n.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let s=u=>(this._coreService.triggerDataEvent(`${de.ESC}${u}${de.ESC}\\`),!0),n=this._bufferService.buffer,o=this._optionsService.rawOptions;return s(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${n.scrollTop+1};${n.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,t){this._dirtyRowTracker.markRangeDirty(e,t)}},Nb=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(Y2=e,e=t,t=Y2),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Nb=Kt([ke(0,nn)],Nb);function X2(e){return 0<=e&&e<256}var Mq=5e7,Z2=12,Dq=50,Oq=class extends Je{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new be),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let s;for(;s=this._writeBuffer.shift();){this._action(s);let n=this._callbacks.shift();n&&n()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>Mq)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let s=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let n=this._writeBuffer[this._bufferOffset],o=this._action(n,t);if(o){let u=h=>performance.now()-s>=Z2?setTimeout(()=>this._innerWrite(0,h)):this._innerWrite(s,h);o.catch(h=>(queueMicrotask(()=>{throw h}),Promise.resolve(!1))).then(u);return}let l=this._callbacks[this._bufferOffset];if(l&&l(),this._bufferOffset++,this._pendingData-=n.length,performance.now()-s>=Z2)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>Dq&&(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()}},Cb=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let h=t.addMarker(t.ybase+t.y),m={data:e,id:this._nextId++,lines:[h]};return h.onDispose(()=>this._removeMarkerFromLink(m,h)),this._dataByLinkId.set(m.id,m),m.id}let s=e,n=this._getEntryIdKey(s),o=this._entriesWithId.get(n);if(o)return this.addLineToLink(o.id,t.ybase+t.y),o.id;let l=t.addMarker(t.ybase+t.y),u={id:this._nextId++,key:this._getEntryIdKey(s),data:s,lines:[l]};return l.onDispose(()=>this._removeMarkerFromLink(u,l)),this._entriesWithId.set(u.key,u),this._dataByLinkId.set(u.id,u),u.id}addLineToLink(e,t){let s=this._dataByLinkId.get(e);if(s&&s.lines.every(n=>n.line!==t)){let n=this._bufferService.buffer.addMarker(t);s.lines.push(n),n.onDispose(()=>this._removeMarkerFromLink(s,n))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let s=e.lines.indexOf(t);s!==-1&&(e.lines.splice(s,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};Cb=Kt([ke(0,nn)],Cb);var Q2=!1,Lq=class extends Je{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new fl),this._onBinary=this._register(new be),this.onBinary=this._onBinary.event,this._onData=this._register(new be),this.onData=this._onData.event,this._onLineFeed=this._register(new be),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new be),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new be),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new be),this._instantiationService=new rq,this.optionsService=this._register(new pq(e)),this._instantiationService.setService(rn,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(yb)),this._instantiationService.setService(nn,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(_b)),this._instantiationService.setService(Y3,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Sb)),this._instantiationService.setService(ao,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(wb)),this._instantiationService.setService(K3,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Wa)),this._instantiationService.setService(tU,this.unicodeService),this._charsetService=this._instantiationService.createInstance(_q),this._instantiationService.setService(eU,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Cb),this._instantiationService.setService(X3,this._oscLinkService),this._inputHandler=this._register(new Rq(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Bs.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Bs.forward(this._bufferService.onResize,this._onResize)),this._register(Bs.forward(this.coreService.onData,this._onData)),this._register(Bs.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 Oq((t,s)=>this._inputHandler.parse(t,s))),this._register(Bs.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new be),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!Q2&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Q2=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,j5),t=Math.max(t,T5),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(F2.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(F2(this._bufferService),!1))),this._windowsWrappingHeuristics.value=It(()=>{for(let t of e)t.dispose()})}}},zq={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 Bq(e,t,s,n){let o={type:0,cancel:!1,key:void 0},l=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?o.key=de.ESC+"OA":o.key=de.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?o.key=de.ESC+"OD":o.key=de.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?o.key=de.ESC+"OC":o.key=de.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?o.key=de.ESC+"OB":o.key=de.ESC+"[B");break;case 8:o.key=e.ctrlKey?"\b":de.DEL,e.altKey&&(o.key=de.ESC+o.key);break;case 9:if(e.shiftKey){o.key=de.ESC+"[Z";break}o.key=de.HT,o.cancel=!0;break;case 13:o.key=e.altKey?de.ESC+de.CR:de.CR,o.cancel=!0;break;case 27:o.key=de.ESC,e.altKey&&(o.key=de.ESC+de.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;l?o.key=de.ESC+"[1;"+(l+1)+"D":t?o.key=de.ESC+"OD":o.key=de.ESC+"[D";break;case 39:if(e.metaKey)break;l?o.key=de.ESC+"[1;"+(l+1)+"C":t?o.key=de.ESC+"OC":o.key=de.ESC+"[C";break;case 38:if(e.metaKey)break;l?o.key=de.ESC+"[1;"+(l+1)+"A":t?o.key=de.ESC+"OA":o.key=de.ESC+"[A";break;case 40:if(e.metaKey)break;l?o.key=de.ESC+"[1;"+(l+1)+"B":t?o.key=de.ESC+"OB":o.key=de.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(o.key=de.ESC+"[2~");break;case 46:l?o.key=de.ESC+"[3;"+(l+1)+"~":o.key=de.ESC+"[3~";break;case 36:l?o.key=de.ESC+"[1;"+(l+1)+"H":t?o.key=de.ESC+"OH":o.key=de.ESC+"[H";break;case 35:l?o.key=de.ESC+"[1;"+(l+1)+"F":t?o.key=de.ESC+"OF":o.key=de.ESC+"[F";break;case 33:e.shiftKey?o.type=2:e.ctrlKey?o.key=de.ESC+"[5;"+(l+1)+"~":o.key=de.ESC+"[5~";break;case 34:e.shiftKey?o.type=3:e.ctrlKey?o.key=de.ESC+"[6;"+(l+1)+"~":o.key=de.ESC+"[6~";break;case 112:l?o.key=de.ESC+"[1;"+(l+1)+"P":o.key=de.ESC+"OP";break;case 113:l?o.key=de.ESC+"[1;"+(l+1)+"Q":o.key=de.ESC+"OQ";break;case 114:l?o.key=de.ESC+"[1;"+(l+1)+"R":o.key=de.ESC+"OR";break;case 115:l?o.key=de.ESC+"[1;"+(l+1)+"S":o.key=de.ESC+"OS";break;case 116:l?o.key=de.ESC+"[15;"+(l+1)+"~":o.key=de.ESC+"[15~";break;case 117:l?o.key=de.ESC+"[17;"+(l+1)+"~":o.key=de.ESC+"[17~";break;case 118:l?o.key=de.ESC+"[18;"+(l+1)+"~":o.key=de.ESC+"[18~";break;case 119:l?o.key=de.ESC+"[19;"+(l+1)+"~":o.key=de.ESC+"[19~";break;case 120:l?o.key=de.ESC+"[20;"+(l+1)+"~":o.key=de.ESC+"[20~";break;case 121:l?o.key=de.ESC+"[21;"+(l+1)+"~":o.key=de.ESC+"[21~";break;case 122:l?o.key=de.ESC+"[23;"+(l+1)+"~":o.key=de.ESC+"[23~";break;case 123:l?o.key=de.ESC+"[24;"+(l+1)+"~":o.key=de.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=de.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?o.key=de.DEL:e.keyCode===219?o.key=de.ESC:e.keyCode===220?o.key=de.FS:e.keyCode===221&&(o.key=de.GS);else if((!s||n)&&e.altKey&&!e.metaKey){let u=zq[e.keyCode]?.[e.shiftKey?1:0];if(u)o.key=de.ESC+u;else if(e.keyCode>=65&&e.keyCode<=90){let h=e.ctrlKey?e.keyCode-64:e.keyCode+32,m=String.fromCharCode(h);e.shiftKey&&(m=m.toUpperCase()),o.key=de.ESC+m}else if(e.keyCode===32)o.key=de.ESC+(e.ctrlKey?de.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let h=e.code.slice(3,4);e.shiftKey||(h=h.toLowerCase()),o.key=de.ESC+h,o.cancel=!0}}else s&&!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=de.US),e.key==="@"&&(o.key=de.NUL));break}return o}var es=0,Iq=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new tf,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new tf,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,l)=>this._getKey(o)-this._getKey(l)),t=0,s=0,n=new Array(this._array.length+this._insertedValues.length);for(let o=0;o<n.length;o++)s>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[s])?(n[o]=e[t],t++):n[o]=this._array[s++];this._array=n,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(es=this._search(t),es===-1)||this._getKey(this._array[es])!==t)return!1;do if(this._array[es]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(es),!0;while(++es<this._array.length&&this._getKey(this._array[es])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((o,l)=>o-l),t=0,s=new Array(this._array.length-e.length),n=0;for(let o=0;o<this._array.length;o++)e[t]===o?t++:s[n++]=this._array[o];this._array=s,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(es=this._search(e),!(es<0||es>=this._array.length)&&this._getKey(this._array[es])===e))do yield this._array[es];while(++es<this._array.length&&this._getKey(this._array[es])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(es=this._search(e),!(es<0||es>=this._array.length)&&this._getKey(this._array[es])===e))do t(this._array[es]);while(++es<this._array.length&&this._getKey(this._array[es])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,s=this._array.length-1;for(;s>=t;){let n=t+s>>1,o=this._getKey(this._array[n]);if(o>e)s=n-1;else if(o<e)t=n+1;else{for(;n>0&&this._getKey(this._array[n-1])===e;)n--;return n}}return t}},wg=0,J2=0,Pq=class extends Je{constructor(){super(),this._decorations=new Iq(e=>e?.marker.line),this._onDecorationRegistered=this._register(new be),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new be),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(It(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new $q(e);if(t){let s=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),s.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,s){let n=0,o=0;for(let l of this._decorations.getKeyIterator(t))n=l.options.x??0,o=n+(l.options.width??1),e>=n&&e<o&&(!s||(l.options.layer??"bottom")===s)&&(yield l)}forEachDecorationAtCell(e,t,s,n){this._decorations.forEachByKey(t,o=>{wg=o.options.x??0,J2=wg+(o.options.width??1),e>=wg&&e<J2&&(!s||(o.options.layer??"bottom")===s)&&n(o)})}},$q=class extends ca{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new be),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new be),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Ut.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Ut.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},Hq=1e3,Uq=class{constructor(e,t=Hq){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,s){this._rowCount=s,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let n=performance.now();if(n-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){let o=n-this._lastRefreshMs,l=this._debounceThresholdMS-o;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},l)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},ek=20,sf=class extends Je{constructor(e,t,s,n){super(),this._terminal=e,this._coreBrowserService=s,this._renderService=n,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 l=0;l<this._terminal.rows;l++)this._rowElements[l]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[l]);if(this._topBoundaryFocusListener=l=>this._handleBoundaryFocus(l,0),this._bottomBoundaryFocusListener=l=>this._handleBoundaryFocus(l,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=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 Uq(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(l=>this._handleResize(l.rows))),this._register(this._terminal.onRender(l=>this._refreshRows(l.start,l.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(l=>this._handleChar(l))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
168
+ `))),this._register(this._terminal.onA11yTab(l=>this._handleTab(l))),this._register(this._terminal.onKey(l=>this._handleKey(l.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Ve(o,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(It(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<ek+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
169
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===ek+1&&(this._liveRegion.textContent+=G0.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let s=this._terminal.buffer,n=s.lines.length.toString();for(let o=e;o<=t;o++){let l=s.lines.get(s.ydisp+o),u=[],h=l?.translateToString(!0,void 0,void 0,u)||"",m=(s.ydisp+o+1).toString(),d=this._rowElements[o];d&&(h.length===0?(d.textContent=" ",this._rowColumns.set(d,[0,1])):(d.textContent=h,this._rowColumns.set(d,u)),d.setAttribute("aria-posinset",m),d.setAttribute("aria-setsize",n),this._alignRowWidth(d))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let s=e.target,n=this._rowElements[t===0?1:this._rowElements.length-2],o=s.getAttribute("aria-posinset"),l=t===0?"1":`${this._terminal.buffer.lines.length}`;if(o===l||e.relatedTarget!==n)return;let u,h;if(t===0?(u=s,h=this._rowElements.pop(),this._rowContainer.removeChild(h)):(u=this._rowElements.shift(),h=s,this._rowContainer.removeChild(u)),u.removeEventListener("focus",this._topBoundaryFocusListener),h.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let m=this._createAccessibilityTreeNode();this._rowElements.unshift(m),this._rowContainer.insertAdjacentElement("afterbegin",m)}else{let m=this._createAccessibilityTreeNode();this._rowElements.push(m),this._rowContainer.appendChild(m)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},s={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(s.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===s.node&&t.offset>s.offset)&&([t,s]=[s,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let n=this._rowElements.slice(-1)[0];if(s.node.compareDocumentPosition(n)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(s={node:n,offset:n.textContent?.length??0}),!this._rowContainer.contains(s.node))return;let o=({node:h,offset:m})=>{let d=h instanceof Text?h.parentNode:h,p=parseInt(d?.getAttribute("aria-posinset"),10)-1;if(isNaN(p))return console.warn("row is invalid. Race condition?"),null;let g=this._rowColumns.get(d);if(!g)return console.warn("columns is null. Race condition?"),null;let x=m<g.length?g[m]:g.slice(-1)[0]+1;return x>=this._terminal.cols&&(++p,x=0),{row:p,column:x}},l=o(t),u=o(s);if(!(!l||!u)){if(l.row>u.row||l.row===u.row&&l.column>=u.column)throw new Error("invalid range");this._terminal.select(l.column,l.row,(u.row-l.row)*this._terminal.cols-l.column+u.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform="";let t=e.getBoundingClientRect().width,s=this._rowColumns.get(e)?.slice(-1)?.[0];if(!s)return;let n=s*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${n/t})`}};sf=Kt([ke(1,Hx),ke(2,Sr),ke(3,wr)],sf);var Eb=class extends Je{constructor(e,t,s,n,o){super(),this._element=e,this._mouseService=t,this._renderService=s,this._bufferService=n,this._linkProviderService=o,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new be),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new be),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(It(()=>{eo(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(Ve(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Ve(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Ve(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Ve(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let s=e.composedPath();for(let n=0;n<s.length;n++){let o=s[n];if(o.classList.contains("xterm"))break;if(o.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(n=>{n?.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let s=!1;for(let[n,o]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(n)&&(s=this._checkLinkProviderResult(n,e,s)):o.provideLinks(e.y,l=>{if(this._isMouseOut)return;let u=l?.map(h=>({link:h}));this._activeProviderReplies?.set(n,u),s=this._checkLinkProviderResult(n,e,s),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let s=new Set;for(let n=0;n<t.size;n++){let o=t.get(n);if(o)for(let l=0;l<o.length;l++){let u=o[l],h=u.link.range.start.y<e?0:u.link.range.start.x,m=u.link.range.end.y>e?this._bufferService.cols:u.link.range.end.x;for(let d=h;d<=m;d++){if(s.has(d)){o.splice(l--,1);break}s.add(d)}}}}_checkLinkProviderResult(e,t,s){if(!this._activeProviderReplies)return s;let n=this._activeProviderReplies.get(e),o=!1;for(let l=0;l<e;l++)(!this._activeProviderReplies.has(l)||this._activeProviderReplies.get(l))&&(o=!0);if(!o&&n){let l=n.find(u=>this._linkAtPosition(u.link,t));l&&(s=!0,this._handleNewLink(l))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!s)for(let l=0;l<this._activeProviderReplies.size;l++){let u=this._activeProviderReplies.get(l)?.find(h=>this._linkAtPosition(h.link,t));if(u){s=!0,this._handleNewLink(u);break}}return s}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&Fq(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,eo(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:s=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==s&&(this._currentLink.state.decorations.pointerCursor=s,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",s))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:s=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==s&&(this._currentLink.state.decorations.underline=s,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,s))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(s=>{if(!this._currentLink)return;let n=s.start===0?0:s.start+1+this._bufferService.buffer.ydisp,o=this._bufferService.buffer.ydisp+1+s.end;if(this._currentLink.link.range.start.y>=n&&this._currentLink.link.range.end.y<=o&&(this._clearCurrentLink(n,o),this._lastMouseEvent)){let l=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);l&&this._askForLink(l,!1)}})))}_linkHover(e,t,s){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(s,t.text)}_fireUnderlineEvent(e,t){let s=e.range,n=this._bufferService.buffer.ydisp,o=this._createLinkUnderlineEvent(s.start.x-1,s.start.y-n-1,s.end.x,s.end.y-n-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(o)}_linkLeave(e,t,s){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(s,t.text)}_linkAtPosition(e,t){let s=e.range.start.y*this._bufferService.cols+e.range.start.x,n=e.range.end.y*this._bufferService.cols+e.range.end.x,o=t.y*this._bufferService.cols+t.x;return s<=o&&o<=n}_positionFromMouseEvent(e,t,s){let n=s.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(n)return{x:n[0],y:n[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,s,n,o){return{x1:e,y1:t,x2:s,y2:n,cols:this._bufferService.cols,fg:o}}};Eb=Kt([ke(1,Ux),ke(2,wr),ke(3,nn),ke(4,Q3)],Eb);function Fq(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var qq=class extends Lq{constructor(e={}){super(e),this._linkifier=this._register(new fl),this.browser=b5,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new fl),this._onCursorMove=this._register(new be),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new be),this.onKey=this._onKey.event,this._onRender=this._register(new be),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new be),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new be),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new be),this.onBell=this._onBell.event,this._onFocus=this._register(new be),this._onBlur=this._register(new be),this._onA11yCharEmitter=this._register(new be),this._onA11yTabEmitter=this._register(new be),this._onWillOpen=this._register(new be),this._setup(),this._decorationService=this._instantiationService.createInstance(Pq),this._instantiationService.setService(Nu,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(DF),this._instantiationService.setService(Q3,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(K0)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh(t?.start??0,t?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(Bs.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Bs.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Bs.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Bs.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(It(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let s,n="";switch(t.index){case 256:s="foreground",n="10";break;case 257:s="background",n="11";break;case 258:s="cursor",n="12";break;default:s="ansi",n="4;"+t.index}switch(t.type){case 0:let o=Ot.toColorRGB(s==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[s]);this.coreService.triggerDataEvent(`${de.ESC}]${n};${Tq(o)}${p5.ST}`);break;case 1:if(s==="ansi")this._themeService.modifyColors(l=>l.ansi[t.index]=us.toColor(...t.color));else{let l=s;this._themeService.modifyColors(u=>u[l]=us.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(sf,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(de.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(de.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let s=Math.min(this.buffer.x,this.cols-1),n=this._renderService.dimensions.css.cell.height,o=t.getWidth(s),l=this._renderService.dimensions.css.cell.width*o,u=this.buffer.y*this._renderService.dimensions.css.cell.height,h=s*this._renderService.dimensions.css.cell.width;this.textarea.style.left=h+"px",this.textarea.style.top=u+"px",this.textarea.style.width=l+"px",this.textarea.style.height=n+"px",this.textarea.style.lineHeight=n+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Ve(this.element,"copy",t=>{this.hasSelection()&&KH(t,this._selectionService)}));let e=t=>YH(t,this.textarea,this.coreService,this.optionsService);this._register(Ve(this.textarea,"paste",e)),this._register(Ve(this.element,"paste",e)),x5?this._register(Ve(this.element,"mousedown",t=>{t.button===2&&u2(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Ve(this.element,"contextmenu",t=>{u2(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Xx&&this._register(Ve(this.element,"auxclick",t=>{t.button===1&&F3(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Ve(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Ve(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Ve(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Ve(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Ve(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Ve(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Ve(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(Ve(this.screenElement,"mousemove",o=>this.updateCursorStyle(o))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let s=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",V0.get()),y5||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>s.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(RF,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Sr,this._coreBrowserService),this._register(Ve(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(Ve(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(pb,this._document,this._helperContainer),this._instantiationService.setService(Cf,this._charSizeService),this._themeService=this._instantiationService.createInstance(vb),this._instantiationService.setService(yl,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Jh),this._instantiationService.setService(Z3,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(bb,this.rows,this.screenElement)),this._instantiationService.setService(wr,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(hb,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(gb),this._instantiationService.setService(Ux,this._mouseService);let n=this._linkifier.value=this._register(this._instantiationService.createInstance(Eb,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(ub,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(xb,this.element,this.screenElement,n)),this._instantiationService.setService(nU,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(Bs.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(db,this.screenElement)),this._register(Ve(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(sf,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Qh,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Qh,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(mb,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function s(l){let u=e._mouseService.getMouseReportCoords(l,e.screenElement);if(!u)return!1;let h,m;switch(l.overrideType||l.type){case"mousemove":m=32,l.buttons===void 0?(h=3,l.button!==void 0&&(h=l.button<3?l.button:3)):h=l.buttons&1?0:l.buttons&4?1:l.buttons&2?2:3;break;case"mouseup":m=0,h=l.button<3?l.button:3;break;case"mousedown":m=1,h=l.button<3?l.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(l)===!1)return!1;let d=l.deltaY;if(d===0||e.coreMouseService.consumeWheelEvent(l,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;m=d<0?0:1,h=4;break;default:return!1}return m===void 0||h===void 0||h>4?!1:e.coreMouseService.triggerMouseEvent({col:u.col,row:u.row,x:u.x,y:u.y,button:h,action:m,ctrl:l.ctrlKey,alt:l.altKey,shift:l.shiftKey})}let n={mouseup:null,wheel:null,mousedrag:null,mousemove:null},o={mouseup:l=>(s(l),l.buttons||(this._document.removeEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.removeEventListener("mousemove",n.mousedrag)),this.cancel(l)),wheel:l=>(s(l),this.cancel(l,!0)),mousedrag:l=>{l.buttons&&s(l)},mousemove:l=>{l.buttons||s(l)}};this._register(this.coreMouseService.onProtocolChange(l=>{l?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(l)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),l&8?n.mousemove||(t.addEventListener("mousemove",o.mousemove),n.mousemove=o.mousemove):(t.removeEventListener("mousemove",n.mousemove),n.mousemove=null),l&16?n.wheel||(t.addEventListener("wheel",o.wheel,{passive:!1}),n.wheel=o.wheel):(t.removeEventListener("wheel",n.wheel),n.wheel=null),l&2?n.mouseup||(n.mouseup=o.mouseup):(this._document.removeEventListener("mouseup",n.mouseup),n.mouseup=null),l&4?n.mousedrag||(n.mousedrag=o.mousedrag):(this._document.removeEventListener("mousemove",n.mousedrag),n.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Ve(t,"mousedown",l=>{if(l.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(l)))return s(l),n.mouseup&&this._document.addEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.addEventListener("mousemove",n.mousedrag),this.cancel(l)})),this._register(Ve(t,"wheel",l=>{if(!n.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(l)===!1)return!1;if(!this.buffer.hasScrollback){if(l.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(l,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(l,!0);let u=de.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(l.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(u,!0),this.cancel(l,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){U3(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,s){this._selectionService.setSelection(e,t,s)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let s=Bq(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),s.type===3||s.type===2){let n=this.rows-1;return this.scrollLines(s.type===2?-n:n),this.cancel(e,!0)}if(s.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(s.cancel&&this.cancel(e,!0),!s.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((s.key===de.ETX||s.key===de.CR)&&(this.textarea.value=""),this._onKey.fire({key:s.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(s.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let s=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?s:s&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(Vq(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(os));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(de.ESC+"[I"):this.coreService.triggerDataEvent(de.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),s=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${de.ESC}[4;${s};${t}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),o=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${de.ESC}[6;${o};${n}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function Vq(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var Gq=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let s={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(s),t.dispose=()=>this._wrappedAddonDispose(s),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let s=0;s<this._addons.length;s++)if(this._addons[s]===e){t=s;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},Wq=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new Xn)}translateToString(e,t,s){return this._line.translateToString(e,t,s)}},tk=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new Wq(t)}getNullCell(){return new Xn}},Kq=class extends Je{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new be),this.onBufferChange=this._onBufferChange.event,this._normal=new tk(this._core.buffers.normal,"normal"),this._alternate=new tk(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)}},Yq=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,s=>t(s.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(s,n)=>t(s,n.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},Xq=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}},Zq=["cols","rows"],Ei=0,Qq=class extends Je{constructor(e){super(),this._core=this._register(new qq(e)),this._addonManager=this._register(new Gq),this._publicOptions={...this._core.options};let t=n=>this._core.options[n],s=(n,o)=>{this._checkReadonlyOptions(n),this._core.options[n]=o};for(let n in this._core.options){let o={get:t.bind(this,n),set:s.bind(this,n)};Object.defineProperty(this._publicOptions,n,o)}}_checkReadonlyOptions(e){if(Zq.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 Yq(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new Xq(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 Kq(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,s){this._verifyIntegers(e,t,s),this._core.select(e,t,s)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
170
+ `,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return V0.get()},set promptLabel(e){V0.set(e)},get tooMuchOutput(){return G0.get()},set tooMuchOutput(e){G0.set(e)}}}_verifyIntegers(...e){for(Ei of e)if(Ei===1/0||isNaN(Ei)||Ei%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Ei of e)if(Ei&&(Ei===1/0||isNaN(Ei)||Ei%1!==0||Ei<0))throw new Error("This API only accepts positive integers")}};function R5({sessionId:e,active:t,toolbarExtra:s}){const n=y.useRef(null),o=y.useRef(null),l=y.useRef(null),u=y.useRef(null),[h,m]=y.useState("Local workspace"),[d,p]=y.useState("connecting"),[g,x]=y.useState("Opening shell"),_=y.useCallback(()=>{const w=u.current,k=l.current;if(!w||w.readyState!==WebSocket.OPEN||!k)return;k.fit();const C=k.proposeDimensions();C&&w.send(JSON.stringify({cols:C.cols,rows:C.rows,type:"resize"}))},[]);y.useEffect(()=>{if(!n.current)return;const w=new Qq({allowProposedApi:!0,cursorBlink:!0,fontFamily:'"SF Mono", "JetBrains Mono", ui-monospace, Menlo, monospace',fontSize:12,lineHeight:1.25,scrollback:4e3,theme:{background:"#090909",black:"#090909",blue:"#69a7ff",brightBlack:"#5f6368",brightBlue:"#8ab4f8",brightCyan:"#7ddfd7",brightGreen:"#8fdc8a",brightMagenta:"#d7a2ff",brightRed:"#ff8a80",brightWhite:"#ffffff",brightYellow:"#ffd166",cyan:"#62d0c8",foreground:"#f2f2f2",green:"#7ac77f",magenta:"#c792ea",red:"#ff6b6b",selectionBackground:"#ffffff33",white:"#e8eaed",yellow:"#f7c948"}}),k=new FH;w.loadAddon(k),w.open(n.current),o.current=w,l.current=k;const C=new WebSocket(Jq(e));u.current=C;const T=w.onData(j=>{C.readyState===WebSocket.OPEN&&C.send(JSON.stringify({data:j,type:"input"}))});C.addEventListener("open",()=>{p("running"),x("Shell connected"),_()}),C.addEventListener("message",j=>{const M=eV(j.data);if(M){if(M.type==="output"){w.write(M.data);return}if(M.type==="error"){p("error"),x(M.error);return}p(M.state==="idle"?"connecting":M.state),M.cwd&&m(M.cwd),x(M.error??M.shell??"Shell connected")}}),C.addEventListener("close",()=>{p(j=>j==="exited"?j:"exited"),x("Socket closed")}),C.addEventListener("error",()=>{p("error"),x("Terminal socket error")}),window.addEventListener("resize",_),window.setTimeout(_,0);const E=new ResizeObserver(()=>_());return E.observe(n.current),()=>{window.removeEventListener("resize",_),E.disconnect(),T.dispose(),C.close(),w.dispose(),u.current=null,o.current=null,l.current=null}},[e,_]),y.useEffect(()=>{if(!t)return;const w=window.setTimeout(()=>{_(),o.current?.focus()},0);return()=>window.clearTimeout(w)},[t,_]);const S=y.useCallback(w=>{const k=u.current;if(!k||k.readyState!==WebSocket.OPEN)return;const C=l.current?.proposeDimensions();k.send(JSON.stringify({cols:C?.cols,rows:C?.rows,...w}))},[]);return r.jsxs("section",{className:ie("flex h-full min-h-0 flex-col bg-[#090909] text-white",!t&&"hidden"),children:[r.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-between gap-3 border-b border-white/10 bg-[#111111] px-4 py-2",children:[r.jsx("div",{className:"min-w-0",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ze,{className:ie("border-white/15 bg-white/10 text-white shadow-none",d==="running"&&"border-emerald-400/35 text-emerald-200",d==="error"&&"border-red-400/35 text-red-200"),variant:"outline",children:d}),r.jsxs("span",{className:"truncate font-mono text-[11px] text-white/55",children:[h," · ",g]})]})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(Y,{"aria-label":"Restart terminal",className:"border-white/15 bg-white/5 text-white hover:bg-white/10",size:"sm",variant:"outline",onClick:()=>S({type:"restart"}),type:"button",children:[r.jsx(fu,{}),"Restart"]}),r.jsxs(Y,{"aria-label":"Stop terminal",className:"border-white/15 bg-white/5 text-white hover:bg-white/10",size:"sm",variant:"outline",onClick:()=>S({type:"stop"}),type:"button",children:[r.jsx(cl,{}),"Stop"]}),s]})]}),r.jsx("div",{"aria-label":"terminal viewport",className:"min-h-0 flex-1 overflow-hidden px-3 py-0.5",children:r.jsx("div",{className:"h-full w-full",ref:n})})]})}function Jq(e){const t=window.location.protocol==="https:"?"wss:":"ws:",s=encodeURIComponent(e);return`${t}//${window.location.host}/api/terminal/socket?id=${s}`}function eV(e){if(typeof e!="string")return null;try{const t=JSON.parse(e);return typeof t?.type=="string"?t:null}catch{return null}}function tV({serviceName:e,active:t}){const[s,n]=y.useState(null),[o,l]=y.useState(null),[u,h]=y.useState(!1),m=y.useRef(!1);y.useEffect(()=>{if(!t||m.current)return;m.current=!0;let g=!1;return(async()=>{try{const x=await mh({serviceName:e});g||n(x.id)}catch(x){g||l(x instanceof Error?x.message:String(x))}})(),()=>{g=!0}},[t,e]);const d=r.jsxs(Y,{"aria-label":u?"Exit fullscreen terminal":"Expand terminal",className:"border-white/15 bg-white/5 text-white hover:bg-white/10",onClick:()=>h(g=>!g),size:"sm",type:"button",variant:"outline",children:[u?r.jsx(UN,{}):r.jsx($N,{}),u?"Exit":"Expand"]}),p=o?r.jsxs("div",{className:"p-3 font-mono text-[11px] text-destructive",children:["Could not open terminal: ",o]}):s?r.jsx(R5,{active:t,sessionId:s,toolbarExtra:d}):r.jsx("div",{className:"p-3 font-mono text-[11px] text-muted-foreground",children:"Opening terminal…"});return u&&t?r.jsx($x,{onClose:()=>h(!1),title:`Terminal — ${e}`,children:p}):r.jsx("div",{className:ie("h-[60vh] min-h-[24rem] overflow-hidden rounded-md border border-border",!t&&"hidden"),children:p})}const sV=500;function nV(e){const[t,s]=y.useState(),[n,o]=y.useState([]),[l,u]=y.useState(),[h,m]=y.useState(!1),d=y.useRef(void 0);y.useEffect(()=>{d.current=void 0,s(void 0),o([]);const g=new EventSource(`/api/services/${encodeURIComponent(e)}/test/stream`),x=_=>{try{const S=JSON.parse(_.data);S.run.id!==d.current&&(d.current=S.run.id,o([])),s(S.run),S.line&&o(w=>[...w,S.line].slice(-sV))}catch{}};return g.addEventListener("status",x),g.addEventListener("output",x),()=>g.close()},[e]);const p=y.useCallback(async g=>{m(!0),u(void 0);try{await v8(e,g)}catch(x){u(x instanceof Error?x.message:String(x))}finally{m(!1)}},[e]);return{run:t,lines:n,error:l,starting:h,start:p}}const iV={running:"secondary",passed:"success",failed:"error",error:"error"},rV={running:"Running",passed:"Passed",failed:"Failed",error:"Error"};function aV({serviceName:e}){const{run:t,lines:s,error:n,starting:o,start:l}=nV(e),[u,h]=y.useState(""),m=t?.status==="running"||o,d=t?.status==="failed"||t?.status==="error";return r.jsxs("div",{className:"space-y-2",children:[r.jsxs("form",{className:"flex items-center gap-2",onSubmit:p=>{p.preventDefault(),m||l(u.trim()||void 0)},children:[r.jsx(tt,{className:"h-7 flex-1 text-[11px]",disabled:m,onChange:p=>h(p.target.value),placeholder:"Optional test pattern (e.g. config-store)",value:u}),r.jsx(Y,{disabled:m,size:"sm",type:"submit",children:m?"Running…":"Run tests"})]}),n?r.jsx("div",{className:"text-red-600",children:n}):null,t?r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-muted-foreground",children:[r.jsx(ze,{size:"small",variant:iV[t.status],children:rV[t.status]}),r.jsx("code",{className:"font-mono text-[11px]",children:t.command}),t.failingCount>0?r.jsxs("span",{children:["· ",t.failingCount," failing"]}):null,t.exitCode!=null?r.jsxs("span",{children:["· exit ",t.exitCode]}):null]}):r.jsx("div",{className:"text-muted-foreground",children:"No test runs yet."}),s.length>0?r.jsx("pre",{className:"max-h-72 overflow-auto whitespace-pre-wrap break-all rounded bg-background p-2 font-mono text-[11px]",children:s.map((p,g)=>r.jsx("div",{className:ie(p.stream==="stderr"&&"text-red-500"),children:p.text},g))}):null,d?r.jsxs("div",{className:"rounded border border-border bg-muted/40 p-2",children:["Failures were piped into the"," ",r.jsx("a",{className:"font-medium underline",href:"/errors",children:"Error Inbox"})," ","— open an incident there to copy a debugging prompt for your agent."]}):null]})}function oV({serviceName:e,status:t,health:s,timeline:n,onRefresh:o}){const[l,u]=y.useState("metrics"),h=s?.processTree?.processes??[];return r.jsxs("div",{className:"border-t border-border bg-muted/30 px-3 py-2 text-xs",children:[r.jsxs("div",{className:"mb-2 flex gap-1",children:[r.jsx(Pa,{active:l==="logs",onClick:()=>u("logs"),children:"Logs"}),r.jsxs(Pa,{active:l==="processes",onClick:()=>u("processes"),children:["Processes ",h.length?r.jsx(ze,{variant:"secondary",size:"small",children:h.length}):null]}),r.jsx(Pa,{active:l==="metrics",onClick:()=>u("metrics"),children:"Metrics"}),r.jsxs(Pa,{active:l==="http",onClick:()=>u("http"),children:["HTTP",t?.inspector?.enabled?r.jsx(ze,{variant:"success",size:"small",children:"on"}):null]}),r.jsx(Pa,{active:l==="env",onClick:()=>u("env"),children:"Env"}),r.jsx(Pa,{active:l==="tests",onClick:()=>u("tests"),children:"Tests"}),r.jsx(Pa,{active:l==="terminal",onClick:()=>u("terminal"),children:"Terminal"})]}),l==="processes"?r.jsx($H,{rows:h}):null,l==="metrics"?r.jsx(OH,{serviceName:e}):null,l==="http"?r.jsx(RH,{serviceName:e,status:t,timeline:n,onRefresh:o}):null,l==="env"?r.jsx(AH,{serviceName:e}):null,l==="tests"?r.jsx(aV,{serviceName:e}):null,l==="logs"?r.jsx(SH,{serviceName:e}):null,r.jsx(tV,{active:l==="terminal",serviceName:e},e)]})}function Pa({active:e,onClick:t,children:s}){return r.jsx("button",{className:ie("inline-flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium transition-colors",e?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),onClick:t,type:"button",children:s})}const lV={high:"success",medium:"warning",low:"secondary"};function cV({onClose:e,onRefresh:t}){const s=Es(),{sendToAgent:n}=At(),[o,l]=y.useState("url"),[u,h]=y.useState(""),[m,d]=y.useState(!1),[p,g]=y.useState(null),[x,_]=y.useState(null),[S,w]=y.useState([]),[k,C]=y.useState([]),[T,E]=y.useState(null),j=T?.kind==="docker-compose"?k.find(A=>A.composeService===T.composeService):void 0;async function M(){if(u.trim()){d(!0),g(null);try{const A=await r8(u.trim());_(A.profile),w(A.proposals),C(A.databases),E(A.proposals[0]??null),A.proposals.length===0&&g("Cloned, but couldn't detect how to run this repo. Refine with AI or add it manually."),l("review")}catch(A){g(A instanceof Error?A.message:String(A))}finally{d(!1)}}}function z(){n({prompt:`Onboard this repository and register it as a NoMoreIDE service: ${u.trim()}
171
+ Use nomoreide_onboard_repo to inspect it, pick the best run command, then register and start it.`,source:{type:"repo-onboard",label:"Onboard repo"},label:`Onboard and run this repo: ${u.trim()}`}),e()}async function O(A){if(T){d(!0),g(null);try{await a8(T,A,j),await t(),s.success(`${T.name} registered${j?" (+ database)":""}${A?" and starting":""}.`),e()}catch(D){g(D instanceof Error?D.message:String(D))}finally{d(!1)}}}return r.jsxs(Qn,{icon:r.jsx(sn,{}),onClose:e,size:"lg",title:"Add from GitHub",children:[o==="url"?r.jsx(uV,{url:u,busy:m,error:p,onChange:h,onScan:M,onRefine:z}):null,o==="review"&&x?r.jsx(dV,{profile:x,proposals:S,selected:T,database:j,error:p,onSelect:E,onEdit:E,onBack:()=>l("url"),onRefine:z,onContinue:()=>l("install")}):null,o==="install"&&T?r.jsx(fV,{proposal:T,busy:m,error:p,onBack:()=>l("review"),onRegister:O}):null]})}function uV({url:e,busy:t,error:s,onChange:n,onScan:o,onRefine:l}){return r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Paste a repository URL. NoMoreIDE clones it, detects how it runs, and proposes a service."}),r.jsx(tt,{autoFocus:!0,placeholder:"https://github.com/owner/repo",value:e,onChange:u=>n(u.target.value),onKeyDown:u=>{u.key==="Enter"&&!t&&o()}}),s?r.jsx("p",{className:"text-sm text-destructive",children:s}):null,r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs(Y,{variant:"ghost",size:"sm",onClick:l,disabled:!e.trim(),children:[r.jsx(pi,{className:"size-3.5"}),"Refine with AI"]}),r.jsxs(Y,{onClick:o,disabled:t||!e.trim(),children:[t?r.jsx(ht,{className:"size-4 animate-spin"}):r.jsx(sn,{className:"size-4"}),t?"Cloning…":"Clone & detect"]})]})]})}function dV({profile:e,proposals:t,selected:s,database:n,error:o,onSelect:l,onEdit:u,onBack:h,onRefine:m,onContinue:d}){return r.jsxs("div",{className:"flex flex-col gap-4",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[r.jsx("span",{className:"text-sm font-medium",children:e.name}),e.languages.map(p=>r.jsx(ze,{variant:"outline",size:"small",label:p},p))]}),o?r.jsx("p",{className:"text-sm text-destructive",children:o}):null,t.length>0?r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsxs("span",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:["Detected service",t.length>1?"s":""]}),t.map(p=>{const g=s?.name===p.name;return r.jsxs("button",{type:"button",onClick:()=>l(p),className:`rounded-md border px-3 py-2 text-left text-sm transition-colors ${g?"border-primary bg-primary/5":"border-border hover:bg-muted/50"}`,children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"font-medium",children:p.name}),r.jsx(ze,{variant:lV[p.confidence],size:"small",label:p.confidence})]}),r.jsx("div",{className:"mt-0.5 font-mono text-xs text-muted-foreground",children:p.kind==="docker-compose"?`compose · ${p.composeService}`:p.command}),r.jsx("div",{className:"text-[11px] text-muted-foreground",children:p.reason})]},p.name)})]}):null,s?r.jsx(hV,{proposal:s,onChange:u}):null,n?r.jsxs("div",{className:"flex items-center gap-1.5 rounded-md border border-border bg-muted/30 px-2.5 py-1.5 text-xs text-muted-foreground",children:[r.jsx(Zn,{className:"size-3.5"}),r.jsxs("span",{children:["Also registers database ",r.jsx("span",{className:"font-medium",children:n.name})," (",n.engine,") so it shows in the Database tab."]})]}):null,e.envKeys.length>0?r.jsxs("div",{className:"text-xs text-muted-foreground",children:[r.jsx("span",{className:"font-medium",children:"Env from .env.example:"})," ",e.envKeys.join(", ")]}):null,e.readmeExcerpt?r.jsxs("details",{className:"rounded-md border border-border bg-muted/30 p-2 text-xs",children:[r.jsx("summary",{className:"cursor-pointer font-medium",children:"README excerpt"}),r.jsx("pre",{className:"mt-2 max-h-40 overflow-auto whitespace-pre-wrap font-mono",children:e.readmeExcerpt})]}):null,r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs(Y,{variant:"ghost",size:"sm",onClick:h,children:[r.jsx(hu,{className:"size-3.5"}),"Back"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(Y,{variant:"outline",size:"sm",onClick:m,children:[r.jsx(pi,{className:"size-3.5"}),"Refine with AI"]}),r.jsx(Y,{onClick:d,disabled:!s,children:"Continue"})]})]})]})}function hV({proposal:e,onChange:t}){return r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsx(Hc,{label:"Service name",children:r.jsx(tt,{value:e.name,onChange:s=>t({...e,name:s.target.value})})}),r.jsx(Hc,{label:"Port (optional)",children:r.jsx(tt,{value:e.port?.toString()??"",placeholder:"auto",onChange:s=>t({...e,port:s.target.value?Number(s.target.value):void 0})})}),e.kind==="docker-compose"?r.jsx(Hc,{label:"Compose service",className:"col-span-2",children:r.jsx(tt,{value:e.composeService??"",onChange:s=>t({...e,composeService:s.target.value})})}):r.jsx(Hc,{label:"Run command",className:"col-span-2",children:r.jsx(tt,{value:e.command??"",onChange:s=>t({...e,command:s.target.value})})})]})}function fV({proposal:e,busy:t,error:s,onBack:n,onRegister:o}){const[l,u]=y.useState(e.installCommand??""),[h,m]=y.useState([]),[d,p]=y.useState(!1),[g,x]=y.useState(!1),_=y.useRef(null);function S(k){m(C=>[...C,k]),queueMicrotask(()=>{const C=_.current;C&&(C.scrollTop=C.scrollHeight)})}async function w(){l.trim()&&(p(!0),x(!1),m([]),await o8({clonePath:e.cwd,command:l.trim()},{onLine:k=>S(k.text),onDone:k=>{S(k===0?"✓ install complete":`✗ install exited ${k}`),p(!1),x(k===0)},onError:k=>{S(`✗ ${k}`),p(!1)}}))}return r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsxs("div",{className:"flex items-end gap-2",children:[r.jsx(Hc,{label:"Install command (optional)",className:"flex-1",children:r.jsx(tt,{value:l,placeholder:"e.g. npm install",onChange:k=>u(k.target.value)})}),r.jsxs(Y,{variant:"outline",onClick:w,disabled:d||!l.trim(),children:[d?r.jsx(ht,{className:"size-4 animate-spin"}):r.jsx(TN,{className:"size-4"}),"Install"]})]}),h.length>0?r.jsx("pre",{ref:_,className:"max-h-48 overflow-auto rounded-md border border-border bg-black/80 p-2 font-mono text-[11px] text-green-200",children:h.join(`
172
+ `)}):null,s?r.jsx("p",{className:"text-sm text-destructive",children:s}):null,r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs(Y,{variant:"ghost",size:"sm",onClick:n,children:[r.jsx(hu,{className:"size-3.5"}),"Back"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Y,{variant:"outline",onClick:()=>o(!1),disabled:t,children:"Register only"}),r.jsxs(Y,{onClick:()=>o(!0),disabled:t,children:[t?r.jsx(ht,{className:"size-4 animate-spin"}):r.jsx(vr,{className:"size-4"}),g||!l.trim()?"Register & start":"Skip install & start"]})]})]})]})}function Hc({label:e,className:t,children:s}){return r.jsxs("label",{className:`flex flex-col gap-1 text-xs ${t??""}`,children:[r.jsx("span",{className:"font-medium text-muted-foreground",children:e}),s]})}function mV({data:e,onRefresh:t,focusService:s,onServiceFocused:n}){const o=e.config.services[0]?.name??"",[l,u]=y.useState(o),[h,m]=y.useState(null),[d,p]=y.useState(!1),{sendToAgent:g,startOnboard:x}=At(),[_,S]=y.useState(!1),[w,k]=y.useState(!1),[C,T]=y.useState(!1),[E,j]=y.useState(!1),M=y.useRef({}),{error:z,message:O,success:A}=Es(),D=y.useMemo(()=>new Set(e.config.bundles.flatMap(L=>L.services)),[e.config.bundles]),B=y.useMemo(()=>{const L=new Map;for(const Q of e.config.bundles)for(const re of Q.services)L.has(re)||L.set(re,Q.name);return L},[e.config.bundles]),P=y.useMemo(()=>e.config.services.filter(L=>!D.has(L.name)),[e.config.services,D]),H=e.health??{},$=e.config.bundles.length>0||P.length>0;y.useEffect(()=>{!e.config.services.some(Q=>Q.name===l)&&o&&u(o)},[e.config.services,o,l]),y.useEffect(()=>{s&&e.config.services.some(L=>L.name===s)&&(u(s),n?.())},[s,e.config.services,n]);const q=y.useMemo(()=>e.config.services.find(L=>L.name===l),[e.config.services,l]),V=l?e.runtime.services[l]:void 0,I=l?H[l]:void 0;async function W(L,Q){if(!L.services.includes(Q))try{await d8(L.name,L.services,Q),A(`Added ${Q} to ${L.name}.`),await t()}catch(re){z(re instanceof Error?re.message:String(re))}}async function Z(){if(q){if(Kc(V?.state)){z(`Stop ${q.name} before deleting it.`);return}if(window.confirm(`Delete service "${q.name}"? This removes it from your config.`))try{await u8(q.name),A(`Deleted ${q.name}.`),await t()}catch(L){z(L instanceof Error?L.message:String(L))}}}async function K(L){const Q=e.config.bundles.filter(re=>re.services.includes(L));if(Q.length!==0)try{for(const re of Q)await h8(re.name,re.services,L);O({text:`Removed ${L} from ${Q.map(re=>re.name).join(", ")}.`}),await t()}catch(re){z(re instanceof Error?re.message:String(re))}}y.useEffect(()=>{const L=Object.fromEntries(e.config.services.map(re=>[re.name,e.runtime.services[re.name]?.state??"stopped"])),Q=M.current;if(Object.keys(Q).length){const re=new Map,he=new Map;for(const fe of e.config.services){const pe=L[fe.name],we=Q[fe.name];if(!we||we===pe)continue;const Le=e.runtime.services[fe.name],ve=B.get(fe.name);if(ve){const We=re.get(ve)??new Map;if(We.set(pe,(We.get(pe)??0)+1),re.set(ve,We),pe==="exited"){const ge=he.get(ve)??[];ge.push(Le?.exitCode),he.set(ve,ge)}continue}if(pe==="running")A(`${fe.name} is running.`);else if(pe==="stopped")O({text:`${fe.name} stopped.`});else if(pe==="starting")O({text:`${fe.name} is starting.`});else if(pe==="exited"){const We=Le?.exitCode===void 0||Le.exitCode===null?"":` with code ${Le.exitCode}`;z(`${fe.name} exited${We}.`)}}for(const[fe,pe]of re)gV({exitCodes:he.get(fe)??[],groupName:fe,showErrorToast:z,showMessageToast:O,showSuccessToast:A,transitions:pe})}M.current=L},[e.config.services,e.runtime.services,B,z,O,A]);const te=e.config.services.length>0;return r.jsxs(r.Fragment,{children:[te?r.jsxs("div",{className:ie("grid h-full min-h-0 overflow-hidden bg-card/85",w?"lg:grid-cols-[320px_minmax(0,1fr)]":"lg:grid-cols-[320px_minmax(0,1fr)_340px]"),children:[r.jsx("div",{className:"min-h-0 min-w-0 overflow-auto border-r border-border",children:r.jsxs(gi,{className:"min-w-0 rounded-none border-0 border-b border-border bg-transparent",children:[r.jsx(bi,{className:"border-b border-border px-3 py-2",children:r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx(xi,{className:"text-sm",children:"Services"}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsxs(Y,{"aria-haspopup":"dialog",className:"h-7 gap-1.5 px-2 text-xs",onClick:()=>S(!0),size:"sm",type:"button",variant:"outline",children:[r.jsx(VN,{className:"size-3.5"}),"Logs"]}),r.jsx(pV,{onCreateGroup:()=>m("group"),onCreateService:()=>m("service"),onOnboardRepo:()=>p(!0),onOnboardWithAi:x,canGroupWithAi:P.length>1,onCreateWithAi:()=>g({prompt:Aw,source:{type:"service-setup",label:"Add a service"},label:"Help me add a new service, one step at a time."}),onGroupWithAi:()=>g({prompt:xB(P),source:{type:"group-services",label:"Group services"},label:"Propose how to group my ungrouped services."})})]})]})}),r.jsx(vi,{className:"p-0",children:$?r.jsxs("div",{className:"divide-y divide-border",children:[e.config.bundles.map(L=>r.jsx(SI,{group:L,onRefresh:t,ports:e.ports,allServices:e.config.services,health:H,services:e.config.services.filter(Q=>L.services.includes(Q.name)),statuses:e.runtime.services,timeline:e.timeline,selectedService:l,onSelectService:u,onDropService:Q=>{W(L,Q)}},L.name)),P.length?r.jsxs("div",{className:ie("transition-colors",E&&"bg-primary/5 outline-dashed outline-2 -outline-offset-2 outline-primary/60"),onDragOver:L=>{L.dataTransfer.types.includes(iu)&&(L.preventDefault(),L.dataTransfer.dropEffect="move",j(!0))},onDragLeave:()=>j(!1),onDrop:L=>{L.preventDefault(),j(!1);const Q=L.dataTransfer.getData(iu);Q&&K(Q)},children:[r.jsxs("div",{className:"flex items-center justify-between gap-2 bg-muted/55 px-3 py-1 text-[10px] font-semibold uppercase text-muted-foreground",children:[r.jsx("span",{children:"Ungrouped"}),r.jsx("span",{className:"text-muted-foreground/80",children:P.length})]}),r.jsx("div",{className:"divide-y divide-border",children:P.map(L=>r.jsx(S3,{service:L,status:e.runtime.services[L.name],health:H[L.name],ports:e.ports,onRefresh:t,timeline:e.timeline,selected:l===L.name,onSelect:()=>u(L.name)},L.name))})]}):null]}):r.jsx(Yh,{label:"No services registered yet."})})]})}),r.jsx("div",{className:"min-h-0 min-w-0 overflow-auto",children:q?r.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[r.jsxs("div",{className:"shrink-0 space-y-2 border-b border-border bg-background/60 px-4 py-3",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("h2",{className:"min-w-0 truncate text-base font-semibold",children:q.name}),r.jsx(Tx,{state:V?.state??"stopped"}),r.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1.5",children:[(()=>{const L=V?.url??(q.port?kI(q.port):void 0);return L?r.jsx(al,{label:`Open ${L}`,children:r.jsx(Y,{"aria-label":"Open in browser",className:"size-7",onClick:()=>window.open(L,"_blank","noopener,noreferrer"),size:"icon",type:"button",variant:"outline",children:r.jsx(br,{})})}):null})(),I?.agentContext&&q?r.jsx(al,{label:"Debug this service with AI",children:r.jsx(Y,{"aria-label":"Debug this service with AI",className:"size-7",onClick:()=>g({prompt:vB({service:q.name,context:I.agentContext}),source:{type:"service-debug",label:q.name},label:`Debug \`${q.name}\` with its current context.`}),size:"icon",type:"button",variant:"outline",children:r.jsx(Tt,{className:"size-3.5"})})}):null,r.jsx(jx,{active:Kc(V?.state),baseUrl:`/api/services/${encodeURIComponent(q.name)}`,compact:!0,targetLabel:q.name,onRefresh:t}),r.jsx(z3,{className:"size-7 border border-border bg-background opacity-100 hover:border-foreground/30",items:[{icon:r.jsx(ll,{className:"size-3.5"}),label:"Edit service",onSelect:()=>T(!0)},...Kc(V?.state)?[]:[{icon:r.jsx(yr,{className:"size-3.5 text-destructive"}),label:"Delete service",onSelect:()=>{Z()}}]],label:`More actions for ${q.name}`}),r.jsx(al,{label:w?"Show Ports & Timeline":"Hide Ports & Timeline",side:"left",children:r.jsx(Y,{"aria-label":w?"Show Ports & Timeline":"Hide Ports & Timeline",className:"size-7",onClick:()=>k(L=>!L),size:"icon",type:"button",variant:"ghost",children:w?r.jsx(E4,{}):r.jsx(Jn,{})})})]})]}),q.command?r.jsxs("div",{className:"truncate font-mono text-[11px] text-muted-foreground",title:q.command,children:["$ ",q.command]}):null,q.cwd?r.jsx("div",{className:"truncate font-mono text-[11px] text-muted-foreground",title:q.cwd,children:q.cwd}):null,r.jsx(oH,{health:I})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:r.jsx(oV,{serviceName:q.name,status:V,health:I,timeline:e.timeline??[],onRefresh:t},q.name)})]}):r.jsx(Yh,{label:"Select a service to see details."})}),w?null:r.jsxs("div",{className:"min-h-0 overflow-auto border-l border-border",children:[r.jsx(hH,{ports:e.ports}),r.jsx(Z$,{events:e.timeline??[]})]})]}):r.jsx(aH,{onOnboardRepo:()=>p(!0),onOnboardWithAi:x,onCreateService:()=>m("service"),onCreateWithAi:()=>g({prompt:Aw,source:{type:"service-setup",label:"Add a service"},label:"Help me add a new service, one step at a time."})}),C&&q?r.jsx(Qn,{icon:r.jsx(ll,{}),onClose:()=>T(!1),size:"lg",title:`Edit Service — ${q.name}`,children:r.jsx(Iw,{cwd:e.cwd,initialService:q,onRefresh:t,onSaved:()=>T(!1)})}):null,h?r.jsx(Qn,{icon:h==="service"?r.jsx(hs,{}):r.jsx(CN,{}),onClose:()=>m(null),size:h==="service"?"lg":"md",title:h==="service"?"Add Service":"Create Group",children:h==="service"?r.jsx(Iw,{cwd:e.cwd,onRefresh:t,onSaved:()=>m(null)}):r.jsx(y3,{services:P,onRefresh:t,onSaved:()=>m(null)})}):null,d?r.jsx(cV,{onClose:()=>p(!1),onRefresh:t}):null,_?r.jsx(NH,{initialService:l||void 0,onClose:()=>S(!1),services:e.config.services.map(L=>L.name)}):null]})}function pV({onCreateService:e,onCreateGroup:t,onCreateWithAi:s,onGroupWithAi:n,canGroupWithAi:o,onOnboardRepo:l,onOnboardWithAi:u}){const[h,m]=y.useState(!1);function d(p){m(!1),p()}return r.jsxs("div",{className:"relative",children:[r.jsx(al,{label:"Add",side:"bottom",children:r.jsx(Y,{"aria-expanded":h,"aria-haspopup":"menu","aria-label":"Add service or group",className:"size-7",onClick:()=>m(p=>!p),size:"icon",type:"button",variant:"ghost",children:r.jsx(hs,{})})}),h?r.jsxs(r.Fragment,{children:[r.jsx("button",{"aria-hidden":!0,className:"fixed inset-0 z-[40] cursor-default",onClick:()=>m(!1),tabIndex:-1,type:"button"}),r.jsxs("div",{className:"absolute right-0 z-[50] mt-1 w-56 overflow-hidden rounded-md border border-border bg-card py-1 shadow-lg",role:"menu",children:[r.jsxs("div",{className:"group flex items-stretch",children:[r.jsxs("button",{className:"flex flex-1 items-center gap-2 whitespace-nowrap px-3 py-2 text-left text-sm hover:bg-muted/60 [&_svg]:size-4",onClick:()=>d(e),role:"menuitem",type:"button",children:[r.jsx(hs,{}),"Create Service"]}),r.jsxs("button",{className:"flex max-w-0 items-center gap-1.5 overflow-hidden whitespace-nowrap border-l border-transparent px-0 text-[11px] font-medium text-muted-foreground opacity-0 transition-all duration-200 ease-out hover:bg-muted/60 hover:text-foreground group-hover:max-w-24 group-hover:border-border group-hover:px-3 group-hover:opacity-100",onClick:()=>d(s),role:"menuitem",title:"Set up with AI — the agent walks you through it",type:"button",children:[r.jsx(Tt,{className:"size-3.5 shrink-0"}),"AI"]})]}),r.jsxs("div",{className:"group flex items-stretch",children:[r.jsxs("button",{className:"flex flex-1 items-center gap-2 whitespace-nowrap px-3 py-2 text-left text-sm hover:bg-muted/60 [&_svg]:size-4",onClick:()=>d(t),role:"menuitem",type:"button",children:[r.jsx(CN,{}),"Create Group"]}),o?r.jsxs("button",{className:"flex max-w-0 items-center gap-1.5 overflow-hidden whitespace-nowrap border-l border-transparent px-0 text-[11px] font-medium text-muted-foreground opacity-0 transition-all duration-200 ease-out hover:bg-muted/60 hover:text-foreground group-hover:max-w-24 group-hover:border-border group-hover:px-3 group-hover:opacity-100",onClick:()=>d(n),role:"menuitem",title:"Group with AI — the agent proposes groupings for your ungrouped services",type:"button",children:[r.jsx(Tt,{className:"size-3.5 shrink-0"}),"AI"]}):null]}),r.jsxs("div",{className:"group flex items-stretch",children:[r.jsxs("button",{className:"flex flex-1 items-center gap-2 whitespace-nowrap px-3 py-2 text-left text-sm hover:bg-muted/60 [&_svg]:size-4",onClick:()=>d(l),role:"menuitem",type:"button",children:[r.jsx(sn,{}),"Add from GitHub"]}),r.jsxs("button",{className:"flex max-w-0 items-center gap-1.5 overflow-hidden whitespace-nowrap border-l border-transparent px-0 text-[11px] font-medium text-muted-foreground opacity-0 transition-all duration-200 ease-out hover:bg-muted/60 hover:text-foreground group-hover:max-w-24 group-hover:border-border group-hover:px-3 group-hover:opacity-100",onClick:()=>d(u),role:"menuitem",title:"Onboard with AI — the agent clones, detects and runs it for you",type:"button",children:[r.jsx(Tt,{className:"size-3.5 shrink-0"}),"AI"]})]})]})]}):null]})}function gV({exitCodes:e,groupName:t,showErrorToast:s,showMessageToast:n,showSuccessToast:o,transitions:l}){if(l.size===1){const[m]=l.keys();if(m==="running")o(`${t} group is running.`);else if(m==="stopped")n({text:`${t} group stopped.`});else if(m==="starting")n({text:`${t} group is starting.`});else if(m==="exited"){const d=e.filter(g=>g!=null),p=d.length?` with code ${d.join(", ")}`:"";s(`${t} group exited${p}.`)}return}const u=[...l.entries()].map(([m,d])=>`${d} ${m}`).join(", "),h=`${t} group updated: ${u}.`;l.has("exited")?s(h):n({text:h})}function bV({data:e,onOpenService:t}){const s=y.useMemo(()=>xV(e),[e]);return s.length?r.jsxs("div",{className:"flex shrink-0 items-center gap-3 overflow-x-auto border-b border-border bg-card/60 px-4 py-1.5 backdrop-blur",children:[r.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 font-mono text-[10px] uppercase tracking-wider text-muted-foreground",children:[r.jsx(Ka,{className:"size-3"}),"Running"]}),r.jsx("div",{className:"flex min-w-0 items-center gap-2",children:s.map(n=>r.jsxs("button",{className:"group flex shrink-0 items-center gap-2 rounded-md border border-border/60 bg-background/60 px-2.5 py-1 font-mono text-[11px] transition-colors hover:border-border hover:bg-muted",onClick:()=>t(n.name),title:n.url?`${n.name} — ${n.url}`:n.name,type:"button",children:[r.jsx("span",{className:ie("size-2 shrink-0 rounded-full",_V(n.tone))}),r.jsx("span",{className:"max-w-40 truncate font-medium text-foreground",children:n.name}),n.port?r.jsxs("span",{className:"text-muted-foreground",children:[":",n.port]}):null,n.uptime?r.jsxs("span",{className:"text-muted-foreground/70",children:["↑",n.uptime]}):null]},n.name))})]}):null}function xV(e){const t=new Map(e.config.services.map(s=>[s.name,s.port]));return Object.values(e.runtime.services).filter(s=>s.state==="running"||s.state==="starting").map(s=>({name:s.name,tone:vV(s,e.health[s.name]),port:t.get(s.name)??yV(s.url),uptime:s.state==="running"?SV(s.startedAt):"starting…",url:s.url})).sort((s,n)=>s.name.localeCompare(n.name))}function vV(e,t){return e.state==="starting"?"starting":t?.status==="healthy"?"healthy":t?.status==="warning"?"warning":t?.status==="unhealthy"?"unhealthy":"healthy"}function _V(e){return e==="starting"?"animate-pulse bg-amber-500":e==="warning"?"bg-amber-500":e==="unhealthy"?"bg-red-500":e==="unknown"?"bg-zinc-500":"bg-emerald-500"}function yV(e){if(e)try{const t=new URL(e).port;return t?Number(t):void 0}catch{return}}function SV(e){if(!e)return;const t=new Date(e).getTime();if(Number.isNaN(t))return;const s=Math.max(0,Math.floor((Date.now()-t)/1e3));if(s<60)return`${s}s`;const n=Math.floor(s/60);if(n<60)return`${n}m`;const o=Math.floor(n/60),l=n%60;return o<24?`${o}h${l?`${l}m`:""}`:`${Math.floor(o/24)}d${o%24?`${o%24}h`:""}`}function wV(){const[e,t]=y.useState([]),[s,n]=y.useState(null),[o,l]=y.useState(!1);y.useEffect(()=>{let m=!1;return(async()=>{let d=await R8().catch(()=>[]);if(d.length===0){const p=await mh().catch(()=>null);d=p?[p]:[]}m||(t(d),n(d[0]?.id??null))})(),()=>{m=!0}},[]);const u=y.useCallback(async()=>{l(!0);try{const m=await mh();t(d=>[...d,m]),n(m.id)}finally{l(!1)}},[]),h=y.useCallback(async m=>{l(!0);try{await M8(m);const d=e.findIndex(g=>g.id===m),p=e.filter(g=>g.id!==m);if(p.length===0){const g=await mh();t([g]),n(g.id);return}if(t(p),s===m){const g=p[Math.min(d,p.length-1)];n(g.id)}}finally{l(!1)}},[e,s]);return r.jsxs("section",{className:"flex h-full min-h-0 flex-col bg-[#090909] text-white",children:[r.jsxs("div",{"aria-label":"Terminal tabs",className:"flex shrink-0 items-center gap-1 overflow-x-auto border-b border-white/10 bg-[#111111] px-2 py-1.5",role:"tablist",children:[e.map((m,d)=>{const p=m.label??`Terminal ${d+1}`;return r.jsxs("div",{className:ie("group flex items-center gap-1 rounded-md border border-transparent px-2 py-1 text-xs",m.id===s?"border-white/15 bg-white/10 text-white":"text-white/60 hover:bg-white/5"),children:[r.jsx("button",{"aria-selected":m.id===s,className:"max-w-[160px] truncate font-medium",onClick:()=>n(m.id),role:"tab",type:"button",children:p}),r.jsx("button",{"aria-label":`Close ${p}`,className:"rounded p-0.5 text-white/40 opacity-0 transition hover:bg-white/10 hover:text-white group-hover:opacity-100",disabled:o,onClick:()=>{h(m.id)},type:"button",children:r.jsx(Ft,{className:"size-3"})})]},m.id)}),r.jsx("button",{"aria-label":"New terminal",className:"ml-1 rounded-md p-1 text-white/60 transition hover:bg-white/10 hover:text-white disabled:opacity-40",disabled:o,onClick:()=>{u()},type:"button",children:r.jsx(hs,{className:"size-4"})})]}),r.jsx("div",{className:"relative min-h-0 flex-1",children:e.length===0?r.jsx("div",{className:"flex h-full items-center justify-center font-mono text-[11px] text-white/40",children:"Starting terminal…"}):e.map(m=>r.jsx("div",{className:"absolute inset-0",children:r.jsx(R5,{active:m.id===s,sessionId:m.id})},m.id))})]})}function M5({branch:e}){return r.jsx("span",{className:"min-w-0 max-w-40",title:e,children:r.jsx(ze,{className:"w-full max-w-full shadow-none",variant:"outline",children:e})})}function D5({branch:e,error:t,files:s,selectedFile:n,onSelectFile:o,root:l,staging:u}){const h=y.useMemo(()=>EV(s).filter(p=>p.files.length),[s]),[m,d]=y.useState({staged:!1,unstaged:!1,untracked:!1});return r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border bg-card/95 px-2.5 py-1.5",children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-[12px] font-semibold tracking-tight",children:[r.jsx(sn,{className:"size-3.5"}),r.jsx("span",{className:"truncate",children:"Changes"})]}),r.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[e?r.jsx(M5,{branch:e}):null,r.jsx(ze,{variant:"secondary",children:s.length})]})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-auto py-1",children:h.length?h.map(p=>r.jsx(kV,{collapsed:m[p.id],group:p,onSelectFile:o,onToggle:()=>d(g=>({...g,[p.id]:!g[p.id]})),root:l,selectedFile:n,staging:u},p.id)):r.jsx($e,{variant:"muted",className:"m-3 text-center",children:t??"No changed files."})})]})}function kV({collapsed:e,group:t,onSelectFile:s,onToggle:n,root:o,selectedFile:l,staging:u}){const h=e?Jn:Mn,m=t.files.map(p=>p.path),d=u?t.id==="staged"?{label:"Unstage all",run:()=>u.onUnstage(m)}:{label:"Stage all",run:()=>u.onStage(m)}:null;return r.jsxs("section",{className:"border-b border-border last:border-b-0",children:[r.jsxs("div",{className:"flex w-full items-center justify-between gap-2 bg-muted/45 px-2 py-0.5 text-[10px] font-semibold uppercase text-muted-foreground hover:bg-muted",children:[r.jsxs("button",{className:"flex min-w-0 flex-1 items-center gap-1.5 text-left",onClick:n,type:"button",children:[r.jsx(h,{className:"size-3.5"}),r.jsx("span",{className:"truncate",children:t.label})]}),d?r.jsx("button",{className:"shrink-0 rounded px-1 text-[10px] font-medium normal-case text-muted-foreground transition-colors hover:bg-background hover:text-foreground disabled:opacity-50",disabled:u?.busy,onClick:d.run,type:"button",children:d.label}):null,r.jsx(ze,{className:"min-w-6 justify-center font-mono shadow-none",size:"small",variant:"outline",children:t.files.length})]}),e?null:r.jsx("div",{children:t.files.map(p=>r.jsx(NV,{active:l===p.path,file:p,group:t.id,onClick:()=>s(p.path),root:o,staging:u},p.path))})]})}function NV({active:e,file:t,group:s,onClick:n,root:o,staging:l}){const u=t.path.split("/").pop()||t.path,h=t.path.split("/").slice(0,-1).join("/"),m=o?_3(Su(o,t.path)):{},d=s==="staged";return r.jsxs("div",{className:ie("group flex w-full items-center gap-1.5 px-1 py-0.5 text-[12px] hover:bg-muted",e&&"bg-muted font-medium"),children:[r.jsxs("button",{"aria-label":`Open changed file ${t.path}`,className:"flex min-w-0 flex-1 items-center gap-1.5 text-left",onClick:n,type:"button",...m,children:[r.jsx(Ax,{path:t.path}),r.jsxs("span",{className:"flex min-w-0 flex-1 items-baseline gap-1.5 truncate",children:[r.jsx("span",{"data-testid":"changed-file-name",className:"shrink-0 truncate",children:u}),h?r.jsx("span",{"data-testid":"changed-file-dir",className:"min-w-0 truncate text-muted-foreground",children:h}):null]})]}),l?r.jsx("button",{"aria-label":`${d?"Unstage":"Stage"} ${t.path}`,className:"shrink-0 rounded p-0.5 text-muted-foreground opacity-0 transition-colors hover:bg-background hover:text-foreground focus:opacity-100 group-hover:opacity-100 disabled:opacity-50",disabled:l.busy,onClick:()=>d?l.onUnstage([t.path]):l.onStage([t.path]),title:d?"Unstage":"Stage",type:"button",children:d?r.jsx(aM,{className:"size-3.5"}):r.jsx(hs,{className:"size-3.5"})}):null,r.jsx("span",{className:ie("ml-1 shrink-0 font-mono text-[10px] font-semibold",s==="untracked"&&"text-amber-700 dark:text-amber-400",s==="staged"&&"text-emerald-700 dark:text-emerald-400",s==="unstaged"&&"text-zinc-800 dark:text-zinc-300"),children:CV(t,s)})]})}function CV(e,t){return t==="untracked"?"?":t==="staged"?e.index.trim():e.workingTree.trim()}function EV(e){return[{id:"unstaged",label:"Changes",files:e.filter(t=>!(t.index==="?"&&t.workingTree==="?")&&t.workingTree.trim())},{id:"staged",label:"Staged Changes",files:e.filter(t=>!(t.index==="?"&&t.workingTree==="?")&&t.index.trim()&&!t.workingTree.trim())},{id:"untracked",label:"Untracked Files",files:e.filter(t=>t.index==="?"&&t.workingTree==="?")}]}function O5({branch:e,files:t,onDone:s,repo:n}){const{sendToAgent:o}=At(),[l,u]=y.useState(""),[h,m]=y.useState(null),[d,p]=y.useState(null),[g,x]=y.useState(null),_=y.useMemo(()=>t.filter(C=>C.index.trim()&&C.index!=="?").map(C=>C.path),[t]),S=_.length>0&&l.trim().length>0&&h===null;async function w(C,T){m(C),p(null),x(null);try{if(await iC(l.trim(),n),T){const E=await pf(n);x(`Committed and pushed ${E.branch}.`)}else x("Committed staged changes.");u(""),s()}catch(E){p(E instanceof Error?E.message:String(E))}finally{m(null)}}function k(){o({prompt:mB({branch:e,stagedFiles:_}),source:{type:"git-commit",label:"commit message"},mode:"send",label:"Suggest a commit message"})}return r.jsxs("div",{className:"shrink-0 space-y-2 border-t border-border bg-card/95 p-2.5",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-tight text-muted-foreground",children:"Commit"}),r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[_.length," staged"]}),r.jsxs("button",{"aria-label":"Suggest a commit message with AI",className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-50",disabled:_.length===0,onClick:k,title:"Ask the agent to draft a commit message from the staged diff",type:"button",children:[r.jsx(Tt,{className:"size-3.5"}),"AI message"]})]})]}),r.jsx("textarea",{"aria-label":"Commit message",className:"min-h-16 w-full resize-y rounded-md border border-border bg-background px-2.5 py-1.5 text-[12px] outline-none transition-colors placeholder:text-muted-foreground focus:border-foreground/40 focus:ring-2 focus:ring-ring",onChange:C=>{u(C.target.value),p(null),x(null)},placeholder:_.length?"Commit message…":"Stage files to commit",value:l}),r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs(Y,{disabled:!S,onClick:()=>{w("commit",!1)},size:"sm",type:"button",variant:"outline",children:[h==="commit"?r.jsx(ht,{className:"size-3.5 animate-spin"}):r.jsx(tn,{className:"size-3.5"}),"Commit"]}),r.jsxs(Y,{disabled:!S,onClick:()=>{w("push",!0)},size:"sm",type:"button",children:[h==="push"?r.jsx(ht,{className:"size-3.5 animate-spin"}):r.jsx(Kb,{className:"size-3.5"}),"Commit & push"]})]}),d?r.jsx($e,{className:"px-2.5 py-1.5 text-[11px]",variant:"destructive",children:d}):g?r.jsx($e,{className:"px-2.5 py-1.5 text-[11px]",variant:"muted",children:g}):null]})}function jV(e){const t={name:"",path:"",children:[],isFile:!1},s=new Map;s.set("",t);const n=[...e].sort();for(const l of n){const u=l.split("/");let h="";for(let m=0;m<u.length;m+=1){const d=u[m],p=m===u.length-1,g=h?`${h}/${d}`:d;let x=s.get(g);x||(x={name:d,path:g,children:[],isFile:p},s.set(g,x),s.get(h)?.children.push(x)),h=g}}const o=l=>{l.children.sort((u,h)=>u.isFile!==h.isFile?u.isFile?1:-1:u.name.localeCompare(h.name)),l.children.forEach(o)};return o(t),t}function sk(e,t){const s={"":!0},n=o=>{for(const l of o.children)l.isFile||(s[l.path]=!0,t&&n(l))};return n(e),s}function nk({defaultExpandAll:e=!1,paths:t,status:s,selectedFile:n,onSelectFile:o,branch:l,emptyMessage:u="No tracked files.",root:h,title:m="Files"}){const d=y.useMemo(()=>jV(t),[t]),p=y.useMemo(()=>sk(d,e),[e,d]),g=y.useMemo(()=>sk(d,!0),[d]),x=Math.max(0,Object.keys(g).length-1),_=y.useMemo(()=>{const M=new Map;for(const z of s)M.set(z.path,z);return M},[s]),[S,w]=y.useState(p),[k,C]=y.useState(!1);y.useEffect(()=>{k||d.children.length===0||(w(p),C(!0))},[p,k,d.children.length]);function T(M){w(z=>({...z,[M]:!z[M]}))}function E(){w(g)}function j(){w({"":!0})}return r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border bg-card/95 px-2.5 py-1.5",children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-[12px] font-semibold tracking-tight",children:[r.jsx(so,{className:"size-3.5"}),r.jsx("span",{className:"truncate",children:m})]}),r.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[x>0?r.jsxs("span",{className:"flex items-center gap-0.5",children:[r.jsx("button",{"aria-label":"Expand all folders",className:"flex size-6 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:E,title:"Expand all folders",type:"button",children:r.jsx(UR,{className:"size-3.5"})}),r.jsx("button",{"aria-label":"Collapse all folders",className:"flex size-6 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:j,title:"Collapse all folders",type:"button",children:r.jsx($R,{className:"size-3.5"})})]}):null,l?r.jsx(M5,{branch:l}):null,r.jsx(ze,{variant:"secondary",children:t.length})]})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-auto py-1",children:d.children.length===0?r.jsx($e,{variant:"muted",className:"m-3 text-center",children:u}):d.children.map(M=>r.jsx(L5,{depth:0,expanded:S,node:M,onSelectFile:o,onToggle:T,root:h,selectedFile:n,statusByPath:_},M.path))})]})}function L5({depth:e,expanded:t,node:s,onSelectFile:n,onToggle:o,root:l,selectedFile:u,statusByPath:h}){const m=t[s.path]??!1,d=6+e*12,p=l?_3(Su(l,s.path)):{};if(s.isFile){const _=h.get(s.path),S=u===s.path;return r.jsxs("button",{className:ie("flex w-full items-center gap-1.5 px-1 py-0.5 text-left text-[12px] hover:bg-muted",S&&"bg-muted font-medium"),onClick:()=>n(s.path),style:{paddingLeft:d},type:"button",...p,children:[r.jsx(Ax,{path:s.path}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:s.name}),_?r.jsx(TV,{file:_}):null]})}const g=m?Mn:Jn,x=m?mf:so;return r.jsxs("div",{children:[r.jsxs("button",{className:"flex w-full items-center gap-1 py-0.5 text-left text-[12px] font-medium hover:bg-muted",onClick:()=>o(s.path),style:{paddingLeft:d},type:"button",...p,children:[r.jsx(g,{className:"size-3.5 shrink-0 text-muted-foreground"}),r.jsx(x,{className:"size-3.5 shrink-0 text-amber-600"}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:s.name})]}),m?s.children.map(_=>r.jsx(L5,{depth:e+1,expanded:t,node:_,onSelectFile:n,onToggle:o,root:l,selectedFile:u,statusByPath:h},_.path)):null]})}function TV({file:e}){const t=e.workingTree.trim()||e.index.trim();if(!t)return null;const s=e.index.trim()&&!e.workingTree.trim()?"text-emerald-700 dark:text-emerald-400":t==="?"?"text-amber-700 dark:text-amber-400":"text-zinc-700 dark:text-zinc-300";return r.jsx("span",{className:ie("ml-1 shrink-0 font-mono text-[10px] font-semibold",s),children:t})}const AV="modulepreload",RV=function(e){return"/"+e},ik={},MV=function(t,s,n){let o=Promise.resolve();if(s&&s.length>0){let m=function(d){return Promise.all(d.map(p=>Promise.resolve(p).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),h=u?.nonce||u?.getAttribute("nonce");o=m(s.map(d=>{if(d=RV(d),d in ik)return;ik[d]=!0;const p=d.endsWith(".css"),g=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${g}`))return;const x=document.createElement("link");if(x.rel=p?"stylesheet":AV,p||(x.as="script"),x.crossOrigin="",x.href=d,h&&x.setAttribute("nonce",h),document.head.appendChild(x),p)return new Promise((_,S)=>{x.addEventListener("load",_),x.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${d}`)))})}))}function l(u){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=u,window.dispatchEvent(h),!h.defaultPrevented)throw u}return o.then(u=>{for(const h of u||[])h.status==="rejected"&&l(h.reason);return t().catch(l)})};var kg,rk;function DV(){if(rk)return kg;rk=1;function e(F){return F instanceof Map?F.clear=F.delete=F.set=function(){throw new Error("map is read-only")}:F instanceof Set&&(F.add=F.clear=F.delete=function(){throw new Error("set is read-only")}),Object.freeze(F),Object.getOwnPropertyNames(F).forEach(oe=>{const ye=F[oe],qe=typeof ye;(qe==="object"||qe==="function")&&!Object.isFrozen(ye)&&e(ye)}),F}class t{constructor(oe){oe.data===void 0&&(oe.data={}),this.data=oe.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function s(F){return F.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function n(F,...oe){const ye=Object.create(null);for(const qe in F)ye[qe]=F[qe];return oe.forEach(function(qe){for(const Rt in qe)ye[Rt]=qe[Rt]}),ye}const o="</span>",l=F=>!!F.scope,u=(F,{prefix:oe})=>{if(F.startsWith("language:"))return F.replace("language:","language-");if(F.includes(".")){const ye=F.split(".");return[`${oe}${ye.shift()}`,...ye.map((qe,Rt)=>`${qe}${"_".repeat(Rt+1)}`)].join(" ")}return`${oe}${F}`};class h{constructor(oe,ye){this.buffer="",this.classPrefix=ye.classPrefix,oe.walk(this)}addText(oe){this.buffer+=s(oe)}openNode(oe){if(!l(oe))return;const ye=u(oe.scope,{prefix:this.classPrefix});this.span(ye)}closeNode(oe){l(oe)&&(this.buffer+=o)}value(){return this.buffer}span(oe){this.buffer+=`<span class="${oe}">`}}const m=(F={})=>{const oe={children:[]};return Object.assign(oe,F),oe};class d{constructor(){this.rootNode=m(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(oe){this.top.children.push(oe)}openNode(oe){const ye=m({scope:oe});this.add(ye),this.stack.push(ye)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(oe){return this.constructor._walk(oe,this.rootNode)}static _walk(oe,ye){return typeof ye=="string"?oe.addText(ye):ye.children&&(oe.openNode(ye),ye.children.forEach(qe=>this._walk(oe,qe)),oe.closeNode(ye)),oe}static _collapse(oe){typeof oe!="string"&&oe.children&&(oe.children.every(ye=>typeof ye=="string")?oe.children=[oe.children.join("")]:oe.children.forEach(ye=>{d._collapse(ye)}))}}class p extends d{constructor(oe){super(),this.options=oe}addText(oe){oe!==""&&this.add(oe)}startScope(oe){this.openNode(oe)}endScope(){this.closeNode()}__addSublanguage(oe,ye){const qe=oe.root;ye&&(qe.scope=`language:${ye}`),this.add(qe)}toHTML(){return new h(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function g(F){return F?typeof F=="string"?F:F.source:null}function x(F){return w("(?=",F,")")}function _(F){return w("(?:",F,")*")}function S(F){return w("(?:",F,")?")}function w(...F){return F.map(ye=>g(ye)).join("")}function k(F){const oe=F[F.length-1];return typeof oe=="object"&&oe.constructor===Object?(F.splice(F.length-1,1),oe):{}}function C(...F){return"("+(k(F).capture?"":"?:")+F.map(qe=>g(qe)).join("|")+")"}function T(F){return new RegExp(F.toString()+"|").exec("").length-1}function E(F,oe){const ye=F&&F.exec(oe);return ye&&ye.index===0}const j=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function M(F,{joinWith:oe}){let ye=0;return F.map(qe=>{ye+=1;const Rt=ye;let Nt=g(qe),Me="";for(;Nt.length>0;){const Ne=j.exec(Nt);if(!Ne){Me+=Nt;break}Me+=Nt.substring(0,Ne.index),Nt=Nt.substring(Ne.index+Ne[0].length),Ne[0][0]==="\\"&&Ne[1]?Me+="\\"+String(Number(Ne[1])+Rt):(Me+=Ne[0],Ne[0]==="("&&ye++)}return Me}).map(qe=>`(${qe})`).join(oe)}const z=/\b\B/,O="[a-zA-Z]\\w*",A="[a-zA-Z_]\\w*",D="\\b\\d+(\\.\\d+)?",B="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",P="\\b(0b[01]+)",H="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",$=(F={})=>{const oe=/^#![ ]*\//;return F.binary&&(F.begin=w(oe,/.*\b/,F.binary,/\b.*/)),n({scope:"meta",begin:oe,end:/$/,relevance:0,"on:begin":(ye,qe)=>{ye.index!==0&&qe.ignoreMatch()}},F)},q={begin:"\\\\[\\s\\S]",relevance:0},V={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[q]},I={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[q]},W={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},Z=function(F,oe,ye={}){const qe=n({scope:"comment",begin:F,end:oe,contains:[]},ye);qe.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const Rt=C("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return qe.contains.push({begin:w(/[ ]+/,"(",Rt,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),qe},K=Z("//","$"),te=Z("/\\*","\\*/"),L=Z("#","$"),Q={scope:"number",begin:D,relevance:0},re={scope:"number",begin:B,relevance:0},he={scope:"number",begin:P,relevance:0},fe={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[q,{begin:/\[/,end:/\]/,relevance:0,contains:[q]}]},pe={scope:"title",begin:O,relevance:0},we={scope:"title",begin:A,relevance:0},Le={begin:"\\.\\s*"+A,relevance:0};var We=Object.freeze({__proto__:null,APOS_STRING_MODE:V,BACKSLASH_ESCAPE:q,BINARY_NUMBER_MODE:he,BINARY_NUMBER_RE:P,COMMENT:Z,C_BLOCK_COMMENT_MODE:te,C_LINE_COMMENT_MODE:K,C_NUMBER_MODE:re,C_NUMBER_RE:B,END_SAME_AS_BEGIN:function(F){return Object.assign(F,{"on:begin":(oe,ye)=>{ye.data._beginMatch=oe[1]},"on:end":(oe,ye)=>{ye.data._beginMatch!==oe[1]&&ye.ignoreMatch()}})},HASH_COMMENT_MODE:L,IDENT_RE:O,MATCH_NOTHING_RE:z,METHOD_GUARD:Le,NUMBER_MODE:Q,NUMBER_RE:D,PHRASAL_WORDS_MODE:W,QUOTE_STRING_MODE:I,REGEXP_MODE:fe,RE_STARTERS_RE:H,SHEBANG:$,TITLE_MODE:pe,UNDERSCORE_IDENT_RE:A,UNDERSCORE_TITLE_MODE:we});function ge(F,oe){F.input[F.index-1]==="."&&oe.ignoreMatch()}function Te(F,oe){F.className!==void 0&&(F.scope=F.className,delete F.className)}function Re(F,oe){oe&&F.beginKeywords&&(F.begin="\\b("+F.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",F.__beforeBegin=ge,F.keywords=F.keywords||F.beginKeywords,delete F.beginKeywords,F.relevance===void 0&&(F.relevance=0))}function Pt(F,oe){Array.isArray(F.illegal)&&(F.illegal=C(...F.illegal))}function Pi(F,oe){if(F.match){if(F.begin||F.end)throw new Error("begin & end are not supported with match");F.begin=F.match,delete F.match}}function ii(F,oe){F.relevance===void 0&&(F.relevance=1)}const kr=(F,oe)=>{if(!F.beforeMatch)return;if(F.starts)throw new Error("beforeMatch cannot be used with starts");const ye=Object.assign({},F);Object.keys(F).forEach(qe=>{delete F[qe]}),F.keywords=ye.keywords,F.begin=w(ye.beforeMatch,x(ye.begin)),F.starts={relevance:0,contains:[Object.assign(ye,{endsParent:!0})]},F.relevance=0,delete ye.beforeMatch},$i=["of","and","for","in","not","or","if","then","parent","list","value"],Hi="keyword";function _e(F,oe,ye=Hi){const qe=Object.create(null);return typeof F=="string"?Rt(ye,F.split(" ")):Array.isArray(F)?Rt(ye,F):Object.keys(F).forEach(function(Nt){Object.assign(qe,_e(F[Nt],oe,Nt))}),qe;function Rt(Nt,Me){oe&&(Me=Me.map(Ne=>Ne.toLowerCase())),Me.forEach(function(Ne){const Fe=Ne.split("|");qe[Fe[0]]=[Nt,ft(Fe[0],Fe[1])]})}}function ft(F,oe){return oe?Number(oe):bn(F)?0:1}function bn(F){return $i.includes(F.toLowerCase())}const Ts={},gt=F=>{console.error(F)},ri=(F,...oe)=>{console.log(`WARN: ${F}`,...oe)},fs=(F,oe)=>{Ts[`${F}/${oe}`]||(console.log(`Deprecated as of ${F}. ${oe}`),Ts[`${F}/${oe}`]=!0)},Ui=new Error;function Fi(F,oe,{key:ye}){let qe=0;const Rt=F[ye],Nt={},Me={};for(let Ne=1;Ne<=oe.length;Ne++)Me[Ne+qe]=Rt[Ne],Nt[Ne+qe]=!0,qe+=T(oe[Ne-1]);F[ye]=Me,F[ye]._emit=Nt,F[ye]._multi=!0}function oo(F){if(Array.isArray(F.begin)){if(F.skip||F.excludeBegin||F.returnBegin)throw gt("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Ui;if(typeof F.beginScope!="object"||F.beginScope===null)throw gt("beginScope must be object"),Ui;Fi(F,F.begin,{key:"beginScope"}),F.begin=M(F.begin,{joinWith:""})}}function Nr(F){if(Array.isArray(F.end)){if(F.skip||F.excludeEnd||F.returnEnd)throw gt("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Ui;if(typeof F.endScope!="object"||F.endScope===null)throw gt("endScope must be object"),Ui;Fi(F,F.end,{key:"endScope"}),F.end=M(F.end,{joinWith:""})}}function wl(F){F.scope&&typeof F.scope=="object"&&F.scope!==null&&(F.beginScope=F.scope,delete F.scope)}function lo(F){wl(F),typeof F.beginScope=="string"&&(F.beginScope={_wrap:F.beginScope}),typeof F.endScope=="string"&&(F.endScope={_wrap:F.endScope}),oo(F),Nr(F)}function qi(F){function oe(Me,Ne){return new RegExp(g(Me),"m"+(F.case_insensitive?"i":"")+(F.unicodeRegex?"u":"")+(Ne?"g":""))}class ye{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(Ne,Fe){Fe.position=this.position++,this.matchIndexes[this.matchAt]=Fe,this.regexes.push([Fe,Ne]),this.matchAt+=T(Ne)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const Ne=this.regexes.map(Fe=>Fe[1]);this.matcherRe=oe(M(Ne,{joinWith:"|"}),!0),this.lastIndex=0}exec(Ne){this.matcherRe.lastIndex=this.lastIndex;const Fe=this.matcherRe.exec(Ne);if(!Fe)return null;const Yt=Fe.findIndex((Vi,uo)=>uo>0&&Vi!==void 0),zt=this.matchIndexes[Yt];return Fe.splice(0,Yt),Object.assign(Fe,zt)}}class qe{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(Ne){if(this.multiRegexes[Ne])return this.multiRegexes[Ne];const Fe=new ye;return this.rules.slice(Ne).forEach(([Yt,zt])=>Fe.addRule(Yt,zt)),Fe.compile(),this.multiRegexes[Ne]=Fe,Fe}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(Ne,Fe){this.rules.push([Ne,Fe]),Fe.type==="begin"&&this.count++}exec(Ne){const Fe=this.getMatcher(this.regexIndex);Fe.lastIndex=this.lastIndex;let Yt=Fe.exec(Ne);if(this.resumingScanAtSamePosition()&&!(Yt&&Yt.index===this.lastIndex)){const zt=this.getMatcher(0);zt.lastIndex=this.lastIndex+1,Yt=zt.exec(Ne)}return Yt&&(this.regexIndex+=Yt.position+1,this.regexIndex===this.count&&this.considerAll()),Yt}}function Rt(Me){const Ne=new qe;return Me.contains.forEach(Fe=>Ne.addRule(Fe.begin,{rule:Fe,type:"begin"})),Me.terminatorEnd&&Ne.addRule(Me.terminatorEnd,{type:"end"}),Me.illegal&&Ne.addRule(Me.illegal,{type:"illegal"}),Ne}function Nt(Me,Ne){const Fe=Me;if(Me.isCompiled)return Fe;[Te,Pi,lo,kr].forEach(zt=>zt(Me,Ne)),F.compilerExtensions.forEach(zt=>zt(Me,Ne)),Me.__beforeBegin=null,[Re,Pt,ii].forEach(zt=>zt(Me,Ne)),Me.isCompiled=!0;let Yt=null;return typeof Me.keywords=="object"&&Me.keywords.$pattern&&(Me.keywords=Object.assign({},Me.keywords),Yt=Me.keywords.$pattern,delete Me.keywords.$pattern),Yt=Yt||/\w+/,Me.keywords&&(Me.keywords=_e(Me.keywords,F.case_insensitive)),Fe.keywordPatternRe=oe(Yt,!0),Ne&&(Me.begin||(Me.begin=/\B|\b/),Fe.beginRe=oe(Fe.begin),!Me.end&&!Me.endsWithParent&&(Me.end=/\B|\b/),Me.end&&(Fe.endRe=oe(Fe.end)),Fe.terminatorEnd=g(Fe.end)||"",Me.endsWithParent&&Ne.terminatorEnd&&(Fe.terminatorEnd+=(Me.end?"|":"")+Ne.terminatorEnd)),Me.illegal&&(Fe.illegalRe=oe(Me.illegal)),Me.contains||(Me.contains=[]),Me.contains=[].concat(...Me.contains.map(function(zt){return Dn(zt==="self"?Me:zt)})),Me.contains.forEach(function(zt){Nt(zt,Fe)}),Me.starts&&Nt(Me.starts,Ne),Fe.matcher=Rt(Fe),Fe}if(F.compilerExtensions||(F.compilerExtensions=[]),F.contains&&F.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return F.classNameAliases=n(F.classNameAliases||{}),Nt(F)}function ys(F){return F?F.endsWithParent||ys(F.starts):!1}function Dn(F){return F.variants&&!F.cachedVariants&&(F.cachedVariants=F.variants.map(function(oe){return n(F,{variants:null},oe)})),F.cachedVariants?F.cachedVariants:ys(F)?n(F,{starts:F.starts?n(F.starts):null}):Object.isFrozen(F)?n(F):F}var As="11.11.1";class kl extends Error{constructor(oe,ye){super(oe),this.name="HTMLInjectionError",this.html=ye}}const ga=s,co=n,lt=Symbol("nomatch"),ai=7,xn=function(F){const oe=Object.create(null),ye=Object.create(null),qe=[];let Rt=!0;const Nt="Could not find the language '{}', did you forget to load/include a language module?",Me={disableAutodetect:!0,name:"Plain text",contains:[]};let Ne={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:p};function Fe(me){return Ne.noHighlightRe.test(me)}function Yt(me){let Be=me.className+" ";Be+=me.parentNode?me.parentNode.className:"";const et=Ne.languageDetectRe.exec(Be);if(et){const bt=Ks(et[1]);return bt||(ri(Nt.replace("{}",et[1])),ri("Falling back to no-highlight mode for this block.",me)),bt?et[1]:"no-highlight"}return Be.split(/\s+/).find(bt=>Fe(bt)||Ks(bt))}function zt(me,Be,et){let bt="",Zt="";typeof Be=="object"?(bt=me,et=Be.ignoreIllegals,Zt=Be.language):(fs("10.7.0","highlight(lang, code, ...args) has been deprecated."),fs("10.7.0",`Please use highlight(code, options) instead.
173
+ https://github.com/highlightjs/highlight.js/issues/2277`),Zt=me,bt=Be),et===void 0&&(et=!0);const Us={code:bt,language:Zt};xa("before:highlight",Us);const vn=Us.result?Us.result:Vi(Us.language,Us.code,et);return vn.code=Us.code,xa("after:highlight",vn),vn}function Vi(me,Be,et,bt){const Zt=Object.create(null);function Us(xe,De){return xe.keywords[De]}function vn(){if(!Ue.keywords){ss.addText(xt);return}let xe=0;Ue.keywordPatternRe.lastIndex=0;let De=Ue.keywordPatternRe.exec(xt),Ke="";for(;De;){Ke+=xt.substring(xe,De.index);const it=Rs.case_insensitive?De[0].toLowerCase():De[0],$t=Us(Ue,it);if($t){const[On,Al]=$t;if(ss.addText(Ke),Ke="",Zt[it]=(Zt[it]||0)+1,Zt[it]<=ai&&(Tr+=Al),On.startsWith("_"))Ke+=De[0];else{const Ou=Rs.classNameAliases[On]||On;_n(De[0],Ou)}}else Ke+=De[0];xe=Ue.keywordPatternRe.lastIndex,De=Ue.keywordPatternRe.exec(xt)}Ke+=xt.substring(xe),ss.addText(Ke)}function an(){if(xt==="")return;let xe=null;if(typeof Ue.subLanguage=="string"){if(!oe[Ue.subLanguage]){ss.addText(xt);return}xe=Vi(Ue.subLanguage,xt,!0,Du[Ue.subLanguage]),Du[Ue.subLanguage]=xe._top}else xe=ho(xt,Ue.subLanguage.length?Ue.subLanguage:null);Ue.relevance>0&&(Tr+=xe.relevance),ss.__addSublanguage(xe._emitter,xe.language)}function jt(){Ue.subLanguage!=null?an():vn(),xt=""}function _n(xe,De){xe!==""&&(ss.startScope(De),ss.addText(xe),ss.endScope())}function Ru(xe,De){let Ke=1;const it=De.length-1;for(;Ke<=it;){if(!xe._emit[Ke]){Ke++;continue}const $t=Rs.classNameAliases[xe[Ke]]||xe[Ke],On=De[Ke];$t?_n(On,$t):(xt=On,vn(),xt=""),Ke++}}function mo(xe,De){return xe.scope&&typeof xe.scope=="string"&&ss.openNode(Rs.classNameAliases[xe.scope]||xe.scope),xe.beginScope&&(xe.beginScope._wrap?(_n(xt,Rs.classNameAliases[xe.beginScope._wrap]||xe.beginScope._wrap),xt=""):xe.beginScope._multi&&(Ru(xe.beginScope,De),xt="")),Ue=Object.create(xe,{parent:{value:Ue}}),Ue}function El(xe,De,Ke){let it=E(xe.endRe,Ke);if(it){if(xe["on:end"]){const $t=new t(xe);xe["on:end"](De,$t),$t.isMatchIgnored&&(it=!1)}if(it){for(;xe.endsParent&&xe.parent;)xe=xe.parent;return xe}}if(xe.endsWithParent)return El(xe.parent,De,Ke)}function po(xe){return Ue.matcher.regexIndex===0?(xt+=xe[0],1):(Ar=!0,0)}function Af(xe){const De=xe[0],Ke=xe.rule,it=new t(Ke),$t=[Ke.__beforeBegin,Ke["on:begin"]];for(const On of $t)if(On&&(On(xe,it),it.isMatchIgnored))return po(De);return Ke.skip?xt+=De:(Ke.excludeBegin&&(xt+=De),jt(),!Ke.returnBegin&&!Ke.excludeBegin&&(xt=De)),mo(Ke,xe),Ke.returnBegin?0:De.length}function on(xe){const De=xe[0],Ke=Be.substring(xe.index),it=El(Ue,xe,Ke);if(!it)return lt;const $t=Ue;Ue.endScope&&Ue.endScope._wrap?(jt(),_n(De,Ue.endScope._wrap)):Ue.endScope&&Ue.endScope._multi?(jt(),Ru(Ue.endScope,xe)):$t.skip?xt+=De:($t.returnEnd||$t.excludeEnd||(xt+=De),jt(),$t.excludeEnd&&(xt=De));do Ue.scope&&ss.closeNode(),!Ue.skip&&!Ue.subLanguage&&(Tr+=Ue.relevance),Ue=Ue.parent;while(Ue!==it.parent);return it.starts&&mo(it.starts,xe),$t.returnEnd?0:De.length}function jl(){const xe=[];for(let De=Ue;De!==Rs;De=De.parent)De.scope&&xe.unshift(De.scope);xe.forEach(De=>ss.openNode(De))}let va={};function go(xe,De){const Ke=De&&De[0];if(xt+=xe,Ke==null)return jt(),0;if(va.type==="begin"&&De.type==="end"&&va.index===De.index&&Ke===""){if(xt+=Be.slice(De.index,De.index+1),!Rt){const it=new Error(`0 width match regex (${me})`);throw it.languageName=me,it.badRule=va.rule,it}return 1}if(va=De,De.type==="begin")return Af(De);if(De.type==="illegal"&&!et){const it=new Error('Illegal lexeme "'+Ke+'" for mode "'+(Ue.scope||"<unnamed>")+'"');throw it.mode=Ue,it}else if(De.type==="end"){const it=on(De);if(it!==lt)return it}if(De.type==="illegal"&&Ke==="")return xt+=`
174
+ `,1;if(Tl>1e5&&Tl>De.index*3)throw new Error("potential infinite loop, way more iterations than matches");return xt+=Ke,Ke.length}const Rs=Ks(me);if(!Rs)throw gt(Nt.replace("{}",me)),new Error('Unknown language: "'+me+'"');const Mu=qi(Rs);let bo="",Ue=bt||Mu;const Du={},ss=new Ne.__emitter(Ne);jl();let xt="",Tr=0,Ki=0,Tl=0,Ar=!1;try{if(Rs.__emitTokens)Rs.__emitTokens(Be,ss);else{for(Ue.matcher.considerAll();;){Tl++,Ar?Ar=!1:Ue.matcher.considerAll(),Ue.matcher.lastIndex=Ki;const xe=Ue.matcher.exec(Be);if(!xe)break;const De=Be.substring(Ki,xe.index),Ke=go(De,xe);Ki=xe.index+Ke}go(Be.substring(Ki))}return ss.finalize(),bo=ss.toHTML(),{language:me,value:bo,relevance:Tr,illegal:!1,_emitter:ss,_top:Ue}}catch(xe){if(xe.message&&xe.message.includes("Illegal"))return{language:me,value:ga(Be),illegal:!0,relevance:0,_illegalBy:{message:xe.message,index:Ki,context:Be.slice(Ki-100,Ki+100),mode:xe.mode,resultSoFar:bo},_emitter:ss};if(Rt)return{language:me,value:ga(Be),illegal:!1,relevance:0,errorRaised:xe,_emitter:ss,_top:Ue};throw xe}}function uo(me){const Be={value:ga(me),illegal:!1,relevance:0,_top:Me,_emitter:new Ne.__emitter(Ne)};return Be._emitter.addText(me),Be}function ho(me,Be){Be=Be||Ne.languages||Object.keys(oe);const et=uo(me),bt=Be.filter(Ks).filter(Er).map(jt=>Vi(jt,me,!1));bt.unshift(et);const Zt=bt.sort((jt,_n)=>{if(jt.relevance!==_n.relevance)return _n.relevance-jt.relevance;if(jt.language&&_n.language){if(Ks(jt.language).supersetOf===_n.language)return 1;if(Ks(_n.language).supersetOf===jt.language)return-1}return 0}),[Us,vn]=Zt,an=Us;return an.secondBest=vn,an}function _i(me,Be,et){const bt=Be&&ye[Be]||et;me.classList.add("hljs"),me.classList.add(`language-${bt}`)}function Xt(me){let Be=null;const et=Yt(me);if(Fe(et))return;if(xa("before:highlightElement",{el:me,language:et}),me.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",me);return}if(me.children.length>0&&(Ne.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(me)),Ne.throwUnescapedHTML))throw new kl("One of your code blocks includes unescaped HTML.",me.innerHTML);Be=me;const bt=Be.textContent,Zt=et?zt(bt,{language:et,ignoreIllegals:!0}):ho(bt);me.innerHTML=Zt.value,me.dataset.highlighted="yes",_i(me,et,Zt.language),me.result={language:Zt.language,re:Zt.relevance,relevance:Zt.relevance},Zt.secondBest&&(me.secondBest={language:Zt.secondBest.language,relevance:Zt.secondBest.relevance}),xa("after:highlightElement",{el:me,result:Zt,text:bt})}function Hs(me){Ne=co(Ne,me)}const Cr=()=>{fo(),fs("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Nl(){fo(),fs("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let ju=!1;function fo(){function me(){fo()}if(document.readyState==="loading"){ju||window.addEventListener("DOMContentLoaded",me,!1),ju=!0;return}document.querySelectorAll(Ne.cssSelector).forEach(Xt)}function Tu(me,Be){let et=null;try{et=Be(F)}catch(bt){if(gt("Language definition for '{}' could not be registered.".replace("{}",me)),Rt)gt(bt);else throw bt;et=Me}et.name||(et.name=me),oe[me]=et,et.rawDefinition=Be.bind(null,F),et.aliases&&Gi(et.aliases,{languageName:me})}function ba(me){delete oe[me];for(const Be of Object.keys(ye))ye[Be]===me&&delete ye[Be]}function Cl(){return Object.keys(oe)}function Ks(me){return me=(me||"").toLowerCase(),oe[me]||oe[ye[me]]}function Gi(me,{languageName:Be}){typeof me=="string"&&(me=[me]),me.forEach(et=>{ye[et.toLowerCase()]=Be})}function Er(me){const Be=Ks(me);return Be&&!Be.disableAutodetect}function jr(me){me["before:highlightBlock"]&&!me["before:highlightElement"]&&(me["before:highlightElement"]=Be=>{me["before:highlightBlock"](Object.assign({block:Be.el},Be))}),me["after:highlightBlock"]&&!me["after:highlightElement"]&&(me["after:highlightElement"]=Be=>{me["after:highlightBlock"](Object.assign({block:Be.el},Be))})}function ts(me){jr(me),qe.push(me)}function Au(me){const Be=qe.indexOf(me);Be!==-1&&qe.splice(Be,1)}function xa(me,Be){const et=me;qe.forEach(function(bt){bt[et]&&bt[et](Be)})}function Wi(me){return fs("10.7.0","highlightBlock will be removed entirely in v12.0"),fs("10.7.0","Please use highlightElement now."),Xt(me)}Object.assign(F,{highlight:zt,highlightAuto:ho,highlightAll:fo,highlightElement:Xt,highlightBlock:Wi,configure:Hs,initHighlighting:Cr,initHighlightingOnLoad:Nl,registerLanguage:Tu,unregisterLanguage:ba,listLanguages:Cl,getLanguage:Ks,registerAliases:Gi,autoDetection:Er,inherit:co,addPlugin:ts,removePlugin:Au}),F.debugMode=function(){Rt=!1},F.safeMode=function(){Rt=!0},F.versionString=As,F.regex={concat:w,lookahead:x,either:C,optional:S,anyNumberOfTimes:_};for(const me in We)typeof We[me]=="object"&&e(We[me]);return Object.assign(F,We),F},$s=xn({});return $s.newInstance=()=>xn({}),kg=$s,$s.HighlightJS=$s,$s.default=$s,kg}var Ng,ak;function OV(){if(ak)return Ng;ak=1;function e(t){const s=t.regex,n=s.concat(/[\p{L}_]/u,s.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),o=/[\p{L}0-9._:-]+/u,l={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},u={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},h=t.inherit(u,{begin:/\(/,end:/\)/}),m=t.inherit(t.APOS_STRING_MODE,{className:"string"}),d=t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),p={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:o,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[l]},{begin:/'/,end:/'/,contains:[l]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[u,d,m,h,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[u,h,d,m]}]}]},t.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},l,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[d]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[p],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[p],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:s.concat(/</,s.lookahead(s.concat(n,s.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:p}]},{className:"tag",begin:s.concat(/<\//,s.lookahead(s.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}return Ng=e,Ng}var Cg,ok;function LV(){if(ok)return Cg;ok=1;function e(t){const s=t.regex,n={},o={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:s.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},o]});const l={className:"subst",begin:/\$\(/,end:/\)/,contains:[t.BACKSLASH_ESCAPE]},u=t.inherit(t.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),h={begin:/<<-?\s*(?=\w+)/,starts:{contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},m={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,n,l]};l.contains.push(m);const d={match:/\\"/},p={className:"string",begin:/'/,end:/'/},g={match:/\\'/},x={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},t.NUMBER_MODE,n]},_=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],S=t.SHEBANG({binary:`(${_.join("|")})`,relevance:10}),w={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[t.inherit(t.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},k=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],C=["true","false"],T={match:/(\/[a-z._-]+)+/},E=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],j=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],M=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],z=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:k,literal:C,built_in:[...E,...j,"set","shopt",...M,...z]},contains:[S,t.SHEBANG(),w,x,u,h,T,m,d,p,g,n]}}return Cg=e,Cg}var Eg,lk;function zV(){if(lk)return Eg;lk=1;function e(t){const s=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),o="decltype\\(auto\\)",l="[a-zA-Z_]\\w*::",h="("+o+"|"+s.optional(l)+"[a-zA-Z_]\\w*"+s.optional("<[^<>]+>")+")",m={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},p={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},g={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},x={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(p,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},_={className:"title",begin:s.optional(l)+t.IDENT_RE,relevance:0},S=s.optional(l)+t.IDENT_RE+"\\s*\\(",C={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},T=[x,m,n,t.C_BLOCK_COMMENT_MODE,g,p],E={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:C,contains:T.concat([{begin:/\(/,end:/\)/,keywords:C,contains:T.concat(["self"]),relevance:0}]),relevance:0},j={begin:"("+h+"[\\*&\\s]+)+"+S,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:C,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:o,keywords:C,relevance:0},{begin:S,returnBegin:!0,contains:[t.inherit(_,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:C,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,p,g,m,{begin:/\(/,end:/\)/,keywords:C,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,p,g,m]}]},m,n,t.C_BLOCK_COMMENT_MODE,x]};return{name:"C",aliases:["h"],keywords:C,disableAutodetect:!0,illegal:"</",contains:[].concat(E,j,T,[x,{begin:t.IDENT_RE+"::",keywords:C},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},t.TITLE_MODE]}]),exports:{preprocessor:x,strings:p,keywords:C}}}return Eg=e,Eg}var jg,ck;function BV(){if(ck)return jg;ck=1;function e(t){const s=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),o="decltype\\(auto\\)",l="[a-zA-Z_]\\w*::",h="(?!struct)("+o+"|"+s.optional(l)+"[a-zA-Z_]\\w*"+s.optional("<[^<>]+>")+")",m={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},p={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},g={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},x={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(p,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},_={className:"title",begin:s.optional(l)+t.IDENT_RE,relevance:0},S=s.optional(l)+t.IDENT_RE+"\\s*\\(",w=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],k=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],C=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],T=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],M={type:k,keyword:w,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:C},z={className:"function.dispatch",relevance:0,keywords:{_hint:T},begin:s.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,s.lookahead(/(<[^<>]+>|)\s*\(/))},O=[z,x,m,n,t.C_BLOCK_COMMENT_MODE,g,p],A={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:M,contains:O.concat([{begin:/\(/,end:/\)/,keywords:M,contains:O.concat(["self"]),relevance:0}]),relevance:0},D={className:"function",begin:"("+h+"[\\*&\\s]+)+"+S,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:M,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:o,keywords:M,relevance:0},{begin:S,returnBegin:!0,contains:[_],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[p,g]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:M,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,p,g,m,{begin:/\(/,end:/\)/,keywords:M,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,p,g,m]}]},m,n,t.C_BLOCK_COMMENT_MODE,x]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:M,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(A,D,z,O,[x,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:M,contains:["self",m]},{begin:t.IDENT_RE+"::",keywords:M},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}return jg=e,jg}var Tg,uk;function IV(){if(uk)return Tg;uk=1;function e(t){const s=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],n=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],o=["default","false","null","true"],l=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],u=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],h={keyword:l.concat(u),built_in:s,literal:o},m=t.inherit(t.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),d={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},p={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},g={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},x=t.inherit(g,{illegal:/\n/}),_={className:"subst",begin:/\{/,end:/\}/,keywords:h},S=t.inherit(_,{illegal:/\n/}),w={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},t.BACKSLASH_ESCAPE,S]},k={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},_]},C=t.inherit(k,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},S]});_.contains=[k,w,g,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,d,t.C_BLOCK_COMMENT_MODE],S.contains=[C,w,x,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,d,t.inherit(t.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const T={variants:[p,k,w,g,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},E={begin:"<",end:">",contains:[{beginKeywords:"in out"},m]},j=t.IDENT_RE+"(<"+t.IDENT_RE+"(\\s*,\\s*"+t.IDENT_RE+")*>)?(\\[\\])?",M={begin:"@"+t.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:h,illegal:/::/,contains:[t.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:"<!--|-->"},{begin:"</?",end:">"}]}]}),t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},T,d,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},m,E,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[m,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[m,E,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+j+"\\s+)+"+t.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:h,contains:[{beginKeywords:n.join(" "),relevance:0},{begin:t.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[t.TITLE_MODE,E],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,relevance:0,contains:[T,d,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},M]}}return Tg=e,Tg}var Ag,dk;function PV(){if(dk)return Ag;dk=1;const e=d=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:d.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[d.APOS_STRING_MODE,d.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:d.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),t=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],s=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],n=[...t,...s],o=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),l=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),u=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),h=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function m(d){const p=d.regex,g=e(d),x={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},_="and or not only",S=/@-?\w[\w]*(-\w+)*/,w="[a-zA-Z-][a-zA-Z0-9_-]*",k=[d.APOS_STRING_MODE,d.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[g.BLOCK_COMMENT,x,g.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+w,relevance:0},g.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+l.join("|")+")"},{begin:":(:)?("+u.join("|")+")"}]},g.CSS_VARIABLE,{className:"attribute",begin:"\\b("+h.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[g.BLOCK_COMMENT,g.HEXCOLOR,g.IMPORTANT,g.CSS_NUMBER_MODE,...k,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...k,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},g.FUNCTION_DISPATCH]},{begin:p.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:S},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:_,attribute:o.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...k,g.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+n.join("|")+")\\b"}]}}return Ag=m,Ag}var Rg,hk;function $V(){if(hk)return Rg;hk=1;function e(t){const s=t.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},o={begin:"^[-\\*]{3,}",end:"$"},l={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},u={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},h={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},m=/[A-Za-z][A-Za-z0-9+.-]*/,d={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:s.concat(/\[.+?\]\(/,m,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},p={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},g={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},x=t.inherit(p,{contains:[]}),_=t.inherit(g,{contains:[]});p.contains.push(_),g.contains.push(x);let S=[n,d];return[p,g,x,_].forEach(T=>{T.contains=T.contains.concat(S)}),S=S.concat(p,g),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:S},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:S}]}]},n,u,p,g,{className:"quote",begin:"^>\\s+",contains:S,end:"$"},l,o,d,h,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}return Rg=e,Rg}var Mg,fk;function HV(){if(fk)return Mg;fk=1;function e(t){const s=t.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:s.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:s.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}return Mg=e,Mg}var Dg,mk;function UV(){if(mk)return Dg;mk=1;function e(t){const s=t.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",o=s.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),l=s.concat(o,/(::\w+)*/),h={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},m={className:"doctag",begin:"@[A-Za-z]+"},d={begin:"#<",end:">"},p=[t.COMMENT("#","$",{contains:[m]}),t.COMMENT("^=begin","^=end",{contains:[m],relevance:10}),t.COMMENT("^__END__",t.MATCH_NOTHING_RE)],g={className:"subst",begin:/#\{/,end:/\}/,keywords:h},x={className:"string",contains:[t.BACKSLASH_ESCAPE,g],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:s.concat(/<<[-~]?'?/,s.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[t.BACKSLASH_ESCAPE,g]})]}]},_="[1-9](_?[0-9])*|0",S="[0-9](_?[0-9])*",w={className:"number",relevance:0,variants:[{begin:`\\b(${_})(\\.(${S}))?([eE][+-]?(${S})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},k={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:h}]},O=[x,{variants:[{match:[/class\s+/,l,/\s+<\s+/,l]},{match:[/\b(class|module)\s+/,l]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:h},{match:[/(include|extend)\s+/,l],scope:{2:"title.class"},keywords:h},{relevance:0,match:[l,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:o,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[k]},{begin:t.IDENT_RE+"::"},{className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[x,{begin:n}],relevance:0},w,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:h},{begin:"("+t.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[t.BACKSLASH_ESCAPE,g],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(d,p),relevance:0}].concat(d,p);g.contains=O,k.contains=O;const P=[{begin:/^\s*=>/,starts:{end:"$",contains:O}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:h,contains:O}}];return p.unshift(d),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:h,illegal:/\/\*/,contains:[t.SHEBANG({binary:"ruby"})].concat(P).concat(p).concat(O)}}return Dg=e,Dg}var Og,pk;function FV(){if(pk)return Og;pk=1;function e(t){const u={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:u,illegal:"</",contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{className:"string",variants:[t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[t.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:u,illegal:/["']/}]}]}}return Og=e,Og}var Lg,gk;function qV(){if(gk)return Lg;gk=1;function e(t){const s=t.regex,n=/[_A-Za-z][_0-9A-Za-z]*/;return{name:"GraphQL",aliases:["gql"],case_insensitive:!0,disableAutodetect:!1,keywords:{keyword:["query","mutation","subscription","type","input","schema","directive","interface","union","scalar","fragment","enum","on"],literal:["true","false","null"]},contains:[t.HASH_COMMENT_MODE,t.QUOTE_STRING_MODE,t.NUMBER_MODE,{scope:"punctuation",match:/[.]{3}/,relevance:0},{scope:"punctuation",begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:"variable",begin:/\$/,end:/\W/,excludeEnd:!0,relevance:0},{scope:"meta",match:/@\w+/,excludeEnd:!0},{scope:"symbol",begin:s.concat(n,s.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}}return Lg=e,Lg}var zg,bk;function VV(){if(bk)return zg;bk=1;function e(t){const s=t.regex,n={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:t.NUMBER_RE}]},o=t.COMMENT();o.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];const l={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},u={className:"literal",begin:/\bon|off|true|false|yes|no\b/},h={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},m={begin:/\[/,end:/\]/,contains:[o,u,l,h,n,"self"],relevance:0},d=/[A-Za-z0-9_-]+/,p=/"(\\"|[^"])*"/,g=/'[^']*'/,x=s.either(d,p,g),_=s.concat(x,"(\\s*\\.\\s*",x,")*",s.lookahead(/\s*=\s*[^#\s]/));return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[o,{className:"section",begin:/\[+/,end:/\]+/},{begin:_,className:"attr",starts:{end:/$/,contains:[o,m,u,l,h,n]}}]}}return zg=e,zg}var Bg,xk;function GV(){if(xk)return Bg;xk=1;var e="[0-9](_*[0-9])*",t=`\\.(${e})`,s="[0-9a-fA-F](_*[0-9a-fA-F])*",n={className:"number",variants:[{begin:`(\\b(${e})((${t})|\\.)?|(${t}))[eE][+-]?(${e})[fFdD]?\\b`},{begin:`\\b(${e})((${t})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${t})[fFdD]?\\b`},{begin:`\\b(${e})[fFdD]\\b`},{begin:`\\b0[xX]((${s})\\.?|(${s})?\\.(${s}))[pP][+-]?(${e})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${s})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function o(u,h,m){return m===-1?"":u.replace(h,d=>o(u,h,m-1))}function l(u){const h=u.regex,m="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",d=m+o("(?:<"+m+"~~~(?:\\s*,\\s*"+m+"~~~)*>)?",/~~~/g,2),S={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},w={className:"meta",begin:"@"+m,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},k={className:"params",begin:/\(/,end:/\)/,keywords:S,relevance:0,contains:[u.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:S,illegal:/<\/|#/,contains:[u.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},u.C_LINE_COMMENT_MODE,u.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[u.BACKSLASH_ESCAPE]},u.APOS_STRING_MODE,u.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,m],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[h.concat(/(?!else)/,m),/\s+/,m,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,m],className:{1:"keyword",3:"title.class"},contains:[k,u.C_LINE_COMMENT_MODE,u.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+d+"\\s+)",u.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:S,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:S,relevance:0,contains:[w,u.APOS_STRING_MODE,u.QUOTE_STRING_MODE,n,u.C_BLOCK_COMMENT_MODE]},u.C_LINE_COMMENT_MODE,u.C_BLOCK_COMMENT_MODE]},n,w]}}return Bg=l,Bg}var Ig,vk;function WV(){if(vk)return Ig;vk=1;const e="[A-Za-z$_][0-9A-Za-z$_]*",t=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],s=["true","false","null","undefined","NaN","Infinity"],n=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],o=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],l=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],u=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],h=[].concat(l,n,o);function m(d){const p=d.regex,g=(we,{after:Le})=>{const ve="</"+we[0].slice(1);return we.input.indexOf(ve,Le)!==-1},x=e,_={begin:"<>",end:"</>"},S=/<[A-Za-z0-9\\._:-]+\s*\/>/,w={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(we,Le)=>{const ve=we[0].length+we.index,We=we.input[ve];if(We==="<"||We===","){Le.ignoreMatch();return}We===">"&&(g(we,{after:ve})||Le.ignoreMatch());let ge;const Te=we.input.substring(ve);if(ge=Te.match(/^\s*=/)){Le.ignoreMatch();return}if((ge=Te.match(/^\s+extends\s+/))&&ge.index===0){Le.ignoreMatch();return}}},k={$pattern:e,keyword:t,literal:s,built_in:h,"variable.language":u},C="[0-9](_?[0-9])*",T=`\\.(${C})`,E="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",j={className:"number",variants:[{begin:`(\\b(${E})((${T})|\\.)?|(${T}))[eE][+-]?(${C})\\b`},{begin:`\\b(${E})\\b((${T})\\b|\\.)?|(${T})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},M={className:"subst",begin:"\\$\\{",end:"\\}",keywords:k,contains:[]},z={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[d.BACKSLASH_ESCAPE,M],subLanguage:"xml"}},O={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[d.BACKSLASH_ESCAPE,M],subLanguage:"css"}},A={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[d.BACKSLASH_ESCAPE,M],subLanguage:"graphql"}},D={className:"string",begin:"`",end:"`",contains:[d.BACKSLASH_ESCAPE,M]},P={className:"comment",variants:[d.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:x+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),d.C_BLOCK_COMMENT_MODE,d.C_LINE_COMMENT_MODE]},H=[d.APOS_STRING_MODE,d.QUOTE_STRING_MODE,z,O,A,D,{match:/\$\d+/},j];M.contains=H.concat({begin:/\{/,end:/\}/,keywords:k,contains:["self"].concat(H)});const $=[].concat(P,M.contains),q=$.concat([{begin:/(\s*)\(/,end:/\)/,keywords:k,contains:["self"].concat($)}]),V={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:k,contains:q},I={variants:[{match:[/class/,/\s+/,x,/\s+/,/extends/,/\s+/,p.concat(x,"(",p.concat(/\./,x),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,x],scope:{1:"keyword",3:"title.class"}}]},W={relevance:0,match:p.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...n,...o]}},Z={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},K={variants:[{match:[/function/,/\s+/,x,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[V],illegal:/%/},te={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function L(we){return p.concat("(?!",we.join("|"),")")}const Q={match:p.concat(/\b/,L([...l,"super","import"].map(we=>`${we}\\s*\\(`)),x,p.lookahead(/\s*\(/)),className:"title.function",relevance:0},re={begin:p.concat(/\./,p.lookahead(p.concat(x,/(?![0-9A-Za-z$_(])/))),end:x,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},he={match:[/get|set/,/\s+/,x,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},V]},fe="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+d.UNDERSCORE_IDENT_RE+")\\s*=>",pe={match:[/const|var|let/,/\s+/,x,/\s*/,/=\s*/,/(async\s*)?/,p.lookahead(fe)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[V]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:k,exports:{PARAMS_CONTAINS:q,CLASS_REFERENCE:W},illegal:/#(?![$_A-z])/,contains:[d.SHEBANG({label:"shebang",binary:"node",relevance:5}),Z,d.APOS_STRING_MODE,d.QUOTE_STRING_MODE,z,O,A,D,P,{match:/\$\d+/},j,W,{scope:"attr",match:x+p.lookahead(":"),relevance:0},pe,{begin:"("+d.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[P,d.REGEXP_MODE,{className:"function",begin:fe,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:d.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:k,contains:q}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:_.begin,end:_.end},{match:S},{begin:w.begin,"on:begin":w.isTrulyOpeningTag,end:w.end}],subLanguage:"xml",contains:[{begin:w.begin,end:w.end,skip:!0,contains:["self"]}]}]},K,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+d.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[V,d.inherit(d.TITLE_MODE,{begin:x,className:"title.function"})]},{match:/\.\.\./,relevance:0},re,{match:"\\$"+x,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[V]},Q,te,I,he,{match:/\$[(.]/}]}}return Ig=m,Ig}var Pg,_k;function KV(){if(_k)return Pg;_k=1;function e(t){const s={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},o=["true","false","null"],l={scope:"literal",beginKeywords:o.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:o},contains:[s,n,t.QUOTE_STRING_MODE,l,t.C_NUMBER_MODE,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}return Pg=e,Pg}var $g,yk;function YV(){if(yk)return $g;yk=1;var e="[0-9](_*[0-9])*",t=`\\.(${e})`,s="[0-9a-fA-F](_*[0-9a-fA-F])*",n={className:"number",variants:[{begin:`(\\b(${e})((${t})|\\.)?|(${t}))[eE][+-]?(${e})[fFdD]?\\b`},{begin:`\\b(${e})((${t})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${t})[fFdD]?\\b`},{begin:`\\b(${e})[fFdD]\\b`},{begin:`\\b0[xX]((${s})\\.?|(${s})?\\.(${s}))[pP][+-]?(${e})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${s})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function o(l){const u={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},h={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},m={className:"symbol",begin:l.UNDERSCORE_IDENT_RE+"@"},d={className:"subst",begin:/\$\{/,end:/\}/,contains:[l.C_NUMBER_MODE]},p={className:"variable",begin:"\\$"+l.UNDERSCORE_IDENT_RE},g={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[p,d]},{begin:"'",end:"'",illegal:/\n/,contains:[l.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[l.BACKSLASH_ESCAPE,p,d]}]};d.contains.push(g);const x={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+l.UNDERSCORE_IDENT_RE+")?"},_={className:"meta",begin:"@"+l.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[l.inherit(g,{className:"string"}),"self"]}]},S=n,w=l.COMMENT("/\\*","\\*/",{contains:[l.C_BLOCK_COMMENT_MODE]}),k={variants:[{className:"type",begin:l.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},C=k;return C.variants[1].contains=[k],k.variants[1].contains=[C],{name:"Kotlin",aliases:["kt","kts"],keywords:u,contains:[l.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),l.C_LINE_COMMENT_MODE,w,h,m,x,_,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:u,relevance:5,contains:[{begin:l.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[l.UNDERSCORE_TITLE_MODE]},{className:"type",begin:/</,end:/>/,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:u,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[k,l.C_LINE_COMMENT_MODE,w],relevance:0},l.C_LINE_COMMENT_MODE,w,x,_,g,l.C_NUMBER_MODE]},w]},{begin:[/class|interface|trait/,/\s+/,l.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},l.UNDERSCORE_TITLE_MODE,{className:"type",begin:/</,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},x,_]},g,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:`
175
+ `},S]}}return $g=o,$g}var Hg,Sk;function XV(){if(Sk)return Hg;Sk=1;const e=p=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:p.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[p.APOS_STRING_MODE,p.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:p.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),t=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],s=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],n=[...t,...s],o=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),l=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),u=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),h=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),m=l.concat(u).sort().reverse();function d(p){const g=e(p),x=m,_="and or not only",S="[\\w-]+",w="("+S+"|@\\{"+S+"\\})",k=[],C=[],T=function($){return{className:"string",begin:"~?"+$+".*?"+$}},E=function($,q,V){return{className:$,begin:q,relevance:V}},j={$pattern:/[a-z-]+/,keyword:_,attribute:o.join(" ")},M={begin:"\\(",end:"\\)",contains:C,keywords:j,relevance:0};C.push(p.C_LINE_COMMENT_MODE,p.C_BLOCK_COMMENT_MODE,T("'"),T('"'),g.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},g.HEXCOLOR,M,E("variable","@@?"+S,10),E("variable","@\\{"+S+"\\}"),E("built_in","~?`[^`]*?`"),{className:"attribute",begin:S+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},g.IMPORTANT,{beginKeywords:"and not"},g.FUNCTION_DISPATCH);const z=C.concat({begin:/\{/,end:/\}/,contains:k}),O={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(C)},A={begin:w+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},g.CSS_VARIABLE,{className:"attribute",begin:"\\b("+h.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:C}}]},D={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:j,returnEnd:!0,contains:C,relevance:0}},B={className:"variable",variants:[{begin:"@"+S+"\\s*:",relevance:15},{begin:"@"+S}],starts:{end:"[;}]",returnEnd:!0,contains:z}},P={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:w,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[p.C_LINE_COMMENT_MODE,p.C_BLOCK_COMMENT_MODE,O,E("keyword","all\\b"),E("variable","@\\{"+S+"\\}"),{begin:"\\b("+n.join("|")+")\\b",className:"selector-tag"},g.CSS_NUMBER_MODE,E("selector-tag",w,0),E("selector-id","#"+w),E("selector-class","\\."+w,0),E("selector-tag","&",0),g.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+l.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+u.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:z},{begin:"!important"},g.FUNCTION_DISPATCH]},H={begin:S+`:(:)?(${x.join("|")})`,returnBegin:!0,contains:[P]};return k.push(p.C_LINE_COMMENT_MODE,p.C_BLOCK_COMMENT_MODE,D,B,H,A,P,O,g.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:k}}return Hg=d,Hg}var Ug,wk;function ZV(){if(wk)return Ug;wk=1;function e(t){const s="\\[=*\\[",n="\\]=*\\]",o={begin:s,end:n,contains:["self"]},l=[t.COMMENT("--(?!"+s+")","$"),t.COMMENT("--"+s,n,{contains:[o],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:t.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:l.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[t.inherit(t.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:l}].concat(l)},t.C_NUMBER_MODE,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{className:"string",begin:s,end:n,contains:[o],relevance:5}])}}return Ug=e,Ug}var Fg,kk;function QV(){if(kk)return Fg;kk=1;function e(t){const s={className:"variable",variants:[{begin:"\\$\\("+t.UNDERSCORE_IDENT_RE+"\\)",contains:[t.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},n={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,s]},o={className:"variable",begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:"subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value"},contains:[s,n]},l={begin:"^"+t.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},u={className:"meta",begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},h={className:"section",begin:/^[^\s]+:/,end:/$/,contains:[s]};return{name:"Makefile",aliases:["mk","mak","make"],keywords:{$pattern:/[\w-]+/,keyword:"define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath"},contains:[t.HASH_COMMENT_MODE,s,n,o,l,u,h]}}return Fg=e,Fg}var qg,Nk;function JV(){if(Nk)return qg;Nk=1;function e(t){const s=t.regex,n=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],o=/[dualxmsipngr]{0,12}/,l={$pattern:/[\w.]+/,keyword:n.join(" ")},u={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:l},h={begin:/->\{/,end:/\}/},m={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},d={scope:"variable",variants:[{begin:/\$\d/},{begin:s.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[m]},p={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},g=[t.BACKSLASH_ESCAPE,u,d],x=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],_=(k,C,T="\\1")=>{const E=T==="\\1"?T:s.concat(T,C);return s.concat(s.concat("(?:",k,")"),C,/(?:\\.|[^\\\/])*?/,E,/(?:\\.|[^\\\/])*?/,T,o)},S=(k,C,T)=>s.concat(s.concat("(?:",k,")"),C,/(?:\\.|[^\\\/])*?/,T,o),w=[d,t.HASH_COMMENT_MODE,t.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),h,{className:"string",contains:g,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},p,{begin:"(\\/\\/|"+t.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[t.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:_("s|tr|y",s.either(...x,{capture:!0}))},{begin:_("s|tr|y","\\(","\\)")},{begin:_("s|tr|y","\\[","\\]")},{begin:_("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:S("(?:m|qr)?",/\//,/\//)},{begin:S("m|qr",s.either(...x,{capture:!0}),/\1/)},{begin:S("m|qr",/\(/,/\)/)},{begin:S("m|qr",/\[/,/\]/)},{begin:S("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE,m]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE,m,p]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return u.contains=w,h.contains=w,{name:"Perl",aliases:["pl","pm"],keywords:l,contains:w}}return qg=e,qg}var Vg,Ck;function eG(){if(Ck)return Vg;Ck=1;function e(t){const s={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},n=/[a-zA-Z@][a-zA-Z0-9_]*/,m={"variable.language":["this","super"],$pattern:n,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},d={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:m,illegal:"</",contains:[s,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,t.C_NUMBER_MODE,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,{className:"string",variants:[{begin:'@"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]}]},{className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),{className:"string",begin:/<.*?>/,end:/$/,illegal:"\\n"},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+d.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:d,contains:[t.UNDERSCORE_TITLE_MODE]},{begin:"\\."+t.UNDERSCORE_IDENT_RE,relevance:0}]}}return Vg=e,Vg}var Gg,Ek;function tG(){if(Ek)return Gg;Ek=1;function e(t){const s=t.regex,n=/(?![A-Za-z0-9])(?![$])/,o=s.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),l=s.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),u=s.concat(/[A-Z]+/,n),h={scope:"variable",match:"\\$+"+o},m={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},d={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},p=t.inherit(t.APOS_STRING_MODE,{illegal:null}),g=t.inherit(t.QUOTE_STRING_MODE,{illegal:null,contains:t.QUOTE_STRING_MODE.contains.concat(d)}),x={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:t.QUOTE_STRING_MODE.contains.concat(d),"on:begin":(V,I)=>{I.data._beginMatch=V[1]||V[2]},"on:end":(V,I)=>{I.data._beginMatch!==V[1]&&I.ignoreMatch()}},_=t.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),S=`[
176
+ ]`,w={scope:"string",variants:[g,p,x,_]},k={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},C=["false","null","true"],T=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],E=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],M={keyword:T,literal:(V=>{const I=[];return V.forEach(W=>{I.push(W),W.toLowerCase()===W?I.push(W.toUpperCase()):I.push(W.toLowerCase())}),I})(C),built_in:E},z=V=>V.map(I=>I.replace(/\|\d+$/,"")),O={variants:[{match:[/new/,s.concat(S,"+"),s.concat("(?!",z(E).join("\\b|"),"\\b)"),l],scope:{1:"keyword",4:"title.class"}}]},A=s.concat(o,"\\b(?!\\()"),D={variants:[{match:[s.concat(/::/,s.lookahead(/(?!class\b)/)),A],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[l,s.concat(/::/,s.lookahead(/(?!class\b)/)),A],scope:{1:"title.class",3:"variable.constant"}},{match:[l,s.concat("::",s.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[l,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},B={scope:"attr",match:s.concat(o,s.lookahead(":"),s.lookahead(/(?!::)/))},P={relevance:0,begin:/\(/,end:/\)/,keywords:M,contains:[B,h,D,t.C_BLOCK_COMMENT_MODE,w,k,O]},H={relevance:0,match:[/\b/,s.concat("(?!fn\\b|function\\b|",z(T).join("\\b|"),"|",z(E).join("\\b|"),"\\b)"),o,s.concat(S,"*"),s.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[P]};P.contains.push(H);const $=[B,D,t.C_BLOCK_COMMENT_MODE,w,k,O],q={begin:s.concat(/#\[\s*\\?/,s.either(l,u)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:C,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:C,keyword:["new","array"]},contains:["self",...$]},...$,{scope:"meta",variants:[{match:l},{match:u}]}]};return{case_insensitive:!1,keywords:M,contains:[q,t.HASH_COMMENT_MODE,t.COMMENT("//","$"),t.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:t.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},m,{scope:"variable.language",match:/\$this\b/},h,H,D,{match:[/const/,/\s/,o],scope:{1:"keyword",3:"variable.constant"}},O,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},t.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:M,contains:["self",q,h,D,t.C_BLOCK_COMMENT_MODE,w,k]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},t.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[t.inherit(t.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},t.UNDERSCORE_TITLE_MODE]},w,k]}}return Gg=e,Gg}var Wg,jk;function sG(){if(jk)return Wg;jk=1;function e(t){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},t.inherit(t.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),t.inherit(t.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}return Wg=e,Wg}var Kg,Tk;function nG(){if(Tk)return Kg;Tk=1;function e(t){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}return Kg=e,Kg}var Yg,Ak;function iG(){if(Ak)return Yg;Ak=1;function e(t){const s=t.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),o=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],m={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:o,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},d={className:"meta",begin:/^(>>>|\.\.\.) /},p={className:"subst",begin:/\{/,end:/\}/,keywords:m,illegal:/#/},g={begin:/\{\{/,relevance:0},x={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,d],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,d],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,d,g,p]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,d,g,p]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[t.BACKSLASH_ESCAPE,g,p]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,g,p]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},_="[0-9](_?[0-9])*",S=`(\\b(${_}))?\\.(${_})|\\b(${_})\\.`,w=`\\b|${o.join("|")}`,k={className:"number",relevance:0,variants:[{begin:`(\\b(${_})|(${S}))[eE][+-]?(${_})[jJ]?(?=${w})`},{begin:`(${S})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${w})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${w})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${w})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${w})`},{begin:`\\b(${_})[jJ](?=${w})`}]},C={className:"comment",begin:s.lookahead(/# type:/),end:/$/,keywords:m,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},T={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:m,contains:["self",d,k,x,t.HASH_COMMENT_MODE]}]};return p.contains=[x,k,d],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:m,illegal:/(<\/|\?)|=>/,contains:[d,k,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},x,C,t.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[T]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[k,T,x]}]}}return Yg=e,Yg}var Xg,Rk;function rG(){if(Rk)return Xg;Rk=1;function e(t){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}return Xg=e,Xg}var Zg,Mk;function aG(){if(Mk)return Zg;Mk=1;function e(t){const s=t.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,o=s.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),l=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,u=s.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:n,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[t.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:s.lookahead(s.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),t.HASH_COMMENT_MODE,{scope:"string",contains:[t.BACKSLASH_ESCAPE],variants:[t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[l,o]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,o]},{scope:{1:"punctuation",2:"number"},match:[u,o]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,o]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:l},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:u},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}return Zg=e,Zg}var Qg,Dk;function oG(){if(Dk)return Qg;Dk=1;function e(t){const s=t.regex,n=/(r#)?/,o=s.concat(n,t.UNDERSCORE_IDENT_RE),l=s.concat(n,t.IDENT_RE),u={className:"title.function.invoke",relevance:0,begin:s.concat(/\b/,/(?!let|for|while|if|else|match\b)/,l,s.lookahead(/\s*\(/))},h="([ui](8|16|32|64|128|size)|f(32|64))?",m=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],d=["true","false","Some","None","Ok","Err"],p=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],g=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:t.IDENT_RE+"!?",type:g,keyword:m,literal:d,built_in:p},illegal:"</",contains:[t.C_LINE_COMMENT_MODE,t.COMMENT("/\\*","\\*/",{contains:["self"]}),t.inherit(t.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+h},{begin:"\\b0o([0-7_]+)"+h},{begin:"\\b0x([A-Fa-f0-9_]+)"+h},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+h}],relevance:0},{begin:[/fn/,/\s+/,o],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,o],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,o,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,o],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,o],className:{1:"keyword",3:"title.class"}},{begin:t.IDENT_RE+"::",keywords:{keyword:"Self",built_in:p,type:g}},{className:"punctuation",begin:"->"},u]}}return Qg=e,Qg}var Jg,Ok;function lG(){if(Ok)return Jg;Ok=1;const e=d=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:d.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[d.APOS_STRING_MODE,d.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:d.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),t=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],s=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],n=[...t,...s],o=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),l=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),u=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),h=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function m(d){const p=e(d),g=u,x=l,_="@[a-z-]+",S="and or not only",k={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[d.C_LINE_COMMENT_MODE,d.C_BLOCK_COMMENT_MODE,p.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},p.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+n.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+x.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+g.join("|")+")"},k,{begin:/\(/,end:/\)/,contains:[p.CSS_NUMBER_MODE]},p.CSS_VARIABLE,{className:"attribute",begin:"\\b("+h.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[p.BLOCK_COMMENT,k,p.HEXCOLOR,p.CSS_NUMBER_MODE,d.QUOTE_STRING_MODE,d.APOS_STRING_MODE,p.IMPORTANT,p.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:_,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:S,attribute:o.join(" ")},contains:[{begin:_,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},k,d.QUOTE_STRING_MODE,d.APOS_STRING_MODE,p.HEXCOLOR,p.CSS_NUMBER_MODE]},p.FUNCTION_DISPATCH]}}return Jg=m,Jg}var e0,Lk;function cG(){if(Lk)return e0;Lk=1;function e(t){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}return e0=e,e0}var t0,zk;function uG(){if(zk)return t0;zk=1;function e(t){const s=t.regex,n=t.COMMENT("--","$"),o={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},l={begin:/"/,end:/"/,contains:[{match:/""/}]},u=["true","false","unknown"],h=["double precision","large object","with timezone","without timezone"],m=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],d=["add","asc","collation","desc","final","first","last","view"],p=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],g=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],x=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],_=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],S=g,w=[...p,...d].filter(z=>!g.includes(z)),k={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},C={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},T={match:s.concat(/\b/,s.either(...S),/\s*\(/),relevance:0,keywords:{built_in:S}};function E(z){return s.concat(/\b/,s.either(...z.map(O=>O.replace(/\s+/,"\\s+"))),/\b/)}const j={scope:"keyword",match:E(_),relevance:0};function M(z,{exceptions:O,when:A}={}){const D=A;return O=O||[],z.map(B=>B.match(/\|\d+$/)||O.includes(B)?B:D(B)?`${B}|0`:B)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:M(w,{when:z=>z.length<3}),literal:u,type:m,built_in:x},contains:[{scope:"type",match:E(h)},j,T,k,o,l,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,n,C]}}return t0=e,t0}var s0,Bk;function dG(){if(Bk)return s0;Bk=1;function e(A){return A?typeof A=="string"?A:A.source:null}function t(A){return s("(?=",A,")")}function s(...A){return A.map(B=>e(B)).join("")}function n(A){const D=A[A.length-1];return typeof D=="object"&&D.constructor===Object?(A.splice(A.length-1,1),D):{}}function o(...A){return"("+(n(A).capture?"":"?:")+A.map(P=>e(P)).join("|")+")"}const l=A=>s(/\b/,A,/\w$/.test(A)?/\b/:/\B/),u=["Protocol","Type"].map(l),h=["init","self"].map(l),m=["Any","Self"],d=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],p=["false","nil","true"],g=["assignment","associativity","higherThan","left","lowerThan","none","right"],x=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],_=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],S=o(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),w=o(S,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),k=s(S,w,"*"),C=o(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),T=o(C,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),E=s(C,T,"*"),j=s(/[A-Z]/,T,"*"),M=["attached","autoclosure",s(/convention\(/,o("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",s(/objc\(/,E,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],z=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function O(A){const D={match:/\s+/,relevance:0},B=A.COMMENT("/\\*","\\*/",{contains:["self"]}),P=[A.C_LINE_COMMENT_MODE,B],H={match:[/\./,o(...u,...h)],className:{2:"keyword"}},$={match:s(/\./,o(...d)),relevance:0},q=d.filter(lt=>typeof lt=="string").concat(["_|0"]),V=d.filter(lt=>typeof lt!="string").concat(m).map(l),I={variants:[{className:"keyword",match:o(...V,...h)}]},W={$pattern:o(/\b\w+/,/#\w+/),keyword:q.concat(x),literal:p},Z=[H,$,I],K={match:s(/\./,o(..._)),relevance:0},te={className:"built_in",match:s(/\b/,o(..._),/(?=\()/)},L=[K,te],Q={match:/->/,relevance:0},re={className:"operator",relevance:0,variants:[{match:k},{match:`\\.(\\.|${w})+`}]},he=[Q,re],fe="([0-9]_*)+",pe="([0-9a-fA-F]_*)+",we={className:"number",relevance:0,variants:[{match:`\\b(${fe})(\\.(${fe}))?([eE][+-]?(${fe}))?\\b`},{match:`\\b0x(${pe})(\\.(${pe}))?([pP][+-]?(${fe}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},Le=(lt="")=>({className:"subst",variants:[{match:s(/\\/,lt,/[0\\tnr"']/)},{match:s(/\\/,lt,/u\{[0-9a-fA-F]{1,8}\}/)}]}),ve=(lt="")=>({className:"subst",match:s(/\\/,lt,/[\t ]*(?:[\r\n]|\r\n)/)}),We=(lt="")=>({className:"subst",label:"interpol",begin:s(/\\/,lt,/\(/),end:/\)/}),ge=(lt="")=>({begin:s(lt,/"""/),end:s(/"""/,lt),contains:[Le(lt),ve(lt),We(lt)]}),Te=(lt="")=>({begin:s(lt,/"/),end:s(/"/,lt),contains:[Le(lt),We(lt)]}),Re={className:"string",variants:[ge(),ge("#"),ge("##"),ge("###"),Te(),Te("#"),Te("##"),Te("###")]},Pt=[A.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[A.BACKSLASH_ESCAPE]}],Pi={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:Pt},ii=lt=>{const ai=s(lt,/\//),xn=s(/\//,lt);return{begin:ai,end:xn,contains:[...Pt,{scope:"comment",begin:`#(?!.*${xn})`,end:/$/}]}},kr={scope:"regexp",variants:[ii("###"),ii("##"),ii("#"),Pi]},$i={match:s(/`/,E,/`/)},Hi={className:"variable",match:/\$\d+/},_e={className:"variable",match:`\\$${T}+`},ft=[$i,Hi,_e],bn={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:z,contains:[...he,we,Re]}]}},Ts={scope:"keyword",match:s(/@/,o(...M),t(o(/\(/,/\s+/)))},gt={scope:"meta",match:s(/@/,E)},ri=[bn,Ts,gt],fs={match:t(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:s(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,T,"+")},{className:"type",match:j,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:s(/\s+&\s+/,t(j)),relevance:0}]},Ui={begin:/</,end:/>/,keywords:W,contains:[...P,...Z,...ri,Q,fs]};fs.contains.push(Ui);const Fi={match:s(E,/\s*:/),keywords:"_|0",relevance:0},oo={begin:/\(/,end:/\)/,relevance:0,keywords:W,contains:["self",Fi,...P,kr,...Z,...L,...he,we,Re,...ft,...ri,fs]},Nr={begin:/</,end:/>/,keywords:"repeat each",contains:[...P,fs]},wl={begin:o(t(s(E,/\s*:/)),t(s(E,/\s+/,E,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:E}]},lo={begin:/\(/,end:/\)/,keywords:W,contains:[wl,...P,...Z,...he,we,Re,...ri,fs,oo],endsParent:!0,illegal:/["']/},qi={match:[/(func|macro)/,/\s+/,o($i.match,E,k)],className:{1:"keyword",3:"title.function"},contains:[Nr,lo,D],illegal:[/\[/,/%/]},ys={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[Nr,lo,D],illegal:/\[|%/},Dn={match:[/operator/,/\s+/,k],className:{1:"keyword",3:"title"}},As={begin:[/precedencegroup/,/\s+/,j],className:{1:"keyword",3:"title"},contains:[fs],keywords:[...g,...p],end:/}/},kl={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},ga={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},co={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,E,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:W,contains:[Nr,...Z,{begin:/:/,end:/\{/,keywords:W,contains:[{scope:"title.class.inherited",match:j},...Z],relevance:0}]};for(const lt of Re.variants){const ai=lt.contains.find($s=>$s.label==="interpol");ai.keywords=W;const xn=[...Z,...L,...he,we,Re,...ft];ai.contains=[...xn,{begin:/\(/,end:/\)/,contains:["self",...xn]}]}return{name:"Swift",keywords:W,contains:[...P,qi,ys,kl,ga,co,Dn,As,{beginKeywords:"import",end:/$/,contains:[...P],relevance:0},kr,...Z,...L,...he,we,Re,...ft,...ri,fs,oo]}}return s0=O,s0}var n0,Ik;function hG(){if(Ik)return n0;Ik=1;function e(t){const s="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",o={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},l={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},u={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},h={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[t.BACKSLASH_ESCAPE,l]},m=t.inherit(h,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),_={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},S={end:",",endsWithParent:!0,excludeEnd:!0,keywords:s,relevance:0},w={begin:/\{/,end:/\}/,contains:[S],illegal:"\\n",relevance:0},k={begin:"\\[",end:"\\]",contains:[S],illegal:"\\n",relevance:0},C=[o,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+t.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+t.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},t.HASH_COMMENT_MODE,{beginKeywords:s,keywords:{literal:s}},_,{className:"number",begin:t.C_NUMBER_RE+"\\b",relevance:0},w,k,u,h],T=[...C];return T.pop(),T.push(m),S.contains=T,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:C}}return n0=e,n0}var i0,Pk;function fG(){if(Pk)return i0;Pk=1;const e="[A-Za-z$_][0-9A-Za-z$_]*",t=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],s=["true","false","null","undefined","NaN","Infinity"],n=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],o=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],l=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],u=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],h=[].concat(l,n,o);function m(p){const g=p.regex,x=(Le,{after:ve})=>{const We="</"+Le[0].slice(1);return Le.input.indexOf(We,ve)!==-1},_=e,S={begin:"<>",end:"</>"},w=/<[A-Za-z0-9\\._:-]+\s*\/>/,k={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(Le,ve)=>{const We=Le[0].length+Le.index,ge=Le.input[We];if(ge==="<"||ge===","){ve.ignoreMatch();return}ge===">"&&(x(Le,{after:We})||ve.ignoreMatch());let Te;const Re=Le.input.substring(We);if(Te=Re.match(/^\s*=/)){ve.ignoreMatch();return}if((Te=Re.match(/^\s+extends\s+/))&&Te.index===0){ve.ignoreMatch();return}}},C={$pattern:e,keyword:t,literal:s,built_in:h,"variable.language":u},T="[0-9](_?[0-9])*",E=`\\.(${T})`,j="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",M={className:"number",variants:[{begin:`(\\b(${j})((${E})|\\.)?|(${E}))[eE][+-]?(${T})\\b`},{begin:`\\b(${j})\\b((${E})\\b|\\.)?|(${E})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},z={className:"subst",begin:"\\$\\{",end:"\\}",keywords:C,contains:[]},O={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[p.BACKSLASH_ESCAPE,z],subLanguage:"xml"}},A={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[p.BACKSLASH_ESCAPE,z],subLanguage:"css"}},D={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[p.BACKSLASH_ESCAPE,z],subLanguage:"graphql"}},B={className:"string",begin:"`",end:"`",contains:[p.BACKSLASH_ESCAPE,z]},H={className:"comment",variants:[p.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:_+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),p.C_BLOCK_COMMENT_MODE,p.C_LINE_COMMENT_MODE]},$=[p.APOS_STRING_MODE,p.QUOTE_STRING_MODE,O,A,D,B,{match:/\$\d+/},M];z.contains=$.concat({begin:/\{/,end:/\}/,keywords:C,contains:["self"].concat($)});const q=[].concat(H,z.contains),V=q.concat([{begin:/(\s*)\(/,end:/\)/,keywords:C,contains:["self"].concat(q)}]),I={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:C,contains:V},W={variants:[{match:[/class/,/\s+/,_,/\s+/,/extends/,/\s+/,g.concat(_,"(",g.concat(/\./,_),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,_],scope:{1:"keyword",3:"title.class"}}]},Z={relevance:0,match:g.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...n,...o]}},K={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},te={variants:[{match:[/function/,/\s+/,_,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[I],illegal:/%/},L={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function Q(Le){return g.concat("(?!",Le.join("|"),")")}const re={match:g.concat(/\b/,Q([...l,"super","import"].map(Le=>`${Le}\\s*\\(`)),_,g.lookahead(/\s*\(/)),className:"title.function",relevance:0},he={begin:g.concat(/\./,g.lookahead(g.concat(_,/(?![0-9A-Za-z$_(])/))),end:_,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},fe={match:[/get|set/,/\s+/,_,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},I]},pe="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+p.UNDERSCORE_IDENT_RE+")\\s*=>",we={match:[/const|var|let/,/\s+/,_,/\s*/,/=\s*/,/(async\s*)?/,g.lookahead(pe)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[I]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:C,exports:{PARAMS_CONTAINS:V,CLASS_REFERENCE:Z},illegal:/#(?![$_A-z])/,contains:[p.SHEBANG({label:"shebang",binary:"node",relevance:5}),K,p.APOS_STRING_MODE,p.QUOTE_STRING_MODE,O,A,D,B,H,{match:/\$\d+/},M,Z,{scope:"attr",match:_+g.lookahead(":"),relevance:0},we,{begin:"("+p.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[H,p.REGEXP_MODE,{className:"function",begin:pe,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:p.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:C,contains:V}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:S.begin,end:S.end},{match:w},{begin:k.begin,"on:begin":k.isTrulyOpeningTag,end:k.end}],subLanguage:"xml",contains:[{begin:k.begin,end:k.end,skip:!0,contains:["self"]}]}]},te,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+p.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[I,p.inherit(p.TITLE_MODE,{begin:_,className:"title.function"})]},{match:/\.\.\./,relevance:0},he,{match:"\\$"+_,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[I]},re,L,W,fe,{match:/\$[(.]/}]}}function d(p){const g=p.regex,x=m(p),_=e,S=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],w={begin:[/namespace/,/\s+/,p.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},k={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:S},contains:[x.exports.CLASS_REFERENCE]},C={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},T=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],E={$pattern:e,keyword:t.concat(T),literal:s,built_in:h.concat(S),"variable.language":u},j={className:"meta",begin:"@"+_},M=(D,B,P)=>{const H=D.contains.findIndex($=>$.label===B);if(H===-1)throw new Error("can not find mode to replace");D.contains.splice(H,1,P)};Object.assign(x.keywords,E),x.exports.PARAMS_CONTAINS.push(j);const z=x.contains.find(D=>D.scope==="attr"),O=Object.assign({},z,{match:g.concat(_,g.lookahead(/\s*\?:/))});x.exports.PARAMS_CONTAINS.push([x.exports.CLASS_REFERENCE,z,O]),x.contains=x.contains.concat([j,w,k,O]),M(x,"shebang",p.SHEBANG()),M(x,"use_strict",C);const A=x.contains.find(D=>D.label==="func.def");return A.relevance=0,Object.assign(x,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),x}return i0=d,i0}var r0,$k;function mG(){if($k)return r0;$k=1;function e(t){const s=t.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},o={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},l=/\d{1,2}\/\d{1,2}\/\d{4}/,u=/\d{4}-\d{1,2}-\d{1,2}/,h=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,m=/\d{1,2}(:\d{1,2}){1,2}/,d={className:"literal",variants:[{begin:s.concat(/# */,s.either(u,l),/ *#/)},{begin:s.concat(/# */,m,/ *#/)},{begin:s.concat(/# */,h,/ *#/)},{begin:s.concat(/# */,s.either(u,l),/ +/,s.either(h,m),/ *#/)}]},p={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},g={className:"label",begin:/^\w+:/},x=t.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),_=t.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[n,o,d,p,g,x,_,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[_]}]}}return r0=e,r0}var a0,Hk;function pG(){if(Hk)return a0;Hk=1;function e(t){t.regex;const s=t.COMMENT(/\(;/,/;\)/);s.contains.push("self");const n=t.COMMENT(/;;/,/$/),o=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],l={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},u={className:"variable",begin:/\$[\w_]+/},h={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},m={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},d={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},p={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:o},contains:[n,s,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},u,h,l,t.QUOTE_STRING_MODE,d,p,m]}}return a0=e,a0}var o0,Uk;function gG(){if(Uk)return o0;Uk=1;var e=DV();return e.registerLanguage("xml",OV()),e.registerLanguage("bash",LV()),e.registerLanguage("c",zV()),e.registerLanguage("cpp",BV()),e.registerLanguage("csharp",IV()),e.registerLanguage("css",PV()),e.registerLanguage("markdown",$V()),e.registerLanguage("diff",HV()),e.registerLanguage("ruby",UV()),e.registerLanguage("go",FV()),e.registerLanguage("graphql",qV()),e.registerLanguage("ini",VV()),e.registerLanguage("java",GV()),e.registerLanguage("javascript",WV()),e.registerLanguage("json",KV()),e.registerLanguage("kotlin",YV()),e.registerLanguage("less",XV()),e.registerLanguage("lua",ZV()),e.registerLanguage("makefile",QV()),e.registerLanguage("perl",JV()),e.registerLanguage("objectivec",eG()),e.registerLanguage("php",tG()),e.registerLanguage("php-template",sG()),e.registerLanguage("plaintext",nG()),e.registerLanguage("python",iG()),e.registerLanguage("python-repl",rG()),e.registerLanguage("r",aG()),e.registerLanguage("rust",oG()),e.registerLanguage("scss",lG()),e.registerLanguage("shell",cG()),e.registerLanguage("sql",uG()),e.registerLanguage("swift",dG()),e.registerLanguage("yaml",hG()),e.registerLanguage("typescript",fG()),e.registerLanguage("vbnet",mG()),e.registerLanguage("wasm",pG()),e.HighlightJS=e,e.default=e,o0=e,o0}var bG=gG();const jb=VA(bG);function xG(e){return e.replace(/<\/?(script|style|iframe|object|embed)\b[^>]*>/gi,"").replace(/\son\w+\s*=\s*("[^"]*"|'[^']*'|[^\s>]+)/gi,"").replace(/(href|src)\s*=\s*("|')\s*javascript:[^"']*\2/gi,"$1=$2#$2")}function vG({content:e}){const t=y.useMemo(()=>{const n=pt.parse(e,{async:!1,gfm:!0,breaks:!1});return xG(n)},[e]),s=y.useRef(null);return y.useEffect(()=>{const n=s.current;n&&n.querySelectorAll("pre code").forEach(o=>{jb.highlightElement(o)})},[t]),r.jsx("div",{ref:s,className:"md-preview min-w-0 px-6 py-5",dangerouslySetInnerHTML:{__html:t}})}function z5(e){return typeof e>"u"||e===null}function _G(e){return typeof e=="object"&&e!==null}function yG(e){return Array.isArray(e)?e:z5(e)?[]:[e]}function SG(e,t){var s,n,o,l;if(t)for(l=Object.keys(t),s=0,n=l.length;s<n;s+=1)o=l[s],e[o]=t[o];return e}function wG(e,t){var s="",n;for(n=0;n<t;n+=1)s+=e;return s}function kG(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var NG=z5,CG=_G,EG=yG,jG=wG,TG=kG,AG=SG,vs={isNothing:NG,isObject:CG,toArray:EG,repeat:jG,isNegativeZero:TG,extend:AG};function B5(e,t){var s="",n=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(s+='in "'+e.mark.name+'" '),s+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(s+=`
177
+
178
+ `+e.mark.snippet),n+" "+s):n}function lu(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=B5(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}lu.prototype=Object.create(Error.prototype);lu.prototype.constructor=lu;lu.prototype.toString=function(t){return this.name+": "+B5(this,t)};var Zs=lu;function l0(e,t,s,n,o){var l="",u="",h=Math.floor(o/2)-1;return n-t>h&&(l=" ... ",t=n-h+l.length),s-n>h&&(u=" ...",s=n+h-u.length),{str:l+e.slice(t,s).replace(/\t/g,"→")+u,pos:n-t+l.length}}function c0(e,t){return vs.repeat(" ",t-e.length)+e}function RG(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),typeof t.indent!="number"&&(t.indent=1),typeof t.linesBefore!="number"&&(t.linesBefore=3),typeof t.linesAfter!="number"&&(t.linesAfter=2);for(var s=/\r?\n|\r|\0/g,n=[0],o=[],l,u=-1;l=s.exec(e.buffer);)o.push(l.index),n.push(l.index+l[0].length),e.position<=l.index&&u<0&&(u=n.length-2);u<0&&(u=n.length-1);var h="",m,d,p=Math.min(e.line+t.linesAfter,o.length).toString().length,g=t.maxLength-(t.indent+p+3);for(m=1;m<=t.linesBefore&&!(u-m<0);m++)d=l0(e.buffer,n[u-m],o[u-m],e.position-(n[u]-n[u-m]),g),h=vs.repeat(" ",t.indent)+c0((e.line-m+1).toString(),p)+" | "+d.str+`
179
+ `+h;for(d=l0(e.buffer,n[u],o[u],e.position,g),h+=vs.repeat(" ",t.indent)+c0((e.line+1).toString(),p)+" | "+d.str+`
180
+ `,h+=vs.repeat("-",t.indent+p+3+d.pos)+`^
181
+ `,m=1;m<=t.linesAfter&&!(u+m>=o.length);m++)d=l0(e.buffer,n[u+m],o[u+m],e.position-(n[u]-n[u+m]),g),h+=vs.repeat(" ",t.indent)+c0((e.line+m+1).toString(),p)+" | "+d.str+`
182
+ `;return h.replace(/\n$/,"")}var MG=RG,DG=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],OG=["scalar","sequence","mapping"];function LG(e){var t={};return e!==null&&Object.keys(e).forEach(function(s){e[s].forEach(function(n){t[String(n)]=s})}),t}function zG(e,t){if(t=t||{},Object.keys(t).forEach(function(s){if(DG.indexOf(s)===-1)throw new Zs('Unknown option "'+s+'" is met in definition of "'+e+'" YAML type.')}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(s){return s},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=LG(t.styleAliases||null),OG.indexOf(this.kind)===-1)throw new Zs('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var Ps=zG;function Fk(e,t){var s=[];return e[t].forEach(function(n){var o=s.length;s.forEach(function(l,u){l.tag===n.tag&&l.kind===n.kind&&l.multi===n.multi&&(o=u)}),s[o]=n}),s}function BG(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},t,s;function n(o){o.multi?(e.multi[o.kind].push(o),e.multi.fallback.push(o)):e[o.kind][o.tag]=e.fallback[o.tag]=o}for(t=0,s=arguments.length;t<s;t+=1)arguments[t].forEach(n);return e}function Tb(e){return this.extend(e)}Tb.prototype.extend=function(t){var s=[],n=[];if(t instanceof Ps)n.push(t);else if(Array.isArray(t))n=n.concat(t);else if(t&&(Array.isArray(t.implicit)||Array.isArray(t.explicit)))t.implicit&&(s=s.concat(t.implicit)),t.explicit&&(n=n.concat(t.explicit));else throw new Zs("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");s.forEach(function(l){if(!(l instanceof Ps))throw new Zs("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(l.loadKind&&l.loadKind!=="scalar")throw new Zs("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(l.multi)throw new Zs("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),n.forEach(function(l){if(!(l instanceof Ps))throw new Zs("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var o=Object.create(Tb.prototype);return o.implicit=(this.implicit||[]).concat(s),o.explicit=(this.explicit||[]).concat(n),o.compiledImplicit=Fk(o,"implicit"),o.compiledExplicit=Fk(o,"explicit"),o.compiledTypeMap=BG(o.compiledImplicit,o.compiledExplicit),o};var I5=Tb,P5=new Ps("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),$5=new Ps("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),H5=new Ps("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),U5=new I5({explicit:[P5,$5,H5]});function IG(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function PG(){return null}function $G(e){return e===null}var F5=new Ps("tag:yaml.org,2002:null",{kind:"scalar",resolve:IG,construct:PG,predicate:$G,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function HG(e){if(e===null)return!1;var t=e.length;return t===4&&(e==="true"||e==="True"||e==="TRUE")||t===5&&(e==="false"||e==="False"||e==="FALSE")}function UG(e){return e==="true"||e==="True"||e==="TRUE"}function FG(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var q5=new Ps("tag:yaml.org,2002:bool",{kind:"scalar",resolve:HG,construct:UG,predicate:FG,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function qG(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function VG(e){return 48<=e&&e<=55}function GG(e){return 48<=e&&e<=57}function WG(e){if(e===null)return!1;var t=e.length,s=0,n=!1,o;if(!t)return!1;if(o=e[s],(o==="-"||o==="+")&&(o=e[++s]),o==="0"){if(s+1===t)return!0;if(o=e[++s],o==="b"){for(s++;s<t;s++)if(o=e[s],o!=="_"){if(o!=="0"&&o!=="1")return!1;n=!0}return n&&o!=="_"}if(o==="x"){for(s++;s<t;s++)if(o=e[s],o!=="_"){if(!qG(e.charCodeAt(s)))return!1;n=!0}return n&&o!=="_"}if(o==="o"){for(s++;s<t;s++)if(o=e[s],o!=="_"){if(!VG(e.charCodeAt(s)))return!1;n=!0}return n&&o!=="_"}}if(o==="_")return!1;for(;s<t;s++)if(o=e[s],o!=="_"){if(!GG(e.charCodeAt(s)))return!1;n=!0}return!(!n||o==="_")}function KG(e){var t=e,s=1,n;if(t.indexOf("_")!==-1&&(t=t.replace(/_/g,"")),n=t[0],(n==="-"||n==="+")&&(n==="-"&&(s=-1),t=t.slice(1),n=t[0]),t==="0")return 0;if(n==="0"){if(t[1]==="b")return s*parseInt(t.slice(2),2);if(t[1]==="x")return s*parseInt(t.slice(2),16);if(t[1]==="o")return s*parseInt(t.slice(2),8)}return s*parseInt(t,10)}function YG(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!vs.isNegativeZero(e)}var V5=new Ps("tag:yaml.org,2002:int",{kind:"scalar",resolve:WG,construct:KG,predicate:YG,represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),XG=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function ZG(e){return!(e===null||!XG.test(e)||e[e.length-1]==="_")}function QG(e){var t,s;return t=e.replace(/_/g,"").toLowerCase(),s=t[0]==="-"?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),t===".inf"?s===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:t===".nan"?NaN:s*parseFloat(t,10)}var JG=/^[-+]?[0-9]+e/;function eW(e,t){var s;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(vs.isNegativeZero(e))return"-0.0";return s=e.toString(10),JG.test(s)?s.replace("e",".e"):s}function tW(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||vs.isNegativeZero(e))}var G5=new Ps("tag:yaml.org,2002:float",{kind:"scalar",resolve:ZG,construct:QG,predicate:tW,represent:eW,defaultStyle:"lowercase"}),W5=U5.extend({implicit:[F5,q5,V5,G5]}),K5=W5,Y5=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),X5=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function sW(e){return e===null?!1:Y5.exec(e)!==null||X5.exec(e)!==null}function nW(e){var t,s,n,o,l,u,h,m=0,d=null,p,g,x;if(t=Y5.exec(e),t===null&&(t=X5.exec(e)),t===null)throw new Error("Date resolve error");if(s=+t[1],n=+t[2]-1,o=+t[3],!t[4])return new Date(Date.UTC(s,n,o));if(l=+t[4],u=+t[5],h=+t[6],t[7]){for(m=t[7].slice(0,3);m.length<3;)m+="0";m=+m}return t[9]&&(p=+t[10],g=+(t[11]||0),d=(p*60+g)*6e4,t[9]==="-"&&(d=-d)),x=new Date(Date.UTC(s,n,o,l,u,h,m)),d&&x.setTime(x.getTime()-d),x}function iW(e){return e.toISOString()}var Z5=new Ps("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:sW,construct:nW,instanceOf:Date,represent:iW});function rW(e){return e==="<<"||e===null}var Q5=new Ps("tag:yaml.org,2002:merge",{kind:"scalar",resolve:rW}),Zx=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
183
+ \r`;function aW(e){if(e===null)return!1;var t,s,n=0,o=e.length,l=Zx;for(s=0;s<o;s++)if(t=l.indexOf(e.charAt(s)),!(t>64)){if(t<0)return!1;n+=6}return n%8===0}function oW(e){var t,s,n=e.replace(/[\r\n=]/g,""),o=n.length,l=Zx,u=0,h=[];for(t=0;t<o;t++)t%4===0&&t&&(h.push(u>>16&255),h.push(u>>8&255),h.push(u&255)),u=u<<6|l.indexOf(n.charAt(t));return s=o%4*6,s===0?(h.push(u>>16&255),h.push(u>>8&255),h.push(u&255)):s===18?(h.push(u>>10&255),h.push(u>>2&255)):s===12&&h.push(u>>4&255),new Uint8Array(h)}function lW(e){var t="",s=0,n,o,l=e.length,u=Zx;for(n=0;n<l;n++)n%3===0&&n&&(t+=u[s>>18&63],t+=u[s>>12&63],t+=u[s>>6&63],t+=u[s&63]),s=(s<<8)+e[n];return o=l%3,o===0?(t+=u[s>>18&63],t+=u[s>>12&63],t+=u[s>>6&63],t+=u[s&63]):o===2?(t+=u[s>>10&63],t+=u[s>>4&63],t+=u[s<<2&63],t+=u[64]):o===1&&(t+=u[s>>2&63],t+=u[s<<4&63],t+=u[64],t+=u[64]),t}function cW(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var J5=new Ps("tag:yaml.org,2002:binary",{kind:"scalar",resolve:aW,construct:oW,predicate:cW,represent:lW}),uW=Object.prototype.hasOwnProperty,dW=Object.prototype.toString;function hW(e){if(e===null)return!0;var t=[],s,n,o,l,u,h=e;for(s=0,n=h.length;s<n;s+=1){if(o=h[s],u=!1,dW.call(o)!=="[object Object]")return!1;for(l in o)if(uW.call(o,l))if(!u)u=!0;else return!1;if(!u)return!1;if(t.indexOf(l)===-1)t.push(l);else return!1}return!0}function fW(e){return e!==null?e:[]}var ej=new Ps("tag:yaml.org,2002:omap",{kind:"sequence",resolve:hW,construct:fW}),mW=Object.prototype.toString;function pW(e){if(e===null)return!0;var t,s,n,o,l,u=e;for(l=new Array(u.length),t=0,s=u.length;t<s;t+=1){if(n=u[t],mW.call(n)!=="[object Object]"||(o=Object.keys(n),o.length!==1))return!1;l[t]=[o[0],n[o[0]]]}return!0}function gW(e){if(e===null)return[];var t,s,n,o,l,u=e;for(l=new Array(u.length),t=0,s=u.length;t<s;t+=1)n=u[t],o=Object.keys(n),l[t]=[o[0],n[o[0]]];return l}var tj=new Ps("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:pW,construct:gW}),bW=Object.prototype.hasOwnProperty;function xW(e){if(e===null)return!0;var t,s=e;for(t in s)if(bW.call(s,t)&&s[t]!==null)return!1;return!0}function vW(e){return e!==null?e:{}}var sj=new Ps("tag:yaml.org,2002:set",{kind:"mapping",resolve:xW,construct:vW}),Qx=K5.extend({implicit:[Z5,Q5],explicit:[J5,ej,tj,sj]}),fa=Object.prototype.hasOwnProperty,nf=1,nj=2,ij=3,rf=4,u0=1,_W=2,qk=3,yW=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,SW=/[\x85\u2028\u2029]/,wW=/[,\[\]\{\}]/,rj=/^(?:!|!!|![a-z\-]+!)$/i,aj=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function Vk(e){return Object.prototype.toString.call(e)}function Li(e){return e===10||e===13}function Qa(e){return e===9||e===32}function gn(e){return e===9||e===32||e===10||e===13}function il(e){return e===44||e===91||e===93||e===123||e===125}function kW(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}function NW(e){return e===120?2:e===117?4:e===85?8:0}function CW(e){return 48<=e&&e<=57?e-48:-1}function Gk(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
184
+ `:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"…":e===95?" ":e===76?"\u2028":e===80?"\u2029":""}function EW(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function oj(e,t,s){t==="__proto__"?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:s}):e[t]=s}var lj=new Array(256),cj=new Array(256);for(var Zo=0;Zo<256;Zo++)lj[Zo]=Gk(Zo)?1:0,cj[Zo]=Gk(Zo);function jW(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||Qx,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function uj(e,t){var s={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return s.snippet=MG(s),new Zs(t,s)}function Ie(e,t){throw uj(e,t)}function af(e,t){e.onWarning&&e.onWarning.call(null,uj(e,t))}var Wk={YAML:function(t,s,n){var o,l,u;t.version!==null&&Ie(t,"duplication of %YAML directive"),n.length!==1&&Ie(t,"YAML directive accepts exactly one argument"),o=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),o===null&&Ie(t,"ill-formed argument of the YAML directive"),l=parseInt(o[1],10),u=parseInt(o[2],10),l!==1&&Ie(t,"unacceptable YAML version of the document"),t.version=n[0],t.checkLineBreaks=u<2,u!==1&&u!==2&&af(t,"unsupported YAML version of the document")},TAG:function(t,s,n){var o,l;n.length!==2&&Ie(t,"TAG directive accepts exactly two arguments"),o=n[0],l=n[1],rj.test(o)||Ie(t,"ill-formed tag handle (first argument) of the TAG directive"),fa.call(t.tagMap,o)&&Ie(t,'there is a previously declared suffix for "'+o+'" tag handle'),aj.test(l)||Ie(t,"ill-formed tag prefix (second argument) of the TAG directive");try{l=decodeURIComponent(l)}catch{Ie(t,"tag prefix is malformed: "+l)}t.tagMap[o]=l}};function ua(e,t,s,n){var o,l,u,h;if(t<s){if(h=e.input.slice(t,s),n)for(o=0,l=h.length;o<l;o+=1)u=h.charCodeAt(o),u===9||32<=u&&u<=1114111||Ie(e,"expected valid JSON character");else yW.test(h)&&Ie(e,"the stream contains non-printable characters");e.result+=h}}function Kk(e,t,s,n){var o,l,u,h;for(vs.isObject(s)||Ie(e,"cannot merge mappings; the provided source object is unacceptable"),o=Object.keys(s),u=0,h=o.length;u<h;u+=1)l=o[u],fa.call(t,l)||(oj(t,l,s[l]),n[l]=!0)}function rl(e,t,s,n,o,l,u,h,m){var d,p;if(Array.isArray(o))for(o=Array.prototype.slice.call(o),d=0,p=o.length;d<p;d+=1)Array.isArray(o[d])&&Ie(e,"nested arrays are not supported inside keys"),typeof o=="object"&&Vk(o[d])==="[object Object]"&&(o[d]="[object Object]");if(typeof o=="object"&&Vk(o)==="[object Object]"&&(o="[object Object]"),o=String(o),t===null&&(t={}),n==="tag:yaml.org,2002:merge")if(Array.isArray(l))for(d=0,p=l.length;d<p;d+=1)Kk(e,t,l[d],s);else Kk(e,t,l,s);else!e.json&&!fa.call(s,o)&&fa.call(t,o)&&(e.line=u||e.line,e.lineStart=h||e.lineStart,e.position=m||e.position,Ie(e,"duplicated mapping key")),oj(t,o,l),delete s[o];return t}function Jx(e){var t;t=e.input.charCodeAt(e.position),t===10?e.position++:t===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):Ie(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function ds(e,t,s){for(var n=0,o=e.input.charCodeAt(e.position);o!==0;){for(;Qa(o);)o===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),o=e.input.charCodeAt(++e.position);if(t&&o===35)do o=e.input.charCodeAt(++e.position);while(o!==10&&o!==13&&o!==0);if(Li(o))for(Jx(e),o=e.input.charCodeAt(e.position),n++,e.lineIndent=0;o===32;)e.lineIndent++,o=e.input.charCodeAt(++e.position);else break}return s!==-1&&n!==0&&e.lineIndent<s&&af(e,"deficient indentation"),n}function Tf(e){var t=e.position,s;return s=e.input.charCodeAt(t),!!((s===45||s===46)&&s===e.input.charCodeAt(t+1)&&s===e.input.charCodeAt(t+2)&&(t+=3,s=e.input.charCodeAt(t),s===0||gn(s)))}function ev(e,t){t===1?e.result+=" ":t>1&&(e.result+=vs.repeat(`
185
+ `,t-1))}function TW(e,t,s){var n,o,l,u,h,m,d,p,g=e.kind,x=e.result,_;if(_=e.input.charCodeAt(e.position),gn(_)||il(_)||_===35||_===38||_===42||_===33||_===124||_===62||_===39||_===34||_===37||_===64||_===96||(_===63||_===45)&&(o=e.input.charCodeAt(e.position+1),gn(o)||s&&il(o)))return!1;for(e.kind="scalar",e.result="",l=u=e.position,h=!1;_!==0;){if(_===58){if(o=e.input.charCodeAt(e.position+1),gn(o)||s&&il(o))break}else if(_===35){if(n=e.input.charCodeAt(e.position-1),gn(n))break}else{if(e.position===e.lineStart&&Tf(e)||s&&il(_))break;if(Li(_))if(m=e.line,d=e.lineStart,p=e.lineIndent,ds(e,!1,-1),e.lineIndent>=t){h=!0,_=e.input.charCodeAt(e.position);continue}else{e.position=u,e.line=m,e.lineStart=d,e.lineIndent=p;break}}h&&(ua(e,l,u,!1),ev(e,e.line-m),l=u=e.position,h=!1),Qa(_)||(u=e.position+1),_=e.input.charCodeAt(++e.position)}return ua(e,l,u,!1),e.result?!0:(e.kind=g,e.result=x,!1)}function AW(e,t){var s,n,o;if(s=e.input.charCodeAt(e.position),s!==39)return!1;for(e.kind="scalar",e.result="",e.position++,n=o=e.position;(s=e.input.charCodeAt(e.position))!==0;)if(s===39)if(ua(e,n,e.position,!0),s=e.input.charCodeAt(++e.position),s===39)n=e.position,e.position++,o=e.position;else return!0;else Li(s)?(ua(e,n,o,!0),ev(e,ds(e,!1,t)),n=o=e.position):e.position===e.lineStart&&Tf(e)?Ie(e,"unexpected end of the document within a single quoted scalar"):(e.position++,o=e.position);Ie(e,"unexpected end of the stream within a single quoted scalar")}function RW(e,t){var s,n,o,l,u,h;if(h=e.input.charCodeAt(e.position),h!==34)return!1;for(e.kind="scalar",e.result="",e.position++,s=n=e.position;(h=e.input.charCodeAt(e.position))!==0;){if(h===34)return ua(e,s,e.position,!0),e.position++,!0;if(h===92){if(ua(e,s,e.position,!0),h=e.input.charCodeAt(++e.position),Li(h))ds(e,!1,t);else if(h<256&&lj[h])e.result+=cj[h],e.position++;else if((u=NW(h))>0){for(o=u,l=0;o>0;o--)h=e.input.charCodeAt(++e.position),(u=kW(h))>=0?l=(l<<4)+u:Ie(e,"expected hexadecimal character");e.result+=EW(l),e.position++}else Ie(e,"unknown escape sequence");s=n=e.position}else Li(h)?(ua(e,s,n,!0),ev(e,ds(e,!1,t)),s=n=e.position):e.position===e.lineStart&&Tf(e)?Ie(e,"unexpected end of the document within a double quoted scalar"):(e.position++,n=e.position)}Ie(e,"unexpected end of the stream within a double quoted scalar")}function MW(e,t){var s=!0,n,o,l,u=e.tag,h,m=e.anchor,d,p,g,x,_,S=Object.create(null),w,k,C,T;if(T=e.input.charCodeAt(e.position),T===91)p=93,_=!1,h=[];else if(T===123)p=125,_=!0,h={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=h),T=e.input.charCodeAt(++e.position);T!==0;){if(ds(e,!0,t),T=e.input.charCodeAt(e.position),T===p)return e.position++,e.tag=u,e.anchor=m,e.kind=_?"mapping":"sequence",e.result=h,!0;s?T===44&&Ie(e,"expected the node content, but found ','"):Ie(e,"missed comma between flow collection entries"),k=w=C=null,g=x=!1,T===63&&(d=e.input.charCodeAt(e.position+1),gn(d)&&(g=x=!0,e.position++,ds(e,!0,t))),n=e.line,o=e.lineStart,l=e.position,ml(e,t,nf,!1,!0),k=e.tag,w=e.result,ds(e,!0,t),T=e.input.charCodeAt(e.position),(x||e.line===n)&&T===58&&(g=!0,T=e.input.charCodeAt(++e.position),ds(e,!0,t),ml(e,t,nf,!1,!0),C=e.result),_?rl(e,h,S,k,w,C,n,o,l):g?h.push(rl(e,null,S,k,w,C,n,o,l)):h.push(w),ds(e,!0,t),T=e.input.charCodeAt(e.position),T===44?(s=!0,T=e.input.charCodeAt(++e.position)):s=!1}Ie(e,"unexpected end of the stream within a flow collection")}function DW(e,t){var s,n,o=u0,l=!1,u=!1,h=t,m=0,d=!1,p,g;if(g=e.input.charCodeAt(e.position),g===124)n=!1;else if(g===62)n=!0;else return!1;for(e.kind="scalar",e.result="";g!==0;)if(g=e.input.charCodeAt(++e.position),g===43||g===45)u0===o?o=g===43?qk:_W:Ie(e,"repeat of a chomping mode identifier");else if((p=CW(g))>=0)p===0?Ie(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):u?Ie(e,"repeat of an indentation width identifier"):(h=t+p-1,u=!0);else break;if(Qa(g)){do g=e.input.charCodeAt(++e.position);while(Qa(g));if(g===35)do g=e.input.charCodeAt(++e.position);while(!Li(g)&&g!==0)}for(;g!==0;){for(Jx(e),e.lineIndent=0,g=e.input.charCodeAt(e.position);(!u||e.lineIndent<h)&&g===32;)e.lineIndent++,g=e.input.charCodeAt(++e.position);if(!u&&e.lineIndent>h&&(h=e.lineIndent),Li(g)){m++;continue}if(e.lineIndent<h){o===qk?e.result+=vs.repeat(`
186
+ `,l?1+m:m):o===u0&&l&&(e.result+=`
187
+ `);break}for(n?Qa(g)?(d=!0,e.result+=vs.repeat(`
188
+ `,l?1+m:m)):d?(d=!1,e.result+=vs.repeat(`
189
+ `,m+1)):m===0?l&&(e.result+=" "):e.result+=vs.repeat(`
190
+ `,m):e.result+=vs.repeat(`
191
+ `,l?1+m:m),l=!0,u=!0,m=0,s=e.position;!Li(g)&&g!==0;)g=e.input.charCodeAt(++e.position);ua(e,s,e.position,!1)}return!0}function Yk(e,t){var s,n=e.tag,o=e.anchor,l=[],u,h=!1,m;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=l),m=e.input.charCodeAt(e.position);m!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,Ie(e,"tab characters must not be used in indentation")),!(m!==45||(u=e.input.charCodeAt(e.position+1),!gn(u))));){if(h=!0,e.position++,ds(e,!0,-1)&&e.lineIndent<=t){l.push(null),m=e.input.charCodeAt(e.position);continue}if(s=e.line,ml(e,t,ij,!1,!0),l.push(e.result),ds(e,!0,-1),m=e.input.charCodeAt(e.position),(e.line===s||e.lineIndent>t)&&m!==0)Ie(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break}return h?(e.tag=n,e.anchor=o,e.kind="sequence",e.result=l,!0):!1}function OW(e,t,s){var n,o,l,u,h,m,d=e.tag,p=e.anchor,g={},x=Object.create(null),_=null,S=null,w=null,k=!1,C=!1,T;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=g),T=e.input.charCodeAt(e.position);T!==0;){if(!k&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,Ie(e,"tab characters must not be used in indentation")),n=e.input.charCodeAt(e.position+1),l=e.line,(T===63||T===58)&&gn(n))T===63?(k&&(rl(e,g,x,_,S,null,u,h,m),_=S=w=null),C=!0,k=!0,o=!0):k?(k=!1,o=!0):Ie(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,T=n;else{if(u=e.line,h=e.lineStart,m=e.position,!ml(e,s,nj,!1,!0))break;if(e.line===l){for(T=e.input.charCodeAt(e.position);Qa(T);)T=e.input.charCodeAt(++e.position);if(T===58)T=e.input.charCodeAt(++e.position),gn(T)||Ie(e,"a whitespace character is expected after the key-value separator within a block mapping"),k&&(rl(e,g,x,_,S,null,u,h,m),_=S=w=null),C=!0,k=!1,o=!1,_=e.tag,S=e.result;else if(C)Ie(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=d,e.anchor=p,!0}else if(C)Ie(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=d,e.anchor=p,!0}if((e.line===l||e.lineIndent>t)&&(k&&(u=e.line,h=e.lineStart,m=e.position),ml(e,t,rf,!0,o)&&(k?S=e.result:w=e.result),k||(rl(e,g,x,_,S,w,u,h,m),_=S=w=null),ds(e,!0,-1),T=e.input.charCodeAt(e.position)),(e.line===l||e.lineIndent>t)&&T!==0)Ie(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return k&&rl(e,g,x,_,S,null,u,h,m),C&&(e.tag=d,e.anchor=p,e.kind="mapping",e.result=g),C}function LW(e){var t,s=!1,n=!1,o,l,u;if(u=e.input.charCodeAt(e.position),u!==33)return!1;if(e.tag!==null&&Ie(e,"duplication of a tag property"),u=e.input.charCodeAt(++e.position),u===60?(s=!0,u=e.input.charCodeAt(++e.position)):u===33?(n=!0,o="!!",u=e.input.charCodeAt(++e.position)):o="!",t=e.position,s){do u=e.input.charCodeAt(++e.position);while(u!==0&&u!==62);e.position<e.length?(l=e.input.slice(t,e.position),u=e.input.charCodeAt(++e.position)):Ie(e,"unexpected end of the stream within a verbatim tag")}else{for(;u!==0&&!gn(u);)u===33&&(n?Ie(e,"tag suffix cannot contain exclamation marks"):(o=e.input.slice(t-1,e.position+1),rj.test(o)||Ie(e,"named tag handle cannot contain such characters"),n=!0,t=e.position+1)),u=e.input.charCodeAt(++e.position);l=e.input.slice(t,e.position),wW.test(l)&&Ie(e,"tag suffix cannot contain flow indicator characters")}l&&!aj.test(l)&&Ie(e,"tag name cannot contain such characters: "+l);try{l=decodeURIComponent(l)}catch{Ie(e,"tag name is malformed: "+l)}return s?e.tag=l:fa.call(e.tagMap,o)?e.tag=e.tagMap[o]+l:o==="!"?e.tag="!"+l:o==="!!"?e.tag="tag:yaml.org,2002:"+l:Ie(e,'undeclared tag handle "'+o+'"'),!0}function zW(e){var t,s;if(s=e.input.charCodeAt(e.position),s!==38)return!1;for(e.anchor!==null&&Ie(e,"duplication of an anchor property"),s=e.input.charCodeAt(++e.position),t=e.position;s!==0&&!gn(s)&&!il(s);)s=e.input.charCodeAt(++e.position);return e.position===t&&Ie(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function BW(e){var t,s,n;if(n=e.input.charCodeAt(e.position),n!==42)return!1;for(n=e.input.charCodeAt(++e.position),t=e.position;n!==0&&!gn(n)&&!il(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&Ie(e,"name of an alias node must contain at least one character"),s=e.input.slice(t,e.position),fa.call(e.anchorMap,s)||Ie(e,'unidentified alias "'+s+'"'),e.result=e.anchorMap[s],ds(e,!0,-1),!0}function ml(e,t,s,n,o){var l,u,h,m=1,d=!1,p=!1,g,x,_,S,w,k;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,l=u=h=rf===s||ij===s,n&&ds(e,!0,-1)&&(d=!0,e.lineIndent>t?m=1:e.lineIndent===t?m=0:e.lineIndent<t&&(m=-1)),m===1)for(;LW(e)||zW(e);)ds(e,!0,-1)?(d=!0,h=l,e.lineIndent>t?m=1:e.lineIndent===t?m=0:e.lineIndent<t&&(m=-1)):h=!1;if(h&&(h=d||o),(m===1||rf===s)&&(nf===s||nj===s?w=t:w=t+1,k=e.position-e.lineStart,m===1?h&&(Yk(e,k)||OW(e,k,w))||MW(e,w)?p=!0:(u&&DW(e,w)||AW(e,w)||RW(e,w)?p=!0:BW(e)?(p=!0,(e.tag!==null||e.anchor!==null)&&Ie(e,"alias node should not have any properties")):TW(e,w,nf===s)&&(p=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):m===0&&(p=h&&Yk(e,k))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&Ie(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),g=0,x=e.implicitTypes.length;g<x;g+=1)if(S=e.implicitTypes[g],S.resolve(e.result)){e.result=S.construct(e.result),e.tag=S.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(fa.call(e.typeMap[e.kind||"fallback"],e.tag))S=e.typeMap[e.kind||"fallback"][e.tag];else for(S=null,_=e.typeMap.multi[e.kind||"fallback"],g=0,x=_.length;g<x;g+=1)if(e.tag.slice(0,_[g].tag.length)===_[g].tag){S=_[g];break}S||Ie(e,"unknown tag !<"+e.tag+">"),e.result!==null&&S.kind!==e.kind&&Ie(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+S.kind+'", not "'+e.kind+'"'),S.resolve(e.result,e.tag)?(e.result=S.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):Ie(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||p}function IW(e){var t=e.position,s,n,o,l=!1,u;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(u=e.input.charCodeAt(e.position))!==0&&(ds(e,!0,-1),u=e.input.charCodeAt(e.position),!(e.lineIndent>0||u!==37));){for(l=!0,u=e.input.charCodeAt(++e.position),s=e.position;u!==0&&!gn(u);)u=e.input.charCodeAt(++e.position);for(n=e.input.slice(s,e.position),o=[],n.length<1&&Ie(e,"directive name must not be less than one character in length");u!==0;){for(;Qa(u);)u=e.input.charCodeAt(++e.position);if(u===35){do u=e.input.charCodeAt(++e.position);while(u!==0&&!Li(u));break}if(Li(u))break;for(s=e.position;u!==0&&!gn(u);)u=e.input.charCodeAt(++e.position);o.push(e.input.slice(s,e.position))}u!==0&&Jx(e),fa.call(Wk,n)?Wk[n](e,n,o):af(e,'unknown document directive "'+n+'"')}if(ds(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,ds(e,!0,-1)):l&&Ie(e,"directives end mark is expected"),ml(e,e.lineIndent-1,rf,!1,!0),ds(e,!0,-1),e.checkLineBreaks&&SW.test(e.input.slice(t,e.position))&&af(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&Tf(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,ds(e,!0,-1));return}if(e.position<e.length-1)Ie(e,"end of the stream or a document separator is expected");else return}function dj(e,t){e=String(e),t=t||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
192
+ `),e.charCodeAt(0)===65279&&(e=e.slice(1)));var s=new jW(e,t),n=e.indexOf("\0");for(n!==-1&&(s.position=n,Ie(s,"null byte is not allowed in input")),s.input+="\0";s.input.charCodeAt(s.position)===32;)s.lineIndent+=1,s.position+=1;for(;s.position<s.length-1;)IW(s);return s.documents}function PW(e,t,s){t!==null&&typeof t=="object"&&typeof s>"u"&&(s=t,t=null);var n=dj(e,s);if(typeof t!="function")return n;for(var o=0,l=n.length;o<l;o+=1)t(n[o])}function $W(e,t){var s=dj(e,t);if(s.length!==0){if(s.length===1)return s[0];throw new Zs("expected a single document in the stream, but found more")}}var HW=PW,UW=$W,hj={loadAll:HW,load:UW},fj=Object.prototype.toString,mj=Object.prototype.hasOwnProperty,tv=65279,FW=9,cu=10,qW=13,VW=32,GW=33,WW=34,Ab=35,KW=37,YW=38,XW=39,ZW=42,pj=44,QW=45,of=58,JW=61,eK=62,tK=63,sK=64,gj=91,bj=93,nK=96,xj=123,iK=124,vj=125,Ws={};Ws[0]="\\0";Ws[7]="\\a";Ws[8]="\\b";Ws[9]="\\t";Ws[10]="\\n";Ws[11]="\\v";Ws[12]="\\f";Ws[13]="\\r";Ws[27]="\\e";Ws[34]='\\"';Ws[92]="\\\\";Ws[133]="\\N";Ws[160]="\\_";Ws[8232]="\\L";Ws[8233]="\\P";var rK=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],aK=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function oK(e,t){var s,n,o,l,u,h,m;if(t===null)return{};for(s={},n=Object.keys(t),o=0,l=n.length;o<l;o+=1)u=n[o],h=String(t[u]),u.slice(0,2)==="!!"&&(u="tag:yaml.org,2002:"+u.slice(2)),m=e.compiledTypeMap.fallback[u],m&&mj.call(m.styleAliases,h)&&(h=m.styleAliases[h]),s[u]=h;return s}function lK(e){var t,s,n;if(t=e.toString(16).toUpperCase(),e<=255)s="x",n=2;else if(e<=65535)s="u",n=4;else if(e<=4294967295)s="U",n=8;else throw new Zs("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+s+vs.repeat("0",n-t.length)+t}var cK=1,uu=2;function uK(e){this.schema=e.schema||Qx,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=vs.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=oK(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType=e.quotingType==='"'?uu:cK,this.forceQuotes=e.forceQuotes||!1,this.replacer=typeof e.replacer=="function"?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function Xk(e,t){for(var s=vs.repeat(" ",t),n=0,o=-1,l="",u,h=e.length;n<h;)o=e.indexOf(`
193
+ `,n),o===-1?(u=e.slice(n),n=h):(u=e.slice(n,o+1),n=o+1),u.length&&u!==`
194
+ `&&(l+=s),l+=u;return l}function Rb(e,t){return`
195
+ `+vs.repeat(" ",e.indent*t)}function dK(e,t){var s,n,o;for(s=0,n=e.implicitTypes.length;s<n;s+=1)if(o=e.implicitTypes[s],o.resolve(t))return!0;return!1}function lf(e){return e===VW||e===FW}function du(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==tv||65536<=e&&e<=1114111}function Zk(e){return du(e)&&e!==tv&&e!==qW&&e!==cu}function Qk(e,t,s){var n=Zk(e),o=n&&!lf(e);return(s?n:n&&e!==pj&&e!==gj&&e!==bj&&e!==xj&&e!==vj)&&e!==Ab&&!(t===of&&!o)||Zk(t)&&!lf(t)&&e===Ab||t===of&&o}function hK(e){return du(e)&&e!==tv&&!lf(e)&&e!==QW&&e!==tK&&e!==of&&e!==pj&&e!==gj&&e!==bj&&e!==xj&&e!==vj&&e!==Ab&&e!==YW&&e!==ZW&&e!==GW&&e!==iK&&e!==JW&&e!==eK&&e!==XW&&e!==WW&&e!==KW&&e!==sK&&e!==nK}function fK(e){return!lf(e)&&e!==of}function Uc(e,t){var s=e.charCodeAt(t),n;return s>=55296&&s<=56319&&t+1<e.length&&(n=e.charCodeAt(t+1),n>=56320&&n<=57343)?(s-55296)*1024+n-56320+65536:s}function _j(e){var t=/^\n* /;return t.test(e)}var yj=1,Mb=2,Sj=3,wj=4,Jo=5;function mK(e,t,s,n,o,l,u,h){var m,d=0,p=null,g=!1,x=!1,_=n!==-1,S=-1,w=hK(Uc(e,0))&&fK(Uc(e,e.length-1));if(t||u)for(m=0;m<e.length;d>=65536?m+=2:m++){if(d=Uc(e,m),!du(d))return Jo;w=w&&Qk(d,p,h),p=d}else{for(m=0;m<e.length;d>=65536?m+=2:m++){if(d=Uc(e,m),d===cu)g=!0,_&&(x=x||m-S-1>n&&e[S+1]!==" ",S=m);else if(!du(d))return Jo;w=w&&Qk(d,p,h),p=d}x=x||_&&m-S-1>n&&e[S+1]!==" "}return!g&&!x?w&&!u&&!o(e)?yj:l===uu?Jo:Mb:s>9&&_j(e)?Jo:u?l===uu?Jo:Mb:x?wj:Sj}function pK(e,t,s,n,o){e.dump=(function(){if(t.length===0)return e.quotingType===uu?'""':"''";if(!e.noCompatMode&&(rK.indexOf(t)!==-1||aK.test(t)))return e.quotingType===uu?'"'+t+'"':"'"+t+"'";var l=e.indent*Math.max(1,s),u=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-l),h=n||e.flowLevel>-1&&s>=e.flowLevel;function m(d){return dK(e,d)}switch(mK(t,h,e.indent,u,m,e.quotingType,e.forceQuotes&&!n,o)){case yj:return t;case Mb:return"'"+t.replace(/'/g,"''")+"'";case Sj:return"|"+Jk(t,e.indent)+eN(Xk(t,l));case wj:return">"+Jk(t,e.indent)+eN(Xk(gK(t,u),l));case Jo:return'"'+bK(t)+'"';default:throw new Zs("impossible error: invalid scalar style")}})()}function Jk(e,t){var s=_j(e)?String(t):"",n=e[e.length-1]===`
196
+ `,o=n&&(e[e.length-2]===`
197
+ `||e===`
198
+ `),l=o?"+":n?"":"-";return s+l+`
199
+ `}function eN(e){return e[e.length-1]===`
200
+ `?e.slice(0,-1):e}function gK(e,t){for(var s=/(\n+)([^\n]*)/g,n=(function(){var d=e.indexOf(`
201
+ `);return d=d!==-1?d:e.length,s.lastIndex=d,tN(e.slice(0,d),t)})(),o=e[0]===`
202
+ `||e[0]===" ",l,u;u=s.exec(e);){var h=u[1],m=u[2];l=m[0]===" ",n+=h+(!o&&!l&&m!==""?`
203
+ `:"")+tN(m,t),o=l}return n}function tN(e,t){if(e===""||e[0]===" ")return e;for(var s=/ [^ ]/g,n,o=0,l,u=0,h=0,m="";n=s.exec(e);)h=n.index,h-o>t&&(l=u>o?u:h,m+=`
204
+ `+e.slice(o,l),o=l+1),u=h;return m+=`
205
+ `,e.length-o>t&&u>o?m+=e.slice(o,u)+`
206
+ `+e.slice(u+1):m+=e.slice(o),m.slice(1)}function bK(e){for(var t="",s=0,n,o=0;o<e.length;s>=65536?o+=2:o++)s=Uc(e,o),n=Ws[s],!n&&du(s)?(t+=e[o],s>=65536&&(t+=e[o+1])):t+=n||lK(s);return t}function xK(e,t,s){var n="",o=e.tag,l,u,h;for(l=0,u=s.length;l<u;l+=1)h=s[l],e.replacer&&(h=e.replacer.call(s,String(l),h)),(xr(e,t,h,!1,!1)||typeof h>"u"&&xr(e,t,null,!1,!1))&&(n!==""&&(n+=","+(e.condenseFlow?"":" ")),n+=e.dump);e.tag=o,e.dump="["+n+"]"}function sN(e,t,s,n){var o="",l=e.tag,u,h,m;for(u=0,h=s.length;u<h;u+=1)m=s[u],e.replacer&&(m=e.replacer.call(s,String(u),m)),(xr(e,t+1,m,!0,!0,!1,!0)||typeof m>"u"&&xr(e,t+1,null,!0,!0,!1,!0))&&((!n||o!=="")&&(o+=Rb(e,t)),e.dump&&cu===e.dump.charCodeAt(0)?o+="-":o+="- ",o+=e.dump);e.tag=l,e.dump=o||"[]"}function vK(e,t,s){var n="",o=e.tag,l=Object.keys(s),u,h,m,d,p;for(u=0,h=l.length;u<h;u+=1)p="",n!==""&&(p+=", "),e.condenseFlow&&(p+='"'),m=l[u],d=s[m],e.replacer&&(d=e.replacer.call(s,m,d)),xr(e,t,m,!1,!1)&&(e.dump.length>1024&&(p+="? "),p+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),xr(e,t,d,!1,!1)&&(p+=e.dump,n+=p));e.tag=o,e.dump="{"+n+"}"}function _K(e,t,s,n){var o="",l=e.tag,u=Object.keys(s),h,m,d,p,g,x;if(e.sortKeys===!0)u.sort();else if(typeof e.sortKeys=="function")u.sort(e.sortKeys);else if(e.sortKeys)throw new Zs("sortKeys must be a boolean or a function");for(h=0,m=u.length;h<m;h+=1)x="",(!n||o!=="")&&(x+=Rb(e,t)),d=u[h],p=s[d],e.replacer&&(p=e.replacer.call(s,d,p)),xr(e,t+1,d,!0,!0,!0)&&(g=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,g&&(e.dump&&cu===e.dump.charCodeAt(0)?x+="?":x+="? "),x+=e.dump,g&&(x+=Rb(e,t)),xr(e,t+1,p,!0,g)&&(e.dump&&cu===e.dump.charCodeAt(0)?x+=":":x+=": ",x+=e.dump,o+=x));e.tag=l,e.dump=o||"{}"}function nN(e,t,s){var n,o,l,u,h,m;for(o=s?e.explicitTypes:e.implicitTypes,l=0,u=o.length;l<u;l+=1)if(h=o[l],(h.instanceOf||h.predicate)&&(!h.instanceOf||typeof t=="object"&&t instanceof h.instanceOf)&&(!h.predicate||h.predicate(t))){if(s?h.multi&&h.representName?e.tag=h.representName(t):e.tag=h.tag:e.tag="?",h.represent){if(m=e.styleMap[h.tag]||h.defaultStyle,fj.call(h.represent)==="[object Function]")n=h.represent(t,m);else if(mj.call(h.represent,m))n=h.represent[m](t,m);else throw new Zs("!<"+h.tag+'> tag resolver accepts not "'+m+'" style');e.dump=n}return!0}return!1}function xr(e,t,s,n,o,l,u){e.tag=null,e.dump=s,nN(e,s,!1)||nN(e,s,!0);var h=fj.call(e.dump),m=n,d;n&&(n=e.flowLevel<0||e.flowLevel>t);var p=h==="[object Object]"||h==="[object Array]",g,x;if(p&&(g=e.duplicates.indexOf(s),x=g!==-1),(e.tag!==null&&e.tag!=="?"||x||e.indent!==2&&t>0)&&(o=!1),x&&e.usedDuplicates[g])e.dump="*ref_"+g;else{if(p&&x&&!e.usedDuplicates[g]&&(e.usedDuplicates[g]=!0),h==="[object Object]")n&&Object.keys(e.dump).length!==0?(_K(e,t,e.dump,o),x&&(e.dump="&ref_"+g+e.dump)):(vK(e,t,e.dump),x&&(e.dump="&ref_"+g+" "+e.dump));else if(h==="[object Array]")n&&e.dump.length!==0?(e.noArrayIndent&&!u&&t>0?sN(e,t-1,e.dump,o):sN(e,t,e.dump,o),x&&(e.dump="&ref_"+g+e.dump)):(xK(e,t,e.dump),x&&(e.dump="&ref_"+g+" "+e.dump));else if(h==="[object String]")e.tag!=="?"&&pK(e,e.dump,t,l,m);else{if(h==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new Zs("unacceptable kind of an object to dump "+h)}e.tag!==null&&e.tag!=="?"&&(d=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?d="!"+d:d.slice(0,18)==="tag:yaml.org,2002:"?d="!!"+d.slice(18):d="!<"+d+">",e.dump=d+" "+e.dump)}return!0}function yK(e,t){var s=[],n=[],o,l;for(Db(e,s,n),o=0,l=n.length;o<l;o+=1)t.duplicates.push(s[n[o]]);t.usedDuplicates=new Array(l)}function Db(e,t,s){var n,o,l;if(e!==null&&typeof e=="object")if(o=t.indexOf(e),o!==-1)s.indexOf(o)===-1&&s.push(o);else if(t.push(e),Array.isArray(e))for(o=0,l=e.length;o<l;o+=1)Db(e[o],t,s);else for(n=Object.keys(e),o=0,l=n.length;o<l;o+=1)Db(e[n[o]],t,s)}function SK(e,t){t=t||{};var s=new uK(t);s.noRefs||yK(e,s);var n=e;return s.replacer&&(n=s.replacer.call({"":n},"",n)),xr(s,0,n,!0,!0)?s.dump+`
207
+ `:""}var wK=SK,kK={dump:wK};function sv(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var NK=Ps,CK=I5,EK=U5,jK=W5,TK=K5,AK=Qx,RK=hj.load,MK=hj.loadAll,DK=kK.dump,OK=Zs,LK={binary:J5,float:G5,map:H5,null:F5,pairs:tj,set:sj,timestamp:Z5,bool:q5,int:V5,merge:Q5,omap:ej,seq:$5,str:P5},zK=sv("safeLoad","load"),BK=sv("safeLoadAll","loadAll"),IK=sv("safeDump","dump"),PK={Type:NK,Schema:CK,FAILSAFE_SCHEMA:EK,JSON_SCHEMA:jK,CORE_SCHEMA:TK,DEFAULT_SCHEMA:AK,load:RK,loadAll:MK,dump:DK,YAMLException:OK,types:LK,safeLoad:zK,safeLoadAll:BK,safeDump:IK};function kj(e){return e!==null&&typeof e=="object"}function Nj(e){return typeof e=="string"?"text-rose-700 dark:text-rose-300":typeof e=="number"?"text-emerald-700 dark:text-emerald-300":typeof e=="boolean"?"text-blue-700 dark:text-blue-400":e==null?"text-muted-foreground italic":"text-foreground"}function Cj(e){return e==null?"null":typeof e=="string"?e===""?'""':e:String(e)}function Ej({label:e,value:t,depth:s,defaultOpen:n}){const[o,l]=y.useState(n),u={paddingLeft:`${s*1.1}rem`};if(!kj(t))return r.jsxs("div",{className:"flex items-baseline gap-2 py-[1px]",style:u,children:[r.jsxs("span",{className:"text-muted-foreground",children:[e,":"]}),r.jsx("span",{className:ie("whitespace-pre-wrap break-words",Nj(t)),children:Cj(t)})]});const h=Array.isArray(t)?t.map((d,p)=>[String(p),d]):Object.entries(t),m=Array.isArray(t)?`[${h.length}]`:`{${h.length}}`;return r.jsxs("div",{children:[r.jsxs("button",{type:"button",onClick:()=>l(d=>!d),className:"flex w-full items-center gap-1 py-[1px] text-left hover:bg-muted",style:u,children:[o?r.jsx(Mn,{className:"size-3.5 shrink-0 text-muted-foreground"}):r.jsx(Jn,{className:"size-3.5 shrink-0 text-muted-foreground"}),r.jsx("span",{className:"font-medium text-foreground",children:e}),r.jsx("span",{className:"text-muted-foreground",children:m})]}),o?h.map(([d,p])=>r.jsx(Ej,{label:d,value:p,depth:s+1,defaultOpen:s<1},d)):null]})}function $K({content:e}){const t=y.useMemo(()=>{try{const n=PK.loadAll(e);return{value:n.length<=1?n[0]:n,error:null}}catch(n){return{value:null,error:n instanceof Error?n.message:String(n)}}},[e]);if(t.error)return r.jsx("div",{className:"p-4",children:r.jsxs($e,{variant:"destructive",children:["Could not parse YAML: ",t.error]})});if(!kj(t.value))return r.jsx("div",{className:"p-4 font-mono text-[12px]",children:r.jsx("span",{className:Nj(t.value),children:Cj(t.value)})});const s=Array.isArray(t.value)?t.value.map((n,o)=>[String(o),n]):Object.entries(t.value);return r.jsx("div",{className:"min-w-max px-4 py-3 font-mono text-[12px] leading-[1.6]",children:s.map(([n,o])=>r.jsx(Ej,{label:n,value:o,depth:0,defaultOpen:!0},n))})}const HK=y.lazy(()=>MV(()=>import("./code-editor-BnSokx6t.js"),[]).then(e=>({default:e.CodeEditor})));function UK(e){const t=e.split("/").pop()?.toLowerCase().split(".").pop()??"";return t==="md"||t==="mdx"||t==="markdown"?"markdown":t==="yml"||t==="yaml"?"yaml":null}function FK(e){const t=e.split("/").pop()?.toLowerCase()??"",s=t.includes(".")?t.split(".").pop()??"":"",n={ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",kt:"kotlin",swift:"swift",c:"c",h:"c",cpp:"cpp",cc:"cpp",hpp:"cpp",cs:"csharp",sh:"bash",bash:"bash",zsh:"bash",json:"json",yaml:"yaml",yml:"yaml",toml:"ini",ini:"ini",md:"markdown",mdx:"markdown",css:"css",scss:"scss",less:"less",html:"xml",xml:"xml",sql:"sql",dockerfile:"dockerfile"};return n[s]?n[s]:t==="dockerfile"?"dockerfile":null}function qK(e,t){const s=e.endsWith(`
208
+ `)?e.slice(0,-1):e;return!t||!jb.getLanguage(t)?s.split(`
209
+ `).map(iN):s.split(`
210
+ `).map(n=>{if(!n)return"";try{return jb.highlight(n,{language:t,ignoreIllegals:!0}).value}catch{return iN(n)}})}function iN(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function VK({content:e,path:t}){const s=y.useMemo(()=>FK(t),[t]),n=y.useMemo(()=>qK(e,s),[e,s]),o=`${Math.max(2,String(n.length).length)}ch`;return r.jsx("div",{className:"min-w-max font-mono text-[12px] leading-[1.5]",children:n.map((l,u)=>r.jsxs("div",{className:"flex",children:[r.jsx("span",{className:"shrink-0 select-none border-r border-zinc-200 bg-zinc-100 px-2 text-right text-zinc-400 dark:border-zinc-800 dark:bg-zinc-900 dark:text-zinc-500",style:{minWidth:`calc(${o} + 1rem)`},children:u+1}),r.jsx("span",{className:"hljs whitespace-pre px-3 text-zinc-800 dark:text-zinc-100",dangerouslySetInnerHTML:{__html:l||" "}})]},u))})}function GK({path:e,isModified:t,onViewDiff:s,onFileSaved:n,onSendToAi:o}){const[l,u]=y.useState(null),[h,m]=y.useState(""),[d,p]=y.useState(!1),[g,x]=y.useState(null),[_,S]=y.useState(!1),[w,k]=y.useState(!1),{success:C,error:T}=Es(),E=y.useMemo(()=>UK(e),[e]),[j,M]=y.useState("preview"),z=!!(l&&!l.binary&&!l.truncated),O=l?h!==l.content:!1;y.useEffect(()=>{M(E?"preview":"source"),p(!1)},[E]),y.useEffect(()=>{if(!e){u(null);return}let B=!0;return S(!0),x(null),p(!1),L6(e).then(P=>{B&&(u(P),m(P.content),S(!1))}).catch(P=>{B&&(x(P instanceof Error?P.message:String(P)),S(!1))}),()=>{B=!1}},[e]);async function A(){if(!(!e||!l||!O||w)){k(!0);try{await z6(e,h);const B={...l,content:h,size:new TextEncoder().encode(h).length};u(B),p(!1),C(`Saved ${e}.`),n?.(e)}catch(B){T(B instanceof Error?B.message:String(B))}finally{k(!1)}}}function D(){m(l?.content??""),p(!1)}return e?r.jsxs("section",{className:"flex min-h-0 min-w-0 flex-col border-l border-border bg-card",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-1.5",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:e}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-muted-foreground",children:[r.jsx("span",{children:"Read-only view of tracked file."}),l?.truncated?r.jsx("span",{className:"text-amber-700",children:"Truncated — file exceeds 1MB."}):null,l?.binary?r.jsx("span",{className:"text-amber-700",children:"Binary file."}):null]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[E&&!l?.binary?r.jsxs("div",{className:"flex items-center rounded-md border border-border p-0.5",children:[r.jsxs("button",{type:"button",onClick:()=>M("preview"),"aria-pressed":j==="preview",className:ie("flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium transition-colors",j==="preview"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"),children:[r.jsx(qb,{className:"size-3.5"}),"Preview"]}),r.jsxs("button",{type:"button",onClick:()=>M("source"),"aria-pressed":j==="source",className:ie("flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium transition-colors",j==="source"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"),children:[r.jsx(jN,{className:"size-3.5"}),"Source"]})]}):null,t?r.jsx(Y,{onClick:s,size:"sm",type:"button",variant:"outline",children:"View diff"}):null,o?r.jsx(Y,{"aria-label":"Send file to AI input",className:"size-8",disabled:!e,onClick:o,size:"icon",title:"Send file path to AI input",type:"button",variant:"outline",children:r.jsx(Tt,{className:"size-4"})}):null,d?r.jsxs(r.Fragment,{children:[r.jsxs(Y,{disabled:!O||w,onClick:()=>{A()},size:"sm",type:"button",children:[r.jsx(qN,{}),"Apply"]}),r.jsxs(Y,{disabled:w,onClick:D,size:"sm",type:"button",variant:"outline",children:[r.jsx(Ft,{}),"Cancel"]})]}):z?r.jsxs(Y,{onClick:()=>{M("source"),p(!0)},size:"sm",type:"button",variant:"outline",children:[r.jsx(ll,{}),"Edit"]}):null]})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-auto bg-zinc-50 dark:bg-zinc-950",children:g?r.jsx("div",{className:"p-4",children:r.jsx($e,{variant:"destructive",children:g})}):_?r.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading…"}):l?.binary?r.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Cannot display binary content."}):l?d?r.jsx(y.Suspense,{fallback:r.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading editor…"}),children:r.jsx(HK,{path:e,value:h,onChange:m})}):E&&j==="preview"?E==="markdown"?r.jsx(vG,{content:l.content}):r.jsx($K,{content:l.content}):r.jsx(VK,{content:l.content,path:e}):null})]}):r.jsx("div",{className:"p-4",children:r.jsx($e,{variant:"muted",className:"border-dashed p-12 text-center",children:"Select a file to view its contents."})})}function WK({activeHunkIndex:e,filePaths:t,hunkCount:s,pendingNextFilePath:n,selectedFile:o}){if(s>0&&e<s-1)return{kind:"hunk",activeHunkIndex:e+1};const l=t.indexOf(o),u=t[l+1];return u?n===u?{kind:"file",filePath:u}:{kind:"confirm-next-file",filePath:u}:{kind:"none"}}function rN(e){const t={name:"",fullPath:"",children:new Map};for(const s of e){const n=s.name.split("/");let o=t;n.forEach((l,u)=>{let h=o.children.get(l);h||(h={name:l,fullPath:n.slice(0,u+1).join("/"),children:new Map},o.children.set(l,h)),o=h}),o.branch=s}return t}function aN({label:e,tree:t,onSelect:s,defaultOpen:n,forceOpen:o}){const[l,u]=y.useState(n??!1),h=o||l,m=t.children.size===0;return r.jsxs("div",{className:"mb-1",children:[r.jsxs("button",{type:"button",onClick:()=>u(d=>!d),className:"flex w-full items-center gap-1 px-2 py-0.5 text-left text-[11px] font-semibold uppercase tracking-wide text-muted-foreground hover:text-foreground",children:[h?r.jsx(Mn,{size:12}):r.jsx(Jn,{size:12}),e,m?null:r.jsxs("span",{className:"ml-1 text-[10px] font-normal",children:["(",t.children.size,")"]})]}),h&&!m?r.jsx("ul",{children:Array.from(t.children.values()).map(d=>r.jsx(jj,{node:d,depth:1,onSelect:s,forceOpen:o},d.fullPath))}):null]})}function jj({node:e,depth:t,onSelect:s,forceOpen:n}){const[o,l]=y.useState(!0),u=n||o,h=e.children.size>0,m=e.branch,d={paddingLeft:`${t*10}px`};return!h&&m?r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>s(m),style:d,title:m.name,className:`flex w-full items-center gap-1.5 py-0.5 pr-2 text-left text-[12px] hover:bg-muted/60 ${m.current?"font-semibold text-emerald-700":""}`,children:[r.jsx(sn,{size:11,className:"shrink-0 opacity-70"}),r.jsx("span",{className:"truncate",children:e.name}),m.current?r.jsx("span",{className:"text-[10px]",children:"●"}):null]})}):r.jsxs("li",{children:[r.jsxs("button",{type:"button",onClick:()=>{m?s(m):l(p=>!p)},style:d,className:"flex w-full items-center gap-1 py-0.5 pr-2 text-left text-[12px] hover:bg-muted/60",children:[h?u?r.jsx(Mn,{size:11}):r.jsx(Jn,{size:11}):r.jsx("span",{className:"inline-block w-[11px]"}),r.jsx("span",{className:"truncate",children:e.name})]}),u&&h?r.jsx("ul",{children:Array.from(e.children.values()).map(p=>r.jsx(jj,{node:p,depth:t+1,onSelect:s,forceOpen:n},p.fullPath))}):null]})}function KK({selectedCommit:e,selectedFile:t,diff:s,diffLoading:n,diffError:o}){return r.jsxs("section",{className:"flex min-h-0 min-w-0 flex-col bg-card border-b border-border",children:[r.jsx("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-1.5",children:r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:t??(e?e.subject:"Commit")}),e?r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-muted-foreground",children:[r.jsx("span",{className:"font-mono",children:e.hash.slice(0,12)}),r.jsxs("span",{children:[e.author," <",e.email,">"]}),r.jsx("span",{children:new Date(e.timestamp*1e3).toLocaleString()})]}):null]})}),r.jsx("div",{className:"relative min-h-0 min-w-0 flex-1",children:o?r.jsx("div",{className:"p-4",children:r.jsx($e,{variant:"destructive",children:o})}):e?n?r.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading diff…"}):s?r.jsx(_u,{activeHunkIndex:0,diff:s}):r.jsx("div",{className:"p-4",children:r.jsx($e,{variant:"muted",className:"border-dashed p-6 text-center",children:e.parents.length>1?"Merge commit with no conflict resolution — no diff against the first parent.":"No textual changes in this commit."})}):r.jsx("div",{className:"p-4",children:r.jsx($e,{variant:"muted",className:"border-dashed p-12 text-center",children:"Select a commit to inspect its diff."})})})]})}function YK({files:e,filesError:t,selectedHash:s,selectedFile:n,onSelect:o}){return r.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden border-r border-border",children:[r.jsx("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-1.5",children:r.jsxs("h2",{className:"text-[13px] font-semibold tracking-tight",children:["Files",e.length?r.jsx("span",{className:"ml-2 text-[11px] font-normal text-muted-foreground",children:e.length}):null]})}),r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:t?r.jsx("div",{className:"p-3",children:r.jsx($e,{variant:"destructive",children:t})}):s?e.length===0?r.jsx("div",{className:"p-3 text-[12px] text-muted-foreground",children:"No file changes."}):r.jsx("ul",{className:"divide-y divide-border",children:e.map(l=>r.jsx("li",{children:r.jsxs("button",{onClick:()=>o(l.path),type:"button",title:l.path,className:`flex w-full items-center gap-2 px-2 py-1 text-left text-[12px] transition-colors hover:bg-muted/60 ${n===l.path?"bg-muted":""}`,children:[r.jsx("span",{className:XK(l.index),children:l.index.trim()||"·"}),r.jsx("span",{className:"truncate font-mono",children:l.path})]})},l.path))}):r.jsx("div",{className:"p-3 text-[12px] text-muted-foreground",children:"Select a commit to see its files."})})]})}function XK(e){const t="inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-[10px] font-bold";switch(e.trim().toUpperCase()){case"A":return`${t} bg-emerald-100 text-emerald-800 dark:bg-emerald-500/15 dark:text-emerald-300`;case"D":return`${t} bg-red-100 text-red-800 dark:bg-red-500/15 dark:text-red-300`;case"M":return`${t} bg-amber-100 text-amber-800 dark:bg-amber-500/15 dark:text-amber-300`;case"R":return`${t} bg-blue-100 text-blue-800 dark:bg-blue-500/15 dark:text-blue-300`;case"C":return`${t} bg-indigo-100 text-indigo-800 dark:bg-indigo-500/15 dark:text-indigo-300`;default:return`${t} bg-slate-100 text-slate-700 dark:bg-slate-500/15 dark:text-slate-300`}}const oN=["#3b82f6","#10b981","#f59e0b","#ec4899","#8b5cf6","#14b8a6","#ef4444","#84cc16"];function Tc(e){return oN[e%oN.length]}function ZK({lane:e,laneCount:t,edges:s,throughLanes:n,isMerge:o,height:l=28,laneWidth:u=14}){const m=Math.max(e+1,t,1)*u,d=l/2,p=Ac(e,u),g=o?4:3.5;return r.jsxs("svg",{width:m,height:l,viewBox:`0 0 ${m} ${l}`,style:{flex:"0 0 auto",display:"block"},children:[n.map(x=>r.jsx("line",{x1:Ac(x,u),y1:0,x2:Ac(x,u),y2:l,stroke:Tc(x),strokeWidth:1.5},`t-${x}`)),r.jsx("line",{x1:p,y1:0,x2:p,y2:d,stroke:Tc(e),strokeWidth:1.5}),s.map((x,_)=>{const S=Ac(x.fromLane,u),w=Ac(x.toLane,u);if(S===w)return r.jsx("line",{x1:S,y1:d,x2:w,y2:l,stroke:Tc(x.toLane),strokeWidth:1.5},`e-${_}`);const k=d+(l-d)/2;return r.jsx("path",{d:`M ${S} ${d} C ${S} ${k}, ${w} ${k}, ${w} ${l}`,fill:"none",stroke:Tc(x.toLane),strokeWidth:1.5},`e-${_}`)}),r.jsx("circle",{cx:p,cy:d,r:g,fill:Tc(e),stroke:"var(--background, #fff)",strokeWidth:1.5})]})}function Ac(e,t){return e*t+t/2}const QK=5,Ob=new Map,d0=new Map,Lb=[];let zb=0;function lN(){for(;zb<QK&&Lb.length>0;){const e=Lb.shift();e&&(zb++,e())}}function JK(e){return Ob.get(e)}function eY(e){const t=Ob.get(e);if(t)return Promise.resolve(t);const s=d0.get(e);if(s)return s;const n=new Promise((o,l)=>{Lb.push(()=>{t8(e).then(u=>{u.state!=="pending"&&Ob.set(e,u),o(u)}).catch(l).finally(()=>{zb--,d0.delete(e),lN()})})});return d0.set(e,n),lN(),n}function tY({sha:e}){const[t,s]=y.useState(()=>JK(e)??null),n=y.useRef(null);if(y.useEffect(()=>{if(t)return;const u=n.current;if(!u||typeof IntersectionObserver>"u")return;let h=!0;const m=new IntersectionObserver(d=>{d.some(p=>p.isIntersecting)&&(m.disconnect(),eY(e).then(p=>{h&&s(p)}).catch(()=>{}))},{rootMargin:"200px"});return m.observe(u),()=>{h=!1,m.disconnect()}},[e,t]),!t||t.state==="unknown"||t.totalCount===0)return r.jsx("span",{ref:n,"aria-hidden":!0,className:"inline-block size-2 shrink-0"});const o=sY(t.state),l=`CI: ${t.state} (${t.totalCount} check${t.totalCount!==1?"s":""})`;return r.jsx("span",{"aria-label":l,className:`shrink-0 size-2 rounded-full ${o}`,title:l})}function sY(e){switch(e){case"success":return"bg-emerald-500";case"pending":return"bg-amber-400 animate-pulse";case"failure":return"bg-red-500";case"error":return"bg-orange-500";default:return"bg-zinc-400"}}const cN=28;function nY({commits:e,loading:t,error:s,selectedHash:n,maxLanes:o,rowRefs:l,onSelect:u,onLoadMore:h}){const{sendToAgent:m}=At(),[d,p]=y.useState(null);function g(x,_){p(null),m({prompt:fB(x,_),source:{type:"git-commit",label:x.hash.slice(0,7)},label:`${x.hash.slice(0,7)}: ${_}`})}return r.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden border-r border-border",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-1.5",children:[r.jsxs("h2",{className:"text-[13px] font-semibold tracking-tight",children:["Commit tree",e.length?r.jsxs("span",{className:"ml-2 text-[11px] font-normal text-muted-foreground",children:[e.length," commits"]}):null]}),r.jsx(Y,{disabled:t,onClick:h,size:"sm",type:"button",variant:"outline",children:"Load more"})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:s?r.jsx("div",{className:"p-3",children:r.jsx($e,{variant:"destructive",children:s})}):t&&e.length===0?r.jsx("div",{className:"p-3 text-[12px] text-muted-foreground",children:"Loading commits…"}):e.length===0?r.jsx("div",{className:"p-3 text-[12px] text-muted-foreground",children:"No commits."}):r.jsx("ul",{className:"divide-y divide-border",children:e.map(x=>r.jsxs("li",{ref:_=>{_?l.current.set(x.hash,_):l.current.delete(x.hash)},className:"group flex flex-col",children:[r.jsxs("div",{className:`flex items-center transition-colors hover:bg-muted/60 ${n===x.hash?"bg-muted":""}`,children:[r.jsxs("button",{onClick:()=>u(x.hash),type:"button",className:"flex min-w-0 flex-1 items-center gap-2 px-2 py-0.5 text-left",style:{minHeight:cN},title:`${x.hash}
211
+ ${x.author} <${x.email}>
212
+ ${x.subject}`,children:[r.jsx(ZK,{lane:x.lane,laneCount:Math.max(x.laneCount,o),edges:x.edges,throughLanes:x.throughLanes,isMerge:x.parents.length>1,height:cN}),r.jsxs("span",{className:"flex items-center gap-1 font-mono text-[10px] text-muted-foreground",children:[x.hash.slice(0,7),r.jsx(tY,{sha:x.hash})]}),r.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[x.refs.map(_=>r.jsx("span",{className:rY(_.kind),children:_.name},`${_.kind}-${_.name}`)),r.jsx("span",{className:"truncate text-[12px]",children:x.subject})]}),r.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:x.author}),r.jsx("span",{className:"shrink-0 font-mono text-[10px] tabular-nums text-muted-foreground/70",title:new Date(x.timestamp*1e3).toLocaleString(),children:iY(x.timestamp)})]}),r.jsx(hl,{className:`mr-1 shrink-0 ${d===x.hash?"opacity-100":""}`,label:`Ask AI about commit ${x.hash.slice(0,7)}`,onAsk:()=>p(_=>_===x.hash?null:x.hash)})]}),d===x.hash?r.jsx("div",{className:"px-2 pb-1.5 pt-0.5",children:r.jsx(yu,{placeholder:"What should the agent do with this commit? (explain, summarize, find regressions…)",onSubmit:_=>g(x,_),onCancel:()=>p(null)})}):null]},x.hash))})})]})}function iY(e){if(!e)return"";const t=Math.max(0,Math.floor(Date.now()/1e3-e));if(t<60)return`${t}s`;const s=Math.floor(t/60);if(s<60)return`${s}m`;const n=Math.floor(s/60);if(n<24)return`${n}h`;const o=Math.floor(n/24);if(o<30)return`${o}d`;const l=Math.floor(o/30);return l<12?`${l}mo`:`${Math.floor(l/12)}y`}function rY(e){const t="rounded border px-1.5 py-px text-[10px] font-medium";switch(e){case"head":return`${t} border-emerald-200 bg-emerald-100 text-emerald-800 dark:border-emerald-400/30 dark:bg-emerald-500/15 dark:text-emerald-300`;case"branch":return`${t} border-blue-200 bg-blue-100 text-blue-800 dark:border-blue-400/30 dark:bg-blue-500/15 dark:text-blue-300`;case"remote":return`${t} border-slate-200 bg-slate-100 text-slate-700 dark:border-zinc-700/80 dark:bg-zinc-800/80 dark:text-zinc-300`;case"tag":return`${t} border-amber-200 bg-amber-100 text-amber-800 dark:border-amber-400/30 dark:bg-amber-500/15 dark:text-amber-300`}}const uN=200;function aY(){const[e,t]=y.useState([]),[s,n]=y.useState(uN),[o,l]=y.useState(!0),[u,h]=y.useState(null),[m,d]=y.useState(null),[p,g]=y.useState([]),[x,_]=y.useState(!1),[S,w]=y.useState(null),[k,C]=y.useState(null),[T,E]=y.useState(""),[j,M]=y.useState(!1),[z,O]=y.useState(null),A=y.useCallback(P=>{d(P),g([]),C(null),E("")},[]);y.useEffect(()=>{let P=!0;return l(!0),h(null),A6(s).then(H=>{P&&(t(H),H.length>0&&!H.some($=>$.hash===m)&&A(H[0].hash))}).catch(H=>{P&&h(H instanceof Error?H.message:String(H))}).finally(()=>{P&&l(!1)}),()=>{P=!1}},[s]),y.useEffect(()=>{if(!m){g([]),C(null),_(!1);return}let P=!0;return w(null),_(!0),M6(m).then(H=>{P&&(g(H),C(H[0]?.path??null))}).catch(H=>{P&&w(H instanceof Error?H.message:String(H))}).finally(()=>{P&&_(!1)}),()=>{P=!1}},[m]),y.useEffect(()=>{if(!m||!k){E(""),M(!1);return}let P=!0;return O(null),M(!0),R6(m,k).then(H=>{P&&E(H)}).catch(H=>{P&&O(H instanceof Error?H.message:String(H))}).finally(()=>{P&&M(!1)}),()=>{P=!1}},[m,k]);const D=y.useMemo(()=>e.reduce((P,H)=>Math.max(P,H.laneCount),1),[e]),B=e.find(P=>P.hash===m)??null;return{commits:e,loading:o,error:u,selectedHash:m,setSelectedHash:A,files:p,filesError:S,selectedFile:k,setSelectedFile:C,diff:T,diffLoading:j||x,diffError:z,maxLanes:D,selectedCommit:B,loadMore:()=>n(P=>P+uN)}}function oY({branches:e=[]}){const{commits:t,loading:s,error:n,selectedHash:o,setSelectedHash:l,files:u,filesError:h,selectedFile:m,setSelectedFile:d,diff:p,diffLoading:g,diffError:x,maxLanes:_,selectedCommit:S,loadMore:w}=aY(),[k,C]=y.useState(""),T=y.useMemo(()=>{const A=k.trim().toLowerCase();return A?e.filter(D=>D.name.toLowerCase().includes(A)):e},[e,k]),E=y.useMemo(()=>rN(T.filter(A=>!A.remote)),[T]),j=y.useMemo(()=>rN(T.filter(A=>A.remote)),[T]),M=k.trim().length>0,z=y.useRef(new Map);function O(A){const D=A.remote?"remote":"branch",B=t.find($=>$.refs.some(q=>q.kind===D&&q.name===A.name));if(!B)return;l(B.hash);const P=z.current.get(B.hash),H=P?.parentElement?.parentElement;!P||!H||H.scrollTo({top:Math.max(P.offsetTop-H.clientHeight/2+P.clientHeight/2,0),behavior:"smooth"})}return r.jsxs("div",{className:"grid h-full min-h-0 overflow-hidden border-0 bg-card/85 grid-cols-[220px_minmax(0,1fr)]",children:[r.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden border-r border-border",children:[r.jsxs("div",{className:"flex shrink-0 flex-col gap-1 border-b border-border px-3 py-1.5",children:[r.jsx("h2",{className:"text-[13px] font-semibold tracking-tight",children:"Branches"}),r.jsx("input",{type:"search",value:k,onChange:A=>C(A.target.value),placeholder:"Search branches…",className:"w-full rounded border border-border bg-background px-2 py-1 text-[11px] outline-none focus:border-foreground"})]}),r.jsxs("div",{className:"min-h-0 flex-1 overflow-auto py-1",children:[r.jsx(aN,{label:"Local",tree:E,onSelect:O,defaultOpen:!0,forceOpen:M}),r.jsx(aN,{label:"Remote",tree:j,onSelect:O,forceOpen:M})]})]}),r.jsxs("div",{className:"grid min-h-0 min-w-0 grid-rows-[minmax(0,3fr)_minmax(0,2fr)]",children:[r.jsx(KK,{selectedCommit:S,selectedFile:m,diff:p,diffLoading:g,diffError:x}),r.jsxs("div",{className:"grid min-h-0 min-w-0 grid-cols-[minmax(0,1fr)_280px]",children:[r.jsx(nY,{commits:t,loading:s,error:n,selectedHash:o,maxLanes:_,rowRefs:z,onSelect:l,onLoadMore:w}),r.jsx(YK,{files:u,filesError:h,selectedHash:o,selectedFile:m,onSelect:d})]})]})]})}function lY({repo:e,file:t,onClose:s}){const[n,o]=y.useState(""),[l,u]=y.useState(null),[h,m]=y.useState(!0);y.useEffect(()=>{let p=!0;return m(!0),u(null),sC(t,e).then(g=>{p&&o(g)}).catch(g=>{p&&u(g instanceof Error?g.message:String(g))}).finally(()=>{p&&m(!1)}),()=>{p=!1}},[e,t]),y.useEffect(()=>{function p(g){g.key==="Escape"&&s()}return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[s]);const d=f3(n);return io.createPortal(r.jsxs("div",{className:"fixed inset-0 z-[1000] flex justify-end",children:[r.jsx("button",{"aria-label":"Close diff",className:"absolute inset-0 bg-black/35",onClick:s,type:"button"}),r.jsxs("div",{className:"relative z-10 flex h-full w-[min(900px,calc(100vw-3rem))] flex-col bg-card shadow-xl",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:t}),r.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground",children:[r.jsx("span",{className:"font-mono",children:e}),d.additions||d.deletions?r.jsxs("span",{className:"flex items-center gap-1 font-mono",children:[r.jsxs("span",{className:"text-emerald-700",children:["+",d.additions]}),r.jsxs("span",{className:"text-red-700",children:["-",d.deletions]})]}):null]})]}),r.jsx(Y,{"aria-label":"Close diff",onClick:s,size:"icon",variant:"ghost",children:r.jsx(Ft,{})})]}),r.jsx("div",{className:"relative min-h-0 min-w-0 flex-1",children:l?r.jsx("div",{className:"p-4",children:r.jsx($e,{variant:"destructive",children:l})}):h?r.jsx("div",{className:"p-4 text-xs text-muted-foreground",children:"Loading diff…"}):r.jsx(_u,{diff:n||"No unstaged diff for this file."})})]})]}),document.body)}function Bb(e){return e.split(/[\\/]/).filter(Boolean).pop()??"project"}function cY({initialPath:e,onSelect:t,selectedPath:s}){const[n,o]=y.useState(e),[l,u]=y.useState(null),[h,m]=y.useState(null),[d,p]=y.useState(!1),g=uY(l);return y.useEffect(()=>{o(e)},[e]),y.useEffect(()=>{let x=!0;return p(!0),m(null),aC(n).then(_=>{x&&(u(_),t(_.path))}).catch(_=>{x&&m(_ instanceof Error?_.message:String(_))}).finally(()=>{x&&p(!1)}),()=>{x=!1}},[n,t]),r.jsxs("div",{className:"rounded-md border border-border bg-background",children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border p-2",children:[g?r.jsx(Y,{"aria-label":"Open parent folder",onClick:()=>l&&o(l.parent),size:"icon",type:"button",variant:"ghost",children:r.jsx(Mn,{className:"rotate-90"})}):null,r.jsx("div",{className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",children:l?.path??n}),d?r.jsx(ht,{className:"size-4 animate-spin text-muted-foreground"}):null]}),r.jsxs("div",{className:"max-h-56 overflow-auto p-1",children:[h?r.jsx($e,{variant:"destructive",className:"m-1",children:h}):null,!h&&l?.entries.length===0?r.jsx($e,{variant:"muted",className:"m-1 text-center",children:"No folders here."}):null,l?.entries.map(x=>r.jsxs(Y,{className:ie("h-8 w-full justify-start rounded-sm px-2 text-left",s===x.path&&"bg-muted"),onClick:()=>o(x.path),title:x.path,type:"button",variant:"ghost",children:[r.jsx(so,{className:"text-accent"}),r.jsx("span",{className:"truncate",children:x.name})]},x.path))]})]})}function uY(e){return!!(e&&e.parent!==e.path)}function dY({data:e,onRefresh:t}){const[s,n]=y.useState(!1),[o,l]=y.useState(e.git.cwd),[u,h]=y.useState(null),[m,d]=y.useState(!1),[p,g]=y.useState(e.git.cwd),x=y.useRef(null),_=e.git.selectedRepository,S=_?.name??(e.git.cwd?Bb(e.git.cwd):"Add Git project"),{error:w,success:k}=Es(),C=fY({gitCwd:e.git.cwd});y.useEffect(()=>{l(e.git.cwd),g(e.git.cwd)},[e.git.cwd]),y.useEffect(()=>{if(!s)return;function O(A){x.current&&A.target instanceof Node&&!x.current.contains(A.target)&&n(!1)}return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[s]);async function T(O){try{await en("/api/git/select",{name:O}),n(!1),await t(),k(`Switched to ${O}.`)}catch(A){w(A instanceof Error?A.message:String(A))}}async function E(O){const A=O.trim();if(!hY(A)){const D="Please add an absolute path. Paths beginning with ~ are not expanded here.";return h(D),w(D),!1}try{const D=Bb(A);return await en("/api/git/repositories",{name:D,path:A}),h(null),await t(),k(`Added Git project ${D}.`),!0}catch(D){const B=D instanceof Error?D.message:String(D);return h(B),w(B),!1}}async function j(O){try{await P6(O),await t(),k(`Removed Git project ${O}.`)}catch(A){w(A instanceof Error?A.message:String(A))}}async function M(O){O.preventDefault(),await E(o)&&n(!1)}function z(){h(null),g(C.selectedPath),d(!0)}return r.jsxs("div",{className:"relative z-50 flex items-center gap-2",ref:x,children:[r.jsxs(Y,{className:"max-w-[220px] justify-start gap-2 rounded-md border-border bg-card",onClick:()=>n(O=>!O),size:"sm",type:"button",variant:"outline",children:[r.jsx(so,{className:"text-muted-foreground"}),r.jsx("span",{className:"truncate",children:S}),r.jsx(Mn,{className:ie("ml-auto transition-transform",s&&"rotate-180")})]}),r.jsx(Y,{"aria-label":"Add Git project",onClick:z,size:"sm",type:"button",variant:"outline",children:r.jsx(hs,{})}),s?r.jsxs("div",{className:"absolute right-0 top-10 z-50 w-[min(380px,calc(100vw-2rem))] overflow-hidden rounded-lg border border-border bg-card shadow-lg",children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[r.jsx(Z4,{className:"size-3.5 text-muted-foreground"}),r.jsx("div",{className:"text-xs font-semibold",children:"Git Projects"}),r.jsx(ze,{className:"ml-auto h-5 px-1.5 text-[10px]",variant:"outline",children:e.config.gitRepositories.length})]}),r.jsx("div",{className:"max-h-72 overflow-auto",children:e.config.gitRepositories.length?r.jsx("div",{className:"divide-y divide-border",children:e.config.gitRepositories.map(O=>{const A=O.name===_?.name;return r.jsxs("div",{className:ie("group grid w-full grid-cols-[1fr_auto_auto] items-center gap-2 px-3 py-1.5 text-left transition-colors hover:bg-muted",A&&"bg-muted/70"),children:[r.jsxs("button",{className:"min-w-0 text-left",onClick:()=>{T(O.name)},type:"button",children:[r.jsx("span",{className:"block truncate text-sm font-medium leading-tight",children:O.name}),r.jsx("span",{className:"block truncate font-mono text-[10px] leading-tight text-muted-foreground",children:O.path})]}),A?r.jsx(tn,{className:"size-3.5"}):r.jsx("span",{className:"size-3.5"}),r.jsx(Y,{"aria-label":`Remove ${O.name}`,className:"size-6 opacity-0 transition-opacity group-hover:opacity-100",onClick:()=>{j(O.name)},size:"icon",title:`Remove ${O.name}`,type:"button",variant:"ghost",children:r.jsx(yr,{className:"size-3.5 text-destructive"})})]},O.name)})}):r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"No saved Git projects yet."})}),r.jsxs("div",{className:"border-t border-border bg-muted/20 p-2",children:[r.jsxs("form",{className:"flex gap-1.5",onSubmit:M,children:[r.jsx(tt,{"aria-label":"Paste absolute path",className:"h-7 flex-1 px-2 font-mono text-[11px]",onChange:O=>{l(O.target.value),h(null)},placeholder:"/absolute/path",value:o}),r.jsxs(Y,{className:"h-7 px-2 text-[11px]",size:"sm",type:"submit",children:[r.jsx(hs,{className:"size-3"}),"Add"]}),r.jsx(Y,{"aria-label":"Browse and add Git project",className:"h-7 px-2",onClick:z,size:"sm",type:"button",variant:"outline",children:r.jsx(LN,{className:"size-3"})})]}),u?r.jsx("div",{className:"mt-1.5 truncate text-[10px] text-destructive",children:u}):null]})]}):null,m?r.jsx(Tj,{confirmLabel:C.confirmLabel,errorMessage:u,initialPath:C.initialPath,selectedPath:p,title:"Add Git Project",onCancel:()=>d(!1),onSelect:g,onUse:async()=>{await E(p)&&(d(!1),n(!1))}}):null]})}function hY(e){return e.startsWith("/")}function fY({gitCwd:e}){return{confirmLabel:"Add Git project",initialPath:e,selectedPath:e}}function Tj({confirmLabel:e="Use this folder",errorMessage:t,initialPath:s,onCancel:n,onSelect:o,onUse:l,selectedPath:u,title:h="Choose Git Project Folder"}){return io.createPortal(r.jsx("div",{className:"fixed inset-0 z-[1000] grid place-items-center bg-black/35 px-4",children:r.jsxs("div",{className:"w-full max-w-2xl rounded-xl border border-border bg-card p-4 shadow-xl",children:[r.jsxs("div",{className:"mb-3 flex items-center gap-3",children:[r.jsx("div",{className:"flex size-8 items-center justify-center rounded-lg border border-border bg-background",children:r.jsx(so,{className:"size-4"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"text-sm font-semibold",children:h}),r.jsx("div",{className:"truncate font-mono text-xs text-muted-foreground",children:u})]}),r.jsx(Y,{"aria-label":"Close folder picker",onClick:n,size:"icon",variant:"ghost",children:r.jsx(Ft,{})})]}),r.jsx(cY,{initialPath:s,onSelect:o,selectedPath:u}),t?r.jsx("div",{className:"mt-3 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:t}):null,r.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[r.jsx(Y,{onClick:n,type:"button",variant:"outline",children:"Cancel"}),r.jsx(Y,{onClick:()=>{l()},type:"button",children:e})]})]})}),document.body)}const Rc=5,mY=240,Ib=8,pY=176+Ib;function gY({currentRepoPath:e}){const[t,s]=y.useState(null),[n,o]=y.useState([]),[l,u]=y.useState(null),[h,m]=y.useState(!0),[d,p]=y.useState(null),g=y.useRef(null),x=y.useRef(null),[_,S]=y.useState(0);y.useEffect(()=>{const $=x.current;if(!$)return;const q=new ResizeObserver(V=>{S(V[0].contentRect.width)});return q.observe($),()=>q.disconnect()},[t]);const w=y.useCallback(()=>{let $=!0;return m(!0),u(null),Ip().then(q=>{$&&(s(q.repos),o(q.board))}).catch(q=>{$&&u(q instanceof Error?q.message:String(q))}).finally(()=>{$&&m(!1)}),()=>{$=!1}},[]);y.useEffect(w,[w]);const k=y.useCallback(()=>{Ip().then($=>{s($.repos),o($.board)}).catch($=>{u($ instanceof Error?$.message:String($))})},[]),C=y.useCallback($=>{o($),Zy($).catch(q=>{u(q instanceof Error?q.message:String(q))})},[]),T=y.useCallback(async $=>{const q=$.trim();if(!q.startsWith("/"))return"Please add an absolute path (it must start with /).";try{const V=Bb(q);await en("/api/git/repositories",{name:V,path:q});const I=await Ip();s(I.repos);const W=(I.board.includes(V)?I.board:[...I.board,V]).slice(0,Rc);return o(W),await Zy(W),null}catch(V){return V instanceof Error?V.message:String(V)}},[]),E=new Map((t??[]).map($=>[$.name,$])),j=n.map($=>E.get($)).filter($=>!!$).slice(0,Rc),M=(t??[]).filter($=>!n.includes($.name)),z=j.length<Rc,O=Math.max(0,_-(z?pY:0)),A=_===0?Rc:Math.max(1,Math.floor((O+Ib)/(mY+Ib))),D=Math.min(j.length,A),B=j.slice(0,D),P=j.length-D;function H($){const q=g.current;if(g.current=null,q===null||q===$)return;const V=[...n],[I]=V.splice(q,1);V.splice($,0,I),C(V)}return r.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/85",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border bg-card/95 px-3 py-1.5",children:[r.jsxs("span",{className:"flex items-center gap-1.5 text-[12px] font-semibold tracking-tight",children:[r.jsx(Gb,{className:"size-3.5"}),"Repositories",t?r.jsxs(ze,{variant:"secondary",className:"ml-1",children:[j.length,t.length>j.length?` / ${t.length}`:""]}):null,P>0?r.jsxs("span",{className:"ml-1 text-[10px] font-normal text-muted-foreground",children:["+",P," hidden — widen the window or remove one"]}):null]}),r.jsxs(Y,{"aria-label":"Refresh repositories",disabled:h,onClick:w,size:"sm",type:"button",variant:"outline",children:[r.jsx(_r,{className:h?"animate-spin":void 0}),"Refresh"]})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:l?r.jsx($e,{variant:"destructive",className:"m-3",children:l}):t&&t.length===0?r.jsx($e,{variant:"muted",className:"m-3 text-center",children:"No Git projects registered. Add one with the project picker in the header."}):r.jsxs("div",{className:"flex h-full min-h-0 gap-2 p-2",ref:x,children:[B.map(($,q)=>r.jsx(bY,{repo:$,isCurrent:!!e&&$.path===e,selectedFile:d?.repo===$.name?d.file:"",onSelectFile:V=>p({repo:$.name,file:V}),onRemove:()=>C(n.filter(V=>V!==$.name)),onMutated:k,onDragStart:()=>{g.current=q},onDropColumn:()=>H(q)},$.name)),z?r.jsx(xY,{unpinned:M,onAdd:$=>C([...n,$].slice(0,Rc)),onRegister:T}):null]})}),d?r.jsx(lY,{repo:d.repo,file:d.file,onClose:()=>p(null)}):null]})}function bY({repo:e,isCurrent:t,selectedFile:s,onSelectFile:n,onRemove:o,onMutated:l,onDragStart:u,onDropColumn:h}){const[m,d]=y.useState(!1),[p,g]=y.useState(!1),[x,_]=y.useState(!1),S=y.useCallback(async(T,E)=>{if(E.length){g(!0);try{await T(E,e.name),l()}finally{g(!1)}}},[e.name,l]),w={busy:p,onStage:T=>{S(Yb,T)},onUnstage:T=>{S(nC,T)}},k=e.files.filter(T=>T.index.trim()&&T.index!=="?").length,C=x?Mn:Jn;return r.jsxs("div",{className:ie("flex min-w-0 flex-1 flex-col overflow-hidden rounded-md border border-border bg-card",t&&"border-primary/60 ring-1 ring-primary/30",m&&"ring-2 ring-foreground/40"),onDragOver:T=>{T.preventDefault(),d(!0)},onDragLeave:()=>d(!1),onDrop:()=>{d(!1),h()},children:[r.jsxs("div",{className:"flex shrink-0 cursor-grab items-center justify-between gap-1 border-b border-border bg-muted/40 px-1.5 py-1.5 active:cursor-grabbing",draggable:!0,onDragStart:u,children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[r.jsx(AR,{className:"size-3.5 shrink-0 text-muted-foreground/60"}),r.jsx("span",{className:"truncate text-[12px] font-semibold",title:e.path,children:e.name}),t?r.jsxs("span",{className:"flex shrink-0 items-center gap-0.5 rounded bg-primary px-1 py-px text-[9px] font-semibold uppercase tracking-wide text-primary-foreground",title:"The repository currently selected across NoMoreIDE",children:[r.jsx(tn,{className:"size-2.5"}),"Current"]}):null]}),r.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[r.jsxs("span",{className:"flex items-center gap-1 font-mono text-[10px] text-muted-foreground",children:[e.ahead?r.jsxs("span",{className:"flex items-center",title:`${e.ahead} ahead`,children:[r.jsx(df,{className:"size-3"}),e.ahead]}):null,e.behind?r.jsxs("span",{className:"flex items-center",title:`${e.behind} behind`,children:[r.jsx(uf,{className:"size-3"}),e.behind]}):null]}),r.jsx("button",{"aria-label":`Remove ${e.name} from board`,className:"rounded p-0.5 text-muted-foreground transition-colors hover:bg-background hover:text-foreground",onClick:o,title:"Remove from board (stays registered)",type:"button",children:r.jsx(Ft,{className:"size-3.5"})})]})]}),r.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:r.jsx(D5,{branch:e.branch||void 0,error:e.error,files:e.files,onSelectFile:n,root:e.path,selectedFile:s,staging:w})}),r.jsxs("div",{className:"shrink-0 border-t border-border",children:[r.jsxs("button",{"aria-expanded":x,className:"flex w-full items-center gap-1.5 bg-muted/40 px-2 py-1 text-left text-[11px] font-semibold uppercase tracking-tight text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:()=>_(T=>!T),type:"button",children:[r.jsx(C,{className:"size-3.5 shrink-0"}),r.jsx("span",{className:"flex-1",children:"Commit"}),k?r.jsxs(ze,{size:"small",variant:"secondary",children:[k," staged"]}):null]}),x?r.jsx(O5,{branch:e.branch||void 0,files:e.files,onDone:l,repo:e.name}):null]})]})}function xY({unpinned:e,onAdd:t,onRegister:s}){const[n,o]=y.useState(!1),[l,u]=y.useState(null),[h,m]=y.useState(""),[d,p]=y.useState(null),[g,x]=y.useState(!1),[_,S]=y.useState(!1),[w,k]=y.useState(""),C=y.useRef(null),T=y.useRef(null);function E(){if(n){o(!1);return}u(C.current?.getBoundingClientRect()??null),p(null),o(!0)}y.useEffect(()=>{if(!n)return;function z(O){const A=O.target;A instanceof Node&&(T.current?.contains(A)||C.current?.contains(A)||o(!1))}return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[n]);async function j(z){x(!0),p(null);const O=await s(z);return x(!1),O?(p(O),!1):(m(""),o(!1),!0)}async function M(z){z.preventDefault(),await j(h)}return r.jsxs("div",{className:"w-44 shrink-0",children:[r.jsxs("button",{ref:C,className:"flex h-full w-full flex-col items-center justify-center gap-1.5 rounded-md border border-dashed border-border text-muted-foreground transition-colors hover:border-foreground/40 hover:text-foreground",onClick:E,type:"button",children:[r.jsx(hs,{className:"size-5"}),r.jsx("span",{className:"text-[12px] font-medium",children:"Add repository"})]}),n&&l?io.createPortal(r.jsxs("div",{ref:T,className:"fixed z-[1000] w-72 overflow-hidden rounded-lg border border-border bg-card shadow-xl",style:{left:Math.max(8,Math.min(l.left,window.innerWidth-296)),top:Math.min(l.top,window.innerHeight-320)},children:[e.length?r.jsxs("div",{className:"border-b border-border",children:[r.jsx("div",{className:"px-3 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Pin a registered repo"}),r.jsx("div",{className:"max-h-52 overflow-auto pb-1",children:e.map(z=>r.jsxs("button",{className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm hover:bg-muted",onClick:()=>{t(z.name),o(!1)},type:"button",children:[r.jsx(Gb,{className:"size-3.5 shrink-0 text-muted-foreground"}),r.jsx("span",{className:"min-w-0 flex-1 truncate",title:z.path,children:z.name}),z.files.length?r.jsx(ze,{variant:"outline",className:"h-5 px-1.5 text-[10px]",children:z.files.length}):null]},z.name))})]}):null,r.jsxs("div",{className:"p-2.5",children:[r.jsx("div",{className:"pb-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Add a new repository"}),r.jsxs("form",{className:"flex gap-1.5",onSubmit:M,children:[r.jsx(tt,{"aria-label":"Repository absolute path",className:"h-7 flex-1 px-2 font-mono text-[11px]",onChange:z=>{m(z.target.value),p(null)},placeholder:"/absolute/path/to/repo",value:h}),r.jsx(Y,{className:"h-7 px-2 text-[11px]",disabled:g||!h.trim(),size:"sm",type:"submit",children:"Add"})]}),r.jsxs(Y,{className:"mt-1.5 h-7 w-full gap-1.5 text-[11px]",disabled:g,onClick:()=>{k(h.trim()||""),S(!0)},size:"sm",type:"button",variant:"outline",children:[r.jsx(LN,{className:"size-3"}),"Browse folders…"]}),d?r.jsx("div",{className:"mt-1.5 text-[10px] text-destructive",children:d}):null]})]}),document.body):null,_?r.jsx(Tj,{confirmLabel:"Add repository",errorMessage:d,initialPath:w||"/",selectedPath:w,title:"Add Repository",onCancel:()=>S(!1),onSelect:k,onUse:async()=>{await j(w)&&S(!1)}}):null]})}const Pb=300,vY=600,_Y=new Set(["md","mdx","markdown","txt","rst","adoc","json","jsonc","json5","yaml","yml","toml","xml","ini","cfg","conf","env","properties","csv","tsv","lock","svg","map","snap","png","jpg","jpeg","gif","ico","webp"]);function yY(e){const t=e.toLowerCase();if(t.endsWith(".d.ts")||t.endsWith(".min.js")||t.endsWith(".min.css"))return!1;const s=t.lastIndexOf(".");return s<0?!0:!_Y.has(t.slice(s+1))}function SY(e){return e>=vY?"danger":e>=Pb?"warn":"ok"}const wY={ok:"bg-emerald-500/60",warn:"bg-amber-500/70",danger:"bg-destructive/70"},kY={ok:"text-muted-foreground",warn:"text-amber-600 dark:text-amber-400",danger:"text-destructive"};function NY({onOpenFile:e,root:t}){const[s,n]=y.useState([]),[o,l]=y.useState(!0),[u,h]=y.useState(null),[m,d]=y.useState(!0);function p(){l(!0),h(null),O6().then(n).catch(w=>h(w instanceof Error?w.message:String(w))).finally(()=>l(!1))}y.useEffect(()=>{p()},[]);const g=y.useMemo(()=>m?s.filter(w=>yY(w.path)):s,[s,m]),x=s.length-g.length,_=g[0]?.lines??1,S=g.filter(w=>w.lines>=Pb).length;return r.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/85",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx(DN,{className:"size-4"}),r.jsx("span",{className:"font-semibold text-foreground",children:"Largest files"}),!o&&!u?r.jsxs("span",{children:[g.length," files · ",S," over ",Pb," lines",m&&x>0?` · ${x} data/docs hidden`:""]}):null]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsxs(Y,{size:"sm",variant:m?"default":"outline",className:"h-7",onClick:()=>d(w=>!w),title:"Hide docs, data, config and generated files",type:"button",children:[r.jsx(jN,{}),"Code only"]}),r.jsxs(Y,{size:"sm",variant:"outline",className:"h-7",onClick:p,disabled:o,type:"button",children:[o?r.jsx(ht,{className:"animate-spin"}):r.jsx(_r,{}),"Refresh"]})]})]}),u?r.jsx($e,{variant:"destructive",className:"m-3",children:u}):o&&s.length===0?r.jsxs("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:[r.jsx(ht,{className:"mr-2 size-4 animate-spin"}),"Scanning tracked files…"]}):g.length===0?r.jsx("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:s.length===0?"No tracked text files found.":"No code files — toggle off “Code only” to see data & docs."}):r.jsx("ul",{className:"min-h-0 flex-1 divide-y divide-border/60 overflow-auto",children:g.map((w,k)=>{const C=SY(w.lines);return r.jsxs("li",{className:"group flex items-center gap-3 px-3 transition-colors hover:bg-muted/50",children:[r.jsx("span",{className:"w-6 shrink-0 text-right font-mono text-[10px] text-muted-foreground",children:k+1}),r.jsx("button",{type:"button",onClick:()=>e(w.path),className:"min-w-0 flex-1 py-1.5 text-left",children:r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsx("span",{className:"truncate font-mono text-[11px]",children:w.path}),r.jsxs("span",{className:ie("shrink-0 font-mono text-[11px] tabular-nums",kY[C]),children:[w.truncated?"≥":"",w.lines.toLocaleString()," lines"]})]}),r.jsx("div",{className:"mt-1 h-1 w-full overflow-hidden rounded-full bg-muted",children:r.jsx("div",{className:ie("h-full rounded-full",wY[C]),style:{width:`${Math.max(2,w.lines/_*100)}%`}})})]})}),r.jsxs("div",{className:"flex shrink-0 items-center justify-end gap-0.5",children:[r.jsx(CY,{file:w,root:t}),r.jsx(EY,{file:w,root:t})]})]},w.path)})})]})}function CY({file:e,root:t}){const{sendToAgent:s}=At(),n=Su(t,e.path),o=e.path.split("/").pop()??e.path;function l(){s({prompt:hB({absolutePath:n,lines:e.lines,relativePath:e.path}),source:{label:o,type:"large-file"},label:`Help me split \`${e.path}\` (${e.lines.toLocaleString()} lines).`,mode:"send"})}function u(){s({prompt:n,source:{label:o,type:"large-file"},mode:"draft"})}return r.jsx(Aj,{label:`AI actions for ${e.path}`,trigger:r.jsx(Tt,{className:"size-3.5"}),children:h=>r.jsxs(r.Fragment,{children:[r.jsx(Zc,{icon:r.jsx(Tt,{className:"size-3.5"}),onSelect:()=>{h(),l()},children:"Ask AI to split this file"}),r.jsx(Zc,{icon:r.jsx(MN,{className:"size-3.5"}),onSelect:()=>{h(),u()},children:"Send file path to AI"})]})})}function EY({file:e,root:t}){const{error:s,success:n}=Es(),o=Su(t,e.path),l=e.path.split("/").pop()??e.path;async function u(h,m){try{await navigator.clipboard.writeText(h),n(`Copied ${m}.`)}catch(d){s(d instanceof Error?d.message:`Could not copy ${m}.`)}}return r.jsx(Aj,{label:`Copy path for ${e.path}`,trigger:r.jsxs(r.Fragment,{children:[r.jsx(AN,{className:"size-3.5"}),r.jsx("span",{className:"sr-only",children:"More actions"})]}),children:h=>r.jsxs(r.Fragment,{children:[r.jsx(Zc,{icon:r.jsx(Vb,{className:"size-3.5"}),onSelect:()=>{h(),u(l,"file name")},children:"Copy file name"}),r.jsx(Zc,{icon:r.jsx(Th,{className:"size-3.5"}),onSelect:()=>{h(),u(e.path,"relative path")},children:"Copy relative path"}),r.jsx(Zc,{icon:r.jsx(Th,{className:"size-3.5"}),onSelect:()=>{h(),u(o,"absolute path")},children:"Copy absolute path"})]})})}function Aj({children:e,label:t,trigger:s}){const[n,o]=y.useState(!1),[l,u]=y.useState({right:0,top:0}),h=y.useRef(null),m=y.useRef(null);function d(){o(!1)}function p(){const g=h.current?.getBoundingClientRect();g&&u({top:g.bottom+6,right:window.innerWidth-g.right}),o(x=>!x)}return y.useEffect(()=>{if(!n)return;function g(_){const S=_.target;h.current?.contains(S)||m.current?.contains(S)||d()}function x(_){_.key==="Escape"&&d()}return document.addEventListener("mousedown",g),document.addEventListener("keydown",x),window.addEventListener("scroll",d,!0),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",x),window.removeEventListener("scroll",d,!0)}},[n]),r.jsxs(r.Fragment,{children:[r.jsx("button",{"aria-label":t,className:ie("flex h-7 min-w-7 shrink-0 items-center justify-center gap-1 rounded-md px-1.5 text-muted-foreground opacity-0 transition-all duration-150 hover:bg-muted hover:text-foreground group-hover:opacity-100",n&&"bg-muted text-foreground opacity-100"),onClick:p,ref:h,title:t,type:"button",children:s}),n?io.createPortal(r.jsx("div",{className:"fixed z-50 w-56 overflow-hidden rounded-md border border-border bg-card p-1 shadow-md",ref:m,style:{top:l.top,right:l.right},children:e(d)}),document.body):null]})}function Zc({children:e,icon:t,onSelect:s}){return r.jsxs("button",{className:"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-xs text-foreground transition-colors hover:bg-muted",onClick:s,type:"button",children:[r.jsx("span",{className:"text-muted-foreground",children:t}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:e})]})}function dN(e,t,s){const n=e.trim(),o=n.toLowerCase(),l=[],u=/\breview|check|inspect|audit\b/.test(o),h=/\btest|verify|ci\b/.test(o),m=/\bcommit\b/.test(o)||/\bship|push|pr|pull request\b/.test(o),d=/\bpush|ship|pr|pull request\b/.test(o),p=/\bpr\b|pull request/.test(o),g=TY(o,s);return p&&l.push({kind:"action",id:"assert-pr-branch",title:"Check PR branch",op:"assert-pr-branch"}),u&&(l.push(dh("gate-review","Approve review","Review the current changes?")),l.push(Mc("review","Review changes","Review the current git changes. Summarize risks, likely bugs, and anything that should change before committing.",hh(g,["skills","mcpServers"])))),h&&l.push(Mc("verify","Run verification","Run the relevant tests or checks for this repository. If something fails, stop and explain the failure.",hh(g,["skills","mcpServers","plugins"]))),m&&(l.push(Mc("commit-message","Generate commit message","Stage the appropriate changed files, inspect the staged diff briefly, and draft one conventional commit message. Do not commit.",hh(g,["skills"]))),l.push(dh("gate-commit","Approve commit","Commit with this generated message?")),l.push({kind:"action",id:"commit",title:"Commit with approved message",op:"commit"})),d&&(l.push(dh("gate-push","Approve push",p?"Push and continue toward a PR?":"Push this branch?")),l.push({kind:"action",id:"push",title:"Push branch",op:"push"})),p&&(l.push(Mc("open-pr","Open PR","Open a pull request for the current branch. Use the latest commit subject as the title and summarize the commit list in the body.",hh(g,["mcpServers","plugins"]))),l.push({kind:"action",id:"checkout-default-and-pull",title:"Return to default branch",op:"checkout-default-and-pull"})),l.length||(l.push(dh("gate-start","Approve start","Run this workflow?")),l.push(Mc("ai-step","AI step",n||"Complete this workflow step.",g))),{id:RY(Rj(hN(o))||"custom-workflow",t),name:hN(o),description:n||"Custom AI-authored workflow.",builtin:!1,steps:AY(l)}}function jY(e){return["Create a NoMoreIDE workflow from this user intent:","",e.trim()||"(no intent provided)","","Return a workflow JSON object only. Use this shape:","{",' "id": "short-kebab-id",',' "name": "Human name",',' "description": "One sentence",',' "steps": [',' { kind: "gate", id: "gate-id", title: "Approve thing", message: "Question for the user?" },',' { kind: "agent", id: "ai-id", title: "AI task", prompt: "Clear instruction", capabilities: { skills: [], mcpServers: [], plugins: [], hooks: [] }, verify: "committed" },',' { kind: "action", id: "push", title: "Push", op: "push" },',' { kind: "action", id: "checkout-default-and-pull", title: "Return to default branch", op: "checkout-default-and-pull" }'," ]","}","","Use gates before mutating git or GitHub state. Prefer intent-level AI steps over direct MCP tool calls."].join(`
213
+ `)}function hN(e){const t=/\breview|check|inspect|audit\b/.test(e),s=/\bcommit\b|\bship|push|pr|pull request\b/.test(e),n=/\bpr\b|pull request/.test(e),o=/\btest|verify|ci\b/.test(e);return t&&s&&n?"Review, Commit & PR":o&&s&&n?"Verify, Commit & PR":t&&s?"Review & Commit":s&&n?"Commit & PR":s?"Commit workflow":t?"Review workflow":"Custom workflow"}function dh(e,t,s){return{kind:"gate",id:e,title:t,message:s}}function Mc(e,t,s,n,o){return{kind:"agent",id:e,title:t,prompt:s,capabilities:nv(n),verify:o}}function TY(e,t){return nv({skills:t.skills.filter(s=>e.includes(s.toLowerCase())),mcpServers:t.mcpServers.filter(s=>e.includes(s.toLowerCase())),plugins:t.plugins.filter(s=>e.includes(s.toLowerCase())),hooks:t.hooks.filter(s=>e.includes(s.toLowerCase()))})??{}}function hh(e,t){const s={};for(const n of t){const o=e[n];o?.length&&(s[n]=o)}return nv(s)}function nv(e){if(!e)return;const t={};for(const s of["skills","mcpServers","plugins","hooks"]){const n=Array.from(new Set((e[s]??[]).filter(Boolean)));n.length&&(t[s]=n)}return Object.keys(t).length?t:void 0}function AY(e){const t=new Map;return e.map(s=>{const n=Rj(s.id)||s.kind,o=t.get(n)??0;return t.set(n,o+1),o===0?{...s,id:n}:{...s,id:`${n}-${o+1}`}})}function RY(e,t){const s=new Set(t.map(l=>l.id));let n=e||"workflow",o=2;for(;s.has(n);)n=`${e}-${o}`,o++;return n}function Rj(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function MY(){const{run:e,start:t,resume:s,approve:n,skip:o,stop:l,dismiss:u}=GI(),[h,m]=y.useState([]),[d,p]=y.useState(null),[g,x]=y.useState(null),[_,S]=y.useState(null),[w,k]=y.useState(!0),[C,T]=y.useState(!1),[E,j]=y.useState(!0);y.useEffect(()=>{let D=!0;return k(!0),Promise.all([D8(),QN().catch(()=>null)]).then(([B,P])=>{D&&(m(B),p(P))}).catch(B=>{D&&S(B instanceof Error?B.message:String(B))}).finally(()=>{D&&k(!1)}),()=>{D=!1}},[]);function M(D){T(!0),t(D,E)}async function z(D){S(null);try{const B=await O8(D);m(B),x(null)}catch(B){S(B instanceof Error?B.message:String(B))}}async function O(D){if(!D.builtin&&window.confirm(`Delete workflow "${D.name}"?`)){S(null);try{m(await L8(D.id))}catch(B){S(B instanceof Error?B.message:String(B))}}}function A(D){x({...D,id:iv(`${D.id}-copy`,h),name:`${D.name} copy`,builtin:!1,steps:D.steps.map((B,P)=>({...B,id:`${B.id}-${P+1}`}))})}return e&&C?r.jsx(UY,{run:e,onApprove:n,onSkip:o,onStop:l,onBack:()=>T(!1),onResume:()=>{T(!0),s(E)},onRestart:()=>{T(!0),t(e.workflow,E)}}):g?r.jsx(LY,{agent:d?GY(d):null,existing:h,initial:g,onCancel:()=>x(null),onSave:D=>{z(D)}}):r.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-auto bg-card/85",children:[r.jsxs("div",{className:"border-b border-border px-4 py-3",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{children:[r.jsxs("h2",{className:"flex items-center gap-1.5 text-[13px] font-semibold",children:[r.jsx(Tt,{className:"size-4"})," AI Workflows"]}),r.jsx("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:"One-click rituals that exceed the IDE — the agent does the work in the dock, pausing at each gate for your OK."})]}),r.jsxs(Y,{onClick:()=>x(KY(h)),size:"sm",type:"button",variant:"outline",children:[r.jsx(hs,{className:"size-3.5"})," New"]})]}),r.jsxs("label",{className:"mt-2 flex w-fit items-center gap-1.5 text-[11px] text-muted-foreground",children:[r.jsx("input",{checked:E,className:"size-3.5 accent-primary",onChange:D=>j(D.target.checked),type:"checkbox"}),"Run without step-by-step prompts",r.jsx("span",{className:"text-muted-foreground/60",children:"— gates still pause; risky shell still asks."})]})]}),_?r.jsx($e,{variant:"destructive",className:"m-4",children:_}):w?r.jsxs("div",{className:"flex flex-1 items-center justify-center text-[12px] text-muted-foreground",children:[r.jsx(ht,{className:"mr-2 size-4 animate-spin"})," Loading workflows…"]}):r.jsxs(r.Fragment,{children:[e?r.jsx(DY,{onClear:u,onView:()=>T(!0),run:e}):null,r.jsx("div",{className:"grid gap-3 p-4 sm:grid-cols-2 xl:grid-cols-3",children:h.map(D=>r.jsx(OY,{lastRun:e?.workflow.id===D.id?e:null,workflow:D,onDelete:()=>{O(D)},onDuplicate:()=>A(D),onEdit:()=>x(D),onRun:()=>M(D)},D.id))})]})]})}function DY({onClear:e,onView:t,run:s}){const n=s.outcome==="running";return r.jsx("section",{className:"mx-4 mt-4 rounded-md border border-border bg-background p-3 shadow-sm",children:r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:n?"Workflow running":"Last workflow"}),r.jsx(Lj,{outcome:s.outcome})]}),r.jsx("p",{className:"mt-1 truncate text-[13px] font-medium",children:s.workflow.name}),r.jsxs("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:[n?"Started":"Ran"," ",Oj(s.startedAt)]})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[r.jsxs(Y,{onClick:t,size:"sm",type:"button",children:[r.jsx(pl,{className:"size-3.5"})," View run"]}),n?null:r.jsxs(Y,{onClick:e,size:"sm",type:"button",variant:"outline",children:[r.jsx(Ft,{className:"size-3.5"})," Clear"]})]})]})})}function OY({lastRun:e,workflow:t,onDelete:s,onDuplicate:n,onEdit:o,onRun:l}){const[u,h]=y.useState(!1),m=t.steps.length;return r.jsxs("div",{className:"flex flex-col rounded-lg border border-border bg-background p-3.5 shadow-sm",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsx("h3",{className:"text-[13px] font-semibold",children:t.name}),t.builtin?r.jsx("span",{className:"rounded-full border border-border px-1.5 py-px text-[9px] uppercase tracking-wide text-muted-foreground",children:"Template"}):null]}),t.description?r.jsx("p",{className:"mt-1 text-[11px] leading-snug text-muted-foreground",children:t.description}):null,e?r.jsxs("p",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[r.jsx(pl,{className:"size-3"}),e.outcome==="running"?"Running now":`Last run ${Oj(e.startedAt)}`]}):null,r.jsxs("button",{"aria-expanded":u,className:"mt-2.5 flex w-full items-center gap-1.5 text-[11px] text-muted-foreground transition-colors hover:text-foreground",onClick:()=>h(d=>!d),type:"button",children:[r.jsx(Jn,{className:ie("size-3 shrink-0 transition-transform",u?"rotate-90":""),"aria-hidden":!0}),r.jsxs("span",{children:[m," ",m===1?"step":"steps"]})]}),u?r.jsx("ol",{className:"mt-1.5 space-y-1",children:t.steps.map(d=>r.jsxs("li",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[r.jsx(ZY,{kind:d.kind}),r.jsx("span",{className:"truncate",children:cf(d)})]},d.id))}):null,r.jsxs(Y,{className:"mt-3 w-full",onClick:l,size:"sm",type:"button",children:[r.jsx(vr,{className:"size-3.5"})," Run"]}),r.jsxs("div",{className:"mt-2 grid grid-cols-3 gap-1.5",children:[r.jsxs(Y,{onClick:o,size:"sm",type:"button",variant:"outline",children:[r.jsx(kM,{className:"size-3.5"})," Edit"]}),r.jsxs(Y,{onClick:n,size:"sm",type:"button",variant:"outline",children:[r.jsx(Th,{className:"size-3.5"})," Copy"]}),r.jsxs(Y,{disabled:t.builtin,onClick:s,size:"sm",title:t.builtin?"Duplicate or edit to create your own version first":"Delete workflow",type:"button",variant:"outline",children:[r.jsx(yr,{className:"size-3.5"})," Delete"]})]})]})}function LY({agent:e,existing:t,initial:s,onCancel:n,onSave:o}){const[l,u]=y.useState(()=>structuredClone(s)),[h,m]=y.useState(s.description??""),[d,p]=y.useState(!1),g=WY(e),{sendToAgent:x}=At(),_=!l.id.trim()||!l.name.trim()||l.steps.length===0;function S(z,O){u(A=>({...A,steps:A.steps.map((D,B)=>B===z?O(D):D)}))}function w(z,O){u(A=>{const D=z+O;if(D<0||D>=A.steps.length)return A;const B=[...A.steps],[P]=B.splice(z,1);return B.splice(D,0,P),{...A,steps:B}})}function k(z){u(O=>({...O,steps:O.steps.filter((A,D)=>D!==z)}))}function C(z,O){u(A=>{const D=[...A.steps];return D.splice(z,0,BY(O,A.steps)),{...A,steps:D}})}function T(z=h){const O=dN(z,t,g);u(O)}function E(z){const O=dN(z,[],g);u(A=>({...A,steps:[...A.steps,...O.steps]}))}function j(){x({prompt:jY(h||l.description||l.name),source:{type:"workflow",label:"Workflow composer"},mode:"draft"})}function M(){const z=ol(l.id)||iv(ol(l.name)||"workflow",t);o({...l,id:z,name:l.name.trim(),description:(h||l.description)?.trim()||void 0,builtin:!1,steps:l.steps.map(YY)})}return r.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-card/85",children:[r.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-border px-4 py-3",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx(Tt,{className:"size-4 shrink-0"}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("input",{"aria-label":"Workflow name",className:"w-full bg-transparent text-[14px] font-semibold outline-none",onChange:z=>u(O=>({...O,name:z.target.value,id:ol(z.target.value)||O.id})),placeholder:"Name your workflow",value:l.name}),r.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:l.id})]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[r.jsxs(Y,{onClick:()=>p(z=>!z),size:"sm",type:"button",variant:d?"default":"outline",children:[r.jsx(pi,{className:"size-3.5"})," AI compose"]}),r.jsxs(Y,{onClick:n,size:"sm",type:"button",variant:"outline",children:[r.jsx(hu,{className:"size-3.5"})," Back"]}),r.jsxs(Y,{disabled:_,onClick:M,size:"sm",type:"button",children:[r.jsx(tn,{className:"size-3.5"})," Save"]})]})]}),d?r.jsx("section",{className:"shrink-0 border-b border-border bg-muted/20 p-4",children:r.jsxs("div",{className:"grid gap-3 xl:grid-cols-[minmax(0,1.1fr)_minmax(0,0.9fr)]",children:[r.jsxs("div",{className:"rounded-lg border border-border bg-background p-3 shadow-sm",children:[r.jsx(gr,{children:"Describe workflow"}),r.jsx("textarea",{className:"min-h-16 w-full resize-none bg-transparent text-[13px] leading-relaxed outline-none placeholder:text-muted-foreground",onChange:z=>m(z.target.value),placeholder:"Review my changes with code-review, ask before commit, push, then open a PR with GitHub...",value:h}),r.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[r.jsxs(Y,{onClick:()=>T(),size:"sm",type:"button",children:[r.jsx(pi,{className:"size-3.5"})," Draft timeline"]}),r.jsxs(Y,{onClick:j,size:"sm",type:"button",variant:"outline",children:[r.jsx(HN,{className:"size-3.5"})," Ask AI"]}),["Commit safely","Review then push","Fix CI then PR","File issue from changes"].map(z=>r.jsx("button",{className:"rounded-md border border-border bg-muted/30 px-2 py-1 text-[11px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:()=>{m(z),T(z)},type:"button",children:z},z))]})]}),r.jsxs("div",{className:"grid gap-3",children:[r.jsx(IY,{onAdd:E}),r.jsx(PY,{capabilities:g})]})]})}):null,r.jsx("main",{className:"min-h-0 flex-1 overflow-auto p-4",children:r.jsxs("div",{className:"mx-auto max-w-3xl",children:[r.jsx(fN,{onInsert:z=>C(0,z)}),l.steps.length?l.steps.map((z,O)=>r.jsxs(y.Fragment,{children:[r.jsxs("div",{className:"flex gap-4",children:[r.jsxs("div",{className:"relative flex w-9 shrink-0 justify-center pt-2",children:[r.jsx("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-border"}),r.jsx(zY,{index:O,kind:z.kind})]}),r.jsx("div",{className:"min-w-0 flex-1 pb-1",children:r.jsx($Y,{capabilities:g,index:O,isFirst:O===0,isLast:O===l.steps.length-1,onMove:w,onRemove:k,onUpdate:S,step:z})})]}),r.jsx(fN,{onInsert:A=>C(O+1,A)})]},`${z.kind}:${z.id}`)):r.jsx("div",{className:"ml-[3.25rem] flex h-24 items-center justify-center rounded-lg border border-dashed border-border text-[12px] text-muted-foreground",children:"Pick a step kind above to start building."})]})})]})}function fN({defaultOpen:e=!1,onInsert:t}){const[s,n]=y.useState(e),o=[{kind:"gate",label:"Gate"},{kind:"agent",label:"AI"},{kind:"action",label:"Auto"}];return r.jsxs("div",{className:"flex gap-4",children:[r.jsxs("div",{className:"relative flex w-9 shrink-0 justify-center",children:[r.jsx("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-border"}),r.jsx("button",{"aria-label":s?"Cancel adding step":"Add step here",className:ie("relative z-10 my-1.5 flex size-5 items-center justify-center rounded-full border bg-card text-muted-foreground transition-colors",s?"border-primary/50 text-primary":"border-border hover:border-primary/50 hover:text-primary"),onClick:()=>n(l=>!l),type:"button",children:s?r.jsx(Ft,{className:"size-3"}):r.jsx(hs,{className:"size-3"})})]}),r.jsx("div",{className:"flex-1 py-1",children:s?r.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:o.map(({kind:l,label:u})=>r.jsxs("button",{className:"flex items-center gap-1.5 rounded-md border border-border bg-background px-2 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary/40 hover:text-foreground",onClick:()=>{t(l),n(!1)},type:"button",children:[r.jsx(zj,{kind:l})," ",u]},l))}):null})]})}function zY({index:e,kind:t}){return r.jsxs("div",{className:"relative z-10 flex size-9 items-center justify-center rounded-full border border-border bg-card shadow-sm",children:[r.jsx("span",{className:"absolute -right-1 -top-1 flex size-4 items-center justify-center rounded-full border border-border bg-background font-mono text-[9px] text-muted-foreground",children:e+1}),r.jsx(zj,{kind:t})]})}function BY(e,t){const s=new Set(t.map(o=>o.id)),n=o=>{let l=o,u=2;for(;s.has(l);)l=`${o}-${u++}`;return l};return e==="gate"?{kind:"gate",id:n("gate"),title:"Approve step",message:"Continue?"}:e==="action"?{kind:"action",id:n("action"),title:"Commit with approved message",op:"commit"}:{kind:"agent",id:n("step"),title:"AI step",prompt:""}}function IY({onAdd:e}){const[t,s]=y.useState("");return r.jsxs("form",{className:"rounded-lg border border-dashed border-border bg-background/70 p-3",onSubmit:n=>{n.preventDefault();const o=t.trim();o&&(e(o),s(""))},children:[r.jsx(gr,{children:"Add a step"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{className:"min-w-0 flex-1 bg-transparent text-[12px] outline-none placeholder:text-muted-foreground",onChange:n=>s(n.target.value),placeholder:"ask before merge, run tests, open an issue...",value:t}),r.jsxs(Y,{size:"sm",type:"submit",variant:"outline",children:[r.jsx(hs,{className:"size-3.5"})," Add"]})]})]})}function PY({capabilities:e}){const t=[...e.skills.map(s=>`@skill:${s}`),...e.mcpServers.map(s=>`@mcp:${s}`),...e.plugins.map(s=>`@plugin:${s}`)].slice(0,18);return t.length?r.jsxs("div",{className:"rounded-lg border border-border bg-background p-3",children:[r.jsx(gr,{children:"Detected capabilities"}),r.jsx("div",{className:"flex max-h-20 flex-wrap gap-1.5 overflow-hidden",children:t.map(s=>r.jsx("span",{className:"rounded-md border border-border bg-muted/30 px-2 py-1 font-mono text-[11px] text-muted-foreground",children:s},s))})]}):null}function $Y({capabilities:e,index:t,isFirst:s,isLast:n,onMove:o,onRemove:l,onUpdate:u,step:h}){return r.jsx("section",{className:"group rounded-lg border border-border bg-background p-3 shadow-sm",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx($b,{kind:h.kind}),r.jsx("input",{className:"min-w-0 flex-1 bg-transparent text-[13px] font-semibold outline-none",onChange:m=>u(t,d=>({...d,title:m.target.value})),value:h.title})]}),h.kind==="gate"?r.jsx("textarea",{className:"mt-2 min-h-12 w-full resize-none bg-transparent text-[12px] leading-relaxed text-muted-foreground outline-none focus:text-foreground",onChange:m=>u(t,d=>d.kind==="gate"?{...d,message:m.target.value}:d),placeholder:"Question to ask before continuing…",value:h.message}):h.kind==="action"?r.jsxs("div",{className:"mt-2 space-y-1.5",children:[r.jsxs("select",{className:"w-full rounded-md border border-border bg-background px-2 py-1 text-[12px] outline-none",onChange:m=>{const d=m.target.value;u(t,p=>p.kind==="action"?{...p,op:d}:p)},value:h.op,children:[r.jsx("option",{value:"commit",children:"Commit staged changes"}),r.jsx("option",{value:"push",children:"Push branch"}),r.jsx("option",{value:"assert-pr-branch",children:"Check PR branch"}),r.jsx("option",{value:"checkout-default-and-pull",children:"Return to default branch"})]}),r.jsx("p",{className:"text-[11px] leading-relaxed text-muted-foreground",children:Mj(h.op)})]}):r.jsxs(r.Fragment,{children:[r.jsx("textarea",{className:"mt-2 min-h-16 w-full resize-none bg-transparent text-[12px] leading-relaxed text-muted-foreground outline-none focus:text-foreground",onChange:m=>u(t,d=>d.kind==="agent"?{...d,prompt:m.target.value}:d),placeholder:"What should the agent do at this step?",value:h.prompt}),r.jsxs("label",{className:"mt-2 flex w-fit items-center gap-1.5 text-[11px] text-muted-foreground",children:[r.jsx("input",{checked:h.isolated??!1,className:"size-3.5 accent-primary",onChange:m=>u(t,d=>d.kind==="agent"?{...d,isolated:m.target.checked}:d),type:"checkbox"}),"Fresh session",r.jsx("span",{className:"text-muted-foreground/60",children:"— cheaper; this step won't see earlier steps' context."})]}),r.jsx(HY,{capabilities:e,selected:h.capabilities,onToggle:(m,d)=>u(t,p=>p.kind==="agent"?{...p,capabilities:XY(p.capabilities,m,d)}:p)})]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1 opacity-70 transition-opacity group-hover:opacity-100",children:[r.jsx(Y,{disabled:s,onClick:()=>o(t,-1),size:"sm",type:"button",variant:"ghost",children:"↑"}),r.jsx(Y,{disabled:n,onClick:()=>o(t,1),size:"sm",type:"button",variant:"ghost",children:"↓"}),r.jsx(Y,{onClick:()=>l(t),size:"sm",type:"button",variant:"ghost",children:r.jsx(yr,{className:"size-3.5"})})]})]})})}function HY({capabilities:e,onToggle:t,selected:s}){const n=[{key:"skills",label:"Skills",values:e.skills},{key:"mcpServers",label:"MCP",values:e.mcpServers},{key:"plugins",label:"Plugins",values:e.plugins},{key:"hooks",label:"Hooks",values:e.hooks}];return r.jsxs("div",{className:"space-y-2",children:[r.jsx(gr,{children:"Capabilities"}),n.map(o=>r.jsxs("div",{children:[r.jsx("div",{className:"mb-1 text-[10px] text-muted-foreground",children:o.label}),o.values.length?r.jsx("div",{className:"flex flex-wrap gap-1.5",children:o.values.map(l=>{const u=s?.[o.key]?.includes(l)??!1;return r.jsx("button",{className:ie("rounded-md border px-2 py-1 text-[11px] transition-colors",u?"border-primary/50 bg-primary/10 text-primary":"border-border bg-muted/30 text-muted-foreground hover:bg-muted"),onClick:()=>t(o.key,l),type:"button",children:l},l)})}):r.jsx("p",{className:"text-[11px] text-muted-foreground/70",children:"None detected."})]},o.key))]})}function UY({run:e,onApprove:t,onSkip:s,onStop:n,onBack:o,onResume:l,onRestart:u}){const{sendToAgent:h}=At(),m=e.outcome!=="running",[d,p]=y.useState(e.index);y.useEffect(()=>{p(e.index)},[e.index]);const g=e.workflow.steps[d]??e.workflow.steps[e.index],x=e.statuses[d]??"pending",_=e.outputs[d],S=e.outputs[d-1],w=g?.kind==="gate"&&x==="waiting",k=x==="failed"||x==="blocked",C=x==="blocked"&&g?.kind==="action"&&g.op==="assert-pr-branch";return r.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-card/85",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("h2",{className:"flex items-center gap-1.5 text-[13px] font-semibold",children:[r.jsx(Tt,{className:"size-4"})," ",e.workflow.name]}),r.jsxs("p",{className:"mt-0.5 flex items-center gap-1 text-[11px] text-muted-foreground",children:[r.jsx(pl,{className:"size-3"})," Watch the agent work in the dock below."]})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(Lj,{outcome:e.outcome}),r.jsxs(Y,{onClick:o,size:"sm",type:"button",variant:"outline",children:[r.jsx(hu,{className:"size-3.5"})," Workflows"]}),m?null:r.jsxs(Y,{onClick:n,size:"sm",type:"button",variant:"outline",children:[r.jsx(cl,{className:"size-3.5"})," Stop"]})]})]}),r.jsxs("div",{className:"grid min-h-0 flex-1 overflow-hidden lg:grid-cols-[minmax(240px,320px)_minmax(0,1fr)]",children:[r.jsx("aside",{className:"min-h-0 overflow-auto border-b border-border bg-background/55 p-3 lg:border-b-0 lg:border-r",children:r.jsx("ol",{className:"space-y-1",children:e.workflow.steps.map((T,E)=>{const j=e.statuses[E],M=j==="running"||j==="waiting",z=E===d;return r.jsx("li",{children:r.jsxs("button",{className:ie("flex w-full items-center gap-2 rounded-md border px-2.5 py-2 text-left transition-colors",z?"border-primary/45 bg-primary/[0.06]":M?"border-primary/30 bg-primary/[0.03]":"border-transparent hover:border-border hover:bg-muted/40"),onClick:()=>p(E),type:"button",children:[r.jsx("span",{className:ie("flex size-7 shrink-0 items-center justify-center rounded-full border bg-card",j==="failed"?"border-destructive/50":j==="blocked"?"border-amber-500/50":M?"border-primary/50":j==="done"?"border-emerald-500/50":"border-border"),children:r.jsx(pN,{status:j,kind:T.kind})}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-[12px] font-medium",children:cf(T)}),r.jsxs("span",{className:"mt-0.5 flex items-center gap-1.5",children:[r.jsx($b,{kind:T.kind}),r.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground/70",children:mN(j)})]})]}),r.jsx(Jn,{className:ie("size-3.5 shrink-0 text-muted-foreground/50 transition-transform",z?"translate-x-0.5 text-primary":"")})]})},T.id)})})}),r.jsx("main",{className:"min-h-0 overflow-auto p-4",children:g?r.jsxs("section",{className:ie("min-h-full rounded-lg border bg-background p-4 shadow-sm",x==="failed"?"border-destructive/40 bg-destructive/[0.03]":x==="blocked"?"border-amber-500/40 bg-amber-500/[0.04]":x==="running"||x==="waiting"?"border-primary/40 bg-primary/[0.03]":"border-border"),children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-border pb-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(pN,{status:x,kind:g.kind}),r.jsx("h3",{className:"truncate text-[13px] font-semibold",children:cf(g)})]}),r.jsxs("div",{className:"mt-1 flex items-center gap-1.5",children:[r.jsx($b,{kind:g.kind}),r.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground/70",children:mN(x)})]})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[m&&k&&d===e.index&&!C?r.jsxs(Y,{"aria-label":"Resume the workflow from this step",onClick:l,size:"sm",type:"button",children:[r.jsx(vr,{className:"size-3.5"})," Resume workflow"]}):null,k?r.jsxs(Y,{"aria-label":"Debug this workflow step with AI",onClick:()=>h({prompt:jI({workflowName:e.workflow.name,step:g,status:x,error:e.error,previousOutput:S,output:_}),source:{type:"workflow-debug",label:g.title},mode:"send",label:`Debug workflow step: ${g.title}`,background:!0}),size:"sm",type:"button",variant:"outline",children:[r.jsx(Tt,{className:"size-3.5"})," Debug with AI"]}):null,m?null:r.jsxs(Y,{"aria-label":"Stop workflow run from step detail",onClick:n,size:"sm",type:"button",variant:"outline",children:[r.jsx(cl,{className:"size-3.5"})," Stop after this step"]})]})]}),r.jsxs("div",{className:"py-3 text-[11px] leading-relaxed",children:[r.jsx(VY,{output:_,previousOutput:S,status:x,step:g}),w?r.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-1.5",children:[r.jsxs(Y,{onClick:t,size:"sm",type:"button",children:[r.jsx(tn,{className:"size-3.5"})," Approve"]}),r.jsxs(Y,{onClick:s,size:"sm",type:"button",variant:"outline",children:[r.jsx(YN,{className:"size-3.5"})," Skip"]}),r.jsxs(Y,{onClick:n,size:"sm",type:"button",variant:"outline",children:[r.jsx(Ft,{className:"size-3.5"})," Stop"]})]}):null,x==="failed"&&e.error?r.jsx("p",{className:"mt-3 text-destructive",children:e.error}):null,C?r.jsx(FY,{error:e.error,onRestart:u,workflowName:e.workflow.name}):null,x==="blocked"&&e.error?r.jsx("p",{className:"mt-3 text-amber-700 dark:text-amber-400",children:e.error}):null]})]}):null})]})]})}function FY({error:e,onRestart:t,workflowName:s}){const{sendToAgent:n,setOpen:o,streaming:l,turns:u}=At(),[h,m]=y.useState(!1),[d,p]=y.useState(null),[g,x]=y.useState(!1),[_,S]=y.useState(null),[w,k]=y.useState(null),C=d===null?"":qY(u,d),T=zI(C),E=h&&!T&&l;function j(z){p(u.length),k(null),S(null),n({prompt:[TI({workflowName:s,error:e}),z?.trim()?z.trim():""].filter(Boolean).join(`
214
+
215
+ `),source:{type:"workflow-branch-recovery",label:s},mode:"send",label:`Recommend PR branch for ${s}`,background:!0}),m(!0)}async function M(){if(T){x(!0),k(null);try{await I6(T),S(T)}catch(z){k(z instanceof Error?z.message:String(z))}finally{x(!1)}}}return r.jsxs("div",{className:"mt-3 rounded-md border border-border bg-muted/35 p-3",children:[r.jsx(gr,{children:"Recover with AI"}),r.jsx("p",{className:"mb-2 text-[11px] text-muted-foreground",children:"Let the agent inspect the change and suggest a feature branch. You approve before anything changes."}),r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[r.jsxs(Y,{onClick:()=>j(),size:"sm",type:"button",children:[r.jsx(Tt,{className:"size-3.5"})," Recommend branch with AI"]}),_?r.jsxs(Y,{onClick:t,size:"sm",type:"button",variant:"outline",children:[r.jsx(vr,{className:"size-3.5"})," Run again"]}):null]}),E?r.jsxs("p",{className:"mt-2 flex items-center gap-1 text-[11px] text-muted-foreground",children:[r.jsx(ht,{className:"size-3 animate-spin"})," Choosing a branch name in the background."]}):null,T?r.jsxs("div",{className:"mt-3 rounded-md border border-border bg-background p-2.5",children:[r.jsx(gr,{children:"Recommended branch"}),r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsx("code",{className:"min-w-0 rounded bg-muted px-2 py-1 font-mono text-[12px] text-foreground",children:T}),r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[r.jsxs(Y,{disabled:g||_===T,onClick:()=>{M()},size:"sm",type:"button",children:[g?r.jsx(ht,{className:"size-3.5 animate-spin"}):r.jsx(tn,{className:"size-3.5"}),"Create this branch"]}),r.jsxs(Y,{disabled:g,onClick:()=>j("Recommend a different concise branch name. Keep the same output contract with `BRANCH_NAME: <branch-name>`."),size:"sm",type:"button",variant:"outline",children:[r.jsx(Tt,{className:"size-3.5"})," Ask for another"]})]})]})]}):C&&!E?r.jsxs("div",{className:"mt-3 rounded-md border border-border bg-background p-2.5",children:[r.jsx("p",{className:"text-[11px] text-muted-foreground",children:"The agent did not return a branch name the workflow could read."}),r.jsxs(Y,{className:"mt-2",onClick:()=>j("Return only a concise branch suggestion using this exact line: `BRANCH_NAME: <branch-name>`."),size:"sm",type:"button",variant:"outline",children:[r.jsx(Tt,{className:"size-3.5"})," Ask for another"]})]}):null,_?r.jsxs("p",{className:"mt-2 text-[11px] text-emerald-700 dark:text-emerald-400",children:["Branch created: ",r.jsx("code",{className:"font-mono",children:_}),". Run the workflow again from here."]}):null,w?r.jsx("p",{className:"mt-2 text-[11px] text-destructive",children:w}):null,C?r.jsxs(Y,{className:"mt-2",onClick:()=>o(!0),size:"sm",type:"button",variant:"outline",children:[r.jsx(HN,{className:"size-3.5"})," Open agent"]}):null]})}function qY(e,t){for(let s=e.length-1;s>=t;s--)if(e[s]?.role==="assistant")return e[s].text.trim();return""}function mN(e){return e==="running"?"Running":e==="waiting"?"Waiting":e==="done"?"Done":e==="blocked"?"Needs you":e==="failed"?"Failed":e==="skipped"?"Skipped":"Queued"}function VY({output:e,previousOutput:t,status:s,step:n}){if(n.kind==="gate"){const l=n.id==="gate-commit"?t?.trim():"";return r.jsxs("div",{children:[r.jsx("p",{className:"text-muted-foreground",children:n.message}),l?r.jsxs("div",{className:"mt-3",children:[r.jsx(gr,{children:"Generated commit message"}),r.jsx("div",{className:"whitespace-pre-wrap break-words rounded-md border border-border bg-muted/50 px-2.5 py-2 font-mono text-[11px] text-foreground",children:l})]}):null]})}if(n.kind==="action")return r.jsx("p",{className:"text-muted-foreground",children:Mj(n.op)});const o=s==="done"||s==="failed"||s==="skipped";return e?r.jsxs("div",{children:[r.jsx(gr,{children:"Result"}),r.jsx("div",{className:"whitespace-pre-wrap break-words rounded-md bg-muted/50 px-2.5 py-2 font-mono text-[11px] text-foreground",children:e})]}):r.jsxs("div",{children:[r.jsx(gr,{children:o?"Result":"Task"}),o?r.jsx("p",{className:"italic text-muted-foreground",children:"No text reply — see the dock for what the agent did."}):r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"text-muted-foreground",children:n.prompt}),s==="running"?r.jsxs("p",{className:"mt-1.5 flex items-center gap-1 text-muted-foreground/80",children:[r.jsx(ht,{className:"size-3 animate-spin"})," Working in the dock…"]}):null]})]})}function GY(e){return e.detected.name==="codex"?e.agents.codex:e.agents["claude-code"]??e}function WY(e){return e?{skills:Fc(e.skills.map(t=>t.name)),mcpServers:Fc(e.mcpServers.map(t=>t.name)),plugins:Fc(e.plugins.map(t=>t.name)),hooks:Fc(e.hooks.map(t=>t.matcher?`${t.event}: ${t.matcher}`:t.event))}:{skills:[],mcpServers:[],plugins:[],hooks:[]}}function KY(e){return{id:iv("custom-workflow",e),name:"Custom workflow",description:"A user-built workflow.",builtin:!1,steps:[{kind:"gate",id:"gate-start",title:"Approve start",message:"Run this workflow?"}]}}function YY(e){const t=ol(e.id)||e.kind,s=e.title.trim()||cf(e);if(e.kind==="gate")return{...e,id:t,title:s,message:e.message.trim()||"Continue?"};if(e.kind==="action")return{...e,id:t,title:s};const n=Dj(e.capabilities);return{...e,id:t,title:s,prompt:e.prompt.trim()||"Complete this workflow step.",capabilities:n}}function Mj(e){return e==="assert-pr-branch"?"Checks that PR workflows are running from a feature branch, not main or master.":e==="checkout-default-and-pull"?"Switches back to the default branch and pulls the latest changes.":e==="push"?"Pushes the current branch to its remote.":"Commits the staged changes with the approved generated message."}function Dj(e){if(!e)return;const t={};for(const s of["skills","mcpServers","plugins","hooks"]){const n=Fc((e[s]??[]).map(o=>o.trim()).filter(Boolean));n.length&&(t[s]=n)}return Object.keys(t).length?t:void 0}function XY(e,t,s){const n=e?.[t]??[],o=n.includes(s)?n.filter(l=>l!==s):[...n,s];return Dj({...e??{},[t]:o})}function iv(e,t){const s=new Set(t.map(l=>l.id));let n=ol(e)||"workflow",o=2;for(;s.has(n);)n=`${ol(e)||"workflow"}-${o}`,o++;return n}function ol(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Fc(e){return Array.from(new Set(e.filter(Boolean)))}function gr({children:e}){return r.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:e})}function Oj(e){return new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}).format(new Date(e))}function Lj({outcome:e}){const t={running:{label:"Running",className:"border-primary/40 text-primary"},done:{label:"Done",className:"border-emerald-500/40 text-emerald-600 dark:text-emerald-400"},stopped:{label:"Stopped",className:"border-border text-muted-foreground"},failed:{label:"Failed",className:"border-destructive/40 text-destructive"},blocked:{label:"Needs you",className:"border-amber-500/40 text-amber-700 dark:text-amber-400"}},{label:s,className:n}=t[e];return r.jsx("span",{className:ie("rounded-full border px-2 py-0.5 text-[10px] font-medium",n),children:s})}function zj({kind:e}){return e==="gate"?r.jsx(KN,{className:"size-4 text-amber-600 dark:text-amber-400"}):e==="agent"?r.jsx(pi,{className:"size-4 text-primary"}):r.jsx(vr,{className:"size-4 text-muted-foreground"})}function pN({status:e,kind:t}){return e==="running"?r.jsx(ht,{className:"size-4 shrink-0 animate-spin text-primary"}):e==="waiting"?r.jsx(KN,{className:"size-4 shrink-0 text-primary"}):e==="done"?r.jsx(tn,{className:"size-4 shrink-0 text-emerald-600 dark:text-emerald-400"}):e==="blocked"?r.jsx(Ub,{className:"size-4 shrink-0 text-amber-600 dark:text-amber-400"}):e==="failed"?r.jsx(mu,{className:"size-4 shrink-0 text-destructive"}):e==="skipped"?r.jsx(YN,{className:"size-4 shrink-0 text-muted-foreground/60"}):t==="agent"?r.jsx(pi,{className:"size-4 shrink-0 text-muted-foreground/50"}):r.jsx(D4,{className:"size-4 shrink-0 text-muted-foreground/50"})}function ZY(e){return r.jsx(Jn,{className:"size-3 shrink-0 text-muted-foreground/40","aria-hidden":!0})}function $b({kind:e}){const t=e==="agent"?"AI":e==="gate"?"Gate":"Auto",s=e==="agent"?"border-primary/30 text-primary":e==="gate"?"border-amber-500/40 text-amber-600 dark:text-amber-400":"border-border text-muted-foreground";return r.jsx("span",{className:ie("shrink-0 rounded-full border px-1.5 py-px text-[9px] uppercase tracking-wide",s),children:t})}function cf(e){return e.title}function QY({data:e,onRefresh:t}){const{insertPath:s}=At(),[n,o]=y.useState(!1),[l,u]=y.useState("changes"),[h,m]=y.useState("changes"),[d,p]=y.useState(e.git.status?.files[0]?.path??""),[g,x]=y.useState(""),[_,S]=y.useState([]),[w,k]=y.useState(null),[C,T]=y.useState(""),[E,j]=y.useState(null),[M,z]=y.useState(0),[O,A]=y.useState(null),[D,B]=y.useState(()=>new Set),P=e.git.status?.files??[],H=y.useMemo(()=>{const ge=new Set(P.map(Re=>Re.path)),Te=[...D].filter(Re=>!ge.has(Re)).sort().map(Re=>({path:Re,index:" ",workingTree:"M"}));return[...P,...Te]},[P,D]),$=y.useMemo(()=>H.map(ge=>ge.path),[H]),q=y.useMemo(()=>f3(C),[C]),V=y.useCallback(async(ge,Te)=>{if(Te.length){o(!0);try{await ge(Te),t?.()}finally{o(!1)}}},[t]),I=t?{busy:n,onStage:ge=>{V(Yb,ge)},onUnstage:ge=>{V(nC,ge)}}:void 0;y.useEffect(()=>{const ge=H[0]?.path??"";p(Te=>Te&&H.some(Re=>Re.path===Te)?Te:ge)},[H]),y.useEffect(()=>{if(l!=="all"||_.length>0)return;let ge=!0;return k(null),D6().then(Te=>{ge&&S(Te)}).catch(Te=>{ge&&k(Te instanceof Error?Te.message:String(Te))}),()=>{ge=!1}},[l,_.length]),y.useEffect(()=>{if(!d){T("");return}let ge=!0;return j(null),sC(d).then(Te=>{ge&&(T(Te),z(0),A(null))}).catch(Te=>{ge&&j(Te instanceof Error?Te.message:String(Te))}),()=>{ge=!1}},[d]);function W(ge){z(0),A(null),p(ge)}function Z(){const ge=WK({activeHunkIndex:M,filePaths:$,hunkCount:q.hunks,pendingNextFilePath:O,selectedFile:d});ge.kind==="hunk"?(A(null),z(ge.activeHunkIndex)):ge.kind==="confirm-next-file"?A(ge.filePath):ge.kind==="file"?W(ge.filePath):A(null)}function K(){if(A(null),M>0){z(Re=>Re-1);return}const ge=H.findIndex(Re=>Re.path===d),Te=H[ge-1];Te&&W(Te.path)}const te=H.findIndex(ge=>ge.path===d),L=!!(q.hunks&&M<q.hunks-1||H[te+1]),Q=!!(M>0||H[te-1]),re=O?`End of file. Click Next again to open ${O}.`:null,he=ge=>`rounded px-2 py-0.5 text-[11px] font-medium transition-colors ${ge?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,fe=ge=>`flex-1 px-2 py-0.5 text-[11px] font-medium transition-colors ${ge?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,pe=y.useMemo(()=>{const ge=new Set(H.map(Te=>Te.path));for(const Te of D)ge.add(Te);return ge},[H,D]);if(!e.git.selectedRepository)return r.jsx(JY,{});function we(){g&&(u("changes"),m("changes"),W(g))}function Le(ge){B(Te=>new Set(Te).add(ge)),x(ge),u("changes"),m("changes"),W(ge)}function ve(ge){x(ge),u("all")}function We(ge){ge&&s(Su(e.git.cwd,ge))}return r.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-card/85",children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-1 border-b border-border bg-card/95 px-3 py-1",children:[r.jsx("button",{type:"button",className:he(l==="changes"),onClick:()=>u("changes"),children:"Changes"}),r.jsx("button",{type:"button","aria-label":"Show changed files across all repositories",className:he(l==="board"),onClick:()=>u("board"),children:"Board"}),r.jsx("button",{type:"button","aria-label":"Open all tracked files",className:he(l==="all"),onClick:()=>u("all"),children:"All files"}),r.jsx("button",{type:"button",className:he(l==="graph"),onClick:()=>u("graph"),children:"Tree"}),r.jsx("button",{type:"button",className:he(l==="largest"),onClick:()=>u("largest"),children:"Largest files"}),r.jsx("button",{type:"button",className:he(l==="snapshots"),onClick:()=>u("snapshots"),children:"Snapshots"}),r.jsx("button",{type:"button",className:he(l==="workflows"),onClick:()=>u("workflows"),children:r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Tt,{className:"size-3"}),"Workflows"]})})]}),r.jsx("div",{className:"min-h-0 flex-1",children:l==="workflows"?r.jsx(MY,{}):l==="board"?r.jsx(gY,{currentRepoPath:e.git.cwd}):l==="graph"?r.jsx(oY,{branches:e.git.branches??[]}):l==="largest"?r.jsx(NY,{onOpenFile:ve,root:e.git.cwd}):l==="snapshots"?r.jsx(Oz,{}):l==="all"?r.jsxs("div",{className:"grid h-full min-h-0 overflow-hidden border-0 bg-card/85 xl:grid-cols-[320px_minmax(0,1fr)]",children:[r.jsx("aside",{className:"flex min-h-0 flex-col overflow-hidden",children:w?r.jsx($e,{variant:"destructive",className:"m-3",children:w}):r.jsx(nk,{branch:e.git.status?.branch||void 0,onSelectFile:x,paths:_,root:e.git.cwd,selectedFile:g,status:H})}),r.jsx(GK,{isModified:pe.has(g),onFileSaved:Le,onSendToAi:()=>We(g),onViewDiff:we,path:g})]}):r.jsxs("div",{className:"grid h-full min-h-0 overflow-hidden border-0 bg-card/85 xl:grid-cols-[320px_minmax(0,1fr)]",children:[r.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden",children:[r.jsxs("div",{className:"flex shrink-0 gap-0.5 border-b border-border bg-card/95 p-1",children:[r.jsx("button",{"aria-label":"Show changed files as a list",className:fe(h==="changes"),onClick:()=>m("changes"),type:"button",children:"Changes"}),r.jsx("button",{"aria-label":"Show changed files as a tree",className:fe(h==="tree"),onClick:()=>m("tree"),type:"button",children:"Tree"})]}),h==="changes"?r.jsx(D5,{branch:e.git.status?.branch||void 0,error:e.git.error,files:H,selectedFile:d,onSelectFile:W,root:e.git.cwd,staging:I}):r.jsx(nk,{branch:e.git.status?.branch||void 0,defaultExpandAll:!0,emptyMessage:e.git.error??"No changed files.",onSelectFile:W,paths:$,root:e.git.cwd,selectedFile:d,status:H,title:"Changes"}),t&&e.git.status?r.jsx(O5,{branch:e.git.status.branch||void 0,files:H,onDone:t}):null]}),r.jsxs("section",{className:"flex min-h-0 min-w-0 flex-col border-l border-border bg-card",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-1.5",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:d||"Diff"}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-muted-foreground",children:[r.jsx("span",{children:"Long rows wrap inside the editor pane."}),q.additions||q.deletions?r.jsxs("span",{className:"flex items-center gap-1 font-mono",children:[r.jsxs("span",{className:"text-emerald-700",children:["+",q.additions]}),r.jsxs("span",{className:"text-red-700",children:["-",q.deletions]})]}):null]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[re?r.jsx("span",{className:"max-w-72 truncate rounded border border-amber-200 bg-amber-50 px-2 py-1 text-[11px] text-amber-900",children:re}):null,r.jsxs(Y,{disabled:!d||!Q,onClick:K,size:"sm",type:"button",variant:"outline",children:[r.jsx(df,{}),"Previous"]}),r.jsxs(Y,{disabled:!d||!L,onClick:Z,size:"sm",type:"button",variant:"outline",children:[r.jsx(uf,{}),"Next"]}),r.jsx(Y,{"aria-label":"Send selected file to AI input",className:"size-8",disabled:!d,onClick:()=>We(d),size:"icon",title:"Send selected file path to AI input",type:"button",variant:"outline",children:r.jsx(Tt,{className:"size-4"})})]})]}),r.jsx("div",{className:"relative min-h-0 min-w-0 flex-1",children:E?r.jsx("div",{className:"p-4",children:r.jsx($e,{variant:"destructive",children:E})}):d?r.jsx(_u,{activeHunkIndex:M,diff:C||"No unstaged diff for this file."}):r.jsx("div",{className:"p-4",children:r.jsx($e,{variant:"muted",className:"border-dashed p-12 text-center",children:"Select a changed file to inspect its diff."})})})]})]})})]})}function JY(){return r.jsx("div",{className:"flex h-full items-center justify-center p-8 text-center",children:r.jsxs("div",{className:"max-w-sm",children:[r.jsx(Gb,{className:"mx-auto size-8 text-muted-foreground/50"}),r.jsx("p",{className:"mt-3 text-sm font-medium",children:"No Git project registered"}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Add a folder that is a Git worktree to review changes, browse files, and inspect history. Use the project picker in the header to add one."})]})})}function eX(){const[e,t]=y.useState(!1),[s,n]=y.useState(!1),[o,l]=y.useState(!0),[u,h]=y.useState("checking"),[m,d]=y.useState(null),[p,g]=y.useState(null);function x(){l(!0),h("checking"),d(null),$6().then(_=>{t(_.configured),n(_.deviceFlowAvailable),h(_.status),d(_.error??null),g(_)}).catch(_=>{t(!1),n(!1),h("connection_error"),d(_ instanceof Error?_.message:String(_)),g(null)}).finally(()=>l(!1))}return y.useEffect(()=>{x()},[]),{configured:e,deviceFlowAvailable:s,loading:o,status:u,error:m,info:p,isConnected:u==="connected",needsLogin:u==="not_configured"||u==="auth_error",refresh:x}}const h0=30;function tX(e="open"){const[t,s]=y.useState([]),[n,o]=y.useState(!0),[l,u]=y.useState(!1),[h,m]=y.useState(!1),[d,p]=y.useState(1),[g,x]=y.useState(null),[_,S]=y.useState(null),[w,k]=y.useState(null),[C,T]=y.useState(""),[E,j]=y.useState(!1),[M,z]=y.useState(null);y.useEffect(()=>{let D=!0;return o(!0),x(null),p(1),Pp(e,1).then(B=>{D&&(s(B),m(B.length===h0),B.length>0&&!B.some(P=>P.number===_)&&S(B[0]?.number??null))}).catch(B=>{D&&x(B instanceof Error?B.message:String(B))}).finally(()=>{D&&o(!1)}),()=>{D=!1}},[e]),y.useEffect(()=>{if(!_){k(null);return}let D=!0;return G6(_).then(B=>{D&&k(B)}).catch(()=>{}),()=>{D=!1}},[_]),y.useEffect(()=>{if(!_){T("");return}let D=!0;return j(!0),z(null),W6(_).then(B=>{D&&T(B)}).catch(B=>{D&&z(B instanceof Error?B.message:String(B))}).finally(()=>{D&&j(!1)}),()=>{D=!1}},[_]);function O(){if(l||!h)return;const D=d+1;u(!0),Pp(e,D).then(B=>{s(P=>{const H=new Set(P.map($=>$.number));return[...P,...B.filter($=>!H.has($.number))]}),m(B.length===h0),p(D)}).catch(B=>x(B instanceof Error?B.message:String(B))).finally(()=>u(!1))}function A(){let D=!0;return o(!0),x(null),p(1),Pp(e,1).then(B=>{D&&(s(B),m(B.length===h0))}).catch(B=>{D&&x(B instanceof Error?B.message:String(B))}).finally(()=>{D&&o(!1)}),()=>{D=!1}}return{prs:t,loading:n,loadingMore:l,hasMore:h,error:g,selectedNumber:_,setSelectedNumber:S,selectedPR:w,diff:C,diffLoading:E,diffError:M,loadMore:O,refresh:A}}const f0=30;function sX(e="open"){const[t,s]=y.useState([]),[n,o]=y.useState(!0),[l,u]=y.useState(!1),[h,m]=y.useState(!1),[d,p]=y.useState(1),[g,x]=y.useState(null),[_,S]=y.useState(null),[w,k]=y.useState(null),[C,T]=y.useState([]),[E,j]=y.useState(!1),[M,z]=y.useState(null),[O,A]=y.useState(!1);y.useEffect(()=>{let H=!0;return o(!0),x(null),p(1),$p(e,1).then($=>{H&&(s($),m($.length===f0),$.length>0&&!$.some(q=>q.number===_)&&S($[0]?.number??null))}).catch($=>{H&&x($ instanceof Error?$.message:String($))}).finally(()=>{H&&o(!1)}),()=>{H=!1}},[e]),y.useEffect(()=>{if(!_){k(null),T([]);return}let H=!0;return j(!0),Promise.all([Q6(_),J6(_)]).then(([$,q])=>{H&&(k($),T(q))}).catch(()=>{}).finally(()=>{H&&j(!1)}),()=>{H=!1}},[_]);async function D(H){if(_){A(!0),z(null);try{const $=await e8(_,H);T(q=>[...q,$])}catch($){z($ instanceof Error?$.message:String($))}finally{A(!1)}}}function B(){if(l||!h)return;const H=d+1;u(!0),$p(e,H).then($=>{s(q=>{const V=new Set(q.map(I=>I.number));return[...q,...$.filter(I=>!V.has(I.number))]}),m($.length===f0),p(H)}).catch($=>x($ instanceof Error?$.message:String($))).finally(()=>u(!1))}function P(){let H=!0;return o(!0),p(1),$p(e,1).then($=>{H&&(s($),m($.length===f0))}).catch(()=>{}).finally(()=>{H&&o(!1)}),()=>{H=!1}}return{issues:t,loading:n,loadingMore:l,hasMore:h,error:g,selectedNumber:_,setSelectedNumber:S,selectedIssue:w,comments:C,commentsLoading:E,commentError:M,submitting:O,addComment:D,loadMore:B,refresh:P}}function rv({className:e}){return r.jsx("svg",{className:ie("size-3.5",e),viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:r.jsx("path",{d:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"})})}function Bj({deviceFlowAvailable:e,initialMode:t,onSaved:s}){const[n,o]=y.useState(()=>t==="device-pending"&&!e?"pat":t??(e?"choose":"pat"));return n==="device-pending"?r.jsx(nX,{onSuccess:s,onCancel:()=>o("choose")}):n==="pat"?r.jsx(iX,{onSaved:s,onBack:e?()=>o("choose"):void 0}):r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-6 p-8",children:[r.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[r.jsx("div",{className:"flex size-12 items-center justify-center rounded-xl bg-muted",children:r.jsx(Ky,{className:"size-6 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-base font-semibold",children:"Connect GitHub"}),r.jsx("p",{className:"mt-1 max-w-sm text-[13px] text-muted-foreground",children:"Authorize NoMoreIDE to read pull requests, issues, and CI status for your repositories."})]})]}),r.jsxs("div",{className:"flex w-full max-w-xs flex-col gap-2",children:[r.jsxs(Y,{className:"w-full",onClick:()=>o("device-pending"),type:"button",children:[r.jsx(Ky,{className:"mr-2 size-4"}),"Authorize with GitHub"]}),r.jsx("button",{className:"text-[12px] text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",onClick:()=>o("pat"),type:"button",children:"Use a Personal Access Token instead"})]})]})}function nX({onSuccess:e,onCancel:t}){const[s,n]=y.useState(null),[o,l]=y.useState(null),[u,h]=y.useState(!0),[m,d]=y.useState(!1),p=y.useRef(null),g=y.useRef(5),x=y.useRef(!1);y.useEffect(()=>{let k=!0;return H6().then(C=>{if(!k)return;n(C),g.current=C.interval,h(!1);const T=C.verification_uri_complete||C.verification_uri;T&&window.open(T,"_blank","noopener,noreferrer"),_(C.device_code,C.interval),setTimeout(()=>{x.current=!0},C.expires_in*1e3)}).catch(C=>{k&&(l(C instanceof Error?C.message:String(C)),h(!1))}),()=>{k=!1,p.current&&clearTimeout(p.current)}},[]);function _(k,C){p.current=setTimeout(()=>{S(k,C)},C*1e3)}async function S(k,C){if(x.current){l("Authorization expired. Please try again.");return}try{const T=await U6(k);if(T.done){e();return}const E=T.slowDown?C+5:C;g.current=E,_(k,E)}catch{_(k,g.current)}}function w(){s&&navigator.clipboard.writeText(s.user_code).then(()=>{d(!0),setTimeout(()=>d(!1),2e3)})}return u?r.jsx("div",{className:"flex h-full items-center justify-center",children:r.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[r.jsx(Yy,{className:"size-6 animate-spin text-muted-foreground"}),r.jsx("p",{className:"text-[13px] text-muted-foreground",children:"Requesting authorization…"})]})}):o?r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-4 p-8",children:[r.jsx($e,{variant:"destructive",children:o}),r.jsx(Y,{onClick:t,variant:"outline",children:"Go back"})]}):r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-6 p-8",children:[r.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[r.jsx("div",{className:"flex size-12 items-center justify-center rounded-xl bg-emerald-100 dark:bg-emerald-500/15",children:r.jsx(ff,{className:"size-6 text-emerald-600 dark:text-emerald-400"})}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-base font-semibold",children:"Authorize on GitHub"}),r.jsxs("p",{className:"mt-1 max-w-sm text-[13px] text-muted-foreground",children:["A GitHub page just opened in a new tab. Enter the code below and click"," ",r.jsx("strong",{children:"Authorize"}),"."]})]})]}),r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx("div",{className:"flex cursor-pointer select-all items-center gap-3 rounded-xl border-2 border-border bg-muted px-6 py-4 font-mono text-2xl font-bold tracking-[0.3em] transition-colors hover:border-ring",onClick:w,title:"Click to copy",children:s?.user_code}),r.jsx("button",{className:"text-[11px] text-muted-foreground transition-colors hover:text-foreground",onClick:w,type:"button",children:m?"Copied!":"Click code to copy"})]}),r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-muted-foreground",children:[r.jsx(Yy,{className:"size-3.5 animate-spin"}),"Waiting for authorization…"]}),r.jsx("a",{className:"text-[12px] text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",href:s?.verification_uri_complete||s?.verification_uri,rel:"noopener noreferrer",target:"_blank",children:"Open GitHub again"}),r.jsx("button",{className:"text-[12px] text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",onClick:t,type:"button",children:"Cancel"})]})]})}function iX({onSaved:e,onBack:t}){const[s,n]=y.useState(""),[o,l]=y.useState(!1),[u,h]=y.useState(null);async function m(d){d.preventDefault();const p=s.trim();if(p){l(!0),h(null);try{await F6("github.com",p),e()}catch(g){h(g instanceof Error?g.message:String(g))}finally{l(!1)}}}return r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-6 p-8",children:[r.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[r.jsx("div",{className:"flex size-12 items-center justify-center rounded-xl bg-muted",children:r.jsx(IN,{className:"size-6 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-base font-semibold",children:"Personal Access Token"}),r.jsxs("p",{className:"mt-1 max-w-sm text-[13px] text-muted-foreground",children:["Create a token at"," ",r.jsx("a",{className:"underline underline-offset-2 hover:text-foreground",href:"https://github.com/settings/tokens/new?scopes=repo,workflow",rel:"noopener noreferrer",target:"_blank",children:"github.com/settings/tokens"})," ","with ",r.jsx("code",{className:"rounded bg-muted px-1 py-px text-[11px]",children:"repo"})," and"," ",r.jsx("code",{className:"rounded bg-muted px-1 py-px text-[11px]",children:"workflow"})," scopes."]})]})]}),r.jsxs("form",{className:"flex w-full max-w-sm flex-col gap-3",onSubmit:d=>{m(d)},children:[r.jsx("input",{autoComplete:"off",className:"w-full rounded-md border border-border bg-background px-3 py-2 font-mono text-[13px] placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring",onChange:d=>n(d.target.value),placeholder:"ghp_...",spellCheck:!1,type:"password",value:s}),u?r.jsx($e,{variant:"destructive",children:u}):null,r.jsx(Y,{disabled:!s.trim()||o,type:"submit",children:o?"Saving…":"Save token"}),t?r.jsx("button",{className:"text-[12px] text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",onClick:t,type:"button",children:"← Back"}):null]})]})}function av({hasMore:e,loading:t,onLoadMore:s}){return e?r.jsx("div",{className:"p-2",children:r.jsxs("button",{className:"flex w-full items-center justify-center gap-1.5 rounded-md border border-border py-1.5 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground disabled:opacity-60",disabled:t,onClick:s,type:"button",children:[t?r.jsx(ht,{className:"size-3 animate-spin"}):null,t?"Loading…":"Load more"]})}):null}function rX({prs:e,loading:t,loadingMore:s,hasMore:n,error:o,selectedNumber:l,onSelect:u,onLoadMore:h}){return t&&e.length===0?r.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading pull requests…"}):o?r.jsx("div",{className:"p-4 text-[12px] text-red-500",children:o}):e.length===0?r.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"No pull requests found."}):r.jsxs(r.Fragment,{children:[r.jsx("ul",{className:"divide-y divide-border",children:e.map(m=>r.jsx("li",{children:r.jsxs("button",{className:`flex w-full items-start gap-3 px-3 py-2.5 text-left transition-colors hover:bg-muted/60 ${l===m.number?"bg-muted":""}`,onClick:()=>u(m.number),type:"button",children:[r.jsx("span",{className:"mt-0.5 shrink-0",children:r.jsx(aX,{pr:m})}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-[13px] font-medium",children:m.title}),r.jsxs("span",{className:"block text-[11px] text-muted-foreground",children:["#",m.number," · ",m.base.ref," ← ",m.head.ref," · ",m.user.login]})]}),m.draft?r.jsx("span",{className:"shrink-0 rounded border border-border px-1.5 py-px text-[10px] text-muted-foreground",children:"Draft"}):null]})},m.number))}),r.jsx(av,{hasMore:n,loading:s,onLoadMore:h})]})}function aX({pr:e}){return e.state==="merged"?r.jsx(Wb,{className:"size-4 text-purple-500"}):e.state==="closed"?r.jsx(NR,{className:"size-4 text-red-500"}):r.jsx(BN,{className:"size-4 text-emerald-500"})}function oX({pr:e,diff:t,diffLoading:s,diffError:n,onMerged:o}){const[l,u]=y.useState("cockpit"),[h,m]=y.useState(null),[d,p]=y.useState(!1),[g,x]=y.useState(null),[_,S]=y.useState(!1),[w,k]=y.useState(null);if(y.useEffect(()=>{if(!e){m(null);return}let j=!0;return p(!0),x(null),K6(e.number).then(M=>{j&&m(M)}).catch(M=>{j&&x(M instanceof Error?M.message:String(M))}).finally(()=>{j&&p(!1)}),()=>{j=!1}},[e]),!e)return r.jsx("div",{className:"flex h-full items-center justify-center text-[12px] text-muted-foreground",children:"Select a pull request"});const C=e.state==="open"&&!e.draft;async function T(){if(!(!e||_)&&window.confirm(`Squash & merge PR #${e.number} "${e.title}" into ${e.base.ref}?`)){S(!0),k(null);try{await Z6(e.number,{method:"squash"}),o?.()}catch(j){k(j instanceof Error?j.message:String(j))}finally{S(!1)}}}const E=j=>`rounded px-2 py-0.5 text-[11px] font-medium transition-colors ${j?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`;return r.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] font-semibold",children:e.title}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[r.jsx("button",{className:E(l==="cockpit"),onClick:()=>u("cockpit"),type:"button",children:"Review"}),r.jsx("button",{className:E(l==="diff"),onClick:()=>u("diff"),type:"button",children:"Diff"})]}),C?r.jsxs("button",{className:"flex shrink-0 items-center gap-1 rounded bg-emerald-600 px-2 py-0.5 text-[11px] font-medium text-white transition-colors hover:bg-emerald-700 disabled:opacity-60",disabled:_,onClick:()=>{T()},title:"Squash & merge this pull request",type:"button",children:[_?r.jsx(ht,{className:"size-3 animate-spin"}):r.jsx(Wb,{className:"size-3"}),"Squash & merge"]}):null,r.jsx("a",{"aria-label":"Open on GitHub",className:"shrink-0 rounded p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",href:e.html_url,rel:"noopener noreferrer",target:"_blank",title:"Open on GitHub",children:r.jsx(br,{className:"size-3.5"})})]}),w?r.jsx("div",{className:"shrink-0 border-b border-border bg-red-500/10 px-3 py-1.5 text-[11px] text-red-500",children:w}):null,l==="cockpit"?r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:r.jsx(lX,{cockpit:h,error:g,loading:d,pr:e})}):r.jsx("div",{className:"relative min-h-0 min-w-0 flex-1",children:s?r.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading diff…"}):n?r.jsx("div",{className:"p-4 text-[12px] text-red-500",children:n}):t?r.jsx(_u,{diff:t}):r.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"No diff available."})})]})}function lX({pr:e,cockpit:t,loading:s,error:n}){const o=t?.pr??e,l=t?.files??[],u=t?.reviews??[],h=t?.comments??[],m=t?.checks??null,d=m?.runs.filter(p=>p.conclusion==="failure"||p.conclusion==="timed_out"||p.conclusion==="cancelled")??[];return r.jsxs("div",{className:"space-y-3 p-4",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 text-[12px]",children:[r.jsx(dX,{pr:o}),r.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md border border-border bg-muted/40 px-2 py-1 font-mono text-[11px]",children:[r.jsx(sn,{className:"size-3 shrink-0 text-muted-foreground"}),o.base.ref,r.jsx(hu,{className:"size-3 shrink-0 text-muted-foreground"}),o.head.ref]}),r.jsxs("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[r.jsx(r6,{className:"size-3 shrink-0"}),o.user.login]}),r.jsxs("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[r.jsx(y4,{className:"size-3 shrink-0"}),new Date(o.created_at).toLocaleDateString()]})]}),n?r.jsx("div",{className:"rounded-md border border-red-500/30 bg-red-500/10 px-3 py-2 text-[12px] text-red-500",children:n}):null,s?r.jsx("p",{className:"text-[12px] text-muted-foreground",children:"Loading review cockpit..."}):null,r.jsxs("div",{className:"grid gap-2 md:grid-cols-4",children:[r.jsx(fh,{title:"Merge readiness",value:Ij(o,m),tone:cX(o,m)}),r.jsx(fh,{title:"Review state",value:Pj(u),tone:uX(u)}),r.jsx(fh,{title:"Checks",value:m?`${m.state} (${m.totalCount})`:"unknown",tone:m?.state==="success"?"success":m?.state==="failure"||m?.state==="error"?"danger":"muted"}),r.jsx(fh,{title:"Changed files",value:String(l.length),tone:"muted"})]}),d.length>0?r.jsxs("section",{className:"rounded-md border border-red-500/25 bg-red-500/10 px-3 py-2",children:[r.jsx("div",{className:"mb-1 text-[11px] font-medium text-red-500",children:"Failing checks"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:d.slice(0,4).map(p=>r.jsxs("a",{className:"inline-flex items-center gap-1 text-[11px] text-red-500 underline-offset-2 hover:underline",href:p.html_url,rel:"noopener noreferrer",target:"_blank",children:[r.jsx(Fb,{className:"size-3"}),"Open failing check: ",p.name]},p.id))})]}):null,r.jsxs("section",{className:"rounded-md border border-border bg-muted/25 p-3",children:[r.jsxs("div",{className:"mb-2 flex items-center gap-2 text-[12px] font-medium",children:[r.jsx(Vb,{className:"size-3.5 text-muted-foreground"}),"Changed files"]}),l.length?r.jsx("ul",{className:"divide-y divide-border",children:l.slice(0,12).map(p=>r.jsxs("li",{className:"flex items-center gap-2 py-1.5 text-[12px]",children:[r.jsx("span",{className:"w-16 shrink-0 font-mono text-[10px] uppercase text-muted-foreground",children:p.status}),r.jsx("span",{className:"min-w-0 flex-1 truncate font-mono",children:p.path}),r.jsxs("span",{className:"shrink-0 font-mono text-[11px] text-emerald-600",children:["+",p.additions]}),r.jsxs("span",{className:"shrink-0 font-mono text-[11px] text-red-500",children:["-",p.deletions]})]},p.path))}):r.jsx("p",{className:"text-[12px] text-muted-foreground",children:"No changed file metadata available."})]}),r.jsxs("section",{className:"rounded-md border border-border bg-muted/25 p-3",children:[r.jsxs("div",{className:"mb-2 flex items-center gap-2 text-[12px] font-medium",children:[r.jsx(nM,{className:"size-3.5 text-muted-foreground"}),"Review state"]}),u.length||h.length?r.jsxs("div",{className:"space-y-2",children:[u.slice(-4).map(p=>r.jsx(gN,{href:p.html_url,meta:`${p.user.login} - ${p.state.toLowerCase()}`,text:p.body||"No review summary."},`review:${p.id}`)),h.slice(-4).map(p=>r.jsx(gN,{href:p.html_url,meta:`${p.user.login} - comment`,text:p.body},`comment:${p.id}`))]}):r.jsx("p",{className:"text-[12px] text-muted-foreground",children:"No reviews or PR comments yet."})]}),o.body?r.jsx("div",{className:"whitespace-pre-wrap rounded-md border border-border bg-muted/25 p-3 font-mono text-[12px]",children:o.body}):r.jsx("p",{className:"text-[12px] italic text-muted-foreground",children:"No description provided."})]})}function fh({title:e,value:t,tone:s}){const n=s==="success"?"bg-emerald-500":s==="warning"?"bg-amber-500":s==="danger"?"bg-red-500":"bg-muted-foreground";return r.jsxs("div",{className:"rounded-md border border-border bg-card px-3 py-2",children:[r.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:e}),r.jsxs("div",{className:"mt-1 flex items-center gap-1.5 text-[12px] font-medium",children:[r.jsx("span",{className:`size-1.5 rounded-full ${n}`}),t]})]})}function gN({meta:e,text:t,href:s}){return r.jsxs("a",{className:"block rounded border border-border bg-card px-2.5 py-2 text-[12px] transition-colors hover:bg-muted/60",href:s,rel:"noopener noreferrer",target:"_blank",children:[r.jsxs("span",{className:"mb-1 flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[r.jsx(br,{className:"size-3"}),e]}),r.jsx("span",{className:"line-clamp-2 whitespace-pre-wrap",children:t})]})}function Ij(e,t){return e.state!=="open"?e.state:e.draft?"draft":e.mergeable===!1?"blocked":t?.state==="failure"||t?.state==="error"?"checks failing":t?.state==="pending"?"checks pending":e.mergeable===!0?"ready":"unknown"}function cX(e,t){const s=Ij(e,t);return s==="ready"?"success":s==="blocked"||s==="checks failing"?"danger":s==="draft"||s==="checks pending"?"warning":"muted"}function Pj(e){return e.some(t=>t.state==="CHANGES_REQUESTED")?"changes requested":e.some(t=>t.state==="APPROVED")?"approved":e.some(t=>t.state==="COMMENTED")?"commented":"no reviews"}function uX(e){const t=Pj(e);return t==="approved"?"success":t==="changes requested"?"danger":t==="commented"?"warning":"muted"}function dX({pr:e}){const{label:t,dot:s}=e.state==="merged"?{label:"Merged",dot:"bg-violet-500"}:e.state==="closed"?{label:"Closed",dot:"bg-red-500"}:e.draft?{label:"Draft",dot:"bg-muted-foreground"}:{label:"Open",dot:"bg-emerald-500"};return r.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground",children:[r.jsx("span",{className:`size-1.5 rounded-full ${s}`}),t==="Merged"?r.jsx(Wb,{className:"size-3"}):t==="Open"?r.jsx(ff,{className:"size-3"}):r.jsx(Qc,{className:"size-3"}),t]})}function $j({label:e}){return r.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5 text-[10px] font-medium text-muted-foreground",title:e.name,children:[r.jsx("span",{className:"size-2 shrink-0 rounded-sm",style:{backgroundColor:`#${e.color}`}}),r.jsx("span",{className:"truncate",children:e.name})]})}function hX({issues:e,loading:t,loadingMore:s,hasMore:n,error:o,selectedNumber:l,onSelect:u,onLoadMore:h}){return t&&e.length===0?r.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading issues…"}):o?r.jsx("div",{className:"p-4 text-[12px] text-red-500",children:o}):e.length===0?r.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"No issues found."}):r.jsxs(r.Fragment,{children:[r.jsx("ul",{className:"divide-y divide-border",children:e.map(m=>r.jsx("li",{children:r.jsxs("button",{className:`flex w-full items-start gap-3 px-3 py-2.5 text-left transition-colors hover:bg-muted/60 ${l===m.number?"bg-muted":""}`,onClick:()=>u(m.number),type:"button",children:[r.jsx(L4,{className:`mt-0.5 size-4 shrink-0 ${m.state==="open"?"text-emerald-500":"text-red-500"}`}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-[13px] font-medium",children:m.title}),r.jsxs("span",{className:"block text-[11px] text-muted-foreground",children:["#",m.number," · ",m.user.login," · ",m.comments," comment",m.comments!==1?"s":""]})]}),m.labels.length>0?r.jsx("span",{className:"flex max-w-40 shrink-0 flex-wrap justify-end gap-x-2 gap-y-0.5",children:m.labels.slice(0,3).map(d=>r.jsx($j,{label:d},d.name))}):null]})},m.number))}),r.jsx(av,{hasMore:n,loading:s,onLoadMore:h})]})}function fX({issue:e,comments:t,commentsLoading:s,commentError:n,submitting:o,onAddComment:l}){const[u,h]=y.useState("");if(!e)return r.jsx("div",{className:"flex h-full items-center justify-center text-[12px] text-muted-foreground",children:"Select an issue"});async function m(d){d.preventDefault();const p=u.trim();p&&(await l(p),h(""))}return r.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] font-semibold",children:e.title}),r.jsx("a",{"aria-label":"Open on GitHub",className:"shrink-0 rounded p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",href:e.html_url,rel:"noopener noreferrer",target:"_blank",children:r.jsx(br,{className:"size-3.5"})})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:r.jsxs("div",{className:"space-y-3 p-4",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1.5 text-[12px]",children:[r.jsxs("span",{className:"text-[11px]",children:[r.jsx("span",{className:"text-muted-foreground",children:"Author: "}),r.jsx("span",{className:"font-medium",children:e.user.login})]}),r.jsxs("span",{className:"text-[11px]",children:[r.jsx("span",{className:"text-muted-foreground",children:"Opened: "}),r.jsx("span",{className:"font-medium",children:new Date(e.created_at).toLocaleDateString()})]}),e.labels.map(d=>r.jsx($j,{label:d},d.name))]}),e.body?r.jsx("div",{className:"whitespace-pre-wrap rounded-md border border-border bg-muted/30 p-3 font-mono text-[12px]",children:e.body}):r.jsx("p",{className:"text-[12px] text-muted-foreground italic",children:"No description provided."}),s?r.jsx("p",{className:"text-[12px] text-muted-foreground",children:"Loading comments…"}):r.jsx("div",{className:"space-y-2",children:t.map(d=>r.jsxs("div",{className:"rounded-md border border-border bg-muted/20 p-3",children:[r.jsxs("div",{className:"mb-1 flex items-baseline gap-2",children:[r.jsx("span",{className:"text-[11px] font-semibold",children:d.user.login}),r.jsx("span",{className:"text-[10px] text-muted-foreground",children:new Date(d.created_at).toLocaleDateString()})]}),r.jsx("p",{className:"whitespace-pre-wrap font-mono text-[12px]",children:d.body})]},d.id))})]})}),r.jsx("div",{className:"shrink-0 border-t border-border p-3",children:r.jsxs("form",{className:"flex flex-col gap-2",onSubmit:d=>{m(d)},children:[r.jsx("textarea",{className:"w-full resize-none rounded-md border border-border bg-background px-3 py-2 font-mono text-[12px] placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring",onChange:d=>h(d.target.value),placeholder:"Add a comment…",rows:3,value:u}),n?r.jsx($e,{variant:"destructive",children:n}):null,r.jsx(Y,{className:"self-end",disabled:!u.trim()||o,size:"sm",type:"submit",children:o?"Posting…":"Comment"})]})})]})}const bN=30;function mX(e){const[t,s]=y.useState([]),[n,o]=y.useState(null),[l,u]=y.useState([]),[h,m]=y.useState(!0),[d,p]=y.useState(!1),[g,x]=y.useState(!1),[_,S]=y.useState(1),[w,k]=y.useState(!1),[C,T]=y.useState(null),[E,j]=y.useState(null);function M(){let O=!0;return m(!0),T(null),S(1),m0(e,1).then(A=>{O&&(s(A),x(A.length===bN))}).catch(A=>{O&&T(A instanceof Error?A.message:String(A))}).finally(()=>{O&&m(!1)}),()=>{O=!1}}function z(){if(d||!g)return;const O=_+1;p(!0),m0(e,O).then(A=>{s(D=>{const B=new Set(D.map(P=>P.id));return[...D,...A.filter(P=>!B.has(P.id))]}),x(A.length===bN),S(O)}).catch(A=>T(A instanceof Error?A.message:String(A))).finally(()=>p(!1))}return y.useEffect(M,[e]),y.useEffect(()=>{o(O=>O&&t.some(A=>A.id===O)?O:t[0]?.id??null)},[t]),y.useEffect(()=>{if(!n){u([]);return}let O=!0;return k(!0),j(null),s8(n).then(A=>{O&&u(A)}).catch(A=>{O&&j(A instanceof Error?A.message:String(A))}).finally(()=>{O&&k(!1)}),()=>{O=!1}},[n]),{runs:t,selectedRunId:n,jobs:l,loading:h,loadingMore:d,hasMore:g,jobsLoading:w,error:C,jobsError:E,loadMore:z,refresh:M,setSelectedRunId:o}}function pX({branch:e,onClearBranch:t}){const{runs:s,selectedRunId:n,jobs:o,loading:l,loadingMore:u,hasMore:h,jobsLoading:m,error:d,jobsError:p,loadMore:g,refresh:x,setSelectedRunId:_}=mX(e),S=s.find(w=>w.id===n)??null;return r.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-1.5",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"text-[13px] font-semibold",children:"Workflow Runs"}),e?r.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 text-[11px] text-muted-foreground",children:[r.jsx("span",{className:"shrink-0",children:"Filtered to"}),r.jsx("span",{className:"min-w-0 truncate font-mono",children:e}),t?r.jsx("button",{"aria-label":"Clear branch filter",className:"shrink-0 rounded p-0.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:t,title:"Clear branch filter",type:"button",children:r.jsx(Ft,{className:"size-3"})}):null]}):null]}),r.jsxs(Y,{disabled:l,onClick:()=>{x()},size:"sm",type:"button",variant:"outline",children:[r.jsx(_r,{className:`mr-1 size-3.5 ${l?"animate-spin":""}`}),"Refresh"]})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:d?r.jsx("div",{className:"p-4 text-[12px] text-red-500",children:d}):l&&s.length===0?r.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading workflow runs…"}):s.length===0?r.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"No workflow runs found."}):r.jsxs("div",{className:"grid h-full min-h-0 grid-cols-[minmax(280px,380px)_minmax(0,1fr)] divide-x divide-border",children:[r.jsxs("div",{className:"min-h-0 overflow-auto",children:[r.jsx("ul",{className:"divide-y divide-border",children:s.map(w=>r.jsx("li",{children:r.jsxs("button",{className:`flex w-full items-center gap-3 px-3 py-2.5 text-left transition-colors hover:bg-muted/60 ${w.id===n?"bg-muted/70":""}`,onClick:()=>_(w.id),type:"button",children:[r.jsx(gX,{run:w}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-[13px] font-medium",children:w.name}),r.jsxs("span",{className:"block text-[11px] text-muted-foreground",children:["#",w.run_number," · ",w.head_branch," · ",w.event," ·"," ",new Date(w.created_at).toLocaleDateString()]})]}),r.jsx(bX,{run:w})]})},w.id))}),r.jsx(av,{hasMore:h,loading:u,onLoadMore:g})]}),r.jsx(xX,{error:p,jobs:o,loading:m,run:S})]})})]})}function gX({run:e}){return e.status==="in_progress"||e.status==="queued"?r.jsx(Qc,{className:"size-4 shrink-0 animate-pulse text-amber-400"}):e.conclusion==="success"?r.jsx(ff,{className:"size-4 shrink-0 text-emerald-500"}):e.conclusion==="failure"||e.conclusion==="timed_out"?r.jsx(Fb,{className:"size-4 shrink-0 text-red-500"}):r.jsx(Qc,{className:"size-4 shrink-0 text-zinc-400"})}function bX({run:e}){const t=e.status==="completed"?e.conclusion??"completed":e.status,s=t==="success"?"bg-emerald-500":t==="failure"||t==="timed_out"?"bg-red-500":t==="in_progress"||t==="queued"?"bg-amber-500":"bg-muted-foreground";return r.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1.5 text-[10px] font-medium text-muted-foreground",children:[r.jsx("span",{className:`size-1.5 rounded-full ${s}`}),t]})}function xX({run:e,jobs:t,loading:s,error:n}){return e?r.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-[13px] font-semibold",children:e.name}),r.jsxs("span",{className:"block text-[11px] text-muted-foreground",children:["Run #",e.run_number," · ",e.head_branch," · ",e.head_sha.slice(0,7)]})]}),r.jsx("a",{"aria-label":"Open run on GitHub",className:"shrink-0 rounded p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",href:e.html_url,rel:"noopener noreferrer",target:"_blank",title:"Open run on GitHub",children:r.jsx(br,{className:"size-3.5"})})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:n?r.jsx("div",{className:"p-4 text-[12px] text-red-500",children:n}):s?r.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading jobs…"}):t.length===0?r.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"No jobs found for this run."}):r.jsx("ul",{className:"divide-y divide-border",children:t.map(o=>r.jsxs("li",{className:"px-3 py-3",children:[r.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[r.jsx(xN,{item:o}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] font-medium",children:o.name}),r.jsx("span",{className:"shrink-0 font-mono text-[11px] text-muted-foreground",children:vN(o.started_at,o.completed_at)}),r.jsx("a",{"aria-label":`Open ${o.name} job on GitHub`,className:"shrink-0 rounded p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",href:o.html_url,rel:"noopener noreferrer",target:"_blank",title:"Open job on GitHub",children:r.jsx(br,{className:"size-3.5"})})]}),o.steps.length?r.jsx("ol",{className:"space-y-1.5 pl-6",children:o.steps.map(l=>r.jsxs("li",{className:"flex items-center gap-2 text-[12px]",children:[r.jsx(xN,{item:l}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:l.name}),r.jsx("span",{className:"shrink-0 font-mono text-[11px] text-muted-foreground",children:vN(l.started_at,l.completed_at)})]},`${o.id}:${l.number}`))}):r.jsx("p",{className:"pl-6 text-[12px] text-muted-foreground",children:"No step details available."})]},o.id))})})]}):r.jsx("div",{className:"flex h-full items-center justify-center text-[12px] text-muted-foreground",children:"Select a workflow run"})}function xN({item:e}){return e.status==="in_progress"||e.status==="queued"?r.jsx(Qc,{className:"size-3.5 shrink-0 animate-pulse text-amber-400"}):e.conclusion==="success"||e.conclusion==="skipped"?r.jsx(ff,{className:"size-3.5 shrink-0 text-emerald-500"}):e.conclusion==="failure"||e.conclusion==="timed_out"||e.conclusion==="cancelled"?r.jsx(Fb,{className:"size-3.5 shrink-0 text-red-500"}):r.jsx(Qc,{className:"size-3.5 shrink-0 text-zinc-400"})}function vN(e,t){if(!e)return"-";const s=Date.parse(e),n=t?Date.parse(t):Date.now();if(!Number.isFinite(s)||!Number.isFinite(n)||n<s)return"-";const o=Math.max(0,Math.round((n-s)/1e3));if(o<60)return`${o}s`;const l=Math.floor(o/60),u=o%60;return u?`${l}m ${u}s`:`${l}m`}function vX({onCreatePR:e,onViewRuns:t}){const[s,n]=y.useState(null),[o,l]=y.useState(!0),[u,h]=y.useState(null);function m(){let p=!0;return l(!0),h(null),V6().then(g=>{p&&n(g)}).catch(g=>{p&&h(g instanceof Error?g.message:String(g))}).finally(()=>{p&&l(!1)}),()=>{p=!1}}y.useEffect(m,[]);const d=y.useMemo(()=>[...s?.branches??[]].sort((g,x)=>{const _=yN(g,s),S=yN(x,s);return _-S||g.name.localeCompare(x.name)}),[s]);return r.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-1.5",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"text-[13px] font-semibold",children:"Branches"}),r.jsx("p",{className:"truncate text-[11px] text-muted-foreground",children:s?.repository.full_name??"Selected repository"})]}),r.jsxs(Y,{disabled:o,onClick:()=>{m()},size:"sm",type:"button",variant:"outline",children:[r.jsx(_r,{className:`mr-1 size-3.5 ${o?"animate-spin":""}`}),"Refresh"]})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:u?r.jsx("div",{className:"p-4 text-[12px] text-red-500",children:u}):o&&!s?r.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading branches..."}):d.length===0?r.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"No branches found."}):r.jsx("ul",{className:"divide-y divide-border",children:d.map(p=>r.jsx(_X,{branch:p,currentBranch:s?.currentBranch??null,defaultBranch:s?.defaultBranch??null,onCreatePR:e,onViewRuns:t},p.name))})})]})}function _X({branch:e,defaultBranch:t,currentBranch:s,onCreatePR:n,onViewRuns:o}){const l=e.name===t,u=e.name===s,h=!l;return r.jsxs("li",{className:"flex flex-wrap items-center gap-3 px-3 py-2.5",children:[r.jsx(sn,{className:"size-4 shrink-0 text-muted-foreground"}),r.jsxs("div",{className:"min-w-48 flex-1",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("span",{className:"truncate font-mono text-[13px] font-medium",children:e.name}),l?r.jsx(_N,{label:"Default",tone:"success"}):null,u?r.jsx(_N,{label:"Current",tone:"warning"}):null,e.protected?r.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 text-[10px] text-muted-foreground",children:[r.jsx(qM,{className:"size-3"}),"protected"]}):null]}),r.jsx("div",{className:"mt-0.5 font-mono text-[11px] text-muted-foreground",children:e.commit.sha.slice(0,7)})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[r.jsxs(Y,{onClick:()=>o(e.name),size:"sm",title:`View workflow runs for ${e.name}`,type:"button",variant:"outline",children:[r.jsx(B4,{className:"size-3.5"}),"View runs"]}),r.jsxs(Y,{disabled:!h,onClick:()=>n(e.name),size:"sm",title:h?`Open PR from ${e.name}`:"Default branch does not need a PR",type:"button",variant:"outline",children:[r.jsx(BN,{className:"size-3.5"}),"Open PR"]})]})]})}function _N({label:e,tone:t}){const s=t==="success"?"bg-emerald-500":"bg-amber-500";return r.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 text-[10px] text-muted-foreground",children:[r.jsx("span",{className:`size-1.5 rounded-full ${s}`}),e]})}function yN(e,t){return e.name===t?.currentBranch?0:e.name===t?.defaultBranch?1:e.protected?2:3}function yX(){const e=eX();let t;return e.loading||e.status==="checking"?t=r.jsx("div",{className:"flex h-full items-center justify-center text-[12px] text-muted-foreground",children:"Loading…"}):e.status==="not_configured"?t=r.jsx(Bj,{deviceFlowAvailable:e.deviceFlowAvailable,onSaved:e.refresh}):e.status==="auth_error"||e.status==="connection_error"?t=r.jsx(SX,{token:e}):t=r.jsx(wX,{token:e}),r.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-card/85",children:t})}function SX({token:e}){const[t,s]=y.useState(null);if(t)return r.jsx(Bj,{deviceFlowAvailable:e.deviceFlowAvailable,initialMode:t,onSaved:e.refresh});const n=e.status==="auth_error";return r.jsx("div",{className:"flex h-full items-center justify-center p-8",children:r.jsxs("div",{className:"w-full max-w-lg space-y-4 rounded-md border border-border bg-card p-5",children:[r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(rv,{className:"size-5"}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("h2",{className:"text-sm font-semibold",children:"GitHub connection failed"}),r.jsx("p",{className:"text-[12px] text-muted-foreground",children:n?"The saved GitHub token is no longer accepted.":"NoMoreIDE could not validate the GitHub connection."})]}),r.jsx(Hj,{label:n?"Needs re-login":"Connection problem",tone:n?"danger":"warning"})]}),e.error?r.jsx($e,{variant:"destructive",children:e.error}):null,r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(Y,{onClick:e.refresh,type:"button",variant:n?"outline":"default",children:[r.jsx(_r,{}),"Refresh"]}),r.jsx(Y,{onClick:()=>s(e.deviceFlowAvailable?"device-pending":"pat"),type:"button",variant:n?"default":"outline",children:"Reconnect GitHub"}),r.jsx(Y,{onClick:()=>s("pat"),type:"button",variant:"outline",children:"Use token instead"})]})]})})}function wX({token:e}){const[t,s]=y.useState("prs"),[n,o]=y.useState("open"),[l,u]=y.useState("open"),[h,m]=y.useState(null),[d,p]=y.useState(null),[g,x]=y.useState(!1),[_,S]=y.useState(null),w=tX(n),k=sX(l),C=j=>`rounded px-2 py-0.5 text-[11px] font-medium transition-colors ${j?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,T=j=>`rounded px-2 py-0.5 text-[10px] font-medium transition-colors ${j?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`;async function E(){x(!0),S(null);try{await q6("github.com"),e.refresh()}catch(j){S(j instanceof Error?j.message:String(j))}finally{x(!1)}}return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-1 border-b border-border bg-card/95 px-3 py-1",children:[r.jsx("button",{className:C(t==="prs"),onClick:()=>s("prs"),type:"button",children:"Pull Requests"}),r.jsx("button",{className:C(t==="issues"),onClick:()=>s("issues"),type:"button",children:"Issues"}),r.jsx("button",{className:C(t==="branches"),onClick:()=>s("branches"),type:"button",children:"Branches"}),r.jsx("button",{className:C(t==="actions"),onClick:()=>s("actions"),type:"button",children:"Actions"}),r.jsxs("div",{className:"ml-auto flex min-w-0 items-center gap-2",children:[r.jsx(kX,{token:e}),r.jsxs(Y,{onClick:e.refresh,size:"sm",type:"button",variant:"outline",children:[r.jsx(_r,{}),"Refresh"]}),r.jsx(Y,{disabled:g,onClick:()=>{E()},size:"sm",type:"button",variant:"outline",children:g?"Disconnecting…":"Disconnect"})]}),t==="prs"?r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("div",{className:"flex items-center gap-0.5 rounded-md bg-muted/60 p-0.5",children:[r.jsx("button",{className:T(n==="open"),onClick:()=>o("open"),type:"button",children:"Open"}),r.jsx("button",{className:T(n==="closed"),onClick:()=>o("closed"),type:"button",children:"Closed"})]}),r.jsx(Y,{onClick:()=>m(""),size:"sm",type:"button",variant:"outline",children:"New PR"})]}):t==="issues"?r.jsxs("div",{className:"flex items-center gap-0.5 rounded-md bg-muted/60 p-0.5",children:[r.jsx("button",{className:T(l==="open"),onClick:()=>u("open"),type:"button",children:"Open"}),r.jsx("button",{className:T(l==="closed"),onClick:()=>u("closed"),type:"button",children:"Closed"})]}):null]}),_?r.jsx($e,{variant:"destructive",className:"m-3",children:_}):null,h!==null?r.jsx(NX,{initialHead:h,onCreated:j=>{m(null),s("prs"),w.setSelectedNumber(j.number),w.refresh()},onCancel:()=>m(null)}):r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:t==="prs"?r.jsxs("div",{className:"grid h-full min-h-0 grid-cols-2 divide-x divide-border",children:[r.jsx("div",{className:"min-h-0 overflow-auto",children:r.jsx(rX,{error:w.error,hasMore:w.hasMore,loading:w.loading,loadingMore:w.loadingMore,onLoadMore:w.loadMore,onSelect:w.setSelectedNumber,prs:w.prs,selectedNumber:w.selectedNumber})}),r.jsx("div",{className:"flex min-h-0 min-w-0 flex-col overflow-hidden",children:r.jsx(oX,{diff:w.diff,diffError:w.diffError,diffLoading:w.diffLoading,onMerged:()=>w.refresh(),pr:w.selectedPR})})]}):t==="issues"?r.jsxs("div",{className:"grid h-full min-h-0 grid-cols-2 divide-x divide-border",children:[r.jsx("div",{className:"min-h-0 overflow-auto",children:r.jsx(hX,{error:k.error,hasMore:k.hasMore,issues:k.issues,loading:k.loading,loadingMore:k.loadingMore,onLoadMore:k.loadMore,onSelect:k.setSelectedNumber,selectedNumber:k.selectedNumber})}),r.jsx("div",{className:"flex min-h-0 min-w-0 flex-col overflow-hidden",children:r.jsx(fX,{commentError:k.commentError,comments:k.comments,commentsLoading:k.commentsLoading,issue:k.selectedIssue,onAddComment:k.addComment,submitting:k.submitting})})]}):t==="branches"?r.jsx(vX,{onCreatePR:j=>m(j),onViewRuns:j=>{p(j),s("actions")}}):r.jsx(pX,{branch:d??void 0,onClearBranch:()=>p(null)})})]})}function kX({token:e}){const t=e.info?.repository?.full_name??(e.info?.user?`@${e.info.user.login}`:"GitHub");return r.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 border-r border-border pr-2",children:[r.jsx(rv,{className:"size-4 shrink-0 text-foreground"}),r.jsx(Hj,{label:"Connected",tone:"success"}),r.jsx("span",{className:"max-w-48 truncate font-mono text-[10px] text-muted-foreground",children:t})]})}function Hj({label:e,tone:t}){const s=t==="success"?"bg-emerald-500":t==="danger"?"bg-red-500":"bg-amber-500";return r.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1.5 text-[11px] font-medium text-muted-foreground",children:[r.jsx("span",{className:`size-1.5 rounded-full ${s}`}),e]})}function NX({initialHead:e,onCreated:t,onCancel:s}){const[n,o]=y.useState(""),[l,u]=y.useState(""),[h,m]=y.useState(""),[d,p]=y.useState("main"),[g,x]=y.useState(!1),[_,S]=y.useState(null),[w,k]=y.useState(!0),[C,T]=y.useState(!1),[E,j]=y.useState(null);y.useEffect(()=>{let A=!0;return k(!0),j(null),Y6().then(D=>{A&&(S(D),o(D.title),u(D.body),m(e||D.head),p(D.base||D.suggestedBase||"main"),x(D.draft))}).catch(D=>{A&&j(D instanceof Error?D.message:String(D))}).finally(()=>{A&&k(!1)}),()=>{A=!1}},[e]);async function M(A){if(A.preventDefault(),!(!n.trim()||!h.trim()||!d.trim())){T(!0),j(null);try{const D=await X6({title:n.trim(),body:l.trim()||void 0,head:h.trim(),base:d.trim(),draft:g});t(D)}catch(D){j(D instanceof Error?D.message:String(D))}finally{T(!1)}}}const z="w-full rounded-md border border-border bg-background px-3 py-2 text-[13px] placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring",O=_?.warnings??[];return r.jsxs("form",{className:"flex min-h-0 flex-col gap-3 overflow-auto bg-muted/20 p-4",onSubmit:A=>{M(A)},children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h3",{className:"text-[13px] font-semibold",children:"Branch to PR Assistant"}),r.jsxs("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:[_?.repository?.full_name??"Selected repository",_?.currentBranch?` - ${_.currentBranch}`:""]})]}),r.jsx("span",{className:"shrink-0 text-[11px] text-muted-foreground",children:w?"Detecting branch...":"Editable draft"})]}),r.jsx(CX,{template:_,loading:w}),O.length>0?r.jsx("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-[12px] text-amber-700 dark:text-amber-300",children:O[0]}):null,r.jsx("input",{className:z,disabled:w,onChange:A=>o(A.target.value),placeholder:"Title",required:!0,value:n}),r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs("label",{className:"space-y-1",children:[r.jsx("span",{className:"text-[10px] uppercase text-muted-foreground",children:"Head"}),r.jsx("input",{className:z,disabled:w,onChange:A=>m(A.target.value),placeholder:"Head branch",required:!0,value:h})]}),r.jsxs("label",{className:"space-y-1",children:[r.jsx("span",{className:"text-[10px] uppercase text-muted-foreground",children:"Base"}),r.jsx("input",{className:z,disabled:w,onChange:A=>p(A.target.value),placeholder:"Base branch",required:!0,value:d})]})]}),r.jsx("textarea",{className:`${z} resize-none`,disabled:w,onChange:A=>u(A.target.value),placeholder:"Description (optional)",rows:7,value:l}),r.jsxs("label",{className:"flex items-center gap-2 text-[12px]",children:[r.jsx("input",{checked:g,className:"size-3.5",disabled:w,onChange:A=>x(A.target.checked),type:"checkbox"}),"Create as draft"]}),E?r.jsx($e,{variant:"destructive",children:E}):null,r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Y,{disabled:w||C||!n.trim()||!h.trim()||!d.trim(),type:"submit",children:C?"Creating…":"Create PR"}),r.jsx(Y,{onClick:s,type:"button",variant:"outline",children:"Cancel"})]})]})}function CX({template:e,loading:t}){const s=e?.compare,n=s?.ciStatus,o=[{label:"base branch",value:s?.base||e?.base||"main"},{label:"head branch",value:s?.head||e?.head||"manual"},{label:"commits ahead",value:t?"...":String(s?.aheadBy??0)},{label:"changed files",value:t?"...":String(s?.files.length??0)},{label:"head CI",value:n?`${n.state} (${n.totalCount})`:"unavailable"}];return r.jsxs("div",{className:"rounded-md border border-border bg-card px-3 py-2",children:[r.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[r.jsx("span",{className:"text-[11px] font-medium text-foreground",children:"Compare summary"}),s?.headSha?r.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:s.headSha.slice(0,7)}):null]}),r.jsx("div",{className:"grid grid-cols-5 gap-2",children:o.map(l=>r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"truncate text-[10px] uppercase text-muted-foreground",children:l.label}),r.jsx("div",{className:"truncate font-mono text-[11px] text-foreground",children:l.value})]},l.label))}),s?.files.length?r.jsx("div",{className:"mt-2 flex flex-wrap gap-x-3 gap-y-1 text-[11px] text-muted-foreground",children:s.files.slice(0,4).map(l=>r.jsxs("span",{className:"max-w-52 truncate",children:[l.status," ",l.path]},`${l.status}:${l.path}`))}):null]})}function EX({ahead:e=0,behind:t=0,branches:s,currentBranch:n,disabled:o,onRefresh:l,upstream:u}){const[h,m]=y.useState(!1),[d,p]=y.useState(""),[g,x]=y.useState(null),[_,S]=y.useState(null),[w,k]=y.useState(null),C=s.filter(D=>!D.remote),T=s.filter(D=>D.remote);async function E(D,B){x(D),k(null),S(null);try{await B(),await l()}catch(P){k(P instanceof Error?P.message:String(P))}finally{x(null)}}async function j(D){await E(`switch:${D}`,async()=>{await en("/api/git/branches/switch",{name:D}),m(!1)})}async function M(){await E("fetch",async()=>{await en("/api/git/fetch",{}),S("Fetched latest branch refs.")})}async function z(){await E("push",async()=>{const D=await pf();S(D.setUpstream?`Pushed ${D.branch} and set upstream.`:`Pushed ${D.branch}.`)})}const O=!!n&&(e>0||!u&&t===0);async function A(D){D.preventDefault();const B=d.trim();if(!B){k("Branch name is required.");return}await E("create",async()=>{await en("/api/git/branches",{name:B}),p(""),m(!1)})}return r.jsxs("div",{className:"fixed bottom-12 right-4 z-50 flex items-end",children:[h?r.jsxs("div",{"aria-label":"Switch Git branch",className:"mb-11 w-[min(460px,calc(100vw-2rem))] rounded-lg border border-border bg-card shadow-xl",role:"dialog",children:[r.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-border p-3",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx(sn,{className:"size-4 text-muted-foreground"}),r.jsx("span",{className:"truncate text-sm font-semibold",children:n||"Branches"})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[O?r.jsxs(Y,{"aria-label":"Push current branch",className:"gap-1.5 px-2 text-xs",disabled:o||g!==null,onClick:()=>{z()},size:"sm",title:u?`Push ${e} commit${e===1?"":"s"} to ${u}`:"Push and set upstream",type:"button",variant:"default",children:[r.jsx(Kb,{className:ie("size-3.5",g==="push"&&"animate-pulse")}),"Push",e>0?` ${e}`:""]}):null,r.jsx(Y,{"aria-label":"Fetch branches",disabled:o||g!==null,onClick:()=>{M()},size:"icon",title:"Fetch branches",type:"button",variant:"ghost",children:r.jsx(_r,{className:ie(g==="fetch"&&"animate-spin")})}),r.jsx(Y,{"aria-label":"Close branch dialog",onClick:()=>m(!1),size:"icon",type:"button",variant:"ghost",children:r.jsx(Ft,{})})]})]}),r.jsx("div",{className:"max-h-72 overflow-auto",children:s.length?r.jsxs(r.Fragment,{children:[r.jsx(SN,{branches:C,busy:g!==null,disabled:o,label:"Local",onSwitch:j}),r.jsx(SN,{branches:T,busy:g!==null,disabled:o,label:"Remote",onSwitch:j})]}):r.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"No branches found."})}),r.jsxs("div",{className:"border-t border-border p-3",children:[r.jsxs("form",{className:"grid gap-2 sm:grid-cols-[1fr_auto]",onSubmit:A,children:[r.jsx(tt,{"aria-label":"New branch name",disabled:o||g!==null,onChange:D=>{p(D.target.value),k(null),S(null)},placeholder:"feature/new-work",value:d}),r.jsxs(Y,{disabled:o||g!==null,type:"submit",children:[r.jsx(ER,{}),"Create"]})]}),w||_?r.jsx($e,{className:"mt-3 px-3 py-2 text-xs",variant:w?"destructive":"muted",children:w??_}):null]})]}):null,r.jsxs(Y,{className:"h-8 max-w-[260px] gap-2 rounded-md shadow-lg",disabled:o,onClick:()=>m(D=>!D),size:"sm",title:"Switch Git branch",type:"button",variant:"default",children:[r.jsx(sn,{className:"size-4"}),r.jsx("span",{className:"truncate font-mono text-xs",children:n||"No branch"}),n&&(e>0||t>0)?r.jsxs("span",{className:"flex items-center gap-1 font-mono text-[11px] tabular-nums",title:u?`${e} ahead / ${t} behind ${u}`:`${e} ahead / ${t} behind`,children:[t>0?r.jsxs("span",{className:"flex items-center",children:[r.jsx(uf,{className:"size-3"}),t]}):null,e>0?r.jsxs("span",{className:"flex items-center",children:[r.jsx(df,{className:"size-3"}),e]}):null]}):null,r.jsx(Mn,{className:ie("size-4 transition-transform",h&&"rotate-180")})]})]})}function SN({branches:e,busy:t,disabled:s,label:n,onSwitch:o}){return r.jsxs("section",{children:[r.jsx("div",{className:"border-b border-border bg-muted/60 px-3 py-1.5 text-[11px] font-semibold uppercase text-muted-foreground",children:n}),e.length?e.map(l=>r.jsxs("button",{className:ie("grid w-full grid-cols-[1fr_auto] items-center gap-2 border-b border-border px-3 py-2 text-left text-sm last:border-b-0 hover:bg-muted",l.current&&"bg-muted/70"),disabled:s||t||l.current,onClick:()=>{o(l.name)},type:"button",children:[r.jsxs("span",{className:"min-w-0",children:[r.jsx("span",{className:"block truncate font-medium",children:l.name}),l.upstream?r.jsxs("span",{className:"block truncate font-mono text-[11px] text-muted-foreground",children:["tracks ",l.upstream]}):null]}),r.jsx(ze,{variant:l.current?"success":l.remote?"outline":"secondary",children:l.current?"current":l.remote?"remote":"local"})]},`${l.remote?"remote":"local"}:${l.name}`)):r.jsxs("div",{className:"border-b border-border px-3 py-3 text-sm text-muted-foreground",children:["No ",n.toLowerCase()," branches."]})]})}const Uj="nomoreide-theme-choice";function jX(){if(typeof window>"u")return"dark";const e=window.localStorage.getItem(Uj);return e==="light"||e==="dark"?e:"dark"}function TX(e){const t=document.documentElement;t.classList.toggle("dark",e==="dark"),t.style.colorScheme=e}function AX(){const[e,t]=y.useState(()=>jX()),s=y.useRef(null);y.useEffect(()=>{TX(e),window.localStorage.setItem(Uj,e)},[e]);const n=y.useCallback(()=>{const o=e==="dark"?"light":"dark",l=s.current,u=document;if(!l||!u.startViewTransition||window.matchMedia("(prefers-reduced-motion: reduce)").matches){t(o);return}const h=l.getBoundingClientRect(),m=h.left+h.width/2,d=h.top+h.height/2,p=Math.hypot(Math.max(m,window.innerWidth-m),Math.max(d,window.innerHeight-d));u.startViewTransition(()=>{t(o)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${m}px ${d}px)`,`circle(${p}px at ${m}px ${d}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},[e]);return r.jsxs("button",{ref:s,type:"button",onClick:n,title:e==="dark"?"Switch to light mode":"Switch to dark mode","aria-label":"Toggle theme",className:Hh(),children:[r.jsx("span",{className:Uh(),children:e==="dark"?r.jsx(QM,{}):r.jsx(lM,{})}),r.jsx("span",{className:Fh(),children:"Theme"})]})}function RX(e=!1){return ie("group/sidebar hidden h-full shrink-0 overflow-x-hidden overflow-y-auto border-r border-border bg-card/85 py-5 backdrop-blur transition-[width,padding] duration-200 md:flex md:flex-col",e?"w-64 px-4":"w-16 px-2 hover:w-64 hover:px-4")}function MX(e,t=!1){return ie("relative grid h-12 grid-cols-[48px_minmax(0,1fr)] items-center justify-start gap-0 overflow-hidden rounded-md px-0 text-[15px] font-medium transition-[background-color,color,width] duration-150",t?"w-full":"w-12 group-hover/sidebar:w-full",e?"bg-primary text-primary-foreground hover:bg-primary/90":"hover:bg-muted")}function DX(e=!1,t=!1){return ie("min-w-0 overflow-hidden text-left text-current transition duration-150 whitespace-pre",e?"translate-x-1 opacity-100":"opacity-0 group-hover/sidebar:translate-x-1 group-hover/sidebar:opacity-100",t?"pr-10":"pr-3")}function OX(e=!1){return ie("flex size-12 items-center justify-center text-current transition-transform duration-150 [&_svg]:size-5",e?"translate-x-0":"-translate-x-px group-hover/sidebar:translate-x-0")}function LX({docked:e,onToggleDock:t}){return r.jsxs("div",{className:ie("mt-auto flex h-10 min-w-0 items-center overflow-hidden border-t border-border/60 text-[11px] text-muted-foreground transition-[height,opacity,width] duration-150",e?"w-full justify-start opacity-100":"w-12 justify-center group-hover/sidebar:w-full group-hover/sidebar:justify-start group-hover/sidebar:opacity-100"),children:[r.jsxs("span",{className:ie("flex min-w-0 items-center gap-1.5 overflow-hidden whitespace-pre transition-[opacity,width] duration-150",e?"flex-1 opacity-100":"w-0 flex-none opacity-0 group-hover/sidebar:w-auto group-hover/sidebar:flex-1 group-hover/sidebar:opacity-100"),children:[r.jsx("span",{children:"Made with"}),r.jsx(MR,{"aria-label":"love",className:"size-3 shrink-0 fill-red-500 text-red-500"}),r.jsx("span",{children:"by Robert Wang"}),r.jsx("a",{"aria-label":"Robert Wang on LinkedIn",className:"shrink-0 rounded p-0.5 text-muted-foreground transition-colors hover:bg-muted hover:text-[#0A66C2]",href:"https://www.linkedin.com/in/robert-wang-cs/",rel:"noopener noreferrer",target:"_blank",title:"LinkedIn",children:r.jsxs("svg",{className:"size-3 fill-current",role:"img",viewBox:"0 0 24 24",children:[r.jsx("title",{children:"LinkedIn"}),r.jsx("path",{d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.063 2.063 0 1 1 0-4.126 2.063 2.063 0 0 1 0 4.126zM7.119 20.452H3.554V9h3.565v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.225 0z"})]})})]}),r.jsx("button",{"aria-label":e?"Undock sidebar":"Dock sidebar","aria-pressed":e,className:ie("flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground [&_svg]:size-4",e?"ml-auto bg-muted text-foreground":"group-hover/sidebar:ml-auto"),onClick:t,title:e?"Undock sidebar":"Dock sidebar",type:"button",children:e?r.jsx(mM,{}):r.jsx(gM,{})})]})}function zX({className:e}){return r.jsxs("div",{className:ie("min-w-0",e),children:[r.jsxs("div",{className:"flex items-baseline gap-1.5",children:[r.jsx("div",{className:"text-sm font-semibold",children:"NoMoreIDE"}),r.jsxs("div",{className:"font-mono text-[10px] text-muted-foreground",children:["v","0.1.56"]})]}),r.jsx("div",{className:"font-mono text-[11px] text-muted-foreground",children:"127.0.0.1 console"})]})}function BX({syncLocation:e=!0}={}){const[t,s]=y.useState(()=>e?window.location.pathname.startsWith("/agent")?"agent":window.location.pathname.startsWith("/errors")?"errors":window.location.pathname.startsWith("/database")?"database":window.location.pathname.startsWith("/terminal")?"terminal":window.location.pathname.startsWith("/github")?"github":window.location.pathname.startsWith("/git")?"git":"services":"services"),[n,o]=y.useState(null),[l,u]=y.useState(null),[h,m]=y.useState(null),[d,p]=y.useState(null),[g,x]=y.useState(!0),{error:_,success:S}=Es(),[w,k]=y.useState(()=>window.localStorage.getItem("nomoreide:sidebar-docked")==="true"),C=y.useCallback(async(j={})=>{j.silent||x(!0),p(null);try{o(await c8()),j.notify&&S("Dashboard refreshed.")}catch(M){const z=M instanceof Error?M.message:String(M);p(z),_(z)}finally{x(!1)}},[_,S]);y.useEffect(()=>{C()},[C]),y.useEffect(()=>{function j(){document.visibilityState==="visible"&&C({silent:!0})}const M=window.setInterval(j,5e3);return window.addEventListener("focus",j),document.addEventListener("visibilitychange",j),()=>{window.clearInterval(M),window.removeEventListener("focus",j),document.removeEventListener("visibilitychange",j)}},[t,C]),y.useEffect(()=>{if(!e)return;const j=t==="git"?"/git":t==="github"?"/github":t==="agent"?"/agent":t==="errors"?"/errors":t==="database"?"/database":t==="terminal"?"/terminal":"/";window.location.pathname!==j&&window.history.pushState(null,"",j)},[t,e]),y.useEffect(()=>{window.localStorage.setItem("nomoreide:sidebar-docked",String(w))},[w]);const T=y.useMemo(()=>n?Object.values(n.runtime.services).filter(j=>j.state==="running").length:0,[n]),E=n?.git.selectedRepository?.name??n?.git.cwd??"no-git-repository";return r.jsx($z,{children:r.jsx(VI,{onRefresh:()=>{C({silent:!0})},children:r.jsxs("div",{className:"h-screen overflow-hidden pb-9",children:[r.jsxs("div",{className:"mx-auto flex h-full max-w-[1500px]",children:[r.jsxs("aside",{className:RX(w),children:[r.jsxs("div",{className:ie("grid h-12 grid-cols-[48px_minmax(0,1fr)] items-center overflow-hidden transition-[width] duration-150",w?"w-full":"w-12 group-hover/sidebar:w-full"),children:[r.jsx("div",{className:"flex size-12 items-center justify-center",children:r.jsx("div",{className:"flex size-9 items-center justify-center overflow-hidden rounded-md bg-primary text-primary-foreground",children:r.jsxs("svg",{"aria-label":"NoMoreIDE",className:"size-6",fill:"none",role:"img",viewBox:"0 0 64 64",xmlns:"http://www.w3.org/2000/svg",children:[r.jsx("path",{d:"M5 17C5 13.69 7.69 11 11 11H25L31 17H53C56.31 17 59 19.69 59 23V53C59 56.31 56.31 59 53 59H11C7.69 59 5 56.31 5 53V17Z",fill:"currentColor"}),r.jsx("path",{d:"M22 31L30 39L22 47",stroke:"hsl(var(--primary))",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"4.5"}),r.jsx("path",{d:"M36 47H48",stroke:"hsl(var(--primary))",strokeLinecap:"round",strokeWidth:"4.5"})]})})}),r.jsx(zX,{className:ie("min-w-0 translate-x-1 overflow-hidden transition-opacity duration-200",w?"opacity-100":"opacity-0 group-hover/sidebar:opacity-100")})]}),r.jsxs("nav",{className:"mt-5 grid flex-1 content-start gap-1",children:[r.jsx($a,{active:t==="services",badge:T,docked:w,icon:r.jsx(GN,{}),label:"Services",onClick:()=>s("services")}),r.jsx($a,{active:t==="git",docked:w,icon:r.jsx(sn,{}),label:"Git Review",onClick:()=>s("git")}),r.jsx($a,{active:t==="github",docked:w,icon:r.jsx(rv,{}),label:"GitHub",onClick:()=>s("github")}),r.jsx($a,{active:t==="errors",docked:w,icon:r.jsx(Ah,{}),label:"Error Inbox",onClick:()=>s("errors")}),r.jsx($a,{active:t==="database",docked:w,icon:r.jsx(Zn,{}),label:"Database",onClick:()=>s("database")}),r.jsx($a,{active:t==="terminal",docked:w,icon:r.jsx(YM,{}),label:"Terminal",onClick:()=>s("terminal")}),r.jsx($a,{active:t==="agent",docked:w,icon:r.jsx(p4,{}),label:"Agent",onClick:()=>s("agent")})]}),r.jsx(LX,{docked:w,onToggleDock:()=>k(j=>!j)})]}),r.jsxs("main",{className:"flex h-full min-w-0 flex-1 flex-col px-0 py-0",children:[r.jsxs("header",{className:ie("relative z-40 flex shrink-0 flex-wrap items-center justify-between gap-3 border border-border bg-card/90 px-4 py-3 backdrop-blur","border-x-0 border-t-0 border-b"),children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(xM,{className:"size-4 text-muted-foreground md:hidden"}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-lg font-semibold tracking-tight",children:t==="git"?"Git Review":t==="github"?"GitHub":t==="agent"?"Agent":t==="errors"?"Error Inbox":t==="database"?"Database":t==="terminal"?"Terminal":"Services"}),r.jsx("p",{className:"font-mono text-xs text-muted-foreground",children:n?.git.selectedRepository?.name??n?.git.cwd??"Local workspace"})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[d?r.jsx(ze,{variant:"danger",children:d}):null,n&&(t==="git"||t==="github")?r.jsx(dY,{data:n,onRefresh:C}):null,r.jsxs("div",{"aria-label":"Dashboard quick actions",className:"flex items-center gap-1 rounded-lg border border-border bg-background p-px",role:"toolbar",children:[r.jsxs("button",{"aria-label":"Refresh dashboard",className:Hh(),onClick:()=>{C({notify:!0})},title:"Refresh dashboard",type:"button",children:[r.jsx("span",{className:Uh(),children:r.jsx(_r,{className:ie(g&&"animate-spin")})}),r.jsx("span",{className:Fh(),children:"Refresh"})]}),r.jsx(AX,{}),r.jsxs("a",{"aria-label":"Open NoMoreIDE documentation",className:Hh(),href:"https://www.nomoreide.com/docs",rel:"noreferrer",target:"_blank",title:"Open NoMoreIDE documentation",children:[r.jsx("span",{className:Uh(),children:r.jsx(f4,{})}),r.jsx("span",{className:Fh(),children:"Docs"})]}),n?r.jsx(NI,{data:n}):null]})]})]}),n?r.jsx(bV,{data:n,onOpenService:j=>{u(j),s("services"),C({silent:!0})}}):null,g&&!n?r.jsx($e,{variant:"muted",children:"Loading NoMoreIDE state..."}):null,r.jsxs("div",{className:"min-h-0 flex-1 overflow-hidden",children:[n&&t==="services"?r.jsx(mV,{data:n,onRefresh:C,focusService:l,onServiceFocused:()=>u(null)}):null,n&&t==="git"?r.jsx(QY,{data:n,onRefresh:()=>{C({silent:!0})}}):null,t==="github"?r.jsx(yX,{},E):null,t==="agent"?r.jsx(tI,{}):null,t==="errors"?r.jsx(Y$,{}):null,t==="database"?r.jsx(F$,{staged:h,onStageConsumed:()=>m(null)}):null,t==="terminal"?r.jsx(wV,{}):null]})]})]}),n&&t==="git"?r.jsx(EX,{ahead:n.git.status?.ahead??0,behind:n.git.status?.behind??0,branches:n.git.branches,currentBranch:n.git.status?.branch||void 0,disabled:!n.git.status,onRefresh:C,upstream:n.git.status?.upstream}):null,r.jsx(c$,{git:n?.git,onGitRefresh:()=>{C({silent:!0})},onOpenAgentPage:t==="agent"?void 0:()=>s("agent"),onOpenService:j=>{u(j),s("services"),C({silent:!0})},onOpenSqlConsole:(j,M)=>{m(z=>({connection:j,sql:M,nonce:(z?.nonce??0)+1})),s("database")}})]})})})}function $a({active:e,badge:t,docked:s,icon:n,label:o,onClick:l}){const u=t!==void 0&&t>0;return r.jsxs(Y,{"aria-label":o,title:o,className:MX(e,s),variant:"ghost",onClick:l,type:"button",children:[r.jsx("span",{className:OX(s),children:n}),r.jsx("span",{className:DX(s,u),children:o}),t!==void 0&&t>0?r.jsx(ze,{appearance:t>0?"solid":"outline",className:ie("min-w-6 justify-center px-1.5 font-mono shadow-none",e?"border-primary-foreground/40 bg-primary-foreground/15 text-primary-foreground dark:border-primary-foreground/40 dark:bg-primary-foreground/15 dark:text-primary-foreground":t>0?"":"border-border bg-background text-muted-foreground","absolute right-1.5 top-1.5 h-4 min-w-4 rounded-full px-1 text-[10px] leading-none shadow-none group-hover/sidebar:right-2 group-hover/sidebar:top-1/2 group-hover/sidebar:-translate-y-1/2 group-hover/sidebar:text-xs",s&&"right-2 top-1/2 -translate-y-1/2 text-xs"),size:"small",variant:t>0?"success":"outline",children:t}):null]})}kN.createRoot(document.getElementById("root")).render(r.jsx(y.StrictMode,{children:r.jsx(BX,{})}));export{r as j,y as r};