nomoreide 0.1.76 → 0.1.78

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.
Files changed (32) hide show
  1. package/dist/core/app-settings.d.ts +61 -0
  2. package/dist/core/app-settings.js +106 -0
  3. package/dist/core/app-settings.js.map +1 -0
  4. package/dist/core/config-store.d.ts +56 -1
  5. package/dist/core/config-store.js +315 -141
  6. package/dist/core/config-store.js.map +1 -1
  7. package/dist/core/db/driver.js +1 -1
  8. package/dist/core/db/driver.js.map +1 -1
  9. package/dist/core/types.d.ts +11 -0
  10. package/dist/core/workflow-triggers.d.ts +41 -7
  11. package/dist/core/workflow-triggers.js +65 -6
  12. package/dist/core/workflow-triggers.js.map +1 -1
  13. package/dist/web/client/assets/{code-editor-B8IA745f.js → code-editor-BNnBWxdS.js} +1 -1
  14. package/dist/web/client/assets/index-BQhhJGr0.js +219 -0
  15. package/dist/web/client/assets/index-GEJPKMXv.css +1 -0
  16. package/dist/web/client/index.html +27 -10
  17. package/dist/web/routes/context.d.ts +2 -0
  18. package/dist/web/routes/context.js.map +1 -1
  19. package/dist/web/routes/github-context.d.ts +8 -0
  20. package/dist/web/routes/github-context.js +30 -0
  21. package/dist/web/routes/github-context.js.map +1 -1
  22. package/dist/web/routes/index.js +2 -0
  23. package/dist/web/routes/index.js.map +1 -1
  24. package/dist/web/routes/settings-routes.d.ts +2 -0
  25. package/dist/web/routes/settings-routes.js +151 -0
  26. package/dist/web/routes/settings-routes.js.map +1 -0
  27. package/dist/web/server.d.ts +1 -0
  28. package/dist/web/server.js +8 -1
  29. package/dist/web/server.js.map +1 -1
  30. package/package.json +1 -1
  31. package/dist/web/client/assets/index-BHAwNBgk.js +0 -219
  32. package/dist/web/client/assets/index-C8YKyqtg.css +0 -1
@@ -1,219 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/window-DlR023_X.js","assets/core-DhEqZVGG.js","assets/event-BK_86lmQ.js"])))=>i.map(i=>d[i]);
2
- (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 ST(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Hp={exports:{}},gc={};var ew;function kT(){if(ew)return gc;ew=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 gc.Fragment=t,gc.jsx=s,gc.jsxs=s,gc}var tw;function NT(){return tw||(tw=1,Hp.exports=kT()),Hp.exports}var i=NT(),Up={exports:{}},ot={};var sw;function CT(){if(sw)return ot;sw=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"),f=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),x=Symbol.iterator;function v(V){return V===null||typeof V!="object"?null:(V=x&&V[x]||V["@@iterator"],typeof V=="function"?V:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,N={};function E(V,q,le){this.props=V,this.context=q,this.refs=N,this.updater=le||w}E.prototype.isReactComponent={},E.prototype.setState=function(V,q){if(typeof V!="object"&&typeof V!="function"&&V!=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,V,q,"setState")},E.prototype.forceUpdate=function(V){this.updater.enqueueForceUpdate(this,V,"forceUpdate")};function T(){}T.prototype=E.prototype;function A(V,q,le){this.props=V,this.context=q,this.refs=N,this.updater=le||w}var C=A.prototype=new T;C.constructor=A,k(C,E.prototype),C.isPureReactComponent=!0;var R=Array.isArray;function D(){}var $={H:null,A:null,T:null,S:null},O=Object.prototype.hasOwnProperty;function P(V,q,le){var ee=le.ref;return{$$typeof:e,type:V,key:q,ref:ee!==void 0?ee:null,props:le}}function B(V,q){return P(V.type,q,V.props)}function G(V){return typeof V=="object"&&V!==null&&V.$$typeof===e}function F(V){var q={"=":"=0",":":"=2"};return"$"+V.replace(/[=:]/g,function(le){return q[le]})}var z=/\/+/g;function U(V,q){return typeof V=="object"&&V!==null&&V.key!=null?F(""+V.key):q.toString(36)}function K(V){switch(V.status){case"fulfilled":return V.value;case"rejected":throw V.reason;default:switch(typeof V.status=="string"?V.then(D,D):(V.status="pending",V.then(function(q){V.status==="pending"&&(V.status="fulfilled",V.value=q)},function(q){V.status==="pending"&&(V.status="rejected",V.reason=q)})),V.status){case"fulfilled":return V.value;case"rejected":throw V.reason}}throw V}function I(V,q,le,ee,fe){var ie=typeof V;(ie==="undefined"||ie==="boolean")&&(V=null);var Se=!1;if(V===null)Se=!0;else switch(ie){case"bigint":case"string":case"number":Se=!0;break;case"object":switch(V.$$typeof){case e:case t:Se=!0;break;case p:return Se=V._init,I(Se(V._payload),q,le,ee,fe)}}if(Se)return fe=fe(V),Se=ee===""?"."+U(V,0):ee,R(fe)?(le="",Se!=null&&(le=Se.replace(z,"$&/")+"/"),I(fe,q,le,"",function(Je){return Je})):fe!=null&&(G(fe)&&(fe=B(fe,le+(fe.key==null||V&&V.key===fe.key?"":(""+fe.key).replace(z,"$&/")+"/")+Se)),q.push(fe)),1;Se=0;var Me=ee===""?".":ee+":";if(R(V))for(var De=0;De<V.length;De++)ee=V[De],ie=Me+U(ee,De),Se+=I(ee,q,le,ie,fe);else if(De=v(V),typeof De=="function")for(V=De.call(V),De=0;!(ee=V.next()).done;)ee=ee.value,ie=Me+U(ee,De++),Se+=I(ee,q,le,ie,fe);else if(ie==="object"){if(typeof V.then=="function")return I(K(V),q,le,ee,fe);throw q=String(V),Error("Objects are not valid as a React child (found: "+(q==="[object Object]"?"object with keys {"+Object.keys(V).join(", ")+"}":q)+"). If you meant to render a collection of children, use an array instead.")}return Se}function Z(V,q,le){if(V==null)return V;var ee=[],fe=0;return I(V,ee,"","",function(ie){return q.call(le,ie,fe++)}),ee}function W(V){if(V._status===-1){var q=V._result;q=q(),q.then(function(le){(V._status===0||V._status===-1)&&(V._status=1,V._result=le)},function(le){(V._status===0||V._status===-1)&&(V._status=2,V._result=le)}),V._status===-1&&(V._status=0,V._result=q)}if(V._status===1)return V._result.default;throw V._result}var te=typeof reportError=="function"?reportError:function(V){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof V=="object"&&V!==null&&typeof V.message=="string"?String(V.message):String(V),error:V});if(!window.dispatchEvent(q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",V);return}console.error(V)},X={map:Z,forEach:function(V,q,le){Z(V,function(){q.apply(this,arguments)},le)},count:function(V){var q=0;return Z(V,function(){q++}),q},toArray:function(V){return Z(V,function(q){return q})||[]},only:function(V){if(!G(V))throw Error("React.Children.only expected to receive a single React element child.");return V}};return ot.Activity=g,ot.Children=X,ot.Component=E,ot.Fragment=s,ot.Profiler=o,ot.PureComponent=A,ot.StrictMode=n,ot.Suspense=f,ot.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=$,ot.__COMPILER_RUNTIME={__proto__:null,c:function(V){return $.H.useMemoCache(V)}},ot.cache=function(V){return function(){return V.apply(null,arguments)}},ot.cacheSignal=function(){return null},ot.cloneElement=function(V,q,le){if(V==null)throw Error("The argument must be a React element, but you passed "+V+".");var ee=k({},V.props),fe=V.key;if(q!=null)for(ie in q.key!==void 0&&(fe=""+q.key),q)!O.call(q,ie)||ie==="key"||ie==="__self"||ie==="__source"||ie==="ref"&&q.ref===void 0||(ee[ie]=q[ie]);var ie=arguments.length-2;if(ie===1)ee.children=le;else if(1<ie){for(var Se=Array(ie),Me=0;Me<ie;Me++)Se[Me]=arguments[Me+2];ee.children=Se}return P(V.type,fe,ee)},ot.createContext=function(V){return V={$$typeof:u,_currentValue:V,_currentValue2:V,_threadCount:0,Provider:null,Consumer:null},V.Provider=V,V.Consumer={$$typeof:l,_context:V},V},ot.createElement=function(V,q,le){var ee,fe={},ie=null;if(q!=null)for(ee in q.key!==void 0&&(ie=""+q.key),q)O.call(q,ee)&&ee!=="key"&&ee!=="__self"&&ee!=="__source"&&(fe[ee]=q[ee]);var Se=arguments.length-2;if(Se===1)fe.children=le;else if(1<Se){for(var Me=Array(Se),De=0;De<Se;De++)Me[De]=arguments[De+2];fe.children=Me}if(V&&V.defaultProps)for(ee in Se=V.defaultProps,Se)fe[ee]===void 0&&(fe[ee]=Se[ee]);return P(V,ie,fe)},ot.createRef=function(){return{current:null}},ot.forwardRef=function(V){return{$$typeof:h,render:V}},ot.isValidElement=G,ot.lazy=function(V){return{$$typeof:p,_payload:{_status:-1,_result:V},_init:W}},ot.memo=function(V,q){return{$$typeof:d,type:V,compare:q===void 0?null:q}},ot.startTransition=function(V){var q=$.T,le={};$.T=le;try{var ee=V(),fe=$.S;fe!==null&&fe(le,ee),typeof ee=="object"&&ee!==null&&typeof ee.then=="function"&&ee.then(D,te)}catch(ie){te(ie)}finally{q!==null&&le.types!==null&&(q.types=le.types),$.T=q}},ot.unstable_useCacheRefresh=function(){return $.H.useCacheRefresh()},ot.use=function(V){return $.H.use(V)},ot.useActionState=function(V,q,le){return $.H.useActionState(V,q,le)},ot.useCallback=function(V,q){return $.H.useCallback(V,q)},ot.useContext=function(V){return $.H.useContext(V)},ot.useDebugValue=function(){},ot.useDeferredValue=function(V,q){return $.H.useDeferredValue(V,q)},ot.useEffect=function(V,q){return $.H.useEffect(V,q)},ot.useEffectEvent=function(V){return $.H.useEffectEvent(V)},ot.useId=function(){return $.H.useId()},ot.useImperativeHandle=function(V,q,le){return $.H.useImperativeHandle(V,q,le)},ot.useInsertionEffect=function(V,q){return $.H.useInsertionEffect(V,q)},ot.useLayoutEffect=function(V,q){return $.H.useLayoutEffect(V,q)},ot.useMemo=function(V,q){return $.H.useMemo(V,q)},ot.useOptimistic=function(V,q){return $.H.useOptimistic(V,q)},ot.useReducer=function(V,q,le){return $.H.useReducer(V,q,le)},ot.useRef=function(V){return $.H.useRef(V)},ot.useState=function(V){return $.H.useState(V)},ot.useSyncExternalStore=function(V,q,le){return $.H.useSyncExternalStore(V,q,le)},ot.useTransition=function(){return $.H.useTransition()},ot.version="19.2.6",ot}var nw;function sb(){return nw||(nw=1,Up.exports=CT()),Up.exports}var _=sb(),Fp={exports:{}},xc={},qp={exports:{}},Vp={};var iw;function ET(){return iw||(iw=1,(function(e){function t(I,Z){var W=I.length;I.push(Z);e:for(;0<W;){var te=W-1>>>1,X=I[te];if(0<o(X,Z))I[te]=Z,I[W]=X,W=te;else break e}}function s(I){return I.length===0?null:I[0]}function n(I){if(I.length===0)return null;var Z=I[0],W=I.pop();if(W!==Z){I[0]=W;e:for(var te=0,X=I.length,V=X>>>1;te<V;){var q=2*(te+1)-1,le=I[q],ee=q+1,fe=I[ee];if(0>o(le,W))ee<X&&0>o(fe,le)?(I[te]=fe,I[ee]=W,te=ee):(I[te]=le,I[q]=W,te=q);else if(ee<X&&0>o(fe,W))I[te]=fe,I[ee]=W,te=ee;else break e}}return Z}function o(I,Z){var W=I.sortIndex-Z.sortIndex;return W!==0?W:I.id-Z.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 f=[],d=[],p=1,g=null,x=3,v=!1,w=!1,k=!1,N=!1,E=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function C(I){for(var Z=s(d);Z!==null;){if(Z.callback===null)n(d);else if(Z.startTime<=I)n(d),Z.sortIndex=Z.expirationTime,t(f,Z);else break;Z=s(d)}}function R(I){if(k=!1,C(I),!w)if(s(f)!==null)w=!0,D||(D=!0,F());else{var Z=s(d);Z!==null&&K(R,Z.startTime-I)}}var D=!1,$=-1,O=5,P=-1;function B(){return N?!0:!(e.unstable_now()-P<O)}function G(){if(N=!1,D){var I=e.unstable_now();P=I;var Z=!0;try{e:{w=!1,k&&(k=!1,T($),$=-1),v=!0;var W=x;try{t:{for(C(I),g=s(f);g!==null&&!(g.expirationTime>I&&B());){var te=g.callback;if(typeof te=="function"){g.callback=null,x=g.priorityLevel;var X=te(g.expirationTime<=I);if(I=e.unstable_now(),typeof X=="function"){g.callback=X,C(I),Z=!0;break t}g===s(f)&&n(f),C(I)}else n(f);g=s(f)}if(g!==null)Z=!0;else{var V=s(d);V!==null&&K(R,V.startTime-I),Z=!1}}break e}finally{g=null,x=W,v=!1}Z=void 0}}finally{Z?F():D=!1}}}var F;if(typeof A=="function")F=function(){A(G)};else if(typeof MessageChannel<"u"){var z=new MessageChannel,U=z.port2;z.port1.onmessage=G,F=function(){U.postMessage(null)}}else F=function(){E(G,0)};function K(I,Z){$=E(function(){I(e.unstable_now())},Z)}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"):O=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 Z=3;break;default:Z=x}var W=x;x=Z;try{return I()}finally{x=W}},e.unstable_requestPaint=function(){N=!0},e.unstable_runWithPriority=function(I,Z){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var W=x;x=I;try{return Z()}finally{x=W}},e.unstable_scheduleCallback=function(I,Z,W){var te=e.unstable_now();switch(typeof W=="object"&&W!==null?(W=W.delay,W=typeof W=="number"&&0<W?te+W:te):W=te,I){case 1:var X=-1;break;case 2:X=250;break;case 5:X=1073741823;break;case 4:X=1e4;break;default:X=5e3}return X=W+X,I={id:p++,callback:Z,priorityLevel:I,startTime:W,expirationTime:X,sortIndex:-1},W>te?(I.sortIndex=W,t(d,I),s(f)===null&&I===s(d)&&(k?(T($),$=-1):k=!0,K(R,W-te))):(I.sortIndex=X,t(f,I),w||v||(w=!0,D||(D=!0,F()))),I},e.unstable_shouldYield=B,e.unstable_wrapCallback=function(I){var Z=x;return function(){var W=x;x=Z;try{return I.apply(this,arguments)}finally{x=W}}}})(Vp)),Vp}var rw;function jT(){return rw||(rw=1,qp.exports=ET()),qp.exports}var Gp={exports:{}},tn={};var aw;function AT(){if(aw)return tn;aw=1;var e=sb();function t(f){var d="https://react.dev/errors/"+f;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 #"+f+"; 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(f,d,p){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:g==null?null:""+g,children:f,containerInfo:d,implementation:p}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(f,d){if(f==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return tn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,tn.createPortal=function(f,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(f,d,null,p)},tn.flushSync=function(f){var d=u.T,p=n.p;try{if(u.T=null,n.p=2,f)return f()}finally{u.T=d,n.p=p,n.d.f()}},tn.preconnect=function(f,d){typeof f=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,n.d.C(f,d))},tn.prefetchDNS=function(f){typeof f=="string"&&n.d.D(f)},tn.preinit=function(f,d){if(typeof f=="string"&&d&&typeof d.as=="string"){var p=d.as,g=h(p,d.crossOrigin),x=typeof d.integrity=="string"?d.integrity:void 0,v=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;p==="style"?n.d.S(f,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:g,integrity:x,fetchPriority:v}):p==="script"&&n.d.X(f,{crossOrigin:g,integrity:x,fetchPriority:v,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},tn.preinitModule=function(f,d){if(typeof f=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var p=h(d.as,d.crossOrigin);n.d.M(f,{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(f)},tn.preload=function(f,d){if(typeof f=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var p=d.as,g=h(p,d.crossOrigin);n.d.L(f,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})}},tn.preloadModule=function(f,d){if(typeof f=="string")if(d){var p=h(d.as,d.crossOrigin);n.d.m(f,{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(f)},tn.requestFormReset=function(f){n.d.r(f)},tn.unstable_batchedUpdates=function(f,d){return f(d)},tn.useFormState=function(f,d,p){return u.H.useFormState(f,d,p)},tn.useFormStatus=function(){return u.H.useHostTransitionStatus()},tn.version="19.2.6",tn}var ow;function tC(){if(ow)return Gp.exports;ow=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(),Gp.exports=AT(),Gp.exports}var lw;function TT(){if(lw)return xc;lw=1;var e=jT(),t=sb(),s=tC();function n(r){var a="https://react.dev/errors/"+r;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 #"+r+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function l(r){var a=r,c=r;if(r.alternate)for(;a.return;)a=a.return;else{r=a;do a=r,(a.flags&4098)!==0&&(c=a.return),r=a.return;while(r)}return a.tag===3?c:null}function u(r){if(r.tag===13){var a=r.memoizedState;if(a===null&&(r=r.alternate,r!==null&&(a=r.memoizedState)),a!==null)return a.dehydrated}return null}function h(r){if(r.tag===31){var a=r.memoizedState;if(a===null&&(r=r.alternate,r!==null&&(a=r.memoizedState)),a!==null)return a.dehydrated}return null}function f(r){if(l(r)!==r)throw Error(n(188))}function d(r){var a=r.alternate;if(!a){if(a=l(r),a===null)throw Error(n(188));return a!==r?null:r}for(var c=r,m=a;;){var b=c.return;if(b===null)break;var y=b.alternate;if(y===null){if(m=b.return,m!==null){c=m;continue}break}if(b.child===y.child){for(y=b.child;y;){if(y===c)return f(b),r;if(y===m)return f(b),a;y=y.sibling}throw Error(n(188))}if(c.return!==m.return)c=b,m=y;else{for(var j=!1,L=b.child;L;){if(L===c){j=!0,c=b,m=y;break}if(L===m){j=!0,m=b,c=y;break}L=L.sibling}if(!j){for(L=y.child;L;){if(L===c){j=!0,c=y,m=b;break}if(L===m){j=!0,m=y,c=b;break}L=L.sibling}if(!j)throw Error(n(189))}}if(c.alternate!==m)throw Error(n(190))}if(c.tag!==3)throw Error(n(188));return c.stateNode.current===c?r:a}function p(r){var a=r.tag;if(a===5||a===26||a===27||a===6)return r;for(r=r.child;r!==null;){if(a=p(r),a!==null)return a;r=r.sibling}return null}var g=Object.assign,x=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),A=Symbol.for("react.context"),C=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),P=Symbol.for("react.activity"),B=Symbol.for("react.memo_cache_sentinel"),G=Symbol.iterator;function F(r){return r===null||typeof r!="object"?null:(r=G&&r[G]||r["@@iterator"],typeof r=="function"?r:null)}var z=Symbol.for("react.client.reference");function U(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===z?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case k:return"Fragment";case E:return"Profiler";case N:return"StrictMode";case R:return"Suspense";case D:return"SuspenseList";case P:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case w:return"Portal";case A:return r.displayName||"Context";case T:return(r._context.displayName||"Context")+".Consumer";case C:var a=r.render;return r=r.displayName,r||(r=a.displayName||a.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case $:return a=r.displayName||null,a!==null?a:U(r.type)||"Memo";case O:a=r._payload,r=r._init;try{return U(r(a))}catch{}}return null}var K=Array.isArray,I=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W={pending:!1,data:null,method:null,action:null},te=[],X=-1;function V(r){return{current:r}}function q(r){0>X||(r.current=te[X],te[X]=null,X--)}function le(r,a){X++,te[X]=r.current,r.current=a}var ee=V(null),fe=V(null),ie=V(null),Se=V(null);function Me(r,a){switch(le(ie,a),le(fe,r),le(ee,null),a.nodeType){case 9:case 11:r=(r=a.documentElement)&&(r=r.namespaceURI)?Sy(r):0;break;default:if(r=a.tagName,a=a.namespaceURI)a=Sy(a),r=ky(a,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}q(ee),le(ee,r)}function De(){q(ee),q(fe),q(ie)}function Je(r){r.memoizedState!==null&&le(Se,r);var a=ee.current,c=ky(a,r.type);a!==c&&(le(fe,r),le(ee,c))}function Ne(r){fe.current===r&&(q(ee),q(fe)),Se.current===r&&(q(Se),hc._currentValue=W)}var Ue,$e;function St(r){if(Ue===void 0)try{throw Error()}catch(c){var a=c.stack.trim().match(/\n( *(at )?)/);Ue=a&&a[1]||"",$e=-1<c.stack.indexOf(`
3
- at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
4
- `+Ue+r+$e}var Ls=!1;function zs(r,a){if(!r||Ls)return"";Ls=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var m={DetermineComponentFrameRoot:function(){try{if(a){var Ce=function(){throw Error()};if(Object.defineProperty(Ce.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ce,[])}catch(pe){var de=pe}Reflect.construct(r,[],Ce)}else{try{Ce.call()}catch(pe){de=pe}r.call(Ce.prototype)}}else{try{throw Error()}catch(pe){de=pe}(Ce=r())&&typeof Ce.catch=="function"&&Ce.catch(function(){})}}catch(pe){if(pe&&de&&typeof pe.stack=="string")return[pe.stack,de.stack]}return[null,null]}};m.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var b=Object.getOwnPropertyDescriptor(m.DetermineComponentFrameRoot,"name");b&&b.configurable&&Object.defineProperty(m.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var y=m.DetermineComponentFrameRoot(),j=y[0],L=y[1];if(j&&L){var Y=j.split(`
5
- `),ue=L.split(`
6
- `);for(b=m=0;m<Y.length&&!Y[m].includes("DetermineComponentFrameRoot");)m++;for(;b<ue.length&&!ue[b].includes("DetermineComponentFrameRoot");)b++;if(m===Y.length||b===ue.length)for(m=Y.length-1,b=ue.length-1;1<=m&&0<=b&&Y[m]!==ue[b];)b--;for(;1<=m&&0<=b;m--,b--)if(Y[m]!==ue[b]){if(m!==1||b!==1)do if(m--,b--,0>b||Y[m]!==ue[b]){var ve=`
7
- `+Y[m].replace(" at new "," at ");return r.displayName&&ve.includes("<anonymous>")&&(ve=ve.replace("<anonymous>",r.displayName)),ve}while(1<=m&&0<=b);break}}}finally{Ls=!1,Error.prepareStackTrace=c}return(c=r?r.displayName||r.name:"")?St(c):""}function vi(r,a){switch(r.tag){case 26:case 27:case 5:return St(r.type);case 16:return St("Lazy");case 13:return r.child!==a&&a!==null?St("Suspense Fallback"):St("Suspense");case 19:return St("SuspenseList");case 0:case 15:return zs(r.type,!1);case 11:return zs(r.type.render,!1);case 1:return zs(r.type,!0);case 31:return St("Activity");default:return""}}function Kn(r){try{var a="",c=null;do a+=vi(r,c),c=r,r=r.return;while(r);return a}catch(m){return`
8
- Error generating stack: `+m.message+`
9
- `+m.stack}}var qs=Object.prototype.hasOwnProperty,An=e.unstable_scheduleCallback,Tn=e.unstable_cancelCallback,Di=e.unstable_shouldYield,_i=e.unstable_requestPaint,It=e.unstable_now,Cs=e.unstable_getCurrentPriorityLevel,ls=e.unstable_ImmediatePriority,gn=e.unstable_UserBlockingPriority,xn=e.unstable_NormalPriority,Oi=e.unstable_LowPriority,S=e.unstable_IdlePriority,re=e.log,be=e.unstable_setDisableYieldValue,ye=null,he=null;function Ae(r){if(typeof re=="function"&&be(r),he&&typeof he.setStrictMode=="function")try{he.setStrictMode(ye,r)}catch{}}var M=Math.clz32?Math.clz32:_e,oe=Math.log,Te=Math.LN2;function _e(r){return r>>>=0,r===0?32:31-(oe(r)/Te|0)|0}var me=256,je=262144,ke=4194304;function Be(r){var a=r&42;if(a!==0)return a;switch(r&-r){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 r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function H(r,a,c){var m=r.pendingLanes;if(m===0)return 0;var b=0,y=r.suspendedLanes,j=r.pingedLanes;r=r.warmLanes;var L=m&134217727;return L!==0?(m=L&~y,m!==0?b=Be(m):(j&=L,j!==0?b=Be(j):c||(c=L&~r,c!==0&&(b=Be(c))))):(L=m&~y,L!==0?b=Be(L):j!==0?b=Be(j):c||(c=m&~r,c!==0&&(b=Be(c)))),b===0?0:a!==0&&a!==b&&(a&y)===0&&(y=b&-b,c=a&-a,y>=c||y===32&&(c&4194048)!==0)?a:b}function se(r,a){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&a)===0}function ge(r,a){switch(r){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 Pe(){var r=ke;return ke<<=1,(ke&62914560)===0&&(ke=4194304),r}function it(r){for(var a=[],c=0;31>c;c++)a.push(r);return a}function Et(r,a){r.pendingLanes|=a,a!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function qe(r,a,c,m,b,y){var j=r.pendingLanes;r.pendingLanes=c,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=c,r.entangledLanes&=c,r.errorRecoveryDisabledLanes&=c,r.shellSuspendCounter=0;var L=r.entanglements,Y=r.expirationTimes,ue=r.hiddenUpdates;for(c=j&~c;0<c;){var ve=31-M(c),Ce=1<<ve;L[ve]=0,Y[ve]=-1;var de=ue[ve];if(de!==null)for(ue[ve]=null,ve=0;ve<de.length;ve++){var pe=de[ve];pe!==null&&(pe.lane&=-536870913)}c&=~Ce}m!==0&&He(r,m,0),y!==0&&b===0&&r.tag!==0&&(r.suspendedLanes|=y&~(j&~a))}function He(r,a,c){r.pendingLanes|=a,r.suspendedLanes&=~a;var m=31-M(a);r.entangledLanes|=a,r.entanglements[m]=r.entanglements[m]|1073741824|c&261930}function rt(r,a){var c=r.entangledLanes|=a;for(r=r.entanglements;c;){var m=31-M(c),b=1<<m;b&a|r[m]&a&&(r[m]|=a),c&=~b}}function cs(r,a){var c=a&-a;return c=(c&42)!==0?1:Xt(c),(c&(r.suspendedLanes|a))!==0?0:c}function Xt(r){switch(r){case 2:r=1;break;case 8:r=4;break;case 32:r=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:r=128;break;case 268435456:r=134217728;break;default:r=0}return r}function sr(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function po(){var r=Z.p;return r!==0?r:(r=window.event,r===void 0?32:Wy(r.type))}function go(r,a){var c=Z.p;try{return Z.p=r,a()}finally{Z.p=c}}var Li=Math.random().toString(36).slice(2),us="__reactFiber$"+Li,Js="__reactProps$"+Li,Lr="__reactContainer$"+Li,Sl="__reactEvents$"+Li,Su="__reactListeners$"+Li,xo="__reactHandles$"+Li,ku="__reactResources$"+Li,ka="__reactMarker$"+Li;function kl(r){delete r[us],delete r[Js],delete r[Sl],delete r[Su],delete r[xo]}function an(r){var a=r[us];if(a)return a;for(var c=r.parentNode;c;){if(a=c[Lr]||c[us]){if(c=a.alternate,a.child!==null||c!==null&&c.child!==null)for(r=Ry(r);r!==null;){if(c=r[us])return c;r=Ry(r)}return a}r=c,c=r.parentNode}return null}function nr(r){if(r=r[us]||r[Lr]){var a=r.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return r}return null}function zr(r){var a=r.tag;if(a===5||a===26||a===27||a===6)return r.stateNode;throw Error(n(33))}function Br(r){var a=r[ku];return a||(a=r[ku]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function gs(r){r[ka]=!0}var Nu=new Set,Na={};function ir(r,a){Oe(r,a),Oe(r+"Capture",a)}function Oe(r,a){for(Na[r]=a,r=0;r<a.length;r++)Nu.add(a[r])}var et=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]*$"),pt={},Tt={};function ds(r){return qs.call(Tt,r)?!0:qs.call(pt,r)?!1:et.test(r)?Tt[r]=!0:(pt[r]=!0,!1)}function en(r,a,c){if(ds(a))if(c===null)r.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":r.removeAttribute(a);return;case"boolean":var m=a.toLowerCase().slice(0,5);if(m!=="data-"&&m!=="aria-"){r.removeAttribute(a);return}}r.setAttribute(a,""+c)}}function Rn(r,a,c){if(c===null)r.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(a);return}r.setAttribute(a,""+c)}}function bn(r,a,c,m){if(m===null)r.removeAttribute(c);else{switch(typeof m){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(c);return}r.setAttributeNS(a,c,""+m)}}function Ft(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function Mn(r){var a=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function Cu(r,a,c){var m=Object.getOwnPropertyDescriptor(r.constructor.prototype,a);if(!r.hasOwnProperty(a)&&typeof m<"u"&&typeof m.get=="function"&&typeof m.set=="function"){var b=m.get,y=m.set;return Object.defineProperty(r,a,{configurable:!0,get:function(){return b.call(this)},set:function(j){c=""+j,y.call(this,j)}}),Object.defineProperty(r,a,{enumerable:m.enumerable}),{getValue:function(){return c},setValue:function(j){c=""+j},stopTracking:function(){r._valueTracker=null,delete r[a]}}}}function bo(r){if(!r._valueTracker){var a=Mn(r)?"checked":"value";r._valueTracker=Cu(r,a,""+r[a])}}function Nl(r){if(!r)return!1;var a=r._valueTracker;if(!a)return!0;var c=a.getValue(),m="";return r&&(m=Mn(r)?r.checked?"true":"false":r.value),r=m,r!==c?(a.setValue(r),!0):!1}function vo(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}var $f=/[\n"\\]/g;function vn(r){return r.replace($f,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Cl(r,a,c,m,b,y,j,L){r.name="",j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?r.type=j:r.removeAttribute("type"),a!=null?j==="number"?(a===0&&r.value===""||r.value!=a)&&(r.value=""+Ft(a)):r.value!==""+Ft(a)&&(r.value=""+Ft(a)):j!=="submit"&&j!=="reset"||r.removeAttribute("value"),a!=null?_o(r,j,Ft(a)):c!=null?_o(r,j,Ft(c)):m!=null&&r.removeAttribute("value"),b==null&&y!=null&&(r.defaultChecked=!!y),b!=null&&(r.checked=b&&typeof b!="function"&&typeof b!="symbol"),L!=null&&typeof L!="function"&&typeof L!="symbol"&&typeof L!="boolean"?r.name=""+Ft(L):r.removeAttribute("name")}function Ca(r,a,c,m,b,y,j,L){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(r.type=y),a!=null||c!=null){if(!(y!=="submit"&&y!=="reset"||a!=null)){bo(r);return}c=c!=null?""+Ft(c):"",a=a!=null?""+Ft(a):c,L||a===r.value||(r.value=a),r.defaultValue=a}m=m??b,m=typeof m!="function"&&typeof m!="symbol"&&!!m,r.checked=L?r.checked:!!m,r.defaultChecked=!!m,j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(r.name=j),bo(r)}function _o(r,a,c){a==="number"&&vo(r.ownerDocument)===r||r.defaultValue===""+c||(r.defaultValue=""+c)}function Vs(r,a,c,m){if(r=r.options,a){a={};for(var b=0;b<c.length;b++)a["$"+c[b]]=!0;for(c=0;c<r.length;c++)b=a.hasOwnProperty("$"+r[c].value),r[c].selected!==b&&(r[c].selected=b),b&&m&&(r[c].defaultSelected=!0)}else{for(c=""+Ft(c),a=null,b=0;b<r.length;b++){if(r[b].value===c){r[b].selected=!0,m&&(r[b].defaultSelected=!0);return}a!==null||r[b].disabled||(a=r[b])}a!==null&&(a.selected=!0)}}function Eu(r,a,c){if(a!=null&&(a=""+Ft(a),a!==r.value&&(r.value=a),c==null)){r.defaultValue!==a&&(r.defaultValue=a);return}r.defaultValue=c!=null?""+Ft(c):""}function yo(r,a,c,m){if(a==null){if(m!=null){if(c!=null)throw Error(n(92));if(K(m)){if(1<m.length)throw Error(n(93));m=m[0]}c=m}c==null&&(c=""),a=c}c=Ft(a),r.defaultValue=c,m=r.textContent,m===c&&m!==""&&m!==null&&(r.value=m),bo(r)}function nt(r,a){if(a){var c=r.firstChild;if(c&&c===r.lastChild&&c.nodeType===3){c.nodeValue=a;return}}r.textContent=a}var ju=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 xs(r,a,c){var m=a.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?m?r.setProperty(a,""):a==="float"?r.cssFloat="":r[a]="":m?r.setProperty(a,c):typeof c!="number"||c===0||ju.has(a)?a==="float"?r.cssFloat=c:r[a]=(""+c).trim():r[a]=c+"px"}function Rt(r,a,c){if(a!=null&&typeof a!="object")throw Error(n(62));if(r=r.style,c!=null){for(var m in c)!c.hasOwnProperty(m)||a!=null&&a.hasOwnProperty(m)||(m.indexOf("--")===0?r.setProperty(m,""):m==="float"?r.cssFloat="":r[m]="");for(var b in a)m=a[b],a.hasOwnProperty(b)&&c[b]!==m&&xs(r,b,m)}else for(var y in a)a.hasOwnProperty(y)&&xs(r,y,a[y])}function Pr(r){if(r.indexOf("-")===-1)return!1;switch(r){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 rr=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"]]),El=/^[\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 Ir(r){return El.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function Ie(){}var Xe=null;function lt(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var bt=null,Jt=null;function Yn(r){var a=nr(r);if(a&&(r=a.stateNode)){var c=r[Js]||null;e:switch(r=a.stateNode,a.type){case"input":if(Cl(r,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),a=c.name,c.type==="radio"&&a!=null){for(c=r;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+vn(""+a)+'"][type="radio"]'),a=0;a<c.length;a++){var m=c[a];if(m!==r&&m.form===r.form){var b=m[Js]||null;if(!b)throw Error(n(90));Cl(m,b.value,b.defaultValue,b.defaultValue,b.checked,b.defaultChecked,b.type,b.name)}}for(a=0;a<c.length;a++)m=c[a],m.form===r.form&&Nl(m)}break e;case"textarea":Eu(r,c.value,c.defaultValue);break e;case"select":a=c.value,a!=null&&Vs(r,!!c.multiple,a,!1)}}}var jl=!1;function Au(r,a,c){if(jl)return r(a,c);jl=!0;try{var m=r(a);return m}finally{if(jl=!1,(bt!==null||Jt!==null)&&(gd(),bt&&(a=bt,r=Jt,Jt=bt=null,Yn(a),r)))for(a=0;a<r.length;a++)Yn(r[a])}}function Al(r,a){var c=r.stateNode;if(c===null)return null;var m=c[Js]||null;if(m===null)return null;c=m[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":(m=!m.disabled)||(r=r.type,m=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!m;break e;default:r=!1}if(r)return null;if(c&&typeof c!="function")throw Error(n(231,a,typeof c));return c}var ar=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Hf=!1;if(ar)try{var Tl={};Object.defineProperty(Tl,"passive",{get:function(){Hf=!0}}),window.addEventListener("test",Tl,Tl),window.removeEventListener("test",Tl,Tl)}catch{Hf=!1}var $r=null,Uf=null,Tu=null;function kv(){if(Tu)return Tu;var r,a=Uf,c=a.length,m,b="value"in $r?$r.value:$r.textContent,y=b.length;for(r=0;r<c&&a[r]===b[r];r++);var j=c-r;for(m=1;m<=j&&a[c-m]===b[y-m];m++);return Tu=b.slice(r,1<m?1-m:void 0)}function Ru(r){var a=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&a===13&&(r=13)):r=a,r===10&&(r=13),32<=r||r===13?r:0}function Mu(){return!0}function Nv(){return!1}function _n(r){function a(c,m,b,y,j){this._reactName=c,this._targetInst=b,this.type=m,this.nativeEvent=y,this.target=j,this.currentTarget=null;for(var L in r)r.hasOwnProperty(L)&&(c=r[L],this[L]=c?c(y):y[L]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?Mu:Nv,this.isPropagationStopped=Nv,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=Mu)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Mu)},persist:function(){},isPersistent:Mu}),a}var Ea={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Du=_n(Ea),Rl=g({},Ea,{view:0,detail:0}),y4=_n(Rl),Ff,qf,Ml,Ou=g({},Rl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Gf,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==Ml&&(Ml&&r.type==="mousemove"?(Ff=r.screenX-Ml.screenX,qf=r.screenY-Ml.screenY):qf=Ff=0,Ml=r),Ff)},movementY:function(r){return"movementY"in r?r.movementY:qf}}),Cv=_n(Ou),w4=g({},Ou,{dataTransfer:0}),S4=_n(w4),k4=g({},Rl,{relatedTarget:0}),Vf=_n(k4),N4=g({},Ea,{animationName:0,elapsedTime:0,pseudoElement:0}),C4=_n(N4),E4=g({},Ea,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),j4=_n(E4),A4=g({},Ea,{data:0}),Ev=_n(A4),T4={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},R4={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"},M4={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function D4(r){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(r):(r=M4[r])?!!a[r]:!1}function Gf(){return D4}var O4=g({},Rl,{key:function(r){if(r.key){var a=T4[r.key]||r.key;if(a!=="Unidentified")return a}return r.type==="keypress"?(r=Ru(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?R4[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Gf,charCode:function(r){return r.type==="keypress"?Ru(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?Ru(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),L4=_n(O4),z4=g({},Ou,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),jv=_n(z4),B4=g({},Rl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Gf}),P4=_n(B4),I4=g({},Ea,{propertyName:0,elapsedTime:0,pseudoElement:0}),$4=_n(I4),H4=g({},Ou,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),U4=_n(H4),F4=g({},Ea,{newState:0,oldState:0}),q4=_n(F4),V4=[9,13,27,32],Wf=ar&&"CompositionEvent"in window,Dl=null;ar&&"documentMode"in document&&(Dl=document.documentMode);var G4=ar&&"TextEvent"in window&&!Dl,Av=ar&&(!Wf||Dl&&8<Dl&&11>=Dl),Tv=" ",Rv=!1;function Mv(r,a){switch(r){case"keyup":return V4.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Dv(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var wo=!1;function W4(r,a){switch(r){case"compositionend":return Dv(a);case"keypress":return a.which!==32?null:(Rv=!0,Tv);case"textInput":return r=a.data,r===Tv&&Rv?null:r;default:return null}}function K4(r,a){if(wo)return r==="compositionend"||!Wf&&Mv(r,a)?(r=kv(),Tu=Uf=$r=null,wo=!1,r):null;switch(r){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 Av&&a.locale!=="ko"?null:a.data;default:return null}}var Y4={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 Ov(r){var a=r&&r.nodeName&&r.nodeName.toLowerCase();return a==="input"?!!Y4[r.type]:a==="textarea"}function Lv(r,a,c,m){bt?Jt?Jt.push(m):Jt=[m]:bt=m,a=Sd(a,"onChange"),0<a.length&&(c=new Du("onChange","change",null,c,m),r.push({event:c,listeners:a}))}var Ol=null,Ll=null;function X4(r){xy(r,0)}function Lu(r){var a=zr(r);if(Nl(a))return r}function zv(r,a){if(r==="change")return a}var Bv=!1;if(ar){var Kf;if(ar){var Yf="oninput"in document;if(!Yf){var Pv=document.createElement("div");Pv.setAttribute("oninput","return;"),Yf=typeof Pv.oninput=="function"}Kf=Yf}else Kf=!1;Bv=Kf&&(!document.documentMode||9<document.documentMode)}function Iv(){Ol&&(Ol.detachEvent("onpropertychange",$v),Ll=Ol=null)}function $v(r){if(r.propertyName==="value"&&Lu(Ll)){var a=[];Lv(a,Ll,r,lt(r)),Au(X4,a)}}function Z4(r,a,c){r==="focusin"?(Iv(),Ol=a,Ll=c,Ol.attachEvent("onpropertychange",$v)):r==="focusout"&&Iv()}function Q4(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return Lu(Ll)}function J4(r,a){if(r==="click")return Lu(a)}function eA(r,a){if(r==="input"||r==="change")return Lu(a)}function tA(r,a){return r===a&&(r!==0||1/r===1/a)||r!==r&&a!==a}var Dn=typeof Object.is=="function"?Object.is:tA;function zl(r,a){if(Dn(r,a))return!0;if(typeof r!="object"||r===null||typeof a!="object"||a===null)return!1;var c=Object.keys(r),m=Object.keys(a);if(c.length!==m.length)return!1;for(m=0;m<c.length;m++){var b=c[m];if(!qs.call(a,b)||!Dn(r[b],a[b]))return!1}return!0}function Hv(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Uv(r,a){var c=Hv(r);r=0;for(var m;c;){if(c.nodeType===3){if(m=r+c.textContent.length,r<=a&&m>=a)return{node:c,offset:a-r};r=m}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=Hv(c)}}function Fv(r,a){return r&&a?r===a?!0:r&&r.nodeType===3?!1:a&&a.nodeType===3?Fv(r,a.parentNode):"contains"in r?r.contains(a):r.compareDocumentPosition?!!(r.compareDocumentPosition(a)&16):!1:!1}function qv(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var a=vo(r.document);a instanceof r.HTMLIFrameElement;){try{var c=typeof a.contentWindow.location.href=="string"}catch{c=!1}if(c)r=a.contentWindow;else break;a=vo(r.document)}return a}function Xf(r){var a=r&&r.nodeName&&r.nodeName.toLowerCase();return a&&(a==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||a==="textarea"||r.contentEditable==="true")}var sA=ar&&"documentMode"in document&&11>=document.documentMode,So=null,Zf=null,Bl=null,Qf=!1;function Vv(r,a,c){var m=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Qf||So==null||So!==vo(m)||(m=So,"selectionStart"in m&&Xf(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),Bl&&zl(Bl,m)||(Bl=m,m=Sd(Zf,"onSelect"),0<m.length&&(a=new Du("onSelect","select",null,a,c),r.push({event:a,listeners:m}),a.target=So)))}function ja(r,a){var c={};return c[r.toLowerCase()]=a.toLowerCase(),c["Webkit"+r]="webkit"+a,c["Moz"+r]="moz"+a,c}var ko={animationend:ja("Animation","AnimationEnd"),animationiteration:ja("Animation","AnimationIteration"),animationstart:ja("Animation","AnimationStart"),transitionrun:ja("Transition","TransitionRun"),transitionstart:ja("Transition","TransitionStart"),transitioncancel:ja("Transition","TransitionCancel"),transitionend:ja("Transition","TransitionEnd")},Jf={},Gv={};ar&&(Gv=document.createElement("div").style,"AnimationEvent"in window||(delete ko.animationend.animation,delete ko.animationiteration.animation,delete ko.animationstart.animation),"TransitionEvent"in window||delete ko.transitionend.transition);function Aa(r){if(Jf[r])return Jf[r];if(!ko[r])return r;var a=ko[r],c;for(c in a)if(a.hasOwnProperty(c)&&c in Gv)return Jf[r]=a[c];return r}var Wv=Aa("animationend"),Kv=Aa("animationiteration"),Yv=Aa("animationstart"),nA=Aa("transitionrun"),iA=Aa("transitionstart"),rA=Aa("transitioncancel"),Xv=Aa("transitionend"),Zv=new Map,em="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(" ");em.push("scrollEnd");function yi(r,a){Zv.set(r,a),ir(a,[r])}var zu=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},Xn=[],No=0,tm=0;function Bu(){for(var r=No,a=tm=No=0;a<r;){var c=Xn[a];Xn[a++]=null;var m=Xn[a];Xn[a++]=null;var b=Xn[a];Xn[a++]=null;var y=Xn[a];if(Xn[a++]=null,m!==null&&b!==null){var j=m.pending;j===null?b.next=b:(b.next=j.next,j.next=b),m.pending=b}y!==0&&Qv(c,b,y)}}function Pu(r,a,c,m){Xn[No++]=r,Xn[No++]=a,Xn[No++]=c,Xn[No++]=m,tm|=m,r.lanes|=m,r=r.alternate,r!==null&&(r.lanes|=m)}function sm(r,a,c,m){return Pu(r,a,c,m),Iu(r)}function Ta(r,a){return Pu(r,null,null,a),Iu(r)}function Qv(r,a,c){r.lanes|=c;var m=r.alternate;m!==null&&(m.lanes|=c);for(var b=!1,y=r.return;y!==null;)y.childLanes|=c,m=y.alternate,m!==null&&(m.childLanes|=c),y.tag===22&&(r=y.stateNode,r===null||r._visibility&1||(b=!0)),r=y,y=y.return;return r.tag===3?(y=r.stateNode,b&&a!==null&&(b=31-M(c),r=y.hiddenUpdates,m=r[b],m===null?r[b]=[a]:m.push(a),a.lane=c|536870912),y):null}function Iu(r){if(50<rc)throw rc=0,dp=null,Error(n(185));for(var a=r.return;a!==null;)r=a,a=r.return;return r.tag===3?r.stateNode:null}var Co={};function aA(r,a,c,m){this.tag=r,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=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function On(r,a,c,m){return new aA(r,a,c,m)}function nm(r){return r=r.prototype,!(!r||!r.isReactComponent)}function or(r,a){var c=r.alternate;return c===null?(c=On(r.tag,a,r.key,r.mode),c.elementType=r.elementType,c.type=r.type,c.stateNode=r.stateNode,c.alternate=r,r.alternate=c):(c.pendingProps=a,c.type=r.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=r.flags&65011712,c.childLanes=r.childLanes,c.lanes=r.lanes,c.child=r.child,c.memoizedProps=r.memoizedProps,c.memoizedState=r.memoizedState,c.updateQueue=r.updateQueue,a=r.dependencies,c.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},c.sibling=r.sibling,c.index=r.index,c.ref=r.ref,c.refCleanup=r.refCleanup,c}function Jv(r,a){r.flags&=65011714;var c=r.alternate;return c===null?(r.childLanes=0,r.lanes=a,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=c.childLanes,r.lanes=c.lanes,r.child=c.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=c.memoizedProps,r.memoizedState=c.memoizedState,r.updateQueue=c.updateQueue,r.type=c.type,a=c.dependencies,r.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),r}function $u(r,a,c,m,b,y){var j=0;if(m=r,typeof r=="function")nm(r)&&(j=1);else if(typeof r=="string")j=dT(r,c,ee.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case P:return r=On(31,c,a,b),r.elementType=P,r.lanes=y,r;case k:return Ra(c.children,b,y,a);case N:j=8,b|=24;break;case E:return r=On(12,c,a,b|2),r.elementType=E,r.lanes=y,r;case R:return r=On(13,c,a,b),r.elementType=R,r.lanes=y,r;case D:return r=On(19,c,a,b),r.elementType=D,r.lanes=y,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case A:j=10;break e;case T:j=9;break e;case C:j=11;break e;case $:j=14;break e;case O:j=16,m=null;break e}j=29,c=Error(n(130,r===null?"null":typeof r,"")),m=null}return a=On(j,c,a,b),a.elementType=r,a.type=m,a.lanes=y,a}function Ra(r,a,c,m){return r=On(7,r,m,a),r.lanes=c,r}function im(r,a,c){return r=On(6,r,null,a),r.lanes=c,r}function e1(r){var a=On(18,null,null,0);return a.stateNode=r,a}function rm(r,a,c){return a=On(4,r.children!==null?r.children:[],r.key,a),a.lanes=c,a.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},a}var t1=new WeakMap;function Zn(r,a){if(typeof r=="object"&&r!==null){var c=t1.get(r);return c!==void 0?c:(a={value:r,source:a,stack:Kn(a)},t1.set(r,a),a)}return{value:r,source:a,stack:Kn(a)}}var Eo=[],jo=0,Hu=null,Pl=0,Qn=[],Jn=0,Hr=null,zi=1,Bi="";function lr(r,a){Eo[jo++]=Pl,Eo[jo++]=Hu,Hu=r,Pl=a}function s1(r,a,c){Qn[Jn++]=zi,Qn[Jn++]=Bi,Qn[Jn++]=Hr,Hr=r;var m=zi;r=Bi;var b=32-M(m)-1;m&=~(1<<b),c+=1;var y=32-M(a)+b;if(30<y){var j=b-b%5;y=(m&(1<<j)-1).toString(32),m>>=j,b-=j,zi=1<<32-M(a)+b|c<<b|m,Bi=y+r}else zi=1<<y|c<<b|m,Bi=r}function am(r){r.return!==null&&(lr(r,1),s1(r,1,0))}function om(r){for(;r===Hu;)Hu=Eo[--jo],Eo[jo]=null,Pl=Eo[--jo],Eo[jo]=null;for(;r===Hr;)Hr=Qn[--Jn],Qn[Jn]=null,Bi=Qn[--Jn],Qn[Jn]=null,zi=Qn[--Jn],Qn[Jn]=null}function n1(r,a){Qn[Jn++]=zi,Qn[Jn++]=Bi,Qn[Jn++]=Hr,zi=a.id,Bi=a.overflow,Hr=r}var Gs=null,Vt=null,yt=!1,Ur=null,ei=!1,lm=Error(n(519));function Fr(r){var a=Error(n(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Il(Zn(a,r)),lm}function i1(r){var a=r.stateNode,c=r.type,m=r.memoizedProps;switch(a[us]=r,a[Js]=m,c){case"dialog":xt("cancel",a),xt("close",a);break;case"iframe":case"object":case"embed":xt("load",a);break;case"video":case"audio":for(c=0;c<oc.length;c++)xt(oc[c],a);break;case"source":xt("error",a);break;case"img":case"image":case"link":xt("error",a),xt("load",a);break;case"details":xt("toggle",a);break;case"input":xt("invalid",a),Ca(a,m.value,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name,!0);break;case"select":xt("invalid",a);break;case"textarea":xt("invalid",a),yo(a,m.value,m.defaultValue,m.children)}c=m.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||a.textContent===""+c||m.suppressHydrationWarning===!0||yy(a.textContent,c)?(m.popover!=null&&(xt("beforetoggle",a),xt("toggle",a)),m.onScroll!=null&&xt("scroll",a),m.onScrollEnd!=null&&xt("scrollend",a),m.onClick!=null&&(a.onclick=Ie),a=!0):a=!1,a||Fr(r,!0)}function r1(r){for(Gs=r.return;Gs;)switch(Gs.tag){case 5:case 31:case 13:ei=!1;return;case 27:case 3:ei=!0;return;default:Gs=Gs.return}}function Ao(r){if(r!==Gs)return!1;if(!yt)return r1(r),yt=!0,!1;var a=r.tag,c;if((c=a!==3&&a!==27)&&((c=a===5)&&(c=r.type,c=!(c!=="form"&&c!=="button")||Cp(r.type,r.memoizedProps)),c=!c),c&&Vt&&Fr(r),r1(r),a===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(n(317));Vt=Ty(r)}else if(a===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(n(317));Vt=Ty(r)}else a===27?(a=Vt,na(r.type)?(r=Rp,Rp=null,Vt=r):Vt=a):Vt=Gs?si(r.stateNode.nextSibling):null;return!0}function Ma(){Vt=Gs=null,yt=!1}function cm(){var r=Ur;return r!==null&&(kn===null?kn=r:kn.push.apply(kn,r),Ur=null),r}function Il(r){Ur===null?Ur=[r]:Ur.push(r)}var um=V(null),Da=null,cr=null;function qr(r,a,c){le(um,a._currentValue),a._currentValue=c}function ur(r){r._currentValue=um.current,q(um)}function dm(r,a,c){for(;r!==null;){var m=r.alternate;if((r.childLanes&a)!==a?(r.childLanes|=a,m!==null&&(m.childLanes|=a)):m!==null&&(m.childLanes&a)!==a&&(m.childLanes|=a),r===c)break;r=r.return}}function hm(r,a,c,m){var b=r.child;for(b!==null&&(b.return=r);b!==null;){var y=b.dependencies;if(y!==null){var j=b.child;y=y.firstContext;e:for(;y!==null;){var L=y;y=b;for(var Y=0;Y<a.length;Y++)if(L.context===a[Y]){y.lanes|=c,L=y.alternate,L!==null&&(L.lanes|=c),dm(y.return,c,r),m||(j=null);break e}y=L.next}}else if(b.tag===18){if(j=b.return,j===null)throw Error(n(341));j.lanes|=c,y=j.alternate,y!==null&&(y.lanes|=c),dm(j,c,r),j=null}else j=b.child;if(j!==null)j.return=b;else for(j=b;j!==null;){if(j===r){j=null;break}if(b=j.sibling,b!==null){b.return=j.return,j=b;break}j=j.return}b=j}}function To(r,a,c,m){r=null;for(var b=a,y=!1;b!==null;){if(!y){if((b.flags&524288)!==0)y=!0;else if((b.flags&262144)!==0)break}if(b.tag===10){var j=b.alternate;if(j===null)throw Error(n(387));if(j=j.memoizedProps,j!==null){var L=b.type;Dn(b.pendingProps.value,j.value)||(r!==null?r.push(L):r=[L])}}else if(b===Se.current){if(j=b.alternate,j===null)throw Error(n(387));j.memoizedState.memoizedState!==b.memoizedState.memoizedState&&(r!==null?r.push(hc):r=[hc])}b=b.return}r!==null&&hm(a,r,c,m),a.flags|=262144}function Uu(r){for(r=r.firstContext;r!==null;){if(!Dn(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function Oa(r){Da=r,cr=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function Ws(r){return a1(Da,r)}function Fu(r,a){return Da===null&&Oa(r),a1(r,a)}function a1(r,a){var c=a._currentValue;if(a={context:a,memoizedValue:c,next:null},cr===null){if(r===null)throw Error(n(308));cr=a,r.dependencies={lanes:0,firstContext:a},r.flags|=524288}else cr=cr.next=a;return c}var oA=typeof AbortController<"u"?AbortController:function(){var r=[],a=this.signal={aborted:!1,addEventListener:function(c,m){r.push(m)}};this.abort=function(){a.aborted=!0,r.forEach(function(c){return c()})}},lA=e.unstable_scheduleCallback,cA=e.unstable_NormalPriority,bs={$$typeof:A,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function fm(){return{controller:new oA,data:new Map,refCount:0}}function $l(r){r.refCount--,r.refCount===0&&lA(cA,function(){r.controller.abort()})}var Hl=null,mm=0,Ro=0,Mo=null;function uA(r,a){if(Hl===null){var c=Hl=[];mm=0,Ro=xp(),Mo={status:"pending",value:void 0,then:function(m){c.push(m)}}}return mm++,a.then(o1,o1),a}function o1(){if(--mm===0&&Hl!==null){Mo!==null&&(Mo.status="fulfilled");var r=Hl;Hl=null,Ro=0,Mo=null;for(var a=0;a<r.length;a++)(0,r[a])()}}function dA(r,a){var c=[],m={status:"pending",value:null,reason:null,then:function(b){c.push(b)}};return r.then(function(){m.status="fulfilled",m.value=a;for(var b=0;b<c.length;b++)(0,c[b])(a)},function(b){for(m.status="rejected",m.reason=b,b=0;b<c.length;b++)(0,c[b])(void 0)}),m}var l1=I.S;I.S=function(r,a){V_=It(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&uA(r,a),l1!==null&&l1(r,a)};var La=V(null);function pm(){var r=La.current;return r!==null?r:$t.pooledCache}function qu(r,a){a===null?le(La,La.current):le(La,a.pool)}function c1(){var r=pm();return r===null?null:{parent:bs._currentValue,pool:r}}var Do=Error(n(460)),gm=Error(n(474)),Vu=Error(n(542)),Gu={then:function(){}};function u1(r){return r=r.status,r==="fulfilled"||r==="rejected"}function d1(r,a,c){switch(c=r[c],c===void 0?r.push(a):c!==a&&(a.then(Ie,Ie),a=c),a.status){case"fulfilled":return a.value;case"rejected":throw r=a.reason,f1(r),r;default:if(typeof a.status=="string")a.then(Ie,Ie);else{if(r=$t,r!==null&&100<r.shellSuspendCounter)throw Error(n(482));r=a,r.status="pending",r.then(function(m){if(a.status==="pending"){var b=a;b.status="fulfilled",b.value=m}},function(m){if(a.status==="pending"){var b=a;b.status="rejected",b.reason=m}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw r=a.reason,f1(r),r}throw Ba=a,Do}}function za(r){try{var a=r._init;return a(r._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(Ba=c,Do):c}}var Ba=null;function h1(){if(Ba===null)throw Error(n(459));var r=Ba;return Ba=null,r}function f1(r){if(r===Do||r===Vu)throw Error(n(483))}var Oo=null,Ul=0;function Wu(r){var a=Ul;return Ul+=1,Oo===null&&(Oo=[]),d1(Oo,r,a)}function Fl(r,a){a=a.props.ref,r.ref=a!==void 0?a:null}function Ku(r,a){throw a.$$typeof===x?Error(n(525)):(r=Object.prototype.toString.call(a),Error(n(31,r==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":r)))}function m1(r){function a(ne,Q){if(r){var ce=ne.deletions;ce===null?(ne.deletions=[Q],ne.flags|=16):ce.push(Q)}}function c(ne,Q){if(!r)return null;for(;Q!==null;)a(ne,Q),Q=Q.sibling;return null}function m(ne){for(var Q=new Map;ne!==null;)ne.key!==null?Q.set(ne.key,ne):Q.set(ne.index,ne),ne=ne.sibling;return Q}function b(ne,Q){return ne=or(ne,Q),ne.index=0,ne.sibling=null,ne}function y(ne,Q,ce){return ne.index=ce,r?(ce=ne.alternate,ce!==null?(ce=ce.index,ce<Q?(ne.flags|=67108866,Q):ce):(ne.flags|=67108866,Q)):(ne.flags|=1048576,Q)}function j(ne){return r&&ne.alternate===null&&(ne.flags|=67108866),ne}function L(ne,Q,ce,we){return Q===null||Q.tag!==6?(Q=im(ce,ne.mode,we),Q.return=ne,Q):(Q=b(Q,ce),Q.return=ne,Q)}function Y(ne,Q,ce,we){var tt=ce.type;return tt===k?ve(ne,Q,ce.props.children,we,ce.key):Q!==null&&(Q.elementType===tt||typeof tt=="object"&&tt!==null&&tt.$$typeof===O&&za(tt)===Q.type)?(Q=b(Q,ce.props),Fl(Q,ce),Q.return=ne,Q):(Q=$u(ce.type,ce.key,ce.props,null,ne.mode,we),Fl(Q,ce),Q.return=ne,Q)}function ue(ne,Q,ce,we){return Q===null||Q.tag!==4||Q.stateNode.containerInfo!==ce.containerInfo||Q.stateNode.implementation!==ce.implementation?(Q=rm(ce,ne.mode,we),Q.return=ne,Q):(Q=b(Q,ce.children||[]),Q.return=ne,Q)}function ve(ne,Q,ce,we,tt){return Q===null||Q.tag!==7?(Q=Ra(ce,ne.mode,we,tt),Q.return=ne,Q):(Q=b(Q,ce),Q.return=ne,Q)}function Ce(ne,Q,ce){if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return Q=im(""+Q,ne.mode,ce),Q.return=ne,Q;if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case v:return ce=$u(Q.type,Q.key,Q.props,null,ne.mode,ce),Fl(ce,Q),ce.return=ne,ce;case w:return Q=rm(Q,ne.mode,ce),Q.return=ne,Q;case O:return Q=za(Q),Ce(ne,Q,ce)}if(K(Q)||F(Q))return Q=Ra(Q,ne.mode,ce,null),Q.return=ne,Q;if(typeof Q.then=="function")return Ce(ne,Wu(Q),ce);if(Q.$$typeof===A)return Ce(ne,Fu(ne,Q),ce);Ku(ne,Q)}return null}function de(ne,Q,ce,we){var tt=Q!==null?Q.key:null;if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return tt!==null?null:L(ne,Q,""+ce,we);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case v:return ce.key===tt?Y(ne,Q,ce,we):null;case w:return ce.key===tt?ue(ne,Q,ce,we):null;case O:return ce=za(ce),de(ne,Q,ce,we)}if(K(ce)||F(ce))return tt!==null?null:ve(ne,Q,ce,we,null);if(typeof ce.then=="function")return de(ne,Q,Wu(ce),we);if(ce.$$typeof===A)return de(ne,Q,Fu(ne,ce),we);Ku(ne,ce)}return null}function pe(ne,Q,ce,we,tt){if(typeof we=="string"&&we!==""||typeof we=="number"||typeof we=="bigint")return ne=ne.get(ce)||null,L(Q,ne,""+we,tt);if(typeof we=="object"&&we!==null){switch(we.$$typeof){case v:return ne=ne.get(we.key===null?ce:we.key)||null,Y(Q,ne,we,tt);case w:return ne=ne.get(we.key===null?ce:we.key)||null,ue(Q,ne,we,tt);case O:return we=za(we),pe(ne,Q,ce,we,tt)}if(K(we)||F(we))return ne=ne.get(ce)||null,ve(Q,ne,we,tt,null);if(typeof we.then=="function")return pe(ne,Q,ce,Wu(we),tt);if(we.$$typeof===A)return pe(ne,Q,ce,Fu(Q,we),tt);Ku(Q,we)}return null}function Ke(ne,Q,ce,we){for(var tt=null,kt=null,Ze=Q,ut=Q=0,_t=null;Ze!==null&&ut<ce.length;ut++){Ze.index>ut?(_t=Ze,Ze=null):_t=Ze.sibling;var Nt=de(ne,Ze,ce[ut],we);if(Nt===null){Ze===null&&(Ze=_t);break}r&&Ze&&Nt.alternate===null&&a(ne,Ze),Q=y(Nt,Q,ut),kt===null?tt=Nt:kt.sibling=Nt,kt=Nt,Ze=_t}if(ut===ce.length)return c(ne,Ze),yt&&lr(ne,ut),tt;if(Ze===null){for(;ut<ce.length;ut++)Ze=Ce(ne,ce[ut],we),Ze!==null&&(Q=y(Ze,Q,ut),kt===null?tt=Ze:kt.sibling=Ze,kt=Ze);return yt&&lr(ne,ut),tt}for(Ze=m(Ze);ut<ce.length;ut++)_t=pe(Ze,ne,ut,ce[ut],we),_t!==null&&(r&&_t.alternate!==null&&Ze.delete(_t.key===null?ut:_t.key),Q=y(_t,Q,ut),kt===null?tt=_t:kt.sibling=_t,kt=_t);return r&&Ze.forEach(function(la){return a(ne,la)}),yt&&lr(ne,ut),tt}function st(ne,Q,ce,we){if(ce==null)throw Error(n(151));for(var tt=null,kt=null,Ze=Q,ut=Q=0,_t=null,Nt=ce.next();Ze!==null&&!Nt.done;ut++,Nt=ce.next()){Ze.index>ut?(_t=Ze,Ze=null):_t=Ze.sibling;var la=de(ne,Ze,Nt.value,we);if(la===null){Ze===null&&(Ze=_t);break}r&&Ze&&la.alternate===null&&a(ne,Ze),Q=y(la,Q,ut),kt===null?tt=la:kt.sibling=la,kt=la,Ze=_t}if(Nt.done)return c(ne,Ze),yt&&lr(ne,ut),tt;if(Ze===null){for(;!Nt.done;ut++,Nt=ce.next())Nt=Ce(ne,Nt.value,we),Nt!==null&&(Q=y(Nt,Q,ut),kt===null?tt=Nt:kt.sibling=Nt,kt=Nt);return yt&&lr(ne,ut),tt}for(Ze=m(Ze);!Nt.done;ut++,Nt=ce.next())Nt=pe(Ze,ne,ut,Nt.value,we),Nt!==null&&(r&&Nt.alternate!==null&&Ze.delete(Nt.key===null?ut:Nt.key),Q=y(Nt,Q,ut),kt===null?tt=Nt:kt.sibling=Nt,kt=Nt);return r&&Ze.forEach(function(wT){return a(ne,wT)}),yt&&lr(ne,ut),tt}function Bt(ne,Q,ce,we){if(typeof ce=="object"&&ce!==null&&ce.type===k&&ce.key===null&&(ce=ce.props.children),typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case v:e:{for(var tt=ce.key;Q!==null;){if(Q.key===tt){if(tt=ce.type,tt===k){if(Q.tag===7){c(ne,Q.sibling),we=b(Q,ce.props.children),we.return=ne,ne=we;break e}}else if(Q.elementType===tt||typeof tt=="object"&&tt!==null&&tt.$$typeof===O&&za(tt)===Q.type){c(ne,Q.sibling),we=b(Q,ce.props),Fl(we,ce),we.return=ne,ne=we;break e}c(ne,Q);break}else a(ne,Q);Q=Q.sibling}ce.type===k?(we=Ra(ce.props.children,ne.mode,we,ce.key),we.return=ne,ne=we):(we=$u(ce.type,ce.key,ce.props,null,ne.mode,we),Fl(we,ce),we.return=ne,ne=we)}return j(ne);case w:e:{for(tt=ce.key;Q!==null;){if(Q.key===tt)if(Q.tag===4&&Q.stateNode.containerInfo===ce.containerInfo&&Q.stateNode.implementation===ce.implementation){c(ne,Q.sibling),we=b(Q,ce.children||[]),we.return=ne,ne=we;break e}else{c(ne,Q);break}else a(ne,Q);Q=Q.sibling}we=rm(ce,ne.mode,we),we.return=ne,ne=we}return j(ne);case O:return ce=za(ce),Bt(ne,Q,ce,we)}if(K(ce))return Ke(ne,Q,ce,we);if(F(ce)){if(tt=F(ce),typeof tt!="function")throw Error(n(150));return ce=tt.call(ce),st(ne,Q,ce,we)}if(typeof ce.then=="function")return Bt(ne,Q,Wu(ce),we);if(ce.$$typeof===A)return Bt(ne,Q,Fu(ne,ce),we);Ku(ne,ce)}return typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint"?(ce=""+ce,Q!==null&&Q.tag===6?(c(ne,Q.sibling),we=b(Q,ce),we.return=ne,ne=we):(c(ne,Q),we=im(ce,ne.mode,we),we.return=ne,ne=we),j(ne)):c(ne,Q)}return function(ne,Q,ce,we){try{Ul=0;var tt=Bt(ne,Q,ce,we);return Oo=null,tt}catch(Ze){if(Ze===Do||Ze===Vu)throw Ze;var kt=On(29,Ze,null,ne.mode);return kt.lanes=we,kt.return=ne,kt}}}var Pa=m1(!0),p1=m1(!1),Vr=!1;function xm(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function bm(r,a){r=r.updateQueue,a.updateQueue===r&&(a.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function Gr(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function Wr(r,a,c){var m=r.updateQueue;if(m===null)return null;if(m=m.shared,(Ct&2)!==0){var b=m.pending;return b===null?a.next=a:(a.next=b.next,b.next=a),m.pending=a,a=Iu(r),Qv(r,null,c),a}return Pu(r,m,a,c),Iu(r)}function ql(r,a,c){if(a=a.updateQueue,a!==null&&(a=a.shared,(c&4194048)!==0)){var m=a.lanes;m&=r.pendingLanes,c|=m,a.lanes=c,rt(r,c)}}function vm(r,a){var c=r.updateQueue,m=r.alternate;if(m!==null&&(m=m.updateQueue,c===m)){var b=null,y=null;if(c=c.firstBaseUpdate,c!==null){do{var j={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};y===null?b=y=j:y=y.next=j,c=c.next}while(c!==null);y===null?b=y=a:y=y.next=a}else b=y=a;c={baseState:m.baseState,firstBaseUpdate:b,lastBaseUpdate:y,shared:m.shared,callbacks:m.callbacks},r.updateQueue=c;return}r=c.lastBaseUpdate,r===null?c.firstBaseUpdate=a:r.next=a,c.lastBaseUpdate=a}var _m=!1;function Vl(){if(_m){var r=Mo;if(r!==null)throw r}}function Gl(r,a,c,m){_m=!1;var b=r.updateQueue;Vr=!1;var y=b.firstBaseUpdate,j=b.lastBaseUpdate,L=b.shared.pending;if(L!==null){b.shared.pending=null;var Y=L,ue=Y.next;Y.next=null,j===null?y=ue:j.next=ue,j=Y;var ve=r.alternate;ve!==null&&(ve=ve.updateQueue,L=ve.lastBaseUpdate,L!==j&&(L===null?ve.firstBaseUpdate=ue:L.next=ue,ve.lastBaseUpdate=Y))}if(y!==null){var Ce=b.baseState;j=0,ve=ue=Y=null,L=y;do{var de=L.lane&-536870913,pe=de!==L.lane;if(pe?(vt&de)===de:(m&de)===de){de!==0&&de===Ro&&(_m=!0),ve!==null&&(ve=ve.next={lane:0,tag:L.tag,payload:L.payload,callback:null,next:null});e:{var Ke=r,st=L;de=a;var Bt=c;switch(st.tag){case 1:if(Ke=st.payload,typeof Ke=="function"){Ce=Ke.call(Bt,Ce,de);break e}Ce=Ke;break e;case 3:Ke.flags=Ke.flags&-65537|128;case 0:if(Ke=st.payload,de=typeof Ke=="function"?Ke.call(Bt,Ce,de):Ke,de==null)break e;Ce=g({},Ce,de);break e;case 2:Vr=!0}}de=L.callback,de!==null&&(r.flags|=64,pe&&(r.flags|=8192),pe=b.callbacks,pe===null?b.callbacks=[de]:pe.push(de))}else pe={lane:de,tag:L.tag,payload:L.payload,callback:L.callback,next:null},ve===null?(ue=ve=pe,Y=Ce):ve=ve.next=pe,j|=de;if(L=L.next,L===null){if(L=b.shared.pending,L===null)break;pe=L,L=pe.next,pe.next=null,b.lastBaseUpdate=pe,b.shared.pending=null}}while(!0);ve===null&&(Y=Ce),b.baseState=Y,b.firstBaseUpdate=ue,b.lastBaseUpdate=ve,y===null&&(b.shared.lanes=0),Qr|=j,r.lanes=j,r.memoizedState=Ce}}function g1(r,a){if(typeof r!="function")throw Error(n(191,r));r.call(a)}function x1(r,a){var c=r.callbacks;if(c!==null)for(r.callbacks=null,r=0;r<c.length;r++)g1(c[r],a)}var Lo=V(null),Yu=V(0);function b1(r,a){r=vr,le(Yu,r),le(Lo,a),vr=r|a.baseLanes}function ym(){le(Yu,vr),le(Lo,Lo.current)}function wm(){vr=Yu.current,q(Lo),q(Yu)}var Ln=V(null),ti=null;function Kr(r){var a=r.alternate;le(hs,hs.current&1),le(Ln,r),ti===null&&(a===null||Lo.current!==null||a.memoizedState!==null)&&(ti=r)}function Sm(r){le(hs,hs.current),le(Ln,r),ti===null&&(ti=r)}function v1(r){r.tag===22?(le(hs,hs.current),le(Ln,r),ti===null&&(ti=r)):Yr()}function Yr(){le(hs,hs.current),le(Ln,Ln.current)}function zn(r){q(Ln),ti===r&&(ti=null),q(hs)}var hs=V(0);function Xu(r){for(var a=r;a!==null;){if(a.tag===13){var c=a.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||Ap(c)||Tp(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===r)break;for(;a.sibling===null;){if(a.return===null||a.return===r)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var dr=0,ct=null,Lt=null,vs=null,Zu=!1,zo=!1,Ia=!1,Qu=0,Wl=0,Bo=null,hA=0;function ss(){throw Error(n(321))}function km(r,a){if(a===null)return!1;for(var c=0;c<a.length&&c<r.length;c++)if(!Dn(r[c],a[c]))return!1;return!0}function Nm(r,a,c,m,b,y){return dr=y,ct=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,I.H=r===null||r.memoizedState===null?s_:$m,Ia=!1,y=c(m,b),Ia=!1,zo&&(y=y1(a,c,m,b)),_1(r),y}function _1(r){I.H=Xl;var a=Lt!==null&&Lt.next!==null;if(dr=0,vs=Lt=ct=null,Zu=!1,Wl=0,Bo=null,a)throw Error(n(300));r===null||_s||(r=r.dependencies,r!==null&&Uu(r)&&(_s=!0))}function y1(r,a,c,m){ct=r;var b=0;do{if(zo&&(Bo=null),Wl=0,zo=!1,25<=b)throw Error(n(301));if(b+=1,vs=Lt=null,r.updateQueue!=null){var y=r.updateQueue;y.lastEffect=null,y.events=null,y.stores=null,y.memoCache!=null&&(y.memoCache.index=0)}I.H=n_,y=a(c,m)}while(zo);return y}function fA(){var r=I.H,a=r.useState()[0];return a=typeof a.then=="function"?Kl(a):a,r=r.useState()[0],(Lt!==null?Lt.memoizedState:null)!==r&&(ct.flags|=1024),a}function Cm(){var r=Qu!==0;return Qu=0,r}function Em(r,a,c){a.updateQueue=r.updateQueue,a.flags&=-2053,r.lanes&=~c}function jm(r){if(Zu){for(r=r.memoizedState;r!==null;){var a=r.queue;a!==null&&(a.pending=null),r=r.next}Zu=!1}dr=0,vs=Lt=ct=null,zo=!1,Wl=Qu=0,Bo=null}function on(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return vs===null?ct.memoizedState=vs=r:vs=vs.next=r,vs}function fs(){if(Lt===null){var r=ct.alternate;r=r!==null?r.memoizedState:null}else r=Lt.next;var a=vs===null?ct.memoizedState:vs.next;if(a!==null)vs=a,Lt=r;else{if(r===null)throw ct.alternate===null?Error(n(467)):Error(n(310));Lt=r,r={memoizedState:Lt.memoizedState,baseState:Lt.baseState,baseQueue:Lt.baseQueue,queue:Lt.queue,next:null},vs===null?ct.memoizedState=vs=r:vs=vs.next=r}return vs}function Ju(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Kl(r){var a=Wl;return Wl+=1,Bo===null&&(Bo=[]),r=d1(Bo,r,a),a=ct,(vs===null?a.memoizedState:vs.next)===null&&(a=a.alternate,I.H=a===null||a.memoizedState===null?s_:$m),r}function ed(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return Kl(r);if(r.$$typeof===A)return Ws(r)}throw Error(n(438,String(r)))}function Am(r){var a=null,c=ct.updateQueue;if(c!==null&&(a=c.memoCache),a==null){var m=ct.alternate;m!==null&&(m=m.updateQueue,m!==null&&(m=m.memoCache,m!=null&&(a={data:m.data.map(function(b){return b.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),c===null&&(c=Ju(),ct.updateQueue=c),c.memoCache=a,c=a.data[a.index],c===void 0)for(c=a.data[a.index]=Array(r),m=0;m<r;m++)c[m]=B;return a.index++,c}function hr(r,a){return typeof a=="function"?a(r):a}function td(r){var a=fs();return Tm(a,Lt,r)}function Tm(r,a,c){var m=r.queue;if(m===null)throw Error(n(311));m.lastRenderedReducer=c;var b=r.baseQueue,y=m.pending;if(y!==null){if(b!==null){var j=b.next;b.next=y.next,y.next=j}a.baseQueue=b=y,m.pending=null}if(y=r.baseState,b===null)r.memoizedState=y;else{a=b.next;var L=j=null,Y=null,ue=a,ve=!1;do{var Ce=ue.lane&-536870913;if(Ce!==ue.lane?(vt&Ce)===Ce:(dr&Ce)===Ce){var de=ue.revertLane;if(de===0)Y!==null&&(Y=Y.next={lane:0,revertLane:0,gesture:null,action:ue.action,hasEagerState:ue.hasEagerState,eagerState:ue.eagerState,next:null}),Ce===Ro&&(ve=!0);else if((dr&de)===de){ue=ue.next,de===Ro&&(ve=!0);continue}else Ce={lane:0,revertLane:ue.revertLane,gesture:null,action:ue.action,hasEagerState:ue.hasEagerState,eagerState:ue.eagerState,next:null},Y===null?(L=Y=Ce,j=y):Y=Y.next=Ce,ct.lanes|=de,Qr|=de;Ce=ue.action,Ia&&c(y,Ce),y=ue.hasEagerState?ue.eagerState:c(y,Ce)}else de={lane:Ce,revertLane:ue.revertLane,gesture:ue.gesture,action:ue.action,hasEagerState:ue.hasEagerState,eagerState:ue.eagerState,next:null},Y===null?(L=Y=de,j=y):Y=Y.next=de,ct.lanes|=Ce,Qr|=Ce;ue=ue.next}while(ue!==null&&ue!==a);if(Y===null?j=y:Y.next=L,!Dn(y,r.memoizedState)&&(_s=!0,ve&&(c=Mo,c!==null)))throw c;r.memoizedState=y,r.baseState=j,r.baseQueue=Y,m.lastRenderedState=y}return b===null&&(m.lanes=0),[r.memoizedState,m.dispatch]}function Rm(r){var a=fs(),c=a.queue;if(c===null)throw Error(n(311));c.lastRenderedReducer=r;var m=c.dispatch,b=c.pending,y=a.memoizedState;if(b!==null){c.pending=null;var j=b=b.next;do y=r(y,j.action),j=j.next;while(j!==b);Dn(y,a.memoizedState)||(_s=!0),a.memoizedState=y,a.baseQueue===null&&(a.baseState=y),c.lastRenderedState=y}return[y,m]}function w1(r,a,c){var m=ct,b=fs(),y=yt;if(y){if(c===void 0)throw Error(n(407));c=c()}else c=a();var j=!Dn((Lt||b).memoizedState,c);if(j&&(b.memoizedState=c,_s=!0),b=b.queue,Om(N1.bind(null,m,b,r),[r]),b.getSnapshot!==a||j||vs!==null&&vs.memoizedState.tag&1){if(m.flags|=2048,Po(9,{destroy:void 0},k1.bind(null,m,b,c,a),null),$t===null)throw Error(n(349));y||(dr&127)!==0||S1(m,a,c)}return c}function S1(r,a,c){r.flags|=16384,r={getSnapshot:a,value:c},a=ct.updateQueue,a===null?(a=Ju(),ct.updateQueue=a,a.stores=[r]):(c=a.stores,c===null?a.stores=[r]:c.push(r))}function k1(r,a,c,m){a.value=c,a.getSnapshot=m,C1(a)&&E1(r)}function N1(r,a,c){return c(function(){C1(a)&&E1(r)})}function C1(r){var a=r.getSnapshot;r=r.value;try{var c=a();return!Dn(r,c)}catch{return!0}}function E1(r){var a=Ta(r,2);a!==null&&Nn(a,r,2)}function Mm(r){var a=on();if(typeof r=="function"){var c=r;if(r=c(),Ia){Ae(!0);try{c()}finally{Ae(!1)}}}return a.memoizedState=a.baseState=r,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:hr,lastRenderedState:r},a}function j1(r,a,c,m){return r.baseState=c,Tm(r,Lt,typeof m=="function"?m:hr)}function mA(r,a,c,m,b){if(id(r))throw Error(n(485));if(r=a.action,r!==null){var y={payload:b,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(j){y.listeners.push(j)}};I.T!==null?c(!0):y.isTransition=!1,m(y),c=a.pending,c===null?(y.next=a.pending=y,A1(a,y)):(y.next=c.next,a.pending=c.next=y)}}function A1(r,a){var c=a.action,m=a.payload,b=r.state;if(a.isTransition){var y=I.T,j={};I.T=j;try{var L=c(b,m),Y=I.S;Y!==null&&Y(j,L),T1(r,a,L)}catch(ue){Dm(r,a,ue)}finally{y!==null&&j.types!==null&&(y.types=j.types),I.T=y}}else try{y=c(b,m),T1(r,a,y)}catch(ue){Dm(r,a,ue)}}function T1(r,a,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(m){R1(r,a,m)},function(m){return Dm(r,a,m)}):R1(r,a,c)}function R1(r,a,c){a.status="fulfilled",a.value=c,M1(a),r.state=c,a=r.pending,a!==null&&(c=a.next,c===a?r.pending=null:(c=c.next,a.next=c,A1(r,c)))}function Dm(r,a,c){var m=r.pending;if(r.pending=null,m!==null){m=m.next;do a.status="rejected",a.reason=c,M1(a),a=a.next;while(a!==m)}r.action=null}function M1(r){r=r.listeners;for(var a=0;a<r.length;a++)(0,r[a])()}function D1(r,a){return a}function O1(r,a){if(yt){var c=$t.formState;if(c!==null){e:{var m=ct;if(yt){if(Vt){t:{for(var b=Vt,y=ei;b.nodeType!==8;){if(!y){b=null;break t}if(b=si(b.nextSibling),b===null){b=null;break t}}y=b.data,b=y==="F!"||y==="F"?b:null}if(b){Vt=si(b.nextSibling),m=b.data==="F!";break e}}Fr(m)}m=!1}m&&(a=c[0])}}return c=on(),c.memoizedState=c.baseState=a,m={pending:null,lanes:0,dispatch:null,lastRenderedReducer:D1,lastRenderedState:a},c.queue=m,c=J1.bind(null,ct,m),m.dispatch=c,m=Mm(!1),y=Im.bind(null,ct,!1,m.queue),m=on(),b={state:a,dispatch:null,action:r,pending:null},m.queue=b,c=mA.bind(null,ct,b,y,c),b.dispatch=c,m.memoizedState=r,[a,c,!1]}function L1(r){var a=fs();return z1(a,Lt,r)}function z1(r,a,c){if(a=Tm(r,a,D1)[0],r=td(hr)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var m=Kl(a)}catch(j){throw j===Do?Vu:j}else m=a;a=fs();var b=a.queue,y=b.dispatch;return c!==a.memoizedState&&(ct.flags|=2048,Po(9,{destroy:void 0},pA.bind(null,b,c),null)),[m,y,r]}function pA(r,a){r.action=a}function B1(r){var a=fs(),c=Lt;if(c!==null)return z1(a,c,r);fs(),a=a.memoizedState,c=fs();var m=c.queue.dispatch;return c.memoizedState=r,[a,m,!1]}function Po(r,a,c,m){return r={tag:r,create:c,deps:m,inst:a,next:null},a=ct.updateQueue,a===null&&(a=Ju(),ct.updateQueue=a),c=a.lastEffect,c===null?a.lastEffect=r.next=r:(m=c.next,c.next=r,r.next=m,a.lastEffect=r),r}function P1(){return fs().memoizedState}function sd(r,a,c,m){var b=on();ct.flags|=r,b.memoizedState=Po(1|a,{destroy:void 0},c,m===void 0?null:m)}function nd(r,a,c,m){var b=fs();m=m===void 0?null:m;var y=b.memoizedState.inst;Lt!==null&&m!==null&&km(m,Lt.memoizedState.deps)?b.memoizedState=Po(a,y,c,m):(ct.flags|=r,b.memoizedState=Po(1|a,y,c,m))}function I1(r,a){sd(8390656,8,r,a)}function Om(r,a){nd(2048,8,r,a)}function gA(r){ct.flags|=4;var a=ct.updateQueue;if(a===null)a=Ju(),ct.updateQueue=a,a.events=[r];else{var c=a.events;c===null?a.events=[r]:c.push(r)}}function $1(r){var a=fs().memoizedState;return gA({ref:a,nextImpl:r}),function(){if((Ct&2)!==0)throw Error(n(440));return a.impl.apply(void 0,arguments)}}function H1(r,a){return nd(4,2,r,a)}function U1(r,a){return nd(4,4,r,a)}function F1(r,a){if(typeof a=="function"){r=r();var c=a(r);return function(){typeof c=="function"?c():a(null)}}if(a!=null)return r=r(),a.current=r,function(){a.current=null}}function q1(r,a,c){c=c!=null?c.concat([r]):null,nd(4,4,F1.bind(null,a,r),c)}function Lm(){}function V1(r,a){var c=fs();a=a===void 0?null:a;var m=c.memoizedState;return a!==null&&km(a,m[1])?m[0]:(c.memoizedState=[r,a],r)}function G1(r,a){var c=fs();a=a===void 0?null:a;var m=c.memoizedState;if(a!==null&&km(a,m[1]))return m[0];if(m=r(),Ia){Ae(!0);try{r()}finally{Ae(!1)}}return c.memoizedState=[m,a],m}function zm(r,a,c){return c===void 0||(dr&1073741824)!==0&&(vt&261930)===0?r.memoizedState=a:(r.memoizedState=c,r=W_(),ct.lanes|=r,Qr|=r,c)}function W1(r,a,c,m){return Dn(c,a)?c:Lo.current!==null?(r=zm(r,c,m),Dn(r,a)||(_s=!0),r):(dr&42)===0||(dr&1073741824)!==0&&(vt&261930)===0?(_s=!0,r.memoizedState=c):(r=W_(),ct.lanes|=r,Qr|=r,a)}function K1(r,a,c,m,b){var y=Z.p;Z.p=y!==0&&8>y?y:8;var j=I.T,L={};I.T=L,Im(r,!1,a,c);try{var Y=b(),ue=I.S;if(ue!==null&&ue(L,Y),Y!==null&&typeof Y=="object"&&typeof Y.then=="function"){var ve=dA(Y,m);Yl(r,a,ve,In(r))}else Yl(r,a,m,In(r))}catch(Ce){Yl(r,a,{then:function(){},status:"rejected",reason:Ce},In())}finally{Z.p=y,j!==null&&L.types!==null&&(j.types=L.types),I.T=j}}function xA(){}function Bm(r,a,c,m){if(r.tag!==5)throw Error(n(476));var b=Y1(r).queue;K1(r,b,a,W,c===null?xA:function(){return X1(r),c(m)})}function Y1(r){var a=r.memoizedState;if(a!==null)return a;a={memoizedState:W,baseState:W,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:hr,lastRenderedState:W},next:null};var c={};return a.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:hr,lastRenderedState:c},next:null},r.memoizedState=a,r=r.alternate,r!==null&&(r.memoizedState=a),a}function X1(r){var a=Y1(r);a.next===null&&(a=r.alternate.memoizedState),Yl(r,a.next.queue,{},In())}function Pm(){return Ws(hc)}function Z1(){return fs().memoizedState}function Q1(){return fs().memoizedState}function bA(r){for(var a=r.return;a!==null;){switch(a.tag){case 24:case 3:var c=In();r=Gr(c);var m=Wr(a,r,c);m!==null&&(Nn(m,a,c),ql(m,a,c)),a={cache:fm()},r.payload=a;return}a=a.return}}function vA(r,a,c){var m=In();c={lane:m,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},id(r)?e_(a,c):(c=sm(r,a,c,m),c!==null&&(Nn(c,r,m),t_(c,a,m)))}function J1(r,a,c){var m=In();Yl(r,a,c,m)}function Yl(r,a,c,m){var b={lane:m,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(id(r))e_(a,b);else{var y=r.alternate;if(r.lanes===0&&(y===null||y.lanes===0)&&(y=a.lastRenderedReducer,y!==null))try{var j=a.lastRenderedState,L=y(j,c);if(b.hasEagerState=!0,b.eagerState=L,Dn(L,j))return Pu(r,a,b,0),$t===null&&Bu(),!1}catch{}if(c=sm(r,a,b,m),c!==null)return Nn(c,r,m),t_(c,a,m),!0}return!1}function Im(r,a,c,m){if(m={lane:2,revertLane:xp(),gesture:null,action:m,hasEagerState:!1,eagerState:null,next:null},id(r)){if(a)throw Error(n(479))}else a=sm(r,c,m,2),a!==null&&Nn(a,r,2)}function id(r){var a=r.alternate;return r===ct||a!==null&&a===ct}function e_(r,a){zo=Zu=!0;var c=r.pending;c===null?a.next=a:(a.next=c.next,c.next=a),r.pending=a}function t_(r,a,c){if((c&4194048)!==0){var m=a.lanes;m&=r.pendingLanes,c|=m,a.lanes=c,rt(r,c)}}var Xl={readContext:Ws,use:ed,useCallback:ss,useContext:ss,useEffect:ss,useImperativeHandle:ss,useLayoutEffect:ss,useInsertionEffect:ss,useMemo:ss,useReducer:ss,useRef:ss,useState:ss,useDebugValue:ss,useDeferredValue:ss,useTransition:ss,useSyncExternalStore:ss,useId:ss,useHostTransitionStatus:ss,useFormState:ss,useActionState:ss,useOptimistic:ss,useMemoCache:ss,useCacheRefresh:ss};Xl.useEffectEvent=ss;var s_={readContext:Ws,use:ed,useCallback:function(r,a){return on().memoizedState=[r,a===void 0?null:a],r},useContext:Ws,useEffect:I1,useImperativeHandle:function(r,a,c){c=c!=null?c.concat([r]):null,sd(4194308,4,F1.bind(null,a,r),c)},useLayoutEffect:function(r,a){return sd(4194308,4,r,a)},useInsertionEffect:function(r,a){sd(4,2,r,a)},useMemo:function(r,a){var c=on();a=a===void 0?null:a;var m=r();if(Ia){Ae(!0);try{r()}finally{Ae(!1)}}return c.memoizedState=[m,a],m},useReducer:function(r,a,c){var m=on();if(c!==void 0){var b=c(a);if(Ia){Ae(!0);try{c(a)}finally{Ae(!1)}}}else b=a;return m.memoizedState=m.baseState=b,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:b},m.queue=r,r=r.dispatch=vA.bind(null,ct,r),[m.memoizedState,r]},useRef:function(r){var a=on();return r={current:r},a.memoizedState=r},useState:function(r){r=Mm(r);var a=r.queue,c=J1.bind(null,ct,a);return a.dispatch=c,[r.memoizedState,c]},useDebugValue:Lm,useDeferredValue:function(r,a){var c=on();return zm(c,r,a)},useTransition:function(){var r=Mm(!1);return r=K1.bind(null,ct,r.queue,!0,!1),on().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,a,c){var m=ct,b=on();if(yt){if(c===void 0)throw Error(n(407));c=c()}else{if(c=a(),$t===null)throw Error(n(349));(vt&127)!==0||S1(m,a,c)}b.memoizedState=c;var y={value:c,getSnapshot:a};return b.queue=y,I1(N1.bind(null,m,y,r),[r]),m.flags|=2048,Po(9,{destroy:void 0},k1.bind(null,m,y,c,a),null),c},useId:function(){var r=on(),a=$t.identifierPrefix;if(yt){var c=Bi,m=zi;c=(m&~(1<<32-M(m)-1)).toString(32)+c,a="_"+a+"R_"+c,c=Qu++,0<c&&(a+="H"+c.toString(32)),a+="_"}else c=hA++,a="_"+a+"r_"+c.toString(32)+"_";return r.memoizedState=a},useHostTransitionStatus:Pm,useFormState:O1,useActionState:O1,useOptimistic:function(r){var a=on();a.memoizedState=a.baseState=r;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=c,a=Im.bind(null,ct,!0,c),c.dispatch=a,[r,a]},useMemoCache:Am,useCacheRefresh:function(){return on().memoizedState=bA.bind(null,ct)},useEffectEvent:function(r){var a=on(),c={impl:r};return a.memoizedState=c,function(){if((Ct&2)!==0)throw Error(n(440));return c.impl.apply(void 0,arguments)}}},$m={readContext:Ws,use:ed,useCallback:V1,useContext:Ws,useEffect:Om,useImperativeHandle:q1,useInsertionEffect:H1,useLayoutEffect:U1,useMemo:G1,useReducer:td,useRef:P1,useState:function(){return td(hr)},useDebugValue:Lm,useDeferredValue:function(r,a){var c=fs();return W1(c,Lt.memoizedState,r,a)},useTransition:function(){var r=td(hr)[0],a=fs().memoizedState;return[typeof r=="boolean"?r:Kl(r),a]},useSyncExternalStore:w1,useId:Z1,useHostTransitionStatus:Pm,useFormState:L1,useActionState:L1,useOptimistic:function(r,a){var c=fs();return j1(c,Lt,r,a)},useMemoCache:Am,useCacheRefresh:Q1};$m.useEffectEvent=$1;var n_={readContext:Ws,use:ed,useCallback:V1,useContext:Ws,useEffect:Om,useImperativeHandle:q1,useInsertionEffect:H1,useLayoutEffect:U1,useMemo:G1,useReducer:Rm,useRef:P1,useState:function(){return Rm(hr)},useDebugValue:Lm,useDeferredValue:function(r,a){var c=fs();return Lt===null?zm(c,r,a):W1(c,Lt.memoizedState,r,a)},useTransition:function(){var r=Rm(hr)[0],a=fs().memoizedState;return[typeof r=="boolean"?r:Kl(r),a]},useSyncExternalStore:w1,useId:Z1,useHostTransitionStatus:Pm,useFormState:B1,useActionState:B1,useOptimistic:function(r,a){var c=fs();return Lt!==null?j1(c,Lt,r,a):(c.baseState=r,[r,c.queue.dispatch])},useMemoCache:Am,useCacheRefresh:Q1};n_.useEffectEvent=$1;function Hm(r,a,c,m){a=r.memoizedState,c=c(m,a),c=c==null?a:g({},a,c),r.memoizedState=c,r.lanes===0&&(r.updateQueue.baseState=c)}var Um={enqueueSetState:function(r,a,c){r=r._reactInternals;var m=In(),b=Gr(m);b.payload=a,c!=null&&(b.callback=c),a=Wr(r,b,m),a!==null&&(Nn(a,r,m),ql(a,r,m))},enqueueReplaceState:function(r,a,c){r=r._reactInternals;var m=In(),b=Gr(m);b.tag=1,b.payload=a,c!=null&&(b.callback=c),a=Wr(r,b,m),a!==null&&(Nn(a,r,m),ql(a,r,m))},enqueueForceUpdate:function(r,a){r=r._reactInternals;var c=In(),m=Gr(c);m.tag=2,a!=null&&(m.callback=a),a=Wr(r,m,c),a!==null&&(Nn(a,r,c),ql(a,r,c))}};function i_(r,a,c,m,b,y,j){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(m,y,j):a.prototype&&a.prototype.isPureReactComponent?!zl(c,m)||!zl(b,y):!0}function r_(r,a,c,m){r=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(c,m),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(c,m),a.state!==r&&Um.enqueueReplaceState(a,a.state,null)}function $a(r,a){var c=a;if("ref"in a){c={};for(var m in a)m!=="ref"&&(c[m]=a[m])}if(r=r.defaultProps){c===a&&(c=g({},c));for(var b in r)c[b]===void 0&&(c[b]=r[b])}return c}function a_(r){zu(r)}function o_(r){console.error(r)}function l_(r){zu(r)}function rd(r,a){try{var c=r.onUncaughtError;c(a.value,{componentStack:a.stack})}catch(m){setTimeout(function(){throw m})}}function c_(r,a,c){try{var m=r.onCaughtError;m(c.value,{componentStack:c.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(b){setTimeout(function(){throw b})}}function Fm(r,a,c){return c=Gr(c),c.tag=3,c.payload={element:null},c.callback=function(){rd(r,a)},c}function u_(r){return r=Gr(r),r.tag=3,r}function d_(r,a,c,m){var b=c.type.getDerivedStateFromError;if(typeof b=="function"){var y=m.value;r.payload=function(){return b(y)},r.callback=function(){c_(a,c,m)}}var j=c.stateNode;j!==null&&typeof j.componentDidCatch=="function"&&(r.callback=function(){c_(a,c,m),typeof b!="function"&&(Jr===null?Jr=new Set([this]):Jr.add(this));var L=m.stack;this.componentDidCatch(m.value,{componentStack:L!==null?L:""})})}function _A(r,a,c,m,b){if(c.flags|=32768,m!==null&&typeof m=="object"&&typeof m.then=="function"){if(a=c.alternate,a!==null&&To(a,c,b,!0),c=Ln.current,c!==null){switch(c.tag){case 31:case 13:return ti===null?xd():c.alternate===null&&ns===0&&(ns=3),c.flags&=-257,c.flags|=65536,c.lanes=b,m===Gu?c.flags|=16384:(a=c.updateQueue,a===null?c.updateQueue=new Set([m]):a.add(m),mp(r,m,b)),!1;case 22:return c.flags|=65536,m===Gu?c.flags|=16384:(a=c.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([m])},c.updateQueue=a):(c=a.retryQueue,c===null?a.retryQueue=new Set([m]):c.add(m)),mp(r,m,b)),!1}throw Error(n(435,c.tag))}return mp(r,m,b),xd(),!1}if(yt)return a=Ln.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=b,m!==lm&&(r=Error(n(422),{cause:m}),Il(Zn(r,c)))):(m!==lm&&(a=Error(n(423),{cause:m}),Il(Zn(a,c))),r=r.current.alternate,r.flags|=65536,b&=-b,r.lanes|=b,m=Zn(m,c),b=Fm(r.stateNode,m,b),vm(r,b),ns!==4&&(ns=2)),!1;var y=Error(n(520),{cause:m});if(y=Zn(y,c),ic===null?ic=[y]:ic.push(y),ns!==4&&(ns=2),a===null)return!0;m=Zn(m,c),c=a;do{switch(c.tag){case 3:return c.flags|=65536,r=b&-b,c.lanes|=r,r=Fm(c.stateNode,m,r),vm(c,r),!1;case 1:if(a=c.type,y=c.stateNode,(c.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(Jr===null||!Jr.has(y))))return c.flags|=65536,b&=-b,c.lanes|=b,b=u_(b),d_(b,r,c,m),vm(c,b),!1}c=c.return}while(c!==null);return!1}var qm=Error(n(461)),_s=!1;function Ks(r,a,c,m){a.child=r===null?p1(a,null,c,m):Pa(a,r.child,c,m)}function h_(r,a,c,m,b){c=c.render;var y=a.ref;if("ref"in m){var j={};for(var L in m)L!=="ref"&&(j[L]=m[L])}else j=m;return Oa(a),m=Nm(r,a,c,j,y,b),L=Cm(),r!==null&&!_s?(Em(r,a,b),fr(r,a,b)):(yt&&L&&am(a),a.flags|=1,Ks(r,a,m,b),a.child)}function f_(r,a,c,m,b){if(r===null){var y=c.type;return typeof y=="function"&&!nm(y)&&y.defaultProps===void 0&&c.compare===null?(a.tag=15,a.type=y,m_(r,a,y,m,b)):(r=$u(c.type,null,m,a,a.mode,b),r.ref=a.ref,r.return=a,a.child=r)}if(y=r.child,!Qm(r,b)){var j=y.memoizedProps;if(c=c.compare,c=c!==null?c:zl,c(j,m)&&r.ref===a.ref)return fr(r,a,b)}return a.flags|=1,r=or(y,m),r.ref=a.ref,r.return=a,a.child=r}function m_(r,a,c,m,b){if(r!==null){var y=r.memoizedProps;if(zl(y,m)&&r.ref===a.ref)if(_s=!1,a.pendingProps=m=y,Qm(r,b))(r.flags&131072)!==0&&(_s=!0);else return a.lanes=r.lanes,fr(r,a,b)}return Vm(r,a,c,m,b)}function p_(r,a,c,m){var b=m.children,y=r!==null?r.memoizedState:null;if(r===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),m.mode==="hidden"){if((a.flags&128)!==0){if(y=y!==null?y.baseLanes|c:c,r!==null){for(m=a.child=r.child,b=0;m!==null;)b=b|m.lanes|m.childLanes,m=m.sibling;m=b&~y}else m=0,a.child=null;return g_(r,a,y,c,m)}if((c&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},r!==null&&qu(a,y!==null?y.cachePool:null),y!==null?b1(a,y):ym(),v1(a);else return m=a.lanes=536870912,g_(r,a,y!==null?y.baseLanes|c:c,c,m)}else y!==null?(qu(a,y.cachePool),b1(a,y),Yr(),a.memoizedState=null):(r!==null&&qu(a,null),ym(),Yr());return Ks(r,a,b,c),a.child}function Zl(r,a){return r!==null&&r.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function g_(r,a,c,m,b){var y=pm();return y=y===null?null:{parent:bs._currentValue,pool:y},a.memoizedState={baseLanes:c,cachePool:y},r!==null&&qu(a,null),ym(),v1(a),r!==null&&To(r,a,m,!0),a.childLanes=b,null}function ad(r,a){return a=ld({mode:a.mode,children:a.children},r.mode),a.ref=r.ref,r.child=a,a.return=r,a}function x_(r,a,c){return Pa(a,r.child,null,c),r=ad(a,a.pendingProps),r.flags|=2,zn(a),a.memoizedState=null,r}function yA(r,a,c){var m=a.pendingProps,b=(a.flags&128)!==0;if(a.flags&=-129,r===null){if(yt){if(m.mode==="hidden")return r=ad(a,m),a.lanes=536870912,Zl(null,r);if(Sm(a),(r=Vt)?(r=Ay(r,ei),r=r!==null&&r.data==="&"?r:null,r!==null&&(a.memoizedState={dehydrated:r,treeContext:Hr!==null?{id:zi,overflow:Bi}:null,retryLane:536870912,hydrationErrors:null},c=e1(r),c.return=a,a.child=c,Gs=a,Vt=null)):r=null,r===null)throw Fr(a);return a.lanes=536870912,null}return ad(a,m)}var y=r.memoizedState;if(y!==null){var j=y.dehydrated;if(Sm(a),b)if(a.flags&256)a.flags&=-257,a=x_(r,a,c);else if(a.memoizedState!==null)a.child=r.child,a.flags|=128,a=null;else throw Error(n(558));else if(_s||To(r,a,c,!1),b=(c&r.childLanes)!==0,_s||b){if(m=$t,m!==null&&(j=cs(m,c),j!==0&&j!==y.retryLane))throw y.retryLane=j,Ta(r,j),Nn(m,r,j),qm;xd(),a=x_(r,a,c)}else r=y.treeContext,Vt=si(j.nextSibling),Gs=a,yt=!0,Ur=null,ei=!1,r!==null&&n1(a,r),a=ad(a,m),a.flags|=4096;return a}return r=or(r.child,{mode:m.mode,children:m.children}),r.ref=a.ref,a.child=r,r.return=a,r}function od(r,a){var c=a.ref;if(c===null)r!==null&&r.ref!==null&&(a.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(n(284));(r===null||r.ref!==c)&&(a.flags|=4194816)}}function Vm(r,a,c,m,b){return Oa(a),c=Nm(r,a,c,m,void 0,b),m=Cm(),r!==null&&!_s?(Em(r,a,b),fr(r,a,b)):(yt&&m&&am(a),a.flags|=1,Ks(r,a,c,b),a.child)}function b_(r,a,c,m,b,y){return Oa(a),a.updateQueue=null,c=y1(a,m,c,b),_1(r),m=Cm(),r!==null&&!_s?(Em(r,a,y),fr(r,a,y)):(yt&&m&&am(a),a.flags|=1,Ks(r,a,c,y),a.child)}function v_(r,a,c,m,b){if(Oa(a),a.stateNode===null){var y=Co,j=c.contextType;typeof j=="object"&&j!==null&&(y=Ws(j)),y=new c(m,y),a.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=Um,a.stateNode=y,y._reactInternals=a,y=a.stateNode,y.props=m,y.state=a.memoizedState,y.refs={},xm(a),j=c.contextType,y.context=typeof j=="object"&&j!==null?Ws(j):Co,y.state=a.memoizedState,j=c.getDerivedStateFromProps,typeof j=="function"&&(Hm(a,c,j,m),y.state=a.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(j=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),j!==y.state&&Um.enqueueReplaceState(y,y.state,null),Gl(a,m,y,b),Vl(),y.state=a.memoizedState),typeof y.componentDidMount=="function"&&(a.flags|=4194308),m=!0}else if(r===null){y=a.stateNode;var L=a.memoizedProps,Y=$a(c,L);y.props=Y;var ue=y.context,ve=c.contextType;j=Co,typeof ve=="object"&&ve!==null&&(j=Ws(ve));var Ce=c.getDerivedStateFromProps;ve=typeof Ce=="function"||typeof y.getSnapshotBeforeUpdate=="function",L=a.pendingProps!==L,ve||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(L||ue!==j)&&r_(a,y,m,j),Vr=!1;var de=a.memoizedState;y.state=de,Gl(a,m,y,b),Vl(),ue=a.memoizedState,L||de!==ue||Vr?(typeof Ce=="function"&&(Hm(a,c,Ce,m),ue=a.memoizedState),(Y=Vr||i_(a,c,Y,m,de,ue,j))?(ve||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(a.flags|=4194308)):(typeof y.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=m,a.memoizedState=ue),y.props=m,y.state=ue,y.context=j,m=Y):(typeof y.componentDidMount=="function"&&(a.flags|=4194308),m=!1)}else{y=a.stateNode,bm(r,a),j=a.memoizedProps,ve=$a(c,j),y.props=ve,Ce=a.pendingProps,de=y.context,ue=c.contextType,Y=Co,typeof ue=="object"&&ue!==null&&(Y=Ws(ue)),L=c.getDerivedStateFromProps,(ue=typeof L=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(j!==Ce||de!==Y)&&r_(a,y,m,Y),Vr=!1,de=a.memoizedState,y.state=de,Gl(a,m,y,b),Vl();var pe=a.memoizedState;j!==Ce||de!==pe||Vr||r!==null&&r.dependencies!==null&&Uu(r.dependencies)?(typeof L=="function"&&(Hm(a,c,L,m),pe=a.memoizedState),(ve=Vr||i_(a,c,ve,m,de,pe,Y)||r!==null&&r.dependencies!==null&&Uu(r.dependencies))?(ue||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(m,pe,Y),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(m,pe,Y)),typeof y.componentDidUpdate=="function"&&(a.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof y.componentDidUpdate!="function"||j===r.memoizedProps&&de===r.memoizedState||(a.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||j===r.memoizedProps&&de===r.memoizedState||(a.flags|=1024),a.memoizedProps=m,a.memoizedState=pe),y.props=m,y.state=pe,y.context=Y,m=ve):(typeof y.componentDidUpdate!="function"||j===r.memoizedProps&&de===r.memoizedState||(a.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||j===r.memoizedProps&&de===r.memoizedState||(a.flags|=1024),m=!1)}return y=m,od(r,a),m=(a.flags&128)!==0,y||m?(y=a.stateNode,c=m&&typeof c.getDerivedStateFromError!="function"?null:y.render(),a.flags|=1,r!==null&&m?(a.child=Pa(a,r.child,null,b),a.child=Pa(a,null,c,b)):Ks(r,a,c,b),a.memoizedState=y.state,r=a.child):r=fr(r,a,b),r}function __(r,a,c,m){return Ma(),a.flags|=256,Ks(r,a,c,m),a.child}var Gm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Wm(r){return{baseLanes:r,cachePool:c1()}}function Km(r,a,c){return r=r!==null?r.childLanes&~c:0,a&&(r|=Pn),r}function y_(r,a,c){var m=a.pendingProps,b=!1,y=(a.flags&128)!==0,j;if((j=y)||(j=r!==null&&r.memoizedState===null?!1:(hs.current&2)!==0),j&&(b=!0,a.flags&=-129),j=(a.flags&32)!==0,a.flags&=-33,r===null){if(yt){if(b?Kr(a):Yr(),(r=Vt)?(r=Ay(r,ei),r=r!==null&&r.data!=="&"?r:null,r!==null&&(a.memoizedState={dehydrated:r,treeContext:Hr!==null?{id:zi,overflow:Bi}:null,retryLane:536870912,hydrationErrors:null},c=e1(r),c.return=a,a.child=c,Gs=a,Vt=null)):r=null,r===null)throw Fr(a);return Tp(r)?a.lanes=32:a.lanes=536870912,null}var L=m.children;return m=m.fallback,b?(Yr(),b=a.mode,L=ld({mode:"hidden",children:L},b),m=Ra(m,b,c,null),L.return=a,m.return=a,L.sibling=m,a.child=L,m=a.child,m.memoizedState=Wm(c),m.childLanes=Km(r,j,c),a.memoizedState=Gm,Zl(null,m)):(Kr(a),Ym(a,L))}var Y=r.memoizedState;if(Y!==null&&(L=Y.dehydrated,L!==null)){if(y)a.flags&256?(Kr(a),a.flags&=-257,a=Xm(r,a,c)):a.memoizedState!==null?(Yr(),a.child=r.child,a.flags|=128,a=null):(Yr(),L=m.fallback,b=a.mode,m=ld({mode:"visible",children:m.children},b),L=Ra(L,b,c,null),L.flags|=2,m.return=a,L.return=a,m.sibling=L,a.child=m,Pa(a,r.child,null,c),m=a.child,m.memoizedState=Wm(c),m.childLanes=Km(r,j,c),a.memoizedState=Gm,a=Zl(null,m));else if(Kr(a),Tp(L)){if(j=L.nextSibling&&L.nextSibling.dataset,j)var ue=j.dgst;j=ue,m=Error(n(419)),m.stack="",m.digest=j,Il({value:m,source:null,stack:null}),a=Xm(r,a,c)}else if(_s||To(r,a,c,!1),j=(c&r.childLanes)!==0,_s||j){if(j=$t,j!==null&&(m=cs(j,c),m!==0&&m!==Y.retryLane))throw Y.retryLane=m,Ta(r,m),Nn(j,r,m),qm;Ap(L)||xd(),a=Xm(r,a,c)}else Ap(L)?(a.flags|=192,a.child=r.child,a=null):(r=Y.treeContext,Vt=si(L.nextSibling),Gs=a,yt=!0,Ur=null,ei=!1,r!==null&&n1(a,r),a=Ym(a,m.children),a.flags|=4096);return a}return b?(Yr(),L=m.fallback,b=a.mode,Y=r.child,ue=Y.sibling,m=or(Y,{mode:"hidden",children:m.children}),m.subtreeFlags=Y.subtreeFlags&65011712,ue!==null?L=or(ue,L):(L=Ra(L,b,c,null),L.flags|=2),L.return=a,m.return=a,m.sibling=L,a.child=m,Zl(null,m),m=a.child,L=r.child.memoizedState,L===null?L=Wm(c):(b=L.cachePool,b!==null?(Y=bs._currentValue,b=b.parent!==Y?{parent:Y,pool:Y}:b):b=c1(),L={baseLanes:L.baseLanes|c,cachePool:b}),m.memoizedState=L,m.childLanes=Km(r,j,c),a.memoizedState=Gm,Zl(r.child,m)):(Kr(a),c=r.child,r=c.sibling,c=or(c,{mode:"visible",children:m.children}),c.return=a,c.sibling=null,r!==null&&(j=a.deletions,j===null?(a.deletions=[r],a.flags|=16):j.push(r)),a.child=c,a.memoizedState=null,c)}function Ym(r,a){return a=ld({mode:"visible",children:a},r.mode),a.return=r,r.child=a}function ld(r,a){return r=On(22,r,null,a),r.lanes=0,r}function Xm(r,a,c){return Pa(a,r.child,null,c),r=Ym(a,a.pendingProps.children),r.flags|=2,a.memoizedState=null,r}function w_(r,a,c){r.lanes|=a;var m=r.alternate;m!==null&&(m.lanes|=a),dm(r.return,a,c)}function Zm(r,a,c,m,b,y){var j=r.memoizedState;j===null?r.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:m,tail:c,tailMode:b,treeForkCount:y}:(j.isBackwards=a,j.rendering=null,j.renderingStartTime=0,j.last=m,j.tail=c,j.tailMode=b,j.treeForkCount=y)}function S_(r,a,c){var m=a.pendingProps,b=m.revealOrder,y=m.tail;m=m.children;var j=hs.current,L=(j&2)!==0;if(L?(j=j&1|2,a.flags|=128):j&=1,le(hs,j),Ks(r,a,m,c),m=yt?Pl:0,!L&&r!==null&&(r.flags&128)!==0)e:for(r=a.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&w_(r,c,a);else if(r.tag===19)w_(r,c,a);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===a)break e;for(;r.sibling===null;){if(r.return===null||r.return===a)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}switch(b){case"forwards":for(c=a.child,b=null;c!==null;)r=c.alternate,r!==null&&Xu(r)===null&&(b=c),c=c.sibling;c=b,c===null?(b=a.child,a.child=null):(b=c.sibling,c.sibling=null),Zm(a,!1,b,c,y,m);break;case"backwards":case"unstable_legacy-backwards":for(c=null,b=a.child,a.child=null;b!==null;){if(r=b.alternate,r!==null&&Xu(r)===null){a.child=b;break}r=b.sibling,b.sibling=c,c=b,b=r}Zm(a,!0,c,null,y,m);break;case"together":Zm(a,!1,null,null,void 0,m);break;default:a.memoizedState=null}return a.child}function fr(r,a,c){if(r!==null&&(a.dependencies=r.dependencies),Qr|=a.lanes,(c&a.childLanes)===0)if(r!==null){if(To(r,a,c,!1),(c&a.childLanes)===0)return null}else return null;if(r!==null&&a.child!==r.child)throw Error(n(153));if(a.child!==null){for(r=a.child,c=or(r,r.pendingProps),a.child=c,c.return=a;r.sibling!==null;)r=r.sibling,c=c.sibling=or(r,r.pendingProps),c.return=a;c.sibling=null}return a.child}function Qm(r,a){return(r.lanes&a)!==0?!0:(r=r.dependencies,!!(r!==null&&Uu(r)))}function wA(r,a,c){switch(a.tag){case 3:Me(a,a.stateNode.containerInfo),qr(a,bs,r.memoizedState.cache),Ma();break;case 27:case 5:Je(a);break;case 4:Me(a,a.stateNode.containerInfo);break;case 10:qr(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Sm(a),null;break;case 13:var m=a.memoizedState;if(m!==null)return m.dehydrated!==null?(Kr(a),a.flags|=128,null):(c&a.child.childLanes)!==0?y_(r,a,c):(Kr(a),r=fr(r,a,c),r!==null?r.sibling:null);Kr(a);break;case 19:var b=(r.flags&128)!==0;if(m=(c&a.childLanes)!==0,m||(To(r,a,c,!1),m=(c&a.childLanes)!==0),b){if(m)return S_(r,a,c);a.flags|=128}if(b=a.memoizedState,b!==null&&(b.rendering=null,b.tail=null,b.lastEffect=null),le(hs,hs.current),m)break;return null;case 22:return a.lanes=0,p_(r,a,c,a.pendingProps);case 24:qr(a,bs,r.memoizedState.cache)}return fr(r,a,c)}function k_(r,a,c){if(r!==null)if(r.memoizedProps!==a.pendingProps)_s=!0;else{if(!Qm(r,c)&&(a.flags&128)===0)return _s=!1,wA(r,a,c);_s=(r.flags&131072)!==0}else _s=!1,yt&&(a.flags&1048576)!==0&&s1(a,Pl,a.index);switch(a.lanes=0,a.tag){case 16:e:{var m=a.pendingProps;if(r=za(a.elementType),a.type=r,typeof r=="function")nm(r)?(m=$a(r,m),a.tag=1,a=v_(null,a,r,m,c)):(a.tag=0,a=Vm(null,a,r,m,c));else{if(r!=null){var b=r.$$typeof;if(b===C){a.tag=11,a=h_(null,a,r,m,c);break e}else if(b===$){a.tag=14,a=f_(null,a,r,m,c);break e}}throw a=U(r)||r,Error(n(306,a,""))}}return a;case 0:return Vm(r,a,a.type,a.pendingProps,c);case 1:return m=a.type,b=$a(m,a.pendingProps),v_(r,a,m,b,c);case 3:e:{if(Me(a,a.stateNode.containerInfo),r===null)throw Error(n(387));m=a.pendingProps;var y=a.memoizedState;b=y.element,bm(r,a),Gl(a,m,null,c);var j=a.memoizedState;if(m=j.cache,qr(a,bs,m),m!==y.cache&&hm(a,[bs],c,!0),Vl(),m=j.element,y.isDehydrated)if(y={element:m,isDehydrated:!1,cache:j.cache},a.updateQueue.baseState=y,a.memoizedState=y,a.flags&256){a=__(r,a,m,c);break e}else if(m!==b){b=Zn(Error(n(424)),a),Il(b),a=__(r,a,m,c);break e}else for(r=a.stateNode.containerInfo,r.nodeType===9?r=r.body:r=r.nodeName==="HTML"?r.ownerDocument.body:r,Vt=si(r.firstChild),Gs=a,yt=!0,Ur=null,ei=!0,c=p1(a,null,m,c),a.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(Ma(),m===b){a=fr(r,a,c);break e}Ks(r,a,m,c)}a=a.child}return a;case 26:return od(r,a),r===null?(c=Ly(a.type,null,a.pendingProps,null))?a.memoizedState=c:yt||(c=a.type,r=a.pendingProps,m=kd(ie.current).createElement(c),m[us]=a,m[Js]=r,Ys(m,c,r),gs(m),a.stateNode=m):a.memoizedState=Ly(a.type,r.memoizedProps,a.pendingProps,r.memoizedState),null;case 27:return Je(a),r===null&&yt&&(m=a.stateNode=My(a.type,a.pendingProps,ie.current),Gs=a,ei=!0,b=Vt,na(a.type)?(Rp=b,Vt=si(m.firstChild)):Vt=b),Ks(r,a,a.pendingProps.children,c),od(r,a),r===null&&(a.flags|=4194304),a.child;case 5:return r===null&&yt&&((b=m=Vt)&&(m=QA(m,a.type,a.pendingProps,ei),m!==null?(a.stateNode=m,Gs=a,Vt=si(m.firstChild),ei=!1,b=!0):b=!1),b||Fr(a)),Je(a),b=a.type,y=a.pendingProps,j=r!==null?r.memoizedProps:null,m=y.children,Cp(b,y)?m=null:j!==null&&Cp(b,j)&&(a.flags|=32),a.memoizedState!==null&&(b=Nm(r,a,fA,null,null,c),hc._currentValue=b),od(r,a),Ks(r,a,m,c),a.child;case 6:return r===null&&yt&&((r=c=Vt)&&(c=JA(c,a.pendingProps,ei),c!==null?(a.stateNode=c,Gs=a,Vt=null,r=!0):r=!1),r||Fr(a)),null;case 13:return y_(r,a,c);case 4:return Me(a,a.stateNode.containerInfo),m=a.pendingProps,r===null?a.child=Pa(a,null,m,c):Ks(r,a,m,c),a.child;case 11:return h_(r,a,a.type,a.pendingProps,c);case 7:return Ks(r,a,a.pendingProps,c),a.child;case 8:return Ks(r,a,a.pendingProps.children,c),a.child;case 12:return Ks(r,a,a.pendingProps.children,c),a.child;case 10:return m=a.pendingProps,qr(a,a.type,m.value),Ks(r,a,m.children,c),a.child;case 9:return b=a.type._context,m=a.pendingProps.children,Oa(a),b=Ws(b),m=m(b),a.flags|=1,Ks(r,a,m,c),a.child;case 14:return f_(r,a,a.type,a.pendingProps,c);case 15:return m_(r,a,a.type,a.pendingProps,c);case 19:return S_(r,a,c);case 31:return yA(r,a,c);case 22:return p_(r,a,c,a.pendingProps);case 24:return Oa(a),m=Ws(bs),r===null?(b=pm(),b===null&&(b=$t,y=fm(),b.pooledCache=y,y.refCount++,y!==null&&(b.pooledCacheLanes|=c),b=y),a.memoizedState={parent:m,cache:b},xm(a),qr(a,bs,b)):((r.lanes&c)!==0&&(bm(r,a),Gl(a,null,null,c),Vl()),b=r.memoizedState,y=a.memoizedState,b.parent!==m?(b={parent:m,cache:m},a.memoizedState=b,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=b),qr(a,bs,m)):(m=y.cache,qr(a,bs,m),m!==b.cache&&hm(a,[bs],c,!0))),Ks(r,a,a.pendingProps.children,c),a.child;case 29:throw a.pendingProps}throw Error(n(156,a.tag))}function mr(r){r.flags|=4}function Jm(r,a,c,m,b){if((a=(r.mode&32)!==0)&&(a=!1),a){if(r.flags|=16777216,(b&335544128)===b)if(r.stateNode.complete)r.flags|=8192;else if(Z_())r.flags|=8192;else throw Ba=Gu,gm}else r.flags&=-16777217}function N_(r,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!$y(a))if(Z_())r.flags|=8192;else throw Ba=Gu,gm}function cd(r,a){a!==null&&(r.flags|=4),r.flags&16384&&(a=r.tag!==22?Pe():536870912,r.lanes|=a,Uo|=a)}function Ql(r,a){if(!yt)switch(r.tailMode){case"hidden":a=r.tail;for(var c=null;a!==null;)a.alternate!==null&&(c=a),a=a.sibling;c===null?r.tail=null:c.sibling=null;break;case"collapsed":c=r.tail;for(var m=null;c!==null;)c.alternate!==null&&(m=c),c=c.sibling;m===null?a||r.tail===null?r.tail=null:r.tail.sibling=null:m.sibling=null}}function Gt(r){var a=r.alternate!==null&&r.alternate.child===r.child,c=0,m=0;if(a)for(var b=r.child;b!==null;)c|=b.lanes|b.childLanes,m|=b.subtreeFlags&65011712,m|=b.flags&65011712,b.return=r,b=b.sibling;else for(b=r.child;b!==null;)c|=b.lanes|b.childLanes,m|=b.subtreeFlags,m|=b.flags,b.return=r,b=b.sibling;return r.subtreeFlags|=m,r.childLanes=c,a}function SA(r,a,c){var m=a.pendingProps;switch(om(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Gt(a),null;case 1:return Gt(a),null;case 3:return c=a.stateNode,m=null,r!==null&&(m=r.memoizedState.cache),a.memoizedState.cache!==m&&(a.flags|=2048),ur(bs),De(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(r===null||r.child===null)&&(Ao(a)?mr(a):r===null||r.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,cm())),Gt(a),null;case 26:var b=a.type,y=a.memoizedState;return r===null?(mr(a),y!==null?(Gt(a),N_(a,y)):(Gt(a),Jm(a,b,null,m,c))):y?y!==r.memoizedState?(mr(a),Gt(a),N_(a,y)):(Gt(a),a.flags&=-16777217):(r=r.memoizedProps,r!==m&&mr(a),Gt(a),Jm(a,b,r,m,c)),null;case 27:if(Ne(a),c=ie.current,b=a.type,r!==null&&a.stateNode!=null)r.memoizedProps!==m&&mr(a);else{if(!m){if(a.stateNode===null)throw Error(n(166));return Gt(a),null}r=ee.current,Ao(a)?i1(a):(r=My(b,m,c),a.stateNode=r,mr(a))}return Gt(a),null;case 5:if(Ne(a),b=a.type,r!==null&&a.stateNode!=null)r.memoizedProps!==m&&mr(a);else{if(!m){if(a.stateNode===null)throw Error(n(166));return Gt(a),null}if(y=ee.current,Ao(a))i1(a);else{var j=kd(ie.current);switch(y){case 1:y=j.createElementNS("http://www.w3.org/2000/svg",b);break;case 2:y=j.createElementNS("http://www.w3.org/1998/Math/MathML",b);break;default:switch(b){case"svg":y=j.createElementNS("http://www.w3.org/2000/svg",b);break;case"math":y=j.createElementNS("http://www.w3.org/1998/Math/MathML",b);break;case"script":y=j.createElement("div"),y.innerHTML="<script><\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof m.is=="string"?j.createElement("select",{is:m.is}):j.createElement("select"),m.multiple?y.multiple=!0:m.size&&(y.size=m.size);break;default:y=typeof m.is=="string"?j.createElement(b,{is:m.is}):j.createElement(b)}}y[us]=a,y[Js]=m;e:for(j=a.child;j!==null;){if(j.tag===5||j.tag===6)y.appendChild(j.stateNode);else if(j.tag!==4&&j.tag!==27&&j.child!==null){j.child.return=j,j=j.child;continue}if(j===a)break e;for(;j.sibling===null;){if(j.return===null||j.return===a)break e;j=j.return}j.sibling.return=j.return,j=j.sibling}a.stateNode=y;e:switch(Ys(y,b,m),b){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}m&&mr(a)}}return Gt(a),Jm(a,a.type,r===null?null:r.memoizedProps,a.pendingProps,c),null;case 6:if(r&&a.stateNode!=null)r.memoizedProps!==m&&mr(a);else{if(typeof m!="string"&&a.stateNode===null)throw Error(n(166));if(r=ie.current,Ao(a)){if(r=a.stateNode,c=a.memoizedProps,m=null,b=Gs,b!==null)switch(b.tag){case 27:case 5:m=b.memoizedProps}r[us]=a,r=!!(r.nodeValue===c||m!==null&&m.suppressHydrationWarning===!0||yy(r.nodeValue,c)),r||Fr(a,!0)}else r=kd(r).createTextNode(m),r[us]=a,a.stateNode=r}return Gt(a),null;case 31:if(c=a.memoizedState,r===null||r.memoizedState!==null){if(m=Ao(a),c!==null){if(r===null){if(!m)throw Error(n(318));if(r=a.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(n(557));r[us]=a}else Ma(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Gt(a),r=!1}else c=cm(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=c),r=!0;if(!r)return a.flags&256?(zn(a),a):(zn(a),null);if((a.flags&128)!==0)throw Error(n(558))}return Gt(a),null;case 13:if(m=a.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(b=Ao(a),m!==null&&m.dehydrated!==null){if(r===null){if(!b)throw Error(n(318));if(b=a.memoizedState,b=b!==null?b.dehydrated:null,!b)throw Error(n(317));b[us]=a}else Ma(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Gt(a),b=!1}else b=cm(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=b),b=!0;if(!b)return a.flags&256?(zn(a),a):(zn(a),null)}return zn(a),(a.flags&128)!==0?(a.lanes=c,a):(c=m!==null,r=r!==null&&r.memoizedState!==null,c&&(m=a.child,b=null,m.alternate!==null&&m.alternate.memoizedState!==null&&m.alternate.memoizedState.cachePool!==null&&(b=m.alternate.memoizedState.cachePool.pool),y=null,m.memoizedState!==null&&m.memoizedState.cachePool!==null&&(y=m.memoizedState.cachePool.pool),y!==b&&(m.flags|=2048)),c!==r&&c&&(a.child.flags|=8192),cd(a,a.updateQueue),Gt(a),null);case 4:return De(),r===null&&yp(a.stateNode.containerInfo),Gt(a),null;case 10:return ur(a.type),Gt(a),null;case 19:if(q(hs),m=a.memoizedState,m===null)return Gt(a),null;if(b=(a.flags&128)!==0,y=m.rendering,y===null)if(b)Ql(m,!1);else{if(ns!==0||r!==null&&(r.flags&128)!==0)for(r=a.child;r!==null;){if(y=Xu(r),y!==null){for(a.flags|=128,Ql(m,!1),r=y.updateQueue,a.updateQueue=r,cd(a,r),a.subtreeFlags=0,r=c,c=a.child;c!==null;)Jv(c,r),c=c.sibling;return le(hs,hs.current&1|2),yt&&lr(a,m.treeForkCount),a.child}r=r.sibling}m.tail!==null&&It()>md&&(a.flags|=128,b=!0,Ql(m,!1),a.lanes=4194304)}else{if(!b)if(r=Xu(y),r!==null){if(a.flags|=128,b=!0,r=r.updateQueue,a.updateQueue=r,cd(a,r),Ql(m,!0),m.tail===null&&m.tailMode==="hidden"&&!y.alternate&&!yt)return Gt(a),null}else 2*It()-m.renderingStartTime>md&&c!==536870912&&(a.flags|=128,b=!0,Ql(m,!1),a.lanes=4194304);m.isBackwards?(y.sibling=a.child,a.child=y):(r=m.last,r!==null?r.sibling=y:a.child=y,m.last=y)}return m.tail!==null?(r=m.tail,m.rendering=r,m.tail=r.sibling,m.renderingStartTime=It(),r.sibling=null,c=hs.current,le(hs,b?c&1|2:c&1),yt&&lr(a,m.treeForkCount),r):(Gt(a),null);case 22:case 23:return zn(a),wm(),m=a.memoizedState!==null,r!==null?r.memoizedState!==null!==m&&(a.flags|=8192):m&&(a.flags|=8192),m?(c&536870912)!==0&&(a.flags&128)===0&&(Gt(a),a.subtreeFlags&6&&(a.flags|=8192)):Gt(a),c=a.updateQueue,c!==null&&cd(a,c.retryQueue),c=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),m=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(m=a.memoizedState.cachePool.pool),m!==c&&(a.flags|=2048),r!==null&&q(La),null;case 24:return c=null,r!==null&&(c=r.memoizedState.cache),a.memoizedState.cache!==c&&(a.flags|=2048),ur(bs),Gt(a),null;case 25:return null;case 30:return null}throw Error(n(156,a.tag))}function kA(r,a){switch(om(a),a.tag){case 1:return r=a.flags,r&65536?(a.flags=r&-65537|128,a):null;case 3:return ur(bs),De(),r=a.flags,(r&65536)!==0&&(r&128)===0?(a.flags=r&-65537|128,a):null;case 26:case 27:case 5:return Ne(a),null;case 31:if(a.memoizedState!==null){if(zn(a),a.alternate===null)throw Error(n(340));Ma()}return r=a.flags,r&65536?(a.flags=r&-65537|128,a):null;case 13:if(zn(a),r=a.memoizedState,r!==null&&r.dehydrated!==null){if(a.alternate===null)throw Error(n(340));Ma()}return r=a.flags,r&65536?(a.flags=r&-65537|128,a):null;case 19:return q(hs),null;case 4:return De(),null;case 10:return ur(a.type),null;case 22:case 23:return zn(a),wm(),r!==null&&q(La),r=a.flags,r&65536?(a.flags=r&-65537|128,a):null;case 24:return ur(bs),null;case 25:return null;default:return null}}function C_(r,a){switch(om(a),a.tag){case 3:ur(bs),De();break;case 26:case 27:case 5:Ne(a);break;case 4:De();break;case 31:a.memoizedState!==null&&zn(a);break;case 13:zn(a);break;case 19:q(hs);break;case 10:ur(a.type);break;case 22:case 23:zn(a),wm(),r!==null&&q(La);break;case 24:ur(bs)}}function Jl(r,a){try{var c=a.updateQueue,m=c!==null?c.lastEffect:null;if(m!==null){var b=m.next;c=b;do{if((c.tag&r)===r){m=void 0;var y=c.create,j=c.inst;m=y(),j.destroy=m}c=c.next}while(c!==b)}}catch(L){Dt(a,a.return,L)}}function Xr(r,a,c){try{var m=a.updateQueue,b=m!==null?m.lastEffect:null;if(b!==null){var y=b.next;m=y;do{if((m.tag&r)===r){var j=m.inst,L=j.destroy;if(L!==void 0){j.destroy=void 0,b=a;var Y=c,ue=L;try{ue()}catch(ve){Dt(b,Y,ve)}}}m=m.next}while(m!==y)}}catch(ve){Dt(a,a.return,ve)}}function E_(r){var a=r.updateQueue;if(a!==null){var c=r.stateNode;try{x1(a,c)}catch(m){Dt(r,r.return,m)}}}function j_(r,a,c){c.props=$a(r.type,r.memoizedProps),c.state=r.memoizedState;try{c.componentWillUnmount()}catch(m){Dt(r,a,m)}}function ec(r,a){try{var c=r.ref;if(c!==null){switch(r.tag){case 26:case 27:case 5:var m=r.stateNode;break;case 30:m=r.stateNode;break;default:m=r.stateNode}typeof c=="function"?r.refCleanup=c(m):c.current=m}}catch(b){Dt(r,a,b)}}function Pi(r,a){var c=r.ref,m=r.refCleanup;if(c!==null)if(typeof m=="function")try{m()}catch(b){Dt(r,a,b)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(b){Dt(r,a,b)}else c.current=null}function A_(r){var a=r.type,c=r.memoizedProps,m=r.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":c.autoFocus&&m.focus();break e;case"img":c.src?m.src=c.src:c.srcSet&&(m.srcset=c.srcSet)}}catch(b){Dt(r,r.return,b)}}function ep(r,a,c){try{var m=r.stateNode;GA(m,r.type,c,a),m[Js]=a}catch(b){Dt(r,r.return,b)}}function T_(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&na(r.type)||r.tag===4}function tp(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||T_(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.tag===27&&na(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function sp(r,a,c){var m=r.tag;if(m===5||m===6)r=r.stateNode,a?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(r,a):(a=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,a.appendChild(r),c=c._reactRootContainer,c!=null||a.onclick!==null||(a.onclick=Ie));else if(m!==4&&(m===27&&na(r.type)&&(c=r.stateNode,a=null),r=r.child,r!==null))for(sp(r,a,c),r=r.sibling;r!==null;)sp(r,a,c),r=r.sibling}function ud(r,a,c){var m=r.tag;if(m===5||m===6)r=r.stateNode,a?c.insertBefore(r,a):c.appendChild(r);else if(m!==4&&(m===27&&na(r.type)&&(c=r.stateNode),r=r.child,r!==null))for(ud(r,a,c),r=r.sibling;r!==null;)ud(r,a,c),r=r.sibling}function R_(r){var a=r.stateNode,c=r.memoizedProps;try{for(var m=r.type,b=a.attributes;b.length;)a.removeAttributeNode(b[0]);Ys(a,m,c),a[us]=r,a[Js]=c}catch(y){Dt(r,r.return,y)}}var pr=!1,ys=!1,np=!1,M_=typeof WeakSet=="function"?WeakSet:Set,Bs=null;function NA(r,a){if(r=r.containerInfo,kp=Rd,r=qv(r),Xf(r)){if("selectionStart"in r)var c={start:r.selectionStart,end:r.selectionEnd};else e:{c=(c=r.ownerDocument)&&c.defaultView||window;var m=c.getSelection&&c.getSelection();if(m&&m.rangeCount!==0){c=m.anchorNode;var b=m.anchorOffset,y=m.focusNode;m=m.focusOffset;try{c.nodeType,y.nodeType}catch{c=null;break e}var j=0,L=-1,Y=-1,ue=0,ve=0,Ce=r,de=null;t:for(;;){for(var pe;Ce!==c||b!==0&&Ce.nodeType!==3||(L=j+b),Ce!==y||m!==0&&Ce.nodeType!==3||(Y=j+m),Ce.nodeType===3&&(j+=Ce.nodeValue.length),(pe=Ce.firstChild)!==null;)de=Ce,Ce=pe;for(;;){if(Ce===r)break t;if(de===c&&++ue===b&&(L=j),de===y&&++ve===m&&(Y=j),(pe=Ce.nextSibling)!==null)break;Ce=de,de=Ce.parentNode}Ce=pe}c=L===-1||Y===-1?null:{start:L,end:Y}}else c=null}c=c||{start:0,end:0}}else c=null;for(Np={focusedElem:r,selectionRange:c},Rd=!1,Bs=a;Bs!==null;)if(a=Bs,r=a.child,(a.subtreeFlags&1028)!==0&&r!==null)r.return=a,Bs=r;else for(;Bs!==null;){switch(a=Bs,y=a.alternate,r=a.flags,a.tag){case 0:if((r&4)!==0&&(r=a.updateQueue,r=r!==null?r.events:null,r!==null))for(c=0;c<r.length;c++)b=r[c],b.ref.impl=b.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&y!==null){r=void 0,c=a,b=y.memoizedProps,y=y.memoizedState,m=c.stateNode;try{var Ke=$a(c.type,b);r=m.getSnapshotBeforeUpdate(Ke,y),m.__reactInternalSnapshotBeforeUpdate=r}catch(st){Dt(c,c.return,st)}}break;case 3:if((r&1024)!==0){if(r=a.stateNode.containerInfo,c=r.nodeType,c===9)jp(r);else if(c===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":jp(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((r&1024)!==0)throw Error(n(163))}if(r=a.sibling,r!==null){r.return=a.return,Bs=r;break}Bs=a.return}}function D_(r,a,c){var m=c.flags;switch(c.tag){case 0:case 11:case 15:xr(r,c),m&4&&Jl(5,c);break;case 1:if(xr(r,c),m&4)if(r=c.stateNode,a===null)try{r.componentDidMount()}catch(j){Dt(c,c.return,j)}else{var b=$a(c.type,a.memoizedProps);a=a.memoizedState;try{r.componentDidUpdate(b,a,r.__reactInternalSnapshotBeforeUpdate)}catch(j){Dt(c,c.return,j)}}m&64&&E_(c),m&512&&ec(c,c.return);break;case 3:if(xr(r,c),m&64&&(r=c.updateQueue,r!==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{x1(r,a)}catch(j){Dt(c,c.return,j)}}break;case 27:a===null&&m&4&&R_(c);case 26:case 5:xr(r,c),a===null&&m&4&&A_(c),m&512&&ec(c,c.return);break;case 12:xr(r,c);break;case 31:xr(r,c),m&4&&z_(r,c);break;case 13:xr(r,c),m&4&&B_(r,c),m&64&&(r=c.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(c=OA.bind(null,c),eT(r,c))));break;case 22:if(m=c.memoizedState!==null||pr,!m){a=a!==null&&a.memoizedState!==null||ys,b=pr;var y=ys;pr=m,(ys=a)&&!y?br(r,c,(c.subtreeFlags&8772)!==0):xr(r,c),pr=b,ys=y}break;case 30:break;default:xr(r,c)}}function O_(r){var a=r.alternate;a!==null&&(r.alternate=null,O_(a)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(a=r.stateNode,a!==null&&kl(a)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}var Zt=null,yn=!1;function gr(r,a,c){for(c=c.child;c!==null;)L_(r,a,c),c=c.sibling}function L_(r,a,c){if(he&&typeof he.onCommitFiberUnmount=="function")try{he.onCommitFiberUnmount(ye,c)}catch{}switch(c.tag){case 26:ys||Pi(c,a),gr(r,a,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:ys||Pi(c,a);var m=Zt,b=yn;na(c.type)&&(Zt=c.stateNode,yn=!1),gr(r,a,c),cc(c.stateNode),Zt=m,yn=b;break;case 5:ys||Pi(c,a);case 6:if(m=Zt,b=yn,Zt=null,gr(r,a,c),Zt=m,yn=b,Zt!==null)if(yn)try{(Zt.nodeType===9?Zt.body:Zt.nodeName==="HTML"?Zt.ownerDocument.body:Zt).removeChild(c.stateNode)}catch(y){Dt(c,a,y)}else try{Zt.removeChild(c.stateNode)}catch(y){Dt(c,a,y)}break;case 18:Zt!==null&&(yn?(r=Zt,Ey(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,c.stateNode),Xo(r)):Ey(Zt,c.stateNode));break;case 4:m=Zt,b=yn,Zt=c.stateNode.containerInfo,yn=!0,gr(r,a,c),Zt=m,yn=b;break;case 0:case 11:case 14:case 15:Xr(2,c,a),ys||Xr(4,c,a),gr(r,a,c);break;case 1:ys||(Pi(c,a),m=c.stateNode,typeof m.componentWillUnmount=="function"&&j_(c,a,m)),gr(r,a,c);break;case 21:gr(r,a,c);break;case 22:ys=(m=ys)||c.memoizedState!==null,gr(r,a,c),ys=m;break;default:gr(r,a,c)}}function z_(r,a){if(a.memoizedState===null&&(r=a.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{Xo(r)}catch(c){Dt(a,a.return,c)}}}function B_(r,a){if(a.memoizedState===null&&(r=a.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{Xo(r)}catch(c){Dt(a,a.return,c)}}function CA(r){switch(r.tag){case 31:case 13:case 19:var a=r.stateNode;return a===null&&(a=r.stateNode=new M_),a;case 22:return r=r.stateNode,a=r._retryCache,a===null&&(a=r._retryCache=new M_),a;default:throw Error(n(435,r.tag))}}function dd(r,a){var c=CA(r);a.forEach(function(m){if(!c.has(m)){c.add(m);var b=LA.bind(null,r,m);m.then(b,b)}})}function wn(r,a){var c=a.deletions;if(c!==null)for(var m=0;m<c.length;m++){var b=c[m],y=r,j=a,L=j;e:for(;L!==null;){switch(L.tag){case 27:if(na(L.type)){Zt=L.stateNode,yn=!1;break e}break;case 5:Zt=L.stateNode,yn=!1;break e;case 3:case 4:Zt=L.stateNode.containerInfo,yn=!0;break e}L=L.return}if(Zt===null)throw Error(n(160));L_(y,j,b),Zt=null,yn=!1,y=b.alternate,y!==null&&(y.return=null),b.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)P_(a,r),a=a.sibling}var wi=null;function P_(r,a){var c=r.alternate,m=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:wn(a,r),Sn(r),m&4&&(Xr(3,r,r.return),Jl(3,r),Xr(5,r,r.return));break;case 1:wn(a,r),Sn(r),m&512&&(ys||c===null||Pi(c,c.return)),m&64&&pr&&(r=r.updateQueue,r!==null&&(m=r.callbacks,m!==null&&(c=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=c===null?m:c.concat(m))));break;case 26:var b=wi;if(wn(a,r),Sn(r),m&512&&(ys||c===null||Pi(c,c.return)),m&4){var y=c!==null?c.memoizedState:null;if(m=r.memoizedState,c===null)if(m===null)if(r.stateNode===null){e:{m=r.type,c=r.memoizedProps,b=b.ownerDocument||b;t:switch(m){case"title":y=b.getElementsByTagName("title")[0],(!y||y[ka]||y[us]||y.namespaceURI==="http://www.w3.org/2000/svg"||y.hasAttribute("itemprop"))&&(y=b.createElement(m),b.head.insertBefore(y,b.querySelector("head > title"))),Ys(y,m,c),y[us]=r,gs(y),m=y;break e;case"link":var j=Py("link","href",b).get(m+(c.href||""));if(j){for(var L=0;L<j.length;L++)if(y=j[L],y.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&y.getAttribute("rel")===(c.rel==null?null:c.rel)&&y.getAttribute("title")===(c.title==null?null:c.title)&&y.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){j.splice(L,1);break t}}y=b.createElement(m),Ys(y,m,c),b.head.appendChild(y);break;case"meta":if(j=Py("meta","content",b).get(m+(c.content||""))){for(L=0;L<j.length;L++)if(y=j[L],y.getAttribute("content")===(c.content==null?null:""+c.content)&&y.getAttribute("name")===(c.name==null?null:c.name)&&y.getAttribute("property")===(c.property==null?null:c.property)&&y.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&y.getAttribute("charset")===(c.charSet==null?null:c.charSet)){j.splice(L,1);break t}}y=b.createElement(m),Ys(y,m,c),b.head.appendChild(y);break;default:throw Error(n(468,m))}y[us]=r,gs(y),m=y}r.stateNode=m}else Iy(b,r.type,r.stateNode);else r.stateNode=By(b,m,r.memoizedProps);else y!==m?(y===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):y.count--,m===null?Iy(b,r.type,r.stateNode):By(b,m,r.memoizedProps)):m===null&&r.stateNode!==null&&ep(r,r.memoizedProps,c.memoizedProps)}break;case 27:wn(a,r),Sn(r),m&512&&(ys||c===null||Pi(c,c.return)),c!==null&&m&4&&ep(r,r.memoizedProps,c.memoizedProps);break;case 5:if(wn(a,r),Sn(r),m&512&&(ys||c===null||Pi(c,c.return)),r.flags&32){b=r.stateNode;try{nt(b,"")}catch(Ke){Dt(r,r.return,Ke)}}m&4&&r.stateNode!=null&&(b=r.memoizedProps,ep(r,b,c!==null?c.memoizedProps:b)),m&1024&&(np=!0);break;case 6:if(wn(a,r),Sn(r),m&4){if(r.stateNode===null)throw Error(n(162));m=r.memoizedProps,c=r.stateNode;try{c.nodeValue=m}catch(Ke){Dt(r,r.return,Ke)}}break;case 3:if(Ed=null,b=wi,wi=Nd(a.containerInfo),wn(a,r),wi=b,Sn(r),m&4&&c!==null&&c.memoizedState.isDehydrated)try{Xo(a.containerInfo)}catch(Ke){Dt(r,r.return,Ke)}np&&(np=!1,I_(r));break;case 4:m=wi,wi=Nd(r.stateNode.containerInfo),wn(a,r),Sn(r),wi=m;break;case 12:wn(a,r),Sn(r);break;case 31:wn(a,r),Sn(r),m&4&&(m=r.updateQueue,m!==null&&(r.updateQueue=null,dd(r,m)));break;case 13:wn(a,r),Sn(r),r.child.flags&8192&&r.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(fd=It()),m&4&&(m=r.updateQueue,m!==null&&(r.updateQueue=null,dd(r,m)));break;case 22:b=r.memoizedState!==null;var Y=c!==null&&c.memoizedState!==null,ue=pr,ve=ys;if(pr=ue||b,ys=ve||Y,wn(a,r),ys=ve,pr=ue,Sn(r),m&8192)e:for(a=r.stateNode,a._visibility=b?a._visibility&-2:a._visibility|1,b&&(c===null||Y||pr||ys||Ha(r)),c=null,a=r;;){if(a.tag===5||a.tag===26){if(c===null){Y=c=a;try{if(y=Y.stateNode,b)j=y.style,typeof j.setProperty=="function"?j.setProperty("display","none","important"):j.display="none";else{L=Y.stateNode;var Ce=Y.memoizedProps.style,de=Ce!=null&&Ce.hasOwnProperty("display")?Ce.display:null;L.style.display=de==null||typeof de=="boolean"?"":(""+de).trim()}}catch(Ke){Dt(Y,Y.return,Ke)}}}else if(a.tag===6){if(c===null){Y=a;try{Y.stateNode.nodeValue=b?"":Y.memoizedProps}catch(Ke){Dt(Y,Y.return,Ke)}}}else if(a.tag===18){if(c===null){Y=a;try{var pe=Y.stateNode;b?jy(pe,!0):jy(Y.stateNode,!1)}catch(Ke){Dt(Y,Y.return,Ke)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===r)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===r)break e;for(;a.sibling===null;){if(a.return===null||a.return===r)break e;c===a&&(c=null),a=a.return}c===a&&(c=null),a.sibling.return=a.return,a=a.sibling}m&4&&(m=r.updateQueue,m!==null&&(c=m.retryQueue,c!==null&&(m.retryQueue=null,dd(r,c))));break;case 19:wn(a,r),Sn(r),m&4&&(m=r.updateQueue,m!==null&&(r.updateQueue=null,dd(r,m)));break;case 30:break;case 21:break;default:wn(a,r),Sn(r)}}function Sn(r){var a=r.flags;if(a&2){try{for(var c,m=r.return;m!==null;){if(T_(m)){c=m;break}m=m.return}if(c==null)throw Error(n(160));switch(c.tag){case 27:var b=c.stateNode,y=tp(r);ud(r,y,b);break;case 5:var j=c.stateNode;c.flags&32&&(nt(j,""),c.flags&=-33);var L=tp(r);ud(r,L,j);break;case 3:case 4:var Y=c.stateNode.containerInfo,ue=tp(r);sp(r,ue,Y);break;default:throw Error(n(161))}}catch(ve){Dt(r,r.return,ve)}r.flags&=-3}a&4096&&(r.flags&=-4097)}function I_(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var a=r;I_(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),r=r.sibling}}function xr(r,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)D_(r,a.alternate,a),a=a.sibling}function Ha(r){for(r=r.child;r!==null;){var a=r;switch(a.tag){case 0:case 11:case 14:case 15:Xr(4,a,a.return),Ha(a);break;case 1:Pi(a,a.return);var c=a.stateNode;typeof c.componentWillUnmount=="function"&&j_(a,a.return,c),Ha(a);break;case 27:cc(a.stateNode);case 26:case 5:Pi(a,a.return),Ha(a);break;case 22:a.memoizedState===null&&Ha(a);break;case 30:Ha(a);break;default:Ha(a)}r=r.sibling}}function br(r,a,c){for(c=c&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var m=a.alternate,b=r,y=a,j=y.flags;switch(y.tag){case 0:case 11:case 15:br(b,y,c),Jl(4,y);break;case 1:if(br(b,y,c),m=y,b=m.stateNode,typeof b.componentDidMount=="function")try{b.componentDidMount()}catch(ue){Dt(m,m.return,ue)}if(m=y,b=m.updateQueue,b!==null){var L=m.stateNode;try{var Y=b.shared.hiddenCallbacks;if(Y!==null)for(b.shared.hiddenCallbacks=null,b=0;b<Y.length;b++)g1(Y[b],L)}catch(ue){Dt(m,m.return,ue)}}c&&j&64&&E_(y),ec(y,y.return);break;case 27:R_(y);case 26:case 5:br(b,y,c),c&&m===null&&j&4&&A_(y),ec(y,y.return);break;case 12:br(b,y,c);break;case 31:br(b,y,c),c&&j&4&&z_(b,y);break;case 13:br(b,y,c),c&&j&4&&B_(b,y);break;case 22:y.memoizedState===null&&br(b,y,c),ec(y,y.return);break;case 30:break;default:br(b,y,c)}a=a.sibling}}function ip(r,a){var c=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),r=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(r=a.memoizedState.cachePool.pool),r!==c&&(r!=null&&r.refCount++,c!=null&&$l(c))}function rp(r,a){r=null,a.alternate!==null&&(r=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==r&&(a.refCount++,r!=null&&$l(r))}function Si(r,a,c,m){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)$_(r,a,c,m),a=a.sibling}function $_(r,a,c,m){var b=a.flags;switch(a.tag){case 0:case 11:case 15:Si(r,a,c,m),b&2048&&Jl(9,a);break;case 1:Si(r,a,c,m);break;case 3:Si(r,a,c,m),b&2048&&(r=null,a.alternate!==null&&(r=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==r&&(a.refCount++,r!=null&&$l(r)));break;case 12:if(b&2048){Si(r,a,c,m),r=a.stateNode;try{var y=a.memoizedProps,j=y.id,L=y.onPostCommit;typeof L=="function"&&L(j,a.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(Y){Dt(a,a.return,Y)}}else Si(r,a,c,m);break;case 31:Si(r,a,c,m);break;case 13:Si(r,a,c,m);break;case 23:break;case 22:y=a.stateNode,j=a.alternate,a.memoizedState!==null?y._visibility&2?Si(r,a,c,m):tc(r,a):y._visibility&2?Si(r,a,c,m):(y._visibility|=2,Io(r,a,c,m,(a.subtreeFlags&10256)!==0||!1)),b&2048&&ip(j,a);break;case 24:Si(r,a,c,m),b&2048&&rp(a.alternate,a);break;default:Si(r,a,c,m)}}function Io(r,a,c,m,b){for(b=b&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var y=r,j=a,L=c,Y=m,ue=j.flags;switch(j.tag){case 0:case 11:case 15:Io(y,j,L,Y,b),Jl(8,j);break;case 23:break;case 22:var ve=j.stateNode;j.memoizedState!==null?ve._visibility&2?Io(y,j,L,Y,b):tc(y,j):(ve._visibility|=2,Io(y,j,L,Y,b)),b&&ue&2048&&ip(j.alternate,j);break;case 24:Io(y,j,L,Y,b),b&&ue&2048&&rp(j.alternate,j);break;default:Io(y,j,L,Y,b)}a=a.sibling}}function tc(r,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var c=r,m=a,b=m.flags;switch(m.tag){case 22:tc(c,m),b&2048&&ip(m.alternate,m);break;case 24:tc(c,m),b&2048&&rp(m.alternate,m);break;default:tc(c,m)}a=a.sibling}}var sc=8192;function $o(r,a,c){if(r.subtreeFlags&sc)for(r=r.child;r!==null;)H_(r,a,c),r=r.sibling}function H_(r,a,c){switch(r.tag){case 26:$o(r,a,c),r.flags&sc&&r.memoizedState!==null&&hT(c,wi,r.memoizedState,r.memoizedProps);break;case 5:$o(r,a,c);break;case 3:case 4:var m=wi;wi=Nd(r.stateNode.containerInfo),$o(r,a,c),wi=m;break;case 22:r.memoizedState===null&&(m=r.alternate,m!==null&&m.memoizedState!==null?(m=sc,sc=16777216,$o(r,a,c),sc=m):$o(r,a,c));break;default:$o(r,a,c)}}function U_(r){var a=r.alternate;if(a!==null&&(r=a.child,r!==null)){a.child=null;do a=r.sibling,r.sibling=null,r=a;while(r!==null)}}function nc(r){var a=r.deletions;if((r.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var m=a[c];Bs=m,q_(m,r)}U_(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)F_(r),r=r.sibling}function F_(r){switch(r.tag){case 0:case 11:case 15:nc(r),r.flags&2048&&Xr(9,r,r.return);break;case 3:nc(r);break;case 12:nc(r);break;case 22:var a=r.stateNode;r.memoizedState!==null&&a._visibility&2&&(r.return===null||r.return.tag!==13)?(a._visibility&=-3,hd(r)):nc(r);break;default:nc(r)}}function hd(r){var a=r.deletions;if((r.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var m=a[c];Bs=m,q_(m,r)}U_(r)}for(r=r.child;r!==null;){switch(a=r,a.tag){case 0:case 11:case 15:Xr(8,a,a.return),hd(a);break;case 22:c=a.stateNode,c._visibility&2&&(c._visibility&=-3,hd(a));break;default:hd(a)}r=r.sibling}}function q_(r,a){for(;Bs!==null;){var c=Bs;switch(c.tag){case 0:case 11:case 15:Xr(8,c,a);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var m=c.memoizedState.cachePool.pool;m!=null&&m.refCount++}break;case 24:$l(c.memoizedState.cache)}if(m=c.child,m!==null)m.return=c,Bs=m;else e:for(c=r;Bs!==null;){m=Bs;var b=m.sibling,y=m.return;if(O_(m),m===c){Bs=null;break e}if(b!==null){b.return=y,Bs=b;break e}Bs=y}}}var EA={getCacheForType:function(r){var a=Ws(bs),c=a.data.get(r);return c===void 0&&(c=r(),a.data.set(r,c)),c},cacheSignal:function(){return Ws(bs).controller.signal}},jA=typeof WeakMap=="function"?WeakMap:Map,Ct=0,$t=null,gt=null,vt=0,Mt=0,Bn=null,Zr=!1,Ho=!1,ap=!1,vr=0,ns=0,Qr=0,Ua=0,op=0,Pn=0,Uo=0,ic=null,kn=null,lp=!1,fd=0,V_=0,md=1/0,pd=null,Jr=null,Es=0,ea=null,Fo=null,_r=0,cp=0,up=null,G_=null,rc=0,dp=null;function In(){return(Ct&2)!==0&&vt!==0?vt&-vt:I.T!==null?xp():po()}function W_(){if(Pn===0)if((vt&536870912)===0||yt){var r=je;je<<=1,(je&3932160)===0&&(je=262144),Pn=r}else Pn=536870912;return r=Ln.current,r!==null&&(r.flags|=32),Pn}function Nn(r,a,c){(r===$t&&(Mt===2||Mt===9)||r.cancelPendingCommit!==null)&&(qo(r,0),ta(r,vt,Pn,!1)),Et(r,c),((Ct&2)===0||r!==$t)&&(r===$t&&((Ct&2)===0&&(Ua|=c),ns===4&&ta(r,vt,Pn,!1)),Ii(r))}function K_(r,a,c){if((Ct&6)!==0)throw Error(n(327));var m=!c&&(a&127)===0&&(a&r.expiredLanes)===0||se(r,a),b=m?RA(r,a):fp(r,a,!0),y=m;do{if(b===0){Ho&&!m&&ta(r,a,0,!1);break}else{if(c=r.current.alternate,y&&!AA(c)){b=fp(r,a,!1),y=!1;continue}if(b===2){if(y=a,r.errorRecoveryDisabledLanes&y)var j=0;else j=r.pendingLanes&-536870913,j=j!==0?j:j&536870912?536870912:0;if(j!==0){a=j;e:{var L=r;b=ic;var Y=L.current.memoizedState.isDehydrated;if(Y&&(qo(L,j).flags|=256),j=fp(L,j,!1),j!==2){if(ap&&!Y){L.errorRecoveryDisabledLanes|=y,Ua|=y,b=4;break e}y=kn,kn=b,y!==null&&(kn===null?kn=y:kn.push.apply(kn,y))}b=j}if(y=!1,b!==2)continue}}if(b===1){qo(r,0),ta(r,a,0,!0);break}e:{switch(m=r,y=b,y){case 0:case 1:throw Error(n(345));case 4:if((a&4194048)!==a)break;case 6:ta(m,a,Pn,!Zr);break e;case 2:kn=null;break;case 3:case 5:break;default:throw Error(n(329))}if((a&62914560)===a&&(b=fd+300-It(),10<b)){if(ta(m,a,Pn,!Zr),H(m,0,!0)!==0)break e;_r=a,m.timeoutHandle=Ny(Y_.bind(null,m,c,kn,pd,lp,a,Pn,Ua,Uo,Zr,y,"Throttled",-0,0),b);break e}Y_(m,c,kn,pd,lp,a,Pn,Ua,Uo,Zr,y,null,-0,0)}}break}while(!0);Ii(r)}function Y_(r,a,c,m,b,y,j,L,Y,ue,ve,Ce,de,pe){if(r.timeoutHandle=-1,Ce=a.subtreeFlags,Ce&8192||(Ce&16785408)===16785408){Ce={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ie},H_(a,y,Ce);var Ke=(y&62914560)===y?fd-It():(y&4194048)===y?V_-It():0;if(Ke=fT(Ce,Ke),Ke!==null){_r=y,r.cancelPendingCommit=Ke(ny.bind(null,r,a,y,c,m,b,j,L,Y,ve,Ce,null,de,pe)),ta(r,y,j,!ue);return}}ny(r,a,y,c,m,b,j,L,Y)}function AA(r){for(var a=r;;){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 m=0;m<c.length;m++){var b=c[m],y=b.getSnapshot;b=b.value;try{if(!Dn(y(),b))return!1}catch{return!1}}if(c=a.child,a.subtreeFlags&16384&&c!==null)c.return=a,a=c;else{if(a===r)break;for(;a.sibling===null;){if(a.return===null||a.return===r)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function ta(r,a,c,m){a&=~op,a&=~Ua,r.suspendedLanes|=a,r.pingedLanes&=~a,m&&(r.warmLanes|=a),m=r.expirationTimes;for(var b=a;0<b;){var y=31-M(b),j=1<<y;m[y]=-1,b&=~j}c!==0&&He(r,c,a)}function gd(){return(Ct&6)===0?(ac(0),!1):!0}function hp(){if(gt!==null){if(Mt===0)var r=gt.return;else r=gt,cr=Da=null,jm(r),Oo=null,Ul=0,r=gt;for(;r!==null;)C_(r.alternate,r),r=r.return;gt=null}}function qo(r,a){var c=r.timeoutHandle;c!==-1&&(r.timeoutHandle=-1,YA(c)),c=r.cancelPendingCommit,c!==null&&(r.cancelPendingCommit=null,c()),_r=0,hp(),$t=r,gt=c=or(r.current,null),vt=a,Mt=0,Bn=null,Zr=!1,Ho=se(r,a),ap=!1,Uo=Pn=op=Ua=Qr=ns=0,kn=ic=null,lp=!1,(a&8)!==0&&(a|=a&32);var m=r.entangledLanes;if(m!==0)for(r=r.entanglements,m&=a;0<m;){var b=31-M(m),y=1<<b;a|=r[b],m&=~y}return vr=a,Bu(),c}function X_(r,a){ct=null,I.H=Xl,a===Do||a===Vu?(a=h1(),Mt=3):a===gm?(a=h1(),Mt=4):Mt=a===qm?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,Bn=a,gt===null&&(ns=1,rd(r,Zn(a,r.current)))}function Z_(){var r=Ln.current;return r===null?!0:(vt&4194048)===vt?ti===null:(vt&62914560)===vt||(vt&536870912)!==0?r===ti:!1}function Q_(){var r=I.H;return I.H=Xl,r===null?Xl:r}function J_(){var r=I.A;return I.A=EA,r}function xd(){ns=4,Zr||(vt&4194048)!==vt&&Ln.current!==null||(Ho=!0),(Qr&134217727)===0&&(Ua&134217727)===0||$t===null||ta($t,vt,Pn,!1)}function fp(r,a,c){var m=Ct;Ct|=2;var b=Q_(),y=J_();($t!==r||vt!==a)&&(pd=null,qo(r,a)),a=!1;var j=ns;e:do try{if(Mt!==0&&gt!==null){var L=gt,Y=Bn;switch(Mt){case 8:hp(),j=6;break e;case 3:case 2:case 9:case 6:Ln.current===null&&(a=!0);var ue=Mt;if(Mt=0,Bn=null,Vo(r,L,Y,ue),c&&Ho){j=0;break e}break;default:ue=Mt,Mt=0,Bn=null,Vo(r,L,Y,ue)}}TA(),j=ns;break}catch(ve){X_(r,ve)}while(!0);return a&&r.shellSuspendCounter++,cr=Da=null,Ct=m,I.H=b,I.A=y,gt===null&&($t=null,vt=0,Bu()),j}function TA(){for(;gt!==null;)ey(gt)}function RA(r,a){var c=Ct;Ct|=2;var m=Q_(),b=J_();$t!==r||vt!==a?(pd=null,md=It()+500,qo(r,a)):Ho=se(r,a);e:do try{if(Mt!==0&&gt!==null){a=gt;var y=Bn;t:switch(Mt){case 1:Mt=0,Bn=null,Vo(r,a,y,1);break;case 2:case 9:if(u1(y)){Mt=0,Bn=null,ty(a);break}a=function(){Mt!==2&&Mt!==9||$t!==r||(Mt=7),Ii(r)},y.then(a,a);break e;case 3:Mt=7;break e;case 4:Mt=5;break e;case 7:u1(y)?(Mt=0,Bn=null,ty(a)):(Mt=0,Bn=null,Vo(r,a,y,7));break;case 5:var j=null;switch(gt.tag){case 26:j=gt.memoizedState;case 5:case 27:var L=gt;if(j?$y(j):L.stateNode.complete){Mt=0,Bn=null;var Y=L.sibling;if(Y!==null)gt=Y;else{var ue=L.return;ue!==null?(gt=ue,bd(ue)):gt=null}break t}}Mt=0,Bn=null,Vo(r,a,y,5);break;case 6:Mt=0,Bn=null,Vo(r,a,y,6);break;case 8:hp(),ns=6;break e;default:throw Error(n(462))}}MA();break}catch(ve){X_(r,ve)}while(!0);return cr=Da=null,I.H=m,I.A=b,Ct=c,gt!==null?0:($t=null,vt=0,Bu(),ns)}function MA(){for(;gt!==null&&!Di();)ey(gt)}function ey(r){var a=k_(r.alternate,r,vr);r.memoizedProps=r.pendingProps,a===null?bd(r):gt=a}function ty(r){var a=r,c=a.alternate;switch(a.tag){case 15:case 0:a=b_(c,a,a.pendingProps,a.type,void 0,vt);break;case 11:a=b_(c,a,a.pendingProps,a.type.render,a.ref,vt);break;case 5:jm(a);default:C_(c,a),a=gt=Jv(a,vr),a=k_(c,a,vr)}r.memoizedProps=r.pendingProps,a===null?bd(r):gt=a}function Vo(r,a,c,m){cr=Da=null,jm(a),Oo=null,Ul=0;var b=a.return;try{if(_A(r,b,a,c,vt)){ns=1,rd(r,Zn(c,r.current)),gt=null;return}}catch(y){if(b!==null)throw gt=b,y;ns=1,rd(r,Zn(c,r.current)),gt=null;return}a.flags&32768?(yt||m===1?r=!0:Ho||(vt&536870912)!==0?r=!1:(Zr=r=!0,(m===2||m===9||m===3||m===6)&&(m=Ln.current,m!==null&&m.tag===13&&(m.flags|=16384))),sy(a,r)):bd(a)}function bd(r){var a=r;do{if((a.flags&32768)!==0){sy(a,Zr);return}r=a.return;var c=SA(a.alternate,a,vr);if(c!==null){gt=c;return}if(a=a.sibling,a!==null){gt=a;return}gt=a=r}while(a!==null);ns===0&&(ns=5)}function sy(r,a){do{var c=kA(r.alternate,r);if(c!==null){c.flags&=32767,gt=c;return}if(c=r.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!a&&(r=r.sibling,r!==null)){gt=r;return}gt=r=c}while(r!==null);ns=6,gt=null}function ny(r,a,c,m,b,y,j,L,Y){r.cancelPendingCommit=null;do vd();while(Es!==0);if((Ct&6)!==0)throw Error(n(327));if(a!==null){if(a===r.current)throw Error(n(177));if(y=a.lanes|a.childLanes,y|=tm,qe(r,c,y,j,L,Y),r===$t&&(gt=$t=null,vt=0),Fo=a,ea=r,_r=c,cp=y,up=b,G_=m,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,zA(xn,function(){return ly(),null})):(r.callbackNode=null,r.callbackPriority=0),m=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||m){m=I.T,I.T=null,b=Z.p,Z.p=2,j=Ct,Ct|=4;try{NA(r,a,c)}finally{Ct=j,Z.p=b,I.T=m}}Es=1,iy(),ry(),ay()}}function iy(){if(Es===1){Es=0;var r=ea,a=Fo,c=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||c){c=I.T,I.T=null;var m=Z.p;Z.p=2;var b=Ct;Ct|=4;try{P_(a,r);var y=Np,j=qv(r.containerInfo),L=y.focusedElem,Y=y.selectionRange;if(j!==L&&L&&L.ownerDocument&&Fv(L.ownerDocument.documentElement,L)){if(Y!==null&&Xf(L)){var ue=Y.start,ve=Y.end;if(ve===void 0&&(ve=ue),"selectionStart"in L)L.selectionStart=ue,L.selectionEnd=Math.min(ve,L.value.length);else{var Ce=L.ownerDocument||document,de=Ce&&Ce.defaultView||window;if(de.getSelection){var pe=de.getSelection(),Ke=L.textContent.length,st=Math.min(Y.start,Ke),Bt=Y.end===void 0?st:Math.min(Y.end,Ke);!pe.extend&&st>Bt&&(j=Bt,Bt=st,st=j);var ne=Uv(L,st),Q=Uv(L,Bt);if(ne&&Q&&(pe.rangeCount!==1||pe.anchorNode!==ne.node||pe.anchorOffset!==ne.offset||pe.focusNode!==Q.node||pe.focusOffset!==Q.offset)){var ce=Ce.createRange();ce.setStart(ne.node,ne.offset),pe.removeAllRanges(),st>Bt?(pe.addRange(ce),pe.extend(Q.node,Q.offset)):(ce.setEnd(Q.node,Q.offset),pe.addRange(ce))}}}}for(Ce=[],pe=L;pe=pe.parentNode;)pe.nodeType===1&&Ce.push({element:pe,left:pe.scrollLeft,top:pe.scrollTop});for(typeof L.focus=="function"&&L.focus(),L=0;L<Ce.length;L++){var we=Ce[L];we.element.scrollLeft=we.left,we.element.scrollTop=we.top}}Rd=!!kp,Np=kp=null}finally{Ct=b,Z.p=m,I.T=c}}r.current=a,Es=2}}function ry(){if(Es===2){Es=0;var r=ea,a=Fo,c=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||c){c=I.T,I.T=null;var m=Z.p;Z.p=2;var b=Ct;Ct|=4;try{D_(r,a.alternate,a)}finally{Ct=b,Z.p=m,I.T=c}}Es=3}}function ay(){if(Es===4||Es===3){Es=0,_i();var r=ea,a=Fo,c=_r,m=G_;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?Es=5:(Es=0,Fo=ea=null,oy(r,r.pendingLanes));var b=r.pendingLanes;if(b===0&&(Jr=null),sr(c),a=a.stateNode,he&&typeof he.onCommitFiberRoot=="function")try{he.onCommitFiberRoot(ye,a,void 0,(a.current.flags&128)===128)}catch{}if(m!==null){a=I.T,b=Z.p,Z.p=2,I.T=null;try{for(var y=r.onRecoverableError,j=0;j<m.length;j++){var L=m[j];y(L.value,{componentStack:L.stack})}}finally{I.T=a,Z.p=b}}(_r&3)!==0&&vd(),Ii(r),b=r.pendingLanes,(c&261930)!==0&&(b&42)!==0?r===dp?rc++:(rc=0,dp=r):rc=0,ac(0)}}function oy(r,a){(r.pooledCacheLanes&=a)===0&&(a=r.pooledCache,a!=null&&(r.pooledCache=null,$l(a)))}function vd(){return iy(),ry(),ay(),ly()}function ly(){if(Es!==5)return!1;var r=ea,a=cp;cp=0;var c=sr(_r),m=I.T,b=Z.p;try{Z.p=32>c?32:c,I.T=null,c=up,up=null;var y=ea,j=_r;if(Es=0,Fo=ea=null,_r=0,(Ct&6)!==0)throw Error(n(331));var L=Ct;if(Ct|=4,F_(y.current),$_(y,y.current,j,c),Ct=L,ac(0,!1),he&&typeof he.onPostCommitFiberRoot=="function")try{he.onPostCommitFiberRoot(ye,y)}catch{}return!0}finally{Z.p=b,I.T=m,oy(r,a)}}function cy(r,a,c){a=Zn(c,a),a=Fm(r.stateNode,a,2),r=Wr(r,a,2),r!==null&&(Et(r,2),Ii(r))}function Dt(r,a,c){if(r.tag===3)cy(r,r,c);else for(;a!==null;){if(a.tag===3){cy(a,r,c);break}else if(a.tag===1){var m=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(Jr===null||!Jr.has(m))){r=Zn(c,r),c=u_(2),m=Wr(a,c,2),m!==null&&(d_(c,m,a,r),Et(m,2),Ii(m));break}}a=a.return}}function mp(r,a,c){var m=r.pingCache;if(m===null){m=r.pingCache=new jA;var b=new Set;m.set(a,b)}else b=m.get(a),b===void 0&&(b=new Set,m.set(a,b));b.has(c)||(ap=!0,b.add(c),r=DA.bind(null,r,a,c),a.then(r,r))}function DA(r,a,c){var m=r.pingCache;m!==null&&m.delete(a),r.pingedLanes|=r.suspendedLanes&c,r.warmLanes&=~c,$t===r&&(vt&c)===c&&(ns===4||ns===3&&(vt&62914560)===vt&&300>It()-fd?(Ct&2)===0&&qo(r,0):op|=c,Uo===vt&&(Uo=0)),Ii(r)}function uy(r,a){a===0&&(a=Pe()),r=Ta(r,a),r!==null&&(Et(r,a),Ii(r))}function OA(r){var a=r.memoizedState,c=0;a!==null&&(c=a.retryLane),uy(r,c)}function LA(r,a){var c=0;switch(r.tag){case 31:case 13:var m=r.stateNode,b=r.memoizedState;b!==null&&(c=b.retryLane);break;case 19:m=r.stateNode;break;case 22:m=r.stateNode._retryCache;break;default:throw Error(n(314))}m!==null&&m.delete(a),uy(r,c)}function zA(r,a){return An(r,a)}var _d=null,Go=null,pp=!1,yd=!1,gp=!1,sa=0;function Ii(r){r!==Go&&r.next===null&&(Go===null?_d=Go=r:Go=Go.next=r),yd=!0,pp||(pp=!0,PA())}function ac(r,a){if(!gp&&yd){gp=!0;do for(var c=!1,m=_d;m!==null;){if(r!==0){var b=m.pendingLanes;if(b===0)var y=0;else{var j=m.suspendedLanes,L=m.pingedLanes;y=(1<<31-M(42|r)+1)-1,y&=b&~(j&~L),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(c=!0,my(m,y))}else y=vt,y=H(m,m===$t?y:0,m.cancelPendingCommit!==null||m.timeoutHandle!==-1),(y&3)===0||se(m,y)||(c=!0,my(m,y));m=m.next}while(c);gp=!1}}function BA(){dy()}function dy(){yd=pp=!1;var r=0;sa!==0&&KA()&&(r=sa);for(var a=It(),c=null,m=_d;m!==null;){var b=m.next,y=hy(m,a);y===0?(m.next=null,c===null?_d=b:c.next=b,b===null&&(Go=c)):(c=m,(r!==0||(y&3)!==0)&&(yd=!0)),m=b}Es!==0&&Es!==5||ac(r),sa!==0&&(sa=0)}function hy(r,a){for(var c=r.suspendedLanes,m=r.pingedLanes,b=r.expirationTimes,y=r.pendingLanes&-62914561;0<y;){var j=31-M(y),L=1<<j,Y=b[j];Y===-1?((L&c)===0||(L&m)!==0)&&(b[j]=ge(L,a)):Y<=a&&(r.expiredLanes|=L),y&=~L}if(a=$t,c=vt,c=H(r,r===a?c:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),m=r.callbackNode,c===0||r===a&&(Mt===2||Mt===9)||r.cancelPendingCommit!==null)return m!==null&&m!==null&&Tn(m),r.callbackNode=null,r.callbackPriority=0;if((c&3)===0||se(r,c)){if(a=c&-c,a===r.callbackPriority)return a;switch(m!==null&&Tn(m),sr(c)){case 2:case 8:c=gn;break;case 32:c=xn;break;case 268435456:c=S;break;default:c=xn}return m=fy.bind(null,r),c=An(c,m),r.callbackPriority=a,r.callbackNode=c,a}return m!==null&&m!==null&&Tn(m),r.callbackPriority=2,r.callbackNode=null,2}function fy(r,a){if(Es!==0&&Es!==5)return r.callbackNode=null,r.callbackPriority=0,null;var c=r.callbackNode;if(vd()&&r.callbackNode!==c)return null;var m=vt;return m=H(r,r===$t?m:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),m===0?null:(K_(r,m,a),hy(r,It()),r.callbackNode!=null&&r.callbackNode===c?fy.bind(null,r):null)}function my(r,a){if(vd())return null;K_(r,a,!0)}function PA(){XA(function(){(Ct&6)!==0?An(ls,BA):dy()})}function xp(){if(sa===0){var r=Ro;r===0&&(r=me,me<<=1,(me&261888)===0&&(me=256)),sa=r}return sa}function py(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:Ir(""+r)}function gy(r,a){var c=a.ownerDocument.createElement("input");return c.name=a.name,c.value=a.value,r.id&&c.setAttribute("form",r.id),a.parentNode.insertBefore(c,a),r=new FormData(r),c.parentNode.removeChild(c),r}function IA(r,a,c,m,b){if(a==="submit"&&c&&c.stateNode===b){var y=py((b[Js]||null).action),j=m.submitter;j&&(a=(a=j[Js]||null)?py(a.formAction):j.getAttribute("formAction"),a!==null&&(y=a,j=null));var L=new Du("action","action",null,m,b);r.push({event:L,listeners:[{instance:null,listener:function(){if(m.defaultPrevented){if(sa!==0){var Y=j?gy(b,j):new FormData(b);Bm(c,{pending:!0,data:Y,method:b.method,action:y},null,Y)}}else typeof y=="function"&&(L.preventDefault(),Y=j?gy(b,j):new FormData(b),Bm(c,{pending:!0,data:Y,method:b.method,action:y},y,Y))},currentTarget:b}]})}}for(var bp=0;bp<em.length;bp++){var vp=em[bp],$A=vp.toLowerCase(),HA=vp[0].toUpperCase()+vp.slice(1);yi($A,"on"+HA)}yi(Wv,"onAnimationEnd"),yi(Kv,"onAnimationIteration"),yi(Yv,"onAnimationStart"),yi("dblclick","onDoubleClick"),yi("focusin","onFocus"),yi("focusout","onBlur"),yi(nA,"onTransitionRun"),yi(iA,"onTransitionStart"),yi(rA,"onTransitionCancel"),yi(Xv,"onTransitionEnd"),Oe("onMouseEnter",["mouseout","mouseover"]),Oe("onMouseLeave",["mouseout","mouseover"]),Oe("onPointerEnter",["pointerout","pointerover"]),Oe("onPointerLeave",["pointerout","pointerover"]),ir("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ir("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ir("onBeforeInput",["compositionend","keypress","textInput","paste"]),ir("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ir("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ir("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var oc="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(oc));function xy(r,a){a=(a&4)!==0;for(var c=0;c<r.length;c++){var m=r[c],b=m.event;m=m.listeners;e:{var y=void 0;if(a)for(var j=m.length-1;0<=j;j--){var L=m[j],Y=L.instance,ue=L.currentTarget;if(L=L.listener,Y!==y&&b.isPropagationStopped())break e;y=L,b.currentTarget=ue;try{y(b)}catch(ve){zu(ve)}b.currentTarget=null,y=Y}else for(j=0;j<m.length;j++){if(L=m[j],Y=L.instance,ue=L.currentTarget,L=L.listener,Y!==y&&b.isPropagationStopped())break e;y=L,b.currentTarget=ue;try{y(b)}catch(ve){zu(ve)}b.currentTarget=null,y=Y}}}}function xt(r,a){var c=a[Sl];c===void 0&&(c=a[Sl]=new Set);var m=r+"__bubble";c.has(m)||(by(a,r,2,!1),c.add(m))}function _p(r,a,c){var m=0;a&&(m|=4),by(c,r,m,a)}var wd="_reactListening"+Math.random().toString(36).slice(2);function yp(r){if(!r[wd]){r[wd]=!0,Nu.forEach(function(c){c!=="selectionchange"&&(UA.has(c)||_p(c,!1,r),_p(c,!0,r))});var a=r.nodeType===9?r:r.ownerDocument;a===null||a[wd]||(a[wd]=!0,_p("selectionchange",!1,a))}}function by(r,a,c,m){switch(Wy(a)){case 2:var b=gT;break;case 8:b=xT;break;default:b=zp}c=b.bind(null,a,c,r),b=void 0,!Hf||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(b=!0),m?b!==void 0?r.addEventListener(a,c,{capture:!0,passive:b}):r.addEventListener(a,c,!0):b!==void 0?r.addEventListener(a,c,{passive:b}):r.addEventListener(a,c,!1)}function wp(r,a,c,m,b){var y=m;if((a&1)===0&&(a&2)===0&&m!==null)e:for(;;){if(m===null)return;var j=m.tag;if(j===3||j===4){var L=m.stateNode.containerInfo;if(L===b)break;if(j===4)for(j=m.return;j!==null;){var Y=j.tag;if((Y===3||Y===4)&&j.stateNode.containerInfo===b)return;j=j.return}for(;L!==null;){if(j=an(L),j===null)return;if(Y=j.tag,Y===5||Y===6||Y===26||Y===27){m=y=j;continue e}L=L.parentNode}}m=m.return}Au(function(){var ue=y,ve=lt(c),Ce=[];e:{var de=Zv.get(r);if(de!==void 0){var pe=Du,Ke=r;switch(r){case"keypress":if(Ru(c)===0)break e;case"keydown":case"keyup":pe=L4;break;case"focusin":Ke="focus",pe=Vf;break;case"focusout":Ke="blur",pe=Vf;break;case"beforeblur":case"afterblur":pe=Vf;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":pe=Cv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":pe=S4;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":pe=P4;break;case Wv:case Kv:case Yv:pe=C4;break;case Xv:pe=$4;break;case"scroll":case"scrollend":pe=y4;break;case"wheel":pe=U4;break;case"copy":case"cut":case"paste":pe=j4;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":pe=jv;break;case"toggle":case"beforetoggle":pe=q4}var st=(a&4)!==0,Bt=!st&&(r==="scroll"||r==="scrollend"),ne=st?de!==null?de+"Capture":null:de;st=[];for(var Q=ue,ce;Q!==null;){var we=Q;if(ce=we.stateNode,we=we.tag,we!==5&&we!==26&&we!==27||ce===null||ne===null||(we=Al(Q,ne),we!=null&&st.push(lc(Q,we,ce))),Bt)break;Q=Q.return}0<st.length&&(de=new pe(de,Ke,null,c,ve),Ce.push({event:de,listeners:st}))}}if((a&7)===0){e:{if(de=r==="mouseover"||r==="pointerover",pe=r==="mouseout"||r==="pointerout",de&&c!==Xe&&(Ke=c.relatedTarget||c.fromElement)&&(an(Ke)||Ke[Lr]))break e;if((pe||de)&&(de=ve.window===ve?ve:(de=ve.ownerDocument)?de.defaultView||de.parentWindow:window,pe?(Ke=c.relatedTarget||c.toElement,pe=ue,Ke=Ke?an(Ke):null,Ke!==null&&(Bt=l(Ke),st=Ke.tag,Ke!==Bt||st!==5&&st!==27&&st!==6)&&(Ke=null)):(pe=null,Ke=ue),pe!==Ke)){if(st=Cv,we="onMouseLeave",ne="onMouseEnter",Q="mouse",(r==="pointerout"||r==="pointerover")&&(st=jv,we="onPointerLeave",ne="onPointerEnter",Q="pointer"),Bt=pe==null?de:zr(pe),ce=Ke==null?de:zr(Ke),de=new st(we,Q+"leave",pe,c,ve),de.target=Bt,de.relatedTarget=ce,we=null,an(ve)===ue&&(st=new st(ne,Q+"enter",Ke,c,ve),st.target=ce,st.relatedTarget=Bt,we=st),Bt=we,pe&&Ke)t:{for(st=FA,ne=pe,Q=Ke,ce=0,we=ne;we;we=st(we))ce++;we=0;for(var tt=Q;tt;tt=st(tt))we++;for(;0<ce-we;)ne=st(ne),ce--;for(;0<we-ce;)Q=st(Q),we--;for(;ce--;){if(ne===Q||Q!==null&&ne===Q.alternate){st=ne;break t}ne=st(ne),Q=st(Q)}st=null}else st=null;pe!==null&&vy(Ce,de,pe,st,!1),Ke!==null&&Bt!==null&&vy(Ce,Bt,Ke,st,!0)}}e:{if(de=ue?zr(ue):window,pe=de.nodeName&&de.nodeName.toLowerCase(),pe==="select"||pe==="input"&&de.type==="file")var kt=zv;else if(Ov(de))if(Bv)kt=eA;else{kt=Q4;var Ze=Z4}else pe=de.nodeName,!pe||pe.toLowerCase()!=="input"||de.type!=="checkbox"&&de.type!=="radio"?ue&&Pr(ue.elementType)&&(kt=zv):kt=J4;if(kt&&(kt=kt(r,ue))){Lv(Ce,kt,c,ve);break e}Ze&&Ze(r,de,ue),r==="focusout"&&ue&&de.type==="number"&&ue.memoizedProps.value!=null&&_o(de,"number",de.value)}switch(Ze=ue?zr(ue):window,r){case"focusin":(Ov(Ze)||Ze.contentEditable==="true")&&(So=Ze,Zf=ue,Bl=null);break;case"focusout":Bl=Zf=So=null;break;case"mousedown":Qf=!0;break;case"contextmenu":case"mouseup":case"dragend":Qf=!1,Vv(Ce,c,ve);break;case"selectionchange":if(sA)break;case"keydown":case"keyup":Vv(Ce,c,ve)}var ut;if(Wf)e:{switch(r){case"compositionstart":var _t="onCompositionStart";break e;case"compositionend":_t="onCompositionEnd";break e;case"compositionupdate":_t="onCompositionUpdate";break e}_t=void 0}else wo?Mv(r,c)&&(_t="onCompositionEnd"):r==="keydown"&&c.keyCode===229&&(_t="onCompositionStart");_t&&(Av&&c.locale!=="ko"&&(wo||_t!=="onCompositionStart"?_t==="onCompositionEnd"&&wo&&(ut=kv()):($r=ve,Uf="value"in $r?$r.value:$r.textContent,wo=!0)),Ze=Sd(ue,_t),0<Ze.length&&(_t=new Ev(_t,r,null,c,ve),Ce.push({event:_t,listeners:Ze}),ut?_t.data=ut:(ut=Dv(c),ut!==null&&(_t.data=ut)))),(ut=G4?W4(r,c):K4(r,c))&&(_t=Sd(ue,"onBeforeInput"),0<_t.length&&(Ze=new Ev("onBeforeInput","beforeinput",null,c,ve),Ce.push({event:Ze,listeners:_t}),Ze.data=ut)),IA(Ce,r,ue,c,ve)}xy(Ce,a)})}function lc(r,a,c){return{instance:r,listener:a,currentTarget:c}}function Sd(r,a){for(var c=a+"Capture",m=[];r!==null;){var b=r,y=b.stateNode;if(b=b.tag,b!==5&&b!==26&&b!==27||y===null||(b=Al(r,c),b!=null&&m.unshift(lc(r,b,y)),b=Al(r,a),b!=null&&m.push(lc(r,b,y))),r.tag===3)return m;r=r.return}return[]}function FA(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function vy(r,a,c,m,b){for(var y=a._reactName,j=[];c!==null&&c!==m;){var L=c,Y=L.alternate,ue=L.stateNode;if(L=L.tag,Y!==null&&Y===m)break;L!==5&&L!==26&&L!==27||ue===null||(Y=ue,b?(ue=Al(c,y),ue!=null&&j.unshift(lc(c,ue,Y))):b||(ue=Al(c,y),ue!=null&&j.push(lc(c,ue,Y)))),c=c.return}j.length!==0&&r.push({event:a,listeners:j})}var qA=/\r\n?/g,VA=/\u0000|\uFFFD/g;function _y(r){return(typeof r=="string"?r:""+r).replace(qA,`
10
- `).replace(VA,"")}function yy(r,a){return a=_y(a),_y(r)===a}function zt(r,a,c,m,b,y){switch(c){case"children":typeof m=="string"?a==="body"||a==="textarea"&&m===""||nt(r,m):(typeof m=="number"||typeof m=="bigint")&&a!=="body"&&nt(r,""+m);break;case"className":Rn(r,"class",m);break;case"tabIndex":Rn(r,"tabindex",m);break;case"dir":case"role":case"viewBox":case"width":case"height":Rn(r,c,m);break;case"style":Rt(r,m,y);break;case"data":if(a!=="object"){Rn(r,"data",m);break}case"src":case"href":if(m===""&&(a!=="a"||c!=="href")){r.removeAttribute(c);break}if(m==null||typeof m=="function"||typeof m=="symbol"||typeof m=="boolean"){r.removeAttribute(c);break}m=Ir(""+m),r.setAttribute(c,m);break;case"action":case"formAction":if(typeof m=="function"){r.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 y=="function"&&(c==="formAction"?(a!=="input"&&zt(r,a,"name",b.name,b,null),zt(r,a,"formEncType",b.formEncType,b,null),zt(r,a,"formMethod",b.formMethod,b,null),zt(r,a,"formTarget",b.formTarget,b,null)):(zt(r,a,"encType",b.encType,b,null),zt(r,a,"method",b.method,b,null),zt(r,a,"target",b.target,b,null)));if(m==null||typeof m=="symbol"||typeof m=="boolean"){r.removeAttribute(c);break}m=Ir(""+m),r.setAttribute(c,m);break;case"onClick":m!=null&&(r.onclick=Ie);break;case"onScroll":m!=null&&xt("scroll",r);break;case"onScrollEnd":m!=null&&xt("scrollend",r);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(n(61));if(c=m.__html,c!=null){if(b.children!=null)throw Error(n(60));r.innerHTML=c}}break;case"multiple":r.multiple=m&&typeof m!="function"&&typeof m!="symbol";break;case"muted":r.muted=m&&typeof m!="function"&&typeof m!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(m==null||typeof m=="function"||typeof m=="boolean"||typeof m=="symbol"){r.removeAttribute("xlink:href");break}c=Ir(""+m),r.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":m!=null&&typeof m!="function"&&typeof m!="symbol"?r.setAttribute(c,""+m):r.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":m&&typeof m!="function"&&typeof m!="symbol"?r.setAttribute(c,""):r.removeAttribute(c);break;case"capture":case"download":m===!0?r.setAttribute(c,""):m!==!1&&m!=null&&typeof m!="function"&&typeof m!="symbol"?r.setAttribute(c,m):r.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":m!=null&&typeof m!="function"&&typeof m!="symbol"&&!isNaN(m)&&1<=m?r.setAttribute(c,m):r.removeAttribute(c);break;case"rowSpan":case"start":m==null||typeof m=="function"||typeof m=="symbol"||isNaN(m)?r.removeAttribute(c):r.setAttribute(c,m);break;case"popover":xt("beforetoggle",r),xt("toggle",r),en(r,"popover",m);break;case"xlinkActuate":bn(r,"http://www.w3.org/1999/xlink","xlink:actuate",m);break;case"xlinkArcrole":bn(r,"http://www.w3.org/1999/xlink","xlink:arcrole",m);break;case"xlinkRole":bn(r,"http://www.w3.org/1999/xlink","xlink:role",m);break;case"xlinkShow":bn(r,"http://www.w3.org/1999/xlink","xlink:show",m);break;case"xlinkTitle":bn(r,"http://www.w3.org/1999/xlink","xlink:title",m);break;case"xlinkType":bn(r,"http://www.w3.org/1999/xlink","xlink:type",m);break;case"xmlBase":bn(r,"http://www.w3.org/XML/1998/namespace","xml:base",m);break;case"xmlLang":bn(r,"http://www.w3.org/XML/1998/namespace","xml:lang",m);break;case"xmlSpace":bn(r,"http://www.w3.org/XML/1998/namespace","xml:space",m);break;case"is":en(r,"is",m);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=rr.get(c)||c,en(r,c,m))}}function Sp(r,a,c,m,b,y){switch(c){case"style":Rt(r,m,y);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(n(61));if(c=m.__html,c!=null){if(b.children!=null)throw Error(n(60));r.innerHTML=c}}break;case"children":typeof m=="string"?nt(r,m):(typeof m=="number"||typeof m=="bigint")&&nt(r,""+m);break;case"onScroll":m!=null&&xt("scroll",r);break;case"onScrollEnd":m!=null&&xt("scrollend",r);break;case"onClick":m!=null&&(r.onclick=Ie);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Na.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(b=c.endsWith("Capture"),a=c.slice(2,b?c.length-7:void 0),y=r[Js]||null,y=y!=null?y[c]:null,typeof y=="function"&&r.removeEventListener(a,y,b),typeof m=="function")){typeof y!="function"&&y!==null&&(c in r?r[c]=null:r.hasAttribute(c)&&r.removeAttribute(c)),r.addEventListener(a,m,b);break e}c in r?r[c]=m:m===!0?r.setAttribute(c,""):en(r,c,m)}}}function Ys(r,a,c){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":xt("error",r),xt("load",r);var m=!1,b=!1,y;for(y in c)if(c.hasOwnProperty(y)){var j=c[y];if(j!=null)switch(y){case"src":m=!0;break;case"srcSet":b=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(n(137,a));default:zt(r,a,y,j,c,null)}}b&&zt(r,a,"srcSet",c.srcSet,c,null),m&&zt(r,a,"src",c.src,c,null);return;case"input":xt("invalid",r);var L=y=j=b=null,Y=null,ue=null;for(m in c)if(c.hasOwnProperty(m)){var ve=c[m];if(ve!=null)switch(m){case"name":b=ve;break;case"type":j=ve;break;case"checked":Y=ve;break;case"defaultChecked":ue=ve;break;case"value":y=ve;break;case"defaultValue":L=ve;break;case"children":case"dangerouslySetInnerHTML":if(ve!=null)throw Error(n(137,a));break;default:zt(r,a,m,ve,c,null)}}Ca(r,y,L,Y,ue,j,b,!1);return;case"select":xt("invalid",r),m=j=y=null;for(b in c)if(c.hasOwnProperty(b)&&(L=c[b],L!=null))switch(b){case"value":y=L;break;case"defaultValue":j=L;break;case"multiple":m=L;default:zt(r,a,b,L,c,null)}a=y,c=j,r.multiple=!!m,a!=null?Vs(r,!!m,a,!1):c!=null&&Vs(r,!!m,c,!0);return;case"textarea":xt("invalid",r),y=b=m=null;for(j in c)if(c.hasOwnProperty(j)&&(L=c[j],L!=null))switch(j){case"value":m=L;break;case"defaultValue":b=L;break;case"children":y=L;break;case"dangerouslySetInnerHTML":if(L!=null)throw Error(n(91));break;default:zt(r,a,j,L,c,null)}yo(r,m,b,y);return;case"option":for(Y in c)c.hasOwnProperty(Y)&&(m=c[Y],m!=null)&&(Y==="selected"?r.selected=m&&typeof m!="function"&&typeof m!="symbol":zt(r,a,Y,m,c,null));return;case"dialog":xt("beforetoggle",r),xt("toggle",r),xt("cancel",r),xt("close",r);break;case"iframe":case"object":xt("load",r);break;case"video":case"audio":for(m=0;m<oc.length;m++)xt(oc[m],r);break;case"image":xt("error",r),xt("load",r);break;case"details":xt("toggle",r);break;case"embed":case"source":case"link":xt("error",r),xt("load",r);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ue in c)if(c.hasOwnProperty(ue)&&(m=c[ue],m!=null))switch(ue){case"children":case"dangerouslySetInnerHTML":throw Error(n(137,a));default:zt(r,a,ue,m,c,null)}return;default:if(Pr(a)){for(ve in c)c.hasOwnProperty(ve)&&(m=c[ve],m!==void 0&&Sp(r,a,ve,m,c,void 0));return}}for(L in c)c.hasOwnProperty(L)&&(m=c[L],m!=null&&zt(r,a,L,m,c,null))}function GA(r,a,c,m){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var b=null,y=null,j=null,L=null,Y=null,ue=null,ve=null;for(pe in c){var Ce=c[pe];if(c.hasOwnProperty(pe)&&Ce!=null)switch(pe){case"checked":break;case"value":break;case"defaultValue":Y=Ce;default:m.hasOwnProperty(pe)||zt(r,a,pe,null,m,Ce)}}for(var de in m){var pe=m[de];if(Ce=c[de],m.hasOwnProperty(de)&&(pe!=null||Ce!=null))switch(de){case"type":y=pe;break;case"name":b=pe;break;case"checked":ue=pe;break;case"defaultChecked":ve=pe;break;case"value":j=pe;break;case"defaultValue":L=pe;break;case"children":case"dangerouslySetInnerHTML":if(pe!=null)throw Error(n(137,a));break;default:pe!==Ce&&zt(r,a,de,pe,m,Ce)}}Cl(r,j,L,Y,ue,ve,y,b);return;case"select":pe=j=L=de=null;for(y in c)if(Y=c[y],c.hasOwnProperty(y)&&Y!=null)switch(y){case"value":break;case"multiple":pe=Y;default:m.hasOwnProperty(y)||zt(r,a,y,null,m,Y)}for(b in m)if(y=m[b],Y=c[b],m.hasOwnProperty(b)&&(y!=null||Y!=null))switch(b){case"value":de=y;break;case"defaultValue":L=y;break;case"multiple":j=y;default:y!==Y&&zt(r,a,b,y,m,Y)}a=L,c=j,m=pe,de!=null?Vs(r,!!c,de,!1):!!m!=!!c&&(a!=null?Vs(r,!!c,a,!0):Vs(r,!!c,c?[]:"",!1));return;case"textarea":pe=de=null;for(L in c)if(b=c[L],c.hasOwnProperty(L)&&b!=null&&!m.hasOwnProperty(L))switch(L){case"value":break;case"children":break;default:zt(r,a,L,null,m,b)}for(j in m)if(b=m[j],y=c[j],m.hasOwnProperty(j)&&(b!=null||y!=null))switch(j){case"value":de=b;break;case"defaultValue":pe=b;break;case"children":break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(n(91));break;default:b!==y&&zt(r,a,j,b,m,y)}Eu(r,de,pe);return;case"option":for(var Ke in c)de=c[Ke],c.hasOwnProperty(Ke)&&de!=null&&!m.hasOwnProperty(Ke)&&(Ke==="selected"?r.selected=!1:zt(r,a,Ke,null,m,de));for(Y in m)de=m[Y],pe=c[Y],m.hasOwnProperty(Y)&&de!==pe&&(de!=null||pe!=null)&&(Y==="selected"?r.selected=de&&typeof de!="function"&&typeof de!="symbol":zt(r,a,Y,de,m,pe));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 st in c)de=c[st],c.hasOwnProperty(st)&&de!=null&&!m.hasOwnProperty(st)&&zt(r,a,st,null,m,de);for(ue in m)if(de=m[ue],pe=c[ue],m.hasOwnProperty(ue)&&de!==pe&&(de!=null||pe!=null))switch(ue){case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(n(137,a));break;default:zt(r,a,ue,de,m,pe)}return;default:if(Pr(a)){for(var Bt in c)de=c[Bt],c.hasOwnProperty(Bt)&&de!==void 0&&!m.hasOwnProperty(Bt)&&Sp(r,a,Bt,void 0,m,de);for(ve in m)de=m[ve],pe=c[ve],!m.hasOwnProperty(ve)||de===pe||de===void 0&&pe===void 0||Sp(r,a,ve,de,m,pe);return}}for(var ne in c)de=c[ne],c.hasOwnProperty(ne)&&de!=null&&!m.hasOwnProperty(ne)&&zt(r,a,ne,null,m,de);for(Ce in m)de=m[Ce],pe=c[Ce],!m.hasOwnProperty(Ce)||de===pe||de==null&&pe==null||zt(r,a,Ce,de,m,pe)}function wy(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function WA(){if(typeof performance.getEntriesByType=="function"){for(var r=0,a=0,c=performance.getEntriesByType("resource"),m=0;m<c.length;m++){var b=c[m],y=b.transferSize,j=b.initiatorType,L=b.duration;if(y&&L&&wy(j)){for(j=0,L=b.responseEnd,m+=1;m<c.length;m++){var Y=c[m],ue=Y.startTime;if(ue>L)break;var ve=Y.transferSize,Ce=Y.initiatorType;ve&&wy(Ce)&&(Y=Y.responseEnd,j+=ve*(Y<L?1:(L-ue)/(Y-ue)))}if(--m,a+=8*(y+j)/(b.duration/1e3),r++,10<r)break}}if(0<r)return a/r/1e6}return navigator.connection&&(r=navigator.connection.downlink,typeof r=="number")?r:5}var kp=null,Np=null;function kd(r){return r.nodeType===9?r:r.ownerDocument}function Sy(r){switch(r){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function ky(r,a){if(r===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return r===1&&a==="foreignObject"?0:r}function Cp(r,a){return r==="textarea"||r==="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 Ep=null;function KA(){var r=window.event;return r&&r.type==="popstate"?r===Ep?!1:(Ep=r,!0):(Ep=null,!1)}var Ny=typeof setTimeout=="function"?setTimeout:void 0,YA=typeof clearTimeout=="function"?clearTimeout:void 0,Cy=typeof Promise=="function"?Promise:void 0,XA=typeof queueMicrotask=="function"?queueMicrotask:typeof Cy<"u"?function(r){return Cy.resolve(null).then(r).catch(ZA)}:Ny;function ZA(r){setTimeout(function(){throw r})}function na(r){return r==="head"}function Ey(r,a){var c=a,m=0;do{var b=c.nextSibling;if(r.removeChild(c),b&&b.nodeType===8)if(c=b.data,c==="/$"||c==="/&"){if(m===0){r.removeChild(b),Xo(a);return}m--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")m++;else if(c==="html")cc(r.ownerDocument.documentElement);else if(c==="head"){c=r.ownerDocument.head,cc(c);for(var y=c.firstChild;y;){var j=y.nextSibling,L=y.nodeName;y[ka]||L==="SCRIPT"||L==="STYLE"||L==="LINK"&&y.rel.toLowerCase()==="stylesheet"||c.removeChild(y),y=j}}else c==="body"&&cc(r.ownerDocument.body);c=b}while(c);Xo(a)}function jy(r,a){var c=r;r=0;do{var m=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||""),m&&m.nodeType===8)if(c=m.data,c==="/$"){if(r===0)break;r--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||r++;c=m}while(c)}function jp(r){var a=r.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":jp(c),kl(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}r.removeChild(c)}}function QA(r,a,c,m){for(;r.nodeType===1;){var b=c;if(r.nodeName.toLowerCase()!==a.toLowerCase()){if(!m&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(m){if(!r[ka])switch(a){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(y=r.getAttribute("rel"),y==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(y!==b.rel||r.getAttribute("href")!==(b.href==null||b.href===""?null:b.href)||r.getAttribute("crossorigin")!==(b.crossOrigin==null?null:b.crossOrigin)||r.getAttribute("title")!==(b.title==null?null:b.title))break;return r;case"style":if(r.hasAttribute("data-precedence"))break;return r;case"script":if(y=r.getAttribute("src"),(y!==(b.src==null?null:b.src)||r.getAttribute("type")!==(b.type==null?null:b.type)||r.getAttribute("crossorigin")!==(b.crossOrigin==null?null:b.crossOrigin))&&y&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(a==="input"&&r.type==="hidden"){var y=b.name==null?null:""+b.name;if(b.type==="hidden"&&r.getAttribute("name")===y)return r}else return r;if(r=si(r.nextSibling),r===null)break}return null}function JA(r,a,c){if(a==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!c||(r=si(r.nextSibling),r===null))return null;return r}function Ay(r,a){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!a||(r=si(r.nextSibling),r===null))return null;return r}function Ap(r){return r.data==="$?"||r.data==="$~"}function Tp(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function eT(r,a){var c=r.ownerDocument;if(r.data==="$~")r._reactRetry=a;else if(r.data!=="$?"||c.readyState!=="loading")a();else{var m=function(){a(),c.removeEventListener("DOMContentLoaded",m)};c.addEventListener("DOMContentLoaded",m),r._reactRetry=m}}function si(r){for(;r!=null;r=r.nextSibling){var a=r.nodeType;if(a===1||a===3)break;if(a===8){if(a=r.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return r}var Rp=null;function Ty(r){r=r.nextSibling;for(var a=0;r;){if(r.nodeType===8){var c=r.data;if(c==="/$"||c==="/&"){if(a===0)return si(r.nextSibling);a--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||a++}r=r.nextSibling}return null}function Ry(r){r=r.previousSibling;for(var a=0;r;){if(r.nodeType===8){var c=r.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(a===0)return r;a--}else c!=="/$"&&c!=="/&"||a++}r=r.previousSibling}return null}function My(r,a,c){switch(a=kd(c),r){case"html":if(r=a.documentElement,!r)throw Error(n(452));return r;case"head":if(r=a.head,!r)throw Error(n(453));return r;case"body":if(r=a.body,!r)throw Error(n(454));return r;default:throw Error(n(451))}}function cc(r){for(var a=r.attributes;a.length;)r.removeAttributeNode(a[0]);kl(r)}var ni=new Map,Dy=new Set;function Nd(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var yr=Z.d;Z.d={f:tT,r:sT,D:nT,C:iT,L:rT,m:aT,X:lT,S:oT,M:cT};function tT(){var r=yr.f(),a=gd();return r||a}function sT(r){var a=nr(r);a!==null&&a.tag===5&&a.type==="form"?X1(a):yr.r(r)}var Wo=typeof document>"u"?null:document;function Oy(r,a,c){var m=Wo;if(m&&typeof a=="string"&&a){var b=vn(a);b='link[rel="'+r+'"][href="'+b+'"]',typeof c=="string"&&(b+='[crossorigin="'+c+'"]'),Dy.has(b)||(Dy.add(b),r={rel:r,crossOrigin:c,href:a},m.querySelector(b)===null&&(a=m.createElement("link"),Ys(a,"link",r),gs(a),m.head.appendChild(a)))}}function nT(r){yr.D(r),Oy("dns-prefetch",r,null)}function iT(r,a){yr.C(r,a),Oy("preconnect",r,a)}function rT(r,a,c){yr.L(r,a,c);var m=Wo;if(m&&r&&a){var b='link[rel="preload"][as="'+vn(a)+'"]';a==="image"&&c&&c.imageSrcSet?(b+='[imagesrcset="'+vn(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(b+='[imagesizes="'+vn(c.imageSizes)+'"]')):b+='[href="'+vn(r)+'"]';var y=b;switch(a){case"style":y=Ko(r);break;case"script":y=Yo(r)}ni.has(y)||(r=g({rel:"preload",href:a==="image"&&c&&c.imageSrcSet?void 0:r,as:a},c),ni.set(y,r),m.querySelector(b)!==null||a==="style"&&m.querySelector(uc(y))||a==="script"&&m.querySelector(dc(y))||(a=m.createElement("link"),Ys(a,"link",r),gs(a),m.head.appendChild(a)))}}function aT(r,a){yr.m(r,a);var c=Wo;if(c&&r){var m=a&&typeof a.as=="string"?a.as:"script",b='link[rel="modulepreload"][as="'+vn(m)+'"][href="'+vn(r)+'"]',y=b;switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=Yo(r)}if(!ni.has(y)&&(r=g({rel:"modulepreload",href:r},a),ni.set(y,r),c.querySelector(b)===null)){switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(dc(y)))return}m=c.createElement("link"),Ys(m,"link",r),gs(m),c.head.appendChild(m)}}}function oT(r,a,c){yr.S(r,a,c);var m=Wo;if(m&&r){var b=Br(m).hoistableStyles,y=Ko(r);a=a||"default";var j=b.get(y);if(!j){var L={loading:0,preload:null};if(j=m.querySelector(uc(y)))L.loading=5;else{r=g({rel:"stylesheet",href:r,"data-precedence":a},c),(c=ni.get(y))&&Mp(r,c);var Y=j=m.createElement("link");gs(Y),Ys(Y,"link",r),Y._p=new Promise(function(ue,ve){Y.onload=ue,Y.onerror=ve}),Y.addEventListener("load",function(){L.loading|=1}),Y.addEventListener("error",function(){L.loading|=2}),L.loading|=4,Cd(j,a,m)}j={type:"stylesheet",instance:j,count:1,state:L},b.set(y,j)}}}function lT(r,a){yr.X(r,a);var c=Wo;if(c&&r){var m=Br(c).hoistableScripts,b=Yo(r),y=m.get(b);y||(y=c.querySelector(dc(b)),y||(r=g({src:r,async:!0},a),(a=ni.get(b))&&Dp(r,a),y=c.createElement("script"),gs(y),Ys(y,"link",r),c.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},m.set(b,y))}}function cT(r,a){yr.M(r,a);var c=Wo;if(c&&r){var m=Br(c).hoistableScripts,b=Yo(r),y=m.get(b);y||(y=c.querySelector(dc(b)),y||(r=g({src:r,async:!0,type:"module"},a),(a=ni.get(b))&&Dp(r,a),y=c.createElement("script"),gs(y),Ys(y,"link",r),c.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},m.set(b,y))}}function Ly(r,a,c,m){var b=(b=ie.current)?Nd(b):null;if(!b)throw Error(n(446));switch(r){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(a=Ko(c.href),c=Br(b).hoistableStyles,m=c.get(a),m||(m={type:"style",instance:null,count:0,state:null},c.set(a,m)),m):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){r=Ko(c.href);var y=Br(b).hoistableStyles,j=y.get(r);if(j||(b=b.ownerDocument||b,j={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(r,j),(y=b.querySelector(uc(r)))&&!y._p&&(j.instance=y,j.state.loading=5),ni.has(r)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},ni.set(r,c),y||uT(b,r,c,j.state))),a&&m===null)throw Error(n(528,""));return j}if(a&&m!==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=Yo(c),c=Br(b).hoistableScripts,m=c.get(a),m||(m={type:"script",instance:null,count:0,state:null},c.set(a,m)),m):{type:"void",instance:null,count:0,state:null};default:throw Error(n(444,r))}}function Ko(r){return'href="'+vn(r)+'"'}function uc(r){return'link[rel="stylesheet"]['+r+"]"}function zy(r){return g({},r,{"data-precedence":r.precedence,precedence:null})}function uT(r,a,c,m){r.querySelector('link[rel="preload"][as="style"]['+a+"]")?m.loading=1:(a=r.createElement("link"),m.preload=a,a.addEventListener("load",function(){return m.loading|=1}),a.addEventListener("error",function(){return m.loading|=2}),Ys(a,"link",c),gs(a),r.head.appendChild(a))}function Yo(r){return'[src="'+vn(r)+'"]'}function dc(r){return"script[async]"+r}function By(r,a,c){if(a.count++,a.instance===null)switch(a.type){case"style":var m=r.querySelector('style[data-href~="'+vn(c.href)+'"]');if(m)return a.instance=m,gs(m),m;var b=g({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return m=(r.ownerDocument||r).createElement("style"),gs(m),Ys(m,"style",b),Cd(m,c.precedence,r),a.instance=m;case"stylesheet":b=Ko(c.href);var y=r.querySelector(uc(b));if(y)return a.state.loading|=4,a.instance=y,gs(y),y;m=zy(c),(b=ni.get(b))&&Mp(m,b),y=(r.ownerDocument||r).createElement("link"),gs(y);var j=y;return j._p=new Promise(function(L,Y){j.onload=L,j.onerror=Y}),Ys(y,"link",m),a.state.loading|=4,Cd(y,c.precedence,r),a.instance=y;case"script":return y=Yo(c.src),(b=r.querySelector(dc(y)))?(a.instance=b,gs(b),b):(m=c,(b=ni.get(y))&&(m=g({},c),Dp(m,b)),r=r.ownerDocument||r,b=r.createElement("script"),gs(b),Ys(b,"link",m),r.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&&(m=a.instance,a.state.loading|=4,Cd(m,c.precedence,r));return a.instance}function Cd(r,a,c){for(var m=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),b=m.length?m[m.length-1]:null,y=b,j=0;j<m.length;j++){var L=m[j];if(L.dataset.precedence===a)y=L;else if(y!==b)break}y?y.parentNode.insertBefore(r,y.nextSibling):(a=c.nodeType===9?c.head:c,a.insertBefore(r,a.firstChild))}function Mp(r,a){r.crossOrigin==null&&(r.crossOrigin=a.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=a.referrerPolicy),r.title==null&&(r.title=a.title)}function Dp(r,a){r.crossOrigin==null&&(r.crossOrigin=a.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=a.referrerPolicy),r.integrity==null&&(r.integrity=a.integrity)}var Ed=null;function Py(r,a,c){if(Ed===null){var m=new Map,b=Ed=new Map;b.set(c,m)}else b=Ed,m=b.get(c),m||(m=new Map,b.set(c,m));if(m.has(r))return m;for(m.set(r,null),c=c.getElementsByTagName(r),b=0;b<c.length;b++){var y=c[b];if(!(y[ka]||y[us]||r==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var j=y.getAttribute(a)||"";j=r+j;var L=m.get(j);L?L.push(y):m.set(j,[y])}}return m}function Iy(r,a,c){r=r.ownerDocument||r,r.head.insertBefore(c,a==="title"?r.querySelector("head > title"):null)}function dT(r,a,c){if(c===1||a.itemProp!=null)return!1;switch(r){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"?(r=a.disabled,typeof a.precedence=="string"&&r==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 $y(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function hT(r,a,c,m){if(c.type==="stylesheet"&&(typeof m.media!="string"||matchMedia(m.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var b=Ko(m.href),y=a.querySelector(uc(b));if(y){a=y._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(r.count++,r=jd.bind(r),a.then(r,r)),c.state.loading|=4,c.instance=y,gs(y);return}y=a.ownerDocument||a,m=zy(m),(b=ni.get(b))&&Mp(m,b),y=y.createElement("link"),gs(y);var j=y;j._p=new Promise(function(L,Y){j.onload=L,j.onerror=Y}),Ys(y,"link",m),c.instance=y}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(c,a),(a=c.state.preload)&&(c.state.loading&3)===0&&(r.count++,c=jd.bind(r),a.addEventListener("load",c),a.addEventListener("error",c))}}var Op=0;function fT(r,a){return r.stylesheets&&r.count===0&&Td(r,r.stylesheets),0<r.count||0<r.imgCount?function(c){var m=setTimeout(function(){if(r.stylesheets&&Td(r,r.stylesheets),r.unsuspend){var y=r.unsuspend;r.unsuspend=null,y()}},6e4+a);0<r.imgBytes&&Op===0&&(Op=62500*WA());var b=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&Td(r,r.stylesheets),r.unsuspend)){var y=r.unsuspend;r.unsuspend=null,y()}},(r.imgBytes>Op?50:800)+a);return r.unsuspend=c,function(){r.unsuspend=null,clearTimeout(m),clearTimeout(b)}}:null}function jd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Td(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var Ad=null;function Td(r,a){r.stylesheets=null,r.unsuspend!==null&&(r.count++,Ad=new Map,a.forEach(mT,r),Ad=null,jd.call(r))}function mT(r,a){if(!(a.state.loading&4)){var c=Ad.get(r);if(c)var m=c.get(null);else{c=new Map,Ad.set(r,c);for(var b=r.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y<b.length;y++){var j=b[y];(j.nodeName==="LINK"||j.getAttribute("media")!=="not all")&&(c.set(j.dataset.precedence,j),m=j)}m&&c.set(null,m)}b=a.instance,j=b.getAttribute("data-precedence"),y=c.get(j)||m,y===m&&c.set(null,b),c.set(j,b),this.count++,m=jd.bind(this),b.addEventListener("load",m),b.addEventListener("error",m),y?y.parentNode.insertBefore(b,y.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(b,r.firstChild)),a.state.loading|=4}}var hc={$$typeof:A,Provider:null,Consumer:null,_currentValue:W,_currentValue2:W,_threadCount:0};function pT(r,a,c,m,b,y,j,L,Y){this.tag=1,this.containerInfo=r,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=it(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=it(0),this.hiddenUpdates=it(null),this.identifierPrefix=m,this.onUncaughtError=b,this.onCaughtError=y,this.onRecoverableError=j,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Y,this.incompleteTransitions=new Map}function Hy(r,a,c,m,b,y,j,L,Y,ue,ve,Ce){return r=new pT(r,a,c,j,Y,ue,ve,Ce,L),a=1,y===!0&&(a|=24),y=On(3,null,null,a),r.current=y,y.stateNode=r,a=fm(),a.refCount++,r.pooledCache=a,a.refCount++,y.memoizedState={element:m,isDehydrated:c,cache:a},xm(y),r}function Uy(r){return r?(r=Co,r):Co}function Fy(r,a,c,m,b,y){b=Uy(b),m.context===null?m.context=b:m.pendingContext=b,m=Gr(a),m.payload={element:c},y=y===void 0?null:y,y!==null&&(m.callback=y),c=Wr(r,m,a),c!==null&&(Nn(c,r,a),ql(c,r,a))}function qy(r,a){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var c=r.retryLane;r.retryLane=c!==0&&c<a?c:a}}function Lp(r,a){qy(r,a),(r=r.alternate)&&qy(r,a)}function Vy(r){if(r.tag===13||r.tag===31){var a=Ta(r,67108864);a!==null&&Nn(a,r,67108864),Lp(r,67108864)}}function Gy(r){if(r.tag===13||r.tag===31){var a=In();a=Xt(a);var c=Ta(r,a);c!==null&&Nn(c,r,a),Lp(r,a)}}var Rd=!0;function gT(r,a,c,m){var b=I.T;I.T=null;var y=Z.p;try{Z.p=2,zp(r,a,c,m)}finally{Z.p=y,I.T=b}}function xT(r,a,c,m){var b=I.T;I.T=null;var y=Z.p;try{Z.p=8,zp(r,a,c,m)}finally{Z.p=y,I.T=b}}function zp(r,a,c,m){if(Rd){var b=Bp(m);if(b===null)wp(r,a,m,Md,c),Ky(r,m);else if(vT(b,r,a,c,m))m.stopPropagation();else if(Ky(r,m),a&4&&-1<bT.indexOf(r)){for(;b!==null;){var y=nr(b);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var j=Be(y.pendingLanes);if(j!==0){var L=y;for(L.pendingLanes|=2,L.entangledLanes|=2;j;){var Y=1<<31-M(j);L.entanglements[1]|=Y,j&=~Y}Ii(y),(Ct&6)===0&&(md=It()+500,ac(0))}}break;case 31:case 13:L=Ta(y,2),L!==null&&Nn(L,y,2),gd(),Lp(y,2)}if(y=Bp(m),y===null&&wp(r,a,m,Md,c),y===b)break;b=y}b!==null&&m.stopPropagation()}else wp(r,a,m,null,c)}}function Bp(r){return r=lt(r),Pp(r)}var Md=null;function Pp(r){if(Md=null,r=an(r),r!==null){var a=l(r);if(a===null)r=null;else{var c=a.tag;if(c===13){if(r=u(a),r!==null)return r;r=null}else if(c===31){if(r=h(a),r!==null)return r;r=null}else if(c===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;r=null}else a!==r&&(r=null)}}return Md=r,null}function Wy(r){switch(r){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(Cs()){case ls:return 2;case gn:return 8;case xn:case Oi:return 32;case S:return 268435456;default:return 32}default:return 32}}var Ip=!1,ia=null,ra=null,aa=null,fc=new Map,mc=new Map,oa=[],bT="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 Ky(r,a){switch(r){case"focusin":case"focusout":ia=null;break;case"dragenter":case"dragleave":ra=null;break;case"mouseover":case"mouseout":aa=null;break;case"pointerover":case"pointerout":fc.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":mc.delete(a.pointerId)}}function pc(r,a,c,m,b,y){return r===null||r.nativeEvent!==y?(r={blockedOn:a,domEventName:c,eventSystemFlags:m,nativeEvent:y,targetContainers:[b]},a!==null&&(a=nr(a),a!==null&&Vy(a)),r):(r.eventSystemFlags|=m,a=r.targetContainers,b!==null&&a.indexOf(b)===-1&&a.push(b),r)}function vT(r,a,c,m,b){switch(a){case"focusin":return ia=pc(ia,r,a,c,m,b),!0;case"dragenter":return ra=pc(ra,r,a,c,m,b),!0;case"mouseover":return aa=pc(aa,r,a,c,m,b),!0;case"pointerover":var y=b.pointerId;return fc.set(y,pc(fc.get(y)||null,r,a,c,m,b)),!0;case"gotpointercapture":return y=b.pointerId,mc.set(y,pc(mc.get(y)||null,r,a,c,m,b)),!0}return!1}function Yy(r){var a=an(r.target);if(a!==null){var c=l(a);if(c!==null){if(a=c.tag,a===13){if(a=u(c),a!==null){r.blockedOn=a,go(r.priority,function(){Gy(c)});return}}else if(a===31){if(a=h(c),a!==null){r.blockedOn=a,go(r.priority,function(){Gy(c)});return}}else if(a===3&&c.stateNode.current.memoizedState.isDehydrated){r.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}r.blockedOn=null}function Dd(r){if(r.blockedOn!==null)return!1;for(var a=r.targetContainers;0<a.length;){var c=Bp(r.nativeEvent);if(c===null){c=r.nativeEvent;var m=new c.constructor(c.type,c);Xe=m,c.target.dispatchEvent(m),Xe=null}else return a=nr(c),a!==null&&Vy(a),r.blockedOn=c,!1;a.shift()}return!0}function Xy(r,a,c){Dd(r)&&c.delete(a)}function _T(){Ip=!1,ia!==null&&Dd(ia)&&(ia=null),ra!==null&&Dd(ra)&&(ra=null),aa!==null&&Dd(aa)&&(aa=null),fc.forEach(Xy),mc.forEach(Xy)}function Od(r,a){r.blockedOn===a&&(r.blockedOn=null,Ip||(Ip=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,_T)))}var Ld=null;function Zy(r){Ld!==r&&(Ld=r,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Ld===r&&(Ld=null);for(var a=0;a<r.length;a+=3){var c=r[a],m=r[a+1],b=r[a+2];if(typeof m!="function"){if(Pp(m||c)===null)continue;break}var y=nr(c);y!==null&&(r.splice(a,3),a-=3,Bm(y,{pending:!0,data:b,method:c.method,action:m},m,b))}}))}function Xo(r){function a(Y){return Od(Y,r)}ia!==null&&Od(ia,r),ra!==null&&Od(ra,r),aa!==null&&Od(aa,r),fc.forEach(a),mc.forEach(a);for(var c=0;c<oa.length;c++){var m=oa[c];m.blockedOn===r&&(m.blockedOn=null)}for(;0<oa.length&&(c=oa[0],c.blockedOn===null);)Yy(c),c.blockedOn===null&&oa.shift();if(c=(r.ownerDocument||r).$$reactFormReplay,c!=null)for(m=0;m<c.length;m+=3){var b=c[m],y=c[m+1],j=b[Js]||null;if(typeof y=="function")j||Zy(c);else if(j){var L=null;if(y&&y.hasAttribute("formAction")){if(b=y,j=y[Js]||null)L=j.formAction;else if(Pp(b)!==null)continue}else L=j.action;typeof L=="function"?c[m+1]=L:(c.splice(m,3),m-=3),Zy(c)}}}function Qy(){function r(y){y.canIntercept&&y.info==="react-transition"&&y.intercept({handler:function(){return new Promise(function(j){return b=j})},focusReset:"manual",scroll:"manual"})}function a(){b!==null&&(b(),b=null),m||setTimeout(c,20)}function c(){if(!m&&!navigation.transition){var y=navigation.currentEntry;y&&y.url!=null&&navigation.navigate(y.url,{state:y.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var m=!1,b=null;return navigation.addEventListener("navigate",r),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(c,100),function(){m=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),b!==null&&(b(),b=null)}}}function $p(r){this._internalRoot=r}zd.prototype.render=$p.prototype.render=function(r){var a=this._internalRoot;if(a===null)throw Error(n(409));var c=a.current,m=In();Fy(c,m,r,a,null,null)},zd.prototype.unmount=$p.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var a=r.containerInfo;Fy(r.current,2,null,r,null,null),gd(),a[Lr]=null}};function zd(r){this._internalRoot=r}zd.prototype.unstable_scheduleHydration=function(r){if(r){var a=po();r={blockedOn:null,target:r,priority:a};for(var c=0;c<oa.length&&a!==0&&a<oa[c].priority;c++);oa.splice(c,0,r),c===0&&Yy(r)}};var Jy=t.version;if(Jy!=="19.2.6")throw Error(n(527,Jy,"19.2.6"));Z.findDOMNode=function(r){var a=r._reactInternals;if(a===void 0)throw typeof r.render=="function"?Error(n(188)):(r=Object.keys(r).join(","),Error(n(268,r)));return r=d(a),r=r!==null?p(r):null,r=r===null?null:r.stateNode,r};var yT={bundleType:0,version:"19.2.6",rendererPackageName:"react-dom",currentDispatcherRef:I,reconcilerVersion:"19.2.6"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Bd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Bd.isDisabled&&Bd.supportsFiber)try{ye=Bd.inject(yT),he=Bd}catch{}}return xc.createRoot=function(r,a){if(!o(r))throw Error(n(299));var c=!1,m="",b=a_,y=o_,j=l_;return a!=null&&(a.unstable_strictMode===!0&&(c=!0),a.identifierPrefix!==void 0&&(m=a.identifierPrefix),a.onUncaughtError!==void 0&&(b=a.onUncaughtError),a.onCaughtError!==void 0&&(y=a.onCaughtError),a.onRecoverableError!==void 0&&(j=a.onRecoverableError)),a=Hy(r,1,!1,null,null,c,m,null,b,y,j,Qy),r[Lr]=a.current,yp(r),new $p(a)},xc.hydrateRoot=function(r,a,c){if(!o(r))throw Error(n(299));var m=!1,b="",y=a_,j=o_,L=l_,Y=null;return c!=null&&(c.unstable_strictMode===!0&&(m=!0),c.identifierPrefix!==void 0&&(b=c.identifierPrefix),c.onUncaughtError!==void 0&&(y=c.onUncaughtError),c.onCaughtError!==void 0&&(j=c.onCaughtError),c.onRecoverableError!==void 0&&(L=c.onRecoverableError),c.formState!==void 0&&(Y=c.formState)),a=Hy(r,1,!0,a,c??null,m,b,Y,y,j,L,Qy),a.context=Uy(null),c=a.current,m=In(),m=Xt(m),b=Gr(m),b.callback=null,Wr(c,b,m),c=m,a.current.lanes=c,Et(a,c),Ii(a),r[Lr]=a.current,yp(r),new zd(a)},xc.version="19.2.6",xc}var cw;function RT(){if(cw)return Fp.exports;cw=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(),Fp.exports=TT(),Fp.exports}var sC=RT();const nC=(...e)=>e.filter((t,s,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===s).join(" ").trim();const MT=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const DT=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,s,n)=>n?n.toUpperCase():s.toLowerCase());const uw=e=>{const t=DT(e);return t.charAt(0).toUpperCase()+t.slice(1)};var Wp={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 OT=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},LT=_.createContext({}),zT=()=>_.useContext(LT),BT=_.forwardRef(({color:e,size:t,strokeWidth:s,absoluteStrokeWidth:n,className:o="",children:l,iconNode:u,...h},f)=>{const{size:d=24,strokeWidth:p=2,absoluteStrokeWidth:g=!1,color:x="currentColor",className:v=""}=zT()??{},w=n??g?Number(s??p)*24/Number(t??d):s??p;return _.createElement("svg",{ref:f,...Wp,width:t??d??Wp.width,height:t??d??Wp.height,stroke:e??x,strokeWidth:w,className:nC("lucide",v,o),...!l&&!OT(h)&&{"aria-hidden":"true"},...h},[...u.map(([k,N])=>_.createElement(k,N)),...Array.isArray(l)?l:[l]])});const xe=(e,t)=>{const s=_.forwardRef(({className:n,...o},l)=>_.createElement(BT,{ref:l,iconNode:t,className:nC(`lucide-${MT(uw(e))}`,`lucide-${e}`,n),...o}));return s.displayName=uw(e),s};const PT=[["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"}]],eo=xe("activity",PT);const IT=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],dw=xe("archive",IT);const $T=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],cf=xe("arrow-down",$T);const HT=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],ou=xe("arrow-left",HT);const UT=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],FT=xe("arrow-right",UT);const qT=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],uf=xe("arrow-up",qT);const VT=[["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"}]],GT=xe("blocks",VT);const WT=[["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"}]],iC=xe("book-open",WT);const KT=[["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"}]],rC=xe("bot",KT);const YT=[["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"}]],df=xe("box",YT);const XT=[["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"}]],ZT=xe("braces",XT);const QT=[["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"}]],aC=xe("brain",QT);const JT=[["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"}]],eR=xe("calendar",JT);const tR=[["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"}]],oC=xe("camera",tR);const sR=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ds=xe("check",sR);const nR=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Wn=xe("chevron-down",nR);const iR=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],rR=xe("chevron-left",iR);const aR=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],jn=xe("chevron-right",aR);const oR=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],hf=xe("chevron-up",oR);const lR=[["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"}]],nb=xe("circle-alert",lR);const cR=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],ff=xe("circle-check-big",cR);const uR=[["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"}]],dR=xe("circle-dashed",uR);const hR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],fR=xe("circle-dot",hR);const mR=[["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"}]],pR=xe("circle-play",mR);const gR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],xR=xe("circle-question-mark",gR);const bR=[["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"}]],ib=xe("circle-x",bR);const vR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],ul=xe("circle",vR);const _R=[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],lC=xe("cloud-upload",_R);const yR=[["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"}]],cC=xe("code-xml",yR);const wR=[["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"}]],Ah=xe("copy",wR);const SR=[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],kR=xe("corner-down-right",SR);const NR=[["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"}]],CR=xe("cpu",NR);const ER=[["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"}]],di=xe("database",ER);const jR=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],AR=xe("dollar-sign",jR);const TR=[["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"}]],Xc=xe("download",TR);const RR=[["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"}]],Th=xe("earth",RR);const MR=[["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"}]],uC=xe("ellipsis",MR);const DR=[["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"}]],io=xe("external-link",DR);const OR=[["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"}]],rb=xe("eye-off",OR);const LR=[["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"}]],mf=xe("eye",LR);const zR=[["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"}]],dC=xe("file-code-corner",zR);const BR=[["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"}]],hC=xe("file-diff",BR);const PR=[["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"}]],fC=xe("file-exclamation-point",PR);const IR=[["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"}]],$R=xe("file-spreadsheet",IR);const HR=[["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"}]],ab=xe("file-text",HR);const UR=[["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"}]],mC=xe("file",UR);const FR=[["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"}]],qR=xe("flask-conical",FR);const VR=[["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"}]],ob=xe("folder-git-2",VR);const GR=[["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"}]],pf=xe("folder-open",GR);const WR=[["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"}]],lb=xe("folder-plus",WR);const KR=[["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"}]],co=xe("folder",KR);const YR=[["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"}]],XR=xe("funnel",YR);const ZR=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],pC=xe("gauge",ZR);const QR=[["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"}]],Gn=xe("git-branch",QR);const JR=[["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"}]],e6=xe("git-commit-horizontal",JR);const t6=[["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"}]],hw=xe("git-fork",t6);const s6=[["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"}]],Rh=xe("git-merge",s6);const n6=[["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"}]],i6=xe("git-pull-request-closed",n6);const r6=[["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"}]],a6=xe("git-pull-request-create",r6);const o6=[["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"}]],gC=xe("git-pull-request",o6);const l6=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],cb=xe("globe",l6);const c6=[["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"}]],u6=xe("grip-vertical",c6);const d6=[["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"}]],h6=xe("heart",d6);const f6=[["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"}]],m6=xe("history",f6);const p6=[["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"}]],g6=xe("image",p6);const x6=[["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"}]],Zc=xe("inbox",x6);const b6=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],v6=xe("info",b6);const _6=[["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"}]],xC=xe("key-round",_6);const y6=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],w6=xe("languages",y6);const S6=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],k6=xe("layers",S6);const N6=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],C6=xe("link",N6);const E6=[["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"}]],j6=xe("list-collapse",E6);const A6=[["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"}]],T6=xe("list-tree",A6);const R6=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],jt=xe("loader-circle",R6);const M6=[["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"}]],fw=xe("loader",M6);const D6=[["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"}]],O6=xe("lock-keyhole",D6);const L6=[["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"}]],bC=xe("lock-open",L6);const z6=[["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"}]],B6=xe("lock",z6);const P6=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],I6=xe("log-in",P6);const $6=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],H6=xe("log-out",$6);const U6=[["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"}]],ub=xe("maximize-2",U6);const F6=[["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"}]],q6=xe("memory-stick",F6);const V6=[["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"}]],G6=xe("message-square-plus",V6);const W6=[["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"}]],K6=xe("message-square",W6);const Y6=[["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"}]],db=xe("minimize-2",Y6);const X6=[["path",{d:"M5 12h14",key:"1ays0h"}]],vC=xe("minus",X6);const Z6=[["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"}]],_C=xe("moon",Z6);const Q6=[["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"}]],J6=xe("network",Q6);const eM=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 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.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],tM=xe("package",eM);const sM=[["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"}]],yC=xe("palette",sM);const nM=[["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"}]],iM=xe("panel-left-close",nM);const rM=[["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"}]],aM=xe("panel-left-open",rM);const oM=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],lM=xe("panel-left",oM);const cM=[["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"}]],uM=xe("paperclip",cM);const dM=[["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"}]],hM=xe("pen-line",dM);const fM=[["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"}]],dl=xe("pencil",fM);const mM=[["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"}]],Tr=xe("play",mM);const pM=[["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"}]],wC=xe("plug",pM);const gM=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ps=xe("plus",gM);const xM=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],hb=xe("puzzle",xM);const bM=[["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"}]],vM=xe("radio",bM);const _M=[["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"}]],Rr=xe("refresh-cw",_M);const yM=[["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"}]],gf=xe("rotate-ccw",yM);const wM=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],SM=xe("rotate-cw",wM);const kM=[["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"}]],SC=xe("save",kM);const NM=[["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"}]],kC=xe("scroll-text",NM);const CM=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],EM=xe("search",CM);const jM=[["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"}]],AM=xe("send-horizontal",jM);const TM=[["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"}]],fb=xe("server",TM);const RM=[["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"}]],mb=xe("settings-2",RM);const MM=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],NC=xe("settings",MM);const DM=[["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"}]],OM=xe("shield-alert",DM);const LM=[["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"}]],zM=xe("shield-check",LM);const BM=[["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"}]],CC=xe("shield-question-mark",BM);const PM=[["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"}]],EC=xe("skip-forward",PM);const IM=[["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"}]],Ri=xe("sparkles",IM);const $M=[["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"}]],xf=xe("square-terminal",$M);const HM=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],ro=xe("square",HM);const UM=[["path",{d:"M11 2v2",key:"1539x4"}],["path",{d:"M5 2v2",key:"1yf1q8"}],["path",{d:"M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1",key:"rb5t3r"}],["path",{d:"M8 15a6 6 0 0 0 12 0v-3",key:"x18d4x"}],["circle",{cx:"20",cy:"10",r:"2",key:"ts1r5v"}]],FM=xe("stethoscope",UM);const qM=[["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"}]],jC=xe("sun",qM);const VM=[["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"}]],AC=xe("table-2",VM);const GM=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],pl=xe("terminal",GM);const WM=[["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"}]],Mi=xe("trash-2",WM);const KM=[["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"}]],Ar=xe("triangle-alert",KM);const YM=[["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"}]],bf=xe("upload",YM);const XM=[["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"}]],ZM=xe("user",XM);const QM=[["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"}]],JM=xe("wand-sparkles",QM);const e8=[["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"}]],t8=xe("webhook",e8);const s8=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],Mh=xe("workflow",s8);const n8=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ut=xe("x",n8);const i8=[["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"}]],TC=xe("zap",i8);class RC extends Error{conflict;constructor(t,s){super(t),this.name="PortConflictResponseError",this.conflict=s}}async function Re(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 RC(n?.error||"Port already in use",n.conflict):new Error(n?.error||s.statusText);return n}async function Ai(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 Re(e,{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:s})}async function Fn(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 Re(e,{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:s})}const r8="modulepreload",a8=function(e){return"/"+e},mw={},lu=function(t,s,n){let o=Promise.resolve();if(s&&s.length>0){let f=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=f(s.map(d=>{if(d=a8(d),d in mw)return;mw[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":r8,p||(x.as="script"),x.crossOrigin="",x.href=d,h&&x.setAttribute("nonce",h),document.head.appendChild(x),p)return new Promise((v,w)=>{x.addEventListener("load",v),x.addEventListener("error",()=>w(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)})},Us=()=>typeof window<"u"&&(!!window.__TAURI_INTERNALS__||!!window.__TAURI__);async function vf(){if(!Us())return null;try{return await lu(()=>import("./window-DlR023_X.js"),__vite__mapDeps([0,1,2]))}catch{return null}}async function o8(){await(await vf())?.getCurrentWindow().minimize()}async function l8(){await(await vf())?.getCurrentWindow().toggleMaximize()}async function c8(){await(await vf())?.getCurrentWindow().hide()}async function u8(){await(await vf())?.getCurrentWindow().startDragging()}async function _f(e){if(Us())try{const{invoke:t}=await lu(async()=>{const{invoke:s}=await import("./core-DhEqZVGG.js");return{invoke:s}},[]);await t("open_external",{url:e});return}catch{}window.open(e,"_blank","noopener,noreferrer")}let Kp=null,Yp=null;async function d8(){return Kp||(Kp=(await lu(()=>import("./core-DhEqZVGG.js"),[])).invoke),Kp}async function h8(){return Yp||(Yp=(await lu(()=>import("./event-BK_86lmQ.js"),__vite__mapDeps([2,1]))).listen),Yp}async function Le(e,t){return(await d8())(e,t)}async function pb(e,t){return(await h8())(e,n=>t(n.payload))}function f8(e){const t=e.state.toLowerCase();return{name:e.name,state:t==="stopping"?"stopped":t,pid:e.pid??void 0,exitCode:e.exitCode??null,url:e.url??void 0}}function m8(e){const t={};for(const s of e.runtime.services)t[s.name]=f8(s);for(const s of e.config.services)typeof s.name!="string"||t[s.name]||(t[s.name]={name:s.name,state:"stopped",pid:void 0,exitCode:null,url:void 0});return{ok:!0,cwd:"",config:{services:e.config.services,bundles:e.config.bundles,gitRepositories:e.config.gitRepositories,selectedGitRepository:e.config.selectedGitRepository??void 0,gitBoardRepositories:e.config.gitBoardRepositories??void 0},runtime:{services:t},ports:[],health:{},timeline:[],logs:[],git:{cwd:"",selectedRepository:null,status:null,branches:[]}}}function p8(e){const t=[];return e.map(s=>{let n=t.indexOf(s.hash);n===-1&&(n=t.indexOf(null),n===-1&&(n=t.length,t.push(null))),t[n]=null;const o=[];for(let h=0;h<s.parents.length;h++){const f=s.parents[h],d=t.indexOf(f);if(d!==-1){const g=d===n?"straight":"merge";o.push({fromLane:n,toLane:d,parentHash:f,kind:g});continue}let p;h===0?(p=n,t[n]=f,o.push({fromLane:n,toLane:n,parentHash:f,kind:"straight"})):(p=t.indexOf(null),p===-1?(p=t.length,t.push(f)):t[p]=f,o.push({fromLane:n,toLane:p,parentHash:f,kind:"branch"}))}const l=t.map((h,f)=>h!==null&&f!==n?f:-1).filter(h=>h!==-1),u=t.reduce((h,f,d)=>f!==null?Math.max(h,d+1):h,n+1);return{lane:n,laneCount:u,edges:o,throughLanes:l}})}function g8(e){const t=p8(e);return e.map((s,n)=>({hash:s.hash,parents:s.parents,author:s.author,email:s.email,timestamp:new Date(s.date).getTime()/1e3,subject:s.subject,refs:s.refs.map(o=>({name:o,kind:o.startsWith("HEAD")?"head":o.startsWith("origin/")||o.includes("/")?"remote":"branch"})),lane:t[n].lane,laneCount:t[n].laneCount,edges:t[n].edges,throughLanes:t[n].throughLanes}))}function x8(e){return e.map(t=>({name:t.name,current:t.isCurrent,remote:t.isRemote}))}async function b8(e){return Le("service_processes",{name:e})}async function v8(){const e=await Le("get_dashboard"),t=m8(e),s=e.runtime.services.filter(d=>d.state.toLowerCase()==="running"),n={};await Promise.all(s.map(async d=>{const p=await b8(d.name).catch(()=>null);p&&(n[d.name]={service:d.name,status:"unknown",summary:"",checkedAt:new Date().toISOString(),checks:[],processTree:p,ports:[],agentContext:""})})),t.health=n;const o=e.config.gitRepositories??[],l=e.config.selectedGitRepository,u=l?o.find(d=>d.name===l)??null:null;if(!u)return t;const[h,f]=await Promise.all([DC().catch(()=>null),B8().catch(()=>[])]);return{...t,git:{cwd:u.path,selectedRepository:u,status:h,branches:f}}}async function MC(e){await Le("start_service",{name:e})}async function _8(e){await Le("stop_service",{name:e})}async function y8(e){await Le("restart_service",{name:e})}async function w8(e){await Le("start_bundle",{name:e})}async function S8(e){await Le("stop_bundle",{name:e})}async function k8(e){await Le("remove_service",{name:e})}async function N8(e){return Le("register_service",{service:e})}async function C8(e){return Le("register_bundle",{bundle:e})}async function E8(e,t){return{logs:await Le("get_logs",{service:e,limit:t??200}),queryable:!1}}async function DC(e){return Le("git_status",{repo:null})}async function j8(e,t){return Le("git_diff",{file:e??null,repo:t??null})}async function A8(e=200){const t=await Le("git_graph",{limit:e,repo:null});return g8(t)}async function T8(e,t){return Le("git_commit_diff",{hash:e,file:t??null,repo:null})}async function R8(e){return await Le("git_commit_files",{hash:e,repo:null})}async function M8(e,t){await Le("git_stage",{paths:e,repo:t??null})}async function D8(e,t){await Le("git_unstage",{paths:e,repo:t??null})}async function O8(e,t){return Le("git_commit",{message:e,repo:t??null})}async function L8(e){return{output:await Le("git_push",{remote:null,repo:e??null}),branch:"",setUpstream:!1}}async function z8(e,t){return await Le("git_create_branch",{name:e,repo:null}),""}async function B8(e){const t=await Le("git_branches",{repo:null});return x8(t)}async function P8(e){return{output:await Le("git_pull_default",{repo:null}),branch:""}}async function I8(e){return Le("git_list_files",{repo:null})}async function $8(e){return Le("git_file_sizes",{repo:null})}async function H8(e){await Le("select_git_repository",{name:e})}async function U8(e,t){const s=await Le("git_read_file",{path:e,repo:null});return{content:s,truncated:!1,binary:!1,size:s.length}}async function F8(e,t,s){await Le("git_write_file",{path:e,content:t,repo:null})}async function q8(e){await Le("remove_git_repository",{name:e})}async function OC(e){return Le("register_git_repository",{repo:e})}async function V8(e){return Le("clone_git_repository",{url:e})}async function G8(e){return await Le("set_git_board_repositories",{names:e}),e}async function W8(){const e=await Le("get_dashboard"),t=e.config.gitRepositories,s=e.config.gitBoardRepositories;return{repos:(await Promise.allSettled(t.map(async l=>{const u=await Le("git_status",{repo:l.name});return{name:l.name,path:l.path,branch:u.branch,ahead:u.ahead,behind:u.behind,files:u.files}}))).map((l,u)=>l.status==="fulfilled"?l.value:{name:t[u].name,path:t[u].path,branch:"",ahead:0,behind:0,files:[],error:String(l.reason)}),board:s??t.map(l=>l.name)}}async function K8(){return Le("get_github_token_status")}async function pw(e,t){await Le("set_github_token",{host:e,token:t})}async function Y8(e){await Le("remove_github_token",{host:e})}async function ln(e){return Le("get_github_repo",{repo:null})}async function X8(e,t,s){return Le("list_pull_requests",{owner:e,repo:t,stateFilter:s??"open"})}async function Z8(e,t,s){return Le("list_issues",{owner:e,repo:t,stateFilter:s??"open"})}async function gw(e,t,s){return Le("get_pull_request",{owner:e,repo:t,number:s})}async function Q8(e){return Le("create_pull_request",e)}async function J8(e){return Le("github_oauth_start",{clientId:e})}async function eD(e,t){return Le("github_oauth_poll",{clientId:e,deviceCode:t})}async function tD(e,t,s){return Le("get_pr_diff",{owner:e,repo:t,number:s})}async function sD(e,t,s){return Le("list_pr_files",{owner:e,repo:t,number:s})}async function nD(e,t,s){return Le("list_pr_reviews",{owner:e,repo:t,number:s})}async function iD(e,t,s){return Le("list_pr_comments",{owner:e,repo:t,number:s})}async function rD(e,t,s,n={}){return Le("merge_pull_request",{owner:e,repo:t,number:s,method:n.method??null,commitTitle:n.commitTitle??null,commitMessage:n.commitMessage??null})}async function aD(e,t,s){return Le("get_github_issue",{owner:e,repo:t,number:s})}async function oD(e,t,s){return Le("list_issue_comments",{owner:e,repo:t,number:s})}async function lD(e,t,s,n){return Le("add_issue_comment",{owner:e,repo:t,number:s,body:n})}async function cD(e,t){return Le("list_github_branches",{owner:e,repo:t})}async function xw(e,t){return Le("get_github_repo_info",{owner:e,repo:t})}async function bw(e,t,s){return Le("list_commit_check_runs",{owner:e,repo:t,sha:s})}async function uD(e,t,s,n){return Le("list_workflow_runs",{owner:e,repo:t,branch:s??null,page:n??null})}async function dD(e,t,s){return Le("list_workflow_run_jobs",{owner:e,repo:t,runId:s})}async function hD(){return Le("list_databases")}async function Xp(e,t,s){return Le("query_database",{name:e,sql:t,limit:s??null})}async function fD(e,t){return Le("execute_database",{name:e,sql:t})}async function mD(e){return Le("list_tables",{name:e})}async function LC(e){await Le("register_database",{db:e})}async function pD(e){await Le("remove_database",{name:e})}async function gD(e,t){await Le("set_database_write_access",{name:e,unlocked:t})}async function xD(){return(await Le("get_config")).logSources}async function bD(e){await Le("register_log_source",{source:e})}async function vD(e){return Le("list_snapshots",{repo:null})}async function _D(e,t){return Le("create_snapshot",{label:e??null,repo:null})}async function yD(e,t){await Le("restore_snapshot",{sha:e,repo:null})}async function wD(e,t){await Le("delete_snapshot",{sha:e,repo:null})}async function SD(e,t){return Le("get_snapshot_files",{sha:e,repo:null})}async function kD(e,t,s){return Le("get_snapshot_diff",{sha:e,path:t??null,repo:null})}async function ND(){return Le("list_workflows")}async function CD(e){return Le("save_workflow",{workflow:e})}async function ED(e){return Le("delete_workflow",{id:e})}async function jD(){return Le("get_agent_info")}async function AD(){return Le("get_agent_chat_status")}async function TD(e){return Le("set_chat_provider",{provider:e})}async function RD(e,t,s){await Le("start_agent_chat",{message:e,resumeSessionId:t??null,provider:s??null})}async function MD(e){return Le("scan_repo_url",{url:e})}async function DD(e,t){await Le("run_install_command",{cwd:e,command:t})}async function OD(){return(await Le("list_terminal_sessions")).map(t=>({...t,serviceName:t.serviceName??void 0,label:t.serviceName??t.label??void 0}))}async function vw(e){const t=await Le("create_terminal_session",{serviceName:e?.serviceName??null,cwd:e?.cwd??null,agent:e?.agent??null});return{...t,serviceName:t.serviceName??void 0,label:t.serviceName??t.label??void 0}}async function _w(e,t){await Le("write_terminal_input",{id:e,data:t})}async function LD(e){await Le("start_terminal_stream",{id:e})}async function zD(e,t,s){await Le("resize_terminal",{id:e,cols:t,rows:s})}async function BD(e){await Le("close_terminal_session",{id:e})}async function PD(e,t){return pb(`terminal-output-${e}`,s=>t(s))}const ID={async getAgentInfo(){return(await Re("/api/agent")).agent},async getMcpAuthStatuses(e){return(await Re(`/api/agent/mcp-status?agent=${encodeURIComponent(e)}`)).statuses},async getAgentUsage(){return(await Re("/api/agent/usage")).usage},async getAgentUsageHistory(e){const t=e?`?since=${encodeURIComponent(e)}`:"",s=await Re(`/api/agent/usage/history${t}`);return{entries:s.entries,summary:s.summary}},async getClaudeAgentSettings(){return(await Re("/api/agent/claude-settings")).settings},async updateClaudeAgentSettings(e){return(await Re("/api/agent/claude-settings",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})).settings}},$D={getAgentInfo:()=>jD(),getMcpAuthStatuses:async()=>[],getAgentUsage:async()=>({}),getAgentUsageHistory:async()=>({entries:[],summary:{runs:0,totalCostUSD:0,totalInputTokens:0,totalOutputTokens:0,totalTokens:0,byDay:[],codexTotalTokens:0}}),getClaudeAgentSettings:async()=>({coAuthorWithClaude:!0}),updateClaudeAgentSettings:async e=>({coAuthorWithClaude:e.coAuthorWithClaude??!0})},HD=Us()?$D:ID,{getAgentInfo:zC,getMcpAuthStatuses:UD,getAgentUsage:FD,getAgentUsageHistory:qD,getClaudeAgentSettings:VD,updateClaudeAgentSettings:GD}=HD,WD={async getAgentChatStatus(){const e=await Re("/api/agent/chat/status");return{configured:e.configured,approvals:e.approvals,provider:e.provider,providers:e.providers??[]}},async setChatProvider(e){return(await Re("/api/agent/chat/provider",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({provider:e})})).provider},async approveAgentTool(e,t,s){await Re("/api/agent/chat/approve",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sessionId:e,requestId:t,decision:s})})},async streamAgentChat(e,t,s,n,o,l){const u=await fetch("/api/agent/chat",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({message:e,resumeSessionId:t,autoApprove:o,provider:l}),signal:n});if(!u.ok||!u.body){const p=await u.json().catch(()=>{});throw new Error(p?.error||u.statusText||"Agent request failed")}const h=u.body.getReader(),f=new TextDecoder;let d="";for(;;){const{done:p,value:g}=await h.read();if(p)break;d+=f.decode(g,{stream:!0});let x=d.indexOf(`
11
-
12
- `);for(;x!==-1;){const v=d.slice(0,x);d=d.slice(x+2);const w=v.split(`
13
- `).find(k=>k.startsWith("data:"));if(w){const k=w.slice(5).trim();if(k)try{s(JSON.parse(k))}catch{}}x=d.indexOf(`
14
-
15
- `)}}}};let Zp="claude";const KD={async getAgentChatStatus(){const t=await AD();return Zp=t.provider?.id??"claude",{...t,providers:t.providers??[]}},async setChatProvider(e){const s=await TD(e)??null;return Zp=s?.id??e,s??{id:e}},approveAgentTool:async()=>{},streamAgentChat(e,t,s,n,o,l){let u,h=!1;return new Promise(f=>{(async()=>{if(u=await pb("agent-chat-event",d=>{if(h)return;const p=d;s(p),(p.type==="done"||p.type==="error")&&(h=!0,u?.(),f())}),n?.aborted){h=!0,u?.(),f();return}n?.addEventListener("abort",()=>{h||(h=!0,u?.(),f())});try{await RD(e,t,l??Zp)}catch(d){h=!0,u?.(),s({type:"error",message:String(d)}),s({type:"done",stopReason:"error"}),f()}})().catch(d=>{h||(h=!0,u?.(),s({type:"error",message:String(d)}),s({type:"done",stopReason:"error"}),f())})})}},YD=Us()?KD:WD,{getAgentChatStatus:XD,setChatProvider:ZD,approveAgentTool:QD,streamAgentChat:JD}=YD;function ki(e,t){return Re(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)})}const e7={async getAgentEnvAgents(){return(await Re("/api/agent-env/agents")).agents},async getAgentEnvConfigs(){return(await Re("/api/agent-env/live")).configs},async getAgentEnvDoctor(){const e=await Re("/api/agent-env/doctor");return{checks:e.checks,hasIssues:e.hasIssues}},async previewAgentEnvChanges(e){const t=await ki("/api/agent-env/changes/preview",{changes:e});return{valid:t.valid,items:t.items,agents:t.agents}},async applyAgentEnvChanges(e){return ki("/api/agent-env/changes/apply",{changes:e})},async getAgentEnvSettings(e){return(await Re(`/api/agent-env/settings/${e}`)).settings},async saveAgentEnvSettings(e,t){const s=await Re(`/api/agent-env/settings/${e}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({content:t})});return{settings:s.settings,backup:s.backup}},async setAgentEnvModel(e,t){const s=await ki(`/api/agent-env/settings/${e}/model`,{model:t});return{settings:s.settings,backup:s.backup}},async listAgentEnvProfiles(){return(await Re("/api/agent-env/profiles")).profiles},async getAgentEnvProfile(e){return(await Re(`/api/agent-env/profiles/${encodeURIComponent(e)}`)).profile},async updateAgentEnvProfile(e,t){return(await Re(`/api/agent-env/profiles/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)})).profile},async deleteAgentEnvProfile(e){await Re(`/api/agent-env/profiles/${encodeURIComponent(e)}`,{method:"DELETE"})},async snapshotAgentEnvProfile(e){return(await ki("/api/agent-env/profiles/snapshot",e)).profile},async previewAgentEnvProfileApply(e,t){return ki(`/api/agent-env/profiles/${encodeURIComponent(e)}/apply-preview`,{agent:t})},async applyAgentEnvProfile({name:e,agent:t,skip:s}){return ki(`/api/agent-env/profiles/${encodeURIComponent(e)}/apply`,{agent:t,skip:s})},async exportAgentEnvProfile(e){return{archivePath:(await ki(`/api/agent-env/profiles/${encodeURIComponent(e)}/export`,{})).archivePath}},async importAgentEnvProfile(e,t){return Re(`/api/agent-env/profiles/import${t?.force?"?force=1":""}`,{method:"POST",headers:{"content-type":"application/gzip"},body:e})},async getRegistryAuthStatus(){const e=await Re("/api/agent-env/auth/status"),{ok:t,...s}=e;return s},async startRegistryAuth(){const e=await ki("/api/agent-env/auth/start",{});return{url:e.url,state:e.state}},async getRegistryAuthOutcome(e){return Re(`/api/agent-env/auth/outcome?state=${encodeURIComponent(e)}`)},async registryLogout(){await ki("/api/agent-env/auth/logout",{})},async publishAgentEnvProfile({name:e,...t}){return ki(`/api/agent-env/profiles/${encodeURIComponent(e)}/publish`,t)},async installAgentEnvProfileFromRegistry(e){return ki("/api/agent-env/profiles/install-from-registry",e)}},js=()=>Promise.reject(new Error("Agent Environments is not available in desktop mode yet.")),t7={getAgentEnvAgents:async()=>[],getAgentEnvConfigs:async()=>[],getAgentEnvDoctor:async()=>({checks:[{label:"Desktop mode",status:"warn",message:"Agent Environments is not available in desktop mode yet."}],hasIssues:!0}),previewAgentEnvChanges:js,applyAgentEnvChanges:js,getAgentEnvSettings:js,saveAgentEnvSettings:js,setAgentEnvModel:js,listAgentEnvProfiles:async()=>[],getAgentEnvProfile:js,updateAgentEnvProfile:js,deleteAgentEnvProfile:js,snapshotAgentEnvProfile:js,previewAgentEnvProfileApply:js,applyAgentEnvProfile:js,exportAgentEnvProfile:js,importAgentEnvProfile:js,getRegistryAuthStatus:js,startRegistryAuth:js,getRegistryAuthOutcome:js,registryLogout:js,publishAgentEnvProfile:js,installAgentEnvProfileFromRegistry:js},s7=Us()?t7:e7,{getAgentEnvAgents:n7,getAgentEnvConfigs:i7,getAgentEnvDoctor:r7,previewAgentEnvChanges:a7,applyAgentEnvChanges:o7,getAgentEnvSettings:l7,saveAgentEnvSettings:c7,setAgentEnvModel:u7,listAgentEnvProfiles:d7,getAgentEnvProfile:h7,updateAgentEnvProfile:f7,deleteAgentEnvProfile:m7,snapshotAgentEnvProfile:p7,previewAgentEnvProfileApply:g7,applyAgentEnvProfile:x7,exportAgentEnvProfile:b7,importAgentEnvProfile:yw,getRegistryAuthStatus:v7,startRegistryAuth:_7,getRegistryAuthOutcome:y7,registryLogout:w7,publishAgentEnvProfile:S7,installAgentEnvProfileFromRegistry:ww}=s7,k7={async listDatabases(){return(await Re("/api/databases")).connections},async detectDatabases(){return(await Re("/api/databases/detect")).detected},async addDatabase(e){await Fn("/api/databases",e)},testDatabase(e){return Fn("/api/databases/test",e)},async deleteDatabase(e){await Re(`/api/databases/${encodeURIComponent(e)}`,{method:"DELETE"})},async getDatabaseTables(e){return(await Re(`/api/databases/${encodeURIComponent(e)}/tables`)).tables},runDatabaseQuery(e,t,s=100){return Fn(`/api/databases/${encodeURIComponent(e)}/query`,{sql:t,limit:s})},async setDatabaseWriteAccess(e,t){await Fn(`/api/databases/${encodeURIComponent(e)}/write-access`,{unlocked:String(t)})},executeDatabaseWrite(e,t,s){return Fn(`/api/databases/${encodeURIComponent(e)}/execute`,{sql:t,mode:s})},getDatabaseRows(e,t,s=100,n=0){return Re(`/api/databases/${encodeURIComponent(e)}/rows?table=${encodeURIComponent(t)}&limit=${s}&offset=${n}`)}};function Sw(e){const t=e.columns.map(n=>({name:n,dataType:"text",nullable:!0,primaryKey:!1})),s=e.rows.map(n=>{const o={};return e.columns.forEach((l,u)=>{o[l]=n[u]}),o});return{columns:t,rows:s,rowCount:e.rowCount}}const N7={async listDatabases(){return await hD()},detectDatabases:async()=>[],async addDatabase(e){await LC(e)},async testDatabase(){try{return await Xp("__test__","SELECT 1",1),{ok:!0}}catch(e){return{ok:!1,error:String(e)}}},async deleteDatabase(e){await pD(e)},async getDatabaseTables(e){return(await mD(e)).map(s=>({name:s,qualifiedName:s}))},async runDatabaseQuery(e,t,s=100){const n=await Xp(e,t,s),{columns:o,rows:l,rowCount:u}=Sw(n);return{engine:"sqlite",columns:o,rows:l,rowCount:u,truncated:!1}},async setDatabaseWriteAccess(e,t){await gD(e,t)},async executeDatabaseWrite(e,t,s){return s==="preview"?{engine:"sqlite",previewUnavailable:!0}:{engine:"sqlite",previewUnavailable:!1,affectedRows:await fD(e,t),committed:!0}},async getDatabaseRows(e,t,s=100,n=0){const o=n>0?`SELECT * FROM ${t} LIMIT ${s} OFFSET ${n}`:`SELECT * FROM ${t} LIMIT ${s}`,l=await Xp(e,o,s),{columns:u,rows:h,rowCount:f}=Sw(l);return{engine:"sqlite",table:{name:t,qualifiedName:t},columns:u,rows:h,rowCount:f,limit:s,offset:n}}},C7=Us()?N7:k7,{listDatabases:BC,detectDatabases:E7,addDatabase:j7,testDatabase:A7,deleteDatabase:T7,getDatabaseTables:PC,runDatabaseQuery:R7,setDatabaseWriteAccess:M7,executeDatabaseWrite:kw,getDatabaseRows:D7}=C7,IC={async getErrorIncidents(e=100){return(await Re(`/api/errors?limit=${e}`)).incidents},getErrorPrompt(e){return Re(`/api/errors/${e}/prompt`)},getErrorBundle(e,t=!1){return Re(`/api/errors/${e}/bundle${t?"?save=1":""}`)},startFix(e){return Re(`/api/errors/${e}/fix`,{method:"POST"})}},O7={...IC,getErrorIncidents:async()=>[]},L7=Us()?O7:IC,{getErrorIncidents:$C,startFix:z7}=L7,B7={async getGitGraph(e=200){return(await Re(`/api/git/graph?limit=${e}`)).commits},async getGitCommitDiff(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 getGitCommitFiles(e){return(await Re(`/api/git/commit/files?hash=${encodeURIComponent(e)}`)).files},async getGitFiles(){return(await Re("/api/git/files")).files},async getFileSizeRanking(){return(await Re("/api/git/file-sizes")).files},async getGitFile(e){const t=await Re(`/api/git/file?path=${encodeURIComponent(e)}`);return{content:t.content,truncated:t.truncated,binary:t.binary,size:t.size}},async updateGitFile(e,t){await Re("/api/git/file",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({path:e,content:t})})},async getGitDiff(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 getGitOverview(){const e=await Re("/api/git/overview"),t=e.repos??[],s=e.board??t.map(n=>n.name);return{repos:t,board:s}},async setGitBoard(e){return(await Re("/api/git/board",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({names:e})})).board},async gitStage(e,t){await Re("/api/git/stage",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t?{paths:e,repo:t}:{paths:e})})},async gitUnstage(e,t){await Re("/api/git/unstage",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t?{paths:e,repo:t}:{paths:e})})},async gitCommit(e,t){return(await Fn("/api/git/commit",{message:e,...t?{repo:t}:{}})).output},async gitPush(e){const t=await Fn("/api/git/push",e?{repo:e}:{});return{output:t.output,branch:t.branch,setUpstream:t.setUpstream}},async gitCheckoutDefaultAndPull(){const e=await Fn("/api/git/default-branch/pull",{});return{output:e.output,branch:e.branch}},async gitCreateBranch(e){return(await Fn("/api/git/branches",{name:e})).output},async deleteGitRepository(e){await Re(`/api/git/repositories/${encodeURIComponent(e)}`,{method:"DELETE"})},async selectGitRepository(e){await Ai("/api/git/select",{name:e})},async registerGitRepository(e,t){await Ai("/api/git/repositories",{name:e,path:t})},async cloneGitRepository(e){const t=await Fn("/api/git/clone",{url:e});return{name:t.name,path:t.path}}},P7={getGitGraph:(e=200)=>A8(e),getGitCommitDiff:(e,t)=>T8(e,t),getGitCommitFiles:e=>R8(e),getGitFiles:()=>I8(),getFileSizeRanking:()=>$8(),getGitFile:e=>U8(e),updateGitFile:(e,t)=>F8(e,t),getGitDiff:(e,t)=>j8(e,t),getGitOverview:()=>W8(),setGitBoard:e=>G8(e),gitStage:(e,t)=>M8(e,t),gitUnstage:(e,t)=>D8(e,t),gitCommit:(e,t)=>O8(e,t),gitPush:e=>L8(e),gitCheckoutDefaultAndPull:()=>P8(),gitCreateBranch:e=>z8(e),deleteGitRepository:e=>q8(e),selectGitRepository:e=>H8(e),registerGitRepository:async(e,t)=>{await OC({name:e,path:t})},cloneGitRepository:e=>V8(e)},I7=Us()?P7:B7,{getGitGraph:$7,getGitCommitDiff:H7,getGitCommitFiles:U7,getGitFiles:F7,getFileSizeRanking:q7,getGitFile:V7,updateGitFile:G7,getGitDiff:HC,getGitOverview:Qp,setGitBoard:Nw,gitStage:gb,gitUnstage:UC,gitCommit:FC,gitPush:yf,gitCheckoutDefaultAndPull:W7,gitCreateBranch:K7,deleteGitRepository:Y7,selectGitRepository:qC,registerGitRepository:X7,cloneGitRepository:Z7}=I7,Q7={getGitHubTokenInfo(){return Re("/api/github/token")},startGitHubDeviceFlow(){return Re("/api/github/oauth/start",{method:"POST"})},async pollGitHubDeviceFlow(e){const t=await Re("/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 setGitHubToken(e,t){const s=new URLSearchParams({host:e,token:t});await Re("/api/github/token",{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:s})},async removeGitHubToken(e){await Re(`/api/github/token/${encodeURIComponent(e)}`,{method:"DELETE"})},async listGitHubBranches(){const e=await Re("/api/github/branches");return{repository:e.repository,defaultBranch:e.defaultBranch,currentBranch:e.currentBranch,branches:e.branches}},async listGitHubPRs(e="open",t=1){return(await Re(`/api/github/prs?state=${e}&page=${t}`)).prs},async getGitHubPR(e){return(await Re(`/api/github/prs/${e}`)).pr},async getGitHubPRDiff(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 getGitHubPRReviewCockpit(e){return(await Re(`/api/github/prs/${e}/review`)).cockpit},async getGitHubPRTemplate(){return(await Re("/api/github/pr-template")).template},async createGitHubPR(e){return(await Re("/api/github/prs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})).pr},async mergeGitHubPR(e,t={}){const s=await Re(`/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 listGitHubIssues(e="open",t=1){return(await Re(`/api/github/issues?state=${e}&page=${t}`)).issues},async getGitHubIssue(e){return(await Re(`/api/github/issues/${e}`)).issue},async listGitHubIssueComments(e){return(await Re(`/api/github/issues/${e}/comments`)).comments},async addGitHubIssueComment(e,t){return(await Re(`/api/github/issues/${e}/comments`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({body:t})})).comment},async getCommitCIStatus(e){return(await Re(`/api/github/ci/${encodeURIComponent(e)}`)).status},async listGitHubWorkflowRuns(e,t=1){const s=new URLSearchParams({page:String(t)});return e&&s.set("branch",e),(await Re(`/api/github/runs?${s}`)).runs},async listGitHubWorkflowRunJobs(e){return(await Re(`/api/github/runs/${e}/jobs`)).jobs}},Cw="Iv23liCxW0Mv0KJP1Svr";function Ew(e){if(e.length===0)return"unknown";const t=e.map(s=>s.conclusion);return t.every(s=>s==="success")?"success":t.some(s=>s==="failure"||s==="cancelled")?"failure":"pending"}const J7={async getGitHubTokenInfo(){const e=await K8();return{configured:e.configured,deviceFlowAvailable:!0,status:e.configured?"connected":"not_configured"}},async startGitHubDeviceFlow(){return await J8(Cw)},async pollGitHubDeviceFlow(e){const t=await eD(Cw,e);return t.access_token?(await pw("github.com",t.access_token),{done:!0}):{done:!1,slowDown:t.error==="slow_down"}},async setGitHubToken(e,t){await pw(e,t)},async removeGitHubToken(e){await Y8(e)},async listGitHubBranches(){const[e,t]=await ln(),[s,n]=await Promise.all([cD(e,t),xw(e,t)]);return{repository:{full_name:n.full_name??`${e}/${t}`,html_url:n.html_url??"",default_branch:n.default_branch},defaultBranch:n.default_branch??null,currentBranch:null,branches:Array.isArray(s)?s:[]}},async listGitHubPRs(e="open",t=1){const[s,n]=await ln();return(await X8(s,n,e)).slice((t-1)*50,t*50)},async getGitHubPR(e){const[t,s]=await ln();return gw(t,s,e)},async getGitHubPRDiff(e){const[t,s]=await ln();return tD(t,s,e)},async getGitHubPRReviewCockpit(e){const[t,s]=await ln(),n=await gw(t,s,e),[o,l,u,h]=await Promise.all([sD(t,s,e),nD(t,s,e),iD(t,s,e),bw(t,s,n.head.sha)]),f=h.check_runs??[];return{pr:n,files:Array.isArray(o)?o:[],reviews:Array.isArray(l)?l:[],comments:Array.isArray(u)?u:[],checks:{sha:n.head.sha,state:Ew(f),totalCount:h.total_count??f.length,runs:f}}},async getGitHubPRTemplate(){const[e,t]=await ln(),s=await xw(e,t),n=s.default_branch??"main";return{repository:{full_name:s.full_name??`${e}/${t}`,html_url:s.html_url??"",default_branch:s.default_branch},currentBranch:null,suggestedBase:n,base:n,head:"",title:"",body:"",draft:!1,compare:{base:n,head:"",aheadBy:0,headSha:null,commits:[],files:[]},warnings:[]}},async createGitHubPR(e){const[t,s]=await ln();return Q8({owner:t,repo:s,title:e.title,body:e.body??"",head:e.head,base:e.base,draft:e.draft})},async mergeGitHubPR(e,t={}){const[s,n]=await ln();return await rD(s,n,e,t)},async listGitHubIssues(e="open",t=1){const[s,n]=await ln();return(await Z8(s,n,e)).slice((t-1)*50,t*50)},async getGitHubIssue(e){const[t,s]=await ln();return aD(t,s,e)},async listGitHubIssueComments(e){const[t,s]=await ln();return oD(t,s,e)},async addGitHubIssueComment(e,t){const[s,n]=await ln();return lD(s,n,e,t)},async getCommitCIStatus(e){const[t,s]=await ln(),n=await bw(t,s,e),o=n.check_runs??[];return{sha:e,state:Ew(o),totalCount:n.total_count??o.length,runs:o}},async listGitHubWorkflowRuns(e,t=1){const[s,n]=await ln();return(await uD(s,n,e,t)).workflow_runs??[]},async listGitHubWorkflowRunJobs(e){const[t,s]=await ln();return(await dD(t,s,e)).jobs??[]}},eO=Us()?J7:Q7,{getGitHubTokenInfo:tO,startGitHubDeviceFlow:sO,pollGitHubDeviceFlow:nO,setGitHubToken:iO,removeGitHubToken:rO,listGitHubBranches:aO,listGitHubPRs:Jp,getGitHubPR:oO,getGitHubPRDiff:lO,getGitHubPRReviewCockpit:cO,getGitHubPRTemplate:uO,createGitHubPR:dO,mergeGitHubPR:hO,listGitHubIssues:eg,getGitHubIssue:fO,listGitHubIssueComments:mO,addGitHubIssueComment:pO,getCommitCIStatus:gO,listGitHubWorkflowRuns:fh,listGitHubWorkflowRunJobs:jw}=eO,xO={async listLogSources(){return(await Re("/api/log-sources")).sources},async addLogSource(e){return(await Fn("/api/log-sources",e)).sources},async getLogSourceLogs(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 Re(`/api/log-sources/${encodeURIComponent(e)}/logs?${s.toString()}`)).logs}};async function Aw(){return await xD()??[]}const bO={listLogSources:Aw,async addLogSource(e){return await bD(e),Aw()},getLogSourceLogs:async()=>[]},vO=Us()?bO:xO,{listLogSources:_O,addLogSource:yO,getLogSourceLogs:VC}=vO,tg={"content-type":"application/json"};function wO(e,t){let s="message",n="";for(const o of e.split(`
16
- `))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{}}const SO={async scanRepo(e){const t=await Re("/api/onboard/scan",{method:"POST",headers:tg,body:JSON.stringify({url:e})});return{profile:t.profile,proposals:t.proposals,databases:t.databases??[]}},async registerOnboarded(e,t,s){const n=s?{name:s.name,engine:s.engine,url:s.url}:void 0;await Re("/api/onboard/register",{method:"POST",headers:tg,body:JSON.stringify({...e,start:t,database:n})})},async streamInstall(e,t){const s=await fetch("/api/onboard/install/stream",{method:"POST",headers:tg,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 f=l.split(`
17
-
18
- `);l=f.pop()??"";for(const d of f)wO(d,t)}}},kO={scanRepo:e=>MD(e),async registerOnboarded(e,t,s){await OC({name:e.name,path:e.cwd}),await N8({name:e.name,kind:e.kind,command:e.command??null,cwd:e.cwd,port:e.port??null,composeFile:e.composeFile??null,composeService:e.composeService??null}),s&&await LC({name:s.name,engine:s.engine,url:s.url}),t&&await MC(e.name)},async streamInstall(e,t){let s;s=await pb("install-output",n=>{const o=n;o.type==="line"?t.onLine({stream:o.stream??"stdout",text:o.text??""}):o.type==="done"?(s?.(),t.onDone(o.exitCode??null)):o.type==="error"&&(s?.(),t.onError(o.message??"Install failed"))});try{await DD(e.clonePath,e.command)}catch(n){s?.(),t.onError(String(n))}}},NO=Us()?kO:SO,{scanRepo:CO,registerOnboarded:EO,streamInstall:jO}=NO,GC={getDashboard(){return Re("/api/dashboard")},async getServiceGraph(){return(await Re("/api/services/graph")).graph},async startService(e){await Re(`/api/services/${encodeURIComponent(e)}/start`,{method:"POST"})},async stopService(e){await Re(`/api/services/${encodeURIComponent(e)}/stop`,{method:"POST"})},async restartService(e){await Re(`/api/services/${encodeURIComponent(e)}/restart`,{method:"POST"})},async startBundle(e){await Re(`/api/bundles/${encodeURIComponent(e)}/start`,{method:"POST"})},async stopBundle(e){await Re(`/api/bundles/${encodeURIComponent(e)}/stop`,{method:"POST"})},async deleteService(e){await Re(`/api/services/${encodeURIComponent(e)}`,{method:"DELETE"})},async registerBundle(e){await Ai("/api/bundles",{name:e.name,originalName:e.name,services:e.services.join(",")})},async getServiceLogs(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 Re(`/api/services/${encodeURIComponent(e)}/logs?${s.toString()}`);return{logs:n.logs,queryable:!!n.queryable}},getDirectories(e,{files:t=!1}={}){const s=new URLSearchParams({path:e});return t&&s.set("files","1"),Re(`/api/fs/directories?${s.toString()}`)},browseServiceConfig(e,t){const s=t?`?path=${encodeURIComponent(t)}`:"";return Re(`/api/services/${encodeURIComponent(e)}/config-browse${s}`)},async getServiceConfigFiles(e){const t=await Re(`/api/services/${encodeURIComponent(e)}/config-files`);return{cwd:t.cwd,files:t.files}},getServiceConfigFile(e,t){return Re(`/api/services/${encodeURIComponent(e)}/config-file?path=${encodeURIComponent(t)}`)},putServiceConfigFileEnv(e,t,s){return Re(`/api/services/${encodeURIComponent(e)}/config-file?path=${encodeURIComponent(t)}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({entries:s})})},putServiceConfigFileText(e,t,s){return Re(`/api/services/${encodeURIComponent(e)}/config-file?path=${encodeURIComponent(t)}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({content:s})})},async getServiceEnvRuntime(e){return(await Re(`/api/services/${encodeURIComponent(e)}/env/runtime`)).runtime},async getServiceMetrics(e){return(await Re(`/api/services/${encodeURIComponent(e)}/metrics`)).metrics},testServiceCommand(e){return Fn("/api/services/test",e)},runServiceTests(e,t){return Fn(`/api/services/${encodeURIComponent(e)}/test`,t?{pattern:t}:{})}},AO={...GC,getDashboard:()=>v8(),startService:e=>MC(e),stopService:e=>_8(e),restartService:e=>y8(e),startBundle:e=>w8(e),stopBundle:e=>S8(e),deleteService:e=>k8(e),registerBundle:e=>C8(e).then(()=>{}),getServiceLogs:(e,t={})=>E8(e,t.lines)},Cr=Us()?AO:GC,{getDashboard:TO,getServiceGraph:RO,startService:MO,stopService:DO,restartService:WC,startBundle:yJ,stopBundle:Tw,deleteService:OO,getServiceLogs:KC,getDirectories:YC,browseServiceConfig:LO,getServiceConfigFiles:zO,getServiceConfigFile:Rw,putServiceConfigFileEnv:BO,putServiceConfigFileText:PO,getServiceEnvRuntime:IO,getServiceMetrics:$O,testServiceCommand:HO,runServiceTests:UO}=Cr;async function FO(e,t,s){t.includes(s)||await Cr.registerBundle({name:e,services:[...t,s]})}async function Mw(e,t){let s,n;try{s=await Cr.getDashboard(),n=await Cr.getServiceGraph()}catch{await Cr.startBundle(e);return}const o=s.config.bundles.find(g=>g.name===e);if(!o){await Cr.startBundle(e);return}const l=new Map(n.nodes.map(g=>[g.name,g.dependsOn])),u=new Map(s.config.services.map(g=>[g.name,g.port])),h=new Set,f=[...o.services];for(;f.length>0;){const g=f.pop();if(!(h.has(g)||!l.has(g))){h.add(g);for(const x of l.get(g)??[])f.push(x)}}const d=n.order.filter(g=>h.has(g)),p=d.length>0?d:o.services;for(const g of p){for(const x of l.get(g)??[]){const v=u.get(x);v&&await qO(v)}await Cr.startService(g),await t?.(g)}}async function qO(e,t=15e3){const s=Date.now()+t;for(;Date.now()<s;){try{if((await Cr.getDashboard()).ports.some(o=>o.port===e&&!o.available))return}catch{return}await new Promise(n=>setTimeout(n,400))}}async function VO(e,t,s){t.includes(s)&&await Cr.registerBundle({name:e,services:t.filter(n=>n!==s)})}async function Dw(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()}const GO={async listSnapshots(){return(await Re("/api/snapshots")).snapshots},async createSnapshot(e){return(await Re("/api/snapshots",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({label:e})})).snapshot},async renameSnapshot(e,t){return(await Re(`/api/snapshots/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({label:t})})).snapshot},async deleteSnapshot(e){await Re(`/api/snapshots/${encodeURIComponent(e)}`,{method:"DELETE"})},async getSnapshotFiles(e){return(await Re(`/api/snapshots/${encodeURIComponent(e)}/files`)).files},getSnapshotDiff(e,t){const s=t?`?path=${encodeURIComponent(t)}`:"";return Dw(`/api/snapshots/${encodeURIComponent(e)}/diff${s}`)},restoreSnapshot(e){return Re(`/api/snapshots/${encodeURIComponent(e)}/restore`,{method:"POST"})},async listChangeSets(){return(await Re("/api/agent/change-sets")).sessions},getChangeSet(e){return Re(`/api/agent/change-sets/${encodeURIComponent(e)}`)},getChangeSetDiff(e,t){const s=t?`?path=${encodeURIComponent(t)}`:"";return Dw(`/api/agent/change-sets/${encodeURIComponent(e)}/diff${s}`)},restoreChangeSet(e){return Re(`/api/agent/change-sets/${encodeURIComponent(e)}/restore`,{method:"POST"})}},WO={listSnapshots:()=>vD(),createSnapshot:e=>_D(e),renameSnapshot:async()=>{throw new Error("Snapshot rename is not supported in desktop mode")},deleteSnapshot:e=>wD(e),getSnapshotFiles:e=>SD(e),getSnapshotDiff:(e,t)=>kD(e,t),async restoreSnapshot(e){return await yD(e),{ok:!0}},listChangeSets:async()=>[],getChangeSet:async()=>{throw new Error("Agent change sets are not available in desktop mode")},getChangeSetDiff:async()=>"",restoreChangeSet:async()=>{throw new Error("Agent change sets are not available in desktop mode")}},KO=Us()?WO:GO,{listSnapshots:YO,createSnapshot:XO,renameSnapshot:ZO,deleteSnapshot:QO,getSnapshotFiles:JO,getSnapshotDiff:eL,restoreSnapshot:tL,listChangeSets:sL,getChangeSet:nL,getChangeSetDiff:iL,restoreChangeSet:rL}=KO,aL={async listTerminalSessions(){return(await Re("/api/terminal/sessions")).sessions},async createTerminalSession(e){return(await Re("/api/terminal/sessions",{method:"POST",...e?.serviceName?{headers:{"content-type":"application/json"},body:JSON.stringify({serviceName:e.serviceName})}:{}})).session},async createAgentTerminalSession(e){return(await Re("/api/terminal/sessions",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({agent:e})})).session},async closeTerminalSession(e){await Re(`/api/terminal/sessions/${encodeURIComponent(e)}`,{method:"DELETE"})}},oL={listTerminalSessions:()=>OD(),createTerminalSession:e=>vw(e),createAgentTerminalSession:e=>vw({agent:e}),closeTerminalSession:e=>BD(e)};function wf(){return Us()?oL:aL}function XC(){return wf().listTerminalSessions()}function mh(e){return wf().createTerminalSession(e)}function lL(e){return wf().createAgentTerminalSession(e)}function Ax(e){return wf().closeTerminalSession(e)}const cL={async listWorkflows(){return(await Re("/api/workflows")).workflows},async saveWorkflow(e){return(await Re("/api/workflows",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})).workflows},async deleteWorkflow(e){return(await Re(`/api/workflows/${encodeURIComponent(e)}`,{method:"DELETE"})).workflows},async getGitStatus(){return(await Re("/api/git/status")).status},async listWorkflowTriggers(){return(await Re("/api/workflow-triggers")).triggers},async saveWorkflowTrigger(e){return(await Re("/api/workflow-triggers",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})).triggers},async deleteWorkflowTrigger(e){return(await Re(`/api/workflow-triggers/${encodeURIComponent(e)}`,{method:"DELETE"})).triggers},async listPendingRuns(){return(await Re("/api/workflow-triggers/pending")).pending},async ackPendingRun(e){await Re(`/api/workflow-triggers/pending/${encodeURIComponent(e)}/ack`,{method:"POST"})}},uL={listWorkflows:()=>ND(),saveWorkflow:e=>CD(e),deleteWorkflow:e=>ED(e),async getGitStatus(){const e=await DC();return{branch:e.branch,upstream:e.upstream??void 0,ahead:e.ahead,behind:e.behind,files:e.files}},listWorkflowTriggers:async()=>[],saveWorkflowTrigger:async()=>[],deleteWorkflowTrigger:async()=>[],listPendingRuns:async()=>[],ackPendingRun:async()=>{}},dL=Us()?uL:cL,{listWorkflows:ZC,saveWorkflow:hL,deleteWorkflow:fL,getGitStatus:sg,listWorkflowTriggers:mL,saveWorkflowTrigger:pL,deleteWorkflowTrigger:gL,listPendingRuns:xL,ackPendingRun:bL}=dL;function QC(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=QC(e[t]))&&(n&&(n+=" "),n+=s)}else for(s in e)e[s]&&(n&&(n+=" "),n+=s);return n}function Qc(){for(var e,t,s=0,n="",o=arguments.length;s<o;s++)(e=arguments[s])&&(t=QC(e))&&(n&&(n+=" "),n+=t);return n}const Ow=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Lw=Qc,JC=(e,t)=>s=>{var n;if(t?.variants==null)return Lw(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=Ow(p)||Ow(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},{}),f=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((d,p)=>{let{class:g,className:x,...v}=p;return Object.entries(v).every(w=>{let[k,N]=w;return Array.isArray(N)?N.includes({...l,...h}[k]):{...l,...h}[k]===N})?[...d,g,x]:d},[]);return Lw(e,u,f,s?.class,s?.className)},vL=(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},_L=(e,t)=>({classGroupId:e,validator:t}),eE=(e=new Map,t=null,s)=>({nextPart:e,validators:t,classGroupId:s}),Dh="-",zw=[],yL="arbitrary..",wL=e=>{const t=kL(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return SL(u);const h=u.split(Dh),f=h[0]===""&&h.length>1?1:0;return tE(h,f,t)},getConflictingClassGroupIds:(u,h)=>{if(h){const f=n[u],d=s[u];return f?d?vL(d,f):f:d||zw}return s[u]||zw}}},tE=(e,t,s)=>{if(e.length-t===0)return s.classGroupId;const o=e[t],l=s.nextPart.get(o);if(l){const d=tE(e,t+1,l);if(d)return d}const u=s.validators;if(u===null)return;const h=t===0?e.join(Dh):e.slice(t).join(Dh),f=u.length;for(let d=0;d<f;d++){const p=u[d];if(p.validator(h))return p.classGroupId}},SL=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?yL+n:void 0})(),kL=e=>{const{theme:t,classGroups:s}=e;return NL(s,t)},NL=(e,t)=>{const s=eE();for(const n in e){const o=e[n];xb(o,s,n,t)}return s},xb=(e,t,s,n)=>{const o=e.length;for(let l=0;l<o;l++){const u=e[l];CL(u,t,s,n)}},CL=(e,t,s,n)=>{if(typeof e=="string"){EL(e,t,s);return}if(typeof e=="function"){jL(e,t,s,n);return}AL(e,t,s,n)},EL=(e,t,s)=>{const n=e===""?t:sE(t,e);n.classGroupId=s},jL=(e,t,s,n)=>{if(TL(e)){xb(e(n),t,s,n);return}t.validators===null&&(t.validators=[]),t.validators.push(_L(s,e))},AL=(e,t,s,n)=>{const o=Object.entries(e),l=o.length;for(let u=0;u<l;u++){const[h,f]=o[u];xb(f,sE(t,h),s,n)}},sE=(e,t)=>{let s=e;const n=t.split(Dh),o=n.length;for(let l=0;l<o;l++){const u=n[l];let h=s.nextPart.get(u);h||(h=eE(),s.nextPart.set(u,h)),s=h}return s},TL=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,RL=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)}}},Tx="!",Bw=":",ML=[],Pw=(e,t,s,n,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:s,maybePostfixModifierPosition:n,isExternal:o}),DL=e=>{const{prefix:t,experimentalParseClassName:s}=e;let n=o=>{const l=[];let u=0,h=0,f=0,d;const p=o.length;for(let k=0;k<p;k++){const N=o[k];if(u===0&&h===0){if(N===Bw){l.push(o.slice(f,k)),f=k+1;continue}if(N==="/"){d=k;continue}}N==="["?u++:N==="]"?u--:N==="("?h++:N===")"&&h--}const g=l.length===0?o:o.slice(f);let x=g,v=!1;g.endsWith(Tx)?(x=g.slice(0,-1),v=!0):g.startsWith(Tx)&&(x=g.slice(1),v=!0);const w=d&&d>f?d-f:void 0;return Pw(l,v,x,w)};if(t){const o=t+Bw,l=n;n=u=>u.startsWith(o)?l(u.slice(o.length)):Pw(ML,!1,u,void 0,!0)}if(s){const o=n;n=l=>s({className:l,parseClassName:o})}return n},OL=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]==="[",f=t.has(u);h||f?(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}},LL=e=>({cache:RL(e.cacheSize),parseClassName:DL(e),sortModifiers:OL(e),postfixLookupClassGroupIds:zL(e),...wL(e)}),zL=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},BL=/\s+/,PL=(e,t)=>{const{parseClassName:s,getClassGroupId:n,getConflictingClassGroupIds:o,sortModifiers:l,postfixLookupClassGroupIds:u}=t,h=[],f=e.trim().split(BL);let d="";for(let p=f.length-1;p>=0;p-=1){const g=f[p],{isExternal:x,modifiers:v,hasImportantModifier:w,baseClassName:k,maybePostfixModifierPosition:N}=s(g);if(x){d=g+(d.length>0?" "+d:d);continue}let E=!!N,T;if(E){const $=k.substring(0,N);T=n($);const O=T&&u[T]?n(k):void 0;O&&O!==T&&(T=O,E=!1)}else T=n(k);if(!T){if(!E){d=g+(d.length>0?" "+d:d);continue}if(T=n(k),!T){d=g+(d.length>0?" "+d:d);continue}E=!1}const A=v.length===0?"":v.length===1?v[0]:l(v).join(":"),C=w?A+Tx:A,R=C+T;if(h.indexOf(R)>-1)continue;h.push(R);const D=o(T,E);for(let $=0;$<D.length;++$){const O=D[$];h.push(C+O)}d=g+(d.length>0?" "+d:d)}return d},IL=(...e)=>{let t=0,s,n,o="";for(;t<e.length;)(s=e[t++])&&(n=nE(s))&&(o&&(o+=" "),o+=n);return o},nE=e=>{if(typeof e=="string")return e;let t,s="";for(let n=0;n<e.length;n++)e[n]&&(t=nE(e[n]))&&(s&&(s+=" "),s+=t);return s},$L=(e,...t)=>{let s,n,o,l;const u=f=>{const d=t.reduce((p,g)=>g(p),e());return s=LL(d),n=s.cache.get,o=s.cache.set,l=h,h(f)},h=f=>{const d=n(f);if(d)return d;const p=PL(f,s);return o(f,p),p};return l=u,(...f)=>l(IL(...f))},HL=[],As=e=>{const t=s=>s[e]||HL;return t.isThemeGetter=!0,t},iE=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,rE=/^\((?:(\w[\w-]*):)?(.+)\)$/i,UL=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,FL=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,qL=/\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$/,VL=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,GL=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,WL=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ca=e=>UL.test(e),ft=e=>!!e&&!Number.isNaN(Number(e)),$i=e=>!!e&&Number.isInteger(Number(e)),ng=e=>e.endsWith("%")&&ft(e.slice(0,-1)),wr=e=>FL.test(e),aE=()=>!0,KL=e=>qL.test(e)&&!VL.test(e),bb=()=>!1,YL=e=>GL.test(e),XL=e=>WL.test(e),ZL=e=>!Ve(e)&&!We(e),QL=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)),JL=e=>ya(e,cE,bb),Ve=e=>iE.test(e),Fa=e=>ya(e,uE,KL),Iw=e=>ya(e,o9,ft),e9=e=>ya(e,hE,aE),t9=e=>ya(e,dE,bb),$w=e=>ya(e,oE,bb),s9=e=>ya(e,lE,XL),Pd=e=>ya(e,fE,YL),We=e=>rE.test(e),bc=e=>uo(e,uE),n9=e=>uo(e,dE),Hw=e=>uo(e,oE),i9=e=>uo(e,cE),r9=e=>uo(e,lE),Id=e=>uo(e,fE,!0),a9=e=>uo(e,hE,!0),ya=(e,t,s)=>{const n=iE.exec(e);return n?n[1]?t(n[1]):s(n[2]):!1},uo=(e,t,s=!1)=>{const n=rE.exec(e);return n?n[1]?t(n[1]):s:!1},oE=e=>e==="position"||e==="percentage",lE=e=>e==="image"||e==="url",cE=e=>e==="length"||e==="size"||e==="bg-size",uE=e=>e==="length",o9=e=>e==="number",dE=e=>e==="family-name",hE=e=>e==="number"||e==="weight",fE=e=>e==="shadow",l9=()=>{const e=As("color"),t=As("font"),s=As("text"),n=As("font-weight"),o=As("tracking"),l=As("leading"),u=As("breakpoint"),h=As("container"),f=As("spacing"),d=As("radius"),p=As("shadow"),g=As("inset-shadow"),x=As("text-shadow"),v=As("drop-shadow"),w=As("blur"),k=As("perspective"),N=As("aspect"),E=As("ease"),T=As("animate"),A=()=>["auto","avoid","all","avoid-page","page","left","right","column"],C=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],R=()=>[...C(),We,Ve],D=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto","contain","none"],O=()=>[We,Ve,f],P=()=>[ca,"full","auto",...O()],B=()=>[$i,"none","subgrid",We,Ve],G=()=>["auto",{span:["full",$i,We,Ve]},$i,We,Ve],F=()=>[$i,"auto",We,Ve],z=()=>["auto","min","max","fr",We,Ve],U=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],K=()=>["start","end","center","stretch","center-safe","end-safe"],I=()=>["auto",...O()],Z=()=>[ca,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...O()],W=()=>[ca,"screen","full","dvw","lvw","svw","min","max","fit",...O()],te=()=>[ca,"screen","full","lh","dvh","lvh","svh","min","max","fit",...O()],X=()=>[e,We,Ve],V=()=>[...C(),Hw,$w,{position:[We,Ve]}],q=()=>["no-repeat",{repeat:["","x","y","space","round"]}],le=()=>["auto","cover","contain",i9,JL,{size:[We,Ve]}],ee=()=>[ng,bc,Fa],fe=()=>["","none","full",d,We,Ve],ie=()=>["",ft,bc,Fa],Se=()=>["solid","dashed","dotted","double"],Me=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],De=()=>[ft,ng,Hw,$w],Je=()=>["","none",w,We,Ve],Ne=()=>["none",ft,We,Ve],Ue=()=>["none",ft,We,Ve],$e=()=>[ft,We,Ve],St=()=>[ca,"full",...O()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[wr],breakpoint:[wr],color:[aE],container:[wr],"drop-shadow":[wr],ease:["in","out","in-out"],font:[ZL],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[wr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[wr],shadow:[wr],spacing:["px",ft],text:[wr],"text-shadow":[wr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ca,Ve,We,N]}],container:["container"],"container-type":[{"@container":["","normal","size",We,Ve]}],"container-named":[QL],columns:[{columns:[ft,Ve,We,h]}],"break-after":[{"break-after":A()}],"break-before":[{"break-before":A()}],"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:R()}],overflow:[{overflow:D()}],"overflow-x":[{"overflow-x":D()}],"overflow-y":[{"overflow-y":D()}],overscroll:[{overscroll:$()}],"overscroll-x":[{"overscroll-x":$()}],"overscroll-y":[{"overscroll-y":$()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:P()}],"inset-x":[{"inset-x":P()}],"inset-y":[{"inset-y":P()}],start:[{"inset-s":P(),start:P()}],end:[{"inset-e":P(),end:P()}],"inset-bs":[{"inset-bs":P()}],"inset-be":[{"inset-be":P()}],top:[{top:P()}],right:[{right:P()}],bottom:[{bottom:P()}],left:[{left:P()}],visibility:["visible","invisible","collapse"],z:[{z:[$i,"auto",We,Ve]}],basis:[{basis:[ca,"full","auto",h,...O()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ft,ca,"auto","initial","none",Ve]}],grow:[{grow:["",ft,We,Ve]}],shrink:[{shrink:["",ft,We,Ve]}],order:[{order:[$i,"first","last","none",We,Ve]}],"grid-cols":[{"grid-cols":B()}],"col-start-end":[{col:G()}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":B()}],"row-start-end":[{row:G()}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":z()}],"auto-rows":[{"auto-rows":z()}],gap:[{gap:O()}],"gap-x":[{"gap-x":O()}],"gap-y":[{"gap-y":O()}],"justify-content":[{justify:[...U(),"normal"]}],"justify-items":[{"justify-items":[...K(),"normal"]}],"justify-self":[{"justify-self":["auto",...K()]}],"align-content":[{content:["normal",...U()]}],"align-items":[{items:[...K(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...K(),{baseline:["","last"]}]}],"place-content":[{"place-content":U()}],"place-items":[{"place-items":[...K(),"baseline"]}],"place-self":[{"place-self":["auto",...K()]}],p:[{p:O()}],px:[{px:O()}],py:[{py:O()}],ps:[{ps:O()}],pe:[{pe:O()}],pbs:[{pbs:O()}],pbe:[{pbe:O()}],pt:[{pt:O()}],pr:[{pr:O()}],pb:[{pb:O()}],pl:[{pl:O()}],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":O()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":O()}],"space-y-reverse":["space-y-reverse"],size:[{size:Z()}],"inline-size":[{inline:["auto",...W()]}],"min-inline-size":[{"min-inline":["auto",...W()]}],"max-inline-size":[{"max-inline":["none",...W()]}],"block-size":[{block:["auto",...te()]}],"min-block-size":[{"min-block":["auto",...te()]}],"max-block-size":[{"max-block":["none",...te()]}],w:[{w:[h,"screen",...Z()]}],"min-w":[{"min-w":[h,"screen","none",...Z()]}],"max-w":[{"max-w":[h,"screen","none","prose",{screen:[u]},...Z()]}],h:[{h:["screen","lh",...Z()]}],"min-h":[{"min-h":["screen","lh","none",...Z()]}],"max-h":[{"max-h":["screen","lh",...Z()]}],"font-size":[{text:["base",s,bc,Fa]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,a9,e9]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ng,Ve]}],"font-family":[{font:[n9,t9,t]}],"font-features":[{"font-features":[Ve]}],"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,We,Ve]}],"line-clamp":[{"line-clamp":[ft,"none",We,Iw]}],leading:[{leading:[l,...O()]}],"list-image":[{"list-image":["none",We,Ve]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",We,Ve]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:X()}],"text-color":[{text:X()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Se(),"wavy"]}],"text-decoration-thickness":[{decoration:[ft,"from-font","auto",We,Fa]}],"text-decoration-color":[{decoration:X()}],"underline-offset":[{"underline-offset":[ft,"auto",We,Ve]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"tab-size":[{tab:[$i,We,Ve]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",We,Ve]}],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",We,Ve]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:V()}],"bg-repeat":[{bg:q()}],"bg-size":[{bg:le()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},$i,We,Ve],radial:["",We,Ve],conic:[$i,We,Ve]},r9,s9]}],"bg-color":[{bg:X()}],"gradient-from-pos":[{from:ee()}],"gradient-via-pos":[{via:ee()}],"gradient-to-pos":[{to:ee()}],"gradient-from":[{from:X()}],"gradient-via":[{via:X()}],"gradient-to":[{to:X()}],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:ie()}],"border-w-x":[{"border-x":ie()}],"border-w-y":[{"border-y":ie()}],"border-w-s":[{"border-s":ie()}],"border-w-e":[{"border-e":ie()}],"border-w-bs":[{"border-bs":ie()}],"border-w-be":[{"border-be":ie()}],"border-w-t":[{"border-t":ie()}],"border-w-r":[{"border-r":ie()}],"border-w-b":[{"border-b":ie()}],"border-w-l":[{"border-l":ie()}],"divide-x":[{"divide-x":ie()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ie()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Se(),"hidden","none"]}],"divide-style":[{divide:[...Se(),"hidden","none"]}],"border-color":[{border:X()}],"border-color-x":[{"border-x":X()}],"border-color-y":[{"border-y":X()}],"border-color-s":[{"border-s":X()}],"border-color-e":[{"border-e":X()}],"border-color-bs":[{"border-bs":X()}],"border-color-be":[{"border-be":X()}],"border-color-t":[{"border-t":X()}],"border-color-r":[{"border-r":X()}],"border-color-b":[{"border-b":X()}],"border-color-l":[{"border-l":X()}],"divide-color":[{divide:X()}],"outline-style":[{outline:[...Se(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ft,We,Ve]}],"outline-w":[{outline:["",ft,bc,Fa]}],"outline-color":[{outline:X()}],shadow:[{shadow:["","none",p,Id,Pd]}],"shadow-color":[{shadow:X()}],"inset-shadow":[{"inset-shadow":["none",g,Id,Pd]}],"inset-shadow-color":[{"inset-shadow":X()}],"ring-w":[{ring:ie()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:X()}],"ring-offset-w":[{"ring-offset":[ft,Fa]}],"ring-offset-color":[{"ring-offset":X()}],"inset-ring-w":[{"inset-ring":ie()}],"inset-ring-color":[{"inset-ring":X()}],"text-shadow":[{"text-shadow":["none",x,Id,Pd]}],"text-shadow-color":[{"text-shadow":X()}],opacity:[{opacity:[ft,We,Ve]}],"mix-blend":[{"mix-blend":[...Me(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Me()}],"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":[ft]}],"mask-image-linear-from-pos":[{"mask-linear-from":De()}],"mask-image-linear-to-pos":[{"mask-linear-to":De()}],"mask-image-linear-from-color":[{"mask-linear-from":X()}],"mask-image-linear-to-color":[{"mask-linear-to":X()}],"mask-image-t-from-pos":[{"mask-t-from":De()}],"mask-image-t-to-pos":[{"mask-t-to":De()}],"mask-image-t-from-color":[{"mask-t-from":X()}],"mask-image-t-to-color":[{"mask-t-to":X()}],"mask-image-r-from-pos":[{"mask-r-from":De()}],"mask-image-r-to-pos":[{"mask-r-to":De()}],"mask-image-r-from-color":[{"mask-r-from":X()}],"mask-image-r-to-color":[{"mask-r-to":X()}],"mask-image-b-from-pos":[{"mask-b-from":De()}],"mask-image-b-to-pos":[{"mask-b-to":De()}],"mask-image-b-from-color":[{"mask-b-from":X()}],"mask-image-b-to-color":[{"mask-b-to":X()}],"mask-image-l-from-pos":[{"mask-l-from":De()}],"mask-image-l-to-pos":[{"mask-l-to":De()}],"mask-image-l-from-color":[{"mask-l-from":X()}],"mask-image-l-to-color":[{"mask-l-to":X()}],"mask-image-x-from-pos":[{"mask-x-from":De()}],"mask-image-x-to-pos":[{"mask-x-to":De()}],"mask-image-x-from-color":[{"mask-x-from":X()}],"mask-image-x-to-color":[{"mask-x-to":X()}],"mask-image-y-from-pos":[{"mask-y-from":De()}],"mask-image-y-to-pos":[{"mask-y-to":De()}],"mask-image-y-from-color":[{"mask-y-from":X()}],"mask-image-y-to-color":[{"mask-y-to":X()}],"mask-image-radial":[{"mask-radial":[We,Ve]}],"mask-image-radial-from-pos":[{"mask-radial-from":De()}],"mask-image-radial-to-pos":[{"mask-radial-to":De()}],"mask-image-radial-from-color":[{"mask-radial-from":X()}],"mask-image-radial-to-color":[{"mask-radial-to":X()}],"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":C()}],"mask-image-conic-pos":[{"mask-conic":[ft]}],"mask-image-conic-from-pos":[{"mask-conic-from":De()}],"mask-image-conic-to-pos":[{"mask-conic-to":De()}],"mask-image-conic-from-color":[{"mask-conic-from":X()}],"mask-image-conic-to-color":[{"mask-conic-to":X()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:V()}],"mask-repeat":[{mask:q()}],"mask-size":[{mask:le()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",We,Ve]}],filter:[{filter:["","none",We,Ve]}],blur:[{blur:Je()}],brightness:[{brightness:[ft,We,Ve]}],contrast:[{contrast:[ft,We,Ve]}],"drop-shadow":[{"drop-shadow":["","none",v,Id,Pd]}],"drop-shadow-color":[{"drop-shadow":X()}],grayscale:[{grayscale:["",ft,We,Ve]}],"hue-rotate":[{"hue-rotate":[ft,We,Ve]}],invert:[{invert:["",ft,We,Ve]}],saturate:[{saturate:[ft,We,Ve]}],sepia:[{sepia:["",ft,We,Ve]}],"backdrop-filter":[{"backdrop-filter":["","none",We,Ve]}],"backdrop-blur":[{"backdrop-blur":Je()}],"backdrop-brightness":[{"backdrop-brightness":[ft,We,Ve]}],"backdrop-contrast":[{"backdrop-contrast":[ft,We,Ve]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ft,We,Ve]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ft,We,Ve]}],"backdrop-invert":[{"backdrop-invert":["",ft,We,Ve]}],"backdrop-opacity":[{"backdrop-opacity":[ft,We,Ve]}],"backdrop-saturate":[{"backdrop-saturate":[ft,We,Ve]}],"backdrop-sepia":[{"backdrop-sepia":["",ft,We,Ve]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":O()}],"border-spacing-x":[{"border-spacing-x":O()}],"border-spacing-y":[{"border-spacing-y":O()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",We,Ve]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ft,"initial",We,Ve]}],ease:[{ease:["linear","initial",E,We,Ve]}],delay:[{delay:[ft,We,Ve]}],animate:[{animate:["none",T,We,Ve]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[k,We,Ve]}],"perspective-origin":[{"perspective-origin":R()}],rotate:[{rotate:Ne()}],"rotate-x":[{"rotate-x":Ne()}],"rotate-y":[{"rotate-y":Ne()}],"rotate-z":[{"rotate-z":Ne()}],scale:[{scale:Ue()}],"scale-x":[{"scale-x":Ue()}],"scale-y":[{"scale-y":Ue()}],"scale-z":[{"scale-z":Ue()}],"scale-3d":["scale-3d"],skew:[{skew:$e()}],"skew-x":[{"skew-x":$e()}],"skew-y":[{"skew-y":$e()}],transform:[{transform:[We,Ve,"","none","gpu","cpu"]}],"transform-origin":[{origin:R()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:St()}],"translate-x":[{"translate-x":St()}],"translate-y":[{"translate-y":St()}],"translate-z":[{"translate-z":St()}],"translate-none":["translate-none"],zoom:[{zoom:[$i,We,Ve]}],accent:[{accent:X()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:X()}],"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",We,Ve]}],"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":X()}],"scrollbar-track-color":[{"scrollbar-track":X()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mbs":[{"scroll-mbs":O()}],"scroll-mbe":[{"scroll-mbe":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pbs":[{"scroll-pbs":O()}],"scroll-pbe":[{"scroll-pbe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"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",We,Ve]}],fill:[{fill:["none",...X()]}],"stroke-w":[{stroke:[ft,bc,Fa,Iw]}],stroke:[{stroke:["none",...X()]}],"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"]}},c9=$L(l9);function ae(...e){return c9(Qc(e))}const u9=[{unit:"year",ms:365*24*60*60*1e3},{unit:"month",ms:720*60*60*1e3},{unit:"day",ms:1440*60*1e3},{unit:"hour",ms:3600*1e3},{unit:"minute",ms:60*1e3}],d9=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});function mE(e){const t=new Date(e).getTime();if(Number.isNaN(t))return"";const s=t-Date.now(),n=Math.abs(s);if(n<60*1e3)return"just now";for(const{unit:o,ms:l}of u9)if(n>=l)return d9.format(Math.round(s/l),o);return"just now"}const h9=JC("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",success:"bg-emerald-600 text-white hover:bg-emerald-700"},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 J({className:e,variant:t,size:s,...n}){return i.jsx("button",{className:ae(h9({variant:t,size:s,className:e})),...n})}const pE=_.createContext({});function f9(e){const t=_.useRef(null);return t.current===null&&(t.current=e()),t.current}const m9=typeof window<"u",p9=m9?_.useLayoutEffect:_.useEffect,vb=_.createContext(null);function _b(e,t){e.indexOf(t)===-1&&e.push(t)}function Oh(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 yb=()=>{};const va={},gE=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function xE(e){return typeof e=="object"&&e!==null}const bE=e=>/^0[^.\s]+$/u.test(e);function vE(e){let t;return()=>(t===void 0&&(t=e()),t)}const ci=e=>e,g9=(e,t)=>s=>t(e(s)),cu=(...e)=>e.reduce(g9),Jc=(e,t,s)=>{const n=t-e;return n===0?1:(s-e)/n};class wb{constructor(){this.subscriptions=[]}add(t){return _b(this.subscriptions,t),()=>Oh(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 qn=e=>e*1e3,li=e=>e/1e3;function _E(e,t){return t?e*(1e3/t):0}const yE=(e,t,s)=>(((1-3*s+3*t)*e+(3*s-6*t))*e+3*t)*e,x9=1e-7,b9=12;function v9(e,t,s,n,o){let l,u,h=0;do u=t+(s-t)/2,l=yE(u,n,o)-e,l>0?s=u:t=u;while(Math.abs(l)>x9&&++h<b9);return u}function uu(e,t,s,n){if(e===t&&s===n)return ci;const o=l=>v9(l,0,1,e,s);return l=>l===0||l===1?l:yE(o(l),t,n)}const wE=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,SE=e=>t=>1-e(1-t),kE=uu(.33,1.53,.69,.99),Sb=SE(kE),NE=wE(Sb),CE=e=>e>=1?1:(e*=2)<1?.5*Sb(e):.5*(2-Math.pow(2,-10*(e-1))),kb=e=>1-Math.sin(Math.acos(e)),EE=SE(kb),jE=wE(kb),_9=uu(.42,0,1,1),y9=uu(0,0,.58,1),AE=uu(.42,0,.58,1),w9=e=>Array.isArray(e)&&typeof e[0]!="number",TE=e=>Array.isArray(e)&&typeof e[0]=="number",S9={linear:ci,easeIn:_9,easeInOut:AE,easeOut:y9,circIn:kb,circInOut:jE,circOut:EE,backIn:Sb,backInOut:NE,backOut:kE,anticipate:CE},k9=e=>typeof e=="string",Uw=e=>{if(TE(e)){yb(e.length===4);const[t,s,n,o]=e;return uu(t,s,n,o)}else if(k9(e))return S9[e];return e},$d=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function N9(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 f(p){u.has(p)&&(d.schedule(p),e()),p(h)}const d={schedule:(p,g=!1,x=!1)=>{const w=x&&o?s:n;return g&&u.add(p),w.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(f),s.clear(),o=!1,l&&(l=!1,d.process(p))}};return d}const C9=40;function RE(e,t){let s=!1,n=!0;const o={delta:0,timestamp:0,isProcessing:!1},l=()=>s=!0,u=$d.reduce((A,C)=>(A[C]=N9(l),A),{}),{setup:h,read:f,resolveKeyframes:d,preUpdate:p,update:g,preRender:x,render:v,postRender:w}=u,k=()=>{const A=va.useManualTiming,C=A?o.timestamp:performance.now();s=!1,A||(o.delta=n?1e3/60:Math.max(Math.min(C-o.timestamp,C9),1)),o.timestamp=C,o.isProcessing=!0,h.process(o),f.process(o),d.process(o),p.process(o),g.process(o),x.process(o),v.process(o),w.process(o),o.isProcessing=!1,s&&t&&(n=!1,e(k))},N=()=>{s=!0,n=!0,o.isProcessing||e(k)};return{schedule:$d.reduce((A,C)=>{const R=u[C];return A[C]=(D,$=!1,O=!1)=>(s||N(),R.schedule(D,$,O)),A},{}),cancel:A=>{for(let C=0;C<$d.length;C++)u[$d[C]].cancel(A)},state:o,steps:u}}const{schedule:Ht,cancel:_a,state:Xs,steps:ig}=RE(typeof requestAnimationFrame<"u"?requestAnimationFrame:ci,!0);let ph;function E9(){ph=void 0}const dn={now:()=>(ph===void 0&&dn.set(Xs.isProcessing||va.useManualTiming?Xs.timestamp:performance.now()),ph),set:e=>{ph=e,queueMicrotask(E9)}},ME=e=>t=>typeof t=="string"&&t.startsWith(e),DE=ME("--"),j9=ME("var(--"),Nb=e=>j9(e)?A9.test(e.split("/*")[0].trim()):!1,A9=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Fw(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const gl={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},eu={...gl,transform:e=>Zi(0,1,e)},Hd={...gl,default:1},Uc=e=>Math.round(e*1e5)/1e5,Cb=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function T9(e){return e==null}const R9=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Eb=(e,t)=>s=>!!(typeof s=="string"&&R9.test(s)&&s.startsWith(e)||t&&!T9(s)&&Object.prototype.hasOwnProperty.call(s,t)),OE=(e,t,s)=>n=>{if(typeof n!="string")return n;const[o,l,u,h]=n.match(Cb);return{[e]:parseFloat(o),[t]:parseFloat(l),[s]:parseFloat(u),alpha:h!==void 0?parseFloat(h):1}},M9=e=>Zi(0,255,e),rg={...gl,transform:e=>Math.round(M9(e))},Za={test:Eb("rgb","red"),parse:OE("red","green","blue"),transform:({red:e,green:t,blue:s,alpha:n=1})=>"rgba("+rg.transform(e)+", "+rg.transform(t)+", "+rg.transform(s)+", "+Uc(eu.transform(n))+")"};function D9(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 Rx={test:Eb("#"),parse:D9,transform:Za.transform},du=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),ma=du("deg"),Ki=du("%"),Ye=du("px"),O9=du("vh"),L9=du("vw"),qw={...Ki,parse:e=>Ki.parse(e)/100,transform:e=>Ki.transform(e*100)},sl={test:Eb("hsl","hue"),parse:OE("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:s,alpha:n=1})=>"hsla("+Math.round(e)+", "+Ki.transform(Uc(t))+", "+Ki.transform(Uc(s))+", "+Uc(eu.transform(n))+")"},Ss={test:e=>Za.test(e)||Rx.test(e)||sl.test(e),parse:e=>Za.test(e)?Za.parse(e):sl.test(e)?sl.parse(e):Rx.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Za.transform(e):sl.transform(e),getAnimatableNone:e=>{const t=Ss.parse(e);return t.alpha=0,Ss.transform(t)}},z9=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function B9(e){return isNaN(e)&&typeof e=="string"&&(e.match(Cb)?.length||0)+(e.match(z9)?.length||0)>0}const LE="number",zE="color",P9="var",I9="var(",Vw="${}",$9=/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 hl(e){const t=e.toString(),s=[],n={color:[],number:[],var:[]},o=[];let l=0;const h=t.replace($9,f=>(Ss.test(f)?(n.color.push(l),o.push(zE),s.push(Ss.parse(f))):f.startsWith(I9)?(n.var.push(l),o.push(P9),s.push(f)):(n.number.push(l),o.push(LE),s.push(parseFloat(f))),++l,Vw)).split(Vw);return{values:s,split:h,indexes:n,types:o}}function H9(e){return hl(e).values}function BE({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===LE?o+=Uc(n[l]):u===zE?o+=Ss.transform(n[l]):o+=n[l]}return o}}function U9(e){return BE(hl(e))}const F9=e=>typeof e=="number"?0:Ss.test(e)?Ss.getAnimatableNone(e):e,q9=(e,t)=>typeof e=="number"?t?.trim().endsWith("/")?e:0:F9(e);function V9(e){const t=hl(e);return BE(t)(t.values.map((n,o)=>q9(n,t.split[o])))}const Ti={test:B9,parse:H9,createTransformer:U9,getAnimatableNone:V9};function ag(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 G9({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,f=2*s-h;o=ag(f,h,e+1/3),l=ag(f,h,e),u=ag(f,h,e-1/3)}return{red:Math.round(o*255),green:Math.round(l*255),blue:Math.round(u*255),alpha:n}}function Lh(e,t){return s=>s>0?t:e}const Kt=(e,t,s)=>e+(t-e)*s,og=(e,t,s)=>{const n=e*e,o=s*(t*t-n)+n;return o<0?0:Math.sqrt(o)},W9=[Rx,Za,sl],K9=e=>W9.find(t=>t.test(e));function Gw(e){const t=K9(e);if(!t)return!1;let s=t.parse(e);return t===sl&&(s=G9(s)),s}const Ww=(e,t)=>{const s=Gw(e),n=Gw(t);if(!s||!n)return Lh(e,t);const o={...s};return l=>(o.red=og(s.red,n.red,l),o.green=og(s.green,n.green,l),o.blue=og(s.blue,n.blue,l),o.alpha=Kt(s.alpha,n.alpha,l),Za.transform(o))},Mx=new Set(["none","hidden"]);function Y9(e,t){return Mx.has(e)?s=>s<=0?e:t:s=>s>=1?t:e}function X9(e,t){return s=>Kt(e,t,s)}function jb(e){return typeof e=="number"?X9:typeof e=="string"?Nb(e)?Lh:Ss.test(e)?Ww:J9:Array.isArray(e)?PE:typeof e=="object"?Ss.test(e)?Ww:Z9:Lh}function PE(e,t){const s=[...e],n=s.length,o=e.map((l,u)=>jb(l)(l,t[u]));return l=>{for(let u=0;u<n;u++)s[u]=o[u](l);return s}}function Z9(e,t){const s={...e,...t},n={};for(const o in s)e[o]!==void 0&&t[o]!==void 0&&(n[o]=jb(e[o])(e[o],t[o]));return o=>{for(const l in n)s[l]=n[l](o);return s}}function Q9(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 J9=(e,t)=>{const s=Ti.createTransformer(t),n=hl(e),o=hl(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?Mx.has(e)&&!o.values.length||Mx.has(t)&&!n.values.length?Y9(e,t):cu(PE(Q9(n,o),o.values),s):Lh(e,t)};function IE(e,t,s){return typeof e=="number"&&typeof t=="number"&&typeof s=="number"?Kt(e,t,s):jb(e)(e,t)}const ez=e=>{const t=({timestamp:s})=>e(s);return{start:(s=!0)=>Ht.update(t,s),stop:()=>_a(t),now:()=>Xs.isProcessing?Xs.timestamp:dn.now()}},$E=(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)})`},zh=2e4;function Ab(e){let t=0;const s=50;let n=e.next(t);for(;!n.done&&t<zh;)t+=s,n=e.next(t);return t>=zh?1/0:t}function tz(e,t=100,s){const n=s({...e,keyframes:[0,t]}),o=Math.min(Ab(n),zh);return{type:"keyframes",ease:l=>n.next(o*l).value/t,duration:li(o)}}const is={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 Dx(e,t){return e*Math.sqrt(1-t*t)}const sz=12;function nz(e,t,s){let n=s;for(let o=1;o<sz;o++)n=n-e(n)/t(n);return n}const lg=.001;function iz({duration:e=is.duration,bounce:t=is.bounce,velocity:s=is.velocity,mass:n=is.mass}){let o,l,u=1-t;u=Zi(is.minDamping,is.maxDamping,u),e=Zi(is.minDuration,is.maxDuration,li(e)),u<1?(o=d=>{const p=d*u,g=p*e,x=p-s,v=Dx(d,u),w=Math.exp(-g);return lg-x/v*w},l=d=>{const g=d*u*e,x=g*s+s,v=Math.pow(u,2)*Math.pow(d,2)*e,w=Math.exp(-g),k=Dx(Math.pow(d,2),u);return(-o(d)+lg>0?-1:1)*((x-v)*w)/k}):(o=d=>{const p=Math.exp(-d*e),g=(d-s)*e+1;return-lg+p*g},l=d=>{const p=Math.exp(-d*e),g=(s-d)*(e*e);return p*g});const h=5/e,f=nz(o,l,h);if(e=qn(e),isNaN(f))return{stiffness:is.stiffness,damping:is.damping,duration:e};{const d=Math.pow(f,2)*n;return{stiffness:d,damping:u*2*Math.sqrt(n*d),duration:e}}}const rz=["duration","bounce"],az=["stiffness","damping","mass"];function Kw(e,t){return t.some(s=>e[s]!==void 0)}function oz(e){let t={velocity:is.velocity,stiffness:is.stiffness,damping:is.damping,mass:is.mass,isResolvedFromDuration:!1,...e};if(!Kw(e,az)&&Kw(e,rz))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:is.mass,stiffness:o,damping:l}}else{const s=iz({...e,velocity:0});t={...t,...s,mass:is.mass},t.isResolvedFromDuration=!0}return t}function Bh(e=is.visualDuration,t=is.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:f,damping:d,mass:p,duration:g,velocity:x,isResolvedFromDuration:v}=oz({...s,velocity:-li(s.velocity||0)}),w=x||0,k=d/(2*Math.sqrt(f*p)),N=u-l,E=li(Math.sqrt(f/p)),T=Math.abs(N)<5;n||(n=T?is.restSpeed.granular:is.restSpeed.default),o||(o=T?is.restDelta.granular:is.restDelta.default);let A,C,R,D,$,O;if(k<1)R=Dx(E,k),D=(w+k*E*N)/R,A=B=>{const G=Math.exp(-k*E*B);return u-G*(D*Math.sin(R*B)+N*Math.cos(R*B))},$=k*E*D+N*R,O=k*E*N-D*R,C=B=>Math.exp(-k*E*B)*($*Math.sin(R*B)+O*Math.cos(R*B));else if(k===1){A=G=>u-Math.exp(-E*G)*(N+(w+E*N)*G);const B=w+E*N;C=G=>Math.exp(-E*G)*(E*B*G-w)}else{const B=E*Math.sqrt(k*k-1);A=U=>{const K=Math.exp(-k*E*U),I=Math.min(B*U,300);return u-K*((w+k*E*N)*Math.sinh(I)+B*N*Math.cosh(I))/B};const G=(w+k*E*N)/B,F=k*E*G-N*B,z=k*E*N-G*B;C=U=>{const K=Math.exp(-k*E*U),I=Math.min(B*U,300);return K*(F*Math.sinh(I)+z*Math.cosh(I))}}const P={calculatedDuration:v&&g||null,velocity:B=>qn(C(B)),next:B=>{if(!v&&k<1){const F=Math.exp(-k*E*B),z=Math.sin(R*B),U=Math.cos(R*B),K=u-F*(D*z+N*U),I=qn(F*($*z+O*U));return h.done=Math.abs(I)<=n&&Math.abs(u-K)<=o,h.value=h.done?u:K,h}const G=A(B);if(v)h.done=B>=g;else{const F=qn(C(B));h.done=Math.abs(F)<=n&&Math.abs(u-G)<=o}return h.value=h.done?u:G,h},toString:()=>{const B=Math.min(Ab(P),zh),G=$E(F=>P.next(B*F).value,B,30);return B+"ms "+G},toTransition:()=>{}};return P}Bh.applyToOptions=e=>{const t=tz(e,100,Bh);return e.ease=t.ease,e.duration=qn(t.duration),e.type="keyframes",e};const lz=5;function HE(e,t,s){const n=Math.max(t-lz,0);return _E(s-e(n),t-n)}function Ox({keyframes:e,velocity:t=0,power:s=.8,timeConstant:n=325,bounceDamping:o=10,bounceStiffness:l=500,modifyTarget:u,min:h,max:f,restDelta:d=.5,restSpeed:p}){const g=e[0],x={done:!1,value:g},v=O=>h!==void 0&&O<h||f!==void 0&&O>f,w=O=>h===void 0?f:f===void 0||Math.abs(h-O)<Math.abs(f-O)?h:f;let k=s*t;const N=g+k,E=u===void 0?N:u(N);E!==N&&(k=E-g);const T=O=>-k*Math.exp(-O/n),A=O=>E+T(O),C=O=>{const P=T(O),B=A(O);x.done=Math.abs(P)<=d,x.value=x.done?E:B};let R,D;const $=O=>{v(x.value)&&(R=O,D=Bh({keyframes:[x.value,w(x.value)],velocity:HE(A,O,x.value),damping:o,stiffness:l,restDelta:d,restSpeed:p}))};return $(0),{calculatedDuration:null,next:O=>{let P=!1;return!D&&R===void 0&&(P=!0,C(O),$(O)),R!==void 0&&O>=R?D.next(O-R):(!P&&C(O),x)}}}function cz(e,t,s){const n=[],o=s||va.mix||IE,l=e.length-1;for(let u=0;u<l;u++){let h=o(e[u],e[u+1]);if(t){const f=Array.isArray(t)?t[u]||ci:t;h=cu(f,h)}n.push(h)}return n}function uz(e,t,{clamp:s=!0,ease:n,mixer:o}={}){const l=e.length;if(yb(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=cz(t,n,o),f=h.length,d=p=>{if(u&&p<e[0])return t[0];let g=0;if(f>1)for(;g<e.length-2&&!(p<e[g+1]);g++);const x=Jc(e[g],e[g+1],p);return h[g](x)};return s?p=>d(Zi(e[0],e[l-1],p)):d}function dz(e,t){const s=e[e.length-1];for(let n=1;n<=t;n++){const o=Jc(0,t,n);e.push(Kt(s,1,o))}}function hz(e){const t=[0];return dz(t,e.length-1),t}function fz(e,t){return e.map(s=>s*t)}function mz(e,t){return e.map(()=>t||AE).splice(0,e.length-1)}function Fc({duration:e=300,keyframes:t,times:s,ease:n="easeInOut"}){const o=w9(n)?n.map(Uw):Uw(n),l={done:!1,value:t[0]},u=fz(s&&s.length===t.length?s:hz(t),e),h=uz(u,t,{ease:Array.isArray(o)?o:mz(t,o)});return{calculatedDuration:e,next:f=>(l.value=h(f),l.done=f>=e,l)}}const pz=e=>e!==null;function Sf(e,{repeat:t,repeatType:s="loop"},n,o=1){const l=e.filter(pz),h=o<0||t&&s!=="loop"&&t%2===1?0:l.length-1;return!h||n===void 0?l[h]:n}const gz={decay:Ox,inertia:Ox,tween:Fc,keyframes:Fc,spring:Bh};function UE(e){typeof e.type=="string"&&(e.type=gz[e.type])}class Tb{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 xz=e=>e/100;class Ph extends Tb{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!==dn.now()&&this.tick(dn.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;UE(t);const{type:s=Fc,repeat:n=0,repeatDelay:o=0,repeatType:l,velocity:u=0}=t;let{keyframes:h}=t;const f=s||Fc;f!==Fc&&typeof h[0]!="number"&&(this.mixKeyframes=cu(xz,IE(h[0],h[1])),h=[0,100]);const d=f({...t,keyframes:h});l==="mirror"&&(this.mirroredGenerator=f({...t,keyframes:[...h].reverse(),velocity:-u})),d.calculatedDuration===null&&(d.calculatedDuration=Ab(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:f}=this;if(this.startTime===null)return n.next(0);const{delay:d=0,keyframes:p,repeat:g,repeatType:x,repeatDelay:v,type:w,onUpdate:k,finalKeyframe:N}=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 E=this.currentTime-d*(this.playbackSpeed>=0?1:-1),T=this.playbackSpeed>=0?E<0:E>o;this.currentTime=Math.max(E,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=o);let A=this.currentTime,C=n;if(g){const O=Math.min(this.currentTime,o)/h;let P=Math.floor(O),B=O%1;!B&&O>=1&&(B=1),B===1&&P--,P=Math.min(P,g+1),P%2&&(x==="reverse"?(B=1-B,v&&(B-=v/h)):x==="mirror"&&(C=u)),A=Zi(0,1,B)*h}let R;T?(this.delayState.value=p[0],R=this.delayState):R=C.next(A),l&&!T&&(R.value=l(R.value));let{done:D}=R;!T&&f!==null&&(D=this.playbackSpeed>=0?this.currentTime>=o:this.currentTime<=0);const $=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&D);return $&&w!==Ox&&(R.value=Sf(p,this.options,N,this.speed)),k&&k(R.value),$&&this.finish(),R}then(t,s){return this.finished.then(t,s)}get duration(){return li(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+li(t)}get time(){return li(this.currentTime)}set time(t){t=qn(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 HE(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(dn.now()),this.playbackSpeed=t,s&&this.driver&&(this.time=li(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=ez,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(dn.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 bz(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Qa=e=>e*180/Math.PI,Lx=e=>{const t=Qa(Math.atan2(e[1],e[0]));return zx(t)},vz={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Lx,rotateZ:Lx,skewX:e=>Qa(Math.atan(e[1])),skewY:e=>Qa(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},zx=e=>(e=e%360,e<0&&(e+=360),e),Yw=Lx,Xw=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Zw=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),_z={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Xw,scaleY:Zw,scale:e=>(Xw(e)+Zw(e))/2,rotateX:e=>zx(Qa(Math.atan2(e[6],e[5]))),rotateY:e=>zx(Qa(Math.atan2(-e[2],e[0]))),rotateZ:Yw,rotate:Yw,skewX:e=>Qa(Math.atan(e[4])),skewY:e=>Qa(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Bx(e){return e.includes("scale")?1:0}function Px(e,t){if(!e||e==="none")return Bx(t);const s=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let n,o;if(s)n=_z,o=s;else{const h=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);n=vz,o=h}if(!o)return Bx(t);const l=n[t],u=o[1].split(",").map(wz);return typeof l=="function"?l(u):u[l]}const yz=(e,t)=>{const{transform:s="none"}=getComputedStyle(e);return Px(s,t)};function wz(e){return parseFloat(e.trim())}const xl=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],bl=new Set(xl),Qw=e=>e===gl||e===Ye,Sz=new Set(["x","y","z"]),kz=xl.filter(e=>!Sz.has(e));function Nz(e){const t=[];return kz.forEach(s=>{const n=e.getValue(s);n!==void 0&&(t.push([s,n.get()]),n.set(s.startsWith("scale")?1:0))}),t}const ga={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})=>Px(t,"x"),y:(e,{transform:t})=>Px(t,"y")};ga.translateX=ga.x;ga.translateY=ga.y;const to=new Set;let Ix=!1,$x=!1,Hx=!1;function FE(){if($x){const e=Array.from(to).filter(n=>n.needsMeasurement),t=new Set(e.map(n=>n.element)),s=new Map;t.forEach(n=>{const o=Nz(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)})}$x=!1,Ix=!1,to.forEach(e=>e.complete(Hx)),to.clear()}function qE(){to.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&($x=!0)})}function Cz(){Hx=!0,qE(),FE(),Hx=!1}class Rb{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?(to.add(this),Ix||(Ix=!0,Ht.read(qE),Ht.resolveKeyframes(FE))):(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])}bz(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),to.delete(this)}cancel(){this.state==="scheduled"&&(to.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const Ez=e=>e.startsWith("--");function VE(e,t,s){Ez(t)?e.style.setProperty(t,s):e.style[t]=s}const jz={};function GE(e,t){const s=vE(e);return()=>jz[t]??s()}const Az=GE(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),WE=GE(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Mc=([e,t,s,n])=>`cubic-bezier(${e}, ${t}, ${s}, ${n})`,Jw={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Mc([0,.65,.55,1]),circOut:Mc([.55,0,1,.45]),backIn:Mc([.31,.01,.66,-.59]),backOut:Mc([.33,1.53,.69,.99])};function KE(e,t){if(e)return typeof e=="function"?WE()?$E(e,t):"ease-out":TE(e)?Mc(e):Array.isArray(e)?e.map(s=>KE(s,t)||Jw.easeOut):Jw[e]}function Tz(e,t,s,{delay:n=0,duration:o=300,repeat:l=0,repeatType:u="loop",ease:h="easeOut",times:f}={},d=void 0){const p={[t]:s};f&&(p.offset=f);const g=KE(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 YE(e){return typeof e=="function"&&"applyToOptions"in e}function Rz({type:e,...t}){return YE(e)&&WE()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class XE extends Tb{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:f}=t;this.isPseudoElement=!!l,this.allowFlatten=u,this.options=t,yb(typeof t.type!="string");const d=Rz(t);this.animation=Tz(s,n,o,d,l),d.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!l){const p=Sf(o,this.options,h,this.speed);this.updateMotionValue&&this.updateMotionValue(p),VE(s,n,p),this.animation.cancel()}f?.(),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 li(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+li(t)}get time(){return li(Number(this.animation.currentTime)||0)}set time(t){const s=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=qn(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&&Az()?(this.animation.timeline=t,s&&(this.animation.rangeStart=s),n&&(this.animation.rangeEnd=n),ci):o(this)}}const ZE={anticipate:CE,backInOut:NE,circInOut:jE};function Mz(e){return e in ZE}function Dz(e){typeof e.ease=="string"&&Mz(e.ease)&&(e.ease=ZE[e.ease])}const cg=10;class Oz extends XE{constructor(t){Dz(t),UE(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 Ph({...u,autoplay:!1}),f=Math.max(cg,dn.now()-this.startTime),d=Zi(0,cg,f-cg),p=h.sample(f).value,{name:g}=this.options;l&&g&&VE(l,g,p),s.setWithVelocity(h.sample(Math.max(0,f-d)).value,p,d),h.stop()}}const eS=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Ti.test(e)||e==="0")&&!e.startsWith("url("));function Lz(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 zz(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=eS(o,t),h=eS(l,t);return!u||!h?!1:Lz(e)||(s==="spring"||YE(s))&&n}function Ux(e){e.duration=0,e.type="keyframes"}const QE=new Set(["opacity","clipPath","filter","transform"]),Bz=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function Pz(e){for(let t=0;t<e.length;t++)if(typeof e[t]=="string"&&Bz.test(e[t]))return!0;return!1}const Iz=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),$z=vE(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function Hz(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 $z()&&s&&(QE.has(s)||Iz.has(s)&&Pz(h))&&(s!=="transform"||!p)&&!d&&!n&&o!=="mirror"&&l!==0&&u!=="inertia"}const Uz=40;class Fz extends Tb{constructor({autoplay:t=!0,delay:s=0,type:n="keyframes",repeat:o=0,repeatDelay:l=0,repeatType:u="loop",keyframes:h,name:f,motionValue:d,element:p,...g}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=dn.now();const x={autoplay:t,delay:s,type:n,repeat:o,repeatDelay:l,repeatType:u,name:f,motionValue:d,element:p,...g},v=p?.KeyframeResolver||Rb;this.keyframeResolver=new v(h,(w,k,N)=>this.onKeyframesResolved(w,k,x,!N),f,d,p),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,s,n,o){this.keyframeResolver=void 0;const{name:l,type:u,velocity:h,delay:f,isHandoff:d,onUpdate:p}=n;this.resolvedAt=dn.now();let g=!0;zz(t,l,u,h)||(g=!1,(va.instantAnimations||!f)&&p?.(Sf(t,n,s)),t[0]=t[t.length-1],Ux(n),n.repeat=0);const v={startTime:o?this.resolvedAt?this.resolvedAt-this.createdAt>Uz?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:s,...n,keyframes:t},w=g&&!d&&Hz(v),k=v.motionValue?.owner?.current;let N;if(w)try{N=new Oz({...v,element:k})}catch{N=new Ph(v)}else N=new Ph(v);N.finished.then(()=>{this.notifyFinished()}).catch(ci),this.pendingTimeline&&(this.stopTimeline=N.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=N}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(),Cz()),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 JE(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 qz=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Vz(e){const t=qz.exec(e);if(!t)return[,];const[,s,n,o]=t;return[`--${s??n}`,o]}function e3(e,t,s=1){const[n,o]=Vz(e);if(!n)return;const l=window.getComputedStyle(t).getPropertyValue(n);if(l){const u=l.trim();return gE(u)?parseFloat(u):u}return Nb(o)?e3(o,t,s+1):o}const Gz={type:"spring",stiffness:500,damping:25,restSpeed:10},Wz=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),Kz={type:"keyframes",duration:.8},Yz={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Xz=(e,{keyframes:t})=>t.length>2?Kz:bl.has(e)?e.startsWith("scale")?Wz(t[1]):Gz:Yz;function t3(e,t){if(e?.inherit&&t){const{inherit:s,...n}=e;return{...t,...n}}return e}function Mb(e,t){const s=e?.[t]??e?.default??e;return s!==e?t3(s,e):s}const Zz=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function Qz(e){for(const t in e)if(!Zz.has(t))return!0;return!1}const Db=(e,t,s,n={},o,l)=>u=>{const h=Mb(n,e)||{},f=h.delay||n.delay||0;let{elapsed:d=0}=n;d=d-qn(f);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};Qz(h)||Object.assign(p,Xz(e,p)),p.duration&&(p.duration=qn(p.duration)),p.repeatDelay&&(p.repeatDelay=qn(p.repeatDelay)),p.from!==void 0&&(p.keyframes[0]=p.from);let g=!1;if((p.type===!1||p.duration===0&&!p.repeatDelay)&&(Ux(p),p.delay===0&&(g=!0)),(va.instantAnimations||va.skipAnimations||o?.shouldSkipAnimations)&&(g=!0,Ux(p),p.delay=0),p.allowFlatten=!h.type&&!h.ease,g&&!l&&t.get()!==void 0){const x=Sf(p.keyframes,h);if(x!==void 0){Ht.update(()=>{p.onUpdate(x),p.onComplete()});return}}return h.isSync?new Ph(p):new Fz(p)};function tS(e){const t=[{},{}];return e?.values.forEach((s,n)=>{t[0][n]=s.get(),t[1][n]=s.getVelocity()}),t}function Ob(e,t,s,n){if(typeof t=="function"){const[o,l]=tS(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]=tS(n);t=t(s!==void 0?s:e.custom,o,l)}return t}function so(e,t,s){const n=e.getProps();return Ob(n,t,s!==void 0?s:n.custom,e)}const s3=new Set(["width","height","top","left","right","bottom",...xl]),sS=30,Jz=e=>!isNaN(parseFloat(e));class eB{constructor(t,s={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=n=>{const o=dn.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=dn.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=Jz(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 wb);const n=this.events[t].add(s);return t==="change"?()=>{n(),Ht.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=dn.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>sS)return 0;const s=Math.min(this.updatedAt-this.prevUpdatedAt,sS);return _E(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 fl(e,t){return new eB(e,t)}const Fx=e=>Array.isArray(e);function tB(e,t,s){e.hasValue(t)?e.getValue(t).set(s):e.addValue(t,fl(s))}function sB(e){return Fx(e)?e[e.length-1]||0:e}function nB(e,t){const s=so(e,t);let{transitionEnd:n={},transition:o={},...l}=s||{};l={...l,...n};for(const u in l){const h=sB(l[u]);tB(e,u,h)}}const Qs=e=>!!(e&&e.getVelocity);function iB(e){return!!(Qs(e)&&e.add)}function qx(e,t){const s=e.getValue("willChange");if(iB(s))return s.add(t);if(!s&&va.WillChange){const n=new va.WillChange("auto");e.addValue("willChange",n),n.add(t)}}function Lb(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const rB="framerAppearId",n3="data-"+Lb(rB);function i3(e){return e.props[n3]}function aB({protectedKeys:e,needsAnimating:t},s){const n=e.hasOwnProperty(s)&&t[s]!==!0;return t[s]=!1,n}function r3(e,t,{delay:s=0,transitionOverride:n,type:o}={}){let{transition:l,transitionEnd:u,...h}=t;const f=e.getDefaultTransition();l=l?t3(l,f):f;const d=l?.reduceMotion;n&&(l=n);const p=[],g=o&&e.animationState&&e.animationState.getState()[o];for(const x in h){const v=e.getValue(x,e.latestValues[x]??null),w=h[x];if(w===void 0||g&&aB(g,x))continue;const k={delay:s,...Mb(l||{},x)},N=v.get();if(N!==void 0&&!v.isAnimating()&&!Array.isArray(w)&&w===N&&!k.velocity){Ht.update(()=>v.set(w));continue}let E=!1;if(window.MotionHandoffAnimation){const C=i3(e);if(C){const R=window.MotionHandoffAnimation(C,x,Ht);R!==null&&(k.startTime=R,E=!0)}}qx(e,x);const T=d??e.shouldReduceMotion;v.start(Db(x,v,w,T&&s3.has(x)?{type:!1}:k,e,E));const A=v.animation;A&&p.push(A)}if(u){const x=()=>Ht.update(()=>{u&&nB(e,u)});p.length?Promise.all(p).then(x):x()}return p}function Vx(e,t,s={}){const n=so(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(r3(e,n,s)):()=>Promise.resolve(),u=e.variantChildren&&e.variantChildren.size?(f=0)=>{const{delayChildren:d=0,staggerChildren:p,staggerDirection:g}=o;return oB(e,t,f,d,p,g,s)}:()=>Promise.resolve(),{when:h}=o;if(h){const[f,d]=h==="beforeChildren"?[l,u]:[u,l];return f().then(()=>d())}else return Promise.all([l(),u(s.delay)])}function oB(e,t,s=0,n=0,o=0,l=1,u){const h=[];for(const f of e.variantChildren)f.notify("AnimationStart",t),h.push(Vx(f,t,{...u,delay:s+(typeof n=="function"?0:n)+JE(e.variantChildren,f,n,o,l)}).then(()=>f.notify("AnimationComplete",t)));return Promise.all(h)}function lB(e,t,s={}){e.notify("AnimationStart",t);let n;if(Array.isArray(t)){const o=t.map(l=>Vx(e,l,s));n=Promise.all(o)}else if(typeof t=="string")n=Vx(e,t,s);else{const o=typeof t=="function"?so(e,t,s.custom):t;n=Promise.all(r3(e,o,s))}return n.then(()=>{e.notify("AnimationComplete",t)})}const cB={test:e=>e==="auto",parse:e=>e},a3=e=>t=>t.test(e),o3=[gl,Ye,Ki,ma,L9,O9,cB],nS=e=>o3.find(a3(e));function uB(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||bE(e):!0}const dB=new Set(["brightness","contrast","saturate","opacity"]);function hB(e){const[t,s]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[n]=s.match(Cb)||[];if(!n)return e;const o=s.replace(n,"");let l=dB.has(t)?1:0;return n!==s&&(l*=100),t+"("+l+o+")"}const fB=/\b([a-z-]*)\(.*?\)/gu,Gx={...Ti,getAnimatableNone:e=>{const t=e.match(fB);return t?t.map(hB).join(" "):e}},Wx={...Ti,getAnimatableNone:e=>{const t=Ti.parse(e);return Ti.createTransformer(e)(t.map(n=>typeof n=="number"?0:typeof n=="object"?{...n,alpha:1}:n))}},iS={...gl,transform:Math.round},mB={rotate:ma,rotateX:ma,rotateY:ma,rotateZ:ma,scale:Hd,scaleX:Hd,scaleY:Hd,scaleZ:Hd,skew:ma,skewX:ma,skewY:ma,distance:Ye,translateX:Ye,translateY:Ye,translateZ:Ye,x:Ye,y:Ye,z:Ye,perspective:Ye,transformPerspective:Ye,opacity:eu,originX:qw,originY:qw,originZ:Ye},zb={borderWidth:Ye,borderTopWidth:Ye,borderRightWidth:Ye,borderBottomWidth:Ye,borderLeftWidth:Ye,borderRadius:Ye,borderTopLeftRadius:Ye,borderTopRightRadius:Ye,borderBottomRightRadius:Ye,borderBottomLeftRadius:Ye,width:Ye,maxWidth:Ye,height:Ye,maxHeight:Ye,top:Ye,right:Ye,bottom:Ye,left:Ye,inset:Ye,insetBlock:Ye,insetBlockStart:Ye,insetBlockEnd:Ye,insetInline:Ye,insetInlineStart:Ye,insetInlineEnd:Ye,padding:Ye,paddingTop:Ye,paddingRight:Ye,paddingBottom:Ye,paddingLeft:Ye,paddingBlock:Ye,paddingBlockStart:Ye,paddingBlockEnd:Ye,paddingInline:Ye,paddingInlineStart:Ye,paddingInlineEnd:Ye,margin:Ye,marginTop:Ye,marginRight:Ye,marginBottom:Ye,marginLeft:Ye,marginBlock:Ye,marginBlockStart:Ye,marginBlockEnd:Ye,marginInline:Ye,marginInlineStart:Ye,marginInlineEnd:Ye,fontSize:Ye,backgroundPositionX:Ye,backgroundPositionY:Ye,...mB,zIndex:iS,fillOpacity:eu,strokeOpacity:eu,numOctaves:iS},pB={...zb,color:Ss,backgroundColor:Ss,outlineColor:Ss,fill:Ss,stroke:Ss,borderColor:Ss,borderTopColor:Ss,borderRightColor:Ss,borderBottomColor:Ss,borderLeftColor:Ss,filter:Gx,WebkitFilter:Gx,mask:Wx,WebkitMask:Wx},l3=e=>pB[e],gB=new Set([Gx,Wx]);function c3(e,t){let s=l3(e);return gB.has(s)||(s=Ti),s.getAnimatableNone?s.getAnimatableNone(t):void 0}const xB=new Set(["auto","none","0"]);function bB(e,t,s){let n=0,o;for(;n<e.length&&!o;){const l=e[n];typeof l=="string"&&!xB.has(l)&&hl(l).values.length&&(o=e[n]),n++}if(o&&s)for(const l of t)e[l]=c3(s,o)}class vB extends Rb{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(),Nb(g))){const x=e3(g,s.current);x!==void 0&&(t[p]=x),p===t.length-1&&(this.finalKeyframe=g)}}if(this.resolveNoneKeyframes(),!s3.has(n)||t.length!==2)return;const[o,l]=t,u=nS(o),h=nS(l),f=Fw(o),d=Fw(l);if(f!==d&&ga[n]){this.needsMeasurement=!0;return}if(u!==h)if(Qw(u)&&Qw(h))for(let p=0;p<t.length;p++){const g=t[p];typeof g=="string"&&(t[p]=parseFloat(g))}else ga[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:s}=this,n=[];for(let o=0;o<t.length;o++)(t[o]===null||uB(t[o]))&&n.push(o);n.length&&bB(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=ga[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]=ga[s](t.measureViewportBox(),window.getComputedStyle(t.current)),u!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=u),this.removedTransforms?.length&&this.removedTransforms.forEach(([h,f])=>{t.getValue(h).set(f)}),this.resolveNoneKeyframes()}}function u3(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 d3=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function _B(e){return xE(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}const{schedule:Bb}=RE(queueMicrotask,!1),Ci={x:!1,y:!1};function h3(){return Ci.x||Ci.y}function yB(e){return e==="x"||e==="y"?Ci[e]?null:(Ci[e]=!0,()=>{Ci[e]=!1}):Ci.x||Ci.y?null:(Ci.x=Ci.y=!0,()=>{Ci.x=Ci.y=!1})}function f3(e,t){const s=u3(e),n=new AbortController,o={passive:!0,...t,signal:n.signal};return[s,o,()=>n.abort()]}function wB(e){return!(e.pointerType==="touch"||h3())}function SB(e,t,s={}){const[n,o,l]=f3(e,s);return n.forEach(u=>{let h=!1,f=!1,d;const p=()=>{u.removeEventListener("pointerleave",w)},g=N=>{d&&(d(N),d=void 0),p()},x=N=>{h=!1,window.removeEventListener("pointerup",x),window.removeEventListener("pointercancel",x),f&&(f=!1,g(N))},v=()=>{h=!0,window.addEventListener("pointerup",x,o),window.addEventListener("pointercancel",x,o)},w=N=>{if(N.pointerType!=="touch"){if(h){f=!0;return}g(N)}},k=N=>{if(!wB(N))return;f=!1;const E=t(u,N);typeof E=="function"&&(d=E,u.addEventListener("pointerleave",w,o))};u.addEventListener("pointerenter",k,o),u.addEventListener("pointerdown",v,o)}),l}const m3=(e,t)=>t?e===t?!0:m3(e,t.parentElement):!1,Pb=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,kB=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function NB(e){return kB.has(e.tagName)||e.isContentEditable===!0}const CB=new Set(["INPUT","SELECT","TEXTAREA"]);function EB(e){return CB.has(e.tagName)||e.isContentEditable===!0}const gh=new WeakSet;function rS(e){return t=>{t.key==="Enter"&&e(t)}}function ug(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const jB=(e,t)=>{const s=e.currentTarget;if(!s)return;const n=rS(()=>{if(gh.has(s))return;ug(s,"down");const o=rS(()=>{ug(s,"up")}),l=()=>ug(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 aS(e){return Pb(e)&&!h3()}const oS=new WeakSet;function AB(e,t,s={}){const[n,o,l]=f3(e,s),u=h=>{const f=h.currentTarget;if(!aS(h)||oS.has(h))return;gh.add(f),s.stopPropagation&&oS.add(h);const d=t(f,h),p=(v,w)=>{window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",x),gh.has(f)&&gh.delete(f),aS(v)&&typeof d=="function"&&d(v,{success:w})},g=v=>{p(v,f===window||f===document||s.useGlobalTarget||m3(f,v.target))},x=v=>{p(v,!1)};window.addEventListener("pointerup",g,o),window.addEventListener("pointercancel",x,o)};return n.forEach(h=>{(s.useGlobalTarget?window:h).addEventListener("pointerdown",u,o),_B(h)&&(h.addEventListener("focus",d=>jB(d,o)),!NB(h)&&!h.hasAttribute("tabindex")&&(h.tabIndex=0))}),l}function Ib(e){return xE(e)&&"ownerSVGElement"in e}const xh=new WeakMap;let bh;const p3=(e,t,s)=>(n,o)=>o&&o[0]?o[0][e+"Size"]:Ib(n)&&"getBBox"in n?n.getBBox()[t]:n[s],TB=p3("inline","width","offsetWidth"),RB=p3("block","height","offsetHeight");function MB({target:e,borderBoxSize:t}){xh.get(e)?.forEach(s=>{s(e,{get width(){return TB(e,t)},get height(){return RB(e,t)}})})}function DB(e){e.forEach(MB)}function OB(){typeof ResizeObserver>"u"||(bh=new ResizeObserver(DB))}function LB(e,t){bh||OB();const s=u3(e);return s.forEach(n=>{let o=xh.get(n);o||(o=new Set,xh.set(n,o)),o.add(t),bh?.observe(n)}),()=>{s.forEach(n=>{const o=xh.get(n);o?.delete(t),o?.size||bh?.unobserve(n)})}}const vh=new Set;let nl;function zB(){nl=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};vh.forEach(t=>t(e))},window.addEventListener("resize",nl)}function BB(e){return vh.add(e),nl||zB(),()=>{vh.delete(e),!vh.size&&typeof nl=="function"&&(window.removeEventListener("resize",nl),nl=void 0)}}function lS(e,t){return typeof e=="function"?BB(e):LB(e,t)}function PB(e){return Ib(e)&&e.tagName==="svg"}const IB=[...o3,Ss,Ti],$B=e=>IB.find(a3(e)),cS=()=>({translate:0,scale:1,origin:0,originPoint:0}),il=()=>({x:cS(),y:cS()}),uS=()=>({min:0,max:0}),Ms=()=>({x:uS(),y:uS()}),HB=new WeakMap;function kf(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function tu(e){return typeof e=="string"||Array.isArray(e)}const $b=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Hb=["initial",...$b];function Nf(e){return kf(e.animate)||Hb.some(t=>tu(e[t]))}function g3(e){return!!(Nf(e)||e.variants)}function UB(e,t,s){for(const n in t){const o=t[n],l=s[n];if(Qs(o))e.addValue(n,o);else if(Qs(l))e.addValue(n,fl(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,fl(u!==void 0?u:o,{owner:e}))}}for(const n in s)t[n]===void 0&&e.removeValue(n);return t}const Kx={current:null},x3={current:!1},FB=typeof window<"u";function qB(){if(x3.current=!0,!!FB)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Kx.current=e.matches;e.addEventListener("change",t),t()}else Kx.current=!1}const dS=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Ih={};function b3(e){Ih=e}function VB(){return Ih}class GB{scrapeMotionValuesFromProps(t,s,n){return{}}constructor({parent:t,props:s,presenceContext:n,reducedMotionConfig:o,skipAnimations:l,blockInitialAnimation:u,visualState:h},f={}){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=Rb,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 v=dn.now();this.renderScheduledAt<v&&(this.renderScheduledAt=v,Ht.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=f,this.blockInitialAnimation=!!u,this.isControllingVariants=Nf(s),this.isVariantNode=g3(s),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:g,...x}=this.scrapeMotionValuesFromProps(s,{},this);for(const v in x){const w=x[v];d[v]!==void 0&&Qs(w)&&w.set(d[v])}}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,HB.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:(x3.current||qB(),this.shouldReduceMotion=Kx.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(),_a(this.notifyUpdate),_a(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&&QE.has(t)&&this.current instanceof HTMLElement){const{factory:u,keyframes:h,times:f,ease:d,duration:p}=s.accelerate,g=new XE({element:this.current,name:t,keyframes:h,times:f,ease:d,duration:qn(p)}),x=u(g);this.valueSubscriptions.set(t,()=>{x(),g.cancel()});return}const n=bl.has(t);n&&this.onBindTransform&&this.onBindTransform();const o=s.on("change",u=>{this.latestValues[t]=u,this.props.onUpdate&&Ht.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 Ih){const s=Ih[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):Ms()}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<dS.length;n++){const o=dS[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=UB(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=fl(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"&&(gE(n)||bE(n))?n=parseFloat(n):!$B(n)&&Ti.test(s)&&(n=c3(t,s)),this.setBaseTarget(t,Qs(n)?n.get():n)),Qs(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=Ob(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&&!Qs(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 wb),this.events[t].add(s)}notify(t,...s){this.events[t]&&this.events[t].notify(...s)}scheduleRenderMicrotask(){Bb.render(this.render)}}class v3 extends GB{constructor(){super(...arguments),this.KeyframeResolver=vB}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;Qs(t)&&(this.childSubscription=t.on("change",s=>{this.current&&(this.current.textContent=`${s}`)}))}}class wa{constructor(t){this.isMounted=!1,this.node=t}update(){}}function _3({top:e,left:t,right:s,bottom:n}){return{x:{min:t,max:s},y:{min:e,max:n}}}function WB({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function KB(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 dg(e){return e===void 0||e===1}function Yx({scale:e,scaleX:t,scaleY:s}){return!dg(e)||!dg(t)||!dg(s)}function Wa(e){return Yx(e)||y3(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function y3(e){return hS(e.x)||hS(e.y)}function hS(e){return e&&e!=="0%"}function $h(e,t,s){const n=e-s,o=t*n;return s+o}function fS(e,t,s,n,o){return o!==void 0&&(e=$h(e,o,n)),$h(e,s,n)+t}function Xx(e,t=0,s=1,n,o){e.min=fS(e.min,t,s,n,o),e.max=fS(e.max,t,s,n,o)}function w3(e,{x:t,y:s}){Xx(e.x,t.translate,t.scale,t.originPoint),Xx(e.y,s.translate,s.scale,s.originPoint)}const mS=.999999999999,pS=1.0000000000001;function YB(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:f}=l.options;f&&f.props.style&&f.props.style.display==="contents"||(n&&l.options.layoutScroll&&l.scroll&&l!==l.root&&(Gi(e.x,-l.scroll.offset.x),Gi(e.y,-l.scroll.offset.y)),u&&(t.x*=u.x.scale,t.y*=u.y.scale,w3(e,u)),n&&Wa(l.latestValues)&&_h(e,l.latestValues,l.layout?.layoutBox))}t.x<pS&&t.x>mS&&(t.x=1),t.y<pS&&t.y>mS&&(t.y=1)}function Gi(e,t){e.min+=t,e.max+=t}function gS(e,t,s,n,o=.5){const l=Kt(e.min,e.max,o);Xx(e,t,s,l,n)}function xS(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function _h(e,t,s){const n=s??e;gS(e.x,xS(t.x,n.x),t.scaleX,t.scale,t.originX),gS(e.y,xS(t.y,n.y),t.scaleY,t.scale,t.originY)}function S3(e,t){return _3(KB(e.getBoundingClientRect(),t))}function XB(e,t,s){const n=S3(e,s),{scroll:o}=t;return o&&(Gi(n.x,o.offset.x),Gi(n.y,o.offset.y)),n}const ZB={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},QB=xl.length;function JB(e,t,s){let n="",o=!0;for(let l=0;l<QB;l++){const u=xl[l],h=e[u];if(h===void 0)continue;let f=!0;if(typeof h=="number")f=h===(u.startsWith("scale")?1:0);else{const d=parseFloat(h);f=u.startsWith("scale")?d===1:d===0}if(!f||s){const d=d3(h,zb[u]);if(!f){o=!1;const p=ZB[u]||u;n+=`${p}(${d}) `}s&&(t[u]=d)}}return n=n.trim(),s?n=s(t,o?"":n):o&&(n="none"),n}function Ub(e,t,s){const{style:n,vars:o,transformOrigin:l}=e;let u=!1,h=!1;for(const f in t){const d=t[f];if(bl.has(f)){u=!0;continue}else if(DE(f)){o[f]=d;continue}else{const p=d3(d,zb[f]);f.startsWith("origin")?(h=!0,l[f]=p):n[f]=p}}if(t.transform||(u||s?n.transform=JB(t,e.transform,s):n.transform&&(n.transform="none")),h){const{originX:f="50%",originY:d="50%",originZ:p=0}=l;n.transformOrigin=`${f} ${d} ${p}`}}function k3(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 vc={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Ye.test(e))e=parseFloat(e);else return e;const s=bS(e,t.target.x),n=bS(e,t.target.y);return`${s}% ${n}%`}},eP={correct:(e,{treeScale:t,projectionDelta:s})=>{const n=e,o=Ti.parse(e);if(o.length>5)return n;const l=Ti.createTransformer(e),u=typeof o[0]!="number"?1:0,h=s.x.scale*t.x,f=s.y.scale*t.y;o[0+u]/=h,o[1+u]/=f;const d=Kt(h,f,.5);return typeof o[2+u]=="number"&&(o[2+u]/=d),typeof o[3+u]=="number"&&(o[3+u]/=d),l(o)}},Zx={borderRadius:{...vc,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:vc,borderTopRightRadius:vc,borderBottomLeftRadius:vc,borderBottomRightRadius:vc,boxShadow:eP};function N3(e,{layout:t,layoutId:s}){return bl.has(e)||e.startsWith("origin")||(t||s!==void 0)&&(!!Zx[e]||e==="opacity")}function Fb(e,t,s){const n=e.style,o=t?.style,l={};if(!n)return l;for(const u in n)(Qs(n[u])||o&&Qs(o[u])||N3(u,e)||s?.getValue(u)?.liveStyle!==void 0)&&(l[u]=n[u]);return l}function tP(e){return window.getComputedStyle(e)}class sP extends v3{constructor(){super(...arguments),this.type="html",this.renderInstance=k3}readValueFromInstance(t,s){if(bl.has(s))return this.projection?.isProjecting?Bx(s):yz(t,s);{const n=tP(t),o=(DE(s)?n.getPropertyValue(s):n[s])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(t,{transformPagePoint:s}){return S3(t,s)}build(t,s,n){Ub(t,s,n.transformTemplate)}scrapeMotionValuesFromProps(t,s,n){return Fb(t,s,n)}}const nP={offset:"stroke-dashoffset",array:"stroke-dasharray"},iP={offset:"strokeDashoffset",array:"strokeDasharray"};function rP(e,t,s=1,n=0,o=!0){e.pathLength=1;const l=o?nP:iP;e[l.offset]=`${-n}`,e[l.array]=`${t} ${s}`}const aP=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function C3(e,{attrX:t,attrY:s,attrScale:n,pathLength:o,pathSpacing:l=1,pathOffset:u=0,...h},f,d,p){if(Ub(e,h,d),f){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 v of aP)g[v]!==void 0&&(x[v]=g[v],delete g[v]);t!==void 0&&(g.x=t),s!==void 0&&(g.y=s),n!==void 0&&(g.scale=n),o!==void 0&&rP(g,o,l,u,!1)}const E3=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"]),j3=e=>typeof e=="string"&&e.toLowerCase()==="svg";function oP(e,t,s,n){k3(e,t,void 0,n);for(const o in t.attrs)e.setAttribute(E3.has(o)?o:Lb(o),t.attrs[o])}function A3(e,t,s){const n=Fb(e,t,s);for(const o in e)if(Qs(e[o])||Qs(t[o])){const l=xl.indexOf(o)!==-1?"attr"+o.charAt(0).toUpperCase()+o.substring(1):o;n[l]=e[o]}return n}class lP extends v3{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Ms}getBaseTargetFromProps(t,s){return t[s]}readValueFromInstance(t,s){if(bl.has(s)){const n=l3(s);return n&&n.default||0}return s=E3.has(s)?s:Lb(s),t.getAttribute(s)}scrapeMotionValuesFromProps(t,s,n){return A3(t,s,n)}build(t,s,n){C3(t,s,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(t,s,n,o){oP(t,s,n,o)}mount(t){this.isSVGTag=j3(t.tagName),super.mount(t)}}const cP=Hb.length;function T3(e){if(!e)return;if(!e.isControllingVariants){const s=e.parent?T3(e.parent)||{}:{};return e.props.initial!==void 0&&(s.initial=e.props.initial),s}const t={};for(let s=0;s<cP;s++){const n=Hb[s],o=e.props[n];(tu(o)||o===!1)&&(t[n]=o)}return t}function R3(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 uP=[...$b].reverse(),dP=$b.length;function hP(e){return t=>Promise.all(t.map(({animation:s,options:n})=>lB(e,s,n)))}function fP(e){let t=hP(e),s=vS(),n=!0,o=!1;const l=d=>(p,g)=>{const x=so(e,g,d==="exit"?e.presenceContext?.custom:void 0);if(x){const{transition:v,transitionEnd:w,...k}=x;p={...p,...k,...w}}return p};function u(d){t=d(e)}function h(d){const{props:p}=e,g=T3(e.parent)||{},x=[],v=new Set;let w={},k=1/0;for(let E=0;E<dP;E++){const T=uP[E],A=s[T],C=p[T]!==void 0?p[T]:g[T],R=tu(C),D=T===d?A.isActive:null;D===!1&&(k=E);let $=C===g[T]&&C!==p[T]&&R;if($&&(n||o)&&e.manuallyAnimateOnMount&&($=!1),A.protectedKeys={...w},!A.isActive&&D===null||!C&&!A.prevProp||kf(C)||typeof C=="boolean")continue;if(T==="exit"&&A.isActive&&D!==!0){A.prevResolvedValues&&(w={...w,...A.prevResolvedValues});continue}const O=mP(A.prevProp,C);let P=O||T===d&&A.isActive&&!$&&R||E>k&&R,B=!1;const G=Array.isArray(C)?C:[C];let F=G.reduce(l(T),{});D===!1&&(F={});const{prevResolvedValues:z={}}=A,U={...z,...F},K=W=>{P=!0,v.has(W)&&(B=!0,v.delete(W)),A.needsAnimating[W]=!0;const te=e.getValue(W);te&&(te.liveStyle=!1)};for(const W in U){const te=F[W],X=z[W];if(w.hasOwnProperty(W))continue;let V=!1;Fx(te)&&Fx(X)?V=!R3(te,X):V=te!==X,V?te!=null?K(W):v.add(W):te!==void 0&&v.has(W)?K(W):A.protectedKeys[W]=!0}A.prevProp=C,A.prevResolvedValues=F,A.isActive&&(w={...w,...F}),(n||o)&&e.blockInitialAnimation&&(P=!1);const I=$&&O;P&&(!I||B)&&x.push(...G.map(W=>{const te={type:T};if(typeof W=="string"&&(n||o)&&!I&&e.manuallyAnimateOnMount&&e.parent){const{parent:X}=e,V=so(X,W);if(X.enteringChildren&&V){const{delayChildren:q}=V.transition||{};te.delay=JE(X.enteringChildren,e,q)}}return{animation:W,options:te}}))}if(v.size){const E={};if(typeof p.initial!="boolean"){const T=so(e,Array.isArray(p.initial)?p.initial[0]:p.initial);T&&T.transition&&(E.transition=T.transition)}v.forEach(T=>{const A=e.getBaseTarget(T),C=e.getValue(T);C&&(C.liveStyle=!0),E[T]=A??null}),x.push({animation:E})}let N=!!x.length;return n&&(p.initial===!1||p.initial===p.animate)&&!e.manuallyAnimateOnMount&&(N=!1),n=!1,o=!1,N?t(x):Promise.resolve()}function f(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:f,setAnimateFunction:u,getState:()=>s,reset:()=>{s=vS(),o=!0}}}function mP(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!R3(t,e):!1}function qa(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function vS(){return{animate:qa(!0),whileInView:qa(),whileHover:qa(),whileTap:qa(),whileDrag:qa(),whileFocus:qa(),exit:qa()}}function Qx(e,t){e.min=t.min,e.max=t.max}function Ni(e,t){Qx(e.x,t.x),Qx(e.y,t.y)}function _S(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const M3=1e-4,pP=1-M3,gP=1+M3,D3=.01,xP=0-D3,bP=0+D3;function hn(e){return e.max-e.min}function vP(e,t,s){return Math.abs(e-t)<=s}function yS(e,t,s,n=.5){e.origin=n,e.originPoint=Kt(t.min,t.max,e.origin),e.scale=hn(s)/hn(t),e.translate=Kt(s.min,s.max,e.origin)-e.originPoint,(e.scale>=pP&&e.scale<=gP||isNaN(e.scale))&&(e.scale=1),(e.translate>=xP&&e.translate<=bP||isNaN(e.translate))&&(e.translate=0)}function qc(e,t,s,n){yS(e.x,t.x,s.x,n?n.originX:void 0),yS(e.y,t.y,s.y,n?n.originY:void 0)}function wS(e,t,s,n=0){const o=n?Kt(s.min,s.max,n):s.min;e.min=o+t.min,e.max=e.min+hn(t)}function _P(e,t,s,n){wS(e.x,t.x,s.x,n?.x),wS(e.y,t.y,s.y,n?.y)}function SS(e,t,s,n=0){const o=n?Kt(s.min,s.max,n):s.min;e.min=t.min-o,e.max=e.min+hn(t)}function Hh(e,t,s,n){SS(e.x,t.x,s.x,n?.x),SS(e.y,t.y,s.y,n?.y)}function kS(e,t,s,n,o){return e-=t,e=$h(e,1/s,n),o!==void 0&&(e=$h(e,1/o,n)),e}function yP(e,t=0,s=1,n=.5,o,l=e,u=e){if(Ki.test(t)&&(t=parseFloat(t),t=Kt(u.min,u.max,t/100)-u.min),typeof t!="number")return;let h=Kt(l.min,l.max,n);e===l&&(h-=t),e.min=kS(e.min,t,s,h,o),e.max=kS(e.max,t,s,h,o)}function NS(e,t,[s,n,o],l,u){yP(e,t[s],t[n],t[o],t.scale,l,u)}const wP=["x","scaleX","originX"],SP=["y","scaleY","originY"];function CS(e,t,s,n){NS(e.x,t,wP,s?s.x:void 0,n?n.x:void 0),NS(e.y,t,SP,s?s.y:void 0,n?n.y:void 0)}function ES(e){return e.translate===0&&e.scale===1}function O3(e){return ES(e.x)&&ES(e.y)}function jS(e,t){return e.min===t.min&&e.max===t.max}function kP(e,t){return jS(e.x,t.x)&&jS(e.y,t.y)}function AS(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function L3(e,t){return AS(e.x,t.x)&&AS(e.y,t.y)}function TS(e){return hn(e.x)/hn(e.y)}function RS(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Vi(e){return[e("x"),e("y")]}function NP(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:v,skewY:w}=s;d&&(n=`perspective(${d}px) ${n}`),p&&(n+=`rotate(${p}deg) `),g&&(n+=`rotateX(${g}deg) `),x&&(n+=`rotateY(${x}deg) `),v&&(n+=`skewX(${v}deg) `),w&&(n+=`skewY(${w}deg) `)}const h=e.x.scale*t.x,f=e.y.scale*t.y;return(h!==1||f!==1)&&(n+=`scale(${h}, ${f})`),n||"none"}const z3=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],CP=z3.length,MS=e=>typeof e=="string"?parseFloat(e):e,DS=e=>typeof e=="number"||Ye.test(e);function EP(e,t,s,n,o,l){o?(e.opacity=Kt(0,s.opacity??1,jP(n)),e.opacityExit=Kt(t.opacity??1,0,AP(n))):l&&(e.opacity=Kt(t.opacity??1,s.opacity??1,n));for(let u=0;u<CP;u++){const h=z3[u];let f=OS(t,h),d=OS(s,h);if(f===void 0&&d===void 0)continue;f||(f=0),d||(d=0),f===0||d===0||DS(f)===DS(d)?(e[h]=Math.max(Kt(MS(f),MS(d),n),0),(Ki.test(d)||Ki.test(f))&&(e[h]+="%")):e[h]=d}(t.rotate||s.rotate)&&(e.rotate=Kt(t.rotate||0,s.rotate||0,n))}function OS(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const jP=B3(0,.5,EE),AP=B3(.5,.95,ci);function B3(e,t,s){return n=>n<e?0:n>t?1:s(Jc(e,t,n))}function TP(e,t,s){const n=Qs(e)?e:fl(e);return n.start(Db("",n,t,s)),n.animation}function su(e,t,s,n={passive:!0}){return e.addEventListener(t,s,n),()=>e.removeEventListener(t,s)}const RP=(e,t)=>e.depth-t.depth;class MP{constructor(){this.children=[],this.isDirty=!1}add(t){_b(this.children,t),this.isDirty=!0}remove(t){Oh(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(RP),this.isDirty=!1,this.children.forEach(t)}}function DP(e,t){const s=dn.now(),n=({timestamp:o})=>{const l=o-s;l>=t&&(_a(n),e(l-t))};return Ht.setup(n,!0),()=>_a(n)}function yh(e){return Qs(e)?e.get():e}class OP{constructor(){this.members=[]}add(t){_b(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&&(Oh(this.members,n),n.unmount())}t.scheduleRender()}remove(t){if(Oh(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 wh={hasAnimatedSinceResize:!0,hasEverUpdated:!1},hg=["","X","Y","Z"],LP=1e3;let zP=0;function fg(e,t,s,n){const{latestValues:o}=t;o[e]&&(s[e]=o[e],t.setStaticValue(e,0),n&&(n[e]=0))}function P3(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const s=i3(t);if(window.MotionHasOptimisedAnimation(s,"transform")){const{layout:o,layoutId:l}=e.options;window.MotionCancelOptimisedAnimation(s,"transform",Ht,!(o||l))}const{parent:n}=e;n&&!n.hasCheckedOptimisedAppear&&P3(n)}function I3({attachResizeListener:e,defaultParent:t,measureScroll:s,checkIsScrollRoot:n,resetTransform:o}){return class{constructor(u={},h=t?.()){this.id=zP++,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(IP),this.nodes.forEach(VP),this.nodes.forEach(GP),this.nodes.forEach($P)},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 f=0;f<this.path.length;f++)this.path[f].shouldResetTransform=!0;this.root===this&&(this.nodes=new MP)}addEventListener(u,h){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new wb),this.eventHandlers.get(u).add(h)}notifyListeners(u,...h){const f=this.eventHandlers.get(u);f&&f.notify(...h)}hasListeners(u){return this.eventHandlers.has(u)}mount(u){if(this.instance)return;this.isSVG=Ib(u)&&!PB(u),this.instance=u;const{layoutId:h,layout:f,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&&(f||h)&&(this.isLayoutDirty=!0),e){let p,g=0;const x=()=>this.root.updateBlockedByResize=!1;Ht.read(()=>{g=window.innerWidth}),e(u,()=>{const v=window.innerWidth;v!==g&&(g=v,this.root.updateBlockedByResize=!0,p&&p(),p=DP(x,250),wh.hasAnimatedSinceResize&&(wh.hasAnimatedSinceResize=!1,this.nodes.forEach(BS)))})}h&&this.root.registerSharedNode(h,this),this.options.animate!==!1&&d&&(h||f)&&this.addEventListener("didUpdate",({delta:p,hasLayoutChanged:g,hasRelativeLayoutChanged:x,layout:v})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const w=this.options.transition||d.getDefaultTransition()||ZP,{onLayoutAnimationStart:k,onLayoutAnimationComplete:N}=d.getProps(),E=!this.targetLayout||!L3(this.targetLayout,v),T=!g&&x;if(this.options.layoutRoot||this.resumeFrom||T||g&&(E||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const A={...Mb(w,"layout"),onPlay:k,onComplete:N};(d.shouldReduceMotion||this.options.layoutRoot)&&(A.delay=0,A.type=!1),this.startAnimation(A),this.setAnimationOrigin(p,T)}else g||BS(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=v})}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(),_a(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(WP),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&&P3(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:f}=this.options;if(h===void 0&&!f)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 f=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),f&&this.nodes.forEach(UP),this.nodes.forEach(LS);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(zS);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(FP),this.nodes.forEach(qP),this.nodes.forEach(BP),this.nodes.forEach(PP)):this.nodes.forEach(zS),this.clearAllSnapshots();const h=dn.now();Xs.delta=Zi(0,1e3/60,h-Xs.timestamp),Xs.timestamp=h,Xs.isProcessing=!0,ig.update.process(Xs),ig.preRender.process(Xs),ig.render.process(Xs),Xs.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Bb.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(HP),this.sharedNodes.forEach(KP)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Ht.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Ht.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!hn(this.snapshot.measuredBox.x)&&!hn(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 f=0;f<this.path.length;f++)this.path[f].updateScroll();const u=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=Ms()),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 f=n(this.instance);this.scroll={animationId:this.root.animationId,phase:u,isRoot:f,offset:s(this.instance),wasRoot:this.scroll?this.scroll.isRoot:f}}}resetTransform(){if(!o)return;const u=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,h=this.projectionDelta&&!O3(this.projectionDelta),f=this.getTransformTemplate(),d=f?f(this.latestValues,""):void 0,p=d!==this.prevTransformTemplateValue;u&&this.instance&&(h||Wa(this.latestValues)||p)&&(o(this.instance,d),this.shouldResetTransform=!1,this.scheduleRender())}measure(u=!0){const h=this.measurePageBox();let f=this.removeElementScroll(h);return u&&(f=this.removeTransform(f)),QP(f),{animationId:this.root.animationId,measuredBox:h,layoutBox:f,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:u}=this.options;if(!u)return Ms();const h=u.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(JP))){const{scroll:d}=this.root;d&&(Gi(h.x,d.offset.x),Gi(h.y,d.offset.y))}return h}removeElementScroll(u){const h=Ms();if(Ni(h,u),this.scroll?.wasRoot)return h;for(let f=0;f<this.path.length;f++){const d=this.path[f],{scroll:p,options:g}=d;d!==this.root&&p&&g.layoutScroll&&(p.wasRoot&&Ni(h,u),Gi(h.x,p.offset.x),Gi(h.y,p.offset.y))}return h}applyTransform(u,h=!1,f){const d=f||Ms();Ni(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&&(Gi(d.x,-g.scroll.offset.x),Gi(d.y,-g.scroll.offset.y)),Wa(g.latestValues)&&_h(d,g.latestValues,g.layout?.layoutBox)}return Wa(this.latestValues)&&_h(d,this.latestValues,this.layout?.layoutBox),d}removeTransform(u){const h=Ms();Ni(h,u);for(let f=0;f<this.path.length;f++){const d=this.path[f];if(!Wa(d.latestValues))continue;let p;d.instance&&(Yx(d.latestValues)&&d.updateSnapshot(),p=Ms(),Ni(p,d.measurePageBox())),CS(h,d.latestValues,d.snapshot?.layoutBox,p)}return Wa(this.latestValues)&&CS(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!==Xs.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 f=!!this.resumingFrom||this!==h;if(!(u||f&&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=Xs.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=Ms(),this.targetWithTransforms=Ms()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),_P(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):Ni(this.target,this.layout.layoutBox),w3(this.target,this.targetDelta)):Ni(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||Yx(this.parent.latestValues)||y3(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,f){this.relativeParent=u,this.linkedParentVersion=u.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Ms(),this.relativeTargetOrigin=Ms(),Hh(this.relativeTargetOrigin,h,f,this.options.layoutAnchor||void 0),Ni(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const u=this.getLead(),h=!!this.resumingFrom||this!==u;let f=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(f=!1),h&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(f=!1),this.resolvedRelativeTargetAt===Xs.timestamp&&(f=!1),f)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;Ni(this.layoutCorrected,this.layout.layoutBox);const g=this.treeScale.x,x=this.treeScale.y;YB(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=Ms());const{target:v}=u;if(!v){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(_S(this.prevProjectionDelta.x,this.projectionDelta.x),_S(this.prevProjectionDelta.y,this.projectionDelta.y)),qc(this.projectionDelta,this.layoutCorrected,v,this.latestValues),(this.treeScale.x!==g||this.treeScale.y!==x||!RS(this.projectionDelta.x,this.prevProjectionDelta.x)||!RS(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",v))}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=il(),this.projectionDelta=il(),this.projectionDeltaWithTransform=il()}setAnimationOrigin(u,h=!1){const f=this.snapshot,d=f?f.latestValues:{},p={...this.latestValues},g=il();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!h;const x=Ms(),v=f?f.source:void 0,w=this.layout?this.layout.source:void 0,k=v!==w,N=this.getStack(),E=!N||N.members.length<=1,T=!!(k&&!E&&this.options.crossfade===!0&&!this.path.some(XP));this.animationProgress=0;let A;this.mixTargetDelta=C=>{const R=C/1e3;PS(g.x,u.x,R),PS(g.y,u.y,R),this.setTargetDelta(g),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Hh(x,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),YP(this.relativeTarget,this.relativeTargetOrigin,x,R),A&&kP(this.relativeTarget,A)&&(this.isProjectionDirty=!1),A||(A=Ms()),Ni(A,this.relativeTarget)),k&&(this.animationValues=p,EP(p,d,this.latestValues,R,T,E)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=R},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(u){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(_a(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Ht.update(()=>{wh.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=fl(0)),this.motionValue.jump(0,!1),this.currentAnimation=TP(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(LP),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const u=this.getLead();let{targetWithTransforms:h,target:f,layout:d,latestValues:p}=u;if(!(!h||!f||!d)){if(this!==u&&this.layout&&d&&$3(this.options.animationType,this.layout.layoutBox,d.layoutBox)){f=this.target||Ms();const g=hn(this.layout.layoutBox.x);f.x.min=u.target.x.min,f.x.max=f.x.min+g;const x=hn(this.layout.layoutBox.y);f.y.min=u.target.y.min,f.y.max=f.y.min+x}Ni(h,f),_h(h,p),qc(this.projectionDeltaWithTransform,this.layoutCorrected,h,p)}}registerSharedNode(u,h){this.sharedNodes.has(u)||this.sharedNodes.set(u,new OP),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:f}={}){const d=this.getStack();d&&d.promote(this,f),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:f}=u;if((f.z||f.rotate||f.rotateX||f.rotateY||f.rotateZ||f.skewX||f.skewY)&&(h=!0),!h)return;const d={};f.z&&fg("z",u,d,this.animationValues);for(let p=0;p<hg.length;p++)fg(`rotate${hg[p]}`,u,d,this.animationValues),fg(`skew${hg[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 f=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,u.visibility="",u.opacity="",u.pointerEvents=yh(h?.pointerEvents)||"",u.transform=f?f(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&&!Wa(this.latestValues)&&(u.transform=f?f({},""):"none",this.hasProjected=!1);return}u.visibility="";const p=d.animationValues||d.latestValues;this.applyTransformsToTarget();let g=NP(this.projectionDeltaWithTransform,this.treeScale,p);f&&(g=f(p,g)),u.transform=g;const{x,y:v}=this.projectionDelta;u.transformOrigin=`${x.origin*100}% ${v.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 w in Zx){if(p[w]===void 0)continue;const{correct:k,applyTo:N,isCSSVariable:E}=Zx[w],T=g==="none"?p[w]:k(p[w],d);if(N){const A=N.length;for(let C=0;C<A;C++)u[N[C]]=T}else E?this.options.visualElement.renderState.vars[w]=T:u[w]=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(LS),this.root.sharedNodes.clear()}}}function BP(e){e.updateLayout()}function PP(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")Vi(p=>{const g=l?t.measuredBox[p]:t.layoutBox[p],x=hn(g);g.min=s[p].min,g.max=g.min+x});else if(o==="x"||o==="y"){const p=o==="x"?"y":"x";Qx(l?t.measuredBox[p]:t.layoutBox[p],s[p])}else $3(o,t.layoutBox,s)&&Vi(p=>{const g=l?t.measuredBox[p]:t.layoutBox[p],x=hn(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=il();qc(u,s,t.layoutBox);const h=il();l?qc(h,e.applyTransform(n,!0),t.measuredBox):qc(h,s,t.layoutBox);const f=!O3(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 v=e.options.layoutAnchor||void 0,w=Ms();Hh(w,t.layoutBox,g.layoutBox,v);const k=Ms();Hh(k,s,x.layoutBox,v),L3(w,k)||(d=!0),p.options.layoutRoot&&(e.relativeTarget=k,e.relativeTargetOrigin=w,e.relativeParent=p)}}}e.notifyListeners("didUpdate",{layout:s,snapshot:t,delta:h,layoutDelta:u,hasLayoutChanged:f,hasRelativeLayoutChanged:d})}else if(e.isLead()){const{onExitComplete:s}=e.options;s&&s()}e.options.transition=void 0}function IP(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 $P(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function HP(e){e.clearSnapshot()}function LS(e){e.clearMeasurements()}function UP(e){e.isLayoutDirty=!0,e.updateLayout()}function zS(e){e.isLayoutDirty=!1}function FP(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function qP(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function BS(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function VP(e){e.resolveTargetDelta()}function GP(e){e.calcProjection()}function WP(e){e.resetSkewAndRotation()}function KP(e){e.removeLeadSnapshot()}function PS(e,t,s){e.translate=Kt(t.translate,0,s),e.scale=Kt(t.scale,1,s),e.origin=t.origin,e.originPoint=t.originPoint}function IS(e,t,s,n){e.min=Kt(t.min,s.min,n),e.max=Kt(t.max,s.max,n)}function YP(e,t,s,n){IS(e.x,t.x,s.x,n),IS(e.y,t.y,s.y,n)}function XP(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const ZP={duration:.45,ease:[.4,0,.1,1]},$S=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),HS=$S("applewebkit/")&&!$S("chrome/")?Math.round:ci;function US(e){e.min=HS(e.min),e.max=HS(e.max)}function QP(e){US(e.x),US(e.y)}function $3(e,t,s){return e==="position"||e==="preserve-aspect"&&!vP(TS(t),TS(s),.2)}function JP(e){return e!==e.root&&e.scroll?.wasRoot}const eI=I3({attachResizeListener:(e,t)=>su(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),mg={current:void 0},H3=I3({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!mg.current){const e=new eI({});e.mount(window),e.setOptions({layoutScroll:!0}),mg.current=e}return mg.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),U3=_.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function tI(e=!0){const t=_.useContext(vb);if(t===null)return[!0,null];const{isPresent:s,onExitComplete:n,register:o}=t,l=_.useId();_.useEffect(()=>{if(e)return o(l)},[e]);const u=_.useCallback(()=>e&&n&&n(l),[l,n,e]);return!s&&n?[!1,u]:[!0]}const F3=_.createContext({strict:!1}),FS={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 qS=!1;function sI(){if(qS)return;const e={};for(const t in FS)e[t]={isEnabled:s=>FS[t].some(n=>!!s[n])};b3(e),qS=!0}function q3(){return sI(),VB()}function nI(e){const t=q3();for(const s in e)t[s]={...t[s],...e[s]};b3(t)}const iI=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 Uh(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||iI.has(e)}let V3=e=>!Uh(e);function rI(e){typeof e=="function"&&(V3=t=>t.startsWith("on")?!Uh(t):e(t))}try{rI(require("@emotion/is-prop-valid").default)}catch{}function aI(e,t,s){const n={};for(const o in e)o==="values"&&typeof e.values=="object"||Qs(e[o])||(V3(o)||s===!0&&Uh(o)||!t&&!Uh(o)||e.draggable&&o.startsWith("onDrag"))&&(n[o]=e[o]);return n}const Cf=_.createContext({});function oI(e,t){if(Nf(e)){const{initial:s,animate:n}=e;return{initial:s===!1||tu(s)?s:void 0,animate:tu(n)?n:void 0}}return e.inherit!==!1?t:{}}function lI(e){const{initial:t,animate:s}=oI(e,_.useContext(Cf));return _.useMemo(()=>({initial:t,animate:s}),[VS(t),VS(s)])}function VS(e){return Array.isArray(e)?e.join(" "):e}const qb=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function G3(e,t,s){for(const n in t)!Qs(t[n])&&!N3(n,s)&&(e[n]=t[n])}function cI({transformTemplate:e},t){return _.useMemo(()=>{const s=qb();return Ub(s,t,e),Object.assign({},s.vars,s.style)},[t])}function uI(e,t){const s=e.style||{},n={};return G3(n,s,e),Object.assign(n,cI(e,t)),n}function dI(e,t){const s={},n=uI(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 W3=()=>({...qb(),attrs:{}});function hI(e,t,s,n){const o=_.useMemo(()=>{const l=W3();return C3(l,t,j3(n),e.transformTemplate,e.style),{...l.attrs,style:{...l.style}}},[t]);if(e.style){const l={};G3(l,e.style,e),o.style={...l,...o.style}}return o}const fI=["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 Vb(e){return typeof e!="string"||e.includes("-")?!1:!!(fI.indexOf(e)>-1||/[A-Z]/u.test(e))}function mI(e,t,s,{latestValues:n},o,l=!1,u){const f=(u??Vb(e)?hI:dI)(t,n,o,e),d=aI(t,typeof e=="string",l),p=e!==_.Fragment?{...d,...f,ref:s}:{},{children:g}=t,x=_.useMemo(()=>Qs(g)?g.get():g,[g]);return _.createElement(e,{...p,children:x})}function pI({scrapeMotionValuesFromProps:e,createRenderState:t},s,n,o){return{latestValues:gI(s,n,o,e),renderState:t()}}function gI(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 f=Nf(e),d=g3(e);t&&d&&!f&&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"&&!kf(g)){const x=Array.isArray(g)?g:[g];for(let v=0;v<x.length;v++){const w=Ob(e,x[v]);if(w){const{transitionEnd:k,transition:N,...E}=w;for(const T in E){let A=E[T];if(Array.isArray(A)){const C=p?A.length-1:0;A=A[C]}A!==null&&(o[T]=A)}for(const T in k)o[T]=k[T]}}}return o}const K3=e=>(t,s)=>{const n=_.useContext(Cf),o=_.useContext(vb),l=()=>pI(e,t,n,o);return s?l():f9(l)},xI=K3({scrapeMotionValuesFromProps:Fb,createRenderState:qb}),bI=K3({scrapeMotionValuesFromProps:A3,createRenderState:W3}),vI=Symbol.for("motionComponentSymbol");function _I(e,t,s){const n=_.useRef(s);_.useInsertionEffect(()=>{n.current=s});const o=_.useRef(null);return _.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 Y3=_.createContext({});function tl(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function yI(e,t,s,n,o,l){const{visualElement:u}=_.useContext(Cf),h=_.useContext(F3),f=_.useContext(vb),d=_.useContext(U3),p=d.reducedMotion,g=d.skipAnimations,x=_.useRef(null),v=_.useRef(!1);n=n||h.renderer,!x.current&&n&&(x.current=n(e,{visualState:t,parent:u,props:s,presenceContext:f,blockInitialAnimation:f?f.initial===!1:!1,reducedMotionConfig:p,skipAnimations:g,isSVG:l}),v.current&&x.current&&(x.current.manuallyAnimateOnMount=!0));const w=x.current,k=_.useContext(Y3);w&&!w.projection&&o&&(w.type==="html"||w.type==="svg")&&wI(x.current,s,o,k);const N=_.useRef(!1);_.useInsertionEffect(()=>{w&&N.current&&w.update(s,f)});const E=s[n3],T=_.useRef(!!E&&typeof window<"u"&&!window.MotionHandoffIsComplete?.(E)&&window.MotionHasOptimisedAnimation?.(E));return p9(()=>{v.current=!0,w&&(N.current=!0,window.MotionIsMounted=!0,w.updateFeatures(),w.scheduleRenderMicrotask(),T.current&&w.animationState&&w.animationState.animateChanges())}),_.useEffect(()=>{w&&(!T.current&&w.animationState&&w.animationState.animateChanges(),T.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(E)}),T.current=!1),w.enteringChildren=void 0)}),w}function wI(e,t,s,n){const{layoutId:o,layout:l,drag:u,dragConstraints:h,layoutScroll:f,layoutRoot:d,layoutAnchor:p,layoutCrossfade:g}=t;e.projection=new s(e.latestValues,t["data-framer-portal-id"]?void 0:X3(e.parent)),e.projection.setOptions({layoutId:o,layout:l,alwaysMeasureLayout:!!u||h&&tl(h),visualElement:e,animationType:typeof l=="string"?l:"both",initialPromotionConfig:n,crossfade:g,layoutScroll:f,layoutRoot:d,layoutAnchor:p})}function X3(e){if(e)return e.options.allowProjection!==!1?e.projection:X3(e.parent)}function pg(e,{forwardMotionProps:t=!1,type:s}={},n,o){n&&nI(n);const l=s?s==="svg":Vb(e),u=l?bI:xI;function h(d,p){let g;const x={..._.useContext(U3),...d,layoutId:SI(d)},{isStatic:v}=x,w=lI(d),k=u(d,v);if(!v&&typeof window<"u"){kI();const N=NI(x);g=N.MeasureLayout,w.visualElement=yI(e,k,x,o,N.ProjectionNode,l)}return i.jsxs(Cf.Provider,{value:w,children:[g&&w.visualElement?i.jsx(g,{visualElement:w.visualElement,...x}):null,mI(e,d,_I(k,w.visualElement,p),k,v,t,l)]})}h.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const f=_.forwardRef(h);return f[vI]=e,f}function SI({layoutId:e}){const t=_.useContext(pE).id;return t&&e!==void 0?t+"-"+e:e}function kI(e,t){_.useContext(F3).strict}function NI(e){const t=q3(),{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 CI(e,t){if(typeof Proxy>"u")return pg;const s=new Map,n=(l,u)=>pg(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,pg(u,void 0,e,t)),s.get(u))})}const EI=(e,t)=>t.isSVG??Vb(e)?new lP(t):new sP(t,{allowProjection:e!==_.Fragment});class jI extends wa{constructor(t){super(t),t.animationState||(t.animationState=fP(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();kf(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 AI=0;class TI extends wa{constructor(){super(...arguments),this.id=AI++,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=so(this.node,l,u);if(h){const{transition:f,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 RI={animation:{Feature:jI},exit:{Feature:TI}};function hu(e){return{point:{x:e.pageX,y:e.pageY}}}const MI=e=>t=>Pb(t)&&e(t,hu(t));function Vc(e,t,s,n){return su(e,t,MI(s),n)}const Z3=({current:e})=>e?e.ownerDocument.defaultView:null,GS=(e,t)=>Math.abs(e-t);function DI(e,t){const s=GS(e.x,t.x),n=GS(e.y,t.y);return Math.sqrt(s**2+n**2)}const WS=new Set(["auto","scroll"]);class Q3{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=v=>{this.handleScroll(v.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Ud(this.lastRawMoveEventInfo,this.transformPagePoint));const v=gg(this.lastMoveEventInfo,this.history),w=this.startEvent!==null,k=DI(v.offset,{x:0,y:0})>=this.distanceThreshold;if(!w&&!k)return;const{point:N}=v,{timestamp:E}=Xs;this.history.push({...N,timestamp:E});const{onStart:T,onMove:A}=this.handlers;w||(T&&T(this.lastMoveEvent,v),this.startEvent=this.lastMoveEvent),A&&A(this.lastMoveEvent,v)},this.handlePointerMove=(v,w)=>{this.lastMoveEvent=v,this.lastRawMoveEventInfo=w,this.lastMoveEventInfo=Ud(w,this.transformPagePoint),Ht.update(this.updatePoint,!0)},this.handlePointerUp=(v,w)=>{this.end();const{onEnd:k,onSessionEnd:N,resumeAnimation:E}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&E&&E(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const T=gg(v.type==="pointercancel"?this.lastMoveEventInfo:Ud(w,this.transformPagePoint),this.history);this.startEvent&&k&&k(v,T),N&&N(v,T)},!Pb(t))return;this.dragSnapToOrigin=l,this.handlers=s,this.transformPagePoint=n,this.distanceThreshold=u,this.contextWindow=o||window;const f=hu(t),d=Ud(f,this.transformPagePoint),{point:p}=d,{timestamp:g}=Xs;this.history=[{...p,timestamp:g}];const{onSessionStart:x}=s;x&&x(t,gg(d,this.history)),this.removeListeners=cu(Vc(this.contextWindow,"pointermove",this.handlePointerMove),Vc(this.contextWindow,"pointerup",this.handlePointerUp),Vc(this.contextWindow,"pointercancel",this.handlePointerUp)),h&&this.startScrollTracking(h)}startScrollTracking(t){let s=t.parentElement;for(;s;){const n=getComputedStyle(s);(WS.has(n.overflowX)||WS.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),Ht.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),_a(this.updatePoint)}}function Ud(e,t){return t?{point:t(e.point)}:e}function KS(e,t){return{x:e.x-t.x,y:e.y-t.y}}function gg({point:e},t){return{point:e,delta:KS(e,J3(t)),offset:KS(e,OI(t)),velocity:LI(t,.1)}}function OI(e){return e[0]}function J3(e){return e[e.length-1]}function LI(e,t){if(e.length<2)return{x:0,y:0};let s=e.length-1,n=null;const o=J3(e);for(;s>=0&&(n=e[s],!(o.timestamp-n.timestamp>qn(t)));)s--;if(!n)return{x:0,y:0};n===e[0]&&e.length>2&&o.timestamp-n.timestamp>qn(t)*2&&(n=e[1]);const l=li(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 zI(e,{min:t,max:s},n){return t!==void 0&&e<t?e=n?Kt(t,e,n.min):Math.max(e,t):s!==void 0&&e>s&&(e=n?Kt(s,e,n.max):Math.min(e,s)),e}function YS(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 BI(e,{top:t,left:s,bottom:n,right:o}){return{x:YS(e.x,s,o),y:YS(e.y,t,n)}}function XS(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 PI(e,t){return{x:XS(e.x,t.x),y:XS(e.y,t.y)}}function II(e,t){let s=.5;const n=hn(e),o=hn(t);return o>n?s=Jc(t.min,t.max-n,e.min):n>o&&(s=Jc(e.min,e.max-o,t.min)),Zi(0,1,s)}function $I(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 Jx=.35;function HI(e=Jx){return e===!1?e=0:e===!0&&(e=Jx),{x:ZS(e,"left","right"),y:ZS(e,"top","bottom")}}function ZS(e,t,s){return{min:QS(e,t),max:QS(e,s)}}function QS(e,t){return typeof e=="number"?e:e[t]||0}const UI=new WeakMap;class FI{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=Ms(),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(hu(g).point),this.stopAnimation()},u=(g,x)=>{const{drag:v,dragPropagation:w,onDragStart:k}=this.getProps();if(v&&!w&&(this.openDragLock&&this.openDragLock(),this.openDragLock=yB(v),!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),Vi(E=>{let T=this.getAxisMotionValue(E).get()||0;if(Ki.test(T)){const{projection:A}=this.visualElement;if(A&&A.layout){const C=A.layout.layoutBox[E];C&&(T=hn(C)*(parseFloat(T)/100))}}this.originPoint[E]=T}),k&&Ht.update(()=>k(g,x),!1,!0),qx(this.visualElement,"transform");const{animationState:N}=this.visualElement;N&&N.setActive("whileDrag",!0)},h=(g,x)=>{this.latestPointerEvent=g,this.latestPanInfo=x;const{dragPropagation:v,dragDirectionLock:w,onDirectionLock:k,onDrag:N}=this.getProps();if(!v&&!this.openDragLock)return;const{offset:E}=x;if(w&&this.currentDirection===null){this.currentDirection=VI(E),this.currentDirection!==null&&k&&k(this.currentDirection);return}this.updateAxis("x",x.point,E),this.updateAxis("y",x.point,E),this.visualElement.render(),N&&Ht.update(()=>N(g,x),!1,!0)},f=(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 Q3(t,{onSessionStart:l,onStart:u,onMove:h,onSessionEnd:f,resumeAnimation:d},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:p,distanceThreshold:n,contextWindow:Z3(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&&Ht.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||!Fd(t,o,this.currentDirection))return;const l=this.getAxisMotionValue(t);let u=this.originPoint[t]+n[t];this.constraints&&this.constraints[t]&&(u=zI(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&&tl(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&n?this.constraints=BI(n.layoutBox,t):this.constraints=!1,this.elastic=HI(s),o!==this.constraints&&!tl(t)&&n&&this.constraints&&!this.hasMutatedConstraints&&Vi(l=>{this.constraints!==!1&&this.getAxisMotionValue(l)&&(this.constraints[l]=$I(n.layoutBox[l],this.constraints[l]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:s}=this.getProps();if(!t||!tl(t))return!1;const n=t.current,{projection:o}=this.visualElement;if(!o||!o.layout)return!1;const l=XB(n,o.root,this.visualElement.getTransformPagePoint());let u=PI(o.layout.layoutBox,l);if(s){const h=s(WB(u));this.hasMutatedConstraints=!!h,h&&(u=_3(h))}return u}startAnimation(t){const{drag:s,dragMomentum:n,dragElastic:o,dragTransition:l,dragSnapToOrigin:u,onDragTransitionEnd:h}=this.getProps(),f=this.constraints||{},d=Vi(p=>{if(!Fd(p,s,this.currentDirection))return;let g=f&&f[p]||{};(u===!0||u===p)&&(g={min:0,max:0});const x=o?200:1e6,v=o?40:1e7,w={type:"inertia",velocity:n?t[p]:0,bounceStiffness:x,bounceDamping:v,timeConstant:750,restDelta:1,restSpeed:10,...l,...g};return this.startAxisValueAnimation(p,w)});return Promise.all(d).then(h)}startAxisValueAnimation(t,s){const n=this.getAxisMotionValue(t);return qx(this.visualElement,t),n.start(Db(t,n,0,s,this.visualElement,!1))}stopAnimation(){Vi(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){Vi(s=>{const{drag:n}=this.getProps();if(!Fd(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],f=l.get()||0;l.set(t[s]-Kt(u,h,.5)+f)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:s}=this.getProps(),{projection:n}=this.visualElement;if(!tl(s)||!n||!this.constraints)return;this.stopAnimation();const o={x:0,y:0};Vi(u=>{const h=this.getAxisMotionValue(u);if(h&&this.constraints!==!1){const f=h.get();o[u]=II({min:f,max:f},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(),Vi(u=>{if(!Fd(u,t,null))return;const h=this.getAxisMotionValue(u),{min:f,max:d}=this.constraints[u];h.set(Kt(f,d,o[u]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;UI.set(this.visualElement,this);const t=this.visualElement.current,s=Vc(t,"pointerdown",d=>{const{drag:p,dragListener:g=!0}=this.getProps(),x=d.target,v=x!==t&&EB(x);p&&g&&!v&&this.start(d)});let n;const o=()=>{const{dragConstraints:d}=this.getProps();tl(d)&&d.current&&(this.constraints=this.resolveRefConstraints(),n||(n=qI(t,d.current,()=>this.scalePositionWithinConstraints())))},{projection:l}=this.visualElement,u=l.addEventListener("measure",o);l&&!l.layout&&(l.root&&l.root.updateScroll(),l.updateLayout()),Ht.read(o);const h=su(window,"resize",()=>this.scalePositionWithinConstraints()),f=l.addEventListener("didUpdate",(({delta:d,hasLayoutChanged:p})=>{this.isDragging&&p&&(Vi(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(),f&&f(),n&&n()}}getProps(){const t=this.visualElement.getProps(),{drag:s=!1,dragDirectionLock:n=!1,dragPropagation:o=!1,dragConstraints:l=!1,dragElastic:u=Jx,dragMomentum:h=!0}=t;return{...t,drag:s,dragDirectionLock:n,dragPropagation:o,dragConstraints:l,dragElastic:u,dragMomentum:h}}}function JS(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function qI(e,t,s){const n=lS(e,JS(s)),o=lS(t,JS(s));return()=>{n(),o()}}function Fd(e,t,s){return(t===!0||t===e)&&(s===null||s===e)}function VI(e,t=10){let s=null;return Math.abs(e.y)>t?s="y":Math.abs(e.x)>t&&(s="x"),s}class GI extends wa{constructor(t){super(t),this.removeGroupControls=ci,this.removeListeners=ci,this.controls=new FI(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||ci}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 xg=e=>(t,s)=>{e&&Ht.update(()=>e(t,s),!1,!0)};class WI extends wa{constructor(){super(...arguments),this.removePointerDownListener=ci}onPointerDown(t){this.session=new Q3(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Z3(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:s,onPan:n,onPanEnd:o}=this.node.getProps();return{onSessionStart:xg(t),onStart:xg(s),onMove:xg(n),onEnd:(l,u)=>{delete this.session,o&&Ht.postRender(()=>o(l,u))}}}mount(){this.removePointerDownListener=Vc(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 bg=!1;class KI extends _.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),bg&&l.root.didUpdate(),l.addEventListener("animationComplete",()=>{this.safeToRemove()}),l.setOptions({...l.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),wh.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}),bg=!0,o||t.layoutDependency!==s||s===void 0||t.isPresent!==l?u.willUpdate():this.safeToRemove(),t.isPresent!==l&&(l?u.promote():u.relegate()||Ht.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(),Bb.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:s,switchLayoutGroup:n}=this.props,{projection:o}=t;bg=!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 ej(e){const[t,s]=tI(),n=_.useContext(pE);return i.jsx(KI,{...e,layoutGroup:n,switchLayoutGroup:_.useContext(Y3),isPresent:t,safeToRemove:s})}const YI={pan:{Feature:WI},drag:{Feature:GI,ProjectionNode:H3,MeasureLayout:ej}};function e2(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&&Ht.postRender(()=>l(t,hu(t)))}class XI extends wa{mount(){const{current:t}=this.node;t&&(this.unmount=SB(t,(s,n)=>(e2(this.node,n,"Start"),o=>e2(this.node,o,"End"))))}unmount(){}}class ZI extends wa{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=cu(su(this.node.current,"focus",()=>this.onFocus()),su(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function t2(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&&Ht.postRender(()=>l(t,hu(t)))}class QI extends wa{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:s,propagate:n}=this.node.props;this.unmount=AB(t,(o,l)=>(t2(this.node,l,"Start"),(u,{success:h})=>t2(this.node,u,h?"End":"Cancel")),{useGlobalTarget:s,stopPropagation:n?.tap===!1})}unmount(){}}const e0=new WeakMap,vg=new WeakMap,JI=e=>{const t=e0.get(e.target);t&&t(e)},e$=e=>{e.forEach(JI)};function t$({root:e,...t}){const s=e||document;vg.has(s)||vg.set(s,{});const n=vg.get(s),o=JSON.stringify(t);return n[o]||(n[o]=new IntersectionObserver(e$,{root:e,...t})),n[o]}function s$(e,t,s){const n=t$(t);return e0.set(e,s),n.observe(e),()=>{e0.delete(e),n.unobserve(e)}}const n$={some:0,all:1};class i$ extends wa{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:n$[o]},h=f=>{const{isIntersecting:d}=f;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(f)};this.stopObserver=s$(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(r$(t,s))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}}function r$({viewport:e={}},{viewport:t={}}={}){return s=>e[s]!==t[s]}const a$={inView:{Feature:i$},tap:{Feature:QI},focus:{Feature:ZI},hover:{Feature:XI}},o$={layout:{ProjectionNode:H3,MeasureLayout:ej}},l$={...RI,...a$,...YI,...o$},_g=CI(l$,EI),Ge=({label:e,children:t,variant:s="primary",size:n="medium",icon:o,onClick:l,removable:u=!1,className:h,maxWidth:f,appearance:d,onRemove:p,isLoading:g=!1})=>{const x=c$(s),v=d??(s==="outline"?"outline":"solid"),w=e??t,k=!!l,N={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"}},E={small:"text-xs px-2 py-1",medium:"text-xs px-2.5 py-1",large:"text-sm px-3 py-1.5"},T=C=>{C.stopPropagation(),l?.()},A=C=>{C.stopPropagation(),p?.()};return i.jsxs(_g.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:k?1.04:1,transition:{duration:.2,ease:"easeInOut",type:"spring"}},onClick:T,style:{maxWidth:f},className:ae("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",N[x][v],E[n],k&&"cursor-pointer",h),children:[g?i.jsx(_g.div,{animate:{rotate:360},transition:{duration:1,ease:"linear",repeat:1/0},className:"flex-shrink-0",children:i.jsx(jt,{className:"size-3.5"})}):o&&i.jsx("span",{className:"flex-shrink-0",children:o}),i.jsx("span",{className:"min-w-0 truncate",children:w}),u&&i.jsx(_g.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:A,type:"button",children:i.jsx(Ut,{className:"size-3.5"})})]})};function c$(e){return e==="danger"?"error":e==="default"||e==="outline"?"primary":e}const u$=JC("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 Qe({className:e,variant:t,...s}){return i.jsx("div",{className:ae(u$({variant:t,className:e})),...s})}function tj({className:e,...t}){return i.jsx("h5",{className:ae("mb-1 font-medium leading-none",e),...t})}function sj({className:e,...t}){return i.jsx("p",{className:ae("leading-5",e),...t})}function Fh(e){return ae("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 qh(e){return ae("flex size-7 shrink-0 items-center justify-center [&_svg]:size-4 [&_svg]:shrink-0",e)}function Vh(e){return ae("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 hi({className:e,...t}){return i.jsx("div",{className:ae("rounded-lg border border-border bg-card text-card-foreground",e),...t})}function fi({className:e,...t}){return i.jsx("div",{className:ae("grid gap-1.5 p-4",e),...t})}function mi({className:e,...t}){return i.jsx("h3",{className:ae("text-sm font-semibold tracking-tight",e),...t})}function er({className:e,...t}){return i.jsx("p",{className:ae("text-sm text-muted-foreground",e),...t})}function pi({className:e,...t}){return i.jsx("div",{className:ae("p-4 pt-0",e),...t})}const s2=100;function d$(){const[e,t]=_.useState([]),[s,n]=_.useState(!1),o=_.useRef(new Set);_.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 f=JSON.parse(h.data);t(d=>{if(o.current.has(f.id))return d;o.current.add(f.id);const p=[...d,f];return p.length>s2&&p.splice(0,p.length-s2),p})}catch{}}),()=>{u.close()}},[]);const l=[...e].reverse();return i.jsxs(hi,{className:"min-w-0 rounded-none border-0 border-b border-border bg-transparent",children:[i.jsxs(fi,{className:"border-b border-border px-3 py-2",children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(eo,{className:"size-4 text-muted-foreground"}),i.jsx(mi,{children:"Live MCP Tool Calls"}),i.jsx(Ge,{variant:"outline",size:"small",children:e.length})]}),i.jsx(Ge,{variant:"outline",size:"small",icon:i.jsx("span",{className:ae("inline-block size-1.5 rounded-full",s?"animate-pulse bg-emerald-500":"bg-muted-foreground/60")}),children:s?"live":"reconnecting…"})]}),i.jsx(er,{className:"text-xs",children:"Streamed from this NoMoreIDE MCP server. Newest at the top."})]}),i.jsx(pi,{className:"p-0",children:l.length?i.jsx("ul",{className:"max-h-96 divide-y divide-border overflow-auto",children:l.map(u=>i.jsxs("li",{className:"px-3 py-2",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("span",{className:"truncate font-mono text-xs font-semibold",children:u.tool}),i.jsxs("div",{className:"flex shrink-0 items-center gap-2 font-mono text-[10px] text-muted-foreground",children:[i.jsxs("span",{children:[u.durationMs," ms"]}),i.jsx(Ge,{variant:u.status==="ok"?"success":"error",appearance:"outline",size:"small",children:u.status})]})]}),u.args?i.jsx("div",{className:"mt-0.5 truncate font-mono text-[11px] text-muted-foreground",children:u.args}):null,u.error?i.jsx("div",{className:"mt-0.5 font-mono text-[11px] text-destructive",children:u.error}):null,i.jsx("div",{className:"mt-0.5 font-mono text-[10px] text-muted-foreground/80",children:new Date(u.startedAt).toLocaleTimeString()})]},u.id))}):i.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 h$({agent:e}){return i.jsxs(i.Fragment,{children:[i.jsx(d$,{}),i.jsxs(hi,{className:"min-w-0 rounded-none border-0 bg-transparent",children:[i.jsxs(fi,{className:"border-b border-border px-3 py-2",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(pf,{className:"size-4 text-muted-foreground"}),i.jsx(mi,{children:"Recent Projects"})]}),i.jsx(Ge,{variant:"outline",size:"small",children:e.projects.length})]}),i.jsx(er,{className:"text-xs",children:"Most recently active projects known to the agent."})]}),i.jsx(pi,{className:"p-0",children:e.projects.length?i.jsx("ul",{className:"divide-y divide-border",children:e.projects.map(t=>i.jsxs("li",{className:ae("flex items-start justify-between gap-3 px-3 py-2",t.current&&"bg-primary/5"),children:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"truncate font-mono text-xs font-semibold",children:t.path}),t.current?i.jsx(Ge,{variant:"outline",size:"small",children:"current"}):null]}),t.lastSessionFirstPrompt?i.jsx("p",{className:"mt-0.5 truncate text-[11px] text-muted-foreground",children:t.lastSessionFirstPrompt}):null]}),i.jsxs("div",{className:"shrink-0 text-right font-mono text-[10px] text-muted-foreground",children:[t.mcpServerCount?i.jsxs("div",{children:[t.mcpServerCount," mcp"]}):null,t.lastSessionModified?i.jsx("div",{children:f$(t.lastSessionModified)}):null]})]},t.path))}):i.jsx("p",{className:"px-3 py-4 text-xs text-muted-foreground",children:"No known projects."})})]})]})}function f$(e){const t=Date.parse(e);return Number.isNaN(t)?e:new Date(t).toLocaleString()}function Sa({className:e}){return i.jsx("svg",{className:ae("size-3.5",e),viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:i.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 ho({className:e}){return i.jsx("svg",{className:ae("size-3.5",e),viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":!0,children:i.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 m$({className:e}){return i.jsx("svg",{className:ae("size-3.5",e),viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:i.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"})})}function p$({className:e}){return i.jsxs("svg",{className:ae("size-3.5",e),viewBox:"0 0 16 15",fill:"none","aria-hidden":!0,children:[i.jsx("mask",{id:"ag-mask",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"16",height:"15",children:i.jsx("path",{d:"M14.0777 13.984C14.945 14.6345 16.2458 14.2008 15.0533 13.0084C11.476 9.53949 12.2349 0 7.79033 0C3.34579 0 4.10461 9.53949 0.527295 13.0084C-0.773543 14.3092 0.635692 14.6345 1.50293 13.984C4.86344 11.7076 4.64663 7.69664 7.79033 7.69664C10.934 7.69664 10.7172 11.7076 14.0777 13.984Z",fill:"black"})}),i.jsxs("g",{mask:"url(#ag-mask)",children:[i.jsx("g",{filter:"url(#ag-blur-sm)",children:i.jsx("path",{d:"M-0.658907 -3.2306C-0.922679 -0.906781 1.07986 1.22861 3.81388 1.53894C6.54791 1.84927 8.97811 0.217009 9.24188 -2.10681C9.50565 -4.43063 7.50312 -6.56602 4.76909 -6.87635C2.03506 -7.18667 -0.395135 -5.55442 -0.658907 -3.2306Z",fill:"#FFE432"})}),i.jsx("g",{filter:"url(#ag-blur-lg)",children:i.jsx("path",{d:"M9.88233 4.36642C10.5673 7.31568 13.566 9.13902 16.5801 8.43896C19.5942 7.73891 21.4823 4.78056 20.7973 1.83131C20.1123 -1.11795 17.1136 -2.94128 14.0995 -2.24123C11.0854 -1.54118 9.19733 1.41717 9.88233 4.36642Z",fill:"#FC413D"})}),i.jsx("g",{filter:"url(#ag-blur-md)",children:i.jsx("path",{d:"M-8.05291 6.34512C-7.18736 9.38883 -3.28925 10.9473 0.653774 9.82598C4.5968 8.7047 7.09158 5.32829 6.22603 2.28458C5.36048 -0.759142 1.46236 -2.31758 -2.48066 -1.19629C-6.42368 -0.0750048 -8.91846 3.3014 -8.05291 6.34512Z",fill:"#00B95C"})}),i.jsx("g",{filter:"url(#ag-blur-md)",children:i.jsx("path",{d:"M-8.05291 6.34512C-7.18736 9.38883 -3.28925 10.9473 0.653774 9.82598C4.5968 8.7047 7.09158 5.32829 6.22603 2.28458C5.36048 -0.759142 1.46236 -2.31758 -2.48066 -1.19629C-6.42368 -0.0750048 -8.91846 3.3014 -8.05291 6.34512Z",fill:"#00B95C"})}),i.jsx("g",{filter:"url(#ag-blur-md)",children:i.jsx("path",{d:"M-4.92402 8.86746C-2.75421 11.0837 0.982691 10.9438 3.42257 8.55507C5.86246 6.1663 6.08139 2.43321 3.91158 0.216963C1.74177 -1.99928 -1.99513 -1.85942 -4.43501 0.529349C-6.87489 2.91812 -7.09383 6.65122 -4.92402 8.86746Z",fill:"#00B95C"})}),i.jsx("g",{filter:"url(#ag-blur-md)",children:i.jsx("path",{d:"M6.42819 17.2263C7.10197 20.1273 9.91278 21.953 12.7063 21.3042C15.4998 20.6553 17.2182 17.7777 16.5444 14.8767C15.8707 11.9757 13.0599 10.15 10.2663 10.7988C7.47281 11.4477 5.75441 14.3253 6.42819 17.2263Z",fill:"#3186FF"})}),i.jsx("g",{filter:"url(#ag-blur-md)",children:i.jsx("path",{d:"M1.66508 -5.94539C0.254213 -2.80254 1.7978 0.951609 5.11277 2.43973C8.42774 3.92785 12.2588 2.58642 13.6696 -0.556431C15.0805 -3.69928 13.5369 -7.45343 10.222 -8.94155C6.90699 -10.4297 3.07594 -9.08824 1.66508 -5.94539Z",fill:"#FBBC04"})}),i.jsx("g",{filter:"url(#ag-blur-md)",children:i.jsx("path",{d:"M-2.11428 24.3903C-5.52984 23.0496 0.307266 12.0177 1.75874 8.32038C3.21024 4.62304 7.15576 2.71272 10.5713 4.05357C13.9869 5.39442 18.0354 12.7796 16.5838 16.477C15.1323 20.1743 1.30129 25.7311 -2.11428 24.3903Z",fill:"#3186FF"})}),i.jsx("g",{filter:"url(#ag-blur-md)",children:i.jsx("path",{d:"M18.5814 10.6598C17.6669 11.727 15.2806 11.1828 13.2514 9.44417C11.2222 7.70556 10.3185 5.43097 11.2329 4.3637C12.1473 3.29646 14.5336 3.84069 16.5628 5.57928C18.592 7.31789 19.4958 9.59249 18.5814 10.6598Z",fill:"#749BFF"})}),i.jsx("g",{filter:"url(#ag-blur-md)",children:i.jsx("path",{d:"M11.7552 5.22715C15.5162 7.77124 19.8471 7.93838 21.4286 5.60045C23.0101 3.26253 21.2433 -0.695128 17.4823 -3.23922C13.7213 -5.78331 9.39044 -5.95044 7.80896 -3.61252C6.22747 -1.27459 7.99428 2.68306 11.7552 5.22715Z",fill:"#FC413D"})}),i.jsx("g",{filter:"url(#ag-blur-sm)",children:i.jsx("path",{d:"M-0.592149 1.08896C-1.5239 3.33663 -1.21959 5.59799 0.0875457 6.13985C1.39468 6.68171 3.20966 5.29888 4.14141 3.05121C5.07316 0.803541 4.76885 -1.45782 3.46171 -1.99968C2.15458 -2.54154 0.339602 -1.15871 -0.592149 1.08896Z",fill:"#FFEE48"})})]}),i.jsxs("defs",{children:[i.jsx("filter",{id:"ag-blur-sm",x:"-200%",y:"-200%",width:"500%",height:"500%",children:i.jsx("feGaussianBlur",{stdDeviation:"0.722959"})}),i.jsx("filter",{id:"ag-blur-md",x:"-200%",y:"-200%",width:"500%",height:"500%",children:i.jsx("feGaussianBlur",{stdDeviation:"2.9"})}),i.jsx("filter",{id:"ag-blur-lg",x:"-200%",y:"-200%",width:"500%",height:"500%",children:i.jsx("feGaussianBlur",{stdDeviation:"3.49513"})})]})]})}function g$({className:e}){return i.jsx(xR,{className:ae("size-3.5",e),"aria-hidden":!0})}const x$=800;function fu({activeHunkIndex:e=0,diff:t}){const s=_$(t),n=_.useRef(null),o=_.useRef([]),[l,u]=_.useState(!1),h=_.useMemo(()=>s.reduce((d,p)=>Math.max(d,p.content.length),0),[s]),f=h>x$;if(_.useEffect(()=>{u(!1)},[t]),_.useEffect(()=>{if(f&&!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,f,l]),f&&!l){const d=s.filter(g=>g.kind==="add").length,p=s.filter(g=>g.kind==="delete").length;return i.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-card p-6",children:i.jsxs("div",{className:"max-w-sm space-y-3 text-center",children:[i.jsx("p",{className:"text-[13px] font-medium text-foreground",children:"Diff hidden for this data file"}),i.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."]}),i.jsxs("p",{className:"font-mono text-[11px]",children:[i.jsxs("span",{className:"text-emerald-700",children:["+",d]})," ",i.jsxs("span",{className:"text-red-700",children:["-",p]})," lines changed"]}),i.jsx(J,{onClick:()=>u(!0),size:"sm",type:"button",variant:"outline",children:"Show diff anyway"})]})})}return i.jsx("div",{className:"absolute inset-0 overflow-auto bg-card text-xs leading-6 text-foreground",ref:n,children:i.jsx("div",{className:"min-w-full font-mono",children:s.map((d,p)=>i.jsxs("div",{className:ae("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",n2(s,p)&&d.hunkIndex===e&&"outline outline-1 outline-offset-[-1px] outline-primary/35"),ref:d.hunkIndex!==null&&n2(s,p)?g=>{o.current[d.hunkIndex??0]=g}:void 0,children:[i.jsx(i2,{value:d.oldLine}),i.jsx(i2,{value:d.newLine}),i.jsx("span",{className:"min-w-0 whitespace-pre-wrap break-all px-2",children:d.content||" "})]},`${p}-${d.content}`))})})}function b$(e){const t=[];let s=null;const n=()=>{if(!s)return;const o=s.join(`
19
- `),l=Gb(o);t.push({path:v$(s[0]),diff:o,additions:l.additions,deletions:l.deletions}),s=null};for(const o of e.split(`
20
- `))o.startsWith("diff --git ")?(n(),s=[o]):s&&s.push(o);return n(),t}function v$(e){const t=/^diff --git a\/(.+?) b\/(.+)$/.exec(e);return t?t[2]:e.replace(/^diff --git /,"")}function Gb(e){return e.split(`
21
- `).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 _$(e){const t=y$(e);return t.some(s=>s.kind==="hunk")?t.filter(s=>s.kind!=="meta"&&s.kind!=="hunk"):t}function y$(e){let t=null,s=null,n=null;return e.split(`
22
- `).map(o=>{if(w$(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 n2(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 w$(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 i2({value:e}){return i.jsx("span",{className:ae("select-none border-r border-border/70 px-2 text-right text-muted-foreground",e===null&&"text-transparent"),children:e??"-"})}function S$(){const[e,t]=_.useState([]),[s,n]=_.useState(""),[o,l]=_.useState(null),[u,h]=_.useState(!1),[f,d]=_.useState(null),p=_.useCallback(async()=>{try{const N=await YO();t(N),n(E=>E&&N.some(T=>T.sha===E)?E:N[0]?.sha??""),l(null)}catch(N){l(N instanceof Error?N.message:String(N))}},[]);_.useEffect(()=>{p()},[p]);async function g(){h(!0),d(null);try{const N=await XO("manual snapshot");await p(),n(N.sha),d(`Snapshot ${N.sha.slice(0,7)} created.`)}catch(N){l(N instanceof Error?N.message:String(N))}finally{h(!1)}}async function x(N,E){h(!0),d(null);try{const T=await ZO(N,E);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 v(N){h(!0),d(null);try{await QO(N),await p(),d(`Snapshot ${N.slice(0,7)} deleted.`)}catch(E){l(E instanceof Error?E.message:String(E))}finally{h(!1)}}async function w(N){h(!0),d(null);try{const E=await tL(N);await p(),d(`Restored ${E.restoredFiles} file(s)`+(E.deletedPaths.length?`, removed ${E.deletedPaths.length} added since`:"")+`. Undo via pre-restore snapshot ${E.preRestore.sha.slice(0,7)}.`)}catch(E){l(E instanceof Error?E.message:String(E))}finally{h(!1)}}const k=e.find(N=>N.sha===s);return i.jsxs("div",{className:"grid h-full min-h-0 overflow-hidden bg-card/85 xl:grid-cols-[320px_minmax(0,1fr)]",children:[i.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden border-r border-border",children:[i.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-2",children:[i.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-semibold",children:[i.jsx(m6,{className:"size-3.5"}),"Snapshots"]}),i.jsxs(J,{disabled:u,onClick:()=>{g()},size:"sm",type:"button",children:[i.jsx(oC,{className:"size-3.5"}),"Snapshot now"]})]}),i.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:o?i.jsxs(Qe,{variant:"destructive",className:"m-3",children:[i.jsx(nb,{}),i.jsxs("div",{className:"min-w-0",children:[i.jsx(tj,{children:"Couldn’t load snapshots"}),i.jsx(sj,{className:"break-words",children:o})]})]}):e.length===0?i.jsx(Qe,{variant:"muted",className:"m-3 border-dashed",children:"No snapshots yet. Take one before risky changes, or let agent sessions create them automatically."}):i.jsx("ul",{children:e.map(N=>i.jsx(k$,{busy:u,onDelete:v,onRename:x,onSelect:n,selected:N.sha===s,snapshot:N},N.ref))})})]}),i.jsxs("section",{className:"flex min-h-0 min-w-0 flex-col",children:[f?i.jsx(Qe,{variant:"muted",className:"m-3 mb-0",children:f}):null,k?i.jsx(N$,{busy:u,onRestore:w,snapshot:k}):i.jsx("div",{className:"p-4",children:i.jsx(Qe,{variant:"muted",className:"border-dashed p-12 text-center",children:"Select a snapshot to compare it with the current working tree."})})]})]})}function k$({busy:e,onDelete:t,onRename:s,onSelect:n,selected:o,snapshot:l}){const[u,h]=_.useState(!1),[f,d]=_.useState(l.label),[p,g]=_.useState(!1);function x(){d(l.label),h(!0)}function v(){const w=f.trim();h(!1),w&&w!==l.label&&s(l.sha,w)}return i.jsx("li",{className:ae("group relative border-b border-border/60 transition-colors",o?"bg-background":"hover:bg-muted/50"),children:u?i.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-2",children:[i.jsx("input",{ref:w=>w?.focus(),value:f,onChange:w=>d(w.target.value),onKeyDown:w=>{w.key==="Enter"&&v(),w.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"}),i.jsx(J,{disabled:e,onClick:v,size:"icon-sm",type:"button",variant:"ghost",children:i.jsx(Ds,{className:"size-3.5"})}),i.jsx(J,{onClick:()=>h(!1),size:"icon-sm",type:"button",variant:"ghost",children:i.jsx(Ut,{className:"size-3.5"})})]}):i.jsxs(i.Fragment,{children:[i.jsxs("button",{type:"button",onClick:()=>n(l.sha),className:"w-full px-3 py-2 pr-16 text-left",children:[i.jsx("span",{className:"block truncate text-xs font-medium",children:l.label}),i.jsxs("span",{className:"mt-0.5 flex items-center gap-2 text-[10px] text-muted-foreground",children:[i.jsx("span",{className:"font-mono",children:l.sha.slice(0,7)}),i.jsx("span",{children:new Date(l.createdAt).toLocaleString()})]})]}),i.jsx("div",{className:"absolute right-2 top-1.5 flex items-center gap-0.5",children:p?i.jsxs(i.Fragment,{children:[i.jsx(J,{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:i.jsx(Ds,{className:"size-3.5"})}),i.jsx(J,{onClick:()=>g(!1),size:"icon-sm",title:"Cancel",type:"button",variant:"ghost",children:i.jsx(Ut,{className:"size-3.5"})})]}):i.jsxs("span",{className:"hidden items-center gap-0.5 group-hover:flex",children:[i.jsx(J,{disabled:e,onClick:x,size:"icon-sm",title:"Rename snapshot",type:"button",variant:"ghost",children:i.jsx(dl,{className:"size-3.5"})}),i.jsx(J,{disabled:e,onClick:()=>g(!0),size:"icon-sm",title:"Delete snapshot",type:"button",variant:"ghost",className:"text-muted-foreground hover:text-red-600",children:i.jsx(Mi,{className:"size-3.5"})})]})})]})})}function N$({busy:e,onRestore:t,snapshot:s}){const[n,o]=_.useState([]),[l,u]=_.useState(""),[h,f]=_.useState(""),[d,p]=_.useState(null),[g,x]=_.useState(!1);return _.useEffect(()=>{let v=!0;return x(!1),p(null),JO(s.sha).then(w=>{v&&(o(w),u(k=>k&&w.some(N=>N.path===k)?k:w[0]?.path??""))}).catch(w=>{v&&p(w instanceof Error?w.message:String(w))}),()=>{v=!1}},[s.sha]),_.useEffect(()=>{if(!l){f("");return}let v=!0;return eL(s.sha,l).then(w=>{v&&f(w)}).catch(w=>{v&&p(w instanceof Error?w.message:String(w))}),()=>{v=!1}},[s.sha,l]),i.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[i.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-2",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:s.label}),i.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?i.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[i.jsx(J,{disabled:e,onClick:()=>{x(!1),t(s.sha)},size:"sm",type:"button",variant:"destructive",children:"Confirm restore"}),i.jsx(J,{onClick:()=>x(!1),size:"sm",type:"button",variant:"outline",children:"Cancel"})]}):i.jsxs(J,{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:[i.jsx(gf,{className:"size-3.5"}),"Restore…"]})]}),i.jsx(nj,{diff:h,error:d,files:n,onSelectPath:u,selectedPath:l})]})}function nj({diff:e,error:t,files:s,onSelectPath:n,selectedPath:o}){return t?i.jsx("div",{className:"p-4",children:i.jsxs(Qe,{variant:"destructive",children:[i.jsx(nb,{}),i.jsxs("div",{className:"min-w-0",children:[i.jsx(tj,{children:"Couldn’t load this snapshot"}),i.jsx(sj,{className:"break-words",children:t})]})]})}):i.jsxs("div",{className:"grid min-h-0 flex-1 xl:grid-cols-[260px_minmax(0,1fr)]",children:[i.jsx("ul",{className:"min-h-0 overflow-auto border-r border-border",children:s.map(l=>i.jsx("li",{children:i.jsxs("button",{type:"button",onClick:()=>n(l.path),className:ae("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:[i.jsx("span",{className:ae("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}),i.jsx("span",{className:"truncate",children:l.path})]})},l.path))}),i.jsx("div",{className:"relative min-h-0 min-w-0",children:o?i.jsx(fu,{diff:e||"No diff for this file."}):i.jsx("div",{className:"p-4",children:i.jsx(Qe,{variant:"muted",className:"border-dashed p-8 text-center",children:"Select a file to see how it differs from the snapshot."})})})]})}function C$(){const[e,t]=_.useState([]),[s,n]=_.useState(""),[o,l]=_.useState(null),[u,h]=_.useState(null),[f,d]=_.useState(!1),p=_.useCallback(async()=>{try{const x=await sL();t(x),n(v=>v&&x.some(w=>w.id===v)?v:x[0]?.id??""),l(null)}catch(x){l(x instanceof Error?x.message:String(x))}},[]);_.useEffect(()=>{p()},[p]);async function g(x){d(!0),h(null);try{const v=await rL(x);await p(),h(`Restored ${v.restoredFiles} file(s)`+(v.deletedPaths.length?`, removed ${v.deletedPaths.length} created by the session`:"")+`. Undo via pre-restore snapshot ${v.preRestore.sha.slice(0,7)} in Git → Snapshots.`)}catch(v){l(v instanceof Error?v.message:String(v))}finally{d(!1)}}return e.length===0?i.jsx("div",{className:"p-4",children:i.jsx(Qe,{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."})}):i.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[u?i.jsx(Qe,{variant:"muted",className:"m-3 mb-0",children:u}):null,i.jsxs("div",{className:"grid min-h-0 flex-1 xl:grid-cols-[280px_minmax(0,1fr)]",children:[i.jsx("aside",{className:"min-h-0 overflow-auto border-r border-border",children:i.jsx("ul",{children:e.map(x=>i.jsx("li",{children:i.jsxs("button",{type:"button",onClick:()=>n(x.id),className:ae("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:[i.jsx("span",{className:"block truncate text-xs font-medium",children:new Date(x.startedAt).toLocaleString()}),i.jsxs("span",{className:"mt-0.5 flex items-center gap-2 text-[10px] text-muted-foreground",children:[i.jsxs("span",{children:[x.toolCount," tool call(s)"]}),x.snapshotSha?i.jsx("span",{className:"font-mono",children:x.snapshotSha.slice(0,7)}):i.jsx("span",{children:"no snapshot"})]})]})},x.id))})}),i.jsx("section",{className:"flex min-h-0 min-w-0 flex-col",children:s?i.jsx(E$,{busy:f,id:s,onRestore:g}):null})]})]})}function E$({busy:e,id:t,onRestore:s}){const[n,o]=_.useState(null),[l,u]=_.useState([]),[h,f]=_.useState(""),[d,p]=_.useState(""),[g,x]=_.useState(null),[v,w]=_.useState(!1);return _.useEffect(()=>{let k=!0;return w(!1),x(null),nL(t).then(N=>{k&&(o(N.session),u(N.files),f(E=>E&&N.files.some(T=>T.path===E)?E:N.files[0]?.path??""))}).catch(N=>{k&&x(N instanceof Error?N.message:String(N))}),()=>{k=!1}},[t]),_.useEffect(()=>{if(!h){p("");return}let k=!0;return iL(t,h).then(N=>{k&&p(N)}).catch(N=>{k&&x(N instanceof Error?N.message:String(N))}),()=>{k=!1}},[t,h]),i.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[i.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-2",children:[i.jsxs("div",{className:"min-w-0",children:[i.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"}),i.jsx("p",{className:"truncate text-[10px] text-muted-foreground",children:n?.repoPath??""})]}),n?.snapshotSha?v?i.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[i.jsx(J,{disabled:e,onClick:()=>{w(!1),s(t)},size:"sm",type:"button",variant:"destructive",children:"Confirm restore"}),i.jsx(J,{onClick:()=>w(!1),size:"sm",type:"button",variant:"outline",children:"Cancel"})]}):i.jsxs(J,{disabled:e||l.length===0,onClick:()=>w(!0),size:"sm",title:"Reset the working tree to before this session (a pre-restore snapshot is taken first)",type:"button",variant:"outline",children:[i.jsx(gf,{className:"size-3.5"}),"Restore to before this session…"]}):null]}),i.jsx(nj,{diff:d,error:g,files:l,onSelectPath:f,selectedPath:h})]})}function j$(e){return e==="codex"?{id:e,label:"Codex",commandName:"codex",installHint:"",intro:""}:{id:e,label:"Claude Code",commandName:"claude",installHint:"",intro:""}}function _c(e){return e instanceof Error?e.message:String(e)}function A$(){const[e,t]=_.useState([]),s=_.useRef([]),[n,o]=_.useState(null),l=_.useRef(null),[u,h]=_.useState(0),[f,d]=_.useState(null),[p,g]=_.useState(new Set),x=_.useRef(new Set),[v,w]=_.useState(null),[k,N]=_.useState(null),[E,T]=_.useState([]),A=_.useRef(void 0),C=_.useRef(!0),R=_.useRef(0),D=_.useRef(0),$=_.useRef(0),O=_.useRef(new Map),P=_.useRef(0),B=_.useRef(new Set),G=_.useRef(new Set),F=_.useCallback(q=>[...q].sort((le,ee)=>{const fe=O.current.get(le.id),ie=O.current.get(ee.id);return!fe||!ie?fe?1:ie?-1:0:fe.group!==ie.group?fe.group==="attached"?-1:1:fe.index-ie.index}),[]),z=_.useCallback(q=>{s.current=q,t(q)},[]),U=_.useCallback(q=>{l.current=q,o(q)},[]),K=_.useCallback(()=>{if(l.current||P.current>0)return;const q=F(s.current).find(le=>!B.current.has(le.id)&&O.current.get(le.id)?.group==="attached");q&&U(q.id)},[U,F]);_.useEffect(()=>(C.current=!0,()=>{C.current=!1}),[]),_.useEffect(()=>{XC().then(q=>{if(!C.current)return;const le=q.filter(Me=>Me.kind==="agent"&&!B.current.has(Me.id));le.forEach((Me,De)=>{O.current.has(Me.id)||O.current.set(Me.id,{group:"attached",index:De})});const ee=new Map(s.current.map(Me=>[Me.id,Me])),fe=le.map(Me=>{const De=ee.get(Me.id);return De?{...Me,label:De.label??Me.label,source:De.source,createdAt:De.createdAt}:Me}),ie=new Set(fe.map(Me=>Me.id)),Se=[...fe,...s.current.filter(Me=>!ie.has(Me.id))];z(F(Se)),K()}).catch(q=>{C.current&&d(_c(q))})},[K,z,F]),_.useEffect(()=>{const q=$.current;XD().then(le=>{if(!C.current)return;if(T(le.providers),$.current===q){w(le.configured),N(le.provider),A.current=le.provider.id;return}const ee=le.providers.find(fe=>fe.id===A.current);ee&&w(ee.configured)}).catch(()=>{C.current&&$.current===q&&(w(!1),d("Unable to load agent provider status"))})},[]);const I=_.useCallback(async q=>{const le=++$.current,ee=E.find(fe=>fe.id===q);A.current=q,d(null),N(ee??j$(q)),ee&&w(ee.configured);try{const fe=await ZD(q);if(!C.current||$.current!==le)return;A.current=fe.id,N(fe);const ie=E.find(Se=>Se.id===fe.id);ie&&w(ie.configured)}catch(fe){C.current&&$.current===le&&d(_c(fe))}},[E]),Z=_.useCallback(async({prompt:q,label:le,source:ee,background:fe=!1})=>{const ie=++R.current;P.current+=1,fe||(D.current=ie);const Se=Date.now(),Me=A.current??"claude";d(null),h(De=>De+1);try{const De=await lL({provider:Me,prompt:q,label:le});if(!C.current||B.current.has(De.id))return;const Je={...De,label:De.label??le,source:ee,createdAt:Se,initialPrompt:q};O.current.set(Je.id,{group:"created",index:ie});const Ne=s.current.filter(Ue=>Ue.id!==Je.id);return z(F([...Ne,Je])),!fe&&D.current===ie&&U(Je.id),Je}catch(De){C.current&&d(_c(De));return}finally{P.current=Math.max(0,P.current-1),C.current&&P.current===0&&K(),C.current&&h(De=>Math.max(0,De-1))}},[K,U,z,F]),W=_.useCallback(async q=>{if(!x.current.has(q)){x.current.add(q),g(new Set(x.current)),B.current.add(q);try{if(await Ax(q),!C.current)return;const le=s.current,ee=le.findIndex(ie=>ie.id===q),fe=le.filter(ie=>ie.id!==q);if(O.current.delete(q),z(fe),l.current===q){const ie=fe[Math.min(Math.max(ee,0),fe.length-1)];U(ie?.id??null)}}catch(le){const ee=s.current,fe=ee.findIndex(ie=>ie.id===q);if(ee[fe]?.state==="exited"){const ie=ee.filter(Se=>Se.id!==q);if(O.current.delete(q),z(ie),l.current===q){const Se=ie[Math.min(Math.max(fe,0),ie.length-1)];U(Se?.id??null)}return}B.current.delete(q),C.current&&d(_c(le))}finally{x.current.delete(q),C.current&&g(new Set(x.current))}}},[U,z]),te=_.useCallback(async q=>{if(!x.current.has(q)){x.current.add(q),g(new Set(x.current)),d(null);try{if(await Ax(q),!C.current)return;const le=s.current.map(ee=>ee.id===q?{...ee,state:"exited"}:ee);z(le)}catch(le){C.current&&d(_c(le))}finally{x.current.delete(q),C.current&&g(new Set(x.current))}}},[z]),X=_.useCallback((q,le)=>{const ee=s.current.map(fe=>fe.id===q?{...fe,...le,id:q}:fe);z(ee)},[z]),V=_.useCallback(q=>{if(G.current.has(q))return;const le=s.current.find(ee=>ee.id===q)?.initialPrompt;if(le)return G.current.add(q),le},[]);return{tasks:e,activeTaskId:n,setActiveTaskId:U,creating:u,terminalError:f,pendingTaskIds:p,error:f,provider:k,configured:v,providers:E,selectProvider:I,createTask:Z,closeTask:W,stopTask:te,updateTaskStatus:X,claimInitialPrompt:V}}const ij=_.createContext(null);function T$({children:e}){const t=A$(),[s,n]=_.useState(!1),[o,l]=_.useState(""),[u,h]=_.useState(null),[f,d]=_.useState(0),[p,g]=_.useState(!1),x=_.useCallback(()=>d(T=>T+1),[]),v=_.useCallback(()=>h(null),[]),w=_.useCallback(()=>{n(!0),g(!0)},[]),k=_.useCallback(T=>{n(!0),l(A=>A.trim()?`${A.replace(/\s*$/,"")}
23
- ${T}`:T),x()},[x]),N=_.useCallback(({prompt:T,source:A,mode:C="send",label:R,background:D})=>C==="draft"?(n(!0),h(A??null),l(T),x(),{queued:!1}):(D||(n(!0),h(A??null)),t.createTask({prompt:T,label:R,source:A,background:D}),{queued:!1}),[t.createTask,x]),E={...t,open:s,setOpen:n,draft:o,setDraft:l,insertPath:k,activeSource:u,clearSource:v,focusNonce:f,sendToAgent:N,onboarding:p,setOnboarding:g,startOnboard:w};return i.jsx(ij.Provider,{value:E,children:e})}function At(){const e=_.useContext(ij);if(!e)throw new Error("useAgentDock must be used within an AgentProvider");return e}function R$({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 i.jsxs(hi,{className:"min-w-0 rounded-none border-0 bg-transparent",children:[i.jsxs(fi,{className:"border-b border-border px-3 py-2",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(aC,{className:"size-4 text-muted-foreground"}),i.jsx(mi,{children:"Project Memory"})]}),i.jsx(Ge,{variant:"outline",size:"small",children:o})]}),i.jsx(er,{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.")})]}),i.jsxs(pi,{className:"space-y-2 p-3",children:[s?i.jsx(r2,{title:s,preview:n,defaultOpen:!0}):null,e.project.memoryFiles.length?e.project.memoryFiles.map(l=>i.jsx(r2,{title:l.name,subtitle:`${l.size} B`,preview:l.preview,defaultOpen:l.name==="MEMORY.md"},l.path)):s?null:i.jsx("p",{className:"text-xs text-muted-foreground",children:"No memory files persisted yet for this project."})]})]})}function r2({title:e,subtitle:t,preview:s,defaultOpen:n=!1}){const[o,l]=_.useState(n);return i.jsxs("div",{className:"rounded-md border border-border bg-background/40",children:[i.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:[i.jsx(jn,{className:ae("size-3.5 text-muted-foreground transition-transform",o&&"rotate-90")}),i.jsx("span",{children:e}),t?i.jsx("span",{className:"font-mono text-[10px] font-normal text-muted-foreground",children:t}):null]}),o&&s?i.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 M$=[{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%)"}],D$=({size:e=20,color:t="#8f8f8f"})=>i.jsx("div",{style:{width:e,height:e},children:i.jsx("div",{className:"relative left-1/2 top-1/2",style:{width:e,height:e},children:M$.map(s=>i.jsx("div",{className:"absolute -left-[10%] -top-[3.9%] h-[8%] w-[24%] animate-fade-spin rounded-[5px]",style:{backgroundColor:t,...s}},s.transform))})}),O$=[{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"}],L$={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"},z$={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]"}},qd=({size:e="medium",type:t="primary",variant:s="styled",shape:n="square",svgOnly:o=!1,children:l,prefix:u,suffix:h,shadow:f=!1,loading:d=!1,disabled:p=!1,fullWidth:g=!1,className:x,...v})=>i.jsxs("button",{disabled:p,tabIndex:0,className:Qc("flex items-center justify-center gap-0.5 duration-150",O$[+o][e],p||d?"cursor-not-allowed border border-gray-400 bg-gray-100 text-gray-700":L$[t],z$[n][e],f&&"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",...v,children:[d?i.jsx(D$,{size:e==="large"?24:16}):u,i.jsx("span",{className:Qc("relative overflow-hidden overflow-ellipsis whitespace-nowrap font-sans",e!=="tiny"&&s!=="unstyled"&&"px-1.5"),children:l}),!d&&h]}),B$=({className:e})=>i.jsx("svg",{height:"16",strokeLinejoin:"round",viewBox:"0 0 16 16",width:"16",className:e,children:i.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"})}),P$=()=>i.jsx("svg",{height:"16",strokeLinejoin:"round",viewBox:"0 0 16 16",width:"16",className:"fill-gray-1000",children:i.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 yg=null,I$=0;const ks={toasts:[],listeners:new Set,add(e,t,s,n,o,l){const u=I$++,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 f=()=>{this.toasts=this.toasts.filter(d=>d.id!==u),this.notify()};h.timeout=setTimeout(f,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(f,h.remaining))}}this.toasts.push(h),this.notify()},remove(e){ks.toasts=ks.toasts.filter(t=>t.id!==e),ks.notify()},subscribe(e){return ks.listeners.add(e),()=>{ks.listeners.delete(e)}},notify(){ks.listeners.forEach(e=>{e()})}},$$=()=>{const[e,t]=_.useState([]),[s,n]=_.useState([]),[o,l]=_.useState(!1),u=w=>k=>{k&&w.measuredHeight==null&&(w.measuredHeight=k.getBoundingClientRect().height,ks.notify())};_.useEffect(()=>(t([...ks.toasts]),ks.subscribe(()=>{t([...ks.toasts])})),[]),_.useEffect(()=>{const w=e.filter(k=>!s.includes(k.id)).map(k=>k.id);w.length>0&&requestAnimationFrame(()=>{n(k=>[...k,...w])})},[s,e]);const f=Math.max(0,e.length-3),d=(w,k)=>{if(w===k-1)return"none";const N=k-1-w;let E=e[k-1]?.measuredHeight||63;for(let C=k-1;C>w;C--)o?E+=(e[C-1]?.measuredHeight||63)+10:E+=20;const T=-N,A=o?1:1-.05*N;return`translate3d(0, calc(100% - ${E}px), ${T}px) scale(${A})`},p=()=>{l(!0),ks.toasts.forEach(w=>{w.pause?.()})},g=()=>{l(!1),ks.toasts.forEach(w=>{w.resume?.()})},v=e.slice(f).reduce((w,k)=>w+(k.measuredHeight??63),0);return i.jsx("div",{className:"pointer-events-none fixed bottom-4 right-4 z-[9999] w-[min(420px,calc(100vw-2rem))]",style:{height:v},children:i.jsx("div",{className:"pointer-events-auto relative w-full",style:{height:v},onMouseEnter:p,onMouseLeave:g,children:e.map((w,k)=>{const N=k>=f;return i.jsx("div",{ref:u(w),className:Qc("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"}[w.type],N?"opacity-100":"opacity-0",k<f&&"pointer-events-none"),style:{width:"100%",transition:"all .35s cubic-bezier(.25,.75,.6,.98)",transform:s.includes(w.id)?d(k,e.length):"translate3d(0, 100%, 150px) scale(1)"},children:i.jsxs("div",{className:"flex flex-col items-center justify-between text-[.875rem]",children:[i.jsxs("div",{className:"flex h-full w-full items-center justify-between gap-4",children:[i.jsx("span",{children:w.text}),!w.action&&i.jsxs("div",{className:"flex gap-1",children:[w.onUndoAction&&i.jsx(qd,{type:"tertiary",svgOnly:!0,size:"small",onClick:()=>{w.onUndoAction?.(),ks.remove(w.id)},children:i.jsx(P$,{})}),i.jsx(qd,{type:"tertiary",svgOnly:!0,size:"small",onClick:()=>ks.remove(w.id),children:i.jsx(B$,{className:{message:"fill-gray-1000",success:"fill-contrast-fg",warning:"fill-gray-1000 dark:fill-gray-100",error:"fill-contrast-fg"}[w.type]})})]})]}),w.action&&i.jsxs("div",{className:"flex w-full items-center justify-end gap-2",children:[i.jsx(qd,{type:"tertiary",size:"small",onClick:()=>ks.remove(w.id),children:"Dismiss"}),i.jsx(qd,{type:"primary",size:"small",onClick:()=>{w.onAction?.(),ks.remove(w.id)},children:w.action})]})]})},w.id)})})})},Vd=()=>{if(yg)return;const e=document.createElement("div");e.className="fixed bottom-4 right-4 z-[9999]",document.body.appendChild(e),yg=sC.createRoot(e),yg.render(i.jsx($$,{}))},as=()=>({message:_.useCallback(({text:e,preserve:t,action:s,onAction:n,onUndoAction:o})=>{Vd(),ks.add(e,"message",t,s,n,o)},[]),success:_.useCallback(e=>{Vd(),ks.add(e,"success")},[]),warning:_.useCallback(e=>{Vd(),ks.add(e,"warning")},[]),error:_.useCallback(e=>{Vd(),ks.add(e,"error")},[])});function H$({usage:e}){const t=[{label:"Cache read",value:e.cacheReadInputTokens,className:"bg-emerald-500"},{label:"Cache create",value:e.cacheCreationInputTokens,className:"bg-teal-400"},{label:"Fresh input",value:e.inputTokens,className:"bg-amber-500"},{label:"Output",value:e.outputTokens,className:"bg-violet-500"}];return i.jsxs("div",{className:"rounded-md border border-border",children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-border px-3 py-1.5",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Sa,{className:"size-3.5 text-amber-700"}),i.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Claude Code · last session"}),e.sessionId?i.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:e.sessionId.slice(0,8)}):null]}),i.jsxs("span",{className:"font-mono text-sm font-semibold text-emerald-700",children:["$",e.costUSD.toFixed(4)]})]}),i.jsx(rj,{segments:t}),i.jsxs("div",{className:"grid grid-cols-2 gap-x-3 gap-y-1.5 border-t border-border px-3 py-2 text-[11px] sm:grid-cols-4",children:[i.jsx(nn,{label:"Input",value:un(e.inputTokens)}),i.jsx(nn,{label:"Output",value:un(e.outputTokens)}),i.jsx(nn,{label:"Cache read",value:un(e.cacheReadInputTokens)}),i.jsx(nn,{label:"Cache create",value:un(e.cacheCreationInputTokens)}),i.jsx(nn,{label:"Lines +",value:String(e.linesAdded)}),i.jsx(nn,{label:"Lines −",value:String(e.linesRemoved)}),i.jsx(nn,{label:"Wall",value:a2(e.durationMs)}),i.jsx(nn,{label:"API",value:a2(e.apiDurationMs)})]}),e.fiveHour||e.weekly?i.jsxs("div",{className:"space-y-2 border-t border-border px-3 py-2",children:[i.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Rate limits"}),e.fiveHour?i.jsx(Gh,{label:"5h block",window:e.fiveHour}):null,e.weekly?i.jsx(Gh,{label:"This week",window:e.weekly}):null]}):null,e.models.length?i.jsxs("div",{className:"space-y-1 border-t border-border px-3 py-2",children:[i.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:"By model"}),e.models.map(s=>i.jsxs("div",{className:"flex items-center justify-between gap-2 font-mono text-[11px]",children:[i.jsx("span",{className:"truncate",children:s.model}),i.jsxs("span",{className:"shrink-0 text-muted-foreground",children:[un(s.inputTokens+s.outputTokens)," tok ·"," ",i.jsxs("span",{className:"text-emerald-700",children:["$",s.costUSD.toFixed(4)]})]})]},s.model))]}):null]})}function U$({usage:e}){const t=e.contextWindow&&e.contextWindow>0?e.lastTotalTokens/e.contextWindow*100:0,s=[{label:"Cache read",value:e.cachedInputTokens,className:"bg-emerald-500"},{label:"Fresh input",value:Math.max(0,e.inputTokens-e.cachedInputTokens),className:"bg-amber-500"},{label:"Output",value:e.outputTokens,className:"bg-violet-500"},{label:"Reasoning",value:e.reasoningOutputTokens,className:"bg-sky-500"}];return i.jsxs("div",{className:"rounded-md border border-border",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-1.5",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(ho,{className:"size-3.5 text-foreground"}),i.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Codex · last session"})]}),e.timestamp?i.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:new Date(e.timestamp).toLocaleString()}):null]}),i.jsx(rj,{segments:s}),i.jsxs("div",{className:"grid grid-cols-2 gap-x-3 gap-y-1.5 border-t border-border px-3 py-2 text-[11px] sm:grid-cols-4",children:[i.jsx(nn,{label:"Input",value:un(e.inputTokens)}),i.jsx(nn,{label:"Output",value:un(e.outputTokens)}),i.jsx(nn,{label:"Cache read",value:un(e.cachedInputTokens)}),i.jsx(nn,{label:"Reasoning",value:un(e.reasoningOutputTokens)}),i.jsx(nn,{label:"Total",value:un(e.totalTokens)}),i.jsx(nn,{label:"Last turn",value:un(e.lastTotalTokens)}),i.jsx(nn,{label:"Context",value:e.contextWindow?un(e.contextWindow):"n/a"}),i.jsx(nn,{label:"Cost",value:"n/a"})]}),e.contextWindow?i.jsx("div",{className:"border-t border-border px-3 py-2",children:i.jsx(F$,{label:"Last turn context share",value:t,tone:"bg-sky-500"})}):null,e.primary||e.secondary?i.jsxs("div",{className:"space-y-2 border-t border-border px-3 py-2",children:[i.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Rate limits"}),e.primary?i.jsx(Gh,{label:"5h window",window:e.primary}):null,e.secondary?i.jsx(Gh,{label:"Weekly window",window:e.secondary}):null]}):null]})}function rj({segments:e}){const t=e.reduce((o,l)=>o+l.value,0),s=e.filter(o=>o.label!=="Output").reduce((o,l)=>o+l.value,0),n=t-s;return i.jsxs("div",{className:"px-3 py-2.5",children:[i.jsxs("div",{className:"mb-1.5 flex items-center justify-between text-[10px] uppercase tracking-wide text-muted-foreground",children:[i.jsx("span",{className:"font-semibold",children:"Tokens"}),i.jsxs("span",{className:"font-mono normal-case",children:[un(s)," in · ",un(n)," out"]})]}),i.jsx("div",{className:"flex h-2.5 overflow-hidden rounded-full bg-muted",role:"img","aria-label":"Token composition",children:e.map(o=>t>0&&o.value>0?i.jsx("div",{className:ae("h-full",o.className),style:{width:`${(o.value/t*100).toFixed(2)}%`},title:`${o.label}: ${un(o.value)} (${(o.value/t*100).toFixed(1)}%)`},o.label):null)}),i.jsx("div",{className:"mt-2 grid grid-cols-2 gap-x-3 gap-y-1 sm:grid-cols-4",children:e.map(o=>i.jsxs("div",{className:"flex items-center gap-1.5 text-[11px]",children:[i.jsx("span",{className:ae("size-2 shrink-0 rounded-sm",o.className)}),i.jsx("span",{className:"min-w-0 flex-1 truncate text-muted-foreground",children:o.label}),i.jsxs("span",{className:"shrink-0 font-mono text-foreground",children:[t>0?(o.value/t*100).toFixed(0):"0","%"]})]},o.label))})]})}function F$({label:e,value:t,tone:s}){const n=Math.min(100,Math.max(0,t));return i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center justify-between text-[11px] text-muted-foreground",children:[i.jsx("span",{children:e}),i.jsxs("span",{className:"font-mono",children:[n.toFixed(1),"%"]})]}),i.jsx("div",{className:"mt-1 h-1.5 overflow-hidden rounded-full bg-muted",children:i.jsx("div",{className:ae("h-full",s),style:{width:`${n.toFixed(2)}%`}})})]})}function Gh({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 i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center justify-between text-[11px]",children:[i.jsx("span",{className:"text-muted-foreground",children:e}),i.jsxs("span",{className:"font-mono",children:[s.toFixed(1),"%"]})]}),i.jsx("div",{className:"mt-1 h-1.5 overflow-hidden rounded-full bg-muted",children:i.jsx("div",{className:ae("h-full",o),style:{width:`${s.toFixed(2)}%`}})}),n?i.jsxs("div",{className:"mt-0.5 font-mono text-[10px] text-muted-foreground",children:["resets ",n]}):null]})}function nn({label:e,value:t}){return i.jsxs("div",{children:[i.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:e}),i.jsx("div",{className:"font-mono text-xs font-semibold",children:t})]})}function un(e){return e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function a2(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 q$(e=1e4){const[t,s]=_.useState(null),[n,o]=_.useState(null);return _.useEffect(()=>{let l=!0;const u=()=>{FD().then(f=>{l&&(s(f),o(null))}).catch(f=>{l&&o(f instanceof Error?f.message:String(f))})};u();const h=window.setInterval(u,e);return()=>{l=!1,window.clearInterval(h)}},[e]),{usage:t,error:n}}const V$={"claude-code":{label:"Claude Code",icon:i.jsx(Sa,{})},codex:{label:"Codex",icon:i.jsx(ho,{})}};function G$({agent:e,agentId:t,isDetected:s}){const{usage:n,error:o}=q$(),l=V$[t],u=t==="codex";return i.jsxs(hi,{className:"min-w-0 rounded-none border-0 bg-transparent",children:[i.jsxs(fi,{className:"border-b border-border px-3 py-2",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx(pC,{className:"size-4 text-muted-foreground"}),i.jsx(mi,{children:u?"Token Usage & Rate Limits":"Token & Cost Usage"}),i.jsx(Ge,{variant:"outline",size:"small",icon:l.icon,children:l.label}),s?i.jsx(Ge,{variant:"outline",size:"small",children:"active session"}):i.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Not the active agent in this session"}),u?null:i.jsx(W$,{className:"ml-auto"})]}),i.jsxs(er,{className:"truncate text-xs",children:[u?i.jsxs(i.Fragment,{children:["Session metrics from ",i.jsx("code",{className:"font-mono",children:"~/.codex/sessions"})]}):i.jsxs(i.Fragment,{children:["Last-session metrics from ",i.jsx("code",{className:"font-mono",children:"~/.claude.json"})]})," · ",i.jsx("span",{className:"font-mono",children:e.project.cwd})]})]}),i.jsxs(pi,{className:"p-3",children:[o?i.jsx("p",{className:"text-xs text-destructive",children:o}):null,u?n?.codex?i.jsx(U$,{usage:n.codex}):o?null:i.jsx(o2,{agent:"Codex CLI"}):n?.claude?i.jsx(H$,{usage:n.claude}):o?null:i.jsx(o2,{agent:"Claude Code"})]})]})}function W$({className:e}){const[t,s]=_.useState(!0),[n,o]=_.useState(!0),[l,u]=_.useState(!1),h=as();_.useEffect(()=>{let d=!0;return VD().then(p=>d&&s(p.coAuthorWithClaude)).catch(()=>{}).finally(()=>d&&o(!1)),()=>{d=!1}},[]);const f=async()=>{const d=!t;u(!0),s(d);try{const p=await GD({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 i.jsxs(J,{type:"button",variant:t?"default":"outline",size:"sm",onClick:f,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:ae("gap-1.5",e),children:[i.jsx(Sa,{className:"size-3.5"}),"Co-author"]})}function o2({agent:e}){return i.jsxs("p",{className:"text-xs text-muted-foreground",children:["No usage data yet. Run a session with ",e," in this project."]})}const l2=["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(`
24
- `),K$=["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(`
25
- `);function Y$(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(`
26
- `)}function X$(e){return e.map(t=>`- ${t.name}: ${t.dataType}${t.primaryKey?" (PK)":""}${t.nullable?"":" NOT NULL"}`).join(`
27
- `)}function aj(e){return e?.length?["## Table schema",X$(e),""].join(`
28
- `):""}const oj="Your prompt: ";function Z$(e,t,s,n,o){return[`I'm looking at a row in my ${t} database (connection "${e}", table \`${s.qualifiedName}\`).`,"",aj(n),"## Row","```json",JSON.stringify(o,null,2),"```","",oj].join(`
29
- `)}function c2(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=aj(s?.columns);return l&&o.push(l),o.push(oj),o.join(`
30
- `)}function Q$(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(`
31
- `)),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(`
32
- `)}function J$(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(`
33
- `)}function eH({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(`
34
- `)}function tH(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(`
35
- `)}function sH(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(`
36
- `)}function nH(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(`
37
- `)}function iH(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(`
38
- `)}function rH(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(`
39
- `)}function aH(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(`
40
- `):"- (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(`
41
- `)}function lj(e){return`Pull request #${e.number} — "${e.title}" (${e.head.ref} → ${e.base.ref}, by ${e.user.login}):`}function oH(e,t){return[lj(e),"",t,"",`Pull the diff with \`gh pr diff ${e.number}\` (or your GitHub tools) if you need it.`].join(`
42
- `)}function lH(e,t,s){return[lj(e),"",`Focus on the file \`${t}\`. ${s}`,"",`Pull the diff with \`gh pr diff ${e.number}\` (or your GitHub tools) to see its changes.`].join(`
43
- `)}function cH(e,t){return[`GitHub issue #${e.number} — "${e.title}" (opened by ${e.user.login}):`,"",t,"",`Read the full thread with \`gh issue view ${e.number} --comments\` (or your GitHub tools) if you need it.`].join(`
44
- `)}function uH(e,t){const s=t?.trim()?t.trim():"Figure out why it failed (read the failing step's logs), then fix the underlying issue in the code. Explain what was wrong before you change anything.";return[`Workflow run "${e.name}" #${e.run_number} failed on \`${e.head_branch}\` (commit ${e.head_sha.slice(0,7)}): ${e.html_url}`,"",s,"",`Pull the failing logs with \`gh run view ${e.id} --log-failed\` (or your GitHub tools) to see the errors.`].join(`
45
- `)}function dH({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(`
46
- `)}function u2(){return{serviceNames:[],databaseNames:[],errorIds:[],repositoryPaths:[]}}function hH(e){return e.serviceNames.length>0||e.databaseNames.length>0||e.errorIds.length>0||e.repositoryPaths.length>0}function fH({dashboard:e,databases:t,incidents:s,note:n,selection:o}){const l=[pH(e,o.serviceNames),gH(t,o.databaseNames),xH(s,o.errorIds),bH(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:
47
- ${n.trim()}`:null,"",l.join(`
48
-
49
- ---
50
-
51
- `)].filter(Boolean).join(`
52
- `)}function mH({note:e,selection:t}){const s=[Gd(t.serviceNames.length,"service"),Gd(t.databaseNames.length,"database"),Gd(t.errorIds.length,"error"),Gd(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 pH(e,t){return t.length?["Services",t.map(n=>{const o=e.config.services.find(f=>f.name===n),l=e.runtime.services[n],u=e.health[n],h=e.logs.filter(f=>f.service===n).slice(-8).map(f=>`${f.timestamp} ${f.stream}: ${f.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:
53
- ${u.agentContext}`:null,h.length?`recent logs:
54
- ${h.join(`
55
- `)}`:null].filter(Boolean).join(`
56
- `)}).join(`
57
-
58
- `)].join(`
59
- `):null}function gH(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(`
60
- `)}).join(`
61
-
62
- `)].join(`
63
- `):null}function xH(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:
64
- ${o.logExcerpt.join(`
65
- `)}`:null].filter(Boolean).join(`
66
- `):`Incident #${n}`}).join(`
67
-
68
- `)].join(`
69
- `):null}function bH(e,t){if(!t.length)return null;const s=vH(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),f=u===n;return[`Repository: ${h?.name??u.split("/").pop()??u}`,`path: ${u}`,f?"current: yes":"current: no",f?o.length?`changed files:
70
- ${o.join(`
71
- `)}`:"changed files: none":"changed files: not loaded for this repository in the current dashboard view"].join(`
72
- `)}).join(`
73
-
74
- `)].join(`
75
- `)}function vH(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 Gd(e,t){return e?`${e} ${t}${e===1?"":"s"}`:null}function Ef(e){return e==="codex"?"Codex":"Claude Code"}function _H(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 ${Ef(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(`
76
- `)}function yH(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(`
77
- `)}function wH(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(`
78
- `)}function SH(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 ${Ef(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(`
79
- `)}function kH(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(`
80
- `)}function NH(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(`
81
- `)}function CH(e,t){return[`Install a plugin for ${Ef(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(`
82
- `)}function EH(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(`
83
- `)}function jH(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(`
84
- `)}function AH(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 ${Ef(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(`
85
- `)}function TH(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(`
86
- `)}function RH(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(`
87
- `)}function cj({id:e,className:t}){return e==="codex"?i.jsx(ho,{className:ae("text-foreground",t)}):e==="gemini"?i.jsx(m$,{className:ae("text-[#1A73E8]",t)}):i.jsx(Sa,{className:ae("text-[#D97757]",t)})}function qt({className:e}){const{provider:t}=At();return i.jsx(cj,{id:t?.id,className:e})}function Qi({onAsk:e,label:t,className:s}){const{provider:n}=At(),o=t??`Ask ${n?.label??"Claude"}`;return i.jsx("button",{"aria-label":o,className:ae("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:i.jsx(cj,{id:n?.id,className:"size-3.5"})})}function Mr({placeholder:e,onSubmit:t,onCancel:s,className:n}){const[o,l]=_.useState(""),u=()=>{const f=o.trim();f&&t(f)},h=_.useCallback(f=>{f?.focus()},[]);return i.jsxs("form",{className:ae("flex items-center gap-1.5 rounded-md border border-primary/40 bg-primary/5 px-1.5 py-1",n),onSubmit:f=>{f.preventDefault(),u()},children:[i.jsx(Qi,{className:"size-5 opacity-100",label:"Send to the agent",onAsk:u}),i.jsx("input",{ref:h,className:"min-w-0 flex-1 bg-transparent text-xs outline-none placeholder:text-muted-foreground",onChange:f=>l(f.target.value),onKeyDown:f=>{f.key==="Escape"&&s()},placeholder:e,value:o}),i.jsx(J,{type:"submit",size:"icon",className:"size-6",disabled:!o.trim(),title:"Send",children:i.jsx(Ds,{className:"size-3.5"})}),i.jsx(J,{type:"button",size:"icon",variant:"ghost",className:"size-6",onClick:s,"aria-label":"Cancel",title:"Cancel",children:i.jsx(Ut,{className:"size-3.5"})})]})}function jf({label:e,onClick:t}){return i.jsxs(J,{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:[i.jsx(ps,{className:"size-3.5"}),"Add"]})}function Af({askLabel:e,removeLabel:t,onAsk:s,onRemove:n}){return i.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[i.jsx(Qi,{label:e,onAsk:s}),i.jsx(MH,{label:t,onConfirm:n})]})}function MH({label:e,onConfirm:t}){const[s,n]=_.useState(!1);return s?i.jsxs("span",{className:"flex items-center gap-0.5",children:[i.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:i.jsx(Ds,{className:"size-3.5"})}),i.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:i.jsx(Ut,{className:"size-3.5"})})]}):i.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:i.jsx(Mi,{className:"size-3.5"})})}function DH({agent:e,agentId:t,alternateHooks:s}){const{sendToAgent:n}=At(),[o,l]=_.useState(!1),u=e.hooks??[];function h(p){l(!1),n({prompt:AH(t,p),source:{type:"agent-hook",label:"New hook"},label:`Add hook: ${p}`})}function f(p){n({prompt:RH(p),source:{type:"agent-hook",label:`${p.event} hook`},mode:"draft"})}function d(p){n({prompt:TH(p),source:{type:"agent-hook",label:`Remove ${p.event}`},label:`Remove hook: ${p.event}`})}return i.jsxs(hi,{className:"min-w-0 rounded-none border-0 border-t border-border bg-transparent md:border-l lg:border-t-0",children:[i.jsxs(fi,{className:"border-b border-border px-3 py-2",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(t8,{className:"size-4 text-muted-foreground"}),i.jsx(mi,{children:"Hooks"})]}),i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(Ge,{variant:"outline",size:"small",children:u.length}),i.jsx(jf,{label:"Add a hook with AI",onClick:()=>l(p=>!p)})]})]}),o?i.jsx(Mr,{className:"mt-1.5",placeholder:"Describe the event, matcher, and command…",onSubmit:h,onCancel:()=>l(!1)}):i.jsx(er,{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."})]}),i.jsx(pi,{className:"p-0",children:u.length?i.jsx("ul",{className:"divide-y divide-border",children:u.map(p=>i.jsxs("li",{className:"group px-3 py-2 hover:bg-muted/40",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[i.jsx("span",{className:"min-w-0 truncate font-mono text-xs font-semibold",title:p.event,children:p.event}),i.jsx(Af,{askLabel:`Ask AI about the ${p.event} hook`,removeLabel:`Remove the ${p.event} hook`,onAsk:()=>f(p),onRemove:()=>d(p)})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[i.jsx(LH,{hook:p}),i.jsx(zH,{hook:p}),i.jsx(Ge,{variant:"outline",size:"small",children:p.scope})]})]}),i.jsx("div",{className:"mt-1 truncate font-mono text-[11px] text-muted-foreground",title:d2(p),children:d2(p)})]},p.id))}):i.jsx(OH,{agentId:t,alternateHooks:s})})]})}function OH({agentId:e,alternateHooks:t}){const s=e==="codex"?"Codex":"Claude Code";return i.jsxs("p",{className:"px-3 py-4 text-xs text-muted-foreground",children:["No ",s," hooks configured.",t?.count?i.jsxs(i.Fragment,{children:[" ",t.agentLabel," has ",t.count," hook",t.count===1?"":"s","; switch agents above to view them."]}):null]})}function LH({hook:e}){return e.status==="enabled"?i.jsx(Ge,{variant:"success",appearance:"subtle",size:"small",children:"Enabled"}):e.status==="disabled"?i.jsx(Ge,{variant:"error",appearance:"subtle",size:"small",children:"Disabled"}):i.jsx(Ge,{variant:"warning",appearance:"subtle",size:"small",children:"Default"})}function zH({hook:e}){return e.trusted===void 0?null:i.jsx(Ge,{variant:e.trusted?"success":"warning",appearance:"subtle",size:"small",children:e.trusted?"Trusted":"Untrusted"})}function BH(e){return e.command?e.command:e.type??e.settingsPath}function d2(e){return`${e.matcher?`matcher ${e.matcher} · `:""}${BH(e)}`}function PH({agent:e,agentId:t}){const{sendToAgent:s}=At(),[n,o]=_.useState([]),[l,u]=_.useState(!1),[h,f]=_.useState(!1),d=_.useCallback(async()=>{u(!0);try{o(await UD(t))}catch{o([])}finally{u(!1)}},[t]);_.useEffect(()=>{d()},[d]);const p=_.useMemo(()=>{const k={};for(const N of n)k[N.name]=N.state;return k},[n]),g=_.useMemo(()=>{const k=new Set(e.mcpServers.map(E=>E.name)),N=n.filter(E=>!k.has(E.name)).map(E=>({name:E.name,scope:"user",synthetic:!0}));return[...e.mcpServers,...N]},[e.mcpServers,n]);function x(k){f(!1),s({prompt:SH(t,k),source:{type:"agent-mcp",label:"New MCP server"},label:`Add MCP server: ${k}`})}function v(k){s({prompt:NH(k),source:{type:"agent-mcp",label:`${k.name} server`},mode:"draft"})}function w(k){s({prompt:kH(k,t),source:{type:"agent-mcp",label:`Remove ${k.name}`},label:`Remove MCP server: ${k.name}`})}return i.jsxs(hi,{className:"min-w-0 rounded-none border-0 bg-transparent md:border-l md:border-border",children:[i.jsxs(fi,{className:"border-b border-border px-3 py-2",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(wC,{className:"size-4 text-muted-foreground"}),i.jsx(mi,{children:"MCP Servers"})]}),i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(Ge,{variant:"outline",size:"small",children:g.length}),i.jsx(J,{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:i.jsx(Rr,{className:l?"animate-spin":void 0})}),i.jsx(jf,{label:"Register an MCP server with AI",onClick:()=>f(k=>!k)})]})]}),h?i.jsx(Mr,{className:"mt-1.5",placeholder:"Paste the MCP install command or URL…",onSubmit:x,onCancel:()=>f(!1)}):i.jsxs(er,{className:"text-xs",children:["From"," ",i.jsx("code",{className:"font-mono",children:t==="codex"?"~/.codex/config.toml":"~/.claude.json"}),t==="codex"?"":" + claude.ai connectors",". Status via"," ",i.jsxs("code",{className:"font-mono",children:[t==="codex"?"codex":"claude"," mcp list"]})," ","(fresh health check)."]})]}),i.jsx(pi,{className:"p-0",children:g.length?i.jsx("ul",{className:"divide-y divide-border",children:g.map(k=>i.jsxs("li",{className:"group px-3 py-2 hover:bg-muted/40",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[i.jsx("span",{className:"min-w-0 truncate font-mono text-xs font-semibold",title:k.name,children:k.name}),i.jsx(Af,{askLabel:`Ask AI about the ${k.name} server`,removeLabel:`Remove the ${k.name} server`,onAsk:()=>v(k),onRemove:()=>w(k)})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[i.jsx($H,{state:p[k.name],loading:l}),i.jsx(Ge,{variant:"outline",size:"small",children:k.synthetic?"connector":k.scope})]})]}),i.jsx("div",{className:"mt-1 truncate font-mono text-[11px] text-muted-foreground",title:k.synthetic?"claude.ai managed connector":h2(k),children:k.synthetic?"claude.ai managed connector":h2(k)})]},`${k.scope}:${k.name}`))}):i.jsx("p",{className:"px-3 py-4 text-xs text-muted-foreground",children:"No MCP servers configured."})})]})}const IH={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 $H({state:e,loading:t}){if(!e)return t?i.jsx(jt,{className:"size-3 animate-spin text-muted-foreground"}):null;const s=e==="unknown"?void 0:IH[e];return s?i.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[i.jsx("span",{className:ae("size-1.5 shrink-0 rounded-full",s.dot),"aria-hidden":!0}),s.label]}):null}function h2(e){return e.command?[e.command,...e.args??[]].join(" "):e.url??e.type??"-"}function HH({agent:e,agentId:t}){const{sendToAgent:s}=At(),[n,o]=_.useState(!1),l=e.plugins??[];function u(d){o(!1),s({prompt:CH(t,d),source:{type:"agent-plugin",label:"New plugin"},label:`Install plugin: ${d}`})}function h(d){s({prompt:jH(d),source:{type:"agent-plugin",label:`${d.name} plugin`},mode:"draft"})}function f(d){s({prompt:EH(d),source:{type:"agent-plugin",label:`Remove ${d.name}`},label:`Uninstall plugin: ${d.name}`})}return i.jsxs(hi,{className:"min-w-0 rounded-none border-0 border-t border-border bg-transparent lg:border-l lg:border-t-0",children:[i.jsxs(fi,{className:"border-b border-border px-3 py-2",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(GT,{className:"size-4 text-muted-foreground"}),i.jsx(mi,{children:"Plugins"})]}),i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(Ge,{variant:"outline",size:"small",children:l.length}),i.jsx(jf,{label:"Install a plugin with AI",onClick:()=>o(d=>!d)})]})]}),n?i.jsx(Mr,{className:"mt-1.5",placeholder:"Paste a plugin name, marketplace, or install command…",onSubmit:u,onCancel:()=>o(!1)}):i.jsx(er,{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."})]}),i.jsx(pi,{className:"p-0",children:l.length?i.jsx("ul",{className:"divide-y divide-border",children:l.map(d=>i.jsxs("li",{className:"group px-3 py-2 hover:bg-muted/40",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[i.jsx("span",{className:"min-w-0 truncate font-mono text-xs font-semibold",title:d.name,children:d.name}),i.jsx(Af,{askLabel:`Ask AI about the ${d.name} plugin`,removeLabel:`Uninstall the ${d.name} plugin`,onAsk:()=>h(d),onRemove:()=>f(d)})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[d.version&&d.version!=="unknown"?i.jsxs(Ge,{variant:"outline",size:"small",children:["v",d.version]}):null,d.marketplace?i.jsx(Ge,{variant:"outline",size:"small",children:d.marketplace}):null]})]}),d.description?i.jsx("p",{className:"mt-1 truncate text-[11px] text-muted-foreground",title:d.description,children:d.description}):null,i.jsx(UH,{plugin:d})]},`${d.name}@${d.marketplace??""}`))}):i.jsx("p",{className:"px-3 py-4 text-xs text-muted-foreground",children:"No plugins installed."})})]})}function UH({plugin:e}){const t=[];return e.skills.length&&t.push(`${e.skills.length} skill${Wd(e.skills.length)}`),e.commands.length&&t.push(`${e.commands.length} command${Wd(e.commands.length)}`),e.agents.length&&t.push(`${e.agents.length} agent${Wd(e.agents.length)}`),e.mcpServers.length&&t.push(`${e.mcpServers.length} MCP server${Wd(e.mcpServers.length)}`),t.length?i.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1",children:t.map(s=>i.jsx("span",{className:"rounded-full bg-muted px-2 py-0.5 text-[10px] text-muted-foreground",children:s},s))}):null}function Wd(e){return e===1?"":"s"}function FH({agent:e,agentId:t}){const{sendToAgent:s}=At(),[n,o]=_.useState(!1);function l(f){o(!1),s({prompt:_H(t,f),source:{type:"agent-skill",label:"New skill"},label:`Add skill: ${f}`})}function u(f){s({prompt:wH(f),source:{type:"agent-skill",label:`${f.name} skill`},mode:"draft"})}function h(f){s({prompt:yH(f),source:{type:"agent-skill",label:`Remove ${f.name}`},label:`Remove skill: ${f.name}`})}return i.jsxs(hi,{className:"min-w-0 rounded-none border-0 bg-transparent",children:[i.jsxs(fi,{className:"border-b border-border px-3 py-2",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Ri,{className:"size-4 text-muted-foreground"}),i.jsx(mi,{children:"Skills"})]}),i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(Ge,{variant:"outline",size:"small",children:e.skills.length}),i.jsx(jf,{label:"Add a skill with AI",onClick:()=>o(f=>!f)})]})]}),n?i.jsx(Mr,{className:"mt-1.5",placeholder:"Paste a skill URL/repo, or describe the skill…",onSubmit:l,onCancel:()=>o(!1)}):i.jsx(er,{className:"text-xs",children:t==="codex"?"User, project, and system skills discovered for Codex.":"User and project skills discovered for the active agent."})]}),i.jsx(pi,{className:"p-0",children:e.skills.length?i.jsx("ul",{className:"divide-y divide-border",children:e.skills.map(f=>i.jsxs("li",{className:"group px-3 py-2 hover:bg-muted/40",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[i.jsx("span",{className:"min-w-0 truncate font-mono text-xs font-semibold",title:f.name,children:f.name}),i.jsx(Af,{askLabel:`Ask AI about the ${f.name} skill`,removeLabel:`Remove the ${f.name} skill`,onAsk:()=>u(f),onRemove:()=>h(f)})]}),i.jsx("div",{className:"flex shrink-0 items-center gap-1.5",children:i.jsx(Ge,{variant:"outline",size:"small",children:f.scope})})]}),f.description?i.jsx("p",{className:"mt-1 truncate text-[11px] text-muted-foreground",title:f.description,children:f.description}):null]},`${f.scope}:${f.name}`))}):i.jsx("p",{className:"px-3 py-4 text-xs text-muted-foreground",children:"No skills found."})})]})}function qH({agent:e,agentId:t,alternateHooks:s,onOpenAgentEnv:n}){return i.jsxs("div",{children:[n?i.jsx("div",{className:"flex items-center justify-end border-b border-border/60 px-3 py-1.5",children:i.jsxs("button",{className:"flex items-center gap-1 text-[11px] text-muted-foreground transition-colors hover:text-foreground",onClick:n,type:"button",children:["Manage across agents in Environments",i.jsx(FT,{className:"size-3"})]})}):null,i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4",children:[i.jsx(FH,{agent:e,agentId:t}),i.jsx(PH,{agent:e,agentId:t}),i.jsx(HH,{agent:e,agentId:t}),i.jsx(DH,{agent:e,agentId:t,alternateHooks:s})]})]})}function VH(e=3e4){const[t,s]=_.useState(null),[n,o]=_.useState(null),[l,u]=_.useState(!0),h=_.useCallback(async()=>{try{s(await qD()),o(null)}catch(f){o(f instanceof Error?f.message:String(f))}finally{u(!1)}},[]);return _.useEffect(()=>{h();const f=window.setInterval(()=>{h()},e);return()=>window.clearInterval(f)},[h,e]),{data:t,error:n,loading:l,refresh:h}}function GH(){const{data:e,error:t,loading:s}=VH();if(s&&!e)return i.jsx(Kd,{children:i.jsx(Qe,{variant:"muted",children:"Loading usage history…"})});if(t)return i.jsx(Kd,{children:i.jsxs(Qe,{variant:"muted",className:"border-destructive/40 text-destructive",children:["Failed to load usage history: ",t]})});const n=e?.summary;return!n||n.runs===0&&n.codexTotalTokens===0?i.jsx(Kd,{children:i.jsx(Qe,{variant:"muted",children:"No usage recorded yet. History accrues as you run the in-dock agent — check back after a session."})}):i.jsxs(Kd,{children:[i.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:[i.jsx(Yd,{label:"Total cost",value:`$${n.totalCostUSD.toFixed(2)}`,accent:!0}),i.jsx(Yd,{label:"Agent runs",value:String(n.runs)}),i.jsx(Yd,{label:"Tokens (in+out)",value:f2(n.totalTokens)}),i.jsx(Yd,{label:"Codex tokens",value:f2(n.codexTotalTokens)})]}),n.byDay.length>0?i.jsxs("div",{className:"rounded-md border border-border p-3",children:[i.jsx("div",{className:"mb-2 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Cost by day"}),i.jsx(WH,{days:n.byDay})]}):null,i.jsx(KH,{summary:n})]})}function WH({days:e}){const t=Math.max(...e.map(s=>s.costUSD),1e-4);return i.jsx("div",{className:"space-y-1.5",children:e.map(s=>i.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[i.jsx("span",{className:"w-20 shrink-0 font-mono text-muted-foreground",children:s.date.slice(5)}),i.jsx("div",{className:"h-3.5 flex-1 overflow-hidden rounded bg-muted/50",children:i.jsx("div",{className:"h-full rounded bg-emerald-500/80",style:{width:`${Math.max(2,s.costUSD/t*100)}%`}})}),i.jsxs("span",{className:"w-14 shrink-0 text-right font-mono text-emerald-700",children:["$",s.costUSD.toFixed(2)]}),i.jsxs("span",{className:"w-12 shrink-0 text-right text-muted-foreground",children:[s.runs," run",s.runs===1?"":"s"]})]},s.date))})}function KH({summary:e}){if(!e.firstAt||!e.lastAt)return null;const t=e.firstAt.slice(0,10),s=e.lastAt.slice(0,10);return i.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[t===s?`Recorded on ${t}.`:`Recorded ${t} → ${s}.`," Costs are Claude per-session figures; Codex reports lifetime token totals only."]})}function Kd({children:e}){return i.jsx("div",{className:"space-y-3 p-4",children:e})}function Yd({label:e,value:t,accent:s}){return i.jsxs("div",{className:"rounded-md border border-border px-3 py-2",children:[i.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:e}),i.jsx("div",{className:s?"font-mono text-lg font-semibold text-emerald-700":"font-mono text-lg font-semibold",children:t})]})}function f2(e){return e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}const YH=[{id:"claude-code",chatId:"claude",label:"Claude Code",icon:i.jsx(Sa,{className:"size-4"})},{id:"codex",chatId:"codex",label:"Codex",icon:i.jsx(ho,{className:"size-4"})}],XH=[{id:"overview",label:"Overview",icon:i.jsx(pC,{className:"size-3.5"})},{id:"memory",label:"Memory",icon:i.jsx(aC,{className:"size-3.5"})},{id:"tools",label:"Skills, MCPs, Plugins & Hooks",icon:i.jsx(wC,{className:"size-3.5"})},{id:"activity",label:"Activity",icon:i.jsx(eo,{className:"size-3.5"})},{id:"changes",label:"Changes",icon:i.jsx(hC,{className:"size-3.5"})},{id:"usage",label:"Usage",icon:i.jsx(AR,{className:"size-3.5"})}];function ZH({focusChanges:e,onOpenAgentEnv:t}={}){const[s,n]=_.useState(null),[o,l]=_.useState(null),[u,h]=_.useState("claude-code"),[f,d]=_.useState("overview"),{provider:p,providers:g,selectProvider:x}=At();_.useEffect(()=>{e&&d("changes")},[e]);function v(N,E){h(N),p?.id!==E&&x(E)}if(_.useEffect(()=>{p&&h(p.id==="codex"?"codex":"claude-code")},[p]),_.useEffect(()=>{let N=!0;return zC().then(E=>{N&&n(E)}).catch(E=>{N&&l(E instanceof Error?E.message:String(E))}),()=>{N=!1}},[]),o)return i.jsx("div",{className:"h-full overflow-auto bg-card/85 p-4",children:i.jsxs(Qe,{variant:"muted",className:"border-destructive/40 text-destructive",children:["Failed to load agent info: ",o]})});if(!s)return i.jsx("div",{className:"h-full overflow-auto bg-card/85 p-4",children:i.jsx(Qe,{variant:"muted",children:"Loading agent info…"})});const w=s.agents?.[u]??s,k=u==="codex"?{agentLabel:"Claude Code",count:s.agents["claude-code"].hooks.length}:{agentLabel:"Codex",count:s.agents.codex.hooks.length};return i.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/85",children:[i.jsx("div",{className:"flex shrink-0 items-center gap-2 border-b border-border bg-card/90 px-3 py-2",children:YH.map(N=>{const E=u===N.id,T=s.detected.name===N.id,A=p?.id===N.chatId,R=g.find(D=>D.id===N.chatId)?.configured??!0;return i.jsxs("button",{type:"button",onClick:()=>v(N.id,N.chatId),title:R?`Use ${N.label} for chat`:`${N.label} CLI isn't installed`,className:ae("flex items-center gap-2 rounded-lg border px-3 py-1.5 text-xs font-medium transition-colors",E?"border-border bg-background text-foreground shadow-sm":"border-transparent text-muted-foreground hover:bg-muted/60 hover:text-foreground",!R&&"opacity-60"),children:[N.icon,N.label,A?i.jsx("span",{className:"rounded-full bg-primary/15 px-1.5 py-px text-[10px] font-medium text-primary",children:"In use"}):T?i.jsx("span",{className:"size-1.5 rounded-full bg-emerald-500",title:"Detected agent","aria-hidden":!0}):R?null:i.jsx("span",{className:"text-[10px] font-normal text-muted-foreground",children:"not installed"})]},N.id)})}),i.jsx("div",{className:"flex shrink-0 items-center gap-1 border-b border-border bg-card/90 px-3",children:XH.map(N=>i.jsxs("button",{type:"button",onClick:()=>d(N.id),className:ae("relative flex items-center gap-1.5 px-2.5 py-2 text-xs font-medium transition-colors",f===N.id?"text-foreground":"text-muted-foreground hover:text-foreground"),children:[N.icon,N.label,f===N.id?i.jsx("span",{className:"absolute inset-x-1 -bottom-px h-0.5 bg-primary"}):null]},N.id))}),i.jsxs("div",{className:"min-h-0 flex-1 overflow-auto",children:[f==="overview"?i.jsx(G$,{agent:w,agentId:u,isDetected:s.detected.name===u}):null,f==="memory"?i.jsx(R$,{agent:w,agentId:u}):null,f==="tools"?i.jsx(qH,{agent:w,agentId:u,alternateHooks:k,onOpenAgentEnv:t}):null,f==="activity"?i.jsx(h$,{agent:w,agentId:u}):null,f==="changes"?i.jsx(C$,{}):null,f==="usage"?i.jsx(GH,{}):null]})]})}const uj=_.createContext(null);function QH(){const e=_.useRef(new Set),t=_.useCallback(n=>(e.current.add(n),()=>{e.current.delete(n)}),[]),s=_.useCallback(async()=>{await Promise.all([...e.current].map(n=>Promise.resolve().then(n)))},[]);return{register:t,runActive:s}}function JH({value:e,children:t}){return i.jsx(uj.Provider,{value:e,children:t})}function vl(e){const t=_.useContext(uj),s=_.useRef(e);s.current=e,_.useEffect(()=>{if(t)return t.register(()=>s.current())},[t])}var tr=tC();const m2=/token|key|secret|password|credential/i,p2="••••••••";function eU(e){return e.replace(/"([^"\n]+)"(\s*:\s*)"((?:[^"\\\n]|\\.)*)"/g,(t,s,n,o)=>m2.test(s)&&o?`"${s}"${n}"${p2}"`:t).replace(/^(\s*)([A-Za-z0-9_.-]+)(\s*=\s*)"((?:[^"\\\n]|\\.)*)"/gm,(t,s,n,o,l)=>m2.test(n)&&l?`${s}${n}${o}"${p2}"`:t)}const tU={claude:["opus","sonnet","haiku","opusplan"],codex:["gpt-5-codex","gpt-5"],antigravity:[]};function sU({agent:e,onClose:t}){const[s,n]=_.useState(null),[o,l]=_.useState(""),[u,h]=_.useState(""),[f,d]=_.useState(!1),[p,g]=_.useState(null),[x,v]=_.useState(!1);_.useEffect(()=>{let C=!1;return l7(e).then(R=>{C||!R||(n(R),l(R.content),h(R.model??""))}).catch(R=>{C||g(R instanceof Error?R.message:String(R))}),()=>{C=!0}},[e]),_.useEffect(()=>{function C(R){R.key==="Escape"&&!f&&t()}return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[t,f]);const w=s!==null&&o!==s.content,k=eU(o),N=!x&&k!==o,E=s!==null&&u.trim()!==(s.model??""),T=async()=>{d(!0),g(null);try{const{settings:C}=await u7(e,u);n(C),l(C.content),h(C.model??"")}catch(C){g(C instanceof Error?C.message:String(C))}finally{d(!1)}},A=async()=>{d(!0),g(null);try{await c7(e,o),t()}catch(C){g(C instanceof Error?C.message:String(C))}finally{d(!1)}};return tr.createPortal(i.jsx("div",{className:"fixed inset-0 z-[1000] grid place-items-center bg-black/35 px-4",onMouseDown:()=>!f&&t(),children:i.jsxs("div",{"aria-modal":"true",className:"flex w-full max-w-2xl flex-col overflow-hidden rounded-lg border border-border bg-card shadow-xl",onMouseDown:C=>C.stopPropagation(),role:"dialog",children:[i.jsxs("div",{className:"space-y-3 px-4 py-4",children:[i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx("div",{className:"flex size-8 shrink-0 items-center justify-center rounded-md border border-border bg-background text-foreground [&_svg]:size-4",children:i.jsx(mb,{})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("h2",{className:"text-sm font-semibold",children:[Yi[e]," settings"]}),i.jsx("p",{className:"truncate font-mono text-[11px] text-muted-foreground",title:s?.path,children:s?.path??"Loading..."})]})]}),s?.modelEditable?i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("label",{className:"text-xs font-medium",htmlFor:`model-${e}`,children:"Model"}),i.jsx("input",{className:"h-8 w-56 rounded-md border border-border bg-background px-2 font-mono text-xs",disabled:f||!s,id:`model-${e}`,list:`model-suggestions-${e}`,onChange:C=>h(C.target.value),placeholder:"default",value:u}),i.jsx("datalist",{id:`model-suggestions-${e}`,children:tU[e].map(C=>i.jsx("option",{value:C},C))}),i.jsx(J,{disabled:f||!E||w,onClick:()=>{T()},size:"sm",title:w?"Save or revert the file edits below first":void 0,variant:"outline",children:"Apply"})]}):null,i.jsxs("div",{className:"relative",children:[i.jsx("textarea",{"aria-label":"Settings file content",className:"h-72 w-full resize-y rounded-md border border-border bg-background p-2 font-mono text-xs leading-relaxed focus:outline-none",disabled:f||!s,onChange:C=>!N&&l(C.target.value),placeholder:s&&!s.exists?"File doesn't exist yet — saving will create it.":void 0,readOnly:N,spellCheck:!1,value:N?k:o}),k!==o||x?i.jsxs(J,{className:"absolute right-2 top-2 h-7 gap-1.5 px-2 text-[11px] text-muted-foreground",onClick:()=>v(C=>!C),size:"sm",title:N?"Secret-looking values are hidden; reveal to edit the file":"Hide secret-looking values",type:"button",variant:"ghost",children:[N?i.jsx(mf,{className:"size-3.5"}):i.jsx(rb,{className:"size-3.5"}),N?"Reveal secrets":"Hide secrets"]}):null]}),p?i.jsx("p",{className:"text-xs text-destructive",children:p}):null,i.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Saves are validated (",s?.format==="toml"?"TOML":"JSON",") and a timestamped .bak backup of the current file is written first."]})]}),i.jsxs("div",{className:"flex justify-end gap-2 border-t border-border bg-muted/30 px-4 py-3",children:[i.jsx(J,{disabled:f,onClick:t,size:"sm",type:"button",variant:"outline",children:"Close"}),i.jsx(J,{disabled:f||!w,onClick:()=>{A()},size:"sm",type:"button",children:f?"Saving...":"Save file"})]})]})}),document.body)}function mu({items:e,label:t="More actions",className:s}){const[n,o]=_.useState(!1),[l,u]=_.useState({top:0,right:0}),h=_.useRef(null),f=_.useRef(null);function d(){const p=h.current?.getBoundingClientRect();p&&u({top:p.bottom+4,right:window.innerWidth-p.right}),o(g=>!g)}return _.useEffect(()=>{if(!n)return;function p(v){const w=v.target;h.current?.contains(w)||f.current?.contains(w)||o(!1)}function g(v){v.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]),i.jsxs(i.Fragment,{children:[i.jsx("button",{"aria-label":t,className:ae("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:i.jsx(uC,{className:"size-3.5"})}),n?tr.createPortal(i.jsx("div",{className:"fixed z-50 min-w-44 overflow-hidden rounded-md border border-border bg-card p-1 shadow-md",ref:f,style:{top:l.top,right:l.right},children:e.map(p=>i.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?i.jsx("span",{className:"text-muted-foreground",children:p.icon}):null,p.label]},p.label))}),document.body):null]})}const Yi={claude:"Claude Code",codex:"Codex CLI",antigravity:"Antigravity"};function t0({agent:e,className:t}){return e==="claude"?i.jsx(Sa,{className:ae("text-[#D97757]",t)}):e==="codex"?i.jsx(ho,{className:t}):i.jsx(p$,{className:t})}const nU=["claude","codex","antigravity"];function iU({availability:e,config:t,onStage:s}){const[n,o]=_.useState(!1),l=[...Object.entries(t.mcpServers).map(([h,f])=>({name:h,detail:x2(f),remote:!1})),...Object.entries(t.remoteMcpServers).map(([h,f])=>({name:h,detail:b2(f),remote:!0}))],u=[...Object.entries(t.projectMcpServers).map(([h,f])=>({name:h,detail:x2(f),remote:!1})),...Object.entries(t.projectRemoteMcpServers).map(([h,f])=>({name:h,detail:b2(f),remote:!0}))];return i.jsxs(hi,{className:"flex min-h-0 flex-col",children:[i.jsxs(fi,{className:"shrink-0",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs(mi,{className:"flex items-center gap-1.5",children:[i.jsx(t0,{agent:t.agent,className:"size-4"}),Yi[t.agent]]}),i.jsxs("span",{className:"flex items-center gap-1",children:[e?i.jsx(Ge,{size:"small",variant:e.available?"success":"warning",children:e.available?"installed":"not on PATH"}):null,i.jsx("button",{className:"rounded p-1 text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground",onClick:()=>o(!0),title:`${Yi[t.agent]} settings`,type:"button",children:i.jsx(mb,{className:"size-3.5"})})]})]}),n?i.jsx(sU,{agent:t.agent,onClose:()=>o(!1)}):null,i.jsx("p",{className:"truncate font-mono text-[11px] text-muted-foreground",title:t.configPath,children:t.exists?t.configPath:`no config — ${t.configPath}`})]}),i.jsxs(pi,{className:"min-h-0 flex-1 space-y-4 overflow-y-auto",children:[i.jsx(g2,{agent:t.agent,label:"MCP servers",mcps:l,onStage:s,scope:"user"}),u.length>0?i.jsx(g2,{agent:t.agent,label:"Project MCP servers",mcps:u,onStage:s,scope:"project"}):null,i.jsx(rU,{agent:t.agent,onStage:s,skills:t.skills})]})]})}function dj(e,t,s){const n=nU.filter(o=>o!==e.sourceAgent);return[...n.map(o=>({label:`Copy to ${Yi[o]}`,onSelect:()=>t({...e,action:"copy",targetAgent:o,targetScope:s(o)})})),...n.map(o=>({label:`Move to ${Yi[o]}`,onSelect:()=>t({...e,action:"move",targetAgent:o,targetScope:s(o)})})),{label:"Remove",onSelect:()=>t({...e,action:"remove"})}]}function g2({agent:e,label:t,mcps:s,scope:n,onStage:o}){return i.jsxs("section",{children:[i.jsx("h4",{className:"mb-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:t}),s.length===0?i.jsx("p",{className:"text-xs text-muted-foreground",children:"None configured."}):i.jsx("ul",{className:"space-y-1",children:s.map(l=>i.jsxs("li",{className:"group flex items-start gap-2 rounded-md border border-border/60 bg-background/60 px-2 py-1.5",children:[i.jsx("span",{className:"mt-0.5 text-muted-foreground [&_svg]:size-3.5",children:l.remote?i.jsx(cb,{}):i.jsx(xf,{})}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block text-xs font-medium",children:l.name}),i.jsx("span",{className:"block truncate font-mono text-[11px] text-muted-foreground",title:l.detail,children:l.detail})]}),o?i.jsx(mu,{items:dj({category:"mcp",name:l.name,sourceAgent:e,sourceScope:n},o,()=>n)}):null]},l.name))})]})}function rU({agent:e,skills:t,onStage:s}){return i.jsxs("section",{children:[i.jsx("h4",{className:"mb-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Skills & plugins"}),t.length===0?i.jsx("p",{className:"text-xs text-muted-foreground",children:"None installed."}):i.jsx("ul",{className:"space-y-1",children:t.map(n=>i.jsxs("li",{className:"group flex items-start gap-2 rounded-md border border-border/60 bg-background/60 px-2 py-1.5",children:[i.jsx("span",{className:"mt-0.5 text-muted-foreground [&_svg]:size-3.5",children:n.kind==="plugin"?i.jsx(tM,{}):i.jsx(Ri,{})}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsxs("span",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"truncate text-xs font-medium",children:n.name}),n.scope==="project"?i.jsx(Ge,{size:"small",variant:"outline",children:"project"}):null]}),n.kind==="plugin"&&n.pluginSkills?.length?i.jsxs("span",{className:"block truncate text-[11px] text-muted-foreground",title:n.pluginSkills.join(", "),children:[n.pluginSkills.length," skill",n.pluginSkills.length===1?"":"s",n.pluginMcps?.length?`, ${n.pluginMcps.length} MCP${n.pluginMcps.length===1?"":"s"}`:""]}):null]}),s&&n.kind!=="plugin"?i.jsx(mu,{items:dj({category:"skill",name:n.name,sourceAgent:e,sourceScope:n.scope},s,o=>o==="claude"?n.scope:"user")}):null]},`${n.scope}:${n.name}`))})]})}function x2(e){return[e.command,...e.args??[]].join(" ").trim()||"(no command)"}function b2(e){return`${e.transport} · ${e.url}`}function Tf({title:e,message:t,confirmLabel:s="Confirm",cancelLabel:n="Cancel",tone:o="default",icon:l,loading:u=!1,onConfirm:h,onCancel:f}){_.useEffect(()=>{function p(g){g.key==="Escape"&&!u&&f()}return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[f,u]);const d=o==="danger"?"destructive":o==="success"?"success":"default";return tr.createPortal(i.jsx("div",{className:"fixed inset-0 z-[1000] grid place-items-center bg-black/35 px-4",onMouseDown:()=>!u&&f(),children:i.jsxs("div",{"aria-modal":"true",className:"flex w-full max-w-md flex-col overflow-hidden rounded-lg border border-border bg-card shadow-xl",onMouseDown:p=>p.stopPropagation(),role:"dialog",children:[i.jsxs("div",{className:"flex items-start gap-3 px-4 py-4",children:[l?i.jsx("div",{className:"flex size-8 shrink-0 items-center justify-center rounded-md border border-border bg-background text-foreground [&_svg]:size-4",children:l}):null,i.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[i.jsx("h2",{className:"text-sm font-semibold",children:e}),i.jsx("div",{className:"text-[13px] text-muted-foreground",children:t})]})]}),i.jsxs("div",{className:"flex justify-end gap-2 border-t border-border bg-muted/30 px-4 py-3",children:[i.jsx(J,{disabled:u,onClick:f,size:"sm",type:"button",variant:"outline",children:n}),i.jsx(J,{disabled:u,onClick:h,size:"sm",type:"button",variant:d,children:s})]})]})}),document.body)}function aU({pending:e,busy:t,onToggle:s,onConfirm:n,onCancel:o}){const{preview:l,skipped:u}=e,h=l.items.filter(f=>!u.has(`${f.category}:${f.name}`)).length;return i.jsx(Tf,{confirmLabel:t?"Applying...":`Apply ${h} item${h===1?"":"s"}`,icon:i.jsx(Xc,{}),loading:t,message:i.jsxs("div",{className:"space-y-2",children:[i.jsxs("p",{children:["Apply profile ",i.jsx("span",{className:"font-medium text-foreground",children:l.profile})," ","to ",Yi[l.agent],". A config backup is written first."]}),i.jsx("ul",{className:"max-h-56 space-y-1 overflow-y-auto",children:l.items.map(f=>{const d=`${f.category}:${f.name}`;return i.jsxs("li",{className:"flex items-start gap-2",children:[i.jsx("input",{checked:!u.has(d),className:"mt-0.5",disabled:t,id:`apply-${d}`,onChange:()=>s(d),type:"checkbox"}),i.jsxs("label",{className:"min-w-0 flex-1 cursor-pointer",htmlFor:`apply-${d}`,children:[i.jsxs("span",{className:"flex items-center gap-1.5",children:[i.jsxs("span",{className:"truncate text-xs text-foreground",children:[f.category==="mcp"?"MCP":"Skill"," ",f.name]}),i.jsx(Ge,{size:"small",variant:f.status==="conflict"?"warning":f.status==="identical"?"outline":"success",children:f.status==="conflict"?"overwrites existing":f.status==="identical"?"already identical":"new"})]}),f.warnings.map(p=>i.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-amber-600 dark:text-amber-500",children:[i.jsx(Ar,{className:"size-3 shrink-0"}),p]},p))]})]},d)})}),l.unresolvedCredentials.length>0?i.jsxs("p",{className:"flex items-center gap-1 text-[11px] text-amber-600 dark:text-amber-500",children:[i.jsx(Ar,{className:"size-3 shrink-0"}),"Unfilled credentials applied as placeholders:"," ",l.unresolvedCredentials.join(", ")]}):null]}),onCancel:o,onConfirm:n,title:`Apply profile to ${Yi[l.agent]}`,tone:"success"})}function v2(e){return e.trim().toLowerCase().replace(/[\s_]+/g,"-").replace(/[^a-z0-9.-]/g,"").replace(/-+/g,"-").replace(/^[-.]+|[-.]+$/g,"")}function oU({profileName:e,busy:t,onConfirm:s,onCancel:n}){const[o,l]=_.useState(v2(e)),[u,h]=_.useState(e),[f,d]=_.useState("1.0.0"),[p,g]=_.useState(""),x=o.trim().length>0&&u.trim().length>0,v="h-8 w-full rounded-md border border-border bg-background px-2 text-xs";return i.jsx(Tf,{confirmLabel:t?"Publishing...":"Publish",icon:i.jsx(lC,{}),loading:t,message:i.jsxs("div",{className:"space-y-2",children:[i.jsxs("p",{children:["Publish ",i.jsx("span",{className:"font-medium text-foreground",children:e})," to the registry. The uploaded archive is credential-redacted — installers supply their own secrets."]}),i.jsxs("label",{className:"block space-y-1",children:[i.jsx("span",{className:"text-[11px] font-medium",children:"Slug"}),i.jsx("input",{className:v,onChange:w=>l(v2(w.target.value)),value:o})]}),i.jsxs("label",{className:"block space-y-1",children:[i.jsx("span",{className:"text-[11px] font-medium",children:"Title"}),i.jsx("input",{className:v,onChange:w=>h(w.target.value),value:u})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsxs("label",{className:"block w-24 space-y-1",children:[i.jsx("span",{className:"text-[11px] font-medium",children:"Version"}),i.jsx("input",{className:v,onChange:w=>d(w.target.value),value:f})]}),i.jsxs("label",{className:"block flex-1 space-y-1",children:[i.jsx("span",{className:"text-[11px] font-medium",children:"Summary (optional)"}),i.jsx("input",{className:v,onChange:w=>g(w.target.value),value:p})]})]})]}),onCancel:n,onConfirm:()=>{!x||t||s({name:e,slug:o.trim(),title:u.trim(),version:f.trim()||void 0,summary:p.trim()||void 0})},title:"Publish to registry",tone:"success"})}function lU({name:e,onChanged:t}){const[s,n]=_.useState(null),[o,l]=_.useState(null),[u,h]=_.useState(!1),[f,d]=_.useState("");_.useEffect(()=>{let k=!1;return h7(e).then(N=>{k||!N||(n(N),d(N.description??""))}).catch(N=>{k||l(N instanceof Error?N.message:String(N))}),()=>{k=!0}},[e]);const p=async k=>{h(!0),l(null);try{const N=await f7(e,k);n(N),d(N.description??""),t()}catch(N){l(N instanceof Error?N.message:String(N))}finally{h(!1)}};if(!s)return i.jsx("p",{className:"px-3 pb-2 pl-9 text-[11px] text-muted-foreground",children:o??"Loading profile..."});const g=Object.entries(s.mcps),x=k=>{const{[k]:N,...E}=s.mcps;p({mcps:E})},v=k=>{p({skills:s.skills.filter(N=>N.name!==k)})},w=()=>{const k=f.trim();k!==(s.description??"")&&p({description:k})};return i.jsxs("div",{className:"space-y-2 border-t border-border/40 bg-muted/20 px-3 py-2 pl-9",children:[i.jsx("input",{"aria-label":"Profile description",className:"h-7 w-full rounded-md border border-transparent bg-transparent px-1.5 text-[11px] text-muted-foreground placeholder:text-muted-foreground/60 hover:border-border focus:border-border focus:bg-background focus:text-foreground focus:outline-none",disabled:u,onBlur:w,onChange:k=>d(k.target.value),onKeyDown:k=>{k.key==="Enter"&&k.currentTarget.blur()},placeholder:"Add a description...",value:f}),i.jsx(_2,{busy:u,items:g.map(([k,N])=>({key:k,name:k,detail:cU(N),icon:N.kind==="remote"?i.jsx(cb,{}):i.jsx(xf,{})})),label:"MCP servers",onRemove:x}),i.jsx(_2,{busy:u,items:s.skills.map(k=>({key:k.name,name:k.name,icon:i.jsx(Ri,{})})),label:"Skills",onRemove:v}),o?i.jsx("p",{className:"text-[11px] text-destructive",children:o}):null]})}function _2({label:e,items:t,busy:s,onRemove:n}){return i.jsxs("section",{children:[i.jsx("h5",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:e}),t.length===0?i.jsx("p",{className:"text-[11px] text-muted-foreground",children:"None."}):i.jsx("ul",{className:"space-y-1",children:t.map(o=>i.jsxs("li",{className:"group/item flex items-start gap-2 rounded-md border border-border/60 bg-background/60 px-2 py-1.5",children:[i.jsx("span",{className:"mt-0.5 text-muted-foreground [&_svg]:size-3.5",children:o.icon}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block text-xs font-medium",children:o.name}),o.detail?i.jsx("span",{className:"block truncate font-mono text-[11px] text-muted-foreground",title:o.detail,children:o.detail}):null]}),i.jsx("button",{className:"rounded p-0.5 text-muted-foreground opacity-0 transition-opacity hover:text-foreground group-hover/item:opacity-100",disabled:s,onClick:()=>n(o.key),title:"Remove from profile",type:"button",children:i.jsx(Ut,{className:"size-3.5"})})]},o.key))})]})}function cU(e){return e.kind==="local"?[e.command,...e.args??[]].join(" ").trim()||"(no command)":`${e.transport} · ${e.url}`}const y2=["claude","codex","antigravity"];function uU({profiles:e,loading:t,busy:s,onSnapshot:n,onApply:o,onExport:l,onImport:u,onDelete:h,onPublish:f,onChanged:d}){const p=_.useRef(null),[g,x]=_.useState("claude"),[v,w]=_.useState(""),[k,N]=_.useState(null),[E,T]=_.useState(null),A=()=>{const C=v.trim();C&&(n(g,C),w(""))};return i.jsxs("div",{className:"flex min-h-0 min-w-0 flex-col",children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-border/60 px-3 py-2",children:[i.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-semibold",children:[i.jsx(dw,{className:"size-3.5 text-muted-foreground"}),"Profiles",e.length>0?i.jsx(Ge,{size:"small",variant:"outline",children:e.length}):null]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("div",{"aria-label":"Agent to snapshot",className:"flex h-8 items-center gap-0.5 rounded-md border border-border bg-muted/40 p-0.5",role:"radiogroup",children:y2.map(C=>i.jsx("button",{"aria-checked":g===C,className:ae("flex h-full w-8 items-center justify-center rounded transition-colors",g===C?"bg-background shadow-sm":"opacity-40 hover:bg-muted/60 hover:opacity-100"),onClick:()=>x(C),role:"radio",title:`Snapshot ${Yi[C]}`,type:"button",children:i.jsx(t0,{agent:C,className:"size-4"})},C))}),i.jsx("input",{"aria-label":"New profile name",className:"h-8 w-36 rounded-md border border-border bg-background px-2 text-xs",onChange:C=>w(C.target.value),onKeyDown:C=>{C.key==="Enter"&&A()},placeholder:"profile name",value:v}),i.jsxs(J,{disabled:s||v.trim().length===0,onClick:A,size:"sm",variant:"outline",children:[i.jsx(oC,{}),"Snapshot"]}),i.jsxs(J,{disabled:s,onClick:()=>p.current?.click(),size:"sm",variant:"outline",children:[i.jsx(bf,{}),"Import"]}),i.jsx("input",{accept:".tar.gz,.tgz,application/gzip",className:"hidden",onChange:C=>{const R=C.target.files?.[0];R&&u(R),C.target.value=""},ref:p,type:"file"})]})]}),t?i.jsx("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:"Loading profiles..."}):e.length===0?i.jsx("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No profiles yet. Snapshot an agent to capture its MCPs and skills as a reusable bundle, or import a shared .tar.gz."}):i.jsx("ul",{className:"min-h-0 flex-1 divide-y divide-border/60 overflow-y-auto",children:e.map(C=>i.jsxs("li",{className:"group",children:[i.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2",children:[i.jsxs("button",{"aria-expanded":E===C.name,className:"flex min-w-0 flex-1 items-center gap-2.5 text-left",onClick:()=>T(E===C.name?null:C.name),type:"button",children:[i.jsx("span",{className:"shrink-0",title:C.sourceAgent?`Snapshot of ${Yi[C.sourceAgent]}`:"Imported profile",children:C.sourceAgent?i.jsx(t0,{agent:C.sourceAgent,className:"size-4"}):i.jsx(g$,{className:"size-4 text-muted-foreground"})}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsxs("span",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"truncate text-xs font-medium",children:C.name}),i.jsxs(Ge,{size:"small",variant:"outline",children:[C.mcpCount," MCP",C.mcpCount===1?"":"s"]}),i.jsxs(Ge,{size:"small",variant:"outline",children:[C.skillCount," skill",C.skillCount===1?"":"s"]}),i.jsx(jn,{className:ae("size-3.5 shrink-0 text-muted-foreground transition-transform",E===C.name?"rotate-90":"opacity-0 group-hover:opacity-100")})]}),C.description&&E!==C.name?i.jsx("span",{className:"block truncate text-[11px] text-muted-foreground",children:C.description}):null]})]}),i.jsx("span",{className:"shrink-0 text-[11px] text-muted-foreground",children:mE(C.updatedAt)}),i.jsx(mu,{className:"opacity-100",items:[...y2.map(R=>({label:`Apply to ${Yi[R]}`,onSelect:()=>o(C.name,R)})),{label:"Export .tar.gz",icon:i.jsx(dw,{className:"size-3.5"}),onSelect:()=>l(C.name)},{label:"Publish to registry...",icon:i.jsx(lC,{className:"size-3.5"}),onSelect:()=>f(C.name)},{label:"Delete",icon:i.jsx(Mi,{className:"size-3.5"}),onSelect:()=>N(C.name)}],label:`Actions for ${C.name}`})]}),E===C.name?i.jsx(lU,{name:C.name,onChanged:d}):null]},C.name))}),k?i.jsx(Tf,{confirmLabel:"Delete",icon:i.jsx(Mi,{}),message:`Delete profile "${k}"? Agents' live configs are not touched.`,onCancel:()=>N(null),onConfirm:()=>{h(k),N(null)},title:"Delete profile",tone:"danger"}):null]})}function dU({status:e,busy:t,signingIn:s,onSignIn:n,onSignOut:o,onInstall:l}){const[u,h]=_.useState(""),f=()=>{const d=u.trim();d&&(l(d),h(""))};return i.jsxs("div",{className:"flex min-w-0 flex-wrap content-start items-center gap-2 px-3 py-2",children:[i.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-semibold",children:[i.jsx(cb,{className:"size-3.5 text-muted-foreground"}),"Registry"]}),e===null?i.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Checking sign-in..."}):e.signedIn?i.jsxs(i.Fragment,{children:[i.jsx(Ge,{size:"small",variant:"success",children:e.user?.displayName||e.user?.email||"signed in"}),e.source==="env"?i.jsx("span",{className:"text-[11px] text-muted-foreground",children:"token from environment"}):i.jsxs(J,{disabled:t,onClick:o,size:"sm",variant:"ghost",children:[i.jsx(H6,{}),"Sign out"]})]}):i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"text-[11px] text-muted-foreground",children:e.error?`Signed out (${e.error})`:"Signed out"}),i.jsxs(J,{disabled:s,onClick:n,size:"sm",variant:"outline",children:[i.jsx(I6,{}),s?"Waiting for browser...":"Sign in"]})]}),e&&e.apiMode!=="prod"?i.jsx(Ge,{size:"small",variant:"warning",children:e.apiMode==="local"?"local registry":e.apiBaseUrl}):null,i.jsx("span",{className:"flex-1"}),i.jsx("input",{"aria-label":"Registry profile slug",className:"h-8 w-44 rounded-md border border-border bg-background px-2 text-xs",onChange:d=>h(d.target.value),onKeyDown:d=>{d.key==="Enter"&&f()},placeholder:"profile slug",value:u}),i.jsxs(J,{disabled:t||u.trim().length===0,onClick:f,size:"sm",variant:"outline",children:[i.jsx(Xc,{}),"Install"]})]})}function hU({count:e,preview:t,applying:s,onUnstage:n,onClear:o,onApply:l}){return e===0?null:i.jsxs("div",{className:"shrink-0 border-t border-border bg-card/95",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border/60 px-3 py-2",children:[i.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-semibold",children:[i.jsx(k6,{className:"size-3.5 text-muted-foreground"}),"Staged changes",i.jsx(Ge,{size:"small",variant:"outline",children:e})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(J,{disabled:s,onClick:o,size:"sm",variant:"ghost",children:"Clear"}),i.jsx(J,{disabled:s||t!==null&&!t.valid,onClick:l,size:"sm",children:s?"Applying...":"Save & apply"})]})]}),t===null?i.jsx("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:"Validating staged changes..."}):null,i.jsx("ul",{className:"max-h-48 space-y-1 overflow-y-auto p-2",children:(t?.items??[]).map((u,h)=>i.jsxs("li",{className:"flex items-start gap-2 rounded-md border border-border/60 bg-background/60 px-2 py-1.5",children:[i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:`block text-xs ${u.ok?"":"text-destructive"}`,children:u.summary}),u.error?i.jsx("span",{className:"block text-[11px] text-destructive",children:u.error}):null,u.warnings.map(f=>i.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-amber-600 dark:text-amber-500",children:[i.jsx(Ar,{className:"size-3 shrink-0"}),f]},f))]}),i.jsx("button",{"aria-label":"Unstage change",className:"mt-0.5 text-muted-foreground transition-colors hover:text-foreground",disabled:s,onClick:()=>n(h),type:"button",children:i.jsx(Ut,{className:"size-3.5"})})]},`${u.summary}-${h}`))}),t&&t.agents.length>0?i.jsx("div",{className:"flex flex-wrap gap-2 border-t border-border/60 px-3 py-2",children:t.agents.map(u=>i.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[i.jsx("span",{className:"font-medium text-foreground",children:u.agent}),u.add.length>0?` +${u.add.length}`:"",u.remove.length>0?` −${u.remove.length}`:""]},u.agent))}):null]})}function fU(){const[e,t]=_.useState([]),[s,n]=_.useState([]),[o,l]=_.useState(null),[u,h]=_.useState(!0),[f,d]=_.useState(null),p=_.useCallback(async()=>{h(!0),d(null);try{const[g,x,v]=await Promise.all([n7(),i7(),r7()]);t(g),n(x),l(v)}catch(g){d(g instanceof Error?g.message:String(g))}finally{h(!1)}},[]);return _.useEffect(()=>{p()},[p]),{agents:e,configs:s,doctor:o,loading:u,error:f,refresh:p}}function mU(e){const[t,s]=_.useState([]),[n,o]=_.useState(!0),[l,u]=_.useState(!1),[h,f]=_.useState(null),d=as(),p=_.useCallback(async()=>{try{s(await d7())}catch{}finally{o(!1)}},[]);_.useEffect(()=>{p()},[p]);const g=_.useCallback(async A=>{if(!l){u(!0);try{await A()}catch(C){d.error(C instanceof Error?C.message:String(C))}finally{u(!1)}}},[l,d]),x=_.useCallback((A,C)=>g(async()=>{const R=await p7({agent:A,name:C});d.success(`Snapshotted ${A} into "${R.name}" (${Object.keys(R.mcps).length} MCPs, ${R.skills.length} skills)`),await p()}),[p,g,d]),v=_.useCallback((A,C)=>g(async()=>{const R=await g7(A,C),D=new Set(R.items.filter($=>$.status==="conflict").map($=>`${$.category}:${$.name}`));f({preview:R,skipped:D})}),[g]),w=_.useCallback(A=>{f(C=>{if(!C)return C;const R=new Set(C.skipped);return R.has(A)?R.delete(A):R.add(A),{...C,skipped:R}})},[]),k=_.useCallback(()=>g(async()=>{if(!h)return;const{preview:A,skipped:C}=h,R=await x7({name:A.profile,agent:A.agent,skip:{mcps:A.items.filter(D=>D.category==="mcp"&&C.has(`mcp:${D.name}`)).map(D=>D.name),skills:A.items.filter(D=>D.category==="skill"&&C.has(`skill:${D.name}`)).map(D=>D.name)}});f(null),d.success(`Applied "${R.profile}" to ${R.agent}: ${R.mcpsApplied.length} MCPs, ${R.skillsApplied.length} skills — ${R.backups.length} backup${R.backups.length===1?"":"s"} written`),e()}),[e,h,g,d]),N=_.useCallback(A=>g(async()=>{const{archivePath:C}=await b7(A);d.message({text:`Exported to ${C} (credentials redacted)`,preserve:!0})}),[g,d]),E=_.useCallback(A=>g(async()=>{try{const C=await yw(A);d.success(w2(C.name,C.missingCredentials.length)),await p()}catch(C){if(!(C instanceof Error?C.message:String(C)).includes("already exists"))throw C;const D=await yw(A,{force:!0});d.success(`${w2(D.name,D.missingCredentials.length)} (overwrote existing)`),await p()}}),[p,g,d]),T=_.useCallback(A=>g(async()=>{await m7(A),d.success(`Deleted profile "${A}"`),await p()}),[p,g,d]);return{profiles:t,loading:n,busy:l,pendingApply:h,refresh:p,snapshot:x,startApply:v,toggleSkip:w,confirmApply:k,cancelApply:()=>f(null),exportOne:N,importArchive:E,deleteOne:T}}function w2(e,t){return t>0?`Imported "${e}" — ${t} credential${t===1?"":"s"} still needed`:`Imported "${e}"`}const pU=1500,gU=300*1e3;function xU(e){const[t,s]=_.useState(null),[n,o]=_.useState(!1),[l,u]=_.useState(!1),h=_.useRef(!1),f=as(),d=_.useCallback(async()=>{try{s(await v7())}catch{}},[]);_.useEffect(()=>(d(),()=>{h.current=!0}),[d]);const p=_.useCallback(async()=>{if(!l){u(!0);try{const{url:k,state:N}=await _7();window.open(k,"_blank","noopener");const E=Date.now()+gU;for(;Date.now()<E&&!h.current;){await new Promise(A=>setTimeout(A,pU));const T=await y7(N).catch(()=>null);if(!(!T||T.status==="pending")){T.status==="success"?f.success("Signed in to the profile registry"):f.error(T.message??"Registry sign-in failed"),await d();return}}h.current||f.error("Registry sign-in timed out")}catch(k){f.error(k instanceof Error?k.message:String(k))}finally{u(!1)}}},[d,l,f]),g=_.useCallback(async k=>{if(n)return!1;o(!0);try{return await k(),!0}catch(N){return f.error(N instanceof Error?N.message:String(N)),!1}finally{o(!1)}},[n,f]),x=_.useCallback(()=>g(async()=>{await w7(),f.success("Signed out of the profile registry"),await d()}),[d,g,f]),v=_.useCallback(k=>g(async()=>{try{const N=await ww({slug:k});f.success(S2(N.name,N.missingCredentials.length))}catch(N){if(!(N instanceof Error?N.message:String(N)).includes("already exists"))throw N;const T=await ww({slug:k,force:!0});f.success(`${S2(T.name,T.missingCredentials.length)} (overwrote existing)`)}e()}),[e,g,f]),w=_.useCallback(k=>g(async()=>{const N=await S7(k);f.message({text:`Published "${N.slug}" v${N.version} to the registry (credentials redacted)`,preserve:!0})}),[g,f]);return{status:t,busy:n,signingIn:l,refreshStatus:d,signIn:p,signOut:x,install:v,publish:w}}function S2(e,t){return t>0?`Installed "${e}" — ${t} credential${t===1?"":"s"} still needed`:`Installed "${e}" from the registry`}function bU(e,t){return e.category===t.category&&e.action===t.action&&e.name===t.name&&e.sourceAgent===t.sourceAgent&&e.sourceScope===t.sourceScope&&e.targetAgent===t.targetAgent&&e.targetScope===t.targetScope}function vU(e){const[t,s]=_.useState([]),[n,o]=_.useState(null),[l,u]=_.useState(!1),h=as(),f=_.useCallback(x=>{s(v=>v.some(w=>bU(w,x))?v:[...v,x])},[]),d=_.useCallback(x=>{s(v=>v.filter((w,k)=>k!==x))},[]),p=_.useCallback(()=>s([]),[]);_.useEffect(()=>{if(t.length===0){o(null);return}let x=!1;return a7(t).then(v=>{x||o(v)}).catch(v=>{x||o({valid:!1,agents:[],items:t.map(w=>({change:w,ok:!1,summary:`${w.action} ${w.category} "${w.name}"`,warnings:[],error:v instanceof Error?v.message:String(v)}))})}),()=>{x=!0}},[t]);const g=_.useCallback(async()=>{if(!(t.length===0||l)){u(!0);try{const x=await o7(t);if(x.ok)h.success(`Applied ${x.applied} change${x.applied===1?"":"s"} — ${x.backups.length} backup${x.backups.length===1?"":"s"} written`),s([]);else{const v=x.results.find(w=>w.error)?.error;h.error(`Applied ${x.applied} of ${t.length} changes${v?` — ${v}`:""}`),s(w=>w.slice(x.applied))}x.applied>0&&e()}catch(x){h.error(x instanceof Error?x.message:String(x))}finally{u(!1)}}},[l,e,t,h]);return{staged:t,preview:n,applying:l,stage:f,unstage:d,clear:p,apply:g}}function _U(){const{agents:e,configs:t,doctor:s,loading:n,error:o,refresh:l}=fU();vl(l);const{staged:u,preview:h,applying:f,stage:d,unstage:p,clear:g,apply:x}=vU(l),v=mU(l),w=xU(v.refresh),[k,N]=_.useState(null),[E,T]=_.useState("agents"),A=new Map(e.map(R=>[R.agent,R])),C=s?.checks.filter(R=>R.status!=="ok")??[];return i.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/85",children:[i.jsxs("header",{className:"flex shrink-0 flex-wrap items-center gap-2 border-b border-border px-3 py-2",children:[i.jsx(hb,{className:"size-4 text-muted-foreground"}),i.jsx("span",{className:"text-sm font-semibold",children:"Agent Environments"}),i.jsx("div",{className:"ml-2 flex items-center gap-0.5 rounded-md border border-border bg-muted/40 p-0.5",children:["agents","profiles"].map(R=>i.jsxs("button",{className:ae("flex h-6 items-center gap-1.5 rounded px-2.5 text-xs font-medium transition-colors",E===R?"bg-background shadow-sm":"text-muted-foreground hover:bg-muted/60 hover:text-foreground"),onClick:()=>T(R),type:"button",children:[R==="agents"?"Agents":"Profiles",R==="profiles"&&v.profiles.length>0?i.jsx("span",{className:"text-[10px] tabular-nums text-muted-foreground",children:v.profiles.length}):null]},R))}),C.length>0?i.jsxs("span",{className:"flex flex-wrap items-center gap-1.5",children:[i.jsxs("span",{className:"ml-2 flex items-center gap-1 text-xs font-medium text-muted-foreground",children:[i.jsx(FM,{className:"size-3.5"}),"Doctor"]}),C.map(R=>i.jsx(Ge,{size:"small",variant:"warning",children:R.message},R.message))]}):null]}),o?i.jsx(Qe,{className:"m-3 shrink-0",variant:"muted",children:o}):null,E==="profiles"?i.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-1 divide-y divide-border lg:grid-cols-[minmax(0,3fr)_minmax(0,2fr)] lg:divide-x lg:divide-y-0",children:[i.jsx(uU,{busy:v.busy,loading:v.loading,onApply:v.startApply,onChanged:v.refresh,onDelete:v.deleteOne,onExport:v.exportOne,onImport:v.importArchive,onPublish:N,onSnapshot:v.snapshot,profiles:v.profiles}),i.jsx(dU,{busy:w.busy,onInstall:w.install,onSignIn:()=>{w.signIn()},onSignOut:w.signOut,signingIn:w.signingIn,status:w.status})]}):t.length>0?i.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-4",children:i.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:t.map(R=>i.jsx(iU,{availability:A.get(R.agent),config:R,onStage:d},R.agent))})}):i.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center p-8 text-center",children:i.jsx("p",{className:"max-w-sm text-xs text-muted-foreground",children:n?"Reading agent configurations...":o?null:"No agent configurations found. Agent Environments reads Claude Code, Codex CLI, and Antigravity configs from your home directory."})}),i.jsx(hU,{applying:f,count:u.length,onApply:()=>{x()},onClear:g,onUnstage:p,preview:h}),k?i.jsx(oU,{busy:w.busy,onCancel:()=>N(null),onConfirm:R=>{w.publish(R).then(D=>{D&&N(null)})},profileName:k}):null,v.pendingApply?i.jsx(aU,{busy:v.busy,onCancel:v.cancelApply,onConfirm:()=>{v.confirmApply()},onToggle:v.toggleSkip,pending:v.pendingApply}):null]})}function Vn({children:e,icon:t,onClose:s,title:n,size:o="md"}){return _.useEffect(()=>{function l(u){u.key==="Escape"&&s()}return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[s]),tr.createPortal(i.jsx("div",{className:"fixed inset-0 z-[1000] grid place-items-center bg-black/35 px-4",onMouseDown:s,children:i.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:[i.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[i.jsx("div",{className:"flex size-8 items-center justify-center rounded-md border border-border bg-background text-foreground [&_svg]:size-4",children:t}),i.jsx("h2",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:n}),i.jsx(J,{"aria-label":"Close dialog",onClick:s,size:"icon",type:"button",variant:"ghost",children:i.jsx(Ut,{})})]}),i.jsx("div",{className:"min-h-0 overflow-auto p-4",children:e})]})}),document.body)}function dt({className:e,type:t,...s}){return i.jsx("input",{type:t,className:ae("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 yU={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 i.jsxs("span",{className:ae("group/tt relative inline-flex",n),children:[t,i.jsx("span",{role:"tooltip",className:ae("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",yU[s]),children:e})]})}const wU="application/x-nomoreide-path";function pu(e,t){return`${e.replace(/\/+$/,"")}/${t.replace(/^\/+/,"")}`}function hj(e,t){e.setData(wU,t)}function fj(e){return{draggable:!0,onDragStart:t=>{hj(t.dataTransfer,e),t.dataTransfer.effectAllowed="copy"}}}const gi='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>',xi='</title><path d="',bi='"/></svg>',SU={title:".NET",slug:"dotnet",get svg(){return gi+".NET"+xi+this.path+bi},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"}},kU={title:"Bun",slug:"bun",get svg(){return gi+"Bun"+xi+this.path+bi},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"},NU={title:"Deno",slug:"deno",get svg(){return gi+"Deno"+xi+this.path+bi},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"}},CU={title:"Docker",slug:"docker",get svg(){return gi+"Docker"+xi+this.path+bi},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"},EU={title:"Go",slug:"go",get svg(){return gi+"Go"+xi+this.path+bi},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"},jU={title:"Node.js",slug:"nodedotjs",get svg(){return gi+"Node.js"+xi+this.path+bi},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"},AU={title:"npm",slug:"npm",get svg(){return gi+"npm"+xi+this.path+bi},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"},TU={title:"pnpm",slug:"pnpm",get svg(){return gi+"pnpm"+xi+this.path+bi},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"},RU={title:"Python",slug:"python",get svg(){return gi+"Python"+xi+this.path+bi},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/"},k2={title:"Rust",slug:"rust",get svg(){return gi+"Rust"+xi+this.path+bi},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"}},MU={title:"Vite",slug:"vite",get svg(){return gi+"Vite"+xi+this.path+bi},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"},DU={title:"Yarn",slug:"yarn",get svg(){return gi+"Yarn"+xi+this.path+bi},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 OU(e){const t=e.toLowerCase();return/\bvite\b/.test(t)?Cn.vite:/\bcargo\s+/.test(t)?Cn.cargo:/\brustc\b/.test(t)?Cn.rust:/\bdotnet\b/.test(t)?Cn.dotnet:/\bdocker(?:\s+compose|-compose|\s+)/.test(t)?Cn.docker:/\bpython3?\b|\buvicorn\b|\bfastapi\b/.test(t)?Cn.python:/\bgo\s+(run|test|build)\b|\bair\b/.test(t)?Cn.go:/\bbun\b/.test(t)?Cn.bun:/\bdeno\b/.test(t)?Cn.deno:/\bpnpm\b/.test(t)?Cn.pnpm:/\byarn\b/.test(t)?Cn.yarn:/\bnpm\b/.test(t)?Cn.npm:/\bnode\b/.test(t)?Cn.node:Cn.generic}const Cn={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 Wb({command:e,compact:t}){const s=OU(e),n=LU[s.kind];return i.jsx("span",{"aria-label":`${s.label} process`,className:ae("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?i.jsx("svg",{"aria-hidden":"true",className:t?"size-3.5":"size-4",fill:"currentColor",role:"img",viewBox:"0 0 24 24",children:i.jsx("path",{d:n.path})}):i.jsx(pl,{className:t?"size-3.5":"size-4"})})}const LU={bun:kU,cargo:k2,deno:NU,dotnet:SU,docker:CU,generic:null,go:EU,node:jU,npm:AU,pnpm:TU,python:RU,rust:k2,vite:MU,yarn:DU};function ri({className:e,...t}){return i.jsx("label",{className:ae("grid gap-1.5 text-xs font-medium text-muted-foreground",e),...t})}const zU=[{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"}],N2=[{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 BU({result:e}){const t=[...e.stdout,...e.stderr].slice(0,4);return i.jsxs(Qe,{variant:e.ok?"default":"destructive",children:[i.jsx("div",{className:"font-medium",children:e.ok?"Command test passed":"Command test failed"}),i.jsx("div",{className:"mt-1 text-xs",children:e.message}),t.length?i.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(`
88
- `)}):null]})}async function PU(e,t,s,n){if(t==="bundle"){if(e==="start")return Mw(s,()=>n?.());if(e==="stop")return Tw(s);await Tw(s),await Mw(s,()=>n?.());return}return e==="start"?MO(s):e==="stop"?DO(s):WC(s)}function Kb({active:e,baseUrl:t,compact:s=!1,onRefresh:n,onStarted:o,resourceKind:l,resourceName:u,solidStart:h=!1,targetLabel:f}){return e?i.jsxs(i.Fragment,{children:[i.jsx(wg,{baseUrl:t,compact:s,intent:"restart",icon:i.jsx(gf,{}),label:"Restart",op:"restart",resourceKind:l,resourceName:u,targetLabel:f,onRefresh:n,onSuccess:o}),i.jsx(wg,{baseUrl:t,compact:s,intent:"stop",icon:i.jsx(ro,{}),label:"Stop",op:"stop",resourceKind:l,resourceName:u,targetLabel:f,onRefresh:n})]}):i.jsx(wg,{baseUrl:t,compact:s,intent:h?"startSolid":"start",icon:i.jsx(Tr,{}),label:"Start",op:"start",resourceKind:l,resourceName:u,targetLabel:f,onRefresh:n,onSuccess:o})}function Wh(e,t,s){const n=s instanceof Error?s.message:String(s);return`${e} failed for ${t}: ${n}`}function wg({baseUrl:e,compact:t=!1,intent:s="neutral",icon:n,label:o,op:l,resourceKind:u,resourceName:h,targetLabel:f,onRefresh:d,onSuccess:p}){const[g,x]=_.useState(!1),[v,w]=_.useState(null),{error:k,success:N}=as();async function E(A=!1){x(!0);try{A?await Ai(`${e}/start`,{strategy:"killHolder"}):await PU(l,u,h,()=>d()),N(`${o} requested for ${f}.`),await d(),w(null),p?.()}catch(C){C instanceof RC?w(C.conflict):k(Wh(o,f,C))}finally{x(!1)}}const T=i.jsxs(J,{"aria-label":o,className:`${$U[s]} ${t?"size-7":""}`.trim(),disabled:g,onClick:()=>E(),size:t?"icon":"sm",variant:"outline",children:[n,t?null:o]});return i.jsxs(i.Fragment,{children:[t?i.jsx(al,{label:o,children:T}):T,v?i.jsx(IU,{busy:g,conflict:v,onCancel:()=>w(null),onKillAndStart:()=>E(!0),targetLabel:f}):null]})}function IU({busy:e,conflict:t,onCancel:s,onKillAndStart:n,targetLabel:o}){const l=t.holder,u=`http://localhost:${t.port}/`;return i.jsx(Vn,{icon:i.jsx(TC,{}),onClose:e?()=>{}:s,title:`Port ${t.port} is already in use`,children:i.jsxs("div",{className:"space-y-3 p-4 text-sm",children:[i.jsxs("p",{children:[i.jsx("span",{className:"font-medium",children:o})," wants port"," ",i.jsx("span",{className:"font-mono",children:t.port}),", but it's already held by:"]}),i.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})`:""}
89
- ${l.command}`:"unknown process"}),i.jsxs("div",{className:"flex flex-wrap justify-end gap-2 pt-2",children:[i.jsx(J,{onClick:s,size:"sm",type:"button",variant:"outline",disabled:e,children:"Cancel"}),i.jsxs(J,{onClick:()=>{_f(u)},size:"sm",type:"button",variant:"outline",disabled:e,children:[i.jsx(io,{}),"Open in browser"]}),i.jsx(J,{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 $U={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 HU({cwd:e,onRefresh:t,onSaved:s,initialService:n}){const{error:o,success:l}=as(),u=!!n,[h,f]=_.useState(n?.kind??"local"),[d,p]=_.useState(n?.name??""),[g,x]=_.useState(n?.command??""),[v,w]=_.useState(n?.cwd??e),[k,N]=_.useState(n?.port?String(n.port):""),[E,T]=_.useState(n?.description??""),[A,C]=_.useState(n?.composeFile??""),[R,D]=_.useState(n?.composeService??""),[$,O]=_.useState(n?.host??""),[P,B]=_.useState(n?.dependsOn??[]),[G,F]=_.useState(null),[z,U]=_.useState(!1);_.useEffect(()=>{F(null)},[g,v,k,h]);function K(){p(""),x(""),w(e),N(""),T(""),C(""),D(""),O(""),B([]),F(null)}async function I(W){W.preventDefault();try{const te={name:d,kind:h,cwd:v,port:k,description:E};(h==="local"||h==="ssh")&&(te.command=g),h==="docker-compose"&&(te.composeFile=A,te.composeService=R),h==="ssh"&&(te.host=$),te.dependsOn=P.filter(X=>X!==d).join(","),await Ai("/api/services",te),u||K(),l(u?`${d} updated.`:`${d} added.`),await t(),s?.()}catch(te){o(Wh(u?"Update service":"Add service",d||"service",te))}}async function Z(){if(!g.trim()){o("Test command failed for service: command is required.");return}U(!0);try{F(await HO({command:g,cwd:v,port:k}))}catch(W){o(Wh("Test command",d||"service",W))}finally{U(!1)}}return{editing:u,kind:h,setKind:f,name:d,setName:p,command:g,setCommand:x,formCwd:v,setFormCwd:w,port:k,setPort:N,description:E,setDescription:T,composeFile:A,setComposeFile:C,composeService:R,setComposeService:D,host:$,setHost:O,dependsOn:P,setDependsOn:B,testResult:G,testing:z,submit:I,testCommand:Z}}function C2({cwd:e,onRefresh:t,onSaved:s,initialService:n,availableServices:o=[]}){const{editing:l,kind:u,setKind:h,name:f,setName:d,command:p,setCommand:g,formCwd:x,setFormCwd:v,port:w,setPort:k,description:N,setDescription:E,composeFile:T,setComposeFile:A,composeService:C,setComposeService:R,host:D,setHost:$,dependsOn:O,setDependsOn:P,testResult:B,testing:G,submit:F,testCommand:z}=HU({cwd:e,onRefresh:t,onSaved:s,initialService:n}),U=N2.find(X=>X.value===u),K=o.filter(X=>X!==f),I=X=>P(V=>V.includes(X)?V.filter(q=>q!==X):[...V,X]),Z=u==="local"&&p.trim().length>0&&x.trim().length>0,W="grid gap-2 rounded-md border border-border bg-muted/30 p-3",te="px-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground";return i.jsxs("form",{className:"grid gap-3",onSubmit:F,children:[i.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[i.jsxs("fieldset",{className:`${W} sm:col-span-2`,children:[i.jsx("legend",{className:te,children:"Step 1 · Service kind"}),i.jsx("div",{className:"grid grid-cols-3 gap-1.5",children:N2.map(X=>i.jsx(J,{className:"justify-center",disabled:l,onClick:()=>h(X.value),size:"sm",type:"button",variant:u===X.value?"default":"outline",children:X.label},X.value))}),i.jsx("p",{className:"text-[11px] text-muted-foreground",children:U.hint})]}),i.jsxs("div",{className:"grid gap-3 sm:col-start-1 sm:row-start-2 sm:self-start",children:[i.jsxs("fieldset",{className:W,children:[i.jsx("legend",{className:te,children:"Step 2 · Identity"}),i.jsxs(ri,{children:["Name",i.jsx(dt,{className:"h-8 text-sm",name:"name",onChange:X=>d(X.target.value),placeholder:"backend",readOnly:l,required:!0,value:f}),l?i.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Name is the service key and can't be changed here."}):null]}),i.jsxs(ri,{children:["Description",i.jsx(dt,{className:"h-8 text-sm",name:"description",onChange:X=>E(X.target.value),placeholder:"API server",value:N})]})]}),i.jsxs("fieldset",{className:W,children:[i.jsx("legend",{className:te,children:"Step 4 · Networking (optional)"}),i.jsxs(ri,{children:["Port",i.jsx(dt,{className:"h-8 text-sm",inputMode:"numeric",name:"port",onChange:X=>k(X.target.value),placeholder:"3001",value:w})]})]})]}),u==="local"?i.jsxs("fieldset",{className:`${W} sm:col-start-2 sm:row-start-2 sm:self-start`,children:[i.jsx("legend",{className:te,children:"Step 3 · Local command"}),i.jsx("div",{className:"grid grid-cols-2 gap-1.5 sm:grid-cols-4",children:zU.map(X=>i.jsxs(J,{className:"justify-start gap-1.5",onClick:()=>{g(X.command),E(X.description)},size:"sm",type:"button",variant:"outline",children:[i.jsx(Wb,{command:X.badgeCommand??X.command,compact:!0}),i.jsx("span",{className:"truncate",children:X.label})]},X.label))}),i.jsxs(ri,{children:["Command",i.jsx(dt,{className:"h-8 font-mono text-sm",name:"command",onChange:X=>g(X.target.value),placeholder:"npm run dev",required:!0,value:p})]}),i.jsxs(ri,{children:["Working Directory",i.jsx(dt,{className:"h-8 font-mono text-sm",name:"cwd",onChange:X=>v(X.target.value),required:!0,value:x})]})]}):null,u==="docker-compose"?i.jsxs("fieldset",{className:`${W} sm:col-start-2 sm:row-start-2 sm:self-start`,children:[i.jsx("legend",{className:te,children:"Step 3 · Docker Compose target"}),i.jsxs(ri,{children:["Compose Service",i.jsx(dt,{className:"h-8 font-mono text-sm",name:"composeService",onChange:X=>R(X.target.value),placeholder:"api",required:!0,value:C})]}),i.jsxs(ri,{children:["Compose File (optional)",i.jsx(dt,{className:"h-8 font-mono text-sm",name:"composeFile",onChange:X=>A(X.target.value),placeholder:"docker-compose.yml",value:T})]}),i.jsxs(ri,{children:["Working Directory (where compose file lives)",i.jsx(dt,{className:"h-8 font-mono text-sm",name:"cwd",onChange:X=>v(X.target.value),required:!0,value:x})]})]}):null,u==="ssh"?i.jsxs("fieldset",{className:`${W} sm:col-start-2 sm:row-start-2 sm:self-start`,children:[i.jsx("legend",{className:te,children:"Step 3 · SSH connection"}),i.jsxs(ri,{children:["SSH Host (alias from ~/.ssh/config)",i.jsx(dt,{className:"h-8 font-mono text-sm",name:"host",onChange:X=>$(X.target.value),placeholder:"devbox",required:!0,value:D})]}),i.jsxs(ri,{children:["Remote Command",i.jsx(dt,{className:"h-8 font-mono text-sm",name:"command",onChange:X=>g(X.target.value),placeholder:"npm run dev",required:!0,value:p})]}),i.jsxs(ri,{children:["Remote Working Directory",i.jsx(dt,{className:"h-8 font-mono text-sm",name:"cwd",onChange:X=>v(X.target.value),placeholder:"/srv/app",required:!0,value:x})]}),i.jsxs(Qe,{variant:"muted",children:[i.jsx("div",{className:"font-medium",children:"SSH key handling"}),i.jsxs("div",{className:"mt-1 text-xs",children:["NoMoreIDE never stores key files. Add a ",i.jsxs("code",{children:["Host ",D||"&lt;alias&gt;"]})," entry to",i.jsx("code",{children:" ~/.ssh/config"})," with ",i.jsx("code",{children:"HostName"}),", ",i.jsx("code",{children:"User"}),", and"," ",i.jsx("code",{children:"IdentityFile ~/.ssh/your-key.pem"})," (chmod 0600). Make sure"," ",i.jsx("code",{children:"ssh-agent"})," is running or your key is loaded (",i.jsx("code",{children:"ssh-add ~/.ssh/your-key.pem"}),"). NoMoreIDE will run"," ",i.jsxs("code",{children:["ssh ",D||"&lt;alias&gt;"]})," using that config."]})]})]}):null,K.length>0?i.jsxs("fieldset",{className:`${W} sm:col-span-2`,children:[i.jsx("legend",{className:te,children:"Step 5 · Dependencies (optional)"}),i.jsx("p",{className:"text-[11px] text-muted-foreground",children:"When this service runs as part of a group, the selected services start first — and NoMoreIDE waits for each to come up before this one."}),i.jsx("div",{className:"flex flex-wrap gap-1.5",children:K.map(X=>i.jsx(J,{className:"h-7 px-2.5 text-xs",onClick:()=>I(X),size:"sm",type:"button",variant:O.includes(X)?"default":"outline",children:X},X))})]}):null]}),B?i.jsx(BU,{result:B}):null,i.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[u==="local"?i.jsxs(J,{disabled:G||!Z,onClick:z,type:"button",variant:"outline",children:[i.jsx(pl,{}),G?"Testing...":"Test Command"]}):null,i.jsx(J,{type:"submit",children:l?"Save Service":"Add Service"})]})]})}function mj({initialName:e="",initialServices:t=[],onSaved:s,onRefresh:n,originalName:o,services:l,submitLabel:u="Save Group"}){const{error:h,success:f}=as();async function d(p){p.preventDefault();const g=p.currentTarget,x=new FormData(g),v=String(x.get("name")??""),w=x.getAll("services").map(k=>String(k)).filter(Boolean);try{await Ai("/api/bundles",{name:v,originalName:o,services:w.join(",")}),g.reset(),f(`${v} group saved.`),await n(),s?.()}catch(k){h(Wh("Save group",v||"group",k))}}return i.jsxs("form",{className:"grid gap-2.5",onSubmit:d,children:[i.jsxs(ri,{children:["Group name",i.jsx(dt,{className:"h-8 text-sm",defaultValue:e,name:"name",placeholder:"full-stack",required:!0})]}),i.jsxs("fieldset",{className:"grid gap-1.5",children:[i.jsx("legend",{className:"text-xs font-medium",children:"Services"}),l.length?l.map(p=>i.jsxs("label",{className:"flex items-center gap-2 overflow-hidden rounded-md border border-border px-2.5 py-1.5 text-sm",children:[i.jsx("input",{className:"size-4 shrink-0 accent-primary",defaultChecked:t.includes(p.name),name:"services",type:"checkbox",value:p.name}),i.jsx(Wb,{command:p.command??"",compact:!0}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block truncate text-sm font-medium",children:p.name}),i.jsx("span",{className:"block truncate font-mono text-[11px] text-muted-foreground",children:p.command??p.kind??""})]})]},p.name)):i.jsx(Qe,{variant:"muted",children:"All services are already grouped, or none registered."})]}),i.jsx(J,{className:"h-8",disabled:!l.length,type:"submit",children:u})]})}function UU({allServices:e,group:t,onRefresh:s,ports:n,services:o,health:l,statuses:u,timeline:h,selectedService:f,onSelectService:d,onDropService:p}){const[g,x]=_.useState(!1),[v,w]=_.useState(!1),[k,N]=_.useState(!1),E=o.some(C=>Gc(u[C.name]?.state));function T(C){!p||!C.dataTransfer.types.includes(nu)||(C.preventDefault(),C.dataTransfer.dropEffect="copy",N(!0))}function A(C){if(!p)return;C.preventDefault(),N(!1);const R=C.dataTransfer.getData(nu);R&&p(R)}return i.jsxs("section",{className:ae("transition-colors",k&&"bg-primary/5 outline-dashed outline-2 -outline-offset-2 outline-primary/60"),onDragOver:T,onDragLeave:()=>N(!1),onDrop:A,children:[i.jsxs("div",{className:"flex items-center gap-1.5 bg-muted/35 px-3 py-1.5",children:[i.jsxs("button",{"aria-expanded":!v,className:"flex min-w-0 flex-1 cursor-pointer items-center gap-1.5 text-left",onClick:()=>w(C=>!C),type:"button",children:[i.jsx(Wn,{className:ae("size-3.5 shrink-0 text-muted-foreground transition-transform",v&&"-rotate-90")}),i.jsx("span",{className:"truncate text-sm font-medium",children:t.name}),t.services.length?i.jsx(Ge,{size:"small",variant:"secondary",children:t.services.length}):null]}),i.jsx(al,{label:"Edit group",children:i.jsx(J,{"aria-expanded":g,"aria-label":`Edit ${t.name}`,className:"size-7",onClick:()=>x(C=>!C),size:"icon",type:"button",variant:"ghost",children:i.jsx(dl,{})})}),i.jsx(Kb,{active:E,baseUrl:`/api/bundles/${encodeURIComponent(t.name)}`,compact:!0,resourceKind:"bundle",resourceName:t.name,solidStart:!0,targetLabel:`group ${t.name}`,onRefresh:s,onStarted:()=>{const C=o[0];C&&d(C.name)}})]}),g?i.jsx("div",{className:"border-t border-border bg-background/65 p-3",children:i.jsx(mj,{initialName:t.name,initialServices:t.services,onRefresh:s,onSaved:()=>x(!1),originalName:t.name,services:e,submitLabel:"Save Group"})}):null,v?null:i.jsx("div",{className:"divide-y divide-border border-t border-border bg-background/45",children:o.length?o.map(C=>i.jsx(pj,{service:C,status:u[C.name],health:l[C.name],ports:n,onRefresh:s,timeline:h,selected:f===C.name,onSelect:()=>d(C.name)},C.name)):i.jsx(Qe,{variant:"muted",className:"m-4",children:"This group does not match any registered services."})})]})}function pj({service:e,status:t,onRefresh:s,selected:n=!1,onSelect:o}){const l=t?.state??"stopped",u=Gc(l),[h,f]=_.useState(!1);return i.jsxs("div",{"aria-selected":n,draggable:!0,onDragStart:d=>{d.dataTransfer.setData(nu,e.name),e.cwd&&hj(d.dataTransfer,e.cwd),d.dataTransfer.effectAllowed="copyMove",f(!0)},onDragEnd:()=>f(!1),className:ae("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:[i.jsx(Wb,{command:e.command??""}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("div",{className:"truncate text-sm font-medium",children:e.name}),i.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[i.jsx(FU,{kind:e.kind}),e.port?i.jsxs("span",{children:[":",e.port]}):null]})]}),i.jsx(VU,{state:l}),i.jsx("span",{className:"flex items-center gap-1",onClick:d=>d.stopPropagation(),children:i.jsx(Kb,{active:u,baseUrl:`/api/services/${encodeURIComponent(e.name)}`,compact:!0,resourceKind:"service",resourceName:e.name,targetLabel:e.name,onRefresh:s,onStarted:o})})]})}const nu="application/x-nomoreide-service",E2={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 FU({kind:e}){const t=E2[e??"local"]??E2.local;return i.jsx("span",{className:ae("rounded border px-1 py-px text-[9px] font-semibold uppercase leading-none tracking-wide",t.className),children:t.label})}function Gc(e){return e==="running"||e==="starting"}function qU(e){return`http://127.0.0.1:${e}`}const j2={running:{className:"bg-emerald-500"},starting:{className:"bg-amber-500",pulse:!0},exited:{className:"bg-red-500"},stopped:{className:"bg-muted-foreground/40"}};function VU({state:e}){const t=j2[e]??j2.stopped;return i.jsxs("span",{className:"relative flex size-2.5 items-center justify-center",title:e,children:[t.pulse&&i.jsx("span",{className:ae("absolute inline-flex size-full animate-ping rounded-full opacity-60",t.className)}),i.jsx("span",{className:ae("relative inline-flex size-2 rounded-full",t.className)})]})}function gj({state:e}){return i.jsx(Ge,{variant:e==="running"?"success":e==="exited"?"danger":e==="starting"?"warning":"outline",className:ae(e==="running"&&"font-mono"),children:e})}function GU({data:e}){const[t,s]=_.useState(!1),[n,o]=_.useState(()=>u2()),[l,u]=_.useState(""),[h,f]=_.useState([]),[d,p]=_.useState([]),[g,x]=_.useState(null),{sendToAgent:v}=At();_.useEffect(()=>{if(!t)return;let A=!0;return x(null),Promise.allSettled([BC(),$C(20)]).then(C=>{if(!A)return;const[R,D]=C;R.status==="fulfilled"&&f(R.value),D.status==="fulfilled"&&p(D.value),C.filter(O=>O.status==="rejected").length&&x("Some AI context could not be loaded. You can still send available context.")}),()=>{A=!1}},[t]);const w=_.useMemo(()=>WU(e),[e]),k=hH(n),N=_.useMemo(()=>n.serviceNames.length+n.databaseNames.length+n.errorIds.length+n.repositoryPaths.length,[n]);function E(A,C){o(R=>{const D=R[A],$=D.includes(C)?D.filter(O=>O!==C):[...D,C];return{...R,[A]:$}})}function T(){k&&(v({prompt:fH({dashboard:e,databases:h,incidents:d,note:l,selection:n}),source:{type:"workspace-context",label:"AI Diagnose"},label:mH({note:l,selection:n})}),s(!1),u(""),o(u2()))}return i.jsxs(i.Fragment,{children:[i.jsxs("button",{"aria-label":"Open AI Diagnose",className:Fh(),onClick:()=>s(!0),title:"Open AI Diagnose",type:"button",children:[i.jsx("span",{className:qh(),children:i.jsx(qt,{className:"size-4"})}),i.jsx("span",{className:Vh(),children:"Diagnose"})]}),t?i.jsx(Vn,{icon:i.jsx(qt,{}),onClose:()=>s(!1),size:"xl",title:"AI Diagnose",children:i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[i.jsxs("div",{children:[i.jsx("div",{className:"text-sm font-medium",children:"Pick the context the agent should inspect"}),i.jsx("div",{className:"text-xs text-muted-foreground",children:"Combine services, databases, incidents, and repositories into one focused prompt."})]}),i.jsxs(Ge,{variant:N?"secondary":"outline",children:[N," selected"]})]}),g?i.jsx(Qe,{variant:"muted",children:g}):null,i.jsxs("div",{className:"grid min-h-0 gap-3 overflow-hidden lg:grid-cols-4",children:[i.jsx(Xd,{count:e.config.services.length,icon:i.jsx(fb,{}),title:"Services",children:i.jsx("div",{className:"grid gap-2",children:e.config.services.map(A=>{const C=n.serviceNames.includes(A.name),R=e.runtime.services[A.name],D=e.health[A.name];return i.jsxs(Zd,{selected:C,onClick:()=>E("serviceNames",A.name),children:[i.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[i.jsx("span",{className:"min-w-0 flex-1 truncate font-semibold",children:A.name}),i.jsx("span",{className:"shrink-0",children:i.jsx(gj,{state:R?.state??"stopped"})})]}),i.jsxs("span",{className:"mt-1 flex flex-wrap gap-1.5 text-[11px] text-muted-foreground",children:[A.kind?i.jsx("span",{children:A.kind}):null,A.port?i.jsxs("span",{children:[":",A.port]}):null,D?.status?i.jsx("span",{children:D.status}):null]})]},A.name)})})}),i.jsx(Xd,{count:h.length,icon:i.jsx(di,{}),title:"Databases",children:h.length?i.jsx("div",{className:"grid gap-2",children:h.map(A=>i.jsxs(Zd,{selected:n.databaseNames.includes(A.name),onClick:()=>E("databaseNames",A.name),children:[i.jsx("span",{className:"truncate font-semibold",children:A.name}),i.jsx("span",{className:"mt-1 block truncate text-[11px] text-muted-foreground",children:A.engine})]},A.name))}):i.jsx(A2,{text:"No database connections detected."})}),i.jsx(Xd,{count:d.length,icon:i.jsx(Zc,{}),title:"Error Inbox",children:d.length?i.jsx("div",{className:"grid gap-2",children:d.map(A=>i.jsxs(Zd,{selected:n.errorIds.includes(A.id),onClick:()=>E("errorIds",A.id),children:[i.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[i.jsx("span",{className:"min-w-0 flex-1 truncate font-semibold",children:A.title}),i.jsx(Ge,{appearance:"subtle",size:"small",variant:A.level==="error"?"danger":"secondary",children:A.level})]}),i.jsxs("span",{className:"mt-1 block min-w-0 truncate font-mono text-[11px] text-muted-foreground",children:[A.service," x",A.count]})]},A.id))}):i.jsx(A2,{text:"No recent incidents."})}),i.jsx(Xd,{count:w.length,icon:i.jsx(Gn,{}),title:"Git Repositories",children:i.jsx("div",{className:"grid gap-2",children:w.map(A=>{const C=n.repositoryPaths.includes(A.path),R=A.path===(e.git.selectedRepository?.path??e.git.cwd),D=R?e.git.status?.files.length??0:void 0;return i.jsxs(Zd,{selected:C,onClick:()=>E("repositoryPaths",A.path),children:[i.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[i.jsx("span",{className:"min-w-0 flex-1 truncate font-semibold",children:A.name}),R?i.jsx(Ge,{className:"shrink-0",size:"small",variant:"outline",children:"current"}):null]}),i.jsx("span",{className:"mt-1 block min-w-0 truncate font-mono text-[11px] text-muted-foreground",children:A.path}),D!==void 0?i.jsx("span",{className:"mt-1 block truncate text-[11px] text-muted-foreground",children:D?`${D} changed file${D===1?"":"s"}`:"No changed files"}):null]},A.path)})})})]}),i.jsxs("label",{className:"block space-y-2",children:[i.jsx("span",{className:"text-sm font-medium",children:"Extra context"}),i.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:A=>u(A.target.value),placeholder:"Example: checkout is failing after login, API exits when DB is selected...",value:l})]}),i.jsxs("div",{className:"flex items-center justify-end gap-2",children:[i.jsx(J,{onClick:()=>s(!1),type:"button",variant:"outline",children:"Cancel"}),i.jsxs(J,{className:"gap-2",disabled:!k,onClick:T,type:"button",children:[i.jsx(AM,{className:"size-4"}),"Send"]})]})]})}):null]})}function Xd({children:e,count:t,icon:s,title:n}){return i.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:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-sm font-semibold",children:[i.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}),i.jsx("span",{className:"min-w-0 flex-1 truncate",children:n}),i.jsx(Ge,{className:"shrink-0",size:"small",variant:"outline",children:t})]}),i.jsx("div",{className:"min-h-0 flex-1 overflow-auto pr-1",children:e})]})}function Zd({children:e,onClick:t,selected:s}){return i.jsx("button",{"aria-pressed":s,className:ae("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 A2({text:e}){return i.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 WU(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}]}async function Yb({prompt:e,provider:t,autoApprove:s=!1,signal:n}){let o="",l,u,h,f=!1;const d=[],p=new AbortController,g=()=>p.abort(n?.reason);n?.aborted?g():n?.addEventListener("abort",g,{once:!0});const x=w=>{if(w.type==="session")l=w.sessionId;else if(w.type==="text")o+=w.text;else if(w.type==="error")u=new Error(w.message);else if(w.type==="approval_request"){const k=l?QD(l,w.requestId,s?"allow":"deny"):Promise.reject(new Error("Agent requested approval before starting a session"));d.push(k.catch(N=>{f||(f=!0,h=N),p.abort()}))}};let v;try{await JD(e,void 0,x,p.signal,s,t)}catch(w){v=w}finally{await Promise.allSettled(d),n?.removeEventListener("abort",g)}if(f)throw h;if(v)throw v;if(u)throw u;return o.trim()}function KU(e){const t=ZU(e.capabilities);return t?`${e.prompt}
90
-
91
- ${t}`:e.prompt}function YU({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:",QU(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(`
92
- `)}function XU({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(`
93
- `)}function ZU(e){if(!e)return"";const t=[Qd("Skills",e.skills),Qd("MCP servers",e.mcpServers),Qd("Plugins",e.plugins),Qd("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(`
94
- `):""}function Qd(e,t){const s=Array.from(new Set((t??[]).map(n=>n.trim()).filter(Boolean)));return s.length?`- ${e}: ${s.join(", ")}`:""}function QU(e){return e.kind==="agent"?e.prompt:e.kind==="gate"?`Gate: ${e.message}`:`Action: ${e.op}`}const T2=/^[ \t>*_-]*WORKFLOW_STATUS:\s*(ok|blocked)\b[ \t]*[—–:-]?[ \t]*(.*)$/im,JU=/^[ \t>*_-]*BRANCH_NAME:\s*`?([A-Za-z0-9][A-Za-z0-9._/-]{0,127})`?\s*$/im,eF=/^[A-Za-z0-9][A-Za-z0-9._/-]{0,127}$/;function tF(e){const t=e.match(T2);if(t){const s=t[1].toLowerCase()==="blocked",n=t[2]?.trim()||void 0;return{output:e.replace(T2,"").trim(),blocked:s,reason:s?n:void 0}}return{output:e,blocked:sF(e)}}function sF(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 nF(e){const t=e.match(JU);if(t&&R2(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(R2(o))return o}return null}function R2(e){return!(!eF.test(e)||e==="main"||e==="master"||e.includes("..")||e.endsWith(".")||e.endsWith("/"))}const iF="\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 rF(e){const{provider:t}=At(),[s,n]=_.useState(null),o=_.useRef(s);_.useEffect(()=>{o.current=s},[s]);const l=_.useRef(!1),u=_.useRef(!1),h=_.useRef(null),f=_.useRef(null),d=_.useRef(!0);_.useEffect(()=>(d.current=!0,u.current=!1,()=>{d.current=!1,u.current=!0,l.current=!1,f.current?.abort(),f.current=null,h.current?.("stop"),h.current=null}),[]);const p=_.useCallback(()=>new Promise(C=>{h.current=C}),[]),g=_.useCallback(async C=>{const R=await sg();return C==="committed"?R.files.length===0:C==="pushed"?R.ahead===0:!0},[]),x=_.useCallback(async(C,R,D)=>{if(C.op==="assert-pr-branch"){lF(await sg());return}if(C.op==="push"){await yf();return}if(C.op==="checkout-default-and-pull"){await W7();return}if(C.op==="commit"){const $=await sg();if(!$.files.length)throw new Error("Nothing to commit — the working tree is clean.");const O=oF($.files);O.length&&await gb(O),await FC(aF(D,R,$.files));return}throw new Error(`Unknown action: ${C.op}`)},[]),v=_.useCallback(async(C,R,D)=>{if(l.current||!d.current)return;l.current=!0,u.current=!1;const $=D?.index??0,O=C.steps.map((F,z)=>D&&z<$?D.statuses[z]??"pending":"pending"),P=C.steps.map((F,z)=>D?.outputs[z]??""),B=(F,z,U)=>{O[F]=z,d.current&&n(K=>K&&{...K,index:F,statuses:[...O],outputs:[...P],...U})};if(!d.current)return;n({workflow:C,startedAt:D?.startedAt??Date.now(),index:$,statuses:[...O],outputs:[...P],error:null,outcome:"running"});const G=F=>{l.current=!1,d.current&&n(z=>z&&{...z,outcome:F,endedAt:Date.now()})};for(let F=$;F<C.steps.length;F++){const z=C.steps[F];if(z.kind==="gate"){B(F,"waiting");const Z=await p();if(h.current=null,Z==="stop"){B(F,"skipped"),G("stopped");return}B(F,Z==="skip"?"skipped":"done");continue}if(z.kind==="action"){B(F,"running");try{await x(z,F,P),B(F,"done"),d.current&&e?.()}catch(Z){if(z.op==="assert-pr-branch"){B(F,"blocked",{error:Sg(Z)}),G("blocked");return}B(F,"failed",{error:Sg(Z)}),G("failed");return}if(u.current)return G("stopped");continue}B(F,"running");const U=new AbortController;f.current=U;let K;try{K=await Yb({prompt:KU(z)+iF,provider:t?.id,autoApprove:R,signal:U.signal})}catch(Z){if(f.current=null,u.current||U.signal.aborted){G("stopped");return}B(F,"failed",{error:Sg(Z)}),G("failed");return}if(f.current=null,!d.current)return G("stopped");e?.();const I=tF(K);if(P[F]=I.output||"(no reply from agent)",I.blocked){B(F,"blocked",{error:I.reason?`Paused — ${I.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."}),G("blocked");return}if(z.verify&&!await g(z.verify).catch(()=>!1)){B(F,"failed",{error:z.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."}),G("failed");return}if(B(F,"done"),u.current)return G("stopped")}G("done")},[e,t?.id,x,g,p]),w=_.useCallback((C,R=!1)=>v(C,R),[v]),k=_.useCallback((C=!1)=>{const R=o.current;!R||R.outcome==="running"||l.current||v(R.workflow,C,{index:R.index,statuses:R.statuses,outputs:R.outputs,startedAt:R.startedAt})},[v]),N=_.useCallback(()=>h.current?.("approve"),[]),E=_.useCallback(()=>h.current?.("skip"),[]),T=_.useCallback(()=>{u.current=!0,f.current?.abort(),h.current?.("stop")},[]),A=_.useCallback(()=>{l.current||!d.current||n(null)},[]);return{run:s,start:w,resume:k,approve:N,skip:E,stop:T,dismiss:A,isRunning:!!s&&s.outcome==="running"}}function Sg(e){return e instanceof Error?e.message:String(e)}function aF(e,t,s){return e[t-1]?.trim()||uF(s)}function oF(e){return e.some(s=>s.index.trim()&&s.index!=="?")?[]:e.map(s=>s.path)}function lF(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(!cF(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 cF(e){return e==="main"||e==="master"}function uF(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 xj=_.createContext(null);function dF({onRefresh:e,children:t}){const s=rF(e);return i.jsx(xj.Provider,{value:s,children:t})}function bj(){const e=_.useContext(xj);if(!e)throw new Error("useWorkflowRun must be used within a WorkflowRunProvider");return e}const vj=_.createContext(null);function hF({children:e}){const{start:t,isRunning:s}=bj(),[n,o]=_.useState([]),[l,u]=_.useState([]),[h,f]=_.useState([]),[d,p]=_.useState(null),g=_.useRef(new Set),x=_.useCallback(E=>{u(T=>[E,...T.filter(A=>A.id!==E.id)])},[]);_.useEffect(()=>{let E=!0;Promise.all([mL().catch(()=>[]),ZC().catch(()=>[]),xL().catch(()=>[])]).then(([A,C,R])=>{E&&(o(Array.isArray(A)?A:[]),f(Array.isArray(C)?C:[]),u(Array.isArray(R)?R:[]))});const T=new EventSource("/api/workflow-triggers/pending/stream");return T.addEventListener("pending",A=>{try{x(JSON.parse(A.data))}catch{}}),()=>{E=!1,T.close()}},[x]);const v=_.useCallback(async E=>{u(T=>T.filter(A=>A.id!==E)),await bL(E).catch(()=>{})},[]),w=_.useCallback(E=>{const T=h.find(A=>A.id===E.workflowId);g.current.add(E.id),v(E.id),T?t(T,!0):p(`Trigger references a missing workflow: ${E.workflowId}`)},[h,t,v]);_.useEffect(()=>{if(s)return;const E=[...l].reverse().find(T=>T.autoRun&&!g.current.has(T.id));E&&w(E)},[l,s,w]);const k=_.useCallback(async E=>{try{o(await pL(E)),p(null)}catch(T){p(T instanceof Error?T.message:String(T))}},[]),N=_.useCallback(async E=>{try{o(await gL(E))}catch(T){p(T instanceof Error?T.message:String(T))}},[]);return i.jsx(vj.Provider,{value:{triggers:n,pending:l,workflows:h,error:d,saveTrigger:k,removeTrigger:N,runPending:w,dismissPending:v},children:e})}function fF(){const e=_.useContext(vj);if(!e)throw new Error("useWorkflowTriggers must be used within a WorkflowTriggerProvider");return e}function mF({git:e,onRefresh:t}){const{sendToAgent:s}=At(),[n,o]=_.useState(!1),[l,u]=_.useState(null),[h,f]=_.useState(null),d=e.status,p=d?.branch||void 0,g=d?.files.length??0,x=d?.ahead??0,v=d?.behind??0;_.useEffect(()=>{if(!p){f(null);return}let N=!0;return fh(p,1).then(E=>{if(!N)return;const T=E[0];f(T&&pF(T)?T:null)}).catch(()=>{N&&f(null)}),()=>{N=!1}},[p]);const w=_.useMemo(()=>g>0||x>0||v>0||!!h,[g,x,v,h]);if(!d||!w)return null;async function k(){o(!0),u(null);try{await yf(),t?.()}catch(N){u(N instanceof Error?N.message:String(N))}finally{o(!1)}}return i.jsx("div",{className:"mx-auto mb-2 w-full max-w-4xl",children:i.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:[i.jsxs("span",{className:"mr-0.5 inline-flex items-center gap-1 font-medium text-muted-foreground",children:[i.jsx(qt,{className:"size-3.5"}),p??"git"]}),g>0?i.jsx(Jd,{icon:i.jsx(e6,{className:"size-3"}),label:`Commit ${g} change${g===1?"":"s"}`,ai:!0,onClick:()=>s({prompt:nH({branch:p,fileCount:g}),source:{type:"git-situation",label:"uncommitted changes"},mode:"send",label:`Commit ${g} uncommitted change${g===1?"":"s"}`})}):null,v>0?i.jsx(Jd,{icon:i.jsx(cf,{className:"size-3"}),label:`Pull ${v} behind`,ai:!0,onClick:()=>s({prompt:iH({branch:p,behind:v,upstream:d.upstream}),source:{type:"git-situation",label:"behind upstream"},mode:"send",label:`Pull & rebase (${v} behind)`})}):null,x>0?i.jsx(Jd,{icon:n?i.jsx(jt,{className:"size-3 animate-spin"}):i.jsx(bf,{className:"size-3"}),label:`Push ${x}`,disabled:n,onClick:()=>{k()}}):null,h?i.jsx(Jd,{danger:!0,icon:i.jsx(Ar,{className:"size-3"}),label:"Fix failing CI",ai:!0,onClick:()=>s({prompt:rH({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?i.jsx("span",{className:"text-destructive",children:l}):null]})})}function Jd({ai:e,danger:t,disabled:s,icon:n,label:o,onClick:l}){return i.jsxs("button",{className:ae("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?i.jsx(qt,{className:"size-3 opacity-70"}):null]})}function pF(e){return e.status==="completed"&&e.conclusion!==null&&!["success","neutral","skipped"].includes(e.conclusion)}var gF=2,xF=1,bF=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,f=u.right+u.left,d=n-h,p=o-f-t;return{cols:Math.max(gF,Math.floor(p/e.css.cell.width)),rows:Math.max(xF,Math.floor(d/e.css.cell.height))}}};var _j=Object.defineProperty,vF=Object.getOwnPropertyDescriptor,_F=(e,t)=>{for(var s in t)_j(e,s,{get:t[s],enumerable:!0})},os=(e,t,s,n)=>{for(var o=n>1?void 0:n?vF(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&&_j(t,s,o),o},Fe=(e,t)=>(s,n)=>t(s,n,e),M2="Terminal input",s0={get:()=>M2,set:e=>M2=e},D2="Too much output to announce, navigate to rows manually to read",n0={get:()=>D2,set:e=>D2=e};function yF(e){return e.replace(/\r?\n/g,"\r")}function wF(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function SF(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function kF(e,t,s,n){if(e.stopPropagation(),e.clipboardData){let o=e.clipboardData.getData("text/plain");yj(o,t,s,n)}}function yj(e,t,s,n){e=yF(e),e=wF(e,s.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(e,!0),t.value=""}function wj(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 O2(e,t,s,n,o){wj(e,t,s),o&&n.rightClickSelect(e),t.value=n.selectionText,t.select()}function pa(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Rf(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 NF=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}},CF=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,f=0,d=0;if(this.interim[0]){let x=!1,v=this.interim[0];v&=(v&224)===192?31:(v&240)===224?15:7;let w=0,k;for(;(k=this.interim[++w]&63)&&w<4;)v<<=6,v|=k;let N=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,E=N-w;for(;d<E;){if(d>=s)return 0;if(k=e[d++],(k&192)!==128){d--,x=!0;break}else this.interim[w++]=k,v<<=6,v|=k&63}x||(N===2?v<128?d--:t[n++]=v:N===3?v<2048||v>=55296&&v<=57343||v===65279||(t[n++]=v):v<65536||v>1114111||(t[n++]=v)),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(f=(o&31)<<6|l&63,f<128){g--;continue}t[n++]=f}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(f=(o&15)<<12|(l&63)<<6|u&63,f<2048||f>=55296&&f<=57343||f===65279)continue;t[n++]=f}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(f=(o&7)<<18|(l&63)<<12|(u&63)<<6|h&63,f<65536||f>1114111)continue;t[n++]=f}}return n}},Sj="",xa=" ",gu=class kj{constructor(){this.fg=0,this.bg=0,this.extended=new Kh}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 kj;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}},Kh=class Nj{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 Nj(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},ui=class Cj extends gu{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Kh,this.combinedData=""}static fromCharData(t){let s=new Cj;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?pa(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()]}},L2="di$target",i0="di$dependencies",kg=new Map;function EF(e){return e[i0]||[]}function Fs(e){if(kg.has(e))return kg.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");jF(t,s,o)};return t._id=e,kg.set(e,t),t}function jF(e,t,s){t[L2]===t?t[i0].push({id:e,index:s}):(t[i0]=[{id:e,index:s}],t[L2]=t)}var fn=Fs("BufferService"),Ej=Fs("CoreMouseService"),fo=Fs("CoreService"),AF=Fs("CharsetService"),Xb=Fs("InstantiationService"),jj=Fs("LogService"),mn=Fs("OptionsService"),Aj=Fs("OscLinkService"),TF=Fs("UnicodeService"),xu=Fs("DecorationService"),r0=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 ui,u=s.getTrimmedLength(),h=-1,f=-1,d=!1;for(let p=0;p<u;p++)if(!(f===-1&&!s.hasContent(p))){if(s.loadCell(p,l),l.hasExtendedAttrs()&&l.extended.urlId)if(f===-1){f=p,h=l.extended.urlId;continue}else d=l.extended.urlId!==h;else f!==-1&&(d=!0);if(d||f!==-1&&p===u-1){let g=this._oscLinkService.getLinkData(h)?.uri;if(g){let x={start:{x:f+1,y:e},end:{x:p+(!d&&p===u-1?1:0),y:e}},v=!1;if(!o?.allowNonHttpProtocols)try{let w=new URL(g);["http:","https:"].includes(w.protocol)||(v=!0)}catch{v=!0}v||n.push({text:g,range:x,activate:(w,k)=>o?o.activate(w,k,x):RF(w,k),hover:(w,k)=>o?.hover?.(w,k,x),leave:(w,k)=>o?.leave?.(w,k,x)})}d=!1,l.hasExtendedAttrs()&&l.extended.urlId?(f=p,h=l.extended.urlId):(f=-1,h=-1)}}t(n)}};r0=os([Fe(0,fn),Fe(1,mn),Fe(2,Aj)],r0);function RF(e,t){if(confirm(`Do you want to navigate to ${t}?
95
-
96
- 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 Mf=Fs("CharSizeService"),Dr=Fs("CoreBrowserService"),Zb=Fs("MouseService"),Or=Fs("RenderService"),MF=Fs("SelectionService"),Tj=Fs("CharacterJoinerService"),_l=Fs("ThemeService"),Rj=Fs("LinkProviderService"),DF=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?z2.isErrorNoTelemetry(e)?new z2(e.message+`
97
-
98
- `+e.stack):new Error(e.message+`
99
-
100
- `+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)}},OF=new DF;function Sh(e){LF(e)||OF.onUnexpectedError(e)}var a0="Canceled";function LF(e){return e instanceof zF?!0:e instanceof Error&&e.name===a0&&e.message===a0}var zF=class extends Error{constructor(){super(a0),this.name=this.message}};function BF(e){return new Error(`Illegal argument: ${e}`)}var z2=class o0 extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof o0)return t;let s=new o0;return s.message=t.message,s.stack=t.stack,s}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},l0=class Mj extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,Mj.prototype)}};function $n(e,t=0){return e[e.length-(1+t)]}var PF;(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})(PF||={});function IF(e,t){let s=this,n=!1,o;return function(){return n||(n=!0,t||(o=e.apply(s,arguments))),o}}var Dj;(e=>{function t(C){return C&&typeof C=="object"&&typeof C[Symbol.iterator]=="function"}e.is=t;let s=Object.freeze([]);function n(){return s}e.empty=n;function*o(C){yield C}e.single=o;function l(C){return t(C)?C:o(C)}e.wrap=l;function u(C){return C||s}e.from=u;function*h(C){for(let R=C.length-1;R>=0;R--)yield C[R]}e.reverse=h;function f(C){return!C||C[Symbol.iterator]().next().done===!0}e.isEmpty=f;function d(C){return C[Symbol.iterator]().next().value}e.first=d;function p(C,R){let D=0;for(let $ of C)if(R($,D++))return!0;return!1}e.some=p;function g(C,R){for(let D of C)if(R(D))return D}e.find=g;function*x(C,R){for(let D of C)R(D)&&(yield D)}e.filter=x;function*v(C,R){let D=0;for(let $ of C)yield R($,D++)}e.map=v;function*w(C,R){let D=0;for(let $ of C)yield*R($,D++)}e.flatMap=w;function*k(...C){for(let R of C)yield*R}e.concat=k;function N(C,R,D){let $=D;for(let O of C)$=R($,O);return $}e.reduce=N;function*E(C,R,D=C.length){for(R<0&&(R+=C.length),D<0?D+=C.length:D>C.length&&(D=C.length);R<D;R++)yield C[R]}e.slice=E;function T(C,R=Number.POSITIVE_INFINITY){let D=[];if(R===0)return[D,C];let $=C[Symbol.iterator]();for(let O=0;O<R;O++){let P=$.next();if(P.done)return[D,e.empty()];D.push(P.value)}return[D,{[Symbol.iterator](){return $}}]}e.consume=T;async function A(C){let R=[];for await(let D of C)R.push(D);return Promise.resolve(R)}e.asyncToArray=A})(Dj||={});function ao(e){if(Dj.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 $F(...e){return Qt(()=>ao(e))}function Qt(e){return{dispose:IF(()=>{e()})}}var Oj=class Lj{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{ao(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?Lj.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)}};Oj.DISABLE_DISPOSED_WARNING=!1;var ba=Oj,mt=class{constructor(){this._store=new ba,this._store}dispose(){this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}};mt.None=Object.freeze({dispose(){}});var ml=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){this._isDisposed||t===this._value||(this._value?.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t}},Er=typeof window=="object"?window:globalThis,c0=class u0{constructor(t){this.element=t,this.next=u0.Undefined,this.prev=u0.Undefined}};c0.Undefined=new c0(void 0);var es=c0,B2=class{constructor(){this._first=es.Undefined,this._last=es.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===es.Undefined}clear(){let e=this._first;for(;e!==es.Undefined;){let t=e.next;e.prev=es.Undefined,e.next=es.Undefined,e=t}this._first=es.Undefined,this._last=es.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let s=new es(e);if(this._first===es.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!==es.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==es.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==es.Undefined&&e.next!==es.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===es.Undefined&&e.next===es.Undefined?(this._first=es.Undefined,this._last=es.Undefined):e.next===es.Undefined?(this._last=this._last.prev,this._last.next=es.Undefined):e.prev===es.Undefined&&(this._first=this._first.next,this._first.prev=es.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==es.Undefined;)yield e.element,e=e.next}},HF=globalThis.performance&&typeof globalThis.performance.now=="function",UF=class zj{static create(t){return new zj(t)}constructor(t){this._now=HF&&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}},Zs;(e=>{e.None=()=>mt.None;function t(F,z){return g(F,()=>{},0,void 0,!0,void 0,z)}e.defer=t;function s(F){return(z,U=null,K)=>{let I=!1,Z;return Z=F(W=>{if(!I)return Z?Z.dispose():I=!0,z.call(U,W)},null,K),I&&Z.dispose(),Z}}e.once=s;function n(F,z,U){return d((K,I=null,Z)=>F(W=>K.call(I,z(W)),null,Z),U)}e.map=n;function o(F,z,U){return d((K,I=null,Z)=>F(W=>{z(W),K.call(I,W)},null,Z),U)}e.forEach=o;function l(F,z,U){return d((K,I=null,Z)=>F(W=>z(W)&&K.call(I,W),null,Z),U)}e.filter=l;function u(F){return F}e.signal=u;function h(...F){return(z,U=null,K)=>{let I=$F(...F.map(Z=>Z(W=>z.call(U,W))));return p(I,K)}}e.any=h;function f(F,z,U,K){let I=U;return n(F,Z=>(I=z(I,Z),I),K)}e.reduce=f;function d(F,z){let U,K={onWillAddFirstListener(){U=F(I.fire,I)},onDidRemoveLastListener(){U?.dispose()}},I=new ze(K);return z?.add(I),I.event}function p(F,z){return z instanceof Array?z.push(F):z&&z.add(F),F}function g(F,z,U=100,K=!1,I=!1,Z,W){let te,X,V,q=0,le,ee={leakWarningThreshold:Z,onWillAddFirstListener(){te=F(ie=>{q++,X=z(X,ie),K&&!V&&(fe.fire(X),X=void 0),le=()=>{let Se=X;X=void 0,V=void 0,(!K||q>1)&&fe.fire(Se),q=0},typeof U=="number"?(clearTimeout(V),V=setTimeout(le,U)):V===void 0&&(V=0,queueMicrotask(le))})},onWillRemoveListener(){I&&q>0&&le?.()},onDidRemoveLastListener(){le=void 0,te.dispose()}},fe=new ze(ee);return W?.add(fe),fe.event}e.debounce=g;function x(F,z=0,U){return e.debounce(F,(K,I)=>K?(K.push(I),K):[I],z,void 0,!0,void 0,U)}e.accumulate=x;function v(F,z=(K,I)=>K===I,U){let K=!0,I;return l(F,Z=>{let W=K||!z(Z,I);return K=!1,I=Z,W},U)}e.latch=v;function w(F,z,U){return[e.filter(F,z,U),e.filter(F,K=>!z(K),U)]}e.split=w;function k(F,z=!1,U=[],K){let I=U.slice(),Z=F(X=>{I?I.push(X):te.fire(X)});K&&K.add(Z);let W=()=>{I?.forEach(X=>te.fire(X)),I=null},te=new ze({onWillAddFirstListener(){Z||(Z=F(X=>te.fire(X)),K&&K.add(Z))},onDidAddFirstListener(){I&&(z?setTimeout(W):W())},onDidRemoveLastListener(){Z&&Z.dispose(),Z=null}});return K&&K.add(te),te.event}e.buffer=k;function N(F,z){return(U,K,I)=>{let Z=z(new T);return F(function(W){let te=Z.evaluate(W);te!==E&&U.call(K,te)},void 0,I)}}e.chain=N;let E=Symbol("HaltChainable");class T{constructor(){this.steps=[]}map(z){return this.steps.push(z),this}forEach(z){return this.steps.push(U=>(z(U),U)),this}filter(z){return this.steps.push(U=>z(U)?U:E),this}reduce(z,U){let K=U;return this.steps.push(I=>(K=z(K,I),K)),this}latch(z=(U,K)=>U===K){let U=!0,K;return this.steps.push(I=>{let Z=U||!z(I,K);return U=!1,K=I,Z?I:E}),this}evaluate(z){for(let U of this.steps)if(z=U(z),z===E)break;return z}}function A(F,z,U=K=>K){let K=(...te)=>W.fire(U(...te)),I=()=>F.on(z,K),Z=()=>F.removeListener(z,K),W=new ze({onWillAddFirstListener:I,onDidRemoveLastListener:Z});return W.event}e.fromNodeEventEmitter=A;function C(F,z,U=K=>K){let K=(...te)=>W.fire(U(...te)),I=()=>F.addEventListener(z,K),Z=()=>F.removeEventListener(z,K),W=new ze({onWillAddFirstListener:I,onDidRemoveLastListener:Z});return W.event}e.fromDOMEventEmitter=C;function R(F){return new Promise(z=>s(F)(z))}e.toPromise=R;function D(F){let z=new ze;return F.then(U=>{z.fire(U)},()=>{z.fire(void 0)}).finally(()=>{z.dispose()}),z.event}e.fromPromise=D;function $(F,z){return F(U=>z.fire(U))}e.forward=$;function O(F,z,U){return z(U),F(K=>z(K))}e.runAndSubscribe=O;class P{constructor(z,U){this._observable=z,this._counter=0,this._hasChanged=!1;let K={onWillAddFirstListener:()=>{z.addObserver(this)},onDidRemoveLastListener:()=>{z.removeObserver(this)}};this.emitter=new ze(K),U&&U.add(this.emitter)}beginUpdate(z){this._counter++}handlePossibleChange(z){}handleChange(z,U){this._hasChanged=!0}endUpdate(z){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function B(F,z){return new P(F,z).emitter.event}e.fromObservable=B;function G(F){return(z,U,K)=>{let I=0,Z=!1,W={beginUpdate(){I++},endUpdate(){I--,I===0&&(F.reportChanges(),Z&&(Z=!1,z.call(U)))},handlePossibleChange(){},handleChange(){Z=!0}};F.addObserver(W),F.reportChanges();let te={dispose(){F.removeObserver(W)}};return K instanceof ba?K.add(te):Array.isArray(K)&&K.push(te),te}}e.fromObservableLight=G})(Zs||={});var d0=class h0{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${h0._idPool++}`,h0.all.add(this)}start(t){this._stopWatch=new UF,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}}};d0.all=new Set,d0._idPool=0;var FF=d0,qF=-1,Bj=class Pj{constructor(t,s,n=(Pj._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 f=new WF(h,l);this._errorHandler(f)}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}};Bj._idPool=1;var VF=Bj,GF=class Ij{constructor(t){this.value=t}static create(){let t=new Error;return new Ij(t.stack??"")}print(){console.warn(this.value.split(`
101
- `).slice(2).join(`
102
- `))}},WF=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},KF=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},YF=0,Ng=class{constructor(e){this.value=e,this.id=YF++}},XF=2,ZF,ze=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new VF(t?.onListenerError??Sh,this._options?.leakWarningThreshold??qF):void 0,this._perfMon=this._options?._profName?new FF(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??=(t,s,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let h=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(h);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],d=new KF(`${h}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(this._options?.onListenerError||Sh)(d),mt.None}if(this._disposed)return mt.None;s&&(t=t.bind(s));let o=new Ng(t),l;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(o.stack=GF.create(),l=this._leakageMon.check(o.stack,this._size+1)),this._listeners?this._listeners instanceof Ng?(this._deliveryQueue??=new QF,this._listeners=[this._listeners,o]):this._listeners.push(o):(this._options?.onWillAddFirstListener?.(this),this._listeners=o,this._options?.onDidAddFirstListener?.(this)),this._size++;let u=Qt(()=>{l?.(),this._removeListener(o)});return n instanceof ba?n.add(u):Array.isArray(n)&&n.push(u),u},this._event}_removeListener(t){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 s=this._listeners,n=s.indexOf(t);if(n===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,s[n]=void 0;let o=this._deliveryQueue.current===this;if(this._size*XF<=s.length){let l=0;for(let u=0;u<s.length;u++)s[u]?s[l++]=s[u]:o&&(this._deliveryQueue.end--,l<this._deliveryQueue.i&&this._deliveryQueue.i--);s.length=l}}_deliver(t,s){if(!t)return;let n=this._options?.onListenerError||Sh;if(!n){t.value(s);return}try{t.value(s)}catch(o){n(o)}}_deliverQueue(t){let s=t.current._listeners;for(;t.i<t.end;)this._deliver(s[t.i++],t.value);t.reset()}fire(t){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof Ng)this._deliver(this._listeners,t);else{let s=this._deliveryQueue;s.enqueue(this,t,this._listeners.length),this._deliverQueue(s)}this._perfMon?.stop()}hasListeners(){return this._size>0}},QF=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}},f0=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ze,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ze,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}};f0.INSTANCE=new f0;var Qb=f0;function JF(e,t,s){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",s)}Qb.INSTANCE.onDidChangeZoomLevel;function eq(e){return Qb.INSTANCE.getZoomFactor(e)}Qb.INSTANCE.onDidChangeFullscreen;var yl=typeof navigator=="object"?navigator.userAgent:"",m0=yl.indexOf("Firefox")>=0,tq=yl.indexOf("AppleWebKit")>=0,Jb=yl.indexOf("Chrome")>=0,sq=!Jb&&yl.indexOf("Safari")>=0;yl.indexOf("Electron/")>=0;yl.indexOf("Android")>=0;var Cg=!1;if(typeof Er.matchMedia=="function"){let e=Er.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Er.matchMedia("(display-mode: fullscreen)");Cg=e.matches,JF(Er,e,({matches:s})=>{Cg&&t.matches||(Cg=s)})}var rl="en",p0=!1,g0=!1,kh=!1,$j=!1,eh,Nh=rl,P2=rl,nq,Nr,no=globalThis,Un;typeof no.vscode<"u"&&typeof no.vscode.process<"u"?Un=no.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Un=process);var iq=typeof Un?.versions?.electron=="string",rq=iq&&Un?.type==="renderer";if(typeof Un=="object"){p0=Un.platform==="win32",g0=Un.platform==="darwin",kh=Un.platform==="linux",kh&&Un.env.SNAP&&Un.env.SNAP_REVISION,Un.env.CI||Un.env.BUILD_ARTIFACTSTAGINGDIRECTORY,eh=rl,Nh=rl;let e=Un.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);eh=t.userLocale,P2=t.osLocale,Nh=t.resolvedLanguage||rl,nq=t.languagePack?.translationsConfigFile}catch{}$j=!0}else typeof navigator=="object"&&!rq?(Nr=navigator.userAgent,p0=Nr.indexOf("Windows")>=0,g0=Nr.indexOf("Macintosh")>=0,(Nr.indexOf("Macintosh")>=0||Nr.indexOf("iPad")>=0||Nr.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,kh=Nr.indexOf("Linux")>=0,Nr?.indexOf("Mobi")>=0,Nh=globalThis._VSCODE_NLS_LANGUAGE||rl,eh=navigator.language.toLowerCase(),P2=eh):console.error("Unable to resolve platform.");var Hj=p0,Xi=g0,aq=kh,I2=$j,Ji=Nr,ua=Nh,oq;(e=>{function t(){return ua}e.value=t;function s(){return ua.length===2?ua==="en":ua.length>=3?ua[0]==="e"&&ua[1]==="n"&&ua[2]==="-":!1}e.isDefaultVariant=s;function n(){return ua==="en"}e.isDefault=n})(oq||={});var lq=typeof no.postMessage=="function"&&!no.importScripts;(()=>{if(lq){let e=[];no.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}),no.postMessage({vscodeScheduleAsyncWork:n},"*")}}return e=>setTimeout(e)})();var cq=!!(Ji&&Ji.indexOf("Chrome")>=0);Ji&&Ji.indexOf("Firefox")>=0;!cq&&Ji&&Ji.indexOf("Safari")>=0;Ji&&Ji.indexOf("Edg/")>=0;Ji&&Ji.indexOf("Android")>=0;var Zo=typeof navigator=="object"?navigator:{};I2||document.queryCommandSupported&&document.queryCommandSupported("copy")||Zo&&Zo.clipboard&&Zo.clipboard.writeText,I2||Zo&&Zo.clipboard&&Zo.clipboard.readText;var ev=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}},Eg=new ev,$2=new ev,H2=new ev,uq=new Array(230),Uj;(e=>{function t(h){return Eg.keyCodeToStr(h)}e.toString=t;function s(h){return Eg.strToKeyCode(h)}e.fromString=s;function n(h){return $2.keyCodeToStr(h)}e.toUserSettingsUS=n;function o(h){return H2.keyCodeToStr(h)}e.toUserSettingsGeneral=o;function l(h){return $2.strToKeyCode(h)||H2.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 Eg.keyCodeToStr(h)}e.toElectronAccelerator=u})(Uj||={});var dq=class Fj{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 Fj&&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 hq([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},hq=class{constructor(e){if(e.length===0)throw BF("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 fq(e){if(e.charCode){let s=String.fromCharCode(e.charCode).toUpperCase();return Uj.fromString(s)}let t=e.keyCode;if(t===3)return 7;if(m0)switch(t){case 59:return 85;case 60:if(aq)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Xi)return 57;break}else if(tq&&(Xi&&t===93||!Xi&&t===92))return 57;return uq[t]||0}var mq=Xi?256:2048,pq=512,gq=1024,xq=Xi?2048:256,U2=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=fq(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|=mq),this.altKey&&(t|=pq),this.shiftKey&&(t|=gq),this.metaKey&&(t|=xq),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new dq(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},F2=new WeakMap;function bq(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 vq=class{static getSameOriginWindowChain(e){let t=F2.get(e);if(!t){t=[],F2.set(e,t);let s=e,n;do n=bq(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}}},th=class{constructor(t,s){this.timestamp=Date.now(),this.browserEvent=s,this.leftButton=s.button===0,this.middleButton=s.button===1,this.rightButton=s.button===2,this.buttons=s.buttons,this.target=s.target,this.detail=s.detail||1,s.type==="dblclick"&&(this.detail=2),this.ctrlKey=s.ctrlKey,this.shiftKey=s.shiftKey,this.altKey=s.altKey,this.metaKey=s.metaKey,typeof s.pageX=="number"?(this.posx=s.pageX,this.posy=s.pageY):(this.posx=s.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=s.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=vq.getPositionOfChildWindowRelativeToAncestorWindow(t,s.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},q2=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(Jb){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?m0&&!Xi?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")sq&&Hj?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?m0&&!Xi?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()}},qj=Object.freeze(function(e,t){let s=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(s)}}}),_q;(e=>{function t(s){return s===e.None||s===e.Cancelled||s instanceof yq?!0:!s||typeof s!="object"?!1:typeof s.isCancellationRequested=="boolean"&&typeof s.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Zs.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:qj})})(_q||={});var yq=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?qj:(this._emitter||(this._emitter=new ze),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},tv=class{constructor(t,s){this._isDisposed=!1,this._token=-1,typeof t=="function"&&typeof s=="number"&&this.setIfNotSet(t,s)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(t,s){if(this._isDisposed)throw new l0("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,t()},s)}setIfNotSet(t,s){if(this._isDisposed)throw new l0("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,t()},s))}},wq=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 l0("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let n=s.setInterval(()=>{e()},t);this.disposable=Qt(()=>{s.clearInterval(n),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},Sq;(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})(Sq||={});var V2=class ai{static fromArray(t){return new ai(s=>{s.emitMany(t)})}static fromPromise(t){return new ai(async s=>{s.emitMany(await t)})}static fromPromises(t){return new ai(async s=>{await Promise.all(t.map(async n=>s.emitOne(await n)))})}static merge(t){return new ai(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 ze,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 Zs.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,s){return new ai(async n=>{for await(let o of t)n.emitOne(s(o))})}map(t){return ai.map(this,t)}static filter(t,s){return new ai(async n=>{for await(let o of t)s(o)&&n.emitOne(o)})}filter(t){return ai.filter(this,t)}static coalesce(t){return ai.filter(t,s=>!!s)}coalesce(){return ai.coalesce(this)}static async toPromise(t){let s=[];for await(let n of t)s.push(n);return s}toPromise(){return ai.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())}};V2.EMPTY=V2.fromArray([]);var{getWindow:Wi,getWindowId:kq,onDidRegisterWindow:Nq}=(function(){let e=new Map,t={window:Er,disposables:new ba};e.set(Er.vscodeWindowId,t);let s=new ze,n=new ze,o=new ze;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 mt.None;let h=new ba,f={window:u,disposables:h.add(new ba)};return e.set(u.vscodeWindowId,f),h.add(Qt(()=>{e.delete(u.vscodeWindowId),n.fire(u)})),h.add(at(u,Ps.BEFORE_UNLOAD,()=>{o.fire(u)})),s.fire(f),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 f=u;return f?.view?f.view.window:Er},getDocument(u){return Wi(u).document}}})(),Cq=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 at(e,t,s,n){return new Cq(e,t,s,n)}var G2=function(e,t,s,n){return at(e,t,s,n)},sv,Eq=class extends wq{constructor(e){super(),this.defaultTarget=e&&Wi(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){Sh(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)};sv=(l,u,h=0)=>{let f=kq(l),d=new W2(u,h),p=e.get(f);return p||(p=[],e.set(f,p)),p.push(d),s.get(f)||(s.set(f,!0),l.requestAnimationFrame(()=>o(f))),d}})();function jq(e){let t=e.getBoundingClientRect(),s=Wi(e);return{left:t.left+s.scrollX,top:t.top+s.scrollY,width:t.width,height:t.height}}var Ps={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"},Aq=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=En(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=En(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=En(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=En(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=En(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=En(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=En(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=En(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=En(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=En(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=En(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=En(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=En(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=En(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 En(e){return typeof e=="number"?`${e}px`:e}function Wc(e){return new Aq(e)}var Vj=class{constructor(){this._hooks=new ba,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(Qt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{l=Wi(e)}this._hooks.add(at(l,Ps.POINTER_MOVE,u=>{if(u.buttons!==s){this.stopMonitoring(!0);return}u.preventDefault(),this._pointerMoveCallback(u)})),this._hooks.add(at(l,Ps.POINTER_UP,u=>this.stopMonitoring(!0)))}};function Tq(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 Fi;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Fi||={});var Dc=class sn extends mt{constructor(){super(),this.dispatched=!1,this.targets=new B2,this.ignoreTargets=new B2,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Zs.runAndSubscribe(Nq,({window:t,disposables:s})=>{s.add(at(t.document,"touchstart",n=>this.onTouchStart(n),{passive:!1})),s.add(at(t.document,"touchend",n=>this.onTouchEnd(t,n))),s.add(at(t.document,"touchmove",n=>this.onTouchMove(n),{passive:!1}))},{window:Er,disposables:this._store}))}static addTarget(t){if(!sn.isTouchDevice())return mt.None;sn.INSTANCE||(sn.INSTANCE=new sn);let s=sn.INSTANCE.targets.push(t);return Qt(s)}static ignoreTarget(t){if(!sn.isTouchDevice())return mt.None;sn.INSTANCE||(sn.INSTANCE=new sn);let s=sn.INSTANCE.ignoreTargets.push(t);return Qt(s)}static isTouchDevice(){return"ontouchstart"in Er||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(Fi.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 f=this.activeTouches[h.identifier],d=Date.now()-f.initialTimeStamp;if(d<sn.HOLD_DELAY&&Math.abs(f.initialPageX-$n(f.rollingPageX))<30&&Math.abs(f.initialPageY-$n(f.rollingPageY))<30){let p=this.newGestureEvent(Fi.Tap,f.initialTarget);p.pageX=$n(f.rollingPageX),p.pageY=$n(f.rollingPageY),this.dispatchEvent(p)}else if(d>=sn.HOLD_DELAY&&Math.abs(f.initialPageX-$n(f.rollingPageX))<30&&Math.abs(f.initialPageY-$n(f.rollingPageY))<30){let p=this.newGestureEvent(Fi.Contextmenu,f.initialTarget);p.pageX=$n(f.rollingPageX),p.pageY=$n(f.rollingPageY),this.dispatchEvent(p)}else if(o===1){let p=$n(f.rollingPageX),g=$n(f.rollingPageY),x=$n(f.rollingTimestamps)-f.rollingTimestamps[0],v=p-f.rollingPageX[0],w=g-f.rollingPageY[0],k=[...this.targets].filter(N=>f.initialTarget instanceof Node&&N.contains(f.initialTarget));this.inertia(t,k,n,Math.abs(v)/x,v>0?1:-1,p,Math.abs(w)/x,w>0?1:-1,g)}this.dispatchEvent(this.newGestureEvent(Fi.End,f.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===Fi.Tap){let s=new Date().getTime(),n=0;s-this._lastSetTapCountTime>sn.CLEAR_TAP_COUNT_TIME?n=1:n=2,this._lastSetTapCountTime=s,t.tapCount=n}else(t.type===Fi.Change||t.type===Fi.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,f,d){this.handle=sv(t,()=>{let p=Date.now(),g=p-n,x=0,v=0,w=!0;o+=sn.SCROLL_FRICTION*g,h+=sn.SCROLL_FRICTION*g,o>0&&(w=!1,x=l*o*g),h>0&&(w=!1,v=f*h*g);let k=this.newGestureEvent(Fi.Change);k.translationX=x,k.translationY=v,s.forEach(N=>N.dispatchEvent(k)),w||this.inertia(t,s,p,o,l,u+x,h,f,d+v)})}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(Fi.Change,u.initialTarget);h.translationX=l.pageX-$n(u.rollingPageX),h.translationY=l.pageY-$n(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)}};Dc.SCROLL_FRICTION=-.005,Dc.HOLD_DELAY=700,Dc.CLEAR_TAP_COUNT_TIME=400,os([Tq],Dc,"isTouchDevice",1);var Rq=Dc,nv=class extends mt{onclick(e,t){this._register(at(e,Ps.CLICK,s=>t(new th(Wi(e),s))))}onmousedown(e,t){this._register(at(e,Ps.MOUSE_DOWN,s=>t(new th(Wi(e),s))))}onmouseover(e,t){this._register(at(e,Ps.MOUSE_OVER,s=>t(new th(Wi(e),s))))}onmouseleave(e,t){this._register(at(e,Ps.MOUSE_LEAVE,s=>t(new th(Wi(e),s))))}onkeydown(e,t){this._register(at(e,Ps.KEY_DOWN,s=>t(new U2(s))))}onkeyup(e,t){this._register(at(e,Ps.KEY_UP,s=>t(new U2(s))))}oninput(e,t){this._register(at(e,Ps.INPUT,t))}onblur(e,t){this._register(at(e,Ps.BLUR,t))}onfocus(e,t){this._register(at(e,Ps.FOCUS,t))}onchange(e,t){this._register(at(e,Ps.CHANGE,t))}ignoreGesture(e){return Rq.ignoreTarget(e)}},K2=11,Mq=class extends nv{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 Vj),this._register(G2(this.bgDomNode,Ps.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(G2(this.domNode,Ps.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new Eq),this._pointerdownScheduleRepeatTimer=this._register(new tv)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Wi(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()}},Dq=class x0{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 x0(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 x0(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,f=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:f}}},Oq=class extends mt{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new ze),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new Dq(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 X2(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=X2.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)))}},Y2=class{constructor(e,t,s){this.scrollLeft=e,this.scrollTop=t,this.isDone=s}};function jg(e,t){let s=t-e;return function(n){return e+s*Bq(n)}}function Lq(e,t,s){return function(n){return n<s?e(n/s):t((n-s)/(1-s))}}var X2=class b0{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),Lq(jg(t,o),jg(l,s),.33)}return jg(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 Y2(n,o,!1)}return new Y2(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,s,n){return b0.start(t,s,n)}static start(t,s,n){n=n+10;let o=Date.now()-10;return new b0(t,s,o,n)}};function zq(e){return Math.pow(e,3)}function Bq(e){return 1-zq(1-e)}var Pq=class extends mt{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 tv)}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":"")))}},Iq=140,Gj=class extends nv{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 Pq(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Vj),this._shouldRender=!0,this.domNode=Wc(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(at(this.domNode.domNode,Ps.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new Mq(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,s,n){this.slider=Wc(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(at(this.slider.domNode,Ps.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=jq(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(Hj&&u>Iq){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()}},Wj=class v0{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 v0(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),f=o>0&&o>n;if(!f)return{computedAvailableSize:Math.round(u),computedIsNeeded:f,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:f,computedSliderSize:Math.round(d),computedSliderRatio:p,computedSliderPosition:Math.round(g)}}_refreshComputedValues(){let t=v0._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)}},$q=class extends Gj{constructor(e,t,s){let n=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:s,scrollbarState:new Wj(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}},Hq=class extends Gj{constructor(e,t,s){let n=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:s,scrollbarState:new Wj(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}},Uq=500,Z2=50,Fq=class{constructor(e,t,s){this.timestamp=e,this.deltaX=t,this.deltaY=s,this.score=0}},_0=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(Jb){let s=Wi(t.browserEvent),n=eq(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 Fq(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),f=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%f===0&&g%d===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};_0.INSTANCE=new _0;var qq=_0,Vq=class extends nv{constructor(e,t,s){super(),this._onScroll=this._register(new ze),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new ze),this.onWillScroll=this._onWillScroll.event,this._options=Wq(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 Hq(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new $q(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=Wc(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Wc(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Wc(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 tv),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=ao(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,Xi&&(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 q2(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=ao(this._mouseWheelToDispose),e)){let t=s=>{this._onMouseWheel(new q2(s))};this._mouseWheelToDispose.push(at(this._listenOnDomNode,Ps.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=qq.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=!Xi&&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(),f={};if(o){let d=Z2*o,p=h.scrollTop-(d<0?Math.floor(d):Math.ceil(d));this._verticalScrollbar.writeScrollPosition(f,p)}if(l){let d=Z2*l,p=h.scrollLeft-(d<0?Math.floor(d):Math.ceil(d));this._horizontalScrollbar.writeScrollPosition(f,p)}f=this._scrollable.validateScrollPosition(f),(h.scrollLeft!==f.scrollLeft||h.scrollTop!==f.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(f):this._scrollable.setScrollPositionNow(f),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(),Uq)}},Gq=class extends Vq{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 Wq(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,Xi&&(t.className+=" mac"),t}var y0=class extends mt{constructor(e,t,s,n,o,l,u,h){super(),this._bufferService=s,this._optionsService=u,this._renderService=h,this._onRequestScrollLines=this._register(new ze),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let f=this._register(new Oq({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:d=>sv(n.window,d)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{f.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Gq(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},f)),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(Zs.runAndSubscribe(l.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=l.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Qt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=n.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Qt(()=>this._styleElement.remove())),this._register(Zs.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(`
103
- `)})),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}};y0=os([Fe(2,fn),Fe(3,Dr),Fe(4,Ej),Fe(5,_l),Fe(6,mn),Fe(7,Or)],y0);var w0=class extends mt{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(Qt(()=>{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()}};w0=os([Fe(1,fn),Fe(2,Dr),Fe(3,xu),Fe(4,Or)],w0);var Kq=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)}},Hi={full:0,left:0,center:0,right:0},da={full:0,left:0,center:0,right:0},yc={full:0,left:0,center:0,right:0},Yh=class extends mt{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 Kq,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(Qt(()=>this._canvas?.remove()));let f=this._canvas.getContext("2d");if(f)this._ctx=f;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);da.full=this._canvas.width,da.left=e,da.center=t,da.right=e,this._refreshDrawHeightConstants(),yc.full=1,yc.left=1,yc.center=1+da.left,yc.right=1+da.left+da.center}_refreshDrawHeightConstants(){Hi.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);Hi.left=t,Hi.center=t,Hi.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Hi.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Hi.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Hi.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Hi.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(yc[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Hi[e.position||"full"]/2),da[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Hi[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}))}};Yh=os([Fe(2,fn),Fe(3,xu),Fe(4,Or),Fe(5,mn),Fe(6,_l),Fe(7,Dr)],Yh);var Ee;(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=`
104
- `,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=""))(Ee||={});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 Kj;(e=>e.ST=`${Ee.ESC}\\`)(Kj||={});var S0=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(`${Ee.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)}}};S0=os([Fe(2,fn),Fe(3,mn),Fe(4,fo),Fe(5,Or)],S0);var Is=0,$s=0,Hs=0,rs=0,Q2={css:"#00000000",rgba:0},Ns;(e=>{function t(o,l,u,h){return h!==void 0?`#${Va(o)}${Va(l)}${Va(u)}${Va(h)}`:`#${Va(o)}${Va(l)}${Va(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})(Ns||={});var Wt;(e=>{function t(f,d){if(rs=(d.rgba&255)/255,rs===1)return{css:d.css,rgba:d.rgba};let p=d.rgba>>24&255,g=d.rgba>>16&255,x=d.rgba>>8&255,v=f.rgba>>24&255,w=f.rgba>>16&255,k=f.rgba>>8&255;Is=v+Math.round((p-v)*rs),$s=w+Math.round((g-w)*rs),Hs=k+Math.round((x-k)*rs);let N=Ns.toCss(Is,$s,Hs),E=Ns.toRgba(Is,$s,Hs);return{css:N,rgba:E}}e.blend=t;function s(f){return(f.rgba&255)===255}e.isOpaque=s;function n(f,d,p){let g=Eh.ensureContrastRatio(f.rgba,d.rgba,p);if(g)return Ns.toColor(g>>24&255,g>>16&255,g>>8&255)}e.ensureContrastRatio=n;function o(f){let d=(f.rgba|255)>>>0;return[Is,$s,Hs]=Eh.toChannels(d),{css:Ns.toCss(Is,$s,Hs),rgba:d}}e.opaque=o;function l(f,d){return rs=Math.round(d*255),[Is,$s,Hs]=Eh.toChannels(f.rgba),{css:Ns.toCss(Is,$s,Hs,rs),rgba:Ns.toRgba(Is,$s,Hs,rs)}}e.opacity=l;function u(f,d){return rs=f.rgba&255,l(f,rs*d/255)}e.multiplyOpacity=u;function h(f){return[f.rgba>>24&255,f.rgba>>16&255,f.rgba>>8&255]}e.toColorRGB=h})(Wt||={});var ts;(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 Is=parseInt(o.slice(1,2).repeat(2),16),$s=parseInt(o.slice(2,3).repeat(2),16),Hs=parseInt(o.slice(3,4).repeat(2),16),Ns.toColor(Is,$s,Hs);case 5:return Is=parseInt(o.slice(1,2).repeat(2),16),$s=parseInt(o.slice(2,3).repeat(2),16),Hs=parseInt(o.slice(3,4).repeat(2),16),rs=parseInt(o.slice(4,5).repeat(2),16),Ns.toColor(Is,$s,Hs,rs);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 Is=parseInt(l[1]),$s=parseInt(l[2]),Hs=parseInt(l[3]),rs=Math.round((l[5]===void 0?1:parseFloat(l[5]))*255),Ns.toColor(Is,$s,Hs,rs);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),[Is,$s,Hs,rs]=t.getImageData(0,0,1,1).data,rs!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Ns.toRgba(Is,$s,Hs,rs),css:o}}e.toColor=n})(ts||={});var cn;(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,f=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=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4);return d*.2126+p*.7152+g*.0722}e.relativeLuminance2=s})(cn||={});var Eh;(e=>{function t(u,h){if(rs=(h&255)/255,rs===1)return h;let f=h>>24&255,d=h>>16&255,p=h>>8&255,g=u>>24&255,x=u>>16&255,v=u>>8&255;return Is=g+Math.round((f-g)*rs),$s=x+Math.round((d-x)*rs),Hs=v+Math.round((p-v)*rs),Ns.toRgba(Is,$s,Hs)}e.blend=t;function s(u,h,f){let d=cn.relativeLuminance(u>>8),p=cn.relativeLuminance(h>>8);if(Sr(d,p)<f){if(p<d){let v=n(u,h,f),w=Sr(d,cn.relativeLuminance(v>>8));if(w<f){let k=o(u,h,f),N=Sr(d,cn.relativeLuminance(k>>8));return w>N?v:k}return v}let g=o(u,h,f),x=Sr(d,cn.relativeLuminance(g>>8));if(x<f){let v=n(u,h,f),w=Sr(d,cn.relativeLuminance(v>>8));return x>w?g:v}return g}}e.ensureContrastRatio=s;function n(u,h,f){let d=u>>24&255,p=u>>16&255,g=u>>8&255,x=h>>24&255,v=h>>16&255,w=h>>8&255,k=Sr(cn.relativeLuminance2(x,v,w),cn.relativeLuminance2(d,p,g));for(;k<f&&(x>0||v>0||w>0);)x-=Math.max(0,Math.ceil(x*.1)),v-=Math.max(0,Math.ceil(v*.1)),w-=Math.max(0,Math.ceil(w*.1)),k=Sr(cn.relativeLuminance2(x,v,w),cn.relativeLuminance2(d,p,g));return(x<<24|v<<16|w<<8|255)>>>0}e.reduceLuminance=n;function o(u,h,f){let d=u>>24&255,p=u>>16&255,g=u>>8&255,x=h>>24&255,v=h>>16&255,w=h>>8&255,k=Sr(cn.relativeLuminance2(x,v,w),cn.relativeLuminance2(d,p,g));for(;k<f&&(x<255||v<255||w<255);)x=Math.min(255,x+Math.ceil((255-x)*.1)),v=Math.min(255,v+Math.ceil((255-v)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),k=Sr(cn.relativeLuminance2(x,v,w),cn.relativeLuminance2(d,p,g));return(x<<24|v<<16|w<<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 Va(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Sr(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var Yq=class extends gu{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()]}},Xh=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new ui}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),f=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!==f){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,f=this._workCell.bg}l+=this._workCell.getChars().length||xa.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 f=this._characterJoiners[h].handler(l);for(let d=0;d<f.length;d++)Xh._mergeRanges(u,f[d])}catch(f){console.error(f)}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 f=t.getWidth(h),d=t.getString(h).length||xa.length;if(f!==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}};Xh=os([Fe(0,fn)],Xh);function Xq(e){return 57508<=e&&e<=57558}function Zq(e){return 9472<=e&&e<=9631}function Qq(e){return Xq(e)||Zq(e)}function Jq(){return{css:{canvas:sh(),cell:sh()},device:{canvas:sh(),cell:sh(),char:{width:0,height:0,left:0,top:0}}}}function sh(){return{width:0,height:0}}var k0=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 ui,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,f,d,p){let g=[],x=this._characterJoinerService.getJoinedCharacters(t),v=this._themeService.colors,w=e.getNoBgTrimmedLength();s&&w<l+1&&(w=l+1);let k,N=0,E="",T=0,A=0,C=0,R=0,D=!1,$=0,O=!1,P=0,B=0,G=[],F=d!==-1&&p!==-1;for(let z=0;z<w;z++){e.loadCell(z,this._workCell);let U=this._workCell.getWidth();if(U===0)continue;let K=!1,I=z>=B,Z=z,W=this._workCell;if(x.length>0&&z===x[0][0]&&I){let $e=x.shift(),St=this._isCellInSelection($e[0],t);for(T=$e[0]+1;T<$e[1];T++)I&&=St===this._isCellInSelection(T,t);I&&=!s||l<$e[0]||l>=$e[1],I?(K=!0,W=new Yq(this._workCell,e.translateToString(!0,$e[0],$e[1]),$e[1]-$e[0]),Z=$e[1]-1,U=W.getWidth()):B=$e[1]}let te=this._isCellInSelection(z,t),X=s&&z===l,V=F&&z>=d&&z<=p,q=!1;this._decorationService.forEachDecorationAtCell(z,t,void 0,$e=>{q=!0});let le=W.getChars()||xa;if(le===" "&&(W.isUnderline()||W.isOverline())&&(le=" "),P=U*h-f.get(le,W.isBold(),W.isItalic()),!k)k=this._document.createElement("span");else if(N&&(te&&O||!te&&!O&&W.bg===A)&&(te&&O&&v.selectionForeground||W.fg===C)&&W.extended.ext===R&&V===D&&P===$&&!X&&!K&&!q&&I){W.isInvisible()?E+=xa:E+=le,N++;continue}else N&&(k.textContent=E),k=this._document.createElement("span"),N=0,E="";if(A=W.bg,C=W.fg,R=W.extended.ext,D=V,$=P,O=te,K&&l>=z&&l<=Z&&(l=z),!this._coreService.isCursorHidden&&X&&this._coreService.isCursorInitialized){if(G.push("xterm-cursor"),this._coreBrowserService.isFocused)u&&G.push("xterm-cursor-blink"),G.push(n==="bar"?"xterm-cursor-bar":n==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(o)switch(o){case"outline":G.push("xterm-cursor-outline");break;case"block":G.push("xterm-cursor-block");break;case"bar":G.push("xterm-cursor-bar");break;case"underline":G.push("xterm-cursor-underline");break}}if(W.isBold()&&G.push("xterm-bold"),W.isItalic()&&G.push("xterm-italic"),W.isDim()&&G.push("xterm-dim"),W.isInvisible()?E=xa:E=W.getChars()||xa,W.isUnderline()&&(G.push(`xterm-underline-${W.extended.underlineStyle}`),E===" "&&(E=" "),!W.isUnderlineColorDefault()))if(W.isUnderlineColorRGB())k.style.textDecorationColor=`rgb(${gu.toColorRGB(W.getUnderlineColor()).join(",")})`;else{let $e=W.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&W.isBold()&&$e<8&&($e+=8),k.style.textDecorationColor=v.ansi[$e].css}W.isOverline()&&(G.push("xterm-overline"),E===" "&&(E=" ")),W.isStrikethrough()&&G.push("xterm-strikethrough"),V&&(k.style.textDecoration="underline");let ee=W.getFgColor(),fe=W.getFgColorMode(),ie=W.getBgColor(),Se=W.getBgColorMode(),Me=!!W.isInverse();if(Me){let $e=ee;ee=ie,ie=$e;let St=fe;fe=Se,Se=St}let De,Je,Ne=!1;this._decorationService.forEachDecorationAtCell(z,t,void 0,$e=>{$e.options.layer!=="top"&&Ne||($e.backgroundColorRGB&&(Se=50331648,ie=$e.backgroundColorRGB.rgba>>8&16777215,De=$e.backgroundColorRGB),$e.foregroundColorRGB&&(fe=50331648,ee=$e.foregroundColorRGB.rgba>>8&16777215,Je=$e.foregroundColorRGB),Ne=$e.options.layer==="top")}),!Ne&&te&&(De=this._coreBrowserService.isFocused?v.selectionBackgroundOpaque:v.selectionInactiveBackgroundOpaque,ie=De.rgba>>8&16777215,Se=50331648,Ne=!0,v.selectionForeground&&(fe=50331648,ee=v.selectionForeground.rgba>>8&16777215,Je=v.selectionForeground)),Ne&&G.push("xterm-decoration-top");let Ue;switch(Se){case 16777216:case 33554432:Ue=v.ansi[ie],G.push(`xterm-bg-${ie}`);break;case 50331648:Ue=Ns.toColor(ie>>16,ie>>8&255,ie&255),this._addStyle(k,`background-color:#${J2((ie>>>0).toString(16),"0",6)}`);break;default:Me?(Ue=v.foreground,G.push("xterm-bg-257")):Ue=v.background}switch(De||W.isDim()&&(De=Wt.multiplyOpacity(Ue,.5)),fe){case 16777216:case 33554432:W.isBold()&&ee<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ee+=8),this._applyMinimumContrast(k,Ue,v.ansi[ee],W,De,void 0)||G.push(`xterm-fg-${ee}`);break;case 50331648:let $e=Ns.toColor(ee>>16&255,ee>>8&255,ee&255);this._applyMinimumContrast(k,Ue,$e,W,De,Je)||this._addStyle(k,`color:#${J2(ee.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(k,Ue,v.foreground,W,De,Je)||Me&&G.push("xterm-fg-257")}G.length&&(k.className=G.join(" "),G.length=0),!X&&!K&&!q&&I?N++:k.textContent=E,P!==this.defaultSpacing&&(k.style.letterSpacing=`${P}px`),g.push(k),z=Z}return k&&N&&(k.textContent=E),g}_applyMinimumContrast(e,t,s,n,o,l){if(this._optionsService.rawOptions.minimumContrastRatio===1||Qq(n.getCode()))return!1;let u=this._getContrastCache(n),h;if(!o&&!l&&(h=u.getColor(t.rgba,s.rgba)),h===void 0){let f=this._optionsService.rawOptions.minimumContrastRatio/(n.isDim()?2:1);h=Wt.ensureContrastRatio(o||t,l||s,f),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]}};k0=os([Fe(1,Tj),Fe(2,mn),Fe(3,Dr),Fe(4,fo),Fe(5,xu),Fe(6,_l)],k0);function J2(e,t,s){for(;e.length<s;)e=t+e;return e}var eV=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}},tV=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),f=Math.min(u,e.rows-1);if(h>=e.rows||f<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=n,this.viewportStartRow=l,this.viewportEndRow=u,this.viewportCappedStartRow=h,this.viewportCappedEndRow=f,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 sV(){return new tV}var Ag="xterm-dom-renderer-owner-",ii="xterm-rows",nh="xterm-fg-",ek="xterm-bg-",wc="xterm-focus",ih="xterm-selection",nV=1,N0=class extends mt{constructor(e,t,s,n,o,l,u,h,f,d,p,g,x,v){super(),this._terminal=e,this._document=t,this._element=s,this._screenElement=n,this._viewportElement=o,this._helperContainer=l,this._linkifier2=u,this._charSizeService=f,this._optionsService=d,this._bufferService=p,this._coreService=g,this._coreBrowserService=x,this._themeService=v,this._terminalClass=nV++,this._rowElements=[],this._selectionRenderModel=sV(),this.onRequestRedraw=this._register(new ze).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(ii),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(ih),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=Jq(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(w=>this._injectCss(w))),this._injectCss(this._themeService.colors),this._rowFactory=h.createInstance(k0,document),this._element.classList.add(Ag+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(w=>this._handleLinkHover(w))),this._register(this._linkifier2.onHideLinkUnderline(w=>this._handleLinkLeave(w))),this._register(Qt(()=>{this._element.classList.remove(Ag+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new eV(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} .${ii} 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} .${ii} { 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} .${ii} .xterm-dim { color: ${Wt.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} .${ii}.${wc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${ii}.${wc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${ii}.${wc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${o} 1s step-end infinite;}${this._terminalSelector} .${ii} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${ii} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${ii} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${ii} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${ii} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${ih} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${ih} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${ih} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[l,u]of e.ansi.entries())t+=`${this._terminalSelector} .${nh}${l} { color: ${u.css}; }${this._terminalSelector} .${nh}${l}.xterm-dim { color: ${Wt.multiplyOpacity(u,.5).css}; }${this._terminalSelector} .${ek}${l} { background-color: ${u.css}; }`;t+=`${this._terminalSelector} .${nh}257 { color: ${Wt.opaque(e.background).css}; }${this._terminalSelector} .${nh}257.xterm-dim { color: ${Wt.multiplyOpacity(Wt.opaque(e.background),.5).css}; }${this._terminalSelector} .${ek}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(wc),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(wc),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 f=e[0]>t[0];h.appendChild(this._createSelectionElement(l,f?t[0]:e[0],f?e[0]:t[0],u-l+1))}else{let f=n===l?e[0]:0,d=l===o?t[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(l,f,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 f=e;f<=t;f++){let d=f+s.ydisp,p=this._rowElements[f],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`.${Ag}${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,f=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 v=s;v<=n;++v){let w=v+h.ydisp,k=this._rowElements[v],N=h.lines.get(w);if(!k||!N)break;k.replaceChildren(...this._rowFactory.createRow(N,w,w===f,g,x,d,p,this.dimensions.css.cell.width,this._widthCache,l?v===s?e:0:-1,l?(v===n?t:o)-1:-1))}}};N0=os([Fe(7,Xb),Fe(8,Mf),Fe(9,mn),Fe(10,fn),Fe(11,fo),Fe(12,Dr),Fe(13,_l)],N0);var C0=class extends mt{constructor(e,t,s){super(),this._optionsService=s,this.width=0,this.height=0,this._onCharSizeChange=this._register(new ze),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new rV(this._optionsService))}catch{this._measureStrategy=this._register(new iV(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())}};C0=os([Fe(2,mn)],C0);var Yj=class extends mt{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)}},iV=class extends Yj{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}},rV=class extends Yj{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}},aV=class extends mt{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 oV(this._window)),this._onDprChange=this._register(new ze),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new ze),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(n=>this._screenDprMonitor.setWindow(n))),this._register(Zs.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(at(this._textarea,"focus",()=>this._isFocused=!0)),this._register(at(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}},oV=class extends mt{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new ml),this._onDprChange=this._register(new ze),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Qt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=at(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)}},lV=class extends mt{constructor(){super(),this.linkProviders=[],this._register(Qt(()=>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 iv(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 cV(e,t,s,n,o,l,u,h,f){if(!l)return;let d=iv(e,t,s);if(d)return d[0]=Math.ceil((d[0]+(f?u/2:0))/u),d[1]=Math.ceil(d[1]/h),d[0]=Math.min(Math.max(d[0],1),n+(f?1:0)),d[1]=Math.min(Math.max(d[1],1),o),d}var E0=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,s,n,o){return cV(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=iv(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])}}};E0=os([Fe(0,Or),Fe(1,Mf)],E0);var uV=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=[]}},Xj={};_F(Xj,{getSafariVersion:()=>hV,isChromeOS:()=>e5,isFirefox:()=>Zj,isIpad:()=>fV,isIphone:()=>mV,isLegacyEdge:()=>dV,isLinux:()=>rv,isMac:()=>Zh,isNode:()=>Df,isSafari:()=>Qj,isWindows:()=>Jj});var Df=typeof process<"u"&&"title"in process,bu=Df?"node":navigator.userAgent,vu=Df?"node":navigator.platform,Zj=bu.includes("Firefox"),dV=bu.includes("Edge"),Qj=/^((?!chrome|android).)*safari/i.test(bu);function hV(){if(!Qj)return 0;let e=bu.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Zh=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(vu),fV=vu==="iPad",mV=vu==="iPhone",Jj=["Windows","Win16","Win32","WinCE"].includes(vu),rv=vu.indexOf("Linux")>=0,e5=/\bCrOS\b/.test(bu),t5=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()}},pV=class extends t5{_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())}}},gV=class extends t5{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Qh=!Df&&"requestIdleCallback"in window?gV:pV,xV=class{constructor(){this._queue=new Qh}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},j0=class extends mt{constructor(e,t,s,n,o,l,u,h,f){super(),this._rowCount=e,this._optionsService=s,this._charSizeService=n,this._coreService=o,this._coreBrowserService=h,this._renderer=this._register(new ml),this._pausedResizeTask=new xV,this._observerDisposable=this._register(new ml),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 ze),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new ze),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new ze),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new ze),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new uV((d,p)=>this._renderRows(d,p),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new bV(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Qt(()=>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(f.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=Qt(()=>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()}};j0=os([Fe(2,mn),Fe(3,Mf),Fe(4,fo),Fe(5,xu),Fe(6,fn),Fe(7,Dr),Fe(8,_l)],j0);var bV=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 vV(e,t,s,n){let o=s.buffer.x,l=s.buffer.y;if(!s.buffer.hasScrollback)return wV(o,l,e,t,s,n)+Of(l,t,s,n)+SV(o,l,e,t,s,n);let u;if(l===t)return u=o>e?"D":"C",ru(Math.abs(o-e),iu(u,n));u=l>t?"D":"C";let h=Math.abs(l-t),f=yV(l>t?e:o,s)+(h-1)*s.cols+1+_V(l>t?o:e);return ru(f,iu(u,n))}function _V(e,t){return e-1}function yV(e,t){return t.cols-e}function wV(e,t,s,n,o,l){return Of(t,n,o,l).length===0?"":ru(n5(e,t,e,t-oo(t,o),!1,o).length,iu("D",l))}function Of(e,t,s,n){let o=e-oo(e,s),l=t-oo(t,s),u=Math.abs(o-l)-kV(e,t,s);return ru(u,iu(s5(e,t),n))}function SV(e,t,s,n,o,l){let u;Of(t,n,o,l).length>0?u=n-oo(n,o):u=t;let h=n,f=NV(e,t,s,n,o,l);return ru(n5(e,u,s,h,f==="C",o).length,iu(f,l))}function kV(e,t,s){let n=0,o=e-oo(e,s),l=t-oo(t,s);for(let u=0;u<Math.abs(o-l);u++){let h=s5(e,t)==="A"?-1:1;s.buffer.lines.get(o+h*u)?.isWrapped&&n++}return n}function oo(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 NV(e,t,s,n,o,l){let u;return Of(s,n,o,l).length>0?u=n-oo(n,o):u=t,e<s&&u<=n||e>=s&&u<n?"C":"D"}function s5(e,t){return e>t?"A":"B"}function n5(e,t,s,n,o,l){let u=e,h=t,f="";for(;(u!==s||h!==n)&&h>=0&&h<l.buffer.lines.length;)u+=o?1:-1,o&&u>l.cols-1?(f+=l.buffer.translateBufferLineToString(h,!1,e,u),u=0,e=0,h++):!o&&u<0&&(f+=l.buffer.translateBufferLineToString(h,!1,0,e+1),u=l.cols-1,e=u,h--);return f+l.buffer.translateBufferLineToString(h,!1,e,u)}function iu(e,t){let s=t?"O":"[";return Ee.ESC+s+e}function ru(e,t){e=Math.floor(e);let s="";for(let n=0;n<e;n++)s+=t;return s}var CV=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 tk(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 Tg=50,EV=15,jV=50,AV=500,TV=" ",RV=new RegExp(TV,"g"),A0=class extends mt{constructor(e,t,s,n,o,l,u,h,f){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=f,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new ui,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new ze),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new ze),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new ze),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new ze),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 CV(this._bufferService),this._activeSelectionMode=0,this._register(Qt(()=>{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(RV," ")).join(Jj?`\r
105
- `:`
106
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),rv&&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=tk(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=iv(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,-Tg),Tg),t/=Tg,t/Math.abs(t)+Math.round(t*(EV-1)))}shouldForceSelection(e){return Zh?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(),jV)}_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&&!(Zh&&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<AV&&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=vV(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]),f=h,d=e[0]-h,p=0,g=0,x=0,v=0;if(u.charAt(h)===" "){for(;h>0&&u.charAt(h-1)===" ";)h--;for(;f<u.length&&u.charAt(f+1)===" ";)f++}else{let N=e[0],E=e[0];l.getWidth(N)===0&&(p++,N--),l.getWidth(E)===2&&(g++,E++);let T=l.getString(E).length;for(T>1&&(v+=T-1,f+=T-1);N>0&&h>0&&!this._isCharWordSeparator(l.loadCell(N-1,this._workCell));){l.loadCell(N-1,this._workCell);let A=this._workCell.getChars().length;this._workCell.getWidth()===0?(p++,N--):A>1&&(x+=A-1,h-=A-1),h--,N--}for(;E<l.length&&f+1<u.length&&!this._isCharWordSeparator(l.loadCell(E+1,this._workCell));){l.loadCell(E+1,this._workCell);let A=this._workCell.getChars().length;this._workCell.getWidth()===2?(g++,E++):A>1&&(v+=A-1,f+=A-1),f++,E++}}f++;let w=h+d-p+x,k=Math.min(this._bufferService.cols,f-h+p+g-x-v);if(!(!t&&u.slice(h,f).trim()==="")){if(s&&w===0&&l.getCodePoint(0)!==32){let N=o.lines.get(e[1]-1);if(N&&l.isWrapped&&N.getCodePoint(this._bufferService.cols-1)!==32){let E=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(E){let T=this._bufferService.cols-E.start;w-=T,k+=T}}}if(n&&w+k===this._bufferService.cols&&l.getCodePoint(this._bufferService.cols-1)!==32){let N=o.lines.get(e[1]+1);if(N?.isWrapped&&N.getCodePoint(0)!==32){let E=this._getWordAt([0,e[1]+1],!1,!1,!0);E&&(k+=E.length)}}return{start:w,length:k}}}_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=tk(s,this._bufferService.cols)}};A0=os([Fe(3,fn),Fe(4,fo),Fe(5,Zb),Fe(6,mn),Fe(7,Or),Fe(8,Dr)],A0);var sk=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={}}},nk=class{constructor(){this._color=new sk,this._css=new sk}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()}},Ts=Object.freeze((()=>{let e=[ts.toColor("#2e3436"),ts.toColor("#cc0000"),ts.toColor("#4e9a06"),ts.toColor("#c4a000"),ts.toColor("#3465a4"),ts.toColor("#75507b"),ts.toColor("#06989a"),ts.toColor("#d3d7cf"),ts.toColor("#555753"),ts.toColor("#ef2929"),ts.toColor("#8ae234"),ts.toColor("#fce94f"),ts.toColor("#729fcf"),ts.toColor("#ad7fa8"),ts.toColor("#34e2e2"),ts.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:Ns.toCss(n,o,l),rgba:Ns.toRgba(n,o,l)})}for(let s=0;s<24;s++){let n=8+s*10;e.push({css:Ns.toCss(n,n,n),rgba:Ns.toRgba(n,n,n)})}return e})()),Ka=ts.toColor("#ffffff"),Oc=ts.toColor("#000000"),ik=ts.toColor("#ffffff"),rk=Oc,Sc={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},MV=Ka,T0=class extends mt{constructor(e){super(),this._optionsService=e,this._contrastCache=new nk,this._halfContrastCache=new nk,this._onChangeColors=this._register(new ze),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Ka,background:Oc,cursor:ik,cursorAccent:rk,selectionForeground:void 0,selectionBackgroundTransparent:Sc,selectionBackgroundOpaque:Wt.blend(Oc,Sc),selectionInactiveBackgroundTransparent:Sc,selectionInactiveBackgroundOpaque:Wt.blend(Oc,Sc),scrollbarSliderBackground:Wt.opacity(Ka,.2),scrollbarSliderHoverBackground:Wt.opacity(Ka,.4),scrollbarSliderActiveBackground:Wt.opacity(Ka,.5),overviewRulerBorder:Ka,ansi:Ts.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=Pt(e.foreground,Ka),t.background=Pt(e.background,Oc),t.cursor=Wt.blend(t.background,Pt(e.cursor,ik)),t.cursorAccent=Wt.blend(t.background,Pt(e.cursorAccent,rk)),t.selectionBackgroundTransparent=Pt(e.selectionBackground,Sc),t.selectionBackgroundOpaque=Wt.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Pt(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Wt.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Pt(e.selectionForeground,Q2):void 0,t.selectionForeground===Q2&&(t.selectionForeground=void 0),Wt.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Wt.opacity(t.selectionBackgroundTransparent,.3)),Wt.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Wt.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Pt(e.scrollbarSliderBackground,Wt.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Pt(e.scrollbarSliderHoverBackground,Wt.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Pt(e.scrollbarSliderActiveBackground,Wt.opacity(t.foreground,.5)),t.overviewRulerBorder=Pt(e.overviewRulerBorder,MV),t.ansi=Ts.slice(),t.ansi[0]=Pt(e.black,Ts[0]),t.ansi[1]=Pt(e.red,Ts[1]),t.ansi[2]=Pt(e.green,Ts[2]),t.ansi[3]=Pt(e.yellow,Ts[3]),t.ansi[4]=Pt(e.blue,Ts[4]),t.ansi[5]=Pt(e.magenta,Ts[5]),t.ansi[6]=Pt(e.cyan,Ts[6]),t.ansi[7]=Pt(e.white,Ts[7]),t.ansi[8]=Pt(e.brightBlack,Ts[8]),t.ansi[9]=Pt(e.brightRed,Ts[9]),t.ansi[10]=Pt(e.brightGreen,Ts[10]),t.ansi[11]=Pt(e.brightYellow,Ts[11]),t.ansi[12]=Pt(e.brightBlue,Ts[12]),t.ansi[13]=Pt(e.brightMagenta,Ts[13]),t.ansi[14]=Pt(e.brightCyan,Ts[14]),t.ansi[15]=Pt(e.brightWhite,Ts[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]=Pt(e.extendedAnsi[n],Ts[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()}}};T0=os([Fe(0,mn)],T0);function Pt(e,t){if(e!==void 0)try{return ts.toColor(e)}catch{}return t}var DV=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)}},OV=class{constructor(){this._services=new DV,this._services.set(Xb,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let s=EF(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)}},LV={trace:0,debug:1,info:2,warn:3,error:4,off:5},zV="xterm.js: ",R0=class extends mt{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=LV[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?"":zV)+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)}};R0=os([Fe(0,mn)],R0);var ak=class extends mt{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new ze),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new ze),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new ze),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}},ht=3,ws=Object.freeze(new gu),rh=0,Rg=2,Lc=class i5{constructor(t,s,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*ht);let o=s||ui.fromCharData([0,Sj,1,0]);for(let l=0;l<t;++l)this.setCell(l,o);this.length=t}get(t){let s=this._data[t*ht+0],n=s&2097151;return[this._data[t*ht+1],s&2097152?this._combined[t]:n?pa(n):"",s>>22,s&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n]}set(t,s){this._data[t*ht+1]=s[0],s[1].length>1?(this._combined[t]=s[1],this._data[t*ht+0]=t|2097152|s[2]<<22):this._data[t*ht+0]=s[1].charCodeAt(0)|s[2]<<22}getWidth(t){return this._data[t*ht+0]>>22}hasWidth(t){return this._data[t*ht+0]&12582912}getFg(t){return this._data[t*ht+1]}getBg(t){return this._data[t*ht+2]}hasContent(t){return this._data[t*ht+0]&4194303}getCodePoint(t){let s=this._data[t*ht+0];return s&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):s&2097151}isCombined(t){return this._data[t*ht+0]&2097152}getString(t){let s=this._data[t*ht+0];return s&2097152?this._combined[t]:s&2097151?pa(s&2097151):""}isProtected(t){return this._data[t*ht+2]&536870912}loadCell(t,s){return rh=t*ht,s.content=this._data[rh+0],s.fg=this._data[rh+1],s.bg=this._data[rh+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*ht+0]=s.content,this._data[t*ht+1]=s.fg,this._data[t*ht+2]=s.bg}setCellFromCodepoint(t,s,n,o){o.bg&268435456&&(this._extendedAttrs[t]=o.extended),this._data[t*ht+0]=s|n<<22,this._data[t*ht+1]=o.fg,this._data[t*ht+2]=o.bg}addCodepointToCell(t,s,n){let o=this._data[t*ht+0];o&2097152?this._combined[t]+=pa(s):o&2097151?(this._combined[t]=pa(o&2097151)+pa(s),o&=-2097152,o|=2097152):o=s|1<<22,n&&(o&=-12582913,o|=n<<22),this._data[t*ht+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 ui;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 ui;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*Rg<this._data.buffer.byteLength;let n=t*ht;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*Rg<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Rg<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 i5(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*ht+0]&4194303)return t+(this._data[t*ht+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*ht+0]&4194303||this._data[t*ht+2]&50331648)return t+(this._data[t*ht+0]>>22);return 0}copyCellsFrom(t,s,n,o,l){let u=t._data;if(l)for(let f=o-1;f>=0;f--){for(let d=0;d<ht;d++)this._data[(n+f)*ht+d]=u[(s+f)*ht+d];u[(s+f)*ht+2]&268435456&&(this._extendedAttrs[n+f]=t._extendedAttrs[s+f])}else for(let f=0;f<o;f++){for(let d=0;d<ht;d++)this._data[(n+f)*ht+d]=u[(s+f)*ht+d];u[(s+f)*ht+2]&268435456&&(this._extendedAttrs[n+f]=t._extendedAttrs[s+f])}let h=Object.keys(t._combined);for(let f=0;f<h.length;f++){let d=parseInt(h[f],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*ht+0],h=u&2097151,f=u&2097152?this._combined[s]:h?pa(h):xa;if(l+=f,o)for(let d=0;d<f.length;++d)o.push(s);s+=u>>22||1}return o&&o.push(s),l}};function BV(e,t,s,n,o,l){let u=[];for(let h=0;h<e.length-1;h++){let f=h,d=e.get(++f);if(!d.isWrapped)continue;let p=[e.get(h)];for(;f<e.length&&d.isWrapped;)p.push(d),d=e.get(++f);if(!l&&n>=h&&n<f){h+=p.length-1;continue}let g=0,x=au(p,g,t),v=1,w=0;for(;v<p.length;){let N=au(p,v,t),E=N-w,T=s-x,A=Math.min(E,T);p[g].copyCellsFrom(p[v],w,x,A,!1),x+=A,x===s&&(g++,x=0),w+=A,w===N&&(v++,w=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 k=0;for(let N=p.length-1;N>0&&(N>g||p[N].getTrimmedLength()===0);N--)k++;k>0&&(u.push(h+p.length-k),u.push(k)),h+=p.length-1}return u}function PV(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 IV(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 $V(e,t,s){let n=[],o=e.map((f,d)=>au(e,d,t)).reduce((f,d)=>f+d),l=0,u=0,h=0;for(;h<o;){if(o-h<s){n.push(o-h);break}l+=s;let f=au(e,u,t);l>f&&(l-=f,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 au(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 r5=class a5{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=a5._nextId++,this._onDispose=this.register(new ze),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),ao(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};r5._nextId=1;var HV=r5,Os={},Ya=Os.B;Os[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Os.A={"#":"£"};Os.B=void 0;Os[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Os.C=Os[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Os.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Os.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Os.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Os.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Os.E=Os[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Os.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Os.H=Os[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Os["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var ok=4294967295,lk=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=ws.clone(),this.savedCharset=Ya,this.markers=[],this._nullCell=ui.fromCharData([0,Sj,1,0]),this._whitespaceCell=ui.fromCharData([0,xa,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Qh,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new ak(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 Kh),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 Kh),this._whitespaceCell}getBlankLine(e,t){return new Lc(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>ok?ok:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=ws);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 ak(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let s=this.getNullCell(ws),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 Lc(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 Lc(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=BV(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(ws),s);if(n.length>0){let o=PV(this.lines,n);IV(this.lines,o.layout),this._reflowLargerAdjustViewport(e,t,o.countRemoved)}}_reflowLargerAdjustViewport(e,t,s){let n=this.getNullCell(ws),o=s;for(;o-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Lc(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(ws),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 f=[h];for(;h.isWrapped&&u>0;)h=this.lines.get(--u),f.unshift(h);if(!s){let A=this.ybase+this.y;if(A>=u&&A<u+f.length)continue}let d=f[f.length-1].getTrimmedLength(),p=$V(f,this._cols,e),g=p.length-f.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 v=[];for(let A=0;A<g;A++){let C=this.getBlankLine(ws,!0);v.push(C)}v.length>0&&(o.push({start:u+f.length+l,newLines:v}),l+=v.length),f.push(...v);let w=p.length-1,k=p[w];k===0&&(w--,k=p[w]);let N=f.length-g-1,E=d;for(;N>=0;){let A=Math.min(E,k);if(f[w]===void 0)break;if(f[w].copyCellsFrom(f[N],E-A,k-A,A,!0),k-=A,k===0&&(w--,k=p[w]),E-=A,E===0){N--;let C=Math.max(N,0);E=au(f,C,this._cols)}}for(let A=0;A<f.length;A++)p[A]<e&&f[A].setCell(p[A],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 k=0;k<this.lines.length;k++)h.push(this.lines.get(k));let f=this.lines.length,d=f-1,p=0,g=o[p];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+l);let x=0;for(let k=Math.min(this.lines.maxLength-1,f+l-1);k>=0;k--)if(g&&g.start>d+x){for(let N=g.newLines.length-1;N>=0;N--)this.lines.set(k--,g.newLines[N]);k++,u.push({index:d+1,amount:g.newLines.length}),x+=g.newLines.length,g=o[++p]}else this.lines.set(k,h[d--]);let v=0;for(let k=u.length-1;k>=0;k--)u[k].index+=v,this.lines.onInsertEmitter.fire(u[k]),v+=u[k].amount;let w=Math.max(0,f+l-this.lines.maxLength);w>0&&this.lines.onTrimEmitter.fire(w)}}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 HV(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)}},UV=class extends mt{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new ze),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 lk(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new lk(!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)}},o5=2,l5=1,M0=class extends mt{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new ze),this.onResize=this._onResize.event,this._onScroll=this._register(new ze),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,o5),this.rows=Math.max(e.rawOptions.rows||0,l5),this.buffers=this._register(new UV(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))}};M0=os([Fe(0,mn)],M0);var Qo={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:Zh,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},FV=["normal","bold","100","200","300","400","500","600","700","800","900"],qV=class extends mt{constructor(e){super(),this._onOptionChange=this._register(new ze),this.onOptionChange=this._onOptionChange.event;let t={...Qo};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(Qt(()=>{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 Qo))throw new Error(`No option with key "${s}"`);return this.rawOptions[s]},t=(s,n)=>{if(!(s in Qo))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=Qo[e]),!VV(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Qo[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=FV.includes(t)?t:Qo[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 VV(e){return e==="block"||e==="underline"||e==="bar"}function zc(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]&&zc(e[n],t-1);return s}var ck=Object.freeze({insertMode:!1}),uk=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),D0=class extends mt{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 ze),this.onData=this._onData.event,this._onUserInput=this._register(new ze),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new ze),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new ze),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=zc(ck),this.decPrivateModes=zc(uk)}reset(){this.modes=zc(ck),this.decPrivateModes=zc(uk)}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))}};D0=os([Fe(0,fn),Fe(1,jj),Fe(2,mn)],D0);var dk={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 Mg(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 Dg=String.fromCharCode,hk={DEFAULT:e=>{let t=[Mg(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Dg(t[0])}${Dg(t[1])}${Dg(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Mg(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Mg(e,!0)};${e.x};${e.y}${t}`}},O0=class extends mt{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 ze),this.onProtocolChange=this._onProtocolChange.event;for(let n of Object.keys(dk))this.addProtocol(n,dk[n]);for(let n of Object.keys(hk))this.addEncoding(n,hk[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)}};O0=os([Fe(0,fn),Fe(1,fo),Fe(2,mn)],O0);var Og=[[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]],GV=[[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]],Rs;function WV(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 KV=class{constructor(){if(this.version="6",!Rs){Rs=new Uint8Array(65536),Rs.fill(1),Rs[0]=0,Rs.fill(0,1,32),Rs.fill(0,127,160),Rs.fill(2,4352,4448),Rs[9001]=2,Rs[9002]=2,Rs.fill(2,11904,42192),Rs[12351]=1,Rs.fill(2,44032,55204),Rs.fill(2,63744,64256),Rs.fill(2,65040,65050),Rs.fill(2,65072,65136),Rs.fill(2,65280,65377),Rs.fill(2,65504,65511);for(let e=0;e<Og.length;++e)Rs.fill(0,Og[e][0],Og[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Rs[e]:WV(e,GV)?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=Ja.extractWidth(t);o===0?n=!1:o>s&&(s=o)}return Ja.createPropertyValue(0,s,n)}},Ja=class jh{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new ze,this.onChange=this._onChange.event;let t=new KV;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),f=jh.extractWidth(h);jh.extractShouldJoin(h)&&(f-=jh.extractWidth(n)),s+=f,n=h}return s}charProperties(t,s){return this._activeProvider.charProperties(t,s)}},YV=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 fk(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 kc=2147483647,XV=256,c5=class L0{constructor(t=32,s=32){if(this.maxLength=t,this.maxSubParamsLength=s,s>XV)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 L0;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 L0(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>kc?kc: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>kc?kc: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,kc):t}},Nc=[],ZV=class{constructor(){this._state=0,this._active=Nc,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=Nc}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=Nc,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Nc,!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",Rf(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=Nc,this._id=-1,this._state=0}}},Hn=class{constructor(t){this._handler=t,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(t,s,n){this._hitLimit||(this._data+=Rf(t,s,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(t){let s=!1;if(this._hitLimit)s=!1;else if(t&&(s=this._handler(this._data),s instanceof Promise))return s.then(n=>(this._data="",this._hitLimit=!1,n));return this._data="",this._hitLimit=!1,s}},Cc=[],QV=class{constructor(){this._handlers=Object.create(null),this._active=Cc,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Cc}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=Cc,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Cc,!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",Rf(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=Cc,this._ident=0}},Bc=new c5;Bc.addParam(0);var mk=class{constructor(e){this._handler=e,this._data="",this._params=Bc,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Bc,this._data="",this._hitLimit=!1}put(e,t,s){this._hitLimit||(this._data+=Rf(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=Bc,this._data="",this._hitLimit=!1,s));return this._params=Bc,this._data="",this._hitLimit=!1,t}},JV=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}},oi=160,eG=(function(){let e=new JV(4095),t=Array.apply(null,Array(256)).map((h,f)=>f),s=(h,f)=>t.slice(h,f),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(oi,0,2,0),e.add(oi,8,5,8),e.add(oi,6,0,6),e.add(oi,11,0,11),e.add(oi,13,13,13),e})(),tG=class extends mt{constructor(e=eG){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 c5,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(Qt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new ZV),this._dcsParser=this._register(new QV),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,f=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(s===!1&&f>-1){for(;f>=0&&(u=h[f](this._params),u!==!0);f--)if(u instanceof Promise)return this._parseStack.handlerPos=f,u}this._parseStack.handlers=[];break;case 4:if(s===!1&&f>-1){for(;f>=0&&(u=h[f](),u!==!0);f--)if(u instanceof Promise)return this._parseStack.handlerPos=f,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:oi)],o>>4){case 2:for(let x=h+1;;++x){if(x>=t||(n=e[x])<32||n>126&&n<oi){this._printHandler(e,h,x),h=x-1;break}if(++x>=t||(n=e[x])<32||n>126&&n<oi){this._printHandler(e,h,x),h=x-1;break}if(++x>=t||(n=e[x])<32||n>126&&n<oi){this._printHandler(e,h,x),h=x-1;break}if(++x>=t||(n=e[x])<32||n>126&&n<oi){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 f=this._csiHandlers[this._collect<<8|n],d=f?f.length-1:-1;for(;d>=0&&(u=f[d](this._params),u!==!0);d--)if(u instanceof Promise)return this._preserveStack(3,f,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<oi){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<oi){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}}},sG=/^([\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})$/,nG=/^[\da-f]+$/;function pk(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let s=sG.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),nG.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 Lg(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 iG(e,t=16){let[s,n,o]=e;return`rgb:${Lg(s,t)}/${Lg(n,t)}/${Lg(o,t)}`}var rG={"(":0,")":1,"*":2,"+":3,"-":1,".":2},ha=131072,gk=10;function xk(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 bk=5e3,vk=0,aG=class extends mt{constructor(e,t,s,n,o,l,u,h,f=new tG){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=f,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new NF,this._utf8Decoder=new CF,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=ws.clone(),this._eraseAttrDataInternal=ws.clone(),this._onRequestBell=this._register(new ze),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new ze),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new ze),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new ze),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new ze),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new ze),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new ze),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new ze),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new ze),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new ze),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new ze),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new ze),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new ze),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 z0(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(Ee.BEL,()=>this.bell()),this._parser.setExecuteHandler(Ee.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(Ee.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(Ee.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(Ee.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(Ee.BS,()=>this.backspace()),this._parser.setExecuteHandler(Ee.HT,()=>this.tab()),this._parser.setExecuteHandler(Ee.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(Ee.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 Hn(d=>(this.setTitle(d),this.setIconName(d),!0))),this._parser.registerOscHandler(1,new Hn(d=>this.setIconName(d))),this._parser.registerOscHandler(2,new Hn(d=>this.setTitle(d))),this._parser.registerOscHandler(4,new Hn(d=>this.setOrReportIndexedColor(d))),this._parser.registerOscHandler(8,new Hn(d=>this.setHyperlink(d))),this._parser.registerOscHandler(10,new Hn(d=>this.setOrReportFgColor(d))),this._parser.registerOscHandler(11,new Hn(d=>this.setOrReportBgColor(d))),this._parser.registerOscHandler(12,new Hn(d=>this.setOrReportCursorColor(d))),this._parser.registerOscHandler(104,new Hn(d=>this.restoreIndexedColor(d))),this._parser.registerOscHandler(110,new Hn(d=>this.restoreFgColor(d))),this._parser.registerOscHandler(111,new Hn(d=>this.restoreBgColor(d))),this._parser.registerOscHandler(112,new Hn(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 Os)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 mk((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"),bk))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${bk} 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>ha&&(l=this._parseStack.position+ha)}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<ha&&(this._parseBuffer=new Uint32Array(Math.min(e.length,ha))),u||this._dirtyRowTracker.clearRange(),e.length>ha)for(let d=l;d<e.length;d+=ha){let p=d+ha<e.length?d+ha: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),f=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);f<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(f,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,f=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 v=t;v<s;++v){if(n=e[v],n<127&&l){let E=l[String.fromCharCode(n)];E&&(n=E.charCodeAt(0))}let w=this._unicodeService.charProperties(n,x);o=Ja.extractWidth(w);let k=Ja.extractShouldJoin(w),N=k?Ja.extractWidth(x):0;if(x=w,u&&this._onA11yChar.fire(pa(n)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+o-N>h){if(f){let E=g,T=this._activeBuffer.x-N;for(this._activeBuffer.x=N,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),N>0&&g instanceof Lc&&g.copyCellsFrom(E,T,0,N,!1);T<h;)E.setCellFromCodepoint(T++,0,1,p)}else if(this._activeBuffer.x=h-1,o===2)continue}if(k&&this._activeBuffer.x){let E=g.getWidth(this._activeBuffer.x-1)?1:2;g.addCodepointToCell(this._activeBuffer.x-E,n,o);for(let T=o-N;--T>=0;)g.setCellFromCodepoint(this._activeBuffer.x++,0,0,p);continue}if(d&&(g.insertCells(this._activeBuffer.x,o-N,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=>xk(s.params[0],this._optionsService.rawOptions.windowOptions)?t(s):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new mk(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Hn(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(ws));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=Ja.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 f=h;for(let d=1;d<s;++d)u.copyWithin(f,0,h),f+=h;return this.print(u,0,f),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(Ee.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(Ee.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(Ee.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(Ee.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(Ee.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,Ya),this._charsetService.setgCharset(1,Ya),this._charsetService.setgCharset(2,Ya),this._charsetService.setgCharset(3,Ya);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;(k=>(k[k.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",k[k.SET=1]="SET",k[k.RESET=2]="RESET",k[k.PERMANENTLY_SET=3]="PERMANENTLY_SET",k[k.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(s||={});let n=this._coreService.decPrivateModes,{activeProtocol:o,activeEncoding:l}=this._coreMouseService,u=this._coreService,{buffers:h,cols:f}=this._bufferService,{active:d,alt:p}=h,g=this._optionsService.rawOptions,x=(k,N)=>(u.triggerDataEvent(`${Ee.ESC}[${t?"":"?"}${k};${N}$y`),!0),v=k=>k?1:2,w=e.params[0];return t?w===2?x(w,4):w===4?x(w,v(u.modes.insertMode)):w===12?x(w,3):w===20?x(w,v(g.convertEol)):x(w,0):w===1?x(w,v(n.applicationCursorKeys)):w===3?x(w,g.windowOptions.setWinLines?f===80?2:f===132?1:0:0):w===6?x(w,v(n.origin)):w===7?x(w,v(n.wraparound)):w===8?x(w,3):w===9?x(w,v(o==="X10")):w===12?x(w,v(g.cursorBlink)):w===25?x(w,v(!u.isCursorHidden)):w===45?x(w,v(n.reverseWraparound)):w===66?x(w,v(n.applicationKeypad)):w===67?x(w,4):w===1e3?x(w,v(o==="VT200")):w===1002?x(w,v(o==="DRAG")):w===1003?x(w,v(o==="ANY")):w===1004?x(w,v(n.sendFocus)):w===1005?x(w,4):w===1006?x(w,v(l==="SGR")):w===1015?x(w,4):w===1016?x(w,v(l==="SGR_PIXELS")):w===1048?x(w,1):w===47||w===1047||w===1049?x(w,v(d===p)):w===2004?x(w,v(n.bracketedPasteMode)):w===2026?x(w,v(n.synchronizedOutput)):x(w,0)}_updateAttrColor(e,t,s,n,o){return t===2?(e|=50331648,e&=-16777216,e|=gu.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=ws.fg,e.bg=ws.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|=ws.fg&16777215):s===49?(n.bg&=-67108864,n.bg|=ws.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|=ws.fg&16777215,n.bg&=-67108864,n.bg|=ws.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",s);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${Ee.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,s=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Ee.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(`${Ee.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=ws.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(!xk(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(`${Ee.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>gk&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>gk&&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(_k(l))if(o==="?")t.push({type:0,index:l});else{let u=pk(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=pk(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]);_k(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,Ya),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(rG[e[0]],Os[e[1]]||Ya),!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=ws.clone(),this._eraseAttrDataInternal=ws.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 ui;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(`${Ee.ESC}${u}${Ee.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)}},z0=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&&(vk=e,e=t,t=vk),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};z0=os([Fe(0,fn)],z0);function _k(e){return 0<=e&&e<256}var oG=5e7,yk=12,lG=50,cG=class extends mt{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 ze),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>oG)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>=yk?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>=yk)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>lG&&(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()}},B0=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),f={data:e,id:this._nextId++,lines:[h]};return h.onDispose(()=>this._removeMarkerFromLink(f,h)),this._dataByLinkId.set(f.id,f),f.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)))}};B0=os([Fe(0,fn)],B0);var wk=!1,uG=class extends mt{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new ml),this._onBinary=this._register(new ze),this.onBinary=this._onBinary.event,this._onData=this._register(new ze),this.onData=this._onData.event,this._onLineFeed=this._register(new ze),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new ze),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new ze),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new ze),this._instantiationService=new OV,this.optionsService=this._register(new qV(e)),this._instantiationService.setService(mn,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(M0)),this._instantiationService.setService(fn,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(R0)),this._instantiationService.setService(jj,this._logService),this.coreService=this._register(this._instantiationService.createInstance(D0)),this._instantiationService.setService(fo,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(O0)),this._instantiationService.setService(Ej,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Ja)),this._instantiationService.setService(TF,this.unicodeService),this._charsetService=this._instantiationService.createInstance(YV),this._instantiationService.setService(AF,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(B0),this._instantiationService.setService(Aj,this._oscLinkService),this._inputHandler=this._register(new aG(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Zs.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Zs.forward(this._bufferService.onResize,this._onResize)),this._register(Zs.forward(this.coreService.onData,this._onData)),this._register(Zs.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 cG((t,s)=>this._inputHandler.parse(t,s))),this._register(Zs.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new ze),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&&!wk&&(this._logService.warn("writeSync is unreliable and will be removed soon."),wk=!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,o5),t=Math.max(t,l5),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(fk.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(fk(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Qt(()=>{for(let t of e)t.dispose()})}}},dG={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 hG(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=Ee.ESC+"OA":o.key=Ee.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?o.key=Ee.ESC+"OD":o.key=Ee.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?o.key=Ee.ESC+"OC":o.key=Ee.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?o.key=Ee.ESC+"OB":o.key=Ee.ESC+"[B");break;case 8:o.key=e.ctrlKey?"\b":Ee.DEL,e.altKey&&(o.key=Ee.ESC+o.key);break;case 9:if(e.shiftKey){o.key=Ee.ESC+"[Z";break}o.key=Ee.HT,o.cancel=!0;break;case 13:o.key=e.altKey?Ee.ESC+Ee.CR:Ee.CR,o.cancel=!0;break;case 27:o.key=Ee.ESC,e.altKey&&(o.key=Ee.ESC+Ee.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;l?o.key=Ee.ESC+"[1;"+(l+1)+"D":t?o.key=Ee.ESC+"OD":o.key=Ee.ESC+"[D";break;case 39:if(e.metaKey)break;l?o.key=Ee.ESC+"[1;"+(l+1)+"C":t?o.key=Ee.ESC+"OC":o.key=Ee.ESC+"[C";break;case 38:if(e.metaKey)break;l?o.key=Ee.ESC+"[1;"+(l+1)+"A":t?o.key=Ee.ESC+"OA":o.key=Ee.ESC+"[A";break;case 40:if(e.metaKey)break;l?o.key=Ee.ESC+"[1;"+(l+1)+"B":t?o.key=Ee.ESC+"OB":o.key=Ee.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(o.key=Ee.ESC+"[2~");break;case 46:l?o.key=Ee.ESC+"[3;"+(l+1)+"~":o.key=Ee.ESC+"[3~";break;case 36:l?o.key=Ee.ESC+"[1;"+(l+1)+"H":t?o.key=Ee.ESC+"OH":o.key=Ee.ESC+"[H";break;case 35:l?o.key=Ee.ESC+"[1;"+(l+1)+"F":t?o.key=Ee.ESC+"OF":o.key=Ee.ESC+"[F";break;case 33:e.shiftKey?o.type=2:e.ctrlKey?o.key=Ee.ESC+"[5;"+(l+1)+"~":o.key=Ee.ESC+"[5~";break;case 34:e.shiftKey?o.type=3:e.ctrlKey?o.key=Ee.ESC+"[6;"+(l+1)+"~":o.key=Ee.ESC+"[6~";break;case 112:l?o.key=Ee.ESC+"[1;"+(l+1)+"P":o.key=Ee.ESC+"OP";break;case 113:l?o.key=Ee.ESC+"[1;"+(l+1)+"Q":o.key=Ee.ESC+"OQ";break;case 114:l?o.key=Ee.ESC+"[1;"+(l+1)+"R":o.key=Ee.ESC+"OR";break;case 115:l?o.key=Ee.ESC+"[1;"+(l+1)+"S":o.key=Ee.ESC+"OS";break;case 116:l?o.key=Ee.ESC+"[15;"+(l+1)+"~":o.key=Ee.ESC+"[15~";break;case 117:l?o.key=Ee.ESC+"[17;"+(l+1)+"~":o.key=Ee.ESC+"[17~";break;case 118:l?o.key=Ee.ESC+"[18;"+(l+1)+"~":o.key=Ee.ESC+"[18~";break;case 119:l?o.key=Ee.ESC+"[19;"+(l+1)+"~":o.key=Ee.ESC+"[19~";break;case 120:l?o.key=Ee.ESC+"[20;"+(l+1)+"~":o.key=Ee.ESC+"[20~";break;case 121:l?o.key=Ee.ESC+"[21;"+(l+1)+"~":o.key=Ee.ESC+"[21~";break;case 122:l?o.key=Ee.ESC+"[23;"+(l+1)+"~":o.key=Ee.ESC+"[23~";break;case 123:l?o.key=Ee.ESC+"[24;"+(l+1)+"~":o.key=Ee.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=Ee.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?o.key=Ee.DEL:e.keyCode===219?o.key=Ee.ESC:e.keyCode===220?o.key=Ee.FS:e.keyCode===221&&(o.key=Ee.GS);else if((!s||n)&&e.altKey&&!e.metaKey){let u=dG[e.keyCode]?.[e.shiftKey?1:0];if(u)o.key=Ee.ESC+u;else if(e.keyCode>=65&&e.keyCode<=90){let h=e.ctrlKey?e.keyCode-64:e.keyCode+32,f=String.fromCharCode(h);e.shiftKey&&(f=f.toUpperCase()),o.key=Ee.ESC+f}else if(e.keyCode===32)o.key=Ee.ESC+(e.ctrlKey?Ee.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let h=e.code.slice(3,4);e.shiftKey||(h=h.toLowerCase()),o.key=Ee.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=Ee.US),e.key==="@"&&(o.key=Ee.NUL));break}return o}var ms=0,fG=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Qh,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Qh,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||(ms=this._search(t),ms===-1)||this._getKey(this._array[ms])!==t)return!1;do if(this._array[ms]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(ms),!0;while(++ms<this._array.length&&this._getKey(this._array[ms])===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&&(ms=this._search(e),!(ms<0||ms>=this._array.length)&&this._getKey(this._array[ms])===e))do yield this._array[ms];while(++ms<this._array.length&&this._getKey(this._array[ms])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(ms=this._search(e),!(ms<0||ms>=this._array.length)&&this._getKey(this._array[ms])===e))do t(this._array[ms]);while(++ms<this._array.length&&this._getKey(this._array[ms])===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}},zg=0,Sk=0,mG=class extends mt{constructor(){super(),this._decorations=new fG(e=>e?.marker.line),this._onDecorationRegistered=this._register(new ze),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new ze),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Qt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new pG(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=>{zg=o.options.x??0,Sk=zg+(o.options.width??1),e>=zg&&e<Sk&&(!s||(o.options.layer??"bottom")===s)&&n(o)})}},pG=class extends ba{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new ze),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new ze),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=ts.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=ts.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},gG=1e3,xG=class{constructor(e,t=gG){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)}},kk=20,Jh=class extends mt{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 xG(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(`
107
- `))),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(at(o,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Qt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<kk+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
108
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===kk+1&&(this._liveRegion.textContent+=n0.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)||"",f=(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",f),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 f=this._createAccessibilityTreeNode();this._rowElements.unshift(f),this._rowContainer.insertAdjacentElement("afterbegin",f)}else{let f=this._createAccessibilityTreeNode();this._rowElements.push(f),this._rowContainer.appendChild(f)}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:f})=>{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=f<g.length?g[f]: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})`}};Jh=os([Fe(1,Xb),Fe(2,Dr),Fe(3,Or)],Jh);var P0=class extends mt{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 ze),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new ze),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Qt(()=>{ao(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(at(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(at(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(at(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(at(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,f=u.link.range.end.y>e?this._bufferService.cols:u.link.range.end.x;for(let d=h;d<=f;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&&bG(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,ao(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}}};P0=os([Fe(1,Zb),Fe(2,Or),Fe(3,fn),Fe(4,Rj)],P0);function bG(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 vG=class extends uG{constructor(e={}){super(e),this._linkifier=this._register(new ml),this.browser=Xj,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new ml),this._onCursorMove=this._register(new ze),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new ze),this.onKey=this._onKey.event,this._onRender=this._register(new ze),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new ze),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new ze),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new ze),this.onBell=this._onBell.event,this._onFocus=this._register(new ze),this._onBlur=this._register(new ze),this._onA11yCharEmitter=this._register(new ze),this._onA11yTabEmitter=this._register(new ze),this._onWillOpen=this._register(new ze),this._setup(),this._decorationService=this._instantiationService.createInstance(mG),this._instantiationService.setService(xu,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(lV),this._instantiationService.setService(Rj,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(r0)),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(Zs.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Zs.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Zs.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Zs.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(Qt(()=>{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=Wt.toColorRGB(s==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[s]);this.coreService.triggerDataEvent(`${Ee.ESC}]${n};${iG(o)}${Kj.ST}`);break;case 1:if(s==="ansi")this._themeService.modifyColors(l=>l.ansi[t.index]=Ns.toColor(...t.color));else{let l=s;this._themeService.modifyColors(u=>u[l]=Ns.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(Jh,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Ee.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(Ee.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(at(this.element,"copy",t=>{this.hasSelection()&&SF(t,this._selectionService)}));let e=t=>kF(t,this.textarea,this.coreService,this.optionsService);this._register(at(this.textarea,"paste",e)),this._register(at(this.element,"paste",e)),Zj?this._register(at(this.element,"mousedown",t=>{t.button===2&&O2(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(at(this.element,"contextmenu",t=>{O2(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),rv&&this._register(at(this.element,"auxclick",t=>{t.button===1&&wj(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(at(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(at(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(at(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(at(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(at(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(at(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(at(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(at(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",s0.get()),e5||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(aV,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Dr,this._coreBrowserService),this._register(at(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(at(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(C0,this._document,this._helperContainer),this._instantiationService.setService(Mf,this._charSizeService),this._themeService=this._instantiationService.createInstance(T0),this._instantiationService.setService(_l,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Xh),this._instantiationService.setService(Tj,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(j0,this.rows,this.screenElement)),this._instantiationService.setService(Or,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(S0,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(E0),this._instantiationService.setService(Zb,this._mouseService);let n=this._linkifier.value=this._register(this._instantiationService.createInstance(P0,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(y0,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(A0,this.element,this.screenElement,n)),this._instantiationService.setService(MF,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(Zs.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(w0,this.screenElement)),this._register(at(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(Jh,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Yh,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Yh,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(N0,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,f;switch(l.overrideType||l.type){case"mousemove":f=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":f=0,h=l.button<3?l.button:3;break;case"mousedown":f=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;f=d<0?0:1,h=4;break;default:return!1}return f===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:f,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(at(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(at(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=Ee.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){yj(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=hG(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===Ee.ETX||s.key===Ee.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)&&(_G(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(ws));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(Ee.ESC+"[I"):this.coreService.triggerDataEvent(Ee.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(`${Ee.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(`${Ee.ESC}[6;${o};${n}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function _G(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var yG=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)}},wG=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 ui)}translateToString(e,t,s){return this._line.translateToString(e,t,s)}},Nk=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 wG(t)}getNullCell(){return new ui}},SG=class extends mt{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new ze),this.onBufferChange=this._onBufferChange.event,this._normal=new Nk(this._core.buffers.normal,"normal"),this._alternate=new Nk(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)}},kG=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)}},NG=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}},CG=["cols","rows"],Ui=0,EG=class extends mt{constructor(e){super(),this._core=this._register(new vG(e)),this._addonManager=this._register(new yG),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(CG.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 kG(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new NG(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 SG(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
109
- `,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 s0.get()},set promptLabel(e){s0.set(e)},get tooMuchOutput(){return n0.get()},set tooMuchOutput(e){n0.set(e)}}}_verifyIntegers(...e){for(Ui of e)if(Ui===1/0||isNaN(Ui)||Ui%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Ui of e)if(Ui&&(Ui===1/0||isNaN(Ui)||Ui%1!==0||Ui<0))throw new Error("This API only accepts positive integers")}};const Bg={state:"connecting",cwd:"Local workspace",detail:"Opening shell"},av=1;function jG(e){return{focus:e.focus,refit:e.refit,restart:()=>e.sendControl("restart"),stop:()=>e.sendControl("stop")}}function AG(e,t,s){if(!e||e.readyState!==av)return;const n=t?.proposeDimensions();e.send(JSON.stringify({cols:n?.cols,rows:n?.rows,type:s}))}function TG(e,t){if(!e)return;const s=t.schedule(()=>{t.refit(),t.focus()});return()=>t.cancel(s)}function RG(e){const t=e.location??window.location,s=e.createSocket??(p=>new WebSocket(p));e.reportStatus(e.initialStatus);const n=s(MG(e.sessionId,t));let o=!1,l;const u=[],h=e.scheduleInitialInput??(p=>{const g=window.setTimeout(p,200);return()=>window.clearTimeout(g)}),f=()=>{l?.(),l=h(()=>{l=void 0,(e.claimInitialInput?.()??[]).forEach((g,x)=>{const v=()=>n.send(JSON.stringify({data:g,type:"input"}));if(x===0)v();else{const w=e.scheduleInput??((k,N)=>{const E=window.setTimeout(k,N);return()=>window.clearTimeout(E)});u.push(w(v,x*(e.initialInputIntervalMs??75)))}})})},d=e.terminal.onData(p=>{o||n.readyState===av&&n.send(JSON.stringify({data:p,type:"input"}))});return n.addEventListener("open",()=>{o||(e.reportStatus(p=>({...p,state:"running",detail:"Shell connected"})),e.sendResize())}),n.addEventListener("message",p=>{if(o)return;const g=DG(p.data);if(g){if(g.type==="output"){e.terminal.write(g.data),f();return}if(g.type==="error"){e.reportStatus(x=>({...x,state:"error",detail:g.error}));return}e.reportStatus(x=>({state:g.state==="idle"?"connecting":g.state,cwd:g.cwd??x.cwd,detail:g.error??g.shell??"Shell connected"}))}}),n.addEventListener("close",()=>{o||e.reportStatus(p=>({...p,state:p.state==="exited"?p.state:"exited",detail:"Socket closed"}))}),n.addEventListener("error",()=>{o||e.reportStatus(p=>({...p,state:"error",detail:"Terminal socket error"}))}),{socket:n,dispose:()=>{o||(o=!0,l?.(),u.forEach(p=>p()),d.dispose(),n.close())}}}const u5=_.forwardRef(function({sessionId:t,active:s,claimInitialInput:n,initialInputIntervalMs:o,onStatusChange:l},u){const h=_.useRef(null),f=_.useRef(null),d=_.useRef(null),p=_.useRef(null),g=_.useRef(l),x=_.useRef(Bg),v=Us();_.useEffect(()=>{g.current=l},[l]);const w=_.useCallback(E=>{const T=typeof E=="function"?E(x.current):E;x.current=T,g.current?.(T)},[]),k=_.useCallback(()=>{const E=d.current;if(!E)return;E.fit();const T=E.proposeDimensions();if(!T)return;if(v){zD(t,T.cols,T.rows);return}const A=p.current;A?.readyState===av&&A.send(JSON.stringify({cols:T.cols,rows:T.rows,type:"resize"}))},[v,t]),N=_.useCallback(E=>{v||AG(p.current,d.current,E)},[v]);return _.useImperativeHandle(u,()=>jG({focus:()=>f.current?.focus(),refit:k,sendControl:N}),[N,k]),_.useEffect(()=>{const E=h.current;if(!E)return;const T=new EG({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"}}),A=new bF;T.loadAddon(A),T.open(E),f.current=T,d.current=A;let C;if(v){w(Bg);let $=null,O=!1,P;const B=T.onData(G=>{_w(t,G)});PD(t,G=>{T.write(G),P!==void 0&&window.clearTimeout(P),P=window.setTimeout(()=>{P=void 0,(async()=>{const F=n?.()??[];for(let z=0;z<F.length;z+=1)z>0&&await new Promise(U=>window.setTimeout(U,o??75)),await _w(t,F[z])})()},200)}).then(G=>{if(O){G();return}$=G,w(F=>({...F,state:"running",detail:"Shell connected"})),LD(t),k()},G=>{O||w(F=>({...F,state:"error",detail:G instanceof Error?G.message:String(G)}))}),C=()=>{O=!0,P!==void 0&&window.clearTimeout(P),B.dispose(),$?.()}}else{const $=RG({claimInitialInput:n,initialInputIntervalMs:o,initialStatus:Bg,reportStatus:w,sendResize:k,sessionId:t,terminal:T});p.current=$.socket,C=()=>{$.dispose(),p.current=null}}window.addEventListener("resize",k);const R=window.setTimeout(k,0),D=new ResizeObserver(()=>k());return D.observe(E),()=>{window.removeEventListener("resize",k),window.clearTimeout(R),D.disconnect(),C(),T.dispose(),f.current=null,d.current=null}},[w,t,k,v]),_.useEffect(()=>TG(s,{cancel:E=>window.clearTimeout(E),focus:()=>f.current?.focus(),refit:k,schedule:E=>window.setTimeout(E,0)}),[s,k]),i.jsx("section",{"aria-label":"terminal viewport",className:ae("h-full min-h-0 overflow-hidden bg-[#090909] px-3 py-0.5",!s&&"hidden"),children:i.jsx("div",{className:"h-full w-full",ref:h})})});function MG(e,t){const s=t.protocol==="https:"?"wss:":"ws:",n=encodeURIComponent(e);return`${s}//${t.host}/api/terminal/socket?id=${n}`}function DG(e){if(typeof e!="string")return null;try{const t=JSON.parse(e);return typeof t?.type=="string"?t:null}catch{return null}}const OG=new Set(["c","cpp","cs","go","java","js","jsx","kt","mjs","py","rs","swift","ts","tsx"]),LG=new Set([".env",".gitignore","components.json","dockerfile","package.json","tsconfig.json","vite.config.ts"]),zG=new Set(["conf","config","ini","toml","yaml","yml"]),BG=new Set(["csv","json","sql","xml"]),PG=new Set(["md","mdx","rst","txt"]),IG=new Set(["gif","jpeg","jpg","png","svg","webp"]),$G=new Set(["package-lock.json","pnpm-lock.yaml","yarn.lock"]),HG=new Set(["css","less","sass","scss"]);function UG(e){const t=e.split("/").pop()?.toLowerCase()??e.toLowerCase(),s=t.includes(".")?t.split(".").pop()??"":"";return $G.has(t)||t.endsWith(".lock")?"lock":FG(t)?"test":LG.has(t)||zG.has(s)?"config":HG.has(s)?"style":IG.has(s)?"image":PG.has(s)?"document":BG.has(s)?"data":OG.has(s)?"code":"generic"}function FG(e){return e.includes(".test.")||e.includes(".spec.")||e.endsWith("_test.go")}function ov({path:e,className:t}){const s=UG(e),n=qG[s];return i.jsx(n,{"aria-label":`${s} file`,className:ae("size-3.5 shrink-0",VG[s],t)})}const qG={code:dC,config:mb,data:di,document:ab,generic:mC,image:g6,lock:O6,style:yC,test:qR},VG={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 GG(e){const t=e.lastIndexOf(".");return t>0?e.slice(t):""}function WG({onPick:e,onClose:t}){const[s,n]=_.useState(""),[o,l]=_.useState(null),[u,h]=_.useState(null),[f,d]=_.useState(!1),p=_.useRef(null),g=o?o.parent!==o.path:!1;return _.useEffect(()=>{function x(v){p.current&&!p.current.contains(v.target)&&t()}return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[t]),_.useEffect(()=>{let x=!0;return d(!0),h(null),YC(s,{files:!0}).then(v=>x&&l(v)).catch(v=>x&&h(v instanceof Error?v.message:String(v))).finally(()=>x&&d(!1)),()=>{x=!1}},[s]),i.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:[i.jsxs("div",{className:"flex items-center gap-1 border-b border-border px-2 py-1.5",children:[i.jsx(J,{"aria-label":"Parent folder",className:"size-7",disabled:!g,onClick:()=>o&&n(o.parent),size:"icon",type:"button",variant:"ghost",children:i.jsx(hf,{})}),i.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-muted-foreground",title:o?.path,children:o?.path??"…"}),f?i.jsx(jt,{className:"size-3.5 animate-spin text-muted-foreground"}):null,o?i.jsxs(J,{className:"h-7 px-2 text-[11px]",onClick:()=>e(o.path),size:"sm",title:"Attach this folder",type:"button",variant:"outline",children:[i.jsx(kR,{})," This folder"]}):null,i.jsx(J,{"aria-label":"Close",className:"size-7",onClick:t,size:"icon",type:"button",variant:"ghost",children:i.jsx(Ut,{})})]}),i.jsx("div",{className:"max-h-64 overflow-auto p-1",children:u?i.jsx(Qe,{variant:"destructive",className:"m-1",children:u}):o&&o.entries.length===0?i.jsx(Qe,{variant:"muted",className:"m-1 text-center",children:"Empty folder."}):o?.entries.map(x=>{const v=x.isDir?"":GG(x.name);return i.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?i.jsx(co,{className:"size-3.5 shrink-0 text-amber-600"}):i.jsx(ov,{path:x.path}),i.jsx("span",{className:"min-w-0 flex-1 truncate",children:x.name}),v?i.jsx("span",{className:"shrink-0 rounded bg-muted px-1 font-mono text-[10px] text-muted-foreground",children:v}):null]},x.path)})})]})}function KG(e,t){const s=t?.trim()||e.split(/\r?\n/).find(n=>n.trim())?.trim()||"Agent task";return s.length>60?`${s.slice(0,57).trimEnd()}…`:s}function YG({onSubmitted:e}){const{activeSource:t,clearSource:s,configured:n,createTask:o,creating:l,draft:u,focusNonce:h,insertPath:f,onboarding:d,provider:p,setDraft:g,setOnboarding:x}=At(),[v,w]=_.useState(!1),[k,N]=_.useState(""),E=_.useRef(null);_.useEffect(()=>{const R=requestAnimationFrame(()=>{const D=E.current;if(!D)return;D.focus();const $=D.value.length;D.setSelectionRange($,$)});return()=>cancelAnimationFrame(R)},[h]),_.useLayoutEffect(()=>{E.current&&(E.current.style.height="auto",E.current.style.height=`${E.current.scrollHeight}px`)},[u]);async function T(R=u,D){!R.trim()||l||n!==!0||!await o({prompt:R,label:KG(R,D??t?.label),source:t??void 0})||(g(""),s(),x(!1),N(""),e?.())}function A(R){R.key==="Enter"&&!R.shiftKey&&(R.preventDefault(),T())}const C=p?.id==="codex"?i.jsx(ho,{className:"size-4"}):i.jsx(Sa,{className:"size-4"});return i.jsx("div",{className:"flex h-full items-center justify-center overflow-auto p-6",children:i.jsxs("div",{className:"w-full max-w-3xl",children:[n===null?i.jsxs("div",{className:"mb-3 border-l-2 border-border pl-3 text-xs text-muted-foreground",children:["Checking ",p?.label??"agent"," availability…"]}):null,n===!1?i.jsxs("div",{className:"mb-3 border-l-2 border-amber-500/70 pl-3 text-xs text-muted-foreground",children:[i.jsxs("span",{className:"font-medium text-foreground",children:[p?.label??"Agent"," is not installed."]})," ",p?.installHint]}):null,t?i.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[i.jsx("span",{className:"font-mono uppercase tracking-wide",children:"Source"}),i.jsx("span",{className:"rounded-sm bg-muted px-1.5 py-0.5 text-foreground",children:t.label}),i.jsx("button",{"aria-label":"Clear source",onClick:s,type:"button",children:i.jsx(Ut,{className:"size-3"})})]}):null,i.jsxs("div",{className:"border border-border bg-card shadow-sm",children:[d?i.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[i.jsx(C6,{className:"size-4 text-muted-foreground"}),i.jsx("input",{"aria-label":"Repository URL",className:"min-w-0 flex-1 bg-transparent text-sm outline-none",disabled:n!==!0,onChange:R=>N(R.target.value),placeholder:"https://github.com/owner/repository",value:k}),i.jsx(J,{disabled:n!==!0||!k.trim()||!!l,onClick:()=>{T(Y$(k),`Onboard ${k}`)},size:"sm",children:"Onboard"})]}):null,i.jsx("textarea",{"aria-label":"Agent task prompt",className:"block max-h-40 min-h-20 w-full resize-none bg-transparent px-3 py-3 text-sm leading-relaxed outline-none placeholder:text-muted-foreground",disabled:n!==!0,onChange:R=>g(R.target.value),onKeyDown:A,placeholder:"Describe the complete task…",ref:E,rows:2,value:u}),i.jsxs("div",{className:"flex h-10 items-center gap-1 border-t border-border px-2",children:[i.jsxs("span",{className:"flex items-center gap-1.5 px-1 text-xs font-medium",children:[C,p?.label??"Agent"]}),i.jsx("button",{"aria-label":"Attach file or folder",className:"grid size-7 place-items-center rounded-sm text-muted-foreground hover:bg-muted hover:text-foreground",onClick:()=>w(R=>!R),type:"button",children:i.jsx(uM,{className:"size-3.5"})}),i.jsx("button",{className:"px-2 text-[11px] text-muted-foreground hover:text-foreground",onClick:()=>x(!d),type:"button",children:"Repository URL"}),i.jsx("span",{className:"flex-1"}),i.jsx("span",{className:"hidden text-[10px] text-muted-foreground sm:inline",children:"Shift+Enter for newline"}),i.jsx(J,{"aria-label":"Run agent task",className:"size-7",disabled:n!==!0||!u.trim()||!!l,onClick:()=>{T()},size:"icon",children:i.jsx(uf,{})})]})]}),v?i.jsx("div",{className:"relative mt-2",children:i.jsx(WG,{onClose:()=>w(!1),onPick:R=>{f(R),w(!1)}})}):null]})})}function XG(e){return e==="running"?"fill-emerald-500 text-emerald-500":e==="error"?"fill-destructive text-destructive":"fill-muted-foreground/50 text-muted-foreground/50"}function ZG({tasks:e,activeTaskId:t,onActivate:s,onClose:n,pendingTaskIds:o}){return i.jsx("div",{"aria-label":"Agent tasks",className:"flex min-w-0 flex-1 items-stretch gap-px overflow-x-auto",role:"tablist",children:e.map(l=>{const u=l.label||`${l.provider==="codex"?"Codex":"Claude"} task`,h=l.id===t;return i.jsxs("div",{className:ae("group/tab flex h-9 shrink-0 items-center border-x border-transparent",h&&"border-border bg-background"),children:[i.jsxs("button",{"aria-controls":`agent-panel-${l.id}`,"aria-label":`Open task ${u}`,"aria-selected":h,className:"flex h-full max-w-56 items-center gap-2 px-3 text-xs",id:`agent-tab-${l.id}`,onClick:()=>s(l.id),role:"tab",type:"button",children:[i.jsx(ul,{"aria-hidden":!0,className:ae("size-2",XG(l.state))}),i.jsx("span",{className:ae("truncate font-mono text-[11px]",h?"text-foreground":"text-muted-foreground"),children:u})]}),i.jsx("button",{"aria-label":`Close task ${u}`,className:"mr-1 grid size-6 place-items-center rounded-sm text-muted-foreground opacity-50 hover:bg-muted hover:text-foreground group-hover/tab:opacity-100 disabled:pointer-events-none disabled:opacity-25",disabled:o?.has(l.id),onClick:()=>n(l.id),type:"button",children:i.jsx(Ut,{className:"size-3"})})]},l.id)})})}function QG(e){return[`\x1B[200~${e}\x1B[201~`,"\r"]}function JG(e){return e==="claude"?500:75}function Lf({className:e}){return i.jsx("svg",{className:ae("size-3.5",e),viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:i.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"})})}const eW=[{page:"services",label:"Services",icon:i.jsx(fb,{})},{page:"git",label:"Git Review",icon:i.jsx(Gn,{})},{page:"github",label:"GitHub",icon:i.jsx(Lf,{})},{page:"workflows",label:"Workflows",icon:i.jsx(Mh,{})},{page:"errors",label:"Error Inbox",icon:i.jsx(Zc,{})},{page:"database",label:"Database",icon:i.jsx(di,{})},{page:"terminal",label:"Terminal",icon:i.jsx(xf,{})},{page:"agent",label:"Agent",icon:i.jsx(rC,{})},{page:"agent-env",label:"Agent Env",icon:i.jsx(hb,{})}];function tW(e,t){const s=Math.max(0,t-48),n=Math.min(180,s);return Math.max(n,Math.min(s,e))}function sW(e){return`${e.charAt(0).toUpperCase()}${e.slice(1)}`}function nW({currentPage:e="services",git:t,onGitRefresh:s,onNavigate:n}){const{activeTaskId:o,claimInitialPrompt:l,closeTask:u,draft:h,focusNonce:f,onboarding:d,open:p,pendingTaskIds:g,provider:x,providers:v,selectProvider:w,setActiveTaskId:k,setOpen:N,stopTask:E,tasks:T,terminalError:A,updateTaskStatus:C}=At(),[R,D]=_.useState(()=>!!(h||f||d||T.length===0)),[$,O]=_.useState(null),[P,B]=_.useState(!1),[G,F]=_.useState(!1),z=_.useRef(null),U=_.useRef(f),K=_.useRef(d),I=_.useRef(T.length),Z=T.find(ee=>ee.id===o)??null;_.useEffect(()=>{T.length===0?D(!0):I.current===0&&!h&&D(!1),I.current=T.length},[h,T.length]),_.useEffect(()=>{f!==U.current&&D(!0),U.current=f},[f]),_.useEffect(()=>{d&&!K.current&&D(!0),K.current=d},[d]),_.useEffect(()=>()=>z.current?.(),[]),_.useEffect(()=>{if(!G)return;const ee=fe=>{fe.key==="Escape"&&F(!1)};return window.addEventListener("keydown",ee),()=>window.removeEventListener("keydown",ee)},[G]),_.useEffect(()=>{p||F(!1)},[p]);const W=()=>{F(!1),N(!1)},te=ee=>{n?.(ee),W()};function X(ee){ee.preventDefault(),ee.currentTarget.setPointerCapture?.(ee.pointerId),B(!0);const fe=Me=>O(tW(window.innerHeight-Me.clientY,window.innerHeight)),ie=()=>{window.removeEventListener("pointermove",fe),window.removeEventListener("pointerup",Se),z.current=null},Se=()=>{B(!1),ie()};z.current?.(),z.current=ie,window.addEventListener("pointermove",fe),window.addEventListener("pointerup",Se)}const q=(Z?.provider??x?.id)==="codex"?ho:Sa,le=Z?Z.provider==="codex"?"Codex":"Claude Code":x?.label??"Agent";return i.jsxs(i.Fragment,{children:[p?null:i.jsxs("button",{"aria-label":"Open agent terminal",className:"fixed inset-x-0 bottom-0 z-50 flex h-9 w-full items-center gap-2 border-t border-border bg-card/95 px-3 text-left shadow-[0_-4px_18px_-14px_rgba(0,0,0,.45)] backdrop-blur",onClick:()=>N(!0),type:"button",children:[i.jsx(q,{className:"size-3.5 text-primary"}),i.jsx("span",{className:"text-xs font-medium",children:le}),i.jsx("span",{className:"h-3 w-px bg-border"}),i.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-muted-foreground",children:Z?.label??"New agent task"}),Z?i.jsxs("span",{className:ae("font-mono text-[10px] text-muted-foreground",Z.state==="running"&&"text-emerald-600",Z.state==="error"&&"text-destructive"),children:[i.jsx("span",{className:"sr-only",children:"Active task status: "}),sW(Z.state)]}):null,T.length>1?i.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:T.length}):null,i.jsx(hf,{className:"size-3.5 text-muted-foreground"})]}),i.jsxs("div",{"aria-hidden":!p||void 0,className:ae("fixed inset-x-0 bottom-0 z-50 flex flex-col overflow-hidden border-t border-border bg-card shadow-[0_-12px_30px_-20px_rgba(0,0,0,.5)]",!G&&(P||"transition-[height] duration-150"),!p&&"invisible pointer-events-none border-transparent shadow-none"),inert:!p||void 0,style:G?{height:"auto",top:Us()?32:0}:{height:p?$??"50vh":0},children:[G?i.jsx("nav",{"aria-label":"Full-screen navigation",className:"flex h-11 shrink-0 items-center gap-1 overflow-x-auto border-b border-border bg-background px-2",children:eW.map(ee=>i.jsxs("button",{"aria-current":e===ee.page?"page":void 0,"aria-label":ee.label,className:ae("flex h-8 shrink-0 items-center gap-2 rounded-md px-3 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground [&_svg]:size-4",e===ee.page&&"bg-primary text-primary-foreground hover:bg-primary/90 hover:text-primary-foreground"),onClick:()=>te(ee.page),type:"button",children:[ee.icon,i.jsx("span",{children:ee.label})]},ee.page))}):null,i.jsx("div",{"aria-hidden":!0,className:ae("absolute inset-x-0 -top-1 z-20 h-2 cursor-ns-resize",G&&"hidden"),"data-agent-resize-grip":!0,onDoubleClick:()=>O(null),onPointerDown:X}),i.jsxs("div",{className:"flex h-9 shrink-0 items-stretch border-b border-border bg-muted/25",children:[i.jsx("select",{"aria-label":"Agent provider",className:"h-9 max-w-36 border-r border-border bg-transparent px-2 text-xs font-medium outline-none",disabled:v.length<2,onChange:ee=>{w(ee.target.value)},value:x?.id??"claude",children:v.map(ee=>i.jsxs("option",{disabled:!ee.configured,title:ee.configured?void 0:ee.installHint,value:ee.id,children:[ee.label,ee.configured?"":" · not installed"]},ee.id))}),i.jsx(ZG,{activeTaskId:o,onActivate:ee=>{k(ee),D(!1)},onClose:ee=>{u(ee)},pendingTaskIds:g,tasks:T}),i.jsxs("div",{className:"flex shrink-0 items-center border-l border-border px-1",children:[i.jsx("button",{"aria-label":"New agent task",className:"grid size-7 place-items-center rounded-sm text-muted-foreground hover:bg-muted hover:text-foreground",onClick:()=>D(!0),type:"button",children:i.jsx(ps,{className:"size-3.5"})}),Z?.state==="running"?i.jsx("button",{"aria-label":`Stop task ${Z.label??"Agent task"}`,className:"grid size-7 place-items-center rounded-sm text-muted-foreground hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-35",disabled:g.has(Z.id),onClick:()=>{E(Z.id)},type:"button",children:i.jsx(ro,{className:"size-3"})}):null,i.jsx("button",{"aria-label":G?"Restore terminal dock":"Enter full-screen terminal",className:"grid size-7 place-items-center rounded-sm text-muted-foreground hover:bg-muted hover:text-foreground",onClick:()=>F(ee=>!ee),type:"button",children:G?i.jsx(db,{className:"size-3.5"}):i.jsx(ub,{className:"size-3.5"})}),i.jsx("button",{"aria-label":"Collapse agent terminal",className:"grid size-7 place-items-center rounded-sm text-muted-foreground hover:bg-muted hover:text-foreground",onClick:W,type:"button",children:i.jsx(Wn,{className:"size-3.5"})})]})]}),A?i.jsx("div",{role:"alert",className:"border-b border-destructive/30 bg-destructive/5 px-3 py-1 font-mono text-[11px] text-destructive",children:A}):null,t&&(R||T.length===0)?i.jsx("div",{className:"shrink-0 px-3 pt-2",children:i.jsx(mF,{git:t,onRefresh:s})}):null,i.jsxs("div",{className:"relative min-h-0 flex-1 bg-[#101214]",children:[T.map(ee=>i.jsx("div",{"aria-labelledby":`agent-tab-${ee.id}`,className:ae("absolute inset-0",(!p||R||ee.id!==o)&&"invisible pointer-events-none"),id:`agent-panel-${ee.id}`,role:"tabpanel",children:i.jsx(u5,{active:p&&!R&&ee.id===o,claimInitialInput:()=>{const fe=l(ee.id);return fe?QG(fe):void 0},initialInputIntervalMs:JG(ee.provider??"claude"),onStatusChange:fe=>C(ee.id,{state:fe.state==="connecting"?"idle":fe.state,cwd:fe.cwd,error:fe.state==="error"?fe.detail:void 0}),sessionId:ee.id})},ee.id)),p&&(R||T.length===0)?i.jsx("div",{className:"absolute inset-0 bg-background",children:i.jsx(YG,{onSubmitted:()=>D(!1)})}):null]})]})]})}function ol(e,t){const s=`nomoreide:${e}`,[n,o]=_.useState(()=>{try{const u=window.localStorage.getItem(s);return u===null?t:JSON.parse(u)}catch{return t}}),l=_.useCallback(u=>{o(u);try{window.localStorage.setItem(s,JSON.stringify(u))}catch{}},[s]);return[n,l]}function zf(e,t){if(!e)return!1;const s=t.endsWith("/")?t.slice(0,-1):t;return e===s||e.startsWith(`${s}/`)}function iW(e,t){return!t||!e?!0:zf(e,t)}function rW(e,t){const s=e.config.services.filter(h=>zf(h.cwd,t.path)),n=new Set(s.map(h=>h.name)),o=e.config.bundles.map(h=>({...h,services:h.services.filter(f=>n.has(f))})).filter(h=>h.services.length>0),l=Object.fromEntries(Object.entries(e.runtime.services).filter(([h])=>n.has(h))),u=Object.fromEntries(Object.entries(e.health).filter(([h])=>n.has(h)));return{...e,config:{...e.config,services:s,bundles:o},runtime:{services:l},health:u,ports:e.ports.filter(h=>h.services.some(f=>n.has(f))),logs:e.logs.filter(h=>n.has(h.service)),timeline:e.timeline.filter(h=>!h.service||n.has(h.service))}}const Pg={host:"",port:"",user:"",password:"",database:"",ssl:!1},aW="localhost";function I0(e,t,{includePassword:s=!0}={}){const n=e==="mysql"?"mysql":"postgres",o=t.host.trim()||aW,l=t.port.trim(),u=t.database.trim().replace(/^\//,""),h=t.user.trim(),f=s&&t.password,d=h?`${encodeURIComponent(h)}${f?`:${encodeURIComponent(t.password)}`:""}@`:"",p=l?`:${l}`:"",g=e==="postgres"&&t.ssl?"?sslmode=require":"";return`${n}://${d}${o}${p}/${u}${g}`}function $0(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:Ck(t.username),password:Ck(t.password),database:t.pathname.replace(/^\//,""),ssl:t.searchParams.get("sslmode")==="require"||t.searchParams.has("ssl")}}function oW(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 Ck(e){try{return decodeURIComponent(e)}catch{return e}}const lW=[{value:"postgres",label:"Postgres"},{value:"mysql",label:"MySQL"},{value:"sqlite",label:"SQLite"}];function cW({onClose:e,onSaved:t,initial:s,projects:n=[]}){const{error:o,success:l}=as(),u=!!s,h=_.useMemo(()=>uW(s),[s]),[f,d]=_.useState(h.engine),[p,g]=_.useState(h.name),[x,v]=_.useState(h.url),[w,k]=_.useState(h.fields),[N,E]=_.useState([]),[T,A]=_.useState(s?.projectPath??""),[C,R]=_.useState({status:"idle"}),[D,$]=_.useState(!1),[O,P]=_.useState(!1);_.useEffect(()=>{u||E7().then(E).catch(()=>E([]))},[u]);const B=f==="sqlite",G=B?x.trim():I0(f,w),F=B?!!x.trim():!!(w.host.trim()&&w.database.trim());function z(){R({status:"idle"})}function U(q,le){return I0(q,le,{includePassword:!1})}function K(q){d(q),z(),q!=="sqlite"&&v(U(q,w))}function I(q){const le={...w,...q};k(le),v(U(f,le)),z()}function Z(q){z();const le=oW(q),ee=le??f;le&&le!==f&&d(le);const fe=le==="sqlite"?null:$0(q);if(!fe){v(q);return}fe.password?(k(fe),v(U(ee,fe))):(k({...fe,password:w.password}),v(q))}function W(q){d(q.engine);const le=q.engine==="sqlite"?null:$0(q.url);le?(k(le),v(U(q.engine,le))):v(q.url),z(),p.trim()||g(dW(q));const ee=q.cwd?n.find(fe=>zf(q.cwd,fe.path)):void 0;ee&&A(ee.path)}function te(){return p.trim()?B?x.trim()?null:"Database file path is required.":w.host.trim()?w.database.trim()?null:"Database name is required.":"Host is required.":"Name is required."}async function X(){if(F){$(!0),z();try{const q=await A7({engine:f,url:G});R(q.ok?{status:"ok",message:"Connected"}:{status:"fail",message:q.error??"Connection failed"})}catch(q){R({status:"fail",message:q instanceof Error?q.message:String(q)})}finally{$(!1)}}}async function V(){const q=te();if(q){o(q);return}P(!0);try{await j7({name:p.trim(),engine:f,url:G,projectPath:T}),l(`Saved connection "${p.trim()}".`),t(),e()}catch(le){o(le instanceof Error?le.message:String(le))}finally{P(!1)}}return i.jsx(Vn,{icon:i.jsx(di,{}),onClose:e,title:u?"Edit database connection":"Add database connection",children:i.jsxs("div",{className:"flex flex-col gap-4",children:[N.length>0?i.jsxs("section",{children:[i.jsxs("p",{className:"mb-1.5 flex items-center gap-1.5 text-xs font-medium text-muted-foreground",children:[i.jsx(JM,{className:"size-3.5"}),"Found in your services"]}),i.jsx("div",{className:"flex flex-wrap gap-1.5",children:N.map(q=>i.jsxs("button",{type:"button",onClick:()=>W(q),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:q.maskedUrl,children:[i.jsx(Ge,{variant:"outline",size:"small",children:q.engine}),i.jsx("span",{className:"font-mono",children:q.service}),i.jsxs("span",{className:"font-mono text-muted-foreground",children:["·",q.key]})]},`${q.service}:${q.key}`))})]}):null,i.jsxs("section",{children:[i.jsx("p",{className:"mb-1.5 text-xs font-medium text-muted-foreground",children:"Engine"}),i.jsx("div",{className:"flex gap-1.5",children:lW.map(q=>i.jsx(J,{size:"sm",variant:f===q.value?"default":"outline",onClick:()=>K(q.value),disabled:u,type:"button",children:q.label},q.value))})]}),i.jsxs("label",{className:"flex flex-col gap-1.5",children:[i.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Name"}),i.jsx(dt,{value:p,onChange:q=>g(q.target.value),placeholder:"e.g. shop-db",disabled:u}),u?i.jsx("span",{className:"text-[11px] text-muted-foreground",children:"The name identifies the connection and can't be changed here."}):null]}),n.length>0?i.jsxs("label",{className:"flex flex-col gap-1.5",children:[i.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Project"}),i.jsxs("select",{className:"h-9 rounded-md border border-border bg-background px-2 text-sm",onChange:q=>A(q.target.value),value:T,children:[i.jsx("option",{value:"",children:"No project (shared)"}),T&&!n.some(q=>q.path===T)?i.jsx("option",{value:T,children:T}):null,n.map(q=>i.jsx("option",{value:q.path,children:q.name},q.path))]}),i.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Classifies the connection under a project; shared connections show in every project scope."})]}):null,B?null:i.jsxs("section",{className:"flex flex-col gap-3",children:[i.jsxs("div",{className:"flex gap-3",children:[i.jsxs("label",{className:"flex flex-1 flex-col gap-1.5",children:[i.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Host"}),i.jsx(dt,{value:w.host,onChange:q=>I({host:q.target.value}),placeholder:"localhost",className:"font-mono text-xs"})]}),i.jsxs("label",{className:"flex w-24 flex-col gap-1.5",children:[i.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Port"}),i.jsx(dt,{value:w.port,onChange:q=>I({port:q.target.value}),placeholder:f==="mysql"?"3306":"5432",className:"font-mono text-xs"})]})]}),i.jsxs("div",{className:"flex gap-3",children:[i.jsxs("label",{className:"flex flex-1 flex-col gap-1.5",children:[i.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"User"}),i.jsx(dt,{value:w.user,onChange:q=>I({user:q.target.value}),placeholder:"postgres",className:"font-mono text-xs"})]}),i.jsxs("label",{className:"flex flex-1 flex-col gap-1.5",children:[i.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Password"}),i.jsx(dt,{type:"password",value:w.password,onChange:q=>I({password:q.target.value}),placeholder:u?"leave blank to keep current":"••••••••",className:"font-mono text-xs"})]})]}),i.jsxs("label",{className:"flex flex-col gap-1.5",children:[i.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Database"}),i.jsx(dt,{value:w.database,onChange:q=>I({database:q.target.value}),placeholder:"app",className:"font-mono text-xs"})]}),f==="postgres"?i.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[i.jsx("input",{type:"checkbox",checked:w.ssl,onChange:q=>I({ssl:q.target.checked}),className:"size-3.5 accent-primary"}),"Require SSL (adds ",i.jsx("span",{className:"font-mono",children:"?sslmode=require"}),")"]}):null]}),i.jsxs("label",{className:"flex flex-col gap-1.5",children:[i.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:B?"Database file path":"Connection URL"}),i.jsx(dt,{value:x,onChange:q=>Z(q.target.value),placeholder:B?"/abs/path/to/app.db":f==="mysql"?"mysql://user:pass@host:3306/db":"postgres://user:pass@host:5432/db",className:"font-mono text-xs"}),i.jsx("span",{className:"text-[11px] text-muted-foreground",children:B?"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"?i.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"?i.jsx(Ds,{className:"size-3.5"}):i.jsx(Ut,{className:"size-3.5"}),i.jsx("span",{className:"break-all font-mono",children:C.message})]}):null,i.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-border pt-3",children:[i.jsxs(J,{variant:"outline",size:"sm",onClick:()=>{X()},disabled:D||!F,type:"button",children:[D?i.jsx(jt,{className:"animate-spin"}):null,"Test connection"]}),i.jsxs(J,{size:"sm",onClick:()=>{V()},disabled:O,type:"button",children:[O?i.jsx(jt,{className:"animate-spin"}):null,u?"Save changes":"Save"]})]})]})})}function uW(e){if(!e)return{engine:"postgres",name:"",fields:Pg,url:""};if(e.engine==="sqlite")return{engine:"sqlite",name:e.name,fields:Pg,url:e.url};const t=$0(e.url),s=t?{...t,password:""}:Pg;return{engine:e.engine,name:e.name,fields:s,url:I0(e.engine,s,{includePassword:!1})}}function dW(e){try{const s=new URL(e.url).pathname.replace(/^\//,"");if(s)return`${e.service}-${s}`}catch{}return`${e.service}-${e.engine}`}function hW({connections:e,projectLabel:t,selected:s,onSelect:n,onAdd:o,onEdit:l,onRemove:u}){const[h,f]=_.useState(!1),d=_.useRef(null),p=e.find(g=>g.name===s);return _.useEffect(()=>{if(!h)return;function g(x){d.current&&x.target instanceof Node&&!d.current.contains(x.target)&&f(!1)}return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[h]),i.jsxs("div",{className:"relative z-50 flex items-center gap-2",ref:d,children:[i.jsxs(J,{className:"max-w-[240px] justify-start gap-2 rounded-md border-border bg-card",onClick:()=>f(g=>!g),size:"sm",type:"button",variant:"outline",children:[i.jsx(di,{className:"text-muted-foreground"}),i.jsx("span",{className:"truncate",children:p?.name??"Select connection"}),p?i.jsx(Ge,{variant:"outline",size:"small",children:p.engine}):null,i.jsx(Wn,{className:ae("ml-auto transition-transform",h&&"rotate-180")})]}),h?i.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:[i.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[i.jsx(di,{className:"size-3.5 text-muted-foreground"}),i.jsx("div",{className:"text-xs font-semibold",children:"Connections"}),i.jsx(Ge,{className:"ml-auto",variant:"outline",size:"small",children:e.length})]}),i.jsx("div",{className:"max-h-72 overflow-auto",children:e.length?i.jsx("div",{className:"divide-y divide-border",children:e.map(g=>{const x=g.name===s;return i.jsxs("div",{className:ae("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",x&&"bg-muted/70"),children:[i.jsxs("button",{className:"min-w-0 text-left",onClick:()=>{n(g.name),f(!1)},type:"button",children:[i.jsxs("span",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"truncate text-sm font-medium leading-tight",children:g.name}),t?i.jsx(Ge,{className:"shrink-0",size:"small",variant:"outline",children:t(g)??"unassigned"}):null]}),i.jsx("span",{className:"block truncate font-mono text-[10px] leading-tight text-muted-foreground",children:g.url})]}),x?i.jsx(Ds,{className:"size-3.5"}):i.jsx("span",{className:"size-3.5"}),i.jsx(J,{"aria-label":`Edit ${g.name}`,className:"size-6 opacity-0 transition-opacity group-hover:opacity-100",onClick:()=>{l(g),f(!1)},size:"icon",title:`Edit ${g.name}`,type:"button",variant:"ghost",children:i.jsx(dl,{className:"size-3.5"})}),i.jsx(J,{"aria-label":`Remove ${g.name}`,className:"size-6 opacity-0 transition-opacity group-hover:opacity-100",onClick:()=>u(g.name),size:"icon",title:`Remove ${g.name}`,type:"button",variant:"ghost",children:i.jsx(Mi,{className:"size-3.5 text-destructive"})})]},g.name)})}):i.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"No saved connections yet."})}),i.jsx("div",{className:"border-t border-border bg-muted/20 p-2",children:i.jsxs(J,{className:"w-full",onClick:()=>{o(),f(!1)},size:"sm",type:"button",children:[i.jsx(ps,{className:"size-3"}),"Add connection"]})})]}):null]})}function fW({onAddManual:e,onAddWithAi:t}){const[s,n]=_.useState(!1),o=_.useRef(null);_.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 i.jsxs("div",{className:"relative",ref:o,children:[i.jsxs(J,{"aria-label":"Add database connection",onClick:()=>n(u=>!u),size:"sm",type:"button",children:[i.jsx(ps,{className:"size-3.5"}),"Add"]}),s?i.jsxs("div",{className:"absolute right-0 top-9 z-50 w-56 overflow-hidden rounded-lg border border-border bg-card shadow-lg",children:[i.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:[i.jsx(di,{className:"size-3.5 text-muted-foreground"}),"Add connection"]}),i.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:[i.jsx(Ri,{className:"size-3.5 text-muted-foreground"}),"Add with AI"]})]}):null]})}function mW(){const[e,t]=_.useState([]),[s,n]=_.useState(!0),[o,l]=_.useState(null),u=_.useCallback(async()=>{n(!0),l(null);try{t(await BC())}catch(h){l(h instanceof Error?h.message:String(h))}finally{n(!1)}},[]);return _.useEffect(()=>{u()},[u]),{connections:e,loading:s,error:o,refresh:u}}const d5=[50,100,500,1e3];function pW(e){const[t,s]=_.useState(null),[n,o]=_.useState(null),[l,u]=_.useState(!1);_.useEffect(()=>{s(null),o(null)},[e]);const h=_.useCallback(async(d,p)=>{if(!(!e||!d.trim())){u(!0),o(null);try{s(await R7(e,d,p))}catch(g){s(null),o(g instanceof Error?g.message:String(g))}finally{u(!1)}}},[e]),f=_.useCallback(()=>{s(null),o(null)},[]);return{result:t,error:n,running:l,run:h,reset:f}}const gW=["select","show","explain","pragma","describe","desc"];function xW(e){const t=/^\s*([a-z]+)/i.exec(e)?.[1]?.toLowerCase()??"";return gW.includes(t)}function bW(e){const[t,s]=_.useState(null),[n,o]=_.useState(null),[l,u]=_.useState(null),[h,f]=_.useState(!1),[d,p]=_.useState(!1);_.useEffect(()=>{s(null),o(null),u(null)},[e]);const g=_.useCallback(async k=>{if(!(!e||!k.trim())){f(!0),u(null),o(null);try{const N=await kw(e,k,"preview");s({sql:k,preview:N})}catch(N){u(N instanceof Error?N.message:String(N))}finally{f(!1)}}},[e]),x=_.useCallback(async()=>{if(!e||!t)return null;p(!0),u(null);try{const k=await kw(e,t.sql,"commit");return o(k),s(null),k}catch(k){return s(null),u(k instanceof Error?k.message:String(k)),null}finally{p(!1)}},[e,t]),v=_.useCallback(()=>s(null),[]),w=_.useCallback(()=>{s(null),o(null),u(null)},[]);return{pending:t,committed:n,error:l,previewing:h,committing:d,preview:g,commit:x,cancel:v,reset:w}}function vW(e,t){const[s,n]=_.useState(!1),o=_.useCallback(async l=>{if(e){n(!0);try{await M7(e,l),t()}finally{n(!1)}}},[e,t]);return{updating:s,setUnlocked:o}}function _W(e){const[t,s]=_.useState([]),[n,o]=_.useState(null),[l,u]=_.useState(null),[h,f]=_.useState(null),[d,p]=_.useState(null),[g,x]=_.useState(!1),[v,w]=_.useState(!1),[k,N]=_.useState(100),[E,T]=_.useState(0);_.useEffect(()=>{T(0)},[e,n]),_.useEffect(()=>{if(s([]),o(null),u(null),f(null),p(null),!e)return;let O=!1;return x(!0),PC(e).then(P=>{O||(s(P),o(P[0]?.qualifiedName??null))}).catch(P=>{O||f(P instanceof Error?P.message:String(P))}).finally(()=>{O||x(!1)}),()=>{O=!0}},[e]),_.useEffect(()=>{if(u(null),p(null),!e||!n)return;let O=!1;return w(!0),D7(e,n,k,E).then(P=>{O||u(P)}).catch(P=>{O||p(P instanceof Error?P.message:String(P))}).finally(()=>{O||w(!1)}),()=>{O=!0}},[e,n,k,E]);const A=E>0,C=l?l.rowCount===k:!1;function R(O){N(O),T(0)}function D(){C&&T(O=>O+k)}function $(){T(O=>Math.max(0,O-k))}return{tables:t,selectedTable:n,setSelectedTable:o,sample:l,tablesError:h,rowsError:d,loadingTables:g,loadingRows:v,limit:k,offset:E,canPrev:A,canNext:C,changePageSize:R,nextPage:D,prevPage:$}}function yW(e,t,s,n){const{provider:o}=At(),[l,u]=_.useState(!1),[h,f]=_.useState(null),d=_.useRef(null),p=_.useRef(!0);return _.useEffect(()=>(p.current=!0,()=>{p.current=!1,d.current?.abort()}),[]),{generate:_.useCallback(async x=>{if(!e||!x.trim()||l)return;u(!0),f(null);const v=new AbortController;d.current=v;try{let w=[];try{w=await PC(e)}catch{w=[]}if(!p.current||v.signal.aborted)return;const k=await Yb({prompt:Q$(e,x,{engine:t,tables:w,unlocked:s}),provider:o?.id,signal:v.signal});if(!p.current)return;const N=wW(k);N?n(N):f("The agent didn't return a SQL block.")}catch(w){p.current&&!v.signal.aborted&&f(w instanceof Error?w.message:String(w))}finally{d.current===v&&(d.current=null),p.current&&u(!1)}},[e,t,s,l,n,o?.id]),generating:l,error:h}}function wW(e){if(!e)return null;const s=/```(?:sql)?\s*\n?([\s\S]*?)```/i.exec(e)?.[1]?.trim();return s||null}function SW({connection:e,sample:t}){const{sendToAgent:s}=At(),{success:n,error:o}=as(),l=t.columns.map(p=>p.name);function u(p){s({prompt:Z$(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 f(p){const g=x=>{const v=Kc(x);return/[",\n]/.test(v)?`"${v.replace(/"/g,'""')}"`:v};return`${l.join(",")}
110
- ${l.map(x=>g(p[x])).join(",")}`}function d(p){const g=v=>v==null?"NULL":typeof v=="number"||typeof v=="boolean"?String(v):`'${(typeof v=="object"?JSON.stringify(v):String(v)).replace(/'/g,"''")}'`,x=l.map(v=>g(p[v])).join(", ");return`INSERT INTO ${t.table} (${l.join(", ")}) VALUES (${x});`}return t.columns.length===0?i.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"This table has no columns."}):i.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:i.jsxs("table",{className:"w-max min-w-full border-collapse text-left font-mono text-[11px]",children:[i.jsx("thead",{className:"sticky top-0 z-10 bg-card",children:i.jsxs("tr",{className:"border-b border-border",children:[t.columns.map(p=>i.jsxs("th",{className:"whitespace-nowrap px-3 py-2 font-semibold text-foreground",children:[i.jsxs("span",{className:"flex items-center gap-1",children:[p.primaryKey?i.jsx(xC,{className:"size-3 text-amber-500"}):null,p.name]}),i.jsx("span",{className:"block text-[10px] font-normal text-muted-foreground",children:p.dataType})]},p.name)),i.jsx("th",{className:"sticky right-0 z-20 w-16 border-l border-border bg-card px-2 py-2"})]})}),i.jsxs("tbody",{children:[t.rows.map((p,g)=>i.jsxs("tr",{className:"group border-b border-border/60 hover:bg-muted/40",children:[t.columns.map(x=>i.jsx("td",{className:"max-w-[320px] truncate px-3 py-1 align-top text-muted-foreground",title:Kc(p[x.name]),children:Kc(p[x.name])},x.name)),i.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:i.jsxs("div",{className:"relative z-[1] flex items-center justify-end gap-0.5",children:[i.jsx(Qi,{label:"Ask AI about this row",onAsk:()=>u(p)}),i.jsx(mu,{label:"Row actions",items:[{label:"Copy as JSON",icon:i.jsx(ZT,{className:"size-3.5"}),onSelect:()=>{h(JSON.stringify(p,null,2),"row as JSON")}},{label:"Copy as CSV",icon:i.jsx($R,{className:"size-3.5"}),onSelect:()=>{h(f(p),"row as CSV")}},{label:"Copy as SQL INSERT",icon:i.jsx(di,{className:"size-3.5"}),onSelect:()=>{h(d(p),"INSERT statement")}}]})]})})]},g)),t.rows.length===0?i.jsx("tr",{children:i.jsx("td",{colSpan:t.columns.length+1,className:"px-3 py-6 text-center text-muted-foreground",children:"No rows."})}):null]})]})})}function Kc(e){return e==null?"NULL":typeof e=="object"?JSON.stringify(e):String(e)}function kW({connection:e,busy:t,onConfirm:s,onClose:n}){return i.jsx(Vn,{icon:i.jsx(OM,{className:"text-amber-500"}),onClose:n,title:`Unlock writes on "${e}"?`,children:i.jsxs("div",{className:"flex flex-col gap-4 text-sm",children:[i.jsxs("p",{className:"text-muted-foreground",children:["This lets the SQL console run statements that ",i.jsx("strong",{children:"change data"})," ","— ",i.jsx("span",{className:"font-mono",children:"INSERT"}),","," ",i.jsx("span",{className:"font-mono",children:"UPDATE"}),","," ",i.jsx("span",{className:"font-mono",children:"DELETE"}),", and DDL like"," ",i.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."]}),i.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."}),i.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-border pt-3",children:[i.jsx(J,{variant:"outline",size:"sm",onClick:n,type:"button",children:"Cancel"}),i.jsxs(J,{size:"sm",onClick:s,disabled:t,type:"button",children:[t?i.jsx(jt,{className:"animate-spin"}):i.jsx(bC,{}),"Unlock writes"]})]})]})})}function NW({sql:e,preview:t,busy:s,onConfirm:n,onClose:o}){return i.jsx(Vn,{icon:i.jsx(Ar,{className:"text-amber-500"}),onClose:o,title:"Confirm write",children:i.jsxs("div",{className:"flex flex-col gap-4 text-sm",children:[i.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?i.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."}):i.jsxs("p",{className:"text-muted-foreground",children:["This will affect"," ",i.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."]}),i.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-border pt-3",children:[i.jsx(J,{variant:"outline",size:"sm",onClick:o,type:"button",children:"Cancel"}),i.jsxs(J,{size:"sm",className:"bg-amber-600 text-white hover:bg-amber-600/90",onClick:n,disabled:s,type:"button",children:[s?i.jsx(jt,{className:"animate-spin"}):null,"Run & commit"]})]})]})})}function CW({connection:e,engine:t,unlocked:s,seed:n,onWriteAccessChange:o}){const{success:l}=as(),{sendToAgent:u}=At(),h=pW(e),f=bW(e),d=vW(e,o),[p,g]=_.useState(n?.sql??""),[x,v]=_.useState(100),w=n?.nonce;_.useEffect(()=>{n&&g(n.sql)},[w]);const[k,N]=_.useState(!1),E=yW(e,t,s,g),T=p.trim().length>0&&!xW(p),A=s&&T,C=T&&!s,R=h.running||f.previewing;function D(){if(p.trim()){if(C){N(!0);return}A?(h.reset(),f.preview(p)):(f.reset(),h.run(p,x))}}function $(B){(B.metaKey||B.ctrlKey)&&B.key==="Enter"&&(B.preventDefault(),D())}function O(B){u({prompt:J$(e,t,p,B),source:{type:"database-sql-debug",label:"Debug SQL"},label:"Debug this SQL error"})}async function P(){const B=await f.commit();if(B?.committed){const G=B.affectedRows??0;l(`Committed — ${G} row${G===1?"":"s"} affected.`)}}return i.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[i.jsxs("div",{className:"shrink-0 border-b border-border p-2",children:[i.jsx(EW,{generate:E}),i.jsx("textarea",{value:p,onChange:B=>g(B.target.value),onKeyDown:$,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"}),i.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[i.jsx(jW,{unlocked:s,updating:d.updating,onUnlock:()=>N(!0),onLock:()=>{d.setUnlocked(!1)}}),i.jsxs("div",{className:"flex items-center gap-2",children:[A?null:i.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=>v(Number(B.target.value)),children:d5.map(B=>i.jsxs("option",{value:B,children:[B," rows"]},B))}),i.jsxs(J,{size:"sm",className:ae("h-7 px-3",A&&"bg-amber-600 text-white hover:bg-amber-600/90"),onClick:D,disabled:R||!p.trim(),type:"button",children:[R?i.jsx(jt,{className:"size-3.5 animate-spin"}):i.jsx(Tr,{className:"size-3.5"}),A?"Preview write":"Run"]})]})]})]}),i.jsx(AW,{read:h,write:f,onDebug:O}),k?i.jsx(kW,{connection:e,busy:d.updating,onConfirm:async()=>{await d.setUnlocked(!0),N(!1)},onClose:()=>N(!1)}):null,f.pending?i.jsx(NW,{sql:f.pending.sql,preview:f.pending.preview,busy:f.committing,onConfirm:()=>{P()},onClose:f.cancel}):null]})}function EW({generate:e}){const[t,s]=_.useState("");function n(){const l=t.trim();!l||e.generating||e.generate(l)}function o(l){l.key==="Enter"&&(l.preventDefault(),n())}return i.jsxs("div",{className:"mb-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx(qt,{className:"pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2"}),i.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"})]}),i.jsxs(J,{size:"sm",variant:"outline",className:"h-8 px-3",onClick:n,disabled:e.generating||!t.trim(),type:"button",children:[e.generating?i.jsx(jt,{className:"size-3.5 animate-spin"}):i.jsx(qt,{className:"size-3.5"}),e.generating?"Generating…":"Ask AI"]})]}),e.error?i.jsx("p",{className:"mt-1 text-[11px] text-amber-600 dark:text-amber-400",children:e.error}):null]})}function jW({unlocked:e,updating:t,onUnlock:s,onLock:n}){return i.jsxs("button",{type:"button",onClick:e?n:s,disabled:t,className:ae("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?i.jsx(jt,{className:"size-3.5 animate-spin"}):e?i.jsx(bC,{className:"size-3.5"}):i.jsx(B6,{className:"size-3.5"}),e?"Writes unlocked":"Read-only"]})}function AW({read:e,write:t,onDebug:s}){const n=t.error??e.error;return i.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:n?i.jsxs("div",{className:"space-y-3 p-4",children:[i.jsx("p",{className:"whitespace-pre-wrap font-mono text-[12px] text-destructive",children:n}),i.jsxs(J,{size:"sm",variant:"outline",className:"h-7 px-3",onClick:()=>s(n),type:"button",children:[i.jsx(qt,{className:"size-3.5"}),"Debug with AI"]})]}):t.committed?i.jsx(TW,{outcome:t.committed}):e.result?i.jsx(h5,{columns:e.result.columns,rows:e.result.rows,truncated:e.result.truncated}):i.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 TW({outcome:e}){if(!e)return null;const t=e.affectedRows??0;return i.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[i.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:[i.jsx(Ds,{className:"size-3.5"}),"Committed — ",t," row",t===1?"":"s"," affected."]}),e.rows&&e.rows.length>0&&e.columns?i.jsx(h5,{columns:e.columns,rows:e.rows}):null]})}function h5({columns:e,rows:t,truncated:s=!1}){return e.length===0?i.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"Query ran successfully — no columns returned."}):i.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[s?i.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:[i.jsx(Ar,{className:"size-3.5"}),"Showing the first ",t.length," rows — add a LIMIT to narrow the result."]}):null,i.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:i.jsxs("table",{className:"w-max min-w-full border-collapse text-left font-mono text-[11px]",children:[i.jsx("thead",{className:"sticky top-0 z-10 bg-card",children:i.jsx("tr",{className:"border-b border-border",children:e.map(n=>i.jsx("th",{className:"whitespace-nowrap px-3 py-2 font-semibold text-foreground",children:n.name},n.name))})}),i.jsxs("tbody",{children:[t.map((n,o)=>i.jsx("tr",{className:"border-b border-border/60 hover:bg-muted/40",children:e.map(l=>i.jsx("td",{className:"max-w-[320px] truncate px-3 py-1 align-top text-muted-foreground",title:Kc(n[l.name]),children:Kc(n[l.name])},l.name))},o)),t.length===0?i.jsx("tr",{children:i.jsx("td",{colSpan:e.length,className:"px-3 py-6 text-center text-muted-foreground",children:"No rows."})}):null]})]})})]})}function RW({staged:e,onStageConsumed:t,projects:s=[],scopePath:n=null}={}){const{connections:o,loading:l,error:u,refresh:h}=mW(),f=_.useMemo(()=>o.filter(O=>iW(O.projectPath,n)),[o,n]),d=O=>O.projectPath?s.find(B=>zf(O.projectPath,B.path))?.name??O.projectPath.split("/").pop()??null:null;vl(h);const{error:p,success:g}=as(),{sendToAgent:x}=At(),[v,w]=ol("database:selected",null),[k,N]=ol("database:mode","browse"),[E,T]=_.useState(null),[A,C]=_.useState(null);_.useEffect(()=>{e&&(e.connection&&w(e.connection),N("query"),C({sql:e.sql,nonce:e.nonce}),t?.())},[e?.nonce]);function R(){x({prompt:K$,source:{type:"database-setup",label:"Add a database"},label:"Help me connect a database, one step at a time."})}_.useEffect(()=>{if(f.length===0){v!==null&&w(null);return}(!v||!f.some(O=>O.name===v))&&w(f[0].name)},[f,v,w]);async function D(O){try{await T7(O),g(`Removed connection "${O}".`),await h()}catch(P){p(P instanceof Error?P.message:String(P))}}function $(O){T({mode:"edit",target:O})}return i.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/85",children:[i.jsxs("header",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(di,{className:"size-4 text-muted-foreground"}),i.jsx("span",{className:"text-sm font-semibold",children:"Databases"}),l&&f.length===0?i.jsx(jt,{className:"size-3.5 animate-spin text-muted-foreground"}):null]}),i.jsxs("div",{className:"flex items-center gap-2",children:[v?i.jsx(MW,{mode:k,onChange:N}):null,i.jsx(hW,{connections:f,projectLabel:d,selected:v,onSelect:w,onAdd:()=>T({mode:"add"}),onEdit:$,onRemove:O=>{D(O)}}),i.jsx(fW,{onAddManual:()=>T({mode:"add"}),onAddWithAi:R})]})]}),i.jsx("div",{className:"min-h-0 flex-1",children:u?i.jsx("div",{className:"p-4",children:i.jsx(Qe,{variant:"muted",className:"border-destructive/40 text-destructive",children:u})}):v?k==="query"?i.jsx(CW,{connection:v,engine:f.find(O=>O.name===v)?.engine,unlocked:f.find(O=>O.name===v)?.writeUnlocked??!1,seed:A,onWriteAccessChange:h},v):i.jsx(DW,{connection:v}):i.jsx(OW,{onAdd:()=>T({mode:"add"}),onAddWithAi:R})}),E?i.jsx(cW,{initial:E.mode==="edit"?E.target:void 0,projects:s,onClose:()=>T(null),onSaved:h}):null]})}function MW({mode:e,onChange:t}){const s=[{value:"browse",label:"Browse",icon:AC},{value:"query",label:"SQL",icon:pl}];return i.jsx("div",{className:"flex items-center rounded-md border border-border p-0.5",children:s.map(n=>{const o=n.icon;return i.jsxs("button",{type:"button",onClick:()=>t(n.value),className:ae("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:[i.jsx(o,{className:"size-3.5"}),n.label]},n.value)})})}function DW({connection:e}){const{sendToAgent:t}=At(),{tables:s,selectedTable:n,setSelectedTable:o,sample:l,tablesError:u,rowsError:h,loadingTables:f,loadingRows:d,limit:p,offset:g,canPrev:x,canNext:v,changePageSize:w,nextPage:k,prevPage:N}=_W(e);function E(A){t({prompt:c2(e,A.table,{engine:A.engine,columns:A.columns}),source:{type:"database-table",label:`${A.table.name} table`},mode:"draft"})}function T(A){t({prompt:c2(e,A),source:{type:"database-table",label:`${A.name} table`},mode:"draft"})}return i.jsxs("div",{className:"flex h-full min-h-0",children:[i.jsxs("div",{className:"flex w-56 shrink-0 flex-col border-r border-border",children:[i.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[i.jsx(AC,{className:"size-4 text-muted-foreground"}),i.jsx("span",{className:"text-sm font-semibold",children:"Tables"}),i.jsx(Ge,{variant:"outline",size:"small",children:s.length}),f?i.jsx(jt,{className:"size-3.5 animate-spin"}):null]}),u?i.jsx("div",{className:"p-3",children:i.jsx(Qe,{variant:"muted",className:"border-destructive/40 text-destructive",children:u})}):i.jsxs("ul",{className:"min-h-0 flex-1 overflow-auto",children:[s.map(A=>i.jsxs("li",{className:ae("group flex items-center gap-1 pr-1 transition-colors hover:bg-muted/50",A.qualifiedName===n&&"bg-muted/70"),children:[i.jsx("button",{type:"button",onClick:()=>o(A.qualifiedName),className:ae("min-w-0 flex-1 truncate px-3 py-1.5 text-left font-mono text-[11px]",A.qualifiedName===n&&"font-semibold"),children:A.qualifiedName}),i.jsx(Qi,{label:`Ask AI about \`${A.qualifiedName}\``,onAsk:()=>T(A)})]},A.qualifiedName)),!f&&s.length===0?i.jsx("li",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No tables."}):null]})]}),i.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[i.jsxs("div",{className:"group flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-2",children:[i.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[i.jsx("span",{className:"truncate font-mono text-xs font-semibold",children:n??"Select a table"}),l?i.jsx(Qi,{label:`Ask AI about \`${l.table.qualifiedName}\``,onAsk:()=>E(l)}):null]}),l?i.jsxs("div",{className:"flex shrink-0 items-center gap-2 text-[11px] text-muted-foreground",children:[i.jsx("span",{className:"tabular-nums",children:l.rowCount===0?"no rows":`rows ${g+1}–${g+l.rowCount}`}),i.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:A=>w(Number(A.target.value)),children:d5.map(A=>i.jsxs("option",{value:A,children:[A," / page"]},A))}),i.jsx(J,{size:"sm",variant:"outline",className:"h-6 px-2",onClick:N,disabled:!x,type:"button",children:"Prev"}),i.jsx(J,{size:"sm",variant:"outline",className:"h-6 px-2",onClick:k,disabled:!v,type:"button",children:"Next"})]}):null]}),h?i.jsx("div",{className:"p-4",children:i.jsx(Qe,{variant:"muted",className:"border-destructive/40 text-destructive",children:h})}):d?i.jsxs("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:[i.jsx(jt,{className:"mr-2 size-4 animate-spin"}),"Loading rows…"]}):l?i.jsx(SW,{connection:e,sample:l}):i.jsx("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:"Pick a table to sample its rows."})]})]})}function OW({onAdd:e,onAddWithAi:t}){return i.jsx("div",{className:"flex h-full items-center justify-center p-8 text-center",children:i.jsxs("div",{className:"max-w-sm",children:[i.jsx(di,{className:"mx-auto size-8 text-muted-foreground/50"}),i.jsx("p",{className:"mt-3 text-sm font-medium",children:"No connections yet"}),i.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' ",i.jsx("code",{children:".env"})," files."]}),i.jsxs("div",{className:"mt-4 flex items-center justify-center gap-2",children:[i.jsxs(J,{size:"sm",onClick:e,type:"button",children:[i.jsx(ps,{}),"Add connection"]}),i.jsxs(J,{size:"sm",variant:"outline",onClick:t,type:"button",children:[i.jsx(Ri,{}),"Add with AI"]})]})]})})}const f5="nomoreide-language-choice",LW=[{value:"en",nativeLabel:"English",englishLabel:"English",available:!0},{value:"zh",nativeLabel:"简体中文",englishLabel:"Chinese (Simplified)",available:!1}];function zW(){if(typeof window>"u")return"en";const e=window.localStorage.getItem(f5);return e==="en"||e==="zh"?e:"en"}let H0=zW();const U0=new Set;function BW(){return H0}function PW(e){if(e!==H0){H0=e;try{window.localStorage.setItem(f5,e)}catch{}for(const t of U0)t()}}function IW(e){return U0.add(e),()=>U0.delete(e)}function $W(){return[_.useSyncExternalStore(IW,BW,()=>"en"),PW]}const m5="nomoreide-theme-choice";function HW(){if(typeof window>"u")return"dark";const e=window.localStorage.getItem(m5);return e==="light"||e==="dark"?e:"dark"}function UW(e){const t=document.documentElement;t.classList.toggle("dark",e==="dark"),t.style.colorScheme=e}let F0=HW();const q0=new Set;function FW(){return F0}function qW(e){if(e!==F0){F0=e,UW(e);try{window.localStorage.setItem(m5,e)}catch{}for(const t of q0)t()}}function VW(e){return q0.add(e),()=>q0.delete(e)}function p5(){return[_.useSyncExternalStore(VW,FW,()=>"dark"),qW]}const GW=[{value:"light",label:"Light",icon:jC},{value:"dark",label:"Dark",icon:_C}];function Ek({active:e,onClick:t,children:s}){return i.jsx("button",{"aria-pressed":e,className:ae("flex items-center gap-2.5 rounded-md border px-3 py-2 text-left text-sm transition-colors",e?"border-primary bg-primary/10 text-foreground":"border-border hover:bg-muted"),onClick:t,type:"button",children:s})}function Ig({icon:e,title:t,description:s,children:n}){return i.jsxs("section",{className:"border-b border-border/60 px-4 py-4 last:border-b-0",children:[i.jsxs("h2",{className:"flex items-center gap-2 text-sm font-semibold",children:[e,t]}),i.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:s}),i.jsx("div",{className:"mt-3",children:n})]})}function WW(){const[e,t]=p5(),[s,n]=$W();return i.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/85",children:[i.jsxs("header",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[i.jsx(NC,{className:"size-4 text-muted-foreground"}),i.jsx("span",{className:"text-sm font-semibold",children:"Settings"})]}),i.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:i.jsxs("div",{className:"mx-auto max-w-xl",children:[i.jsx(Ig,{description:"Theme for the dashboard. The header toggle switches the same setting.",icon:i.jsx(yC,{className:"size-4 text-muted-foreground"}),title:"Appearance",children:i.jsx("div",{className:"grid grid-cols-2 gap-2",children:GW.map(({value:o,label:l,icon:u})=>{const h=e===o;return i.jsxs(Ek,{active:h,onClick:()=>t(o),children:[i.jsx(u,{className:"size-4 shrink-0 text-muted-foreground"}),i.jsx("span",{className:"flex-1 font-medium",children:l}),h?i.jsx(Ds,{className:"size-4 shrink-0 text-primary"}):null]},o)})})}),i.jsx(Ig,{description:"Your preference is saved now; the interface switches once the translation catalogs land.",icon:i.jsx(w6,{className:"size-4 text-muted-foreground"}),title:"Language",children:i.jsx("div",{className:"flex flex-col gap-2",children:LW.map(o=>{const l=s===o.value;return i.jsxs(Ek,{active:l,onClick:()=>n(o.value),children:[i.jsxs("span",{className:"flex-1",children:[i.jsx("span",{className:"font-medium",children:o.nativeLabel}),o.nativeLabel!==o.englishLabel?i.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:o.englishLabel}):null]}),o.available?null:i.jsx(Ge,{size:"small",variant:"outline",children:"Coming soon"}),l?i.jsx(Ds,{className:"size-4 shrink-0 text-primary"}):null]},o.value)})})}),i.jsx(Ig,{description:"This local console and where to learn more.",icon:i.jsx(v6,{className:"size-4 text-muted-foreground"}),title:"About",children:i.jsxs("dl",{className:"grid grid-cols-[auto_minmax(0,1fr)] gap-x-4 gap-y-1.5 text-xs",children:[i.jsx("dt",{className:"text-muted-foreground",children:"Version"}),i.jsxs("dd",{className:"font-mono",children:["v","0.1.76"]}),i.jsx("dt",{className:"text-muted-foreground",children:"Console"}),i.jsx("dd",{className:"font-mono",children:"127.0.0.1:4317"}),i.jsx("dt",{className:"text-muted-foreground",children:"Docs"}),i.jsx("dd",{children:i.jsxs("a",{className:"inline-flex items-center gap-1 text-primary hover:underline",href:"https://www.nomoreide.com/docs",rel:"noreferrer",target:"_blank",children:[i.jsx(iC,{className:"size-3"}),"nomoreide.com/docs"]})})]})})]})})]})}function KW({incident:e,onReviewChanges:t}){const{error:s}=as(),{sendToAgent:n}=At(),[o,l]=_.useState(!1),[u,h]=_.useState(null);async function f(){l(!0);try{const{prompt:d,sessionId:p}=await z7(e.id);n({prompt:d,source:{type:"error",label:`${e.service} — ${e.level}`},label:`Fix this ${e.level} in \`${e.service}\`: ${e.title}`}),h(p)}catch(d){s(d instanceof Error?d.message:String(d))}finally{l(!1)}}return i.jsxs("div",{className:"flex h-full min-h-0 min-w-0 flex-col",children:[i.jsxs("div",{className:"shrink-0 border-b border-border px-4 py-3",children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i.jsx(Ge,{variant:e.level==="error"?"danger":"secondary",appearance:"subtle",size:"small",children:e.level}),i.jsx("span",{className:"truncate font-mono text-xs font-semibold",children:e.service}),e.count>1?i.jsxs(Ge,{variant:"outline",size:"small",children:["×",e.count]}):null]}),i.jsxs(J,{onClick:()=>{f()},disabled:o,size:"sm",variant:"outline",children:[i.jsx(qt,{className:"size-3.5"}),o?"Starting…":"Fix with AI"]})]}),i.jsx("p",{className:"mt-1.5 break-words font-mono text-xs text-foreground",children:e.title}),e.file?i.jsxs("p",{className:"mt-1 flex items-center gap-1.5 font-mono text-[11px] text-muted-foreground",children:[i.jsx(fC,{className:"size-3.5"}),e.file,e.line?`:${e.line}`:""]}):null,i.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()]})]}),i.jsxs("div",{className:"min-h-0 flex-1 overflow-auto p-4",children:[u?i.jsx(Qe,{variant:"muted",className:"mb-3",children:i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[i.jsx("span",{className:"text-xs",children:"The agent is working on this in the dock. A snapshot was taken first — review or undo its edits as one change-set."}),t?i.jsxs(J,{onClick:()=>t(u),size:"sm",variant:"outline",children:[i.jsx(hC,{className:"size-3.5"}),"Review changes"]}):null]})}):null,i.jsx("p",{className:"mb-1.5 text-xs font-medium text-muted-foreground",children:"Log excerpt"}),i.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(`
111
- `)}),i.jsx("p",{className:"mt-3 text-[11px] text-muted-foreground",children:`"Fix with AI" snapshots the working tree, then sends the agent a repro bundle (this error, the affected file's diff, recent logs, service state, and masked env) so it can fix it — and you can revert the whole change-set if it goes sideways.`})]})]})}function jk(e){return[...e].sort((t,s)=>t.lastSeen<s.lastSeen?1:t.lastSeen>s.lastSeen?-1:s.id-t.id)}function YW(){const[e,t]=_.useState([]),[s,n]=_.useState(!1),[o,l]=_.useState(null),u=_.useCallback(h=>{t(f=>jk([...f.filter(d=>d.id!==h.id),h]))},[]);return _.useEffect(()=>{let h=!0;$C().then(d=>{h&&t(jk(d))}).catch(d=>{h&&l(d instanceof Error?d.message:String(d))});const f=new EventSource("/api/errors/stream");return f.addEventListener("open",()=>n(!0)),f.addEventListener("error",()=>n(!1)),f.addEventListener("incident",d=>{try{const p=JSON.parse(d.data);u(p)}catch{}}),()=>{h=!1,f.close()}},[u]),{incidents:e,connected:s,error:o}}function XW({inScope:e,onReviewChanges:t}={}){const{incidents:s,connected:n,error:o}=YW(),l=_.useMemo(()=>e?s.filter(d=>e(d.service)):s,[s,e]),[u,h]=_.useState(null);_.useEffect(()=>{if(l.length===0){h(null);return}h(d=>d!==null&&l.some(p=>p.id===d)?d:l[0].id)},[l]);const f=_.useMemo(()=>l.find(d=>d.id===u)??null,[l,u]);return i.jsxs("div",{className:"flex h-full min-h-0 bg-card/85",children:[i.jsxs("div",{className:"flex w-72 shrink-0 flex-col border-r border-border",children:[i.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Zc,{className:"size-4 text-muted-foreground"}),i.jsx("span",{className:"text-sm font-semibold",children:"Incidents"}),i.jsx(Ge,{variant:"outline",size:"small",children:l.length})]}),i.jsx(Ge,{variant:"outline",size:"small",icon:i.jsx("span",{className:ae("inline-block size-1.5 rounded-full",n?"animate-pulse bg-emerald-500":"bg-muted-foreground/60")}),children:n?"live":"reconnecting…"})]}),i.jsx("ul",{className:"min-h-0 flex-1 divide-y divide-border overflow-auto",children:l.map(d=>i.jsx("li",{children:i.jsxs("button",{type:"button",onClick:()=>h(d.id),className:ae("flex w-full flex-col gap-1 px-3 py-2 text-left transition-colors hover:bg-muted/50",d.id===u&&"bg-muted/70"),children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("span",{className:"truncate font-mono text-[11px] font-semibold",children:d.service}),i.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[d.count>1?i.jsxs(Ge,{variant:"outline",size:"small",children:["×",d.count]}):null,i.jsx(Ge,{variant:d.level==="error"?"danger":"secondary",appearance:"subtle",size:"small",children:d.level})]})]}),i.jsx("span",{className:"truncate font-mono text-[11px] text-muted-foreground",children:d.title}),i.jsx("span",{className:"font-mono text-[10px] text-muted-foreground/70",children:new Date(d.lastSeen).toLocaleTimeString()})]})},d.id))})]}),i.jsx("div",{className:"min-h-0 min-w-0 flex-1",children:o?i.jsx("div",{className:"p-4",children:i.jsxs(Qe,{variant:"muted",className:"border-destructive/40 text-destructive",children:["Failed to load incidents: ",o]})}):f?i.jsx(KW,{incident:f,onReviewChanges:t}):i.jsx("div",{className:"flex h-full items-center justify-center p-8 text-center",children:i.jsxs("div",{className:"max-w-sm",children:[i.jsx(Zc,{className:"mx-auto size-8 text-muted-foreground/50"}),i.jsx("p",{className:"mt-3 text-sm font-medium",children:"No incidents yet"}),i.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 ef({label:e}){return i.jsx(Qe,{variant:"muted",className:"m-4 text-center",children:e})}const ZW=900*1e3,Pc=12,$g=200;function QW({events:e}){const[t,s]=_.useState(null),[n,o]=_.useState(null),{rows:l,windowStart:u,windowEnd:h}=_.useMemo(()=>JW(e),[e]),f=t?l.find(d=>d.service===t)??null:null;return i.jsxs(i.Fragment,{children:[i.jsxs(hi,{className:"rounded-none border-0 border-b border-border bg-transparent",children:[i.jsxs(fi,{className:"border-b border-border px-3 py-2",children:[i.jsxs(mi,{className:"flex items-center gap-2",children:[i.jsx(eo,{className:"size-3.5"}),"Runtime Monitor"]}),i.jsx(er,{className:"text-xs",children:e.length===0?"No events yet":`${e.length} event${e.length===1?"":"s"} · last 15 min`})]}),i.jsx(pi,{className:"p-0",children:l.length===0?i.jsx(ef,{label:"No runtime timeline events yet."}):i.jsxs("div",{className:"divide-y divide-border",children:[l.map(d=>i.jsx(tK,{onClick:()=>s(d.service),row:d,windowEnd:h,windowStart:u},d.service)),i.jsxs("div",{className:"flex justify-between px-3 py-1.5 font-mono text-[10px] text-muted-foreground",children:[i.jsx("span",{children:tf(u)}),i.jsx("span",{children:"now"})]})]})})]}),f?i.jsx(Vn,{icon:i.jsx(eo,{}),onClose:()=>s(null),title:f.service,children:i.jsx(nK,{onSelect:o,row:f})}):null,n?i.jsx(Vn,{icon:i.jsx(eo,{}),onClose:()=>o(null),title:n.title,children:i.jsx(iK,{event:n})}):null]})}function JW(e){const t=Date.now(),s=t,n=t-ZW;let o=e.filter(f=>{if(f.kind==="service.http")return!1;const d=new Date(f.timestamp).getTime();return!Number.isNaN(d)&&d>=n});o.length===0&&e.length>0?o=e.slice(-$g):o.length>$g&&(o=o.slice(-$g));const l=new Map;for(const f of o){const d=f.service||"·system",p=l.get(d)??[];p.push(f),l.set(d,p)}const u=Math.max(s-n,1);return{rows:Array.from(l.entries()).map(([f,d])=>{const p=[...d].sort((T,A)=>T.timestamp.localeCompare(A.timestamp)),g=new Array(Pc).fill(0),x=new Array(Pc).fill(null);for(const T of p){const A=new Date(T.timestamp).getTime(),C=Math.max(n,Math.min(s,A)),R=Math.min(Pc-1,Math.floor((C-n)/u*Pc));g[R]+=1;const D=x[R];x[R]=eK(D,T.severity)}const v=p.filter(T=>T.severity==="error").length,w=p.filter(T=>T.severity==="warning").length,k=p.length-v-w,N=[...p].reverse().find(T=>T.severity!=="info")??null,E=v>0?"error":w>0?"warning":"info";return{service:f,events:p,errors:v,warnings:w,infos:k,buckets:g,bucketSeverity:x,lastNotable:N,worstSeverity:E}}).sort((f,d)=>{const p=x=>x.errors*1e3+x.warnings,g=p(d)-p(f);return g!==0?g:f.service.localeCompare(d.service)}),windowStart:n,windowEnd:s}}function eK(e,t){return e==="error"||t==="error"?"error":e==="warning"||t==="warning"?"warning":"info"}function tK({onClick:e,row:t,windowEnd:s,windowStart:n}){const o=Math.max(1,...t.buckets);return i.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:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i.jsx("span",{className:ae("size-2 shrink-0 rounded-full",g5(t.worstSeverity))}),i.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium text-foreground",dir:"rtl",children:i.jsx("bdi",{children:t.service})}),t.errors>0?i.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?i.jsxs("span",{className:"rounded bg-amber-500/15 px-1 font-mono text-[10px] text-amber-500",children:[t.warnings,"W"]}):null,i.jsx(jn,{className:"size-3 text-muted-foreground"})]}),i.jsx("div",{className:"timeline-density mt-1.5 grid h-3 gap-px","data-testid":"timeline-density",style:{gridTemplateColumns:`repeat(${Pc}, minmax(0, 1fr))`},children:t.buckets.map((l,u)=>i.jsx(sK,{count:l,max:o,severity:t.bucketSeverity[u]},u))}),t.lastNotable?i.jsx("div",{className:"mt-1 truncate font-mono text-[10px] text-muted-foreground",children:t.lastNotable.detail??t.lastNotable.title}):i.jsxs("div",{className:"mt-1 truncate text-[10px] text-muted-foreground",children:[t.infos," info ",t.infos===1?"event":"events"]}),i.jsxs("div",{className:"mt-0.5 flex justify-between font-mono text-[9px] text-muted-foreground/60",children:[i.jsx("span",{children:tf(n)}),i.jsx("span",{children:tf(s)})]})]})}function sK({count:e,max:t,severity:s}){if(e===0)return i.jsx("span",{className:"rounded-sm bg-border/60"});const n=Math.min(1,.35+e/t*.65);return i.jsx("span",{className:ae("rounded-sm",rK(s)),style:{opacity:n},title:`${e} event${e===1?"":"s"}`})}function nK({onSelect:e,row:t}){const s=[...t.events].sort((n,o)=>o.timestamp.localeCompare(n.timestamp));return i.jsxs("div",{className:"flex max-h-[480px] flex-col overflow-hidden",children:[i.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-4 py-2 text-xs text-muted-foreground",children:[i.jsxs("span",{children:[t.events.length," events"]}),i.jsx("span",{children:"·"}),i.jsxs("span",{children:[t.errors," error",t.errors===1?"":"s"]}),i.jsx("span",{children:"·"}),i.jsxs("span",{children:[t.warnings," warning",t.warnings===1?"":"s"]})]}),i.jsx("ul",{className:"min-h-0 divide-y divide-border overflow-auto",children:s.map(n=>i.jsx("li",{children:i.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:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:ae("size-2 shrink-0 rounded-full",g5(n.severity))}),i.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium text-foreground",children:n.title}),i.jsx("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:tf(n.timestamp)})]}),n.detail?i.jsx("div",{className:"mt-1 truncate font-mono text-[10px] text-muted-foreground",children:n.detail}):null]})},n.id))})]})}function iK({event:e}){const t=new Date(e.timestamp);return i.jsxs("div",{className:"space-y-3 p-4 text-sm",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("span",{className:ae("rounded px-1.5 py-0.5 font-mono text-[10px] uppercase text-white",aK(e.severity)),children:e.severity}),i.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?i.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]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-xs text-muted-foreground",children:"When"}),i.jsx("div",{className:"font-mono text-xs",children:Number.isNaN(t.getTime())?e.timestamp:t.toLocaleString()})]}),e.detail?i.jsxs("div",{children:[i.jsx("div",{className:"text-xs text-muted-foreground",children:"Detail"}),i.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 g5(e){return e==="error"?"bg-red-500":e==="warning"?"bg-amber-500":"bg-zinc-400"}function rK(e){return e==="error"?"bg-red-500":e==="warning"?"bg-amber-500":"bg-zinc-500"}function aK(e){return e==="error"?"bg-red-600":e==="warning"?"bg-amber-600":"bg-zinc-700"}function tf(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"})}const V0=150,ll=40,Ak=200,Tk=64,ah=20;function oK({statuses:e,health:t,hasDependencies:s,onSelectService:n}){const[o,l]=_.useState(null),[u,h]=_.useState(null);_.useEffect(()=>{let p=!0;return RO().then(g=>{p&&l(g)}).catch(g=>{p&&h(g instanceof Error?g.message:String(g))}),()=>{p=!1}},[]);const f=_.useMemo(()=>o?lK(o.nodes):null,[o]);if(u)return i.jsxs(Qe,{variant:"destructive",children:["Couldn't load the dependency graph: ",u]});if(!o||!f)return i.jsxs("div",{className:"flex items-center justify-center gap-2 py-10 text-sm text-muted-foreground",children:[i.jsx(jt,{className:"size-4 animate-spin"}),"Loading graph…"]});if(!s)return i.jsx("div",{className:"grid gap-3",children:i.jsxs(Qe,{variant:"muted",children:[i.jsx("div",{className:"font-medium",children:"No dependencies declared yet."}),i.jsxs("div",{className:"mt-1 text-xs",children:["Edit a service and pick the services it should wait for under"," ",i.jsx("span",{className:"font-medium",children:"Dependencies"}),". Groups then start in dependency order, waiting for each service's port before the next."]})]})});const d=o.nodes.filter(p=>p.missing.length>0);return i.jsxs("div",{className:"grid gap-3",children:[o.cycles.length>0?i.jsxs(Qe,{variant:"destructive",children:[i.jsxs("div",{className:"flex items-center gap-1.5 font-medium",children:[i.jsx(Ar,{className:"size-4"}),"Dependency cycle detected"]}),i.jsxs("div",{className:"mt-1 text-xs",children:[o.cycles.map(p=>p.join(" → ")).join("; "),". Group start will refuse to run until this is resolved."]})]}):null,d.length>0?i.jsx(Qe,{variant:"muted",children:i.jsx("div",{className:"text-xs",children:d.map(p=>i.jsxs("div",{children:[i.jsx("span",{className:"font-medium",children:p.name})," depends on unknown service",p.missing.length>1?"s":"",": ",p.missing.join(", ")]},p.name))})}):null,i.jsx("div",{className:"overflow-auto rounded-md border border-border bg-muted/20 p-2",children:i.jsxs("svg",{"aria-label":"Service dependency graph",height:f.height,role:"img",width:f.width,children:[f.edges.map(p=>i.jsx("path",{className:"fill-none stroke-border",d:p.path,strokeWidth:1.5},`${p.from}->${p.to}`)),f.nodes.map(p=>{const g=e[p.name],x=cK(g?.state,t[p.name]?.status);return i.jsxs("g",{"aria-label":`Select ${p.name}`,className:"cursor-pointer",onClick:()=>n(p.name),transform:`translate(${p.x}, ${p.y})`,children:[i.jsx("rect",{className:ae("stroke-2",x.fill,x.stroke),height:ll,rx:6,width:V0}),i.jsx("circle",{className:x.dot,cx:14,cy:ll/2,r:4}),i.jsx("text",{className:"fill-foreground text-[11px] font-medium",dominantBaseline:"middle",x:26,y:ll/2,children:uK(p.name)})]},p.name)})]})}),o.order.length>0?i.jsxs("div",{className:"text-[11px] text-muted-foreground",children:[i.jsx("span",{className:"font-medium uppercase tracking-wide",children:"Start order:"})," ",o.order.join(" → ")]}):null]})}function lK(e){const t=new Map(e.map(g=>[g.name,g.dependsOn])),s=new Map,n=new Set,o=g=>{const x=s.get(g);if(x!==void 0)return x;if(n.has(g))return 0;n.add(g);const v=t.get(g)??[],w=v.length===0?0:Math.max(...v.map(k=>o(k)+1));return n.delete(g),s.set(g,w),w};for(const g of e)o(g.name);const l=new Map,u=e.map(g=>{const x=s.get(g.name)??0,v=l.get(x)??0;return l.set(x,v+1),{...g,x:ah+x*Ak,y:ah+v*Tk}}),h=new Map(u.map(g=>[g.name,g])),f=u.flatMap(g=>g.dependsOn.flatMap(x=>{const v=h.get(x);if(!v)return[];const w=v.x+V0,k=v.y+ll/2,N=g.x,E=g.y+ll/2,T=(w+N)/2;return[{from:x,to:g.name,path:`M ${w} ${k} C ${T} ${k}, ${T} ${E}, ${N} ${E}`}]})),d=Math.max(0,...u.map(g=>s.get(g.name)??0)),p=Math.max(1,...l.values());return{nodes:u,edges:f,width:ah*2+d*Ak+V0,height:ah*2+(p-1)*Tk+ll}}function cK(e,t){return e==="running"?t==="warning"?{fill:"fill-amber-500/10",stroke:"stroke-amber-500/60",dot:"fill-amber-500"}:t==="unhealthy"?{fill:"fill-red-500/10",stroke:"stroke-red-500/60",dot:"fill-red-500"}:{fill:"fill-emerald-500/10",stroke:"stroke-emerald-500/60",dot:"fill-emerald-500"}:e==="starting"?{fill:"fill-amber-500/10",stroke:"stroke-amber-500/60",dot:"fill-amber-500"}:e==="exited"?{fill:"fill-red-500/10",stroke:"stroke-red-500/60",dot:"fill-red-500"}:{fill:"fill-card",stroke:"stroke-border",dot:"fill-muted-foreground"}}function uK(e,t=18){return e.length>t?`${e.slice(0,t-1)}…`:e}function dK({onOnboardRepo:e,onOnboardWithAi:t,onCreateService:s,onCreateWithAi:n}){return i.jsx("div",{className:"flex h-full min-h-0 items-center justify-center overflow-auto bg-card/85 p-6",children:i.jsxs("div",{className:"w-full max-w-xl space-y-6",children:[i.jsxs("div",{className:"space-y-2 text-center",children:[i.jsx("h2",{className:"text-xl font-semibold",children:"Set up your first service"}),i.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."})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsx(Rk,{icon:i.jsx(Gn,{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"}),i.jsx(Rk,{icon:i.jsx(ps,{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 Rk({icon:e,title:t,description:s,onClick:n,onAi:o,aiTitle:l}){return i.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:[i.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:[i.jsx("span",{className:"mt-0.5 shrink-0 text-muted-foreground",children:e}),i.jsxs("span",{className:"min-w-0 space-y-1",children:[i.jsx("span",{className:"block text-sm font-semibold",children:t}),i.jsx("span",{className:"block text-xs text-muted-foreground",children:s})]})]}),i.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:[i.jsx(qt,{className:"size-4 shrink-0"}),"AI"]})]})}function hK({health:e}){if(!e)return null;const t=e.processTree,s=e.status==="healthy"||e.status==="unknown"?void 0:gK(e.summary);return i.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:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i.jsxs("span",{className:ae("inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md px-2.5 font-medium",fK(e.status)),children:[i.jsx("span",{className:"inline-flex shrink-0",children:i.jsx(eo,{className:"size-3"})}),i.jsx("span",{className:"whitespace-nowrap",children:e.status})]}),s?i.jsx("span",{className:"min-w-0 truncate",children:s}):null]}),t?i.jsxs("div",{className:"health-metrics flex min-w-max items-center gap-2 font-mono sm:justify-end",children:[i.jsxs("span",{className:"inline-flex items-center gap-1 font-mono",children:[i.jsx(CR,{className:"size-3"}),t.processCount," ",t.processCount===1?"process":"processes"]}),i.jsxs("span",{children:[pK(t.cpuPercent)," CPU"]}),i.jsxs("span",{className:"inline-flex items-center gap-1 font-mono",children:[i.jsx(q6,{className:"size-3"}),mK(t.rssMb)," RAM"]})]}):null]})}function fK(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 mK(e){return Number.isInteger(e)?`${e} MB`:`${e.toFixed(1)} MB`}function pK(e){return`${e.toFixed(1)}%`}function gK(e){return e.replace(/^Recent error log:\s*/i,"Recent stderr: ").replace(/:\s*\d+(?:\.\d+)? MB RSS\.?$/i,"").replace(/\s+RSS\.?$/i,"")}function xK({ports:e}){const t=e.filter(n=>n.state==="occupied").length,s=e.filter(n=>n.state==="managed").length;return i.jsxs(hi,{className:"rounded-none border-0 border-b border-border bg-transparent",children:[i.jsxs(fi,{className:"border-b border-border px-3 py-2",children:[i.jsxs(mi,{className:"flex items-center gap-2",children:[i.jsx(J6,{className:"size-3.5"}),"Ports"]}),i.jsxs(er,{className:"text-xs",children:[s," managed, ",t," occupied by other"]})]}),i.jsx(pi,{className:"p-0",children:e.length?i.jsx("div",{className:"divide-y divide-border",children:e.map(n=>i.jsxs("div",{className:"grid grid-cols-[1fr_auto] items-center gap-2 px-3 py-2",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"font-mono text-xs",children:[":",n.port]}),i.jsx("div",{className:"truncate text-[11px] text-muted-foreground",children:n.services.join(", ")||"Unassigned"}),n.urls[0]?i.jsx("div",{className:"truncate font-mono text-[10px] text-muted-foreground",children:n.urls[0]}):null]}),i.jsx(bK,{port:n})]},n.port))}):i.jsx(ef,{label:"No configured ports yet."})})]})}function bK({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 i.jsx(Ge,{className:ae(e&&"max-w-36 truncate"),variant:n,children:s})}function vK({onChange:e,value:t}){return i.jsxs("label",{className:"relative block",children:[i.jsx(EM,{className:"pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground"}),i.jsx(dt,{"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 _K({className:e,containerRef:t,emptyText:s,logs:n,query:o}){return i.jsx("div",{className:ae("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)=>i.jsxs("div",{className:ae("grid min-w-max grid-cols-[88px_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:[i.jsx("span",{className:"text-muted-foreground dark:text-zinc-500",title:l.timestamp,children:yK(l.timestamp)}),i.jsxs("span",{className:"whitespace-pre-wrap break-words",children:[l.stream==="stderr"?i.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,SK(l.text,o)]})]},`${l.timestamp}-${l.stream}-${u}`)):i.jsx("div",{className:"p-3 text-muted-foreground",children:s})})}function yK(e){const t=/T(\d{2}:\d{2}:\d{2})(?:\.(\d{1,3}))?/.exec(e);return t?t[2]?`${t[1]}.${t[2]}`:t[1]:e}function wK(e){return`${e.timestamp} ${e.stream} ${e.text}`}function SK(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 f=h+s.length;l.push(i.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,f)},`${h}-${f}`)),u=f,h=n.indexOf(o,u)}return u<e.length&&l.push(e.slice(u)),l}function Mk(e){return`${e.kind}:${e.name}`}function kK(e,t=!1,s={}){const[n,o]=_.useState(),[l,u]=_.useState(),[h,f]=_.useState(e.kind==="source"),d=JSON.stringify(s);return _.useEffect(()=>{o(void 0),u(void 0);let p=!1;const g=async()=>{try{if(e.kind==="service"){const v=await KC(e.name,s);p||(o(v.logs),f(v.queryable),u(void 0))}else{const v=await VC(e.name,s);p||(o(v),f(!0),u(void 0))}}catch(v){p||u(v instanceof Error?v.message:String(v))}};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 NK=[{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 x5({target:e,query:t,setQuery:s,streaming:n,setStreaming:o,hideStdout:l,setHideStdout:u,fill:h=!1,leading:f,trailing:d}){const p=e.kind==="source",[g,x]=_.useState(""),[v,w]=_.useState(""),[k,N]=_.useState(t);_.useEffect(()=>{const te=window.setTimeout(()=>N(t),300);return()=>window.clearTimeout(te)},[t]);const E=_.useMemo(()=>{const te={};g&&(te.since=g),v&&(te.level=v);const X=k.trim();return X&&(te.grep=X),te},[g,v,k]),{logs:T,error:A,queryable:C}=kK(e,n,E),R=p||C,D=_.useRef(null),$=_.useRef(!0),[O,P]=_.useState([]),[B,G]=_.useState(!1),F=JSON.stringify(E);_.useEffect(()=>{P([])},[F,e.kind,e.name]);const z=_.useMemo(()=>{const te=T??[];if(O.length===0)return te;const X=new Set(O.map(V=>V.cursor).filter(Boolean));return[...O,...te.filter(V=>!V.cursor||!X.has(V.cursor))]},[T,O]),U=(O[0]??(T??[])[0])?.cursor;async function K(){if(!(!R||!U||B)){G(!0),$.current=!1;try{const te={...E,before:U,lines:200},X=e.kind==="source"?await VC(e.name,te):(await KC(e.name,te)).logs;X.length&&P(V=>{const q=new Set(V.map(ee=>ee.cursor).filter(Boolean));return[...X.filter(ee=>!ee.cursor||!q.has(ee.cursor)),...V]})}finally{G(!1)}}}const I=t.trim().toLowerCase(),Z=_.useMemo(()=>{let te=z;return l&&(te=te.filter(X=>X.stream==="stderr")),I&&(te=te.filter(X=>wK(X).toLowerCase().includes(I))),te},[z,l,I]);_.useEffect(()=>{const te=D.current;if(!te)return;const X=()=>{const V=te.scrollHeight-te.scrollTop-te.clientHeight;$.current=V<40};return X(),te.addEventListener("scroll",X,{passive:!0}),()=>te.removeEventListener("scroll",X)},[]),_.useEffect(()=>{if(!n||!$.current||Z.length===0)return;const te=D.current;te&&(te.scrollTop=te.scrollHeight)},[n,Z]);const W=T?I?`No log lines match "${t.trim()}".`:l?"No stderr output captured.":"No log entries.":"Loading…";return i.jsxs("div",{className:h?"flex h-full min-h-0 flex-col gap-2":"flex flex-col gap-2",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f,i.jsx(vK,{onChange:s,value:t}),R?i.jsxs(i.Fragment,{children:[i.jsx("select",{"aria-label":"Time range",className:"h-8 rounded-md border border-border bg-background px-2 text-xs",onChange:te=>x(te.target.value),value:g,children:NK.map(te=>i.jsx("option",{value:te.value,children:te.label},te.label))}),i.jsxs("select",{"aria-label":"Level",className:"h-8 rounded-md border border-border bg-background px-2 text-xs",onChange:te=>w(te.target.value),value:v,children:[i.jsx("option",{value:"",children:"All levels"}),i.jsx("option",{value:"warn",children:"Warnings+"}),i.jsx("option",{value:"error",children:"Errors"})]})]}):i.jsxs(Dk,{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:[i.jsx(XR,{}),"Errors only"]}),i.jsxs(Dk,{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:[i.jsx(vM,{}),n?"Streaming":"Stream"]}),R&&U?i.jsxs(J,{disabled:B,onClick:()=>{K()},size:"sm",type:"button",variant:"outline",children:[i.jsx(hf,{}),B?"Loading…":"Load older"]}):null,d?i.jsx("div",{className:"ml-auto flex items-center gap-2",children:d}):null]}),A?i.jsx("div",{className:"text-red-600",children:A}):null,i.jsx(_K,{className:ae("rounded border border-border/60",h?"min-h-0 flex-1":"max-h-80"),containerRef:D,emptyText:W,logs:Z,query:t})]})}function Dk({active:e,activeClassName:t,children:s,onClick:n}){return i.jsx(J,{"aria-pressed":e,className:e?t:void 0,onClick:n,size:"sm",type:"button",variant:"outline",children:s})}function CK(e,t){return e.kind===t.kind&&e.name===t.name}function EK({options:e,target:t,onChange:s,className:n}){const o=e.findIndex(u=>CK(u.target,t)),l=[...new Set(e.map(u=>u.group))];return i.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=>i.jsx("optgroup",{label:u,children:e.map((h,f)=>h.group===u?i.jsx("option",{value:String(f),children:h.label},`${h.group}:${h.label}`):null)},u))})}function jK({serviceName:e}){const[t,s]=_.useState(""),[n,o]=_.useState(!1),[l,u]=_.useState(!1),[h,f]=_.useState(!1),d=i.jsx(x5,{fill:!0,hideStdout:l,query:t,setHideStdout:u,setQuery:s,setStreaming:o,streaming:n,target:{kind:"service",name:e},trailing:i.jsx(J,{"aria-label":h?"Exit fullscreen logs":"Expand logs",className:"text-muted-foreground hover:text-foreground",onClick:()=>f(p=>!p),size:"icon-sm",title:h?"Exit fullscreen":"Expand",type:"button",variant:"ghost",children:h?i.jsx(db,{}):i.jsx(ub,{})})});return h?i.jsx(lv,{onClose:()=>f(!1),title:`Logs — ${e}`,children:d}):i.jsx("div",{className:"h-[60vh] min-h-[24rem]",children:d})}function lv({title:e,onClose:t,children:s,maxWidthClass:n="max-w-6xl"}){return _.useEffect(()=>{function o(l){l.key==="Escape"&&t()}return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[t]),tr.createPortal(i.jsx("div",{className:"fixed inset-0 z-[1000] bg-black/40 p-4 sm:p-8",onMouseDown:t,children:i.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:[i.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-2",children:[i.jsx("h2",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:e}),i.jsx(J,{"aria-label":"Close logs",onClick:t,size:"icon",type:"button",variant:"ghost",children:i.jsx(Ut,{})})]}),i.jsx("div",{className:"min-h-0 flex-1 p-3",children:s})]})}),document.body)}const AK={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 TK({onClose:e,onAdded:t}){const[s,n]=_.useState(""),[o,l]=_.useState("journald"),[u,h]=_.useState(""),[f,d]=_.useState(""),[p,g]=_.useState(""),[x,v]=_.useState(""),[w,k]=_.useState(""),[N,E]=_.useState(""),[T,A]=_.useState(),[C,R]=_.useState(!1);async function D(){R(!0),A(void 0);try{const $={name:s.trim(),kind:"command"};o==="file"?($.kind="file",$.path=f.trim()):o==="ssh"?($.kind="ssh",$.host=u.trim(),$.path=f.trim()):o==="command"?($.kind="command",$.command=p.trim(),x.trim()&&($.cwd=x.trim())):o==="journald"?($.driver="journald",$.unit=w.trim(),u.trim()&&($.host=u.trim())):o==="docker"&&($.driver="docker",$.container=N.trim(),u.trim()&&($.host=u.trim()));const O=await yO($);t(O,$.name),e()}catch($){A($ instanceof Error?$.message:String($))}finally{R(!1)}}return i.jsx(Vn,{icon:i.jsx(kC,{}),onClose:e,size:"md",title:"Add log source",children:i.jsxs("form",{className:"flex flex-col gap-3 p-4 text-xs",onSubmit:$=>{$.preventDefault(),D()},children:[i.jsx(kr,{label:"Name",children:i.jsx(dt,{autoFocus:!0,onChange:$=>n($.target.value),placeholder:"PROD",value:s})}),i.jsxs(kr,{label:"Type",children:[i.jsxs("select",{className:"h-9 w-full rounded-md border border-border bg-background px-2 text-xs",onChange:$=>l($.target.value),value:o,children:[i.jsx("option",{value:"journald",children:"systemd journal (journald)"}),i.jsx("option",{value:"docker",children:"Docker container"}),i.jsx("option",{value:"ssh",children:"Remote file (SSH)"}),i.jsx("option",{value:"file",children:"Local file"}),i.jsx("option",{value:"command",children:"Command"})]}),i.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:AK[o]})]}),o==="journald"||o==="docker"?i.jsx(kr,{label:"Host (optional — leave blank to run locally)",children:i.jsx(dt,{onChange:$=>h($.target.value),placeholder:"jobjourney-prod (an alias from ~/.ssh/config)",value:u})}):null,o==="journald"?i.jsx(kr,{label:"Unit",children:i.jsx(dt,{onChange:$=>k($.target.value),placeholder:"jobjourney",value:w})}):null,o==="docker"?i.jsx(kr,{label:"Container",children:i.jsx(dt,{onChange:$=>E($.target.value),placeholder:"brainctl-api",value:N})}):null,o==="ssh"?i.jsx(kr,{label:"Host",children:i.jsx(dt,{onChange:$=>h($.target.value),placeholder:"prod (an alias from ~/.ssh/config)",value:u})}):null,o==="file"||o==="ssh"?i.jsx(kr,{label:o==="ssh"?"Remote path":"File path",children:i.jsx(dt,{onChange:$=>d($.target.value),placeholder:"/var/log/app/out.log",value:f})}):null,o==="command"?i.jsxs(i.Fragment,{children:[i.jsx(kr,{label:"Command",children:i.jsx(dt,{onChange:$=>g($.target.value),placeholder:"kubectl logs -l app=myapp --tail 500",value:p})}),i.jsx(kr,{label:"Working directory (optional)",children:i.jsx(dt,{onChange:$=>v($.target.value),placeholder:"/srv/app",value:x})})]}):null,T?i.jsx("div",{className:"text-red-600",children:T}):null,i.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[i.jsx(J,{onClick:e,size:"sm",type:"button",variant:"outline",children:"Cancel"}),i.jsx(J,{disabled:C||!s.trim(),size:"sm",type:"submit",children:C?"Saving…":"Add source"})]})]})})}function kr({label:e,children:t}){return i.jsxs("label",{className:"flex flex-col gap-1",children:[i.jsx("span",{className:"font-medium text-muted-foreground",children:e}),t]})}const Ok=4;function RK({services:e,initialService:t,onClose:s}){const[n,o]=_.useState([]),[l,u]=_.useState(!1),[h,f]=_.useState(()=>[0]),[d,p]=_.useState(()=>{const A=t?{kind:"service",name:t}:e[0]?{kind:"service",name:e[0]}:void 0;return A?{0:A}:{}}),g=_.useRef(1);_.useEffect(()=>{let A=!1;return _O().then(C=>{A||o(C)}),()=>{A=!0}},[]);const x=[...e.map(A=>({target:{kind:"service",name:A},label:A,group:"Services"})),...n.map(A=>({target:{kind:"source",name:A.name},label:A.name,group:"Log sources"}))],v=x.map(A=>A.target);function w(){if(h.length>=Ok||v.length===0)return;const A=g.current++,C=new Set(Object.values(d).map(Mk)),R=v.find(D=>!C.has(Mk(D)))??v[0];f(D=>[...D,A]),p(D=>({...D,[A]:R}))}function k(A){f(C=>C.filter(R=>R!==A)),p(C=>{const R={...C};return delete R[A],R})}function N(A,C){p(R=>({...R,[A]:C}))}function E(A,C){o(A);const R=h[0];R!==void 0&&N(R,{kind:"source",name:C})}const T=i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("span",{children:"Logs"}),i.jsxs(J,{onClick:()=>u(!0),size:"sm",type:"button",variant:"outline",children:[i.jsx(ps,{}),"Add source"]}),i.jsxs(J,{disabled:h.length>=Ok||v.length===0,onClick:w,size:"sm",type:"button",variant:"outline",children:[i.jsx(ps,{}),"Add pane"]})]});return i.jsxs(i.Fragment,{children:[i.jsx(lv,{maxWidthClass:"max-w-[1500px]",onClose:s,title:T,children:v.length===0?i.jsx("div",{className:"grid h-full place-items-center text-center text-muted-foreground",children:i.jsxs("div",{children:[i.jsx("p",{children:"No services or log sources yet."}),i.jsxs(J,{className:"mt-2",onClick:()=>u(!0),size:"sm",type:"button",children:[i.jsx(ps,{}),"Add a log source"]})]})}):i.jsx("div",{className:ae("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(A=>i.jsx(MK,{onChangeTarget:C=>N(A,C),onRemove:h.length>1?()=>k(A):void 0,options:x,target:d[A]??v[0]},A))})}),l?i.jsx(TK,{onAdded:E,onClose:()=>u(!1)}):null]})}function MK({options:e,target:t,onChangeTarget:s,onRemove:n}){const[o,l]=_.useState(""),[u,h]=_.useState(!0),[f,d]=_.useState(!1);return i.jsx("div",{className:"flex min-h-0 min-w-0 flex-col rounded-lg border border-border bg-background/60 p-2",children:i.jsx(x5,{fill:!0,hideStdout:f,leading:i.jsx(EK,{onChange:s,options:e,target:t}),query:o,setHideStdout:d,setQuery:l,setStreaming:h,streaming:u,target:t,trailing:n?i.jsx(J,{"aria-label":"Remove pane",onClick:n,size:"icon",type:"button",variant:"ghost",children:i.jsx(Ut,{})}):void 0})})}function DK({runtime:e,reloading:t,onReload:s}){if(!e?.stale)return null;const n=e.staleFiles,o=n.length===1?`${n[0].relativePath} was edited`:`${n.length} config files were edited`;return i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 rounded border border-amber-500/40 bg-amber-500/10 px-2.5 py-1.5 text-amber-700 dark:text-amber-400",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Ar,{className:"size-4 shrink-0"}),i.jsxs("span",{children:["Running with a stale configuration — ",o," after this service started. Reload to apply."]})]}),i.jsxs(J,{disabled:t,onClick:s,size:"sm",type:"button",variant:"outline",children:[i.jsx(SM,{})," ",t?"Reloading…":"Reload service"]})]})}function OK({rows:e,revealAll:t,onAdd:s,onRemove:n,onUpdate:o}){return e.length===0?i.jsxs("div",{className:"text-muted-foreground",children:["No variables yet."," ",i.jsx("button",{className:"underline",onClick:s,type:"button",children:"Add one"}),"."]}):i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full font-mono text-[11px]",children:[i.jsx("thead",{className:"text-left text-muted-foreground",children:i.jsxs("tr",{children:[i.jsx("th",{className:"py-1 pr-3",children:"Key"}),i.jsx("th",{className:"py-1 pr-3",children:"Value"}),i.jsx("th",{className:"py-1 w-8"})]})}),i.jsx("tbody",{children:e.map((l,u)=>{const h=!l.reveal&&!t;return i.jsxs("tr",{className:"border-t border-border/40",children:[i.jsx("td",{className:"py-1 pr-3 align-top",children:i.jsx("input",{className:"w-full rounded border border-border/60 bg-background px-1.5 py-0.5 font-mono",onChange:f=>o(u,{key:f.target.value}),placeholder:"KEY",spellCheck:!1,value:l.key})}),i.jsx("td",{className:"py-1 pr-3 align-top",children:i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("input",{className:"w-full rounded border border-border/60 bg-background px-1.5 py-0.5 font-mono",onChange:f=>o(u,{value:f.target.value}),spellCheck:!1,type:h?"password":"text",value:l.value}),i.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?i.jsx(rb,{size:14}):i.jsx(mf,{size:14})})]})}),i.jsx("td",{className:"py-1 align-top",children:i.jsx("button",{className:"text-muted-foreground hover:text-red-600",onClick:()=>n(u),type:"button",children:i.jsx(Mi,{size:14})})})]},u)})})]})})}function LK({serviceName:e,onClose:t,onPick:s}){const[n,o]=_.useState(),[l,u]=_.useState(),[h,f]=_.useState(!0),[d,p]=_.useState();_.useEffect(()=>{let v=!1;return f(!0),u(void 0),(async()=>{try{const w=await LO(e,d);v||o(w)}catch(w){v||u(w instanceof Error?w.message:String(w))}finally{v||f(!1)}})(),()=>{v=!0}},[e,d]);function g(v){if(v.kind==="directory"){p(v.relativePath);return}v.supported&&s(v.relativePath)}function x(){if(!n||n.isRoot)return;const v=n.relativePath,w=v.includes("/")?v.slice(0,v.lastIndexOf("/")):"";p(w||void 0)}return i.jsx(Vn,{icon:i.jsx(pf,{}),onClose:t,size:"lg",title:"Pick a config file",children:i.jsxs("div",{className:"flex flex-col gap-2 p-4",children:[i.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[i.jsxs(J,{disabled:!n||n.isRoot,onClick:x,size:"sm",type:"button",variant:"outline",children:[i.jsx(hf,{})," Up"]}),i.jsx("code",{className:"truncate rounded bg-muted px-2 py-1 font-mono",children:n?.relativePath||"./"})]}),l?i.jsx("div",{className:"text-red-600",children:l}):h?i.jsx("div",{className:"text-muted-foreground",children:"Loading…"}):!n||n.entries.length===0?i.jsx("div",{className:"text-muted-foreground",children:"Empty directory."}):i.jsx("div",{className:"max-h-[50vh] overflow-auto rounded border border-border/60",children:i.jsx("ul",{className:"divide-y divide-border/40",children:n.entries.map(v=>{const w=v.kind==="directory",k=w||v.supported;return i.jsx("li",{children:i.jsxs("button",{className:ae("flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs",k?"hover:bg-muted":"cursor-not-allowed text-muted-foreground"),disabled:!k,onClick:()=>g(v),type:"button",children:[w?i.jsx(co,{size:14}):i.jsx(mC,{size:14}),i.jsx("span",{className:"flex-1 truncate font-mono",children:v.name}),!w&&v.format?i.jsx(Ge,{size:"small",variant:"secondary",children:v.format}):null]})},v.relativePath)})})}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:["Only ",i.jsx("code",{children:".env*"}),", ",i.jsx("code",{children:"appsettings*.json"}),", and"," ",i.jsx("code",{children:"application*.yml"})," can be selected. Other files are shown disabled."]})]})})}function zK(e){const{error:t,success:s}=as(),[n,o]=_.useState(),[l,u]=_.useState(!1),h=_.useCallback(async()=>{try{o(await IO(e))}catch{o(void 0)}},[e]);_.useEffect(()=>{h()},[h]);const f=_.useCallback(async()=>{u(!0);try{await WC(e),s(`Reloaded ${e} with the latest configuration.`),await h()}catch(d){t(d instanceof Error?d.message:String(d))}finally{u(!1)}},[e,h,t,s]);return{runtime:n,reloading:l,refresh:h,reload:f}}function b5(e){if(!e.trim())return e;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function BK(e){const{error:t,success:s}=as(),[n,o]=_.useState([]),[l,u]=_.useState(),[h,f]=_.useState(),[d,p]=_.useState(!0),[g,x]=_.useState(!1),[v,w]=_.useState(!1),[k,N]=_.useState(!1),[E,T]=_.useState();_.useEffect(()=>{let B=!1;return p(!0),T(void 0),(async()=>{try{const G=await zO(e);if(B)return;o(G.files),G.files.length>0?u(F=>F??G.files[0].path):(u(void 0),f(void 0))}catch(G){B||T(G instanceof Error?G.message:String(G))}finally{B||p(!1)}})(),()=>{B=!0}},[e]);const A=_.useCallback(async B=>{x(!0),T(void 0);try{const G=await Rw(e,B),F={path:G.path,relativePath:G.relativePath,format:G.format};G.format==="env"?f({info:F,exists:G.exists,rows:G.entries.map(z=>({...z,reveal:!1}))}):f({info:F,exists:G.exists,text:G.format==="json"?b5(G.content):G.content}),N(!1)}catch(G){T(G instanceof Error?G.message:String(G))}finally{x(!1)}},[e]);_.useEffect(()=>{l&&A(l)},[l,A]);function C(B,G){f(F=>{if(!F?.rows)return F;const z=F.rows.map((U,K)=>K===B?{...U,...G}:U);return{...F,rows:z}}),N(!0)}function R(){f(B=>B?.rows?{...B,rows:[...B.rows,{key:"",value:"",secret:!1,reveal:!0}]}:B),N(!0)}function D(B){f(G=>G?.rows?{...G,rows:G.rows.filter((F,z)=>z!==B)}:G),N(!0)}function $(B){f(G=>G&&{...G,text:B}),N(!0)}async function O(){if(h){w(!0);try{if(h.info.format==="env"&&h.rows){const B=await BO(e,h.info.path,h.rows.map(G=>({key:G.key.trim(),value:G.value})));f({info:{path:B.path,relativePath:B.relativePath,format:B.format},exists:B.exists,rows:B.entries.map(G=>({...G,reveal:!1}))}),s(`Saved ${B.entries.length} entries to ${B.relativePath}.`)}else if(h.text!==void 0){const B=await PO(e,h.info.path,h.text);f({info:{path:B.path,relativePath:B.relativePath,format:B.format},exists:B.exists,text:B.content}),s(`Saved ${B.relativePath}.`)}N(!1)}catch(B){t(B instanceof Error?B.message:String(B))}finally{w(!1)}}}async function P(B){try{const G=await Rw(e,B),F={path:G.path,relativePath:G.relativePath,format:G.format};return o(z=>z.some(U=>U.path===F.path)?z:[...z,F]),u(F.path),s(`Loaded ${F.relativePath}.`),!0}catch(G){return t(G instanceof Error?G.message:String(G)),!1}}return{files:n,selectedPath:l,setSelectedPath:u,loaded:h,loadingList:d,loadingFile:g,saving:v,dirty:k,error:E,addRow:R,removeRow:D,updateRow:C,updateText:$,save:O,pickFile:P}}function PK({serviceName:e}){const{files:t,selectedPath:s,setSelectedPath:n,loaded:o,loadingList:l,loadingFile:u,saving:h,dirty:f,error:d,addRow:p,removeRow:g,updateRow:x,updateText:v,save:w,pickFile:k}=BK(e),N=zK(e),[E,T]=_.useState(!1),[A,C]=_.useState(!1);async function R(){await w(),await N.refresh()}return l?i.jsx("div",{className:"text-muted-foreground",children:"Loading…"}):d&&!o?i.jsx("div",{className:"text-red-600",children:d}):i.jsxs("div",{className:"space-y-2",children:[i.jsx(DK,{onReload:()=>{N.reload()},reloading:N.reloading,runtime:N.runtime}),i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("span",{className:"text-muted-foreground",children:"File:"}),t.length>0?i.jsx("select",{className:"rounded border border-border/60 bg-background px-1.5 py-0.5 font-mono text-xs",onChange:D=>n(D.target.value),value:s??"",children:t.map(D=>i.jsxs("option",{value:D.path,children:[D.relativePath," [",D.format,"]"]},D.path))}):i.jsx("span",{className:"text-muted-foreground",children:"none detected"}),i.jsxs(J,{onClick:()=>C(!0),size:"sm",type:"button",variant:"outline",children:[i.jsx(pf,{})," Browse files"]}),o?i.jsx("code",{className:"rounded bg-background px-1.5 py-0.5 font-mono text-muted-foreground",children:o.info.path}):null]}),i.jsxs("div",{className:"flex items-center gap-1",children:[o?.info.format==="env"?i.jsxs(i.Fragment,{children:[i.jsxs(J,{onClick:()=>T(D=>!D),size:"sm",type:"button",variant:"outline",children:[E?i.jsx(rb,{}):i.jsx(mf,{}),E?"Hide secrets":"Reveal secrets"]}),i.jsxs(J,{onClick:p,size:"sm",type:"button",variant:"outline",children:[i.jsx(ps,{})," Add"]})]}):null,i.jsxs(J,{disabled:!f||h||!o,onClick:()=>{R()},size:"sm",type:"button",children:[i.jsx(SC,{})," ",h?"Saving…":"Save"]})]})]}),d&&!o?i.jsx("div",{className:"text-red-600",children:d}):o?.info.format==="env"&&o.rows?i.jsx("div",{className:ae(u&&"opacity-60 transition-opacity"),children:i.jsx(OK,{revealAll:E,rows:o.rows,onAdd:p,onRemove:g,onUpdate:x})}):o?.text!==void 0?i.jsxs("div",{className:ae("space-y-1",u&&"opacity-60 transition-opacity"),children:[o.info.format==="json"?i.jsx("div",{className:"flex justify-end",children:i.jsx(J,{onClick:()=>v(b5(o.text??"")),size:"sm",type:"button",variant:"outline",children:"Format JSON"})}):null,i.jsx("textarea",{className:"min-h-[300px] w-full rounded border border-border/60 bg-background p-2 font-mono text-[11px] leading-relaxed",onChange:D=>v(D.target.value),spellCheck:!1,value:o.text})]}):u?i.jsx("div",{className:"text-muted-foreground",children:"Loading file…"}):null,o?i.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,A?i.jsx(LK,{onClose:()=>C(!1),onPick:D=>{k(D).then($=>{$&&C(!1)})},serviceName:e}):null]})}function IK({serviceName:e,status:t,timeline:s,onRefresh:n}){const{error:o,success:l}=as(),[u,h]=_.useState(!1),f=t?.inspector,d=t?.state==="running",p=_.useMemo(()=>s.filter(v=>v.kind==="service.http"&&v.service===e).map(v=>{const w=v.data??{};return{id:w.id??v.id,startedAt:v.timestamp,method:w.method??"?",path:w.path??"?",status:w.status??0,durationMs:w.durationMs??0,reqBytes:w.reqBytes??0,resBytes:w.resBytes??0}}).slice(-500).reverse(),[s,e]);async function g(v){h(!0);try{await Ai(`/api/services/${encodeURIComponent(e)}/inspector`,{enabled:v?"true":"false"}),await n(),l(v?`HTTP inspector started for ${e}.`:`HTTP inspector stopped for ${e}.`)}catch(w){o(w instanceof Error?w.message:String(w))}finally{h(!1)}}if(!d)return i.jsx("div",{className:"text-muted-foreground",children:"Service is not running."});if(!f?.enabled)return i.jsxs("div",{className:"space-y-2",children:[i.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."}),i.jsxs(J,{disabled:u,onClick:()=>g(!0),size:"sm",type:"button",children:[i.jsx(Tr,{})," Start HTTP inspector"]})]});const x=f.port?`http://127.0.0.1:${f.port}`:void 0;return i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("span",{className:"text-muted-foreground",children:"Inspect URL:"}),x?i.jsxs(i.Fragment,{children:[i.jsx("code",{className:"rounded bg-background px-1.5 py-0.5 font-mono",children:x}),i.jsxs(J,{onClick:()=>{navigator.clipboard.writeText(x),l("Copied inspect URL.")},size:"sm",type:"button",variant:"outline",children:[i.jsx(Ah,{})," Copy"]}),i.jsx(J,{onClick:()=>{_f(x)},size:"sm",type:"button",variant:"outline",children:"Open"})]}):i.jsx("span",{className:"text-muted-foreground",children:"starting…"}),i.jsxs("span",{className:"text-muted-foreground",children:["→ upstream :",f.upstreamPort??"?"]}),i.jsxs(J,{disabled:u,onClick:()=>g(!1),size:"sm",type:"button",variant:"outline",children:[i.jsx(ro,{})," Stop"]})]}),p.length===0?i.jsx("div",{className:"text-muted-foreground",children:"No requests captured yet. Hit the inspect URL in your browser to see traffic."}):i.jsx("div",{className:"max-h-80 overflow-auto",children:i.jsxs("table",{className:"w-full font-mono text-[11px]",children:[i.jsx("thead",{className:"sticky top-0 bg-muted/60 text-left text-muted-foreground",children:i.jsxs("tr",{children:[i.jsx("th",{className:"py-1 pr-3",children:"Time"}),i.jsx("th",{className:"py-1 pr-3",children:"Method"}),i.jsx("th",{className:"py-1 pr-3",children:"Path"}),i.jsx("th",{className:"py-1 pr-3 text-right",children:"Status"}),i.jsx("th",{className:"py-1 pr-3 text-right",children:"Size"}),i.jsx("th",{className:"py-1 pr-3 text-right",children:"ms"})]})}),i.jsx("tbody",{children:p.map(v=>i.jsxs("tr",{className:"border-t border-border/40",children:[i.jsx("td",{className:"py-1 pr-3 text-muted-foreground",children:new Date(v.startedAt).toLocaleTimeString()}),i.jsx("td",{className:"py-1 pr-3",children:v.method}),i.jsx("td",{className:"py-1 pr-3 truncate max-w-[40ch]",children:v.path}),i.jsx("td",{className:ae("py-1 pr-3 text-right",$K(v.status)),children:v.status}),i.jsx("td",{className:"py-1 pr-3 text-right text-muted-foreground",children:HK(v.resBytes)}),i.jsx("td",{className:"py-1 pr-3 text-right",children:v.durationMs.toFixed(1)})]},v.id))})]})})]})}function $K(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 HK(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function UK({serviceName:e}){const[t,s]=_.useState(null),[n,o]=_.useState(null),[l,u]=_.useState(()=>Date.now());return _.useEffect(()=>{let h=!1;async function f(){try{const p=await $O(e);h||(s(p),u(Date.now()),o(null))}catch(p){h||o(p instanceof Error?p.message:String(p))}}f();const d=setInterval(()=>{f()},3e3);return()=>{h=!0,clearInterval(d)}},[e]),n?i.jsxs("p",{className:"text-destructive",children:["Failed to load metrics: ",n]}):t?t.samples.length===0?i.jsx("p",{className:"text-muted-foreground",children:"No samples yet. Metrics start collecting once the service is running."}):i.jsx(FK,{series:t,now:l}):i.jsx("p",{className:"text-muted-foreground",children:"Loading metrics…"})}function FK({series:e,now:t}){const{samples:s}=e,n=_.useMemo(()=>Lk(s,f=>f.cpu),[s]),o=_.useMemo(()=>Lk(s,f=>f.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 i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:[i.jsx(oh,{accent:"#22c55e",label:"CPU",value:`${n.last.toFixed(1)}%`,sub:`peak ${n.max.toFixed(1)}% · avg ${n.avg.toFixed(1)}%`}),i.jsx(oh,{accent:"#3b82f6",label:"Memory",value:Hg(o.last),sub:`peak ${Hg(o.max)} · avg ${Hg(o.avg)}`}),i.jsx(oh,{accent:"#a855f7",label:"Uptime",value:u!=null?Pk(u):"—",sub:l?`since ${l.toLocaleTimeString()}`:"not running"}),i.jsx(oh,{accent:"#f59e0b",label:"Samples",value:String(s.length),sub:h?`over ${Pk(h)}`:"collecting…"})]}),i.jsx(Bk,{label:"CPU",samples:s,pick:f=>f.cpu,summary:n,color:"#22c55e",suffix:"%",unit:"percent"}),i.jsx(Bk,{label:"Memory (RSS)",samples:s,pick:f=>f.rss,summary:o,color:"#3b82f6",suffix:" MB",unit:"mb"})]})}function Lk(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 oh({accent:e,label:t,value:s,sub:n}){return i.jsxs("div",{className:"rounded-lg border border-border bg-card px-3 py-2",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full",style:{backgroundColor:e}}),i.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:t})]}),i.jsx("div",{className:"mt-1 font-mono text-lg leading-none tabular-nums",children:s}),i.jsx("div",{className:"mt-1 truncate font-mono text-[10px] text-muted-foreground",children:n})]})}const Jo=160,zk=44,qK=20;function Bk({label:e,samples:t,pick:s,summary:n,color:o,suffix:l,unit:u}){const h=_.useMemo(()=>`metric-grad-${u}-${Math.random().toString(36).slice(2,8)}`,[u]),f=t.map(s),d=Math.max(...f,u==="percent"?10:1),p=VK(d),g=0,x=p-g||1,v=t[0].t,w=t[t.length-1].t,k=Math.max(1,w-v),N=B=>(B-v)/k*1e3,E=B=>(1-(B-g)/x)*1e3,T=t.map(B=>`${N(B.t).toFixed(1)},${E(s(B)).toFixed(1)}`),A=`M0,1000 L${T.join(" L")} L1000,1000 Z`,C=`M${T.join(" L")}`,R=N(w),D=E(n.last),$=E(n.avg),O=[1,.75,.5,.25,0],P=5;return i.jsxs("figure",{className:"space-y-1",children:[i.jsxs("figcaption",{className:"flex items-baseline justify-between",children:[i.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:e}),i.jsxs("span",{className:"font-mono text-[11px] text-muted-foreground",children:["now ",i.jsxs("span",{className:"text-foreground",children:[n.last.toFixed(1),l]}),i.jsx("span",{className:"mx-1.5",children:"·"}),"peak ",n.max.toFixed(1),l,i.jsx("span",{className:"mx-1.5",children:"·"}),"avg ",n.avg.toFixed(1),l]})]}),i.jsxs("div",{className:"rounded-lg border border-border bg-card p-2",children:[i.jsxs("div",{className:"flex",children:[i.jsx("div",{className:"relative flex shrink-0 flex-col justify-between text-right font-mono text-[10px] text-muted-foreground",style:{width:zk,height:Jo},children:O.map(B=>i.jsx("span",{className:"pr-1 leading-none",children:GK(g+B*x,u)},B))}),i.jsxs("div",{className:"relative min-w-0 flex-1",style:{height:Jo},children:[O.map((B,G)=>i.jsx("div",{className:"pointer-events-none absolute inset-x-0 border-t border-border/40",style:{top:`${B===1?0:B===0?Jo-1:(1-B)*Jo}px`,borderStyle:G===O.length-1?"solid":"dashed"}},B)),i.jsx("div",{className:"pointer-events-none absolute inset-x-0 border-t border-dashed",style:{top:`${$/1e3*Jo}px`,borderColor:o,opacity:.4}}),i.jsxs("svg",{"aria-label":e,className:"absolute inset-0 h-full w-full",preserveAspectRatio:"none",role:"img",viewBox:"0 0 1000 1000",children:[i.jsx("defs",{children:i.jsxs("linearGradient",{id:h,x1:"0",x2:"0",y1:"0",y2:"1",children:[i.jsx("stop",{offset:"0%",stopColor:o,stopOpacity:.35}),i.jsx("stop",{offset:"100%",stopColor:o,stopOpacity:.02})]})}),i.jsx("path",{d:A,fill:`url(#${h})`}),i.jsx("path",{d:C,fill:"none",stroke:o,strokeWidth:2,vectorEffect:"non-scaling-stroke",strokeLinejoin:"round",strokeLinecap:"round"})]}),i.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:`${R/1e3*100}%`,top:`${D/1e3*Jo}px`,backgroundColor:o,boxShadow:`0 0 0 4px ${o}33`}})]})]}),i.jsx("div",{className:"flex font-mono text-[10px] text-muted-foreground",style:{height:qK,paddingLeft:zk},children:i.jsx("div",{className:"relative flex-1",children:Array.from({length:P+1},(B,G)=>{const F=G/P,z=v+F*k;return i.jsx("span",{className:"absolute top-1 whitespace-nowrap",style:{left:`${F*100}%`,transform:G===0?"translateX(0)":G===P?"translateX(-100%)":"translateX(-50%)"},children:WK(z-w)},G)})})})]})]})}function VK(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 GK(e,t){return t==="percent"?`${e.toFixed(0)}%`:e>=1024?`${(e/1024).toFixed(1)}G`:`${e.toFixed(0)}M`}function Hg(e){return e>=1024?`${(e/1024).toFixed(2)} GB`:`${e.toFixed(0)} MB`}function Pk(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 WK(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 KK({rows:e,running:t}){if(e.length===0)return i.jsx("div",{className:"text-muted-foreground",children:t?"No process tree available for this running service.":"No process tree (service not running)."});const s=[...e].sort((o,l)=>l.cpuPercent-o.cpuPercent),n=new Set(e.map(o=>o.pid));return i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full font-mono text-[11px]",children:[i.jsx("thead",{className:"text-left text-muted-foreground",children:i.jsxs("tr",{children:[i.jsx("th",{className:"py-1 pr-3",children:"PID"}),i.jsx("th",{className:"py-1 pr-3",children:"PPID"}),i.jsx("th",{className:"py-1 pr-3 text-right",children:"CPU%"}),i.jsx("th",{className:"py-1 pr-3 text-right",children:"RSS MB"}),i.jsx("th",{className:"py-1",children:"Command"})]})}),i.jsx("tbody",{children:s.map(o=>{const l=n.has(o.ppid);return i.jsxs("tr",{className:"border-t border-border/40",children:[i.jsx("td",{className:"py-1 pr-3",children:o.pid}),i.jsx("td",{className:"py-1 pr-3 text-muted-foreground",children:o.ppid}),i.jsx("td",{className:"py-1 pr-3 text-right",children:o.cpuPercent.toFixed(1)}),i.jsx("td",{className:"py-1 pr-3 text-right",children:o.rssMb.toFixed(1)}),i.jsx("td",{className:ae("py-1 truncate max-w-[60ch]",l&&"pl-4"),children:o.command})]},o.pid)})})]})})}const Ik={connecting:"bg-amber-500",running:"bg-emerald-500",exited:"bg-muted-foreground/40",error:"bg-red-500"},YK={state:"connecting",cwd:"Local workspace",detail:"Opening shell"};function v5({sessionId:e,active:t,toolbarExtra:s}){const n=_.useRef(null),[o,l]=_.useState(YK),u=_.useCallback(h=>l(h),[]);return i.jsxs("section",{className:ae("flex h-full min-h-0 flex-col bg-[#090909] text-white",!t&&"hidden"),children:[i.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:[i.jsx("div",{className:"min-w-0",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("span",{className:"relative flex size-2.5 shrink-0 items-center justify-center",title:o.state,children:[o.state==="connecting"&&i.jsx("span",{className:ae("absolute inline-flex size-full animate-ping rounded-full opacity-60",Ik[o.state])}),i.jsx("span",{className:ae("relative inline-flex size-2 rounded-full",Ik[o.state])})]}),i.jsxs("span",{className:"truncate font-mono text-[11px] text-white/55",children:[o.cwd," · ",o.detail]})]})}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx(J,{"aria-label":"Restart terminal",className:"text-white/60 hover:bg-white/10 hover:text-white",size:"icon-sm",variant:"ghost",onClick:()=>n.current?.restart(),title:"Restart terminal",type:"button",children:i.jsx(gf,{})}),i.jsx(J,{"aria-label":"Stop terminal",className:"text-white/60 hover:bg-white/10 hover:text-white",size:"icon-sm",variant:"ghost",onClick:()=>n.current?.stop(),title:"Stop terminal",type:"button",children:i.jsx(ro,{})}),s]})]}),i.jsx("div",{className:"min-h-0 flex-1",children:i.jsx(u5,{active:t,onStatusChange:u,ref:n,sessionId:e})})]})}function XK({serviceName:e,active:t}){const[s,n]=_.useState(null),[o,l]=_.useState(null),[u,h]=_.useState(!1),f=_.useRef(!1),d=_.useRef(!0);_.useEffect(()=>(d.current=!0,()=>{d.current=!1}),[]),_.useEffect(()=>{!t||f.current||(f.current=!0,(async()=>{try{const x=await mh({serviceName:e});d.current&&n(x.id)}catch(x){d.current&&(l(x instanceof Error?x.message:String(x)),f.current=!1)}})())},[t,e]);const p=i.jsx(J,{"aria-label":u?"Exit fullscreen terminal":"Expand terminal",className:"text-white/60 hover:bg-white/10 hover:text-white",onClick:()=>h(x=>!x),size:"icon-sm",title:u?"Exit fullscreen":"Expand",type:"button",variant:"ghost",children:u?i.jsx(db,{}):i.jsx(ub,{})}),g=o?i.jsxs("div",{className:"p-3 font-mono text-[11px] text-destructive",children:["Could not open terminal: ",o]}):s?i.jsx(v5,{active:t,sessionId:s,toolbarExtra:p}):i.jsx("div",{className:"p-3 font-mono text-[11px] text-muted-foreground",children:"Opening terminal…"});return u&&t?i.jsx(lv,{onClose:()=>h(!1),title:`Terminal — ${e}`,children:g}):i.jsx("div",{className:ae("h-[60vh] min-h-[24rem] overflow-hidden rounded-md border border-border",!t&&"hidden"),children:g})}const ZK=500;function QK(e){const[t,s]=_.useState(),[n,o]=_.useState([]),[l,u]=_.useState(),[h,f]=_.useState(!1),d=_.useRef(void 0);_.useEffect(()=>{d.current=void 0,s(void 0),o([]);const g=new EventSource(`/api/services/${encodeURIComponent(e)}/test/stream`),x=v=>{try{const w=JSON.parse(v.data);w.run.id!==d.current&&(d.current=w.run.id,o([])),s(w.run),w.line&&o(k=>[...k,w.line].slice(-ZK))}catch{}};return g.addEventListener("status",x),g.addEventListener("output",x),()=>g.close()},[e]);const p=_.useCallback(async g=>{f(!0),u(void 0);try{await UO(e,g)}catch(x){u(x instanceof Error?x.message:String(x))}finally{f(!1)}},[e]);return{run:t,lines:n,error:l,starting:h,start:p}}const JK={running:"secondary",passed:"success",failed:"error",error:"error"},eY={running:"Running",passed:"Passed",failed:"Failed",error:"Error"};function tY({serviceName:e}){const{run:t,lines:s,error:n,starting:o,start:l}=QK(e),[u,h]=_.useState(""),f=t?.status==="running"||o,d=t?.status==="failed"||t?.status==="error";return i.jsxs("div",{className:"space-y-2",children:[i.jsxs("form",{className:"flex items-center gap-2",onSubmit:p=>{p.preventDefault(),f||l(u.trim()||void 0)},children:[i.jsx(dt,{className:"h-7 flex-1 text-[11px]",disabled:f,onChange:p=>h(p.target.value),placeholder:"Optional test pattern (e.g. config-store)",value:u}),i.jsx(J,{disabled:f,size:"sm",type:"submit",children:f?"Running…":"Run tests"})]}),n?i.jsx("div",{className:"text-red-600",children:n}):null,t?i.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-muted-foreground",children:[i.jsx(Ge,{size:"small",variant:JK[t.status],children:eY[t.status]}),i.jsx("code",{className:"font-mono text-[11px]",children:t.command}),t.failingCount>0?i.jsxs("span",{children:["· ",t.failingCount," failing"]}):null,t.exitCode!=null?i.jsxs("span",{children:["· exit ",t.exitCode]}):null]}):i.jsx("div",{className:"text-muted-foreground",children:"No test runs yet."}),s.length>0?i.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)=>i.jsx("div",{className:ae(p.stream==="stderr"&&"text-red-500"),children:p.text},g))}):null,d?i.jsxs("div",{className:"rounded border border-border bg-muted/40 p-2",children:["Failures were piped into the"," ",i.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 sY({serviceName:e,status:t,health:s,timeline:n,onRefresh:o}){const[l,u]=ol("service-detail:tab","metrics"),h=s?.processTree?.processes??[];return i.jsxs("div",{className:"border-t border-border bg-muted/30 px-3 py-2 text-xs",children:[i.jsxs("div",{className:"mb-2 flex gap-1",children:[i.jsx(Ga,{active:l==="logs",onClick:()=>u("logs"),children:"Logs"}),i.jsxs(Ga,{active:l==="processes",onClick:()=>u("processes"),children:["Processes ",h.length?i.jsx(Ge,{variant:"secondary",size:"small",children:h.length}):null]}),i.jsx(Ga,{active:l==="metrics",onClick:()=>u("metrics"),children:"Metrics"}),i.jsxs(Ga,{active:l==="http",onClick:()=>u("http"),children:["HTTP",t?.inspector?.enabled?i.jsx(Ge,{variant:"success",size:"small",children:"on"}):null]}),i.jsx(Ga,{active:l==="env",onClick:()=>u("env"),children:"Env"}),i.jsx(Ga,{active:l==="tests",onClick:()=>u("tests"),children:"Tests"}),i.jsx(Ga,{active:l==="terminal",onClick:()=>u("terminal"),children:"Terminal"})]}),l==="processes"?i.jsx(KK,{rows:h,running:t?.state==="running"}):null,l==="metrics"?i.jsx(UK,{serviceName:e}):null,l==="http"?i.jsx(IK,{serviceName:e,status:t,timeline:n,onRefresh:o}):null,l==="env"?i.jsx(PK,{serviceName:e}):null,l==="tests"?i.jsx(tY,{serviceName:e}):null,l==="logs"?i.jsx(jK,{serviceName:e}):null,i.jsx(XK,{active:l==="terminal",serviceName:e},e)]})}function Ga({active:e,onClick:t,children:s}){return i.jsx("button",{className:ae("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 nY={high:"success",medium:"warning",low:"secondary"};function iY({onClose:e,onRefresh:t}){const s=as(),{sendToAgent:n}=At(),[o,l]=_.useState("url"),[u,h]=_.useState(""),[f,d]=_.useState(!1),[p,g]=_.useState(null),[x,v]=_.useState(null),[w,k]=_.useState([]),[N,E]=_.useState([]),[T,A]=_.useState(null),C=T?.kind==="docker-compose"?N.find(O=>O.composeService===T.composeService):void 0;async function R(){if(u.trim()){d(!0),g(null);try{const O=await CO(u.trim());v(O.profile),k(O.proposals),E(O.databases),A(O.proposals[0]??null),O.proposals.length===0&&g("Cloned, but couldn't detect how to run this repo. Refine with AI or add it manually."),l("review")}catch(O){g(O instanceof Error?O.message:String(O))}finally{d(!1)}}}function D(){n({prompt:`Onboard this repository and register it as a NoMoreIDE service: ${u.trim()}
112
- 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){if(T){d(!0),g(null);try{await EO(T,O,C),await t(),s.success(`${T.name} registered${C?" (+ database)":""}${O?" and starting":""}.`),e()}catch(P){g(P instanceof Error?P.message:String(P))}finally{d(!1)}}}return i.jsxs(Vn,{icon:i.jsx(Gn,{}),onClose:e,size:"lg",title:"Add from GitHub",children:[o==="url"?i.jsx(rY,{url:u,busy:f,error:p,onChange:h,onScan:R,onRefine:D}):null,o==="review"&&x?i.jsx(aY,{profile:x,proposals:w,selected:T,database:C,error:p,onSelect:A,onEdit:A,onBack:()=>l("url"),onRefine:D,onContinue:()=>l("install")}):null,o==="install"&&T?i.jsx(lY,{proposal:T,busy:f,error:p,onBack:()=>l("review"),onRegister:$}):null]})}function rY({url:e,busy:t,error:s,onChange:n,onScan:o,onRefine:l}){return i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:"Paste a repository URL. NoMoreIDE clones it, detects how it runs, and proposes a service."}),i.jsx(dt,{autoFocus:!0,placeholder:"https://github.com/owner/repo",value:e,onChange:u=>n(u.target.value),onKeyDown:u=>{u.key==="Enter"&&!t&&o()}}),s?i.jsx("p",{className:"text-sm text-destructive",children:s}):null,i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs(J,{variant:"ghost",size:"sm",onClick:l,disabled:!e.trim(),children:[i.jsx(Ri,{className:"size-3.5"}),"Refine with AI"]}),i.jsxs(J,{onClick:o,disabled:t||!e.trim(),children:[t?i.jsx(jt,{className:"size-4 animate-spin"}):i.jsx(Gn,{className:"size-4"}),t?"Cloning…":"Clone & detect"]})]})]})}function aY({profile:e,proposals:t,selected:s,database:n,error:o,onSelect:l,onEdit:u,onBack:h,onRefine:f,onContinue:d}){return i.jsxs("div",{className:"flex flex-col gap-4",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[i.jsx("span",{className:"text-sm font-medium",children:e.name}),e.languages.map(p=>i.jsx(Ge,{variant:"outline",size:"small",label:p},p))]}),o?i.jsx("p",{className:"text-sm text-destructive",children:o}):null,t.length>0?i.jsxs("div",{className:"flex flex-col gap-2",children:[i.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 i.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:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("span",{className:"font-medium",children:p.name}),i.jsx(Ge,{variant:nY[p.confidence],size:"small",label:p.confidence})]}),i.jsx("div",{className:"mt-0.5 font-mono text-xs text-muted-foreground",children:p.kind==="docker-compose"?`compose · ${p.composeService}`:p.command}),i.jsx("div",{className:"text-[11px] text-muted-foreground",children:p.reason})]},p.name)})]}):null,s?i.jsx(oY,{proposal:s,onChange:u}):null,n?i.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:[i.jsx(di,{className:"size-3.5"}),i.jsxs("span",{children:["Also registers database ",i.jsx("span",{className:"font-medium",children:n.name})," (",n.engine,") so it shows in the Database tab."]})]}):null,e.envKeys.length>0?i.jsxs("div",{className:"text-xs text-muted-foreground",children:[i.jsx("span",{className:"font-medium",children:"Env from .env.example:"})," ",e.envKeys.join(", ")]}):null,e.readmeExcerpt?i.jsxs("details",{className:"rounded-md border border-border bg-muted/30 p-2 text-xs",children:[i.jsx("summary",{className:"cursor-pointer font-medium",children:"README excerpt"}),i.jsx("pre",{className:"mt-2 max-h-40 overflow-auto whitespace-pre-wrap font-mono",children:e.readmeExcerpt})]}):null,i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs(J,{variant:"ghost",size:"sm",onClick:h,children:[i.jsx(ou,{className:"size-3.5"}),"Back"]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs(J,{variant:"outline",size:"sm",onClick:f,children:[i.jsx(Ri,{className:"size-3.5"}),"Refine with AI"]}),i.jsx(J,{onClick:d,disabled:!s,children:"Continue"})]})]})]})}function oY({proposal:e,onChange:t}){return i.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[i.jsx(Ic,{label:"Service name",children:i.jsx(dt,{value:e.name,onChange:s=>t({...e,name:s.target.value})})}),i.jsx(Ic,{label:"Port (optional)",children:i.jsx(dt,{value:e.port?.toString()??"",placeholder:"auto",onChange:s=>t({...e,port:s.target.value?Number(s.target.value):void 0})})}),e.kind==="docker-compose"?i.jsx(Ic,{label:"Compose service",className:"col-span-2",children:i.jsx(dt,{value:e.composeService??"",onChange:s=>t({...e,composeService:s.target.value})})}):i.jsx(Ic,{label:"Run command",className:"col-span-2",children:i.jsx(dt,{value:e.command??"",onChange:s=>t({...e,command:s.target.value})})})]})}function lY({proposal:e,busy:t,error:s,onBack:n,onRegister:o}){const[l,u]=_.useState(e.installCommand??""),[h,f]=_.useState([]),[d,p]=_.useState(!1),[g,x]=_.useState(!1),v=_.useRef(null);function w(N){f(E=>[...E,N]),queueMicrotask(()=>{const E=v.current;E&&(E.scrollTop=E.scrollHeight)})}async function k(){l.trim()&&(p(!0),x(!1),f([]),await jO({clonePath:e.cwd,command:l.trim()},{onLine:N=>w(N.text),onDone:N=>{w(N===0?"✓ install complete":`✗ install exited ${N}`),p(!1),x(N===0)},onError:N=>{w(`✗ ${N}`),p(!1)}}))}return i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsxs("div",{className:"flex items-end gap-2",children:[i.jsx(Ic,{label:"Install command (optional)",className:"flex-1",children:i.jsx(dt,{value:l,placeholder:"e.g. npm install",onChange:N=>u(N.target.value)})}),i.jsxs(J,{variant:"outline",onClick:k,disabled:d||!l.trim(),children:[d?i.jsx(jt,{className:"size-4 animate-spin"}):i.jsx(Xc,{className:"size-4"}),"Install"]})]}),h.length>0?i.jsx("pre",{ref:v,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(`
113
- `)}):null,s?i.jsx("p",{className:"text-sm text-destructive",children:s}):null,i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs(J,{variant:"ghost",size:"sm",onClick:n,children:[i.jsx(ou,{className:"size-3.5"}),"Back"]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(J,{variant:"outline",onClick:()=>o(!1),disabled:t,children:"Register only"}),i.jsxs(J,{onClick:()=>o(!0),disabled:t,children:[t?i.jsx(jt,{className:"size-4 animate-spin"}):i.jsx(Tr,{className:"size-4"}),g||!l.trim()?"Register & start":"Skip install & start"]})]})]})]})}function Ic({label:e,className:t,children:s}){return i.jsxs("label",{className:`flex flex-col gap-1 text-xs ${t??""}`,children:[i.jsx("span",{className:"font-medium text-muted-foreground",children:e}),s]})}function cY({data:e,onRefresh:t,focusService:s,onServiceFocused:n,scopeName:o}){const l=e.config.services[0]?.name??"",[u,h]=_.useState(l),[f,d]=_.useState(null),[p,g]=_.useState(!1),{sendToAgent:x,startOnboard:v}=At(),[w,k]=_.useState(!1),[N,E]=_.useState(!1),[T,A]=_.useState(!1),[C,R]=_.useState(!1),[D,$]=_.useState(!1),O=_.useRef({}),{error:P,message:B,success:G}=as(),F=_.useMemo(()=>new Set(e.config.bundles.flatMap(ie=>ie.services)),[e.config.bundles]),z=_.useMemo(()=>{const ie=new Map;for(const Se of e.config.bundles)for(const Me of Se.services)ie.has(Me)||ie.set(Me,Se.name);return ie},[e.config.bundles]),U=_.useMemo(()=>e.config.services.filter(ie=>!F.has(ie.name)),[e.config.services,F]),K=_.useMemo(()=>e.config.services.map(ie=>ie.name),[e.config.services]),I=_.useMemo(()=>e.config.services.some(ie=>(ie.dependsOn?.length??0)>0),[e.config.services]),Z=e.health??{},W=e.config.bundles.length>0||U.length>0;_.useEffect(()=>{!e.config.services.some(Se=>Se.name===u)&&l&&h(l)},[e.config.services,l,u]),_.useEffect(()=>{s&&e.config.services.some(ie=>ie.name===s)&&(h(s),n?.())},[s,e.config.services,n]);const te=_.useMemo(()=>e.config.services.find(ie=>ie.name===u),[e.config.services,u]),X=u?e.runtime.services[u]:void 0,V=u?Z[u]:void 0;async function q(ie,Se){if(!ie.services.includes(Se))try{await FO(ie.name,ie.services,Se),G(`Added ${Se} to ${ie.name}.`),await t()}catch(Me){P(Me instanceof Error?Me.message:String(Me))}}async function le(){if(te){if(Gc(X?.state)){P(`Stop ${te.name} before deleting it.`);return}if(window.confirm(`Delete service "${te.name}"? This removes it from your config.`))try{await OO(te.name),G(`Deleted ${te.name}.`),await t()}catch(ie){P(ie instanceof Error?ie.message:String(ie))}}}async function ee(ie){const Se=e.config.bundles.filter(Me=>Me.services.includes(ie));if(Se.length!==0)try{for(const Me of Se)await VO(Me.name,Me.services,ie);B({text:`Removed ${ie} from ${Se.map(Me=>Me.name).join(", ")}.`}),await t()}catch(Me){P(Me instanceof Error?Me.message:String(Me))}}_.useEffect(()=>{const ie=Object.fromEntries(e.config.services.map(Me=>[Me.name,e.runtime.services[Me.name]?.state??"stopped"])),Se=O.current;if(Object.keys(Se).length){const Me=new Map,De=new Map;for(const Je of e.config.services){const Ne=ie[Je.name],Ue=Se[Je.name];if(!Ue||Ue===Ne)continue;const $e=e.runtime.services[Je.name],St=z.get(Je.name);if(St){const Ls=Me.get(St)??new Map;if(Ls.set(Ne,(Ls.get(Ne)??0)+1),Me.set(St,Ls),Ne==="exited"){const zs=De.get(St)??[];zs.push($e?.exitCode),De.set(St,zs)}continue}if(Ne==="running")G(`${Je.name} is running.`);else if(Ne==="stopped")B({text:`${Je.name} stopped.`});else if(Ne==="starting")B({text:`${Je.name} is starting.`});else if(Ne==="exited"){const Ls=$e?.exitCode===void 0||$e.exitCode===null?"":` with code ${$e.exitCode}`;P(`${Je.name} exited${Ls}.`)}}for(const[Je,Ne]of Me)dY({exitCodes:De.get(Je)??[],groupName:Je,showErrorToast:P,showMessageToast:B,showSuccessToast:G,transitions:Ne})}O.current=ie},[e.config.services,e.runtime.services,z,P,B,G]);const fe=e.config.services.length>0;return i.jsxs(i.Fragment,{children:[!fe&&o?i.jsx("div",{className:"flex h-full items-center justify-center p-8 text-center",children:i.jsxs("div",{className:"max-w-sm text-sm text-muted-foreground",children:[i.jsxs("p",{className:"font-medium text-foreground",children:["No services in ",o]}),i.jsx("p",{className:"mt-1 text-xs",children:"Services whose working directory lives under this project appear here. Switch to All projects in the sidebar to see everything."})]})}):fe?i.jsxs("div",{className:ae("grid h-full min-h-0 overflow-hidden bg-card/85",T?"lg:grid-cols-[320px_minmax(0,1fr)]":"lg:grid-cols-[320px_minmax(0,1fr)_340px]"),children:[i.jsx("div",{className:"min-h-0 min-w-0 overflow-auto border-r border-border",children:i.jsxs(hi,{className:"min-w-0 rounded-none border-0 border-b border-border bg-transparent",children:[i.jsx(fi,{className:"border-b border-border px-3 py-2",children:i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx(mi,{className:"text-sm",children:"Services"}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsxs(J,{"aria-haspopup":"dialog",className:"h-7 gap-1.5 px-2 text-xs",onClick:()=>E(!0),size:"sm",type:"button",variant:"outline",children:[i.jsx(Mh,{className:"size-3.5"}),"Graph"]}),i.jsxs(J,{"aria-haspopup":"dialog",className:"h-7 gap-1.5 px-2 text-xs",onClick:()=>k(!0),size:"sm",type:"button",variant:"outline",children:[i.jsx(kC,{className:"size-3.5"}),"Logs"]}),i.jsx(uY,{onCreateGroup:()=>d("group"),onCreateService:()=>d("service"),onOnboardRepo:()=>g(!0),onOnboardWithAi:v,canGroupWithAi:U.length>1,onCreateWithAi:()=>x({prompt:l2,source:{type:"service-setup",label:"Add a service"},label:"Help me add a new service, one step at a time."}),onGroupWithAi:()=>x({prompt:aH(U),source:{type:"group-services",label:"Group services"},label:"Propose how to group my ungrouped services."})})]})]})}),i.jsx(pi,{className:"p-0",children:W?i.jsxs("div",{className:"divide-y divide-border",children:[e.config.bundles.map(ie=>i.jsx(UU,{group:ie,onRefresh:t,ports:e.ports,allServices:e.config.services,health:Z,services:e.config.services.filter(Se=>ie.services.includes(Se.name)),statuses:e.runtime.services,timeline:e.timeline,selectedService:u,onSelectService:h,onDropService:Se=>{q(ie,Se)}},ie.name)),U.length?i.jsxs("div",{className:ae("transition-colors",D&&"bg-primary/5 outline-dashed outline-2 -outline-offset-2 outline-primary/60"),onDragOver:ie=>{ie.dataTransfer.types.includes(nu)&&(ie.preventDefault(),ie.dataTransfer.dropEffect="move",$(!0))},onDragLeave:()=>$(!1),onDrop:ie=>{ie.preventDefault(),$(!1);const Se=ie.dataTransfer.getData(nu);Se&&ee(Se)},children:[i.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:[i.jsx("span",{children:"Ungrouped"}),i.jsx("span",{className:"text-muted-foreground/80",children:U.length})]}),i.jsx("div",{className:"divide-y divide-border",children:U.map(ie=>i.jsx(pj,{service:ie,status:e.runtime.services[ie.name],health:Z[ie.name],ports:e.ports,onRefresh:t,timeline:e.timeline,selected:u===ie.name,onSelect:()=>h(ie.name)},ie.name))})]}):null]}):i.jsx(ef,{label:"No services registered yet."})})]})}),i.jsx("div",{className:"min-h-0 min-w-0 overflow-auto",children:te?i.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[i.jsxs("div",{className:"shrink-0 space-y-2 border-b border-border bg-background/60 px-4 py-3",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i.jsx("h2",{className:"min-w-0 truncate text-base font-semibold",children:te.name}),i.jsx(gj,{state:X?.state??"stopped"}),i.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1.5",children:[(()=>{const ie=X?.url??(te.port?qU(te.port):void 0);return ie?i.jsx(al,{label:`Open ${ie}`,children:i.jsx(J,{"aria-label":"Open in browser",className:"size-7",onClick:()=>{_f(ie)},size:"icon",type:"button",variant:"outline",children:i.jsx(io,{})})}):null})(),V?.agentContext&&te?i.jsx(al,{label:"Debug this service with AI",children:i.jsx(J,{"aria-label":"Debug this service with AI",className:"size-7",onClick:()=>x({prompt:dH({service:te.name,context:V.agentContext}),source:{type:"service-debug",label:te.name},label:`Debug \`${te.name}\` with its current context.`}),size:"icon",type:"button",variant:"outline",children:i.jsx(qt,{className:"size-3.5"})})}):null,i.jsx(Kb,{active:Gc(X?.state),baseUrl:`/api/services/${encodeURIComponent(te.name)}`,compact:!0,resourceKind:"service",resourceName:te.name,targetLabel:te.name,onRefresh:t}),i.jsx(mu,{className:"size-7 border border-border bg-background opacity-100 hover:border-foreground/30",items:[{icon:i.jsx(dl,{className:"size-3.5"}),label:"Edit service",onSelect:()=>R(!0)},...Gc(X?.state)?[]:[{icon:i.jsx(Mi,{className:"size-3.5 text-destructive"}),label:"Delete service",onSelect:()=>{le()}}]],label:`More actions for ${te.name}`}),i.jsx(al,{label:T?"Show Ports & Timeline":"Hide Ports & Timeline",side:"left",children:i.jsx(J,{"aria-label":T?"Show Ports & Timeline":"Hide Ports & Timeline",className:"size-7",onClick:()=>A(ie=>!ie),size:"icon",type:"button",variant:"ghost",children:T?i.jsx(rR,{}):i.jsx(jn,{})})})]})]}),te.command?i.jsxs("div",{className:"truncate font-mono text-[11px] text-muted-foreground",title:te.command,children:["$ ",te.command]}):null,te.cwd?i.jsx("div",{className:"truncate font-mono text-[11px] text-muted-foreground",title:te.cwd,children:te.cwd}):null,i.jsx(hK,{health:V})]}),i.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:i.jsx(sY,{serviceName:te.name,status:X,health:V,timeline:e.timeline??[],onRefresh:t},te.name)})]}):i.jsx(ef,{label:"Select a service to see details."})}),T?null:i.jsxs("div",{className:"min-h-0 overflow-auto border-l border-border",children:[i.jsx(xK,{ports:e.ports}),i.jsx(QW,{events:e.timeline??[]})]})]}):i.jsx(dK,{onOnboardRepo:()=>g(!0),onOnboardWithAi:v,onCreateService:()=>d("service"),onCreateWithAi:()=>x({prompt:l2,source:{type:"service-setup",label:"Add a service"},label:"Help me add a new service, one step at a time."})}),C&&te?i.jsx(Vn,{icon:i.jsx(dl,{}),onClose:()=>R(!1),size:"lg",title:`Edit Service — ${te.name}`,children:i.jsx(C2,{cwd:e.cwd,initialService:te,availableServices:K,onRefresh:t,onSaved:()=>R(!1)})}):null,f?i.jsx(Vn,{icon:f==="service"?i.jsx(ps,{}):i.jsx(df,{}),onClose:()=>d(null),size:f==="service"?"lg":"md",title:f==="service"?"Add Service":"Create Group",children:f==="service"?i.jsx(C2,{cwd:e.cwd,availableServices:K,onRefresh:t,onSaved:()=>d(null)}):i.jsx(mj,{services:U,onRefresh:t,onSaved:()=>d(null)})}):null,p?i.jsx(iY,{onClose:()=>g(!1),onRefresh:t}):null,w?i.jsx(RK,{initialService:u||void 0,onClose:()=>k(!1),services:e.config.services.map(ie=>ie.name)}):null,N?i.jsx(Vn,{icon:i.jsx(Mh,{}),onClose:()=>E(!1),size:"lg",title:"Service Dependency Graph",children:i.jsx(oK,{statuses:e.runtime.services,health:Z,hasDependencies:I,onSelectService:ie=>{h(ie),E(!1)}})}):null]})}function uY({onCreateService:e,onCreateGroup:t,onCreateWithAi:s,onGroupWithAi:n,canGroupWithAi:o,onOnboardRepo:l,onOnboardWithAi:u}){const[h,f]=_.useState(!1);function d(p){f(!1),p()}return i.jsxs("div",{className:"relative",children:[i.jsx(al,{label:"Add",side:"bottom",children:i.jsx(J,{"aria-expanded":h,"aria-haspopup":"menu","aria-label":"Add service or group",className:"size-7",onClick:()=>f(p=>!p),size:"icon",type:"button",variant:"ghost",children:i.jsx(ps,{})})}),h?i.jsxs(i.Fragment,{children:[i.jsx("button",{"aria-hidden":!0,className:"fixed inset-0 z-[40] cursor-default",onClick:()=>f(!1),tabIndex:-1,type:"button"}),i.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:[i.jsxs("div",{className:"group flex items-stretch",children:[i.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:[i.jsx(ps,{}),"Create Service"]}),i.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:[i.jsx(qt,{className:"size-3.5 shrink-0"}),"AI"]})]}),i.jsxs("div",{className:"group flex items-stretch",children:[i.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:[i.jsx(df,{}),"Create Group"]}),o?i.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:[i.jsx(qt,{className:"size-3.5 shrink-0"}),"AI"]}):null]}),i.jsxs("div",{className:"group flex items-stretch",children:[i.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:[i.jsx(Gn,{}),"Add from GitHub"]}),i.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:[i.jsx(qt,{className:"size-3.5 shrink-0"}),"AI"]})]})]})]}):null]})}function dY({exitCodes:e,groupName:t,showErrorToast:s,showMessageToast:n,showSuccessToast:o,transitions:l}){if(l.size===1){const[f]=l.keys();if(f==="running")o(`${t} group is running.`);else if(f==="stopped")n({text:`${t} group stopped.`});else if(f==="starting")n({text:`${t} group is starting.`});else if(f==="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(([f,d])=>`${d} ${f}`).join(", "),h=`${t} group updated: ${u}.`;l.has("exited")?s(h):n({text:h})}function hY({data:e,onOpenService:t}){const s=_.useMemo(()=>fY(e),[e]);return s.length?i.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:[i.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 font-mono text-[10px] uppercase tracking-wider text-muted-foreground",children:[i.jsx(eo,{className:"size-3"}),"Running"]}),i.jsx("div",{className:"flex min-w-0 items-center gap-2",children:s.map(n=>i.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:[i.jsx("span",{className:ae("size-2 shrink-0 rounded-full",pY(n.tone))}),i.jsx("span",{className:"max-w-40 truncate font-medium text-foreground",children:n.name}),n.port?i.jsxs("span",{className:"text-muted-foreground",children:[":",n.port]}):null,n.uptime?i.jsxs("span",{className:"text-muted-foreground/70",children:["↑",n.uptime]}):null]},n.name))})]}):null}function fY(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:mY(s,e.health[s.name]),port:t.get(s.name)??gY(s.url),uptime:s.state==="running"?xY(s.startedAt):"starting…",url:s.url})).sort((s,n)=>s.name.localeCompare(n.name))}function mY(e,t){return e.state==="starting"?"starting":t?.status==="healthy"?"healthy":t?.status==="warning"?"warning":t?.status==="unhealthy"?"unhealthy":"healthy"}function pY(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 gY(e){if(e)try{const t=new URL(e).port;return t?Number(t):void 0}catch{return}}function xY(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 bY(){const[e,t]=_.useState([]),[s,n]=_.useState(null),[o,l]=_.useState(!1);_.useEffect(()=>{let f=!1;return(async()=>{let d=await XC().catch(()=>[]);if(d.length===0){const p=await mh().catch(()=>null);d=p?[p]:[]}f||(t(d),n(d[0]?.id??null))})(),()=>{f=!0}},[]);const u=_.useCallback(async()=>{l(!0);try{const f=await mh();t(d=>[...d,f]),n(f.id)}finally{l(!1)}},[]),h=_.useCallback(async f=>{l(!0);try{await Ax(f);const d=e.findIndex(g=>g.id===f),p=e.filter(g=>g.id!==f);if(p.length===0){const g=await mh();t([g]),n(g.id);return}if(t(p),s===f){const g=p[Math.min(d,p.length-1)];n(g.id)}}finally{l(!1)}},[e,s]);return i.jsxs("section",{className:"flex h-full min-h-0 flex-col bg-[#090909] text-white",children:[i.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((f,d)=>{const p=f.label??`Terminal ${d+1}`;return i.jsxs("div",{className:ae("group flex items-center gap-1 rounded-md border border-transparent px-2 py-1 text-xs",f.id===s?"border-white/15 bg-white/10 text-white":"text-white/60 hover:bg-white/5"),children:[i.jsx("button",{"aria-selected":f.id===s,className:"max-w-[160px] truncate font-medium",onClick:()=>n(f.id),role:"tab",type:"button",children:p}),i.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(f.id)},type:"button",children:i.jsx(Ut,{className:"size-3"})})]},f.id)}),i.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:i.jsx(ps,{className:"size-4"})})]}),i.jsx("div",{className:"relative min-h-0 flex-1",children:e.length===0?i.jsx("div",{className:"flex h-full items-center justify-center font-mono text-[11px] text-white/40",children:"Starting terminal…"}):e.map(f=>i.jsx("div",{className:"absolute inset-0",children:i.jsx(v5,{active:f.id===s,sessionId:f.id})},f.id))})]})}function _5({branch:e}){return i.jsx("span",{className:"min-w-0 max-w-40",title:e,children:i.jsx(Ge,{className:"w-full max-w-full shadow-none",variant:"outline",children:e})})}function y5({branch:e,error:t,files:s,selectedFile:n,onSelectFile:o,root:l,staging:u}){const h=_.useMemo(()=>wY(s).filter(p=>p.files.length),[s]),[f,d]=_.useState({staged:!1,unstaged:!1,untracked:!1});return i.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[i.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:[i.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-[12px] font-semibold tracking-tight",children:[i.jsx(Gn,{className:"size-3.5"}),i.jsx("span",{className:"truncate",children:"Changes"})]}),i.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[e?i.jsx(_5,{branch:e}):null,i.jsx(Ge,{variant:"secondary",children:s.length})]})]}),i.jsx("div",{className:"min-h-0 flex-1 overflow-auto py-1",children:h.length?h.map(p=>i.jsx(vY,{collapsed:f[p.id],group:p,onSelectFile:o,onToggle:()=>d(g=>({...g,[p.id]:!g[p.id]})),root:l,selectedFile:n,staging:u},p.id)):i.jsx(Qe,{variant:"muted",className:"m-3 text-center",children:t??"No changed files."})})]})}function vY({collapsed:e,group:t,onSelectFile:s,onToggle:n,root:o,selectedFile:l,staging:u}){const h=e?jn:Wn,f=t.files.map(p=>p.path),d=u?t.id==="staged"?{label:"Unstage all",run:()=>u.onUnstage(f)}:{label:"Stage all",run:()=>u.onStage(f)}:null;return i.jsxs("section",{className:"border-b border-border last:border-b-0",children:[i.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:[i.jsxs("button",{className:"flex min-w-0 flex-1 items-center gap-1.5 text-left",onClick:n,type:"button",children:[i.jsx(h,{className:"size-3.5"}),i.jsx("span",{className:"truncate",children:t.label})]}),d?i.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,i.jsx(Ge,{className:"min-w-6 justify-center font-mono shadow-none",size:"small",variant:"outline",children:t.files.length})]}),e?null:i.jsx("div",{children:t.files.map(p=>i.jsx(_Y,{active:l===p.path,file:p,group:t.id,onClick:()=>s(p.path),root:o,staging:u},p.path))})]})}function _Y({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("/"),f=o?fj(pu(o,t.path)):{},d=s==="staged";return i.jsxs("div",{className:ae("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:[i.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",...f,children:[i.jsx(ov,{path:t.path}),i.jsxs("span",{className:"flex min-w-0 flex-1 items-baseline gap-1.5 truncate",children:[i.jsx("span",{"data-testid":"changed-file-name",className:"shrink-0 truncate",children:u}),h?i.jsx("span",{"data-testid":"changed-file-dir",className:"min-w-0 truncate text-muted-foreground",children:h}):null]})]}),l?i.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?i.jsx(vC,{className:"size-3.5"}):i.jsx(ps,{className:"size-3.5"})}):null,i.jsx("span",{className:ae("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:yY(t,s)})]})}function yY(e,t){return t==="untracked"?"?":t==="staged"?e.index.trim():e.workingTree.trim()}function wY(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 w5({branch:e,files:t,onDone:s,repo:n}){const{sendToAgent:o}=At(),[l,u]=_.useState(""),[h,f]=_.useState(null),[d,p]=_.useState(null),[g,x]=_.useState(null),v=_.useMemo(()=>t.filter(E=>E.index.trim()&&E.index!=="?").map(E=>E.path),[t]),w=v.length>0&&l.trim().length>0&&h===null;async function k(E,T){f(E),p(null),x(null);try{if(await FC(l.trim(),n),T){const A=await yf(n);x(`Committed and pushed ${A.branch}.`)}else x("Committed staged changes.");u(""),s()}catch(A){p(A instanceof Error?A.message:String(A))}finally{f(null)}}function N(){o({prompt:sH({branch:e,stagedFiles:v}),source:{type:"git-commit",label:"commit message"},mode:"send",label:"Suggest a commit message"})}return i.jsxs("div",{className:"shrink-0 space-y-2 border-t border-border bg-card/95 p-2.5",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-tight text-muted-foreground",children:"Commit"}),i.jsxs("span",{className:"flex items-center gap-1.5",children:[i.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[v.length," staged"]}),i.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:v.length===0,onClick:N,title:"Ask the agent to draft a commit message from the staged diff",type:"button",children:[i.jsx(qt,{className:"size-3.5"}),"AI message"]})]})]}),i.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:E=>{u(E.target.value),p(null),x(null)},placeholder:v.length?"Commit message…":"Stage files to commit",value:l}),i.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[i.jsxs(J,{disabled:!w,onClick:()=>{k("commit",!1)},size:"sm",type:"button",variant:"outline",children:[h==="commit"?i.jsx(jt,{className:"size-3.5 animate-spin"}):i.jsx(Ds,{className:"size-3.5"}),"Commit"]}),i.jsxs(J,{disabled:!w,onClick:()=>{k("push",!0)},size:"sm",type:"button",children:[h==="push"?i.jsx(jt,{className:"size-3.5 animate-spin"}):i.jsx(bf,{className:"size-3.5"}),"Commit & push"]})]}),d?i.jsx(Qe,{className:"px-2.5 py-1.5 text-[11px]",variant:"destructive",children:d}):g?i.jsx(Qe,{className:"px-2.5 py-1.5 text-[11px]",variant:"muted",children:g}):null]})}function SY(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 f=0;f<u.length;f+=1){const d=u[f],p=f===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 $k(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 Hk({defaultExpandAll:e=!1,paths:t,status:s,selectedFile:n,onSelectFile:o,branch:l,emptyMessage:u="No tracked files.",root:h,title:f="Files"}){const d=_.useMemo(()=>SY(t),[t]),p=_.useMemo(()=>$k(d,e),[e,d]),g=_.useMemo(()=>$k(d,!0),[d]),x=Math.max(0,Object.keys(g).length-1),v=_.useMemo(()=>{const R=new Map;for(const D of s)R.set(D.path,D);return R},[s]),[w,k]=_.useState(p),[N,E]=_.useState(!1);_.useEffect(()=>{N||d.children.length===0||(k(p),E(!0))},[p,N,d.children.length]);function T(R){k(D=>({...D,[R]:!D[R]}))}function A(){k(g)}function C(){k({"":!0})}return i.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[i.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:[i.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-[12px] font-semibold tracking-tight",children:[i.jsx(co,{className:"size-3.5"}),i.jsx("span",{className:"truncate",children:f})]}),i.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[x>0?i.jsxs("span",{className:"flex items-center gap-0.5",children:[i.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:A,title:"Expand all folders",type:"button",children:i.jsx(T6,{className:"size-3.5"})}),i.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:C,title:"Collapse all folders",type:"button",children:i.jsx(j6,{className:"size-3.5"})})]}):null,l?i.jsx(_5,{branch:l}):null,i.jsx(Ge,{variant:"secondary",children:t.length})]})]}),i.jsx("div",{className:"min-h-0 flex-1 overflow-auto py-1",children:d.children.length===0?i.jsx(Qe,{variant:"muted",className:"m-3 text-center",children:u}):d.children.map(R=>i.jsx(S5,{depth:0,expanded:w,node:R,onSelectFile:o,onToggle:T,root:h,selectedFile:n,statusByPath:v},R.path))})]})}function S5({depth:e,expanded:t,node:s,onSelectFile:n,onToggle:o,root:l,selectedFile:u,statusByPath:h}){const f=t[s.path]??!1,d=6+e*12,p=l?fj(pu(l,s.path)):{};if(s.isFile){const v=h.get(s.path),w=u===s.path;return i.jsxs("button",{className:ae("flex w-full items-center gap-1.5 px-1 py-0.5 text-left text-[12px] hover:bg-muted",w&&"bg-muted font-medium"),onClick:()=>n(s.path),style:{paddingLeft:d},type:"button",...p,children:[i.jsx(ov,{path:s.path}),i.jsx("span",{className:"min-w-0 flex-1 truncate",children:s.name}),v?i.jsx(kY,{file:v}):null]})}const g=f?Wn:jn,x=f?pf:co;return i.jsxs("div",{children:[i.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:[i.jsx(g,{className:"size-3.5 shrink-0 text-muted-foreground"}),i.jsx(x,{className:"size-3.5 shrink-0 text-amber-600"}),i.jsx("span",{className:"min-w-0 flex-1 truncate",children:s.name})]}),f?s.children.map(v=>i.jsx(S5,{depth:e+1,expanded:t,node:v,onSelectFile:n,onToggle:o,root:l,selectedFile:u,statusByPath:h},v.path)):null]})}function kY({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 i.jsx("span",{className:ae("ml-1 shrink-0 font-mono text-[10px] font-semibold",s),children:t})}var Ug,Uk;function NY(){if(Uk)return Ug;Uk=1;function e(H){return H instanceof Map?H.clear=H.delete=H.set=function(){throw new Error("map is read-only")}:H instanceof Set&&(H.add=H.clear=H.delete=function(){throw new Error("set is read-only")}),Object.freeze(H),Object.getOwnPropertyNames(H).forEach(se=>{const ge=H[se],Pe=typeof ge;(Pe==="object"||Pe==="function")&&!Object.isFrozen(ge)&&e(ge)}),H}class t{constructor(se){se.data===void 0&&(se.data={}),this.data=se.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function s(H){return H.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function n(H,...se){const ge=Object.create(null);for(const Pe in H)ge[Pe]=H[Pe];return se.forEach(function(Pe){for(const it in Pe)ge[it]=Pe[it]}),ge}const o="</span>",l=H=>!!H.scope,u=(H,{prefix:se})=>{if(H.startsWith("language:"))return H.replace("language:","language-");if(H.includes(".")){const ge=H.split(".");return[`${se}${ge.shift()}`,...ge.map((Pe,it)=>`${Pe}${"_".repeat(it+1)}`)].join(" ")}return`${se}${H}`};class h{constructor(se,ge){this.buffer="",this.classPrefix=ge.classPrefix,se.walk(this)}addText(se){this.buffer+=s(se)}openNode(se){if(!l(se))return;const ge=u(se.scope,{prefix:this.classPrefix});this.span(ge)}closeNode(se){l(se)&&(this.buffer+=o)}value(){return this.buffer}span(se){this.buffer+=`<span class="${se}">`}}const f=(H={})=>{const se={children:[]};return Object.assign(se,H),se};class d{constructor(){this.rootNode=f(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(se){this.top.children.push(se)}openNode(se){const ge=f({scope:se});this.add(ge),this.stack.push(ge)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(se){return this.constructor._walk(se,this.rootNode)}static _walk(se,ge){return typeof ge=="string"?se.addText(ge):ge.children&&(se.openNode(ge),ge.children.forEach(Pe=>this._walk(se,Pe)),se.closeNode(ge)),se}static _collapse(se){typeof se!="string"&&se.children&&(se.children.every(ge=>typeof ge=="string")?se.children=[se.children.join("")]:se.children.forEach(ge=>{d._collapse(ge)}))}}class p extends d{constructor(se){super(),this.options=se}addText(se){se!==""&&this.add(se)}startScope(se){this.openNode(se)}endScope(){this.closeNode()}__addSublanguage(se,ge){const Pe=se.root;ge&&(Pe.scope=`language:${ge}`),this.add(Pe)}toHTML(){return new h(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function g(H){return H?typeof H=="string"?H:H.source:null}function x(H){return k("(?=",H,")")}function v(H){return k("(?:",H,")*")}function w(H){return k("(?:",H,")?")}function k(...H){return H.map(ge=>g(ge)).join("")}function N(H){const se=H[H.length-1];return typeof se=="object"&&se.constructor===Object?(H.splice(H.length-1,1),se):{}}function E(...H){return"("+(N(H).capture?"":"?:")+H.map(Pe=>g(Pe)).join("|")+")"}function T(H){return new RegExp(H.toString()+"|").exec("").length-1}function A(H,se){const ge=H&&H.exec(se);return ge&&ge.index===0}const C=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function R(H,{joinWith:se}){let ge=0;return H.map(Pe=>{ge+=1;const it=ge;let Et=g(Pe),qe="";for(;Et.length>0;){const He=C.exec(Et);if(!He){qe+=Et;break}qe+=Et.substring(0,He.index),Et=Et.substring(He.index+He[0].length),He[0][0]==="\\"&&He[1]?qe+="\\"+String(Number(He[1])+it):(qe+=He[0],He[0]==="("&&ge++)}return qe}).map(Pe=>`(${Pe})`).join(se)}const D=/\b\B/,$="[a-zA-Z]\\w*",O="[a-zA-Z_]\\w*",P="\\b\\d+(\\.\\d+)?",B="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",G="\\b(0b[01]+)",F="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",z=(H={})=>{const se=/^#![ ]*\//;return H.binary&&(H.begin=k(se,/.*\b/,H.binary,/\b.*/)),n({scope:"meta",begin:se,end:/$/,relevance:0,"on:begin":(ge,Pe)=>{ge.index!==0&&Pe.ignoreMatch()}},H)},U={begin:"\\\\[\\s\\S]",relevance:0},K={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[U]},I={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[U]},Z={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/},W=function(H,se,ge={}){const Pe=n({scope:"comment",begin:H,end:se,contains:[]},ge);Pe.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 it=E("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 Pe.contains.push({begin:k(/[ ]+/,"(",it,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),Pe},te=W("//","$"),X=W("/\\*","\\*/"),V=W("#","$"),q={scope:"number",begin:P,relevance:0},le={scope:"number",begin:B,relevance:0},ee={scope:"number",begin:G,relevance:0},fe={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[U,{begin:/\[/,end:/\]/,relevance:0,contains:[U]}]},ie={scope:"title",begin:$,relevance:0},Se={scope:"title",begin:O,relevance:0},Me={begin:"\\.\\s*"+O,relevance:0};var Je=Object.freeze({__proto__:null,APOS_STRING_MODE:K,BACKSLASH_ESCAPE:U,BINARY_NUMBER_MODE:ee,BINARY_NUMBER_RE:G,COMMENT:W,C_BLOCK_COMMENT_MODE:X,C_LINE_COMMENT_MODE:te,C_NUMBER_MODE:le,C_NUMBER_RE:B,END_SAME_AS_BEGIN:function(H){return Object.assign(H,{"on:begin":(se,ge)=>{ge.data._beginMatch=se[1]},"on:end":(se,ge)=>{ge.data._beginMatch!==se[1]&&ge.ignoreMatch()}})},HASH_COMMENT_MODE:V,IDENT_RE:$,MATCH_NOTHING_RE:D,METHOD_GUARD:Me,NUMBER_MODE:q,NUMBER_RE:P,PHRASAL_WORDS_MODE:Z,QUOTE_STRING_MODE:I,REGEXP_MODE:fe,RE_STARTERS_RE:F,SHEBANG:z,TITLE_MODE:ie,UNDERSCORE_IDENT_RE:O,UNDERSCORE_TITLE_MODE:Se});function Ne(H,se){H.input[H.index-1]==="."&&se.ignoreMatch()}function Ue(H,se){H.className!==void 0&&(H.scope=H.className,delete H.className)}function $e(H,se){se&&H.beginKeywords&&(H.begin="\\b("+H.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",H.__beforeBegin=Ne,H.keywords=H.keywords||H.beginKeywords,delete H.beginKeywords,H.relevance===void 0&&(H.relevance=0))}function St(H,se){Array.isArray(H.illegal)&&(H.illegal=E(...H.illegal))}function Ls(H,se){if(H.match){if(H.begin||H.end)throw new Error("begin & end are not supported with match");H.begin=H.match,delete H.match}}function zs(H,se){H.relevance===void 0&&(H.relevance=1)}const vi=(H,se)=>{if(!H.beforeMatch)return;if(H.starts)throw new Error("beforeMatch cannot be used with starts");const ge=Object.assign({},H);Object.keys(H).forEach(Pe=>{delete H[Pe]}),H.keywords=ge.keywords,H.begin=k(ge.beforeMatch,x(ge.begin)),H.starts={relevance:0,contains:[Object.assign(ge,{endsParent:!0})]},H.relevance=0,delete ge.beforeMatch},Kn=["of","and","for","in","not","or","if","then","parent","list","value"],qs="keyword";function An(H,se,ge=qs){const Pe=Object.create(null);return typeof H=="string"?it(ge,H.split(" ")):Array.isArray(H)?it(ge,H):Object.keys(H).forEach(function(Et){Object.assign(Pe,An(H[Et],se,Et))}),Pe;function it(Et,qe){se&&(qe=qe.map(He=>He.toLowerCase())),qe.forEach(function(He){const rt=He.split("|");Pe[rt[0]]=[Et,Tn(rt[0],rt[1])]})}}function Tn(H,se){return se?Number(se):Di(H)?0:1}function Di(H){return Kn.includes(H.toLowerCase())}const _i={},It=H=>{console.error(H)},Cs=(H,...se)=>{console.log(`WARN: ${H}`,...se)},ls=(H,se)=>{_i[`${H}/${se}`]||(console.log(`Deprecated as of ${H}. ${se}`),_i[`${H}/${se}`]=!0)},gn=new Error;function xn(H,se,{key:ge}){let Pe=0;const it=H[ge],Et={},qe={};for(let He=1;He<=se.length;He++)qe[He+Pe]=it[He],Et[He+Pe]=!0,Pe+=T(se[He-1]);H[ge]=qe,H[ge]._emit=Et,H[ge]._multi=!0}function Oi(H){if(Array.isArray(H.begin)){if(H.skip||H.excludeBegin||H.returnBegin)throw It("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),gn;if(typeof H.beginScope!="object"||H.beginScope===null)throw It("beginScope must be object"),gn;xn(H,H.begin,{key:"beginScope"}),H.begin=R(H.begin,{joinWith:""})}}function S(H){if(Array.isArray(H.end)){if(H.skip||H.excludeEnd||H.returnEnd)throw It("skip, excludeEnd, returnEnd not compatible with endScope: {}"),gn;if(typeof H.endScope!="object"||H.endScope===null)throw It("endScope must be object"),gn;xn(H,H.end,{key:"endScope"}),H.end=R(H.end,{joinWith:""})}}function re(H){H.scope&&typeof H.scope=="object"&&H.scope!==null&&(H.beginScope=H.scope,delete H.scope)}function be(H){re(H),typeof H.beginScope=="string"&&(H.beginScope={_wrap:H.beginScope}),typeof H.endScope=="string"&&(H.endScope={_wrap:H.endScope}),Oi(H),S(H)}function ye(H){function se(qe,He){return new RegExp(g(qe),"m"+(H.case_insensitive?"i":"")+(H.unicodeRegex?"u":"")+(He?"g":""))}class ge{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(He,rt){rt.position=this.position++,this.matchIndexes[this.matchAt]=rt,this.regexes.push([rt,He]),this.matchAt+=T(He)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const He=this.regexes.map(rt=>rt[1]);this.matcherRe=se(R(He,{joinWith:"|"}),!0),this.lastIndex=0}exec(He){this.matcherRe.lastIndex=this.lastIndex;const rt=this.matcherRe.exec(He);if(!rt)return null;const cs=rt.findIndex((sr,po)=>po>0&&sr!==void 0),Xt=this.matchIndexes[cs];return rt.splice(0,cs),Object.assign(rt,Xt)}}class Pe{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(He){if(this.multiRegexes[He])return this.multiRegexes[He];const rt=new ge;return this.rules.slice(He).forEach(([cs,Xt])=>rt.addRule(cs,Xt)),rt.compile(),this.multiRegexes[He]=rt,rt}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(He,rt){this.rules.push([He,rt]),rt.type==="begin"&&this.count++}exec(He){const rt=this.getMatcher(this.regexIndex);rt.lastIndex=this.lastIndex;let cs=rt.exec(He);if(this.resumingScanAtSamePosition()&&!(cs&&cs.index===this.lastIndex)){const Xt=this.getMatcher(0);Xt.lastIndex=this.lastIndex+1,cs=Xt.exec(He)}return cs&&(this.regexIndex+=cs.position+1,this.regexIndex===this.count&&this.considerAll()),cs}}function it(qe){const He=new Pe;return qe.contains.forEach(rt=>He.addRule(rt.begin,{rule:rt,type:"begin"})),qe.terminatorEnd&&He.addRule(qe.terminatorEnd,{type:"end"}),qe.illegal&&He.addRule(qe.illegal,{type:"illegal"}),He}function Et(qe,He){const rt=qe;if(qe.isCompiled)return rt;[Ue,Ls,be,vi].forEach(Xt=>Xt(qe,He)),H.compilerExtensions.forEach(Xt=>Xt(qe,He)),qe.__beforeBegin=null,[$e,St,zs].forEach(Xt=>Xt(qe,He)),qe.isCompiled=!0;let cs=null;return typeof qe.keywords=="object"&&qe.keywords.$pattern&&(qe.keywords=Object.assign({},qe.keywords),cs=qe.keywords.$pattern,delete qe.keywords.$pattern),cs=cs||/\w+/,qe.keywords&&(qe.keywords=An(qe.keywords,H.case_insensitive)),rt.keywordPatternRe=se(cs,!0),He&&(qe.begin||(qe.begin=/\B|\b/),rt.beginRe=se(rt.begin),!qe.end&&!qe.endsWithParent&&(qe.end=/\B|\b/),qe.end&&(rt.endRe=se(rt.end)),rt.terminatorEnd=g(rt.end)||"",qe.endsWithParent&&He.terminatorEnd&&(rt.terminatorEnd+=(qe.end?"|":"")+He.terminatorEnd)),qe.illegal&&(rt.illegalRe=se(qe.illegal)),qe.contains||(qe.contains=[]),qe.contains=[].concat(...qe.contains.map(function(Xt){return Ae(Xt==="self"?qe:Xt)})),qe.contains.forEach(function(Xt){Et(Xt,rt)}),qe.starts&&Et(qe.starts,He),rt.matcher=it(rt),rt}if(H.compilerExtensions||(H.compilerExtensions=[]),H.contains&&H.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return H.classNameAliases=n(H.classNameAliases||{}),Et(H)}function he(H){return H?H.endsWithParent||he(H.starts):!1}function Ae(H){return H.variants&&!H.cachedVariants&&(H.cachedVariants=H.variants.map(function(se){return n(H,{variants:null},se)})),H.cachedVariants?H.cachedVariants:he(H)?n(H,{starts:H.starts?n(H.starts):null}):Object.isFrozen(H)?n(H):H}var M="11.11.1";class oe extends Error{constructor(se,ge){super(se),this.name="HTMLInjectionError",this.html=ge}}const Te=s,_e=n,me=Symbol("nomatch"),je=7,ke=function(H){const se=Object.create(null),ge=Object.create(null),Pe=[];let it=!0;const Et="Could not find the language '{}', did you forget to load/include a language module?",qe={disableAutodetect:!0,name:"Plain text",contains:[]};let He={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:p};function rt(Oe){return He.noHighlightRe.test(Oe)}function cs(Oe){let et=Oe.className+" ";et+=Oe.parentNode?Oe.parentNode.className:"";const pt=He.languageDetectRe.exec(et);if(pt){const Tt=an(pt[1]);return Tt||(Cs(Et.replace("{}",pt[1])),Cs("Falling back to no-highlight mode for this block.",Oe)),Tt?pt[1]:"no-highlight"}return et.split(/\s+/).find(Tt=>rt(Tt)||an(Tt))}function Xt(Oe,et,pt){let Tt="",ds="";typeof et=="object"?(Tt=Oe,pt=et.ignoreIllegals,ds=et.language):(ls("10.7.0","highlight(lang, code, ...args) has been deprecated."),ls("10.7.0",`Please use highlight(code, options) instead.
114
- https://github.com/highlightjs/highlight.js/issues/2277`),ds=Oe,Tt=et),pt===void 0&&(pt=!0);const en={code:Tt,language:ds};Na("before:highlight",en);const Rn=en.result?en.result:sr(en.language,en.code,pt);return Rn.code=en.code,Na("after:highlight",Rn),Rn}function sr(Oe,et,pt,Tt){const ds=Object.create(null);function en(Ie,Xe){return Ie.keywords[Xe]}function Rn(){if(!nt.keywords){xs.addText(Rt);return}let Ie=0;nt.keywordPatternRe.lastIndex=0;let Xe=nt.keywordPatternRe.exec(Rt),lt="";for(;Xe;){lt+=Rt.substring(Ie,Xe.index);const bt=Vs.case_insensitive?Xe[0].toLowerCase():Xe[0],Jt=en(nt,bt);if(Jt){const[Yn,jl]=Jt;if(xs.addText(lt),lt="",ds[bt]=(ds[bt]||0)+1,ds[bt]<=je&&(Pr+=jl),Yn.startsWith("_"))lt+=Xe[0];else{const Au=Vs.classNameAliases[Yn]||Yn;Mn(Xe[0],Au)}}else lt+=Xe[0];Ie=nt.keywordPatternRe.lastIndex,Xe=nt.keywordPatternRe.exec(Rt)}lt+=Rt.substring(Ie),xs.addText(lt)}function bn(){if(Rt==="")return;let Ie=null;if(typeof nt.subLanguage=="string"){if(!se[nt.subLanguage]){xs.addText(Rt);return}Ie=sr(nt.subLanguage,Rt,!0,ju[nt.subLanguage]),ju[nt.subLanguage]=Ie._top}else Ie=go(Rt,nt.subLanguage.length?nt.subLanguage:null);nt.relevance>0&&(Pr+=Ie.relevance),xs.__addSublanguage(Ie._emitter,Ie.language)}function Ft(){nt.subLanguage!=null?bn():Rn(),Rt=""}function Mn(Ie,Xe){Ie!==""&&(xs.startScope(Xe),xs.addText(Ie),xs.endScope())}function Cu(Ie,Xe){let lt=1;const bt=Xe.length-1;for(;lt<=bt;){if(!Ie._emit[lt]){lt++;continue}const Jt=Vs.classNameAliases[Ie[lt]]||Ie[lt],Yn=Xe[lt];Jt?Mn(Yn,Jt):(Rt=Yn,Rn(),Rt=""),lt++}}function bo(Ie,Xe){return Ie.scope&&typeof Ie.scope=="string"&&xs.openNode(Vs.classNameAliases[Ie.scope]||Ie.scope),Ie.beginScope&&(Ie.beginScope._wrap?(Mn(Rt,Vs.classNameAliases[Ie.beginScope._wrap]||Ie.beginScope._wrap),Rt=""):Ie.beginScope._multi&&(Cu(Ie.beginScope,Xe),Rt="")),nt=Object.create(Ie,{parent:{value:nt}}),nt}function Nl(Ie,Xe,lt){let bt=A(Ie.endRe,lt);if(bt){if(Ie["on:end"]){const Jt=new t(Ie);Ie["on:end"](Xe,Jt),Jt.isMatchIgnored&&(bt=!1)}if(bt){for(;Ie.endsParent&&Ie.parent;)Ie=Ie.parent;return Ie}}if(Ie.endsWithParent)return Nl(Ie.parent,Xe,lt)}function vo(Ie){return nt.matcher.regexIndex===0?(Rt+=Ie[0],1):(Ir=!0,0)}function $f(Ie){const Xe=Ie[0],lt=Ie.rule,bt=new t(lt),Jt=[lt.__beforeBegin,lt["on:begin"]];for(const Yn of Jt)if(Yn&&(Yn(Ie,bt),bt.isMatchIgnored))return vo(Xe);return lt.skip?Rt+=Xe:(lt.excludeBegin&&(Rt+=Xe),Ft(),!lt.returnBegin&&!lt.excludeBegin&&(Rt=Xe)),bo(lt,Ie),lt.returnBegin?0:Xe.length}function vn(Ie){const Xe=Ie[0],lt=et.substring(Ie.index),bt=Nl(nt,Ie,lt);if(!bt)return me;const Jt=nt;nt.endScope&&nt.endScope._wrap?(Ft(),Mn(Xe,nt.endScope._wrap)):nt.endScope&&nt.endScope._multi?(Ft(),Cu(nt.endScope,Ie)):Jt.skip?Rt+=Xe:(Jt.returnEnd||Jt.excludeEnd||(Rt+=Xe),Ft(),Jt.excludeEnd&&(Rt=Xe));do nt.scope&&xs.closeNode(),!nt.skip&&!nt.subLanguage&&(Pr+=nt.relevance),nt=nt.parent;while(nt!==bt.parent);return bt.starts&&bo(bt.starts,Ie),Jt.returnEnd?0:Xe.length}function Cl(){const Ie=[];for(let Xe=nt;Xe!==Vs;Xe=Xe.parent)Xe.scope&&Ie.unshift(Xe.scope);Ie.forEach(Xe=>xs.openNode(Xe))}let Ca={};function _o(Ie,Xe){const lt=Xe&&Xe[0];if(Rt+=Ie,lt==null)return Ft(),0;if(Ca.type==="begin"&&Xe.type==="end"&&Ca.index===Xe.index&&lt===""){if(Rt+=et.slice(Xe.index,Xe.index+1),!it){const bt=new Error(`0 width match regex (${Oe})`);throw bt.languageName=Oe,bt.badRule=Ca.rule,bt}return 1}if(Ca=Xe,Xe.type==="begin")return $f(Xe);if(Xe.type==="illegal"&&!pt){const bt=new Error('Illegal lexeme "'+lt+'" for mode "'+(nt.scope||"<unnamed>")+'"');throw bt.mode=nt,bt}else if(Xe.type==="end"){const bt=vn(Xe);if(bt!==me)return bt}if(Xe.type==="illegal"&&lt==="")return Rt+=`
115
- `,1;if(El>1e5&&El>Xe.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Rt+=lt,lt.length}const Vs=an(Oe);if(!Vs)throw It(Et.replace("{}",Oe)),new Error('Unknown language: "'+Oe+'"');const Eu=ye(Vs);let yo="",nt=Tt||Eu;const ju={},xs=new He.__emitter(He);Cl();let Rt="",Pr=0,rr=0,El=0,Ir=!1;try{if(Vs.__emitTokens)Vs.__emitTokens(et,xs);else{for(nt.matcher.considerAll();;){El++,Ir?Ir=!1:nt.matcher.considerAll(),nt.matcher.lastIndex=rr;const Ie=nt.matcher.exec(et);if(!Ie)break;const Xe=et.substring(rr,Ie.index),lt=_o(Xe,Ie);rr=Ie.index+lt}_o(et.substring(rr))}return xs.finalize(),yo=xs.toHTML(),{language:Oe,value:yo,relevance:Pr,illegal:!1,_emitter:xs,_top:nt}}catch(Ie){if(Ie.message&&Ie.message.includes("Illegal"))return{language:Oe,value:Te(et),illegal:!0,relevance:0,_illegalBy:{message:Ie.message,index:rr,context:et.slice(rr-100,rr+100),mode:Ie.mode,resultSoFar:yo},_emitter:xs};if(it)return{language:Oe,value:Te(et),illegal:!1,relevance:0,errorRaised:Ie,_emitter:xs,_top:nt};throw Ie}}function po(Oe){const et={value:Te(Oe),illegal:!1,relevance:0,_top:qe,_emitter:new He.__emitter(He)};return et._emitter.addText(Oe),et}function go(Oe,et){et=et||He.languages||Object.keys(se);const pt=po(Oe),Tt=et.filter(an).filter(zr).map(Ft=>sr(Ft,Oe,!1));Tt.unshift(pt);const ds=Tt.sort((Ft,Mn)=>{if(Ft.relevance!==Mn.relevance)return Mn.relevance-Ft.relevance;if(Ft.language&&Mn.language){if(an(Ft.language).supersetOf===Mn.language)return 1;if(an(Mn.language).supersetOf===Ft.language)return-1}return 0}),[en,Rn]=ds,bn=en;return bn.secondBest=Rn,bn}function Li(Oe,et,pt){const Tt=et&&ge[et]||pt;Oe.classList.add("hljs"),Oe.classList.add(`language-${Tt}`)}function us(Oe){let et=null;const pt=cs(Oe);if(rt(pt))return;if(Na("before:highlightElement",{el:Oe,language:pt}),Oe.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",Oe);return}if(Oe.children.length>0&&(He.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(Oe)),He.throwUnescapedHTML))throw new oe("One of your code blocks includes unescaped HTML.",Oe.innerHTML);et=Oe;const Tt=et.textContent,ds=pt?Xt(Tt,{language:pt,ignoreIllegals:!0}):go(Tt);Oe.innerHTML=ds.value,Oe.dataset.highlighted="yes",Li(Oe,pt,ds.language),Oe.result={language:ds.language,re:ds.relevance,relevance:ds.relevance},ds.secondBest&&(Oe.secondBest={language:ds.secondBest.language,relevance:ds.secondBest.relevance}),Na("after:highlightElement",{el:Oe,result:ds,text:Tt})}function Js(Oe){He=_e(He,Oe)}const Lr=()=>{xo(),ls("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Sl(){xo(),ls("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Su=!1;function xo(){function Oe(){xo()}if(document.readyState==="loading"){Su||window.addEventListener("DOMContentLoaded",Oe,!1),Su=!0;return}document.querySelectorAll(He.cssSelector).forEach(us)}function ku(Oe,et){let pt=null;try{pt=et(H)}catch(Tt){if(It("Language definition for '{}' could not be registered.".replace("{}",Oe)),it)It(Tt);else throw Tt;pt=qe}pt.name||(pt.name=Oe),se[Oe]=pt,pt.rawDefinition=et.bind(null,H),pt.aliases&&nr(pt.aliases,{languageName:Oe})}function ka(Oe){delete se[Oe];for(const et of Object.keys(ge))ge[et]===Oe&&delete ge[et]}function kl(){return Object.keys(se)}function an(Oe){return Oe=(Oe||"").toLowerCase(),se[Oe]||se[ge[Oe]]}function nr(Oe,{languageName:et}){typeof Oe=="string"&&(Oe=[Oe]),Oe.forEach(pt=>{ge[pt.toLowerCase()]=et})}function zr(Oe){const et=an(Oe);return et&&!et.disableAutodetect}function Br(Oe){Oe["before:highlightBlock"]&&!Oe["before:highlightElement"]&&(Oe["before:highlightElement"]=et=>{Oe["before:highlightBlock"](Object.assign({block:et.el},et))}),Oe["after:highlightBlock"]&&!Oe["after:highlightElement"]&&(Oe["after:highlightElement"]=et=>{Oe["after:highlightBlock"](Object.assign({block:et.el},et))})}function gs(Oe){Br(Oe),Pe.push(Oe)}function Nu(Oe){const et=Pe.indexOf(Oe);et!==-1&&Pe.splice(et,1)}function Na(Oe,et){const pt=Oe;Pe.forEach(function(Tt){Tt[pt]&&Tt[pt](et)})}function ir(Oe){return ls("10.7.0","highlightBlock will be removed entirely in v12.0"),ls("10.7.0","Please use highlightElement now."),us(Oe)}Object.assign(H,{highlight:Xt,highlightAuto:go,highlightAll:xo,highlightElement:us,highlightBlock:ir,configure:Js,initHighlighting:Lr,initHighlightingOnLoad:Sl,registerLanguage:ku,unregisterLanguage:ka,listLanguages:kl,getLanguage:an,registerAliases:nr,autoDetection:zr,inherit:_e,addPlugin:gs,removePlugin:Nu}),H.debugMode=function(){it=!1},H.safeMode=function(){it=!0},H.versionString=M,H.regex={concat:k,lookahead:x,either:E,optional:w,anyNumberOfTimes:v};for(const Oe in Je)typeof Je[Oe]=="object"&&e(Je[Oe]);return Object.assign(H,Je),H},Be=ke({});return Be.newInstance=()=>ke({}),Ug=Be,Be.HighlightJS=Be,Be.default=Be,Ug}var Fg,Fk;function CY(){if(Fk)return Fg;Fk=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:/\)/}),f=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,f,h,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[u,h,d,f]}]}]},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 Fg=e,Fg}var qg,qk;function EY(){if(qk)return qg;qk=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"})]}},f={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,n,l]};l.contains.push(f);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]},v=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],w=t.SHEBANG({binary:`(${v.join("|")})`,relevance:10}),k={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[t.inherit(t.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},N=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],E=["true","false"],T={match:/(\/[a-z._-]+)+/},A=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],C=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],R=["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"],D=["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:N,literal:E,built_in:[...A,...C,"set","shopt",...R,...D]},contains:[w,t.SHEBANG(),k,x,u,h,T,f,d,p,g,n]}}return qg=e,qg}var Vg,Vk;function jY(){if(Vk)return Vg;Vk=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("<[^<>]+>")+")",f={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]},v={className:"title",begin:s.optional(l)+t.IDENT_RE,relevance:0},w=s.optional(l)+t.IDENT_RE+"\\s*\\(",E={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,f,n,t.C_BLOCK_COMMENT_MODE,g,p],A={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:E,contains:T.concat([{begin:/\(/,end:/\)/,keywords:E,contains:T.concat(["self"]),relevance:0}]),relevance:0},C={begin:"("+h+"[\\*&\\s]+)+"+w,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:E,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:o,keywords:E,relevance:0},{begin:w,returnBegin:!0,contains:[t.inherit(v,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:E,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,p,g,f,{begin:/\(/,end:/\)/,keywords:E,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,p,g,f]}]},f,n,t.C_BLOCK_COMMENT_MODE,x]};return{name:"C",aliases:["h"],keywords:E,disableAutodetect:!0,illegal:"</",contains:[].concat(A,C,T,[x,{begin:t.IDENT_RE+"::",keywords:E},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},t.TITLE_MODE]}]),exports:{preprocessor:x,strings:p,keywords:E}}}return Vg=e,Vg}var Gg,Gk;function AY(){if(Gk)return Gg;Gk=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("<[^<>]+>")+")",f={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]},v={className:"title",begin:s.optional(l)+t.IDENT_RE,relevance:0},w=s.optional(l)+t.IDENT_RE+"\\s*\\(",k=["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"],N=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],E=["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"],R={type:N,keyword:k,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:E},D={className:"function.dispatch",relevance:0,keywords:{_hint:T},begin:s.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,s.lookahead(/(<[^<>]+>|)\s*\(/))},$=[D,x,f,n,t.C_BLOCK_COMMENT_MODE,g,p],O={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:R,contains:$.concat([{begin:/\(/,end:/\)/,keywords:R,contains:$.concat(["self"]),relevance:0}]),relevance:0},P={className:"function",begin:"("+h+"[\\*&\\s]+)+"+w,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:R,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:o,keywords:R,relevance:0},{begin:w,returnBegin:!0,contains:[v],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[p,g]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:R,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,p,g,f,{begin:/\(/,end:/\)/,keywords:R,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,p,g,f]}]},f,n,t.C_BLOCK_COMMENT_MODE,x]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:R,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(O,P,D,$,[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:R,contains:["self",f]},{begin:t.IDENT_RE+"::",keywords:R},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}return Gg=e,Gg}var Wg,Wk;function TY(){if(Wk)return Wg;Wk=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},f=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/}),v={className:"subst",begin:/\{/,end:/\}/,keywords:h},w=t.inherit(v,{illegal:/\n/}),k={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},t.BACKSLASH_ESCAPE,w]},N={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},v]},E=t.inherit(N,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},w]});v.contains=[N,k,g,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,d,t.C_BLOCK_COMMENT_MODE],w.contains=[E,k,x,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,d,t.inherit(t.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const T={variants:[p,N,k,g,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},A={begin:"<",end:">",contains:[{beginKeywords:"in out"},f]},C=t.IDENT_RE+"(<"+t.IDENT_RE+"(\\s*,\\s*"+t.IDENT_RE+")*>)?(\\[\\])?",R={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"},f,A,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[f,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[f,A,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:"("+C+"\\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,A],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]},R]}}return Wg=e,Wg}var Kg,Kk;function RY(){if(Kk)return Kg;Kk=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 f(d){const p=d.regex,g=e(d),x={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},v="and or not only",w=/@-?\w[\w]*(-\w+)*/,k="[a-zA-Z-][a-zA-Z0-9_-]*",N=[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:"\\."+k,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,...N,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...N,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},g.FUNCTION_DISPATCH]},{begin:p.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:w},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:v,attribute:o.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...N,g.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+n.join("|")+")\\b"}]}}return Kg=f,Kg}var Yg,Yk;function MY(){if(Yk)return Yg;Yk=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}]},f=/[A-Za-z][A-Za-z0-9+.-]*/,d={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:s.concat(/\[.+?\]\(/,f,/:\/\/.*?\)/),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:[]}),v=t.inherit(g,{contains:[]});p.contains.push(v),g.contains.push(x);let w=[n,d];return[p,g,x,v].forEach(T=>{T.contains=T.contains.concat(w)}),w=w.concat(p,g),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:w},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:w}]}]},n,u,p,g,{className:"quote",begin:"^>\\s+",contains:w,end:"$"},l,o,d,h,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}return Yg=e,Yg}var Xg,Xk;function DY(){if(Xk)return Xg;Xk=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 Xg=e,Xg}var Zg,Zk;function OY(){if(Zk)return Zg;Zk=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"]},f={className:"doctag",begin:"@[A-Za-z]+"},d={begin:"#<",end:">"},p=[t.COMMENT("#","$",{contains:[f]}),t.COMMENT("^=begin","^=end",{contains:[f],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]})]}]},v="[1-9](_?[0-9])*|0",w="[0-9](_?[0-9])*",k={className:"number",relevance:0,variants:[{begin:`\\b(${v})(\\.(${w}))?([eE][+-]?(${w})|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"}]},N={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:h}]},$=[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:[N]},{begin:t.IDENT_RE+"::"},{className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[x,{begin:n}],relevance:0},k,{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=$,N.contains=$;const G=[{begin:/^\s*=>/,starts:{end:"$",contains:$}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:h,contains:$}}];return p.unshift(d),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:h,illegal:/\/\*/,contains:[t.SHEBANG({binary:"ruby"})].concat(G).concat(p).concat($)}}return Zg=e,Zg}var Qg,Qk;function LY(){if(Qk)return Qg;Qk=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 Qg=e,Qg}var Jg,Jk;function zY(){if(Jk)return Jg;Jk=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 Jg=e,Jg}var ex,eN;function BY(){if(eN)return ex;eN=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:"'"}]},f={begin:/\[/,end:/\]/,contains:[o,u,l,h,n,"self"],relevance:0},d=/[A-Za-z0-9_-]+/,p=/"(\\"|[^"])*"/,g=/'[^']*'/,x=s.either(d,p,g),v=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:v,className:"attr",starts:{end:/$/,contains:[o,f,u,l,h,n]}}]}}return ex=e,ex}var tx,tN;function PY(){if(tN)return tx;tN=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,f){return f===-1?"":u.replace(h,d=>o(u,h,f-1))}function l(u){const h=u.regex,f="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",d=f+o("(?:<"+f+"~~~(?:\\s*,\\s*"+f+"~~~)*>)?",/~~~/g,2),w={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"]},k={className:"meta",begin:"@"+f,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},N={className:"params",begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:[u.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:w,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+/,f],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[h.concat(/(?!else)/,f),/\s+/,f,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,f],className:{1:"keyword",3:"title.class"},contains:[N,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:w,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:[k,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,k]}}return tx=l,tx}var sx,sN;function IY(){if(sN)return sx;sN=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 f(d){const p=d.regex,g=(Se,{after:Me})=>{const De="</"+Se[0].slice(1);return Se.input.indexOf(De,Me)!==-1},x=e,v={begin:"<>",end:"</>"},w=/<[A-Za-z0-9\\._:-]+\s*\/>/,k={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(Se,Me)=>{const De=Se[0].length+Se.index,Je=Se.input[De];if(Je==="<"||Je===","){Me.ignoreMatch();return}Je===">"&&(g(Se,{after:De})||Me.ignoreMatch());let Ne;const Ue=Se.input.substring(De);if(Ne=Ue.match(/^\s*=/)){Me.ignoreMatch();return}if((Ne=Ue.match(/^\s+extends\s+/))&&Ne.index===0){Me.ignoreMatch();return}}},N={$pattern:e,keyword:t,literal:s,built_in:h,"variable.language":u},E="[0-9](_?[0-9])*",T=`\\.(${E})`,A="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",C={className:"number",variants:[{begin:`(\\b(${A})((${T})|\\.)?|(${T}))[eE][+-]?(${E})\\b`},{begin:`\\b(${A})\\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},R={className:"subst",begin:"\\$\\{",end:"\\}",keywords:N,contains:[]},D={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[d.BACKSLASH_ESCAPE,R],subLanguage:"xml"}},$={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[d.BACKSLASH_ESCAPE,R],subLanguage:"css"}},O={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[d.BACKSLASH_ESCAPE,R],subLanguage:"graphql"}},P={className:"string",begin:"`",end:"`",contains:[d.BACKSLASH_ESCAPE,R]},G={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]},F=[d.APOS_STRING_MODE,d.QUOTE_STRING_MODE,D,$,O,P,{match:/\$\d+/},C];R.contains=F.concat({begin:/\{/,end:/\}/,keywords:N,contains:["self"].concat(F)});const z=[].concat(G,R.contains),U=z.concat([{begin:/(\s*)\(/,end:/\)/,keywords:N,contains:["self"].concat(z)}]),K={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:N,contains:U},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"}}]},Z={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]}},W={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},te={variants:[{match:[/function/,/\s+/,x,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[K],illegal:/%/},X={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function V(Se){return p.concat("(?!",Se.join("|"),")")}const q={match:p.concat(/\b/,V([...l,"super","import"].map(Se=>`${Se}\\s*\\(`)),x,p.lookahead(/\s*\(/)),className:"title.function",relevance:0},le={begin:p.concat(/\./,p.lookahead(p.concat(x,/(?![0-9A-Za-z$_(])/))),end:x,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},ee={match:[/get|set/,/\s+/,x,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},K]},fe="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+d.UNDERSCORE_IDENT_RE+")\\s*=>",ie={match:[/const|var|let/,/\s+/,x,/\s*/,/=\s*/,/(async\s*)?/,p.lookahead(fe)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[K]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:N,exports:{PARAMS_CONTAINS:U,CLASS_REFERENCE:Z},illegal:/#(?![$_A-z])/,contains:[d.SHEBANG({label:"shebang",binary:"node",relevance:5}),W,d.APOS_STRING_MODE,d.QUOTE_STRING_MODE,D,$,O,P,G,{match:/\$\d+/},C,Z,{scope:"attr",match:x+p.lookahead(":"),relevance:0},ie,{begin:"("+d.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[G,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:N,contains:U}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:v.begin,end:v.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)"+d.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[K,d.inherit(d.TITLE_MODE,{begin:x,className:"title.function"})]},{match:/\.\.\./,relevance:0},le,{match:"\\$"+x,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[K]},q,X,I,ee,{match:/\$[(.]/}]}}return sx=f,sx}var nx,nN;function $Y(){if(nN)return nx;nN=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 nx=e,nx}var ix,iN;function HY(){if(iN)return ix;iN=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+/}]}},f={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+")?"},v={className:"meta",begin:"@"+l.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[l.inherit(g,{className:"string"}),"self"]}]},w=n,k=l.COMMENT("/\\*","\\*/",{contains:[l.C_BLOCK_COMMENT_MODE]}),N={variants:[{className:"type",begin:l.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},E=N;return E.variants[1].contains=[N],N.variants[1].contains=[E],{name:"Kotlin",aliases:["kt","kts"],keywords:u,contains:[l.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),l.C_LINE_COMMENT_MODE,k,h,f,x,v,{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:[N,l.C_LINE_COMMENT_MODE,k],relevance:0},l.C_LINE_COMMENT_MODE,k,x,v,g,l.C_NUMBER_MODE]},k]},{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,v]},g,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:`
116
- `},w]}}return ix=o,ix}var rx,rN;function UY(){if(rN)return rx;rN=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(),f=l.concat(u).sort().reverse();function d(p){const g=e(p),x=f,v="and or not only",w="[\\w-]+",k="("+w+"|@\\{"+w+"\\})",N=[],E=[],T=function(z){return{className:"string",begin:"~?"+z+".*?"+z}},A=function(z,U,K){return{className:z,begin:U,relevance:K}},C={$pattern:/[a-z-]+/,keyword:v,attribute:o.join(" ")},R={begin:"\\(",end:"\\)",contains:E,keywords:C,relevance:0};E.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,R,A("variable","@@?"+w,10),A("variable","@\\{"+w+"\\}"),A("built_in","~?`[^`]*?`"),{className:"attribute",begin:w+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},g.IMPORTANT,{beginKeywords:"and not"},g.FUNCTION_DISPATCH);const D=E.concat({begin:/\{/,end:/\}/,contains:N}),$={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(E)},O={begin:k+"\\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:E}}]},P={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:C,returnEnd:!0,contains:E,relevance:0}},B={className:"variable",variants:[{begin:"@"+w+"\\s*:",relevance:15},{begin:"@"+w}],starts:{end:"[;}]",returnEnd:!0,contains:D}},G={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:k,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[p.C_LINE_COMMENT_MODE,p.C_BLOCK_COMMENT_MODE,$,A("keyword","all\\b"),A("variable","@\\{"+w+"\\}"),{begin:"\\b("+n.join("|")+")\\b",className:"selector-tag"},g.CSS_NUMBER_MODE,A("selector-tag",k,0),A("selector-id","#"+k),A("selector-class","\\."+k,0),A("selector-tag","&",0),g.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+l.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+u.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:D},{begin:"!important"},g.FUNCTION_DISPATCH]},F={begin:w+`:(:)?(${x.join("|")})`,returnBegin:!0,contains:[G]};return N.push(p.C_LINE_COMMENT_MODE,p.C_BLOCK_COMMENT_MODE,P,B,F,O,G,$,g.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:N}}return rx=d,rx}var ax,aN;function FY(){if(aN)return ax;aN=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 ax=e,ax}var ox,oN;function qY(){if(oN)return ox;oN=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 ox=e,ox}var lx,lN;function VY(){if(lN)return lx;lN=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:/\}/},f={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:[f]},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=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],v=(N,E,T="\\1")=>{const A=T==="\\1"?T:s.concat(T,E);return s.concat(s.concat("(?:",N,")"),E,/(?:\\.|[^\\\/])*?/,A,/(?:\\.|[^\\\/])*?/,T,o)},w=(N,E,T)=>s.concat(s.concat("(?:",N,")"),E,/(?:\\.|[^\\\/])*?/,T,o),k=[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:v("s|tr|y",s.either(...x,{capture:!0}))},{begin:v("s|tr|y","\\(","\\)")},{begin:v("s|tr|y","\\[","\\]")},{begin:v("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:w("(?:m|qr)?",/\//,/\//)},{begin:w("m|qr",s.either(...x,{capture:!0}),/\1/)},{begin:w("m|qr",/\(/,/\)/)},{begin:w("m|qr",/\[/,/\]/)},{begin:w("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE,f]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE,f,p]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return u.contains=k,h.contains=k,{name:"Perl",aliases:["pl","pm"],keywords:l,contains:k}}return lx=e,lx}var cx,cN;function GY(){if(cN)return cx;cN=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_]*/,f={"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:f,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 cx=e,cx}var ux,uN;function WY(){if(uN)return ux;uN=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},f={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":(K,I)=>{I.data._beginMatch=K[1]||K[2]},"on:end":(K,I)=>{I.data._beginMatch!==K[1]&&I.ignoreMatch()}},v=t.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),w=`[
117
- ]`,k={scope:"string",variants:[g,p,x,v]},N={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},E=["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"],A=["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"],R={keyword:T,literal:(K=>{const I=[];return K.forEach(Z=>{I.push(Z),Z.toLowerCase()===Z?I.push(Z.toUpperCase()):I.push(Z.toLowerCase())}),I})(E),built_in:A},D=K=>K.map(I=>I.replace(/\|\d+$/,"")),$={variants:[{match:[/new/,s.concat(w,"+"),s.concat("(?!",D(A).join("\\b|"),"\\b)"),l],scope:{1:"keyword",4:"title.class"}}]},O=s.concat(o,"\\b(?!\\()"),P={variants:[{match:[s.concat(/::/,s.lookahead(/(?!class\b)/)),O],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[l,s.concat(/::/,s.lookahead(/(?!class\b)/)),O],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(/(?!::)/))},G={relevance:0,begin:/\(/,end:/\)/,keywords:R,contains:[B,h,P,t.C_BLOCK_COMMENT_MODE,k,N,$]},F={relevance:0,match:[/\b/,s.concat("(?!fn\\b|function\\b|",D(T).join("\\b|"),"|",D(A).join("\\b|"),"\\b)"),o,s.concat(w,"*"),s.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[G]};G.contains.push(F);const z=[B,P,t.C_BLOCK_COMMENT_MODE,k,N,$],U={begin:s.concat(/#\[\s*\\?/,s.either(l,u)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:E,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:E,keyword:["new","array"]},contains:["self",...z]},...z,{scope:"meta",variants:[{match:l},{match:u}]}]};return{case_insensitive:!1,keywords:R,contains:[U,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}]}},f,{scope:"variable.language",match:/\$this\b/},h,F,P,{match:[/const/,/\s/,o],scope:{1:"keyword",3:"variable.constant"}},$,{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:R,contains:["self",U,h,P,t.C_BLOCK_COMMENT_MODE,k,N]}]},{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]},k,N]}}return ux=e,ux}var dx,dN;function KY(){if(dN)return dx;dN=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 dx=e,dx}var hx,hN;function YY(){if(hN)return hx;hN=1;function e(t){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}return hx=e,hx}var fx,fN;function XY(){if(fN)return fx;fN=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"],f={$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:f,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]},v="[0-9](_?[0-9])*",w=`(\\b(${v}))?\\.(${v})|\\b(${v})\\.`,k=`\\b|${o.join("|")}`,N={className:"number",relevance:0,variants:[{begin:`(\\b(${v})|(${w}))[eE][+-]?(${v})[jJ]?(?=${k})`},{begin:`(${w})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${k})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${k})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${k})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${k})`},{begin:`\\b(${v})[jJ](?=${k})`}]},E={className:"comment",begin:s.lookahead(/# type:/),end:/$/,keywords:f,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:f,contains:["self",d,N,x,t.HASH_COMMENT_MODE]}]};return p.contains=[x,N,d],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:f,illegal:/(<\/|\?)|=>/,contains:[d,N,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},x,E,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:[N,T,x]}]}}return fx=e,fx}var mx,mN;function ZY(){if(mN)return mx;mN=1;function e(t){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}return mx=e,mx}var px,pN;function QY(){if(pN)return px;pN=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 px=e,px}var gx,gN;function JY(){if(gN)return gx;gN=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))?",f=["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:f,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 gx=e,gx}var xx,xN;function eX(){if(xN)return xx;xN=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 f(d){const p=e(d),g=u,x=l,v="@[a-z-]+",w="and or not only",N={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("|")+")"},N,{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,N,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:v,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:w,attribute:o.join(" ")},contains:[{begin:v,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},N,d.QUOTE_STRING_MODE,d.APOS_STRING_MODE,p.HEXCOLOR,p.CSS_NUMBER_MODE]},p.FUNCTION_DISPATCH]}}return xx=f,xx}var bx,bN;function tX(){if(bN)return bx;bN=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 bx=e,bx}var vx,vN;function sX(){if(vN)return vx;vN=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"],f=["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"],v=["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"],w=g,k=[...p,...d].filter(D=>!g.includes(D)),N={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},E={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},T={match:s.concat(/\b/,s.either(...w),/\s*\(/),relevance:0,keywords:{built_in:w}};function A(D){return s.concat(/\b/,s.either(...D.map($=>$.replace(/\s+/,"\\s+"))),/\b/)}const C={scope:"keyword",match:A(v),relevance:0};function R(D,{exceptions:$,when:O}={}){const P=O;return $=$||[],D.map(B=>B.match(/\|\d+$/)||$.includes(B)?B:P(B)?`${B}|0`:B)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:R(k,{when:D=>D.length<3}),literal:u,type:f,built_in:x},contains:[{scope:"type",match:A(h)},C,T,N,o,l,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,n,E]}}return vx=e,vx}var _x,_N;function nX(){if(_N)return _x;_N=1;function e(O){return O?typeof O=="string"?O:O.source:null}function t(O){return s("(?=",O,")")}function s(...O){return O.map(B=>e(B)).join("")}function n(O){const P=O[O.length-1];return typeof P=="object"&&P.constructor===Object?(O.splice(O.length-1,1),P):{}}function o(...O){return"("+(n(O).capture?"":"?:")+O.map(G=>e(G)).join("|")+")"}const l=O=>s(/\b/,O,/\w$/.test(O)?/\b/:/\B/),u=["Protocol","Type"].map(l),h=["init","self"].map(l),f=["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"],v=["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"],w=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]/),k=o(w,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),N=s(w,k,"*"),E=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(E,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),A=s(E,T,"*"),C=s(/[A-Z]/,T,"*"),R=["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\(/,A,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],D=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function $(O){const P={match:/\s+/,relevance:0},B=O.COMMENT("/\\*","\\*/",{contains:["self"]}),G=[O.C_LINE_COMMENT_MODE,B],F={match:[/\./,o(...u,...h)],className:{2:"keyword"}},z={match:s(/\./,o(...d)),relevance:0},U=d.filter(me=>typeof me=="string").concat(["_|0"]),K=d.filter(me=>typeof me!="string").concat(f).map(l),I={variants:[{className:"keyword",match:o(...K,...h)}]},Z={$pattern:o(/\b\w+/,/#\w+/),keyword:U.concat(x),literal:p},W=[F,z,I],te={match:s(/\./,o(...v)),relevance:0},X={className:"built_in",match:s(/\b/,o(...v),/(?=\()/)},V=[te,X],q={match:/->/,relevance:0},le={className:"operator",relevance:0,variants:[{match:N},{match:`\\.(\\.|${k})+`}]},ee=[q,le],fe="([0-9]_*)+",ie="([0-9a-fA-F]_*)+",Se={className:"number",relevance:0,variants:[{match:`\\b(${fe})(\\.(${fe}))?([eE][+-]?(${fe}))?\\b`},{match:`\\b0x(${ie})(\\.(${ie}))?([pP][+-]?(${fe}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},Me=(me="")=>({className:"subst",variants:[{match:s(/\\/,me,/[0\\tnr"']/)},{match:s(/\\/,me,/u\{[0-9a-fA-F]{1,8}\}/)}]}),De=(me="")=>({className:"subst",match:s(/\\/,me,/[\t ]*(?:[\r\n]|\r\n)/)}),Je=(me="")=>({className:"subst",label:"interpol",begin:s(/\\/,me,/\(/),end:/\)/}),Ne=(me="")=>({begin:s(me,/"""/),end:s(/"""/,me),contains:[Me(me),De(me),Je(me)]}),Ue=(me="")=>({begin:s(me,/"/),end:s(/"/,me),contains:[Me(me),Je(me)]}),$e={className:"string",variants:[Ne(),Ne("#"),Ne("##"),Ne("###"),Ue(),Ue("#"),Ue("##"),Ue("###")]},St=[O.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[O.BACKSLASH_ESCAPE]}],Ls={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:St},zs=me=>{const je=s(me,/\//),ke=s(/\//,me);return{begin:je,end:ke,contains:[...St,{scope:"comment",begin:`#(?!.*${ke})`,end:/$/}]}},vi={scope:"regexp",variants:[zs("###"),zs("##"),zs("#"),Ls]},Kn={match:s(/`/,A,/`/)},qs={className:"variable",match:/\$\d+/},An={className:"variable",match:`\\$${T}+`},Tn=[Kn,qs,An],Di={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:D,contains:[...ee,Se,$e]}]}},_i={scope:"keyword",match:s(/@/,o(...R),t(o(/\(/,/\s+/)))},It={scope:"meta",match:s(/@/,A)},Cs=[Di,_i,It],ls={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:C,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:s(/\s+&\s+/,t(C)),relevance:0}]},gn={begin:/</,end:/>/,keywords:Z,contains:[...G,...W,...Cs,q,ls]};ls.contains.push(gn);const xn={match:s(A,/\s*:/),keywords:"_|0",relevance:0},Oi={begin:/\(/,end:/\)/,relevance:0,keywords:Z,contains:["self",xn,...G,vi,...W,...V,...ee,Se,$e,...Tn,...Cs,ls]},S={begin:/</,end:/>/,keywords:"repeat each",contains:[...G,ls]},re={begin:o(t(s(A,/\s*:/)),t(s(A,/\s+/,A,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:A}]},be={begin:/\(/,end:/\)/,keywords:Z,contains:[re,...G,...W,...ee,Se,$e,...Cs,ls,Oi],endsParent:!0,illegal:/["']/},ye={match:[/(func|macro)/,/\s+/,o(Kn.match,A,N)],className:{1:"keyword",3:"title.function"},contains:[S,be,P],illegal:[/\[/,/%/]},he={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[S,be,P],illegal:/\[|%/},Ae={match:[/operator/,/\s+/,N],className:{1:"keyword",3:"title"}},M={begin:[/precedencegroup/,/\s+/,C],className:{1:"keyword",3:"title"},contains:[ls],keywords:[...g,...p],end:/}/},oe={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Te={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},_e={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,A,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:Z,contains:[S,...W,{begin:/:/,end:/\{/,keywords:Z,contains:[{scope:"title.class.inherited",match:C},...W],relevance:0}]};for(const me of $e.variants){const je=me.contains.find(Be=>Be.label==="interpol");je.keywords=Z;const ke=[...W,...V,...ee,Se,$e,...Tn];je.contains=[...ke,{begin:/\(/,end:/\)/,contains:["self",...ke]}]}return{name:"Swift",keywords:Z,contains:[...G,ye,he,oe,Te,_e,Ae,M,{beginKeywords:"import",end:/$/,contains:[...G],relevance:0},vi,...W,...V,...ee,Se,$e,...Tn,...Cs,ls,Oi]}}return _x=$,_x}var yx,yN;function iX(){if(yN)return yx;yN=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]},f=t.inherit(h,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),v={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"},w={end:",",endsWithParent:!0,excludeEnd:!0,keywords:s,relevance:0},k={begin:/\{/,end:/\}/,contains:[w],illegal:"\\n",relevance:0},N={begin:"\\[",end:"\\]",contains:[w],illegal:"\\n",relevance:0},E=[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}},v,{className:"number",begin:t.C_NUMBER_RE+"\\b",relevance:0},k,N,u,h],T=[...E];return T.pop(),T.push(f),w.contains=T,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:E}}return yx=e,yx}var wx,wN;function rX(){if(wN)return wx;wN=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 f(p){const g=p.regex,x=(Me,{after:De})=>{const Je="</"+Me[0].slice(1);return Me.input.indexOf(Je,De)!==-1},v=e,w={begin:"<>",end:"</>"},k=/<[A-Za-z0-9\\._:-]+\s*\/>/,N={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(Me,De)=>{const Je=Me[0].length+Me.index,Ne=Me.input[Je];if(Ne==="<"||Ne===","){De.ignoreMatch();return}Ne===">"&&(x(Me,{after:Je})||De.ignoreMatch());let Ue;const $e=Me.input.substring(Je);if(Ue=$e.match(/^\s*=/)){De.ignoreMatch();return}if((Ue=$e.match(/^\s+extends\s+/))&&Ue.index===0){De.ignoreMatch();return}}},E={$pattern:e,keyword:t,literal:s,built_in:h,"variable.language":u},T="[0-9](_?[0-9])*",A=`\\.(${T})`,C="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",R={className:"number",variants:[{begin:`(\\b(${C})((${A})|\\.)?|(${A}))[eE][+-]?(${T})\\b`},{begin:`\\b(${C})\\b((${A})\\b|\\.)?|(${A})\\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},D={className:"subst",begin:"\\$\\{",end:"\\}",keywords:E,contains:[]},$={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[p.BACKSLASH_ESCAPE,D],subLanguage:"xml"}},O={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[p.BACKSLASH_ESCAPE,D],subLanguage:"css"}},P={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[p.BACKSLASH_ESCAPE,D],subLanguage:"graphql"}},B={className:"string",begin:"`",end:"`",contains:[p.BACKSLASH_ESCAPE,D]},F={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:v+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),p.C_BLOCK_COMMENT_MODE,p.C_LINE_COMMENT_MODE]},z=[p.APOS_STRING_MODE,p.QUOTE_STRING_MODE,$,O,P,B,{match:/\$\d+/},R];D.contains=z.concat({begin:/\{/,end:/\}/,keywords:E,contains:["self"].concat(z)});const U=[].concat(F,D.contains),K=U.concat([{begin:/(\s*)\(/,end:/\)/,keywords:E,contains:["self"].concat(U)}]),I={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:E,contains:K},Z={variants:[{match:[/class/,/\s+/,v,/\s+/,/extends/,/\s+/,g.concat(v,"(",g.concat(/\./,v),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,v],scope:{1:"keyword",3:"title.class"}}]},W={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]}},te={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},X={variants:[{match:[/function/,/\s+/,v,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[I],illegal:/%/},V={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function q(Me){return g.concat("(?!",Me.join("|"),")")}const le={match:g.concat(/\b/,q([...l,"super","import"].map(Me=>`${Me}\\s*\\(`)),v,g.lookahead(/\s*\(/)),className:"title.function",relevance:0},ee={begin:g.concat(/\./,g.lookahead(g.concat(v,/(?![0-9A-Za-z$_(])/))),end:v,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},fe={match:[/get|set/,/\s+/,v,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},I]},ie="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+p.UNDERSCORE_IDENT_RE+")\\s*=>",Se={match:[/const|var|let/,/\s+/,v,/\s*/,/=\s*/,/(async\s*)?/,g.lookahead(ie)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[I]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:E,exports:{PARAMS_CONTAINS:K,CLASS_REFERENCE:W},illegal:/#(?![$_A-z])/,contains:[p.SHEBANG({label:"shebang",binary:"node",relevance:5}),te,p.APOS_STRING_MODE,p.QUOTE_STRING_MODE,$,O,P,B,F,{match:/\$\d+/},R,W,{scope:"attr",match:v+g.lookahead(":"),relevance:0},Se,{begin:"("+p.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[F,p.REGEXP_MODE,{className:"function",begin:ie,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:E,contains:K}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:w.begin,end:w.end},{match:k},{begin:N.begin,"on:begin":N.isTrulyOpeningTag,end:N.end}],subLanguage:"xml",contains:[{begin:N.begin,end:N.end,skip:!0,contains:["self"]}]}]},X,{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:v,className:"title.function"})]},{match:/\.\.\./,relevance:0},ee,{match:"\\$"+v,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[I]},le,V,Z,fe,{match:/\$[(.]/}]}}function d(p){const g=p.regex,x=f(p),v=e,w=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],k={begin:[/namespace/,/\s+/,p.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},N={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:w},contains:[x.exports.CLASS_REFERENCE]},E={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},T=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],A={$pattern:e,keyword:t.concat(T),literal:s,built_in:h.concat(w),"variable.language":u},C={className:"meta",begin:"@"+v},R=(P,B,G)=>{const F=P.contains.findIndex(z=>z.label===B);if(F===-1)throw new Error("can not find mode to replace");P.contains.splice(F,1,G)};Object.assign(x.keywords,A),x.exports.PARAMS_CONTAINS.push(C);const D=x.contains.find(P=>P.scope==="attr"),$=Object.assign({},D,{match:g.concat(v,g.lookahead(/\s*\?:/))});x.exports.PARAMS_CONTAINS.push([x.exports.CLASS_REFERENCE,D,$]),x.contains=x.contains.concat([C,k,N,$]),R(x,"shebang",p.SHEBANG()),R(x,"use_strict",E);const O=x.contains.find(P=>P.label==="func.def");return O.relevance=0,Object.assign(x,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),x}return wx=d,wx}var Sx,SN;function aX(){if(SN)return Sx;SN=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)/,f=/\d{1,2}(:\d{1,2}){1,2}/,d={className:"literal",variants:[{begin:s.concat(/# */,s.either(u,l),/ *#/)},{begin:s.concat(/# */,f,/ *#/)},{begin:s.concat(/# */,h,/ *#/)},{begin:s.concat(/# */,s.either(u,l),/ +/,s.either(h,f),/ *#/)}]},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:/>/}]}),v=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,v,{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:[v]}]}}return Sx=e,Sx}var kx,kN;function oX(){if(kN)return kx;kN=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},f={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,f]}}return kx=e,kx}var Nx,NN;function lX(){if(NN)return Nx;NN=1;var e=NY();return e.registerLanguage("xml",CY()),e.registerLanguage("bash",EY()),e.registerLanguage("c",jY()),e.registerLanguage("cpp",AY()),e.registerLanguage("csharp",TY()),e.registerLanguage("css",RY()),e.registerLanguage("markdown",MY()),e.registerLanguage("diff",DY()),e.registerLanguage("ruby",OY()),e.registerLanguage("go",LY()),e.registerLanguage("graphql",zY()),e.registerLanguage("ini",BY()),e.registerLanguage("java",PY()),e.registerLanguage("javascript",IY()),e.registerLanguage("json",$Y()),e.registerLanguage("kotlin",HY()),e.registerLanguage("less",UY()),e.registerLanguage("lua",FY()),e.registerLanguage("makefile",qY()),e.registerLanguage("perl",VY()),e.registerLanguage("objectivec",GY()),e.registerLanguage("php",WY()),e.registerLanguage("php-template",KY()),e.registerLanguage("plaintext",YY()),e.registerLanguage("python",XY()),e.registerLanguage("python-repl",ZY()),e.registerLanguage("r",QY()),e.registerLanguage("rust",JY()),e.registerLanguage("scss",eX()),e.registerLanguage("shell",tX()),e.registerLanguage("sql",sX()),e.registerLanguage("swift",nX()),e.registerLanguage("yaml",iX()),e.registerLanguage("typescript",rX()),e.registerLanguage("vbnet",aX()),e.registerLanguage("wasm",oX()),e.HighlightJS=e,e.default=e,Nx=e,Nx}var cX=lX();const G0=ST(cX);function cv(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var mo=cv();function k5(e){mo=e}var Xa={exec:()=>null};function el(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 wt(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(rn.caret,"$1"),s=s.replace(o,u),n},getRegex:()=>new RegExp(s,t)};return n}var uX=((e="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+e)}catch{return!1}})(),rn={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:el(e=>new RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:el(e=>new RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:el(e=>new RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:el(e=>new RegExp(`^ {0,${e}}#`)),htmlBeginRegex:el(e=>new RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:el(e=>new RegExp(`^ {0,${e}}>`))},dX=/^(?:[ \t]*(?:\n|$))+/,hX=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,fX=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,_u=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,mX=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,uv=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,N5=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,C5=wt(N5).replace(/bull/g,uv).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(),pX=wt(N5).replace(/bull/g,uv).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(),dv=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,gX=/^[^\n]+/,hv=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,xX=wt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",hv).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),bX=wt(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,uv).getRegex(),Bf="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",fv=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,vX=wt("^ {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",fv).replace("tag",Bf).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),E5=wt(dv).replace("hr",_u).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",Bf).getRegex(),_X=wt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",E5).getRegex(),mv={blockquote:_X,code:hX,def:xX,fences:fX,heading:mX,hr:_u,html:vX,lheading:C5,list:bX,newline:dX,paragraph:E5,table:Xa,text:gX},CN=wt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",_u).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",Bf).getRegex(),yX={...mv,lheading:pX,table:CN,paragraph:wt(dv).replace("hr",_u).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",CN).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",Bf).getRegex()},wX={...mv,html:wt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",fv).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:Xa,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:wt(dv).replace("hr",_u).replace("heading",` *#{1,6} *[^
118
- ]`).replace("lheading",C5).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},SX=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,kX=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,j5=/^( {2,}|\\)\n(?!\s*$)/,NX=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,wl=/[\p{P}\p{S}]/u,Pf=/[\s\p{P}\p{S}]/u,pv=/[^\s\p{P}\p{S}]/u,CX=wt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Pf).getRegex(),A5=/(?!~)[\p{P}\p{S}]/u,EX=/(?!~)[\s\p{P}\p{S}]/u,jX=/(?:[^\s\p{P}\p{S}]|~)/u,AX=wt(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",uX?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),T5=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,TX=wt(T5,"u").replace(/punct/g,wl).getRegex(),RX=wt(T5,"u").replace(/punct/g,A5).getRegex(),R5="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",MX=wt(R5,"gu").replace(/notPunctSpace/g,pv).replace(/punctSpace/g,Pf).replace(/punct/g,wl).getRegex(),DX=wt(R5,"gu").replace(/notPunctSpace/g,jX).replace(/punctSpace/g,EX).replace(/punct/g,A5).getRegex(),OX=wt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,pv).replace(/punctSpace/g,Pf).replace(/punct/g,wl).getRegex(),LX=wt(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,wl).getRegex(),zX="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",BX=wt(zX,"gu").replace(/notPunctSpace/g,pv).replace(/punctSpace/g,Pf).replace(/punct/g,wl).getRegex(),PX=wt(/\\(punct)/,"gu").replace(/punct/g,wl).getRegex(),IX=wt(/^<(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(),$X=wt(fv).replace("(?:-->|$)","-->").getRegex(),HX=wt("^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",$X).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),sf=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,UX=wt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",sf).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),M5=wt(/^!?\[(label)\]\[(ref)\]/).replace("label",sf).replace("ref",hv).getRegex(),D5=wt(/^!?\[(ref)\](?:\[\])?/).replace("ref",hv).getRegex(),FX=wt("reflink|nolink(?!\\()","g").replace("reflink",M5).replace("nolink",D5).getRegex(),EN=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,gv={_backpedal:Xa,anyPunctuation:PX,autolink:IX,blockSkip:AX,br:j5,code:kX,del:Xa,delLDelim:Xa,delRDelim:Xa,emStrongLDelim:TX,emStrongRDelimAst:MX,emStrongRDelimUnd:OX,escape:SX,link:UX,nolink:D5,punctuation:CX,reflink:M5,reflinkSearch:FX,tag:HX,text:NX,url:Xa},qX={...gv,link:wt(/^!?\[(label)\]\((.*?)\)/).replace("label",sf).getRegex(),reflink:wt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",sf).getRegex()},W0={...gv,emStrongRDelimAst:DX,emStrongLDelim:RX,delLDelim:LX,delRDelim:BX,url:wt(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",EN).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:wt(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",EN).getRegex()},VX={...W0,br:wt(j5).replace("{2,}","*").getRegex(),text:wt(W0.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},lh={normal:mv,gfm:yX,pedantic:wX},Ec={normal:gv,gfm:W0,breaks:VX,pedantic:qX},GX={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},jN=e=>GX[e];function qi(e,t){if(t){if(rn.escapeTest.test(e))return e.replace(rn.escapeReplace,jN)}else if(rn.escapeTestNoEncode.test(e))return e.replace(rn.escapeReplaceNoEncode,jN);return e}function AN(e){try{e=encodeURI(e).replace(rn.percentDecode,"%")}catch{return null}return e}function TN(e,t){let s=e.replace(rn.findPipe,(l,u,h)=>{let f=!1,d=u;for(;--d>=0&&h[d]==="\\";)f=!f;return f?"|":" |"}),n=s.split(rn.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(rn.slashPipe,"|");return n}function fa(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 RN(e){let t=e.split(`
119
- `),s=t.length-1;for(;s>=0&&rn.blankLine.test(t[s]);)s--;return t.length-s<=2?e:t.slice(0,s+1).join(`
120
- `)}function WX(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 KX(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 MN(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 f={type:e[0].charAt(0)==="!"?"image":"link",raw:s,href:l,title:u,text:h,tokens:n.inlineTokens(h)};return n.state.inLink=!1,f}function YX(e,t,s){let n=e.match(s.other.indentCodeCompensation);if(n===null)return t;let o=n[1];return t.split(`
121
- `).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(`
122
- `)}var nf=class{options;rules;lexer;constructor(e){this.options=e||mo}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]:RN(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=YX(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=fa(s,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(s=n.trim())}return{type:"heading",raw:fa(t[0],`
123
- `),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:fa(t[0],`
124
- `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let s=fa(t[0],`
125
- `).split(`
126
- `),n="",o="",l=[];for(;s.length>0;){let u=!1,h=[],f;for(f=0;f<s.length;f++)if(this.rules.other.blockquoteStart.test(s[f]))h.push(s[f]),u=!0;else if(!u)h.push(s[f]);else break;s=s.slice(f);let d=h.join(`
127
- `),p=d.replace(this.rules.other.blockquoteSetextReplace,`
128
- $1`).replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}
129
- ${d}`:d,o=o?`${o}
130
- ${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 v=x,w=v.raw+`
131
- `+s.join(`
132
- `),k=this.blockquote(w);l[l.length-1]=k,n=n.substring(0,n.length-v.raw.length)+k.raw,o=o.substring(0,o.length-v.text.length)+k.text;break}else if(x?.type==="list"){let v=x,w=v.raw+`
133
- `+s.join(`
134
- `),k=this.list(w);l[l.length-1]=k,n=n.substring(0,n.length-x.raw.length)+k.raw,o=o.substring(0,o.length-v.raw.length)+k.raw,s=w.substring(l.at(-1).raw.length).split(`
135
- `);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 f=!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=KX(t[2].split(`
136
- `,1)[0],t[1].length),x=e.split(`
137
- `,1)[0],v=!g.trim(),w=0;if(this.options.pedantic?(w=2,p=g.trimStart()):v?w=t[1].length+1:(w=g.search(this.rules.other.nonSpaceChar),w=w>4?1:w,p=g.slice(w),w+=t[1].length),v&&this.rules.other.blankLine.test(x)&&(d+=x+`
138
- `,e=e.substring(x.length+1),f=!0),!f){let k=this.rules.other.nextBulletRegex(w),N=this.rules.other.hrRegex(w),E=this.rules.other.fencesBeginRegex(w),T=this.rules.other.headingBeginRegex(w),A=this.rules.other.htmlBeginRegex(w),C=this.rules.other.blockquoteBeginRegex(w);for(;e;){let R=e.split(`
139
- `,1)[0],D;if(x=R,this.options.pedantic?(x=x.replace(this.rules.other.listReplaceNesting," "),D=x):D=x.replace(this.rules.other.tabCharGlobal," "),E.test(x)||T.test(x)||A.test(x)||C.test(x)||k.test(x)||N.test(x))break;if(D.search(this.rules.other.nonSpaceChar)>=w||!x.trim())p+=`
140
- `+D.slice(w);else{if(v||g.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||E.test(g)||T.test(g)||N.test(g))break;p+=`
141
- `+x}v=!x.trim(),d+=R+`
142
- `,e=e.substring(R.length+1),g=D.slice(w)}}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 f of o.items){this.lexer.state.top=!1,f.tokens=this.lexer.blockTokens(f.text,[]);let d=f.tokens[0];if(f.task&&(d?.type==="text"||d?.type==="paragraph")){f.text=f.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(f.raw);if(p){let g={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};f.checked=g.checked,o.loose?f.tokens[0]&&["paragraph","text"].includes(f.tokens[0].type)&&"tokens"in f.tokens[0]&&f.tokens[0].tokens?(f.tokens[0].raw=g.raw+f.tokens[0].raw,f.tokens[0].text=g.raw+f.tokens[0].text,f.tokens[0].tokens.unshift(g)):f.tokens.unshift({type:"paragraph",raw:g.raw,text:g.raw,tokens:[g]}):f.tokens.unshift(g)}}else f.task&&(f.task=!1);if(!o.loose){let p=f.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 f of o.items){f.loose=!0;for(let d of f.tokens)d.type==="text"&&(d.type="paragraph")}return o}}html(e){let t=this.rules.block.html.exec(e);if(t){let s=RN(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:fa(t[0],`
143
- `),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=TN(t[1]),n=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
144
- `):[],l={type:"table",raw:fa(t[0],`
145
- `),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(TN(u,l.header.length).map((h,f)=>({text:h,tokens:this.lexer.inline(h),header:!1,align:l.align[f]})));return l}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let s=t[1].trim();return{type:"heading",raw:fa(t[0],`
146
- `),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)===`
147
- `?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=fa(s.slice(0,-1),"\\");if((s.length-l.length)%2===0)return}else{let l=WX(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)),MN(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 MN(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,f=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)){f+=u;continue}if(h-=u,h>0)continue;u=Math.min(u,u+h+f);let p=[...n[0]][0].length,g=e.slice(0,o+n.index+p+u);if(Math.min(o,u)%2){let v=g.slice(1,-1);return{type:"em",raw:g,text:v,tokens:this.lexer.inlineTokens(v)}}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,f=this.rules.inline.delRDelim;for(f.lastIndex=0,t=t.slice(-1*e.length+o);(n=f.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}}}},Ei=class K0{tokens;options;state;inlineQueue;tokenizer;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||mo,this.options.tokenizer=this.options.tokenizer||new nf,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:rn,block:lh.normal,inline:Ec.normal};this.options.pedantic?(s.block=lh.pedantic,s.inline=Ec.pedantic):this.options.gfm&&(s.block=lh.gfm,this.options.breaks?s.inline=Ec.breaks:s.inline=Ec.gfm),this.tokenizer.rules=s}static get rules(){return{block:lh,inline:Ec}}static lex(t,s){return new K0(s).lex(t)}static lexInline(t,s){return new K0(s).inlineTokens(t)}lex(t){t=t.replace(rn.carriageReturn,`
148
- `),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(rn.tabCharGlobal," ").replace(rn.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+=`
149
- `: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(`
150
- `)?"":`
151
- `)+l.raw,h.text+=`
152
- `+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(`
153
- `)?"":`
154
- `)+l.raw,h.text+=`
155
- `+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,f=t.slice(1),d;this.options.extensions.startBlock.forEach(p=>{d=p.call({lexer:this},f),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(`
156
- `)?"":`
157
- `)+l.raw,h.text+=`
158
- `+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(`
159
- `)?"":`
160
- `)+l.raw,h.text+=`
161
- `+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="",f=1/0;for(;t;){if(t.length<f)f=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),v;this.options.extensions.startInline.forEach(w=>{v=w.call({lexer:this},x),typeof v=="number"&&v>=0&&(g=Math.min(g,v))}),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)}},rf=class{options;parser;constructor(e){this.options=e||mo}space(e){return""}code({text:e,lang:t,escaped:s}){let n=(t||"").match(rn.notSpaceStart)?.[0],o=e.replace(rn.endingNewline,"")+`
162
- `;return n?'<pre><code class="language-'+qi(n)+'">'+(s?o:qi(o,!0))+`</code></pre>
163
- `:"<pre><code>"+(s?o:qi(o,!0))+`</code></pre>
164
- `}blockquote({tokens:e}){return`<blockquote>
165
- ${this.parser.parse(e)}</blockquote>
166
- `}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
167
- `}hr(e){return`<hr>
168
- `}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+`>
169
- `+n+"</"+o+`>
170
- `}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
171
- `}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
172
- `}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>
173
- <thead>
174
- `+t+`</thead>
175
- `+n+`</table>
176
- `}tablerow({text:e}){return`<tr>
177
- ${e}</tr>
178
- `}tablecell(e){let t=this.parser.parseInline(e.tokens),s=e.header?"th":"td";return(e.align?`<${s} align="${e.align}">`:`<${s}>`)+t+`</${s}>
179
- `}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>${qi(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=AN(e);if(o===null)return n;e=o;let l='<a href="'+e+'"';return t&&(l+=' title="'+qi(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=AN(e);if(o===null)return qi(s);e=o;let l=`<img src="${e}" alt="${qi(s)}"`;return t&&(l+=` title="${qi(t)}"`),l+=">",l}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:qi(e.text)}},xv=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},ji=class Y0{options;renderer;textRenderer;constructor(t){this.options=t||mo,this.options.renderer=this.options.renderer||new rf,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new xv}static parse(t,s){return new Y0(s).parse(t)}static parseInline(t,s){return new Y0(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}},$c=class{options;block;constructor(e){this.options=e||mo}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?Ei.lex:Ei.lexInline}provideParser(e=this.block){return e?ji.parse:ji.parseInline}},XX=class{defaults=cv();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=ji;Renderer=rf;TextRenderer=xv;Lexer=Ei;Tokenizer=nf;Hooks=$c;constructor(...e){this.use(...e)}walkTokens(e,t){let s=[];for(let n of e)switch(s=s.concat(t.call(this,n)),n.type){case"table":{let o=n;for(let l of o.header)s=s.concat(this.walkTokens(l.tokens,t));for(let l of o.rows)for(let u of l)s=s.concat(this.walkTokens(u.tokens,t));break}case"list":{let o=n;s=s.concat(this.walkTokens(o.items,t));break}default:{let o=n;this.defaults.extensions?.childTokens?.[o.type]?this.defaults.extensions.childTokens[o.type].forEach(l=>{let u=o[l].flat(1/0);s=s.concat(this.walkTokens(u,t))}):o.tokens&&(s=s.concat(this.walkTokens(o.tokens,t)))}}return s}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(s=>{let n={...s};if(n.async=this.defaults.async||n.async||!1,s.extensions&&(s.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){let l=t.renderers[o.name];l?t.renderers[o.name]=function(...u){let h=o.renderer.apply(this,u);return h===!1&&(h=l.apply(this,u)),h}:t.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let l=t[o.level];l?l.unshift(o.tokenizer):t[o.level]=[o.tokenizer],o.start&&(o.level==="block"?t.startBlock?t.startBlock.push(o.start):t.startBlock=[o.start]:o.level==="inline"&&(t.startInline?t.startInline.push(o.start):t.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(t.childTokens[o.name]=o.childTokens)}),n.extensions=t),s.renderer){let o=this.defaults.renderer||new rf(this.defaults);for(let l in s.renderer){if(!(l in o))throw new Error(`renderer '${l}' does not exist`);if(["options","parser"].includes(l))continue;let u=l,h=s.renderer[u],f=o[u];o[u]=(...d)=>{let p=h.apply(o,d);return p===!1&&(p=f.apply(o,d)),p||""}}n.renderer=o}if(s.tokenizer){let o=this.defaults.tokenizer||new nf(this.defaults);for(let l in s.tokenizer){if(!(l in o))throw new Error(`tokenizer '${l}' does not exist`);if(["options","rules","lexer"].includes(l))continue;let u=l,h=s.tokenizer[u],f=o[u];o[u]=(...d)=>{let p=h.apply(o,d);return p===!1&&(p=f.apply(o,d)),p}}n.tokenizer=o}if(s.hooks){let o=this.defaults.hooks||new $c;for(let l in s.hooks){if(!(l in o))throw new Error(`hook '${l}' does not exist`);if(["options","block"].includes(l))continue;let u=l,h=s.hooks[u],f=o[u];$c.passThroughHooks.has(l)?o[u]=d=>{if(this.defaults.async&&$c.passThroughHooksRespectAsync.has(l))return(async()=>{let g=await h.call(o,d);return f.call(o,g)})();let p=h.call(o,d);return f.call(o,p)}:o[u]=(...d)=>{if(this.defaults.async)return(async()=>{let g=await h.apply(o,d);return g===!1&&(g=await f.apply(o,d)),g})();let p=h.apply(o,d);return p===!1&&(p=f.apply(o,d)),p}}n.hooks=o}if(s.walkTokens){let o=this.defaults.walkTokens,l=s.walkTokens;n.walkTokens=function(u){let h=[];return h.push(l.call(this,u)),o&&(h=h.concat(o.call(this,u))),h}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Ei.lex(e,t??this.defaults)}parser(e,t){return ji.parse(e,t??this.defaults)}parseMarkdown(e){return(t,s)=>{let n={...s},o={...this.defaults,...n},l=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&n.async===!1)return l(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 t>"u"||t===null)return l(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return l(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(o.hooks&&(o.hooks.options=o,o.hooks.block=e),o.async)return(async()=>{let u=o.hooks?await o.hooks.preprocess(t):t,h=await(o.hooks?await o.hooks.provideLexer(e):e?Ei.lex:Ei.lexInline)(u,o),f=o.hooks?await o.hooks.processAllTokens(h):h;o.walkTokens&&await Promise.all(this.walkTokens(f,o.walkTokens));let d=await(o.hooks?await o.hooks.provideParser(e):e?ji.parse:ji.parseInline)(f,o);return o.hooks?await o.hooks.postprocess(d):d})().catch(l);try{o.hooks&&(t=o.hooks.preprocess(t));let u=(o.hooks?o.hooks.provideLexer(e):e?Ei.lex:Ei.lexInline)(t,o);o.hooks&&(u=o.hooks.processAllTokens(u)),o.walkTokens&&this.walkTokens(u,o.walkTokens);let h=(o.hooks?o.hooks.provideParser(e):e?ji.parse:ji.parseInline)(u,o);return o.hooks&&(h=o.hooks.postprocess(h)),h}catch(u){return l(u)}}}onError(e,t){return s=>{if(s.message+=`
180
- Please report this to https://github.com/markedjs/marked.`,e){let n="<p>An error occurred:</p><pre>"+qi(s.message+"",!0)+"</pre>";return t?Promise.resolve(n):n}if(t)return Promise.reject(s);throw s}}},lo=new XX;function Ot(e,t){return lo.parse(e,t)}Ot.options=Ot.setOptions=function(e){return lo.setOptions(e),Ot.defaults=lo.defaults,k5(Ot.defaults),Ot};Ot.getDefaults=cv;Ot.defaults=mo;Ot.use=function(...e){return lo.use(...e),Ot.defaults=lo.defaults,k5(Ot.defaults),Ot};Ot.walkTokens=function(e,t){return lo.walkTokens(e,t)};Ot.parseInline=lo.parseInline;Ot.Parser=ji;Ot.parser=ji.parse;Ot.Renderer=rf;Ot.TextRenderer=xv;Ot.Lexer=Ei;Ot.lexer=Ei.lex;Ot.Tokenizer=nf;Ot.Hooks=$c;Ot.parse=Ot;Ot.options;Ot.setOptions;Ot.use;Ot.walkTokens;Ot.parseInline;ji.parse;Ei.lex;function ZX(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 bv({content:e}){const t=_.useMemo(()=>{const n=Ot.parse(e,{async:!1,gfm:!0,breaks:!1});return ZX(n)},[e]),s=_.useRef(null);return _.useEffect(()=>{const n=s.current;n&&n.querySelectorAll("pre code").forEach(o=>{G0.highlightElement(o)})},[t]),i.jsx("div",{ref:s,className:"md-preview min-w-0 px-6 py-5",dangerouslySetInnerHTML:{__html:t}})}var QX=Object.create,O5=Object.defineProperty,JX=Object.getOwnPropertyDescriptor,eZ=Object.getOwnPropertyNames,tZ=Object.getPrototypeOf,sZ=Object.prototype.hasOwnProperty,Yt=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),nZ=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(var o=eZ(t),l=0,u=o.length,h;l<u;l++)h=o[l],!sZ.call(e,h)&&h!==s&&O5(e,h,{get:(f=>t[f]).bind(null,h),enumerable:!(n=JX(t,h))||n.enumerable});return e},iZ=(e,t,s)=>(s=e!=null?QX(tZ(e)):{},nZ(O5(s,"default",{value:e,enumerable:!0}),e)),yu=Yt(((e,t)=>{function s(f){return typeof f>"u"||f===null}function n(f){return typeof f=="object"&&f!==null}function o(f){return Array.isArray(f)?f:s(f)?[]:[f]}function l(f,d){if(d){const p=Object.keys(d);for(let g=0,x=p.length;g<x;g+=1){const v=p[g];f[v]=d[v]}}return f}function u(f,d){let p="";for(let g=0;g<d;g+=1)p+=f;return p}function h(f){return f===0&&Number.NEGATIVE_INFINITY===1/f}t.exports.isNothing=s,t.exports.isObject=n,t.exports.toArray=o,t.exports.repeat=u,t.exports.isNegativeZero=h,t.exports.extend=l})),wu=Yt(((e,t)=>{function s(o,l){let u="";const h=o.reason||"(unknown reason)";return o.mark?(o.mark.name&&(u+='in "'+o.mark.name+'" '),u+="("+(o.mark.line+1)+":"+(o.mark.column+1)+")",!l&&o.mark.snippet&&(u+=`
181
-
182
- `+o.mark.snippet),h+" "+u):h}function n(o,l){Error.call(this),this.name="YAMLException",this.reason=o,this.mark=l,this.message=s(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n.prototype.toString=function(l){return this.name+": "+s(this,l)},t.exports=n})),rZ=Yt(((e,t)=>{var s=yu();function n(u,h,f,d,p){let g="",x="";const v=Math.floor(p/2)-1;return d-h>v&&(g=" ... ",h=d-v+g.length),f-d>v&&(x=" ...",f=d+v-x.length),{str:g+u.slice(h,f).replace(/\t/g,"→")+x,pos:d-h+g.length}}function o(u,h){return s.repeat(" ",h-u.length)+u}function l(u,h){if(h=Object.create(h||null),!u.buffer)return null;h.maxLength||(h.maxLength=79),typeof h.indent!="number"&&(h.indent=1),typeof h.linesBefore!="number"&&(h.linesBefore=3),typeof h.linesAfter!="number"&&(h.linesAfter=2);const f=/\r?\n|\r|\0/g,d=[0],p=[];let g,x=-1;for(;g=f.exec(u.buffer);)p.push(g.index),d.push(g.index+g[0].length),u.position<=g.index&&x<0&&(x=d.length-2);x<0&&(x=d.length-1);let v="";const w=Math.min(u.line+h.linesAfter,p.length).toString().length,k=h.maxLength-(h.indent+w+3);for(let E=1;E<=h.linesBefore&&!(x-E<0);E++){const T=n(u.buffer,d[x-E],p[x-E],u.position-(d[x]-d[x-E]),k);v=s.repeat(" ",h.indent)+o((u.line-E+1).toString(),w)+" | "+T.str+`
183
- `+v}const N=n(u.buffer,d[x],p[x],u.position,k);v+=s.repeat(" ",h.indent)+o((u.line+1).toString(),w)+" | "+N.str+`
184
- `,v+=s.repeat("-",h.indent+w+3+N.pos)+`^
185
- `;for(let E=1;E<=h.linesAfter&&!(x+E>=p.length);E++){const T=n(u.buffer,d[x+E],p[x+E],u.position-(d[x]-d[x+E]),k);v+=s.repeat(" ",h.indent)+o((u.line+E+1).toString(),w)+" | "+T.str+`
186
- `}return v.replace(/\n$/,"")}t.exports=l})),pn=Yt(((e,t)=>{var s=wu(),n=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],o=["scalar","sequence","mapping"];function l(h){const f={};return h!==null&&Object.keys(h).forEach(function(d){h[d].forEach(function(p){f[String(p)]=d})}),f}function u(h,f){if(f=f||{},Object.keys(f).forEach(function(d){if(n.indexOf(d)===-1)throw new s('Unknown option "'+d+'" is met in definition of "'+h+'" YAML type.')}),this.options=f,this.tag=h,this.kind=f.kind||null,this.resolve=f.resolve||function(){return!0},this.construct=f.construct||function(d){return d},this.instanceOf=f.instanceOf||null,this.predicate=f.predicate||null,this.represent=f.represent||null,this.representName=f.representName||null,this.defaultStyle=f.defaultStyle||null,this.multi=f.multi||!1,this.styleAliases=l(f.styleAliases||null),o.indexOf(this.kind)===-1)throw new s('Unknown kind "'+this.kind+'" is specified for "'+h+'" YAML type.')}t.exports=u})),L5=Yt(((e,t)=>{var s=wu(),n=pn();function o(h,f){const d=[];return h[f].forEach(function(p){let g=d.length;d.forEach(function(x,v){x.tag===p.tag&&x.kind===p.kind&&x.multi===p.multi&&(g=v)}),d[g]=p}),d}function l(){const h={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function f(d){d.multi?(h.multi[d.kind].push(d),h.multi.fallback.push(d)):h[d.kind][d.tag]=h.fallback[d.tag]=d}for(let d=0,p=arguments.length;d<p;d+=1)arguments[d].forEach(f);return h}function u(h){return this.extend(h)}u.prototype.extend=function(f){let d=[],p=[];if(f instanceof n)p.push(f);else if(Array.isArray(f))p=p.concat(f);else if(f&&(Array.isArray(f.implicit)||Array.isArray(f.explicit)))f.implicit&&(d=d.concat(f.implicit)),f.explicit&&(p=p.concat(f.explicit));else throw new s("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");d.forEach(function(x){if(!(x instanceof n))throw new s("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(x.loadKind&&x.loadKind!=="scalar")throw new s("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(x.multi)throw new s("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),p.forEach(function(x){if(!(x instanceof n))throw new s("Specified list of YAML types (or a single Type object) contains a non-Type object.")});const g=Object.create(u.prototype);return g.implicit=(this.implicit||[]).concat(d),g.explicit=(this.explicit||[]).concat(p),g.compiledImplicit=o(g,"implicit"),g.compiledExplicit=o(g,"explicit"),g.compiledTypeMap=l(g.compiledImplicit,g.compiledExplicit),g},t.exports=u})),z5=Yt(((e,t)=>{t.exports=new(pn())("tag:yaml.org,2002:str",{kind:"scalar",construct:function(s){return s!==null?s:""}})})),B5=Yt(((e,t)=>{t.exports=new(pn())("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(s){return s!==null?s:[]}})})),P5=Yt(((e,t)=>{t.exports=new(pn())("tag:yaml.org,2002:map",{kind:"mapping",construct:function(s){return s!==null?s:{}}})})),I5=Yt(((e,t)=>{t.exports=new(L5())({explicit:[z5(),B5(),P5()]})})),$5=Yt(((e,t)=>{var s=pn();function n(u){if(u===null)return!0;const h=u.length;return h===1&&u==="~"||h===4&&(u==="null"||u==="Null"||u==="NULL")}function o(){return null}function l(u){return u===null}t.exports=new s("tag:yaml.org,2002:null",{kind:"scalar",resolve:n,construct:o,predicate:l,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"})})),H5=Yt(((e,t)=>{var s=pn();function n(u){if(u===null)return!1;const h=u.length;return h===4&&(u==="true"||u==="True"||u==="TRUE")||h===5&&(u==="false"||u==="False"||u==="FALSE")}function o(u){return u==="true"||u==="True"||u==="TRUE"}function l(u){return Object.prototype.toString.call(u)==="[object Boolean]"}t.exports=new s("tag:yaml.org,2002:bool",{kind:"scalar",resolve:n,construct:o,predicate:l,represent:{lowercase:function(u){return u?"true":"false"},uppercase:function(u){return u?"TRUE":"FALSE"},camelcase:function(u){return u?"True":"False"}},defaultStyle:"lowercase"})})),U5=Yt(((e,t)=>{var s=yu(),n=pn();function o(g){return g>=48&&g<=57||g>=65&&g<=70||g>=97&&g<=102}function l(g){return g>=48&&g<=55}function u(g){return g>=48&&g<=57}function h(g){if(g===null)return!1;const x=g.length;let v=0,w=!1;if(!x)return!1;let k=g[v];if((k==="-"||k==="+")&&(k=g[++v]),k==="0"){if(v+1===x)return!0;if(k=g[++v],k==="b"){for(v++;v<x;v++){if(k=g[v],k!=="0"&&k!=="1")return!1;w=!0}return w&&Number.isFinite(f(g))}if(k==="x"){for(v++;v<x;v++){if(!o(g.charCodeAt(v)))return!1;w=!0}return w&&Number.isFinite(f(g))}if(k==="o"){for(v++;v<x;v++){if(!l(g.charCodeAt(v)))return!1;w=!0}return w&&Number.isFinite(f(g))}}for(;v<x;v++){if(!u(g.charCodeAt(v)))return!1;w=!0}return w?Number.isFinite(f(g)):!1}function f(g){let x=g,v=1,w=x[0];if((w==="-"||w==="+")&&(w==="-"&&(v=-1),x=x.slice(1),w=x[0]),x==="0")return 0;if(w==="0"){if(x[1]==="b")return v*parseInt(x.slice(2),2);if(x[1]==="x")return v*parseInt(x.slice(2),16);if(x[1]==="o")return v*parseInt(x.slice(2),8)}return v*parseInt(x,10)}function d(g){return f(g)}function p(g){return Object.prototype.toString.call(g)==="[object Number]"&&g%1===0&&!s.isNegativeZero(g)}t.exports=new n("tag:yaml.org,2002:int",{kind:"scalar",resolve:h,construct:d,predicate:p,represent:{binary:function(g){return g>=0?"0b"+g.toString(2):"-0b"+g.toString(2).slice(1)},octal:function(g){return g>=0?"0o"+g.toString(8):"-0o"+g.toString(8).slice(1)},decimal:function(g){return g.toString(10)},hexadecimal:function(g){return g>=0?"0x"+g.toString(16).toUpperCase():"-0x"+g.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})})),F5=Yt(((e,t)=>{var s=yu(),n=pn(),o=new RegExp("^(?:[-+]?(?:[0-9]+)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),l=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function u(g){return g===null||!o.test(g)?!1:Number.isFinite(parseFloat(g,10))?!0:l.test(g)}function h(g){let x=g.toLowerCase();const v=x[0]==="-"?-1:1;return"+-".indexOf(x[0])>=0&&(x=x.slice(1)),x===".inf"?v===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:x===".nan"?NaN:v*parseFloat(x,10)}var f=/^[-+]?[0-9]+e/;function d(g,x){if(isNaN(g))switch(x){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===g)switch(x){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===g)switch(x){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(s.isNegativeZero(g))return"-0.0";const v=g.toString(10);return f.test(v)?v.replace("e",".e"):v}function p(g){return Object.prototype.toString.call(g)==="[object Number]"&&(g%1!==0||s.isNegativeZero(g))}t.exports=new n("tag:yaml.org,2002:float",{kind:"scalar",resolve:u,construct:h,predicate:p,represent:d,defaultStyle:"lowercase"})})),q5=Yt(((e,t)=>{t.exports=I5().extend({implicit:[$5(),H5(),U5(),F5()]})})),V5=Yt(((e,t)=>{t.exports=q5()})),G5=Yt(((e,t)=>{var s=pn(),n=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),o=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 l(f){return f===null?!1:n.exec(f)!==null||o.exec(f)!==null}function u(f){let d=0,p=null,g=n.exec(f);if(g===null&&(g=o.exec(f)),g===null)throw new Error("Date resolve error");const x=+g[1],v=+g[2]-1,w=+g[3];if(!g[4])return new Date(Date.UTC(x,v,w));const k=+g[4],N=+g[5],E=+g[6];if(g[7]){for(d=g[7].slice(0,3);d.length<3;)d+="0";d=+d}if(g[9]){const A=+g[10],C=+(g[11]||0);p=(A*60+C)*6e4,g[9]==="-"&&(p=-p)}const T=new Date(Date.UTC(x,v,w,k,N,E,d));return p&&T.setTime(T.getTime()-p),T}function h(f){return f.toISOString()}t.exports=new s("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:l,construct:u,instanceOf:Date,represent:h})})),W5=Yt(((e,t)=>{var s=pn();function n(o){return o==="<<"||o===null}t.exports=new s("tag:yaml.org,2002:merge",{kind:"scalar",resolve:n})})),K5=Yt(((e,t)=>{var s=pn(),n=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
187
- \r`;function o(f){if(f===null)return!1;let d=0;const p=f.length,g=n;for(let x=0;x<p;x++){const v=g.indexOf(f.charAt(x));if(!(v>64)){if(v<0)return!1;d+=6}}return d%8===0}function l(f){const d=f.replace(/[\r\n=]/g,""),p=d.length,g=n;let x=0;const v=[];for(let k=0;k<p;k++)k%4===0&&k&&(v.push(x>>16&255),v.push(x>>8&255),v.push(x&255)),x=x<<6|g.indexOf(d.charAt(k));const w=p%4*6;return w===0?(v.push(x>>16&255),v.push(x>>8&255),v.push(x&255)):w===18?(v.push(x>>10&255),v.push(x>>2&255)):w===12&&v.push(x>>4&255),new Uint8Array(v)}function u(f){let d="",p=0;const g=f.length,x=n;for(let w=0;w<g;w++)w%3===0&&w&&(d+=x[p>>18&63],d+=x[p>>12&63],d+=x[p>>6&63],d+=x[p&63]),p=(p<<8)+f[w];const v=g%3;return v===0?(d+=x[p>>18&63],d+=x[p>>12&63],d+=x[p>>6&63],d+=x[p&63]):v===2?(d+=x[p>>10&63],d+=x[p>>4&63],d+=x[p<<2&63],d+=x[64]):v===1&&(d+=x[p>>2&63],d+=x[p<<4&63],d+=x[64],d+=x[64]),d}function h(f){return Object.prototype.toString.call(f)==="[object Uint8Array]"}t.exports=new s("tag:yaml.org,2002:binary",{kind:"scalar",resolve:o,construct:l,predicate:h,represent:u})})),Y5=Yt(((e,t)=>{var s=pn(),n=Object.prototype.hasOwnProperty,o=Object.prototype.toString;function l(h){if(h===null)return!0;const f=[],d=h;for(let p=0,g=d.length;p<g;p+=1){const x=d[p];let v=!1;if(o.call(x)!=="[object Object]")return!1;let w;for(w in x)if(n.call(x,w))if(!v)v=!0;else return!1;if(!v)return!1;if(f.indexOf(w)===-1)f.push(w);else return!1}return!0}function u(h){return h!==null?h:[]}t.exports=new s("tag:yaml.org,2002:omap",{kind:"sequence",resolve:l,construct:u})})),X5=Yt(((e,t)=>{var s=pn(),n=Object.prototype.toString;function o(u){if(u===null)return!0;const h=u,f=new Array(h.length);for(let d=0,p=h.length;d<p;d+=1){const g=h[d];if(n.call(g)!=="[object Object]")return!1;const x=Object.keys(g);if(x.length!==1)return!1;f[d]=[x[0],g[x[0]]]}return!0}function l(u){if(u===null)return[];const h=u,f=new Array(h.length);for(let d=0,p=h.length;d<p;d+=1){const g=h[d],x=Object.keys(g);f[d]=[x[0],g[x[0]]]}return f}t.exports=new s("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:o,construct:l})})),Z5=Yt(((e,t)=>{var s=pn(),n=Object.prototype.hasOwnProperty;function o(u){if(u===null)return!0;const h=u;for(const f in h)if(n.call(h,f)&&h[f]!==null)return!1;return!0}function l(u){return u!==null?u:{}}t.exports=new s("tag:yaml.org,2002:set",{kind:"mapping",resolve:o,construct:l})})),vv=Yt(((e,t)=>{t.exports=V5().extend({implicit:[G5(),W5()],explicit:[K5(),Y5(),X5(),Z5()]})})),aZ=Yt(((e,t)=>{var s=yu(),n=wu(),o=rZ(),l=vv(),u=Object.prototype.hasOwnProperty,h=1,f=2,d=3,p=4,g=1,x=2,v=3,w=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,k=/[\x85\u2028\u2029]/,N=/[,\[\]{}]/,E=/^(?:!|!!|![0-9A-Za-z-]+!)$/,T=/^(?:!|[^,\[\]{}])(?:%[0-9a-f]{2}|[0-9a-z\-#;/?:@&=+$,_.!~*'()\[\]])*$/i;function A(S){return Object.prototype.toString.call(S)}function C(S){return S===10||S===13}function R(S){return S===9||S===32}function D(S){return S===9||S===32||S===10||S===13}function $(S){return S===44||S===91||S===93||S===123||S===125}function O(S){if(S>=48&&S<=57)return S-48;const re=S|32;return re>=97&&re<=102?re-97+10:-1}function P(S){return S===120?2:S===117?4:S===85?8:0}function B(S){return S>=48&&S<=57?S-48:-1}function G(S){switch(S){case 48:return"\0";case 97:return"\x07";case 98:return"\b";case 116:return" ";case 9:return" ";case 110:return`
188
- `;case 118:return"\v";case 102:return"\f";case 114:return"\r";case 101:return"\x1B";case 32:return" ";case 34:return'"';case 47:return"/";case 92:return"\\";case 78:return"…";case 95:return" ";case 76:return"\u2028";case 80:return"\u2029";default:return""}}function F(S){return S<=65535?String.fromCharCode(S):String.fromCharCode((S-65536>>10)+55296,(S-65536&1023)+56320)}function z(S,re,be){re==="__proto__"?Object.defineProperty(S,re,{configurable:!0,enumerable:!0,writable:!0,value:be}):S[re]=be}var U=new Array(256),K=new Array(256);for(let S=0;S<256;S++)U[S]=G(S)?1:0,K[S]=G(S);function I(S,re){this.input=S,this.filename=re.filename||null,this.schema=re.schema||l,this.onWarning=re.onWarning||null,this.legacy=re.legacy||!1,this.json=re.json||!1,this.listener=re.listener||null,this.maxDepth=typeof re.maxDepth=="number"?re.maxDepth:100,this.maxMergeSeqLength=typeof re.maxMergeSeqLength=="number"?re.maxMergeSeqLength:20,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=S.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.depth=0,this.firstTabInLine=-1,this.documents=[],this.anchorMapTransactions=[]}function Z(S,re){const be={name:S.filename,buffer:S.input.slice(0,-1),position:S.position,line:S.line,column:S.position-S.lineStart};return be.snippet=o(be),new n(re,be)}function W(S,re){throw Z(S,re)}function te(S,re){S.onWarning&&S.onWarning.call(null,Z(S,re))}function X(S,re,be){const ye=S.anchorMapTransactions;if(ye.length!==0){const he=ye[ye.length-1];u.call(he,re)||(he[re]={existed:u.call(S.anchorMap,re),value:S.anchorMap[re]})}S.anchorMap[re]=be}function V(S){S.anchorMapTransactions.push(Object.create(null))}function q(S){const re=S.anchorMapTransactions.pop(),be=S.anchorMapTransactions;if(be.length===0)return;const ye=be[be.length-1],he=Object.keys(re);for(let Ae=0,M=he.length;Ae<M;Ae+=1){const oe=he[Ae];u.call(ye,oe)||(ye[oe]=re[oe])}}function le(S){const re=S.anchorMapTransactions.pop(),be=Object.keys(re);for(let ye=be.length-1;ye>=0;ye-=1){const he=re[be[ye]];he.existed?S.anchorMap[be[ye]]=he.value:delete S.anchorMap[be[ye]]}}function ee(S){return{position:S.position,line:S.line,lineStart:S.lineStart,lineIndent:S.lineIndent,firstTabInLine:S.firstTabInLine,tag:S.tag,anchor:S.anchor,kind:S.kind,result:S.result}}function fe(S,re){S.position=re.position,S.line=re.line,S.lineStart=re.lineStart,S.lineIndent=re.lineIndent,S.firstTabInLine=re.firstTabInLine,S.tag=re.tag,S.anchor=re.anchor,S.kind=re.kind,S.result=re.result}var ie={YAML:function(re,be,ye){re.version!==null&&W(re,"duplication of %YAML directive"),ye.length!==1&&W(re,"YAML directive accepts exactly one argument");const he=/^([0-9]+)\.([0-9]+)$/.exec(ye[0]);he===null&&W(re,"ill-formed argument of the YAML directive");const Ae=parseInt(he[1],10),M=parseInt(he[2],10);Ae!==1&&W(re,"unacceptable YAML version of the document"),re.version=ye[0],re.checkLineBreaks=M<2,M!==1&&M!==2&&te(re,"unsupported YAML version of the document")},TAG:function(re,be,ye){let he;ye.length!==2&&W(re,"TAG directive accepts exactly two arguments");const Ae=ye[0];he=ye[1],E.test(Ae)||W(re,"ill-formed tag handle (first argument) of the TAG directive"),u.call(re.tagMap,Ae)&&W(re,'there is a previously declared suffix for "'+Ae+'" tag handle'),T.test(he)||W(re,"ill-formed tag prefix (second argument) of the TAG directive");try{he=decodeURIComponent(he)}catch{W(re,"tag prefix is malformed: "+he)}re.tagMap[Ae]=he}};function Se(S,re,be,ye){if(re<be){const he=S.input.slice(re,be);if(ye)for(let Ae=0,M=he.length;Ae<M;Ae+=1){const oe=he.charCodeAt(Ae);oe===9||oe>=32&&oe<=1114111||W(S,"expected valid JSON character")}else w.test(he)&&W(S,"the stream contains non-printable characters");S.result+=he}}function Me(S,re,be,ye){s.isObject(be)||W(S,"cannot merge mappings; the provided source object is unacceptable");const he=Object.keys(be);for(let Ae=0,M=he.length;Ae<M;Ae+=1){const oe=he[Ae];u.call(re,oe)||(z(re,oe,be[oe]),ye[oe]=!0)}}function De(S,re,be,ye,he,Ae,M,oe,Te){if(Array.isArray(he)){he=Array.prototype.slice.call(he);for(let _e=0,me=he.length;_e<me;_e+=1)Array.isArray(he[_e])&&W(S,"nested arrays are not supported inside keys"),typeof he=="object"&&A(he[_e])==="[object Object]"&&(he[_e]="[object Object]")}if(typeof he=="object"&&A(he)==="[object Object]"&&(he="[object Object]"),he=String(he),re===null&&(re={}),ye==="tag:yaml.org,2002:merge")if(Array.isArray(Ae)){Ae.length>S.maxMergeSeqLength&&W(S,"merge sequence length exceeded maxMergeSeqLength ("+S.maxMergeSeqLength+")");const _e=new Set;for(let me=0,je=Ae.length;me<je;me+=1){const ke=Ae[me];_e.has(ke)||(_e.add(ke),Me(S,re,ke,be))}}else Me(S,re,Ae,be);else!S.json&&!u.call(be,he)&&u.call(re,he)&&(S.line=M||S.line,S.lineStart=oe||S.lineStart,S.position=Te||S.position,W(S,"duplicated mapping key")),z(re,he,Ae),delete be[he];return re}function Je(S){const re=S.input.charCodeAt(S.position);re===10?S.position++:re===13?(S.position++,S.input.charCodeAt(S.position)===10&&S.position++):W(S,"a line break is expected"),S.line+=1,S.lineStart=S.position,S.firstTabInLine=-1}function Ne(S,re,be){let ye=0,he=S.input.charCodeAt(S.position);for(;he!==0;){for(;R(he);)he===9&&S.firstTabInLine===-1&&(S.firstTabInLine=S.position),he=S.input.charCodeAt(++S.position);if(re&&he===35)do he=S.input.charCodeAt(++S.position);while(he!==10&&he!==13&&he!==0);if(C(he))for(Je(S),he=S.input.charCodeAt(S.position),ye++,S.lineIndent=0;he===32;)S.lineIndent++,he=S.input.charCodeAt(++S.position);else break}return be!==-1&&ye!==0&&S.lineIndent<be&&te(S,"deficient indentation"),ye}function Ue(S){let re=S.position,be=S.input.charCodeAt(re);return!!((be===45||be===46)&&be===S.input.charCodeAt(re+1)&&be===S.input.charCodeAt(re+2)&&(re+=3,be=S.input.charCodeAt(re),be===0||D(be)))}function $e(S,re){re===1?S.result+=" ":re>1&&(S.result+=s.repeat(`
189
- `,re-1))}function St(S,re,be){let ye,he,Ae,M,oe,Te;const _e=S.kind,me=S.result;let je=S.input.charCodeAt(S.position);if(D(je)||$(je)||je===35||je===38||je===42||je===33||je===124||je===62||je===39||je===34||je===37||je===64||je===96)return!1;if(je===63||je===45){const ke=S.input.charCodeAt(S.position+1);if(D(ke)||be&&$(ke))return!1}for(S.kind="scalar",S.result="",ye=he=S.position,Ae=!1;je!==0;){if(je===58){const ke=S.input.charCodeAt(S.position+1);if(D(ke)||be&&$(ke))break}else if(je===35){if(D(S.input.charCodeAt(S.position-1)))break}else{if(S.position===S.lineStart&&Ue(S)||be&&$(je))break;if(C(je))if(M=S.line,oe=S.lineStart,Te=S.lineIndent,Ne(S,!1,-1),S.lineIndent>=re){Ae=!0,je=S.input.charCodeAt(S.position);continue}else{S.position=he,S.line=M,S.lineStart=oe,S.lineIndent=Te;break}}Ae&&(Se(S,ye,he,!1),$e(S,S.line-M),ye=he=S.position,Ae=!1),R(je)||(he=S.position+1),je=S.input.charCodeAt(++S.position)}return Se(S,ye,he,!1),S.result?!0:(S.kind=_e,S.result=me,!1)}function Ls(S,re){let be,ye,he=S.input.charCodeAt(S.position);if(he!==39)return!1;for(S.kind="scalar",S.result="",S.position++,be=ye=S.position;(he=S.input.charCodeAt(S.position))!==0;)if(he===39)if(Se(S,be,S.position,!0),he=S.input.charCodeAt(++S.position),he===39)be=S.position,S.position++,ye=S.position;else return!0;else C(he)?(Se(S,be,ye,!0),$e(S,Ne(S,!1,re)),be=ye=S.position):S.position===S.lineStart&&Ue(S)?W(S,"unexpected end of the document within a single quoted scalar"):(S.position++,R(he)||(ye=S.position));W(S,"unexpected end of the stream within a single quoted scalar")}function zs(S,re){let be,ye,he,Ae=S.input.charCodeAt(S.position);if(Ae!==34)return!1;for(S.kind="scalar",S.result="",S.position++,be=ye=S.position;(Ae=S.input.charCodeAt(S.position))!==0;){if(Ae===34)return Se(S,be,S.position,!0),S.position++,!0;if(Ae===92){if(Se(S,be,S.position,!0),Ae=S.input.charCodeAt(++S.position),C(Ae))Ne(S,!1,re);else if(Ae<256&&U[Ae])S.result+=K[Ae],S.position++;else if((he=P(Ae))>0){let M=he,oe=0;for(;M>0;M--)Ae=S.input.charCodeAt(++S.position),(he=O(Ae))>=0?oe=(oe<<4)+he:W(S,"expected hexadecimal character");S.result+=F(oe),S.position++}else W(S,"unknown escape sequence");be=ye=S.position}else C(Ae)?(Se(S,be,ye,!0),$e(S,Ne(S,!1,re)),be=ye=S.position):S.position===S.lineStart&&Ue(S)?W(S,"unexpected end of the document within a double quoted scalar"):(S.position++,R(Ae)||(ye=S.position))}W(S,"unexpected end of the stream within a double quoted scalar")}function vi(S,re){let be=!0,ye,he,Ae;const M=S.tag;let oe;const Te=S.anchor;let _e,me,je,ke;const Be=Object.create(null);let H,se,ge,Pe=S.input.charCodeAt(S.position);if(Pe===91)_e=93,ke=!1,oe=[];else if(Pe===123)_e=125,ke=!0,oe={};else return!1;for(S.anchor!==null&&X(S,S.anchor,oe),Pe=S.input.charCodeAt(++S.position);Pe!==0;){if(Ne(S,!0,re),Pe=S.input.charCodeAt(S.position),Pe===_e)return S.position++,S.tag=M,S.anchor=Te,S.kind=ke?"mapping":"sequence",S.result=oe,!0;be?Pe===44&&W(S,"expected the node content, but found ','"):W(S,"missed comma between flow collection entries"),se=H=ge=null,me=je=!1,Pe===63&&D(S.input.charCodeAt(S.position+1))&&(me=je=!0,S.position++,Ne(S,!0,re)),ye=S.line,he=S.lineStart,Ae=S.position,Cs(S,re,h,!1,!0),se=S.tag,H=S.result,Ne(S,!0,re),Pe=S.input.charCodeAt(S.position),(je||S.line===ye)&&Pe===58&&(me=!0,Pe=S.input.charCodeAt(++S.position),Ne(S,!0,re),Cs(S,re,h,!1,!0),ge=S.result),ke?De(S,oe,Be,se,H,ge,ye,he,Ae):me?oe.push(De(S,null,Be,se,H,ge,ye,he,Ae)):oe.push(H),Ne(S,!0,re),Pe=S.input.charCodeAt(S.position),Pe===44?(be=!0,Pe=S.input.charCodeAt(++S.position)):be=!1}W(S,"unexpected end of the stream within a flow collection")}function Kn(S,re){let be,ye=g,he=!1,Ae=!1,M=re,oe=0,Te=!1,_e,me=S.input.charCodeAt(S.position);if(me===124)be=!1;else if(me===62)be=!0;else return!1;for(S.kind="scalar",S.result="";me!==0;)if(me=S.input.charCodeAt(++S.position),me===43||me===45)g===ye?ye=me===43?v:x:W(S,"repeat of a chomping mode identifier");else if((_e=B(me))>=0)_e===0?W(S,"bad explicit indentation width of a block scalar; it cannot be less than one"):Ae?W(S,"repeat of an indentation width identifier"):(M=re+_e-1,Ae=!0);else break;if(R(me)){do me=S.input.charCodeAt(++S.position);while(R(me));if(me===35)do me=S.input.charCodeAt(++S.position);while(!C(me)&&me!==0)}for(;me!==0;){for(Je(S),S.lineIndent=0,me=S.input.charCodeAt(S.position);(!Ae||S.lineIndent<M)&&me===32;)S.lineIndent++,me=S.input.charCodeAt(++S.position);if(!Ae&&S.lineIndent>M&&(M=S.lineIndent),C(me)){oe++;continue}if(!Ae&&M===0&&W(S,"missing indentation for block scalar"),S.lineIndent<M){ye===v?S.result+=s.repeat(`
190
- `,he?1+oe:oe):ye===g&&he&&(S.result+=`
191
- `);break}be?R(me)?(Te=!0,S.result+=s.repeat(`
192
- `,he?1+oe:oe)):Te?(Te=!1,S.result+=s.repeat(`
193
- `,oe+1)):oe===0?he&&(S.result+=" "):S.result+=s.repeat(`
194
- `,oe):S.result+=s.repeat(`
195
- `,he?1+oe:oe),he=!0,Ae=!0,oe=0;const je=S.position;for(;!C(me)&&me!==0;)me=S.input.charCodeAt(++S.position);Se(S,je,S.position,!1)}return!0}function qs(S,re){const be=S.tag,ye=S.anchor,he=[];let Ae=!1;if(S.firstTabInLine!==-1)return!1;S.anchor!==null&&X(S,S.anchor,he);let M=S.input.charCodeAt(S.position);for(;M!==0&&(S.firstTabInLine!==-1&&(S.position=S.firstTabInLine,W(S,"tab characters must not be used in indentation")),!(M!==45||!D(S.input.charCodeAt(S.position+1))));){if(Ae=!0,S.position++,Ne(S,!0,-1)&&S.lineIndent<=re){he.push(null),M=S.input.charCodeAt(S.position);continue}const oe=S.line;if(Cs(S,re,d,!1,!0),he.push(S.result),Ne(S,!0,-1),M=S.input.charCodeAt(S.position),(S.line===oe||S.lineIndent>re)&&M!==0)W(S,"bad indentation of a sequence entry");else if(S.lineIndent<re)break}return Ae?(S.tag=be,S.anchor=ye,S.kind="sequence",S.result=he,!0):!1}function An(S,re,be){let ye,he,Ae,M;const oe=S.tag,Te=S.anchor,_e={},me=Object.create(null);let je=null,ke=null,Be=null,H=!1,se=!1;if(S.firstTabInLine!==-1)return!1;S.anchor!==null&&X(S,S.anchor,_e);let ge=S.input.charCodeAt(S.position);for(;ge!==0;){!H&&S.firstTabInLine!==-1&&(S.position=S.firstTabInLine,W(S,"tab characters must not be used in indentation"));const Pe=S.input.charCodeAt(S.position+1),it=S.line;if((ge===63||ge===58)&&D(Pe))ge===63?(H&&(De(S,_e,me,je,ke,null,he,Ae,M),je=ke=Be=null),se=!0,H=!0,ye=!0):H?(H=!1,ye=!0):W(S,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),S.position+=1,ge=Pe;else{if(he=S.line,Ae=S.lineStart,M=S.position,!Cs(S,be,f,!1,!0))break;if(S.line===it){for(ge=S.input.charCodeAt(S.position);R(ge);)ge=S.input.charCodeAt(++S.position);if(ge===58)ge=S.input.charCodeAt(++S.position),D(ge)||W(S,"a whitespace character is expected after the key-value separator within a block mapping"),H&&(De(S,_e,me,je,ke,null,he,Ae,M),je=ke=Be=null),se=!0,H=!1,ye=!1,je=S.tag,ke=S.result;else if(se)W(S,"can not read an implicit mapping pair; a colon is missed");else return S.tag=oe,S.anchor=Te,!0}else if(se)W(S,"can not read a block mapping entry; a multiline key may not be an implicit key");else return S.tag=oe,S.anchor=Te,!0}if((S.line===it||S.lineIndent>re)&&(H&&(he=S.line,Ae=S.lineStart,M=S.position),Cs(S,re,p,!0,ye)&&(H?ke=S.result:Be=S.result),H||(De(S,_e,me,je,ke,Be,he,Ae,M),je=ke=Be=null),Ne(S,!0,-1),ge=S.input.charCodeAt(S.position)),(S.line===it||S.lineIndent>re)&&ge!==0)W(S,"bad indentation of a mapping entry");else if(S.lineIndent<re)break}return H&&De(S,_e,me,je,ke,null,he,Ae,M),se&&(S.tag=oe,S.anchor=Te,S.kind="mapping",S.result=_e),se}function Tn(S){let re=!1,be=!1,ye,he,Ae=S.input.charCodeAt(S.position);if(Ae!==33)return!1;S.tag!==null&&W(S,"duplication of a tag property"),Ae=S.input.charCodeAt(++S.position),Ae===60?(re=!0,Ae=S.input.charCodeAt(++S.position)):Ae===33?(be=!0,ye="!!",Ae=S.input.charCodeAt(++S.position)):ye="!";let M=S.position;if(re){do Ae=S.input.charCodeAt(++S.position);while(Ae!==0&&Ae!==62);S.position<S.length?(he=S.input.slice(M,S.position),Ae=S.input.charCodeAt(++S.position)):W(S,"unexpected end of the stream within a verbatim tag")}else{for(;Ae!==0&&!D(Ae);)Ae===33&&(be?W(S,"tag suffix cannot contain exclamation marks"):(ye=S.input.slice(M-1,S.position+1),E.test(ye)||W(S,"named tag handle cannot contain such characters"),be=!0,M=S.position+1)),Ae=S.input.charCodeAt(++S.position);he=S.input.slice(M,S.position),N.test(he)&&W(S,"tag suffix cannot contain flow indicator characters")}he&&!T.test(he)&&W(S,"tag name cannot contain such characters: "+he);try{he=decodeURIComponent(he)}catch{W(S,"tag name is malformed: "+he)}return re?S.tag=he:u.call(S.tagMap,ye)?S.tag=S.tagMap[ye]+he:ye==="!"?S.tag="!"+he:ye==="!!"?S.tag="tag:yaml.org,2002:"+he:W(S,'undeclared tag handle "'+ye+'"'),!0}function Di(S){let re=S.input.charCodeAt(S.position);if(re!==38)return!1;S.anchor!==null&&W(S,"duplication of an anchor property"),re=S.input.charCodeAt(++S.position);const be=S.position;for(;re!==0&&!D(re)&&!$(re);)re=S.input.charCodeAt(++S.position);return S.position===be&&W(S,"name of an anchor node must contain at least one character"),S.anchor=S.input.slice(be,S.position),!0}function _i(S){let re=S.input.charCodeAt(S.position);if(re!==42)return!1;re=S.input.charCodeAt(++S.position);const be=S.position;for(;re!==0&&!D(re)&&!$(re);)re=S.input.charCodeAt(++S.position);S.position===be&&W(S,"name of an alias node must contain at least one character");const ye=S.input.slice(be,S.position);return u.call(S.anchorMap,ye)||W(S,'unidentified alias "'+ye+'"'),S.result=S.anchorMap[ye],Ne(S,!0,-1),!0}function It(S,re,be,ye){const he=ee(S);return V(S),fe(S,re),S.tag=null,S.anchor=null,S.kind=null,S.result=null,An(S,be,ye)&&S.kind==="mapping"?(q(S),!0):(le(S),fe(S,he),!1)}function Cs(S,re,be,ye,he){let Ae,M,oe=1,Te=!1,_e=!1,me=null,je,ke,Be;S.depth>=S.maxDepth&&W(S,"nesting exceeded maxDepth ("+S.maxDepth+")"),S.depth+=1,S.listener!==null&&S.listener("open",S),S.tag=null,S.anchor=null,S.kind=null,S.result=null;const H=Ae=M=p===be||d===be;if(ye&&Ne(S,!0,-1)&&(Te=!0,S.lineIndent>re?oe=1:S.lineIndent===re?oe=0:S.lineIndent<re&&(oe=-1)),oe===1)for(;;){const se=S.input.charCodeAt(S.position),ge=ee(S);if(Te&&(se===33&&S.tag!==null||se===38&&S.anchor!==null)||!Tn(S)&&!Di(S))break;me===null&&(me=ge),Ne(S,!0,-1)?(Te=!0,M=H,S.lineIndent>re?oe=1:S.lineIndent===re?oe=0:S.lineIndent<re&&(oe=-1)):M=!1}if(M&&(M=Te||he),oe===1||p===be)if(h===be||f===be?ke=re:ke=re+1,Be=S.position-S.lineStart,oe===1)if(M&&(qs(S,Be)||An(S,Be,ke))||vi(S,ke))_e=!0;else{const se=S.input.charCodeAt(S.position);me!==null&&H&&!M&&se!==124&&se!==62&&It(S,me,me.position-me.lineStart,ke)||Ae&&Kn(S,ke)||Ls(S,ke)||zs(S,ke)?_e=!0:_i(S)?(_e=!0,(S.tag!==null||S.anchor!==null)&&W(S,"alias node should not have any properties")):St(S,ke,h===be)&&(_e=!0,S.tag===null&&(S.tag="?")),S.anchor!==null&&X(S,S.anchor,S.result)}else oe===0&&(_e=M&&qs(S,Be));if(S.tag===null)S.anchor!==null&&X(S,S.anchor,S.result);else if(S.tag==="?"){S.result!==null&&S.kind!=="scalar"&&W(S,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+S.kind+'"');for(let se=0,ge=S.implicitTypes.length;se<ge;se+=1)if(je=S.implicitTypes[se],je.resolve(S.result)){S.result=je.construct(S.result),S.tag=je.tag,S.anchor!==null&&X(S,S.anchor,S.result);break}}else if(S.tag!=="!"){if(u.call(S.typeMap[S.kind||"fallback"],S.tag))je=S.typeMap[S.kind||"fallback"][S.tag];else{je=null;const se=S.typeMap.multi[S.kind||"fallback"];for(let ge=0,Pe=se.length;ge<Pe;ge+=1)if(S.tag.slice(0,se[ge].tag.length)===se[ge].tag){je=se[ge];break}}je||W(S,"unknown tag !<"+S.tag+">"),S.result!==null&&je.kind!==S.kind&&W(S,"unacceptable node kind for !<"+S.tag+'> tag; it should be "'+je.kind+'", not "'+S.kind+'"'),je.resolve(S.result,S.tag)?(S.result=je.construct(S.result,S.tag),S.anchor!==null&&X(S,S.anchor,S.result)):W(S,"cannot resolve a node with !<"+S.tag+"> explicit tag")}return S.listener!==null&&S.listener("close",S),S.depth-=1,S.tag!==null||S.anchor!==null||_e}function ls(S){const re=S.position;let be=!1,ye;for(S.version=null,S.checkLineBreaks=S.legacy,S.tagMap=Object.create(null),S.anchorMap=Object.create(null);(ye=S.input.charCodeAt(S.position))!==0&&(Ne(S,!0,-1),ye=S.input.charCodeAt(S.position),!(S.lineIndent>0||ye!==37));){be=!0,ye=S.input.charCodeAt(++S.position);let he=S.position;for(;ye!==0&&!D(ye);)ye=S.input.charCodeAt(++S.position);const Ae=S.input.slice(he,S.position),M=[];for(Ae.length<1&&W(S,"directive name must not be less than one character in length");ye!==0;){for(;R(ye);)ye=S.input.charCodeAt(++S.position);if(ye===35){do ye=S.input.charCodeAt(++S.position);while(ye!==0&&!C(ye));break}if(C(ye))break;for(he=S.position;ye!==0&&!D(ye);)ye=S.input.charCodeAt(++S.position);M.push(S.input.slice(he,S.position))}ye!==0&&Je(S),u.call(ie,Ae)?ie[Ae](S,Ae,M):te(S,'unknown document directive "'+Ae+'"')}if(Ne(S,!0,-1),S.lineIndent===0&&S.input.charCodeAt(S.position)===45&&S.input.charCodeAt(S.position+1)===45&&S.input.charCodeAt(S.position+2)===45?(S.position+=3,Ne(S,!0,-1)):be&&W(S,"directives end mark is expected"),Cs(S,S.lineIndent-1,p,!1,!0),Ne(S,!0,-1),S.checkLineBreaks&&k.test(S.input.slice(re,S.position))&&te(S,"non-ASCII line breaks are interpreted as content"),S.documents.push(S.result),S.position===S.lineStart&&Ue(S)){S.input.charCodeAt(S.position)===46&&(S.position+=3,Ne(S,!0,-1));return}S.position<S.length-1&&W(S,"end of the stream or a document separator is expected")}function gn(S,re){S=String(S),re=re||{},S.length!==0&&(S.charCodeAt(S.length-1)!==10&&S.charCodeAt(S.length-1)!==13&&(S+=`
196
- `),S.charCodeAt(0)===65279&&(S=S.slice(1)));const be=new I(S,re),ye=S.indexOf("\0");for(ye!==-1&&(be.position=ye,W(be,"null byte is not allowed in input")),be.input+="\0";be.input.charCodeAt(be.position)===32;)be.lineIndent+=1,be.position+=1;for(;be.position<be.length-1;)ls(be);return be.documents}function xn(S,re,be){re!==null&&typeof re=="object"&&typeof be>"u"&&(be=re,re=null);const ye=gn(S,be);if(typeof re!="function")return ye;for(let he=0,Ae=ye.length;he<Ae;he+=1)re(ye[he])}function Oi(S,re){const be=gn(S,re);if(be.length!==0){if(be.length===1)return be[0];throw new n("expected a single document in the stream, but found more")}}t.exports.loadAll=xn,t.exports.load=Oi})),oZ=Yt(((e,t)=>{var s=yu(),n=wu(),o=vv(),l=Object.prototype.toString,u=Object.prototype.hasOwnProperty,h=65279,f=9,d=10,p=13,g=32,x=33,v=34,w=35,k=37,N=38,E=39,T=42,A=44,C=45,R=58,D=61,$=62,O=63,P=64,B=91,G=93,F=96,z=123,U=124,K=125,I={};I[0]="\\0",I[7]="\\a",I[8]="\\b",I[9]="\\t",I[10]="\\n",I[11]="\\v",I[12]="\\f",I[13]="\\r",I[27]="\\e",I[34]='\\"',I[92]="\\\\",I[133]="\\N",I[160]="\\_",I[8232]="\\L",I[8233]="\\P";var Z=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],W=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function te(M,oe){if(oe===null)return{};const Te={},_e=Object.keys(oe);for(let me=0,je=_e.length;me<je;me+=1){let ke=_e[me],Be=String(oe[ke]);ke.slice(0,2)==="!!"&&(ke="tag:yaml.org,2002:"+ke.slice(2));const H=M.compiledTypeMap.fallback[ke];H&&u.call(H.styleAliases,Be)&&(Be=H.styleAliases[Be]),Te[ke]=Be}return Te}function X(M){let oe,Te;const _e=M.toString(16).toUpperCase();if(M<=255)oe="x",Te=2;else if(M<=65535)oe="u",Te=4;else if(M<=4294967295)oe="U",Te=8;else throw new n("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+oe+s.repeat("0",Te-_e.length)+_e}var V=1,q=2;function le(M){this.schema=M.schema||o,this.indent=Math.max(1,M.indent||2),this.noArrayIndent=M.noArrayIndent||!1,this.skipInvalid=M.skipInvalid||!1,this.flowLevel=s.isNothing(M.flowLevel)?-1:M.flowLevel,this.styleMap=te(this.schema,M.styles||null),this.sortKeys=M.sortKeys||!1,this.lineWidth=M.lineWidth||80,this.noRefs=M.noRefs||!1,this.noCompatMode=M.noCompatMode||!1,this.condenseFlow=M.condenseFlow||!1,this.quotingType=M.quotingType==='"'?q:V,this.forceQuotes=M.forceQuotes||!1,this.replacer=typeof M.replacer=="function"?M.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function ee(M,oe){const Te=s.repeat(" ",oe);let _e=0,me="";const je=M.length;for(;_e<je;){let ke;const Be=M.indexOf(`
197
- `,_e);Be===-1?(ke=M.slice(_e),_e=je):(ke=M.slice(_e,Be+1),_e=Be+1),ke.length&&ke!==`
198
- `&&(me+=Te),me+=ke}return me}function fe(M,oe){return`
199
- `+s.repeat(" ",M.indent*oe)}function ie(M,oe){for(let Te=0,_e=M.implicitTypes.length;Te<_e;Te+=1)if(M.implicitTypes[Te].resolve(oe))return!0;return!1}function Se(M){return M===g||M===f}function Me(M){return M>=32&&M<=126||M>=161&&M<=55295&&M!==8232&&M!==8233||M>=57344&&M<=65533&&M!==h||M>=65536&&M<=1114111}function De(M){return Me(M)&&M!==h&&M!==p&&M!==d}function Je(M,oe,Te){const _e=De(M),me=_e&&!Se(M);return(Te?_e:_e&&M!==A&&M!==B&&M!==G&&M!==z&&M!==K)&&M!==w&&!(oe===R&&!me)||De(oe)&&!Se(oe)&&M===w||oe===R&&me}function Ne(M){return Me(M)&&M!==h&&!Se(M)&&M!==C&&M!==O&&M!==R&&M!==A&&M!==B&&M!==G&&M!==z&&M!==K&&M!==w&&M!==N&&M!==T&&M!==x&&M!==U&&M!==D&&M!==$&&M!==E&&M!==v&&M!==k&&M!==P&&M!==F}function Ue(M){return!Se(M)&&M!==R}function $e(M,oe){const Te=M.charCodeAt(oe);let _e;return Te>=55296&&Te<=56319&&oe+1<M.length&&(_e=M.charCodeAt(oe+1),_e>=56320&&_e<=57343)?(Te-55296)*1024+_e-56320+65536:Te}function St(M){return/^\n* /.test(M)}var Ls=1,zs=2,vi=3,Kn=4,qs=5;function An(M,oe,Te,_e,me,je,ke,Be){let H,se=0,ge=null,Pe=!1,it=!1;const Et=_e!==-1;let qe=-1,He=Ne($e(M,0))&&Ue($e(M,M.length-1));if(oe||ke)for(H=0;H<M.length;se>=65536?H+=2:H++){if(se=$e(M,H),!Me(se))return qs;He=He&&Je(se,ge,Be),ge=se}else{for(H=0;H<M.length;se>=65536?H+=2:H++){if(se=$e(M,H),se===d)Pe=!0,Et&&(it=it||H-qe-1>_e&&M[qe+1]!==" ",qe=H);else if(!Me(se))return qs;He=He&&Je(se,ge,Be),ge=se}it=it||Et&&H-qe-1>_e&&M[qe+1]!==" "}return!Pe&&!it?He&&!ke&&!me(M)?Ls:je===q?qs:zs:Te>9&&St(M)?qs:ke?je===q?qs:zs:it?Kn:vi}function Tn(M,oe,Te,_e,me){M.dump=(function(){if(oe.length===0)return M.quotingType===q?'""':"''";if(!M.noCompatMode&&(Z.indexOf(oe)!==-1||W.test(oe)))return M.quotingType===q?'"'+oe+'"':"'"+oe+"'";const je=M.indent*Math.max(1,Te),ke=M.lineWidth===-1?-1:Math.max(Math.min(M.lineWidth,40),M.lineWidth-je),Be=_e||M.flowLevel>-1&&Te>=M.flowLevel;function H(se){return ie(M,se)}switch(An(oe,Be,M.indent,ke,H,M.quotingType,M.forceQuotes&&!_e,me)){case Ls:return oe;case zs:return"'"+oe.replace(/'/g,"''")+"'";case vi:return"|"+Di(oe,M.indent)+_i(ee(oe,je));case Kn:return">"+Di(oe,M.indent)+_i(ee(It(oe,ke),je));case qs:return'"'+ls(oe)+'"';default:throw new n("impossible error: invalid scalar style")}})()}function Di(M,oe){const Te=St(M)?String(oe):"",_e=M[M.length-1]===`
200
- `;return Te+(_e&&(M[M.length-2]===`
201
- `||M===`
202
- `)?"+":_e?"":"-")+`
203
- `}function _i(M){return M[M.length-1]===`
204
- `?M.slice(0,-1):M}function It(M,oe){const Te=/(\n+)([^\n]*)/g;let _e=(function(){let Be=M.indexOf(`
205
- `);return Be=Be!==-1?Be:M.length,Te.lastIndex=Be,Cs(M.slice(0,Be),oe)})(),me=M[0]===`
206
- `||M[0]===" ",je,ke;for(;ke=Te.exec(M);){const Be=ke[1],H=ke[2];je=H[0]===" ",_e+=Be+(!me&&!je&&H!==""?`
207
- `:"")+Cs(H,oe),me=je}return _e}function Cs(M,oe){if(M===""||M[0]===" ")return M;const Te=/ [^ ]/g;let _e,me=0,je,ke=0,Be=0,H="";for(;_e=Te.exec(M);)Be=_e.index,Be-me>oe&&(je=ke>me?ke:Be,H+=`
208
- `+M.slice(me,je),me=je+1),ke=Be;return H+=`
209
- `,M.length-me>oe&&ke>me?H+=M.slice(me,ke)+`
210
- `+M.slice(ke+1):H+=M.slice(me),H.slice(1)}function ls(M){let oe="",Te=0;for(let _e=0;_e<M.length;Te>=65536?_e+=2:_e++){Te=$e(M,_e);const me=I[Te];!me&&Me(Te)?(oe+=M[_e],Te>=65536&&(oe+=M[_e+1])):oe+=me||X(Te)}return oe}function gn(M,oe,Te){let _e="";const me=M.tag;for(let je=0,ke=Te.length;je<ke;je+=1){let Be=Te[je];M.replacer&&(Be=M.replacer.call(Te,String(je),Be)),(be(M,oe,Be,!1,!1)||typeof Be>"u"&&be(M,oe,null,!1,!1))&&(_e!==""&&(_e+=","+(M.condenseFlow?"":" ")),_e+=M.dump)}M.tag=me,M.dump="["+_e+"]"}function xn(M,oe,Te,_e){let me="";const je=M.tag;for(let ke=0,Be=Te.length;ke<Be;ke+=1){let H=Te[ke];M.replacer&&(H=M.replacer.call(Te,String(ke),H)),(be(M,oe+1,H,!0,!0,!1,!0)||typeof H>"u"&&be(M,oe+1,null,!0,!0,!1,!0))&&((!_e||me!=="")&&(me+=fe(M,oe)),M.dump&&d===M.dump.charCodeAt(0)?me+="-":me+="- ",me+=M.dump)}M.tag=je,M.dump=me||"[]"}function Oi(M,oe,Te){let _e="";const me=M.tag,je=Object.keys(Te);for(let ke=0,Be=je.length;ke<Be;ke+=1){let H="";_e!==""&&(H+=", "),M.condenseFlow&&(H+='"');const se=je[ke];let ge=Te[se];M.replacer&&(ge=M.replacer.call(Te,se,ge)),be(M,oe,se,!1,!1)&&(M.dump.length>1024&&(H+="? "),H+=M.dump+(M.condenseFlow?'"':"")+":"+(M.condenseFlow?"":" "),be(M,oe,ge,!1,!1)&&(H+=M.dump,_e+=H))}M.tag=me,M.dump="{"+_e+"}"}function S(M,oe,Te,_e){let me="";const je=M.tag,ke=Object.keys(Te);if(M.sortKeys===!0)ke.sort();else if(typeof M.sortKeys=="function")ke.sort(M.sortKeys);else if(M.sortKeys)throw new n("sortKeys must be a boolean or a function");for(let Be=0,H=ke.length;Be<H;Be+=1){let se="";(!_e||me!=="")&&(se+=fe(M,oe));const ge=ke[Be];let Pe=Te[ge];if(M.replacer&&(Pe=M.replacer.call(Te,ge,Pe)),!be(M,oe+1,ge,!0,!0,!0))continue;const it=M.tag!==null&&M.tag!=="?"||M.dump&&M.dump.length>1024;it&&(M.dump&&d===M.dump.charCodeAt(0)?se+="?":se+="? "),se+=M.dump,it&&(se+=fe(M,oe)),be(M,oe+1,Pe,!0,it)&&(M.dump&&d===M.dump.charCodeAt(0)?se+=":":se+=": ",se+=M.dump,me+=se)}M.tag=je,M.dump=me||"{}"}function re(M,oe,Te){const _e=Te?M.explicitTypes:M.implicitTypes;for(let me=0,je=_e.length;me<je;me+=1){const ke=_e[me];if((ke.instanceOf||ke.predicate)&&(!ke.instanceOf||typeof oe=="object"&&oe instanceof ke.instanceOf)&&(!ke.predicate||ke.predicate(oe))){if(Te?ke.multi&&ke.representName?M.tag=ke.representName(oe):M.tag=ke.tag:M.tag="?",ke.represent){const Be=M.styleMap[ke.tag]||ke.defaultStyle;let H;if(l.call(ke.represent)==="[object Function]")H=ke.represent(oe,Be);else if(u.call(ke.represent,Be))H=ke.represent[Be](oe,Be);else throw new n("!<"+ke.tag+'> tag resolver accepts not "'+Be+'" style');M.dump=H}return!0}}return!1}function be(M,oe,Te,_e,me,je,ke){M.tag=null,M.dump=Te,re(M,Te,!1)||re(M,Te,!0);const Be=l.call(M.dump),H=_e;_e&&(_e=M.flowLevel<0||M.flowLevel>oe);const se=Be==="[object Object]"||Be==="[object Array]";let ge,Pe;if(se&&(ge=M.duplicates.indexOf(Te),Pe=ge!==-1),(M.tag!==null&&M.tag!=="?"||Pe||M.indent!==2&&oe>0)&&(me=!1),Pe&&M.usedDuplicates[ge])M.dump="*ref_"+ge;else{if(se&&Pe&&!M.usedDuplicates[ge]&&(M.usedDuplicates[ge]=!0),Be==="[object Object]")_e&&Object.keys(M.dump).length!==0?(S(M,oe,M.dump,me),Pe&&(M.dump="&ref_"+ge+M.dump)):(Oi(M,oe,M.dump),Pe&&(M.dump="&ref_"+ge+" "+M.dump));else if(Be==="[object Array]")_e&&M.dump.length!==0?(M.noArrayIndent&&!ke&&oe>0?xn(M,oe-1,M.dump,me):xn(M,oe,M.dump,me),Pe&&(M.dump="&ref_"+ge+M.dump)):(gn(M,oe,M.dump),Pe&&(M.dump="&ref_"+ge+" "+M.dump));else if(Be==="[object String]")M.tag!=="?"&&Tn(M,M.dump,oe,je,H);else{if(Be==="[object Undefined]")return!1;if(M.skipInvalid)return!1;throw new n("unacceptable kind of an object to dump "+Be)}if(M.tag!==null&&M.tag!=="?"){let it=encodeURI(M.tag[0]==="!"?M.tag.slice(1):M.tag).replace(/!/g,"%21");M.tag[0]==="!"?it="!"+it:it.slice(0,18)==="tag:yaml.org,2002:"?it="!!"+it.slice(18):it="!<"+it+">",M.dump=it+" "+M.dump}}return!0}function ye(M,oe){const Te=[],_e=[];he(M,Te,_e);const me=_e.length;for(let je=0;je<me;je+=1)oe.duplicates.push(Te[_e[je]]);oe.usedDuplicates=new Array(me)}function he(M,oe,Te){if(M!==null&&typeof M=="object"){const _e=oe.indexOf(M);if(_e!==-1)Te.indexOf(_e)===-1&&Te.push(_e);else if(oe.push(M),Array.isArray(M))for(let me=0,je=M.length;me<je;me+=1)he(M[me],oe,Te);else{const me=Object.keys(M);for(let je=0,ke=me.length;je<ke;je+=1)he(M[me[je]],oe,Te)}}}function Ae(M,oe){oe=oe||{};const Te=new le(oe);Te.noRefs||ye(M,Te);let _e=M;return Te.replacer&&(_e=Te.replacer.call({"":_e},"",_e)),be(Te,0,_e,!0,!0)?Te.dump+`
211
- `:""}t.exports.dump=Ae})),Q5=iZ(Yt(((e,t)=>{var s=aZ(),n=oZ();function o(l,u){return function(){throw new Error("Function yaml."+l+" is removed in js-yaml 4. Use yaml."+u+" instead, which is now safe by default.")}}t.exports.Type=pn(),t.exports.Schema=L5(),t.exports.FAILSAFE_SCHEMA=I5(),t.exports.JSON_SCHEMA=q5(),t.exports.CORE_SCHEMA=V5(),t.exports.DEFAULT_SCHEMA=vv(),t.exports.load=s.load,t.exports.loadAll=s.loadAll,t.exports.dump=n.dump,t.exports.YAMLException=wu(),t.exports.types={binary:K5(),float:F5(),map:P5(),null:$5(),pairs:X5(),set:Z5(),timestamp:G5(),bool:H5(),int:U5(),merge:W5(),omap:Y5(),seq:B5(),str:z5()},t.exports.safeLoad=o("safeLoad","load"),t.exports.safeLoadAll=o("safeLoadAll","loadAll"),t.exports.safeDump=o("safeDump","dump")}))()),{Type:RJ,Schema:MJ,FAILSAFE_SCHEMA:DJ,JSON_SCHEMA:OJ,CORE_SCHEMA:LJ,DEFAULT_SCHEMA:zJ,load:BJ,loadAll:PJ,dump:IJ,YAMLException:$J,types:HJ,safeLoad:UJ,safeLoadAll:FJ,safeDump:qJ}=Q5.default,lZ=Q5.default;function J5(e){return e!==null&&typeof e=="object"}function e4(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 t4(e){return e==null?"null":typeof e=="string"?e===""?'""':e:String(e)}function s4({label:e,value:t,depth:s,defaultOpen:n}){const[o,l]=_.useState(n),u={paddingLeft:`${s*1.1}rem`};if(!J5(t))return i.jsxs("div",{className:"flex items-baseline gap-2 py-[1px]",style:u,children:[i.jsxs("span",{className:"text-muted-foreground",children:[e,":"]}),i.jsx("span",{className:ae("whitespace-pre-wrap break-words",e4(t)),children:t4(t)})]});const h=Array.isArray(t)?t.map((d,p)=>[String(p),d]):Object.entries(t),f=Array.isArray(t)?`[${h.length}]`:`{${h.length}}`;return i.jsxs("div",{children:[i.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?i.jsx(Wn,{className:"size-3.5 shrink-0 text-muted-foreground"}):i.jsx(jn,{className:"size-3.5 shrink-0 text-muted-foreground"}),i.jsx("span",{className:"font-medium text-foreground",children:e}),i.jsx("span",{className:"text-muted-foreground",children:f})]}),o?h.map(([d,p])=>i.jsx(s4,{label:d,value:p,depth:s+1,defaultOpen:s<1},d)):null]})}function cZ({content:e}){const t=_.useMemo(()=>{try{const n=lZ.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 i.jsx("div",{className:"p-4",children:i.jsxs(Qe,{variant:"destructive",children:["Could not parse YAML: ",t.error]})});if(!J5(t.value))return i.jsx("div",{className:"p-4 font-mono text-[12px]",children:i.jsx("span",{className:e4(t.value),children:t4(t.value)})});const s=Array.isArray(t.value)?t.value.map((n,o)=>[String(o),n]):Object.entries(t.value);return i.jsx("div",{className:"min-w-max px-4 py-3 font-mono text-[12px] leading-[1.6]",children:s.map(([n,o])=>i.jsx(s4,{label:n,value:o,depth:0,defaultOpen:!0},n))})}const uZ=_.lazy(()=>lu(()=>import("./code-editor-B8IA745f.js"),[]).then(e=>({default:e.CodeEditor})));function dZ(e){const t=e.split("/").pop()?.toLowerCase().split(".").pop()??"";return t==="md"||t==="mdx"||t==="markdown"?"markdown":t==="yml"||t==="yaml"?"yaml":null}function hZ(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 fZ(e,t){const s=e.endsWith(`
212
- `)?e.slice(0,-1):e;return!t||!G0.getLanguage(t)?s.split(`
213
- `).map(DN):s.split(`
214
- `).map(n=>{if(!n)return"";try{return G0.highlight(n,{language:t,ignoreIllegals:!0}).value}catch{return DN(n)}})}function DN(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function mZ({content:e,path:t}){const s=_.useMemo(()=>hZ(t),[t]),n=_.useMemo(()=>fZ(e,s),[e,s]),o=`${Math.max(2,String(n.length).length)}ch`;return i.jsx("div",{className:"min-w-max font-mono text-[12px] leading-[1.5]",children:n.map((l,u)=>i.jsxs("div",{className:"flex",children:[i.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}),i.jsx("span",{className:"hljs whitespace-pre px-3 text-zinc-800 dark:text-zinc-100",dangerouslySetInnerHTML:{__html:l||" "}})]},u))})}function pZ({path:e,isModified:t,onViewDiff:s,onFileSaved:n,onSendToAi:o}){const[l,u]=_.useState(null),[h,f]=_.useState(""),[d,p]=_.useState(!1),[g,x]=_.useState(null),[v,w]=_.useState(!1),[k,N]=_.useState(!1),{success:E,error:T}=as(),A=_.useMemo(()=>dZ(e),[e]),[C,R]=_.useState("preview"),D=!!(l&&!l.binary&&!l.truncated),$=l?h!==l.content:!1;_.useEffect(()=>{R(A?"preview":"source"),p(!1)},[A]),_.useEffect(()=>{if(!e){u(null);return}let B=!0;return w(!0),x(null),p(!1),V7(e).then(G=>{B&&(u(G),f(G.content),w(!1))}).catch(G=>{B&&(x(G instanceof Error?G.message:String(G)),w(!1))}),()=>{B=!1}},[e]);async function O(){if(!(!e||!l||!$||k)){N(!0);try{await G7(e,h);const B={...l,content:h,size:new TextEncoder().encode(h).length};u(B),p(!1),E(`Saved ${e}.`),n?.(e)}catch(B){T(B instanceof Error?B.message:String(B))}finally{N(!1)}}}function P(){f(l?.content??""),p(!1)}return e?i.jsxs("section",{className:"flex min-h-0 min-w-0 flex-col border-l border-border bg-card",children:[i.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-1.5",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:e}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-muted-foreground",children:[i.jsx("span",{children:"Read-only view of tracked file."}),l?.truncated?i.jsx("span",{className:"text-amber-700",children:"Truncated — file exceeds 1MB."}):null,l?.binary?i.jsx("span",{className:"text-amber-700",children:"Binary file."}):null]})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[A&&!l?.binary?i.jsxs("div",{className:"flex items-center rounded-md border border-border p-0.5",children:[i.jsxs("button",{type:"button",onClick:()=>R("preview"),"aria-pressed":C==="preview",className:ae("flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium transition-colors",C==="preview"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"),children:[i.jsx(mf,{className:"size-3.5"}),"Preview"]}),i.jsxs("button",{type:"button",onClick:()=>R("source"),"aria-pressed":C==="source",className:ae("flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium transition-colors",C==="source"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"),children:[i.jsx(cC,{className:"size-3.5"}),"Source"]})]}):null,t?i.jsx(J,{onClick:s,size:"sm",type:"button",variant:"outline",children:"View diff"}):null,o?i.jsx(J,{"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:i.jsx(qt,{className:"size-4"})}):null,d?i.jsxs(i.Fragment,{children:[i.jsxs(J,{disabled:!$||k,onClick:()=>{O()},size:"sm",type:"button",children:[i.jsx(SC,{}),"Apply"]}),i.jsxs(J,{disabled:k,onClick:P,size:"sm",type:"button",variant:"outline",children:[i.jsx(Ut,{}),"Cancel"]})]}):D?i.jsxs(J,{onClick:()=>{R("source"),p(!0)},size:"sm",type:"button",variant:"outline",children:[i.jsx(dl,{}),"Edit"]}):null]})]}),i.jsx("div",{className:"min-h-0 flex-1 overflow-auto bg-card",children:g?i.jsx("div",{className:"p-4",children:i.jsx(Qe,{variant:"destructive",children:g})}):v?i.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading…"}):l?.binary?i.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Cannot display binary content."}):l?d?i.jsx(_.Suspense,{fallback:i.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading editor…"}),children:i.jsx(uZ,{path:e,value:h,onChange:f})}):A&&C==="preview"?A==="markdown"?i.jsx(bv,{content:l.content}):i.jsx(cZ,{content:l.content}):i.jsx(mZ,{content:l.content,path:e}):null})]}):i.jsx("div",{className:"p-4",children:i.jsx(Qe,{variant:"muted",className:"border-dashed p-12 text-center",children:"Select a file to view its contents."})})}function gZ({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 ON(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 LN({label:e,tree:t,onSelect:s,defaultOpen:n,forceOpen:o}){const[l,u]=_.useState(n??!1),h=o||l,f=t.children.size===0;return i.jsxs("div",{className:"mb-1",children:[i.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?i.jsx(Wn,{size:12}):i.jsx(jn,{size:12}),e,f?null:i.jsxs("span",{className:"ml-1 text-[10px] font-normal",children:["(",t.children.size,")"]})]}),h&&!f?i.jsx("ul",{children:Array.from(t.children.values()).map(d=>i.jsx(n4,{node:d,depth:1,onSelect:s,forceOpen:o},d.fullPath))}):null]})}function n4({node:e,depth:t,onSelect:s,forceOpen:n}){const[o,l]=_.useState(!0),u=n||o,h=e.children.size>0,f=e.branch,d={paddingLeft:`${t*10}px`};return!h&&f?i.jsx("li",{children:i.jsxs("button",{type:"button",onClick:()=>s(f),style:d,title:f.name,className:`flex w-full items-center gap-1.5 py-0.5 pr-2 text-left text-[12px] hover:bg-muted/60 ${f.current?"font-semibold text-emerald-700":""}`,children:[i.jsx(Gn,{size:11,className:"shrink-0 opacity-70"}),i.jsx("span",{className:"truncate",children:e.name}),f.current?i.jsx("span",{className:"text-[10px]",children:"●"}):null]})}):i.jsxs("li",{children:[i.jsxs("button",{type:"button",onClick:()=>{f?s(f):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?i.jsx(Wn,{size:11}):i.jsx(jn,{size:11}):i.jsx("span",{className:"inline-block w-[11px]"}),i.jsx("span",{className:"truncate",children:e.name})]}),u&&h?i.jsx("ul",{children:Array.from(e.children.values()).map(p=>i.jsx(n4,{node:p,depth:t+1,onSelect:s,forceOpen:n},p.fullPath))}):null]})}function xZ({selectedCommit:e,selectedFile:t,diff:s,diffLoading:n,diffError:o}){return i.jsxs("section",{className:"flex min-h-0 min-w-0 flex-col bg-card border-b border-border",children:[i.jsx("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-1.5",children:i.jsxs("div",{className:"min-w-0",children:[i.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:t??(e?e.subject:"Commit")}),e?i.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-muted-foreground",children:[i.jsx("span",{className:"font-mono",children:e.hash.slice(0,12)}),i.jsxs("span",{children:[e.author," <",e.email,">"]}),i.jsx("span",{children:new Date(e.timestamp*1e3).toLocaleString()})]}):null]})}),i.jsx("div",{className:"relative min-h-0 min-w-0 flex-1",children:o?i.jsx("div",{className:"p-4",children:i.jsx(Qe,{variant:"destructive",children:o})}):e?n?i.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading diff…"}):s?i.jsx(fu,{activeHunkIndex:0,diff:s}):i.jsx("div",{className:"p-4",children:i.jsx(Qe,{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."})}):i.jsx("div",{className:"p-4",children:i.jsx(Qe,{variant:"muted",className:"border-dashed p-12 text-center",children:"Select a commit to inspect its diff."})})})]})}function bZ({files:e,filesError:t,selectedHash:s,selectedFile:n,onSelect:o}){return i.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden border-r border-border",children:[i.jsx("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-1.5",children:i.jsxs("h2",{className:"text-[13px] font-semibold tracking-tight",children:["Files",e.length?i.jsx("span",{className:"ml-2 text-[11px] font-normal text-muted-foreground",children:e.length}):null]})}),i.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:t?i.jsx("div",{className:"p-3",children:i.jsx(Qe,{variant:"destructive",children:t})}):s?e.length===0?i.jsx("div",{className:"p-3 text-[12px] text-muted-foreground",children:"No file changes."}):i.jsx("ul",{className:"divide-y divide-border",children:e.map(l=>i.jsx("li",{children:i.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:[i.jsx("span",{className:vZ(l.index),children:l.index.trim()||"·"}),i.jsx("span",{className:"truncate font-mono",children:l.path})]})},l.path))}):i.jsx("div",{className:"p-3 text-[12px] text-muted-foreground",children:"Select a commit to see its files."})})]})}function vZ(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 zN=["#3b82f6","#10b981","#f59e0b","#ec4899","#8b5cf6","#14b8a6","#ef4444","#84cc16"];function jc(e){return zN[e%zN.length]}function _Z({lane:e,laneCount:t,edges:s,throughLanes:n,isMerge:o,height:l=28,laneWidth:u=14}){const f=Math.max(e+1,t,1)*u,d=l/2,p=Ac(e,u),g=o?4:3.5;return i.jsxs("svg",{width:f,height:l,viewBox:`0 0 ${f} ${l}`,style:{flex:"0 0 auto",display:"block"},children:[n.map(x=>i.jsx("line",{x1:Ac(x,u),y1:0,x2:Ac(x,u),y2:l,stroke:jc(x),strokeWidth:1.5},`t-${x}`)),i.jsx("line",{x1:p,y1:0,x2:p,y2:d,stroke:jc(e),strokeWidth:1.5}),s.map((x,v)=>{const w=Ac(x.fromLane,u),k=Ac(x.toLane,u);if(w===k)return i.jsx("line",{x1:w,y1:d,x2:k,y2:l,stroke:jc(x.toLane),strokeWidth:1.5},`e-${v}`);const N=d+(l-d)/2;return i.jsx("path",{d:`M ${w} ${d} C ${w} ${N}, ${k} ${N}, ${k} ${l}`,fill:"none",stroke:jc(x.toLane),strokeWidth:1.5},`e-${v}`)}),i.jsx("circle",{cx:p,cy:d,r:g,fill:jc(e),stroke:"var(--background, #fff)",strokeWidth:1.5})]})}function Ac(e,t){return e*t+t/2}const yZ=5,X0=new Map,Cx=new Map,Z0=[];let Q0=0;function BN(){for(;Q0<yZ&&Z0.length>0;){const e=Z0.shift();e&&(Q0++,e())}}function wZ(e){return X0.get(e)}function SZ(e){const t=X0.get(e);if(t)return Promise.resolve(t);const s=Cx.get(e);if(s)return s;const n=new Promise((o,l)=>{Z0.push(()=>{gO(e).then(u=>{u.state!=="pending"&&X0.set(e,u),o(u)}).catch(l).finally(()=>{Q0--,Cx.delete(e),BN()})})});return Cx.set(e,n),BN(),n}function kZ({sha:e}){const[t,s]=_.useState(()=>wZ(e)??null),n=_.useRef(null);if(_.useEffect(()=>{if(t)return;const u=n.current;if(!u||typeof IntersectionObserver>"u")return;let h=!0;const f=new IntersectionObserver(d=>{d.some(p=>p.isIntersecting)&&(f.disconnect(),SZ(e).then(p=>{h&&s(p)}).catch(()=>{}))},{rootMargin:"200px"});return f.observe(u),()=>{h=!1,f.disconnect()}},[e,t]),!t||t.state==="unknown"||t.totalCount===0)return i.jsx("span",{ref:n,"aria-hidden":!0,className:"inline-block size-2 shrink-0"});const o=NZ(t.state),l=`CI: ${t.state} (${t.totalCount} check${t.totalCount!==1?"s":""})`;return i.jsx("span",{"aria-label":l,className:`shrink-0 size-2 rounded-full ${o}`,title:l})}function NZ(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 PN=28;function CZ({commits:e,loading:t,error:s,selectedHash:n,maxLanes:o,rowRefs:l,onSelect:u,onLoadMore:h}){const{sendToAgent:f}=At(),[d,p]=_.useState(null);function g(x,v){p(null),f({prompt:tH(x,v),source:{type:"git-commit",label:x.hash.slice(0,7)},label:`${x.hash.slice(0,7)}: ${v}`})}return i.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden border-r border-border",children:[i.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-1.5",children:[i.jsxs("h2",{className:"text-[13px] font-semibold tracking-tight",children:["Commit tree",e.length?i.jsxs("span",{className:"ml-2 text-[11px] font-normal text-muted-foreground",children:[e.length," commits"]}):null]}),i.jsx(J,{disabled:t,onClick:h,size:"sm",type:"button",variant:"outline",children:"Load more"})]}),i.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:s?i.jsx("div",{className:"p-3",children:i.jsx(Qe,{variant:"destructive",children:s})}):t&&e.length===0?i.jsx("div",{className:"p-3 text-[12px] text-muted-foreground",children:"Loading commits…"}):e.length===0?i.jsx("div",{className:"p-3 text-[12px] text-muted-foreground",children:"No commits."}):i.jsx("ul",{className:"divide-y divide-border",children:e.map(x=>i.jsxs("li",{ref:v=>{v?l.current.set(x.hash,v):l.current.delete(x.hash)},className:"group flex flex-col",children:[i.jsxs("div",{className:`flex items-center transition-colors hover:bg-muted/60 ${n===x.hash?"bg-muted":""}`,children:[i.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:PN},title:`${x.hash}
215
- ${x.author} <${x.email}>
216
- ${x.subject}`,children:[i.jsx(_Z,{lane:x.lane,laneCount:Math.max(x.laneCount,o),edges:x.edges,throughLanes:x.throughLanes,isMerge:x.parents.length>1,height:PN}),i.jsxs("span",{className:"flex items-center gap-1 font-mono text-[10px] text-muted-foreground",children:[x.hash.slice(0,7),i.jsx(kZ,{sha:x.hash})]}),i.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[x.refs.map(v=>i.jsx("span",{className:jZ(v.kind),children:v.name},`${v.kind}-${v.name}`)),i.jsx("span",{className:"truncate text-[12px]",children:x.subject})]}),i.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:x.author}),i.jsx("span",{className:"shrink-0 font-mono text-[10px] tabular-nums text-muted-foreground/70",title:new Date(x.timestamp*1e3).toLocaleString(),children:EZ(x.timestamp)})]}),i.jsx(Qi,{className:`mr-1 shrink-0 ${d===x.hash?"opacity-100":""}`,label:`Ask AI about commit ${x.hash.slice(0,7)}`,onAsk:()=>p(v=>v===x.hash?null:x.hash)})]}),d===x.hash?i.jsx("div",{className:"px-2 pb-1.5 pt-0.5",children:i.jsx(Mr,{placeholder:"What should the agent do with this commit? (explain, summarize, find regressions…)",onSubmit:v=>g(x,v),onCancel:()=>p(null)})}):null]},x.hash))})})]})}function EZ(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 jZ(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 IN=200;function AZ(){const[e,t]=_.useState([]),[s,n]=_.useState(IN),[o,l]=_.useState(0),[u,h]=_.useState(!0),[f,d]=_.useState(null),[p,g]=_.useState(null),[x,v]=_.useState([]),[w,k]=_.useState(!1),[N,E]=_.useState(null),[T,A]=_.useState(null),[C,R]=_.useState(""),[D,$]=_.useState(!1),[O,P]=_.useState(null),B=_.useCallback(z=>{g(z),v([]),A(null),R("")},[]);_.useEffect(()=>{let z=!0;return h(!0),d(null),$7(s).then(U=>{z&&(t(U),U.length>0&&!U.some(K=>K.hash===p)&&B(U[0].hash))}).catch(U=>{z&&d(U instanceof Error?U.message:String(U))}).finally(()=>{z&&h(!1)}),()=>{z=!1}},[s,o]),_.useEffect(()=>{if(!p){v([]),A(null),k(!1);return}let z=!0;return E(null),k(!0),U7(p).then(U=>{z&&(v(U),A(U[0]?.path??null))}).catch(U=>{z&&E(U instanceof Error?U.message:String(U))}).finally(()=>{z&&k(!1)}),()=>{z=!1}},[p]),_.useEffect(()=>{if(!p||!T){R(""),$(!1);return}let z=!0;return P(null),$(!0),H7(p,T).then(U=>{z&&R(U)}).catch(U=>{z&&P(U instanceof Error?U.message:String(U))}).finally(()=>{z&&$(!1)}),()=>{z=!1}},[p,T]);const G=_.useMemo(()=>e.reduce((z,U)=>Math.max(z,U.laneCount),1),[e]),F=e.find(z=>z.hash===p)??null;return{commits:e,loading:u,error:f,selectedHash:p,setSelectedHash:B,files:x,filesError:N,selectedFile:T,setSelectedFile:A,diff:C,diffLoading:D||w,diffError:O,maxLanes:G,selectedCommit:F,loadMore:()=>n(z=>z+IN),refresh:()=>l(z=>z+1)}}function TZ({branches:e=[]}){const{commits:t,loading:s,error:n,selectedHash:o,setSelectedHash:l,files:u,filesError:h,selectedFile:f,setSelectedFile:d,diff:p,diffLoading:g,diffError:x,maxLanes:v,selectedCommit:w,loadMore:k,refresh:N}=AZ();vl(N);const[E,T]=_.useState(""),A=_.useMemo(()=>{const P=E.trim().toLowerCase();return P?e.filter(B=>B.name.toLowerCase().includes(P)):e},[e,E]),C=_.useMemo(()=>ON(A.filter(P=>!P.remote)),[A]),R=_.useMemo(()=>ON(A.filter(P=>P.remote)),[A]),D=E.trim().length>0,$=_.useRef(new Map);function O(P){const B=P.remote?"remote":"branch",G=t.find(U=>U.refs.some(K=>K.kind===B&&K.name===P.name));if(!G)return;l(G.hash);const F=$.current.get(G.hash),z=F?.parentElement?.parentElement;!F||!z||z.scrollTo({top:Math.max(F.offsetTop-z.clientHeight/2+F.clientHeight/2,0),behavior:"smooth"})}return i.jsxs("div",{className:"grid h-full min-h-0 overflow-hidden border-0 bg-card/85 grid-cols-[220px_minmax(0,1fr)]",children:[i.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden border-r border-border",children:[i.jsxs("div",{className:"flex shrink-0 flex-col gap-1 border-b border-border px-3 py-1.5",children:[i.jsx("h2",{className:"text-[13px] font-semibold tracking-tight",children:"Branches"}),i.jsx("input",{type:"search",value:E,onChange:P=>T(P.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"})]}),i.jsxs("div",{className:"min-h-0 flex-1 overflow-auto py-1",children:[i.jsx(LN,{label:"Local",tree:C,onSelect:O,defaultOpen:!0,forceOpen:D}),i.jsx(LN,{label:"Remote",tree:R,onSelect:O,forceOpen:D})]})]}),i.jsxs("div",{className:"grid min-h-0 min-w-0 grid-rows-[minmax(0,3fr)_minmax(0,2fr)]",children:[i.jsx(xZ,{selectedCommit:w,selectedFile:f,diff:p,diffLoading:g,diffError:x}),i.jsxs("div",{className:"grid min-h-0 min-w-0 grid-cols-[minmax(0,1fr)_280px]",children:[i.jsx(CZ,{commits:t,loading:s,error:n,selectedHash:o,maxLanes:v,rowRefs:$,onSelect:l,onLoadMore:k}),i.jsx(bZ,{files:u,filesError:h,selectedHash:o,selectedFile:f,onSelect:d})]})]})]})}function RZ({repo:e,file:t,onClose:s}){const[n,o]=_.useState(""),[l,u]=_.useState(null),[h,f]=_.useState(!0);_.useEffect(()=>{let p=!0;return f(!0),u(null),HC(t,e).then(g=>{p&&o(g)}).catch(g=>{p&&u(g instanceof Error?g.message:String(g))}).finally(()=>{p&&f(!1)}),()=>{p=!1}},[e,t]),_.useEffect(()=>{function p(g){g.key==="Escape"&&s()}return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[s]);const d=Gb(n);return tr.createPortal(i.jsxs("div",{className:"fixed inset-0 z-[1000] flex justify-end",children:[i.jsx("button",{"aria-label":"Close diff",className:"absolute inset-0 bg-black/35",onClick:s,type:"button"}),i.jsxs("div",{className:"relative z-10 flex h-full w-[min(900px,calc(100vw-3rem))] flex-col bg-card shadow-xl",children:[i.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-2",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:t}),i.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground",children:[i.jsx("span",{className:"font-mono",children:e}),d.additions||d.deletions?i.jsxs("span",{className:"flex items-center gap-1 font-mono",children:[i.jsxs("span",{className:"text-emerald-700",children:["+",d.additions]}),i.jsxs("span",{className:"text-red-700",children:["-",d.deletions]})]}):null]})]}),i.jsx(J,{"aria-label":"Close diff",onClick:s,size:"icon",variant:"ghost",children:i.jsx(Ut,{})})]}),i.jsx("div",{className:"relative min-h-0 min-w-0 flex-1",children:l?i.jsx("div",{className:"p-4",children:i.jsx(Qe,{variant:"destructive",children:l})}):h?i.jsx("div",{className:"p-4 text-xs text-muted-foreground",children:"Loading diff…"}):i.jsx(fu,{diff:n||"No unstaged diff for this file."})})]})]}),document.body)}function i4(e){return e.split(/[\\/]/).filter(Boolean).pop()??"project"}function MZ({initialPath:e,onSelect:t,selectedPath:s}){const[n,o]=_.useState(e),[l,u]=_.useState(e),[h,f]=_.useState(null),[d,p]=_.useState(null),[g,x]=_.useState(!1),v=DZ(h);return _.useEffect(()=>{o(e)},[e]),_.useEffect(()=>{h&&u(h.path)},[h]),_.useEffect(()=>{let w=!0;return x(!0),p(null),YC(n).then(k=>{w&&(f(k),t(k.path))}).catch(k=>{w&&p(k instanceof Error?k.message:String(k))}).finally(()=>{w&&x(!1)}),()=>{w=!1}},[n,t]),i.jsxs("div",{className:"rounded-md border border-border bg-background",children:[i.jsxs("div",{className:"flex items-center gap-2 border-b border-border p-2",children:[v?i.jsx(J,{"aria-label":"Open parent folder",onClick:()=>h&&o(h.parent),size:"icon",type:"button",variant:"ghost",children:i.jsx(Wn,{className:"rotate-90"})}):null,i.jsx(dt,{"aria-label":"Folder path",className:"h-7 min-w-0 flex-1 font-mono text-xs",onChange:w=>u(w.target.value),onKeyDown:w=>{if(w.key==="Enter"){w.preventDefault();const k=l.trim();k&&o(k)}},spellCheck:!1,value:l}),g?i.jsx(jt,{className:"size-4 shrink-0 animate-spin text-muted-foreground"}):null]}),i.jsxs("div",{className:"max-h-56 overflow-auto p-1",children:[d?i.jsx(Qe,{variant:"destructive",className:"m-1",children:d}):null,!d&&h?.entries.length===0?i.jsx(Qe,{variant:"muted",className:"m-1 text-center",children:"No folders here."}):null,h?.entries.map(w=>i.jsxs(J,{className:ae("h-8 w-full justify-start rounded-sm px-2 text-left",s===w.path&&"bg-muted"),onClick:()=>o(w.path),title:w.path,type:"button",variant:"ghost",children:[i.jsx(co,{className:"text-accent"}),i.jsx("span",{className:"truncate",children:w.name})]},w.path))]})]})}function DZ(e){return!!(e&&e.parent!==e.path)}function r4({confirmLabel:e="Use this folder",errorMessage:t,initialPath:s,onCancel:n,onSelect:o,onUse:l,selectedPath:u,title:h="Choose Git Project Folder"}){return tr.createPortal(i.jsx("div",{className:"fixed inset-0 z-[1000] grid place-items-center bg-black/35 px-4",children:i.jsxs("div",{className:"w-full max-w-2xl rounded-xl border border-border bg-card p-4 shadow-xl",children:[i.jsxs("div",{className:"mb-3 flex items-center gap-3",children:[i.jsx("div",{className:"flex size-8 items-center justify-center rounded-lg border border-border bg-background",children:i.jsx(co,{className:"size-4"})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("div",{className:"text-sm font-semibold",children:h}),i.jsx("div",{className:"truncate font-mono text-xs text-muted-foreground",children:u})]}),i.jsx(J,{"aria-label":"Close folder picker",onClick:n,size:"icon",variant:"ghost",children:i.jsx(Ut,{})})]}),i.jsx(MZ,{initialPath:s,onSelect:o,selectedPath:u}),t?i.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,i.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[i.jsx(J,{onClick:n,type:"button",variant:"outline",children:"Cancel"}),i.jsx(J,{onClick:()=>{l()},type:"button",children:e})]})]})}),document.body)}const Tc=5,OZ=240,J0=8,LZ=176+J0;function zZ({currentRepoPath:e}){const[t,s]=_.useState(null),[n,o]=_.useState([]),[l,u]=_.useState(null),[h,f]=_.useState(!0),[d,p]=_.useState(null),g=_.useRef(null),x=_.useRef(null),[v,w]=_.useState(0);_.useEffect(()=>{const z=x.current;if(!z)return;const U=new ResizeObserver(K=>{w(K[0].contentRect.width)});return U.observe(z),()=>U.disconnect()},[t]);const k=_.useCallback(()=>{let z=!0;return f(!0),u(null),Qp().then(U=>{z&&(s(U.repos),o(U.board))}).catch(U=>{z&&u(U instanceof Error?U.message:String(U))}).finally(()=>{z&&f(!1)}),()=>{z=!1}},[]);_.useEffect(k,[k]);const N=_.useCallback(()=>{Qp().then(z=>{s(z.repos),o(z.board)}).catch(z=>{u(z instanceof Error?z.message:String(z))})},[]),E=_.useCallback(z=>{o(z),Nw(z).catch(U=>{u(U instanceof Error?U.message:String(U))})},[]),T=_.useCallback(async z=>{const U=z.trim();if(!U.startsWith("/"))return"Please add an absolute path (it must start with /).";try{const K=i4(U);await Ai("/api/git/repositories",{name:K,path:U});const I=await Qp();s(I.repos);const Z=(I.board.includes(K)?I.board:[...I.board,K]).slice(0,Tc);return o(Z),await Nw(Z),null}catch(K){return K instanceof Error?K.message:String(K)}},[]),A=new Map((t??[]).map(z=>[z.name,z])),C=n.map(z=>A.get(z)).filter(z=>!!z).slice(0,Tc),R=(t??[]).filter(z=>!n.includes(z.name)),D=C.length<Tc,$=Math.max(0,v-(D?LZ:0)),O=v===0?Tc:Math.max(1,Math.floor(($+J0)/(OZ+J0))),P=Math.min(C.length,O),B=C.slice(0,P),G=C.length-P;function F(z){const U=g.current;if(g.current=null,U===null||U===z)return;const K=[...n],[I]=K.splice(U,1);K.splice(z,0,I),E(K)}return i.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/85",children:[i.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:[i.jsxs("span",{className:"flex items-center gap-1.5 text-[12px] font-semibold tracking-tight",children:[i.jsx(ob,{className:"size-3.5"}),"Repositories",t?i.jsxs(Ge,{variant:"secondary",className:"ml-1",children:[C.length,t.length>C.length?` / ${t.length}`:""]}):null,G>0?i.jsxs("span",{className:"ml-1 text-[10px] font-normal text-muted-foreground",children:["+",G," hidden — widen the window or remove one"]}):null]}),i.jsxs(J,{"aria-label":"Refresh repositories",disabled:h,onClick:k,size:"sm",type:"button",variant:"outline",children:[i.jsx(Rr,{className:h?"animate-spin":void 0}),"Refresh"]})]}),i.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:l?i.jsx(Qe,{variant:"destructive",className:"m-3",children:l}):t&&t.length===0?i.jsx(Qe,{variant:"muted",className:"m-3 text-center",children:"No Git projects registered. Add one with the project picker in the header."}):i.jsxs("div",{className:"flex h-full min-h-0 gap-2 p-2",ref:x,children:[B.map((z,U)=>i.jsx(BZ,{repo:z,isCurrent:!!e&&z.path===e,selectedFile:d?.repo===z.name?d.file:"",onSelectFile:K=>p({repo:z.name,file:K}),onRemove:()=>E(n.filter(K=>K!==z.name)),onMutated:N,onDragStart:()=>{g.current=U},onDropColumn:()=>F(U)},z.name)),D?i.jsx(PZ,{unpinned:R,onAdd:z=>E([...n,z].slice(0,Tc)),onRegister:T}):null]})}),d?i.jsx(RZ,{repo:d.repo,file:d.file,onClose:()=>p(null)}):null]})}function BZ({repo:e,isCurrent:t,selectedFile:s,onSelectFile:n,onRemove:o,onMutated:l,onDragStart:u,onDropColumn:h}){const[f,d]=_.useState(!1),[p,g]=_.useState(!1),[x,v]=_.useState(!1),w=_.useCallback(async(T,A)=>{if(A.length){g(!0);try{await T(A,e.name),l()}finally{g(!1)}}},[e.name,l]),k={busy:p,onStage:T=>{w(gb,T)},onUnstage:T=>{w(UC,T)}},N=e.files.filter(T=>T.index.trim()&&T.index!=="?").length,E=x?Wn:jn;return i.jsxs("div",{className:ae("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",f&&"ring-2 ring-foreground/40"),onDragOver:T=>{T.preventDefault(),d(!0)},onDragLeave:()=>d(!1),onDrop:()=>{d(!1),h()},children:[i.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:[i.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[i.jsx(u6,{className:"size-3.5 shrink-0 text-muted-foreground/60"}),i.jsx("span",{className:"truncate text-[12px] font-semibold",title:e.path,children:e.name}),t?i.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:[i.jsx(Ds,{className:"size-2.5"}),"Current"]}):null]}),i.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[i.jsxs("span",{className:"flex items-center gap-1 font-mono text-[10px] text-muted-foreground",children:[e.ahead?i.jsxs("span",{className:"flex items-center",title:`${e.ahead} ahead`,children:[i.jsx(uf,{className:"size-3"}),e.ahead]}):null,e.behind?i.jsxs("span",{className:"flex items-center",title:`${e.behind} behind`,children:[i.jsx(cf,{className:"size-3"}),e.behind]}):null]}),i.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:i.jsx(Ut,{className:"size-3.5"})})]})]}),i.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:i.jsx(y5,{branch:e.branch||void 0,error:e.error,files:e.files,onSelectFile:n,root:e.path,selectedFile:s,staging:k})}),i.jsxs("div",{className:"shrink-0 border-t border-border",children:[i.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:()=>v(T=>!T),type:"button",children:[i.jsx(E,{className:"size-3.5 shrink-0"}),i.jsx("span",{className:"flex-1",children:"Commit"}),N?i.jsxs(Ge,{size:"small",variant:"secondary",children:[N," staged"]}):null]}),x?i.jsx(w5,{branch:e.branch||void 0,files:e.files,onDone:l,repo:e.name}):null]})]})}function PZ({unpinned:e,onAdd:t,onRegister:s}){const[n,o]=_.useState(!1),[l,u]=_.useState(null),[h,f]=_.useState(""),[d,p]=_.useState(null),[g,x]=_.useState(!1),[v,w]=_.useState(!1),[k,N]=_.useState(""),E=_.useRef(null),T=_.useRef(null);function A(){if(n){o(!1);return}u(E.current?.getBoundingClientRect()??null),p(null),o(!0)}_.useEffect(()=>{if(!n)return;function D($){const O=$.target;O instanceof Node&&(T.current?.contains(O)||E.current?.contains(O)||o(!1))}return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[n]);async function C(D){x(!0),p(null);const $=await s(D);return x(!1),$?(p($),!1):(f(""),o(!1),!0)}async function R(D){D.preventDefault(),await C(h)}return i.jsxs("div",{className:"w-44 shrink-0",children:[i.jsxs("button",{ref:E,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:A,type:"button",children:[i.jsx(ps,{className:"size-5"}),i.jsx("span",{className:"text-[12px] font-medium",children:"Add repository"})]}),n&&l?tr.createPortal(i.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?i.jsxs("div",{className:"border-b border-border",children:[i.jsx("div",{className:"px-3 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Pin a registered repo"}),i.jsx("div",{className:"max-h-52 overflow-auto pb-1",children:e.map(D=>i.jsxs("button",{className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm hover:bg-muted",onClick:()=>{t(D.name),o(!1)},type:"button",children:[i.jsx(ob,{className:"size-3.5 shrink-0 text-muted-foreground"}),i.jsx("span",{className:"min-w-0 flex-1 truncate",title:D.path,children:D.name}),D.files.length?i.jsx(Ge,{variant:"outline",className:"h-5 px-1.5 text-[10px]",children:D.files.length}):null]},D.name))})]}):null,i.jsxs("div",{className:"p-2.5",children:[i.jsx("div",{className:"pb-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Add a new repository"}),i.jsxs("form",{className:"flex gap-1.5",onSubmit:R,children:[i.jsx(dt,{"aria-label":"Repository absolute path",className:"h-7 flex-1 px-2 font-mono text-[11px]",onChange:D=>{f(D.target.value),p(null)},placeholder:"/absolute/path/to/repo",value:h}),i.jsx(J,{className:"h-7 px-2 text-[11px]",disabled:g||!h.trim(),size:"sm",type:"submit",children:"Add"})]}),i.jsxs(J,{className:"mt-1.5 h-7 w-full gap-1.5 text-[11px]",disabled:g,onClick:()=>{N(h.trim()||""),w(!0)},size:"sm",type:"button",variant:"outline",children:[i.jsx(lb,{className:"size-3"}),"Browse folders…"]}),d?i.jsx("div",{className:"mt-1.5 text-[10px] text-destructive",children:d}):null]})]}),document.body):null,v?i.jsx(r4,{confirmLabel:"Add repository",errorMessage:d,initialPath:k||"/",selectedPath:k,title:"Add Repository",onCancel:()=>w(!1),onSelect:N,onUse:async()=>{await C(k)&&w(!1)}}):null]})}const eb=300,IZ=600,$Z=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 HZ(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:!$Z.has(t.slice(s+1))}function UZ(e){return e>=IZ?"danger":e>=eb?"warn":"ok"}const FZ={ok:"bg-emerald-500/60",warn:"bg-amber-500/70",danger:"bg-destructive/70"},qZ={ok:"text-muted-foreground",warn:"text-amber-600 dark:text-amber-400",danger:"text-destructive"};function VZ({onOpenFile:e,root:t}){const[s,n]=_.useState([]),[o,l]=_.useState(!0),[u,h]=_.useState(null),[f,d]=_.useState(!0);function p(){l(!0),h(null),q7().then(n).catch(k=>h(k instanceof Error?k.message:String(k))).finally(()=>l(!1))}_.useEffect(()=>{p()},[]);const g=_.useMemo(()=>f?s.filter(k=>HZ(k.path)):s,[s,f]),x=s.length-g.length,v=g[0]?.lines??1,w=g.filter(k=>k.lines>=eb).length;return i.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/85",children:[i.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-2",children:[i.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[i.jsx(fC,{className:"size-4"}),i.jsx("span",{className:"font-semibold text-foreground",children:"Largest files"}),!o&&!u?i.jsxs("span",{children:[g.length," files · ",w," over ",eb," lines",f&&x>0?` · ${x} data/docs hidden`:""]}):null]}),i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsxs(J,{size:"sm",variant:f?"default":"outline",className:"h-7",onClick:()=>d(k=>!k),title:"Hide docs, data, config and generated files",type:"button",children:[i.jsx(cC,{}),"Code only"]}),i.jsxs(J,{size:"sm",variant:"outline",className:"h-7",onClick:p,disabled:o,type:"button",children:[o?i.jsx(jt,{className:"animate-spin"}):i.jsx(Rr,{}),"Refresh"]})]})]}),u?i.jsx(Qe,{variant:"destructive",className:"m-3",children:u}):o&&s.length===0?i.jsxs("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:[i.jsx(jt,{className:"mr-2 size-4 animate-spin"}),"Scanning tracked files…"]}):g.length===0?i.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."}):i.jsx("ul",{className:"min-h-0 flex-1 divide-y divide-border/60 overflow-auto",children:g.map((k,N)=>{const E=UZ(k.lines);return i.jsxs("li",{className:"group flex items-center gap-3 px-3 transition-colors hover:bg-muted/50",children:[i.jsx("span",{className:"w-6 shrink-0 text-right font-mono text-[10px] text-muted-foreground",children:N+1}),i.jsx("button",{type:"button",onClick:()=>e(k.path),className:"min-w-0 flex-1 py-1.5 text-left",children:i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex items-center justify-between gap-3",children:[i.jsx("span",{className:"truncate font-mono text-[11px]",children:k.path}),i.jsxs("span",{className:ae("shrink-0 font-mono text-[11px] tabular-nums",qZ[E]),children:[k.truncated?"≥":"",k.lines.toLocaleString()," lines"]})]}),i.jsx("div",{className:"mt-1 h-1 w-full overflow-hidden rounded-full bg-muted",children:i.jsx("div",{className:ae("h-full rounded-full",FZ[E]),style:{width:`${Math.max(2,k.lines/v*100)}%`}})})]})}),i.jsxs("div",{className:"flex shrink-0 items-center justify-end gap-0.5",children:[i.jsx(GZ,{file:k,root:t}),i.jsx(WZ,{file:k,root:t})]})]},k.path)})})]})}function GZ({file:e,root:t}){const{sendToAgent:s}=At(),n=pu(t,e.path),o=e.path.split("/").pop()??e.path;function l(){s({prompt:eH({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 i.jsx(a4,{label:`AI actions for ${e.path}`,trigger:i.jsx(qt,{className:"size-3.5"}),children:h=>i.jsxs(i.Fragment,{children:[i.jsx(Yc,{icon:i.jsx(qt,{className:"size-3.5"}),onSelect:()=>{h(),l()},children:"Ask AI to split this file"}),i.jsx(Yc,{icon:i.jsx(dC,{className:"size-3.5"}),onSelect:()=>{h(),u()},children:"Send file path to AI"})]})})}function WZ({file:e,root:t}){const{error:s,success:n}=as(),o=pu(t,e.path),l=e.path.split("/").pop()??e.path;async function u(h,f){try{await navigator.clipboard.writeText(h),n(`Copied ${f}.`)}catch(d){s(d instanceof Error?d.message:`Could not copy ${f}.`)}}return i.jsx(a4,{label:`Copy path for ${e.path}`,trigger:i.jsxs(i.Fragment,{children:[i.jsx(uC,{className:"size-3.5"}),i.jsx("span",{className:"sr-only",children:"More actions"})]}),children:h=>i.jsxs(i.Fragment,{children:[i.jsx(Yc,{icon:i.jsx(ab,{className:"size-3.5"}),onSelect:()=>{h(),u(l,"file name")},children:"Copy file name"}),i.jsx(Yc,{icon:i.jsx(Ah,{className:"size-3.5"}),onSelect:()=>{h(),u(e.path,"relative path")},children:"Copy relative path"}),i.jsx(Yc,{icon:i.jsx(Ah,{className:"size-3.5"}),onSelect:()=>{h(),u(o,"absolute path")},children:"Copy absolute path"})]})})}function a4({children:e,label:t,trigger:s}){const[n,o]=_.useState(!1),[l,u]=_.useState({right:0,top:0}),h=_.useRef(null),f=_.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 _.useEffect(()=>{if(!n)return;function g(v){const w=v.target;h.current?.contains(w)||f.current?.contains(w)||d()}function x(v){v.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]),i.jsxs(i.Fragment,{children:[i.jsx("button",{"aria-label":t,className:ae("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?tr.createPortal(i.jsx("div",{className:"fixed z-50 w-56 overflow-hidden rounded-md border border-border bg-card p-1 shadow-md",ref:f,style:{top:l.top,right:l.right},children:e(d)}),document.body):null]})}function Yc({children:e,icon:t,onSelect:s}){return i.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:[i.jsx("span",{className:"text-muted-foreground",children:t}),i.jsx("span",{className:"min-w-0 flex-1 truncate",children:e})]})}function KZ({data:e,onRefresh:t}){const{insertPath:s}=At(),[n,o]=_.useState(!1),[l,u]=_.useState("changes"),[h,f]=_.useState("changes"),[d,p]=_.useState(e.git.status?.files[0]?.path??""),[g,x]=_.useState(""),[v,w]=_.useState([]),[k,N]=_.useState(null),[E,T]=_.useState(""),[A,C]=_.useState(null),[R,D]=_.useState(0),[$,O]=_.useState(null),[P,B]=_.useState(()=>new Set),G=e.git.status?.files??[],F=_.useMemo(()=>{const Ne=new Set(G.map($e=>$e.path)),Ue=[...P].filter($e=>!Ne.has($e)).sort().map($e=>({path:$e,index:" ",workingTree:"M"}));return[...G,...Ue]},[G,P]),z=_.useMemo(()=>F.map(Ne=>Ne.path),[F]),U=_.useMemo(()=>Gb(E),[E]),K=_.useCallback(async(Ne,Ue)=>{if(Ue.length){o(!0);try{await Ne(Ue),t?.()}finally{o(!1)}}},[t]),I=t?{busy:n,onStage:Ne=>{K(gb,Ne)},onUnstage:Ne=>{K(UC,Ne)}}:void 0;_.useEffect(()=>{const Ne=F[0]?.path??"";p(Ue=>Ue&&F.some($e=>$e.path===Ue)?Ue:Ne)},[F]),_.useEffect(()=>{if(l!=="all"||v.length>0)return;let Ne=!0;return N(null),F7().then(Ue=>{Ne&&w(Ue)}).catch(Ue=>{Ne&&N(Ue instanceof Error?Ue.message:String(Ue))}),()=>{Ne=!1}},[l,v.length]),_.useEffect(()=>{if(!d){T("");return}let Ne=!0;return C(null),HC(d).then(Ue=>{Ne&&(T(Ue),D(0),O(null))}).catch(Ue=>{Ne&&C(Ue instanceof Error?Ue.message:String(Ue))}),()=>{Ne=!1}},[d]);function Z(Ne){D(0),O(null),p(Ne)}function W(){const Ne=gZ({activeHunkIndex:R,filePaths:z,hunkCount:U.hunks,pendingNextFilePath:$,selectedFile:d});Ne.kind==="hunk"?(O(null),D(Ne.activeHunkIndex)):Ne.kind==="confirm-next-file"?O(Ne.filePath):Ne.kind==="file"?Z(Ne.filePath):O(null)}function te(){if(O(null),R>0){D($e=>$e-1);return}const Ne=F.findIndex($e=>$e.path===d),Ue=F[Ne-1];Ue&&Z(Ue.path)}const X=F.findIndex(Ne=>Ne.path===d),V=!!(U.hunks&&R<U.hunks-1||F[X+1]),q=!!(R>0||F[X-1]),le=$?`End of file. Click Next again to open ${$}.`:null,ee=Ne=>`rounded px-2 py-0.5 text-[11px] font-medium transition-colors ${Ne?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,fe=Ne=>`flex-1 px-2 py-0.5 text-[11px] font-medium transition-colors ${Ne?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,ie=_.useMemo(()=>{const Ne=new Set(F.map(Ue=>Ue.path));for(const Ue of P)Ne.add(Ue);return Ne},[F,P]);if(!e.git.selectedRepository)return i.jsx(YZ,{});function Se(){g&&(u("changes"),f("changes"),Z(g))}function Me(Ne){B(Ue=>new Set(Ue).add(Ne)),x(Ne),u("changes"),f("changes"),Z(Ne)}function De(Ne){x(Ne),u("all")}function Je(Ne){Ne&&s(pu(e.git.cwd,Ne))}return i.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-card/85",children:[i.jsxs("div",{className:"flex shrink-0 items-center gap-1 border-b border-border bg-card/95 px-3 py-1",children:[i.jsx("button",{type:"button",className:ee(l==="changes"),onClick:()=>u("changes"),children:"Changes"}),i.jsx("button",{type:"button","aria-label":"Show changed files across all repositories",className:ee(l==="board"),onClick:()=>u("board"),children:"Board"}),i.jsx("button",{type:"button","aria-label":"Open all tracked files",className:ee(l==="all"),onClick:()=>u("all"),children:"All files"}),i.jsx("button",{type:"button",className:ee(l==="graph"),onClick:()=>u("graph"),children:"Tree"}),i.jsx("button",{type:"button",className:ee(l==="largest"),onClick:()=>u("largest"),children:"Largest files"}),i.jsx("button",{type:"button",className:ee(l==="snapshots"),onClick:()=>u("snapshots"),children:"Snapshots"})]}),i.jsx("div",{className:"min-h-0 flex-1",children:l==="board"?i.jsx(zZ,{currentRepoPath:e.git.cwd}):l==="graph"?i.jsx(TZ,{branches:e.git.branches??[]}):l==="largest"?i.jsx(VZ,{onOpenFile:De,root:e.git.cwd}):l==="snapshots"?i.jsx(S$,{}):l==="all"?i.jsxs("div",{className:"grid h-full min-h-0 overflow-hidden border-0 bg-card/85 xl:grid-cols-[320px_minmax(0,1fr)]",children:[i.jsx("aside",{className:"flex min-h-0 flex-col overflow-hidden",children:k?i.jsx(Qe,{variant:"destructive",className:"m-3",children:k}):i.jsx(Hk,{branch:e.git.status?.branch||void 0,onSelectFile:x,paths:v,root:e.git.cwd,selectedFile:g,status:F})}),i.jsx(pZ,{isModified:ie.has(g),onFileSaved:Me,onSendToAi:()=>Je(g),onViewDiff:Se,path:g})]}):i.jsxs("div",{className:"grid h-full min-h-0 overflow-hidden border-0 bg-card/85 xl:grid-cols-[320px_minmax(0,1fr)]",children:[i.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden",children:[i.jsxs("div",{className:"flex shrink-0 gap-0.5 border-b border-border bg-card/95 p-1",children:[i.jsx("button",{"aria-label":"Show changed files as a list",className:fe(h==="changes"),onClick:()=>f("changes"),type:"button",children:"Changes"}),i.jsx("button",{"aria-label":"Show changed files as a tree",className:fe(h==="tree"),onClick:()=>f("tree"),type:"button",children:"Tree"})]}),h==="changes"?i.jsx(y5,{branch:e.git.status?.branch||void 0,error:e.git.error,files:F,selectedFile:d,onSelectFile:Z,root:e.git.cwd,staging:I}):i.jsx(Hk,{branch:e.git.status?.branch||void 0,defaultExpandAll:!0,emptyMessage:e.git.error??"No changed files.",onSelectFile:Z,paths:z,root:e.git.cwd,selectedFile:d,status:F,title:"Changes"}),t&&e.git.status?i.jsx(w5,{branch:e.git.status.branch||void 0,files:F,onDone:t}):null]}),i.jsxs("section",{className:"flex min-h-0 min-w-0 flex-col border-l border-border bg-card",children:[i.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-1.5",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:d||"Diff"}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-muted-foreground",children:[i.jsx("span",{children:"Long rows wrap inside the editor pane."}),U.additions||U.deletions?i.jsxs("span",{className:"flex items-center gap-1 font-mono",children:[i.jsxs("span",{className:"text-emerald-700",children:["+",U.additions]}),i.jsxs("span",{className:"text-red-700",children:["-",U.deletions]})]}):null]})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[le?i.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:le}):null,i.jsxs(J,{disabled:!d||!q,onClick:te,size:"sm",type:"button",variant:"outline",children:[i.jsx(uf,{}),"Previous"]}),i.jsxs(J,{disabled:!d||!V,onClick:W,size:"sm",type:"button",variant:"outline",children:[i.jsx(cf,{}),"Next"]}),i.jsx(J,{"aria-label":"Send selected file to AI input",className:"size-8",disabled:!d,onClick:()=>Je(d),size:"icon",title:"Send selected file path to AI input",type:"button",variant:"outline",children:i.jsx(qt,{className:"size-4"})})]})]}),i.jsx("div",{className:"relative min-h-0 min-w-0 flex-1",children:A?i.jsx("div",{className:"p-4",children:i.jsx(Qe,{variant:"destructive",children:A})}):d?i.jsx(fu,{activeHunkIndex:R,diff:E||"No unstaged diff for this file."}):i.jsx("div",{className:"p-4",children:i.jsx(Qe,{variant:"muted",className:"border-dashed p-12 text-center",children:"Select a changed file to inspect its diff."})})})]})]})})]})}function YZ(){return i.jsx("div",{className:"flex h-full items-center justify-center p-8 text-center",children:i.jsxs("div",{className:"max-w-sm",children:[i.jsx(ob,{className:"mx-auto size-8 text-muted-foreground/50"}),i.jsx("p",{className:"mt-3 text-sm font-medium",children:"No Git project registered"}),i.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 switcher in the sidebar to add one."})]})})}function $N(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),f=/\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=ZZ(o,s);return p&&l.push({kind:"action",id:"assert-pr-branch",title:"Check PR branch",op:"assert-pr-branch"}),u&&(l.push(ch("gate-review","Approve review","Review the current changes?")),l.push(Rc("review","Review changes","Review the current git changes. Summarize risks, likely bugs, and anything that should change before committing.",uh(g,["skills","mcpServers"])))),h&&l.push(Rc("verify","Run verification","Run the relevant tests or checks for this repository. If something fails, stop and explain the failure.",uh(g,["skills","mcpServers","plugins"]))),f&&(l.push(Rc("commit-message","Generate commit message","Stage the appropriate changed files, inspect the staged diff briefly, and draft one conventional commit message. Do not commit.",uh(g,["skills"]))),l.push(ch("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(ch("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(Rc("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.",uh(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(ch("gate-start","Approve start","Run this workflow?")),l.push(Rc("ai-step","AI step",n||"Complete this workflow step.",g))),{id:JZ(o4(HN(o))||"custom-workflow",t),name:HN(o),description:n||"Custom AI-authored workflow.",builtin:!1,steps:QZ(l)}}function XZ(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(`
217
- `)}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 ch(e,t,s){return{kind:"gate",id:e,title:t,message:s}}function Rc(e,t,s,n,o){return{kind:"agent",id:e,title:t,prompt:s,capabilities:_v(n),verify:o}}function ZZ(e,t){return _v({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 uh(e,t){const s={};for(const n of t){const o=e[n];o?.length&&(s[n]=o)}return _v(s)}function _v(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 QZ(e){const t=new Map;return e.map(s=>{const n=o4(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 JZ(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 o4(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}const af={"error-incident":"Error incident","service-crash":"Service crash"};function eQ({workflows:e}){const{triggers:t,pending:s,error:n,saveTrigger:o,removeTrigger:l,runPending:u,dismissPending:h}=fF(),[f,d]=_.useState(!1),p=g=>e.find(x=>x.id===g)?.name??g;return i.jsxs("section",{className:"border-t border-border px-4 py-3",children:[i.jsxs("div",{className:"flex items-center justify-between gap-3",children:[i.jsxs("div",{children:[i.jsxs("h3",{className:"flex items-center gap-1.5 text-[12px] font-semibold",children:[i.jsx(TC,{className:"size-3.5 text-amber-500"})," Triggers"]}),i.jsx("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:"Run a workflow automatically when an error or crash is detected."})]}),i.jsxs(J,{onClick:()=>d(g=>!g),size:"sm",type:"button",variant:"outline",children:[i.jsx(ps,{className:"size-3.5"})," Add trigger"]})]}),n?i.jsx("p",{className:"mt-2 text-[11px] text-destructive",children:n}):null,s.length>0?i.jsx("div",{className:"mt-3 space-y-1.5",children:s.map(g=>i.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-amber-500/40 bg-amber-500/5 px-2.5 py-1.5",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"truncate text-[11px] font-medium",children:[p(g.workflowId),i.jsxs("span",{className:"ml-1.5 text-muted-foreground",children:["· ",af[g.event]]})]}),i.jsx("div",{className:"truncate text-[10px] text-muted-foreground",children:g.summary})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[i.jsxs(J,{onClick:()=>u(g),size:"sm",type:"button",variant:"outline",children:[i.jsx(Tr,{className:"size-3"})," Run"]}),i.jsx(J,{onClick:()=>{h(g.id)},size:"icon",type:"button",variant:"ghost","aria-label":"Dismiss",children:i.jsx(Ut,{className:"size-3.5"})})]})]},g.id))}):null,f?i.jsx(tQ,{workflows:e,onCancel:()=>d(!1),onSave:async g=>{await o(g),d(!1)}}):null,i.jsxs("div",{className:"mt-3 space-y-1.5",children:[t.length===0&&!f?i.jsx("p",{className:"text-[11px] text-muted-foreground/70",children:"No triggers yet."}):null,t.map(g=>i.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-border px-2.5 py-1.5",children:[i.jsxs("label",{className:"flex min-w-0 items-center gap-2",children:[i.jsx("input",{checked:g.enabled,className:"size-3.5 accent-primary",onChange:x=>{o({...g,enabled:x.target.checked})},type:"checkbox"}),i.jsxs("span",{className:"min-w-0 truncate text-[11px]",children:[i.jsx("span",{className:"font-medium",children:af[g.event]}),g.filter?i.jsxs("span",{className:"text-muted-foreground",children:[" · “",g.filter,"”"]}):null,i.jsxs("span",{className:"text-muted-foreground",children:[" → ",p(g.workflowId)]}),g.autoRun?i.jsx("span",{className:"ml-1.5 rounded bg-amber-500/15 px-1 py-px text-[9px] font-semibold uppercase text-amber-600",children:"auto"}):null]})]}),i.jsx(J,{onClick:()=>{l(g.id)},size:"icon",type:"button",variant:"ghost","aria-label":"Delete trigger",children:i.jsx(Mi,{className:"size-3.5"})})]},g.id))]})]})}function tQ({workflows:e,onCancel:t,onSave:s}){const[n,o]=_.useState("error-incident"),[l,u]=_.useState(e[0]?.id??""),[h,f]=_.useState(""),[d,p]=_.useState(!1),g="rounded border border-border bg-background px-2 py-1 text-[11px] outline-none focus:border-primary";return i.jsxs("div",{className:"mt-3 space-y-2 rounded-md border border-border bg-background p-3",children:[i.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[i.jsxs("label",{className:"flex flex-col gap-1 text-[10px] font-medium text-muted-foreground",children:["When",i.jsx("select",{className:g,value:n,onChange:x=>o(x.target.value),children:Object.keys(af).map(x=>i.jsx("option",{value:x,children:af[x]},x))})]}),i.jsxs("label",{className:"flex flex-col gap-1 text-[10px] font-medium text-muted-foreground",children:["Run workflow",i.jsx("select",{className:g,value:l,onChange:x=>u(x.target.value),children:e.map(x=>i.jsx("option",{value:x.id,children:x.name},x.id))})]})]}),i.jsxs("label",{className:"flex flex-col gap-1 text-[10px] font-medium text-muted-foreground",children:["Only when the service name / message contains (optional)",i.jsx("input",{className:g,value:h,onChange:x=>f(x.target.value),placeholder:"e.g. api",type:"text"})]}),i.jsxs("label",{className:"flex w-fit items-center gap-1.5 text-[11px] text-muted-foreground",children:[i.jsx("input",{checked:d,className:"size-3.5 accent-primary",onChange:x=>p(x.target.checked),type:"checkbox"}),"Start automatically (otherwise it waits for one click)"]}),i.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[i.jsx(J,{onClick:t,size:"sm",type:"button",variant:"ghost",children:"Cancel"}),i.jsx(J,{disabled:!l,onClick:()=>{s({id:`trigger-${Date.now().toString(36)}`,event:n,workflowId:l,filter:h.trim()||void 0,enabled:!0,autoRun:d})},size:"sm",type:"button",children:"Add"})]})]})}function sQ(){const{run:e,start:t,resume:s,approve:n,skip:o,stop:l,dismiss:u}=bj(),[h,f]=_.useState([]),[d,p]=_.useState(null),[g,x]=_.useState(null),[v,w]=_.useState(null),[k,N]=_.useState(!0),[E,T]=_.useState(!1),[A,C]=_.useState(!0);_.useEffect(()=>{let P=!0;return N(!0),Promise.all([ZC(),zC().catch(()=>null)]).then(([B,G])=>{P&&(f(B),p(G))}).catch(B=>{P&&w(B instanceof Error?B.message:String(B))}).finally(()=>{P&&N(!1)}),()=>{P=!1}},[]);function R(P){T(!0),t(P,A)}async function D(P){w(null);try{const B=await hL(P);f(B),x(null)}catch(B){w(B instanceof Error?B.message:String(B))}}async function $(P){if(!P.builtin&&window.confirm(`Delete workflow "${P.name}"?`)){w(null);try{f(await fL(P.id))}catch(B){w(B instanceof Error?B.message:String(B))}}}function O(P){x({...P,id:yv(`${P.id}-copy`,h),name:`${P.name} copy`,builtin:!1,steps:P.steps.map((B,G)=>({...B,id:`${B.id}-${G+1}`}))})}return e&&E?i.jsx(hQ,{run:e,onApprove:n,onSkip:o,onStop:l,onBack:()=>T(!1),onResume:()=>{T(!0),s(A)},onRestart:()=>{T(!0),t(e.workflow,A)}}):g?i.jsx(rQ,{agent:d?pQ(d):null,existing:h,initial:g,onCancel:()=>x(null),onSave:P=>{D(P)}}):i.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-auto bg-card/85",children:[i.jsxs("div",{className:"border-b border-border px-4 py-3",children:[i.jsxs("div",{className:"flex items-start justify-between gap-3",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"flex items-center gap-1.5 text-[13px] font-semibold",children:[i.jsx(qt,{className:"size-4"})," AI Workflows"]}),i.jsx("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:"One-click rituals that exceed the IDE — agent steps do the work, pausing at each gate for your OK."})]}),i.jsxs(J,{onClick:()=>x(xQ(h)),size:"sm",type:"button",variant:"outline",children:[i.jsx(ps,{className:"size-3.5"})," New"]})]}),i.jsxs("label",{className:"mt-2 flex w-fit items-center gap-1.5 text-[11px] text-muted-foreground",children:[i.jsx("input",{checked:A,className:"size-3.5 accent-primary",onChange:P=>C(P.target.checked),type:"checkbox"}),"Run without step-by-step prompts",i.jsx("span",{className:"text-muted-foreground/60",children:"— gates still pause; risky shell still asks."})]})]}),v?i.jsx(Qe,{variant:"destructive",className:"m-4",children:v}):k?i.jsxs("div",{className:"flex flex-1 items-center justify-center text-[12px] text-muted-foreground",children:[i.jsx(jt,{className:"mr-2 size-4 animate-spin"})," Loading workflows…"]}):i.jsxs(i.Fragment,{children:[e?i.jsx(nQ,{onClear:u,onView:()=>T(!0),run:e}):null,i.jsx("div",{className:"grid gap-3 p-4 sm:grid-cols-2 xl:grid-cols-3",children:h.map(P=>i.jsx(iQ,{lastRun:e?.workflow.id===P.id?e:null,workflow:P,onDelete:()=>{$(P)},onDuplicate:()=>O(P),onEdit:()=>x(P),onRun:()=>R(P)},P.id))}),i.jsx(eQ,{workflows:h})]})]})}function nQ({onClear:e,onView:t,run:s}){const n=s.outcome==="running";return i.jsx("section",{className:"mx-4 mt-4 rounded-md border border-border bg-background p-3 shadow-sm",children:i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:n?"Workflow running":"Last workflow"}),i.jsx(d4,{outcome:s.outcome})]}),i.jsx("p",{className:"mt-1 truncate text-[13px] font-medium",children:s.workflow.name}),i.jsxs("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:[n?"Started":"Ran"," ",u4(s.startedAt)]})]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[i.jsxs(J,{onClick:t,size:"sm",type:"button",children:[i.jsx(pl,{className:"size-3.5"})," View run"]}),n?null:i.jsxs(J,{onClick:e,size:"sm",type:"button",variant:"outline",children:[i.jsx(Ut,{className:"size-3.5"})," Clear"]})]})]})})}function iQ({lastRun:e,workflow:t,onDelete:s,onDuplicate:n,onEdit:o,onRun:l}){const[u,h]=_.useState(!1),f=t.steps.length;return i.jsxs("div",{className:"flex flex-col rounded-lg border border-border bg-background p-3.5 shadow-sm",children:[i.jsxs("div",{className:"flex items-start justify-between gap-2",children:[i.jsx("h3",{className:"text-[13px] font-semibold",children:t.name}),t.builtin?i.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?i.jsx("p",{className:"mt-1 text-[11px] leading-snug text-muted-foreground",children:t.description}):null,e?i.jsxs("p",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[i.jsx(pl,{className:"size-3"}),e.outcome==="running"?"Running now":`Last run ${u4(e.startedAt)}`]}):null,i.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:[i.jsx(jn,{className:ae("size-3 shrink-0 transition-transform",u?"rotate-90":""),"aria-hidden":!0}),i.jsxs("span",{children:[f," ",f===1?"step":"steps"]})]}),u?i.jsx("ol",{className:"mt-1.5 space-y-1",children:t.steps.map(d=>i.jsxs("li",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[i.jsx(_Q,{kind:d.kind}),i.jsx("span",{className:"truncate",children:of(d)})]},d.id))}):null,i.jsxs(J,{className:"mt-3 w-full",onClick:l,size:"sm",type:"button",children:[i.jsx(Tr,{className:"size-3.5"})," Run"]}),i.jsxs("div",{className:"mt-2 grid grid-cols-3 gap-1.5",children:[i.jsxs(J,{onClick:o,size:"sm",type:"button",variant:"outline",children:[i.jsx(hM,{className:"size-3.5"})," Edit"]}),i.jsxs(J,{onClick:n,size:"sm",type:"button",variant:"outline",children:[i.jsx(Ah,{className:"size-3.5"})," Copy"]}),i.jsxs(J,{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:[i.jsx(Mi,{className:"size-3.5"})," Delete"]})]})]})}function rQ({agent:e,existing:t,initial:s,onCancel:n,onSave:o}){const[l,u]=_.useState(()=>structuredClone(s)),[h,f]=_.useState(s.description??""),[d,p]=_.useState(!1),g=gQ(e),{sendToAgent:x}=At(),v=!l.id.trim()||!l.name.trim()||l.steps.length===0;function w(D,$){u(O=>({...O,steps:O.steps.map((P,B)=>B===D?$(P):P)}))}function k(D,$){u(O=>{const P=D+$;if(P<0||P>=O.steps.length)return O;const B=[...O.steps],[G]=B.splice(D,1);return B.splice(P,0,G),{...O,steps:B}})}function N(D){u($=>({...$,steps:$.steps.filter((O,P)=>P!==D)}))}function E(D,$){u(O=>{const P=[...O.steps];return P.splice(D,0,oQ($,O.steps)),{...O,steps:P}})}function T(D=h){const $=$N(D,t,g);u($)}function A(D){const $=$N(D,[],g);u(O=>({...O,steps:[...O.steps,...$.steps]}))}function C(){x({prompt:XZ(h||l.description||l.name),source:{type:"workflow",label:"Workflow composer"},mode:"draft"})}function R(){const D=cl(l.id)||yv(cl(l.name)||"workflow",t);o({...l,id:D,name:l.name.trim(),description:(h||l.description)?.trim()||void 0,builtin:!1,steps:l.steps.map(bQ)})}return i.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-card/85",children:[i.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-border px-4 py-3",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i.jsx(qt,{className:"size-4 shrink-0"}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("input",{"aria-label":"Workflow name",className:"w-full bg-transparent text-[14px] font-semibold outline-none",onChange:D=>u($=>({...$,name:D.target.value,id:cl(D.target.value)||$.id})),placeholder:"Name your workflow",value:l.name}),i.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:l.id})]})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[i.jsxs(J,{onClick:()=>p(D=>!D),size:"sm",type:"button",variant:d?"default":"outline",children:[i.jsx(Ri,{className:"size-3.5"})," AI compose"]}),i.jsxs(J,{onClick:n,size:"sm",type:"button",variant:"outline",children:[i.jsx(ou,{className:"size-3.5"})," Back"]}),i.jsxs(J,{disabled:v,onClick:R,size:"sm",type:"button",children:[i.jsx(Ds,{className:"size-3.5"})," Save"]})]})]}),d?i.jsx("section",{className:"shrink-0 border-b border-border bg-muted/20 p-4",children:i.jsxs("div",{className:"grid gap-3 xl:grid-cols-[minmax(0,1.1fr)_minmax(0,0.9fr)]",children:[i.jsxs("div",{className:"rounded-lg border border-border bg-background p-3 shadow-sm",children:[i.jsx(jr,{children:"Describe workflow"}),i.jsx("textarea",{className:"min-h-16 w-full resize-none bg-transparent text-[13px] leading-relaxed outline-none placeholder:text-muted-foreground",onChange:D=>f(D.target.value),placeholder:"Review my changes with code-review, ask before commit, push, then open a PR with GitHub...",value:h}),i.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[i.jsxs(J,{onClick:()=>T(),size:"sm",type:"button",children:[i.jsx(Ri,{className:"size-3.5"})," Draft timeline"]}),i.jsxs(J,{onClick:C,size:"sm",type:"button",variant:"outline",children:[i.jsx(G6,{className:"size-3.5"})," Ask AI"]}),["Commit safely","Review then push","Fix CI then PR","File issue from changes"].map(D=>i.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:()=>{f(D),T(D)},type:"button",children:D},D))]})]}),i.jsxs("div",{className:"grid gap-3",children:[i.jsx(lQ,{onAdd:A}),i.jsx(cQ,{capabilities:g})]})]})}):null,i.jsx("main",{className:"min-h-0 flex-1 overflow-auto p-4",children:i.jsxs("div",{className:"mx-auto max-w-3xl",children:[i.jsx(UN,{onInsert:D=>E(0,D)}),l.steps.length?l.steps.map((D,$)=>i.jsxs(_.Fragment,{children:[i.jsxs("div",{className:"flex gap-4",children:[i.jsxs("div",{className:"relative flex w-9 shrink-0 justify-center pt-2",children:[i.jsx("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-border"}),i.jsx(aQ,{index:$,kind:D.kind})]}),i.jsx("div",{className:"min-w-0 flex-1 pb-1",children:i.jsx(uQ,{capabilities:g,index:$,isFirst:$===0,isLast:$===l.steps.length-1,onMove:k,onRemove:N,onUpdate:w,step:D})})]}),i.jsx(UN,{onInsert:O=>E($+1,O)})]},`${D.kind}:${D.id}`)):i.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 UN({defaultOpen:e=!1,onInsert:t}){const[s,n]=_.useState(e),o=[{kind:"gate",label:"Gate"},{kind:"agent",label:"AI"},{kind:"action",label:"Auto"}];return i.jsxs("div",{className:"flex gap-4",children:[i.jsxs("div",{className:"relative flex w-9 shrink-0 justify-center",children:[i.jsx("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-border"}),i.jsx("button",{"aria-label":s?"Cancel adding step":"Add step here",className:ae("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?i.jsx(Ut,{className:"size-3"}):i.jsx(ps,{className:"size-3"})})]}),i.jsx("div",{className:"flex-1 py-1",children:s?i.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:o.map(({kind:l,label:u})=>i.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:[i.jsx(h4,{kind:l})," ",u]},l))}):null})]})}function aQ({index:e,kind:t}){return i.jsxs("div",{className:"relative z-10 flex size-9 items-center justify-center rounded-full border border-border bg-card shadow-sm",children:[i.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}),i.jsx(h4,{kind:t})]})}function oQ(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 lQ({onAdd:e}){const[t,s]=_.useState("");return i.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:[i.jsx(jr,{children:"Add a step"}),i.jsxs("div",{className:"flex gap-2",children:[i.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}),i.jsxs(J,{size:"sm",type:"submit",variant:"outline",children:[i.jsx(ps,{className:"size-3.5"})," Add"]})]})]})}function cQ({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?i.jsxs("div",{className:"rounded-lg border border-border bg-background p-3",children:[i.jsx(jr,{children:"Detected capabilities"}),i.jsx("div",{className:"flex max-h-20 flex-wrap gap-1.5 overflow-hidden",children:t.map(s=>i.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 uQ({capabilities:e,index:t,isFirst:s,isLast:n,onMove:o,onRemove:l,onUpdate:u,step:h}){return i.jsx("section",{className:"group rounded-lg border border-border bg-background p-3 shadow-sm",children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(tb,{kind:h.kind}),i.jsx("input",{className:"min-w-0 flex-1 bg-transparent text-[13px] font-semibold outline-none",onChange:f=>u(t,d=>({...d,title:f.target.value})),value:h.title})]}),h.kind==="gate"?i.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:f=>u(t,d=>d.kind==="gate"?{...d,message:f.target.value}:d),placeholder:"Question to ask before continuing…",value:h.message}):h.kind==="action"?i.jsxs("div",{className:"mt-2 space-y-1.5",children:[i.jsxs("select",{className:"w-full rounded-md border border-border bg-background px-2 py-1 text-[12px] outline-none",onChange:f=>{const d=f.target.value;u(t,p=>p.kind==="action"?{...p,op:d}:p)},value:h.op,children:[i.jsx("option",{value:"commit",children:"Commit staged changes"}),i.jsx("option",{value:"push",children:"Push branch"}),i.jsx("option",{value:"assert-pr-branch",children:"Check PR branch"}),i.jsx("option",{value:"checkout-default-and-pull",children:"Return to default branch"})]}),i.jsx("p",{className:"text-[11px] leading-relaxed text-muted-foreground",children:l4(h.op)})]}):i.jsxs(i.Fragment,{children:[i.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:f=>u(t,d=>d.kind==="agent"?{...d,prompt:f.target.value}:d),placeholder:"What should the agent do at this step?",value:h.prompt}),i.jsx(dQ,{capabilities:e,selected:h.capabilities,onToggle:(f,d)=>u(t,p=>p.kind==="agent"?{...p,capabilities:vQ(p.capabilities,f,d)}:p)})]})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-1 opacity-70 transition-opacity group-hover:opacity-100",children:[i.jsx(J,{disabled:s,onClick:()=>o(t,-1),size:"sm",type:"button",variant:"ghost",children:"↑"}),i.jsx(J,{disabled:n,onClick:()=>o(t,1),size:"sm",type:"button",variant:"ghost",children:"↓"}),i.jsx(J,{onClick:()=>l(t),size:"sm",type:"button",variant:"ghost",children:i.jsx(Mi,{className:"size-3.5"})})]})]})})}function dQ({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 i.jsxs("div",{className:"space-y-2",children:[i.jsx(jr,{children:"Capabilities"}),n.map(o=>i.jsxs("div",{children:[i.jsx("div",{className:"mb-1 text-[10px] text-muted-foreground",children:o.label}),o.values.length?i.jsx("div",{className:"flex flex-wrap gap-1.5",children:o.values.map(l=>{const u=s?.[o.key]?.includes(l)??!1;return i.jsx("button",{className:ae("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)})}):i.jsx("p",{className:"text-[11px] text-muted-foreground/70",children:"None detected."})]},o.key))]})}function hQ({run:e,onApprove:t,onSkip:s,onStop:n,onBack:o,onResume:l,onRestart:u}){const{sendToAgent:h}=At(),f=e.outcome!=="running",[d,p]=_.useState(e.index);_.useEffect(()=>{p(e.index)},[e.index]);const g=e.workflow.steps[d]??e.workflow.steps[e.index],x=e.statuses[d]??"pending",v=e.outputs[d],w=e.outputs[d-1],k=g?.kind==="gate"&&x==="waiting",N=x==="failed"||x==="blocked",E=x==="blocked"&&g?.kind==="action"&&g.op==="assert-pr-branch";return i.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-card/85",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsxs("h2",{className:"flex items-center gap-1.5 text-[13px] font-semibold",children:[i.jsx(qt,{className:"size-4"})," ",e.workflow.name]}),i.jsxs("p",{className:"mt-0.5 flex items-center gap-1 text-[11px] text-muted-foreground",children:[i.jsx(pl,{className:"size-3"})," Watch the agent workflow run."]})]}),i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(d4,{outcome:e.outcome}),i.jsxs(J,{onClick:o,size:"sm",type:"button",variant:"outline",children:[i.jsx(ou,{className:"size-3.5"})," Workflows"]}),f?null:i.jsxs(J,{onClick:n,size:"sm",type:"button",variant:"outline",children:[i.jsx(ro,{className:"size-3.5"})," Stop"]})]})]}),i.jsxs("div",{className:"grid min-h-0 flex-1 overflow-hidden lg:grid-cols-[minmax(240px,320px)_minmax(0,1fr)]",children:[i.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:i.jsx("ol",{className:"space-y-1",children:e.workflow.steps.map((T,A)=>{const C=e.statuses[A],R=C==="running"||C==="waiting",D=A===d;return i.jsx("li",{children:i.jsxs("button",{className:ae("flex w-full items-center gap-2 rounded-md border px-2.5 py-2 text-left transition-colors",D?"border-primary/45 bg-primary/[0.06]":R?"border-primary/30 bg-primary/[0.03]":"border-transparent hover:border-border hover:bg-muted/40"),onClick:()=>p(A),type:"button",children:[i.jsx("span",{className:ae("flex size-7 shrink-0 items-center justify-center rounded-full border bg-card",C==="failed"?"border-destructive/50":C==="blocked"?"border-amber-500/50":R?"border-primary/50":C==="done"?"border-emerald-500/50":"border-border"),children:i.jsx(qN,{status:C,kind:T.kind})}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block truncate text-[12px] font-medium",children:of(T)}),i.jsxs("span",{className:"mt-0.5 flex items-center gap-1.5",children:[i.jsx(tb,{kind:T.kind}),i.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground/70",children:FN(C)})]})]}),i.jsx(jn,{className:ae("size-3.5 shrink-0 text-muted-foreground/50 transition-transform",D?"translate-x-0.5 text-primary":"")})]})},T.id)})})}),i.jsx("main",{className:"min-h-0 overflow-auto p-4",children:g?i.jsxs("section",{className:ae("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:[i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-border pb-3",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(qN,{status:x,kind:g.kind}),i.jsx("h3",{className:"truncate text-[13px] font-semibold",children:of(g)})]}),i.jsxs("div",{className:"mt-1 flex items-center gap-1.5",children:[i.jsx(tb,{kind:g.kind}),i.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground/70",children:FN(x)})]})]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[f&&N&&d===e.index&&!E?i.jsxs(J,{"aria-label":"Resume the workflow from this step",onClick:l,size:"sm",type:"button",children:[i.jsx(Tr,{className:"size-3.5"})," Resume workflow"]}):null,N?i.jsxs(J,{"aria-label":"Debug this workflow step with AI",onClick:()=>h({prompt:YU({workflowName:e.workflow.name,step:g,status:x,error:e.error,previousOutput:w,output:v}),source:{type:"workflow-debug",label:g.title},mode:"send",label:`Debug workflow step: ${g.title}`,background:!0}),size:"sm",type:"button",variant:"outline",children:[i.jsx(qt,{className:"size-3.5"})," Debug with AI"]}):null,f?null:i.jsxs(J,{"aria-label":"Stop workflow run from step detail",onClick:n,size:"sm",type:"button",variant:"outline",children:[i.jsx(ro,{className:"size-3.5"})," Stop after this step"]})]})]}),i.jsxs("div",{className:"py-3 text-[11px] leading-relaxed",children:[i.jsx(mQ,{output:v,previousOutput:w,status:x,step:g}),k?i.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-1.5",children:[i.jsxs(J,{onClick:t,size:"sm",type:"button",children:[i.jsx(Ds,{className:"size-3.5"})," Approve"]}),i.jsxs(J,{onClick:s,size:"sm",type:"button",variant:"outline",children:[i.jsx(EC,{className:"size-3.5"})," Skip"]}),i.jsxs(J,{onClick:n,size:"sm",type:"button",variant:"outline",children:[i.jsx(Ut,{className:"size-3.5"})," Stop"]})]}):null,x==="failed"&&e.error?i.jsx("p",{className:"mt-3 text-destructive",children:e.error}):null,E?i.jsx(fQ,{error:e.error,onRestart:u,workflowName:e.workflow.name}):null,x==="blocked"&&e.error?i.jsx("p",{className:"mt-3 text-amber-700 dark:text-amber-400",children:e.error}):null]})]}):null})]})]})}function fQ({error:e,onRestart:t,workflowName:s}){const{provider:n}=At(),[o,l]=_.useState(""),[u,h]=_.useState(!1),[f,d]=_.useState(!1),[p,g]=_.useState(null),[x,v]=_.useState(null),w=_.useRef(null),k=nF(o);_.useEffect(()=>()=>w.current?.abort(),[]);async function N(T){w.current?.abort();const A=new AbortController;w.current=A,v(null),g(null),l(""),h(!0);try{const C=await Yb({prompt:[XU({workflowName:s,error:e}),T?.trim()?T.trim():""].filter(Boolean).join(`
218
-
219
- `),provider:n?.id,signal:A.signal});A.signal.aborted||l(C)}catch(C){A.signal.aborted||v(C instanceof Error?C.message:String(C))}finally{w.current===A&&(w.current=null,h(!1))}}async function E(){if(k){d(!0),v(null);try{await K7(k),g(k)}catch(T){v(T instanceof Error?T.message:String(T))}finally{d(!1)}}}return i.jsxs("div",{className:"mt-3 rounded-md border border-border bg-muted/35 p-3",children:[i.jsx(jr,{children:"Recover with AI"}),i.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."}),i.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[i.jsxs(J,{onClick:()=>{N()},size:"sm",type:"button",children:[i.jsx(qt,{className:"size-3.5"})," Recommend branch with AI"]}),p?i.jsxs(J,{onClick:t,size:"sm",type:"button",variant:"outline",children:[i.jsx(Tr,{className:"size-3.5"})," Run again"]}):null]}),u?i.jsxs("p",{className:"mt-2 flex items-center gap-1 text-[11px] text-muted-foreground",children:[i.jsx(jt,{className:"size-3 animate-spin"})," Choosing a branch name in the background."]}):null,k?i.jsxs("div",{className:"mt-3 rounded-md border border-border bg-background p-2.5",children:[i.jsx(jr,{children:"Recommended branch"}),i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[i.jsx("code",{className:"min-w-0 rounded bg-muted px-2 py-1 font-mono text-[12px] text-foreground",children:k}),i.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[i.jsxs(J,{disabled:f||p===k,onClick:()=>{E()},size:"sm",type:"button",children:[f?i.jsx(jt,{className:"size-3.5 animate-spin"}):i.jsx(Ds,{className:"size-3.5"}),"Create this branch"]}),i.jsxs(J,{disabled:f,onClick:()=>{N("Recommend a different concise branch name. Keep the same output contract with `BRANCH_NAME: <branch-name>`.")},size:"sm",type:"button",variant:"outline",children:[i.jsx(qt,{className:"size-3.5"})," Ask for another"]})]})]})]}):o&&!u?i.jsxs("div",{className:"mt-3 rounded-md border border-border bg-background p-2.5",children:[i.jsx("p",{className:"text-[11px] text-muted-foreground",children:"The agent did not return a branch name the workflow could read."}),i.jsxs(J,{className:"mt-2",onClick:()=>{N("Return only a concise branch suggestion using this exact line: `BRANCH_NAME: <branch-name>`.")},size:"sm",type:"button",variant:"outline",children:[i.jsx(qt,{className:"size-3.5"})," Ask for another"]})]}):null,p?i.jsxs("p",{className:"mt-2 text-[11px] text-emerald-700 dark:text-emerald-400",children:["Branch created: ",i.jsx("code",{className:"font-mono",children:p}),". Run the workflow again from here."]}):null,x?i.jsx("p",{className:"mt-2 text-[11px] text-destructive",children:x}):null]})}function FN(e){return e==="running"?"Running":e==="waiting"?"Waiting":e==="done"?"Done":e==="blocked"?"Needs you":e==="failed"?"Failed":e==="skipped"?"Skipped":"Queued"}function mQ({output:e,previousOutput:t,status:s,step:n}){if(n.kind==="gate"){const l=n.id==="gate-commit"?t?.trim():"";return i.jsxs("div",{children:[i.jsx("p",{className:"text-muted-foreground",children:n.message}),l?i.jsxs("div",{className:"mt-3",children:[i.jsx(jr,{children:"Generated commit message"}),i.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 i.jsx("p",{className:"text-muted-foreground",children:l4(n.op)});const o=s==="done"||s==="failed"||s==="skipped";return e?i.jsxs("div",{children:[i.jsx(jr,{children:"Result"}),i.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})]}):i.jsxs("div",{children:[i.jsx(jr,{children:o?"Result":"Task"}),o?i.jsx("p",{className:"italic text-muted-foreground",children:"The agent returned no text result."}):i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"text-muted-foreground",children:n.prompt}),s==="running"?i.jsxs("p",{className:"mt-1.5 flex items-center gap-1 text-muted-foreground/80",children:[i.jsx(jt,{className:"size-3 animate-spin"})," Running agent step…"]}):null]})]})}function pQ(e){return e.detected.name==="codex"?e.agents.codex:e.agents["claude-code"]??e}function gQ(e){return e?{skills:Hc(e.skills.map(t=>t.name)),mcpServers:Hc(e.mcpServers.map(t=>t.name)),plugins:Hc(e.plugins.map(t=>t.name)),hooks:Hc(e.hooks.map(t=>t.matcher?`${t.event}: ${t.matcher}`:t.event))}:{skills:[],mcpServers:[],plugins:[],hooks:[]}}function xQ(e){return{id:yv("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 bQ(e){const t=cl(e.id)||e.kind,s=e.title.trim()||of(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=c4(e.capabilities);return{...e,id:t,title:s,prompt:e.prompt.trim()||"Complete this workflow step.",capabilities:n}}function l4(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 c4(e){if(!e)return;const t={};for(const s of["skills","mcpServers","plugins","hooks"]){const n=Hc((e[s]??[]).map(o=>o.trim()).filter(Boolean));n.length&&(t[s]=n)}return Object.keys(t).length?t:void 0}function vQ(e,t,s){const n=e?.[t]??[],o=n.includes(s)?n.filter(l=>l!==s):[...n,s];return c4({...e??{},[t]:o})}function yv(e,t){const s=new Set(t.map(l=>l.id));let n=cl(e)||"workflow",o=2;for(;s.has(n);)n=`${cl(e)||"workflow"}-${o}`,o++;return n}function cl(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Hc(e){return Array.from(new Set(e.filter(Boolean)))}function jr({children:e}){return i.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:e})}function u4(e){return new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}).format(new Date(e))}function d4({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 i.jsx("span",{className:ae("rounded-full border px-2 py-0.5 text-[10px] font-medium",n),children:s})}function h4({kind:e}){return e==="gate"?i.jsx(CC,{className:"size-4 text-amber-600 dark:text-amber-400"}):e==="agent"?i.jsx(Ri,{className:"size-4 text-primary"}):i.jsx(Tr,{className:"size-4 text-muted-foreground"})}function qN({status:e,kind:t}){return e==="running"?i.jsx(jt,{className:"size-4 shrink-0 animate-spin text-primary"}):e==="waiting"?i.jsx(CC,{className:"size-4 shrink-0 text-primary"}):e==="done"?i.jsx(Ds,{className:"size-4 shrink-0 text-emerald-600 dark:text-emerald-400"}):e==="blocked"?i.jsx(nb,{className:"size-4 shrink-0 text-amber-600 dark:text-amber-400"}):e==="failed"?i.jsx(Ar,{className:"size-4 shrink-0 text-destructive"}):e==="skipped"?i.jsx(EC,{className:"size-4 shrink-0 text-muted-foreground/60"}):t==="agent"?i.jsx(Ri,{className:"size-4 shrink-0 text-muted-foreground/50"}):i.jsx(dR,{className:"size-4 shrink-0 text-muted-foreground/50"})}function _Q(e){return i.jsx(jn,{className:"size-3 shrink-0 text-muted-foreground/40","aria-hidden":!0})}function tb({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 i.jsx("span",{className:ae("shrink-0 rounded-full border px-1.5 py-px text-[9px] uppercase tracking-wide",s),children:t})}function of(e){return e.title}const yQ={sm:"size-3.5",md:"size-4",lg:"size-6"};function wv({size:e="md",className:t}){return i.jsx(jt,{"aria-hidden":!0,className:ae("animate-spin",yQ[e],t)})}function If({label:e,size:t="md",fill:s=!1,className:n}){return i.jsxs("div",{className:ae("flex items-center justify-center gap-2 text-[12px] text-muted-foreground",s&&"h-full",n),role:"status",children:[i.jsx(wv,{size:t}),e?i.jsx("span",{children:e}):null]})}function wQ(){const[e,t]=_.useState(!1),[s,n]=_.useState(!1),[o,l]=_.useState(!0),[u,h]=_.useState("checking"),[f,d]=_.useState(null),[p,g]=_.useState(null);function x(){l(!0),h("checking"),d(null),tO().then(v=>{t(v.configured),n(v.deviceFlowAvailable),h(v.status),d(v.error??null),g(v)}).catch(v=>{t(!1),n(!1),h("connection_error"),d(v instanceof Error?v.message:String(v)),g(null)}).finally(()=>l(!1))}return _.useEffect(()=>{x()},[]),{configured:e,deviceFlowAvailable:s,loading:o,status:u,error:f,info:p,isConnected:u==="connected",needsLogin:u==="not_configured"||u==="auth_error",refresh:x}}const Ex=30;function SQ(e="open"){const[t,s]=_.useState([]),[n,o]=_.useState(!0),[l,u]=_.useState(!1),[h,f]=_.useState(!1),[d,p]=_.useState(1),[g,x]=_.useState(null),[v,w]=_.useState(null),[k,N]=_.useState(null),[E,T]=_.useState(""),[A,C]=_.useState(!1),[R,D]=_.useState(null);_.useEffect(()=>{let P=!0;return o(!0),x(null),p(1),Jp(e,1).then(B=>{P&&(s(B),f(B.length===Ex),B.length>0&&!B.some(G=>G.number===v)&&w(B[0]?.number??null))}).catch(B=>{P&&x(B instanceof Error?B.message:String(B))}).finally(()=>{P&&o(!1)}),()=>{P=!1}},[e]),_.useEffect(()=>{if(!v){N(null);return}let P=!0;return oO(v).then(B=>{P&&N(B)}).catch(()=>{}),()=>{P=!1}},[v]),_.useEffect(()=>{if(!v){T("");return}let P=!0;return C(!0),D(null),lO(v).then(B=>{P&&T(B)}).catch(B=>{P&&D(B instanceof Error?B.message:String(B))}).finally(()=>{P&&C(!1)}),()=>{P=!1}},[v]);function $(){if(l||!h)return;const P=d+1;u(!0),Jp(e,P).then(B=>{s(G=>{const F=new Set(G.map(z=>z.number));return[...G,...B.filter(z=>!F.has(z.number))]}),f(B.length===Ex),p(P)}).catch(B=>x(B instanceof Error?B.message:String(B))).finally(()=>u(!1))}function O(){let P=!0;return o(!0),x(null),p(1),Jp(e,1).then(B=>{P&&(s(B),f(B.length===Ex))}).catch(B=>{P&&x(B instanceof Error?B.message:String(B))}).finally(()=>{P&&o(!1)}),()=>{P=!1}}return{prs:t,loading:n,loadingMore:l,hasMore:h,error:g,selectedNumber:v,setSelectedNumber:w,selectedPR:k,diff:E,diffLoading:A,diffError:R,loadMore:$,refresh:O}}const jx=30;function kQ(e="open"){const[t,s]=_.useState([]),[n,o]=_.useState(!0),[l,u]=_.useState(!1),[h,f]=_.useState(!1),[d,p]=_.useState(1),[g,x]=_.useState(null),[v,w]=_.useState(null),[k,N]=_.useState(null),[E,T]=_.useState([]),[A,C]=_.useState(!1),[R,D]=_.useState(null),[$,O]=_.useState(!1);_.useEffect(()=>{let F=!0;return o(!0),x(null),p(1),eg(e,1).then(z=>{F&&(s(z),f(z.length===jx),z.length>0&&!z.some(U=>U.number===v)&&w(z[0]?.number??null))}).catch(z=>{F&&x(z instanceof Error?z.message:String(z))}).finally(()=>{F&&o(!1)}),()=>{F=!1}},[e]),_.useEffect(()=>{if(!v){N(null),T([]);return}let F=!0;return C(!0),Promise.all([fO(v),mO(v)]).then(([z,U])=>{F&&(N(z),T(U))}).catch(()=>{}).finally(()=>{F&&C(!1)}),()=>{F=!1}},[v]);async function P(F){if(v){O(!0),D(null);try{const z=await pO(v,F);T(U=>[...U,z])}catch(z){D(z instanceof Error?z.message:String(z))}finally{O(!1)}}}function B(){if(l||!h)return;const F=d+1;u(!0),eg(e,F).then(z=>{s(U=>{const K=new Set(U.map(I=>I.number));return[...U,...z.filter(I=>!K.has(I.number))]}),f(z.length===jx),p(F)}).catch(z=>x(z instanceof Error?z.message:String(z))).finally(()=>u(!1))}function G(){let F=!0;return o(!0),p(1),eg(e,1).then(z=>{F&&(s(z),f(z.length===jx))}).catch(()=>{}).finally(()=>{F&&o(!1)}),()=>{F=!1}}return{issues:t,loading:n,loadingMore:l,hasMore:h,error:g,selectedNumber:v,setSelectedNumber:w,selectedIssue:k,comments:E,commentsLoading:A,commentError:R,submitting:$,addComment:P,loadMore:B,refresh:G}}function f4({deviceFlowAvailable:e,initialMode:t,onSaved:s}){const[n,o]=_.useState(()=>t==="device-pending"&&!e?"pat":t??(e?"choose":"pat"));return n==="device-pending"?i.jsx(NQ,{onSuccess:s,onCancel:()=>o("choose")}):n==="pat"?i.jsx(CQ,{onSaved:s,onBack:e?()=>o("choose"):void 0}):i.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-6 p-8",children:[i.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[i.jsx("div",{className:"flex size-12 items-center justify-center rounded-xl bg-muted",children:i.jsx(hw,{className:"size-6 text-muted-foreground"})}),i.jsxs("div",{children:[i.jsx("h2",{className:"text-base font-semibold",children:"Connect GitHub"}),i.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."})]})]}),i.jsxs("div",{className:"flex w-full max-w-xs flex-col gap-2",children:[i.jsxs(J,{className:"w-full",onClick:()=>o("device-pending"),type:"button",children:[i.jsx(hw,{className:"mr-2 size-4"}),"Authorize with GitHub"]}),i.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 NQ({onSuccess:e,onCancel:t}){const[s,n]=_.useState(null),[o,l]=_.useState(null),[u,h]=_.useState(!0),[f,d]=_.useState(!1),p=_.useRef(null),g=_.useRef(5),x=_.useRef(!1);_.useEffect(()=>{let N=!0;return sO().then(E=>{if(!N)return;n(E),g.current=E.interval,h(!1);const T=E.verification_uri_complete||E.verification_uri;T&&_f(T),v(E.device_code,E.interval),setTimeout(()=>{x.current=!0},E.expires_in*1e3)}).catch(E=>{N&&(l(E instanceof Error?E.message:String(E)),h(!1))}),()=>{N=!1,p.current&&clearTimeout(p.current)}},[]);function v(N,E){p.current=setTimeout(()=>{w(N,E)},E*1e3)}async function w(N,E){if(x.current){l("Authorization expired. Please try again.");return}try{const T=await nO(N);if(T.done){e();return}const A=T.slowDown?E+5:E;g.current=A,v(N,A)}catch{v(N,g.current)}}function k(){s&&navigator.clipboard.writeText(s.user_code).then(()=>{d(!0),setTimeout(()=>d(!1),2e3)})}return u?i.jsx("div",{className:"flex h-full items-center justify-center",children:i.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[i.jsx(fw,{className:"size-6 animate-spin text-muted-foreground"}),i.jsx("p",{className:"text-[13px] text-muted-foreground",children:"Requesting authorization…"})]})}):o?i.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-4 p-8",children:[i.jsx(Qe,{variant:"destructive",children:o}),i.jsx(J,{onClick:t,variant:"outline",children:"Go back"})]}):i.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-6 p-8",children:[i.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[i.jsx("div",{className:"flex size-12 items-center justify-center rounded-xl bg-emerald-100 dark:bg-emerald-500/15",children:i.jsx(ff,{className:"size-6 text-emerald-600 dark:text-emerald-400"})}),i.jsxs("div",{children:[i.jsx("h2",{className:"text-base font-semibold",children:"Authorize on GitHub"}),i.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"," ",i.jsx("strong",{children:"Authorize"}),"."]})]})]}),i.jsxs("div",{className:"flex flex-col items-center gap-2",children:[i.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:k,title:"Click to copy",children:s?.user_code}),i.jsx("button",{className:"text-[11px] text-muted-foreground transition-colors hover:text-foreground",onClick:k,type:"button",children:f?"Copied!":"Click code to copy"})]}),i.jsxs("div",{className:"flex flex-col items-center gap-2",children:[i.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-muted-foreground",children:[i.jsx(fw,{className:"size-3.5 animate-spin"}),"Waiting for authorization…"]}),i.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"}),i.jsx("button",{className:"text-[12px] text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",onClick:t,type:"button",children:"Cancel"})]})]})}function CQ({onSaved:e,onBack:t}){const[s,n]=_.useState(""),[o,l]=_.useState(!1),[u,h]=_.useState(null);async function f(d){d.preventDefault();const p=s.trim();if(p){l(!0),h(null);try{await iO("github.com",p),e()}catch(g){h(g instanceof Error?g.message:String(g))}finally{l(!1)}}}return i.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-6 p-8",children:[i.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[i.jsx("div",{className:"flex size-12 items-center justify-center rounded-xl bg-muted",children:i.jsx(xC,{className:"size-6 text-muted-foreground"})}),i.jsxs("div",{children:[i.jsx("h2",{className:"text-base font-semibold",children:"Personal Access Token"}),i.jsxs("p",{className:"mt-1 max-w-sm text-[13px] text-muted-foreground",children:["Create a token at"," ",i.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 ",i.jsx("code",{className:"rounded bg-muted px-1 py-px text-[11px]",children:"repo"})," and"," ",i.jsx("code",{className:"rounded bg-muted px-1 py-px text-[11px]",children:"workflow"})," scopes."]})]})]}),i.jsxs("form",{className:"flex w-full max-w-sm flex-col gap-3",onSubmit:d=>{f(d)},children:[i.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?i.jsx(Qe,{variant:"destructive",children:u}):null,i.jsx(J,{disabled:!s.trim()||o,type:"submit",children:o?"Saving…":"Save token"}),t?i.jsx("button",{className:"text-[12px] text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",onClick:t,type:"button",children:"← Back"}):null]})]})}function Sv({hasMore:e,loading:t,onLoadMore:s}){return e?i.jsx("div",{className:"p-2",children:i.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?i.jsx(jt,{className:"size-3 animate-spin"}):null,t?"Loading…":"Load more"]})}):null}function EQ({prs:e,loading:t,loadingMore:s,hasMore:n,error:o,selectedNumber:l,onSelect:u,onLoadMore:h}){return t&&e.length===0?i.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading pull requests…"}):o?i.jsx("div",{className:"p-4 text-[12px] text-red-500",children:o}):e.length===0?i.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"No pull requests found."}):i.jsxs(i.Fragment,{children:[i.jsx("ul",{className:"divide-y divide-border",children:e.map(f=>i.jsx("li",{children:i.jsxs("button",{className:`flex w-full items-start gap-3 px-3 py-2.5 text-left transition-colors hover:bg-muted/60 ${l===f.number?"bg-muted":""}`,onClick:()=>u(f.number),type:"button",children:[i.jsx("span",{className:"mt-0.5 shrink-0",children:i.jsx(jQ,{pr:f})}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block truncate text-[13px] font-medium",children:f.title}),i.jsxs("span",{className:"block text-[11px] text-muted-foreground",children:["#",f.number," · ",f.base.ref," ← ",f.head.ref," · ",f.user.login]})]}),f.draft?i.jsx("span",{className:"shrink-0 rounded border border-border px-1.5 py-px text-[10px] text-muted-foreground",children:"Draft"}):null]})},f.number))}),i.jsx(Sv,{hasMore:n,loading:s,onLoadMore:h})]})}function jQ({pr:e}){return e.state==="merged"?i.jsx(Rh,{className:"size-4 text-purple-500"}):e.state==="closed"?i.jsx(i6,{className:"size-4 text-red-500"}):i.jsx(gC,{className:"size-4 text-emerald-500"})}function m4({body:e,title:t="Description"}){const[s,n]=_.useState("rendered"),o=l=>ae("rounded px-1.5 py-0.5 text-[10px] font-medium transition-colors",l?"bg-foreground text-background":"text-muted-foreground hover:text-foreground");return i.jsxs("section",{className:"overflow-hidden rounded-md border border-border bg-muted/25",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-1.5",children:[i.jsx("span",{className:"text-[11px] font-medium text-muted-foreground",children:t}),i.jsxs("div",{className:"flex items-center gap-0.5 rounded-md bg-background/60 p-0.5",children:[i.jsx("button",{className:o(s==="rendered"),onClick:()=>n("rendered"),type:"button",children:"Rendered"}),i.jsx("button",{className:o(s==="raw"),onClick:()=>n("raw"),type:"button",children:"Raw"})]})]}),s==="rendered"?i.jsx(bv,{content:e}):i.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap px-3 py-3 font-mono text-[12px]",children:e})]})}function AQ({pr:e,diff:t,diffLoading:s,diffError:n,onMerged:o}){const[l,u]=_.useState("cockpit"),[h,f]=_.useState(null),[d,p]=_.useState(!1),[g,x]=_.useState(null),[v,w]=_.useState(!1),[k,N]=_.useState(null),[E,T]=_.useState(!1),[A,C]=_.useState(null),[R,D]=_.useState(!1),{sendToAgent:$}=At(),O=_.useMemo(()=>b$(t),[t]);_.useEffect(()=>{C(K=>K&&O.some(I=>I.path===K)?K:O[0]?.path??null)},[O]);const P=O.find(K=>K.path===A)??O[0]??null;function B(K){C(K),u("diff")}function G(K,I){e&&(D(!1),$({prompt:I?lH(e,I,K):oH(e,K),source:{type:"github-pr",label:`PR #${e.number}${I?` · ${lf(I)}`:""}`},label:`PR #${e.number}${I?` (${lf(I)})`:""}: ${K}`}))}if(_.useEffect(()=>{if(D(!1),!e){f(null);return}let K=!0;return p(!0),x(null),cO(e.number).then(I=>{K&&f(I)}).catch(I=>{K&&x(I instanceof Error?I.message:String(I))}).finally(()=>{K&&p(!1)}),()=>{K=!1}},[e]),!e)return i.jsx("div",{className:"flex h-full items-center justify-center text-[12px] text-muted-foreground",children:"Select a pull request"});const F=e.state==="open"&&!e.draft;async function z(){if(!(!e||v)){w(!0),N(null);try{await hO(e.number,{method:"squash"}),T(!1),o?.()}catch(K){N(K instanceof Error?K.message:String(K)),T(!1)}finally{w(!1)}}}const U=K=>`rounded px-2 py-0.5 text-[11px] font-medium transition-colors ${K?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`;return i.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[i.jsxs("div",{className:"group flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[i.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] font-semibold",children:e.title}),i.jsx(Qi,{className:ae("shrink-0",R&&"opacity-100"),label:`Ask AI about PR #${e.number}`,onAsk:()=>D(K=>!K)}),i.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[i.jsx("button",{className:U(l==="cockpit"),onClick:()=>u("cockpit"),type:"button",children:"Review"}),i.jsx("button",{className:U(l==="diff"),onClick:()=>u("diff"),type:"button",children:"Diff"})]}),F?i.jsxs(J,{className:"shrink-0",disabled:v,onClick:()=>T(!0),size:"sm",title:"Squash & merge this pull request",type:"button",variant:"success",children:[i.jsx(Rh,{}),"Squash & merge"]}):null,i.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:i.jsx(io,{className:"size-3.5"})})]}),k?i.jsx("div",{className:"shrink-0 border-b border-border bg-red-500/10 px-3 py-1.5 text-[11px] text-red-500",children:k}):null,R?i.jsx("div",{className:"shrink-0 border-b border-border px-3 py-1.5",children:i.jsx(Mr,{placeholder:"What should the agent do with this PR? (review, summarize, find regressions…)",onSubmit:K=>G(K),onCancel:()=>D(!1)})}):null,l==="cockpit"?i.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:i.jsx(TQ,{cockpit:h,error:g,loading:d,onOpenFile:B,pr:e})}):s?i.jsx(If,{className:"flex-1",label:"Loading diff…"}):n?i.jsx("div",{className:"p-4 text-[12px] text-red-500",children:n}):O.length?i.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1",children:[i.jsx(RQ,{files:O,onAsk:(K,I)=>G(I,K),onSelect:C,selected:P?.path??null}),i.jsx("div",{className:"relative min-h-0 min-w-0 flex-1",children:P?i.jsx(fu,{diff:P.diff}):null})]}):i.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"No diff available."}),E?i.jsx(Tf,{confirmLabel:v?i.jsxs(i.Fragment,{children:[i.jsx(wv,{size:"sm"})," Merging…"]}):"Squash & merge",icon:i.jsx(Rh,{}),loading:v,message:i.jsxs(i.Fragment,{children:["Squash & merge PR ",i.jsxs("span",{className:"font-mono",children:["#",e.number]})," ",i.jsx("span",{className:"font-medium text-foreground",children:e.title})," into"," ",i.jsx("span",{className:"font-mono",children:e.base.ref}),"?"]}),onCancel:()=>T(!1),onConfirm:()=>{z()},title:"Squash & merge",tone:"success"}):null]})}function TQ({pr:e,cockpit:t,loading:s,error:n,onOpenFile:o}){const[l,u]=_.useState(!1),h=t?.pr??e,f=t?.files??[],d=t?.reviews??[],p=t?.comments??[],g=t?.checks??null,x=g?.runs.filter(v=>v.conclusion==="failure"||v.conclusion==="timed_out"||v.conclusion==="cancelled")??[];return i.jsxs("div",{className:"space-y-3 p-4",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 text-[12px]",children:[i.jsx(OQ,{pr:h}),i.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:[i.jsx(Gn,{className:"size-3 shrink-0 text-muted-foreground"}),h.base.ref,i.jsx(ou,{className:"size-3 shrink-0 text-muted-foreground"}),h.head.ref]}),i.jsxs("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[i.jsx(ZM,{className:"size-3 shrink-0"}),h.user.login]}),i.jsxs("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[i.jsx(eR,{className:"size-3 shrink-0"}),new Date(h.created_at).toLocaleDateString()]})]}),n?i.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?i.jsx(If,{className:"justify-start",label:"Loading review cockpit…"}):null,i.jsxs("div",{className:"grid gap-2 md:grid-cols-4",children:[i.jsx(dh,{title:"Merge readiness",value:p4(h,g),tone:MQ(h,g)}),i.jsx(dh,{title:"Review state",value:g4(d),tone:DQ(d)}),i.jsx(dh,{title:"Checks",value:g?`${g.state} (${g.totalCount})`:"unknown",tone:g?.state==="success"?"success":g?.state==="failure"||g?.state==="error"?"danger":"muted"}),i.jsx(dh,{title:"Changed files",value:String(f.length),tone:"muted"})]}),x.length>0?i.jsxs("section",{className:"rounded-md border border-red-500/25 bg-red-500/10 px-3 py-2",children:[i.jsx("div",{className:"mb-1 text-[11px] font-medium text-red-500",children:"Failing checks"}),i.jsx("div",{className:"flex flex-wrap gap-2",children:x.slice(0,4).map(v=>i.jsxs("a",{className:"inline-flex items-center gap-1 text-[11px] text-red-500 underline-offset-2 hover:underline",href:v.html_url,rel:"noopener noreferrer",target:"_blank",children:[i.jsx(ib,{className:"size-3"}),"Open failing check: ",v.name]},v.id))})]}):null,i.jsxs("section",{className:"rounded-md border border-border bg-muted/25 p-3",children:[i.jsxs("button",{className:"flex w-full items-center gap-2 text-[12px] font-medium",onClick:()=>u(v=>!v),type:"button",children:[l?i.jsx(Wn,{className:"size-3.5 text-muted-foreground"}):i.jsx(jn,{className:"size-3.5 text-muted-foreground"}),i.jsx(ab,{className:"size-3.5 text-muted-foreground"}),"Changed files",f.length?i.jsxs("span",{className:"font-mono text-[11px] text-muted-foreground",children:["(",f.length,")"]}):null]}),l?f.length?i.jsx("ul",{className:"mt-2 divide-y divide-border",children:f.slice(0,12).map(v=>i.jsx("li",{children:i.jsxs("button",{className:"flex w-full items-center gap-2 py-1.5 text-left text-[12px] transition-colors hover:text-foreground",onClick:()=>o(v.path),title:`View diff for ${v.path}`,type:"button",children:[i.jsx("span",{className:"w-16 shrink-0 font-mono text-[10px] uppercase text-muted-foreground",children:v.status}),i.jsx("span",{className:"min-w-0 flex-1 truncate font-mono",children:v.path}),i.jsxs("span",{className:"shrink-0 font-mono text-[11px] text-emerald-600",children:["+",v.additions]}),i.jsxs("span",{className:"shrink-0 font-mono text-[11px] text-red-500",children:["-",v.deletions]})]})},v.path))}):i.jsx("p",{className:"mt-2 text-[12px] text-muted-foreground",children:"No changed file metadata available."}):null]}),i.jsxs("section",{className:"rounded-md border border-border bg-muted/25 p-3",children:[i.jsxs("div",{className:"mb-2 flex items-center gap-2 text-[12px] font-medium",children:[i.jsx(K6,{className:"size-3.5 text-muted-foreground"}),"Review state"]}),d.length||p.length?i.jsxs("div",{className:"space-y-2",children:[d.slice(-4).map(v=>i.jsx(VN,{href:v.html_url,meta:`${v.user.login} - ${v.state.toLowerCase()}`,text:v.body||"No review summary."},`review:${v.id}`)),p.slice(-4).map(v=>i.jsx(VN,{href:v.html_url,meta:`${v.user.login} - comment`,text:v.body},`comment:${v.id}`))]}):i.jsx("p",{className:"text-[12px] text-muted-foreground",children:"No reviews or PR comments yet."})]}),h.body?i.jsx(m4,{body:h.body}):i.jsx("p",{className:"text-[12px] italic text-muted-foreground",children:"No description provided."})]})}function RQ({files:e,selected:t,onSelect:s,onAsk:n}){const[o,l]=_.useState(null);return i.jsx("div",{className:"w-44 shrink-0 overflow-y-auto border-r border-border bg-card/60",children:i.jsx("ul",{className:"py-1",children:e.map(u=>i.jsxs("li",{className:"group flex flex-col",children:[i.jsxs("div",{className:ae("flex items-center transition-colors",u.path===t?"bg-muted":"hover:bg-muted/60"),children:[i.jsxs("button",{className:ae("flex min-w-0 flex-1 items-center gap-1.5 px-2.5 py-1.5 text-left text-[11px]",u.path===t?"text-foreground":"text-muted-foreground group-hover:text-foreground"),onClick:()=>s(u.path),title:u.path,type:"button",children:[i.jsx("span",{className:"min-w-0 flex-1 truncate font-mono",children:lf(u.path)}),i.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-emerald-600",children:["+",u.additions]}),i.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-red-500",children:["-",u.deletions]})]}),i.jsx(Qi,{className:ae("mr-1 shrink-0",o===u.path&&"opacity-100"),label:`Ask AI about ${lf(u.path)}`,onAsk:()=>l(h=>h===u.path?null:u.path)})]}),o===u.path?i.jsx("div",{className:"px-2 pb-1.5 pt-0.5",children:i.jsx(Mr,{placeholder:"What about this file? (review, explain, find bugs…)",onSubmit:h=>{l(null),n(u.path,h)},onCancel:()=>l(null)})}):null]},u.path))})})}function lf(e){const t=e.split("/");return t[t.length-1]||e}function dh({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 i.jsxs("div",{className:"rounded-md border border-border bg-card px-3 py-2",children:[i.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:e}),i.jsxs("div",{className:"mt-1 flex items-center gap-1.5 text-[12px] font-medium",children:[i.jsx("span",{className:`size-1.5 rounded-full ${n}`}),t]})]})}function VN({meta:e,text:t,href:s}){return i.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:[i.jsxs("span",{className:"mb-1 flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[i.jsx(io,{className:"size-3"}),e]}),i.jsx("span",{className:"line-clamp-2 whitespace-pre-wrap",children:t})]})}function p4(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 MQ(e,t){const s=p4(e,t);return s==="ready"?"success":s==="blocked"||s==="checks failing"?"danger":s==="draft"||s==="checks pending"?"warning":"muted"}function g4(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 DQ(e){const t=g4(e);return t==="approved"?"success":t==="changes requested"?"danger":t==="commented"?"warning":"muted"}function OQ({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 i.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground",children:[i.jsx("span",{className:`size-1.5 rounded-full ${s}`}),t==="Merged"?i.jsx(Rh,{className:"size-3"}):t==="Open"?i.jsx(ff,{className:"size-3"}):i.jsx(ul,{className:"size-3"}),t]})}function x4({label:e}){return i.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5 text-[10px] font-medium text-muted-foreground",title:e.name,children:[i.jsx("span",{className:"size-2 shrink-0 rounded-sm",style:{backgroundColor:`#${e.color}`}}),i.jsx("span",{className:"truncate",children:e.name})]})}function LQ({issues:e,loading:t,loadingMore:s,hasMore:n,error:o,selectedNumber:l,onSelect:u,onLoadMore:h}){return t&&e.length===0?i.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading issues…"}):o?i.jsx("div",{className:"p-4 text-[12px] text-red-500",children:o}):e.length===0?i.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"No issues found."}):i.jsxs(i.Fragment,{children:[i.jsx("ul",{className:"divide-y divide-border",children:e.map(f=>i.jsx("li",{children:i.jsxs("button",{className:`flex w-full items-start gap-3 px-3 py-2.5 text-left transition-colors hover:bg-muted/60 ${l===f.number?"bg-muted":""}`,onClick:()=>u(f.number),type:"button",children:[i.jsx(fR,{className:`mt-0.5 size-4 shrink-0 ${f.state==="open"?"text-emerald-500":"text-red-500"}`}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block truncate text-[13px] font-medium",children:f.title}),i.jsxs("span",{className:"block text-[11px] text-muted-foreground",children:["#",f.number," · ",f.user.login," · ",f.comments," comment",f.comments!==1?"s":""]})]}),f.labels.length>0?i.jsx("span",{className:"flex max-w-40 shrink-0 flex-wrap justify-end gap-x-2 gap-y-0.5",children:f.labels.slice(0,3).map(d=>i.jsx(x4,{label:d},d.name))}):null]})},f.number))}),i.jsx(Sv,{hasMore:n,loading:s,onLoadMore:h})]})}const hh=6,zQ=6,BQ=8;function PQ(e,t,s,n){const o=Math.max(0,Math.min(zQ,e/2,t/2)),l=Math.max(0,Math.min(BQ,s-o,n-o));return[`M ${o} 0`,`H ${e-o}`,`A ${o} ${o} 0 0 1 ${e} ${o}`,`V ${t-n-o}`,`A ${o} ${o} 0 0 1 ${e-o} ${t-n}`,`H ${e-s+l}`,`A ${l} ${l} 0 0 0 ${e-s} ${t-n+l}`,`V ${t-o}`,`A ${o} ${o} 0 0 1 ${e-s-o} ${t}`,`H ${o}`,`A ${o} ${o} 0 0 1 0 ${t-o}`,`V ${o}`,`A ${o} ${o} 0 0 1 ${o} 0`,"Z"].join(" ")}function IQ({value:e,onChange:t,placeholder:s,rows:n=3,action:o}){const l=_.useRef(null),u=_.useRef(null),[h,f]=_.useState(null),[d,p]=_.useState({w:0,h:0});_.useLayoutEffect(()=>{const x=l.current,v=u.current;if(!x||!v)return;const w=()=>{f({w:x.clientWidth,h:x.clientHeight}),p({w:v.offsetWidth+hh*2,h:v.offsetHeight+hh*2})};w();const k=new ResizeObserver(w);return k.observe(x),k.observe(v),()=>k.disconnect()},[]);const g=h&&d.w&&d.h?PQ(h.w,h.h,d.w,d.h):null;return i.jsxs("div",{className:"relative",ref:l,children:[i.jsx("textarea",{className:"peer block w-full resize-none bg-background px-3 pt-2 font-mono text-[12px] placeholder:text-muted-foreground focus:outline-none",onChange:x=>t(x.target.value),placeholder:s,rows:n,style:{clipPath:g?`path('${g}')`:void 0,paddingBottom:d.h||44},value:e}),h&&g?i.jsxs("svg",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 overflow-visible text-border transition-colors peer-focus:text-foreground/40",fill:"none",height:h.h,viewBox:`0 0 ${h.w} ${h.h}`,width:h.w,children:[i.jsx("title",{children:"Comment field border"}),i.jsx("path",{d:g,stroke:"currentColor",strokeWidth:1})]}):null,i.jsx("div",{className:"absolute",ref:u,style:{bottom:hh,right:hh},children:o})]})}function $Q({issue:e,comments:t,commentsLoading:s,commentError:n,submitting:o,onAddComment:l}){const[u,h]=_.useState(""),[f,d]=_.useState(!1),{sendToAgent:p}=At();_.useEffect(()=>{d(!1)},[e?.number]);function g(v){e&&(d(!1),p({prompt:cH(e,v),source:{type:"github-issue",label:`Issue #${e.number}`},label:`Issue #${e.number}: ${v}`}))}if(!e)return i.jsx("div",{className:"flex h-full items-center justify-center text-[12px] text-muted-foreground",children:"Select an issue"});async function x(v){v.preventDefault();const w=u.trim();w&&(await l(w),h(""))}return i.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[i.jsxs("div",{className:"group flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[i.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] font-semibold",children:e.title}),i.jsx(Qi,{className:ae("shrink-0",f&&"opacity-100"),label:`Ask AI about issue #${e.number}`,onAsk:()=>d(v=>!v)}),i.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:i.jsx(io,{className:"size-3.5"})})]}),f?i.jsx("div",{className:"shrink-0 border-b border-border px-3 py-1.5",children:i.jsx(Mr,{placeholder:"What should the agent do with this issue? (summarize, draft a fix plan, reproduce…)",onSubmit:g,onCancel:()=>d(!1)})}):null,i.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:i.jsxs("div",{className:"space-y-3 p-4",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1.5 text-[12px]",children:[i.jsxs("span",{className:"text-[11px]",children:[i.jsx("span",{className:"text-muted-foreground",children:"Author: "}),i.jsx("span",{className:"font-medium",children:e.user.login})]}),i.jsxs("span",{className:"text-[11px]",children:[i.jsx("span",{className:"text-muted-foreground",children:"Opened: "}),i.jsx("span",{className:"font-medium",children:new Date(e.created_at).toLocaleDateString()})]}),e.labels.map(v=>i.jsx(x4,{label:v},v.name))]}),e.body?i.jsx(m4,{body:e.body}):i.jsx("p",{className:"text-[12px] text-muted-foreground italic",children:"No description provided."}),s?i.jsx(If,{className:"justify-start",label:"Loading comments…"}):i.jsx("div",{className:"space-y-2",children:t.map(v=>i.jsxs("div",{className:"rounded-md border border-border bg-muted/20 p-3",children:[i.jsxs("div",{className:"mb-1 flex items-baseline gap-2",children:[i.jsx("span",{className:"text-[11px] font-semibold",children:v.user.login}),i.jsx("span",{className:"text-[10px] text-muted-foreground",children:new Date(v.created_at).toLocaleDateString()})]}),i.jsx(bv,{content:v.body})]},v.id))})]})}),i.jsx("div",{className:"shrink-0 border-t border-border p-3",children:i.jsxs("form",{className:"flex flex-col gap-2",onSubmit:v=>{x(v)},children:[i.jsx(IQ,{action:i.jsx(J,{disabled:!u.trim()||o,size:"sm",type:"submit",children:o?i.jsxs(i.Fragment,{children:[i.jsx(wv,{size:"sm"})," Posting…"]}):"Comment"}),onChange:h,placeholder:"Add a comment…",value:u}),n?i.jsx(Qe,{variant:"destructive",children:n}):null]})})]})}const GN=30,HQ=4e3;function UQ(e){return e.status==="in_progress"||e.status==="queued"}function WN(e){return e.map(t=>`${t.id}:${t.status}:${t.conclusion}`).join("|")}function KN(e){return e.map(t=>`${t.id}:${t.status}:${t.conclusion}:`+t.steps.map(s=>`${s.number}:${s.status}:${s.conclusion}`).join(",")).join("|")}function FQ(e,t){if(e.length===0)return t;const s=new Map(t.map(u=>[u.id,u])),n=new Set(e.map(u=>u.id)),o=t.filter(u=>!n.has(u.id)),l=e.map(u=>s.get(u.id)??u);return[...o,...l]}function qQ(e){const[t,s]=_.useState([]),[n,o]=_.useState(null),[l,u]=_.useState([]),[h,f]=_.useState(!0),[d,p]=_.useState(!1),[g,x]=_.useState(!1),[v,w]=_.useState(1),[k,N]=_.useState(!1),[E,T]=_.useState(null),[A,C]=_.useState(null);function R(){let P=!0;return f(!0),T(null),w(1),fh(e,1).then(B=>{P&&(s(B),x(B.length===GN))}).catch(B=>{P&&T(B instanceof Error?B.message:String(B))}).finally(()=>{P&&f(!1)}),()=>{P=!1}}function D(){if(d||!g)return;const P=v+1;p(!0),fh(e,P).then(B=>{s(G=>{const F=new Set(G.map(z=>z.id));return[...G,...B.filter(z=>!F.has(z.id))]}),x(B.length===GN),w(P)}).catch(B=>T(B instanceof Error?B.message:String(B))).finally(()=>p(!1))}const $=_.useCallback(()=>{fh(e,1).then(P=>s(B=>{const G=FQ(B,P);return WN(B)===WN(G)?B:G})).catch(()=>{}),n&&jw(n).then(P=>u(B=>KN(B)===KN(P)?B:P)).catch(()=>{})},[e,n]);_.useEffect(R,[e]),_.useEffect(()=>{o(P=>P&&t.some(B=>B.id===P)?P:t[0]?.id??null)},[t]),_.useEffect(()=>{if(!n){u([]);return}let P=!0;return N(!0),C(null),jw(n).then(B=>{P&&u(B)}).catch(B=>{P&&C(B instanceof Error?B.message:String(B))}).finally(()=>{P&&N(!1)}),()=>{P=!1}},[n]);const O=t.some(UQ);return _.useEffect(()=>{if(!O)return;const P=window.setInterval(()=>{document.visibilityState==="visible"&&$()},HQ);return()=>window.clearInterval(P)},[O,$]),{runs:t,selectedRunId:n,jobs:l,loading:h,loadingMore:d,hasMore:g,jobsLoading:k,error:E,jobsError:A,loadMore:D,refresh:R,syncLatest:$,setSelectedRunId:o}}function b4(e){return e.conclusion==="failure"||e.conclusion==="timed_out"||e.conclusion==="cancelled"}function VQ({branch:e,onClearBranch:t}){const{runs:s,selectedRunId:n,jobs:o,loading:l,loadingMore:u,hasMore:h,jobsLoading:f,error:d,jobsError:p,loadMore:g,refresh:x,syncLatest:v,setSelectedRunId:w}=qQ(e);vl(v);const k=s.find(C=>C.id===n)??null,{sendToAgent:N}=At(),[E,T]=_.useState(null);function A(C,R){T(null),N({prompt:uH(C,R),source:{type:"github-run",label:`Run #${C.run_number}`},label:`Run #${C.run_number}: ${R??"fix failing run"}`})}return i.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[i.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-1.5",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("h2",{className:"text-[13px] font-semibold",children:"Workflow Runs"}),e?i.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 text-[11px] text-muted-foreground",children:[i.jsx("span",{className:"shrink-0",children:"Filtered to"}),i.jsx("span",{className:"min-w-0 truncate font-mono",children:e}),t?i.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:i.jsx(Ut,{className:"size-3"})}):null]}):null]}),i.jsxs(J,{disabled:l,onClick:()=>{x()},size:"sm",type:"button",variant:"outline",children:[i.jsx(Rr,{className:`mr-1 size-3.5 ${l?"animate-spin":""}`}),"Refresh"]})]}),i.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:d?i.jsx("div",{className:"p-4 text-[12px] text-red-500",children:d}):l&&s.length===0?i.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading workflow runs…"}):s.length===0?i.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"No workflow runs found."}):i.jsxs("div",{className:"grid h-full min-h-0 grid-cols-[minmax(280px,380px)_minmax(0,1fr)] divide-x divide-border",children:[i.jsxs("div",{className:"min-h-0 overflow-auto",children:[i.jsx("ul",{className:"divide-y divide-border",children:s.map(C=>i.jsxs("li",{className:"group flex flex-col",children:[i.jsxs("div",{className:`flex items-center transition-colors hover:bg-muted/60 ${C.id===n?"bg-muted/70":""}`,children:[i.jsxs("button",{className:"flex min-w-0 flex-1 items-center gap-3 px-3 py-2.5 text-left",onClick:()=>w(C.id),type:"button",children:[i.jsx(GQ,{run:C}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block truncate text-[13px] font-medium",children:C.name}),i.jsxs("span",{className:"block text-[11px] text-muted-foreground",children:["#",C.run_number," · ",C.head_branch," · ",C.event," ·"," ",i.jsx("span",{title:new Date(C.created_at).toLocaleString(),children:mE(C.created_at)})]})]}),i.jsx(WQ,{run:C})]}),b4(C)?i.jsx(Qi,{className:`mr-2 shrink-0 ${E===C.id?"opacity-100":""}`,label:`Fix failing run #${C.run_number} with AI`,onAsk:()=>T(R=>R===C.id?null:C.id)}):null]}),E===C.id?i.jsx("div",{className:"px-3 pb-2 pt-0.5",children:i.jsx(Mr,{onCancel:()=>T(null),onSubmit:R=>A(C,R),placeholder:"What should the agent do? (fix it, explain the failure, find the broken step…)"})}):null]},C.id))}),i.jsx(Sv,{hasMore:h,loading:u,onLoadMore:g})]}),i.jsx(KQ,{error:p,jobs:o,loading:f,onFix:C=>A(C),run:k})]})})]})}function GQ({run:e}){return e.status==="in_progress"||e.status==="queued"?i.jsx(ul,{className:"size-4 shrink-0 animate-pulse text-amber-400"}):e.conclusion==="success"?i.jsx(ff,{className:"size-4 shrink-0 text-emerald-500"}):e.conclusion==="failure"||e.conclusion==="timed_out"?i.jsx(ib,{className:"size-4 shrink-0 text-red-500"}):i.jsx(ul,{className:"size-4 shrink-0 text-zinc-400"})}function WQ({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 i.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1.5 text-[10px] font-medium text-muted-foreground",children:[i.jsx("span",{className:`size-1.5 rounded-full ${s}`}),t]})}function KQ({run:e,jobs:t,loading:s,error:n,onFix:o}){return e?i.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[i.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block truncate text-[13px] font-semibold",children:e.name}),i.jsxs("span",{className:"block text-[11px] text-muted-foreground",children:["Run #",e.run_number," · ",e.head_branch," · ",e.head_sha.slice(0,7)]})]}),b4(e)?i.jsxs(J,{className:"shrink-0 gap-1",onClick:()=>o(e),size:"sm",title:"Send this failing run to the agent to investigate and fix",type:"button",variant:"outline",children:[i.jsx(qt,{className:"size-3.5"}),"Fix with AI"]}):null,i.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:i.jsx(io,{className:"size-3.5"})})]}),i.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:n?i.jsx("div",{className:"p-4 text-[12px] text-red-500",children:n}):s?i.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading jobs…"}):t.length===0?i.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"No jobs found for this run."}):i.jsx("ul",{className:"divide-y divide-border",children:t.map(l=>i.jsxs("li",{className:"px-3 py-3",children:[i.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[i.jsx(YN,{item:l}),i.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] font-medium",children:l.name}),i.jsx("span",{className:"shrink-0 font-mono text-[11px] text-muted-foreground",children:XN(l.started_at,l.completed_at)}),i.jsx("a",{"aria-label":`Open ${l.name} job on GitHub`,className:"shrink-0 rounded p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",href:l.html_url,rel:"noopener noreferrer",target:"_blank",title:"Open job on GitHub",children:i.jsx(io,{className:"size-3.5"})})]}),l.steps.length?i.jsx("ol",{className:"space-y-1.5 pl-6",children:l.steps.map(u=>i.jsxs("li",{className:"flex items-center gap-2 text-[12px]",children:[i.jsx(YN,{item:u}),i.jsx("span",{className:"min-w-0 flex-1 truncate",children:u.name}),i.jsx("span",{className:"shrink-0 font-mono text-[11px] text-muted-foreground",children:XN(u.started_at,u.completed_at)})]},`${l.id}:${u.number}`))}):i.jsx("p",{className:"pl-6 text-[12px] text-muted-foreground",children:"No step details available."})]},l.id))})})]}):i.jsx("div",{className:"flex h-full items-center justify-center text-[12px] text-muted-foreground",children:"Select a workflow run"})}function YN({item:e}){return e.status==="in_progress"||e.status==="queued"?i.jsx(ul,{className:"size-3.5 shrink-0 animate-pulse text-amber-400"}):e.conclusion==="success"||e.conclusion==="skipped"?i.jsx(ff,{className:"size-3.5 shrink-0 text-emerald-500"}):e.conclusion==="failure"||e.conclusion==="timed_out"||e.conclusion==="cancelled"?i.jsx(ib,{className:"size-3.5 shrink-0 text-red-500"}):i.jsx(ul,{className:"size-3.5 shrink-0 text-zinc-400"})}function XN(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 YQ({onCreatePR:e,onViewRuns:t}){const[s,n]=_.useState(null),[o,l]=_.useState(!0),[u,h]=_.useState(null);function f(){let p=!0;return l(!0),h(null),aO().then(g=>{p&&n(g)}).catch(g=>{p&&h(g instanceof Error?g.message:String(g))}).finally(()=>{p&&l(!1)}),()=>{p=!1}}_.useEffect(f,[]),vl(()=>{f()});const d=_.useMemo(()=>[...s?.branches??[]].sort((g,x)=>{const v=QN(g,s),w=QN(x,s);return v-w||g.name.localeCompare(x.name)}),[s]);return i.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[i.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-1.5",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("h2",{className:"text-[13px] font-semibold",children:"Branches"}),i.jsx("p",{className:"truncate text-[11px] text-muted-foreground",children:s?.repository.full_name??"Selected repository"})]}),i.jsxs(J,{disabled:o,onClick:()=>{f()},size:"sm",type:"button",variant:"outline",children:[i.jsx(Rr,{className:`mr-1 size-3.5 ${o?"animate-spin":""}`}),"Refresh"]})]}),i.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:u?i.jsx("div",{className:"p-4 text-[12px] text-red-500",children:u}):o&&!s?i.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading branches..."}):d.length===0?i.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"No branches found."}):i.jsx("ul",{className:"divide-y divide-border",children:d.map(p=>i.jsx(XQ,{branch:p,currentBranch:s?.currentBranch??null,defaultBranch:s?.defaultBranch??null,onCreatePR:e,onViewRuns:t},p.name))})})]})}function XQ({branch:e,defaultBranch:t,currentBranch:s,onCreatePR:n,onViewRuns:o}){const l=e.name===t,u=e.name===s,h=!l;return i.jsxs("li",{className:"flex flex-wrap items-center gap-3 px-3 py-2.5",children:[i.jsx(Gn,{className:"size-4 shrink-0 text-muted-foreground"}),i.jsxs("div",{className:"min-w-48 flex-1",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i.jsx("span",{className:"truncate font-mono text-[13px] font-medium",children:e.name}),l?i.jsx(ZN,{label:"Default",tone:"success"}):null,u?i.jsx(ZN,{label:"Current",tone:"warning"}):null,e.protected?i.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 text-[10px] text-muted-foreground",children:[i.jsx(zM,{className:"size-3"}),"protected"]}):null]}),i.jsx("div",{className:"mt-0.5 font-mono text-[11px] text-muted-foreground",children:e.commit.sha.slice(0,7)})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[i.jsxs(J,{onClick:()=>o(e.name),size:"sm",title:`View workflow runs for ${e.name}`,type:"button",variant:"outline",children:[i.jsx(pR,{className:"size-3.5"}),"View runs"]}),i.jsxs(J,{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:[i.jsx(gC,{className:"size-3.5"}),"Open PR"]})]})]})}function ZN({label:e,tone:t}){const s=t==="success"?"bg-emerald-500":"bg-amber-500";return i.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 text-[10px] text-muted-foreground",children:[i.jsx("span",{className:`size-1.5 rounded-full ${s}`}),e]})}function QN(e,t){return e.name===t?.currentBranch?0:e.name===t?.defaultBranch?1:e.protected?2:3}function ZQ(){const e=wQ();let t;return e.loading||e.status==="checking"?t=i.jsx(If,{fill:!0,label:"Loading…"}):e.status==="not_configured"?t=i.jsx(f4,{deviceFlowAvailable:e.deviceFlowAvailable,onSaved:e.refresh}):e.status==="auth_error"||e.status==="connection_error"?t=i.jsx(QQ,{token:e}):t=i.jsx(JQ,{token:e}),i.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-card/85",children:t})}function QQ({token:e}){const[t,s]=_.useState(null);if(t)return i.jsx(f4,{deviceFlowAvailable:e.deviceFlowAvailable,initialMode:t,onSaved:e.refresh});const n=e.status==="auth_error";return i.jsx("div",{className:"flex h-full items-center justify-center p-8",children:i.jsxs("div",{className:"w-full max-w-lg space-y-4 rounded-md border border-border bg-card p-5",children:[i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx(Lf,{className:"size-5"}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("h2",{className:"text-sm font-semibold",children:"GitHub connection failed"}),i.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."})]}),i.jsx(v4,{label:n?"Needs re-login":"Connection problem",tone:n?"danger":"warning"})]}),e.error?i.jsx(Qe,{variant:"destructive",children:e.error}):null,i.jsxs("div",{className:"flex flex-wrap gap-2",children:[i.jsxs(J,{onClick:e.refresh,type:"button",variant:n?"outline":"default",children:[i.jsx(Rr,{}),"Refresh"]}),i.jsx(J,{onClick:()=>s(e.deviceFlowAvailable?"device-pending":"pat"),type:"button",variant:n?"default":"outline",children:"Reconnect GitHub"}),i.jsx(J,{onClick:()=>s("pat"),type:"button",variant:"outline",children:"Use token instead"})]})]})})}function JQ({token:e}){const[t,s]=ol("github:tab","prs"),[n,o]=ol("github:pr-state","open"),[l,u]=ol("github:issue-state","open"),[h,f]=_.useState(null),[d,p]=_.useState(null),[g,x]=_.useState(!1),[v,w]=_.useState(null),k=SQ(n),N=kQ(l);vl(()=>{t==="prs"?k.refresh():t==="issues"&&N.refresh()});const E=C=>`rounded px-2 py-0.5 text-[11px] font-medium transition-colors ${C?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,T=C=>`rounded px-2 py-0.5 text-[10px] font-medium transition-colors ${C?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`;async function A(){x(!0),w(null);try{await rO("github.com"),e.refresh()}catch(C){w(C instanceof Error?C.message:String(C))}finally{x(!1)}}return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex shrink-0 items-center gap-1 border-b border-border bg-card/95 px-3 py-1",children:[i.jsx("button",{className:E(t==="prs"),onClick:()=>s("prs"),type:"button",children:"Pull Requests"}),i.jsx("button",{className:E(t==="issues"),onClick:()=>s("issues"),type:"button",children:"Issues"}),i.jsx("button",{className:E(t==="branches"),onClick:()=>s("branches"),type:"button",children:"Branches"}),i.jsx("button",{className:E(t==="actions"),onClick:()=>s("actions"),type:"button",children:"Actions"}),i.jsxs("div",{className:"ml-auto flex min-w-0 items-center gap-2",children:[i.jsx(eJ,{token:e}),i.jsxs(J,{onClick:e.refresh,size:"sm",title:"Re-check the GitHub connection",type:"button",variant:"outline",children:[i.jsx(Rr,{}),"Reconnect"]}),i.jsx(J,{disabled:g,onClick:()=>{A()},size:"sm",type:"button",variant:"outline",children:g?"Disconnecting…":"Disconnect"})]}),t==="prs"?i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("div",{className:"flex items-center gap-0.5 rounded-md bg-muted/60 p-0.5",children:[i.jsx("button",{className:T(n==="open"),onClick:()=>o("open"),type:"button",children:"Open"}),i.jsx("button",{className:T(n==="closed"),onClick:()=>o("closed"),type:"button",children:"Closed"})]}),i.jsx(J,{onClick:()=>f(""),size:"sm",type:"button",variant:"outline",children:"New PR"})]}):t==="issues"?i.jsxs("div",{className:"flex items-center gap-0.5 rounded-md bg-muted/60 p-0.5",children:[i.jsx("button",{className:T(l==="open"),onClick:()=>u("open"),type:"button",children:"Open"}),i.jsx("button",{className:T(l==="closed"),onClick:()=>u("closed"),type:"button",children:"Closed"})]}):null]}),v?i.jsx(Qe,{variant:"destructive",className:"m-3",children:v}):null,h!==null?i.jsx(tJ,{initialHead:h,onCreated:C=>{f(null),s("prs"),k.setSelectedNumber(C.number),k.refresh()},onCancel:()=>f(null)}):i.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:t==="prs"?i.jsxs("div",{className:"grid h-full min-h-0 grid-cols-[minmax(0,1fr)_minmax(0,2fr)] divide-x divide-border",children:[i.jsx("div",{className:"min-h-0 overflow-auto",children:i.jsx(EQ,{error:k.error,hasMore:k.hasMore,loading:k.loading,loadingMore:k.loadingMore,onLoadMore:k.loadMore,onSelect:k.setSelectedNumber,prs:k.prs,selectedNumber:k.selectedNumber})}),i.jsx("div",{className:"flex min-h-0 min-w-0 flex-col overflow-hidden",children:i.jsx(AQ,{diff:k.diff,diffError:k.diffError,diffLoading:k.diffLoading,onMerged:()=>k.refresh(),pr:k.selectedPR})})]}):t==="issues"?i.jsxs("div",{className:"grid h-full min-h-0 grid-cols-[minmax(0,1fr)_minmax(0,2fr)] divide-x divide-border",children:[i.jsx("div",{className:"min-h-0 overflow-auto",children:i.jsx(LQ,{error:N.error,hasMore:N.hasMore,issues:N.issues,loading:N.loading,loadingMore:N.loadingMore,onLoadMore:N.loadMore,onSelect:N.setSelectedNumber,selectedNumber:N.selectedNumber})}),i.jsx("div",{className:"flex min-h-0 min-w-0 flex-col overflow-hidden",children:i.jsx($Q,{commentError:N.commentError,comments:N.comments,commentsLoading:N.commentsLoading,issue:N.selectedIssue,onAddComment:N.addComment,submitting:N.submitting})})]}):t==="branches"?i.jsx(YQ,{onCreatePR:C=>f(C),onViewRuns:C=>{p(C),s("actions")}}):i.jsx(VQ,{branch:d??void 0,onClearBranch:()=>p(null)})})]})}function eJ({token:e}){const t=e.info?.repository?.full_name??(e.info?.user?`@${e.info.user.login}`:"GitHub");return i.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 border-r border-border pr-2",children:[i.jsx(Lf,{className:"size-4 shrink-0 text-foreground"}),i.jsx(v4,{label:"Connected",tone:"success"}),i.jsx("span",{className:"max-w-48 truncate font-mono text-[10px] text-muted-foreground",children:t})]})}function v4({label:e,tone:t}){const s=t==="success"?"bg-emerald-500":t==="danger"?"bg-red-500":"bg-amber-500";return i.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1.5 text-[11px] font-medium text-muted-foreground",children:[i.jsx("span",{className:`size-1.5 rounded-full ${s}`}),e]})}function tJ({initialHead:e,onCreated:t,onCancel:s}){const[n,o]=_.useState(""),[l,u]=_.useState(""),[h,f]=_.useState(""),[d,p]=_.useState("main"),[g,x]=_.useState(!1),[v,w]=_.useState(null),[k,N]=_.useState(!0),[E,T]=_.useState(!1),[A,C]=_.useState(null);_.useEffect(()=>{let O=!0;return N(!0),C(null),uO().then(P=>{O&&(w(P),o(P.title),u(P.body),f(e||P.head),p(P.base||P.suggestedBase||"main"),x(P.draft))}).catch(P=>{O&&C(P instanceof Error?P.message:String(P))}).finally(()=>{O&&N(!1)}),()=>{O=!1}},[e]);async function R(O){if(O.preventDefault(),!(!n.trim()||!h.trim()||!d.trim())){T(!0),C(null);try{const P=await dO({title:n.trim(),body:l.trim()||void 0,head:h.trim(),base:d.trim(),draft:g});t(P)}catch(P){C(P instanceof Error?P.message:String(P))}finally{T(!1)}}}const D="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",$=v?.warnings??[];return i.jsxs("form",{className:"flex min-h-0 flex-col gap-3 overflow-auto bg-muted/20 p-4",onSubmit:O=>{R(O)},children:[i.jsxs("div",{className:"flex items-start justify-between gap-3",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("h3",{className:"text-[13px] font-semibold",children:"Branch to PR Assistant"}),i.jsxs("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:[v?.repository?.full_name??"Selected repository",v?.currentBranch?` - ${v.currentBranch}`:""]})]}),i.jsx("span",{className:"shrink-0 text-[11px] text-muted-foreground",children:k?"Detecting branch...":"Editable draft"})]}),i.jsx(sJ,{template:v,loading:k}),$.length>0?i.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:$[0]}):null,i.jsx("input",{className:D,disabled:k,onChange:O=>o(O.target.value),placeholder:"Title",required:!0,value:n}),i.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[i.jsxs("label",{className:"space-y-1",children:[i.jsx("span",{className:"text-[10px] uppercase text-muted-foreground",children:"Head"}),i.jsx("input",{className:D,disabled:k,onChange:O=>f(O.target.value),placeholder:"Head branch",required:!0,value:h})]}),i.jsxs("label",{className:"space-y-1",children:[i.jsx("span",{className:"text-[10px] uppercase text-muted-foreground",children:"Base"}),i.jsx("input",{className:D,disabled:k,onChange:O=>p(O.target.value),placeholder:"Base branch",required:!0,value:d})]})]}),i.jsx("textarea",{className:`${D} resize-none`,disabled:k,onChange:O=>u(O.target.value),placeholder:"Description (optional)",rows:7,value:l}),i.jsxs("label",{className:"flex items-center gap-2 text-[12px]",children:[i.jsx("input",{checked:g,className:"size-3.5",disabled:k,onChange:O=>x(O.target.checked),type:"checkbox"}),"Create as draft"]}),A?i.jsx(Qe,{variant:"destructive",children:A}):null,i.jsxs("div",{className:"flex gap-2",children:[i.jsx(J,{disabled:k||E||!n.trim()||!h.trim()||!d.trim(),type:"submit",children:E?"Creating…":"Create PR"}),i.jsx(J,{onClick:s,type:"button",variant:"outline",children:"Cancel"})]})]})}function sJ({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 i.jsxs("div",{className:"rounded-md border border-border bg-card px-3 py-2",children:[i.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[i.jsx("span",{className:"text-[11px] font-medium text-foreground",children:"Compare summary"}),s?.headSha?i.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:s.headSha.slice(0,7)}):null]}),i.jsx("div",{className:"grid grid-cols-5 gap-2",children:o.map(l=>i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"truncate text-[10px] uppercase text-muted-foreground",children:l.label}),i.jsx("div",{className:"truncate font-mono text-[11px] text-foreground",children:l.value})]},l.label))}),s?.files.length?i.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=>i.jsxs("span",{className:"max-w-52 truncate",children:[l.status," ",l.path]},`${l.status}:${l.path}`))}):null]})}function nJ({data:e,docked:t,scopeAll:s,onScopeChange:n,onRefresh:o,onClose:l,onManage:u}){const{error:h,success:f}=as(),d=e.git.selectedRepository;async function p(w){l();try{await qC(w),n(!1),await o(),f(`Switched to ${w}.`)}catch(k){h(k instanceof Error?k.message:String(k))}}function g(){l(),n(!0),f("Showing all projects.")}const x=w=>ae("grid h-8 grid-cols-[48px_minmax(0,1fr)] items-center overflow-hidden rounded-md text-left transition-[background-color,width] duration-150 hover:bg-muted",t?"w-full":"w-12 group-hover/sidebar:w-full",w&&"bg-muted/60"),v=ae("flex min-w-0 items-center gap-2 overflow-hidden whitespace-pre pr-2 text-xs transition duration-150",t?"translate-x-1 opacity-100":"opacity-0 group-hover/sidebar:translate-x-1 group-hover/sidebar:opacity-100");return i.jsxs("div",{className:"mt-1 grid gap-0.5",children:[i.jsxs("button",{className:x(s),onClick:g,title:"All projects",type:"button",children:[i.jsx("span",{className:"flex h-8 w-12 items-center justify-center",children:i.jsx(Th,{className:"size-4 text-muted-foreground"})}),i.jsxs("span",{className:v,children:[i.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:"All projects"}),s?i.jsx(Ds,{className:"size-3.5 shrink-0"}):null]})]}),e.config.gitRepositories.map(w=>{const k=!s&&w.name===d?.name;return i.jsxs("button",{className:x(k),onClick:()=>{p(w.name)},title:w.path,type:"button",children:[i.jsx("span",{className:"flex h-8 w-12 items-center justify-center",children:i.jsx(df,{className:"size-4 text-muted-foreground"})}),i.jsxs("span",{className:v,children:[i.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:w.name}),k?i.jsx(Ds,{className:"size-3.5 shrink-0"}):null]})]},w.name)}),i.jsxs("button",{className:ae("grid h-8 grid-cols-[48px_minmax(0,1fr)] items-center overflow-hidden rounded-md text-left text-muted-foreground transition-[background-color,color,width] duration-150 hover:bg-muted hover:text-foreground",t?"w-full":"w-12 group-hover/sidebar:w-full"),onClick:()=>{l(),u()},title:"Add or manage projects",type:"button",children:[i.jsx("span",{className:"flex h-8 w-12 items-center justify-center",children:i.jsx(lb,{className:"size-4"})}),i.jsx("span",{className:v,children:i.jsx("span",{className:"min-w-0 flex-1 truncate",children:"Add or manage projects…"})})]})]})}function iJ({data:e,docked:t,scopeAll:s,onScopeChange:n,onRefresh:o}){const[l,u]=_.useState(!1),[h,f]=_.useState(!1),d=e.git.selectedRepository,p=s?"All projects":d?.name??"Pick a project",g=e.config.gitRepositories.length,x=s?`${g} project${g===1?"":"s"}`:d?e.git.status?.branch??d.path:"set the context";return i.jsxs(i.Fragment,{children:[i.jsxs("button",{"aria-label":`Project scope: ${p}`,className:ae("relative grid h-11 grid-cols-[48px_minmax(0,1fr)] items-center overflow-hidden rounded-md text-left transition-[background-color,width] duration-150 hover:bg-muted",t?"w-full":"w-12 group-hover/sidebar:w-full"),"aria-expanded":l,onClick:()=>u(v=>!v),title:`Project scope: ${p}`,type:"button",children:[i.jsx("span",{className:"flex h-11 w-12 items-center justify-center",children:i.jsx("span",{className:"flex size-8 items-center justify-center rounded-lg border border-border bg-background text-[13px] font-semibold text-foreground",children:s?i.jsx(Th,{className:"size-4 text-muted-foreground"}):d?p.charAt(0).toUpperCase():i.jsx(df,{className:"size-4 text-muted-foreground"})})}),i.jsxs("span",{className:ae("min-w-0 overflow-hidden whitespace-pre pr-8 transition duration-150",t?"translate-x-1 opacity-100":"opacity-0 group-hover/sidebar:translate-x-1 group-hover/sidebar:opacity-100"),children:[i.jsx("span",{className:"block truncate text-[13px] font-semibold leading-tight",children:p}),i.jsx("span",{className:"block truncate text-[10px] leading-tight text-muted-foreground",children:x})]}),i.jsx(Wn,{className:ae("absolute right-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground transition-[opacity,transform] duration-150",t?"opacity-100":"opacity-0 group-hover/sidebar:opacity-100",l&&"rotate-180")})]}),l?i.jsx(nJ,{data:e,docked:t,onClose:()=>u(!1),onManage:()=>f(!0),onRefresh:o,onScopeChange:n,scopeAll:s}):null,h?i.jsx(rJ,{data:e,onClose:()=>f(!1),onRefresh:o,onScopeChange:n,scopeAll:s}):null]})}function rJ({data:e,onClose:t,onRefresh:s,onScopeChange:n,scopeAll:o}){const[l,u]=_.useState("path"),[h,f]=_.useState(e.git.cwd),[d,p]=_.useState(""),[g,x]=_.useState(!1),[v,w]=_.useState(null),[k,N]=_.useState(!1),[E,T]=_.useState(e.git.cwd),A=e.git.selectedRepository,{error:C,success:R}=as();async function D(F){try{await qC(F),n(!1),t(),await s(),R(`Switched to ${F}.`)}catch(z){C(z instanceof Error?z.message:String(z))}}function $(){n(!0),t(),R("Showing all projects.")}async function O(F){const z=F.trim();if(!z.startsWith("/")){const U="Please add an absolute path. Paths beginning with ~ are not expanded here.";return w(U),C(U),!1}try{const U=i4(z);return await X7(U,z),w(null),await s(),R(`Added Git project ${U}.`),!0}catch(U){const K=U instanceof Error?U.message:String(U);return w(K),C(K),!1}}async function P(F){try{await Y7(F),await s(),R(`Removed Git project ${F}.`)}catch(z){C(z instanceof Error?z.message:String(z))}}async function B(F){F.preventDefault(),await O(h)&&t()}async function G(F){F.preventDefault();const z=d.trim();if(z){x(!0),w(null);try{const{name:U}=await Z7(z);p(""),await s(),R(`Cloned and added ${U}.`),t()}catch(U){const K=U instanceof Error?U.message:String(U);w(K),C(K)}finally{x(!1)}}}return tr.createPortal(i.jsxs("div",{className:"fixed inset-0 z-[1000] grid place-items-center bg-black/35 px-4",onMouseDown:F=>{F.target===F.currentTarget&&t()},children:[i.jsxs("div",{className:"w-full max-w-md overflow-hidden rounded-xl border border-border bg-card shadow-xl",children:[i.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-4 py-3",children:[i.jsx(Th,{className:"size-4 text-muted-foreground"}),i.jsx("div",{className:"text-sm font-semibold",children:"Projects"}),i.jsx(Ge,{className:"h-5 px-1.5 text-[10px]",variant:"outline",children:e.config.gitRepositories.length}),i.jsx(J,{"aria-label":"Close project switcher",className:"ml-auto size-7",onClick:t,size:"icon",variant:"ghost",children:i.jsx(Ut,{className:"size-4"})})]}),i.jsxs("div",{className:"max-h-80 overflow-auto",children:[i.jsxs("button",{className:ae("grid w-full grid-cols-[1fr_auto] items-center gap-2 border-b border-border px-4 py-2.5 text-left transition-colors hover:bg-muted",o&&"bg-muted/70"),onClick:$,type:"button",children:[i.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[i.jsx(Th,{className:"size-3.5 shrink-0 text-muted-foreground"}),i.jsxs("span",{className:"min-w-0",children:[i.jsx("span",{className:"block truncate text-sm font-medium leading-tight",children:"All projects"}),i.jsx("span",{className:"block truncate text-[10px] leading-tight text-muted-foreground",children:"Everything the daemon runs, across every repo"})]})]}),o?i.jsx(Ds,{className:"size-3.5"}):i.jsx("span",{className:"size-3.5"})]}),e.config.gitRepositories.length?i.jsx("div",{className:"divide-y divide-border",children:e.config.gitRepositories.map(F=>{const z=!o&&F.name===A?.name;return i.jsxs("div",{className:ae("group grid w-full grid-cols-[1fr_auto_auto] items-center gap-2 px-4 py-2 text-left transition-colors hover:bg-muted",z&&"bg-muted/70"),children:[i.jsxs("button",{className:"min-w-0 text-left",onClick:()=>{D(F.name)},type:"button",children:[i.jsx("span",{className:"block truncate text-sm font-medium leading-tight",children:F.name}),i.jsx("span",{className:"block truncate font-mono text-[10px] leading-tight text-muted-foreground",children:F.path})]}),z?i.jsx(Ds,{className:"size-3.5"}):i.jsx("span",{className:"size-3.5"}),i.jsx(J,{"aria-label":`Remove ${F.name}`,className:"size-6 opacity-0 transition-opacity group-hover:opacity-100",onClick:()=>{P(F.name)},size:"icon",title:`Remove ${F.name}`,type:"button",variant:"ghost",children:i.jsx(Mi,{className:"size-3.5 text-destructive"})})]},F.name)})}):i.jsx("div",{className:"px-4 py-6 text-center text-xs text-muted-foreground",children:"No saved Git projects yet."})]}),i.jsxs("div",{className:"border-t border-border bg-muted/20 p-3",children:[i.jsxs("div",{className:"mb-1.5 flex gap-1 text-[11px]",children:[i.jsxs("button",{className:ae("flex items-center gap-1 rounded px-2 py-0.5 transition-colors",l==="path"?"bg-muted font-medium text-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>{u("path"),w(null)},type:"button",children:[i.jsx(co,{className:"size-3"}),"Local path"]}),i.jsxs("button",{className:ae("flex items-center gap-1 rounded px-2 py-0.5 transition-colors",l==="url"?"bg-muted font-medium text-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>{u("url"),w(null)},type:"button",children:[i.jsx(Xc,{className:"size-3"}),"Clone URL"]})]}),l==="path"?i.jsxs("form",{className:"flex gap-1.5",onSubmit:B,children:[i.jsx(dt,{"aria-label":"Paste absolute path",className:"h-7 flex-1 px-2 font-mono text-[11px]",onChange:F=>{f(F.target.value),w(null)},placeholder:"/absolute/path",value:h}),i.jsxs(J,{className:"h-7 px-2 text-[11px]",size:"sm",type:"submit",children:[i.jsx(ps,{className:"size-3"}),"Add"]}),i.jsx(J,{"aria-label":"Browse and add Git project",className:"h-7 px-2",onClick:()=>{w(null),T(e.git.cwd),N(!0)},size:"sm",type:"button",variant:"outline",children:i.jsx(lb,{className:"size-3"})})]}):i.jsxs("form",{className:"flex gap-1.5",onSubmit:G,children:[i.jsx(dt,{"aria-label":"Git remote URL",className:"h-7 flex-1 px-2 font-mono text-[11px]",onChange:F=>{p(F.target.value),w(null)},placeholder:"https://… or git@host:owner/repo.git",value:d}),i.jsxs(J,{className:"h-7 px-2 text-[11px]",disabled:g||!d.trim(),size:"sm",type:"submit",children:[i.jsx(Xc,{className:"size-3"}),g?"Cloning…":"Clone"]})]}),v?i.jsx("div",{className:"mt-1.5 truncate text-[10px] text-destructive",children:v}):null,l==="url"?i.jsx("div",{className:"mt-1 text-[10px] text-muted-foreground",children:"Private github.com repos reuse your GitHub login; SSH uses your machine's keys. Clones into ~/.nomoreide/repos."}):null]})]}),k?i.jsx(r4,{confirmLabel:"Add Git project",errorMessage:v,initialPath:e.git.cwd,selectedPath:E,title:"Add Git Project",onCancel:()=>N(!1),onSelect:T,onUse:async()=>{await O(E)&&(N(!1),t())}}):null]}),document.body)}function aJ({ahead:e=0,behind:t=0,branches:s,currentBranch:n,disabled:o,onRefresh:l,upstream:u}){const[h,f]=_.useState(!1),[d,p]=_.useState(""),[g,x]=_.useState(null),[v,w]=_.useState(null),[k,N]=_.useState(null),E=s.filter(P=>!P.remote),T=s.filter(P=>P.remote);async function A(P,B){x(P),N(null),w(null);try{await B(),await l()}catch(G){N(G instanceof Error?G.message:String(G))}finally{x(null)}}async function C(P){await A(`switch:${P}`,async()=>{await Ai("/api/git/branches/switch",{name:P}),f(!1)})}async function R(){await A("fetch",async()=>{await Ai("/api/git/fetch",{}),w("Fetched latest branch refs.")})}async function D(){await A("push",async()=>{const P=await yf();w(P.setUpstream?`Pushed ${P.branch} and set upstream.`:`Pushed ${P.branch}.`)})}const $=!!n&&(e>0||!u&&t===0);async function O(P){P.preventDefault();const B=d.trim();if(!B){N("Branch name is required.");return}await A("create",async()=>{await Ai("/api/git/branches",{name:B}),p(""),f(!1)})}return i.jsxs("div",{className:"fixed bottom-12 right-4 z-50 flex items-end",children:[h?i.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:[i.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-border p-3",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i.jsx(Gn,{className:"size-4 text-muted-foreground"}),i.jsx("span",{className:"truncate text-sm font-semibold",children:n||"Branches"})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[$?i.jsxs(J,{"aria-label":"Push current branch",className:"gap-1.5 px-2 text-xs",disabled:o||g!==null,onClick:()=>{D()},size:"sm",title:u?`Push ${e} commit${e===1?"":"s"} to ${u}`:"Push and set upstream",type:"button",variant:"default",children:[i.jsx(bf,{className:ae("size-3.5",g==="push"&&"animate-pulse")}),"Push",e>0?` ${e}`:""]}):null,i.jsx(J,{"aria-label":"Fetch branches",disabled:o||g!==null,onClick:()=>{R()},size:"icon",title:"Fetch branches",type:"button",variant:"ghost",children:i.jsx(Rr,{className:ae(g==="fetch"&&"animate-spin")})}),i.jsx(J,{"aria-label":"Close branch dialog",onClick:()=>f(!1),size:"icon",type:"button",variant:"ghost",children:i.jsx(Ut,{})})]})]}),i.jsx("div",{className:"max-h-72 overflow-auto",children:s.length?i.jsxs(i.Fragment,{children:[i.jsx(JN,{branches:E,busy:g!==null,disabled:o,label:"Local",onSwitch:C}),i.jsx(JN,{branches:T,busy:g!==null,disabled:o,label:"Remote",onSwitch:C})]}):i.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"No branches found."})}),i.jsxs("div",{className:"border-t border-border p-3",children:[i.jsxs("form",{className:"grid gap-2 sm:grid-cols-[1fr_auto]",onSubmit:O,children:[i.jsx(dt,{"aria-label":"New branch name",disabled:o||g!==null,onChange:P=>{p(P.target.value),N(null),w(null)},placeholder:"feature/new-work",value:d}),i.jsxs(J,{disabled:o||g!==null,type:"submit",children:[i.jsx(a6,{}),"Create"]})]}),k||v?i.jsx(Qe,{className:"mt-3 px-3 py-2 text-xs",variant:k?"destructive":"muted",children:k??v}):null]})]}):null,i.jsxs(J,{className:"h-8 max-w-[260px] gap-2 rounded-md shadow-lg",disabled:o,onClick:()=>f(P=>!P),size:"sm",title:"Switch Git branch",type:"button",variant:"default",children:[i.jsx(Gn,{className:"size-4"}),i.jsx("span",{className:"truncate font-mono text-xs",children:n||"No branch"}),n&&(e>0||t>0)?i.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?i.jsxs("span",{className:"flex items-center",children:[i.jsx(cf,{className:"size-3"}),t]}):null,e>0?i.jsxs("span",{className:"flex items-center",children:[i.jsx(uf,{className:"size-3"}),e]}):null]}):null,i.jsx(Wn,{className:ae("size-4 transition-transform",h&&"rotate-180")})]})]})}function JN({branches:e,busy:t,disabled:s,label:n,onSwitch:o}){return i.jsxs("section",{children:[i.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=>i.jsxs("button",{className:ae("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:[i.jsxs("span",{className:"min-w-0",children:[i.jsx("span",{className:"block truncate font-medium",children:l.name}),l.upstream?i.jsxs("span",{className:"block truncate font-mono text-[11px] text-muted-foreground",children:["tracks ",l.upstream]}):null]}),i.jsx(Ge,{variant:l.current?"success":l.remote?"outline":"secondary",children:l.current?"current":l.remote?"remote":"local"})]},`${l.remote?"remote":"local"}:${l.name}`)):i.jsxs("div",{className:"border-b border-border px-3 py-3 text-sm text-muted-foreground",children:["No ",n.toLowerCase()," branches."]})]})}function oJ(){const[e,t]=p5(),s=_.useRef(null),n=_.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(),f=h.left+h.width/2,d=h.top+h.height/2,p=Math.hypot(Math.max(f,window.innerWidth-f),Math.max(d,window.innerHeight-d));u.startViewTransition(()=>{t(o)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${f}px ${d}px)`,`circle(${p}px at ${f}px ${d}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},[e]);return i.jsxs("button",{ref:s,type:"button",onClick:n,title:e==="dark"?"Switch to light mode":"Switch to dark mode","aria-label":"Toggle theme",className:Fh(),children:[i.jsx("span",{className:qh(),children:e==="dark"?i.jsx(jC,{}):i.jsx(_C,{})}),i.jsx("span",{className:Vh(),children:"Theme"})]})}function lJ(){return Us()?i.jsxs("div",{className:"flex items-center justify-between h-8 bg-background border-b border-border select-none",style:{WebkitAppRegion:"drag"},onMouseDown:()=>u8(),children:[i.jsx("span",{className:"px-3 text-xs font-medium text-muted-foreground",children:"NoMoreIDE"}),i.jsxs("div",{className:"flex items-center",style:{WebkitAppRegion:"no-drag"},children:[i.jsx("button",{type:"button",onClick:o8,className:"h-8 w-10 flex items-center justify-center hover:bg-muted transition-colors","aria-label":"Minimize",children:i.jsx(vC,{className:"h-3 w-3"})}),i.jsx("button",{type:"button",onClick:l8,className:"h-8 w-10 flex items-center justify-center hover:bg-muted transition-colors","aria-label":"Maximize",children:i.jsx(ro,{className:"h-3 w-3"})}),i.jsx("button",{type:"button",onClick:c8,className:"h-8 w-10 flex items-center justify-center hover:bg-destructive hover:text-destructive-foreground transition-colors","aria-label":"Close",children:i.jsx(Ut,{className:"h-3 w-3"})})]})]}):null}const _4={services:"/",git:"/git",github:"/github",workflows:"/workflows",errors:"/errors",database:"/database",terminal:"/terminal",agent:"/agent","agent-env":"/agent-env",settings:"/settings"},cJ={services:"Services",git:"Git Review",github:"GitHub",workflows:"Workflows",errors:"Error Inbox",database:"Database",terminal:"Terminal",agent:"Agent Console","agent-env":"Agent Environments",settings:"Settings"},uJ=Object.entries(_4).filter(([,e])=>e!=="/").sort(([,e],[,t])=>t.length-e.length);function dJ(e){for(const[t,s]of uJ)if(e.startsWith(s))return t;return"services"}const hJ=[{label:"Run",items:[{page:"services",label:"Services",icon:i.jsx(fb,{})},{page:"errors",label:"Error Inbox",icon:i.jsx(Zc,{})},{page:"terminal",label:"Terminal",icon:i.jsx(xf,{})}]},{label:"Code",items:[{page:"git",label:"Git Review",icon:i.jsx(Gn,{})},{page:"github",label:"GitHub",icon:i.jsx(Lf,{})},{page:"workflows",label:"Workflows",icon:i.jsx(Mh,{})}]},{label:"Data",items:[{page:"database",label:"Database",icon:i.jsx(di,{})}]},{label:"Agent",items:[{page:"agent",label:"Console",icon:i.jsx(rC,{})},{page:"agent-env",label:"Environments",icon:i.jsx(hb,{})}]}];function fJ(e=!1){return ae("group/sidebar hidden h-full shrink-0 overflow-x-hidden overflow-y-auto border-r border-border bg-card/85 py-4 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 mJ(e,t=!1){return ae("relative grid h-10 grid-cols-[48px_minmax(0,1fr)] items-center justify-start gap-0 overflow-hidden rounded-md px-0 text-sm 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 pJ(e=!1,t=!1){return ae("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 gJ(e=!1){return ae("flex h-10 w-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 xJ({docked:e,onToggleDock:t}){return i.jsxs("div",{className:ae("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:[i.jsxs("span",{className:ae("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:[i.jsx("span",{children:"Made with"}),i.jsx(h6,{"aria-label":"love",className:"size-3 shrink-0 fill-red-500 text-red-500"}),i.jsx("span",{children:"by Robert Wang"}),i.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:i.jsxs("svg",{className:"size-3 fill-current",role:"img",viewBox:"0 0 24 24",children:[i.jsx("title",{children:"LinkedIn"}),i.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"})]})})]}),i.jsx("button",{"aria-label":e?"Undock sidebar":"Dock sidebar","aria-pressed":e,className:ae("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?i.jsx(iM,{}):i.jsx(aM,{})})]})}function bJ({className:e}){return i.jsxs("div",{className:ae("min-w-0",e),children:[i.jsxs("div",{className:"flex items-baseline gap-1.5",children:[i.jsx("div",{className:"text-sm font-semibold",children:"NoMoreIDE"}),i.jsxs("div",{className:"font-mono text-[10px] text-muted-foreground",children:["v","0.1.76"]})]}),i.jsx("div",{className:"font-mono text-[11px] text-muted-foreground",children:"127.0.0.1 console"})]})}function vJ({syncLocation:e=!0}={}){const[t,s]=_.useState(()=>e?dJ(window.location.pathname):"services"),[n,o]=_.useState(null),[l,u]=_.useState(null),[h,f]=_.useState(null),[d,p]=_.useState(0),[g,x]=_.useState(null),[v,w]=_.useState(!0),{error:k,message:N,success:E}=as(),[T,A]=_.useState(()=>window.localStorage.getItem("nomoreide:sidebar-docked")==="true"),[C,R]=_.useState(()=>window.localStorage.getItem("nomoreide:project-scope")!=="project"),D=QH(),$=_.useCallback(async(U={})=>{U.silent||w(!0),x(null);try{o(await TO()),U.notify&&E("Dashboard refreshed.")}catch(K){const I=K instanceof Error?K.message:String(K);x(I),k(I)}finally{w(!1)}},[k,E]),O=_.useCallback(()=>{$({notify:!0}),D.runActive()},[$,D]);_.useEffect(()=>{$()},[$]),_.useEffect(()=>{function U(){document.visibilityState==="visible"&&($({silent:!0}),D.runActive())}const K=window.setInterval(U,5e3);return window.addEventListener("focus",U),document.addEventListener("visibilitychange",U),()=>{window.clearInterval(K),window.removeEventListener("focus",U),document.removeEventListener("visibilitychange",U)}},[t,$,D.runActive]),_.useEffect(()=>{if(!e)return;const U=_4[t];window.location.pathname!==U&&window.history.pushState(null,"",U)},[t,e]),_.useEffect(()=>{window.localStorage.setItem("nomoreide:sidebar-docked",String(T))},[T]),_.useEffect(()=>{window.localStorage.setItem("nomoreide:project-scope",C?"all":"project")},[C]);const P=!C&&n?.git.selectedRepository||null,B=_.useMemo(()=>n&&P?rW(n,P):n,[n,P]),G=_.useMemo(()=>P&&B?new Set(B.config.services.map(U=>U.name)):null,[P,B]),F=_.useMemo(()=>B?Object.values(B.runtime.services).filter(U=>U.state==="running").length:0,[B]),z=n?.git.selectedRepository?.name??n?.git.cwd??"no-git-repository";return i.jsx(T$,{children:i.jsx(JH,{value:D,children:i.jsx(dF,{onRefresh:()=>{$({silent:!0})},children:i.jsx(hF,{children:i.jsxs("div",{className:"flex flex-col h-screen overflow-hidden",children:[i.jsx(lJ,{}),i.jsxs("div",{className:"flex-1 overflow-hidden pb-9",children:[i.jsxs("div",{className:"mx-auto flex h-full max-w-[1500px]",children:[i.jsxs("aside",{className:fJ(T),children:[i.jsxs("div",{className:ae("grid h-12 grid-cols-[48px_minmax(0,1fr)] items-center overflow-hidden transition-[width] duration-150",T?"w-full":"w-12 group-hover/sidebar:w-full"),children:[i.jsx("div",{className:"flex size-12 items-center justify-center",children:i.jsx("div",{className:"flex size-9 items-center justify-center overflow-hidden rounded-md bg-primary text-primary-foreground",children:i.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:[i.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"}),i.jsx("path",{d:"M22 31L30 39L22 47",stroke:"hsl(var(--primary))",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"4.5"}),i.jsx("path",{d:"M36 47H48",stroke:"hsl(var(--primary))",strokeLinecap:"round",strokeWidth:"4.5"})]})})}),i.jsx(bJ,{className:ae("min-w-0 translate-x-1 overflow-hidden transition-opacity duration-200",T?"opacity-100":"opacity-0 group-hover/sidebar:opacity-100")})]}),n?i.jsx("div",{className:"mt-3 border-b border-border/60 pb-2",children:i.jsx(iJ,{data:n,docked:T,onRefresh:()=>$({silent:!0}),onScopeChange:R,scopeAll:C})}):null,i.jsx("nav",{className:"mt-2 flex-1 content-start overflow-y-auto overflow-x-hidden",children:hJ.map((U,K)=>i.jsxs("div",{className:ae(K>0&&"mt-2 border-t border-border/60 pt-2"),children:[i.jsx(_J,{docked:T,label:U.label}),i.jsx("div",{className:"grid gap-0.5",children:U.items.map(I=>i.jsx(eC,{active:t===I.page,badge:I.page==="services"?F:void 0,docked:T,icon:I.icon,label:I.label,onClick:()=>s(I.page)},I.page))})]},U.label))}),i.jsx("div",{className:"mb-1 border-t border-border/60 pt-1",children:i.jsx(eC,{active:t==="settings",docked:T,icon:i.jsx(NC,{}),label:"Settings",onClick:()=>s("settings")})}),i.jsx(xJ,{docked:T,onToggleDock:()=>A(U=>!U)})]}),i.jsxs("main",{className:"flex h-full min-w-0 flex-1 flex-col px-0 py-0",children:[i.jsxs("header",{className:ae("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:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(lM,{className:"size-4 text-muted-foreground md:hidden"}),i.jsxs("div",{children:[i.jsx("h1",{className:"text-lg font-semibold tracking-tight",children:cJ[t]}),i.jsx("p",{className:"font-mono text-xs text-muted-foreground",children:t==="git"||t==="github"?n?.git.selectedRepository?.name??n?.git.cwd??"Local workspace":P?.name??"All projects"})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[g?i.jsx(Ge,{variant:"danger",children:g}):null,i.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:[i.jsxs("button",{"aria-label":"Refresh",className:Fh(),onClick:O,title:"Refresh this page",type:"button",children:[i.jsx("span",{className:qh(),children:i.jsx(Rr,{className:ae(v&&"animate-spin")})}),i.jsx("span",{className:Vh(),children:"Refresh"})]}),i.jsx(oJ,{}),i.jsxs("a",{"aria-label":"Open NoMoreIDE documentation",className:Fh(),href:"https://www.nomoreide.com/docs",rel:"noreferrer",target:"_blank",title:"Open NoMoreIDE documentation",children:[i.jsx("span",{className:qh(),children:i.jsx(iC,{})}),i.jsx("span",{className:Vh(),children:"Docs"})]}),n?i.jsx(GU,{data:n}):null]})]})]}),n?i.jsx(hY,{data:n,onOpenService:U=>{G&&!G.has(U)&&(R(!0),N({text:"Service is outside the current project — showing all projects."})),u(U),s("services"),$({silent:!0})}}):null,v&&!n?i.jsx(Qe,{variant:"muted",children:"Loading NoMoreIDE state..."}):null,i.jsxs("div",{className:"min-h-0 flex-1 overflow-hidden",children:[B&&t==="services"?i.jsx(cY,{data:B,onRefresh:$,focusService:l,onServiceFocused:()=>u(null),scopeName:P?.name??null}):null,n&&t==="git"?i.jsx(KZ,{data:n,onRefresh:()=>{$({silent:!0})}}):null,t==="github"?i.jsx(ZQ,{},z):null,t==="workflows"?i.jsx(sQ,{}):null,t==="agent"?i.jsx(ZH,{focusChanges:d,onOpenAgentEnv:()=>s("agent-env")}):null,t==="agent-env"?i.jsx(_U,{}):null,t==="errors"?i.jsx(XW,{inScope:G?U=>G.has(U):void 0,onReviewChanges:()=>{p(U=>U+1),s("agent")}}):null,t==="database"?i.jsx(RW,{projects:n?.config.gitRepositories??[],scopePath:P?.path??null,staged:h,onStageConsumed:()=>f(null)}):null,t==="terminal"?i.jsx(bY,{}):null,t==="settings"?i.jsx(WW,{}):null]})]})]}),n&&t==="git"?i.jsx(aJ,{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:$,upstream:n.git.status?.upstream}):null,i.jsx(nW,{currentPage:t,git:n?.git,onNavigate:U=>s(U),onGitRefresh:()=>{$({silent:!0})}})]})]})})})})})}function _J({docked:e,label:t}){return i.jsx("div",{className:"flex h-5 items-center overflow-hidden px-3",children:i.jsx("span",{className:ae("whitespace-pre text-[10px] font-semibold uppercase tracking-widest text-muted-foreground transition-opacity duration-150",e?"opacity-100":"opacity-0 group-hover/sidebar:opacity-100"),children:t})})}function eC({active:e,badge:t,docked:s,icon:n,label:o,onClick:l}){const u=t!==void 0&&t>0;return i.jsxs(J,{"aria-label":o,title:o,className:mJ(e,s),variant:"ghost",onClick:l,type:"button",children:[i.jsx("span",{className:gJ(s),children:n}),i.jsx("span",{className:pJ(s,u),children:o}),t!==void 0&&t>0?i.jsx(Ge,{appearance:t>0?"solid":"outline",className:ae("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]})}sC.createRoot(document.getElementById("root")).render(i.jsx(_.StrictMode,{children:i.jsx(vJ,{})}));export{i as j,_ as r};