nomoreide 0.1.56 → 0.1.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/agent-runtime.d.ts +12 -2
- package/dist/core/agent-runtime.js +16 -5
- package/dist/core/agent-runtime.js.map +1 -1
- package/dist/core/config-store.d.ts +2 -0
- package/dist/core/config-store.js +15 -0
- package/dist/core/config-store.js.map +1 -1
- package/dist/core/process-manager.d.ts +13 -0
- package/dist/core/process-manager.js +59 -2
- package/dist/core/process-manager.js.map +1 -1
- package/dist/core/service-graph.d.ts +50 -0
- package/dist/core/service-graph.js +143 -0
- package/dist/core/service-graph.js.map +1 -0
- package/dist/core/types.d.ts +10 -0
- package/dist/web/client/assets/{code-editor-BnSokx6t.js → code-editor-BxFHS7P5.js} +1 -1
- package/dist/web/client/assets/core-DhEqZVGG.js +1 -0
- package/dist/web/client/assets/event-BK_86lmQ.js +1 -0
- package/dist/web/client/assets/index-4FJ5hj8X.js +222 -0
- package/dist/web/client/assets/index-Ca7-Vu2E.css +1 -0
- package/dist/web/client/assets/window-DlR023_X.js +1 -0
- package/dist/web/client/index.html +2 -2
- package/dist/web/routes/agent-chat-routes.js +41 -13
- package/dist/web/routes/agent-chat-routes.js.map +1 -1
- package/dist/web/routes/service-routes.js +16 -0
- package/dist/web/routes/service-routes.js.map +1 -1
- package/package.json +5 -1
- package/dist/web/client/assets/index-B0Tno-0X.js +0 -215
- package/dist/web/client/assets/index-CBZqXKDN.css +0 -1
|
@@ -0,0 +1,222 @@
|
|
|
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 kA(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var kp={exports:{}},dc={};var wy;function NA(){if(wy)return dc;wy=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 dc.Fragment=t,dc.jsx=s,dc.jsxs=s,dc}var ky;function CA(){return ky||(ky=1,kp.exports=NA()),kp.exports}var r=CA(),Np={exports:{}},lt={};var Ny;function EA(){if(Ny)return lt;Ny=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),b=Symbol.iterator;function v(F){return F===null||typeof F!="object"?null:(F=b&&F[b]||F["@@iterator"],typeof F=="function"?F:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,N={};function E(F,ie,Ee){this.props=F,this.context=ie,this.refs=N,this.updater=Ee||w}E.prototype.isReactComponent={},E.prototype.setState=function(F,ie){if(typeof F!="object"&&typeof F!="function"&&F!=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,F,ie,"setState")},E.prototype.forceUpdate=function(F){this.updater.enqueueForceUpdate(this,F,"forceUpdate")};function A(){}A.prototype=E.prototype;function j(F,ie,Ee){this.props=F,this.context=ie,this.refs=N,this.updater=Ee||w}var T=j.prototype=new A;T.constructor=j,k(T,E.prototype),T.isPureReactComponent=!0;var P=Array.isArray;function z(){}var L={H:null,A:null,T:null,S:null},R=Object.prototype.hasOwnProperty;function D(F,ie,Ee){var ye=Ee.ref;return{$$typeof:e,type:F,key:ie,ref:ye!==void 0?ye:null,props:Ee}}function I(F,ie){return D(F.type,ie,F.props)}function V(F){return typeof F=="object"&&F!==null&&F.$$typeof===e}function X(F){var ie={"=":"=0",":":"=2"};return"$"+F.replace(/[=:]/g,function(Ee){return ie[Ee]})}var $=/\/+/g;function W(F,ie){return typeof F=="object"&&F!==null&&F.key!=null?X(""+F.key):ie.toString(36)}function q(F){switch(F.status){case"fulfilled":return F.value;case"rejected":throw F.reason;default:switch(typeof F.status=="string"?F.then(z,z):(F.status="pending",F.then(function(ie){F.status==="pending"&&(F.status="fulfilled",F.value=ie)},function(ie){F.status==="pending"&&(F.status="rejected",F.reason=ie)})),F.status){case"fulfilled":return F.value;case"rejected":throw F.reason}}throw F}function B(F,ie,Ee,ye,oe){var je=typeof F;(je==="undefined"||je==="boolean")&&(F=null);var Ne=!1;if(F===null)Ne=!0;else switch(je){case"bigint":case"string":case"number":Ne=!0;break;case"object":switch(F.$$typeof){case e:case t:Ne=!0;break;case p:return Ne=F._init,B(Ne(F._payload),ie,Ee,ye,oe)}}if(Ne)return oe=oe(F),Ne=ye===""?"."+W(F,0):ye,P(oe)?(Ee="",Ne!=null&&(Ee=Ne.replace($,"$&/")+"/"),B(oe,ie,Ee,"",function(Qe){return Qe})):oe!=null&&(V(oe)&&(oe=I(oe,Ee+(oe.key==null||F&&F.key===oe.key?"":(""+oe.key).replace($,"$&/")+"/")+Ne)),ie.push(oe)),1;Ne=0;var Ge=ye===""?".":ye+":";if(P(F))for(var Me=0;Me<F.length;Me++)ye=F[Me],je=Ge+W(ye,Me),Ne+=B(ye,ie,Ee,je,oe);else if(Me=v(F),typeof Me=="function")for(F=Me.call(F),Me=0;!(ye=F.next()).done;)ye=ye.value,je=Ge+W(ye,Me++),Ne+=B(ye,ie,Ee,je,oe);else if(je==="object"){if(typeof F.then=="function")return B(q(F),ie,Ee,ye,oe);throw ie=String(F),Error("Objects are not valid as a React child (found: "+(ie==="[object Object]"?"object with keys {"+Object.keys(F).join(", ")+"}":ie)+"). If you meant to render a collection of children, use an array instead.")}return Ne}function Z(F,ie,Ee){if(F==null)return F;var ye=[],oe=0;return B(F,ye,"","",function(je){return ie.call(Ee,je,oe++)}),ye}function U(F){if(F._status===-1){var ie=F._result;ie=ie(),ie.then(function(Ee){(F._status===0||F._status===-1)&&(F._status=1,F._result=Ee)},function(Ee){(F._status===0||F._status===-1)&&(F._status=2,F._result=Ee)}),F._status===-1&&(F._status=0,F._result=ie)}if(F._status===1)return F._result.default;throw F._result}var K=typeof reportError=="function"?reportError:function(F){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var ie=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof F=="object"&&F!==null&&typeof F.message=="string"?String(F.message):String(F),error:F});if(!window.dispatchEvent(ie))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",F);return}console.error(F)},Y={map:Z,forEach:function(F,ie,Ee){Z(F,function(){ie.apply(this,arguments)},Ee)},count:function(F){var ie=0;return Z(F,function(){ie++}),ie},toArray:function(F){return Z(F,function(ie){return ie})||[]},only:function(F){if(!V(F))throw Error("React.Children.only expected to receive a single React element child.");return F}};return lt.Activity=g,lt.Children=Y,lt.Component=E,lt.Fragment=s,lt.Profiler=o,lt.PureComponent=j,lt.StrictMode=n,lt.Suspense=m,lt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=L,lt.__COMPILER_RUNTIME={__proto__:null,c:function(F){return L.H.useMemoCache(F)}},lt.cache=function(F){return function(){return F.apply(null,arguments)}},lt.cacheSignal=function(){return null},lt.cloneElement=function(F,ie,Ee){if(F==null)throw Error("The argument must be a React element, but you passed "+F+".");var ye=k({},F.props),oe=F.key;if(ie!=null)for(je in ie.key!==void 0&&(oe=""+ie.key),ie)!R.call(ie,je)||je==="key"||je==="__self"||je==="__source"||je==="ref"&&ie.ref===void 0||(ye[je]=ie[je]);var je=arguments.length-2;if(je===1)ye.children=Ee;else if(1<je){for(var Ne=Array(je),Ge=0;Ge<je;Ge++)Ne[Ge]=arguments[Ge+2];ye.children=Ne}return D(F.type,oe,ye)},lt.createContext=function(F){return F={$$typeof:u,_currentValue:F,_currentValue2:F,_threadCount:0,Provider:null,Consumer:null},F.Provider=F,F.Consumer={$$typeof:l,_context:F},F},lt.createElement=function(F,ie,Ee){var ye,oe={},je=null;if(ie!=null)for(ye in ie.key!==void 0&&(je=""+ie.key),ie)R.call(ie,ye)&&ye!=="key"&&ye!=="__self"&&ye!=="__source"&&(oe[ye]=ie[ye]);var Ne=arguments.length-2;if(Ne===1)oe.children=Ee;else if(1<Ne){for(var Ge=Array(Ne),Me=0;Me<Ne;Me++)Ge[Me]=arguments[Me+2];oe.children=Ge}if(F&&F.defaultProps)for(ye in Ne=F.defaultProps,Ne)oe[ye]===void 0&&(oe[ye]=Ne[ye]);return D(F,je,oe)},lt.createRef=function(){return{current:null}},lt.forwardRef=function(F){return{$$typeof:h,render:F}},lt.isValidElement=V,lt.lazy=function(F){return{$$typeof:p,_payload:{_status:-1,_result:F},_init:U}},lt.memo=function(F,ie){return{$$typeof:d,type:F,compare:ie===void 0?null:ie}},lt.startTransition=function(F){var ie=L.T,Ee={};L.T=Ee;try{var ye=F(),oe=L.S;oe!==null&&oe(Ee,ye),typeof ye=="object"&&ye!==null&&typeof ye.then=="function"&&ye.then(z,K)}catch(je){K(je)}finally{ie!==null&&Ee.types!==null&&(ie.types=Ee.types),L.T=ie}},lt.unstable_useCacheRefresh=function(){return L.H.useCacheRefresh()},lt.use=function(F){return L.H.use(F)},lt.useActionState=function(F,ie,Ee){return L.H.useActionState(F,ie,Ee)},lt.useCallback=function(F,ie){return L.H.useCallback(F,ie)},lt.useContext=function(F){return L.H.useContext(F)},lt.useDebugValue=function(){},lt.useDeferredValue=function(F,ie){return L.H.useDeferredValue(F,ie)},lt.useEffect=function(F,ie){return L.H.useEffect(F,ie)},lt.useEffectEvent=function(F){return L.H.useEffectEvent(F)},lt.useId=function(){return L.H.useId()},lt.useImperativeHandle=function(F,ie,Ee){return L.H.useImperativeHandle(F,ie,Ee)},lt.useInsertionEffect=function(F,ie){return L.H.useInsertionEffect(F,ie)},lt.useLayoutEffect=function(F,ie){return L.H.useLayoutEffect(F,ie)},lt.useMemo=function(F,ie){return L.H.useMemo(F,ie)},lt.useOptimistic=function(F,ie){return L.H.useOptimistic(F,ie)},lt.useReducer=function(F,ie,Ee){return L.H.useReducer(F,ie,Ee)},lt.useRef=function(F){return L.H.useRef(F)},lt.useState=function(F){return L.H.useState(F)},lt.useSyncExternalStore=function(F,ie,Ee){return L.H.useSyncExternalStore(F,ie,Ee)},lt.useTransition=function(){return L.H.useTransition()},lt.version="19.2.6",lt}var Cy;function Rb(){return Cy||(Cy=1,Np.exports=EA()),Np.exports}var y=Rb(),Cp={exports:{}},hc={},Ep={exports:{}},jp={};var Ey;function jA(){return Ey||(Ey=1,(function(e){function t(B,Z){var U=B.length;B.push(Z);e:for(;0<U;){var K=U-1>>>1,Y=B[K];if(0<o(Y,Z))B[K]=Z,B[U]=Y,U=K;else break e}}function s(B){return B.length===0?null:B[0]}function n(B){if(B.length===0)return null;var Z=B[0],U=B.pop();if(U!==Z){B[0]=U;e:for(var K=0,Y=B.length,F=Y>>>1;K<F;){var ie=2*(K+1)-1,Ee=B[ie],ye=ie+1,oe=B[ye];if(0>o(Ee,U))ye<Y&&0>o(oe,Ee)?(B[K]=oe,B[ye]=U,K=ye):(B[K]=Ee,B[ie]=U,K=ie);else if(ye<Y&&0>o(oe,U))B[K]=oe,B[ye]=U,K=ye;else break e}}return Z}function o(B,Z){var U=B.sortIndex-Z.sortIndex;return U!==0?U:B.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 m=[],d=[],p=1,g=null,b=3,v=!1,w=!1,k=!1,N=!1,E=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;function T(B){for(var Z=s(d);Z!==null;){if(Z.callback===null)n(d);else if(Z.startTime<=B)n(d),Z.sortIndex=Z.expirationTime,t(m,Z);else break;Z=s(d)}}function P(B){if(k=!1,T(B),!w)if(s(m)!==null)w=!0,z||(z=!0,X());else{var Z=s(d);Z!==null&&q(P,Z.startTime-B)}}var z=!1,L=-1,R=5,D=-1;function I(){return N?!0:!(e.unstable_now()-D<R)}function V(){if(N=!1,z){var B=e.unstable_now();D=B;var Z=!0;try{e:{w=!1,k&&(k=!1,A(L),L=-1),v=!0;var U=b;try{t:{for(T(B),g=s(m);g!==null&&!(g.expirationTime>B&&I());){var K=g.callback;if(typeof K=="function"){g.callback=null,b=g.priorityLevel;var Y=K(g.expirationTime<=B);if(B=e.unstable_now(),typeof Y=="function"){g.callback=Y,T(B),Z=!0;break t}g===s(m)&&n(m),T(B)}else n(m);g=s(m)}if(g!==null)Z=!0;else{var F=s(d);F!==null&&q(P,F.startTime-B),Z=!1}}break e}finally{g=null,b=U,v=!1}Z=void 0}}finally{Z?X():z=!1}}}var X;if(typeof j=="function")X=function(){j(V)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,W=$.port2;$.port1.onmessage=V,X=function(){W.postMessage(null)}}else X=function(){E(V,0)};function q(B,Z){L=E(function(){B(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(B){B.callback=null},e.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<B?Math.floor(1e3/B):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(B){switch(b){case 1:case 2:case 3:var Z=3;break;default:Z=b}var U=b;b=Z;try{return B()}finally{b=U}},e.unstable_requestPaint=function(){N=!0},e.unstable_runWithPriority=function(B,Z){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var U=b;b=B;try{return Z()}finally{b=U}},e.unstable_scheduleCallback=function(B,Z,U){var K=e.unstable_now();switch(typeof U=="object"&&U!==null?(U=U.delay,U=typeof U=="number"&&0<U?K+U:K):U=K,B){case 1:var Y=-1;break;case 2:Y=250;break;case 5:Y=1073741823;break;case 4:Y=1e4;break;default:Y=5e3}return Y=U+Y,B={id:p++,callback:Z,priorityLevel:B,startTime:U,expirationTime:Y,sortIndex:-1},U>K?(B.sortIndex=U,t(d,B),s(m)===null&&B===s(d)&&(k?(A(L),L=-1):k=!0,q(P,U-K))):(B.sortIndex=Y,t(m,B),w||v||(w=!0,z||(z=!0,X()))),B},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(B){var Z=b;return function(){var U=b;b=Z;try{return B.apply(this,arguments)}finally{b=U}}}})(jp)),jp}var jy;function TA(){return jy||(jy=1,Ep.exports=jA()),Ep.exports}var Tp={exports:{}},sn={};var Ty;function AA(){if(Ty)return sn;Ty=1;var e=Rb();function t(m){var d="https://react.dev/errors/"+m;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)d+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+m+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(){}var n={d:{f:s,r:function(){throw Error(t(522))},D:s,C:s,L:s,m:s,X:s,S:s,M:s},p:0,findDOMNode:null},o=Symbol.for("react.portal");function l(m,d,p){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:g==null?null:""+g,children:m,containerInfo:d,implementation:p}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(m,d){if(m==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return sn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,sn.createPortal=function(m,d){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(t(299));return l(m,d,null,p)},sn.flushSync=function(m){var d=u.T,p=n.p;try{if(u.T=null,n.p=2,m)return m()}finally{u.T=d,n.p=p,n.d.f()}},sn.preconnect=function(m,d){typeof m=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,n.d.C(m,d))},sn.prefetchDNS=function(m){typeof m=="string"&&n.d.D(m)},sn.preinit=function(m,d){if(typeof m=="string"&&d&&typeof d.as=="string"){var p=d.as,g=h(p,d.crossOrigin),b=typeof d.integrity=="string"?d.integrity:void 0,v=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;p==="style"?n.d.S(m,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:g,integrity:b,fetchPriority:v}):p==="script"&&n.d.X(m,{crossOrigin:g,integrity:b,fetchPriority:v,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},sn.preinitModule=function(m,d){if(typeof m=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var p=h(d.as,d.crossOrigin);n.d.M(m,{crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&n.d.M(m)},sn.preload=function(m,d){if(typeof m=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var p=d.as,g=h(p,d.crossOrigin);n.d.L(m,p,{crossOrigin:g,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},sn.preloadModule=function(m,d){if(typeof m=="string")if(d){var p=h(d.as,d.crossOrigin);n.d.m(m,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else n.d.m(m)},sn.requestFormReset=function(m){n.d.r(m)},sn.unstable_batchedUpdates=function(m,d){return m(d)},sn.useFormState=function(m,d,p){return u.H.useFormState(m,d,p)},sn.useFormStatus=function(){return u.H.useHostTransitionStatus()},sn.version="19.2.6",sn}var Ay;function dN(){if(Ay)return Tp.exports;Ay=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(),Tp.exports=AA(),Tp.exports}var Ry;function RA(){if(Ry)return hc;Ry=1;var e=TA(),t=Rb(),s=dN();function n(i){var a="https://react.dev/errors/"+i;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)a+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+i+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function l(i){var a=i,c=i;if(i.alternate)for(;a.return;)a=a.return;else{i=a;do a=i,(a.flags&4098)!==0&&(c=a.return),i=a.return;while(i)}return a.tag===3?c:null}function u(i){if(i.tag===13){var a=i.memoizedState;if(a===null&&(i=i.alternate,i!==null&&(a=i.memoizedState)),a!==null)return a.dehydrated}return null}function h(i){if(i.tag===31){var a=i.memoizedState;if(a===null&&(i=i.alternate,i!==null&&(a=i.memoizedState)),a!==null)return a.dehydrated}return null}function m(i){if(l(i)!==i)throw Error(n(188))}function d(i){var a=i.alternate;if(!a){if(a=l(i),a===null)throw Error(n(188));return a!==i?null:i}for(var c=i,f=a;;){var x=c.return;if(x===null)break;var _=x.alternate;if(_===null){if(f=x.return,f!==null){c=f;continue}break}if(x.child===_.child){for(_=x.child;_;){if(_===c)return m(x),i;if(_===f)return m(x),a;_=_.sibling}throw Error(n(188))}if(c.return!==f.return)c=x,f=_;else{for(var C=!1,O=x.child;O;){if(O===c){C=!0,c=x,f=_;break}if(O===f){C=!0,f=x,c=_;break}O=O.sibling}if(!C){for(O=_.child;O;){if(O===c){C=!0,c=_,f=x;break}if(O===f){C=!0,f=_,c=x;break}O=O.sibling}if(!C)throw Error(n(189))}}if(c.alternate!==f)throw Error(n(190))}if(c.tag!==3)throw Error(n(188));return c.stateNode.current===c?i:a}function p(i){var a=i.tag;if(a===5||a===26||a===27||a===6)return i;for(i=i.child;i!==null;){if(a=p(i),a!==null)return a;i=i.sibling}return null}var g=Object.assign,b=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"),A=Symbol.for("react.consumer"),j=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),z=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),R=Symbol.for("react.lazy"),D=Symbol.for("react.activity"),I=Symbol.for("react.memo_cache_sentinel"),V=Symbol.iterator;function X(i){return i===null||typeof i!="object"?null:(i=V&&i[V]||i["@@iterator"],typeof i=="function"?i:null)}var $=Symbol.for("react.client.reference");function W(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===$?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case k:return"Fragment";case E:return"Profiler";case N:return"StrictMode";case P:return"Suspense";case z:return"SuspenseList";case D:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case w:return"Portal";case j:return i.displayName||"Context";case A:return(i._context.displayName||"Context")+".Consumer";case T:var a=i.render;return i=i.displayName,i||(i=a.displayName||a.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case L:return a=i.displayName||null,a!==null?a:W(i.type)||"Memo";case R:a=i._payload,i=i._init;try{return W(i(a))}catch{}}return null}var q=Array.isArray,B=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,U={pending:!1,data:null,method:null,action:null},K=[],Y=-1;function F(i){return{current:i}}function ie(i){0>Y||(i.current=K[Y],K[Y]=null,Y--)}function Ee(i,a){Y++,K[Y]=i.current,i.current=a}var ye=F(null),oe=F(null),je=F(null),Ne=F(null);function Ge(i,a){switch(Ee(je,a),Ee(oe,i),Ee(ye,null),a.nodeType){case 9:case 11:i=(i=a.documentElement)&&(i=i.namespaceURI)?G_(i):0;break;default:if(i=a.tagName,a=a.namespaceURI)a=G_(a),i=W_(a,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}ie(ye),Ee(ye,i)}function Me(){ie(ye),ie(oe),ie(je)}function Qe(i){i.memoizedState!==null&&Ee(Ne,i);var a=ye.current,c=W_(a,i.type);a!==c&&(Ee(oe,i),Ee(ye,c))}function ke(i){oe.current===i&&(ie(ye),ie(oe)),Ne.current===i&&(ie(Ne),oc._currentValue=U)}var He,$e;function St(i){if(He===void 0)try{throw Error()}catch(c){var a=c.stack.trim().match(/\n( *(at )?)/);He=a&&a[1]||"",$e=-1<c.stack.indexOf(`
|
|
3
|
+
at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
4
|
+
`+He+i+$e}var Us=!1;function Fs(i,a){if(!i||Us)return"";Us=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var f={DetermineComponentFrameRoot:function(){try{if(a){var Se=function(){throw Error()};if(Object.defineProperty(Se.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Se,[])}catch(he){var le=he}Reflect.construct(i,[],Se)}else{try{Se.call()}catch(he){le=he}i.call(Se.prototype)}}else{try{throw Error()}catch(he){le=he}(Se=i())&&typeof Se.catch=="function"&&Se.catch(function(){})}}catch(he){if(he&&le&&typeof he.stack=="string")return[he.stack,le.stack]}return[null,null]}};f.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var x=Object.getOwnPropertyDescriptor(f.DetermineComponentFrameRoot,"name");x&&x.configurable&&Object.defineProperty(f.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var _=f.DetermineComponentFrameRoot(),C=_[0],O=_[1];if(C&&O){var G=C.split(`
|
|
5
|
+
`),ae=O.split(`
|
|
6
|
+
`);for(x=f=0;f<G.length&&!G[f].includes("DetermineComponentFrameRoot");)f++;for(;x<ae.length&&!ae[x].includes("DetermineComponentFrameRoot");)x++;if(f===G.length||x===ae.length)for(f=G.length-1,x=ae.length-1;1<=f&&0<=x&&G[f]!==ae[x];)x--;for(;1<=f&&0<=x;f--,x--)if(G[f]!==ae[x]){if(f!==1||x!==1)do if(f--,x--,0>x||G[f]!==ae[x]){var pe=`
|
|
7
|
+
`+G[f].replace(" at new "," at ");return i.displayName&&pe.includes("<anonymous>")&&(pe=pe.replace("<anonymous>",i.displayName)),pe}while(1<=f&&0<=x);break}}}finally{Us=!1,Error.prepareStackTrace=c}return(c=i?i.displayName||i.name:"")?St(c):""}function On(i,a){switch(i.tag){case 26:case 27:case 5:return St(i.type);case 16:return St("Lazy");case 13:return i.child!==a&&a!==null?St("Suspense Fallback"):St("Suspense");case 19:return St("SuspenseList");case 0:case 15:return Fs(i.type,!1);case 11:return Fs(i.type.render,!1);case 1:return Fs(i.type,!0);case 31:return St("Activity");default:return""}}function wn(i){try{var a="",c=null;do a+=On(i,c),c=i,i=i.return;while(i);return a}catch(f){return`
|
|
8
|
+
Error generating stack: `+f.message+`
|
|
9
|
+
`+f.stack}}var js=Object.prototype.hasOwnProperty,cn=e.unstable_scheduleCallback,un=e.unstable_cancelCallback,Pe=e.unstable_shouldYield,Ct=e.unstable_requestPaint,wt=e.unstable_now,Rt=e.unstable_getCurrentPriorityLevel,Ft=e.unstable_ImmediatePriority,Qs=e.unstable_UserBlockingPriority,Js=e.unstable_NormalPriority,Ri=e.unstable_LowPriority,S=e.unstable_IdlePriority,se=e.log,me=e.unstable_setDisableYieldValue,be=null,ce=null;function Te(i){if(typeof se=="function"&&me(i),ce&&typeof ce.setStrictMode=="function")try{ce.setStrictMode(be,i)}catch{}}var M=Math.clz32?Math.clz32:ge,ne=Math.log,Ae=Math.LN2;function ge(i){return i>>>=0,i===0?32:31-(ne(i)/Ae|0)|0}var ue=256,Ce=262144,ve=4194304;function Le(i){var a=i&42;if(a!==0)return a;switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function H(i,a,c){var f=i.pendingLanes;if(f===0)return 0;var x=0,_=i.suspendedLanes,C=i.pingedLanes;i=i.warmLanes;var O=f&134217727;return O!==0?(f=O&~_,f!==0?x=Le(f):(C&=O,C!==0?x=Le(C):c||(c=O&~i,c!==0&&(x=Le(c))))):(O=f&~_,O!==0?x=Le(O):C!==0?x=Le(C):c||(c=f&~i,c!==0&&(x=Le(c)))),x===0?0:a!==0&&a!==x&&(a&_)===0&&(_=x&-x,c=a&-a,_>=c||_===32&&(c&4194048)!==0)?a:x}function ee(i,a){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&a)===0}function fe(i,a){switch(i){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Be(){var i=ve;return ve<<=1,(ve&62914560)===0&&(ve=4194304),i}function rt(i){for(var a=[],c=0;31>c;c++)a.push(i);return a}function Mt(i,a){i.pendingLanes|=a,a!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function qe(i,a,c,f,x,_){var C=i.pendingLanes;i.pendingLanes=c,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=c,i.entangledLanes&=c,i.errorRecoveryDisabledLanes&=c,i.shellSuspendCounter=0;var O=i.entanglements,G=i.expirationTimes,ae=i.hiddenUpdates;for(c=C&~c;0<c;){var pe=31-M(c),Se=1<<pe;O[pe]=0,G[pe]=-1;var le=ae[pe];if(le!==null)for(ae[pe]=null,pe=0;pe<le.length;pe++){var he=le[pe];he!==null&&(he.lane&=-536870913)}c&=~Se}f!==0&&Ue(i,f,0),_!==0&&x===0&&i.tag!==0&&(i.suspendedLanes|=_&~(C&~a))}function Ue(i,a,c){i.pendingLanes|=a,i.suspendedLanes&=~a;var f=31-M(a);i.entangledLanes|=a,i.entanglements[f]=i.entanglements[f]|1073741824|c&261930}function at(i,a){var c=i.entangledLanes|=a;for(i=i.entanglements;c;){var f=31-M(c),x=1<<f;x&a|i[f]&a&&(i[f]|=a),c&=~x}}function ds(i,a){var c=a&-a;return c=(c&42)!==0?1:Jt(c),(c&(i.suspendedLanes|a))!==0?0:c}function Jt(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function Zi(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function co(){var i=Z.p;return i!==0?i:(i=window.event,i===void 0?32:gy(i.type))}function uo(i,a){var c=Z.p;try{return Z.p=i,a()}finally{Z.p=c}}var Mi=Math.random().toString(36).slice(2),hs="__reactFiber$"+Mi,en="__reactProps$"+Mi,Rr="__reactContainer$"+Mi,xl="__reactEvents$"+Mi,xu="__reactListeners$"+Mi,ho="__reactHandles$"+Mi,vu="__reactResources$"+Mi,_a="__reactMarker$"+Mi;function vl(i){delete i[hs],delete i[en],delete i[xl],delete i[xu],delete i[ho]}function dn(i){var a=i[hs];if(a)return a;for(var c=i.parentNode;c;){if(a=c[Rr]||c[hs]){if(c=a.alternate,a.child!==null||c!==null&&c.child!==null)for(i=ey(i);i!==null;){if(c=i[hs])return c;i=ey(i)}return a}i=c,c=i.parentNode}return null}function Qi(i){if(i=i[hs]||i[Rr]){var a=i.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return i}return null}function Mr(i){var a=i.tag;if(a===5||a===26||a===27||a===6)return i.stateNode;throw Error(n(33))}function Dr(i){var a=i[vu];return a||(a=i[vu]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function bs(i){i[_a]=!0}var _u=new Set,ya={};function Ji(i,a){Re(i,a),Re(i+"Capture",a)}function Re(i,a){for(ya[i]=a,i=0;i<a.length;i++)_u.add(a[i])}var Je=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={},Ot={};function fs(i){return js.call(Ot,i)?!0:js.call(pt,i)?!1:Je.test(i)?Ot[i]=!0:(pt[i]=!0,!1)}function tn(i,a,c){if(fs(a))if(c===null)i.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":i.removeAttribute(a);return;case"boolean":var f=a.toLowerCase().slice(0,5);if(f!=="data-"&&f!=="aria-"){i.removeAttribute(a);return}}i.setAttribute(a,""+c)}}function Ln(i,a,c){if(c===null)i.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(a);return}i.setAttribute(a,""+c)}}function kn(i,a,c,f){if(f===null)i.removeAttribute(c);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(c);return}i.setAttributeNS(a,c,""+f)}}function Wt(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function zn(i){var a=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function yu(i,a,c){var f=Object.getOwnPropertyDescriptor(i.constructor.prototype,a);if(!i.hasOwnProperty(a)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var x=f.get,_=f.set;return Object.defineProperty(i,a,{configurable:!0,get:function(){return x.call(this)},set:function(C){c=""+C,_.call(this,C)}}),Object.defineProperty(i,a,{enumerable:f.enumerable}),{getValue:function(){return c},setValue:function(C){c=""+C},stopTracking:function(){i._valueTracker=null,delete i[a]}}}}function fo(i){if(!i._valueTracker){var a=zn(i)?"checked":"value";i._valueTracker=yu(i,a,""+i[a])}}function _l(i){if(!i)return!1;var a=i._valueTracker;if(!a)return!0;var c=a.getValue(),f="";return i&&(f=zn(i)?i.checked?"true":"false":i.value),i=f,i!==c?(a.setValue(i),!0):!1}function mo(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var wf=/[\n"\\]/g;function Nn(i){return i.replace(wf,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function yl(i,a,c,f,x,_,C,O){i.name="",C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?i.type=C:i.removeAttribute("type"),a!=null?C==="number"?(a===0&&i.value===""||i.value!=a)&&(i.value=""+Wt(a)):i.value!==""+Wt(a)&&(i.value=""+Wt(a)):C!=="submit"&&C!=="reset"||i.removeAttribute("value"),a!=null?po(i,C,Wt(a)):c!=null?po(i,C,Wt(c)):f!=null&&i.removeAttribute("value"),x==null&&_!=null&&(i.defaultChecked=!!_),x!=null&&(i.checked=x&&typeof x!="function"&&typeof x!="symbol"),O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?i.name=""+Wt(O):i.removeAttribute("name")}function Sa(i,a,c,f,x,_,C,O){if(_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(i.type=_),a!=null||c!=null){if(!(_!=="submit"&&_!=="reset"||a!=null)){fo(i);return}c=c!=null?""+Wt(c):"",a=a!=null?""+Wt(a):c,O||a===i.value||(i.value=a),i.defaultValue=a}f=f??x,f=typeof f!="function"&&typeof f!="symbol"&&!!f,i.checked=O?i.checked:!!f,i.defaultChecked=!!f,C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(i.name=C),fo(i)}function po(i,a,c){a==="number"&&mo(i.ownerDocument)===i||i.defaultValue===""+c||(i.defaultValue=""+c)}function qs(i,a,c,f){if(i=i.options,a){a={};for(var x=0;x<c.length;x++)a["$"+c[x]]=!0;for(c=0;c<i.length;c++)x=a.hasOwnProperty("$"+i[c].value),i[c].selected!==x&&(i[c].selected=x),x&&f&&(i[c].defaultSelected=!0)}else{for(c=""+Wt(c),a=null,x=0;x<i.length;x++){if(i[x].value===c){i[x].selected=!0,f&&(i[x].defaultSelected=!0);return}a!==null||i[x].disabled||(a=i[x])}a!==null&&(a.selected=!0)}}function Su(i,a,c){if(a!=null&&(a=""+Wt(a),a!==i.value&&(i.value=a),c==null)){i.defaultValue!==a&&(i.defaultValue=a);return}i.defaultValue=c!=null?""+Wt(c):""}function go(i,a,c,f){if(a==null){if(f!=null){if(c!=null)throw Error(n(92));if(q(f)){if(1<f.length)throw Error(n(93));f=f[0]}c=f}c==null&&(c=""),a=c}c=Wt(a),i.defaultValue=c,f=i.textContent,f===c&&f!==""&&f!==null&&(i.value=f),fo(i)}function it(i,a){if(a){var c=i.firstChild;if(c&&c===i.lastChild&&c.nodeType===3){c.nodeValue=a;return}}i.textContent=a}var wu=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(i,a,c){var f=a.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?f?i.setProperty(a,""):a==="float"?i.cssFloat="":i[a]="":f?i.setProperty(a,c):typeof c!="number"||c===0||wu.has(a)?a==="float"?i.cssFloat=c:i[a]=(""+c).trim():i[a]=c+"px"}function Lt(i,a,c){if(a!=null&&typeof a!="object")throw Error(n(62));if(i=i.style,c!=null){for(var f in c)!c.hasOwnProperty(f)||a!=null&&a.hasOwnProperty(f)||(f.indexOf("--")===0?i.setProperty(f,""):f==="float"?i.cssFloat="":i[f]="");for(var x in a)f=a[x],a.hasOwnProperty(x)&&c[x]!==f&&xs(i,x,f)}else for(var _ in a)a.hasOwnProperty(_)&&xs(i,_,a[_])}function Or(i){if(i.indexOf("-")===-1)return!1;switch(i){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var er=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"]]),Sl=/^[\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 Lr(i){return Sl.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function Ie(){}var Xe=null;function ct(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var vt=null,ns=null;function Xn(i){var a=Qi(i);if(a&&(i=a.stateNode)){var c=i[en]||null;e:switch(i=a.stateNode,a.type){case"input":if(yl(i,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),a=c.name,c.type==="radio"&&a!=null){for(c=i;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+Nn(""+a)+'"][type="radio"]'),a=0;a<c.length;a++){var f=c[a];if(f!==i&&f.form===i.form){var x=f[en]||null;if(!x)throw Error(n(90));yl(f,x.value,x.defaultValue,x.defaultValue,x.checked,x.defaultChecked,x.type,x.name)}}for(a=0;a<c.length;a++)f=c[a],f.form===i.form&&_l(f)}break e;case"textarea":Su(i,c.value,c.defaultValue);break e;case"select":a=c.value,a!=null&&qs(i,!!c.multiple,a,!1)}}}var wl=!1;function ku(i,a,c){if(wl)return i(a,c);wl=!0;try{var f=i(a);return f}finally{if(wl=!1,(vt!==null||ns!==null)&&(dd(),vt&&(a=vt,i=ns,ns=vt=null,Xn(a),i)))for(a=0;a<i.length;a++)Xn(i[a])}}function kl(i,a){var c=i.stateNode;if(c===null)return null;var f=c[en]||null;if(f===null)return null;c=f[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(i=i.type,f=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!f;break e;default:i=!1}if(i)return null;if(c&&typeof c!="function")throw Error(n(231,a,typeof c));return c}var tr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),kf=!1;if(tr)try{var Nl={};Object.defineProperty(Nl,"passive",{get:function(){kf=!0}}),window.addEventListener("test",Nl,Nl),window.removeEventListener("test",Nl,Nl)}catch{kf=!1}var zr=null,Nf=null,Nu=null;function Wx(){if(Nu)return Nu;var i,a=Nf,c=a.length,f,x="value"in zr?zr.value:zr.textContent,_=x.length;for(i=0;i<c&&a[i]===x[i];i++);var C=c-i;for(f=1;f<=C&&a[c-f]===x[_-f];f++);return Nu=x.slice(i,1<f?1-f:void 0)}function Cu(i){var a=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&a===13&&(i=13)):i=a,i===10&&(i=13),32<=i||i===13?i:0}function Eu(){return!0}function Kx(){return!1}function Cn(i){function a(c,f,x,_,C){this._reactName=c,this._targetInst=x,this.type=f,this.nativeEvent=_,this.target=C,this.currentTarget=null;for(var O in i)i.hasOwnProperty(O)&&(c=i[O],this[O]=c?c(_):_[O]);return this.isDefaultPrevented=(_.defaultPrevented!=null?_.defaultPrevented:_.returnValue===!1)?Eu:Kx,this.isPropagationStopped=Kx,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=Eu)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Eu)},persist:function(){},isPersistent:Eu}),a}var wa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ju=Cn(wa),Cl=g({},wa,{view:0,detail:0}),Sj=Cn(Cl),Cf,Ef,El,Tu=g({},Cl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Tf,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==El&&(El&&i.type==="mousemove"?(Cf=i.screenX-El.screenX,Ef=i.screenY-El.screenY):Ef=Cf=0,El=i),Cf)},movementY:function(i){return"movementY"in i?i.movementY:Ef}}),Yx=Cn(Tu),wj=g({},Tu,{dataTransfer:0}),kj=Cn(wj),Nj=g({},Cl,{relatedTarget:0}),jf=Cn(Nj),Cj=g({},wa,{animationName:0,elapsedTime:0,pseudoElement:0}),Ej=Cn(Cj),jj=g({},wa,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),Tj=Cn(jj),Aj=g({},wa,{data:0}),Xx=Cn(Aj),Rj={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Mj={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"},Dj={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Oj(i){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(i):(i=Dj[i])?!!a[i]:!1}function Tf(){return Oj}var Lj=g({},Cl,{key:function(i){if(i.key){var a=Rj[i.key]||i.key;if(a!=="Unidentified")return a}return i.type==="keypress"?(i=Cu(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?Mj[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Tf,charCode:function(i){return i.type==="keypress"?Cu(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Cu(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),zj=Cn(Lj),Bj=g({},Tu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Zx=Cn(Bj),Ij=g({},Cl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Tf}),Pj=Cn(Ij),$j=g({},wa,{propertyName:0,elapsedTime:0,pseudoElement:0}),Hj=Cn($j),Uj=g({},Tu,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),Fj=Cn(Uj),qj=g({},wa,{newState:0,oldState:0}),Vj=Cn(qj),Gj=[9,13,27,32],Af=tr&&"CompositionEvent"in window,jl=null;tr&&"documentMode"in document&&(jl=document.documentMode);var Wj=tr&&"TextEvent"in window&&!jl,Qx=tr&&(!Af||jl&&8<jl&&11>=jl),Jx=" ",ev=!1;function tv(i,a){switch(i){case"keyup":return Gj.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function sv(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var bo=!1;function Kj(i,a){switch(i){case"compositionend":return sv(a);case"keypress":return a.which!==32?null:(ev=!0,Jx);case"textInput":return i=a.data,i===Jx&&ev?null:i;default:return null}}function Yj(i,a){if(bo)return i==="compositionend"||!Af&&tv(i,a)?(i=Wx(),Nu=Nf=zr=null,bo=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return Qx&&a.locale!=="ko"?null:a.data;default:return null}}var Xj={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 nv(i){var a=i&&i.nodeName&&i.nodeName.toLowerCase();return a==="input"?!!Xj[i.type]:a==="textarea"}function iv(i,a,c,f){vt?ns?ns.push(f):ns=[f]:vt=f,a=xd(a,"onChange"),0<a.length&&(c=new ju("onChange","change",null,c,f),i.push({event:c,listeners:a}))}var Tl=null,Al=null;function Zj(i){$_(i,0)}function Au(i){var a=Mr(i);if(_l(a))return i}function rv(i,a){if(i==="change")return a}var av=!1;if(tr){var Rf;if(tr){var Mf="oninput"in document;if(!Mf){var ov=document.createElement("div");ov.setAttribute("oninput","return;"),Mf=typeof ov.oninput=="function"}Rf=Mf}else Rf=!1;av=Rf&&(!document.documentMode||9<document.documentMode)}function lv(){Tl&&(Tl.detachEvent("onpropertychange",cv),Al=Tl=null)}function cv(i){if(i.propertyName==="value"&&Au(Al)){var a=[];iv(a,Al,i,ct(i)),ku(Zj,a)}}function Qj(i,a,c){i==="focusin"?(lv(),Tl=a,Al=c,Tl.attachEvent("onpropertychange",cv)):i==="focusout"&&lv()}function Jj(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Au(Al)}function eT(i,a){if(i==="click")return Au(a)}function tT(i,a){if(i==="input"||i==="change")return Au(a)}function sT(i,a){return i===a&&(i!==0||1/i===1/a)||i!==i&&a!==a}var Bn=typeof Object.is=="function"?Object.is:sT;function Rl(i,a){if(Bn(i,a))return!0;if(typeof i!="object"||i===null||typeof a!="object"||a===null)return!1;var c=Object.keys(i),f=Object.keys(a);if(c.length!==f.length)return!1;for(f=0;f<c.length;f++){var x=c[f];if(!js.call(a,x)||!Bn(i[x],a[x]))return!1}return!0}function uv(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function dv(i,a){var c=uv(i);i=0;for(var f;c;){if(c.nodeType===3){if(f=i+c.textContent.length,i<=a&&f>=a)return{node:c,offset:a-i};i=f}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=uv(c)}}function hv(i,a){return i&&a?i===a?!0:i&&i.nodeType===3?!1:a&&a.nodeType===3?hv(i,a.parentNode):"contains"in i?i.contains(a):i.compareDocumentPosition?!!(i.compareDocumentPosition(a)&16):!1:!1}function fv(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var a=mo(i.document);a instanceof i.HTMLIFrameElement;){try{var c=typeof a.contentWindow.location.href=="string"}catch{c=!1}if(c)i=a.contentWindow;else break;a=mo(i.document)}return a}function Df(i){var a=i&&i.nodeName&&i.nodeName.toLowerCase();return a&&(a==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||a==="textarea"||i.contentEditable==="true")}var nT=tr&&"documentMode"in document&&11>=document.documentMode,xo=null,Of=null,Ml=null,Lf=!1;function mv(i,a,c){var f=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Lf||xo==null||xo!==mo(f)||(f=xo,"selectionStart"in f&&Df(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),Ml&&Rl(Ml,f)||(Ml=f,f=xd(Of,"onSelect"),0<f.length&&(a=new ju("onSelect","select",null,a,c),i.push({event:a,listeners:f}),a.target=xo)))}function ka(i,a){var c={};return c[i.toLowerCase()]=a.toLowerCase(),c["Webkit"+i]="webkit"+a,c["Moz"+i]="moz"+a,c}var vo={animationend:ka("Animation","AnimationEnd"),animationiteration:ka("Animation","AnimationIteration"),animationstart:ka("Animation","AnimationStart"),transitionrun:ka("Transition","TransitionRun"),transitionstart:ka("Transition","TransitionStart"),transitioncancel:ka("Transition","TransitionCancel"),transitionend:ka("Transition","TransitionEnd")},zf={},pv={};tr&&(pv=document.createElement("div").style,"AnimationEvent"in window||(delete vo.animationend.animation,delete vo.animationiteration.animation,delete vo.animationstart.animation),"TransitionEvent"in window||delete vo.transitionend.transition);function Na(i){if(zf[i])return zf[i];if(!vo[i])return i;var a=vo[i],c;for(c in a)if(a.hasOwnProperty(c)&&c in pv)return zf[i]=a[c];return i}var gv=Na("animationend"),bv=Na("animationiteration"),xv=Na("animationstart"),iT=Na("transitionrun"),rT=Na("transitionstart"),aT=Na("transitioncancel"),vv=Na("transitionend"),_v=new Map,Bf="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(" ");Bf.push("scrollEnd");function bi(i,a){_v.set(i,a),Ji(a,[i])}var Ru=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},Zn=[],_o=0,If=0;function Mu(){for(var i=_o,a=If=_o=0;a<i;){var c=Zn[a];Zn[a++]=null;var f=Zn[a];Zn[a++]=null;var x=Zn[a];Zn[a++]=null;var _=Zn[a];if(Zn[a++]=null,f!==null&&x!==null){var C=f.pending;C===null?x.next=x:(x.next=C.next,C.next=x),f.pending=x}_!==0&&yv(c,x,_)}}function Du(i,a,c,f){Zn[_o++]=i,Zn[_o++]=a,Zn[_o++]=c,Zn[_o++]=f,If|=f,i.lanes|=f,i=i.alternate,i!==null&&(i.lanes|=f)}function Pf(i,a,c,f){return Du(i,a,c,f),Ou(i)}function Ca(i,a){return Du(i,null,null,a),Ou(i)}function yv(i,a,c){i.lanes|=c;var f=i.alternate;f!==null&&(f.lanes|=c);for(var x=!1,_=i.return;_!==null;)_.childLanes|=c,f=_.alternate,f!==null&&(f.childLanes|=c),_.tag===22&&(i=_.stateNode,i===null||i._visibility&1||(x=!0)),i=_,_=_.return;return i.tag===3?(_=i.stateNode,x&&a!==null&&(x=31-M(c),i=_.hiddenUpdates,f=i[x],f===null?i[x]=[a]:f.push(a),a.lane=c|536870912),_):null}function Ou(i){if(50<ec)throw ec=0,Km=null,Error(n(185));for(var a=i.return;a!==null;)i=a,a=i.return;return i.tag===3?i.stateNode:null}var yo={};function oT(i,a,c,f){this.tag=i,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function In(i,a,c,f){return new oT(i,a,c,f)}function $f(i){return i=i.prototype,!(!i||!i.isReactComponent)}function sr(i,a){var c=i.alternate;return c===null?(c=In(i.tag,a,i.key,i.mode),c.elementType=i.elementType,c.type=i.type,c.stateNode=i.stateNode,c.alternate=i,i.alternate=c):(c.pendingProps=a,c.type=i.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=i.flags&65011712,c.childLanes=i.childLanes,c.lanes=i.lanes,c.child=i.child,c.memoizedProps=i.memoizedProps,c.memoizedState=i.memoizedState,c.updateQueue=i.updateQueue,a=i.dependencies,c.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},c.sibling=i.sibling,c.index=i.index,c.ref=i.ref,c.refCleanup=i.refCleanup,c}function Sv(i,a){i.flags&=65011714;var c=i.alternate;return c===null?(i.childLanes=0,i.lanes=a,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=c.childLanes,i.lanes=c.lanes,i.child=c.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=c.memoizedProps,i.memoizedState=c.memoizedState,i.updateQueue=c.updateQueue,i.type=c.type,a=c.dependencies,i.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),i}function Lu(i,a,c,f,x,_){var C=0;if(f=i,typeof i=="function")$f(i)&&(C=1);else if(typeof i=="string")C=hA(i,c,ye.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case D:return i=In(31,c,a,x),i.elementType=D,i.lanes=_,i;case k:return Ea(c.children,x,_,a);case N:C=8,x|=24;break;case E:return i=In(12,c,a,x|2),i.elementType=E,i.lanes=_,i;case P:return i=In(13,c,a,x),i.elementType=P,i.lanes=_,i;case z:return i=In(19,c,a,x),i.elementType=z,i.lanes=_,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case j:C=10;break e;case A:C=9;break e;case T:C=11;break e;case L:C=14;break e;case R:C=16,f=null;break e}C=29,c=Error(n(130,i===null?"null":typeof i,"")),f=null}return a=In(C,c,a,x),a.elementType=i,a.type=f,a.lanes=_,a}function Ea(i,a,c,f){return i=In(7,i,f,a),i.lanes=c,i}function Hf(i,a,c){return i=In(6,i,null,a),i.lanes=c,i}function wv(i){var a=In(18,null,null,0);return a.stateNode=i,a}function Uf(i,a,c){return a=In(4,i.children!==null?i.children:[],i.key,a),a.lanes=c,a.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},a}var kv=new WeakMap;function Qn(i,a){if(typeof i=="object"&&i!==null){var c=kv.get(i);return c!==void 0?c:(a={value:i,source:a,stack:wn(a)},kv.set(i,a),a)}return{value:i,source:a,stack:wn(a)}}var So=[],wo=0,zu=null,Dl=0,Jn=[],ei=0,Br=null,Di=1,Oi="";function nr(i,a){So[wo++]=Dl,So[wo++]=zu,zu=i,Dl=a}function Nv(i,a,c){Jn[ei++]=Di,Jn[ei++]=Oi,Jn[ei++]=Br,Br=i;var f=Di;i=Oi;var x=32-M(f)-1;f&=~(1<<x),c+=1;var _=32-M(a)+x;if(30<_){var C=x-x%5;_=(f&(1<<C)-1).toString(32),f>>=C,x-=C,Di=1<<32-M(a)+x|c<<x|f,Oi=_+i}else Di=1<<_|c<<x|f,Oi=i}function Ff(i){i.return!==null&&(nr(i,1),Nv(i,1,0))}function qf(i){for(;i===zu;)zu=So[--wo],So[wo]=null,Dl=So[--wo],So[wo]=null;for(;i===Br;)Br=Jn[--ei],Jn[ei]=null,Oi=Jn[--ei],Jn[ei]=null,Di=Jn[--ei],Jn[ei]=null}function Cv(i,a){Jn[ei++]=Di,Jn[ei++]=Oi,Jn[ei++]=Br,Di=a.id,Oi=a.overflow,Br=i}var Vs=null,Kt=null,kt=!1,Ir=null,ti=!1,Vf=Error(n(519));function Pr(i){var a=Error(n(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ol(Qn(a,i)),Vf}function Ev(i){var a=i.stateNode,c=i.type,f=i.memoizedProps;switch(a[hs]=i,a[en]=f,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<sc.length;c++)xt(sc[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),Sa(a,f.value,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name,!0);break;case"select":xt("invalid",a);break;case"textarea":xt("invalid",a),go(a,f.value,f.defaultValue,f.children)}c=f.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||a.textContent===""+c||f.suppressHydrationWarning===!0||q_(a.textContent,c)?(f.popover!=null&&(xt("beforetoggle",a),xt("toggle",a)),f.onScroll!=null&&xt("scroll",a),f.onScrollEnd!=null&&xt("scrollend",a),f.onClick!=null&&(a.onclick=Ie),a=!0):a=!1,a||Pr(i,!0)}function jv(i){for(Vs=i.return;Vs;)switch(Vs.tag){case 5:case 31:case 13:ti=!1;return;case 27:case 3:ti=!0;return;default:Vs=Vs.return}}function ko(i){if(i!==Vs)return!1;if(!kt)return jv(i),kt=!0,!1;var a=i.tag,c;if((c=a!==3&&a!==27)&&((c=a===5)&&(c=i.type,c=!(c!=="form"&&c!=="button")||cp(i.type,i.memoizedProps)),c=!c),c&&Kt&&Pr(i),jv(i),a===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(n(317));Kt=J_(i)}else if(a===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(n(317));Kt=J_(i)}else a===27?(a=Kt,Jr(i.type)?(i=mp,mp=null,Kt=i):Kt=a):Kt=Vs?ni(i.stateNode.nextSibling):null;return!0}function ja(){Kt=Vs=null,kt=!1}function Gf(){var i=Ir;return i!==null&&(An===null?An=i:An.push.apply(An,i),Ir=null),i}function Ol(i){Ir===null?Ir=[i]:Ir.push(i)}var Wf=F(null),Ta=null,ir=null;function $r(i,a,c){Ee(Wf,a._currentValue),a._currentValue=c}function rr(i){i._currentValue=Wf.current,ie(Wf)}function Kf(i,a,c){for(;i!==null;){var f=i.alternate;if((i.childLanes&a)!==a?(i.childLanes|=a,f!==null&&(f.childLanes|=a)):f!==null&&(f.childLanes&a)!==a&&(f.childLanes|=a),i===c)break;i=i.return}}function Yf(i,a,c,f){var x=i.child;for(x!==null&&(x.return=i);x!==null;){var _=x.dependencies;if(_!==null){var C=x.child;_=_.firstContext;e:for(;_!==null;){var O=_;_=x;for(var G=0;G<a.length;G++)if(O.context===a[G]){_.lanes|=c,O=_.alternate,O!==null&&(O.lanes|=c),Kf(_.return,c,i),f||(C=null);break e}_=O.next}}else if(x.tag===18){if(C=x.return,C===null)throw Error(n(341));C.lanes|=c,_=C.alternate,_!==null&&(_.lanes|=c),Kf(C,c,i),C=null}else C=x.child;if(C!==null)C.return=x;else for(C=x;C!==null;){if(C===i){C=null;break}if(x=C.sibling,x!==null){x.return=C.return,C=x;break}C=C.return}x=C}}function No(i,a,c,f){i=null;for(var x=a,_=!1;x!==null;){if(!_){if((x.flags&524288)!==0)_=!0;else if((x.flags&262144)!==0)break}if(x.tag===10){var C=x.alternate;if(C===null)throw Error(n(387));if(C=C.memoizedProps,C!==null){var O=x.type;Bn(x.pendingProps.value,C.value)||(i!==null?i.push(O):i=[O])}}else if(x===Ne.current){if(C=x.alternate,C===null)throw Error(n(387));C.memoizedState.memoizedState!==x.memoizedState.memoizedState&&(i!==null?i.push(oc):i=[oc])}x=x.return}i!==null&&Yf(a,i,c,f),a.flags|=262144}function Bu(i){for(i=i.firstContext;i!==null;){if(!Bn(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function Aa(i){Ta=i,ir=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function Gs(i){return Tv(Ta,i)}function Iu(i,a){return Ta===null&&Aa(i),Tv(i,a)}function Tv(i,a){var c=a._currentValue;if(a={context:a,memoizedValue:c,next:null},ir===null){if(i===null)throw Error(n(308));ir=a,i.dependencies={lanes:0,firstContext:a},i.flags|=524288}else ir=ir.next=a;return c}var lT=typeof AbortController<"u"?AbortController:function(){var i=[],a=this.signal={aborted:!1,addEventListener:function(c,f){i.push(f)}};this.abort=function(){a.aborted=!0,i.forEach(function(c){return c()})}},cT=e.unstable_scheduleCallback,uT=e.unstable_NormalPriority,vs={$$typeof:j,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Xf(){return{controller:new lT,data:new Map,refCount:0}}function Ll(i){i.refCount--,i.refCount===0&&cT(uT,function(){i.controller.abort()})}var zl=null,Zf=0,Co=0,Eo=null;function dT(i,a){if(zl===null){var c=zl=[];Zf=0,Co=ep(),Eo={status:"pending",value:void 0,then:function(f){c.push(f)}}}return Zf++,a.then(Av,Av),a}function Av(){if(--Zf===0&&zl!==null){Eo!==null&&(Eo.status="fulfilled");var i=zl;zl=null,Co=0,Eo=null;for(var a=0;a<i.length;a++)(0,i[a])()}}function hT(i,a){var c=[],f={status:"pending",value:null,reason:null,then:function(x){c.push(x)}};return i.then(function(){f.status="fulfilled",f.value=a;for(var x=0;x<c.length;x++)(0,c[x])(a)},function(x){for(f.status="rejected",f.reason=x,x=0;x<c.length;x++)(0,c[x])(void 0)}),f}var Rv=B.S;B.S=function(i,a){m_=wt(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&dT(i,a),Rv!==null&&Rv(i,a)};var Ra=F(null);function Qf(){var i=Ra.current;return i!==null?i:qt.pooledCache}function Pu(i,a){a===null?Ee(Ra,Ra.current):Ee(Ra,a.pool)}function Mv(){var i=Qf();return i===null?null:{parent:vs._currentValue,pool:i}}var jo=Error(n(460)),Jf=Error(n(474)),$u=Error(n(542)),Hu={then:function(){}};function Dv(i){return i=i.status,i==="fulfilled"||i==="rejected"}function Ov(i,a,c){switch(c=i[c],c===void 0?i.push(a):c!==a&&(a.then(Ie,Ie),a=c),a.status){case"fulfilled":return a.value;case"rejected":throw i=a.reason,zv(i),i;default:if(typeof a.status=="string")a.then(Ie,Ie);else{if(i=qt,i!==null&&100<i.shellSuspendCounter)throw Error(n(482));i=a,i.status="pending",i.then(function(f){if(a.status==="pending"){var x=a;x.status="fulfilled",x.value=f}},function(f){if(a.status==="pending"){var x=a;x.status="rejected",x.reason=f}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw i=a.reason,zv(i),i}throw Da=a,jo}}function Ma(i){try{var a=i._init;return a(i._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(Da=c,jo):c}}var Da=null;function Lv(){if(Da===null)throw Error(n(459));var i=Da;return Da=null,i}function zv(i){if(i===jo||i===$u)throw Error(n(483))}var To=null,Bl=0;function Uu(i){var a=Bl;return Bl+=1,To===null&&(To=[]),Ov(To,i,a)}function Il(i,a){a=a.props.ref,i.ref=a!==void 0?a:null}function Fu(i,a){throw a.$$typeof===b?Error(n(525)):(i=Object.prototype.toString.call(a),Error(n(31,i==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":i)))}function Bv(i){function a(te,Q){if(i){var re=te.deletions;re===null?(te.deletions=[Q],te.flags|=16):re.push(Q)}}function c(te,Q){if(!i)return null;for(;Q!==null;)a(te,Q),Q=Q.sibling;return null}function f(te){for(var Q=new Map;te!==null;)te.key!==null?Q.set(te.key,te):Q.set(te.index,te),te=te.sibling;return Q}function x(te,Q){return te=sr(te,Q),te.index=0,te.sibling=null,te}function _(te,Q,re){return te.index=re,i?(re=te.alternate,re!==null?(re=re.index,re<Q?(te.flags|=67108866,Q):re):(te.flags|=67108866,Q)):(te.flags|=1048576,Q)}function C(te){return i&&te.alternate===null&&(te.flags|=67108866),te}function O(te,Q,re,xe){return Q===null||Q.tag!==6?(Q=Hf(re,te.mode,xe),Q.return=te,Q):(Q=x(Q,re),Q.return=te,Q)}function G(te,Q,re,xe){var st=re.type;return st===k?pe(te,Q,re.props.children,xe,re.key):Q!==null&&(Q.elementType===st||typeof st=="object"&&st!==null&&st.$$typeof===R&&Ma(st)===Q.type)?(Q=x(Q,re.props),Il(Q,re),Q.return=te,Q):(Q=Lu(re.type,re.key,re.props,null,te.mode,xe),Il(Q,re),Q.return=te,Q)}function ae(te,Q,re,xe){return Q===null||Q.tag!==4||Q.stateNode.containerInfo!==re.containerInfo||Q.stateNode.implementation!==re.implementation?(Q=Uf(re,te.mode,xe),Q.return=te,Q):(Q=x(Q,re.children||[]),Q.return=te,Q)}function pe(te,Q,re,xe,st){return Q===null||Q.tag!==7?(Q=Ea(re,te.mode,xe,st),Q.return=te,Q):(Q=x(Q,re),Q.return=te,Q)}function Se(te,Q,re){if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return Q=Hf(""+Q,te.mode,re),Q.return=te,Q;if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case v:return re=Lu(Q.type,Q.key,Q.props,null,te.mode,re),Il(re,Q),re.return=te,re;case w:return Q=Uf(Q,te.mode,re),Q.return=te,Q;case R:return Q=Ma(Q),Se(te,Q,re)}if(q(Q)||X(Q))return Q=Ea(Q,te.mode,re,null),Q.return=te,Q;if(typeof Q.then=="function")return Se(te,Uu(Q),re);if(Q.$$typeof===j)return Se(te,Iu(te,Q),re);Fu(te,Q)}return null}function le(te,Q,re,xe){var st=Q!==null?Q.key:null;if(typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint")return st!==null?null:O(te,Q,""+re,xe);if(typeof re=="object"&&re!==null){switch(re.$$typeof){case v:return re.key===st?G(te,Q,re,xe):null;case w:return re.key===st?ae(te,Q,re,xe):null;case R:return re=Ma(re),le(te,Q,re,xe)}if(q(re)||X(re))return st!==null?null:pe(te,Q,re,xe,null);if(typeof re.then=="function")return le(te,Q,Uu(re),xe);if(re.$$typeof===j)return le(te,Q,Iu(te,re),xe);Fu(te,re)}return null}function he(te,Q,re,xe,st){if(typeof xe=="string"&&xe!==""||typeof xe=="number"||typeof xe=="bigint")return te=te.get(re)||null,O(Q,te,""+xe,st);if(typeof xe=="object"&&xe!==null){switch(xe.$$typeof){case v:return te=te.get(xe.key===null?re:xe.key)||null,G(Q,te,xe,st);case w:return te=te.get(xe.key===null?re:xe.key)||null,ae(Q,te,xe,st);case R:return xe=Ma(xe),he(te,Q,re,xe,st)}if(q(xe)||X(xe))return te=te.get(re)||null,pe(Q,te,xe,st,null);if(typeof xe.then=="function")return he(te,Q,re,Uu(xe),st);if(xe.$$typeof===j)return he(te,Q,re,Iu(Q,xe),st);Fu(Q,xe)}return null}function Ke(te,Q,re,xe){for(var st=null,jt=null,Ze=Q,dt=Q=0,yt=null;Ze!==null&&dt<re.length;dt++){Ze.index>dt?(yt=Ze,Ze=null):yt=Ze.sibling;var Tt=le(te,Ze,re[dt],xe);if(Tt===null){Ze===null&&(Ze=yt);break}i&&Ze&&Tt.alternate===null&&a(te,Ze),Q=_(Tt,Q,dt),jt===null?st=Tt:jt.sibling=Tt,jt=Tt,Ze=yt}if(dt===re.length)return c(te,Ze),kt&&nr(te,dt),st;if(Ze===null){for(;dt<re.length;dt++)Ze=Se(te,re[dt],xe),Ze!==null&&(Q=_(Ze,Q,dt),jt===null?st=Ze:jt.sibling=Ze,jt=Ze);return kt&&nr(te,dt),st}for(Ze=f(Ze);dt<re.length;dt++)yt=he(Ze,te,dt,re[dt],xe),yt!==null&&(i&&yt.alternate!==null&&Ze.delete(yt.key===null?dt:yt.key),Q=_(yt,Q,dt),jt===null?st=yt:jt.sibling=yt,jt=yt);return i&&Ze.forEach(function(ia){return a(te,ia)}),kt&&nr(te,dt),st}function nt(te,Q,re,xe){if(re==null)throw Error(n(151));for(var st=null,jt=null,Ze=Q,dt=Q=0,yt=null,Tt=re.next();Ze!==null&&!Tt.done;dt++,Tt=re.next()){Ze.index>dt?(yt=Ze,Ze=null):yt=Ze.sibling;var ia=le(te,Ze,Tt.value,xe);if(ia===null){Ze===null&&(Ze=yt);break}i&&Ze&&ia.alternate===null&&a(te,Ze),Q=_(ia,Q,dt),jt===null?st=ia:jt.sibling=ia,jt=ia,Ze=yt}if(Tt.done)return c(te,Ze),kt&&nr(te,dt),st;if(Ze===null){for(;!Tt.done;dt++,Tt=re.next())Tt=Se(te,Tt.value,xe),Tt!==null&&(Q=_(Tt,Q,dt),jt===null?st=Tt:jt.sibling=Tt,jt=Tt);return kt&&nr(te,dt),st}for(Ze=f(Ze);!Tt.done;dt++,Tt=re.next())Tt=he(Ze,te,dt,Tt.value,xe),Tt!==null&&(i&&Tt.alternate!==null&&Ze.delete(Tt.key===null?dt:Tt.key),Q=_(Tt,Q,dt),jt===null?st=Tt:jt.sibling=Tt,jt=Tt);return i&&Ze.forEach(function(wA){return a(te,wA)}),kt&&nr(te,dt),st}function Ht(te,Q,re,xe){if(typeof re=="object"&&re!==null&&re.type===k&&re.key===null&&(re=re.props.children),typeof re=="object"&&re!==null){switch(re.$$typeof){case v:e:{for(var st=re.key;Q!==null;){if(Q.key===st){if(st=re.type,st===k){if(Q.tag===7){c(te,Q.sibling),xe=x(Q,re.props.children),xe.return=te,te=xe;break e}}else if(Q.elementType===st||typeof st=="object"&&st!==null&&st.$$typeof===R&&Ma(st)===Q.type){c(te,Q.sibling),xe=x(Q,re.props),Il(xe,re),xe.return=te,te=xe;break e}c(te,Q);break}else a(te,Q);Q=Q.sibling}re.type===k?(xe=Ea(re.props.children,te.mode,xe,re.key),xe.return=te,te=xe):(xe=Lu(re.type,re.key,re.props,null,te.mode,xe),Il(xe,re),xe.return=te,te=xe)}return C(te);case w:e:{for(st=re.key;Q!==null;){if(Q.key===st)if(Q.tag===4&&Q.stateNode.containerInfo===re.containerInfo&&Q.stateNode.implementation===re.implementation){c(te,Q.sibling),xe=x(Q,re.children||[]),xe.return=te,te=xe;break e}else{c(te,Q);break}else a(te,Q);Q=Q.sibling}xe=Uf(re,te.mode,xe),xe.return=te,te=xe}return C(te);case R:return re=Ma(re),Ht(te,Q,re,xe)}if(q(re))return Ke(te,Q,re,xe);if(X(re)){if(st=X(re),typeof st!="function")throw Error(n(150));return re=st.call(re),nt(te,Q,re,xe)}if(typeof re.then=="function")return Ht(te,Q,Uu(re),xe);if(re.$$typeof===j)return Ht(te,Q,Iu(te,re),xe);Fu(te,re)}return typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint"?(re=""+re,Q!==null&&Q.tag===6?(c(te,Q.sibling),xe=x(Q,re),xe.return=te,te=xe):(c(te,Q),xe=Hf(re,te.mode,xe),xe.return=te,te=xe),C(te)):c(te,Q)}return function(te,Q,re,xe){try{Bl=0;var st=Ht(te,Q,re,xe);return To=null,st}catch(Ze){if(Ze===jo||Ze===$u)throw Ze;var jt=In(29,Ze,null,te.mode);return jt.lanes=xe,jt.return=te,jt}}}var Oa=Bv(!0),Iv=Bv(!1),Hr=!1;function em(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function tm(i,a){i=i.updateQueue,a.updateQueue===i&&(a.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function Ur(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function Fr(i,a,c){var f=i.updateQueue;if(f===null)return null;if(f=f.shared,(At&2)!==0){var x=f.pending;return x===null?a.next=a:(a.next=x.next,x.next=a),f.pending=a,a=Ou(i),yv(i,null,c),a}return Du(i,f,a,c),Ou(i)}function Pl(i,a,c){if(a=a.updateQueue,a!==null&&(a=a.shared,(c&4194048)!==0)){var f=a.lanes;f&=i.pendingLanes,c|=f,a.lanes=c,at(i,c)}}function sm(i,a){var c=i.updateQueue,f=i.alternate;if(f!==null&&(f=f.updateQueue,c===f)){var x=null,_=null;if(c=c.firstBaseUpdate,c!==null){do{var C={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};_===null?x=_=C:_=_.next=C,c=c.next}while(c!==null);_===null?x=_=a:_=_.next=a}else x=_=a;c={baseState:f.baseState,firstBaseUpdate:x,lastBaseUpdate:_,shared:f.shared,callbacks:f.callbacks},i.updateQueue=c;return}i=c.lastBaseUpdate,i===null?c.firstBaseUpdate=a:i.next=a,c.lastBaseUpdate=a}var nm=!1;function $l(){if(nm){var i=Eo;if(i!==null)throw i}}function Hl(i,a,c,f){nm=!1;var x=i.updateQueue;Hr=!1;var _=x.firstBaseUpdate,C=x.lastBaseUpdate,O=x.shared.pending;if(O!==null){x.shared.pending=null;var G=O,ae=G.next;G.next=null,C===null?_=ae:C.next=ae,C=G;var pe=i.alternate;pe!==null&&(pe=pe.updateQueue,O=pe.lastBaseUpdate,O!==C&&(O===null?pe.firstBaseUpdate=ae:O.next=ae,pe.lastBaseUpdate=G))}if(_!==null){var Se=x.baseState;C=0,pe=ae=G=null,O=_;do{var le=O.lane&-536870913,he=le!==O.lane;if(he?(_t&le)===le:(f&le)===le){le!==0&&le===Co&&(nm=!0),pe!==null&&(pe=pe.next={lane:0,tag:O.tag,payload:O.payload,callback:null,next:null});e:{var Ke=i,nt=O;le=a;var Ht=c;switch(nt.tag){case 1:if(Ke=nt.payload,typeof Ke=="function"){Se=Ke.call(Ht,Se,le);break e}Se=Ke;break e;case 3:Ke.flags=Ke.flags&-65537|128;case 0:if(Ke=nt.payload,le=typeof Ke=="function"?Ke.call(Ht,Se,le):Ke,le==null)break e;Se=g({},Se,le);break e;case 2:Hr=!0}}le=O.callback,le!==null&&(i.flags|=64,he&&(i.flags|=8192),he=x.callbacks,he===null?x.callbacks=[le]:he.push(le))}else he={lane:le,tag:O.tag,payload:O.payload,callback:O.callback,next:null},pe===null?(ae=pe=he,G=Se):pe=pe.next=he,C|=le;if(O=O.next,O===null){if(O=x.shared.pending,O===null)break;he=O,O=he.next,he.next=null,x.lastBaseUpdate=he,x.shared.pending=null}}while(!0);pe===null&&(G=Se),x.baseState=G,x.firstBaseUpdate=ae,x.lastBaseUpdate=pe,_===null&&(x.shared.lanes=0),Kr|=C,i.lanes=C,i.memoizedState=Se}}function Pv(i,a){if(typeof i!="function")throw Error(n(191,i));i.call(a)}function $v(i,a){var c=i.callbacks;if(c!==null)for(i.callbacks=null,i=0;i<c.length;i++)Pv(c[i],a)}var Ao=F(null),qu=F(0);function Hv(i,a){i=mr,Ee(qu,i),Ee(Ao,a),mr=i|a.baseLanes}function im(){Ee(qu,mr),Ee(Ao,Ao.current)}function rm(){mr=qu.current,ie(Ao),ie(qu)}var Pn=F(null),si=null;function qr(i){var a=i.alternate;Ee(ms,ms.current&1),Ee(Pn,i),si===null&&(a===null||Ao.current!==null||a.memoizedState!==null)&&(si=i)}function am(i){Ee(ms,ms.current),Ee(Pn,i),si===null&&(si=i)}function Uv(i){i.tag===22?(Ee(ms,ms.current),Ee(Pn,i),si===null&&(si=i)):Vr()}function Vr(){Ee(ms,ms.current),Ee(Pn,Pn.current)}function $n(i){ie(Pn),si===i&&(si=null),ie(ms)}var ms=F(0);function Vu(i){for(var a=i;a!==null;){if(a.tag===13){var c=a.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||hp(c)||fp(c)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===i)break;for(;a.sibling===null;){if(a.return===null||a.return===i)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var ar=0,ut=null,Pt=null,_s=null,Gu=!1,Ro=!1,La=!1,Wu=0,Ul=0,Mo=null,fT=0;function as(){throw Error(n(321))}function om(i,a){if(a===null)return!1;for(var c=0;c<a.length&&c<i.length;c++)if(!Bn(i[c],a[c]))return!1;return!0}function lm(i,a,c,f,x,_){return ar=_,ut=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,B.H=i===null||i.memoizedState===null?N1:wm,La=!1,_=c(f,x),La=!1,Ro&&(_=qv(a,c,f,x)),Fv(i),_}function Fv(i){B.H=Vl;var a=Pt!==null&&Pt.next!==null;if(ar=0,_s=Pt=ut=null,Gu=!1,Ul=0,Mo=null,a)throw Error(n(300));i===null||ys||(i=i.dependencies,i!==null&&Bu(i)&&(ys=!0))}function qv(i,a,c,f){ut=i;var x=0;do{if(Ro&&(Mo=null),Ul=0,Ro=!1,25<=x)throw Error(n(301));if(x+=1,_s=Pt=null,i.updateQueue!=null){var _=i.updateQueue;_.lastEffect=null,_.events=null,_.stores=null,_.memoCache!=null&&(_.memoCache.index=0)}B.H=C1,_=a(c,f)}while(Ro);return _}function mT(){var i=B.H,a=i.useState()[0];return a=typeof a.then=="function"?Fl(a):a,i=i.useState()[0],(Pt!==null?Pt.memoizedState:null)!==i&&(ut.flags|=1024),a}function cm(){var i=Wu!==0;return Wu=0,i}function um(i,a,c){a.updateQueue=i.updateQueue,a.flags&=-2053,i.lanes&=~c}function dm(i){if(Gu){for(i=i.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}Gu=!1}ar=0,_s=Pt=ut=null,Ro=!1,Ul=Wu=0,Mo=null}function hn(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return _s===null?ut.memoizedState=_s=i:_s=_s.next=i,_s}function ps(){if(Pt===null){var i=ut.alternate;i=i!==null?i.memoizedState:null}else i=Pt.next;var a=_s===null?ut.memoizedState:_s.next;if(a!==null)_s=a,Pt=i;else{if(i===null)throw ut.alternate===null?Error(n(467)):Error(n(310));Pt=i,i={memoizedState:Pt.memoizedState,baseState:Pt.baseState,baseQueue:Pt.baseQueue,queue:Pt.queue,next:null},_s===null?ut.memoizedState=_s=i:_s=_s.next=i}return _s}function Ku(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Fl(i){var a=Ul;return Ul+=1,Mo===null&&(Mo=[]),i=Ov(Mo,i,a),a=ut,(_s===null?a.memoizedState:_s.next)===null&&(a=a.alternate,B.H=a===null||a.memoizedState===null?N1:wm),i}function Yu(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return Fl(i);if(i.$$typeof===j)return Gs(i)}throw Error(n(438,String(i)))}function hm(i){var a=null,c=ut.updateQueue;if(c!==null&&(a=c.memoCache),a==null){var f=ut.alternate;f!==null&&(f=f.updateQueue,f!==null&&(f=f.memoCache,f!=null&&(a={data:f.data.map(function(x){return x.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),c===null&&(c=Ku(),ut.updateQueue=c),c.memoCache=a,c=a.data[a.index],c===void 0)for(c=a.data[a.index]=Array(i),f=0;f<i;f++)c[f]=I;return a.index++,c}function or(i,a){return typeof a=="function"?a(i):a}function Xu(i){var a=ps();return fm(a,Pt,i)}function fm(i,a,c){var f=i.queue;if(f===null)throw Error(n(311));f.lastRenderedReducer=c;var x=i.baseQueue,_=f.pending;if(_!==null){if(x!==null){var C=x.next;x.next=_.next,_.next=C}a.baseQueue=x=_,f.pending=null}if(_=i.baseState,x===null)i.memoizedState=_;else{a=x.next;var O=C=null,G=null,ae=a,pe=!1;do{var Se=ae.lane&-536870913;if(Se!==ae.lane?(_t&Se)===Se:(ar&Se)===Se){var le=ae.revertLane;if(le===0)G!==null&&(G=G.next={lane:0,revertLane:0,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null}),Se===Co&&(pe=!0);else if((ar&le)===le){ae=ae.next,le===Co&&(pe=!0);continue}else Se={lane:0,revertLane:ae.revertLane,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},G===null?(O=G=Se,C=_):G=G.next=Se,ut.lanes|=le,Kr|=le;Se=ae.action,La&&c(_,Se),_=ae.hasEagerState?ae.eagerState:c(_,Se)}else le={lane:Se,revertLane:ae.revertLane,gesture:ae.gesture,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},G===null?(O=G=le,C=_):G=G.next=le,ut.lanes|=Se,Kr|=Se;ae=ae.next}while(ae!==null&&ae!==a);if(G===null?C=_:G.next=O,!Bn(_,i.memoizedState)&&(ys=!0,pe&&(c=Eo,c!==null)))throw c;i.memoizedState=_,i.baseState=C,i.baseQueue=G,f.lastRenderedState=_}return x===null&&(f.lanes=0),[i.memoizedState,f.dispatch]}function mm(i){var a=ps(),c=a.queue;if(c===null)throw Error(n(311));c.lastRenderedReducer=i;var f=c.dispatch,x=c.pending,_=a.memoizedState;if(x!==null){c.pending=null;var C=x=x.next;do _=i(_,C.action),C=C.next;while(C!==x);Bn(_,a.memoizedState)||(ys=!0),a.memoizedState=_,a.baseQueue===null&&(a.baseState=_),c.lastRenderedState=_}return[_,f]}function Vv(i,a,c){var f=ut,x=ps(),_=kt;if(_){if(c===void 0)throw Error(n(407));c=c()}else c=a();var C=!Bn((Pt||x).memoizedState,c);if(C&&(x.memoizedState=c,ys=!0),x=x.queue,bm(Kv.bind(null,f,x,i),[i]),x.getSnapshot!==a||C||_s!==null&&_s.memoizedState.tag&1){if(f.flags|=2048,Do(9,{destroy:void 0},Wv.bind(null,f,x,c,a),null),qt===null)throw Error(n(349));_||(ar&127)!==0||Gv(f,a,c)}return c}function Gv(i,a,c){i.flags|=16384,i={getSnapshot:a,value:c},a=ut.updateQueue,a===null?(a=Ku(),ut.updateQueue=a,a.stores=[i]):(c=a.stores,c===null?a.stores=[i]:c.push(i))}function Wv(i,a,c,f){a.value=c,a.getSnapshot=f,Yv(a)&&Xv(i)}function Kv(i,a,c){return c(function(){Yv(a)&&Xv(i)})}function Yv(i){var a=i.getSnapshot;i=i.value;try{var c=a();return!Bn(i,c)}catch{return!0}}function Xv(i){var a=Ca(i,2);a!==null&&Rn(a,i,2)}function pm(i){var a=hn();if(typeof i=="function"){var c=i;if(i=c(),La){Te(!0);try{c()}finally{Te(!1)}}}return a.memoizedState=a.baseState=i,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:or,lastRenderedState:i},a}function Zv(i,a,c,f){return i.baseState=c,fm(i,Pt,typeof f=="function"?f:or)}function pT(i,a,c,f,x){if(Ju(i))throw Error(n(485));if(i=a.action,i!==null){var _={payload:x,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(C){_.listeners.push(C)}};B.T!==null?c(!0):_.isTransition=!1,f(_),c=a.pending,c===null?(_.next=a.pending=_,Qv(a,_)):(_.next=c.next,a.pending=c.next=_)}}function Qv(i,a){var c=a.action,f=a.payload,x=i.state;if(a.isTransition){var _=B.T,C={};B.T=C;try{var O=c(x,f),G=B.S;G!==null&&G(C,O),Jv(i,a,O)}catch(ae){gm(i,a,ae)}finally{_!==null&&C.types!==null&&(_.types=C.types),B.T=_}}else try{_=c(x,f),Jv(i,a,_)}catch(ae){gm(i,a,ae)}}function Jv(i,a,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(f){e1(i,a,f)},function(f){return gm(i,a,f)}):e1(i,a,c)}function e1(i,a,c){a.status="fulfilled",a.value=c,t1(a),i.state=c,a=i.pending,a!==null&&(c=a.next,c===a?i.pending=null:(c=c.next,a.next=c,Qv(i,c)))}function gm(i,a,c){var f=i.pending;if(i.pending=null,f!==null){f=f.next;do a.status="rejected",a.reason=c,t1(a),a=a.next;while(a!==f)}i.action=null}function t1(i){i=i.listeners;for(var a=0;a<i.length;a++)(0,i[a])()}function s1(i,a){return a}function n1(i,a){if(kt){var c=qt.formState;if(c!==null){e:{var f=ut;if(kt){if(Kt){t:{for(var x=Kt,_=ti;x.nodeType!==8;){if(!_){x=null;break t}if(x=ni(x.nextSibling),x===null){x=null;break t}}_=x.data,x=_==="F!"||_==="F"?x:null}if(x){Kt=ni(x.nextSibling),f=x.data==="F!";break e}}Pr(f)}f=!1}f&&(a=c[0])}}return c=hn(),c.memoizedState=c.baseState=a,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s1,lastRenderedState:a},c.queue=f,c=S1.bind(null,ut,f),f.dispatch=c,f=pm(!1),_=Sm.bind(null,ut,!1,f.queue),f=hn(),x={state:a,dispatch:null,action:i,pending:null},f.queue=x,c=pT.bind(null,ut,x,_,c),x.dispatch=c,f.memoizedState=i,[a,c,!1]}function i1(i){var a=ps();return r1(a,Pt,i)}function r1(i,a,c){if(a=fm(i,a,s1)[0],i=Xu(or)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var f=Fl(a)}catch(C){throw C===jo?$u:C}else f=a;a=ps();var x=a.queue,_=x.dispatch;return c!==a.memoizedState&&(ut.flags|=2048,Do(9,{destroy:void 0},gT.bind(null,x,c),null)),[f,_,i]}function gT(i,a){i.action=a}function a1(i){var a=ps(),c=Pt;if(c!==null)return r1(a,c,i);ps(),a=a.memoizedState,c=ps();var f=c.queue.dispatch;return c.memoizedState=i,[a,f,!1]}function Do(i,a,c,f){return i={tag:i,create:c,deps:f,inst:a,next:null},a=ut.updateQueue,a===null&&(a=Ku(),ut.updateQueue=a),c=a.lastEffect,c===null?a.lastEffect=i.next=i:(f=c.next,c.next=i,i.next=f,a.lastEffect=i),i}function o1(){return ps().memoizedState}function Zu(i,a,c,f){var x=hn();ut.flags|=i,x.memoizedState=Do(1|a,{destroy:void 0},c,f===void 0?null:f)}function Qu(i,a,c,f){var x=ps();f=f===void 0?null:f;var _=x.memoizedState.inst;Pt!==null&&f!==null&&om(f,Pt.memoizedState.deps)?x.memoizedState=Do(a,_,c,f):(ut.flags|=i,x.memoizedState=Do(1|a,_,c,f))}function l1(i,a){Zu(8390656,8,i,a)}function bm(i,a){Qu(2048,8,i,a)}function bT(i){ut.flags|=4;var a=ut.updateQueue;if(a===null)a=Ku(),ut.updateQueue=a,a.events=[i];else{var c=a.events;c===null?a.events=[i]:c.push(i)}}function c1(i){var a=ps().memoizedState;return bT({ref:a,nextImpl:i}),function(){if((At&2)!==0)throw Error(n(440));return a.impl.apply(void 0,arguments)}}function u1(i,a){return Qu(4,2,i,a)}function d1(i,a){return Qu(4,4,i,a)}function h1(i,a){if(typeof a=="function"){i=i();var c=a(i);return function(){typeof c=="function"?c():a(null)}}if(a!=null)return i=i(),a.current=i,function(){a.current=null}}function f1(i,a,c){c=c!=null?c.concat([i]):null,Qu(4,4,h1.bind(null,a,i),c)}function xm(){}function m1(i,a){var c=ps();a=a===void 0?null:a;var f=c.memoizedState;return a!==null&&om(a,f[1])?f[0]:(c.memoizedState=[i,a],i)}function p1(i,a){var c=ps();a=a===void 0?null:a;var f=c.memoizedState;if(a!==null&&om(a,f[1]))return f[0];if(f=i(),La){Te(!0);try{i()}finally{Te(!1)}}return c.memoizedState=[f,a],f}function vm(i,a,c){return c===void 0||(ar&1073741824)!==0&&(_t&261930)===0?i.memoizedState=a:(i.memoizedState=c,i=g_(),ut.lanes|=i,Kr|=i,c)}function g1(i,a,c,f){return Bn(c,a)?c:Ao.current!==null?(i=vm(i,c,f),Bn(i,a)||(ys=!0),i):(ar&42)===0||(ar&1073741824)!==0&&(_t&261930)===0?(ys=!0,i.memoizedState=c):(i=g_(),ut.lanes|=i,Kr|=i,a)}function b1(i,a,c,f,x){var _=Z.p;Z.p=_!==0&&8>_?_:8;var C=B.T,O={};B.T=O,Sm(i,!1,a,c);try{var G=x(),ae=B.S;if(ae!==null&&ae(O,G),G!==null&&typeof G=="object"&&typeof G.then=="function"){var pe=hT(G,f);ql(i,a,pe,Fn(i))}else ql(i,a,f,Fn(i))}catch(Se){ql(i,a,{then:function(){},status:"rejected",reason:Se},Fn())}finally{Z.p=_,C!==null&&O.types!==null&&(C.types=O.types),B.T=C}}function xT(){}function _m(i,a,c,f){if(i.tag!==5)throw Error(n(476));var x=x1(i).queue;b1(i,x,a,U,c===null?xT:function(){return v1(i),c(f)})}function x1(i){var a=i.memoizedState;if(a!==null)return a;a={memoizedState:U,baseState:U,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:or,lastRenderedState:U},next:null};var c={};return a.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:or,lastRenderedState:c},next:null},i.memoizedState=a,i=i.alternate,i!==null&&(i.memoizedState=a),a}function v1(i){var a=x1(i);a.next===null&&(a=i.alternate.memoizedState),ql(i,a.next.queue,{},Fn())}function ym(){return Gs(oc)}function _1(){return ps().memoizedState}function y1(){return ps().memoizedState}function vT(i){for(var a=i.return;a!==null;){switch(a.tag){case 24:case 3:var c=Fn();i=Ur(c);var f=Fr(a,i,c);f!==null&&(Rn(f,a,c),Pl(f,a,c)),a={cache:Xf()},i.payload=a;return}a=a.return}}function _T(i,a,c){var f=Fn();c={lane:f,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Ju(i)?w1(a,c):(c=Pf(i,a,c,f),c!==null&&(Rn(c,i,f),k1(c,a,f)))}function S1(i,a,c){var f=Fn();ql(i,a,c,f)}function ql(i,a,c,f){var x={lane:f,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Ju(i))w1(a,x);else{var _=i.alternate;if(i.lanes===0&&(_===null||_.lanes===0)&&(_=a.lastRenderedReducer,_!==null))try{var C=a.lastRenderedState,O=_(C,c);if(x.hasEagerState=!0,x.eagerState=O,Bn(O,C))return Du(i,a,x,0),qt===null&&Mu(),!1}catch{}if(c=Pf(i,a,x,f),c!==null)return Rn(c,i,f),k1(c,a,f),!0}return!1}function Sm(i,a,c,f){if(f={lane:2,revertLane:ep(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},Ju(i)){if(a)throw Error(n(479))}else a=Pf(i,c,f,2),a!==null&&Rn(a,i,2)}function Ju(i){var a=i.alternate;return i===ut||a!==null&&a===ut}function w1(i,a){Ro=Gu=!0;var c=i.pending;c===null?a.next=a:(a.next=c.next,c.next=a),i.pending=a}function k1(i,a,c){if((c&4194048)!==0){var f=a.lanes;f&=i.pendingLanes,c|=f,a.lanes=c,at(i,c)}}var Vl={readContext:Gs,use:Yu,useCallback:as,useContext:as,useEffect:as,useImperativeHandle:as,useLayoutEffect:as,useInsertionEffect:as,useMemo:as,useReducer:as,useRef:as,useState:as,useDebugValue:as,useDeferredValue:as,useTransition:as,useSyncExternalStore:as,useId:as,useHostTransitionStatus:as,useFormState:as,useActionState:as,useOptimistic:as,useMemoCache:as,useCacheRefresh:as};Vl.useEffectEvent=as;var N1={readContext:Gs,use:Yu,useCallback:function(i,a){return hn().memoizedState=[i,a===void 0?null:a],i},useContext:Gs,useEffect:l1,useImperativeHandle:function(i,a,c){c=c!=null?c.concat([i]):null,Zu(4194308,4,h1.bind(null,a,i),c)},useLayoutEffect:function(i,a){return Zu(4194308,4,i,a)},useInsertionEffect:function(i,a){Zu(4,2,i,a)},useMemo:function(i,a){var c=hn();a=a===void 0?null:a;var f=i();if(La){Te(!0);try{i()}finally{Te(!1)}}return c.memoizedState=[f,a],f},useReducer:function(i,a,c){var f=hn();if(c!==void 0){var x=c(a);if(La){Te(!0);try{c(a)}finally{Te(!1)}}}else x=a;return f.memoizedState=f.baseState=x,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:x},f.queue=i,i=i.dispatch=_T.bind(null,ut,i),[f.memoizedState,i]},useRef:function(i){var a=hn();return i={current:i},a.memoizedState=i},useState:function(i){i=pm(i);var a=i.queue,c=S1.bind(null,ut,a);return a.dispatch=c,[i.memoizedState,c]},useDebugValue:xm,useDeferredValue:function(i,a){var c=hn();return vm(c,i,a)},useTransition:function(){var i=pm(!1);return i=b1.bind(null,ut,i.queue,!0,!1),hn().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,a,c){var f=ut,x=hn();if(kt){if(c===void 0)throw Error(n(407));c=c()}else{if(c=a(),qt===null)throw Error(n(349));(_t&127)!==0||Gv(f,a,c)}x.memoizedState=c;var _={value:c,getSnapshot:a};return x.queue=_,l1(Kv.bind(null,f,_,i),[i]),f.flags|=2048,Do(9,{destroy:void 0},Wv.bind(null,f,_,c,a),null),c},useId:function(){var i=hn(),a=qt.identifierPrefix;if(kt){var c=Oi,f=Di;c=(f&~(1<<32-M(f)-1)).toString(32)+c,a="_"+a+"R_"+c,c=Wu++,0<c&&(a+="H"+c.toString(32)),a+="_"}else c=fT++,a="_"+a+"r_"+c.toString(32)+"_";return i.memoizedState=a},useHostTransitionStatus:ym,useFormState:n1,useActionState:n1,useOptimistic:function(i){var a=hn();a.memoizedState=a.baseState=i;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=c,a=Sm.bind(null,ut,!0,c),c.dispatch=a,[i,a]},useMemoCache:hm,useCacheRefresh:function(){return hn().memoizedState=vT.bind(null,ut)},useEffectEvent:function(i){var a=hn(),c={impl:i};return a.memoizedState=c,function(){if((At&2)!==0)throw Error(n(440));return c.impl.apply(void 0,arguments)}}},wm={readContext:Gs,use:Yu,useCallback:m1,useContext:Gs,useEffect:bm,useImperativeHandle:f1,useInsertionEffect:u1,useLayoutEffect:d1,useMemo:p1,useReducer:Xu,useRef:o1,useState:function(){return Xu(or)},useDebugValue:xm,useDeferredValue:function(i,a){var c=ps();return g1(c,Pt.memoizedState,i,a)},useTransition:function(){var i=Xu(or)[0],a=ps().memoizedState;return[typeof i=="boolean"?i:Fl(i),a]},useSyncExternalStore:Vv,useId:_1,useHostTransitionStatus:ym,useFormState:i1,useActionState:i1,useOptimistic:function(i,a){var c=ps();return Zv(c,Pt,i,a)},useMemoCache:hm,useCacheRefresh:y1};wm.useEffectEvent=c1;var C1={readContext:Gs,use:Yu,useCallback:m1,useContext:Gs,useEffect:bm,useImperativeHandle:f1,useInsertionEffect:u1,useLayoutEffect:d1,useMemo:p1,useReducer:mm,useRef:o1,useState:function(){return mm(or)},useDebugValue:xm,useDeferredValue:function(i,a){var c=ps();return Pt===null?vm(c,i,a):g1(c,Pt.memoizedState,i,a)},useTransition:function(){var i=mm(or)[0],a=ps().memoizedState;return[typeof i=="boolean"?i:Fl(i),a]},useSyncExternalStore:Vv,useId:_1,useHostTransitionStatus:ym,useFormState:a1,useActionState:a1,useOptimistic:function(i,a){var c=ps();return Pt!==null?Zv(c,Pt,i,a):(c.baseState=i,[i,c.queue.dispatch])},useMemoCache:hm,useCacheRefresh:y1};C1.useEffectEvent=c1;function km(i,a,c,f){a=i.memoizedState,c=c(f,a),c=c==null?a:g({},a,c),i.memoizedState=c,i.lanes===0&&(i.updateQueue.baseState=c)}var Nm={enqueueSetState:function(i,a,c){i=i._reactInternals;var f=Fn(),x=Ur(f);x.payload=a,c!=null&&(x.callback=c),a=Fr(i,x,f),a!==null&&(Rn(a,i,f),Pl(a,i,f))},enqueueReplaceState:function(i,a,c){i=i._reactInternals;var f=Fn(),x=Ur(f);x.tag=1,x.payload=a,c!=null&&(x.callback=c),a=Fr(i,x,f),a!==null&&(Rn(a,i,f),Pl(a,i,f))},enqueueForceUpdate:function(i,a){i=i._reactInternals;var c=Fn(),f=Ur(c);f.tag=2,a!=null&&(f.callback=a),a=Fr(i,f,c),a!==null&&(Rn(a,i,c),Pl(a,i,c))}};function E1(i,a,c,f,x,_,C){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(f,_,C):a.prototype&&a.prototype.isPureReactComponent?!Rl(c,f)||!Rl(x,_):!0}function j1(i,a,c,f){i=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(c,f),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(c,f),a.state!==i&&Nm.enqueueReplaceState(a,a.state,null)}function za(i,a){var c=a;if("ref"in a){c={};for(var f in a)f!=="ref"&&(c[f]=a[f])}if(i=i.defaultProps){c===a&&(c=g({},c));for(var x in i)c[x]===void 0&&(c[x]=i[x])}return c}function T1(i){Ru(i)}function A1(i){console.error(i)}function R1(i){Ru(i)}function ed(i,a){try{var c=i.onUncaughtError;c(a.value,{componentStack:a.stack})}catch(f){setTimeout(function(){throw f})}}function M1(i,a,c){try{var f=i.onCaughtError;f(c.value,{componentStack:c.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(x){setTimeout(function(){throw x})}}function Cm(i,a,c){return c=Ur(c),c.tag=3,c.payload={element:null},c.callback=function(){ed(i,a)},c}function D1(i){return i=Ur(i),i.tag=3,i}function O1(i,a,c,f){var x=c.type.getDerivedStateFromError;if(typeof x=="function"){var _=f.value;i.payload=function(){return x(_)},i.callback=function(){M1(a,c,f)}}var C=c.stateNode;C!==null&&typeof C.componentDidCatch=="function"&&(i.callback=function(){M1(a,c,f),typeof x!="function"&&(Yr===null?Yr=new Set([this]):Yr.add(this));var O=f.stack;this.componentDidCatch(f.value,{componentStack:O!==null?O:""})})}function yT(i,a,c,f,x){if(c.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){if(a=c.alternate,a!==null&&No(a,c,x,!0),c=Pn.current,c!==null){switch(c.tag){case 31:case 13:return si===null?hd():c.alternate===null&&os===0&&(os=3),c.flags&=-257,c.flags|=65536,c.lanes=x,f===Hu?c.flags|=16384:(a=c.updateQueue,a===null?c.updateQueue=new Set([f]):a.add(f),Zm(i,f,x)),!1;case 22:return c.flags|=65536,f===Hu?c.flags|=16384:(a=c.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([f])},c.updateQueue=a):(c=a.retryQueue,c===null?a.retryQueue=new Set([f]):c.add(f)),Zm(i,f,x)),!1}throw Error(n(435,c.tag))}return Zm(i,f,x),hd(),!1}if(kt)return a=Pn.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=x,f!==Vf&&(i=Error(n(422),{cause:f}),Ol(Qn(i,c)))):(f!==Vf&&(a=Error(n(423),{cause:f}),Ol(Qn(a,c))),i=i.current.alternate,i.flags|=65536,x&=-x,i.lanes|=x,f=Qn(f,c),x=Cm(i.stateNode,f,x),sm(i,x),os!==4&&(os=2)),!1;var _=Error(n(520),{cause:f});if(_=Qn(_,c),Jl===null?Jl=[_]:Jl.push(_),os!==4&&(os=2),a===null)return!0;f=Qn(f,c),c=a;do{switch(c.tag){case 3:return c.flags|=65536,i=x&-x,c.lanes|=i,i=Cm(c.stateNode,f,i),sm(c,i),!1;case 1:if(a=c.type,_=c.stateNode,(c.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||_!==null&&typeof _.componentDidCatch=="function"&&(Yr===null||!Yr.has(_))))return c.flags|=65536,x&=-x,c.lanes|=x,x=D1(x),O1(x,i,c,f),sm(c,x),!1}c=c.return}while(c!==null);return!1}var Em=Error(n(461)),ys=!1;function Ws(i,a,c,f){a.child=i===null?Iv(a,null,c,f):Oa(a,i.child,c,f)}function L1(i,a,c,f,x){c=c.render;var _=a.ref;if("ref"in f){var C={};for(var O in f)O!=="ref"&&(C[O]=f[O])}else C=f;return Aa(a),f=lm(i,a,c,C,_,x),O=cm(),i!==null&&!ys?(um(i,a,x),lr(i,a,x)):(kt&&O&&Ff(a),a.flags|=1,Ws(i,a,f,x),a.child)}function z1(i,a,c,f,x){if(i===null){var _=c.type;return typeof _=="function"&&!$f(_)&&_.defaultProps===void 0&&c.compare===null?(a.tag=15,a.type=_,B1(i,a,_,f,x)):(i=Lu(c.type,null,f,a,a.mode,x),i.ref=a.ref,i.return=a,a.child=i)}if(_=i.child,!Lm(i,x)){var C=_.memoizedProps;if(c=c.compare,c=c!==null?c:Rl,c(C,f)&&i.ref===a.ref)return lr(i,a,x)}return a.flags|=1,i=sr(_,f),i.ref=a.ref,i.return=a,a.child=i}function B1(i,a,c,f,x){if(i!==null){var _=i.memoizedProps;if(Rl(_,f)&&i.ref===a.ref)if(ys=!1,a.pendingProps=f=_,Lm(i,x))(i.flags&131072)!==0&&(ys=!0);else return a.lanes=i.lanes,lr(i,a,x)}return jm(i,a,c,f,x)}function I1(i,a,c,f){var x=f.children,_=i!==null?i.memoizedState:null;if(i===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.mode==="hidden"){if((a.flags&128)!==0){if(_=_!==null?_.baseLanes|c:c,i!==null){for(f=a.child=i.child,x=0;f!==null;)x=x|f.lanes|f.childLanes,f=f.sibling;f=x&~_}else f=0,a.child=null;return P1(i,a,_,c,f)}if((c&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},i!==null&&Pu(a,_!==null?_.cachePool:null),_!==null?Hv(a,_):im(),Uv(a);else return f=a.lanes=536870912,P1(i,a,_!==null?_.baseLanes|c:c,c,f)}else _!==null?(Pu(a,_.cachePool),Hv(a,_),Vr(),a.memoizedState=null):(i!==null&&Pu(a,null),im(),Vr());return Ws(i,a,x,c),a.child}function Gl(i,a){return i!==null&&i.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function P1(i,a,c,f,x){var _=Qf();return _=_===null?null:{parent:vs._currentValue,pool:_},a.memoizedState={baseLanes:c,cachePool:_},i!==null&&Pu(a,null),im(),Uv(a),i!==null&&No(i,a,f,!0),a.childLanes=x,null}function td(i,a){return a=nd({mode:a.mode,children:a.children},i.mode),a.ref=i.ref,i.child=a,a.return=i,a}function $1(i,a,c){return Oa(a,i.child,null,c),i=td(a,a.pendingProps),i.flags|=2,$n(a),a.memoizedState=null,i}function ST(i,a,c){var f=a.pendingProps,x=(a.flags&128)!==0;if(a.flags&=-129,i===null){if(kt){if(f.mode==="hidden")return i=td(a,f),a.lanes=536870912,Gl(null,i);if(am(a),(i=Kt)?(i=Q_(i,ti),i=i!==null&&i.data==="&"?i:null,i!==null&&(a.memoizedState={dehydrated:i,treeContext:Br!==null?{id:Di,overflow:Oi}:null,retryLane:536870912,hydrationErrors:null},c=wv(i),c.return=a,a.child=c,Vs=a,Kt=null)):i=null,i===null)throw Pr(a);return a.lanes=536870912,null}return td(a,f)}var _=i.memoizedState;if(_!==null){var C=_.dehydrated;if(am(a),x)if(a.flags&256)a.flags&=-257,a=$1(i,a,c);else if(a.memoizedState!==null)a.child=i.child,a.flags|=128,a=null;else throw Error(n(558));else if(ys||No(i,a,c,!1),x=(c&i.childLanes)!==0,ys||x){if(f=qt,f!==null&&(C=ds(f,c),C!==0&&C!==_.retryLane))throw _.retryLane=C,Ca(i,C),Rn(f,i,C),Em;hd(),a=$1(i,a,c)}else i=_.treeContext,Kt=ni(C.nextSibling),Vs=a,kt=!0,Ir=null,ti=!1,i!==null&&Cv(a,i),a=td(a,f),a.flags|=4096;return a}return i=sr(i.child,{mode:f.mode,children:f.children}),i.ref=a.ref,a.child=i,i.return=a,i}function sd(i,a){var c=a.ref;if(c===null)i!==null&&i.ref!==null&&(a.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(n(284));(i===null||i.ref!==c)&&(a.flags|=4194816)}}function jm(i,a,c,f,x){return Aa(a),c=lm(i,a,c,f,void 0,x),f=cm(),i!==null&&!ys?(um(i,a,x),lr(i,a,x)):(kt&&f&&Ff(a),a.flags|=1,Ws(i,a,c,x),a.child)}function H1(i,a,c,f,x,_){return Aa(a),a.updateQueue=null,c=qv(a,f,c,x),Fv(i),f=cm(),i!==null&&!ys?(um(i,a,_),lr(i,a,_)):(kt&&f&&Ff(a),a.flags|=1,Ws(i,a,c,_),a.child)}function U1(i,a,c,f,x){if(Aa(a),a.stateNode===null){var _=yo,C=c.contextType;typeof C=="object"&&C!==null&&(_=Gs(C)),_=new c(f,_),a.memoizedState=_.state!==null&&_.state!==void 0?_.state:null,_.updater=Nm,a.stateNode=_,_._reactInternals=a,_=a.stateNode,_.props=f,_.state=a.memoizedState,_.refs={},em(a),C=c.contextType,_.context=typeof C=="object"&&C!==null?Gs(C):yo,_.state=a.memoizedState,C=c.getDerivedStateFromProps,typeof C=="function"&&(km(a,c,C,f),_.state=a.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof _.getSnapshotBeforeUpdate=="function"||typeof _.UNSAFE_componentWillMount!="function"&&typeof _.componentWillMount!="function"||(C=_.state,typeof _.componentWillMount=="function"&&_.componentWillMount(),typeof _.UNSAFE_componentWillMount=="function"&&_.UNSAFE_componentWillMount(),C!==_.state&&Nm.enqueueReplaceState(_,_.state,null),Hl(a,f,_,x),$l(),_.state=a.memoizedState),typeof _.componentDidMount=="function"&&(a.flags|=4194308),f=!0}else if(i===null){_=a.stateNode;var O=a.memoizedProps,G=za(c,O);_.props=G;var ae=_.context,pe=c.contextType;C=yo,typeof pe=="object"&&pe!==null&&(C=Gs(pe));var Se=c.getDerivedStateFromProps;pe=typeof Se=="function"||typeof _.getSnapshotBeforeUpdate=="function",O=a.pendingProps!==O,pe||typeof _.UNSAFE_componentWillReceiveProps!="function"&&typeof _.componentWillReceiveProps!="function"||(O||ae!==C)&&j1(a,_,f,C),Hr=!1;var le=a.memoizedState;_.state=le,Hl(a,f,_,x),$l(),ae=a.memoizedState,O||le!==ae||Hr?(typeof Se=="function"&&(km(a,c,Se,f),ae=a.memoizedState),(G=Hr||E1(a,c,G,f,le,ae,C))?(pe||typeof _.UNSAFE_componentWillMount!="function"&&typeof _.componentWillMount!="function"||(typeof _.componentWillMount=="function"&&_.componentWillMount(),typeof _.UNSAFE_componentWillMount=="function"&&_.UNSAFE_componentWillMount()),typeof _.componentDidMount=="function"&&(a.flags|=4194308)):(typeof _.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=f,a.memoizedState=ae),_.props=f,_.state=ae,_.context=C,f=G):(typeof _.componentDidMount=="function"&&(a.flags|=4194308),f=!1)}else{_=a.stateNode,tm(i,a),C=a.memoizedProps,pe=za(c,C),_.props=pe,Se=a.pendingProps,le=_.context,ae=c.contextType,G=yo,typeof ae=="object"&&ae!==null&&(G=Gs(ae)),O=c.getDerivedStateFromProps,(ae=typeof O=="function"||typeof _.getSnapshotBeforeUpdate=="function")||typeof _.UNSAFE_componentWillReceiveProps!="function"&&typeof _.componentWillReceiveProps!="function"||(C!==Se||le!==G)&&j1(a,_,f,G),Hr=!1,le=a.memoizedState,_.state=le,Hl(a,f,_,x),$l();var he=a.memoizedState;C!==Se||le!==he||Hr||i!==null&&i.dependencies!==null&&Bu(i.dependencies)?(typeof O=="function"&&(km(a,c,O,f),he=a.memoizedState),(pe=Hr||E1(a,c,pe,f,le,he,G)||i!==null&&i.dependencies!==null&&Bu(i.dependencies))?(ae||typeof _.UNSAFE_componentWillUpdate!="function"&&typeof _.componentWillUpdate!="function"||(typeof _.componentWillUpdate=="function"&&_.componentWillUpdate(f,he,G),typeof _.UNSAFE_componentWillUpdate=="function"&&_.UNSAFE_componentWillUpdate(f,he,G)),typeof _.componentDidUpdate=="function"&&(a.flags|=4),typeof _.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof _.componentDidUpdate!="function"||C===i.memoizedProps&&le===i.memoizedState||(a.flags|=4),typeof _.getSnapshotBeforeUpdate!="function"||C===i.memoizedProps&&le===i.memoizedState||(a.flags|=1024),a.memoizedProps=f,a.memoizedState=he),_.props=f,_.state=he,_.context=G,f=pe):(typeof _.componentDidUpdate!="function"||C===i.memoizedProps&&le===i.memoizedState||(a.flags|=4),typeof _.getSnapshotBeforeUpdate!="function"||C===i.memoizedProps&&le===i.memoizedState||(a.flags|=1024),f=!1)}return _=f,sd(i,a),f=(a.flags&128)!==0,_||f?(_=a.stateNode,c=f&&typeof c.getDerivedStateFromError!="function"?null:_.render(),a.flags|=1,i!==null&&f?(a.child=Oa(a,i.child,null,x),a.child=Oa(a,null,c,x)):Ws(i,a,c,x),a.memoizedState=_.state,i=a.child):i=lr(i,a,x),i}function F1(i,a,c,f){return ja(),a.flags|=256,Ws(i,a,c,f),a.child}var Tm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Am(i){return{baseLanes:i,cachePool:Mv()}}function Rm(i,a,c){return i=i!==null?i.childLanes&~c:0,a&&(i|=Un),i}function q1(i,a,c){var f=a.pendingProps,x=!1,_=(a.flags&128)!==0,C;if((C=_)||(C=i!==null&&i.memoizedState===null?!1:(ms.current&2)!==0),C&&(x=!0,a.flags&=-129),C=(a.flags&32)!==0,a.flags&=-33,i===null){if(kt){if(x?qr(a):Vr(),(i=Kt)?(i=Q_(i,ti),i=i!==null&&i.data!=="&"?i:null,i!==null&&(a.memoizedState={dehydrated:i,treeContext:Br!==null?{id:Di,overflow:Oi}:null,retryLane:536870912,hydrationErrors:null},c=wv(i),c.return=a,a.child=c,Vs=a,Kt=null)):i=null,i===null)throw Pr(a);return fp(i)?a.lanes=32:a.lanes=536870912,null}var O=f.children;return f=f.fallback,x?(Vr(),x=a.mode,O=nd({mode:"hidden",children:O},x),f=Ea(f,x,c,null),O.return=a,f.return=a,O.sibling=f,a.child=O,f=a.child,f.memoizedState=Am(c),f.childLanes=Rm(i,C,c),a.memoizedState=Tm,Gl(null,f)):(qr(a),Mm(a,O))}var G=i.memoizedState;if(G!==null&&(O=G.dehydrated,O!==null)){if(_)a.flags&256?(qr(a),a.flags&=-257,a=Dm(i,a,c)):a.memoizedState!==null?(Vr(),a.child=i.child,a.flags|=128,a=null):(Vr(),O=f.fallback,x=a.mode,f=nd({mode:"visible",children:f.children},x),O=Ea(O,x,c,null),O.flags|=2,f.return=a,O.return=a,f.sibling=O,a.child=f,Oa(a,i.child,null,c),f=a.child,f.memoizedState=Am(c),f.childLanes=Rm(i,C,c),a.memoizedState=Tm,a=Gl(null,f));else if(qr(a),fp(O)){if(C=O.nextSibling&&O.nextSibling.dataset,C)var ae=C.dgst;C=ae,f=Error(n(419)),f.stack="",f.digest=C,Ol({value:f,source:null,stack:null}),a=Dm(i,a,c)}else if(ys||No(i,a,c,!1),C=(c&i.childLanes)!==0,ys||C){if(C=qt,C!==null&&(f=ds(C,c),f!==0&&f!==G.retryLane))throw G.retryLane=f,Ca(i,f),Rn(C,i,f),Em;hp(O)||hd(),a=Dm(i,a,c)}else hp(O)?(a.flags|=192,a.child=i.child,a=null):(i=G.treeContext,Kt=ni(O.nextSibling),Vs=a,kt=!0,Ir=null,ti=!1,i!==null&&Cv(a,i),a=Mm(a,f.children),a.flags|=4096);return a}return x?(Vr(),O=f.fallback,x=a.mode,G=i.child,ae=G.sibling,f=sr(G,{mode:"hidden",children:f.children}),f.subtreeFlags=G.subtreeFlags&65011712,ae!==null?O=sr(ae,O):(O=Ea(O,x,c,null),O.flags|=2),O.return=a,f.return=a,f.sibling=O,a.child=f,Gl(null,f),f=a.child,O=i.child.memoizedState,O===null?O=Am(c):(x=O.cachePool,x!==null?(G=vs._currentValue,x=x.parent!==G?{parent:G,pool:G}:x):x=Mv(),O={baseLanes:O.baseLanes|c,cachePool:x}),f.memoizedState=O,f.childLanes=Rm(i,C,c),a.memoizedState=Tm,Gl(i.child,f)):(qr(a),c=i.child,i=c.sibling,c=sr(c,{mode:"visible",children:f.children}),c.return=a,c.sibling=null,i!==null&&(C=a.deletions,C===null?(a.deletions=[i],a.flags|=16):C.push(i)),a.child=c,a.memoizedState=null,c)}function Mm(i,a){return a=nd({mode:"visible",children:a},i.mode),a.return=i,i.child=a}function nd(i,a){return i=In(22,i,null,a),i.lanes=0,i}function Dm(i,a,c){return Oa(a,i.child,null,c),i=Mm(a,a.pendingProps.children),i.flags|=2,a.memoizedState=null,i}function V1(i,a,c){i.lanes|=a;var f=i.alternate;f!==null&&(f.lanes|=a),Kf(i.return,a,c)}function Om(i,a,c,f,x,_){var C=i.memoizedState;C===null?i.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:f,tail:c,tailMode:x,treeForkCount:_}:(C.isBackwards=a,C.rendering=null,C.renderingStartTime=0,C.last=f,C.tail=c,C.tailMode=x,C.treeForkCount=_)}function G1(i,a,c){var f=a.pendingProps,x=f.revealOrder,_=f.tail;f=f.children;var C=ms.current,O=(C&2)!==0;if(O?(C=C&1|2,a.flags|=128):C&=1,Ee(ms,C),Ws(i,a,f,c),f=kt?Dl:0,!O&&i!==null&&(i.flags&128)!==0)e:for(i=a.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&V1(i,c,a);else if(i.tag===19)V1(i,c,a);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===a)break e;for(;i.sibling===null;){if(i.return===null||i.return===a)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(x){case"forwards":for(c=a.child,x=null;c!==null;)i=c.alternate,i!==null&&Vu(i)===null&&(x=c),c=c.sibling;c=x,c===null?(x=a.child,a.child=null):(x=c.sibling,c.sibling=null),Om(a,!1,x,c,_,f);break;case"backwards":case"unstable_legacy-backwards":for(c=null,x=a.child,a.child=null;x!==null;){if(i=x.alternate,i!==null&&Vu(i)===null){a.child=x;break}i=x.sibling,x.sibling=c,c=x,x=i}Om(a,!0,c,null,_,f);break;case"together":Om(a,!1,null,null,void 0,f);break;default:a.memoizedState=null}return a.child}function lr(i,a,c){if(i!==null&&(a.dependencies=i.dependencies),Kr|=a.lanes,(c&a.childLanes)===0)if(i!==null){if(No(i,a,c,!1),(c&a.childLanes)===0)return null}else return null;if(i!==null&&a.child!==i.child)throw Error(n(153));if(a.child!==null){for(i=a.child,c=sr(i,i.pendingProps),a.child=c,c.return=a;i.sibling!==null;)i=i.sibling,c=c.sibling=sr(i,i.pendingProps),c.return=a;c.sibling=null}return a.child}function Lm(i,a){return(i.lanes&a)!==0?!0:(i=i.dependencies,!!(i!==null&&Bu(i)))}function wT(i,a,c){switch(a.tag){case 3:Ge(a,a.stateNode.containerInfo),$r(a,vs,i.memoizedState.cache),ja();break;case 27:case 5:Qe(a);break;case 4:Ge(a,a.stateNode.containerInfo);break;case 10:$r(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,am(a),null;break;case 13:var f=a.memoizedState;if(f!==null)return f.dehydrated!==null?(qr(a),a.flags|=128,null):(c&a.child.childLanes)!==0?q1(i,a,c):(qr(a),i=lr(i,a,c),i!==null?i.sibling:null);qr(a);break;case 19:var x=(i.flags&128)!==0;if(f=(c&a.childLanes)!==0,f||(No(i,a,c,!1),f=(c&a.childLanes)!==0),x){if(f)return G1(i,a,c);a.flags|=128}if(x=a.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),Ee(ms,ms.current),f)break;return null;case 22:return a.lanes=0,I1(i,a,c,a.pendingProps);case 24:$r(a,vs,i.memoizedState.cache)}return lr(i,a,c)}function W1(i,a,c){if(i!==null)if(i.memoizedProps!==a.pendingProps)ys=!0;else{if(!Lm(i,c)&&(a.flags&128)===0)return ys=!1,wT(i,a,c);ys=(i.flags&131072)!==0}else ys=!1,kt&&(a.flags&1048576)!==0&&Nv(a,Dl,a.index);switch(a.lanes=0,a.tag){case 16:e:{var f=a.pendingProps;if(i=Ma(a.elementType),a.type=i,typeof i=="function")$f(i)?(f=za(i,f),a.tag=1,a=U1(null,a,i,f,c)):(a.tag=0,a=jm(null,a,i,f,c));else{if(i!=null){var x=i.$$typeof;if(x===T){a.tag=11,a=L1(null,a,i,f,c);break e}else if(x===L){a.tag=14,a=z1(null,a,i,f,c);break e}}throw a=W(i)||i,Error(n(306,a,""))}}return a;case 0:return jm(i,a,a.type,a.pendingProps,c);case 1:return f=a.type,x=za(f,a.pendingProps),U1(i,a,f,x,c);case 3:e:{if(Ge(a,a.stateNode.containerInfo),i===null)throw Error(n(387));f=a.pendingProps;var _=a.memoizedState;x=_.element,tm(i,a),Hl(a,f,null,c);var C=a.memoizedState;if(f=C.cache,$r(a,vs,f),f!==_.cache&&Yf(a,[vs],c,!0),$l(),f=C.element,_.isDehydrated)if(_={element:f,isDehydrated:!1,cache:C.cache},a.updateQueue.baseState=_,a.memoizedState=_,a.flags&256){a=F1(i,a,f,c);break e}else if(f!==x){x=Qn(Error(n(424)),a),Ol(x),a=F1(i,a,f,c);break e}else for(i=a.stateNode.containerInfo,i.nodeType===9?i=i.body:i=i.nodeName==="HTML"?i.ownerDocument.body:i,Kt=ni(i.firstChild),Vs=a,kt=!0,Ir=null,ti=!0,c=Iv(a,null,f,c),a.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(ja(),f===x){a=lr(i,a,c);break e}Ws(i,a,f,c)}a=a.child}return a;case 26:return sd(i,a),i===null?(c=iy(a.type,null,a.pendingProps,null))?a.memoizedState=c:kt||(c=a.type,i=a.pendingProps,f=vd(je.current).createElement(c),f[hs]=a,f[en]=i,Ks(f,c,i),bs(f),a.stateNode=f):a.memoizedState=iy(a.type,i.memoizedProps,a.pendingProps,i.memoizedState),null;case 27:return Qe(a),i===null&&kt&&(f=a.stateNode=ty(a.type,a.pendingProps,je.current),Vs=a,ti=!0,x=Kt,Jr(a.type)?(mp=x,Kt=ni(f.firstChild)):Kt=x),Ws(i,a,a.pendingProps.children,c),sd(i,a),i===null&&(a.flags|=4194304),a.child;case 5:return i===null&&kt&&((x=f=Kt)&&(f=JT(f,a.type,a.pendingProps,ti),f!==null?(a.stateNode=f,Vs=a,Kt=ni(f.firstChild),ti=!1,x=!0):x=!1),x||Pr(a)),Qe(a),x=a.type,_=a.pendingProps,C=i!==null?i.memoizedProps:null,f=_.children,cp(x,_)?f=null:C!==null&&cp(x,C)&&(a.flags|=32),a.memoizedState!==null&&(x=lm(i,a,mT,null,null,c),oc._currentValue=x),sd(i,a),Ws(i,a,f,c),a.child;case 6:return i===null&&kt&&((i=c=Kt)&&(c=eA(c,a.pendingProps,ti),c!==null?(a.stateNode=c,Vs=a,Kt=null,i=!0):i=!1),i||Pr(a)),null;case 13:return q1(i,a,c);case 4:return Ge(a,a.stateNode.containerInfo),f=a.pendingProps,i===null?a.child=Oa(a,null,f,c):Ws(i,a,f,c),a.child;case 11:return L1(i,a,a.type,a.pendingProps,c);case 7:return Ws(i,a,a.pendingProps,c),a.child;case 8:return Ws(i,a,a.pendingProps.children,c),a.child;case 12:return Ws(i,a,a.pendingProps.children,c),a.child;case 10:return f=a.pendingProps,$r(a,a.type,f.value),Ws(i,a,f.children,c),a.child;case 9:return x=a.type._context,f=a.pendingProps.children,Aa(a),x=Gs(x),f=f(x),a.flags|=1,Ws(i,a,f,c),a.child;case 14:return z1(i,a,a.type,a.pendingProps,c);case 15:return B1(i,a,a.type,a.pendingProps,c);case 19:return G1(i,a,c);case 31:return ST(i,a,c);case 22:return I1(i,a,c,a.pendingProps);case 24:return Aa(a),f=Gs(vs),i===null?(x=Qf(),x===null&&(x=qt,_=Xf(),x.pooledCache=_,_.refCount++,_!==null&&(x.pooledCacheLanes|=c),x=_),a.memoizedState={parent:f,cache:x},em(a),$r(a,vs,x)):((i.lanes&c)!==0&&(tm(i,a),Hl(a,null,null,c),$l()),x=i.memoizedState,_=a.memoizedState,x.parent!==f?(x={parent:f,cache:f},a.memoizedState=x,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=x),$r(a,vs,f)):(f=_.cache,$r(a,vs,f),f!==x.cache&&Yf(a,[vs],c,!0))),Ws(i,a,a.pendingProps.children,c),a.child;case 29:throw a.pendingProps}throw Error(n(156,a.tag))}function cr(i){i.flags|=4}function zm(i,a,c,f,x){if((a=(i.mode&32)!==0)&&(a=!1),a){if(i.flags|=16777216,(x&335544128)===x)if(i.stateNode.complete)i.flags|=8192;else if(__())i.flags|=8192;else throw Da=Hu,Jf}else i.flags&=-16777217}function K1(i,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!cy(a))if(__())i.flags|=8192;else throw Da=Hu,Jf}function id(i,a){a!==null&&(i.flags|=4),i.flags&16384&&(a=i.tag!==22?Be():536870912,i.lanes|=a,Bo|=a)}function Wl(i,a){if(!kt)switch(i.tailMode){case"hidden":a=i.tail;for(var c=null;a!==null;)a.alternate!==null&&(c=a),a=a.sibling;c===null?i.tail=null:c.sibling=null;break;case"collapsed":c=i.tail;for(var f=null;c!==null;)c.alternate!==null&&(f=c),c=c.sibling;f===null?a||i.tail===null?i.tail=null:i.tail.sibling=null:f.sibling=null}}function Yt(i){var a=i.alternate!==null&&i.alternate.child===i.child,c=0,f=0;if(a)for(var x=i.child;x!==null;)c|=x.lanes|x.childLanes,f|=x.subtreeFlags&65011712,f|=x.flags&65011712,x.return=i,x=x.sibling;else for(x=i.child;x!==null;)c|=x.lanes|x.childLanes,f|=x.subtreeFlags,f|=x.flags,x.return=i,x=x.sibling;return i.subtreeFlags|=f,i.childLanes=c,a}function kT(i,a,c){var f=a.pendingProps;switch(qf(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Yt(a),null;case 1:return Yt(a),null;case 3:return c=a.stateNode,f=null,i!==null&&(f=i.memoizedState.cache),a.memoizedState.cache!==f&&(a.flags|=2048),rr(vs),Me(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(i===null||i.child===null)&&(ko(a)?cr(a):i===null||i.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Gf())),Yt(a),null;case 26:var x=a.type,_=a.memoizedState;return i===null?(cr(a),_!==null?(Yt(a),K1(a,_)):(Yt(a),zm(a,x,null,f,c))):_?_!==i.memoizedState?(cr(a),Yt(a),K1(a,_)):(Yt(a),a.flags&=-16777217):(i=i.memoizedProps,i!==f&&cr(a),Yt(a),zm(a,x,i,f,c)),null;case 27:if(ke(a),c=je.current,x=a.type,i!==null&&a.stateNode!=null)i.memoizedProps!==f&&cr(a);else{if(!f){if(a.stateNode===null)throw Error(n(166));return Yt(a),null}i=ye.current,ko(a)?Ev(a):(i=ty(x,f,c),a.stateNode=i,cr(a))}return Yt(a),null;case 5:if(ke(a),x=a.type,i!==null&&a.stateNode!=null)i.memoizedProps!==f&&cr(a);else{if(!f){if(a.stateNode===null)throw Error(n(166));return Yt(a),null}if(_=ye.current,ko(a))Ev(a);else{var C=vd(je.current);switch(_){case 1:_=C.createElementNS("http://www.w3.org/2000/svg",x);break;case 2:_=C.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;default:switch(x){case"svg":_=C.createElementNS("http://www.w3.org/2000/svg",x);break;case"math":_=C.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;case"script":_=C.createElement("div"),_.innerHTML="<script><\/script>",_=_.removeChild(_.firstChild);break;case"select":_=typeof f.is=="string"?C.createElement("select",{is:f.is}):C.createElement("select"),f.multiple?_.multiple=!0:f.size&&(_.size=f.size);break;default:_=typeof f.is=="string"?C.createElement(x,{is:f.is}):C.createElement(x)}}_[hs]=a,_[en]=f;e:for(C=a.child;C!==null;){if(C.tag===5||C.tag===6)_.appendChild(C.stateNode);else if(C.tag!==4&&C.tag!==27&&C.child!==null){C.child.return=C,C=C.child;continue}if(C===a)break e;for(;C.sibling===null;){if(C.return===null||C.return===a)break e;C=C.return}C.sibling.return=C.return,C=C.sibling}a.stateNode=_;e:switch(Ks(_,x,f),x){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}f&&cr(a)}}return Yt(a),zm(a,a.type,i===null?null:i.memoizedProps,a.pendingProps,c),null;case 6:if(i&&a.stateNode!=null)i.memoizedProps!==f&&cr(a);else{if(typeof f!="string"&&a.stateNode===null)throw Error(n(166));if(i=je.current,ko(a)){if(i=a.stateNode,c=a.memoizedProps,f=null,x=Vs,x!==null)switch(x.tag){case 27:case 5:f=x.memoizedProps}i[hs]=a,i=!!(i.nodeValue===c||f!==null&&f.suppressHydrationWarning===!0||q_(i.nodeValue,c)),i||Pr(a,!0)}else i=vd(i).createTextNode(f),i[hs]=a,a.stateNode=i}return Yt(a),null;case 31:if(c=a.memoizedState,i===null||i.memoizedState!==null){if(f=ko(a),c!==null){if(i===null){if(!f)throw Error(n(318));if(i=a.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(n(557));i[hs]=a}else ja(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Yt(a),i=!1}else c=Gf(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=c),i=!0;if(!i)return a.flags&256?($n(a),a):($n(a),null);if((a.flags&128)!==0)throw Error(n(558))}return Yt(a),null;case 13:if(f=a.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(x=ko(a),f!==null&&f.dehydrated!==null){if(i===null){if(!x)throw Error(n(318));if(x=a.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(n(317));x[hs]=a}else ja(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Yt(a),x=!1}else x=Gf(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=x),x=!0;if(!x)return a.flags&256?($n(a),a):($n(a),null)}return $n(a),(a.flags&128)!==0?(a.lanes=c,a):(c=f!==null,i=i!==null&&i.memoizedState!==null,c&&(f=a.child,x=null,f.alternate!==null&&f.alternate.memoizedState!==null&&f.alternate.memoizedState.cachePool!==null&&(x=f.alternate.memoizedState.cachePool.pool),_=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(_=f.memoizedState.cachePool.pool),_!==x&&(f.flags|=2048)),c!==i&&c&&(a.child.flags|=8192),id(a,a.updateQueue),Yt(a),null);case 4:return Me(),i===null&&ip(a.stateNode.containerInfo),Yt(a),null;case 10:return rr(a.type),Yt(a),null;case 19:if(ie(ms),f=a.memoizedState,f===null)return Yt(a),null;if(x=(a.flags&128)!==0,_=f.rendering,_===null)if(x)Wl(f,!1);else{if(os!==0||i!==null&&(i.flags&128)!==0)for(i=a.child;i!==null;){if(_=Vu(i),_!==null){for(a.flags|=128,Wl(f,!1),i=_.updateQueue,a.updateQueue=i,id(a,i),a.subtreeFlags=0,i=c,c=a.child;c!==null;)Sv(c,i),c=c.sibling;return Ee(ms,ms.current&1|2),kt&&nr(a,f.treeForkCount),a.child}i=i.sibling}f.tail!==null&&wt()>cd&&(a.flags|=128,x=!0,Wl(f,!1),a.lanes=4194304)}else{if(!x)if(i=Vu(_),i!==null){if(a.flags|=128,x=!0,i=i.updateQueue,a.updateQueue=i,id(a,i),Wl(f,!0),f.tail===null&&f.tailMode==="hidden"&&!_.alternate&&!kt)return Yt(a),null}else 2*wt()-f.renderingStartTime>cd&&c!==536870912&&(a.flags|=128,x=!0,Wl(f,!1),a.lanes=4194304);f.isBackwards?(_.sibling=a.child,a.child=_):(i=f.last,i!==null?i.sibling=_:a.child=_,f.last=_)}return f.tail!==null?(i=f.tail,f.rendering=i,f.tail=i.sibling,f.renderingStartTime=wt(),i.sibling=null,c=ms.current,Ee(ms,x?c&1|2:c&1),kt&&nr(a,f.treeForkCount),i):(Yt(a),null);case 22:case 23:return $n(a),rm(),f=a.memoizedState!==null,i!==null?i.memoizedState!==null!==f&&(a.flags|=8192):f&&(a.flags|=8192),f?(c&536870912)!==0&&(a.flags&128)===0&&(Yt(a),a.subtreeFlags&6&&(a.flags|=8192)):Yt(a),c=a.updateQueue,c!==null&&id(a,c.retryQueue),c=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(c=i.memoizedState.cachePool.pool),f=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(f=a.memoizedState.cachePool.pool),f!==c&&(a.flags|=2048),i!==null&&ie(Ra),null;case 24:return c=null,i!==null&&(c=i.memoizedState.cache),a.memoizedState.cache!==c&&(a.flags|=2048),rr(vs),Yt(a),null;case 25:return null;case 30:return null}throw Error(n(156,a.tag))}function NT(i,a){switch(qf(a),a.tag){case 1:return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 3:return rr(vs),Me(),i=a.flags,(i&65536)!==0&&(i&128)===0?(a.flags=i&-65537|128,a):null;case 26:case 27:case 5:return ke(a),null;case 31:if(a.memoizedState!==null){if($n(a),a.alternate===null)throw Error(n(340));ja()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 13:if($n(a),i=a.memoizedState,i!==null&&i.dehydrated!==null){if(a.alternate===null)throw Error(n(340));ja()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 19:return ie(ms),null;case 4:return Me(),null;case 10:return rr(a.type),null;case 22:case 23:return $n(a),rm(),i!==null&&ie(Ra),i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 24:return rr(vs),null;case 25:return null;default:return null}}function Y1(i,a){switch(qf(a),a.tag){case 3:rr(vs),Me();break;case 26:case 27:case 5:ke(a);break;case 4:Me();break;case 31:a.memoizedState!==null&&$n(a);break;case 13:$n(a);break;case 19:ie(ms);break;case 10:rr(a.type);break;case 22:case 23:$n(a),rm(),i!==null&&ie(Ra);break;case 24:rr(vs)}}function Kl(i,a){try{var c=a.updateQueue,f=c!==null?c.lastEffect:null;if(f!==null){var x=f.next;c=x;do{if((c.tag&i)===i){f=void 0;var _=c.create,C=c.inst;f=_(),C.destroy=f}c=c.next}while(c!==x)}}catch(O){Bt(a,a.return,O)}}function Gr(i,a,c){try{var f=a.updateQueue,x=f!==null?f.lastEffect:null;if(x!==null){var _=x.next;f=_;do{if((f.tag&i)===i){var C=f.inst,O=C.destroy;if(O!==void 0){C.destroy=void 0,x=a;var G=c,ae=O;try{ae()}catch(pe){Bt(x,G,pe)}}}f=f.next}while(f!==_)}}catch(pe){Bt(a,a.return,pe)}}function X1(i){var a=i.updateQueue;if(a!==null){var c=i.stateNode;try{$v(a,c)}catch(f){Bt(i,i.return,f)}}}function Z1(i,a,c){c.props=za(i.type,i.memoizedProps),c.state=i.memoizedState;try{c.componentWillUnmount()}catch(f){Bt(i,a,f)}}function Yl(i,a){try{var c=i.ref;if(c!==null){switch(i.tag){case 26:case 27:case 5:var f=i.stateNode;break;case 30:f=i.stateNode;break;default:f=i.stateNode}typeof c=="function"?i.refCleanup=c(f):c.current=f}}catch(x){Bt(i,a,x)}}function Li(i,a){var c=i.ref,f=i.refCleanup;if(c!==null)if(typeof f=="function")try{f()}catch(x){Bt(i,a,x)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(x){Bt(i,a,x)}else c.current=null}function Q1(i){var a=i.type,c=i.memoizedProps,f=i.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":c.autoFocus&&f.focus();break e;case"img":c.src?f.src=c.src:c.srcSet&&(f.srcset=c.srcSet)}}catch(x){Bt(i,i.return,x)}}function Bm(i,a,c){try{var f=i.stateNode;WT(f,i.type,c,a),f[en]=a}catch(x){Bt(i,i.return,x)}}function J1(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&Jr(i.type)||i.tag===4}function Im(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||J1(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&Jr(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function Pm(i,a,c){var f=i.tag;if(f===5||f===6)i=i.stateNode,a?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(i,a):(a=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,a.appendChild(i),c=c._reactRootContainer,c!=null||a.onclick!==null||(a.onclick=Ie));else if(f!==4&&(f===27&&Jr(i.type)&&(c=i.stateNode,a=null),i=i.child,i!==null))for(Pm(i,a,c),i=i.sibling;i!==null;)Pm(i,a,c),i=i.sibling}function rd(i,a,c){var f=i.tag;if(f===5||f===6)i=i.stateNode,a?c.insertBefore(i,a):c.appendChild(i);else if(f!==4&&(f===27&&Jr(i.type)&&(c=i.stateNode),i=i.child,i!==null))for(rd(i,a,c),i=i.sibling;i!==null;)rd(i,a,c),i=i.sibling}function e_(i){var a=i.stateNode,c=i.memoizedProps;try{for(var f=i.type,x=a.attributes;x.length;)a.removeAttributeNode(x[0]);Ks(a,f,c),a[hs]=i,a[en]=c}catch(_){Bt(i,i.return,_)}}var ur=!1,Ss=!1,$m=!1,t_=typeof WeakSet=="function"?WeakSet:Set,Ls=null;function CT(i,a){if(i=i.containerInfo,op=Cd,i=fv(i),Df(i)){if("selectionStart"in i)var c={start:i.selectionStart,end:i.selectionEnd};else e:{c=(c=i.ownerDocument)&&c.defaultView||window;var f=c.getSelection&&c.getSelection();if(f&&f.rangeCount!==0){c=f.anchorNode;var x=f.anchorOffset,_=f.focusNode;f=f.focusOffset;try{c.nodeType,_.nodeType}catch{c=null;break e}var C=0,O=-1,G=-1,ae=0,pe=0,Se=i,le=null;t:for(;;){for(var he;Se!==c||x!==0&&Se.nodeType!==3||(O=C+x),Se!==_||f!==0&&Se.nodeType!==3||(G=C+f),Se.nodeType===3&&(C+=Se.nodeValue.length),(he=Se.firstChild)!==null;)le=Se,Se=he;for(;;){if(Se===i)break t;if(le===c&&++ae===x&&(O=C),le===_&&++pe===f&&(G=C),(he=Se.nextSibling)!==null)break;Se=le,le=Se.parentNode}Se=he}c=O===-1||G===-1?null:{start:O,end:G}}else c=null}c=c||{start:0,end:0}}else c=null;for(lp={focusedElem:i,selectionRange:c},Cd=!1,Ls=a;Ls!==null;)if(a=Ls,i=a.child,(a.subtreeFlags&1028)!==0&&i!==null)i.return=a,Ls=i;else for(;Ls!==null;){switch(a=Ls,_=a.alternate,i=a.flags,a.tag){case 0:if((i&4)!==0&&(i=a.updateQueue,i=i!==null?i.events:null,i!==null))for(c=0;c<i.length;c++)x=i[c],x.ref.impl=x.nextImpl;break;case 11:case 15:break;case 1:if((i&1024)!==0&&_!==null){i=void 0,c=a,x=_.memoizedProps,_=_.memoizedState,f=c.stateNode;try{var Ke=za(c.type,x);i=f.getSnapshotBeforeUpdate(Ke,_),f.__reactInternalSnapshotBeforeUpdate=i}catch(nt){Bt(c,c.return,nt)}}break;case 3:if((i&1024)!==0){if(i=a.stateNode.containerInfo,c=i.nodeType,c===9)dp(i);else if(c===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":dp(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(n(163))}if(i=a.sibling,i!==null){i.return=a.return,Ls=i;break}Ls=a.return}}function s_(i,a,c){var f=c.flags;switch(c.tag){case 0:case 11:case 15:hr(i,c),f&4&&Kl(5,c);break;case 1:if(hr(i,c),f&4)if(i=c.stateNode,a===null)try{i.componentDidMount()}catch(C){Bt(c,c.return,C)}else{var x=za(c.type,a.memoizedProps);a=a.memoizedState;try{i.componentDidUpdate(x,a,i.__reactInternalSnapshotBeforeUpdate)}catch(C){Bt(c,c.return,C)}}f&64&&X1(c),f&512&&Yl(c,c.return);break;case 3:if(hr(i,c),f&64&&(i=c.updateQueue,i!==null)){if(a=null,c.child!==null)switch(c.child.tag){case 27:case 5:a=c.child.stateNode;break;case 1:a=c.child.stateNode}try{$v(i,a)}catch(C){Bt(c,c.return,C)}}break;case 27:a===null&&f&4&&e_(c);case 26:case 5:hr(i,c),a===null&&f&4&&Q1(c),f&512&&Yl(c,c.return);break;case 12:hr(i,c);break;case 31:hr(i,c),f&4&&r_(i,c);break;case 13:hr(i,c),f&4&&a_(i,c),f&64&&(i=c.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(c=LT.bind(null,c),tA(i,c))));break;case 22:if(f=c.memoizedState!==null||ur,!f){a=a!==null&&a.memoizedState!==null||Ss,x=ur;var _=Ss;ur=f,(Ss=a)&&!_?fr(i,c,(c.subtreeFlags&8772)!==0):hr(i,c),ur=x,Ss=_}break;case 30:break;default:hr(i,c)}}function n_(i){var a=i.alternate;a!==null&&(i.alternate=null,n_(a)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(a=i.stateNode,a!==null&&vl(a)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var es=null,En=!1;function dr(i,a,c){for(c=c.child;c!==null;)i_(i,a,c),c=c.sibling}function i_(i,a,c){if(ce&&typeof ce.onCommitFiberUnmount=="function")try{ce.onCommitFiberUnmount(be,c)}catch{}switch(c.tag){case 26:Ss||Li(c,a),dr(i,a,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:Ss||Li(c,a);var f=es,x=En;Jr(c.type)&&(es=c.stateNode,En=!1),dr(i,a,c),ic(c.stateNode),es=f,En=x;break;case 5:Ss||Li(c,a);case 6:if(f=es,x=En,es=null,dr(i,a,c),es=f,En=x,es!==null)if(En)try{(es.nodeType===9?es.body:es.nodeName==="HTML"?es.ownerDocument.body:es).removeChild(c.stateNode)}catch(_){Bt(c,a,_)}else try{es.removeChild(c.stateNode)}catch(_){Bt(c,a,_)}break;case 18:es!==null&&(En?(i=es,X_(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,c.stateNode),Vo(i)):X_(es,c.stateNode));break;case 4:f=es,x=En,es=c.stateNode.containerInfo,En=!0,dr(i,a,c),es=f,En=x;break;case 0:case 11:case 14:case 15:Gr(2,c,a),Ss||Gr(4,c,a),dr(i,a,c);break;case 1:Ss||(Li(c,a),f=c.stateNode,typeof f.componentWillUnmount=="function"&&Z1(c,a,f)),dr(i,a,c);break;case 21:dr(i,a,c);break;case 22:Ss=(f=Ss)||c.memoizedState!==null,dr(i,a,c),Ss=f;break;default:dr(i,a,c)}}function r_(i,a){if(a.memoizedState===null&&(i=a.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{Vo(i)}catch(c){Bt(a,a.return,c)}}}function a_(i,a){if(a.memoizedState===null&&(i=a.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{Vo(i)}catch(c){Bt(a,a.return,c)}}function ET(i){switch(i.tag){case 31:case 13:case 19:var a=i.stateNode;return a===null&&(a=i.stateNode=new t_),a;case 22:return i=i.stateNode,a=i._retryCache,a===null&&(a=i._retryCache=new t_),a;default:throw Error(n(435,i.tag))}}function ad(i,a){var c=ET(i);a.forEach(function(f){if(!c.has(f)){c.add(f);var x=zT.bind(null,i,f);f.then(x,x)}})}function jn(i,a){var c=a.deletions;if(c!==null)for(var f=0;f<c.length;f++){var x=c[f],_=i,C=a,O=C;e:for(;O!==null;){switch(O.tag){case 27:if(Jr(O.type)){es=O.stateNode,En=!1;break e}break;case 5:es=O.stateNode,En=!1;break e;case 3:case 4:es=O.stateNode.containerInfo,En=!0;break e}O=O.return}if(es===null)throw Error(n(160));i_(_,C,x),es=null,En=!1,_=x.alternate,_!==null&&(_.return=null),x.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)o_(a,i),a=a.sibling}var xi=null;function o_(i,a){var c=i.alternate,f=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:jn(a,i),Tn(i),f&4&&(Gr(3,i,i.return),Kl(3,i),Gr(5,i,i.return));break;case 1:jn(a,i),Tn(i),f&512&&(Ss||c===null||Li(c,c.return)),f&64&&ur&&(i=i.updateQueue,i!==null&&(f=i.callbacks,f!==null&&(c=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=c===null?f:c.concat(f))));break;case 26:var x=xi;if(jn(a,i),Tn(i),f&512&&(Ss||c===null||Li(c,c.return)),f&4){var _=c!==null?c.memoizedState:null;if(f=i.memoizedState,c===null)if(f===null)if(i.stateNode===null){e:{f=i.type,c=i.memoizedProps,x=x.ownerDocument||x;t:switch(f){case"title":_=x.getElementsByTagName("title")[0],(!_||_[_a]||_[hs]||_.namespaceURI==="http://www.w3.org/2000/svg"||_.hasAttribute("itemprop"))&&(_=x.createElement(f),x.head.insertBefore(_,x.querySelector("head > title"))),Ks(_,f,c),_[hs]=i,bs(_),f=_;break e;case"link":var C=oy("link","href",x).get(f+(c.href||""));if(C){for(var O=0;O<C.length;O++)if(_=C[O],_.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&_.getAttribute("rel")===(c.rel==null?null:c.rel)&&_.getAttribute("title")===(c.title==null?null:c.title)&&_.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){C.splice(O,1);break t}}_=x.createElement(f),Ks(_,f,c),x.head.appendChild(_);break;case"meta":if(C=oy("meta","content",x).get(f+(c.content||""))){for(O=0;O<C.length;O++)if(_=C[O],_.getAttribute("content")===(c.content==null?null:""+c.content)&&_.getAttribute("name")===(c.name==null?null:c.name)&&_.getAttribute("property")===(c.property==null?null:c.property)&&_.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&_.getAttribute("charset")===(c.charSet==null?null:c.charSet)){C.splice(O,1);break t}}_=x.createElement(f),Ks(_,f,c),x.head.appendChild(_);break;default:throw Error(n(468,f))}_[hs]=i,bs(_),f=_}i.stateNode=f}else ly(x,i.type,i.stateNode);else i.stateNode=ay(x,f,i.memoizedProps);else _!==f?(_===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):_.count--,f===null?ly(x,i.type,i.stateNode):ay(x,f,i.memoizedProps)):f===null&&i.stateNode!==null&&Bm(i,i.memoizedProps,c.memoizedProps)}break;case 27:jn(a,i),Tn(i),f&512&&(Ss||c===null||Li(c,c.return)),c!==null&&f&4&&Bm(i,i.memoizedProps,c.memoizedProps);break;case 5:if(jn(a,i),Tn(i),f&512&&(Ss||c===null||Li(c,c.return)),i.flags&32){x=i.stateNode;try{it(x,"")}catch(Ke){Bt(i,i.return,Ke)}}f&4&&i.stateNode!=null&&(x=i.memoizedProps,Bm(i,x,c!==null?c.memoizedProps:x)),f&1024&&($m=!0);break;case 6:if(jn(a,i),Tn(i),f&4){if(i.stateNode===null)throw Error(n(162));f=i.memoizedProps,c=i.stateNode;try{c.nodeValue=f}catch(Ke){Bt(i,i.return,Ke)}}break;case 3:if(Sd=null,x=xi,xi=_d(a.containerInfo),jn(a,i),xi=x,Tn(i),f&4&&c!==null&&c.memoizedState.isDehydrated)try{Vo(a.containerInfo)}catch(Ke){Bt(i,i.return,Ke)}$m&&($m=!1,l_(i));break;case 4:f=xi,xi=_d(i.stateNode.containerInfo),jn(a,i),Tn(i),xi=f;break;case 12:jn(a,i),Tn(i);break;case 31:jn(a,i),Tn(i),f&4&&(f=i.updateQueue,f!==null&&(i.updateQueue=null,ad(i,f)));break;case 13:jn(a,i),Tn(i),i.child.flags&8192&&i.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(ld=wt()),f&4&&(f=i.updateQueue,f!==null&&(i.updateQueue=null,ad(i,f)));break;case 22:x=i.memoizedState!==null;var G=c!==null&&c.memoizedState!==null,ae=ur,pe=Ss;if(ur=ae||x,Ss=pe||G,jn(a,i),Ss=pe,ur=ae,Tn(i),f&8192)e:for(a=i.stateNode,a._visibility=x?a._visibility&-2:a._visibility|1,x&&(c===null||G||ur||Ss||Ba(i)),c=null,a=i;;){if(a.tag===5||a.tag===26){if(c===null){G=c=a;try{if(_=G.stateNode,x)C=_.style,typeof C.setProperty=="function"?C.setProperty("display","none","important"):C.display="none";else{O=G.stateNode;var Se=G.memoizedProps.style,le=Se!=null&&Se.hasOwnProperty("display")?Se.display:null;O.style.display=le==null||typeof le=="boolean"?"":(""+le).trim()}}catch(Ke){Bt(G,G.return,Ke)}}}else if(a.tag===6){if(c===null){G=a;try{G.stateNode.nodeValue=x?"":G.memoizedProps}catch(Ke){Bt(G,G.return,Ke)}}}else if(a.tag===18){if(c===null){G=a;try{var he=G.stateNode;x?Z_(he,!0):Z_(G.stateNode,!1)}catch(Ke){Bt(G,G.return,Ke)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===i)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===i)break e;for(;a.sibling===null;){if(a.return===null||a.return===i)break e;c===a&&(c=null),a=a.return}c===a&&(c=null),a.sibling.return=a.return,a=a.sibling}f&4&&(f=i.updateQueue,f!==null&&(c=f.retryQueue,c!==null&&(f.retryQueue=null,ad(i,c))));break;case 19:jn(a,i),Tn(i),f&4&&(f=i.updateQueue,f!==null&&(i.updateQueue=null,ad(i,f)));break;case 30:break;case 21:break;default:jn(a,i),Tn(i)}}function Tn(i){var a=i.flags;if(a&2){try{for(var c,f=i.return;f!==null;){if(J1(f)){c=f;break}f=f.return}if(c==null)throw Error(n(160));switch(c.tag){case 27:var x=c.stateNode,_=Im(i);rd(i,_,x);break;case 5:var C=c.stateNode;c.flags&32&&(it(C,""),c.flags&=-33);var O=Im(i);rd(i,O,C);break;case 3:case 4:var G=c.stateNode.containerInfo,ae=Im(i);Pm(i,ae,G);break;default:throw Error(n(161))}}catch(pe){Bt(i,i.return,pe)}i.flags&=-3}a&4096&&(i.flags&=-4097)}function l_(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var a=i;l_(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),i=i.sibling}}function hr(i,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)s_(i,a.alternate,a),a=a.sibling}function Ba(i){for(i=i.child;i!==null;){var a=i;switch(a.tag){case 0:case 11:case 14:case 15:Gr(4,a,a.return),Ba(a);break;case 1:Li(a,a.return);var c=a.stateNode;typeof c.componentWillUnmount=="function"&&Z1(a,a.return,c),Ba(a);break;case 27:ic(a.stateNode);case 26:case 5:Li(a,a.return),Ba(a);break;case 22:a.memoizedState===null&&Ba(a);break;case 30:Ba(a);break;default:Ba(a)}i=i.sibling}}function fr(i,a,c){for(c=c&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var f=a.alternate,x=i,_=a,C=_.flags;switch(_.tag){case 0:case 11:case 15:fr(x,_,c),Kl(4,_);break;case 1:if(fr(x,_,c),f=_,x=f.stateNode,typeof x.componentDidMount=="function")try{x.componentDidMount()}catch(ae){Bt(f,f.return,ae)}if(f=_,x=f.updateQueue,x!==null){var O=f.stateNode;try{var G=x.shared.hiddenCallbacks;if(G!==null)for(x.shared.hiddenCallbacks=null,x=0;x<G.length;x++)Pv(G[x],O)}catch(ae){Bt(f,f.return,ae)}}c&&C&64&&X1(_),Yl(_,_.return);break;case 27:e_(_);case 26:case 5:fr(x,_,c),c&&f===null&&C&4&&Q1(_),Yl(_,_.return);break;case 12:fr(x,_,c);break;case 31:fr(x,_,c),c&&C&4&&r_(x,_);break;case 13:fr(x,_,c),c&&C&4&&a_(x,_);break;case 22:_.memoizedState===null&&fr(x,_,c),Yl(_,_.return);break;case 30:break;default:fr(x,_,c)}a=a.sibling}}function Hm(i,a){var c=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(c=i.memoizedState.cachePool.pool),i=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(i=a.memoizedState.cachePool.pool),i!==c&&(i!=null&&i.refCount++,c!=null&&Ll(c))}function Um(i,a){i=null,a.alternate!==null&&(i=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==i&&(a.refCount++,i!=null&&Ll(i))}function vi(i,a,c,f){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)c_(i,a,c,f),a=a.sibling}function c_(i,a,c,f){var x=a.flags;switch(a.tag){case 0:case 11:case 15:vi(i,a,c,f),x&2048&&Kl(9,a);break;case 1:vi(i,a,c,f);break;case 3:vi(i,a,c,f),x&2048&&(i=null,a.alternate!==null&&(i=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==i&&(a.refCount++,i!=null&&Ll(i)));break;case 12:if(x&2048){vi(i,a,c,f),i=a.stateNode;try{var _=a.memoizedProps,C=_.id,O=_.onPostCommit;typeof O=="function"&&O(C,a.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(G){Bt(a,a.return,G)}}else vi(i,a,c,f);break;case 31:vi(i,a,c,f);break;case 13:vi(i,a,c,f);break;case 23:break;case 22:_=a.stateNode,C=a.alternate,a.memoizedState!==null?_._visibility&2?vi(i,a,c,f):Xl(i,a):_._visibility&2?vi(i,a,c,f):(_._visibility|=2,Oo(i,a,c,f,(a.subtreeFlags&10256)!==0||!1)),x&2048&&Hm(C,a);break;case 24:vi(i,a,c,f),x&2048&&Um(a.alternate,a);break;default:vi(i,a,c,f)}}function Oo(i,a,c,f,x){for(x=x&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var _=i,C=a,O=c,G=f,ae=C.flags;switch(C.tag){case 0:case 11:case 15:Oo(_,C,O,G,x),Kl(8,C);break;case 23:break;case 22:var pe=C.stateNode;C.memoizedState!==null?pe._visibility&2?Oo(_,C,O,G,x):Xl(_,C):(pe._visibility|=2,Oo(_,C,O,G,x)),x&&ae&2048&&Hm(C.alternate,C);break;case 24:Oo(_,C,O,G,x),x&&ae&2048&&Um(C.alternate,C);break;default:Oo(_,C,O,G,x)}a=a.sibling}}function Xl(i,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var c=i,f=a,x=f.flags;switch(f.tag){case 22:Xl(c,f),x&2048&&Hm(f.alternate,f);break;case 24:Xl(c,f),x&2048&&Um(f.alternate,f);break;default:Xl(c,f)}a=a.sibling}}var Zl=8192;function Lo(i,a,c){if(i.subtreeFlags&Zl)for(i=i.child;i!==null;)u_(i,a,c),i=i.sibling}function u_(i,a,c){switch(i.tag){case 26:Lo(i,a,c),i.flags&Zl&&i.memoizedState!==null&&fA(c,xi,i.memoizedState,i.memoizedProps);break;case 5:Lo(i,a,c);break;case 3:case 4:var f=xi;xi=_d(i.stateNode.containerInfo),Lo(i,a,c),xi=f;break;case 22:i.memoizedState===null&&(f=i.alternate,f!==null&&f.memoizedState!==null?(f=Zl,Zl=16777216,Lo(i,a,c),Zl=f):Lo(i,a,c));break;default:Lo(i,a,c)}}function d_(i){var a=i.alternate;if(a!==null&&(i=a.child,i!==null)){a.child=null;do a=i.sibling,i.sibling=null,i=a;while(i!==null)}}function Ql(i){var a=i.deletions;if((i.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var f=a[c];Ls=f,f_(f,i)}d_(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)h_(i),i=i.sibling}function h_(i){switch(i.tag){case 0:case 11:case 15:Ql(i),i.flags&2048&&Gr(9,i,i.return);break;case 3:Ql(i);break;case 12:Ql(i);break;case 22:var a=i.stateNode;i.memoizedState!==null&&a._visibility&2&&(i.return===null||i.return.tag!==13)?(a._visibility&=-3,od(i)):Ql(i);break;default:Ql(i)}}function od(i){var a=i.deletions;if((i.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var f=a[c];Ls=f,f_(f,i)}d_(i)}for(i=i.child;i!==null;){switch(a=i,a.tag){case 0:case 11:case 15:Gr(8,a,a.return),od(a);break;case 22:c=a.stateNode,c._visibility&2&&(c._visibility&=-3,od(a));break;default:od(a)}i=i.sibling}}function f_(i,a){for(;Ls!==null;){var c=Ls;switch(c.tag){case 0:case 11:case 15:Gr(8,c,a);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var f=c.memoizedState.cachePool.pool;f!=null&&f.refCount++}break;case 24:Ll(c.memoizedState.cache)}if(f=c.child,f!==null)f.return=c,Ls=f;else e:for(c=i;Ls!==null;){f=Ls;var x=f.sibling,_=f.return;if(n_(f),f===c){Ls=null;break e}if(x!==null){x.return=_,Ls=x;break e}Ls=_}}}var jT={getCacheForType:function(i){var a=Gs(vs),c=a.data.get(i);return c===void 0&&(c=i(),a.data.set(i,c)),c},cacheSignal:function(){return Gs(vs).controller.signal}},TT=typeof WeakMap=="function"?WeakMap:Map,At=0,qt=null,bt=null,_t=0,zt=0,Hn=null,Wr=!1,zo=!1,Fm=!1,mr=0,os=0,Kr=0,Ia=0,qm=0,Un=0,Bo=0,Jl=null,An=null,Vm=!1,ld=0,m_=0,cd=1/0,ud=null,Yr=null,Ts=0,Xr=null,Io=null,pr=0,Gm=0,Wm=null,p_=null,ec=0,Km=null;function Fn(){return(At&2)!==0&&_t!==0?_t&-_t:B.T!==null?ep():co()}function g_(){if(Un===0)if((_t&536870912)===0||kt){var i=Ce;Ce<<=1,(Ce&3932160)===0&&(Ce=262144),Un=i}else Un=536870912;return i=Pn.current,i!==null&&(i.flags|=32),Un}function Rn(i,a,c){(i===qt&&(zt===2||zt===9)||i.cancelPendingCommit!==null)&&(Po(i,0),Zr(i,_t,Un,!1)),Mt(i,c),((At&2)===0||i!==qt)&&(i===qt&&((At&2)===0&&(Ia|=c),os===4&&Zr(i,_t,Un,!1)),zi(i))}function b_(i,a,c){if((At&6)!==0)throw Error(n(327));var f=!c&&(a&127)===0&&(a&i.expiredLanes)===0||ee(i,a),x=f?MT(i,a):Xm(i,a,!0),_=f;do{if(x===0){zo&&!f&&Zr(i,a,0,!1);break}else{if(c=i.current.alternate,_&&!AT(c)){x=Xm(i,a,!1),_=!1;continue}if(x===2){if(_=a,i.errorRecoveryDisabledLanes&_)var C=0;else C=i.pendingLanes&-536870913,C=C!==0?C:C&536870912?536870912:0;if(C!==0){a=C;e:{var O=i;x=Jl;var G=O.current.memoizedState.isDehydrated;if(G&&(Po(O,C).flags|=256),C=Xm(O,C,!1),C!==2){if(Fm&&!G){O.errorRecoveryDisabledLanes|=_,Ia|=_,x=4;break e}_=An,An=x,_!==null&&(An===null?An=_:An.push.apply(An,_))}x=C}if(_=!1,x!==2)continue}}if(x===1){Po(i,0),Zr(i,a,0,!0);break}e:{switch(f=i,_=x,_){case 0:case 1:throw Error(n(345));case 4:if((a&4194048)!==a)break;case 6:Zr(f,a,Un,!Wr);break e;case 2:An=null;break;case 3:case 5:break;default:throw Error(n(329))}if((a&62914560)===a&&(x=ld+300-wt(),10<x)){if(Zr(f,a,Un,!Wr),H(f,0,!0)!==0)break e;pr=a,f.timeoutHandle=K_(x_.bind(null,f,c,An,ud,Vm,a,Un,Ia,Bo,Wr,_,"Throttled",-0,0),x);break e}x_(f,c,An,ud,Vm,a,Un,Ia,Bo,Wr,_,null,-0,0)}}break}while(!0);zi(i)}function x_(i,a,c,f,x,_,C,O,G,ae,pe,Se,le,he){if(i.timeoutHandle=-1,Se=a.subtreeFlags,Se&8192||(Se&16785408)===16785408){Se={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ie},u_(a,_,Se);var Ke=(_&62914560)===_?ld-wt():(_&4194048)===_?m_-wt():0;if(Ke=mA(Se,Ke),Ke!==null){pr=_,i.cancelPendingCommit=Ke(C_.bind(null,i,a,_,c,f,x,C,O,G,pe,Se,null,le,he)),Zr(i,_,C,!ae);return}}C_(i,a,_,c,f,x,C,O,G)}function AT(i){for(var a=i;;){var c=a.tag;if((c===0||c===11||c===15)&&a.flags&16384&&(c=a.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var f=0;f<c.length;f++){var x=c[f],_=x.getSnapshot;x=x.value;try{if(!Bn(_(),x))return!1}catch{return!1}}if(c=a.child,a.subtreeFlags&16384&&c!==null)c.return=a,a=c;else{if(a===i)break;for(;a.sibling===null;){if(a.return===null||a.return===i)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Zr(i,a,c,f){a&=~qm,a&=~Ia,i.suspendedLanes|=a,i.pingedLanes&=~a,f&&(i.warmLanes|=a),f=i.expirationTimes;for(var x=a;0<x;){var _=31-M(x),C=1<<_;f[_]=-1,x&=~C}c!==0&&Ue(i,c,a)}function dd(){return(At&6)===0?(tc(0),!1):!0}function Ym(){if(bt!==null){if(zt===0)var i=bt.return;else i=bt,ir=Ta=null,dm(i),To=null,Bl=0,i=bt;for(;i!==null;)Y1(i.alternate,i),i=i.return;bt=null}}function Po(i,a){var c=i.timeoutHandle;c!==-1&&(i.timeoutHandle=-1,XT(c)),c=i.cancelPendingCommit,c!==null&&(i.cancelPendingCommit=null,c()),pr=0,Ym(),qt=i,bt=c=sr(i.current,null),_t=a,zt=0,Hn=null,Wr=!1,zo=ee(i,a),Fm=!1,Bo=Un=qm=Ia=Kr=os=0,An=Jl=null,Vm=!1,(a&8)!==0&&(a|=a&32);var f=i.entangledLanes;if(f!==0)for(i=i.entanglements,f&=a;0<f;){var x=31-M(f),_=1<<x;a|=i[x],f&=~_}return mr=a,Mu(),c}function v_(i,a){ut=null,B.H=Vl,a===jo||a===$u?(a=Lv(),zt=3):a===Jf?(a=Lv(),zt=4):zt=a===Em?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,Hn=a,bt===null&&(os=1,ed(i,Qn(a,i.current)))}function __(){var i=Pn.current;return i===null?!0:(_t&4194048)===_t?si===null:(_t&62914560)===_t||(_t&536870912)!==0?i===si:!1}function y_(){var i=B.H;return B.H=Vl,i===null?Vl:i}function S_(){var i=B.A;return B.A=jT,i}function hd(){os=4,Wr||(_t&4194048)!==_t&&Pn.current!==null||(zo=!0),(Kr&134217727)===0&&(Ia&134217727)===0||qt===null||Zr(qt,_t,Un,!1)}function Xm(i,a,c){var f=At;At|=2;var x=y_(),_=S_();(qt!==i||_t!==a)&&(ud=null,Po(i,a)),a=!1;var C=os;e:do try{if(zt!==0&&bt!==null){var O=bt,G=Hn;switch(zt){case 8:Ym(),C=6;break e;case 3:case 2:case 9:case 6:Pn.current===null&&(a=!0);var ae=zt;if(zt=0,Hn=null,$o(i,O,G,ae),c&&zo){C=0;break e}break;default:ae=zt,zt=0,Hn=null,$o(i,O,G,ae)}}RT(),C=os;break}catch(pe){v_(i,pe)}while(!0);return a&&i.shellSuspendCounter++,ir=Ta=null,At=f,B.H=x,B.A=_,bt===null&&(qt=null,_t=0,Mu()),C}function RT(){for(;bt!==null;)w_(bt)}function MT(i,a){var c=At;At|=2;var f=y_(),x=S_();qt!==i||_t!==a?(ud=null,cd=wt()+500,Po(i,a)):zo=ee(i,a);e:do try{if(zt!==0&&bt!==null){a=bt;var _=Hn;t:switch(zt){case 1:zt=0,Hn=null,$o(i,a,_,1);break;case 2:case 9:if(Dv(_)){zt=0,Hn=null,k_(a);break}a=function(){zt!==2&&zt!==9||qt!==i||(zt=7),zi(i)},_.then(a,a);break e;case 3:zt=7;break e;case 4:zt=5;break e;case 7:Dv(_)?(zt=0,Hn=null,k_(a)):(zt=0,Hn=null,$o(i,a,_,7));break;case 5:var C=null;switch(bt.tag){case 26:C=bt.memoizedState;case 5:case 27:var O=bt;if(C?cy(C):O.stateNode.complete){zt=0,Hn=null;var G=O.sibling;if(G!==null)bt=G;else{var ae=O.return;ae!==null?(bt=ae,fd(ae)):bt=null}break t}}zt=0,Hn=null,$o(i,a,_,5);break;case 6:zt=0,Hn=null,$o(i,a,_,6);break;case 8:Ym(),os=6;break e;default:throw Error(n(462))}}DT();break}catch(pe){v_(i,pe)}while(!0);return ir=Ta=null,B.H=f,B.A=x,At=c,bt!==null?0:(qt=null,_t=0,Mu(),os)}function DT(){for(;bt!==null&&!Pe();)w_(bt)}function w_(i){var a=W1(i.alternate,i,mr);i.memoizedProps=i.pendingProps,a===null?fd(i):bt=a}function k_(i){var a=i,c=a.alternate;switch(a.tag){case 15:case 0:a=H1(c,a,a.pendingProps,a.type,void 0,_t);break;case 11:a=H1(c,a,a.pendingProps,a.type.render,a.ref,_t);break;case 5:dm(a);default:Y1(c,a),a=bt=Sv(a,mr),a=W1(c,a,mr)}i.memoizedProps=i.pendingProps,a===null?fd(i):bt=a}function $o(i,a,c,f){ir=Ta=null,dm(a),To=null,Bl=0;var x=a.return;try{if(yT(i,x,a,c,_t)){os=1,ed(i,Qn(c,i.current)),bt=null;return}}catch(_){if(x!==null)throw bt=x,_;os=1,ed(i,Qn(c,i.current)),bt=null;return}a.flags&32768?(kt||f===1?i=!0:zo||(_t&536870912)!==0?i=!1:(Wr=i=!0,(f===2||f===9||f===3||f===6)&&(f=Pn.current,f!==null&&f.tag===13&&(f.flags|=16384))),N_(a,i)):fd(a)}function fd(i){var a=i;do{if((a.flags&32768)!==0){N_(a,Wr);return}i=a.return;var c=kT(a.alternate,a,mr);if(c!==null){bt=c;return}if(a=a.sibling,a!==null){bt=a;return}bt=a=i}while(a!==null);os===0&&(os=5)}function N_(i,a){do{var c=NT(i.alternate,i);if(c!==null){c.flags&=32767,bt=c;return}if(c=i.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!a&&(i=i.sibling,i!==null)){bt=i;return}bt=i=c}while(i!==null);os=6,bt=null}function C_(i,a,c,f,x,_,C,O,G){i.cancelPendingCommit=null;do md();while(Ts!==0);if((At&6)!==0)throw Error(n(327));if(a!==null){if(a===i.current)throw Error(n(177));if(_=a.lanes|a.childLanes,_|=If,qe(i,c,_,C,O,G),i===qt&&(bt=qt=null,_t=0),Io=a,Xr=i,pr=c,Gm=_,Wm=x,p_=f,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,BT(Js,function(){return R_(),null})):(i.callbackNode=null,i.callbackPriority=0),f=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||f){f=B.T,B.T=null,x=Z.p,Z.p=2,C=At,At|=4;try{CT(i,a,c)}finally{At=C,Z.p=x,B.T=f}}Ts=1,E_(),j_(),T_()}}function E_(){if(Ts===1){Ts=0;var i=Xr,a=Io,c=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||c){c=B.T,B.T=null;var f=Z.p;Z.p=2;var x=At;At|=4;try{o_(a,i);var _=lp,C=fv(i.containerInfo),O=_.focusedElem,G=_.selectionRange;if(C!==O&&O&&O.ownerDocument&&hv(O.ownerDocument.documentElement,O)){if(G!==null&&Df(O)){var ae=G.start,pe=G.end;if(pe===void 0&&(pe=ae),"selectionStart"in O)O.selectionStart=ae,O.selectionEnd=Math.min(pe,O.value.length);else{var Se=O.ownerDocument||document,le=Se&&Se.defaultView||window;if(le.getSelection){var he=le.getSelection(),Ke=O.textContent.length,nt=Math.min(G.start,Ke),Ht=G.end===void 0?nt:Math.min(G.end,Ke);!he.extend&&nt>Ht&&(C=Ht,Ht=nt,nt=C);var te=dv(O,nt),Q=dv(O,Ht);if(te&&Q&&(he.rangeCount!==1||he.anchorNode!==te.node||he.anchorOffset!==te.offset||he.focusNode!==Q.node||he.focusOffset!==Q.offset)){var re=Se.createRange();re.setStart(te.node,te.offset),he.removeAllRanges(),nt>Ht?(he.addRange(re),he.extend(Q.node,Q.offset)):(re.setEnd(Q.node,Q.offset),he.addRange(re))}}}}for(Se=[],he=O;he=he.parentNode;)he.nodeType===1&&Se.push({element:he,left:he.scrollLeft,top:he.scrollTop});for(typeof O.focus=="function"&&O.focus(),O=0;O<Se.length;O++){var xe=Se[O];xe.element.scrollLeft=xe.left,xe.element.scrollTop=xe.top}}Cd=!!op,lp=op=null}finally{At=x,Z.p=f,B.T=c}}i.current=a,Ts=2}}function j_(){if(Ts===2){Ts=0;var i=Xr,a=Io,c=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||c){c=B.T,B.T=null;var f=Z.p;Z.p=2;var x=At;At|=4;try{s_(i,a.alternate,a)}finally{At=x,Z.p=f,B.T=c}}Ts=3}}function T_(){if(Ts===4||Ts===3){Ts=0,Ct();var i=Xr,a=Io,c=pr,f=p_;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?Ts=5:(Ts=0,Io=Xr=null,A_(i,i.pendingLanes));var x=i.pendingLanes;if(x===0&&(Yr=null),Zi(c),a=a.stateNode,ce&&typeof ce.onCommitFiberRoot=="function")try{ce.onCommitFiberRoot(be,a,void 0,(a.current.flags&128)===128)}catch{}if(f!==null){a=B.T,x=Z.p,Z.p=2,B.T=null;try{for(var _=i.onRecoverableError,C=0;C<f.length;C++){var O=f[C];_(O.value,{componentStack:O.stack})}}finally{B.T=a,Z.p=x}}(pr&3)!==0&&md(),zi(i),x=i.pendingLanes,(c&261930)!==0&&(x&42)!==0?i===Km?ec++:(ec=0,Km=i):ec=0,tc(0)}}function A_(i,a){(i.pooledCacheLanes&=a)===0&&(a=i.pooledCache,a!=null&&(i.pooledCache=null,Ll(a)))}function md(){return E_(),j_(),T_(),R_()}function R_(){if(Ts!==5)return!1;var i=Xr,a=Gm;Gm=0;var c=Zi(pr),f=B.T,x=Z.p;try{Z.p=32>c?32:c,B.T=null,c=Wm,Wm=null;var _=Xr,C=pr;if(Ts=0,Io=Xr=null,pr=0,(At&6)!==0)throw Error(n(331));var O=At;if(At|=4,h_(_.current),c_(_,_.current,C,c),At=O,tc(0,!1),ce&&typeof ce.onPostCommitFiberRoot=="function")try{ce.onPostCommitFiberRoot(be,_)}catch{}return!0}finally{Z.p=x,B.T=f,A_(i,a)}}function M_(i,a,c){a=Qn(c,a),a=Cm(i.stateNode,a,2),i=Fr(i,a,2),i!==null&&(Mt(i,2),zi(i))}function Bt(i,a,c){if(i.tag===3)M_(i,i,c);else for(;a!==null;){if(a.tag===3){M_(a,i,c);break}else if(a.tag===1){var f=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(Yr===null||!Yr.has(f))){i=Qn(c,i),c=D1(2),f=Fr(a,c,2),f!==null&&(O1(c,f,a,i),Mt(f,2),zi(f));break}}a=a.return}}function Zm(i,a,c){var f=i.pingCache;if(f===null){f=i.pingCache=new TT;var x=new Set;f.set(a,x)}else x=f.get(a),x===void 0&&(x=new Set,f.set(a,x));x.has(c)||(Fm=!0,x.add(c),i=OT.bind(null,i,a,c),a.then(i,i))}function OT(i,a,c){var f=i.pingCache;f!==null&&f.delete(a),i.pingedLanes|=i.suspendedLanes&c,i.warmLanes&=~c,qt===i&&(_t&c)===c&&(os===4||os===3&&(_t&62914560)===_t&&300>wt()-ld?(At&2)===0&&Po(i,0):qm|=c,Bo===_t&&(Bo=0)),zi(i)}function D_(i,a){a===0&&(a=Be()),i=Ca(i,a),i!==null&&(Mt(i,a),zi(i))}function LT(i){var a=i.memoizedState,c=0;a!==null&&(c=a.retryLane),D_(i,c)}function zT(i,a){var c=0;switch(i.tag){case 31:case 13:var f=i.stateNode,x=i.memoizedState;x!==null&&(c=x.retryLane);break;case 19:f=i.stateNode;break;case 22:f=i.stateNode._retryCache;break;default:throw Error(n(314))}f!==null&&f.delete(a),D_(i,c)}function BT(i,a){return cn(i,a)}var pd=null,Ho=null,Qm=!1,gd=!1,Jm=!1,Qr=0;function zi(i){i!==Ho&&i.next===null&&(Ho===null?pd=Ho=i:Ho=Ho.next=i),gd=!0,Qm||(Qm=!0,PT())}function tc(i,a){if(!Jm&&gd){Jm=!0;do for(var c=!1,f=pd;f!==null;){if(i!==0){var x=f.pendingLanes;if(x===0)var _=0;else{var C=f.suspendedLanes,O=f.pingedLanes;_=(1<<31-M(42|i)+1)-1,_&=x&~(C&~O),_=_&201326741?_&201326741|1:_?_|2:0}_!==0&&(c=!0,B_(f,_))}else _=_t,_=H(f,f===qt?_:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(_&3)===0||ee(f,_)||(c=!0,B_(f,_));f=f.next}while(c);Jm=!1}}function IT(){O_()}function O_(){gd=Qm=!1;var i=0;Qr!==0&&YT()&&(i=Qr);for(var a=wt(),c=null,f=pd;f!==null;){var x=f.next,_=L_(f,a);_===0?(f.next=null,c===null?pd=x:c.next=x,x===null&&(Ho=c)):(c=f,(i!==0||(_&3)!==0)&&(gd=!0)),f=x}Ts!==0&&Ts!==5||tc(i),Qr!==0&&(Qr=0)}function L_(i,a){for(var c=i.suspendedLanes,f=i.pingedLanes,x=i.expirationTimes,_=i.pendingLanes&-62914561;0<_;){var C=31-M(_),O=1<<C,G=x[C];G===-1?((O&c)===0||(O&f)!==0)&&(x[C]=fe(O,a)):G<=a&&(i.expiredLanes|=O),_&=~O}if(a=qt,c=_t,c=H(i,i===a?c:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),f=i.callbackNode,c===0||i===a&&(zt===2||zt===9)||i.cancelPendingCommit!==null)return f!==null&&f!==null&&un(f),i.callbackNode=null,i.callbackPriority=0;if((c&3)===0||ee(i,c)){if(a=c&-c,a===i.callbackPriority)return a;switch(f!==null&&un(f),Zi(c)){case 2:case 8:c=Qs;break;case 32:c=Js;break;case 268435456:c=S;break;default:c=Js}return f=z_.bind(null,i),c=cn(c,f),i.callbackPriority=a,i.callbackNode=c,a}return f!==null&&f!==null&&un(f),i.callbackPriority=2,i.callbackNode=null,2}function z_(i,a){if(Ts!==0&&Ts!==5)return i.callbackNode=null,i.callbackPriority=0,null;var c=i.callbackNode;if(md()&&i.callbackNode!==c)return null;var f=_t;return f=H(i,i===qt?f:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),f===0?null:(b_(i,f,a),L_(i,wt()),i.callbackNode!=null&&i.callbackNode===c?z_.bind(null,i):null)}function B_(i,a){if(md())return null;b_(i,a,!0)}function PT(){ZT(function(){(At&6)!==0?cn(Ft,IT):O_()})}function ep(){if(Qr===0){var i=Co;i===0&&(i=ue,ue<<=1,(ue&261888)===0&&(ue=256)),Qr=i}return Qr}function I_(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:Lr(""+i)}function P_(i,a){var c=a.ownerDocument.createElement("input");return c.name=a.name,c.value=a.value,i.id&&c.setAttribute("form",i.id),a.parentNode.insertBefore(c,a),i=new FormData(i),c.parentNode.removeChild(c),i}function $T(i,a,c,f,x){if(a==="submit"&&c&&c.stateNode===x){var _=I_((x[en]||null).action),C=f.submitter;C&&(a=(a=C[en]||null)?I_(a.formAction):C.getAttribute("formAction"),a!==null&&(_=a,C=null));var O=new ju("action","action",null,f,x);i.push({event:O,listeners:[{instance:null,listener:function(){if(f.defaultPrevented){if(Qr!==0){var G=C?P_(x,C):new FormData(x);_m(c,{pending:!0,data:G,method:x.method,action:_},null,G)}}else typeof _=="function"&&(O.preventDefault(),G=C?P_(x,C):new FormData(x),_m(c,{pending:!0,data:G,method:x.method,action:_},_,G))},currentTarget:x}]})}}for(var tp=0;tp<Bf.length;tp++){var sp=Bf[tp],HT=sp.toLowerCase(),UT=sp[0].toUpperCase()+sp.slice(1);bi(HT,"on"+UT)}bi(gv,"onAnimationEnd"),bi(bv,"onAnimationIteration"),bi(xv,"onAnimationStart"),bi("dblclick","onDoubleClick"),bi("focusin","onFocus"),bi("focusout","onBlur"),bi(iT,"onTransitionRun"),bi(rT,"onTransitionStart"),bi(aT,"onTransitionCancel"),bi(vv,"onTransitionEnd"),Re("onMouseEnter",["mouseout","mouseover"]),Re("onMouseLeave",["mouseout","mouseover"]),Re("onPointerEnter",["pointerout","pointerover"]),Re("onPointerLeave",["pointerout","pointerover"]),Ji("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ji("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ji("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ji("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ji("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ji("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var sc="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(" "),FT=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(sc));function $_(i,a){a=(a&4)!==0;for(var c=0;c<i.length;c++){var f=i[c],x=f.event;f=f.listeners;e:{var _=void 0;if(a)for(var C=f.length-1;0<=C;C--){var O=f[C],G=O.instance,ae=O.currentTarget;if(O=O.listener,G!==_&&x.isPropagationStopped())break e;_=O,x.currentTarget=ae;try{_(x)}catch(pe){Ru(pe)}x.currentTarget=null,_=G}else for(C=0;C<f.length;C++){if(O=f[C],G=O.instance,ae=O.currentTarget,O=O.listener,G!==_&&x.isPropagationStopped())break e;_=O,x.currentTarget=ae;try{_(x)}catch(pe){Ru(pe)}x.currentTarget=null,_=G}}}}function xt(i,a){var c=a[xl];c===void 0&&(c=a[xl]=new Set);var f=i+"__bubble";c.has(f)||(H_(a,i,2,!1),c.add(f))}function np(i,a,c){var f=0;a&&(f|=4),H_(c,i,f,a)}var bd="_reactListening"+Math.random().toString(36).slice(2);function ip(i){if(!i[bd]){i[bd]=!0,_u.forEach(function(c){c!=="selectionchange"&&(FT.has(c)||np(c,!1,i),np(c,!0,i))});var a=i.nodeType===9?i:i.ownerDocument;a===null||a[bd]||(a[bd]=!0,np("selectionchange",!1,a))}}function H_(i,a,c,f){switch(gy(a)){case 2:var x=bA;break;case 8:x=xA;break;default:x=vp}c=x.bind(null,a,c,i),x=void 0,!kf||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(x=!0),f?x!==void 0?i.addEventListener(a,c,{capture:!0,passive:x}):i.addEventListener(a,c,!0):x!==void 0?i.addEventListener(a,c,{passive:x}):i.addEventListener(a,c,!1)}function rp(i,a,c,f,x){var _=f;if((a&1)===0&&(a&2)===0&&f!==null)e:for(;;){if(f===null)return;var C=f.tag;if(C===3||C===4){var O=f.stateNode.containerInfo;if(O===x)break;if(C===4)for(C=f.return;C!==null;){var G=C.tag;if((G===3||G===4)&&C.stateNode.containerInfo===x)return;C=C.return}for(;O!==null;){if(C=dn(O),C===null)return;if(G=C.tag,G===5||G===6||G===26||G===27){f=_=C;continue e}O=O.parentNode}}f=f.return}ku(function(){var ae=_,pe=ct(c),Se=[];e:{var le=_v.get(i);if(le!==void 0){var he=ju,Ke=i;switch(i){case"keypress":if(Cu(c)===0)break e;case"keydown":case"keyup":he=zj;break;case"focusin":Ke="focus",he=jf;break;case"focusout":Ke="blur",he=jf;break;case"beforeblur":case"afterblur":he=jf;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":he=Yx;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":he=kj;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":he=Pj;break;case gv:case bv:case xv:he=Ej;break;case vv:he=Hj;break;case"scroll":case"scrollend":he=Sj;break;case"wheel":he=Fj;break;case"copy":case"cut":case"paste":he=Tj;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":he=Zx;break;case"toggle":case"beforetoggle":he=Vj}var nt=(a&4)!==0,Ht=!nt&&(i==="scroll"||i==="scrollend"),te=nt?le!==null?le+"Capture":null:le;nt=[];for(var Q=ae,re;Q!==null;){var xe=Q;if(re=xe.stateNode,xe=xe.tag,xe!==5&&xe!==26&&xe!==27||re===null||te===null||(xe=kl(Q,te),xe!=null&&nt.push(nc(Q,xe,re))),Ht)break;Q=Q.return}0<nt.length&&(le=new he(le,Ke,null,c,pe),Se.push({event:le,listeners:nt}))}}if((a&7)===0){e:{if(le=i==="mouseover"||i==="pointerover",he=i==="mouseout"||i==="pointerout",le&&c!==Xe&&(Ke=c.relatedTarget||c.fromElement)&&(dn(Ke)||Ke[Rr]))break e;if((he||le)&&(le=pe.window===pe?pe:(le=pe.ownerDocument)?le.defaultView||le.parentWindow:window,he?(Ke=c.relatedTarget||c.toElement,he=ae,Ke=Ke?dn(Ke):null,Ke!==null&&(Ht=l(Ke),nt=Ke.tag,Ke!==Ht||nt!==5&&nt!==27&&nt!==6)&&(Ke=null)):(he=null,Ke=ae),he!==Ke)){if(nt=Yx,xe="onMouseLeave",te="onMouseEnter",Q="mouse",(i==="pointerout"||i==="pointerover")&&(nt=Zx,xe="onPointerLeave",te="onPointerEnter",Q="pointer"),Ht=he==null?le:Mr(he),re=Ke==null?le:Mr(Ke),le=new nt(xe,Q+"leave",he,c,pe),le.target=Ht,le.relatedTarget=re,xe=null,dn(pe)===ae&&(nt=new nt(te,Q+"enter",Ke,c,pe),nt.target=re,nt.relatedTarget=Ht,xe=nt),Ht=xe,he&&Ke)t:{for(nt=qT,te=he,Q=Ke,re=0,xe=te;xe;xe=nt(xe))re++;xe=0;for(var st=Q;st;st=nt(st))xe++;for(;0<re-xe;)te=nt(te),re--;for(;0<xe-re;)Q=nt(Q),xe--;for(;re--;){if(te===Q||Q!==null&&te===Q.alternate){nt=te;break t}te=nt(te),Q=nt(Q)}nt=null}else nt=null;he!==null&&U_(Se,le,he,nt,!1),Ke!==null&&Ht!==null&&U_(Se,Ht,Ke,nt,!0)}}e:{if(le=ae?Mr(ae):window,he=le.nodeName&&le.nodeName.toLowerCase(),he==="select"||he==="input"&&le.type==="file")var jt=rv;else if(nv(le))if(av)jt=tT;else{jt=Jj;var Ze=Qj}else he=le.nodeName,!he||he.toLowerCase()!=="input"||le.type!=="checkbox"&&le.type!=="radio"?ae&&Or(ae.elementType)&&(jt=rv):jt=eT;if(jt&&(jt=jt(i,ae))){iv(Se,jt,c,pe);break e}Ze&&Ze(i,le,ae),i==="focusout"&&ae&&le.type==="number"&&ae.memoizedProps.value!=null&&po(le,"number",le.value)}switch(Ze=ae?Mr(ae):window,i){case"focusin":(nv(Ze)||Ze.contentEditable==="true")&&(xo=Ze,Of=ae,Ml=null);break;case"focusout":Ml=Of=xo=null;break;case"mousedown":Lf=!0;break;case"contextmenu":case"mouseup":case"dragend":Lf=!1,mv(Se,c,pe);break;case"selectionchange":if(nT)break;case"keydown":case"keyup":mv(Se,c,pe)}var dt;if(Af)e:{switch(i){case"compositionstart":var yt="onCompositionStart";break e;case"compositionend":yt="onCompositionEnd";break e;case"compositionupdate":yt="onCompositionUpdate";break e}yt=void 0}else bo?tv(i,c)&&(yt="onCompositionEnd"):i==="keydown"&&c.keyCode===229&&(yt="onCompositionStart");yt&&(Qx&&c.locale!=="ko"&&(bo||yt!=="onCompositionStart"?yt==="onCompositionEnd"&&bo&&(dt=Wx()):(zr=pe,Nf="value"in zr?zr.value:zr.textContent,bo=!0)),Ze=xd(ae,yt),0<Ze.length&&(yt=new Xx(yt,i,null,c,pe),Se.push({event:yt,listeners:Ze}),dt?yt.data=dt:(dt=sv(c),dt!==null&&(yt.data=dt)))),(dt=Wj?Kj(i,c):Yj(i,c))&&(yt=xd(ae,"onBeforeInput"),0<yt.length&&(Ze=new Xx("onBeforeInput","beforeinput",null,c,pe),Se.push({event:Ze,listeners:yt}),Ze.data=dt)),$T(Se,i,ae,c,pe)}$_(Se,a)})}function nc(i,a,c){return{instance:i,listener:a,currentTarget:c}}function xd(i,a){for(var c=a+"Capture",f=[];i!==null;){var x=i,_=x.stateNode;if(x=x.tag,x!==5&&x!==26&&x!==27||_===null||(x=kl(i,c),x!=null&&f.unshift(nc(i,x,_)),x=kl(i,a),x!=null&&f.push(nc(i,x,_))),i.tag===3)return f;i=i.return}return[]}function qT(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function U_(i,a,c,f,x){for(var _=a._reactName,C=[];c!==null&&c!==f;){var O=c,G=O.alternate,ae=O.stateNode;if(O=O.tag,G!==null&&G===f)break;O!==5&&O!==26&&O!==27||ae===null||(G=ae,x?(ae=kl(c,_),ae!=null&&C.unshift(nc(c,ae,G))):x||(ae=kl(c,_),ae!=null&&C.push(nc(c,ae,G)))),c=c.return}C.length!==0&&i.push({event:a,listeners:C})}var VT=/\r\n?/g,GT=/\u0000|\uFFFD/g;function F_(i){return(typeof i=="string"?i:""+i).replace(VT,`
|
|
10
|
+
`).replace(GT,"")}function q_(i,a){return a=F_(a),F_(i)===a}function $t(i,a,c,f,x,_){switch(c){case"children":typeof f=="string"?a==="body"||a==="textarea"&&f===""||it(i,f):(typeof f=="number"||typeof f=="bigint")&&a!=="body"&&it(i,""+f);break;case"className":Ln(i,"class",f);break;case"tabIndex":Ln(i,"tabindex",f);break;case"dir":case"role":case"viewBox":case"width":case"height":Ln(i,c,f);break;case"style":Lt(i,f,_);break;case"data":if(a!=="object"){Ln(i,"data",f);break}case"src":case"href":if(f===""&&(a!=="a"||c!=="href")){i.removeAttribute(c);break}if(f==null||typeof f=="function"||typeof f=="symbol"||typeof f=="boolean"){i.removeAttribute(c);break}f=Lr(""+f),i.setAttribute(c,f);break;case"action":case"formAction":if(typeof f=="function"){i.setAttribute(c,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof _=="function"&&(c==="formAction"?(a!=="input"&&$t(i,a,"name",x.name,x,null),$t(i,a,"formEncType",x.formEncType,x,null),$t(i,a,"formMethod",x.formMethod,x,null),$t(i,a,"formTarget",x.formTarget,x,null)):($t(i,a,"encType",x.encType,x,null),$t(i,a,"method",x.method,x,null),$t(i,a,"target",x.target,x,null)));if(f==null||typeof f=="symbol"||typeof f=="boolean"){i.removeAttribute(c);break}f=Lr(""+f),i.setAttribute(c,f);break;case"onClick":f!=null&&(i.onclick=Ie);break;case"onScroll":f!=null&&xt("scroll",i);break;case"onScrollEnd":f!=null&&xt("scrollend",i);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(n(61));if(c=f.__html,c!=null){if(x.children!=null)throw Error(n(60));i.innerHTML=c}}break;case"multiple":i.multiple=f&&typeof f!="function"&&typeof f!="symbol";break;case"muted":i.muted=f&&typeof f!="function"&&typeof f!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(f==null||typeof f=="function"||typeof f=="boolean"||typeof f=="symbol"){i.removeAttribute("xlink:href");break}c=Lr(""+f),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":f!=null&&typeof f!="function"&&typeof f!="symbol"?i.setAttribute(c,""+f):i.removeAttribute(c);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":f&&typeof f!="function"&&typeof f!="symbol"?i.setAttribute(c,""):i.removeAttribute(c);break;case"capture":case"download":f===!0?i.setAttribute(c,""):f!==!1&&f!=null&&typeof f!="function"&&typeof f!="symbol"?i.setAttribute(c,f):i.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":f!=null&&typeof f!="function"&&typeof f!="symbol"&&!isNaN(f)&&1<=f?i.setAttribute(c,f):i.removeAttribute(c);break;case"rowSpan":case"start":f==null||typeof f=="function"||typeof f=="symbol"||isNaN(f)?i.removeAttribute(c):i.setAttribute(c,f);break;case"popover":xt("beforetoggle",i),xt("toggle",i),tn(i,"popover",f);break;case"xlinkActuate":kn(i,"http://www.w3.org/1999/xlink","xlink:actuate",f);break;case"xlinkArcrole":kn(i,"http://www.w3.org/1999/xlink","xlink:arcrole",f);break;case"xlinkRole":kn(i,"http://www.w3.org/1999/xlink","xlink:role",f);break;case"xlinkShow":kn(i,"http://www.w3.org/1999/xlink","xlink:show",f);break;case"xlinkTitle":kn(i,"http://www.w3.org/1999/xlink","xlink:title",f);break;case"xlinkType":kn(i,"http://www.w3.org/1999/xlink","xlink:type",f);break;case"xmlBase":kn(i,"http://www.w3.org/XML/1998/namespace","xml:base",f);break;case"xmlLang":kn(i,"http://www.w3.org/XML/1998/namespace","xml:lang",f);break;case"xmlSpace":kn(i,"http://www.w3.org/XML/1998/namespace","xml:space",f);break;case"is":tn(i,"is",f);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=er.get(c)||c,tn(i,c,f))}}function ap(i,a,c,f,x,_){switch(c){case"style":Lt(i,f,_);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(n(61));if(c=f.__html,c!=null){if(x.children!=null)throw Error(n(60));i.innerHTML=c}}break;case"children":typeof f=="string"?it(i,f):(typeof f=="number"||typeof f=="bigint")&&it(i,""+f);break;case"onScroll":f!=null&&xt("scroll",i);break;case"onScrollEnd":f!=null&&xt("scrollend",i);break;case"onClick":f!=null&&(i.onclick=Ie);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ya.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(x=c.endsWith("Capture"),a=c.slice(2,x?c.length-7:void 0),_=i[en]||null,_=_!=null?_[c]:null,typeof _=="function"&&i.removeEventListener(a,_,x),typeof f=="function")){typeof _!="function"&&_!==null&&(c in i?i[c]=null:i.hasAttribute(c)&&i.removeAttribute(c)),i.addEventListener(a,f,x);break e}c in i?i[c]=f:f===!0?i.setAttribute(c,""):tn(i,c,f)}}}function Ks(i,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",i),xt("load",i);var f=!1,x=!1,_;for(_ in c)if(c.hasOwnProperty(_)){var C=c[_];if(C!=null)switch(_){case"src":f=!0;break;case"srcSet":x=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(n(137,a));default:$t(i,a,_,C,c,null)}}x&&$t(i,a,"srcSet",c.srcSet,c,null),f&&$t(i,a,"src",c.src,c,null);return;case"input":xt("invalid",i);var O=_=C=x=null,G=null,ae=null;for(f in c)if(c.hasOwnProperty(f)){var pe=c[f];if(pe!=null)switch(f){case"name":x=pe;break;case"type":C=pe;break;case"checked":G=pe;break;case"defaultChecked":ae=pe;break;case"value":_=pe;break;case"defaultValue":O=pe;break;case"children":case"dangerouslySetInnerHTML":if(pe!=null)throw Error(n(137,a));break;default:$t(i,a,f,pe,c,null)}}Sa(i,_,O,G,ae,C,x,!1);return;case"select":xt("invalid",i),f=C=_=null;for(x in c)if(c.hasOwnProperty(x)&&(O=c[x],O!=null))switch(x){case"value":_=O;break;case"defaultValue":C=O;break;case"multiple":f=O;default:$t(i,a,x,O,c,null)}a=_,c=C,i.multiple=!!f,a!=null?qs(i,!!f,a,!1):c!=null&&qs(i,!!f,c,!0);return;case"textarea":xt("invalid",i),_=x=f=null;for(C in c)if(c.hasOwnProperty(C)&&(O=c[C],O!=null))switch(C){case"value":f=O;break;case"defaultValue":x=O;break;case"children":_=O;break;case"dangerouslySetInnerHTML":if(O!=null)throw Error(n(91));break;default:$t(i,a,C,O,c,null)}go(i,f,x,_);return;case"option":for(G in c)c.hasOwnProperty(G)&&(f=c[G],f!=null)&&(G==="selected"?i.selected=f&&typeof f!="function"&&typeof f!="symbol":$t(i,a,G,f,c,null));return;case"dialog":xt("beforetoggle",i),xt("toggle",i),xt("cancel",i),xt("close",i);break;case"iframe":case"object":xt("load",i);break;case"video":case"audio":for(f=0;f<sc.length;f++)xt(sc[f],i);break;case"image":xt("error",i),xt("load",i);break;case"details":xt("toggle",i);break;case"embed":case"source":case"link":xt("error",i),xt("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ae in c)if(c.hasOwnProperty(ae)&&(f=c[ae],f!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":throw Error(n(137,a));default:$t(i,a,ae,f,c,null)}return;default:if(Or(a)){for(pe in c)c.hasOwnProperty(pe)&&(f=c[pe],f!==void 0&&ap(i,a,pe,f,c,void 0));return}}for(O in c)c.hasOwnProperty(O)&&(f=c[O],f!=null&&$t(i,a,O,f,c,null))}function WT(i,a,c,f){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var x=null,_=null,C=null,O=null,G=null,ae=null,pe=null;for(he in c){var Se=c[he];if(c.hasOwnProperty(he)&&Se!=null)switch(he){case"checked":break;case"value":break;case"defaultValue":G=Se;default:f.hasOwnProperty(he)||$t(i,a,he,null,f,Se)}}for(var le in f){var he=f[le];if(Se=c[le],f.hasOwnProperty(le)&&(he!=null||Se!=null))switch(le){case"type":_=he;break;case"name":x=he;break;case"checked":ae=he;break;case"defaultChecked":pe=he;break;case"value":C=he;break;case"defaultValue":O=he;break;case"children":case"dangerouslySetInnerHTML":if(he!=null)throw Error(n(137,a));break;default:he!==Se&&$t(i,a,le,he,f,Se)}}yl(i,C,O,G,ae,pe,_,x);return;case"select":he=C=O=le=null;for(_ in c)if(G=c[_],c.hasOwnProperty(_)&&G!=null)switch(_){case"value":break;case"multiple":he=G;default:f.hasOwnProperty(_)||$t(i,a,_,null,f,G)}for(x in f)if(_=f[x],G=c[x],f.hasOwnProperty(x)&&(_!=null||G!=null))switch(x){case"value":le=_;break;case"defaultValue":O=_;break;case"multiple":C=_;default:_!==G&&$t(i,a,x,_,f,G)}a=O,c=C,f=he,le!=null?qs(i,!!c,le,!1):!!f!=!!c&&(a!=null?qs(i,!!c,a,!0):qs(i,!!c,c?[]:"",!1));return;case"textarea":he=le=null;for(O in c)if(x=c[O],c.hasOwnProperty(O)&&x!=null&&!f.hasOwnProperty(O))switch(O){case"value":break;case"children":break;default:$t(i,a,O,null,f,x)}for(C in f)if(x=f[C],_=c[C],f.hasOwnProperty(C)&&(x!=null||_!=null))switch(C){case"value":le=x;break;case"defaultValue":he=x;break;case"children":break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(n(91));break;default:x!==_&&$t(i,a,C,x,f,_)}Su(i,le,he);return;case"option":for(var Ke in c)le=c[Ke],c.hasOwnProperty(Ke)&&le!=null&&!f.hasOwnProperty(Ke)&&(Ke==="selected"?i.selected=!1:$t(i,a,Ke,null,f,le));for(G in f)le=f[G],he=c[G],f.hasOwnProperty(G)&&le!==he&&(le!=null||he!=null)&&(G==="selected"?i.selected=le&&typeof le!="function"&&typeof le!="symbol":$t(i,a,G,le,f,he));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 nt in c)le=c[nt],c.hasOwnProperty(nt)&&le!=null&&!f.hasOwnProperty(nt)&&$t(i,a,nt,null,f,le);for(ae in f)if(le=f[ae],he=c[ae],f.hasOwnProperty(ae)&&le!==he&&(le!=null||he!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(n(137,a));break;default:$t(i,a,ae,le,f,he)}return;default:if(Or(a)){for(var Ht in c)le=c[Ht],c.hasOwnProperty(Ht)&&le!==void 0&&!f.hasOwnProperty(Ht)&&ap(i,a,Ht,void 0,f,le);for(pe in f)le=f[pe],he=c[pe],!f.hasOwnProperty(pe)||le===he||le===void 0&&he===void 0||ap(i,a,pe,le,f,he);return}}for(var te in c)le=c[te],c.hasOwnProperty(te)&&le!=null&&!f.hasOwnProperty(te)&&$t(i,a,te,null,f,le);for(Se in f)le=f[Se],he=c[Se],!f.hasOwnProperty(Se)||le===he||le==null&&he==null||$t(i,a,Se,le,f,he)}function V_(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function KT(){if(typeof performance.getEntriesByType=="function"){for(var i=0,a=0,c=performance.getEntriesByType("resource"),f=0;f<c.length;f++){var x=c[f],_=x.transferSize,C=x.initiatorType,O=x.duration;if(_&&O&&V_(C)){for(C=0,O=x.responseEnd,f+=1;f<c.length;f++){var G=c[f],ae=G.startTime;if(ae>O)break;var pe=G.transferSize,Se=G.initiatorType;pe&&V_(Se)&&(G=G.responseEnd,C+=pe*(G<O?1:(O-ae)/(G-ae)))}if(--f,a+=8*(_+C)/(x.duration/1e3),i++,10<i)break}}if(0<i)return a/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var op=null,lp=null;function vd(i){return i.nodeType===9?i:i.ownerDocument}function G_(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function W_(i,a){if(i===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&a==="foreignObject"?0:i}function cp(i,a){return i==="textarea"||i==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var up=null;function YT(){var i=window.event;return i&&i.type==="popstate"?i===up?!1:(up=i,!0):(up=null,!1)}var K_=typeof setTimeout=="function"?setTimeout:void 0,XT=typeof clearTimeout=="function"?clearTimeout:void 0,Y_=typeof Promise=="function"?Promise:void 0,ZT=typeof queueMicrotask=="function"?queueMicrotask:typeof Y_<"u"?function(i){return Y_.resolve(null).then(i).catch(QT)}:K_;function QT(i){setTimeout(function(){throw i})}function Jr(i){return i==="head"}function X_(i,a){var c=a,f=0;do{var x=c.nextSibling;if(i.removeChild(c),x&&x.nodeType===8)if(c=x.data,c==="/$"||c==="/&"){if(f===0){i.removeChild(x),Vo(a);return}f--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")f++;else if(c==="html")ic(i.ownerDocument.documentElement);else if(c==="head"){c=i.ownerDocument.head,ic(c);for(var _=c.firstChild;_;){var C=_.nextSibling,O=_.nodeName;_[_a]||O==="SCRIPT"||O==="STYLE"||O==="LINK"&&_.rel.toLowerCase()==="stylesheet"||c.removeChild(_),_=C}}else c==="body"&&ic(i.ownerDocument.body);c=x}while(c);Vo(a)}function Z_(i,a){var c=i;i=0;do{var f=c.nextSibling;if(c.nodeType===1?a?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(a?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),f&&f.nodeType===8)if(c=f.data,c==="/$"){if(i===0)break;i--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||i++;c=f}while(c)}function dp(i){var a=i.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var c=a;switch(a=a.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":dp(c),vl(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}i.removeChild(c)}}function JT(i,a,c,f){for(;i.nodeType===1;){var x=c;if(i.nodeName.toLowerCase()!==a.toLowerCase()){if(!f&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(f){if(!i[_a])switch(a){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(_=i.getAttribute("rel"),_==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(_!==x.rel||i.getAttribute("href")!==(x.href==null||x.href===""?null:x.href)||i.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin)||i.getAttribute("title")!==(x.title==null?null:x.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(_=i.getAttribute("src"),(_!==(x.src==null?null:x.src)||i.getAttribute("type")!==(x.type==null?null:x.type)||i.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin))&&_&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(a==="input"&&i.type==="hidden"){var _=x.name==null?null:""+x.name;if(x.type==="hidden"&&i.getAttribute("name")===_)return i}else return i;if(i=ni(i.nextSibling),i===null)break}return null}function eA(i,a,c){if(a==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!c||(i=ni(i.nextSibling),i===null))return null;return i}function Q_(i,a){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!a||(i=ni(i.nextSibling),i===null))return null;return i}function hp(i){return i.data==="$?"||i.data==="$~"}function fp(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function tA(i,a){var c=i.ownerDocument;if(i.data==="$~")i._reactRetry=a;else if(i.data!=="$?"||c.readyState!=="loading")a();else{var f=function(){a(),c.removeEventListener("DOMContentLoaded",f)};c.addEventListener("DOMContentLoaded",f),i._reactRetry=f}}function ni(i){for(;i!=null;i=i.nextSibling){var a=i.nodeType;if(a===1||a===3)break;if(a===8){if(a=i.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return i}var mp=null;function J_(i){i=i.nextSibling;for(var a=0;i;){if(i.nodeType===8){var c=i.data;if(c==="/$"||c==="/&"){if(a===0)return ni(i.nextSibling);a--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||a++}i=i.nextSibling}return null}function ey(i){i=i.previousSibling;for(var a=0;i;){if(i.nodeType===8){var c=i.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(a===0)return i;a--}else c!=="/$"&&c!=="/&"||a++}i=i.previousSibling}return null}function ty(i,a,c){switch(a=vd(c),i){case"html":if(i=a.documentElement,!i)throw Error(n(452));return i;case"head":if(i=a.head,!i)throw Error(n(453));return i;case"body":if(i=a.body,!i)throw Error(n(454));return i;default:throw Error(n(451))}}function ic(i){for(var a=i.attributes;a.length;)i.removeAttributeNode(a[0]);vl(i)}var ii=new Map,sy=new Set;function _d(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var gr=Z.d;Z.d={f:sA,r:nA,D:iA,C:rA,L:aA,m:oA,X:cA,S:lA,M:uA};function sA(){var i=gr.f(),a=dd();return i||a}function nA(i){var a=Qi(i);a!==null&&a.tag===5&&a.type==="form"?v1(a):gr.r(i)}var Uo=typeof document>"u"?null:document;function ny(i,a,c){var f=Uo;if(f&&typeof a=="string"&&a){var x=Nn(a);x='link[rel="'+i+'"][href="'+x+'"]',typeof c=="string"&&(x+='[crossorigin="'+c+'"]'),sy.has(x)||(sy.add(x),i={rel:i,crossOrigin:c,href:a},f.querySelector(x)===null&&(a=f.createElement("link"),Ks(a,"link",i),bs(a),f.head.appendChild(a)))}}function iA(i){gr.D(i),ny("dns-prefetch",i,null)}function rA(i,a){gr.C(i,a),ny("preconnect",i,a)}function aA(i,a,c){gr.L(i,a,c);var f=Uo;if(f&&i&&a){var x='link[rel="preload"][as="'+Nn(a)+'"]';a==="image"&&c&&c.imageSrcSet?(x+='[imagesrcset="'+Nn(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(x+='[imagesizes="'+Nn(c.imageSizes)+'"]')):x+='[href="'+Nn(i)+'"]';var _=x;switch(a){case"style":_=Fo(i);break;case"script":_=qo(i)}ii.has(_)||(i=g({rel:"preload",href:a==="image"&&c&&c.imageSrcSet?void 0:i,as:a},c),ii.set(_,i),f.querySelector(x)!==null||a==="style"&&f.querySelector(rc(_))||a==="script"&&f.querySelector(ac(_))||(a=f.createElement("link"),Ks(a,"link",i),bs(a),f.head.appendChild(a)))}}function oA(i,a){gr.m(i,a);var c=Uo;if(c&&i){var f=a&&typeof a.as=="string"?a.as:"script",x='link[rel="modulepreload"][as="'+Nn(f)+'"][href="'+Nn(i)+'"]',_=x;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":_=qo(i)}if(!ii.has(_)&&(i=g({rel:"modulepreload",href:i},a),ii.set(_,i),c.querySelector(x)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(ac(_)))return}f=c.createElement("link"),Ks(f,"link",i),bs(f),c.head.appendChild(f)}}}function lA(i,a,c){gr.S(i,a,c);var f=Uo;if(f&&i){var x=Dr(f).hoistableStyles,_=Fo(i);a=a||"default";var C=x.get(_);if(!C){var O={loading:0,preload:null};if(C=f.querySelector(rc(_)))O.loading=5;else{i=g({rel:"stylesheet",href:i,"data-precedence":a},c),(c=ii.get(_))&&pp(i,c);var G=C=f.createElement("link");bs(G),Ks(G,"link",i),G._p=new Promise(function(ae,pe){G.onload=ae,G.onerror=pe}),G.addEventListener("load",function(){O.loading|=1}),G.addEventListener("error",function(){O.loading|=2}),O.loading|=4,yd(C,a,f)}C={type:"stylesheet",instance:C,count:1,state:O},x.set(_,C)}}}function cA(i,a){gr.X(i,a);var c=Uo;if(c&&i){var f=Dr(c).hoistableScripts,x=qo(i),_=f.get(x);_||(_=c.querySelector(ac(x)),_||(i=g({src:i,async:!0},a),(a=ii.get(x))&&gp(i,a),_=c.createElement("script"),bs(_),Ks(_,"link",i),c.head.appendChild(_)),_={type:"script",instance:_,count:1,state:null},f.set(x,_))}}function uA(i,a){gr.M(i,a);var c=Uo;if(c&&i){var f=Dr(c).hoistableScripts,x=qo(i),_=f.get(x);_||(_=c.querySelector(ac(x)),_||(i=g({src:i,async:!0,type:"module"},a),(a=ii.get(x))&&gp(i,a),_=c.createElement("script"),bs(_),Ks(_,"link",i),c.head.appendChild(_)),_={type:"script",instance:_,count:1,state:null},f.set(x,_))}}function iy(i,a,c,f){var x=(x=je.current)?_d(x):null;if(!x)throw Error(n(446));switch(i){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(a=Fo(c.href),c=Dr(x).hoistableStyles,f=c.get(a),f||(f={type:"style",instance:null,count:0,state:null},c.set(a,f)),f):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){i=Fo(c.href);var _=Dr(x).hoistableStyles,C=_.get(i);if(C||(x=x.ownerDocument||x,C={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},_.set(i,C),(_=x.querySelector(rc(i)))&&!_._p&&(C.instance=_,C.state.loading=5),ii.has(i)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},ii.set(i,c),_||dA(x,i,c,C.state))),a&&f===null)throw Error(n(528,""));return C}if(a&&f!==null)throw Error(n(529,""));return null;case"script":return a=c.async,c=c.src,typeof c=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=qo(c),c=Dr(x).hoistableScripts,f=c.get(a),f||(f={type:"script",instance:null,count:0,state:null},c.set(a,f)),f):{type:"void",instance:null,count:0,state:null};default:throw Error(n(444,i))}}function Fo(i){return'href="'+Nn(i)+'"'}function rc(i){return'link[rel="stylesheet"]['+i+"]"}function ry(i){return g({},i,{"data-precedence":i.precedence,precedence:null})}function dA(i,a,c,f){i.querySelector('link[rel="preload"][as="style"]['+a+"]")?f.loading=1:(a=i.createElement("link"),f.preload=a,a.addEventListener("load",function(){return f.loading|=1}),a.addEventListener("error",function(){return f.loading|=2}),Ks(a,"link",c),bs(a),i.head.appendChild(a))}function qo(i){return'[src="'+Nn(i)+'"]'}function ac(i){return"script[async]"+i}function ay(i,a,c){if(a.count++,a.instance===null)switch(a.type){case"style":var f=i.querySelector('style[data-href~="'+Nn(c.href)+'"]');if(f)return a.instance=f,bs(f),f;var x=g({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return f=(i.ownerDocument||i).createElement("style"),bs(f),Ks(f,"style",x),yd(f,c.precedence,i),a.instance=f;case"stylesheet":x=Fo(c.href);var _=i.querySelector(rc(x));if(_)return a.state.loading|=4,a.instance=_,bs(_),_;f=ry(c),(x=ii.get(x))&&pp(f,x),_=(i.ownerDocument||i).createElement("link"),bs(_);var C=_;return C._p=new Promise(function(O,G){C.onload=O,C.onerror=G}),Ks(_,"link",f),a.state.loading|=4,yd(_,c.precedence,i),a.instance=_;case"script":return _=qo(c.src),(x=i.querySelector(ac(_)))?(a.instance=x,bs(x),x):(f=c,(x=ii.get(_))&&(f=g({},c),gp(f,x)),i=i.ownerDocument||i,x=i.createElement("script"),bs(x),Ks(x,"link",f),i.head.appendChild(x),a.instance=x);case"void":return null;default:throw Error(n(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(f=a.instance,a.state.loading|=4,yd(f,c.precedence,i));return a.instance}function yd(i,a,c){for(var f=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),x=f.length?f[f.length-1]:null,_=x,C=0;C<f.length;C++){var O=f[C];if(O.dataset.precedence===a)_=O;else if(_!==x)break}_?_.parentNode.insertBefore(i,_.nextSibling):(a=c.nodeType===9?c.head:c,a.insertBefore(i,a.firstChild))}function pp(i,a){i.crossOrigin==null&&(i.crossOrigin=a.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=a.referrerPolicy),i.title==null&&(i.title=a.title)}function gp(i,a){i.crossOrigin==null&&(i.crossOrigin=a.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=a.referrerPolicy),i.integrity==null&&(i.integrity=a.integrity)}var Sd=null;function oy(i,a,c){if(Sd===null){var f=new Map,x=Sd=new Map;x.set(c,f)}else x=Sd,f=x.get(c),f||(f=new Map,x.set(c,f));if(f.has(i))return f;for(f.set(i,null),c=c.getElementsByTagName(i),x=0;x<c.length;x++){var _=c[x];if(!(_[_a]||_[hs]||i==="link"&&_.getAttribute("rel")==="stylesheet")&&_.namespaceURI!=="http://www.w3.org/2000/svg"){var C=_.getAttribute(a)||"";C=i+C;var O=f.get(C);O?O.push(_):f.set(C,[_])}}return f}function ly(i,a,c){i=i.ownerDocument||i,i.head.insertBefore(c,a==="title"?i.querySelector("head > title"):null)}function hA(i,a,c){if(c===1||a.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;return a.rel==="stylesheet"?(i=a.disabled,typeof a.precedence=="string"&&i==null):!0;case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function cy(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function fA(i,a,c,f){if(c.type==="stylesheet"&&(typeof f.media!="string"||matchMedia(f.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var x=Fo(f.href),_=a.querySelector(rc(x));if(_){a=_._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(i.count++,i=wd.bind(i),a.then(i,i)),c.state.loading|=4,c.instance=_,bs(_);return}_=a.ownerDocument||a,f=ry(f),(x=ii.get(x))&&pp(f,x),_=_.createElement("link"),bs(_);var C=_;C._p=new Promise(function(O,G){C.onload=O,C.onerror=G}),Ks(_,"link",f),c.instance=_}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(c,a),(a=c.state.preload)&&(c.state.loading&3)===0&&(i.count++,c=wd.bind(i),a.addEventListener("load",c),a.addEventListener("error",c))}}var bp=0;function mA(i,a){return i.stylesheets&&i.count===0&&Nd(i,i.stylesheets),0<i.count||0<i.imgCount?function(c){var f=setTimeout(function(){if(i.stylesheets&&Nd(i,i.stylesheets),i.unsuspend){var _=i.unsuspend;i.unsuspend=null,_()}},6e4+a);0<i.imgBytes&&bp===0&&(bp=62500*KT());var x=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&Nd(i,i.stylesheets),i.unsuspend)){var _=i.unsuspend;i.unsuspend=null,_()}},(i.imgBytes>bp?50:800)+a);return i.unsuspend=c,function(){i.unsuspend=null,clearTimeout(f),clearTimeout(x)}}:null}function wd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Nd(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var kd=null;function Nd(i,a){i.stylesheets=null,i.unsuspend!==null&&(i.count++,kd=new Map,a.forEach(pA,i),kd=null,wd.call(i))}function pA(i,a){if(!(a.state.loading&4)){var c=kd.get(i);if(c)var f=c.get(null);else{c=new Map,kd.set(i,c);for(var x=i.querySelectorAll("link[data-precedence],style[data-precedence]"),_=0;_<x.length;_++){var C=x[_];(C.nodeName==="LINK"||C.getAttribute("media")!=="not all")&&(c.set(C.dataset.precedence,C),f=C)}f&&c.set(null,f)}x=a.instance,C=x.getAttribute("data-precedence"),_=c.get(C)||f,_===f&&c.set(null,x),c.set(C,x),this.count++,f=wd.bind(this),x.addEventListener("load",f),x.addEventListener("error",f),_?_.parentNode.insertBefore(x,_.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(x,i.firstChild)),a.state.loading|=4}}var oc={$$typeof:j,Provider:null,Consumer:null,_currentValue:U,_currentValue2:U,_threadCount:0};function gA(i,a,c,f,x,_,C,O,G){this.tag=1,this.containerInfo=i,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=rt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=rt(0),this.hiddenUpdates=rt(null),this.identifierPrefix=f,this.onUncaughtError=x,this.onCaughtError=_,this.onRecoverableError=C,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=G,this.incompleteTransitions=new Map}function uy(i,a,c,f,x,_,C,O,G,ae,pe,Se){return i=new gA(i,a,c,C,G,ae,pe,Se,O),a=1,_===!0&&(a|=24),_=In(3,null,null,a),i.current=_,_.stateNode=i,a=Xf(),a.refCount++,i.pooledCache=a,a.refCount++,_.memoizedState={element:f,isDehydrated:c,cache:a},em(_),i}function dy(i){return i?(i=yo,i):yo}function hy(i,a,c,f,x,_){x=dy(x),f.context===null?f.context=x:f.pendingContext=x,f=Ur(a),f.payload={element:c},_=_===void 0?null:_,_!==null&&(f.callback=_),c=Fr(i,f,a),c!==null&&(Rn(c,i,a),Pl(c,i,a))}function fy(i,a){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var c=i.retryLane;i.retryLane=c!==0&&c<a?c:a}}function xp(i,a){fy(i,a),(i=i.alternate)&&fy(i,a)}function my(i){if(i.tag===13||i.tag===31){var a=Ca(i,67108864);a!==null&&Rn(a,i,67108864),xp(i,67108864)}}function py(i){if(i.tag===13||i.tag===31){var a=Fn();a=Jt(a);var c=Ca(i,a);c!==null&&Rn(c,i,a),xp(i,a)}}var Cd=!0;function bA(i,a,c,f){var x=B.T;B.T=null;var _=Z.p;try{Z.p=2,vp(i,a,c,f)}finally{Z.p=_,B.T=x}}function xA(i,a,c,f){var x=B.T;B.T=null;var _=Z.p;try{Z.p=8,vp(i,a,c,f)}finally{Z.p=_,B.T=x}}function vp(i,a,c,f){if(Cd){var x=_p(f);if(x===null)rp(i,a,f,Ed,c),by(i,f);else if(_A(x,i,a,c,f))f.stopPropagation();else if(by(i,f),a&4&&-1<vA.indexOf(i)){for(;x!==null;){var _=Qi(x);if(_!==null)switch(_.tag){case 3:if(_=_.stateNode,_.current.memoizedState.isDehydrated){var C=Le(_.pendingLanes);if(C!==0){var O=_;for(O.pendingLanes|=2,O.entangledLanes|=2;C;){var G=1<<31-M(C);O.entanglements[1]|=G,C&=~G}zi(_),(At&6)===0&&(cd=wt()+500,tc(0))}}break;case 31:case 13:O=Ca(_,2),O!==null&&Rn(O,_,2),dd(),xp(_,2)}if(_=_p(f),_===null&&rp(i,a,f,Ed,c),_===x)break;x=_}x!==null&&f.stopPropagation()}else rp(i,a,f,null,c)}}function _p(i){return i=ct(i),yp(i)}var Ed=null;function yp(i){if(Ed=null,i=dn(i),i!==null){var a=l(i);if(a===null)i=null;else{var c=a.tag;if(c===13){if(i=u(a),i!==null)return i;i=null}else if(c===31){if(i=h(a),i!==null)return i;i=null}else if(c===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;i=null}else a!==i&&(i=null)}}return Ed=i,null}function gy(i){switch(i){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Rt()){case Ft:return 2;case Qs:return 8;case Js:case Ri:return 32;case S:return 268435456;default:return 32}default:return 32}}var Sp=!1,ea=null,ta=null,sa=null,lc=new Map,cc=new Map,na=[],vA="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 by(i,a){switch(i){case"focusin":case"focusout":ea=null;break;case"dragenter":case"dragleave":ta=null;break;case"mouseover":case"mouseout":sa=null;break;case"pointerover":case"pointerout":lc.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":cc.delete(a.pointerId)}}function uc(i,a,c,f,x,_){return i===null||i.nativeEvent!==_?(i={blockedOn:a,domEventName:c,eventSystemFlags:f,nativeEvent:_,targetContainers:[x]},a!==null&&(a=Qi(a),a!==null&&my(a)),i):(i.eventSystemFlags|=f,a=i.targetContainers,x!==null&&a.indexOf(x)===-1&&a.push(x),i)}function _A(i,a,c,f,x){switch(a){case"focusin":return ea=uc(ea,i,a,c,f,x),!0;case"dragenter":return ta=uc(ta,i,a,c,f,x),!0;case"mouseover":return sa=uc(sa,i,a,c,f,x),!0;case"pointerover":var _=x.pointerId;return lc.set(_,uc(lc.get(_)||null,i,a,c,f,x)),!0;case"gotpointercapture":return _=x.pointerId,cc.set(_,uc(cc.get(_)||null,i,a,c,f,x)),!0}return!1}function xy(i){var a=dn(i.target);if(a!==null){var c=l(a);if(c!==null){if(a=c.tag,a===13){if(a=u(c),a!==null){i.blockedOn=a,uo(i.priority,function(){py(c)});return}}else if(a===31){if(a=h(c),a!==null){i.blockedOn=a,uo(i.priority,function(){py(c)});return}}else if(a===3&&c.stateNode.current.memoizedState.isDehydrated){i.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}i.blockedOn=null}function jd(i){if(i.blockedOn!==null)return!1;for(var a=i.targetContainers;0<a.length;){var c=_p(i.nativeEvent);if(c===null){c=i.nativeEvent;var f=new c.constructor(c.type,c);Xe=f,c.target.dispatchEvent(f),Xe=null}else return a=Qi(c),a!==null&&my(a),i.blockedOn=c,!1;a.shift()}return!0}function vy(i,a,c){jd(i)&&c.delete(a)}function yA(){Sp=!1,ea!==null&&jd(ea)&&(ea=null),ta!==null&&jd(ta)&&(ta=null),sa!==null&&jd(sa)&&(sa=null),lc.forEach(vy),cc.forEach(vy)}function Td(i,a){i.blockedOn===a&&(i.blockedOn=null,Sp||(Sp=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,yA)))}var Ad=null;function _y(i){Ad!==i&&(Ad=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Ad===i&&(Ad=null);for(var a=0;a<i.length;a+=3){var c=i[a],f=i[a+1],x=i[a+2];if(typeof f!="function"){if(yp(f||c)===null)continue;break}var _=Qi(c);_!==null&&(i.splice(a,3),a-=3,_m(_,{pending:!0,data:x,method:c.method,action:f},f,x))}}))}function Vo(i){function a(G){return Td(G,i)}ea!==null&&Td(ea,i),ta!==null&&Td(ta,i),sa!==null&&Td(sa,i),lc.forEach(a),cc.forEach(a);for(var c=0;c<na.length;c++){var f=na[c];f.blockedOn===i&&(f.blockedOn=null)}for(;0<na.length&&(c=na[0],c.blockedOn===null);)xy(c),c.blockedOn===null&&na.shift();if(c=(i.ownerDocument||i).$$reactFormReplay,c!=null)for(f=0;f<c.length;f+=3){var x=c[f],_=c[f+1],C=x[en]||null;if(typeof _=="function")C||_y(c);else if(C){var O=null;if(_&&_.hasAttribute("formAction")){if(x=_,C=_[en]||null)O=C.formAction;else if(yp(x)!==null)continue}else O=C.action;typeof O=="function"?c[f+1]=O:(c.splice(f,3),f-=3),_y(c)}}}function yy(){function i(_){_.canIntercept&&_.info==="react-transition"&&_.intercept({handler:function(){return new Promise(function(C){return x=C})},focusReset:"manual",scroll:"manual"})}function a(){x!==null&&(x(),x=null),f||setTimeout(c,20)}function c(){if(!f&&!navigation.transition){var _=navigation.currentEntry;_&&_.url!=null&&navigation.navigate(_.url,{state:_.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var f=!1,x=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(c,100),function(){f=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),x!==null&&(x(),x=null)}}}function wp(i){this._internalRoot=i}Rd.prototype.render=wp.prototype.render=function(i){var a=this._internalRoot;if(a===null)throw Error(n(409));var c=a.current,f=Fn();hy(c,f,i,a,null,null)},Rd.prototype.unmount=wp.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var a=i.containerInfo;hy(i.current,2,null,i,null,null),dd(),a[Rr]=null}};function Rd(i){this._internalRoot=i}Rd.prototype.unstable_scheduleHydration=function(i){if(i){var a=co();i={blockedOn:null,target:i,priority:a};for(var c=0;c<na.length&&a!==0&&a<na[c].priority;c++);na.splice(c,0,i),c===0&&xy(i)}};var Sy=t.version;if(Sy!=="19.2.6")throw Error(n(527,Sy,"19.2.6"));Z.findDOMNode=function(i){var a=i._reactInternals;if(a===void 0)throw typeof i.render=="function"?Error(n(188)):(i=Object.keys(i).join(","),Error(n(268,i)));return i=d(a),i=i!==null?p(i):null,i=i===null?null:i.stateNode,i};var SA={bundleType:0,version:"19.2.6",rendererPackageName:"react-dom",currentDispatcherRef:B,reconcilerVersion:"19.2.6"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Md=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Md.isDisabled&&Md.supportsFiber)try{be=Md.inject(SA),ce=Md}catch{}}return hc.createRoot=function(i,a){if(!o(i))throw Error(n(299));var c=!1,f="",x=T1,_=A1,C=R1;return a!=null&&(a.unstable_strictMode===!0&&(c=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(x=a.onUncaughtError),a.onCaughtError!==void 0&&(_=a.onCaughtError),a.onRecoverableError!==void 0&&(C=a.onRecoverableError)),a=uy(i,1,!1,null,null,c,f,null,x,_,C,yy),i[Rr]=a.current,ip(i),new wp(a)},hc.hydrateRoot=function(i,a,c){if(!o(i))throw Error(n(299));var f=!1,x="",_=T1,C=A1,O=R1,G=null;return c!=null&&(c.unstable_strictMode===!0&&(f=!0),c.identifierPrefix!==void 0&&(x=c.identifierPrefix),c.onUncaughtError!==void 0&&(_=c.onUncaughtError),c.onCaughtError!==void 0&&(C=c.onCaughtError),c.onRecoverableError!==void 0&&(O=c.onRecoverableError),c.formState!==void 0&&(G=c.formState)),a=uy(i,1,!0,a,c??null,f,x,G,_,C,O,yy),a.context=dy(null),c=a.current,f=Fn(),f=Jt(f),x=Ur(f),x.callback=null,Fr(c,x,f),c=f,a.current.lanes=c,Mt(a,c),zi(a),i[Rr]=a.current,ip(i),new Rd(a)},hc.version="19.2.6",hc}var My;function MA(){if(My)return Cp.exports;My=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(),Cp.exports=RA(),Cp.exports}var hN=MA();const fN=(...e)=>e.filter((t,s,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===s).join(" ").trim();const DA=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const OA=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,s,n)=>n?n.toUpperCase():s.toLowerCase());const Dy=e=>{const t=OA(e);return t.charAt(0).toUpperCase()+t.slice(1)};var Ap={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 LA=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},zA=y.createContext({}),BA=()=>y.useContext(zA),IA=y.forwardRef(({color:e,size:t,strokeWidth:s,absoluteStrokeWidth:n,className:o="",children:l,iconNode:u,...h},m)=>{const{size:d=24,strokeWidth:p=2,absoluteStrokeWidth:g=!1,color:b="currentColor",className:v=""}=BA()??{},w=n??g?Number(s??p)*24/Number(t??d):s??p;return y.createElement("svg",{ref:m,...Ap,width:t??d??Ap.width,height:t??d??Ap.height,stroke:e??b,strokeWidth:w,className:fN("lucide",v,o),...!l&&!LA(h)&&{"aria-hidden":"true"},...h},[...u.map(([k,N])=>y.createElement(k,N)),...Array.isArray(l)?l:[l]])});const _e=(e,t)=>{const s=y.forwardRef(({className:n,...o},l)=>y.createElement(IA,{ref:l,iconNode:t,className:fN(`lucide-${DA(Dy(e))}`,`lucide-${e}`,n),...o}));return s.displayName=Dy(e),s};const PA=[["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"}]],Za=_e("activity",PA);const $A=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],ef=_e("arrow-down",$A);const HA=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],eu=_e("arrow-left",HA);const UA=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],tf=_e("arrow-up",UA);const FA=[["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"}]],qA=_e("blocks",FA);const VA=[["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"}]],GA=_e("book-open",VA);const WA=[["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"}]],KA=_e("bot",WA);const YA=[["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"}]],mN=_e("box",YA);const XA=[["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"}]],ZA=_e("braces",XA);const QA=[["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"}]],pN=_e("brain",QA);const JA=[["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"}]],e4=_e("calendar",JA);const t4=[["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"}]],s4=_e("camera",t4);const n4=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],on=_e("check",n4);const i4=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],vn=_e("chevron-down",i4);const r4=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],a4=_e("chevron-left",r4);const o4=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Yn=_e("chevron-right",o4);const l4=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],sf=_e("chevron-up",l4);const c4=[["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"}]],Mb=_e("circle-alert",c4);const u4=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],nf=_e("circle-check-big",u4);const d4=[["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"}]],h4=_e("circle-dashed",d4);const f4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],m4=_e("circle-dot",f4);const p4=[["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"}]],g4=_e("circle-play",p4);const b4=[["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"}]],Db=_e("circle-x",b4);const x4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],qc=_e("circle",x4);const v4=[["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"}]],gN=_e("code-xml",v4);const _4=[["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"}]],wh=_e("copy",_4);const y4=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],S4=_e("corner-down-left",y4);const w4=[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],k4=_e("corner-down-right",w4);const N4=[["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"}]],C4=_e("cpu",N4);const E4=[["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"}]],fi=_e("database",E4);const j4=[["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"}]],bN=_e("download",j4);const T4=[["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"}]],A4=_e("earth",T4);const R4=[["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"}]],xN=_e("ellipsis",R4);const M4=[["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"}]],kr=_e("external-link",M4);const D4=[["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"}]],vN=_e("eye-off",D4);const O4=[["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"}]],Ob=_e("eye",O4);const L4=[["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"}]],_N=_e("file-code-corner",L4);const z4=[["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"}]],B4=_e("file-diff",z4);const I4=[["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"}]],yN=_e("file-exclamation-point",I4);const P4=[["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"}]],$4=_e("file-spreadsheet",P4);const H4=[["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"}]],Lb=_e("file-text",H4);const U4=[["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"}]],SN=_e("file",U4);const F4=[["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"}]],q4=_e("flask-conical",F4);const V4=[["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"}]],zb=_e("folder-git-2",V4);const G4=[["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"}]],rf=_e("folder-open",G4);const W4=[["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"}]],wN=_e("folder-plus",W4);const K4=[["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"}]],ro=_e("folder",K4);const Y4=[["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"}]],X4=_e("funnel",Y4);const Z4=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],kN=_e("gauge",Z4);const Q4=[["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"}]],xn=_e("git-branch",Q4);const J4=[["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"}]],eR=_e("git-commit-horizontal",J4);const tR=[["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"}]],Oy=_e("git-fork",tR);const sR=[["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"}]],kh=_e("git-merge",sR);const nR=[["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"}]],iR=_e("git-pull-request-closed",nR);const rR=[["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"}]],aR=_e("git-pull-request-create",rR);const oR=[["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"}]],NN=_e("git-pull-request",oR);const lR=[["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"}]],cR=_e("grip-vertical",lR);const uR=[["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"}]],dR=_e("heart",uR);const hR=[["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"}]],fR=_e("history",hR);const mR=[["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"}]],pR=_e("image",mR);const gR=[["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"}]],Nh=_e("inbox",gR);const bR=[["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"}]],CN=_e("key-round",bR);const xR=[["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"}]],vR=_e("list-collapse",xR);const _R=[["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"}]],yR=_e("list-tree",_R);const SR=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Et=_e("loader-circle",SR);const wR=[["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"}]],Ly=_e("loader",wR);const kR=[["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"}]],NR=_e("lock-keyhole",kR);const CR=[["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"}]],EN=_e("lock-open",CR);const ER=[["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"}]],jR=_e("lock",ER);const TR=[["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"}]],jN=_e("maximize-2",TR);const AR=[["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"}]],RR=_e("memory-stick",AR);const MR=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],DR=_e("message-circle-warning",MR);const OR=[["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"}]],TN=_e("message-square-plus",OR);const LR=[["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"}]],zR=_e("message-square",LR);const BR=[["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"}]],AN=_e("minimize-2",BR);const IR=[["path",{d:"M5 12h14",key:"1ays0h"}]],RN=_e("minus",IR);const PR=[["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"}]],$R=_e("moon",PR);const HR=[["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"}]],UR=_e("network",HR);const FR=[["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"}]],qR=_e("palette",FR);const VR=[["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"}]],GR=_e("panel-left-close",VR);const WR=[["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"}]],KR=_e("panel-left-open",WR);const YR=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],XR=_e("panel-left",YR);const ZR=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]],QR=_e("panel-top",ZR);const JR=[["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"}]],eM=_e("paperclip",JR);const tM=[["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"}]],sM=_e("pen-line",tM);const nM=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],rl=_e("pencil",nM);const iM=[["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"}]],Nr=_e("play",iM);const rM=[["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"}]],MN=_e("plug",rM);const aM=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Es=_e("plus",aM);const oM=[["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"}]],lM=_e("radio",oM);const cM=[["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"}]],Cr=_e("refresh-cw",cM);const uM=[["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"}]],tu=_e("rotate-ccw",uM);const dM=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],DN=_e("save",dM);const hM=[["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"}]],ON=_e("scroll-text",hM);const fM=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],mM=_e("search",fM);const pM=[["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"}]],gM=_e("send-horizontal",pM);const bM=[["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"}]],LN=_e("server",bM);const xM=[["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"}]],vM=_e("settings-2",xM);const _M=[["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"}]],zN=_e("shield-alert",_M);const yM=[["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"}]],SM=_e("shield-check",yM);const wM=[["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"}]],BN=_e("shield-question-mark",wM);const kM=[["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"}]],IN=_e("skip-forward",kM);const NM=[["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"}]],Ci=_e("sparkles",NM);const CM=[["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"}]],EM=_e("square-terminal",CM);const jM=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],to=_e("square",jM);const TM=[["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"}]],AM=_e("sun",TM);const RM=[["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"}]],PN=_e("table-2",RM);const MM=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],cl=_e("terminal",MM);const DM=[["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"}]],Er=_e("trash-2",DM);const OM=[["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"}]],ul=_e("triangle-alert",OM);const LM=[["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"}]],Bb=_e("upload",LM);const zM=[["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"}]],BM=_e("user",zM);const IM=[["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"}]],PM=_e("wand-sparkles",IM);const $M=[["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"}]],HM=_e("webhook",$M);const UM=[["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"}]],zy=_e("workflow",UM);const FM=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],qM=_e("wrench",FM);const VM=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ts=_e("x",VM);const GM=[["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"}]],WM=_e("zap",GM);class $N extends Error{conflict;constructor(t,s){super(t),this.name="PortConflictResponseError",this.conflict=s}}async function ze(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 $N(n?.error||"Port already in use",n.conflict):new Error(n?.error||s.statusText);return n}async function ki(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 ze(e,{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:s})}async function ci(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 ze(e,{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:s})}const KM="modulepreload",YM=function(e){return"/"+e},By={},su=function(t,s,n){let o=Promise.resolve();if(s&&s.length>0){let m=function(d){return Promise.all(d.map(p=>Promise.resolve(p).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),h=u?.nonce||u?.getAttribute("nonce");o=m(s.map(d=>{if(d=YM(d),d in By)return;By[d]=!0;const p=d.endsWith(".css"),g=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${g}`))return;const b=document.createElement("link");if(b.rel=p?"stylesheet":KM,p||(b.as="script"),b.crossOrigin="",b.href=d,h&&b.setAttribute("nonce",h),document.head.appendChild(b),p)return new Promise((v,w)=>{b.addEventListener("load",v),b.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)})},ln=()=>typeof window<"u"&&(!!window.__TAURI_INTERNALS__||!!window.__TAURI__);async function af(){if(!ln())return null;try{return await su(()=>import("./window-DlR023_X.js"),__vite__mapDeps([0,1,2]))}catch{return null}}async function XM(){await(await af())?.getCurrentWindow().minimize()}async function ZM(){await(await af())?.getCurrentWindow().toggleMaximize()}async function QM(){await(await af())?.getCurrentWindow().hide()}async function JM(){await(await af())?.getCurrentWindow().startDragging()}async function of(e){if(ln())try{const{invoke:t}=await su(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 Rp=null,Mp=null;async function e6(){return Rp||(Rp=(await su(()=>import("./core-DhEqZVGG.js"),[])).invoke),Rp}async function t6(){return Mp||(Mp=(await su(()=>import("./event-BK_86lmQ.js"),__vite__mapDeps([2,1]))).listen),Mp}async function De(e,t){return(await e6())(e,t)}async function Ib(e,t){return(await t6())(e,n=>t(n.payload))}function s6(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 n6(e){const t={};for(const s of e.runtime.services)t[s.name]=s6(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 i6(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 m=s.parents[h],d=t.indexOf(m);if(d!==-1){const g=d===n?"straight":"merge";o.push({fromLane:n,toLane:d,parentHash:m,kind:g});continue}let p;h===0?(p=n,t[n]=m,o.push({fromLane:n,toLane:n,parentHash:m,kind:"straight"})):(p=t.indexOf(null),p===-1?(p=t.length,t.push(m)):t[p]=m,o.push({fromLane:n,toLane:p,parentHash:m,kind:"branch"}))}const l=t.map((h,m)=>h!==null&&m!==n?m:-1).filter(h=>h!==-1),u=t.reduce((h,m,d)=>m!==null?Math.max(h,d+1):h,n+1);return{lane:n,laneCount:u,edges:o,throughLanes:l}})}function r6(e){const t=i6(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 a6(e){return e.map(t=>({name:t.name,current:t.isCurrent,remote:t.isRemote}))}async function o6(e){return De("service_processes",{name:e})}async function l6(){const e=await De("get_dashboard"),t=n6(e),s=e.runtime.services.filter(d=>d.state.toLowerCase()==="running"),n={};await Promise.all(s.map(async d=>{const p=await o6(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,m]=await Promise.all([UN().catch(()=>null),C6().catch(()=>[])]);return{...t,git:{cwd:u.path,selectedRepository:u,status:h,branches:m}}}async function HN(e){await De("start_service",{name:e})}async function c6(e){await De("stop_service",{name:e})}async function u6(e){await De("restart_service",{name:e})}async function d6(e){await De("start_bundle",{name:e})}async function h6(e){await De("stop_bundle",{name:e})}async function f6(e){await De("remove_service",{name:e})}async function m6(e){return De("register_service",{service:e})}async function p6(e){return De("register_bundle",{bundle:e})}async function g6(e,t){return{logs:await De("get_logs",{service:e,limit:t??200}),queryable:!1}}async function UN(e){return De("git_status",{repo:null})}async function b6(e,t){return De("git_diff",{file:e??null,repo:t??null})}async function x6(e=200){const t=await De("git_graph",{limit:e,repo:null});return r6(t)}async function v6(e,t){return De("git_commit_diff",{hash:e,file:t??null,repo:null})}async function _6(e){return await De("git_commit_files",{hash:e,repo:null})}async function y6(e,t){await De("git_stage",{paths:e,repo:t??null})}async function S6(e,t){await De("git_unstage",{paths:e,repo:t??null})}async function w6(e,t){return De("git_commit",{message:e,repo:t??null})}async function k6(e){return{output:await De("git_push",{remote:null,repo:e??null}),branch:"",setUpstream:!1}}async function N6(e,t){return await De("git_create_branch",{name:e,repo:null}),""}async function C6(e){const t=await De("git_branches",{repo:null});return a6(t)}async function E6(e){return{output:await De("git_pull_default",{repo:null}),branch:""}}async function j6(e){return De("git_list_files",{repo:null})}async function T6(e){return De("git_file_sizes",{repo:null})}async function A6(e){await De("select_git_repository",{name:e})}async function R6(e,t){const s=await De("git_read_file",{path:e,repo:null});return{content:s,truncated:!1,binary:!1,size:s.length}}async function M6(e,t,s){await De("git_write_file",{path:e,content:t,repo:null})}async function D6(e){await De("remove_git_repository",{name:e})}async function FN(e){return De("register_git_repository",{repo:e})}async function O6(e){return await De("set_git_board_repositories",{names:e}),e}async function L6(){const e=await De("get_dashboard"),t=e.config.gitRepositories,s=e.config.gitBoardRepositories;return{repos:(await Promise.allSettled(t.map(async l=>{const u=await De("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 z6(){return De("get_github_token_status")}async function Iy(e,t){await De("set_github_token",{host:e,token:t})}async function B6(e){await De("remove_github_token",{host:e})}async function fn(e){return De("get_github_repo",{repo:null})}async function I6(e,t,s){return De("list_pull_requests",{owner:e,repo:t,stateFilter:s??"open"})}async function P6(e,t,s){return De("list_issues",{owner:e,repo:t,stateFilter:s??"open"})}async function Py(e,t,s){return De("get_pull_request",{owner:e,repo:t,number:s})}async function $6(e){return De("create_pull_request",e)}async function H6(e){return De("github_oauth_start",{clientId:e})}async function U6(e,t){return De("github_oauth_poll",{clientId:e,deviceCode:t})}async function F6(e,t,s){return De("get_pr_diff",{owner:e,repo:t,number:s})}async function q6(e,t,s){return De("list_pr_files",{owner:e,repo:t,number:s})}async function V6(e,t,s){return De("list_pr_reviews",{owner:e,repo:t,number:s})}async function G6(e,t,s){return De("list_pr_comments",{owner:e,repo:t,number:s})}async function W6(e,t,s,n={}){return De("merge_pull_request",{owner:e,repo:t,number:s,method:n.method??null,commitTitle:n.commitTitle??null,commitMessage:n.commitMessage??null})}async function K6(e,t,s){return De("get_github_issue",{owner:e,repo:t,number:s})}async function Y6(e,t,s){return De("list_issue_comments",{owner:e,repo:t,number:s})}async function X6(e,t,s,n){return De("add_issue_comment",{owner:e,repo:t,number:s,body:n})}async function Z6(e,t){return De("list_github_branches",{owner:e,repo:t})}async function $y(e,t){return De("get_github_repo_info",{owner:e,repo:t})}async function Hy(e,t,s){return De("list_commit_check_runs",{owner:e,repo:t,sha:s})}async function Q6(e,t,s,n){return De("list_workflow_runs",{owner:e,repo:t,branch:s??null,page:n??null})}async function J6(e,t,s){return De("list_workflow_run_jobs",{owner:e,repo:t,runId:s})}async function eD(){return De("list_databases")}async function Dp(e,t,s){return De("query_database",{name:e,sql:t,limit:s??null})}async function tD(e,t){return De("execute_database",{name:e,sql:t})}async function sD(e){return De("list_tables",{name:e})}async function qN(e){await De("register_database",{db:e})}async function nD(e){await De("remove_database",{name:e})}async function iD(e,t){await De("set_database_write_access",{name:e,unlocked:t})}async function rD(){return(await De("get_config")).logSources}async function aD(e){await De("register_log_source",{source:e})}async function oD(e){return De("list_snapshots",{repo:null})}async function lD(e,t){return De("create_snapshot",{label:e??null,repo:null})}async function cD(e,t){await De("restore_snapshot",{sha:e,repo:null})}async function uD(e,t){await De("delete_snapshot",{sha:e,repo:null})}async function dD(e,t){return De("get_snapshot_files",{sha:e,repo:null})}async function hD(e,t,s){return De("get_snapshot_diff",{sha:e,path:t??null,repo:null})}async function fD(){return De("list_workflows")}async function mD(e){return De("save_workflow",{workflow:e})}async function pD(e){return De("delete_workflow",{id:e})}async function gD(){return De("get_agent_info")}async function bD(){return De("get_agent_chat_status")}async function xD(e){return De("set_chat_provider",{provider:e})}async function vD(e,t,s){await De("start_agent_chat",{message:e,resumeSessionId:t??null,provider:s??null})}async function _D(e){return De("scan_repo_url",{url:e})}async function yD(e,t){await De("run_install_command",{cwd:e,command:t})}async function SD(){return(await De("list_terminal_sessions")).map(t=>({...t,serviceName:t.serviceName??void 0,label:t.serviceName??void 0}))}async function wD(e){const t=await De("create_terminal_session",{serviceName:e?.serviceName??null,cwd:e?.cwd??null});return{...t,serviceName:t.serviceName??void 0,label:t.serviceName??void 0}}async function kD(e,t){await De("write_terminal_input",{id:e,data:t})}async function ND(e){await De("start_terminal_stream",{id:e})}async function CD(e,t,s){await De("resize_terminal",{id:e,cols:t,rows:s})}async function ED(e){await De("close_terminal_session",{id:e})}async function jD(e,t){return Ib(`terminal-output-${e}`,s=>t(s))}const TD={async getAgentInfo(){return(await ze("/api/agent")).agent},async getMcpAuthStatuses(e){return(await ze(`/api/agent/mcp-status?agent=${encodeURIComponent(e)}`)).statuses},async getAgentUsage(){return(await ze("/api/agent/usage")).usage},async getClaudeAgentSettings(){return(await ze("/api/agent/claude-settings")).settings},async updateClaudeAgentSettings(e){return(await ze("/api/agent/claude-settings",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})).settings}},AD={getAgentInfo:()=>gD(),getMcpAuthStatuses:async()=>[],getAgentUsage:async()=>({}),getClaudeAgentSettings:async()=>({coAuthorWithClaude:!0}),updateClaudeAgentSettings:async e=>({coAuthorWithClaude:e.coAuthorWithClaude??!0})},RD=ln()?AD:TD,{getAgentInfo:VN,getMcpAuthStatuses:MD,getAgentUsage:DD,getClaudeAgentSettings:OD,updateClaudeAgentSettings:LD}=RD,zD={async getAgentChatStatus(){const e=await ze("/api/agent/chat/status");return{configured:e.configured,approvals:e.approvals,provider:e.provider,providers:e.providers??[]}},async setChatProvider(e){return(await ze("/api/agent/chat/provider",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({provider:e})})).provider},async approveAgentTool(e,t,s){await ze("/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(),m=new TextDecoder;let d="";for(;;){const{done:p,value:g}=await h.read();if(p)break;d+=m.decode(g,{stream:!0});let b=d.indexOf(`
|
|
11
|
+
|
|
12
|
+
`);for(;b!==-1;){const v=d.slice(0,b);d=d.slice(b+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{}}b=d.indexOf(`
|
|
14
|
+
|
|
15
|
+
`)}}}};let Op="claude";const BD={async getAgentChatStatus(){const t=await bD();return Op=t.provider?.id??"claude",{...t,providers:t.providers??[]}},async setChatProvider(e){const s=await xD(e)??null;return Op=s?.id??e,s??{id:e}},approveAgentTool:async()=>{},streamAgentChat(e,t,s,n,o,l){let u,h=!1;return new Promise(m=>{(async()=>{if(u=await Ib("agent-chat-event",d=>{if(h)return;const p=d;s(p),(p.type==="done"||p.type==="error")&&(h=!0,u?.(),m())}),n?.aborted){h=!0,u?.(),m();return}n?.addEventListener("abort",()=>{h||(h=!0,u?.(),m())});try{await vD(e,t,l??Op)}catch(d){h=!0,u?.(),s({type:"error",message:String(d)}),s({type:"done",stopReason:"error"}),m()}})().catch(d=>{h||(h=!0,u?.(),s({type:"error",message:String(d)}),s({type:"done",stopReason:"error"}),m())})})}},ID=ln()?BD:zD,{getAgentChatStatus:PD,setChatProvider:$D,approveAgentTool:HD,streamAgentChat:UD}=ID,FD={async listDatabases(){return(await ze("/api/databases")).connections},async detectDatabases(){return(await ze("/api/databases/detect")).detected},async addDatabase(e){await ci("/api/databases",e)},testDatabase(e){return ci("/api/databases/test",e)},async deleteDatabase(e){await ze(`/api/databases/${encodeURIComponent(e)}`,{method:"DELETE"})},async getDatabaseTables(e){return(await ze(`/api/databases/${encodeURIComponent(e)}/tables`)).tables},runDatabaseQuery(e,t,s=100){return ci(`/api/databases/${encodeURIComponent(e)}/query`,{sql:t,limit:s})},async setDatabaseWriteAccess(e,t){await ci(`/api/databases/${encodeURIComponent(e)}/write-access`,{unlocked:String(t)})},executeDatabaseWrite(e,t,s){return ci(`/api/databases/${encodeURIComponent(e)}/execute`,{sql:t,mode:s})},getDatabaseRows(e,t,s=100,n=0){return ze(`/api/databases/${encodeURIComponent(e)}/rows?table=${encodeURIComponent(t)}&limit=${s}&offset=${n}`)}};function Uy(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 qD={async listDatabases(){return await eD()},detectDatabases:async()=>[],async addDatabase(e){await qN(e)},async testDatabase(){try{return await Dp("__test__","SELECT 1",1),{ok:!0}}catch(e){return{ok:!1,error:String(e)}}},async deleteDatabase(e){await nD(e)},async getDatabaseTables(e){return(await sD(e)).map(s=>({name:s,qualifiedName:s}))},async runDatabaseQuery(e,t,s=100){const n=await Dp(e,t,s),{columns:o,rows:l,rowCount:u}=Uy(n);return{engine:"sqlite",columns:o,rows:l,rowCount:u,truncated:!1}},async setDatabaseWriteAccess(e,t){await iD(e,t)},async executeDatabaseWrite(e,t,s){return s==="preview"?{engine:"sqlite",previewUnavailable:!0}:{engine:"sqlite",previewUnavailable:!1,affectedRows:await tD(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 Dp(e,o,s),{columns:u,rows:h,rowCount:m}=Uy(l);return{engine:"sqlite",table:{name:t,qualifiedName:t},columns:u,rows:h,rowCount:m,limit:s,offset:n}}},VD=ln()?qD:FD,{listDatabases:GN,detectDatabases:GD,addDatabase:WD,testDatabase:KD,deleteDatabase:YD,getDatabaseTables:WN,runDatabaseQuery:XD,setDatabaseWriteAccess:ZD,executeDatabaseWrite:Fy,getDatabaseRows:QD}=VD,KN={async getErrorIncidents(e=100){return(await ze(`/api/errors?limit=${e}`)).incidents},getErrorPrompt(e){return ze(`/api/errors/${e}/prompt`)},getErrorBundle(e,t=!1){return ze(`/api/errors/${e}/bundle${t?"?save=1":""}`)}},JD={...KN,getErrorIncidents:async()=>[]},e8=ln()?JD:KN,{getErrorIncidents:YN,getErrorPrompt:t8}=e8,s8={async getGitGraph(e=200){return(await ze(`/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 ze(`/api/git/commit/files?hash=${encodeURIComponent(e)}`)).files},async getGitFiles(){return(await ze("/api/git/files")).files},async getFileSizeRanking(){return(await ze("/api/git/file-sizes")).files},async getGitFile(e){const t=await ze(`/api/git/file?path=${encodeURIComponent(e)}`);return{content:t.content,truncated:t.truncated,binary:t.binary,size:t.size}},async updateGitFile(e,t){await ze("/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 ze("/api/git/overview"),t=e.repos??[],s=e.board??t.map(n=>n.name);return{repos:t,board:s}},async setGitBoard(e){return(await ze("/api/git/board",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({names:e})})).board},async gitStage(e,t){await ze("/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 ze("/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 ci("/api/git/commit",{message:e,...t?{repo:t}:{}})).output},async gitPush(e){const t=await ci("/api/git/push",e?{repo:e}:{});return{output:t.output,branch:t.branch,setUpstream:t.setUpstream}},async gitCheckoutDefaultAndPull(){const e=await ci("/api/git/default-branch/pull",{});return{output:e.output,branch:e.branch}},async gitCreateBranch(e){return(await ci("/api/git/branches",{name:e})).output},async deleteGitRepository(e){await ze(`/api/git/repositories/${encodeURIComponent(e)}`,{method:"DELETE"})},async selectGitRepository(e){await ki("/api/git/select",{name:e})},async registerGitRepository(e,t){await ki("/api/git/repositories",{name:e,path:t})}},n8={getGitGraph:(e=200)=>x6(e),getGitCommitDiff:(e,t)=>v6(e,t),getGitCommitFiles:e=>_6(e),getGitFiles:()=>j6(),getFileSizeRanking:()=>T6(),getGitFile:e=>R6(e),updateGitFile:(e,t)=>M6(e,t),getGitDiff:(e,t)=>b6(e,t),getGitOverview:()=>L6(),setGitBoard:e=>O6(e),gitStage:(e,t)=>y6(e,t),gitUnstage:(e,t)=>S6(e,t),gitCommit:(e,t)=>w6(e,t),gitPush:e=>k6(e),gitCheckoutDefaultAndPull:()=>E6(),gitCreateBranch:e=>N6(e),deleteGitRepository:e=>D6(e),selectGitRepository:e=>A6(e),registerGitRepository:async(e,t)=>{await FN({name:e,path:t})}},i8=ln()?n8:s8,{getGitGraph:r8,getGitCommitDiff:a8,getGitCommitFiles:o8,getGitFiles:l8,getFileSizeRanking:c8,getGitFile:u8,updateGitFile:d8,getGitDiff:XN,getGitOverview:Lp,setGitBoard:qy,gitStage:Pb,gitUnstage:ZN,gitCommit:QN,gitPush:lf,gitCheckoutDefaultAndPull:h8,gitCreateBranch:f8,deleteGitRepository:m8,selectGitRepository:p8,registerGitRepository:g8}=i8,b8={getGitHubTokenInfo(){return ze("/api/github/token")},startGitHubDeviceFlow(){return ze("/api/github/oauth/start",{method:"POST"})},async pollGitHubDeviceFlow(e){const t=await ze("/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 ze("/api/github/token",{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:s})},async removeGitHubToken(e){await ze(`/api/github/token/${encodeURIComponent(e)}`,{method:"DELETE"})},async listGitHubBranches(){const e=await ze("/api/github/branches");return{repository:e.repository,defaultBranch:e.defaultBranch,currentBranch:e.currentBranch,branches:e.branches}},async listGitHubPRs(e="open",t=1){return(await ze(`/api/github/prs?state=${e}&page=${t}`)).prs},async getGitHubPR(e){return(await ze(`/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 ze(`/api/github/prs/${e}/review`)).cockpit},async getGitHubPRTemplate(){return(await ze("/api/github/pr-template")).template},async createGitHubPR(e){return(await ze("/api/github/prs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})).pr},async mergeGitHubPR(e,t={}){const s=await ze(`/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 ze(`/api/github/issues?state=${e}&page=${t}`)).issues},async getGitHubIssue(e){return(await ze(`/api/github/issues/${e}`)).issue},async listGitHubIssueComments(e){return(await ze(`/api/github/issues/${e}/comments`)).comments},async addGitHubIssueComment(e,t){return(await ze(`/api/github/issues/${e}/comments`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({body:t})})).comment},async getCommitCIStatus(e){return(await ze(`/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 ze(`/api/github/runs?${s}`)).runs},async listGitHubWorkflowRunJobs(e){return(await ze(`/api/github/runs/${e}/jobs`)).jobs}},Vy="Iv23liCxW0Mv0KJP1Svr";function Gy(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 x8={async getGitHubTokenInfo(){const e=await z6();return{configured:e.configured,deviceFlowAvailable:!0,status:e.configured?"connected":"not_configured"}},async startGitHubDeviceFlow(){return await H6(Vy)},async pollGitHubDeviceFlow(e){const t=await U6(Vy,e);return t.access_token?(await Iy("github.com",t.access_token),{done:!0}):{done:!1,slowDown:t.error==="slow_down"}},async setGitHubToken(e,t){await Iy(e,t)},async removeGitHubToken(e){await B6(e)},async listGitHubBranches(){const[e,t]=await fn(),[s,n]=await Promise.all([Z6(e,t),$y(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 fn();return(await I6(s,n,e)).slice((t-1)*50,t*50)},async getGitHubPR(e){const[t,s]=await fn();return Py(t,s,e)},async getGitHubPRDiff(e){const[t,s]=await fn();return F6(t,s,e)},async getGitHubPRReviewCockpit(e){const[t,s]=await fn(),n=await Py(t,s,e),[o,l,u,h]=await Promise.all([q6(t,s,e),V6(t,s,e),G6(t,s,e),Hy(t,s,n.head.sha)]),m=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:Gy(m),totalCount:h.total_count??m.length,runs:m}}},async getGitHubPRTemplate(){const[e,t]=await fn(),s=await $y(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 fn();return $6({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 fn();return await W6(s,n,e,t)},async listGitHubIssues(e="open",t=1){const[s,n]=await fn();return(await P6(s,n,e)).slice((t-1)*50,t*50)},async getGitHubIssue(e){const[t,s]=await fn();return K6(t,s,e)},async listGitHubIssueComments(e){const[t,s]=await fn();return Y6(t,s,e)},async addGitHubIssueComment(e,t){const[s,n]=await fn();return X6(s,n,e,t)},async getCommitCIStatus(e){const[t,s]=await fn(),n=await Hy(t,s,e),o=n.check_runs??[];return{sha:e,state:Gy(o),totalCount:n.total_count??o.length,runs:o}},async listGitHubWorkflowRuns(e,t=1){const[s,n]=await fn();return(await Q6(s,n,e,t)).workflow_runs??[]},async listGitHubWorkflowRunJobs(e){const[t,s]=await fn();return(await J6(t,s,e)).jobs??[]}},v8=ln()?x8:b8,{getGitHubTokenInfo:_8,startGitHubDeviceFlow:y8,pollGitHubDeviceFlow:S8,setGitHubToken:w8,removeGitHubToken:k8,listGitHubBranches:N8,listGitHubPRs:zp,getGitHubPR:C8,getGitHubPRDiff:E8,getGitHubPRReviewCockpit:j8,getGitHubPRTemplate:T8,createGitHubPR:A8,mergeGitHubPR:R8,listGitHubIssues:Bp,getGitHubIssue:M8,listGitHubIssueComments:D8,addGitHubIssueComment:O8,getCommitCIStatus:L8,listGitHubWorkflowRuns:ah,listGitHubWorkflowRunJobs:Wy}=v8,z8={async listLogSources(){return(await ze("/api/log-sources")).sources},async addLogSource(e){return(await ci("/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 ze(`/api/log-sources/${encodeURIComponent(e)}/logs?${s.toString()}`)).logs}};async function Ky(){return await rD()??[]}const B8={listLogSources:Ky,async addLogSource(e){return await aD(e),Ky()},getLogSourceLogs:async()=>[]},I8=ln()?B8:z8,{listLogSources:P8,addLogSource:$8,getLogSourceLogs:JN}=I8,Ip={"content-type":"application/json"};function H8(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 U8={async scanRepo(e){const t=await ze("/api/onboard/scan",{method:"POST",headers:Ip,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 ze("/api/onboard/register",{method:"POST",headers:Ip,body:JSON.stringify({...e,start:t,database:n})})},async streamInstall(e,t){const s=await fetch("/api/onboard/install/stream",{method:"POST",headers:Ip,body:JSON.stringify(e)});if(!s.ok||!s.body){const u=await s.json().catch(()=>{});t.onError(u?.error||s.statusText);return}const n=s.body.getReader(),o=new TextDecoder;let l="";for(;;){const{done:u,value:h}=await n.read();if(u)break;l+=o.decode(h,{stream:!0});const m=l.split(`
|
|
17
|
+
|
|
18
|
+
`);l=m.pop()??"";for(const d of m)H8(d,t)}}},F8={scanRepo:e=>_D(e),async registerOnboarded(e,t,s){await FN({name:e.name,path:e.cwd}),await m6({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 qN({name:s.name,engine:s.engine,url:s.url}),t&&await HN(e.name)},async streamInstall(e,t){let s;s=await Ib("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 yD(e.clonePath,e.command)}catch(n){s?.(),t.onError(String(n))}}},q8=ln()?F8:U8,{scanRepo:V8,registerOnboarded:G8,streamInstall:W8}=q8,eC={getDashboard(){return ze("/api/dashboard")},async getServiceGraph(){return(await ze("/api/services/graph")).graph},async startService(e){await ze(`/api/services/${encodeURIComponent(e)}/start`,{method:"POST"})},async stopService(e){await ze(`/api/services/${encodeURIComponent(e)}/stop`,{method:"POST"})},async restartService(e){await ze(`/api/services/${encodeURIComponent(e)}/restart`,{method:"POST"})},async startBundle(e){await ze(`/api/bundles/${encodeURIComponent(e)}/start`,{method:"POST"})},async stopBundle(e){await ze(`/api/bundles/${encodeURIComponent(e)}/stop`,{method:"POST"})},async deleteService(e){await ze(`/api/services/${encodeURIComponent(e)}`,{method:"DELETE"})},async registerBundle(e){await ki("/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 ze(`/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"),ze(`/api/fs/directories?${s.toString()}`)},browseServiceConfig(e,t){const s=t?`?path=${encodeURIComponent(t)}`:"";return ze(`/api/services/${encodeURIComponent(e)}/config-browse${s}`)},async getServiceConfigFiles(e){const t=await ze(`/api/services/${encodeURIComponent(e)}/config-files`);return{cwd:t.cwd,files:t.files}},getServiceConfigFile(e,t){return ze(`/api/services/${encodeURIComponent(e)}/config-file?path=${encodeURIComponent(t)}`)},putServiceConfigFileEnv(e,t,s){return ze(`/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 ze(`/api/services/${encodeURIComponent(e)}/config-file?path=${encodeURIComponent(t)}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({content:s})})},async getServiceMetrics(e){return(await ze(`/api/services/${encodeURIComponent(e)}/metrics`)).metrics},testServiceCommand(e){return ci("/api/services/test",e)},runServiceTests(e,t){return ci(`/api/services/${encodeURIComponent(e)}/test`,t?{pattern:t}:{})}},K8={...eC,getDashboard:()=>l6(),startService:e=>HN(e),stopService:e=>c6(e),restartService:e=>u6(e),startBundle:e=>d6(e),stopBundle:e=>h6(e),deleteService:e=>f6(e),registerBundle:e=>p6(e).then(()=>{}),getServiceLogs:(e,t={})=>g6(e,t.lines)},yr=ln()?K8:eC,{getDashboard:Y8,getServiceGraph:X8,startService:tC,stopService:Z8,restartService:Q8,startBundle:eZ,stopBundle:Yy,deleteService:J8,getServiceLogs:sC,getDirectories:nC,browseServiceConfig:eO,getServiceConfigFiles:tO,getServiceConfigFile:Xy,putServiceConfigFileEnv:sO,putServiceConfigFileText:nO,getServiceMetrics:iO,testServiceCommand:rO,runServiceTests:aO}=yr;async function oO(e,t,s){t.includes(s)||await yr.registerBundle({name:e,services:[...t,s]})}async function Zy(e,t){let s,n;try{s=await yr.getDashboard(),n=await yr.getServiceGraph()}catch{await yr.startBundle(e);return}const o=s.config.bundles.find(g=>g.name===e);if(!o){await yr.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,m=[...o.services];for(;m.length>0;){const g=m.pop();if(!(h.has(g)||!l.has(g))){h.add(g);for(const b of l.get(g)??[])m.push(b)}}const d=n.order.filter(g=>h.has(g)),p=d.length>0?d:o.services;for(const g of p){for(const b of l.get(g)??[]){const v=u.get(b);v&&await lO(v)}await yr.startService(g),await t?.(g)}}async function lO(e,t=15e3){const s=Date.now()+t;for(;Date.now()<s;){try{if((await yr.getDashboard()).ports.some(o=>o.port===e&&!o.available))return}catch{return}await new Promise(n=>setTimeout(n,400))}}async function cO(e,t,s){t.includes(s)&&await yr.registerBundle({name:e,services:t.filter(n=>n!==s)})}async function Qy(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 uO={async listSnapshots(){return(await ze("/api/snapshots")).snapshots},async createSnapshot(e){return(await ze("/api/snapshots",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({label:e})})).snapshot},async renameSnapshot(e,t){return(await ze(`/api/snapshots/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({label:t})})).snapshot},async deleteSnapshot(e){await ze(`/api/snapshots/${encodeURIComponent(e)}`,{method:"DELETE"})},async getSnapshotFiles(e){return(await ze(`/api/snapshots/${encodeURIComponent(e)}/files`)).files},getSnapshotDiff(e,t){const s=t?`?path=${encodeURIComponent(t)}`:"";return Qy(`/api/snapshots/${encodeURIComponent(e)}/diff${s}`)},restoreSnapshot(e){return ze(`/api/snapshots/${encodeURIComponent(e)}/restore`,{method:"POST"})},async listChangeSets(){return(await ze("/api/agent/change-sets")).sessions},getChangeSet(e){return ze(`/api/agent/change-sets/${encodeURIComponent(e)}`)},getChangeSetDiff(e,t){const s=t?`?path=${encodeURIComponent(t)}`:"";return Qy(`/api/agent/change-sets/${encodeURIComponent(e)}/diff${s}`)},restoreChangeSet(e){return ze(`/api/agent/change-sets/${encodeURIComponent(e)}/restore`,{method:"POST"})}},dO={listSnapshots:()=>oD(),createSnapshot:e=>lD(e),renameSnapshot:async()=>{throw new Error("Snapshot rename is not supported in desktop mode")},deleteSnapshot:e=>uD(e),getSnapshotFiles:e=>dD(e),getSnapshotDiff:(e,t)=>hD(e,t),async restoreSnapshot(e){return await cD(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")}},hO=ln()?dO:uO,{listSnapshots:fO,createSnapshot:mO,renameSnapshot:pO,deleteSnapshot:gO,getSnapshotFiles:bO,getSnapshotDiff:xO,restoreSnapshot:vO,listChangeSets:_O,getChangeSet:yO,getChangeSetDiff:SO,restoreChangeSet:wO}=hO,kO={async listTerminalSessions(){return(await ze("/api/terminal/sessions")).sessions},async createTerminalSession(e){return(await ze("/api/terminal/sessions",{method:"POST",...e?.serviceName?{headers:{"content-type":"application/json"},body:JSON.stringify({serviceName:e.serviceName})}:{}})).session},async closeTerminalSession(e){await ze(`/api/terminal/sessions/${encodeURIComponent(e)}`,{method:"DELETE"})}},NO={listTerminalSessions:()=>SD(),createTerminalSession:e=>wD(e),closeTerminalSession:e=>ED(e)};function $b(){return ln()?NO:kO}function CO(){return $b().listTerminalSessions()}function oh(e){return $b().createTerminalSession(e)}function EO(e){return $b().closeTerminalSession(e)}const jO={async listWorkflows(){return(await ze("/api/workflows")).workflows},async saveWorkflow(e){return(await ze("/api/workflows",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})).workflows},async deleteWorkflow(e){return(await ze(`/api/workflows/${encodeURIComponent(e)}`,{method:"DELETE"})).workflows},async getGitStatus(){return(await ze("/api/git/status")).status}},TO={listWorkflows:()=>fD(),saveWorkflow:e=>mD(e),deleteWorkflow:e=>pD(e),async getGitStatus(){const e=await UN();return{branch:e.branch,upstream:e.upstream??void 0,ahead:e.ahead,behind:e.behind,files:e.files}}},AO=ln()?TO:jO,{listWorkflows:RO,saveWorkflow:MO,deleteWorkflow:DO,getGitStatus:Pp}=AO;function iC(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=iC(e[t]))&&(n&&(n+=" "),n+=s)}else for(s in e)e[s]&&(n&&(n+=" "),n+=s);return n}function Vc(){for(var e,t,s=0,n="",o=arguments.length;s<o;s++)(e=arguments[s])&&(t=iC(e))&&(n&&(n+=" "),n+=t);return n}const Jy=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,eS=Vc,rC=(e,t)=>s=>{var n;if(t?.variants==null)return eS(e,s?.class,s?.className);const{variants:o,defaultVariants:l}=t,u=Object.keys(o).map(d=>{const p=s?.[d],g=l?.[d];if(p===null)return null;const b=Jy(p)||Jy(g);return o[d][b]}),h=s&&Object.entries(s).reduce((d,p)=>{let[g,b]=p;return b===void 0||(d[g]=b),d},{}),m=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((d,p)=>{let{class:g,className:b,...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,b]:d},[]);return eS(e,u,m,s?.class,s?.className)},OO=(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},LO=(e,t)=>({classGroupId:e,validator:t}),aC=(e=new Map,t=null,s)=>({nextPart:e,validators:t,classGroupId:s}),Ch="-",tS=[],zO="arbitrary..",BO=e=>{const t=PO(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return IO(u);const h=u.split(Ch),m=h[0]===""&&h.length>1?1:0;return oC(h,m,t)},getConflictingClassGroupIds:(u,h)=>{if(h){const m=n[u],d=s[u];return m?d?OO(d,m):m:d||tS}return s[u]||tS}}},oC=(e,t,s)=>{if(e.length-t===0)return s.classGroupId;const o=e[t],l=s.nextPart.get(o);if(l){const d=oC(e,t+1,l);if(d)return d}const u=s.validators;if(u===null)return;const h=t===0?e.join(Ch):e.slice(t).join(Ch),m=u.length;for(let d=0;d<m;d++){const p=u[d];if(p.validator(h))return p.classGroupId}},IO=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?zO+n:void 0})(),PO=e=>{const{theme:t,classGroups:s}=e;return $O(s,t)},$O=(e,t)=>{const s=aC();for(const n in e){const o=e[n];Hb(o,s,n,t)}return s},Hb=(e,t,s,n)=>{const o=e.length;for(let l=0;l<o;l++){const u=e[l];HO(u,t,s,n)}},HO=(e,t,s,n)=>{if(typeof e=="string"){UO(e,t,s);return}if(typeof e=="function"){FO(e,t,s,n);return}qO(e,t,s,n)},UO=(e,t,s)=>{const n=e===""?t:lC(t,e);n.classGroupId=s},FO=(e,t,s,n)=>{if(VO(e)){Hb(e(n),t,s,n);return}t.validators===null&&(t.validators=[]),t.validators.push(LO(s,e))},qO=(e,t,s,n)=>{const o=Object.entries(e),l=o.length;for(let u=0;u<l;u++){const[h,m]=o[u];Hb(m,lC(t,h),s,n)}},lC=(e,t)=>{let s=e;const n=t.split(Ch),o=n.length;for(let l=0;l<o;l++){const u=n[l];let h=s.nextPart.get(u);h||(h=aC(),s.nextPart.set(u,h)),s=h}return s},VO=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,GO=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)}}},c0="!",sS=":",WO=[],nS=(e,t,s,n,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:s,maybePostfixModifierPosition:n,isExternal:o}),KO=e=>{const{prefix:t,experimentalParseClassName:s}=e;let n=o=>{const l=[];let u=0,h=0,m=0,d;const p=o.length;for(let k=0;k<p;k++){const N=o[k];if(u===0&&h===0){if(N===sS){l.push(o.slice(m,k)),m=k+1;continue}if(N==="/"){d=k;continue}}N==="["?u++:N==="]"?u--:N==="("?h++:N===")"&&h--}const g=l.length===0?o:o.slice(m);let b=g,v=!1;g.endsWith(c0)?(b=g.slice(0,-1),v=!0):g.startsWith(c0)&&(b=g.slice(1),v=!0);const w=d&&d>m?d-m:void 0;return nS(l,v,b,w)};if(t){const o=t+sS,l=n;n=u=>u.startsWith(o)?l(u.slice(o.length)):nS(WO,!1,u,void 0,!0)}if(s){const o=n;n=l=>s({className:l,parseClassName:o})}return n},YO=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((s,n)=>{t.set(s,1e6+n)}),s=>{const n=[];let o=[];for(let l=0;l<s.length;l++){const u=s[l],h=u[0]==="[",m=t.has(u);h||m?(o.length>0&&(o.sort(),n.push(...o),o=[]),n.push(u)):o.push(u)}return o.length>0&&(o.sort(),n.push(...o)),n}},XO=e=>({cache:GO(e.cacheSize),parseClassName:KO(e),sortModifiers:YO(e),postfixLookupClassGroupIds:ZO(e),...BO(e)}),ZO=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},QO=/\s+/,JO=(e,t)=>{const{parseClassName:s,getClassGroupId:n,getConflictingClassGroupIds:o,sortModifiers:l,postfixLookupClassGroupIds:u}=t,h=[],m=e.trim().split(QO);let d="";for(let p=m.length-1;p>=0;p-=1){const g=m[p],{isExternal:b,modifiers:v,hasImportantModifier:w,baseClassName:k,maybePostfixModifierPosition:N}=s(g);if(b){d=g+(d.length>0?" "+d:d);continue}let E=!!N,A;if(E){const L=k.substring(0,N);A=n(L);const R=A&&u[A]?n(k):void 0;R&&R!==A&&(A=R,E=!1)}else A=n(k);if(!A){if(!E){d=g+(d.length>0?" "+d:d);continue}if(A=n(k),!A){d=g+(d.length>0?" "+d:d);continue}E=!1}const j=v.length===0?"":v.length===1?v[0]:l(v).join(":"),T=w?j+c0:j,P=T+A;if(h.indexOf(P)>-1)continue;h.push(P);const z=o(A,E);for(let L=0;L<z.length;++L){const R=z[L];h.push(T+R)}d=g+(d.length>0?" "+d:d)}return d},eL=(...e)=>{let t=0,s,n,o="";for(;t<e.length;)(s=e[t++])&&(n=cC(s))&&(o&&(o+=" "),o+=n);return o},cC=e=>{if(typeof e=="string")return e;let t,s="";for(let n=0;n<e.length;n++)e[n]&&(t=cC(e[n]))&&(s&&(s+=" "),s+=t);return s},tL=(e,...t)=>{let s,n,o,l;const u=m=>{const d=t.reduce((p,g)=>g(p),e());return s=XO(d),n=s.cache.get,o=s.cache.set,l=h,h(m)},h=m=>{const d=n(m);if(d)return d;const p=JO(m,s);return o(m,p),p};return l=u,(...m)=>l(eL(...m))},sL=[],As=e=>{const t=s=>s[e]||sL;return t.isThemeGetter=!0,t},uC=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,dC=/^\((?:(\w[\w-]*):)?(.+)\)$/i,nL=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,iL=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,rL=/\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$/,aL=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,oL=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,lL=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ra=e=>nL.test(e),ft=e=>!!e&&!Number.isNaN(Number(e)),Bi=e=>!!e&&Number.isInteger(Number(e)),$p=e=>e.endsWith("%")&&ft(e.slice(0,-1)),br=e=>iL.test(e),hC=()=>!0,cL=e=>rL.test(e)&&!aL.test(e),Ub=()=>!1,uL=e=>oL.test(e),dL=e=>lL.test(e),hL=e=>!Ve(e)&&!We(e),fL=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)),mL=e=>ba(e,pC,Ub),Ve=e=>uC.test(e),Pa=e=>ba(e,gC,cL),iS=e=>ba(e,SL,ft),pL=e=>ba(e,xC,hC),gL=e=>ba(e,bC,Ub),rS=e=>ba(e,fC,Ub),bL=e=>ba(e,mC,dL),Dd=e=>ba(e,vC,uL),We=e=>dC.test(e),fc=e=>ao(e,gC),xL=e=>ao(e,bC),aS=e=>ao(e,fC),vL=e=>ao(e,pC),_L=e=>ao(e,mC),Od=e=>ao(e,vC,!0),yL=e=>ao(e,xC,!0),ba=(e,t,s)=>{const n=uC.exec(e);return n?n[1]?t(n[1]):s(n[2]):!1},ao=(e,t,s=!1)=>{const n=dC.exec(e);return n?n[1]?t(n[1]):s:!1},fC=e=>e==="position"||e==="percentage",mC=e=>e==="image"||e==="url",pC=e=>e==="length"||e==="size"||e==="bg-size",gC=e=>e==="length",SL=e=>e==="number",bC=e=>e==="family-name",xC=e=>e==="number"||e==="weight",vC=e=>e==="shadow",wL=()=>{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"),m=As("spacing"),d=As("radius"),p=As("shadow"),g=As("inset-shadow"),b=As("text-shadow"),v=As("drop-shadow"),w=As("blur"),k=As("perspective"),N=As("aspect"),E=As("ease"),A=As("animate"),j=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],P=()=>[...T(),We,Ve],z=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto","contain","none"],R=()=>[We,Ve,m],D=()=>[ra,"full","auto",...R()],I=()=>[Bi,"none","subgrid",We,Ve],V=()=>["auto",{span:["full",Bi,We,Ve]},Bi,We,Ve],X=()=>[Bi,"auto",We,Ve],$=()=>["auto","min","max","fr",We,Ve],W=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],q=()=>["start","end","center","stretch","center-safe","end-safe"],B=()=>["auto",...R()],Z=()=>[ra,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],U=()=>[ra,"screen","full","dvw","lvw","svw","min","max","fit",...R()],K=()=>[ra,"screen","full","lh","dvh","lvh","svh","min","max","fit",...R()],Y=()=>[e,We,Ve],F=()=>[...T(),aS,rS,{position:[We,Ve]}],ie=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Ee=()=>["auto","cover","contain",vL,mL,{size:[We,Ve]}],ye=()=>[$p,fc,Pa],oe=()=>["","none","full",d,We,Ve],je=()=>["",ft,fc,Pa],Ne=()=>["solid","dashed","dotted","double"],Ge=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Me=()=>[ft,$p,aS,rS],Qe=()=>["","none",w,We,Ve],ke=()=>["none",ft,We,Ve],He=()=>["none",ft,We,Ve],$e=()=>[ft,We,Ve],St=()=>[ra,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[br],breakpoint:[br],color:[hC],container:[br],"drop-shadow":[br],ease:["in","out","in-out"],font:[hL],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[br],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[br],shadow:[br],spacing:["px",ft],text:[br],"text-shadow":[br],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ra,Ve,We,N]}],container:["container"],"container-type":[{"@container":["","normal","size",We,Ve]}],"container-named":[fL],columns:[{columns:[ft,Ve,We,h]}],"break-after":[{"break-after":j()}],"break-before":[{"break-before":j()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:P()}],overflow:[{overflow:z()}],"overflow-x":[{"overflow-x":z()}],"overflow-y":[{"overflow-y":z()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:D()}],"inset-x":[{"inset-x":D()}],"inset-y":[{"inset-y":D()}],start:[{"inset-s":D(),start:D()}],end:[{"inset-e":D(),end:D()}],"inset-bs":[{"inset-bs":D()}],"inset-be":[{"inset-be":D()}],top:[{top:D()}],right:[{right:D()}],bottom:[{bottom:D()}],left:[{left:D()}],visibility:["visible","invisible","collapse"],z:[{z:[Bi,"auto",We,Ve]}],basis:[{basis:[ra,"full","auto",h,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ft,ra,"auto","initial","none",Ve]}],grow:[{grow:["",ft,We,Ve]}],shrink:[{shrink:["",ft,We,Ve]}],order:[{order:[Bi,"first","last","none",We,Ve]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:V()}],"col-start":[{"col-start":X()}],"col-end":[{"col-end":X()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:V()}],"row-start":[{"row-start":X()}],"row-end":[{"row-end":X()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":$()}],"auto-rows":[{"auto-rows":$()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[...W(),"normal"]}],"justify-items":[{"justify-items":[...q(),"normal"]}],"justify-self":[{"justify-self":["auto",...q()]}],"align-content":[{content:["normal",...W()]}],"align-items":[{items:[...q(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...q(),{baseline:["","last"]}]}],"place-content":[{"place-content":W()}],"place-items":[{"place-items":[...q(),"baseline"]}],"place-self":[{"place-self":["auto",...q()]}],p:[{p:R()}],px:[{px:R()}],py:[{py:R()}],ps:[{ps:R()}],pe:[{pe:R()}],pbs:[{pbs:R()}],pbe:[{pbe:R()}],pt:[{pt:R()}],pr:[{pr:R()}],pb:[{pb:R()}],pl:[{pl:R()}],m:[{m:B()}],mx:[{mx:B()}],my:[{my:B()}],ms:[{ms:B()}],me:[{me:B()}],mbs:[{mbs:B()}],mbe:[{mbe:B()}],mt:[{mt:B()}],mr:[{mr:B()}],mb:[{mb:B()}],ml:[{ml:B()}],"space-x":[{"space-x":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:Z()}],"inline-size":[{inline:["auto",...U()]}],"min-inline-size":[{"min-inline":["auto",...U()]}],"max-inline-size":[{"max-inline":["none",...U()]}],"block-size":[{block:["auto",...K()]}],"min-block-size":[{"min-block":["auto",...K()]}],"max-block-size":[{"max-block":["none",...K()]}],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,fc,Pa]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,yL,pL]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",$p,Ve]}],"font-family":[{font:[xL,gL,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,iS]}],leading:[{leading:[l,...R()]}],"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:Y()}],"text-color":[{text:Y()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Ne(),"wavy"]}],"text-decoration-thickness":[{decoration:[ft,"from-font","auto",We,Pa]}],"text-decoration-color":[{decoration:Y()}],"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:R()}],"tab-size":[{tab:[Bi,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:F()}],"bg-repeat":[{bg:ie()}],"bg-size":[{bg:Ee()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Bi,We,Ve],radial:["",We,Ve],conic:[Bi,We,Ve]},_L,bL]}],"bg-color":[{bg:Y()}],"gradient-from-pos":[{from:ye()}],"gradient-via-pos":[{via:ye()}],"gradient-to-pos":[{to:ye()}],"gradient-from":[{from:Y()}],"gradient-via":[{via:Y()}],"gradient-to":[{to:Y()}],rounded:[{rounded:oe()}],"rounded-s":[{"rounded-s":oe()}],"rounded-e":[{"rounded-e":oe()}],"rounded-t":[{"rounded-t":oe()}],"rounded-r":[{"rounded-r":oe()}],"rounded-b":[{"rounded-b":oe()}],"rounded-l":[{"rounded-l":oe()}],"rounded-ss":[{"rounded-ss":oe()}],"rounded-se":[{"rounded-se":oe()}],"rounded-ee":[{"rounded-ee":oe()}],"rounded-es":[{"rounded-es":oe()}],"rounded-tl":[{"rounded-tl":oe()}],"rounded-tr":[{"rounded-tr":oe()}],"rounded-br":[{"rounded-br":oe()}],"rounded-bl":[{"rounded-bl":oe()}],"border-w":[{border:je()}],"border-w-x":[{"border-x":je()}],"border-w-y":[{"border-y":je()}],"border-w-s":[{"border-s":je()}],"border-w-e":[{"border-e":je()}],"border-w-bs":[{"border-bs":je()}],"border-w-be":[{"border-be":je()}],"border-w-t":[{"border-t":je()}],"border-w-r":[{"border-r":je()}],"border-w-b":[{"border-b":je()}],"border-w-l":[{"border-l":je()}],"divide-x":[{"divide-x":je()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":je()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Ne(),"hidden","none"]}],"divide-style":[{divide:[...Ne(),"hidden","none"]}],"border-color":[{border:Y()}],"border-color-x":[{"border-x":Y()}],"border-color-y":[{"border-y":Y()}],"border-color-s":[{"border-s":Y()}],"border-color-e":[{"border-e":Y()}],"border-color-bs":[{"border-bs":Y()}],"border-color-be":[{"border-be":Y()}],"border-color-t":[{"border-t":Y()}],"border-color-r":[{"border-r":Y()}],"border-color-b":[{"border-b":Y()}],"border-color-l":[{"border-l":Y()}],"divide-color":[{divide:Y()}],"outline-style":[{outline:[...Ne(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ft,We,Ve]}],"outline-w":[{outline:["",ft,fc,Pa]}],"outline-color":[{outline:Y()}],shadow:[{shadow:["","none",p,Od,Dd]}],"shadow-color":[{shadow:Y()}],"inset-shadow":[{"inset-shadow":["none",g,Od,Dd]}],"inset-shadow-color":[{"inset-shadow":Y()}],"ring-w":[{ring:je()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:Y()}],"ring-offset-w":[{"ring-offset":[ft,Pa]}],"ring-offset-color":[{"ring-offset":Y()}],"inset-ring-w":[{"inset-ring":je()}],"inset-ring-color":[{"inset-ring":Y()}],"text-shadow":[{"text-shadow":["none",b,Od,Dd]}],"text-shadow-color":[{"text-shadow":Y()}],opacity:[{opacity:[ft,We,Ve]}],"mix-blend":[{"mix-blend":[...Ge(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Ge()}],"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":Me()}],"mask-image-linear-to-pos":[{"mask-linear-to":Me()}],"mask-image-linear-from-color":[{"mask-linear-from":Y()}],"mask-image-linear-to-color":[{"mask-linear-to":Y()}],"mask-image-t-from-pos":[{"mask-t-from":Me()}],"mask-image-t-to-pos":[{"mask-t-to":Me()}],"mask-image-t-from-color":[{"mask-t-from":Y()}],"mask-image-t-to-color":[{"mask-t-to":Y()}],"mask-image-r-from-pos":[{"mask-r-from":Me()}],"mask-image-r-to-pos":[{"mask-r-to":Me()}],"mask-image-r-from-color":[{"mask-r-from":Y()}],"mask-image-r-to-color":[{"mask-r-to":Y()}],"mask-image-b-from-pos":[{"mask-b-from":Me()}],"mask-image-b-to-pos":[{"mask-b-to":Me()}],"mask-image-b-from-color":[{"mask-b-from":Y()}],"mask-image-b-to-color":[{"mask-b-to":Y()}],"mask-image-l-from-pos":[{"mask-l-from":Me()}],"mask-image-l-to-pos":[{"mask-l-to":Me()}],"mask-image-l-from-color":[{"mask-l-from":Y()}],"mask-image-l-to-color":[{"mask-l-to":Y()}],"mask-image-x-from-pos":[{"mask-x-from":Me()}],"mask-image-x-to-pos":[{"mask-x-to":Me()}],"mask-image-x-from-color":[{"mask-x-from":Y()}],"mask-image-x-to-color":[{"mask-x-to":Y()}],"mask-image-y-from-pos":[{"mask-y-from":Me()}],"mask-image-y-to-pos":[{"mask-y-to":Me()}],"mask-image-y-from-color":[{"mask-y-from":Y()}],"mask-image-y-to-color":[{"mask-y-to":Y()}],"mask-image-radial":[{"mask-radial":[We,Ve]}],"mask-image-radial-from-pos":[{"mask-radial-from":Me()}],"mask-image-radial-to-pos":[{"mask-radial-to":Me()}],"mask-image-radial-from-color":[{"mask-radial-from":Y()}],"mask-image-radial-to-color":[{"mask-radial-to":Y()}],"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":T()}],"mask-image-conic-pos":[{"mask-conic":[ft]}],"mask-image-conic-from-pos":[{"mask-conic-from":Me()}],"mask-image-conic-to-pos":[{"mask-conic-to":Me()}],"mask-image-conic-from-color":[{"mask-conic-from":Y()}],"mask-image-conic-to-color":[{"mask-conic-to":Y()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:F()}],"mask-repeat":[{mask:ie()}],"mask-size":[{mask:Ee()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",We,Ve]}],filter:[{filter:["","none",We,Ve]}],blur:[{blur:Qe()}],brightness:[{brightness:[ft,We,Ve]}],contrast:[{contrast:[ft,We,Ve]}],"drop-shadow":[{"drop-shadow":["","none",v,Od,Dd]}],"drop-shadow-color":[{"drop-shadow":Y()}],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":Qe()}],"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":R()}],"border-spacing-x":[{"border-spacing-x":R()}],"border-spacing-y":[{"border-spacing-y":R()}],"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",A,We,Ve]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[k,We,Ve]}],"perspective-origin":[{"perspective-origin":P()}],rotate:[{rotate:ke()}],"rotate-x":[{"rotate-x":ke()}],"rotate-y":[{"rotate-y":ke()}],"rotate-z":[{"rotate-z":ke()}],scale:[{scale:He()}],"scale-x":[{"scale-x":He()}],"scale-y":[{"scale-y":He()}],"scale-z":[{"scale-z":He()}],"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:P()}],"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:[Bi,We,Ve]}],accent:[{accent:Y()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:Y()}],"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":Y()}],"scrollbar-track-color":[{"scrollbar-track":Y()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mbs":[{"scroll-mbs":R()}],"scroll-mbe":[{"scroll-mbe":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pbs":[{"scroll-pbs":R()}],"scroll-pbe":[{"scroll-pbe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"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",...Y()]}],"stroke-w":[{stroke:[ft,fc,Pa,iS]}],stroke:[{stroke:["none",...Y()]}],"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"]}},kL=tL(wL);function de(...e){return kL(Vc(e))}const NL=[{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}],CL=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});function EL(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 NL)if(n>=l)return CL.format(Math.round(s/l),o);return"just now"}const jL=rC("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 r.jsx("button",{className:de(jL({variant:t,size:s,className:e})),...n})}const _C=y.createContext({});function TL(e){const t=y.useRef(null);return t.current===null&&(t.current=e()),t.current}const AL=typeof window<"u",RL=AL?y.useLayoutEffect:y.useEffect,Fb=y.createContext(null);function qb(e,t){e.indexOf(t)===-1&&e.push(t)}function Eh(e,t){const s=e.indexOf(t);s>-1&&e.splice(s,1)}const Wi=(e,t,s)=>s>t?t:s<e?e:s;let Vb=()=>{};const pa={},yC=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function SC(e){return typeof e=="object"&&e!==null}const wC=e=>/^0[^.\s]+$/u.test(e);function kC(e){let t;return()=>(t===void 0&&(t=e()),t)}const di=e=>e,ML=(e,t)=>s=>t(e(s)),nu=(...e)=>e.reduce(ML),Gc=(e,t,s)=>{const n=t-e;return n===0?1:(s-e)/n};class Gb{constructor(){this.subscriptions=[]}add(t){return qb(this.subscriptions,t),()=>Eh(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 Wn=e=>e*1e3,ui=e=>e/1e3;function NC(e,t){return t?e*(1e3/t):0}const CC=(e,t,s)=>(((1-3*s+3*t)*e+(3*s-6*t))*e+3*t)*e,DL=1e-7,OL=12;function LL(e,t,s,n,o){let l,u,h=0;do u=t+(s-t)/2,l=CC(u,n,o)-e,l>0?s=u:t=u;while(Math.abs(l)>DL&&++h<OL);return u}function iu(e,t,s,n){if(e===t&&s===n)return di;const o=l=>LL(l,0,1,e,s);return l=>l===0||l===1?l:CC(o(l),t,n)}const EC=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,jC=e=>t=>1-e(1-t),TC=iu(.33,1.53,.69,.99),Wb=jC(TC),AC=EC(Wb),RC=e=>e>=1?1:(e*=2)<1?.5*Wb(e):.5*(2-Math.pow(2,-10*(e-1))),Kb=e=>1-Math.sin(Math.acos(e)),MC=jC(Kb),DC=EC(Kb),zL=iu(.42,0,1,1),BL=iu(0,0,.58,1),OC=iu(.42,0,.58,1),IL=e=>Array.isArray(e)&&typeof e[0]!="number",LC=e=>Array.isArray(e)&&typeof e[0]=="number",PL={linear:di,easeIn:zL,easeInOut:OC,easeOut:BL,circIn:Kb,circInOut:DC,circOut:MC,backIn:Wb,backInOut:AC,backOut:TC,anticipate:RC},$L=e=>typeof e=="string",oS=e=>{if(LC(e)){Vb(e.length===4);const[t,s,n,o]=e;return iu(t,s,n,o)}else if($L(e))return PL[e];return e},Ld=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function HL(e,t){let s=new Set,n=new Set,o=!1,l=!1;const u=new WeakSet;let h={delta:0,timestamp:0,isProcessing:!1};function m(p){u.has(p)&&(d.schedule(p),e()),p(h)}const d={schedule:(p,g=!1,b=!1)=>{const w=b&&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(m),s.clear(),o=!1,l&&(l=!1,d.process(p))}};return d}const UL=40;function zC(e,t){let s=!1,n=!0;const o={delta:0,timestamp:0,isProcessing:!1},l=()=>s=!0,u=Ld.reduce((j,T)=>(j[T]=HL(l),j),{}),{setup:h,read:m,resolveKeyframes:d,preUpdate:p,update:g,preRender:b,render:v,postRender:w}=u,k=()=>{const j=pa.useManualTiming,T=j?o.timestamp:performance.now();s=!1,j||(o.delta=n?1e3/60:Math.max(Math.min(T-o.timestamp,UL),1)),o.timestamp=T,o.isProcessing=!0,h.process(o),m.process(o),d.process(o),p.process(o),g.process(o),b.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:Ld.reduce((j,T)=>{const P=u[T];return j[T]=(z,L=!1,R=!1)=>(s||N(),P.schedule(z,L,R)),j},{}),cancel:j=>{for(let T=0;T<Ld.length;T++)u[Ld[T]].cancel(j)},state:o,steps:u}}const{schedule:Vt,cancel:ga,state:Ys,steps:Hp}=zC(typeof requestAnimationFrame<"u"?requestAnimationFrame:di,!0);let lh;function FL(){lh=void 0}const gn={now:()=>(lh===void 0&&gn.set(Ys.isProcessing||pa.useManualTiming?Ys.timestamp:performance.now()),lh),set:e=>{lh=e,queueMicrotask(FL)}},BC=e=>t=>typeof t=="string"&&t.startsWith(e),IC=BC("--"),qL=BC("var(--"),Yb=e=>qL(e)?VL.test(e.split("/*")[0].trim()):!1,VL=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function lS(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const dl={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Wc={...dl,transform:e=>Wi(0,1,e)},zd={...dl,default:1},zc=e=>Math.round(e*1e5)/1e5,Xb=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function GL(e){return e==null}const WL=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Zb=(e,t)=>s=>!!(typeof s=="string"&&WL.test(s)&&s.startsWith(e)||t&&!GL(s)&&Object.prototype.hasOwnProperty.call(s,t)),PC=(e,t,s)=>n=>{if(typeof n!="string")return n;const[o,l,u,h]=n.match(Xb);return{[e]:parseFloat(o),[t]:parseFloat(l),[s]:parseFloat(u),alpha:h!==void 0?parseFloat(h):1}},KL=e=>Wi(0,255,e),Up={...dl,transform:e=>Math.round(KL(e))},Ka={test:Zb("rgb","red"),parse:PC("red","green","blue"),transform:({red:e,green:t,blue:s,alpha:n=1})=>"rgba("+Up.transform(e)+", "+Up.transform(t)+", "+Up.transform(s)+", "+zc(Wc.transform(n))+")"};function YL(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 u0={test:Zb("#"),parse:YL,transform:Ka.transform},ru=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),ua=ru("deg"),Vi=ru("%"),Ye=ru("px"),XL=ru("vh"),ZL=ru("vw"),cS={...Vi,parse:e=>Vi.parse(e)/100,transform:e=>Vi.transform(e*100)},Zo={test:Zb("hsl","hue"),parse:PC("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:s,alpha:n=1})=>"hsla("+Math.round(e)+", "+Vi.transform(zc(t))+", "+Vi.transform(zc(s))+", "+zc(Wc.transform(n))+")"},ks={test:e=>Ka.test(e)||u0.test(e)||Zo.test(e),parse:e=>Ka.test(e)?Ka.parse(e):Zo.test(e)?Zo.parse(e):u0.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Ka.transform(e):Zo.transform(e),getAnimatableNone:e=>{const t=ks.parse(e);return t.alpha=0,ks.transform(t)}},QL=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function JL(e){return isNaN(e)&&typeof e=="string"&&(e.match(Xb)?.length||0)+(e.match(QL)?.length||0)>0}const $C="number",HC="color",e7="var",t7="var(",uS="${}",s7=/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 al(e){const t=e.toString(),s=[],n={color:[],number:[],var:[]},o=[];let l=0;const h=t.replace(s7,m=>(ks.test(m)?(n.color.push(l),o.push(HC),s.push(ks.parse(m))):m.startsWith(t7)?(n.var.push(l),o.push(e7),s.push(m)):(n.number.push(l),o.push($C),s.push(parseFloat(m))),++l,uS)).split(uS);return{values:s,split:h,indexes:n,types:o}}function n7(e){return al(e).values}function UC({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===$C?o+=zc(n[l]):u===HC?o+=ks.transform(n[l]):o+=n[l]}return o}}function i7(e){return UC(al(e))}const r7=e=>typeof e=="number"?0:ks.test(e)?ks.getAnimatableNone(e):e,a7=(e,t)=>typeof e=="number"?t?.trim().endsWith("/")?e:0:r7(e);function o7(e){const t=al(e);return UC(t)(t.values.map((n,o)=>a7(n,t.split[o])))}const Ni={test:JL,parse:n7,createTransformer:i7,getAnimatableNone:o7};function Fp(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 l7({hue:e,saturation:t,lightness:s,alpha:n}){e/=360,t/=100,s/=100;let o=0,l=0,u=0;if(!t)o=l=u=s;else{const h=s<.5?s*(1+t):s+t-s*t,m=2*s-h;o=Fp(m,h,e+1/3),l=Fp(m,h,e),u=Fp(m,h,e-1/3)}return{red:Math.round(o*255),green:Math.round(l*255),blue:Math.round(u*255),alpha:n}}function jh(e,t){return s=>s>0?t:e}const Zt=(e,t,s)=>e+(t-e)*s,qp=(e,t,s)=>{const n=e*e,o=s*(t*t-n)+n;return o<0?0:Math.sqrt(o)},c7=[u0,Ka,Zo],u7=e=>c7.find(t=>t.test(e));function dS(e){const t=u7(e);if(!t)return!1;let s=t.parse(e);return t===Zo&&(s=l7(s)),s}const hS=(e,t)=>{const s=dS(e),n=dS(t);if(!s||!n)return jh(e,t);const o={...s};return l=>(o.red=qp(s.red,n.red,l),o.green=qp(s.green,n.green,l),o.blue=qp(s.blue,n.blue,l),o.alpha=Zt(s.alpha,n.alpha,l),Ka.transform(o))},d0=new Set(["none","hidden"]);function d7(e,t){return d0.has(e)?s=>s<=0?e:t:s=>s>=1?t:e}function h7(e,t){return s=>Zt(e,t,s)}function Qb(e){return typeof e=="number"?h7:typeof e=="string"?Yb(e)?jh:ks.test(e)?hS:p7:Array.isArray(e)?FC:typeof e=="object"?ks.test(e)?hS:f7:jh}function FC(e,t){const s=[...e],n=s.length,o=e.map((l,u)=>Qb(l)(l,t[u]));return l=>{for(let u=0;u<n;u++)s[u]=o[u](l);return s}}function f7(e,t){const s={...e,...t},n={};for(const o in s)e[o]!==void 0&&t[o]!==void 0&&(n[o]=Qb(e[o])(e[o],t[o]));return o=>{for(const l in n)s[l]=n[l](o);return s}}function m7(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 p7=(e,t)=>{const s=Ni.createTransformer(t),n=al(e),o=al(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?d0.has(e)&&!o.values.length||d0.has(t)&&!n.values.length?d7(e,t):nu(FC(m7(n,o),o.values),s):jh(e,t)};function qC(e,t,s){return typeof e=="number"&&typeof t=="number"&&typeof s=="number"?Zt(e,t,s):Qb(e)(e,t)}const g7=e=>{const t=({timestamp:s})=>e(s);return{start:(s=!0)=>Vt.update(t,s),stop:()=>ga(t),now:()=>Ys.isProcessing?Ys.timestamp:gn.now()}},VC=(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)})`},Th=2e4;function Jb(e){let t=0;const s=50;let n=e.next(t);for(;!n.done&&t<Th;)t+=s,n=e.next(t);return t>=Th?1/0:t}function b7(e,t=100,s){const n=s({...e,keyframes:[0,t]}),o=Math.min(Jb(n),Th);return{type:"keyframes",ease:l=>n.next(o*l).value/t,duration:ui(o)}}const ls={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 h0(e,t){return e*Math.sqrt(1-t*t)}const x7=12;function v7(e,t,s){let n=s;for(let o=1;o<x7;o++)n=n-e(n)/t(n);return n}const Vp=.001;function _7({duration:e=ls.duration,bounce:t=ls.bounce,velocity:s=ls.velocity,mass:n=ls.mass}){let o,l,u=1-t;u=Wi(ls.minDamping,ls.maxDamping,u),e=Wi(ls.minDuration,ls.maxDuration,ui(e)),u<1?(o=d=>{const p=d*u,g=p*e,b=p-s,v=h0(d,u),w=Math.exp(-g);return Vp-b/v*w},l=d=>{const g=d*u*e,b=g*s+s,v=Math.pow(u,2)*Math.pow(d,2)*e,w=Math.exp(-g),k=h0(Math.pow(d,2),u);return(-o(d)+Vp>0?-1:1)*((b-v)*w)/k}):(o=d=>{const p=Math.exp(-d*e),g=(d-s)*e+1;return-Vp+p*g},l=d=>{const p=Math.exp(-d*e),g=(s-d)*(e*e);return p*g});const h=5/e,m=v7(o,l,h);if(e=Wn(e),isNaN(m))return{stiffness:ls.stiffness,damping:ls.damping,duration:e};{const d=Math.pow(m,2)*n;return{stiffness:d,damping:u*2*Math.sqrt(n*d),duration:e}}}const y7=["duration","bounce"],S7=["stiffness","damping","mass"];function fS(e,t){return t.some(s=>e[s]!==void 0)}function w7(e){let t={velocity:ls.velocity,stiffness:ls.stiffness,damping:ls.damping,mass:ls.mass,isResolvedFromDuration:!1,...e};if(!fS(e,S7)&&fS(e,y7))if(t.velocity=0,e.visualDuration){const s=e.visualDuration,n=2*Math.PI/(s*1.2),o=n*n,l=2*Wi(.05,1,1-(e.bounce||0))*Math.sqrt(o);t={...t,mass:ls.mass,stiffness:o,damping:l}}else{const s=_7({...e,velocity:0});t={...t,...s,mass:ls.mass},t.isResolvedFromDuration=!0}return t}function Ah(e=ls.visualDuration,t=ls.bounce){const s=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:n,restDelta:o}=s;const l=s.keyframes[0],u=s.keyframes[s.keyframes.length-1],h={done:!1,value:l},{stiffness:m,damping:d,mass:p,duration:g,velocity:b,isResolvedFromDuration:v}=w7({...s,velocity:-ui(s.velocity||0)}),w=b||0,k=d/(2*Math.sqrt(m*p)),N=u-l,E=ui(Math.sqrt(m/p)),A=Math.abs(N)<5;n||(n=A?ls.restSpeed.granular:ls.restSpeed.default),o||(o=A?ls.restDelta.granular:ls.restDelta.default);let j,T,P,z,L,R;if(k<1)P=h0(E,k),z=(w+k*E*N)/P,j=I=>{const V=Math.exp(-k*E*I);return u-V*(z*Math.sin(P*I)+N*Math.cos(P*I))},L=k*E*z+N*P,R=k*E*N-z*P,T=I=>Math.exp(-k*E*I)*(L*Math.sin(P*I)+R*Math.cos(P*I));else if(k===1){j=V=>u-Math.exp(-E*V)*(N+(w+E*N)*V);const I=w+E*N;T=V=>Math.exp(-E*V)*(E*I*V-w)}else{const I=E*Math.sqrt(k*k-1);j=W=>{const q=Math.exp(-k*E*W),B=Math.min(I*W,300);return u-q*((w+k*E*N)*Math.sinh(B)+I*N*Math.cosh(B))/I};const V=(w+k*E*N)/I,X=k*E*V-N*I,$=k*E*N-V*I;T=W=>{const q=Math.exp(-k*E*W),B=Math.min(I*W,300);return q*(X*Math.sinh(B)+$*Math.cosh(B))}}const D={calculatedDuration:v&&g||null,velocity:I=>Wn(T(I)),next:I=>{if(!v&&k<1){const X=Math.exp(-k*E*I),$=Math.sin(P*I),W=Math.cos(P*I),q=u-X*(z*$+N*W),B=Wn(X*(L*$+R*W));return h.done=Math.abs(B)<=n&&Math.abs(u-q)<=o,h.value=h.done?u:q,h}const V=j(I);if(v)h.done=I>=g;else{const X=Wn(T(I));h.done=Math.abs(X)<=n&&Math.abs(u-V)<=o}return h.value=h.done?u:V,h},toString:()=>{const I=Math.min(Jb(D),Th),V=VC(X=>D.next(I*X).value,I,30);return I+"ms "+V},toTransition:()=>{}};return D}Ah.applyToOptions=e=>{const t=b7(e,100,Ah);return e.ease=t.ease,e.duration=Wn(t.duration),e.type="keyframes",e};const k7=5;function GC(e,t,s){const n=Math.max(t-k7,0);return NC(s-e(n),t-n)}function f0({keyframes:e,velocity:t=0,power:s=.8,timeConstant:n=325,bounceDamping:o=10,bounceStiffness:l=500,modifyTarget:u,min:h,max:m,restDelta:d=.5,restSpeed:p}){const g=e[0],b={done:!1,value:g},v=R=>h!==void 0&&R<h||m!==void 0&&R>m,w=R=>h===void 0?m:m===void 0||Math.abs(h-R)<Math.abs(m-R)?h:m;let k=s*t;const N=g+k,E=u===void 0?N:u(N);E!==N&&(k=E-g);const A=R=>-k*Math.exp(-R/n),j=R=>E+A(R),T=R=>{const D=A(R),I=j(R);b.done=Math.abs(D)<=d,b.value=b.done?E:I};let P,z;const L=R=>{v(b.value)&&(P=R,z=Ah({keyframes:[b.value,w(b.value)],velocity:GC(j,R,b.value),damping:o,stiffness:l,restDelta:d,restSpeed:p}))};return L(0),{calculatedDuration:null,next:R=>{let D=!1;return!z&&P===void 0&&(D=!0,T(R),L(R)),P!==void 0&&R>=P?z.next(R-P):(!D&&T(R),b)}}}function N7(e,t,s){const n=[],o=s||pa.mix||qC,l=e.length-1;for(let u=0;u<l;u++){let h=o(e[u],e[u+1]);if(t){const m=Array.isArray(t)?t[u]||di:t;h=nu(m,h)}n.push(h)}return n}function C7(e,t,{clamp:s=!0,ease:n,mixer:o}={}){const l=e.length;if(Vb(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=N7(t,n,o),m=h.length,d=p=>{if(u&&p<e[0])return t[0];let g=0;if(m>1)for(;g<e.length-2&&!(p<e[g+1]);g++);const b=Gc(e[g],e[g+1],p);return h[g](b)};return s?p=>d(Wi(e[0],e[l-1],p)):d}function E7(e,t){const s=e[e.length-1];for(let n=1;n<=t;n++){const o=Gc(0,t,n);e.push(Zt(s,1,o))}}function j7(e){const t=[0];return E7(t,e.length-1),t}function T7(e,t){return e.map(s=>s*t)}function A7(e,t){return e.map(()=>t||OC).splice(0,e.length-1)}function Bc({duration:e=300,keyframes:t,times:s,ease:n="easeInOut"}){const o=IL(n)?n.map(oS):oS(n),l={done:!1,value:t[0]},u=T7(s&&s.length===t.length?s:j7(t),e),h=C7(u,t,{ease:Array.isArray(o)?o:A7(t,o)});return{calculatedDuration:e,next:m=>(l.value=h(m),l.done=m>=e,l)}}const R7=e=>e!==null;function cf(e,{repeat:t,repeatType:s="loop"},n,o=1){const l=e.filter(R7),h=o<0||t&&s!=="loop"&&t%2===1?0:l.length-1;return!h||n===void 0?l[h]:n}const M7={decay:f0,inertia:f0,tween:Bc,keyframes:Bc,spring:Ah};function WC(e){typeof e.type=="string"&&(e.type=M7[e.type])}class ex{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 D7=e=>e/100;class Rh extends ex{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!==gn.now()&&this.tick(gn.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;WC(t);const{type:s=Bc,repeat:n=0,repeatDelay:o=0,repeatType:l,velocity:u=0}=t;let{keyframes:h}=t;const m=s||Bc;m!==Bc&&typeof h[0]!="number"&&(this.mixKeyframes=nu(D7,qC(h[0],h[1])),h=[0,100]);const d=m({...t,keyframes:h});l==="mirror"&&(this.mirroredGenerator=m({...t,keyframes:[...h].reverse(),velocity:-u})),d.calculatedDuration===null&&(d.calculatedDuration=Jb(d));const{calculatedDuration:p}=d;this.calculatedDuration=p,this.resolvedDuration=p+o,this.totalDuration=this.resolvedDuration*(n+1)-o,this.generator=d}updateTime(t){const s=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=s}tick(t,s=!1){const{generator:n,totalDuration:o,mixKeyframes:l,mirroredGenerator:u,resolvedDuration:h,calculatedDuration:m}=this;if(this.startTime===null)return n.next(0);const{delay:d=0,keyframes:p,repeat:g,repeatType:b,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),A=this.playbackSpeed>=0?E<0:E>o;this.currentTime=Math.max(E,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=o);let j=this.currentTime,T=n;if(g){const R=Math.min(this.currentTime,o)/h;let D=Math.floor(R),I=R%1;!I&&R>=1&&(I=1),I===1&&D--,D=Math.min(D,g+1),D%2&&(b==="reverse"?(I=1-I,v&&(I-=v/h)):b==="mirror"&&(T=u)),j=Wi(0,1,I)*h}let P;A?(this.delayState.value=p[0],P=this.delayState):P=T.next(j),l&&!A&&(P.value=l(P.value));let{done:z}=P;!A&&m!==null&&(z=this.playbackSpeed>=0?this.currentTime>=o:this.currentTime<=0);const L=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&z);return L&&w!==f0&&(P.value=cf(p,this.options,N,this.speed)),k&&k(P.value),L&&this.finish(),P}then(t,s){return this.finished.then(t,s)}get duration(){return ui(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+ui(t)}get time(){return ui(this.currentTime)}set time(t){t=Wn(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 GC(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(gn.now()),this.playbackSpeed=t,s&&this.driver&&(this.time=ui(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=g7,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(gn.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 O7(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Ya=e=>e*180/Math.PI,m0=e=>{const t=Ya(Math.atan2(e[1],e[0]));return p0(t)},L7={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:m0,rotateZ:m0,skewX:e=>Ya(Math.atan(e[1])),skewY:e=>Ya(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},p0=e=>(e=e%360,e<0&&(e+=360),e),mS=m0,pS=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),gS=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),z7={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:pS,scaleY:gS,scale:e=>(pS(e)+gS(e))/2,rotateX:e=>p0(Ya(Math.atan2(e[6],e[5]))),rotateY:e=>p0(Ya(Math.atan2(-e[2],e[0]))),rotateZ:mS,rotate:mS,skewX:e=>Ya(Math.atan(e[4])),skewY:e=>Ya(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function g0(e){return e.includes("scale")?1:0}function b0(e,t){if(!e||e==="none")return g0(t);const s=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let n,o;if(s)n=z7,o=s;else{const h=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);n=L7,o=h}if(!o)return g0(t);const l=n[t],u=o[1].split(",").map(I7);return typeof l=="function"?l(u):u[l]}const B7=(e,t)=>{const{transform:s="none"}=getComputedStyle(e);return b0(s,t)};function I7(e){return parseFloat(e.trim())}const hl=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],fl=new Set(hl),bS=e=>e===dl||e===Ye,P7=new Set(["x","y","z"]),$7=hl.filter(e=>!P7.has(e));function H7(e){const t=[];return $7.forEach(s=>{const n=e.getValue(s);n!==void 0&&(t.push([s,n.get()]),n.set(s.startsWith("scale")?1:0))}),t}const ha={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})=>b0(t,"x"),y:(e,{transform:t})=>b0(t,"y")};ha.translateX=ha.x;ha.translateY=ha.y;const Qa=new Set;let x0=!1,v0=!1,_0=!1;function KC(){if(v0){const e=Array.from(Qa).filter(n=>n.needsMeasurement),t=new Set(e.map(n=>n.element)),s=new Map;t.forEach(n=>{const o=H7(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)})}v0=!1,x0=!1,Qa.forEach(e=>e.complete(_0)),Qa.clear()}function YC(){Qa.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(v0=!0)})}function U7(){_0=!0,YC(),KC(),_0=!1}class tx{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?(Qa.add(this),x0||(x0=!0,Vt.read(YC),Vt.resolveKeyframes(KC))):(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])}O7(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Qa.delete(this)}cancel(){this.state==="scheduled"&&(Qa.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const F7=e=>e.startsWith("--");function XC(e,t,s){F7(t)?e.style.setProperty(t,s):e.style[t]=s}const q7={};function ZC(e,t){const s=kC(e);return()=>q7[t]??s()}const V7=ZC(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),QC=ZC(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Cc=([e,t,s,n])=>`cubic-bezier(${e}, ${t}, ${s}, ${n})`,xS={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Cc([0,.65,.55,1]),circOut:Cc([.55,0,1,.45]),backIn:Cc([.31,.01,.66,-.59]),backOut:Cc([.33,1.53,.69,.99])};function JC(e,t){if(e)return typeof e=="function"?QC()?VC(e,t):"ease-out":LC(e)?Cc(e):Array.isArray(e)?e.map(s=>JC(s,t)||xS.easeOut):xS[e]}function G7(e,t,s,{delay:n=0,duration:o=300,repeat:l=0,repeatType:u="loop",ease:h="easeOut",times:m}={},d=void 0){const p={[t]:s};m&&(p.offset=m);const g=JC(h,o);Array.isArray(g)&&(p.easing=g);const b={delay:n,duration:o,easing:Array.isArray(g)?"linear":g,fill:"both",iterations:l+1,direction:u==="reverse"?"alternate":"normal"};return d&&(b.pseudoElement=d),e.animate(p,b)}function eE(e){return typeof e=="function"&&"applyToOptions"in e}function W7({type:e,...t}){return eE(e)&&QC()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class tE extends ex{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:s,name:n,keyframes:o,pseudoElement:l,allowFlatten:u=!1,finalKeyframe:h,onComplete:m}=t;this.isPseudoElement=!!l,this.allowFlatten=u,this.options=t,Vb(typeof t.type!="string");const d=W7(t);this.animation=G7(s,n,o,d,l),d.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!l){const p=cf(o,this.options,h,this.speed);this.updateMotionValue&&this.updateMotionValue(p),XC(s,n,p),this.animation.cancel()}m?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const t=this.options?.element;!this.isPseudoElement&&t?.isConnected&&this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return ui(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+ui(t)}get time(){return ui(Number(this.animation.currentTime)||0)}set time(t){const s=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Wn(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&&V7()?(this.animation.timeline=t,s&&(this.animation.rangeStart=s),n&&(this.animation.rangeEnd=n),di):o(this)}}const sE={anticipate:RC,backInOut:AC,circInOut:DC};function K7(e){return e in sE}function Y7(e){typeof e.ease=="string"&&K7(e.ease)&&(e.ease=sE[e.ease])}const Gp=10;class X7 extends tE{constructor(t){Y7(t),WC(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 Rh({...u,autoplay:!1}),m=Math.max(Gp,gn.now()-this.startTime),d=Wi(0,Gp,m-Gp),p=h.sample(m).value,{name:g}=this.options;l&&g&&XC(l,g,p),s.setWithVelocity(h.sample(Math.max(0,m-d)).value,p,d),h.stop()}}const vS=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Ni.test(e)||e==="0")&&!e.startsWith("url("));function Z7(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 Q7(e,t,s,n){const o=e[0];if(o===null)return!1;if(t==="display"||t==="visibility")return!0;const l=e[e.length-1],u=vS(o,t),h=vS(l,t);return!u||!h?!1:Z7(e)||(s==="spring"||eE(s))&&n}function y0(e){e.duration=0,e.type="keyframes"}const nE=new Set(["opacity","clipPath","filter","transform"]),J7=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function e9(e){for(let t=0;t<e.length;t++)if(typeof e[t]=="string"&&J7.test(e[t]))return!0;return!1}const t9=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),s9=kC(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function n9(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 s9()&&s&&(nE.has(s)||t9.has(s)&&e9(h))&&(s!=="transform"||!p)&&!d&&!n&&o!=="mirror"&&l!==0&&u!=="inertia"}const i9=40;class r9 extends ex{constructor({autoplay:t=!0,delay:s=0,type:n="keyframes",repeat:o=0,repeatDelay:l=0,repeatType:u="loop",keyframes:h,name:m,motionValue:d,element:p,...g}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=gn.now();const b={autoplay:t,delay:s,type:n,repeat:o,repeatDelay:l,repeatType:u,name:m,motionValue:d,element:p,...g},v=p?.KeyframeResolver||tx;this.keyframeResolver=new v(h,(w,k,N)=>this.onKeyframesResolved(w,k,b,!N),m,d,p),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,s,n,o){this.keyframeResolver=void 0;const{name:l,type:u,velocity:h,delay:m,isHandoff:d,onUpdate:p}=n;this.resolvedAt=gn.now();let g=!0;Q7(t,l,u,h)||(g=!1,(pa.instantAnimations||!m)&&p?.(cf(t,n,s)),t[0]=t[t.length-1],y0(n),n.repeat=0);const v={startTime:o?this.resolvedAt?this.resolvedAt-this.createdAt>i9?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:s,...n,keyframes:t},w=g&&!d&&n9(v),k=v.motionValue?.owner?.current;let N;if(w)try{N=new X7({...v,element:k})}catch{N=new Rh(v)}else N=new Rh(v);N.finished.then(()=>{this.notifyFinished()}).catch(di),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(),U7()),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 iE(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 a9=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function o9(e){const t=a9.exec(e);if(!t)return[,];const[,s,n,o]=t;return[`--${s??n}`,o]}function rE(e,t,s=1){const[n,o]=o9(e);if(!n)return;const l=window.getComputedStyle(t).getPropertyValue(n);if(l){const u=l.trim();return yC(u)?parseFloat(u):u}return Yb(o)?rE(o,t,s+1):o}const l9={type:"spring",stiffness:500,damping:25,restSpeed:10},c9=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),u9={type:"keyframes",duration:.8},d9={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},h9=(e,{keyframes:t})=>t.length>2?u9:fl.has(e)?e.startsWith("scale")?c9(t[1]):l9:d9;function aE(e,t){if(e?.inherit&&t){const{inherit:s,...n}=e;return{...t,...n}}return e}function sx(e,t){const s=e?.[t]??e?.default??e;return s!==e?aE(s,e):s}const f9=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function m9(e){for(const t in e)if(!f9.has(t))return!0;return!1}const nx=(e,t,s,n={},o,l)=>u=>{const h=sx(n,e)||{},m=h.delay||n.delay||0;let{elapsed:d=0}=n;d=d-Wn(m);const p={keyframes:Array.isArray(s)?s:[null,s],ease:"easeOut",velocity:t.getVelocity(),...h,delay:-d,onUpdate:b=>{t.set(b),h.onUpdate&&h.onUpdate(b)},onComplete:()=>{u(),h.onComplete&&h.onComplete()},name:e,motionValue:t,element:l?void 0:o};m9(h)||Object.assign(p,h9(e,p)),p.duration&&(p.duration=Wn(p.duration)),p.repeatDelay&&(p.repeatDelay=Wn(p.repeatDelay)),p.from!==void 0&&(p.keyframes[0]=p.from);let g=!1;if((p.type===!1||p.duration===0&&!p.repeatDelay)&&(y0(p),p.delay===0&&(g=!0)),(pa.instantAnimations||pa.skipAnimations||o?.shouldSkipAnimations)&&(g=!0,y0(p),p.delay=0),p.allowFlatten=!h.type&&!h.ease,g&&!l&&t.get()!==void 0){const b=cf(p.keyframes,h);if(b!==void 0){Vt.update(()=>{p.onUpdate(b),p.onComplete()});return}}return h.isSync?new Rh(p):new r9(p)};function _S(e){const t=[{},{}];return e?.values.forEach((s,n)=>{t[0][n]=s.get(),t[1][n]=s.getVelocity()}),t}function ix(e,t,s,n){if(typeof t=="function"){const[o,l]=_S(n);t=t(s!==void 0?s:e.custom,o,l)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[o,l]=_S(n);t=t(s!==void 0?s:e.custom,o,l)}return t}function Ja(e,t,s){const n=e.getProps();return ix(n,t,s!==void 0?s:n.custom,e)}const oE=new Set(["width","height","top","left","right","bottom",...hl]),yS=30,p9=e=>!isNaN(parseFloat(e));class g9{constructor(t,s={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=n=>{const o=gn.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=gn.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=p9(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 Gb);const n=this.events[t].add(s);return t==="change"?()=>{n(),Vt.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=gn.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>yS)return 0;const s=Math.min(this.updatedAt-this.prevUpdatedAt,yS);return NC(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 ol(e,t){return new g9(e,t)}const S0=e=>Array.isArray(e);function b9(e,t,s){e.hasValue(t)?e.getValue(t).set(s):e.addValue(t,ol(s))}function x9(e){return S0(e)?e[e.length-1]||0:e}function v9(e,t){const s=Ja(e,t);let{transitionEnd:n={},transition:o={},...l}=s||{};l={...l,...n};for(const u in l){const h=x9(l[u]);b9(e,u,h)}}const Zs=e=>!!(e&&e.getVelocity);function _9(e){return!!(Zs(e)&&e.add)}function w0(e,t){const s=e.getValue("willChange");if(_9(s))return s.add(t);if(!s&&pa.WillChange){const n=new pa.WillChange("auto");e.addValue("willChange",n),n.add(t)}}function rx(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const y9="framerAppearId",lE="data-"+rx(y9);function cE(e){return e.props[lE]}function S9({protectedKeys:e,needsAnimating:t},s){const n=e.hasOwnProperty(s)&&t[s]!==!0;return t[s]=!1,n}function uE(e,t,{delay:s=0,transitionOverride:n,type:o}={}){let{transition:l,transitionEnd:u,...h}=t;const m=e.getDefaultTransition();l=l?aE(l,m):m;const d=l?.reduceMotion;n&&(l=n);const p=[],g=o&&e.animationState&&e.animationState.getState()[o];for(const b in h){const v=e.getValue(b,e.latestValues[b]??null),w=h[b];if(w===void 0||g&&S9(g,b))continue;const k={delay:s,...sx(l||{},b)},N=v.get();if(N!==void 0&&!v.isAnimating()&&!Array.isArray(w)&&w===N&&!k.velocity){Vt.update(()=>v.set(w));continue}let E=!1;if(window.MotionHandoffAnimation){const T=cE(e);if(T){const P=window.MotionHandoffAnimation(T,b,Vt);P!==null&&(k.startTime=P,E=!0)}}w0(e,b);const A=d??e.shouldReduceMotion;v.start(nx(b,v,w,A&&oE.has(b)?{type:!1}:k,e,E));const j=v.animation;j&&p.push(j)}if(u){const b=()=>Vt.update(()=>{u&&v9(e,u)});p.length?Promise.all(p).then(b):b()}return p}function k0(e,t,s={}){const n=Ja(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(uE(e,n,s)):()=>Promise.resolve(),u=e.variantChildren&&e.variantChildren.size?(m=0)=>{const{delayChildren:d=0,staggerChildren:p,staggerDirection:g}=o;return w9(e,t,m,d,p,g,s)}:()=>Promise.resolve(),{when:h}=o;if(h){const[m,d]=h==="beforeChildren"?[l,u]:[u,l];return m().then(()=>d())}else return Promise.all([l(),u(s.delay)])}function w9(e,t,s=0,n=0,o=0,l=1,u){const h=[];for(const m of e.variantChildren)m.notify("AnimationStart",t),h.push(k0(m,t,{...u,delay:s+(typeof n=="function"?0:n)+iE(e.variantChildren,m,n,o,l)}).then(()=>m.notify("AnimationComplete",t)));return Promise.all(h)}function k9(e,t,s={}){e.notify("AnimationStart",t);let n;if(Array.isArray(t)){const o=t.map(l=>k0(e,l,s));n=Promise.all(o)}else if(typeof t=="string")n=k0(e,t,s);else{const o=typeof t=="function"?Ja(e,t,s.custom):t;n=Promise.all(uE(e,o,s))}return n.then(()=>{e.notify("AnimationComplete",t)})}const N9={test:e=>e==="auto",parse:e=>e},dE=e=>t=>t.test(e),hE=[dl,Ye,Vi,ua,ZL,XL,N9],SS=e=>hE.find(dE(e));function C9(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||wC(e):!0}const E9=new Set(["brightness","contrast","saturate","opacity"]);function j9(e){const[t,s]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[n]=s.match(Xb)||[];if(!n)return e;const o=s.replace(n,"");let l=E9.has(t)?1:0;return n!==s&&(l*=100),t+"("+l+o+")"}const T9=/\b([a-z-]*)\(.*?\)/gu,N0={...Ni,getAnimatableNone:e=>{const t=e.match(T9);return t?t.map(j9).join(" "):e}},C0={...Ni,getAnimatableNone:e=>{const t=Ni.parse(e);return Ni.createTransformer(e)(t.map(n=>typeof n=="number"?0:typeof n=="object"?{...n,alpha:1}:n))}},wS={...dl,transform:Math.round},A9={rotate:ua,rotateX:ua,rotateY:ua,rotateZ:ua,scale:zd,scaleX:zd,scaleY:zd,scaleZ:zd,skew:ua,skewX:ua,skewY:ua,distance:Ye,translateX:Ye,translateY:Ye,translateZ:Ye,x:Ye,y:Ye,z:Ye,perspective:Ye,transformPerspective:Ye,opacity:Wc,originX:cS,originY:cS,originZ:Ye},ax={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,...A9,zIndex:wS,fillOpacity:Wc,strokeOpacity:Wc,numOctaves:wS},R9={...ax,color:ks,backgroundColor:ks,outlineColor:ks,fill:ks,stroke:ks,borderColor:ks,borderTopColor:ks,borderRightColor:ks,borderBottomColor:ks,borderLeftColor:ks,filter:N0,WebkitFilter:N0,mask:C0,WebkitMask:C0},fE=e=>R9[e],M9=new Set([N0,C0]);function mE(e,t){let s=fE(e);return M9.has(s)||(s=Ni),s.getAnimatableNone?s.getAnimatableNone(t):void 0}const D9=new Set(["auto","none","0"]);function O9(e,t,s){let n=0,o;for(;n<e.length&&!o;){const l=e[n];typeof l=="string"&&!D9.has(l)&&al(l).values.length&&(o=e[n]),n++}if(o&&s)for(const l of t)e[l]=mE(s,o)}class L9 extends tx{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(),Yb(g))){const b=rE(g,s.current);b!==void 0&&(t[p]=b),p===t.length-1&&(this.finalKeyframe=g)}}if(this.resolveNoneKeyframes(),!oE.has(n)||t.length!==2)return;const[o,l]=t,u=SS(o),h=SS(l),m=lS(o),d=lS(l);if(m!==d&&ha[n]){this.needsMeasurement=!0;return}if(u!==h)if(bS(u)&&bS(h))for(let p=0;p<t.length;p++){const g=t[p];typeof g=="string"&&(t[p]=parseFloat(g))}else ha[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:s}=this,n=[];for(let o=0;o<t.length;o++)(t[o]===null||C9(t[o]))&&n.push(o);n.length&&O9(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=ha[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]=ha[s](t.measureViewportBox(),window.getComputedStyle(t.current)),u!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=u),this.removedTransforms?.length&&this.removedTransforms.forEach(([h,m])=>{t.getValue(h).set(m)}),this.resolveNoneKeyframes()}}function pE(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 gE=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function z9(e){return SC(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}const{schedule:ox}=zC(queueMicrotask,!1),yi={x:!1,y:!1};function bE(){return yi.x||yi.y}function B9(e){return e==="x"||e==="y"?yi[e]?null:(yi[e]=!0,()=>{yi[e]=!1}):yi.x||yi.y?null:(yi.x=yi.y=!0,()=>{yi.x=yi.y=!1})}function xE(e,t){const s=pE(e),n=new AbortController,o={passive:!0,...t,signal:n.signal};return[s,o,()=>n.abort()]}function I9(e){return!(e.pointerType==="touch"||bE())}function P9(e,t,s={}){const[n,o,l]=xE(e,s);return n.forEach(u=>{let h=!1,m=!1,d;const p=()=>{u.removeEventListener("pointerleave",w)},g=N=>{d&&(d(N),d=void 0),p()},b=N=>{h=!1,window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",b),m&&(m=!1,g(N))},v=()=>{h=!0,window.addEventListener("pointerup",b,o),window.addEventListener("pointercancel",b,o)},w=N=>{if(N.pointerType!=="touch"){if(h){m=!0;return}g(N)}},k=N=>{if(!I9(N))return;m=!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 vE=(e,t)=>t?e===t?!0:vE(e,t.parentElement):!1,lx=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,$9=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function H9(e){return $9.has(e.tagName)||e.isContentEditable===!0}const U9=new Set(["INPUT","SELECT","TEXTAREA"]);function F9(e){return U9.has(e.tagName)||e.isContentEditable===!0}const ch=new WeakSet;function kS(e){return t=>{t.key==="Enter"&&e(t)}}function Wp(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const q9=(e,t)=>{const s=e.currentTarget;if(!s)return;const n=kS(()=>{if(ch.has(s))return;Wp(s,"down");const o=kS(()=>{Wp(s,"up")}),l=()=>Wp(s,"cancel");s.addEventListener("keyup",o,t),s.addEventListener("blur",l,t)});s.addEventListener("keydown",n,t),s.addEventListener("blur",()=>s.removeEventListener("keydown",n),t)};function NS(e){return lx(e)&&!bE()}const CS=new WeakSet;function V9(e,t,s={}){const[n,o,l]=xE(e,s),u=h=>{const m=h.currentTarget;if(!NS(h)||CS.has(h))return;ch.add(m),s.stopPropagation&&CS.add(h);const d=t(m,h),p=(v,w)=>{window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",b),ch.has(m)&&ch.delete(m),NS(v)&&typeof d=="function"&&d(v,{success:w})},g=v=>{p(v,m===window||m===document||s.useGlobalTarget||vE(m,v.target))},b=v=>{p(v,!1)};window.addEventListener("pointerup",g,o),window.addEventListener("pointercancel",b,o)};return n.forEach(h=>{(s.useGlobalTarget?window:h).addEventListener("pointerdown",u,o),z9(h)&&(h.addEventListener("focus",d=>q9(d,o)),!H9(h)&&!h.hasAttribute("tabindex")&&(h.tabIndex=0))}),l}function cx(e){return SC(e)&&"ownerSVGElement"in e}const uh=new WeakMap;let dh;const _E=(e,t,s)=>(n,o)=>o&&o[0]?o[0][e+"Size"]:cx(n)&&"getBBox"in n?n.getBBox()[t]:n[s],G9=_E("inline","width","offsetWidth"),W9=_E("block","height","offsetHeight");function K9({target:e,borderBoxSize:t}){uh.get(e)?.forEach(s=>{s(e,{get width(){return G9(e,t)},get height(){return W9(e,t)}})})}function Y9(e){e.forEach(K9)}function X9(){typeof ResizeObserver>"u"||(dh=new ResizeObserver(Y9))}function Z9(e,t){dh||X9();const s=pE(e);return s.forEach(n=>{let o=uh.get(n);o||(o=new Set,uh.set(n,o)),o.add(t),dh?.observe(n)}),()=>{s.forEach(n=>{const o=uh.get(n);o?.delete(t),o?.size||dh?.unobserve(n)})}}const hh=new Set;let Qo;function Q9(){Qo=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};hh.forEach(t=>t(e))},window.addEventListener("resize",Qo)}function J9(e){return hh.add(e),Qo||Q9(),()=>{hh.delete(e),!hh.size&&typeof Qo=="function"&&(window.removeEventListener("resize",Qo),Qo=void 0)}}function ES(e,t){return typeof e=="function"?J9(e):Z9(e,t)}function ez(e){return cx(e)&&e.tagName==="svg"}const tz=[...hE,ks,Ni],sz=e=>tz.find(dE(e)),jS=()=>({translate:0,scale:1,origin:0,originPoint:0}),Jo=()=>({x:jS(),y:jS()}),TS=()=>({min:0,max:0}),Ds=()=>({x:TS(),y:TS()}),nz=new WeakMap;function uf(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function Kc(e){return typeof e=="string"||Array.isArray(e)}const ux=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],dx=["initial",...ux];function df(e){return uf(e.animate)||dx.some(t=>Kc(e[t]))}function yE(e){return!!(df(e)||e.variants)}function iz(e,t,s){for(const n in t){const o=t[n],l=s[n];if(Zs(o))e.addValue(n,o);else if(Zs(l))e.addValue(n,ol(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,ol(u!==void 0?u:o,{owner:e}))}}for(const n in s)t[n]===void 0&&e.removeValue(n);return t}const E0={current:null},SE={current:!1},rz=typeof window<"u";function az(){if(SE.current=!0,!!rz)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>E0.current=e.matches;e.addEventListener("change",t),t()}else E0.current=!1}const AS=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Mh={};function wE(e){Mh=e}function oz(){return Mh}class lz{scrapeMotionValuesFromProps(t,s,n){return{}}constructor({parent:t,props:s,presenceContext:n,reducedMotionConfig:o,skipAnimations:l,blockInitialAnimation:u,visualState:h},m={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=tx,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=gn.now();this.renderScheduledAt<v&&(this.renderScheduledAt=v,Vt.render(this.render,!1,!0))};const{latestValues:d,renderState:p}=h;this.latestValues=d,this.baseTarget={...d},this.initialValues=s.initial?{...d}:{},this.renderState=p,this.parent=t,this.props=s,this.presenceContext=n,this.depth=t?t.depth+1:0,this.reducedMotionConfig=o,this.skipAnimationsConfig=l,this.options=m,this.blockInitialAnimation=!!u,this.isControllingVariants=df(s),this.isVariantNode=yE(s),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:g,...b}=this.scrapeMotionValuesFromProps(s,{},this);for(const v in b){const w=b[v];d[v]!==void 0&&Zs(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,nz.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:(SE.current||az(),this.shouldReduceMotion=E0.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(),ga(this.notifyUpdate),ga(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&&nE.has(t)&&this.current instanceof HTMLElement){const{factory:u,keyframes:h,times:m,ease:d,duration:p}=s.accelerate,g=new tE({element:this.current,name:t,keyframes:h,times:m,ease:d,duration:Wn(p)}),b=u(g);this.valueSubscriptions.set(t,()=>{b(),g.cancel()});return}const n=fl.has(t);n&&this.onBindTransform&&this.onBindTransform();const o=s.on("change",u=>{this.latestValues[t]=u,this.props.onUpdate&&Vt.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 Mh){const s=Mh[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):Ds()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,s){this.latestValues[t]=s}update(t,s){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=s;for(let n=0;n<AS.length;n++){const o=AS[n];this.propEventSubscriptions[o]&&(this.propEventSubscriptions[o](),delete this.propEventSubscriptions[o]);const l="on"+o,u=t[l];u&&(this.propEventSubscriptions[o]=this.on(o,u))}this.prevMotionValues=iz(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=ol(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"&&(yC(n)||wC(n))?n=parseFloat(n):!sz(n)&&Ni.test(s)&&(n=mE(t,s)),this.setBaseTarget(t,Zs(n)?n.get():n)),Zs(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=ix(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&&!Zs(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 Gb),this.events[t].add(s)}notify(t,...s){this.events[t]&&this.events[t].notify(...s)}scheduleRenderMicrotask(){ox.render(this.render)}}class kE extends lz{constructor(){super(...arguments),this.KeyframeResolver=L9}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;Zs(t)&&(this.childSubscription=t.on("change",s=>{this.current&&(this.current.textContent=`${s}`)}))}}class xa{constructor(t){this.isMounted=!1,this.node=t}update(){}}function NE({top:e,left:t,right:s,bottom:n}){return{x:{min:t,max:s},y:{min:e,max:n}}}function cz({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function uz(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 Kp(e){return e===void 0||e===1}function j0({scale:e,scaleX:t,scaleY:s}){return!Kp(e)||!Kp(t)||!Kp(s)}function qa(e){return j0(e)||CE(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function CE(e){return RS(e.x)||RS(e.y)}function RS(e){return e&&e!=="0%"}function Dh(e,t,s){const n=e-s,o=t*n;return s+o}function MS(e,t,s,n,o){return o!==void 0&&(e=Dh(e,o,n)),Dh(e,s,n)+t}function T0(e,t=0,s=1,n,o){e.min=MS(e.min,t,s,n,o),e.max=MS(e.max,t,s,n,o)}function EE(e,{x:t,y:s}){T0(e.x,t.translate,t.scale,t.originPoint),T0(e.y,s.translate,s.scale,s.originPoint)}const DS=.999999999999,OS=1.0000000000001;function dz(e,t,s,n=!1){const o=s.length;if(!o)return;t.x=t.y=1;let l,u;for(let h=0;h<o;h++){l=s[h],u=l.projectionDelta;const{visualElement:m}=l.options;m&&m.props.style&&m.props.style.display==="contents"||(n&&l.options.layoutScroll&&l.scroll&&l!==l.root&&(Fi(e.x,-l.scroll.offset.x),Fi(e.y,-l.scroll.offset.y)),u&&(t.x*=u.x.scale,t.y*=u.y.scale,EE(e,u)),n&&qa(l.latestValues)&&fh(e,l.latestValues,l.layout?.layoutBox))}t.x<OS&&t.x>DS&&(t.x=1),t.y<OS&&t.y>DS&&(t.y=1)}function Fi(e,t){e.min+=t,e.max+=t}function LS(e,t,s,n,o=.5){const l=Zt(e.min,e.max,o);T0(e,t,s,l,n)}function zS(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function fh(e,t,s){const n=s??e;LS(e.x,zS(t.x,n.x),t.scaleX,t.scale,t.originX),LS(e.y,zS(t.y,n.y),t.scaleY,t.scale,t.originY)}function jE(e,t){return NE(uz(e.getBoundingClientRect(),t))}function hz(e,t,s){const n=jE(e,s),{scroll:o}=t;return o&&(Fi(n.x,o.offset.x),Fi(n.y,o.offset.y)),n}const fz={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},mz=hl.length;function pz(e,t,s){let n="",o=!0;for(let l=0;l<mz;l++){const u=hl[l],h=e[u];if(h===void 0)continue;let m=!0;if(typeof h=="number")m=h===(u.startsWith("scale")?1:0);else{const d=parseFloat(h);m=u.startsWith("scale")?d===1:d===0}if(!m||s){const d=gE(h,ax[u]);if(!m){o=!1;const p=fz[u]||u;n+=`${p}(${d}) `}s&&(t[u]=d)}}return n=n.trim(),s?n=s(t,o?"":n):o&&(n="none"),n}function hx(e,t,s){const{style:n,vars:o,transformOrigin:l}=e;let u=!1,h=!1;for(const m in t){const d=t[m];if(fl.has(m)){u=!0;continue}else if(IC(m)){o[m]=d;continue}else{const p=gE(d,ax[m]);m.startsWith("origin")?(h=!0,l[m]=p):n[m]=p}}if(t.transform||(u||s?n.transform=pz(t,e.transform,s):n.transform&&(n.transform="none")),h){const{originX:m="50%",originY:d="50%",originZ:p=0}=l;n.transformOrigin=`${m} ${d} ${p}`}}function TE(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 mc={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}%`}},gz={correct:(e,{treeScale:t,projectionDelta:s})=>{const n=e,o=Ni.parse(e);if(o.length>5)return n;const l=Ni.createTransformer(e),u=typeof o[0]!="number"?1:0,h=s.x.scale*t.x,m=s.y.scale*t.y;o[0+u]/=h,o[1+u]/=m;const d=Zt(h,m,.5);return typeof o[2+u]=="number"&&(o[2+u]/=d),typeof o[3+u]=="number"&&(o[3+u]/=d),l(o)}},A0={borderRadius:{...mc,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:mc,borderTopRightRadius:mc,borderBottomLeftRadius:mc,borderBottomRightRadius:mc,boxShadow:gz};function AE(e,{layout:t,layoutId:s}){return fl.has(e)||e.startsWith("origin")||(t||s!==void 0)&&(!!A0[e]||e==="opacity")}function fx(e,t,s){const n=e.style,o=t?.style,l={};if(!n)return l;for(const u in n)(Zs(n[u])||o&&Zs(o[u])||AE(u,e)||s?.getValue(u)?.liveStyle!==void 0)&&(l[u]=n[u]);return l}function bz(e){return window.getComputedStyle(e)}class xz extends kE{constructor(){super(...arguments),this.type="html",this.renderInstance=TE}readValueFromInstance(t,s){if(fl.has(s))return this.projection?.isProjecting?g0(s):B7(t,s);{const n=bz(t),o=(IC(s)?n.getPropertyValue(s):n[s])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(t,{transformPagePoint:s}){return jE(t,s)}build(t,s,n){hx(t,s,n.transformTemplate)}scrapeMotionValuesFromProps(t,s,n){return fx(t,s,n)}}const vz={offset:"stroke-dashoffset",array:"stroke-dasharray"},_z={offset:"strokeDashoffset",array:"strokeDasharray"};function yz(e,t,s=1,n=0,o=!0){e.pathLength=1;const l=o?vz:_z;e[l.offset]=`${-n}`,e[l.array]=`${t} ${s}`}const Sz=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function RE(e,{attrX:t,attrY:s,attrScale:n,pathLength:o,pathSpacing:l=1,pathOffset:u=0,...h},m,d,p){if(hx(e,h,d),m){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:g,style:b}=e;g.transform&&(b.transform=g.transform,delete g.transform),(b.transform||g.transformOrigin)&&(b.transformOrigin=g.transformOrigin??"50% 50%",delete g.transformOrigin),b.transform&&(b.transformBox=p?.transformBox??"fill-box",delete g.transformBox);for(const v of Sz)g[v]!==void 0&&(b[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&&yz(g,o,l,u,!1)}const ME=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"]),DE=e=>typeof e=="string"&&e.toLowerCase()==="svg";function wz(e,t,s,n){TE(e,t,void 0,n);for(const o in t.attrs)e.setAttribute(ME.has(o)?o:rx(o),t.attrs[o])}function OE(e,t,s){const n=fx(e,t,s);for(const o in e)if(Zs(e[o])||Zs(t[o])){const l=hl.indexOf(o)!==-1?"attr"+o.charAt(0).toUpperCase()+o.substring(1):o;n[l]=e[o]}return n}class kz extends kE{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Ds}getBaseTargetFromProps(t,s){return t[s]}readValueFromInstance(t,s){if(fl.has(s)){const n=fE(s);return n&&n.default||0}return s=ME.has(s)?s:rx(s),t.getAttribute(s)}scrapeMotionValuesFromProps(t,s,n){return OE(t,s,n)}build(t,s,n){RE(t,s,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(t,s,n,o){wz(t,s,n,o)}mount(t){this.isSVGTag=DE(t.tagName),super.mount(t)}}const Nz=dx.length;function LE(e){if(!e)return;if(!e.isControllingVariants){const s=e.parent?LE(e.parent)||{}:{};return e.props.initial!==void 0&&(s.initial=e.props.initial),s}const t={};for(let s=0;s<Nz;s++){const n=dx[s],o=e.props[n];(Kc(o)||o===!1)&&(t[n]=o)}return t}function zE(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 Cz=[...ux].reverse(),Ez=ux.length;function jz(e){return t=>Promise.all(t.map(({animation:s,options:n})=>k9(e,s,n)))}function Tz(e){let t=jz(e),s=IS(),n=!0,o=!1;const l=d=>(p,g)=>{const b=Ja(e,g,d==="exit"?e.presenceContext?.custom:void 0);if(b){const{transition:v,transitionEnd:w,...k}=b;p={...p,...k,...w}}return p};function u(d){t=d(e)}function h(d){const{props:p}=e,g=LE(e.parent)||{},b=[],v=new Set;let w={},k=1/0;for(let E=0;E<Ez;E++){const A=Cz[E],j=s[A],T=p[A]!==void 0?p[A]:g[A],P=Kc(T),z=A===d?j.isActive:null;z===!1&&(k=E);let L=T===g[A]&&T!==p[A]&&P;if(L&&(n||o)&&e.manuallyAnimateOnMount&&(L=!1),j.protectedKeys={...w},!j.isActive&&z===null||!T&&!j.prevProp||uf(T)||typeof T=="boolean")continue;if(A==="exit"&&j.isActive&&z!==!0){j.prevResolvedValues&&(w={...w,...j.prevResolvedValues});continue}const R=Az(j.prevProp,T);let D=R||A===d&&j.isActive&&!L&&P||E>k&&P,I=!1;const V=Array.isArray(T)?T:[T];let X=V.reduce(l(A),{});z===!1&&(X={});const{prevResolvedValues:$={}}=j,W={...$,...X},q=U=>{D=!0,v.has(U)&&(I=!0,v.delete(U)),j.needsAnimating[U]=!0;const K=e.getValue(U);K&&(K.liveStyle=!1)};for(const U in W){const K=X[U],Y=$[U];if(w.hasOwnProperty(U))continue;let F=!1;S0(K)&&S0(Y)?F=!zE(K,Y):F=K!==Y,F?K!=null?q(U):v.add(U):K!==void 0&&v.has(U)?q(U):j.protectedKeys[U]=!0}j.prevProp=T,j.prevResolvedValues=X,j.isActive&&(w={...w,...X}),(n||o)&&e.blockInitialAnimation&&(D=!1);const B=L&&R;D&&(!B||I)&&b.push(...V.map(U=>{const K={type:A};if(typeof U=="string"&&(n||o)&&!B&&e.manuallyAnimateOnMount&&e.parent){const{parent:Y}=e,F=Ja(Y,U);if(Y.enteringChildren&&F){const{delayChildren:ie}=F.transition||{};K.delay=iE(Y.enteringChildren,e,ie)}}return{animation:U,options:K}}))}if(v.size){const E={};if(typeof p.initial!="boolean"){const A=Ja(e,Array.isArray(p.initial)?p.initial[0]:p.initial);A&&A.transition&&(E.transition=A.transition)}v.forEach(A=>{const j=e.getBaseTarget(A),T=e.getValue(A);T&&(T.liveStyle=!0),E[A]=j??null}),b.push({animation:E})}let N=!!b.length;return n&&(p.initial===!1||p.initial===p.animate)&&!e.manuallyAnimateOnMount&&(N=!1),n=!1,o=!1,N?t(b):Promise.resolve()}function m(d,p){if(s[d].isActive===p)return Promise.resolve();e.variantChildren?.forEach(b=>b.animationState?.setActive(d,p)),s[d].isActive=p;const g=h(d);for(const b in s)s[b].protectedKeys={};return g}return{animateChanges:h,setActive:m,setAnimateFunction:u,getState:()=>s,reset:()=>{s=IS(),o=!0}}}function Az(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!zE(t,e):!1}function $a(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function IS(){return{animate:$a(!0),whileInView:$a(),whileHover:$a(),whileTap:$a(),whileDrag:$a(),whileFocus:$a(),exit:$a()}}function R0(e,t){e.min=t.min,e.max=t.max}function _i(e,t){R0(e.x,t.x),R0(e.y,t.y)}function PS(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const BE=1e-4,Rz=1-BE,Mz=1+BE,IE=.01,Dz=0-IE,Oz=0+IE;function bn(e){return e.max-e.min}function Lz(e,t,s){return Math.abs(e-t)<=s}function $S(e,t,s,n=.5){e.origin=n,e.originPoint=Zt(t.min,t.max,e.origin),e.scale=bn(s)/bn(t),e.translate=Zt(s.min,s.max,e.origin)-e.originPoint,(e.scale>=Rz&&e.scale<=Mz||isNaN(e.scale))&&(e.scale=1),(e.translate>=Dz&&e.translate<=Oz||isNaN(e.translate))&&(e.translate=0)}function Ic(e,t,s,n){$S(e.x,t.x,s.x,n?n.originX:void 0),$S(e.y,t.y,s.y,n?n.originY:void 0)}function HS(e,t,s,n=0){const o=n?Zt(s.min,s.max,n):s.min;e.min=o+t.min,e.max=e.min+bn(t)}function zz(e,t,s,n){HS(e.x,t.x,s.x,n?.x),HS(e.y,t.y,s.y,n?.y)}function US(e,t,s,n=0){const o=n?Zt(s.min,s.max,n):s.min;e.min=t.min-o,e.max=e.min+bn(t)}function Oh(e,t,s,n){US(e.x,t.x,s.x,n?.x),US(e.y,t.y,s.y,n?.y)}function FS(e,t,s,n,o){return e-=t,e=Dh(e,1/s,n),o!==void 0&&(e=Dh(e,1/o,n)),e}function Bz(e,t=0,s=1,n=.5,o,l=e,u=e){if(Vi.test(t)&&(t=parseFloat(t),t=Zt(u.min,u.max,t/100)-u.min),typeof t!="number")return;let h=Zt(l.min,l.max,n);e===l&&(h-=t),e.min=FS(e.min,t,s,h,o),e.max=FS(e.max,t,s,h,o)}function qS(e,t,[s,n,o],l,u){Bz(e,t[s],t[n],t[o],t.scale,l,u)}const Iz=["x","scaleX","originX"],Pz=["y","scaleY","originY"];function VS(e,t,s,n){qS(e.x,t,Iz,s?s.x:void 0,n?n.x:void 0),qS(e.y,t,Pz,s?s.y:void 0,n?n.y:void 0)}function GS(e){return e.translate===0&&e.scale===1}function PE(e){return GS(e.x)&&GS(e.y)}function WS(e,t){return e.min===t.min&&e.max===t.max}function $z(e,t){return WS(e.x,t.x)&&WS(e.y,t.y)}function KS(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function $E(e,t){return KS(e.x,t.x)&&KS(e.y,t.y)}function YS(e){return bn(e.x)/bn(e.y)}function XS(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Ui(e){return[e("x"),e("y")]}function Hz(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:b,skewX:v,skewY:w}=s;d&&(n=`perspective(${d}px) ${n}`),p&&(n+=`rotate(${p}deg) `),g&&(n+=`rotateX(${g}deg) `),b&&(n+=`rotateY(${b}deg) `),v&&(n+=`skewX(${v}deg) `),w&&(n+=`skewY(${w}deg) `)}const h=e.x.scale*t.x,m=e.y.scale*t.y;return(h!==1||m!==1)&&(n+=`scale(${h}, ${m})`),n||"none"}const HE=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],Uz=HE.length,ZS=e=>typeof e=="string"?parseFloat(e):e,QS=e=>typeof e=="number"||Ye.test(e);function Fz(e,t,s,n,o,l){o?(e.opacity=Zt(0,s.opacity??1,qz(n)),e.opacityExit=Zt(t.opacity??1,0,Vz(n))):l&&(e.opacity=Zt(t.opacity??1,s.opacity??1,n));for(let u=0;u<Uz;u++){const h=HE[u];let m=JS(t,h),d=JS(s,h);if(m===void 0&&d===void 0)continue;m||(m=0),d||(d=0),m===0||d===0||QS(m)===QS(d)?(e[h]=Math.max(Zt(ZS(m),ZS(d),n),0),(Vi.test(d)||Vi.test(m))&&(e[h]+="%")):e[h]=d}(t.rotate||s.rotate)&&(e.rotate=Zt(t.rotate||0,s.rotate||0,n))}function JS(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const qz=UE(0,.5,MC),Vz=UE(.5,.95,di);function UE(e,t,s){return n=>n<e?0:n>t?1:s(Gc(e,t,n))}function Gz(e,t,s){const n=Zs(e)?e:ol(e);return n.start(nx("",n,t,s)),n.animation}function Yc(e,t,s,n={passive:!0}){return e.addEventListener(t,s,n),()=>e.removeEventListener(t,s)}const Wz=(e,t)=>e.depth-t.depth;class Kz{constructor(){this.children=[],this.isDirty=!1}add(t){qb(this.children,t),this.isDirty=!0}remove(t){Eh(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(Wz),this.isDirty=!1,this.children.forEach(t)}}function Yz(e,t){const s=gn.now(),n=({timestamp:o})=>{const l=o-s;l>=t&&(ga(n),e(l-t))};return Vt.setup(n,!0),()=>ga(n)}function mh(e){return Zs(e)?e.get():e}class Xz{constructor(){this.members=[]}add(t){qb(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&&(Eh(this.members,n),n.unmount())}t.scheduleRender()}remove(t){if(Eh(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 ph={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Yp=["","X","Y","Z"],Zz=1e3;let Qz=0;function Xp(e,t,s,n){const{latestValues:o}=t;o[e]&&(s[e]=o[e],t.setStaticValue(e,0),n&&(n[e]=0))}function FE(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const s=cE(t);if(window.MotionHasOptimisedAnimation(s,"transform")){const{layout:o,layoutId:l}=e.options;window.MotionCancelOptimisedAnimation(s,"transform",Vt,!(o||l))}const{parent:n}=e;n&&!n.hasCheckedOptimisedAppear&&FE(n)}function qE({attachResizeListener:e,defaultParent:t,measureScroll:s,checkIsScrollRoot:n,resetTransform:o}){return class{constructor(u={},h=t?.()){this.id=Qz++,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(tB),this.nodes.forEach(oB),this.nodes.forEach(lB),this.nodes.forEach(sB)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=u,this.root=h?h.root||h:this,this.path=h?[...h.path,h]:[],this.parent=h,this.depth=h?h.depth+1:0;for(let m=0;m<this.path.length;m++)this.path[m].shouldResetTransform=!0;this.root===this&&(this.nodes=new Kz)}addEventListener(u,h){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new Gb),this.eventHandlers.get(u).add(h)}notifyListeners(u,...h){const m=this.eventHandlers.get(u);m&&m.notify(...h)}hasListeners(u){return this.eventHandlers.has(u)}mount(u){if(this.instance)return;this.isSVG=cx(u)&&!ez(u),this.instance=u;const{layoutId:h,layout:m,visualElement:d}=this.options;if(d&&!d.current&&d.mount(u),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(m||h)&&(this.isLayoutDirty=!0),e){let p,g=0;const b=()=>this.root.updateBlockedByResize=!1;Vt.read(()=>{g=window.innerWidth}),e(u,()=>{const v=window.innerWidth;v!==g&&(g=v,this.root.updateBlockedByResize=!0,p&&p(),p=Yz(b,250),ph.hasAnimatedSinceResize&&(ph.hasAnimatedSinceResize=!1,this.nodes.forEach(sw)))})}h&&this.root.registerSharedNode(h,this),this.options.animate!==!1&&d&&(h||m)&&this.addEventListener("didUpdate",({delta:p,hasLayoutChanged:g,hasRelativeLayoutChanged:b,layout:v})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const w=this.options.transition||d.getDefaultTransition()||fB,{onLayoutAnimationStart:k,onLayoutAnimationComplete:N}=d.getProps(),E=!this.targetLayout||!$E(this.targetLayout,v),A=!g&&b;if(this.options.layoutRoot||this.resumeFrom||A||g&&(E||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const j={...sx(w,"layout"),onPlay:k,onComplete:N};(d.shouldReduceMotion||this.options.layoutRoot)&&(j.delay=0,j.type=!1),this.startAnimation(j),this.setAnimationOrigin(p,A)}else g||sw(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(),ga(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(cB),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&&FE(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let p=0;p<this.path.length;p++){const g=this.path[p];g.shouldResetTransform=!0,(typeof g.latestValues.x=="string"||typeof g.latestValues.y=="string")&&(g.isLayoutDirty=!0),g.updateScroll("snapshot"),g.options.layoutRoot&&g.willUpdate(!1)}const{layoutId:h,layout:m}=this.options;if(h===void 0&&!m)return;const d=this.getTransformTemplate();this.prevTransformTemplateValue=d?d(this.latestValues,""):void 0,this.updateSnapshot(),u&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const m=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),m&&this.nodes.forEach(iB),this.nodes.forEach(ew);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(tw);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(rB),this.nodes.forEach(aB),this.nodes.forEach(Jz),this.nodes.forEach(eB)):this.nodes.forEach(tw),this.clearAllSnapshots();const h=gn.now();Ys.delta=Wi(0,1e3/60,h-Ys.timestamp),Ys.timestamp=h,Ys.isProcessing=!0,Hp.update.process(Ys),Hp.preRender.process(Ys),Hp.render.process(Ys),Ys.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,ox.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(nB),this.sharedNodes.forEach(uB)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Vt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Vt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!bn(this.snapshot.measuredBox.x)&&!bn(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let m=0;m<this.path.length;m++)this.path[m].updateScroll();const u=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=Ds()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:h}=this.options;h&&h.notify("LayoutMeasure",this.layout.layoutBox,u?u.layoutBox:void 0)}updateScroll(u="measure"){let h=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===u&&(h=!1),h&&this.instance){const m=n(this.instance);this.scroll={animationId:this.root.animationId,phase:u,isRoot:m,offset:s(this.instance),wasRoot:this.scroll?this.scroll.isRoot:m}}}resetTransform(){if(!o)return;const u=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,h=this.projectionDelta&&!PE(this.projectionDelta),m=this.getTransformTemplate(),d=m?m(this.latestValues,""):void 0,p=d!==this.prevTransformTemplateValue;u&&this.instance&&(h||qa(this.latestValues)||p)&&(o(this.instance,d),this.shouldResetTransform=!1,this.scheduleRender())}measure(u=!0){const h=this.measurePageBox();let m=this.removeElementScroll(h);return u&&(m=this.removeTransform(m)),mB(m),{animationId:this.root.animationId,measuredBox:h,layoutBox:m,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:u}=this.options;if(!u)return Ds();const h=u.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(pB))){const{scroll:d}=this.root;d&&(Fi(h.x,d.offset.x),Fi(h.y,d.offset.y))}return h}removeElementScroll(u){const h=Ds();if(_i(h,u),this.scroll?.wasRoot)return h;for(let m=0;m<this.path.length;m++){const d=this.path[m],{scroll:p,options:g}=d;d!==this.root&&p&&g.layoutScroll&&(p.wasRoot&&_i(h,u),Fi(h.x,p.offset.x),Fi(h.y,p.offset.y))}return h}applyTransform(u,h=!1,m){const d=m||Ds();_i(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&&(Fi(d.x,-g.scroll.offset.x),Fi(d.y,-g.scroll.offset.y)),qa(g.latestValues)&&fh(d,g.latestValues,g.layout?.layoutBox)}return qa(this.latestValues)&&fh(d,this.latestValues,this.layout?.layoutBox),d}removeTransform(u){const h=Ds();_i(h,u);for(let m=0;m<this.path.length;m++){const d=this.path[m];if(!qa(d.latestValues))continue;let p;d.instance&&(j0(d.latestValues)&&d.updateSnapshot(),p=Ds(),_i(p,d.measurePageBox())),VS(h,d.latestValues,d.snapshot?.layoutBox,p)}return qa(this.latestValues)&&VS(h,this.latestValues),h}setTargetDelta(u){this.targetDelta=u,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(u){this.options={...this.options,...u,crossfade:u.crossfade!==void 0?u.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Ys.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(u=!1){const h=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=h.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=h.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=h.isSharedProjectionDirty);const m=!!this.resumingFrom||this!==h;if(!(u||m&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:p,layoutId:g}=this.options;if(!this.layout||!(p||g))return;this.resolvedRelativeTargetAt=Ys.timestamp;const b=this.getClosestProjectingParent();b&&this.linkedParentVersion!==b.layoutVersion&&!b.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&b&&b.layout?this.createRelativeTarget(b,this.layout.layoutBox,b.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Ds(),this.targetWithTransforms=Ds()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),zz(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):_i(this.target,this.layout.layoutBox),EE(this.target,this.targetDelta)):_i(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&b&&!!b.resumingFrom==!!this.resumingFrom&&!b.options.layoutScroll&&b.target&&this.animationProgress!==1?this.createRelativeTarget(b,this.target,b.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||j0(this.parent.latestValues)||CE(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(u,h,m){this.relativeParent=u,this.linkedParentVersion=u.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Ds(),this.relativeTargetOrigin=Ds(),Oh(this.relativeTargetOrigin,h,m,this.options.layoutAnchor||void 0),_i(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const u=this.getLead(),h=!!this.resumingFrom||this!==u;let m=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(m=!1),h&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(m=!1),this.resolvedRelativeTargetAt===Ys.timestamp&&(m=!1),m)return;const{layout:d,layoutId:p}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(d||p))return;_i(this.layoutCorrected,this.layout.layoutBox);const g=this.treeScale.x,b=this.treeScale.y;dz(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=Ds());const{target:v}=u;if(!v){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(PS(this.prevProjectionDelta.x,this.projectionDelta.x),PS(this.prevProjectionDelta.y,this.projectionDelta.y)),Ic(this.projectionDelta,this.layoutCorrected,v,this.latestValues),(this.treeScale.x!==g||this.treeScale.y!==b||!XS(this.projectionDelta.x,this.prevProjectionDelta.x)||!XS(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=Jo(),this.projectionDelta=Jo(),this.projectionDeltaWithTransform=Jo()}setAnimationOrigin(u,h=!1){const m=this.snapshot,d=m?m.latestValues:{},p={...this.latestValues},g=Jo();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!h;const b=Ds(),v=m?m.source:void 0,w=this.layout?this.layout.source:void 0,k=v!==w,N=this.getStack(),E=!N||N.members.length<=1,A=!!(k&&!E&&this.options.crossfade===!0&&!this.path.some(hB));this.animationProgress=0;let j;this.mixTargetDelta=T=>{const P=T/1e3;nw(g.x,u.x,P),nw(g.y,u.y,P),this.setTargetDelta(g),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Oh(b,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),dB(this.relativeTarget,this.relativeTargetOrigin,b,P),j&&$z(this.relativeTarget,j)&&(this.isProjectionDirty=!1),j||(j=Ds()),_i(j,this.relativeTarget)),k&&(this.animationValues=p,Fz(p,d,this.latestValues,P,A,E)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=P},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(u){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(ga(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Vt.update(()=>{ph.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=ol(0)),this.motionValue.jump(0,!1),this.currentAnimation=Gz(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(Zz),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const u=this.getLead();let{targetWithTransforms:h,target:m,layout:d,latestValues:p}=u;if(!(!h||!m||!d)){if(this!==u&&this.layout&&d&&VE(this.options.animationType,this.layout.layoutBox,d.layoutBox)){m=this.target||Ds();const g=bn(this.layout.layoutBox.x);m.x.min=u.target.x.min,m.x.max=m.x.min+g;const b=bn(this.layout.layoutBox.y);m.y.min=u.target.y.min,m.y.max=m.y.min+b}_i(h,m),fh(h,p),Ic(this.projectionDeltaWithTransform,this.layoutCorrected,h,p)}}registerSharedNode(u,h){this.sharedNodes.has(u)||this.sharedNodes.set(u,new Xz),this.sharedNodes.get(u).add(h);const d=h.options.initialPromotionConfig;h.promote({transition:d?d.transition:void 0,preserveFollowOpacity:d&&d.shouldPreserveFollowOpacity?d.shouldPreserveFollowOpacity(h):void 0})}isLead(){const u=this.getStack();return u?u.lead===this:!0}getLead(){const{layoutId:u}=this.options;return u?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:u}=this.options;return u?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:u}=this.options;if(u)return this.root.sharedNodes.get(u)}promote({needsReset:u,transition:h,preserveFollowOpacity:m}={}){const d=this.getStack();d&&d.promote(this,m),u&&(this.projectionDelta=void 0,this.needsReset=!0),h&&this.setOptions({transition:h})}relegate(){const u=this.getStack();return u?u.relegate(this):!1}resetSkewAndRotation(){const{visualElement:u}=this.options;if(!u)return;let h=!1;const{latestValues:m}=u;if((m.z||m.rotate||m.rotateX||m.rotateY||m.rotateZ||m.skewX||m.skewY)&&(h=!0),!h)return;const d={};m.z&&Xp("z",u,d,this.animationValues);for(let p=0;p<Yp.length;p++)Xp(`rotate${Yp[p]}`,u,d,this.animationValues),Xp(`skew${Yp[p]}`,u,d,this.animationValues);u.render();for(const p in d)u.setStaticValue(p,d[p]),this.animationValues&&(this.animationValues[p]=d[p]);u.scheduleRender()}applyProjectionStyles(u,h){if(!this.instance||this.isSVG)return;if(!this.isVisible){u.visibility="hidden";return}const m=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,u.visibility="",u.opacity="",u.pointerEvents=mh(h?.pointerEvents)||"",u.transform=m?m(this.latestValues,""):"none";return}const d=this.getLead();if(!this.projectionDelta||!this.layout||!d.target){this.options.layoutId&&(u.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,u.pointerEvents=mh(h?.pointerEvents)||""),this.hasProjected&&!qa(this.latestValues)&&(u.transform=m?m({},""):"none",this.hasProjected=!1);return}u.visibility="";const p=d.animationValues||d.latestValues;this.applyTransformsToTarget();let g=Hz(this.projectionDeltaWithTransform,this.treeScale,p);m&&(g=m(p,g)),u.transform=g;const{x:b,y:v}=this.projectionDelta;u.transformOrigin=`${b.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 A0){if(p[w]===void 0)continue;const{correct:k,applyTo:N,isCSSVariable:E}=A0[w],A=g==="none"?p[w]:k(p[w],d);if(N){const j=N.length;for(let T=0;T<j;T++)u[N[T]]=A}else E?this.options.visualElement.renderState.vars[w]=A:u[w]=A}this.options.layoutId&&(u.pointerEvents=d===this?mh(h?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(u=>u.currentAnimation?.stop()),this.root.nodes.forEach(ew),this.root.sharedNodes.clear()}}}function Jz(e){e.updateLayout()}function eB(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")Ui(p=>{const g=l?t.measuredBox[p]:t.layoutBox[p],b=bn(g);g.min=s[p].min,g.max=g.min+b});else if(o==="x"||o==="y"){const p=o==="x"?"y":"x";R0(l?t.measuredBox[p]:t.layoutBox[p],s[p])}else VE(o,t.layoutBox,s)&&Ui(p=>{const g=l?t.measuredBox[p]:t.layoutBox[p],b=bn(s[p]);g.max=g.min+b,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[p].max=e.relativeTarget[p].min+b)});const u=Jo();Ic(u,s,t.layoutBox);const h=Jo();l?Ic(h,e.applyTransform(n,!0),t.measuredBox):Ic(h,s,t.layoutBox);const m=!PE(u);let d=!1;if(!e.resumeFrom){const p=e.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:g,layout:b}=p;if(g&&b){const v=e.options.layoutAnchor||void 0,w=Ds();Oh(w,t.layoutBox,g.layoutBox,v);const k=Ds();Oh(k,s,b.layoutBox,v),$E(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:m,hasRelativeLayoutChanged:d})}else if(e.isLead()){const{onExitComplete:s}=e.options;s&&s()}e.options.transition=void 0}function tB(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 sB(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function nB(e){e.clearSnapshot()}function ew(e){e.clearMeasurements()}function iB(e){e.isLayoutDirty=!0,e.updateLayout()}function tw(e){e.isLayoutDirty=!1}function rB(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function aB(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function sw(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function oB(e){e.resolveTargetDelta()}function lB(e){e.calcProjection()}function cB(e){e.resetSkewAndRotation()}function uB(e){e.removeLeadSnapshot()}function nw(e,t,s){e.translate=Zt(t.translate,0,s),e.scale=Zt(t.scale,1,s),e.origin=t.origin,e.originPoint=t.originPoint}function iw(e,t,s,n){e.min=Zt(t.min,s.min,n),e.max=Zt(t.max,s.max,n)}function dB(e,t,s,n){iw(e.x,t.x,s.x,n),iw(e.y,t.y,s.y,n)}function hB(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const fB={duration:.45,ease:[.4,0,.1,1]},rw=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),aw=rw("applewebkit/")&&!rw("chrome/")?Math.round:di;function ow(e){e.min=aw(e.min),e.max=aw(e.max)}function mB(e){ow(e.x),ow(e.y)}function VE(e,t,s){return e==="position"||e==="preserve-aspect"&&!Lz(YS(t),YS(s),.2)}function pB(e){return e!==e.root&&e.scroll?.wasRoot}const gB=qE({attachResizeListener:(e,t)=>Yc(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),Zp={current:void 0},GE=qE({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Zp.current){const e=new gB({});e.mount(window),e.setOptions({layoutScroll:!0}),Zp.current=e}return Zp.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),WE=y.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function bB(e=!0){const t=y.useContext(Fb);if(t===null)return[!0,null];const{isPresent:s,onExitComplete:n,register:o}=t,l=y.useId();y.useEffect(()=>{if(e)return o(l)},[e]);const u=y.useCallback(()=>e&&n&&n(l),[l,n,e]);return!s&&n?[!1,u]:[!0]}const KE=y.createContext({strict:!1}),lw={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let cw=!1;function xB(){if(cw)return;const e={};for(const t in lw)e[t]={isEnabled:s=>lw[t].some(n=>!!s[n])};wE(e),cw=!0}function YE(){return xB(),oz()}function vB(e){const t=YE();for(const s in e)t[s]={...t[s],...e[s]};wE(t)}const _B=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 Lh(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||_B.has(e)}let XE=e=>!Lh(e);function yB(e){typeof e=="function"&&(XE=t=>t.startsWith("on")?!Lh(t):e(t))}try{yB(require("@emotion/is-prop-valid").default)}catch{}function SB(e,t,s){const n={};for(const o in e)o==="values"&&typeof e.values=="object"||Zs(e[o])||(XE(o)||s===!0&&Lh(o)||!t&&!Lh(o)||e.draggable&&o.startsWith("onDrag"))&&(n[o]=e[o]);return n}const hf=y.createContext({});function wB(e,t){if(df(e)){const{initial:s,animate:n}=e;return{initial:s===!1||Kc(s)?s:void 0,animate:Kc(n)?n:void 0}}return e.inherit!==!1?t:{}}function kB(e){const{initial:t,animate:s}=wB(e,y.useContext(hf));return y.useMemo(()=>({initial:t,animate:s}),[uw(t),uw(s)])}function uw(e){return Array.isArray(e)?e.join(" "):e}const mx=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function ZE(e,t,s){for(const n in t)!Zs(t[n])&&!AE(n,s)&&(e[n]=t[n])}function NB({transformTemplate:e},t){return y.useMemo(()=>{const s=mx();return hx(s,t,e),Object.assign({},s.vars,s.style)},[t])}function CB(e,t){const s=e.style||{},n={};return ZE(n,s,e),Object.assign(n,NB(e,t)),n}function EB(e,t){const s={},n=CB(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 QE=()=>({...mx(),attrs:{}});function jB(e,t,s,n){const o=y.useMemo(()=>{const l=QE();return RE(l,t,DE(n),e.transformTemplate,e.style),{...l.attrs,style:{...l.style}}},[t]);if(e.style){const l={};ZE(l,e.style,e),o.style={...l,...o.style}}return o}const TB=["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 px(e){return typeof e!="string"||e.includes("-")?!1:!!(TB.indexOf(e)>-1||/[A-Z]/u.test(e))}function AB(e,t,s,{latestValues:n},o,l=!1,u){const m=(u??px(e)?jB:EB)(t,n,o,e),d=SB(t,typeof e=="string",l),p=e!==y.Fragment?{...d,...m,ref:s}:{},{children:g}=t,b=y.useMemo(()=>Zs(g)?g.get():g,[g]);return y.createElement(e,{...p,children:b})}function RB({scrapeMotionValuesFromProps:e,createRenderState:t},s,n,o){return{latestValues:MB(s,n,o,e),renderState:t()}}function MB(e,t,s,n){const o={},l=n(e,{});for(const b in l)o[b]=mh(l[b]);let{initial:u,animate:h}=e;const m=df(e),d=yE(e);t&&d&&!m&&e.inherit!==!1&&(u===void 0&&(u=t.initial),h===void 0&&(h=t.animate));let p=s?s.initial===!1:!1;p=p||u===!1;const g=p?h:u;if(g&&typeof g!="boolean"&&!uf(g)){const b=Array.isArray(g)?g:[g];for(let v=0;v<b.length;v++){const w=ix(e,b[v]);if(w){const{transitionEnd:k,transition:N,...E}=w;for(const A in E){let j=E[A];if(Array.isArray(j)){const T=p?j.length-1:0;j=j[T]}j!==null&&(o[A]=j)}for(const A in k)o[A]=k[A]}}}return o}const JE=e=>(t,s)=>{const n=y.useContext(hf),o=y.useContext(Fb),l=()=>RB(e,t,n,o);return s?l():TL(l)},DB=JE({scrapeMotionValuesFromProps:fx,createRenderState:mx}),OB=JE({scrapeMotionValuesFromProps:OE,createRenderState:QE}),LB=Symbol.for("motionComponentSymbol");function zB(e,t,s){const n=y.useRef(s);y.useInsertionEffect(()=>{n.current=s});const o=y.useRef(null);return y.useCallback(l=>{l&&e.onMount?.(l);const u=n.current;if(typeof u=="function")if(l){const h=u(l);typeof h=="function"&&(o.current=h)}else o.current?(o.current(),o.current=null):u(l);else u&&(u.current=l);t&&(l?t.mount(l):t.unmount())},[t])}const e3=y.createContext({});function Xo(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function BB(e,t,s,n,o,l){const{visualElement:u}=y.useContext(hf),h=y.useContext(KE),m=y.useContext(Fb),d=y.useContext(WE),p=d.reducedMotion,g=d.skipAnimations,b=y.useRef(null),v=y.useRef(!1);n=n||h.renderer,!b.current&&n&&(b.current=n(e,{visualState:t,parent:u,props:s,presenceContext:m,blockInitialAnimation:m?m.initial===!1:!1,reducedMotionConfig:p,skipAnimations:g,isSVG:l}),v.current&&b.current&&(b.current.manuallyAnimateOnMount=!0));const w=b.current,k=y.useContext(e3);w&&!w.projection&&o&&(w.type==="html"||w.type==="svg")&&IB(b.current,s,o,k);const N=y.useRef(!1);y.useInsertionEffect(()=>{w&&N.current&&w.update(s,m)});const E=s[lE],A=y.useRef(!!E&&typeof window<"u"&&!window.MotionHandoffIsComplete?.(E)&&window.MotionHasOptimisedAnimation?.(E));return RL(()=>{v.current=!0,w&&(N.current=!0,window.MotionIsMounted=!0,w.updateFeatures(),w.scheduleRenderMicrotask(),A.current&&w.animationState&&w.animationState.animateChanges())}),y.useEffect(()=>{w&&(!A.current&&w.animationState&&w.animationState.animateChanges(),A.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(E)}),A.current=!1),w.enteringChildren=void 0)}),w}function IB(e,t,s,n){const{layoutId:o,layout:l,drag:u,dragConstraints:h,layoutScroll:m,layoutRoot:d,layoutAnchor:p,layoutCrossfade:g}=t;e.projection=new s(e.latestValues,t["data-framer-portal-id"]?void 0:t3(e.parent)),e.projection.setOptions({layoutId:o,layout:l,alwaysMeasureLayout:!!u||h&&Xo(h),visualElement:e,animationType:typeof l=="string"?l:"both",initialPromotionConfig:n,crossfade:g,layoutScroll:m,layoutRoot:d,layoutAnchor:p})}function t3(e){if(e)return e.options.allowProjection!==!1?e.projection:t3(e.parent)}function Qp(e,{forwardMotionProps:t=!1,type:s}={},n,o){n&&vB(n);const l=s?s==="svg":px(e),u=l?OB:DB;function h(d,p){let g;const b={...y.useContext(WE),...d,layoutId:PB(d)},{isStatic:v}=b,w=kB(d),k=u(d,v);if(!v&&typeof window<"u"){$B();const N=HB(b);g=N.MeasureLayout,w.visualElement=BB(e,k,b,o,N.ProjectionNode,l)}return r.jsxs(hf.Provider,{value:w,children:[g&&w.visualElement?r.jsx(g,{visualElement:w.visualElement,...b}):null,AB(e,d,zB(k,w.visualElement,p),k,v,t,l)]})}h.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const m=y.forwardRef(h);return m[LB]=e,m}function PB({layoutId:e}){const t=y.useContext(_C).id;return t&&e!==void 0?t+"-"+e:e}function $B(e,t){y.useContext(KE).strict}function HB(e){const t=YE(),{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 UB(e,t){if(typeof Proxy>"u")return Qp;const s=new Map,n=(l,u)=>Qp(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,Qp(u,void 0,e,t)),s.get(u))})}const FB=(e,t)=>t.isSVG??px(e)?new kz(t):new xz(t,{allowProjection:e!==y.Fragment});class qB extends xa{constructor(t){super(t),t.animationState||(t.animationState=Tz(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();uf(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 VB=0;class GB extends xa{constructor(){super(...arguments),this.id=VB++,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=Ja(this.node,l,u);if(h){const{transition:m,transitionEnd:d,...p}=h;for(const g in p)this.node.getValue(g)?.jump(p[g])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const o=this.node.animationState.setActive("exit",!t);s&&!t&&o.then(()=>{this.isExitComplete=!0,s(this.id)})}mount(){const{register:t,onExitComplete:s}=this.node.presenceContext||{};s&&s(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const WB={animation:{Feature:qB},exit:{Feature:GB}};function au(e){return{point:{x:e.pageX,y:e.pageY}}}const KB=e=>t=>lx(t)&&e(t,au(t));function Pc(e,t,s,n){return Yc(e,t,KB(s),n)}const s3=({current:e})=>e?e.ownerDocument.defaultView:null,dw=(e,t)=>Math.abs(e-t);function YB(e,t){const s=dw(e.x,t.x),n=dw(e.y,t.y);return Math.sqrt(s**2+n**2)}const hw=new Set(["auto","scroll"]);class n3{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=Bd(this.lastRawMoveEventInfo,this.transformPagePoint));const v=Jp(this.lastMoveEventInfo,this.history),w=this.startEvent!==null,k=YB(v.offset,{x:0,y:0})>=this.distanceThreshold;if(!w&&!k)return;const{point:N}=v,{timestamp:E}=Ys;this.history.push({...N,timestamp:E});const{onStart:A,onMove:j}=this.handlers;w||(A&&A(this.lastMoveEvent,v),this.startEvent=this.lastMoveEvent),j&&j(this.lastMoveEvent,v)},this.handlePointerMove=(v,w)=>{this.lastMoveEvent=v,this.lastRawMoveEventInfo=w,this.lastMoveEventInfo=Bd(w,this.transformPagePoint),Vt.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 A=Jp(v.type==="pointercancel"?this.lastMoveEventInfo:Bd(w,this.transformPagePoint),this.history);this.startEvent&&k&&k(v,A),N&&N(v,A)},!lx(t))return;this.dragSnapToOrigin=l,this.handlers=s,this.transformPagePoint=n,this.distanceThreshold=u,this.contextWindow=o||window;const m=au(t),d=Bd(m,this.transformPagePoint),{point:p}=d,{timestamp:g}=Ys;this.history=[{...p,timestamp:g}];const{onSessionStart:b}=s;b&&b(t,Jp(d,this.history)),this.removeListeners=nu(Pc(this.contextWindow,"pointermove",this.handlePointerMove),Pc(this.contextWindow,"pointerup",this.handlePointerUp),Pc(this.contextWindow,"pointercancel",this.handlePointerUp)),h&&this.startScrollTracking(h)}startScrollTracking(t){let s=t.parentElement;for(;s;){const n=getComputedStyle(s);(hw.has(n.overflowX)||hw.has(n.overflowY))&&this.scrollPositions.set(s,{x:s.scrollLeft,y:s.scrollTop}),s=s.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const s=this.scrollPositions.get(t);if(!s)return;const n=t===window,o=n?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},l={x:o.x-s.x,y:o.y-s.y};l.x===0&&l.y===0||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=l.x,this.lastMoveEventInfo.point.y+=l.y):this.history.length>0&&(this.history[0].x-=l.x,this.history[0].y-=l.y),this.scrollPositions.set(t,o),Vt.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),ga(this.updatePoint)}}function Bd(e,t){return t?{point:t(e.point)}:e}function fw(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Jp({point:e},t){return{point:e,delta:fw(e,i3(t)),offset:fw(e,XB(t)),velocity:ZB(t,.1)}}function XB(e){return e[0]}function i3(e){return e[e.length-1]}function ZB(e,t){if(e.length<2)return{x:0,y:0};let s=e.length-1,n=null;const o=i3(e);for(;s>=0&&(n=e[s],!(o.timestamp-n.timestamp>Wn(t)));)s--;if(!n)return{x:0,y:0};n===e[0]&&e.length>2&&o.timestamp-n.timestamp>Wn(t)*2&&(n=e[1]);const l=ui(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 QB(e,{min:t,max:s},n){return t!==void 0&&e<t?e=n?Zt(t,e,n.min):Math.max(e,t):s!==void 0&&e>s&&(e=n?Zt(s,e,n.max):Math.min(e,s)),e}function mw(e,t,s){return{min:t!==void 0?e.min+t:void 0,max:s!==void 0?e.max+s-(e.max-e.min):void 0}}function JB(e,{top:t,left:s,bottom:n,right:o}){return{x:mw(e.x,s,o),y:mw(e.y,t,n)}}function pw(e,t){let s=t.min-e.min,n=t.max-e.max;return t.max-t.min<e.max-e.min&&([s,n]=[n,s]),{min:s,max:n}}function eI(e,t){return{x:pw(e.x,t.x),y:pw(e.y,t.y)}}function tI(e,t){let s=.5;const n=bn(e),o=bn(t);return o>n?s=Gc(t.min,t.max-n,e.min):n>o&&(s=Gc(e.min,e.max-o,t.min)),Wi(0,1,s)}function sI(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 M0=.35;function nI(e=M0){return e===!1?e=0:e===!0&&(e=M0),{x:gw(e,"left","right"),y:gw(e,"top","bottom")}}function gw(e,t,s){return{min:bw(e,t),max:bw(e,s)}}function bw(e,t){return typeof e=="number"?e:e[t]||0}const iI=new WeakMap;class rI{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=Ds(),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(au(g).point),this.stopAnimation()},u=(g,b)=>{const{drag:v,dragPropagation:w,onDragStart:k}=this.getProps();if(v&&!w&&(this.openDragLock&&this.openDragLock(),this.openDragLock=B9(v),!this.openDragLock))return;this.latestPointerEvent=g,this.latestPanInfo=b,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Ui(E=>{let A=this.getAxisMotionValue(E).get()||0;if(Vi.test(A)){const{projection:j}=this.visualElement;if(j&&j.layout){const T=j.layout.layoutBox[E];T&&(A=bn(T)*(parseFloat(A)/100))}}this.originPoint[E]=A}),k&&Vt.update(()=>k(g,b),!1,!0),w0(this.visualElement,"transform");const{animationState:N}=this.visualElement;N&&N.setActive("whileDrag",!0)},h=(g,b)=>{this.latestPointerEvent=g,this.latestPanInfo=b;const{dragPropagation:v,dragDirectionLock:w,onDirectionLock:k,onDrag:N}=this.getProps();if(!v&&!this.openDragLock)return;const{offset:E}=b;if(w&&this.currentDirection===null){this.currentDirection=oI(E),this.currentDirection!==null&&k&&k(this.currentDirection);return}this.updateAxis("x",b.point,E),this.updateAxis("y",b.point,E),this.visualElement.render(),N&&Vt.update(()=>N(g,b),!1,!0)},m=(g,b)=>{this.latestPointerEvent=g,this.latestPanInfo=b,this.stop(g,b),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 n3(t,{onSessionStart:l,onStart:u,onMove:h,onSessionEnd:m,resumeAnimation:d},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:p,distanceThreshold:n,contextWindow:s3(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&&Vt.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||!Id(t,o,this.currentDirection))return;const l=this.getAxisMotionValue(t);let u=this.originPoint[t]+n[t];this.constraints&&this.constraints[t]&&(u=QB(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&&Xo(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&n?this.constraints=JB(n.layoutBox,t):this.constraints=!1,this.elastic=nI(s),o!==this.constraints&&!Xo(t)&&n&&this.constraints&&!this.hasMutatedConstraints&&Ui(l=>{this.constraints!==!1&&this.getAxisMotionValue(l)&&(this.constraints[l]=sI(n.layoutBox[l],this.constraints[l]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:s}=this.getProps();if(!t||!Xo(t))return!1;const n=t.current,{projection:o}=this.visualElement;if(!o||!o.layout)return!1;const l=hz(n,o.root,this.visualElement.getTransformPagePoint());let u=eI(o.layout.layoutBox,l);if(s){const h=s(cz(u));this.hasMutatedConstraints=!!h,h&&(u=NE(h))}return u}startAnimation(t){const{drag:s,dragMomentum:n,dragElastic:o,dragTransition:l,dragSnapToOrigin:u,onDragTransitionEnd:h}=this.getProps(),m=this.constraints||{},d=Ui(p=>{if(!Id(p,s,this.currentDirection))return;let g=m&&m[p]||{};(u===!0||u===p)&&(g={min:0,max:0});const b=o?200:1e6,v=o?40:1e7,w={type:"inertia",velocity:n?t[p]:0,bounceStiffness:b,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 w0(this.visualElement,t),n.start(nx(t,n,0,s,this.visualElement,!1))}stopAnimation(){Ui(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){Ui(s=>{const{drag:n}=this.getProps();if(!Id(s,n,this.currentDirection))return;const{projection:o}=this.visualElement,l=this.getAxisMotionValue(s);if(o&&o.layout){const{min:u,max:h}=o.layout.layoutBox[s],m=l.get()||0;l.set(t[s]-Zt(u,h,.5)+m)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:s}=this.getProps(),{projection:n}=this.visualElement;if(!Xo(s)||!n||!this.constraints)return;this.stopAnimation();const o={x:0,y:0};Ui(u=>{const h=this.getAxisMotionValue(u);if(h&&this.constraints!==!1){const m=h.get();o[u]=tI({min:m,max:m},this.constraints[u])}});const{transformTemplate:l}=this.visualElement.getProps();this.visualElement.current.style.transform=l?l({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),Ui(u=>{if(!Id(u,t,null))return;const h=this.getAxisMotionValue(u),{min:m,max:d}=this.constraints[u];h.set(Zt(m,d,o[u]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;iI.set(this.visualElement,this);const t=this.visualElement.current,s=Pc(t,"pointerdown",d=>{const{drag:p,dragListener:g=!0}=this.getProps(),b=d.target,v=b!==t&&F9(b);p&&g&&!v&&this.start(d)});let n;const o=()=>{const{dragConstraints:d}=this.getProps();Xo(d)&&d.current&&(this.constraints=this.resolveRefConstraints(),n||(n=aI(t,d.current,()=>this.scalePositionWithinConstraints())))},{projection:l}=this.visualElement,u=l.addEventListener("measure",o);l&&!l.layout&&(l.root&&l.root.updateScroll(),l.updateLayout()),Vt.read(o);const h=Yc(window,"resize",()=>this.scalePositionWithinConstraints()),m=l.addEventListener("didUpdate",(({delta:d,hasLayoutChanged:p})=>{this.isDragging&&p&&(Ui(g=>{const b=this.getAxisMotionValue(g);b&&(this.originPoint[g]+=d[g].translate,b.set(b.get()+d[g].translate))}),this.visualElement.render())}));return()=>{h(),s(),u(),m&&m(),n&&n()}}getProps(){const t=this.visualElement.getProps(),{drag:s=!1,dragDirectionLock:n=!1,dragPropagation:o=!1,dragConstraints:l=!1,dragElastic:u=M0,dragMomentum:h=!0}=t;return{...t,drag:s,dragDirectionLock:n,dragPropagation:o,dragConstraints:l,dragElastic:u,dragMomentum:h}}}function xw(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function aI(e,t,s){const n=ES(e,xw(s)),o=ES(t,xw(s));return()=>{n(),o()}}function Id(e,t,s){return(t===!0||t===e)&&(s===null||s===e)}function oI(e,t=10){let s=null;return Math.abs(e.y)>t?s="y":Math.abs(e.x)>t&&(s="x"),s}class lI extends xa{constructor(t){super(t),this.removeGroupControls=di,this.removeListeners=di,this.controls=new rI(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||di}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 eg=e=>(t,s)=>{e&&Vt.update(()=>e(t,s),!1,!0)};class cI extends xa{constructor(){super(...arguments),this.removePointerDownListener=di}onPointerDown(t){this.session=new n3(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:s3(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:s,onPan:n,onPanEnd:o}=this.node.getProps();return{onSessionStart:eg(t),onStart:eg(s),onMove:eg(n),onEnd:(l,u)=>{delete this.session,o&&Vt.postRender(()=>o(l,u))}}}mount(){this.removePointerDownListener=Pc(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 tg=!1;class uI extends y.Component{componentDidMount(){const{visualElement:t,layoutGroup:s,switchLayoutGroup:n,layoutId:o}=this.props,{projection:l}=t;l&&(s.group&&s.group.add(l),n&&n.register&&o&&n.register(l),tg&&l.root.didUpdate(),l.addEventListener("animationComplete",()=>{this.safeToRemove()}),l.setOptions({...l.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),ph.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}),tg=!0,o||t.layoutDependency!==s||s===void 0||t.isPresent!==l?u.willUpdate():this.safeToRemove(),t.isPresent!==l&&(l?u.promote():u.relegate()||Vt.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(),ox.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:s,switchLayoutGroup:n}=this.props,{projection:o}=t;tg=!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 r3(e){const[t,s]=bB(),n=y.useContext(_C);return r.jsx(uI,{...e,layoutGroup:n,switchLayoutGroup:y.useContext(e3),isPresent:t,safeToRemove:s})}const dI={pan:{Feature:cI},drag:{Feature:lI,ProjectionNode:GE,MeasureLayout:r3}};function vw(e,t,s){const{props:n}=e;e.animationState&&n.whileHover&&e.animationState.setActive("whileHover",s==="Start");const o="onHover"+s,l=n[o];l&&Vt.postRender(()=>l(t,au(t)))}class hI extends xa{mount(){const{current:t}=this.node;t&&(this.unmount=P9(t,(s,n)=>(vw(this.node,n,"Start"),o=>vw(this.node,o,"End"))))}unmount(){}}class fI extends xa{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=nu(Yc(this.node.current,"focus",()=>this.onFocus()),Yc(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function _w(e,t,s){const{props:n}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&n.whileTap&&e.animationState.setActive("whileTap",s==="Start");const o="onTap"+(s==="End"?"":s),l=n[o];l&&Vt.postRender(()=>l(t,au(t)))}class mI extends xa{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:s,propagate:n}=this.node.props;this.unmount=V9(t,(o,l)=>(_w(this.node,l,"Start"),(u,{success:h})=>_w(this.node,u,h?"End":"Cancel")),{useGlobalTarget:s,stopPropagation:n?.tap===!1})}unmount(){}}const D0=new WeakMap,sg=new WeakMap,pI=e=>{const t=D0.get(e.target);t&&t(e)},gI=e=>{e.forEach(pI)};function bI({root:e,...t}){const s=e||document;sg.has(s)||sg.set(s,{});const n=sg.get(s),o=JSON.stringify(t);return n[o]||(n[o]=new IntersectionObserver(gI,{root:e,...t})),n[o]}function xI(e,t,s){const n=bI(t);return D0.set(e,s),n.observe(e),()=>{D0.delete(e),n.unobserve(e)}}const vI={some:0,all:1};class _I extends xa{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:vI[o]},h=m=>{const{isIntersecting:d}=m;if(this.isInView===d||(this.isInView=d,l&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:p,onViewportLeave:g}=this.node.getProps(),b=d?p:g;b&&b(m)};this.stopObserver=xI(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(yI(t,s))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}}function yI({viewport:e={}},{viewport:t={}}={}){return s=>e[s]!==t[s]}const SI={inView:{Feature:_I},tap:{Feature:mI},focus:{Feature:fI},hover:{Feature:hI}},wI={layout:{ProjectionNode:GE,MeasureLayout:r3}},kI={...WB,...SI,...dI,...wI},ng=UB(kI,FB),et=({label:e,children:t,variant:s="primary",size:n="medium",icon:o,onClick:l,removable:u=!1,className:h,maxWidth:m,appearance:d,onRemove:p,isLoading:g=!1})=>{const b=NI(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"},A=T=>{T.stopPropagation(),l?.()},j=T=>{T.stopPropagation(),p?.()};return r.jsxs(ng.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:A,style:{maxWidth:m},className:de("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[b][v],E[n],k&&"cursor-pointer",h),children:[g?r.jsx(ng.div,{animate:{rotate:360},transition:{duration:1,ease:"linear",repeat:1/0},className:"flex-shrink-0",children:r.jsx(Et,{className:"size-3.5"})}):o&&r.jsx("span",{className:"flex-shrink-0",children:o}),r.jsx("span",{className:"min-w-0 truncate",children:w}),u&&r.jsx(ng.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:j,type:"button",children:r.jsx(ts,{className:"size-3.5"})})]})};function NI(e){return e==="danger"?"error":e==="default"||e==="outline"?"primary":e}const CI=rC("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 tt({className:e,variant:t,...s}){return r.jsx("div",{className:de(CI({variant:t,className:e})),...s})}function a3({className:e,...t}){return r.jsx("h5",{className:de("mb-1 font-medium leading-none",e),...t})}function o3({className:e,...t}){return r.jsx("p",{className:de("leading-5",e),...t})}function zh(e){return de("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 Bh(e){return de("flex size-7 shrink-0 items-center justify-center [&_svg]:size-4 [&_svg]:shrink-0",e)}function Ih(e){return de("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 Ei({className:e,...t}){return r.jsx("div",{className:de("rounded-lg border border-border bg-card text-card-foreground",e),...t})}function ji({className:e,...t}){return r.jsx("div",{className:de("grid gap-1.5 p-4",e),...t})}function Ti({className:e,...t}){return r.jsx("h3",{className:de("text-sm font-semibold tracking-tight",e),...t})}function Xi({className:e,...t}){return r.jsx("p",{className:de("text-sm text-muted-foreground",e),...t})}function Ai({className:e,...t}){return r.jsx("div",{className:de("p-4 pt-0",e),...t})}const yw=100;function EI(){const[e,t]=y.useState([]),[s,n]=y.useState(!1),o=y.useRef(new Set);y.useEffect(()=>{const u=new EventSource("/api/agent/tool-calls/stream");return u.addEventListener("open",()=>n(!0)),u.addEventListener("error",()=>n(!1)),u.addEventListener("tool-call",h=>{try{const m=JSON.parse(h.data);t(d=>{if(o.current.has(m.id))return d;o.current.add(m.id);const p=[...d,m];return p.length>yw&&p.splice(0,p.length-yw),p})}catch{}}),()=>{u.close()}},[]);const l=[...e].reverse();return r.jsxs(Ei,{className:"min-w-0 rounded-none border-0 border-b border-border bg-transparent",children:[r.jsxs(ji,{className:"border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Za,{className:"size-4 text-muted-foreground"}),r.jsx(Ti,{children:"Live MCP Tool Calls"}),r.jsx(et,{variant:"outline",size:"small",children:e.length})]}),r.jsx(et,{variant:"outline",size:"small",icon:r.jsx("span",{className:de("inline-block size-1.5 rounded-full",s?"animate-pulse bg-emerald-500":"bg-muted-foreground/60")}),children:s?"live":"reconnecting…"})]}),r.jsx(Xi,{className:"text-xs",children:"Streamed from this NoMoreIDE MCP server. Newest at the top."})]}),r.jsx(Ai,{className:"p-0",children:l.length?r.jsx("ul",{className:"max-h-96 divide-y divide-border overflow-auto",children:l.map(u=>r.jsxs("li",{className:"px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"truncate font-mono text-xs font-semibold",children:u.tool}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2 font-mono text-[10px] text-muted-foreground",children:[r.jsxs("span",{children:[u.durationMs," ms"]}),r.jsx(et,{variant:u.status==="ok"?"success":"error",appearance:"outline",size:"small",children:u.status})]})]}),u.args?r.jsx("div",{className:"mt-0.5 truncate font-mono text-[11px] text-muted-foreground",children:u.args}):null,u.error?r.jsx("div",{className:"mt-0.5 font-mono text-[11px] text-destructive",children:u.error}):null,r.jsx("div",{className:"mt-0.5 font-mono text-[10px] text-muted-foreground/80",children:new Date(u.startedAt).toLocaleTimeString()})]},u.id))}):r.jsx("p",{className:"px-3 py-4 text-xs text-muted-foreground",children:"No tool calls yet. Invoke a NoMoreIDE MCP tool from your agent and it will appear here."})})]})}function jI({agent:e}){return r.jsxs(r.Fragment,{children:[r.jsx(EI,{}),r.jsxs(Ei,{className:"min-w-0 rounded-none border-0 bg-transparent",children:[r.jsxs(ji,{className:"border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(rf,{className:"size-4 text-muted-foreground"}),r.jsx(Ti,{children:"Recent Projects"})]}),r.jsx(et,{variant:"outline",size:"small",children:e.projects.length})]}),r.jsx(Xi,{className:"text-xs",children:"Most recently active projects known to the agent."})]}),r.jsx(Ai,{className:"p-0",children:e.projects.length?r.jsx("ul",{className:"divide-y divide-border",children:e.projects.map(t=>r.jsxs("li",{className:de("flex items-start justify-between gap-3 px-3 py-2",t.current&&"bg-primary/5"),children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"truncate font-mono text-xs font-semibold",children:t.path}),t.current?r.jsx(et,{variant:"outline",size:"small",children:"current"}):null]}),t.lastSessionFirstPrompt?r.jsx("p",{className:"mt-0.5 truncate text-[11px] text-muted-foreground",children:t.lastSessionFirstPrompt}):null]}),r.jsxs("div",{className:"shrink-0 text-right font-mono text-[10px] text-muted-foreground",children:[t.mcpServerCount?r.jsxs("div",{children:[t.mcpServerCount," mcp"]}):null,t.lastSessionModified?r.jsx("div",{children:TI(t.lastSessionModified)}):null]})]},t.path))}):r.jsx("p",{className:"px-3 py-4 text-xs text-muted-foreground",children:"No known projects."})})]})]})}function TI(e){const t=Date.parse(e);return Number.isNaN(t)?e:new Date(t).toLocaleString()}function ml({className:e}){return r.jsx("svg",{className:de("size-3.5",e),viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:r.jsx("path",{d:"m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z"})})}function ou({className:e}){return r.jsx("svg",{className:de("size-3.5",e),viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":!0,children:r.jsx("path",{d:"M11.248 18.25q-.825 0-1.568-.314a4.3 4.3 0 0 1-1.32-.874 4 4 0 0 1-1.304.214 4 4 0 0 1-2.046-.544 4.27 4.27 0 0 1-1.518-1.485 4 4 0 0 1-.56-2.095q0-.48.131-1.04A4.4 4.4 0 0 1 2.04 10.71a4.07 4.07 0 0 1 .017-3.4 4.2 4.2 0 0 1 1.056-1.418 3.8 3.8 0 0 1 1.6-.842 3.9 3.9 0 0 1 .76-1.683q.593-.759 1.451-1.188a4.04 4.04 0 0 1 1.832-.429q.825 0 1.567.313.742.314 1.32.875a4 4 0 0 1 1.304-.215q1.106 0 2.046.545a4.14 4.14 0 0 1 1.501 1.485q.578.941.578 2.095 0 .48-.132 1.04.66.61 1.023 1.419.363.792.363 1.666 0 .892-.38 1.717a4.3 4.3 0 0 1-1.072 1.435 3.8 3.8 0 0 1-1.584.825 3.8 3.8 0 0 1-.775 1.683 4.06 4.06 0 0 1-1.436 1.188 4.04 4.04 0 0 1-1.832.429m-4.076-2.062q.825 0 1.435-.347l3.103-1.782a.36.36 0 0 0 .164-.313v-1.42L7.881 14.62a.67.67 0 0 1-.726 0l-3.118-1.798a.5.5 0 0 1-.017.115v.198q0 .841.396 1.551.413.693 1.139 1.089a3.2 3.2 0 0 0 1.617.412m.165-2.69a.4.4 0 0 0 .181.05q.083 0 .165-.05l1.238-.71-3.977-2.31a.7.7 0 0 1-.363-.643v-3.58q-.825.362-1.32 1.122a2.9 2.9 0 0 0-.495 1.65q0 .809.413 1.55.412.743 1.072 1.123zm3.91 3.663q.875 0 1.585-.396a2.96 2.96 0 0 0 1.534-2.64v-3.564a.32.32 0 0 0-.165-.297l-1.254-.726v4.604a.7.7 0 0 1-.363.643l-3.119 1.799a3 3 0 0 0 1.783.577m.627-6.039V8.878L10.01 7.822 8.129 8.878v2.244l1.881 1.056zM7.057 5.859a.7.7 0 0 1 .363-.644l3.119-1.798a3 3 0 0 0-1.782-.578q-.874 0-1.584.396A2.96 2.96 0 0 0 6.05 4.324a3.07 3.07 0 0 0-.396 1.551v3.547q0 .199.165.314l1.237.726zm8.383 7.887q.825-.364 1.303-1.123.495-.758.495-1.65a3.15 3.15 0 0 0-.412-1.55q-.413-.743-1.073-1.123l-3.086-1.782q-.099-.065-.181-.049a.3.3 0 0 0-.165.05l-1.238.692 3.993 2.327a.6.6 0 0 1 .264.264.64.64 0 0 1 .1.363zm-3.317-8.382a.63.63 0 0 1 .726 0l3.135 1.831v-.297q0-.792-.396-1.501a2.86 2.86 0 0 0-1.105-1.155q-.71-.43-1.65-.43-.825 0-1.436.347L8.294 5.941a.36.36 0 0 0-.165.314v1.418z"})})}function AI({className:e}){return r.jsx("svg",{className:de("size-3.5",e),viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:r.jsx("path",{d:"M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81"})})}const RI=800;function lu({activeHunkIndex:e=0,diff:t}){const s=OI(t),n=y.useRef(null),o=y.useRef([]),[l,u]=y.useState(!1),h=y.useMemo(()=>s.reduce((d,p)=>Math.max(d,p.content.length),0),[s]),m=h>RI;if(y.useEffect(()=>{u(!1)},[t]),y.useEffect(()=>{if(m&&!l)return;const d=o.current[e],p=n.current;!d||!p||p.scrollTo({top:Math.max(d.offsetTop-8,0),behavior:"smooth"})},[e,t,m,l]),m&&!l){const d=s.filter(g=>g.kind==="add").length,p=s.filter(g=>g.kind==="delete").length;return r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-card p-6",children:r.jsxs("div",{className:"max-w-sm space-y-3 text-center",children:[r.jsx("p",{className:"text-[13px] font-medium text-foreground",children:"Diff hidden for this data file"}),r.jsxs("p",{className:"text-[12px] text-muted-foreground",children:["Rows run up to ",h.toLocaleString()," characters, so this looks like a CSV, log, or other data dump rather than source code."]}),r.jsxs("p",{className:"font-mono text-[11px]",children:[r.jsxs("span",{className:"text-emerald-700",children:["+",d]})," ",r.jsxs("span",{className:"text-red-700",children:["-",p]})," lines changed"]}),r.jsx(J,{onClick:()=>u(!0),size:"sm",type:"button",variant:"outline",children:"Show diff anyway"})]})})}return r.jsx("div",{className:"absolute inset-0 overflow-auto bg-card text-xs leading-6 text-foreground",ref:n,children:r.jsx("div",{className:"min-w-full font-mono",children:s.map((d,p)=>r.jsxs("div",{className:de("grid grid-cols-[3rem_3rem_minmax(0,1fr)]",d.kind==="add"&&"bg-emerald-50 text-emerald-800 dark:bg-emerald-500/15 dark:text-emerald-300",d.kind==="delete"&&"bg-red-50 text-red-800 dark:bg-red-500/15 dark:text-red-300",Sw(s,p)&&d.hunkIndex===e&&"outline outline-1 outline-offset-[-1px] outline-primary/35"),ref:d.hunkIndex!==null&&Sw(s,p)?g=>{o.current[d.hunkIndex??0]=g}:void 0,children:[r.jsx(ww,{value:d.oldLine}),r.jsx(ww,{value:d.newLine}),r.jsx("span",{className:"min-w-0 whitespace-pre-wrap break-all px-2",children:d.content||" "})]},`${p}-${d.content}`))})})}function MI(e){const t=[];let s=null;const n=()=>{if(!s)return;const o=s.join(`
|
|
19
|
+
`),l=gx(o);t.push({path:DI(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 DI(e){const t=/^diff --git a\/(.+?) b\/(.+)$/.exec(e);return t?t[2]:e.replace(/^diff --git /,"")}function gx(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 OI(e){const t=LI(e);return t.some(s=>s.kind==="hunk")?t.filter(s=>s.kind!=="meta"&&s.kind!=="hunk"):t}function LI(e){let t=null,s=null,n=null;return e.split(`
|
|
22
|
+
`).map(o=>{if(zI(o))return t=null,s=null,n=null,{content:o,hunkIndex:n,kind:"meta",oldLine:null,newLine:null};if(o.startsWith("@@")){const u=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(o);return u&&(t=Number(u[1]),s=Number(u[2])),n=(n??-1)+1,{content:o,hunkIndex:n,kind:"hunk",oldLine:null,newLine:null}}if(t===null||s===null)return{content:o,hunkIndex:null,kind:"meta",oldLine:null,newLine:null};if(o.startsWith("\\ No newline"))return{content:o,hunkIndex:n,kind:"meta",oldLine:null,newLine:null};if(o.startsWith("+")&&!o.startsWith("+++")){const u={content:o,hunkIndex:n,kind:"add",oldLine:null,newLine:s};return s+=1,u}if(o.startsWith("-")&&!o.startsWith("---")){const u={content:o,hunkIndex:n,kind:"delete",oldLine:t,newLine:null};return t+=1,u}const l={content:o,hunkIndex:n,kind:"context",oldLine:t,newLine:s};return t+=1,s+=1,l})}function Sw(e,t){const s=e[t]?.hunkIndex;if(s===null)return!1;const n=e.findIndex(o=>o.hunkIndex===s&&(o.kind==="add"||o.kind==="delete"));return n!==-1?n===t:e.findIndex(o=>o.hunkIndex===s)===t}function zI(e){return e.startsWith("diff --git ")||e.startsWith("index ")||e.startsWith("--- ")||e.startsWith("+++ ")||e.startsWith("new file mode ")||e.startsWith("deleted file mode ")||e.startsWith("old mode ")||e.startsWith("new mode ")||e.startsWith("similarity index ")||e.startsWith("rename from ")||e.startsWith("rename to ")||e.startsWith("Binary files ")}function ww({value:e}){return r.jsx("span",{className:de("select-none border-r border-border/70 px-2 text-right text-muted-foreground",e===null&&"text-transparent"),children:e??"-"})}function BI(){const[e,t]=y.useState([]),[s,n]=y.useState(""),[o,l]=y.useState(null),[u,h]=y.useState(!1),[m,d]=y.useState(null),p=y.useCallback(async()=>{try{const N=await fO();t(N),n(E=>E&&N.some(A=>A.sha===E)?E:N[0]?.sha??""),l(null)}catch(N){l(N instanceof Error?N.message:String(N))}},[]);y.useEffect(()=>{p()},[p]);async function g(){h(!0),d(null);try{const N=await mO("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 b(N,E){h(!0),d(null);try{const A=await pO(N,E);await p(),n(A.sha),d(`Snapshot renamed to “${A.label}”.`)}catch(A){l(A instanceof Error?A.message:String(A))}finally{h(!1)}}async function v(N){h(!0),d(null);try{await gO(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 vO(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 r.jsxs("div",{className:"grid h-full min-h-0 overflow-hidden bg-card/85 xl:grid-cols-[320px_minmax(0,1fr)]",children:[r.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden border-r border-border",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-2",children:[r.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-semibold",children:[r.jsx(fR,{className:"size-3.5"}),"Snapshots"]}),r.jsxs(J,{disabled:u,onClick:()=>{g()},size:"sm",type:"button",children:[r.jsx(s4,{className:"size-3.5"}),"Snapshot now"]})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:o?r.jsxs(tt,{variant:"destructive",className:"m-3",children:[r.jsx(Mb,{}),r.jsxs("div",{className:"min-w-0",children:[r.jsx(a3,{children:"Couldn’t load snapshots"}),r.jsx(o3,{className:"break-words",children:o})]})]}):e.length===0?r.jsx(tt,{variant:"muted",className:"m-3 border-dashed",children:"No snapshots yet. Take one before risky changes, or let agent sessions create them automatically."}):r.jsx("ul",{children:e.map(N=>r.jsx(II,{busy:u,onDelete:v,onRename:b,onSelect:n,selected:N.sha===s,snapshot:N},N.ref))})})]}),r.jsxs("section",{className:"flex min-h-0 min-w-0 flex-col",children:[m?r.jsx(tt,{variant:"muted",className:"m-3 mb-0",children:m}):null,k?r.jsx(PI,{busy:u,onRestore:w,snapshot:k}):r.jsx("div",{className:"p-4",children:r.jsx(tt,{variant:"muted",className:"border-dashed p-12 text-center",children:"Select a snapshot to compare it with the current working tree."})})]})]})}function II({busy:e,onDelete:t,onRename:s,onSelect:n,selected:o,snapshot:l}){const[u,h]=y.useState(!1),[m,d]=y.useState(l.label),[p,g]=y.useState(!1);function b(){d(l.label),h(!0)}function v(){const w=m.trim();h(!1),w&&w!==l.label&&s(l.sha,w)}return r.jsx("li",{className:de("group relative border-b border-border/60 transition-colors",o?"bg-background":"hover:bg-muted/50"),children:u?r.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-2",children:[r.jsx("input",{ref:w=>w?.focus(),value:m,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"}),r.jsx(J,{disabled:e,onClick:v,size:"icon-sm",type:"button",variant:"ghost",children:r.jsx(on,{className:"size-3.5"})}),r.jsx(J,{onClick:()=>h(!1),size:"icon-sm",type:"button",variant:"ghost",children:r.jsx(ts,{className:"size-3.5"})})]}):r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",onClick:()=>n(l.sha),className:"w-full px-3 py-2 pr-16 text-left",children:[r.jsx("span",{className:"block truncate text-xs font-medium",children:l.label}),r.jsxs("span",{className:"mt-0.5 flex items-center gap-2 text-[10px] text-muted-foreground",children:[r.jsx("span",{className:"font-mono",children:l.sha.slice(0,7)}),r.jsx("span",{children:new Date(l.createdAt).toLocaleString()})]})]}),r.jsx("div",{className:"absolute right-2 top-1.5 flex items-center gap-0.5",children:p?r.jsxs(r.Fragment,{children:[r.jsx(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:r.jsx(on,{className:"size-3.5"})}),r.jsx(J,{onClick:()=>g(!1),size:"icon-sm",title:"Cancel",type:"button",variant:"ghost",children:r.jsx(ts,{className:"size-3.5"})})]}):r.jsxs("span",{className:"hidden items-center gap-0.5 group-hover:flex",children:[r.jsx(J,{disabled:e,onClick:b,size:"icon-sm",title:"Rename snapshot",type:"button",variant:"ghost",children:r.jsx(rl,{className:"size-3.5"})}),r.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:r.jsx(Er,{className:"size-3.5"})})]})})]})})}function PI({busy:e,onRestore:t,snapshot:s}){const[n,o]=y.useState([]),[l,u]=y.useState(""),[h,m]=y.useState(""),[d,p]=y.useState(null),[g,b]=y.useState(!1);return y.useEffect(()=>{let v=!0;return b(!1),p(null),bO(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]),y.useEffect(()=>{if(!l){m("");return}let v=!0;return xO(s.sha,l).then(w=>{v&&m(w)}).catch(w=>{v&&p(w instanceof Error?w.message:String(w))}),()=>{v=!1}},[s.sha,l]),r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:s.label}),r.jsx("p",{className:"text-[10px] text-muted-foreground",children:n.length?`${n.length} file(s) differ from the current working tree.`:"Identical to the current working tree."})]}),g?r.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[r.jsx(J,{disabled:e,onClick:()=>{b(!1),t(s.sha)},size:"sm",type:"button",variant:"destructive",children:"Confirm restore"}),r.jsx(J,{onClick:()=>b(!1),size:"sm",type:"button",variant:"outline",children:"Cancel"})]}):r.jsxs(J,{disabled:e||n.length===0,onClick:()=>b(!0),size:"sm",title:"Reset the working tree to this snapshot (a pre-restore snapshot is taken first)",type:"button",variant:"outline",children:[r.jsx(tu,{className:"size-3.5"}),"Restore…"]})]}),r.jsx(l3,{diff:h,error:d,files:n,onSelectPath:u,selectedPath:l})]})}function l3({diff:e,error:t,files:s,onSelectPath:n,selectedPath:o}){return t?r.jsx("div",{className:"p-4",children:r.jsxs(tt,{variant:"destructive",children:[r.jsx(Mb,{}),r.jsxs("div",{className:"min-w-0",children:[r.jsx(a3,{children:"Couldn’t load this snapshot"}),r.jsx(o3,{className:"break-words",children:t})]})]})}):r.jsxs("div",{className:"grid min-h-0 flex-1 xl:grid-cols-[260px_minmax(0,1fr)]",children:[r.jsx("ul",{className:"min-h-0 overflow-auto border-r border-border",children:s.map(l=>r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>n(l.path),className:de("flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors",l.path===o?"bg-background":"hover:bg-muted/50"),children:[r.jsx("span",{className:de("w-3 shrink-0 font-mono text-[10px]",l.status==="A"&&"text-emerald-600",l.status==="D"&&"text-red-600",l.status==="M"&&"text-amber-600"),children:l.status}),r.jsx("span",{className:"truncate",children:l.path})]})},l.path))}),r.jsx("div",{className:"relative min-h-0 min-w-0",children:o?r.jsx(lu,{diff:e||"No diff for this file."}):r.jsx("div",{className:"p-4",children:r.jsx(tt,{variant:"muted",className:"border-dashed p-8 text-center",children:"Select a file to see how it differs from the snapshot."})})})]})}function $I(){const[e,t]=y.useState([]),[s,n]=y.useState(""),[o,l]=y.useState(null),[u,h]=y.useState(null),[m,d]=y.useState(!1),p=y.useCallback(async()=>{try{const b=await _O();t(b),n(v=>v&&b.some(w=>w.id===v)?v:b[0]?.id??""),l(null)}catch(b){l(b instanceof Error?b.message:String(b))}},[]);y.useEffect(()=>{p()},[p]);async function g(b){d(!0),h(null);try{const v=await wO(b);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?r.jsx("div",{className:"p-4",children:r.jsx(tt,{variant:"muted",className:"border-dashed p-8 text-center",children:o??"No agent sessions recorded yet. Sessions appear here once an agent calls a nomoreide MCP tool; each one starts with a working-tree snapshot you can roll back to."})}):r.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[u?r.jsx(tt,{variant:"muted",className:"m-3 mb-0",children:u}):null,r.jsxs("div",{className:"grid min-h-0 flex-1 xl:grid-cols-[280px_minmax(0,1fr)]",children:[r.jsx("aside",{className:"min-h-0 overflow-auto border-r border-border",children:r.jsx("ul",{children:e.map(b=>r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>n(b.id),className:de("w-full border-b border-border/60 px-3 py-2 text-left transition-colors",b.id===s?"bg-background":"hover:bg-muted/50"),children:[r.jsx("span",{className:"block truncate text-xs font-medium",children:new Date(b.startedAt).toLocaleString()}),r.jsxs("span",{className:"mt-0.5 flex items-center gap-2 text-[10px] text-muted-foreground",children:[r.jsxs("span",{children:[b.toolCount," tool call(s)"]}),b.snapshotSha?r.jsx("span",{className:"font-mono",children:b.snapshotSha.slice(0,7)}):r.jsx("span",{children:"no snapshot"})]})]})},b.id))})}),r.jsx("section",{className:"flex min-h-0 min-w-0 flex-col",children:s?r.jsx(HI,{busy:m,id:s,onRestore:g}):null})]})]})}function HI({busy:e,id:t,onRestore:s}){const[n,o]=y.useState(null),[l,u]=y.useState([]),[h,m]=y.useState(""),[d,p]=y.useState(""),[g,b]=y.useState(null),[v,w]=y.useState(!1);return y.useEffect(()=>{let k=!0;return w(!1),b(null),yO(t).then(N=>{k&&(o(N.session),u(N.files),m(E=>E&&N.files.some(A=>A.path===E)?E:N.files[0]?.path??""))}).catch(N=>{k&&b(N instanceof Error?N.message:String(N))}),()=>{k=!1}},[t]),y.useEffect(()=>{if(!h){p("");return}let k=!0;return SO(t,h).then(N=>{k&&p(N)}).catch(N=>{k&&b(N instanceof Error?N.message:String(N))}),()=>{k=!1}},[t,h]),r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:l.length?`${l.length} file(s) changed since this session started`:"No working-tree changes since this session started"}),r.jsx("p",{className:"truncate text-[10px] text-muted-foreground",children:n?.repoPath??""})]}),n?.snapshotSha?v?r.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[r.jsx(J,{disabled:e,onClick:()=>{w(!1),s(t)},size:"sm",type:"button",variant:"destructive",children:"Confirm restore"}),r.jsx(J,{onClick:()=>w(!1),size:"sm",type:"button",variant:"outline",children:"Cancel"})]}):r.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:[r.jsx(tu,{className:"size-3.5"}),"Restore to before this session…"]}):null]}),r.jsx(l3,{diff:d,error:g,files:l,onSelectPath:m,selectedPath:h})]})}let kw=0;const Nw=()=>(kw+=1,`t${Date.now()}-${kw}`);function UI(e){return e==="codex"?{id:e,label:"Codex",commandName:"codex",installHint:"",intro:""}:{id:e,label:"Claude Code",commandName:"claude",installHint:"",intro:""}}function FI(){const[e,t]=y.useState([]),[s,n]=y.useState(!1),[o,l]=y.useState(null),[u,h]=y.useState(null),[m,d]=y.useState(null),[p,g]=y.useState([]),[b,v]=y.useState([]),w=y.useRef(void 0),k=y.useRef(null),N=y.useRef(void 0),E=y.useRef(void 0);y.useEffect(()=>{PD().then(L=>{h(L.configured),d(L.provider),g(L.providers),w.current=L.provider?.id}).catch(()=>h(!1))},[]);const A=y.useCallback(async L=>{const R=p.find(D=>D.id===L);d(R??UI(L)),w.current=L,R&&h(R.configured);try{const D=await $D(L);d(D),w.current=D.id}catch{}},[p]),j=y.useCallback(async(L,R)=>{v(I=>I.filter(V=>V.requestId!==L));const D=E.current??N.current;if(D)try{await HD(D,L,R)}catch{}},[]),T=y.useCallback(()=>{k.current?.abort(),k.current=null,n(!1)},[]),P=y.useCallback(async(L,R)=>{const D=L.trim();if(!D||s)return;l(null);const I={id:Nw(),createdAt:Date.now(),role:"user",text:D,label:R?.label,tools:[]},V=Nw(),X={id:V,createdAt:Date.now(),role:"assistant",text:"",tools:[]};t(q=>[...q,I,X]);const $=q=>t(B=>B.map(Z=>Z.id===V?q(Z):Z)),W=new AbortController;k.current=W,n(!0);try{await UD(D,R?.isolated?void 0:N.current,q=>{switch(q.type){case"session":E.current=q.sessionId,R?.isolated||(N.current=q.sessionId);break;case"text":$(B=>({...B,text:B.text+q.text}));break;case"tool_use":$(B=>({...B,tools:[...B.tools,{id:q.id,name:q.name,input:q.input,status:"running"}]}));break;case"tool_result":$(B=>({...B,tools:B.tools.map(Z=>Z.id===q.id?{...Z,preview:q.preview,isError:q.isError,status:"done"}:Z)}));break;case"approval_request":v(B=>[...B,{requestId:q.requestId,name:q.name,input:q.input}]);break;case"error":l(q.message);break;case"done":break}},W.signal,R?.autoApprove,w.current)}catch(q){W.signal.aborted||l(q instanceof Error?q.message:String(q))}finally{k.current=null,n(!1)}},[s]),z=y.useCallback(()=>{T(),N.current=void 0,E.current=void 0,t([]),v([]),l(null)},[T]);return{turns:e,streaming:s,error:o,configured:u,provider:m,providers:p,selectProvider:A,approvals:b,send:P,stop:T,clear:z,respond:j}}const c3=y.createContext(null);function qI({children:e}){const t=FI(),{streaming:s}=t,[n,o]=y.useState(!1),[l,u]=y.useState(""),[h,m]=y.useState(null),[d,p]=y.useState(0),[g,b]=y.useState(0),[v,w]=y.useState(!1),k=y.useRef([]),N=y.useCallback(()=>p(D=>D+1),[]),E=y.useCallback(()=>b(D=>D+1),[]),A=y.useCallback((D,I)=>(E(),t.send(D,I)),[t,E]),j=y.useCallback(()=>m(null),[]),T=y.useCallback(()=>{o(!0),w(!0)},[]),P=y.useCallback(D=>{o(!0),u(I=>I.trim()?`${I.replace(/\s*$/,"")}
|
|
23
|
+
${D}`:D),N()},[N]);y.useEffect(()=>{if(s)return;const D=k.current.shift();D&&A(D.prompt,{label:D.label,autoApprove:D.autoApprove,isolated:D.isolated})},[s,A]);const z=y.useCallback(({prompt:D,source:I,mode:V="send",label:X,autoApprove:$,background:W,isolated:q})=>(W||o(!0),m(I??null),E(),V==="draft"?(u(D),N(),{queued:!1}):s?(k.current.push({prompt:D,label:X,autoApprove:$,isolated:q}),{queued:!0}):(A(D,{label:X,autoApprove:$,isolated:q}),{queued:!1})),[s,A,N,E]),L=y.useCallback(()=>{k.current=[],m(null),t.clear()},[t]),R={...t,send:A,clear:L,open:n,setOpen:o,draft:l,setDraft:u,insertPath:P,activeSource:h,clearSource:j,focusNonce:d,stickNonce:g,sendToAgent:z,onboarding:v,setOnboarding:w,startOnboard:T};return r.jsx(c3.Provider,{value:R,children:e})}function It(){const e=y.useContext(c3);if(!e)throw new Error("useAgentDock must be used within an AgentProvider");return e}function VI(e){const t=Math.max(0,Math.floor(e/6e4));if(t<60)return`${t}m`;const s=Math.floor(t/60),n=t%60;return`${s}h ${String(n).padStart(2,"0")}m`}function GI(e,t=Date.now()){const s=e[0],n=s?t-s.createdAt:0,o=e.length,l=n>=60*6e4||o>=30,u=n>=30*6e4||o>=16,h=l?"heavy":u?"long":"fresh";return{durationLabel:s?VI(n):"0m",recommendation:h==="fresh"?null:"Consider starting a new chat for a cleaner context.",status:h,statusLabel:h==="heavy"?"Heavy context":h==="long"?"Long":"Fresh",turnCount:o}}function WI({now:e,onNewChat:t,turns:s}){const[n,o]=y.useState(()=>Date.now());y.useEffect(()=>{const h=window.setInterval(()=>o(Date.now()),3e4);return()=>window.clearInterval(h)},[]);const l=GI(s,e??n),u=s.length>0;return r.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-border bg-background/55 px-3 py-2 text-xs",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx(DR,{className:de("size-4 shrink-0",l.status==="heavy"?"text-amber-500":l.status==="long"?"text-yellow-500":"text-muted-foreground")}),r.jsx("span",{className:"font-medium",children:"Conversation"}),r.jsx("span",{className:"font-mono text-muted-foreground",children:u?l.durationLabel:"not started"}),u?r.jsxs("span",{className:"font-mono text-muted-foreground",children:[l.turnCount," turns"]}):null]}),r.jsx(et,{appearance:l.status==="fresh"?"subtle":"solid",size:"small",variant:l.status==="heavy"?"warning":l.status==="long"?"secondary":"outline",children:l.statusLabel}),l.recommendation?r.jsx("span",{className:"min-w-0 flex-1 text-muted-foreground",children:l.recommendation}):r.jsx("span",{className:"min-w-0 flex-1 text-muted-foreground",children:"Short chats usually give the agent cleaner context."}),r.jsxs(J,{className:"h-7 gap-1.5 px-2 text-xs",disabled:!u,onClick:t,size:"sm",type:"button",variant:"outline",children:[r.jsx(tu,{className:"size-3.5"}),"New chat"]})]})}function KI({agent:e,agentId:t}){const s=e.project.instructionFileName??(e.project.claudeMdPath?"CLAUDE.md":void 0),n=e.project.instructionFilePreview??e.project.claudeMdPreview,o=e.project.memoryFiles.length+(s?1:0);return r.jsxs(Ei,{className:"min-w-0 rounded-none border-0 bg-transparent",children:[r.jsxs(ji,{className:"border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(pN,{className:"size-4 text-muted-foreground"}),r.jsx(Ti,{children:"Project Memory"})]}),r.jsx(et,{variant:"outline",size:"small",children:o})]}),r.jsx(Xi,{className:"truncate text-xs",children:e.project.memoryDir??(t==="codex"?"No Codex memory directory found for this project.":"No memory directory found for this project.")})]}),r.jsxs(Ai,{className:"space-y-2 p-3",children:[s?r.jsx(Cw,{title:s,preview:n,defaultOpen:!0}):null,e.project.memoryFiles.length?e.project.memoryFiles.map(l=>r.jsx(Cw,{title:l.name,subtitle:`${l.size} B`,preview:l.preview,defaultOpen:l.name==="MEMORY.md"},l.path)):s?null:r.jsx("p",{className:"text-xs text-muted-foreground",children:"No memory files persisted yet for this project."})]})]})}function Cw({title:e,subtitle:t,preview:s,defaultOpen:n=!1}){const[o,l]=y.useState(n);return r.jsxs("div",{className:"rounded-md border border-border bg-background/40",children:[r.jsxs("button",{type:"button",onClick:()=>l(!o),className:"flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-xs font-semibold",children:[r.jsx(Yn,{className:de("size-3.5 text-muted-foreground transition-transform",o&&"rotate-90")}),r.jsx("span",{children:e}),t?r.jsx("span",{className:"font-mono text-[10px] font-normal text-muted-foreground",children:t}):null]}),o&&s?r.jsx("pre",{className:"max-h-64 overflow-auto whitespace-pre-wrap border-t border-border px-2.5 py-2 font-mono text-[11px] leading-relaxed text-muted-foreground",children:s}):null]})}const YI=[{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%)"}],XI=({size:e=20,color:t="#8f8f8f"})=>r.jsx("div",{style:{width:e,height:e},children:r.jsx("div",{className:"relative left-1/2 top-1/2",style:{width:e,height:e},children:YI.map(s=>r.jsx("div",{className:"absolute -left-[10%] -top-[3.9%] h-[8%] w-[24%] animate-fade-spin rounded-[5px]",style:{backgroundColor:t,...s}},s.transform))})}),ZI=[{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"}],QI={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"},JI={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]"}},Pd=({size:e="medium",type:t="primary",variant:s="styled",shape:n="square",svgOnly:o=!1,children:l,prefix:u,suffix:h,shadow:m=!1,loading:d=!1,disabled:p=!1,fullWidth:g=!1,className:b,...v})=>r.jsxs("button",{disabled:p,tabIndex:0,className:Vc("flex items-center justify-center gap-0.5 duration-150",ZI[+o][e],p||d?"cursor-not-allowed border border-gray-400 bg-gray-100 text-gray-700":QI[t],JI[n][e],m&&"shadow-border-small border-none",g&&"w-full",s==="unstyled"?"h-fit bg-transparent px-0 text-gray-1000 outline-none hover:bg-transparent":"focus:shadow-focus-ring focus:outline-0",b),type:"button",...v,children:[d?r.jsx(XI,{size:e==="large"?24:16}):u,r.jsx("span",{className:Vc("relative overflow-hidden overflow-ellipsis whitespace-nowrap font-sans",e!=="tiny"&&s!=="unstyled"&&"px-1.5"),children:l}),!d&&h]}),eP=({className:e})=>r.jsx("svg",{height:"16",strokeLinejoin:"round",viewBox:"0 0 16 16",width:"16",className:e,children:r.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.4697 13.5303L13 14.0607L14.0607 13L13.5303 12.4697L9.06065 7.99999L13.5303 3.53032L14.0607 2.99999L13 1.93933L12.4697 2.46966L7.99999 6.93933L3.53032 2.46966L2.99999 1.93933L1.93933 2.99999L2.46966 3.53032L6.93933 7.99999L2.46966 12.4697L1.93933 13L2.99999 14.0607L3.53032 13.5303L7.99999 9.06065L12.4697 13.5303Z"})}),tP=()=>r.jsx("svg",{height:"16",strokeLinejoin:"round",viewBox:"0 0 16 16",width:"16",className:"fill-gray-1000",children:r.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.5 8C13.5 4.96643 11.0257 2.5 7.96452 2.5C5.42843 2.5 3.29365 4.19393 2.63724 6.5H5.25H6V8H5.25H0.75C0.335787 8 0 7.66421 0 7.25V2.75V2H1.5V2.75V5.23347C2.57851 2.74164 5.06835 1 7.96452 1C11.8461 1 15 4.13001 15 8C15 11.87 11.8461 15 7.96452 15C5.62368 15 3.54872 13.8617 2.27046 12.1122L1.828 11.5066L3.03915 10.6217L3.48161 11.2273C4.48831 12.6051 6.12055 13.5 7.96452 13.5C11.0257 13.5 13.5 11.0336 13.5 8Z"})});let ig=null,sP=0;const Ns={toasts:[],listeners:new Set,add(e,t,s,n,o,l){const u=sP++,h={id:u,text:e,preserve:s,action:n,onAction:o,onUndoAction:l,type:t};if(!h.preserve){h.remaining=3e3,h.start=Date.now();const m=()=>{this.toasts=this.toasts.filter(d=>d.id!==u),this.notify()};h.timeout=setTimeout(m,h.remaining),h.pause=()=>{h.timeout&&(clearTimeout(h.timeout),h.timeout=void 0,h.remaining-=Date.now()-h.start)},h.resume=()=>{h.timeout||(h.start=Date.now(),h.timeout=setTimeout(m,h.remaining))}}this.toasts.push(h),this.notify()},remove(e){Ns.toasts=Ns.toasts.filter(t=>t.id!==e),Ns.notify()},subscribe(e){return Ns.listeners.add(e),()=>{Ns.listeners.delete(e)}},notify(){Ns.listeners.forEach(e=>{e()})}},nP=()=>{const[e,t]=y.useState([]),[s,n]=y.useState([]),[o,l]=y.useState(!1),u=w=>k=>{k&&w.measuredHeight==null&&(w.measuredHeight=k.getBoundingClientRect().height,Ns.notify())};y.useEffect(()=>(t([...Ns.toasts]),Ns.subscribe(()=>{t([...Ns.toasts])})),[]),y.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 m=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 T=k-1;T>w;T--)o?E+=(e[T-1]?.measuredHeight||63)+10:E+=20;const A=-N,j=o?1:1-.05*N;return`translate3d(0, calc(100% - ${E}px), ${A}px) scale(${j})`},p=()=>{l(!0),Ns.toasts.forEach(w=>{w.pause?.()})},g=()=>{l(!1),Ns.toasts.forEach(w=>{w.resume?.()})},v=e.slice(m).reduce((w,k)=>w+(k.measuredHeight??63),0);return r.jsx("div",{className:"pointer-events-none fixed bottom-4 right-4 z-[9999] w-[min(420px,calc(100vw-2rem))]",style:{height:v},children:r.jsx("div",{className:"pointer-events-auto relative w-full",style:{height:v},onMouseEnter:p,onMouseLeave:g,children:e.map((w,k)=>{const N=k>=m;return r.jsx("div",{ref:u(w),className:Vc("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<m&&"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:r.jsxs("div",{className:"flex flex-col items-center justify-between text-[.875rem]",children:[r.jsxs("div",{className:"flex h-full w-full items-center justify-between gap-4",children:[r.jsx("span",{children:w.text}),!w.action&&r.jsxs("div",{className:"flex gap-1",children:[w.onUndoAction&&r.jsx(Pd,{type:"tertiary",svgOnly:!0,size:"small",onClick:()=>{w.onUndoAction?.(),Ns.remove(w.id)},children:r.jsx(tP,{})}),r.jsx(Pd,{type:"tertiary",svgOnly:!0,size:"small",onClick:()=>Ns.remove(w.id),children:r.jsx(eP,{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&&r.jsxs("div",{className:"flex w-full items-center justify-end gap-2",children:[r.jsx(Pd,{type:"tertiary",size:"small",onClick:()=>Ns.remove(w.id),children:"Dismiss"}),r.jsx(Pd,{type:"primary",size:"small",onClick:()=>{w.onAction?.(),Ns.remove(w.id)},children:w.action})]})]})},w.id)})})})},$d=()=>{if(ig)return;const e=document.createElement("div");e.className="fixed bottom-4 right-4 z-[9999]",document.body.appendChild(e),ig=hN.createRoot(e),ig.render(r.jsx(nP,{}))},$s=()=>({message:y.useCallback(({text:e,preserve:t,action:s,onAction:n,onUndoAction:o})=>{$d(),Ns.add(e,"message",t,s,n,o)},[]),success:y.useCallback(e=>{$d(),Ns.add(e,"success")},[]),warning:y.useCallback(e=>{$d(),Ns.add(e,"warning")},[]),error:y.useCallback(e=>{$d(),Ns.add(e,"error")},[])});function iP({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 r.jsxs("div",{className:"rounded-md border border-border",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-border px-3 py-1.5",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ml,{className:"size-3.5 text-amber-700"}),r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Claude Code · last session"}),e.sessionId?r.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:e.sessionId.slice(0,8)}):null]}),r.jsxs("span",{className:"font-mono text-sm font-semibold text-emerald-700",children:["$",e.costUSD.toFixed(4)]})]}),r.jsx(u3,{segments:t}),r.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:[r.jsx(rn,{label:"Input",value:pn(e.inputTokens)}),r.jsx(rn,{label:"Output",value:pn(e.outputTokens)}),r.jsx(rn,{label:"Cache read",value:pn(e.cacheReadInputTokens)}),r.jsx(rn,{label:"Cache create",value:pn(e.cacheCreationInputTokens)}),r.jsx(rn,{label:"Lines +",value:String(e.linesAdded)}),r.jsx(rn,{label:"Lines −",value:String(e.linesRemoved)}),r.jsx(rn,{label:"Wall",value:Ew(e.durationMs)}),r.jsx(rn,{label:"API",value:Ew(e.apiDurationMs)})]}),e.fiveHour||e.weekly?r.jsxs("div",{className:"space-y-2 border-t border-border px-3 py-2",children:[r.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Rate limits"}),e.fiveHour?r.jsx(Ph,{label:"5h block",window:e.fiveHour}):null,e.weekly?r.jsx(Ph,{label:"This week",window:e.weekly}):null]}):null,e.models.length?r.jsxs("div",{className:"space-y-1 border-t border-border px-3 py-2",children:[r.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:"By model"}),e.models.map(s=>r.jsxs("div",{className:"flex items-center justify-between gap-2 font-mono text-[11px]",children:[r.jsx("span",{className:"truncate",children:s.model}),r.jsxs("span",{className:"shrink-0 text-muted-foreground",children:[pn(s.inputTokens+s.outputTokens)," tok ·"," ",r.jsxs("span",{className:"text-emerald-700",children:["$",s.costUSD.toFixed(4)]})]})]},s.model))]}):null]})}function rP({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 r.jsxs("div",{className:"rounded-md border border-border",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-1.5",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ou,{className:"size-3.5 text-foreground"}),r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Codex · last session"})]}),e.timestamp?r.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:new Date(e.timestamp).toLocaleString()}):null]}),r.jsx(u3,{segments:s}),r.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:[r.jsx(rn,{label:"Input",value:pn(e.inputTokens)}),r.jsx(rn,{label:"Output",value:pn(e.outputTokens)}),r.jsx(rn,{label:"Cache read",value:pn(e.cachedInputTokens)}),r.jsx(rn,{label:"Reasoning",value:pn(e.reasoningOutputTokens)}),r.jsx(rn,{label:"Total",value:pn(e.totalTokens)}),r.jsx(rn,{label:"Last turn",value:pn(e.lastTotalTokens)}),r.jsx(rn,{label:"Context",value:e.contextWindow?pn(e.contextWindow):"n/a"}),r.jsx(rn,{label:"Cost",value:"n/a"})]}),e.contextWindow?r.jsx("div",{className:"border-t border-border px-3 py-2",children:r.jsx(aP,{label:"Last turn context share",value:t,tone:"bg-sky-500"})}):null,e.primary||e.secondary?r.jsxs("div",{className:"space-y-2 border-t border-border px-3 py-2",children:[r.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Rate limits"}),e.primary?r.jsx(Ph,{label:"5h window",window:e.primary}):null,e.secondary?r.jsx(Ph,{label:"Weekly window",window:e.secondary}):null]}):null]})}function u3({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 r.jsxs("div",{className:"px-3 py-2.5",children:[r.jsxs("div",{className:"mb-1.5 flex items-center justify-between text-[10px] uppercase tracking-wide text-muted-foreground",children:[r.jsx("span",{className:"font-semibold",children:"Tokens"}),r.jsxs("span",{className:"font-mono normal-case",children:[pn(s)," in · ",pn(n)," out"]})]}),r.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?r.jsx("div",{className:de("h-full",o.className),style:{width:`${(o.value/t*100).toFixed(2)}%`},title:`${o.label}: ${pn(o.value)} (${(o.value/t*100).toFixed(1)}%)`},o.label):null)}),r.jsx("div",{className:"mt-2 grid grid-cols-2 gap-x-3 gap-y-1 sm:grid-cols-4",children:e.map(o=>r.jsxs("div",{className:"flex items-center gap-1.5 text-[11px]",children:[r.jsx("span",{className:de("size-2 shrink-0 rounded-sm",o.className)}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-muted-foreground",children:o.label}),r.jsxs("span",{className:"shrink-0 font-mono text-foreground",children:[t>0?(o.value/t*100).toFixed(0):"0","%"]})]},o.label))})]})}function aP({label:e,value:t,tone:s}){const n=Math.min(100,Math.max(0,t));return r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between text-[11px] text-muted-foreground",children:[r.jsx("span",{children:e}),r.jsxs("span",{className:"font-mono",children:[n.toFixed(1),"%"]})]}),r.jsx("div",{className:"mt-1 h-1.5 overflow-hidden rounded-full bg-muted",children:r.jsx("div",{className:de("h-full",s),style:{width:`${n.toFixed(2)}%`}})})]})}function Ph({label:e,window:t}){const s=Math.min(100,Math.max(0,t.usedPercent)),n=t.resetsAtUnix?new Date(t.resetsAtUnix*1e3).toLocaleString():null,o=s>=90?"bg-red-500":s>=70?"bg-amber-500":"bg-emerald-500";return r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between text-[11px]",children:[r.jsx("span",{className:"text-muted-foreground",children:e}),r.jsxs("span",{className:"font-mono",children:[s.toFixed(1),"%"]})]}),r.jsx("div",{className:"mt-1 h-1.5 overflow-hidden rounded-full bg-muted",children:r.jsx("div",{className:de("h-full",o),style:{width:`${s.toFixed(2)}%`}})}),n?r.jsxs("div",{className:"mt-0.5 font-mono text-[10px] text-muted-foreground",children:["resets ",n]}):null]})}function rn({label:e,value:t}){return r.jsxs("div",{children:[r.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:e}),r.jsx("div",{className:"font-mono text-xs font-semibold",children:t})]})}function pn(e){return e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function Ew(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 oP(e=1e4){const[t,s]=y.useState(null),[n,o]=y.useState(null);return y.useEffect(()=>{let l=!0;const u=()=>{DD().then(m=>{l&&(s(m),o(null))}).catch(m=>{l&&o(m instanceof Error?m.message:String(m))})};u();const h=window.setInterval(u,e);return()=>{l=!1,window.clearInterval(h)}},[e]),{usage:t,error:n}}const lP={"claude-code":{label:"Claude Code",icon:r.jsx(ml,{})},codex:{label:"Codex",icon:r.jsx(ou,{})}};function cP({agent:e,agentId:t,isDetected:s}){const{usage:n,error:o}=oP(),l=lP[t],u=t==="codex";return r.jsxs(Ei,{className:"min-w-0 rounded-none border-0 bg-transparent",children:[r.jsxs(ji,{className:"border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx(kN,{className:"size-4 text-muted-foreground"}),r.jsx(Ti,{children:u?"Token Usage & Rate Limits":"Token & Cost Usage"}),r.jsx(et,{variant:"outline",size:"small",icon:l.icon,children:l.label}),s?r.jsx(et,{variant:"outline",size:"small",children:"active session"}):r.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Not the active agent in this session"}),u?null:r.jsx(uP,{className:"ml-auto"})]}),r.jsxs(Xi,{className:"truncate text-xs",children:[u?r.jsxs(r.Fragment,{children:["Session metrics from ",r.jsx("code",{className:"font-mono",children:"~/.codex/sessions"})]}):r.jsxs(r.Fragment,{children:["Last-session metrics from ",r.jsx("code",{className:"font-mono",children:"~/.claude.json"})]})," · ",r.jsx("span",{className:"font-mono",children:e.project.cwd})]})]}),r.jsxs(Ai,{className:"p-3",children:[o?r.jsx("p",{className:"text-xs text-destructive",children:o}):null,u?n?.codex?r.jsx(rP,{usage:n.codex}):o?null:r.jsx(jw,{agent:"Codex CLI"}):n?.claude?r.jsx(iP,{usage:n.claude}):o?null:r.jsx(jw,{agent:"Claude Code"})]})]})}function uP({className:e}){const[t,s]=y.useState(!0),[n,o]=y.useState(!0),[l,u]=y.useState(!1),h=$s();y.useEffect(()=>{let d=!0;return OD().then(p=>d&&s(p.coAuthorWithClaude)).catch(()=>{}).finally(()=>d&&o(!1)),()=>{d=!1}},[]);const m=async()=>{const d=!t;u(!0),s(d);try{const p=await LD({coAuthorWithClaude:d});s(p.coAuthorWithClaude),h.success(p.coAuthorWithClaude?"Claude co-author trailer enabled for commits":"Claude co-author trailer disabled for commits")}catch(p){s(!d),h.error(p instanceof Error?p.message:"Failed to update setting")}finally{u(!1)}};return r.jsxs(J,{type:"button",variant:t?"default":"outline",size:"sm",onClick:m,disabled:n||l,"aria-pressed":t,title:t?"Claude will be added as commit co-author. Click to disable.":"Co-author trailer disabled. Click to enable.",className:de("gap-1.5",e),children:[r.jsx(ml,{className:"size-3.5"}),"Co-author"]})}function jw({agent:e}){return r.jsxs("p",{className:"text-xs text-muted-foreground",children:["No usage data yet. Run a session with ",e," in this project."]})}const Tw=["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
|
+
`),dP=["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 hP(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 fP(e){return e.map(t=>`- ${t.name}: ${t.dataType}${t.primaryKey?" (PK)":""}${t.nullable?"":" NOT NULL"}`).join(`
|
|
27
|
+
`)}function d3(e){return e?.length?["## Table schema",fP(e),""].join(`
|
|
28
|
+
`):""}const h3="Your prompt: ";function mP(e,t,s,n,o){return[`I'm looking at a row in my ${t} database (connection "${e}", table \`${s.qualifiedName}\`).`,"",d3(n),"## Row","```json",JSON.stringify(o,null,2),"```","",h3].join(`
|
|
29
|
+
`)}function Aw(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=d3(s?.columns);return l&&o.push(l),o.push(h3),o.join(`
|
|
30
|
+
`)}function pP(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 gP(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 bP({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 xP(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 vP(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 _P(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 yP(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 SP(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 wP(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 f3(e){return`Pull request #${e.number} — "${e.title}" (${e.head.ref} → ${e.base.ref}, by ${e.user.login}):`}function kP(e,t){return[f3(e),"",t,"",`Pull the diff with \`gh pr diff ${e.number}\` (or your GitHub tools) if you need it.`].join(`
|
|
42
|
+
`)}function NP(e,t,s){return[f3(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 CP(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 EP(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 jP({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 Rw(){return{serviceNames:[],databaseNames:[],errorIds:[],repositoryPaths:[]}}function TP(e){return e.serviceNames.length>0||e.databaseNames.length>0||e.errorIds.length>0||e.repositoryPaths.length>0}function AP({dashboard:e,databases:t,incidents:s,note:n,selection:o}){const l=[MP(e,o.serviceNames),DP(t,o.databaseNames),OP(s,o.errorIds),LP(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 RP({note:e,selection:t}){const s=[Hd(t.serviceNames.length,"service"),Hd(t.databaseNames.length,"database"),Hd(t.errorIds.length,"error"),Hd(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 MP(e,t){return t.length?["Services",t.map(n=>{const o=e.config.services.find(m=>m.name===n),l=e.runtime.services[n],u=e.health[n],h=e.logs.filter(m=>m.service===n).slice(-8).map(m=>`${m.timestamp} ${m.stream}: ${m.text}`);return[`Service: ${n}`,o?.kind?`kind: ${o.kind}`:null,o?.command?`command: ${o.command}`:null,o?.cwd?`cwd: ${o.cwd}`:null,o?.port?`port: ${o.port}`:null,l?`state: ${l.state}`:"state: unknown",l?.pid?`pid: ${l.pid}`:null,l?.url?`url: ${l.url}`:null,l?.exitCode!==void 0&&l.exitCode!==null?`exitCode: ${l.exitCode}`:null,u?`health: ${u.status} - ${u.summary}`:null,u?.agentContext?`agent debug context:
|
|
53
|
+
${u.agentContext}`:null,h.length?`recent logs:
|
|
54
|
+
${h.join(`
|
|
55
|
+
`)}`:null].filter(Boolean).join(`
|
|
56
|
+
`)}).join(`
|
|
57
|
+
|
|
58
|
+
`)].join(`
|
|
59
|
+
`):null}function DP(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 OP(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 LP(e,t){if(!t.length)return null;const s=zP(e),n=e.git.selectedRepository?.path??e.git.cwd,o=e.git.status?.files.map(u=>`${u.index}${u.workingTree}: ${u.path}`)??[];return["Git Repositories",t.map(u=>{const h=s.find(d=>d.path===u),m=u===n;return[`Repository: ${h?.name??u.split("/").pop()??u}`,`path: ${u}`,m?"current: yes":"current: no",m?o.length?`changed files:
|
|
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 zP(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 Hd(e,t){return e?`${e} ${t}${e===1?"":"s"}`:null}function ff(e){return e==="codex"?"Codex":"Claude Code"}function BP(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 ${ff(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 IP(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 PP(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 $P(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 ${ff(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 HP(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 UP(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 FP(e,t){return[`Install a plugin for ${ff(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 qP(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 VP(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 GP(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 ${ff(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 WP(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 KP(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 m3({id:e,className:t}){return e==="codex"?r.jsx(ou,{className:de("text-foreground",t)}):e==="gemini"?r.jsx(AI,{className:de("text-[#1A73E8]",t)}):r.jsx(ml,{className:de("text-[#D97757]",t)})}function Gt({className:e}){const{provider:t}=It();return r.jsx(m3,{id:t?.id,className:e})}function Ki({onAsk:e,label:t,className:s}){const{provider:n}=It(),o=t??`Ask ${n?.label??"Claude"}`;return r.jsx("button",{"aria-label":o,className:de("flex size-6 items-center justify-center rounded-md opacity-0 transition-all duration-150 hover:bg-muted group-hover:opacity-100",s),onClick:e,title:o,type:"button",children:r.jsx(m3,{id:n?.id,className:"size-3.5"})})}function jr({placeholder:e,onSubmit:t,onCancel:s,className:n}){const[o,l]=y.useState(""),u=()=>{const m=o.trim();m&&t(m)},h=y.useCallback(m=>{m?.focus()},[]);return r.jsxs("form",{className:de("flex items-center gap-1.5 rounded-md border border-primary/40 bg-primary/5 px-1.5 py-1",n),onSubmit:m=>{m.preventDefault(),u()},children:[r.jsx(Ki,{className:"size-5 opacity-100",label:"Send to the agent",onAsk:u}),r.jsx("input",{ref:h,className:"min-w-0 flex-1 bg-transparent text-xs outline-none placeholder:text-muted-foreground",onChange:m=>l(m.target.value),onKeyDown:m=>{m.key==="Escape"&&s()},placeholder:e,value:o}),r.jsx(J,{type:"submit",size:"icon",className:"size-6",disabled:!o.trim(),title:"Send",children:r.jsx(on,{className:"size-3.5"})}),r.jsx(J,{type:"button",size:"icon",variant:"ghost",className:"size-6",onClick:s,"aria-label":"Cancel",title:"Cancel",children:r.jsx(ts,{className:"size-3.5"})})]})}function mf({label:e,onClick:t}){return r.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:[r.jsx(Es,{className:"size-3.5"}),"Add"]})}function pf({askLabel:e,removeLabel:t,onAsk:s,onRemove:n}){return r.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[r.jsx(Ki,{label:e,onAsk:s}),r.jsx(YP,{label:t,onConfirm:n})]})}function YP({label:e,onConfirm:t}){const[s,n]=y.useState(!1);return s?r.jsxs("span",{className:"flex items-center gap-0.5",children:[r.jsx("button",{type:"button","aria-label":e,title:e,onClick:()=>{n(!1),t()},className:"flex size-6 items-center justify-center rounded-md text-emerald-600 transition-colors hover:bg-emerald-500/10",children:r.jsx(on,{className:"size-3.5"})}),r.jsx("button",{type:"button","aria-label":"Cancel",title:"Cancel",onClick:()=>n(!1),className:"flex size-6 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted",children:r.jsx(ts,{className:"size-3.5"})})]}):r.jsx("button",{type:"button","aria-label":e,title:e,onClick:()=>n(!0),className:"flex size-6 items-center justify-center rounded-md text-muted-foreground opacity-0 transition-all duration-150 hover:bg-destructive/10 hover:text-destructive group-hover:opacity-100",children:r.jsx(Er,{className:"size-3.5"})})}function XP({agent:e,agentId:t,alternateHooks:s}){const{sendToAgent:n}=It(),[o,l]=y.useState(!1),u=e.hooks??[];function h(p){l(!1),n({prompt:GP(t,p),source:{type:"agent-hook",label:"New hook"},label:`Add hook: ${p}`})}function m(p){n({prompt:KP(p),source:{type:"agent-hook",label:`${p.event} hook`},mode:"draft"})}function d(p){n({prompt:WP(p),source:{type:"agent-hook",label:`Remove ${p.event}`},label:`Remove hook: ${p.event}`})}return r.jsxs(Ei,{className:"min-w-0 rounded-none border-0 border-t border-border bg-transparent md:border-l lg:border-t-0",children:[r.jsxs(ji,{className:"border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(HM,{className:"size-4 text-muted-foreground"}),r.jsx(Ti,{children:"Hooks"})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(et,{variant:"outline",size:"small",children:u.length}),r.jsx(mf,{label:"Add a hook with AI",onClick:()=>l(p=>!p)})]})]}),o?r.jsx(jr,{className:"mt-1.5",placeholder:"Describe the event, matcher, and command…",onSubmit:h,onCancel:()=>l(!1)}):r.jsx(Xi,{className:"text-xs",children:t==="codex"?"Codex hooks from ~/.codex/hooks.json, with state from ~/.codex/config.toml.":"PreToolUse, PostToolUse, and other Claude Code hooks from user and project settings."})]}),r.jsx(Ai,{className:"p-0",children:u.length?r.jsx("ul",{className:"divide-y divide-border",children:u.map(p=>r.jsxs("li",{className:"group px-3 py-2 hover:bg-muted/40",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[r.jsx("span",{className:"min-w-0 truncate font-mono text-xs font-semibold",title:p.event,children:p.event}),r.jsx(pf,{askLabel:`Ask AI about the ${p.event} hook`,removeLabel:`Remove the ${p.event} hook`,onAsk:()=>m(p),onRemove:()=>d(p)})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[r.jsx(QP,{hook:p}),r.jsx(JP,{hook:p}),r.jsx(et,{variant:"outline",size:"small",children:p.scope})]})]}),r.jsx("div",{className:"mt-1 truncate font-mono text-[11px] text-muted-foreground",title:Mw(p),children:Mw(p)})]},p.id))}):r.jsx(ZP,{agentId:t,alternateHooks:s})})]})}function ZP({agentId:e,alternateHooks:t}){const s=e==="codex"?"Codex":"Claude Code";return r.jsxs("p",{className:"px-3 py-4 text-xs text-muted-foreground",children:["No ",s," hooks configured.",t?.count?r.jsxs(r.Fragment,{children:[" ",t.agentLabel," has ",t.count," hook",t.count===1?"":"s","; switch agents above to view them."]}):null]})}function QP({hook:e}){return e.status==="enabled"?r.jsx(et,{variant:"success",appearance:"subtle",size:"small",children:"Enabled"}):e.status==="disabled"?r.jsx(et,{variant:"error",appearance:"subtle",size:"small",children:"Disabled"}):r.jsx(et,{variant:"warning",appearance:"subtle",size:"small",children:"Default"})}function JP({hook:e}){return e.trusted===void 0?null:r.jsx(et,{variant:e.trusted?"success":"warning",appearance:"subtle",size:"small",children:e.trusted?"Trusted":"Untrusted"})}function e$(e){return e.command?e.command:e.type??e.settingsPath}function Mw(e){return`${e.matcher?`matcher ${e.matcher} · `:""}${e$(e)}`}function t$({agent:e,agentId:t}){const{sendToAgent:s}=It(),[n,o]=y.useState([]),[l,u]=y.useState(!1),[h,m]=y.useState(!1),d=y.useCallback(async()=>{u(!0);try{o(await MD(t))}catch{o([])}finally{u(!1)}},[t]);y.useEffect(()=>{d()},[d]);const p=y.useMemo(()=>{const k={};for(const N of n)k[N.name]=N.state;return k},[n]),g=y.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 b(k){m(!1),s({prompt:$P(t,k),source:{type:"agent-mcp",label:"New MCP server"},label:`Add MCP server: ${k}`})}function v(k){s({prompt:UP(k),source:{type:"agent-mcp",label:`${k.name} server`},mode:"draft"})}function w(k){s({prompt:HP(k,t),source:{type:"agent-mcp",label:`Remove ${k.name}`},label:`Remove MCP server: ${k.name}`})}return r.jsxs(Ei,{className:"min-w-0 rounded-none border-0 bg-transparent md:border-l md:border-border",children:[r.jsxs(ji,{className:"border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(MN,{className:"size-4 text-muted-foreground"}),r.jsx(Ti,{children:"MCP Servers"})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(et,{variant:"outline",size:"small",children:g.length}),r.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:r.jsx(Cr,{className:l?"animate-spin":void 0})}),r.jsx(mf,{label:"Register an MCP server with AI",onClick:()=>m(k=>!k)})]})]}),h?r.jsx(jr,{className:"mt-1.5",placeholder:"Paste the MCP install command or URL…",onSubmit:b,onCancel:()=>m(!1)}):r.jsxs(Xi,{className:"text-xs",children:["From"," ",r.jsx("code",{className:"font-mono",children:t==="codex"?"~/.codex/config.toml":"~/.claude.json"}),t==="codex"?"":" + claude.ai connectors",". Status via"," ",r.jsxs("code",{className:"font-mono",children:[t==="codex"?"codex":"claude"," mcp list"]})," ","(fresh health check)."]})]}),r.jsx(Ai,{className:"p-0",children:g.length?r.jsx("ul",{className:"divide-y divide-border",children:g.map(k=>r.jsxs("li",{className:"group px-3 py-2 hover:bg-muted/40",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[r.jsx("span",{className:"min-w-0 truncate font-mono text-xs font-semibold",title:k.name,children:k.name}),r.jsx(pf,{askLabel:`Ask AI about the ${k.name} server`,removeLabel:`Remove the ${k.name} server`,onAsk:()=>v(k),onRemove:()=>w(k)})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[r.jsx(n$,{state:p[k.name],loading:l}),r.jsx(et,{variant:"outline",size:"small",children:k.synthetic?"connector":k.scope})]})]}),r.jsx("div",{className:"mt-1 truncate font-mono text-[11px] text-muted-foreground",title:k.synthetic?"claude.ai managed connector":Dw(k),children:k.synthetic?"claude.ai managed connector":Dw(k)})]},`${k.scope}:${k.name}`))}):r.jsx("p",{className:"px-3 py-4 text-xs text-muted-foreground",children:"No MCP servers configured."})})]})}const s$={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 n$({state:e,loading:t}){if(!e)return t?r.jsx(Et,{className:"size-3 animate-spin text-muted-foreground"}):null;const s=e==="unknown"?void 0:s$[e];return s?r.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[r.jsx("span",{className:de("size-1.5 shrink-0 rounded-full",s.dot),"aria-hidden":!0}),s.label]}):null}function Dw(e){return e.command?[e.command,...e.args??[]].join(" "):e.url??e.type??"-"}function i$({agent:e,agentId:t}){const{sendToAgent:s}=It(),[n,o]=y.useState(!1),l=e.plugins??[];function u(d){o(!1),s({prompt:FP(t,d),source:{type:"agent-plugin",label:"New plugin"},label:`Install plugin: ${d}`})}function h(d){s({prompt:VP(d),source:{type:"agent-plugin",label:`${d.name} plugin`},mode:"draft"})}function m(d){s({prompt:qP(d),source:{type:"agent-plugin",label:`Remove ${d.name}`},label:`Uninstall plugin: ${d.name}`})}return r.jsxs(Ei,{className:"min-w-0 rounded-none border-0 border-t border-border bg-transparent lg:border-l lg:border-t-0",children:[r.jsxs(ji,{className:"border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(qA,{className:"size-4 text-muted-foreground"}),r.jsx(Ti,{children:"Plugins"})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(et,{variant:"outline",size:"small",children:l.length}),r.jsx(mf,{label:"Install a plugin with AI",onClick:()=>o(d=>!d)})]})]}),n?r.jsx(jr,{className:"mt-1.5",placeholder:"Paste a plugin name, marketplace, or install command…",onSubmit:u,onCancel:()=>o(!1)}):r.jsx(Xi,{className:"text-xs",children:t==="codex"?"Codex doesn't expose an installed-plugin registry here yet.":"Installed from marketplaces (~/.claude/plugins). Each bundles skills, commands, agents, and MCP servers."})]}),r.jsx(Ai,{className:"p-0",children:l.length?r.jsx("ul",{className:"divide-y divide-border",children:l.map(d=>r.jsxs("li",{className:"group px-3 py-2 hover:bg-muted/40",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[r.jsx("span",{className:"min-w-0 truncate font-mono text-xs font-semibold",title:d.name,children:d.name}),r.jsx(pf,{askLabel:`Ask AI about the ${d.name} plugin`,removeLabel:`Uninstall the ${d.name} plugin`,onAsk:()=>h(d),onRemove:()=>m(d)})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[d.version&&d.version!=="unknown"?r.jsxs(et,{variant:"outline",size:"small",children:["v",d.version]}):null,d.marketplace?r.jsx(et,{variant:"outline",size:"small",children:d.marketplace}):null]})]}),d.description?r.jsx("p",{className:"mt-1 truncate text-[11px] text-muted-foreground",title:d.description,children:d.description}):null,r.jsx(r$,{plugin:d})]},`${d.name}@${d.marketplace??""}`))}):r.jsx("p",{className:"px-3 py-4 text-xs text-muted-foreground",children:"No plugins installed."})})]})}function r$({plugin:e}){const t=[];return e.skills.length&&t.push(`${e.skills.length} skill${Ud(e.skills.length)}`),e.commands.length&&t.push(`${e.commands.length} command${Ud(e.commands.length)}`),e.agents.length&&t.push(`${e.agents.length} agent${Ud(e.agents.length)}`),e.mcpServers.length&&t.push(`${e.mcpServers.length} MCP server${Ud(e.mcpServers.length)}`),t.length?r.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1",children:t.map(s=>r.jsx("span",{className:"rounded-full bg-muted px-2 py-0.5 text-[10px] text-muted-foreground",children:s},s))}):null}function Ud(e){return e===1?"":"s"}function a$({agent:e,agentId:t}){const{sendToAgent:s}=It(),[n,o]=y.useState(!1);function l(m){o(!1),s({prompt:BP(t,m),source:{type:"agent-skill",label:"New skill"},label:`Add skill: ${m}`})}function u(m){s({prompt:PP(m),source:{type:"agent-skill",label:`${m.name} skill`},mode:"draft"})}function h(m){s({prompt:IP(m),source:{type:"agent-skill",label:`Remove ${m.name}`},label:`Remove skill: ${m.name}`})}return r.jsxs(Ei,{className:"min-w-0 rounded-none border-0 bg-transparent",children:[r.jsxs(ji,{className:"border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ci,{className:"size-4 text-muted-foreground"}),r.jsx(Ti,{children:"Skills"})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(et,{variant:"outline",size:"small",children:e.skills.length}),r.jsx(mf,{label:"Add a skill with AI",onClick:()=>o(m=>!m)})]})]}),n?r.jsx(jr,{className:"mt-1.5",placeholder:"Paste a skill URL/repo, or describe the skill…",onSubmit:l,onCancel:()=>o(!1)}):r.jsx(Xi,{className:"text-xs",children:t==="codex"?"User, project, and system skills discovered for Codex.":"User and project skills discovered for the active agent."})]}),r.jsx(Ai,{className:"p-0",children:e.skills.length?r.jsx("ul",{className:"divide-y divide-border",children:e.skills.map(m=>r.jsxs("li",{className:"group px-3 py-2 hover:bg-muted/40",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[r.jsx("span",{className:"min-w-0 truncate font-mono text-xs font-semibold",title:m.name,children:m.name}),r.jsx(pf,{askLabel:`Ask AI about the ${m.name} skill`,removeLabel:`Remove the ${m.name} skill`,onAsk:()=>u(m),onRemove:()=>h(m)})]}),r.jsx("div",{className:"flex shrink-0 items-center gap-1.5",children:r.jsx(et,{variant:"outline",size:"small",children:m.scope})})]}),m.description?r.jsx("p",{className:"mt-1 truncate text-[11px] text-muted-foreground",title:m.description,children:m.description}):null]},`${m.scope}:${m.name}`))}):r.jsx("p",{className:"px-3 py-4 text-xs text-muted-foreground",children:"No skills found."})})]})}function o$({agent:e,agentId:t,alternateHooks:s}){return r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4",children:[r.jsx(a$,{agent:e,agentId:t}),r.jsx(t$,{agent:e,agentId:t}),r.jsx(i$,{agent:e,agentId:t}),r.jsx(XP,{agent:e,agentId:t,alternateHooks:s})]})}const l$=[{id:"claude-code",chatId:"claude",label:"Claude Code",icon:r.jsx(ml,{className:"size-4"})},{id:"codex",chatId:"codex",label:"Codex",icon:r.jsx(ou,{className:"size-4"})}],c$=[{id:"overview",label:"Overview",icon:r.jsx(kN,{className:"size-3.5"})},{id:"memory",label:"Memory",icon:r.jsx(pN,{className:"size-3.5"})},{id:"tools",label:"Skills, MCPs, Plugins & Hooks",icon:r.jsx(MN,{className:"size-3.5"})},{id:"activity",label:"Activity",icon:r.jsx(Za,{className:"size-3.5"})},{id:"changes",label:"Changes",icon:r.jsx(B4,{className:"size-3.5"})}];function u$(){const[e,t]=y.useState(null),[s,n]=y.useState(null),[o,l]=y.useState("claude-code"),[u,h]=y.useState("overview"),{clear:m,turns:d,provider:p,providers:g,selectProvider:b}=It();function v(N,E){l(N),p?.id!==E&&b(E)}if(y.useEffect(()=>{p&&l(p.id==="codex"?"codex":"claude-code")},[p]),y.useEffect(()=>{let N=!0;return VN().then(E=>{N&&t(E)}).catch(E=>{N&&n(E instanceof Error?E.message:String(E))}),()=>{N=!1}},[]),s)return r.jsx("div",{className:"h-full overflow-auto bg-card/85 p-4",children:r.jsxs(tt,{variant:"muted",className:"border-destructive/40 text-destructive",children:["Failed to load agent info: ",s]})});if(!e)return r.jsx("div",{className:"h-full overflow-auto bg-card/85 p-4",children:r.jsx(tt,{variant:"muted",children:"Loading agent info…"})});const w=e.agents?.[o]??e,k=o==="codex"?{agentLabel:"Claude Code",count:e.agents["claude-code"].hooks.length}:{agentLabel:"Codex",count:e.agents.codex.hooks.length};return r.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/85",children:[r.jsx("div",{className:"flex shrink-0 items-center gap-2 border-b border-border bg-card/90 px-3 py-2",children:l$.map(N=>{const E=o===N.id,A=e.detected.name===N.id,j=p?.id===N.chatId,P=g.find(z=>z.id===N.chatId)?.configured??!0;return r.jsxs("button",{type:"button",onClick:()=>v(N.id,N.chatId),title:P?`Use ${N.label} for chat`:`${N.label} CLI isn't installed`,className:de("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",!P&&"opacity-60"),children:[N.icon,N.label,j?r.jsx("span",{className:"rounded-full bg-primary/15 px-1.5 py-px text-[10px] font-medium text-primary",children:"In use"}):A?r.jsx("span",{className:"size-1.5 rounded-full bg-emerald-500",title:"Detected agent","aria-hidden":!0}):P?null:r.jsx("span",{className:"text-[10px] font-normal text-muted-foreground",children:"not installed"})]},N.id)})}),r.jsx("div",{className:"flex shrink-0 items-center gap-1 border-b border-border bg-card/90 px-3",children:c$.map(N=>r.jsxs("button",{type:"button",onClick:()=>h(N.id),className:de("relative flex items-center gap-1.5 px-2.5 py-2 text-xs font-medium transition-colors",u===N.id?"text-foreground":"text-muted-foreground hover:text-foreground"),children:[N.icon,N.label,u===N.id?r.jsx("span",{className:"absolute inset-x-1 -bottom-px h-0.5 bg-primary"}):null]},N.id))}),r.jsx(WI,{onNewChat:m,turns:d}),r.jsxs("div",{className:"min-h-0 flex-1 overflow-auto",children:[u==="overview"?r.jsx(cP,{agent:w,agentId:o,isDetected:e.detected.name===o}):null,u==="memory"?r.jsx(KI,{agent:w,agentId:o}):null,u==="tools"?r.jsx(o$,{agent:w,agentId:o,alternateHooks:k}):null,u==="activity"?r.jsx(jI,{agent:w,agentId:o}):null,u==="changes"?r.jsx($I,{}):null]})]})}var va=dN();function Kn({children:e,icon:t,onClose:s,title:n,size:o="md"}){return y.useEffect(()=>{function l(u){u.key==="Escape"&&s()}return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[s]),va.createPortal(r.jsx("div",{className:"fixed inset-0 z-[1000] grid place-items-center bg-black/35 px-4",onMouseDown:s,children:r.jsxs("div",{"aria-modal":"true",className:`flex max-h-[min(820px,calc(100vh-2rem))] w-full flex-col overflow-hidden rounded-lg border border-border bg-card shadow-xl ${o==="xl"?"max-w-[min(1400px,calc(100vw-2rem))]":o==="lg"?"max-w-3xl":"max-w-lg"}`,onMouseDown:l=>l.stopPropagation(),role:"dialog",children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[r.jsx("div",{className:"flex size-8 items-center justify-center rounded-md border border-border bg-background text-foreground [&_svg]:size-4",children:t}),r.jsx("h2",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:n}),r.jsx(J,{"aria-label":"Close dialog",onClick:s,size:"icon",type:"button",variant:"ghost",children:r.jsx(ts,{})})]}),r.jsx("div",{className:"min-h-0 overflow-auto p-4",children:e})]})}),document.body)}function gt({className:e,type:t,...s}){return r.jsx("input",{type:t,className:de("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 d$={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 tl({label:e,children:t,side:s="bottom",className:n}){return r.jsxs("span",{className:de("group/tt relative inline-flex",n),children:[t,r.jsx("span",{role:"tooltip",className:de("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",d$[s]),children:e})]})}const bx="application/x-nomoreide-path";function cu(e,t){return`${e.replace(/\/+$/,"")}/${t.replace(/^\/+/,"")}`}function p3(e,t){e.setData(bx,t)}function Ow(e){return e.types.includes(bx)}function h$(e){return e.getData(bx)||null}function g3(e){return{draggable:!0,onDragStart:t=>{p3(t.dataTransfer,e),t.dataTransfer.effectAllowed="copy"}}}const mi='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>',pi='</title><path d="',gi='"/></svg>',f$={title:".NET",slug:"dotnet",get svg(){return mi+".NET"+pi+this.path+gi},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"}},m$={title:"Bun",slug:"bun",get svg(){return mi+"Bun"+pi+this.path+gi},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"},p$={title:"Deno",slug:"deno",get svg(){return mi+"Deno"+pi+this.path+gi},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"}},g$={title:"Docker",slug:"docker",get svg(){return mi+"Docker"+pi+this.path+gi},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"},b$={title:"Go",slug:"go",get svg(){return mi+"Go"+pi+this.path+gi},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"},x$={title:"Node.js",slug:"nodedotjs",get svg(){return mi+"Node.js"+pi+this.path+gi},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"},v$={title:"npm",slug:"npm",get svg(){return mi+"npm"+pi+this.path+gi},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"},_$={title:"pnpm",slug:"pnpm",get svg(){return mi+"pnpm"+pi+this.path+gi},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"},y$={title:"Python",slug:"python",get svg(){return mi+"Python"+pi+this.path+gi},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/"},Lw={title:"Rust",slug:"rust",get svg(){return mi+"Rust"+pi+this.path+gi},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"}},S$={title:"Vite",slug:"vite",get svg(){return mi+"Vite"+pi+this.path+gi},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"},w$={title:"Yarn",slug:"yarn",get svg(){return mi+"Yarn"+pi+this.path+gi},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 k$(e){const t=e.toLowerCase();return/\bvite\b/.test(t)?Mn.vite:/\bcargo\s+/.test(t)?Mn.cargo:/\brustc\b/.test(t)?Mn.rust:/\bdotnet\b/.test(t)?Mn.dotnet:/\bdocker(?:\s+compose|-compose|\s+)/.test(t)?Mn.docker:/\bpython3?\b|\buvicorn\b|\bfastapi\b/.test(t)?Mn.python:/\bgo\s+(run|test|build)\b|\bair\b/.test(t)?Mn.go:/\bbun\b/.test(t)?Mn.bun:/\bdeno\b/.test(t)?Mn.deno:/\bpnpm\b/.test(t)?Mn.pnpm:/\byarn\b/.test(t)?Mn.yarn:/\bnpm\b/.test(t)?Mn.npm:/\bnode\b/.test(t)?Mn.node:Mn.generic}const Mn={bun:{kind:"bun",label:"Bun"},cargo:{kind:"cargo",label:"Cargo"},deno:{kind:"deno",label:"Deno"},dotnet:{kind:"dotnet",label:".NET"},docker:{kind:"docker",label:"Docker"},generic:{kind:"generic",label:"Process"},go:{kind:"go",label:"Go"},node:{kind:"node",label:"Node"},npm:{kind:"npm",label:"npm"},pnpm:{kind:"pnpm",label:"pnpm"},python:{kind:"python",label:"Python"},rust:{kind:"rust",label:"Rust"},vite:{kind:"vite",label:"Vite"},yarn:{kind:"yarn",label:"Yarn"}};function xx({command:e,compact:t}){const s=k$(e),n=N$[s.kind];return r.jsx("span",{"aria-label":`${s.label} process`,className:de("inline-flex shrink-0 items-center justify-center rounded-md border bg-card shadow-sm dark:border-zinc-700/80 dark:bg-zinc-100",t?"size-6":"size-7",n?"border-border":"border-border bg-muted text-muted-foreground dark:bg-zinc-100 dark:text-zinc-700"),style:n?{color:`#${n.hex}`}:void 0,title:s.label,children:n?r.jsx("svg",{"aria-hidden":"true",className:t?"size-3.5":"size-4",fill:"currentColor",role:"img",viewBox:"0 0 24 24",children:r.jsx("path",{d:n.path})}):r.jsx(cl,{className:t?"size-3.5":"size-4"})})}const N$={bun:m$,cargo:Lw,deno:p$,dotnet:f$,docker:g$,generic:null,go:b$,node:x$,npm:v$,pnpm:_$,python:y$,rust:Lw,vite:S$,yarn:w$};function ai({className:e,...t}){return r.jsx("label",{className:de("grid gap-1.5 text-xs font-medium text-muted-foreground",e),...t})}const C$=[{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"}],zw=[{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 E$({result:e}){const t=[...e.stdout,...e.stderr].slice(0,4);return r.jsxs(tt,{variant:e.ok?"default":"destructive",children:[r.jsx("div",{className:"font-medium",children:e.ok?"Command test passed":"Command test failed"}),r.jsx("div",{className:"mt-1 text-xs",children:e.message}),t.length?r.jsx("pre",{className:"mt-2 max-h-24 overflow-auto rounded-md bg-background/80 p-2 font-mono text-[11px] leading-4",children:t.join(`
|
|
88
|
+
`)}):null]})}async function j$(e,t,s,n){if(t==="bundle"){if(e==="start")return Zy(s,()=>n?.());if(e==="stop")return Yy(s);await Yy(s),await Zy(s,()=>n?.());return}return e==="start"?tC(s):e==="stop"?Z8(s):Q8(s)}function vx({active:e,baseUrl:t,compact:s=!1,onRefresh:n,onStarted:o,resourceKind:l,resourceName:u,solidStart:h=!1,targetLabel:m}){return e?r.jsxs(r.Fragment,{children:[r.jsx(rg,{baseUrl:t,compact:s,intent:"restart",icon:r.jsx(tu,{}),label:"Restart",op:"restart",resourceKind:l,resourceName:u,targetLabel:m,onRefresh:n,onSuccess:o}),r.jsx(rg,{baseUrl:t,compact:s,intent:"stop",icon:r.jsx(to,{}),label:"Stop",op:"stop",resourceKind:l,resourceName:u,targetLabel:m,onRefresh:n})]}):r.jsx(rg,{baseUrl:t,compact:s,intent:h?"startSolid":"start",icon:r.jsx(Nr,{}),label:"Start",op:"start",resourceKind:l,resourceName:u,targetLabel:m,onRefresh:n,onSuccess:o})}function $h(e,t,s){const n=s instanceof Error?s.message:String(s);return`${e} failed for ${t}: ${n}`}function rg({baseUrl:e,compact:t=!1,intent:s="neutral",icon:n,label:o,op:l,resourceKind:u,resourceName:h,targetLabel:m,onRefresh:d,onSuccess:p}){const[g,b]=y.useState(!1),[v,w]=y.useState(null),{error:k,success:N}=$s();async function E(j=!1){b(!0);try{j?await ki(`${e}/start`,{strategy:"killHolder"}):await j$(l,u,h,()=>d()),N(`${o} requested for ${m}.`),await d(),w(null),p?.()}catch(T){T instanceof $N?w(T.conflict):k($h(o,m,T))}finally{b(!1)}}const A=r.jsxs(J,{"aria-label":o,className:`${A$[s]} ${t?"size-7":""}`.trim(),disabled:g,onClick:()=>E(),size:t?"icon":"sm",variant:"outline",children:[n,t?null:o]});return r.jsxs(r.Fragment,{children:[t?r.jsx(tl,{label:o,children:A}):A,v?r.jsx(T$,{busy:g,conflict:v,onCancel:()=>w(null),onKillAndStart:()=>E(!0),targetLabel:m}):null]})}function T$({busy:e,conflict:t,onCancel:s,onKillAndStart:n,targetLabel:o}){const l=t.holder,u=`http://localhost:${t.port}/`;return r.jsx(Kn,{icon:r.jsx(WM,{}),onClose:e?()=>{}:s,title:`Port ${t.port} is already in use`,children:r.jsxs("div",{className:"space-y-3 p-4 text-sm",children:[r.jsxs("p",{children:[r.jsx("span",{className:"font-medium",children:o})," wants port"," ",r.jsx("span",{className:"font-mono",children:t.port}),", but it's already held by:"]}),r.jsx("pre",{className:"overflow-auto whitespace-pre-wrap rounded border border-border bg-background p-3 font-mono text-xs",children:l?`pid ${l.pid}${l.pgid?` (pgid ${l.pgid})`:""}
|
|
89
|
+
${l.command}`:"unknown process"}),r.jsxs("div",{className:"flex flex-wrap justify-end gap-2 pt-2",children:[r.jsx(J,{onClick:s,size:"sm",type:"button",variant:"outline",disabled:e,children:"Cancel"}),r.jsxs(J,{onClick:()=>{of(u)},size:"sm",type:"button",variant:"outline",disabled:e,children:[r.jsx(kr,{}),"Open in browser"]}),r.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 A$={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 R$({cwd:e,onRefresh:t,onSaved:s,initialService:n}){const{error:o,success:l}=$s(),u=!!n,[h,m]=y.useState(n?.kind??"local"),[d,p]=y.useState(n?.name??""),[g,b]=y.useState(n?.command??""),[v,w]=y.useState(n?.cwd??e),[k,N]=y.useState(n?.port?String(n.port):""),[E,A]=y.useState(n?.description??""),[j,T]=y.useState(n?.composeFile??""),[P,z]=y.useState(n?.composeService??""),[L,R]=y.useState(n?.host??""),[D,I]=y.useState(n?.dependsOn??[]),[V,X]=y.useState(null),[$,W]=y.useState(!1);y.useEffect(()=>{X(null)},[g,v,k,h]);function q(){p(""),b(""),w(e),N(""),A(""),T(""),z(""),R(""),I([]),X(null)}async function B(U){U.preventDefault();try{const K={name:d,kind:h,cwd:v,port:k,description:E};(h==="local"||h==="ssh")&&(K.command=g),h==="docker-compose"&&(K.composeFile=j,K.composeService=P),h==="ssh"&&(K.host=L),K.dependsOn=D.filter(Y=>Y!==d).join(","),await ki("/api/services",K),u||q(),l(u?`${d} updated.`:`${d} added.`),await t(),s?.()}catch(K){o($h(u?"Update service":"Add service",d||"service",K))}}async function Z(){if(!g.trim()){o("Test command failed for service: command is required.");return}W(!0);try{X(await rO({command:g,cwd:v,port:k}))}catch(U){o($h("Test command",d||"service",U))}finally{W(!1)}}return{editing:u,kind:h,setKind:m,name:d,setName:p,command:g,setCommand:b,formCwd:v,setFormCwd:w,port:k,setPort:N,description:E,setDescription:A,composeFile:j,setComposeFile:T,composeService:P,setComposeService:z,host:L,setHost:R,dependsOn:D,setDependsOn:I,testResult:V,testing:$,submit:B,testCommand:Z}}function Bw({cwd:e,onRefresh:t,onSaved:s,initialService:n,availableServices:o=[]}){const{editing:l,kind:u,setKind:h,name:m,setName:d,command:p,setCommand:g,formCwd:b,setFormCwd:v,port:w,setPort:k,description:N,setDescription:E,composeFile:A,setComposeFile:j,composeService:T,setComposeService:P,host:z,setHost:L,dependsOn:R,setDependsOn:D,testResult:I,testing:V,submit:X,testCommand:$}=R$({cwd:e,onRefresh:t,onSaved:s,initialService:n}),W=zw.find(Y=>Y.value===u),q=o.filter(Y=>Y!==m),B=Y=>D(F=>F.includes(Y)?F.filter(ie=>ie!==Y):[...F,Y]),Z=u==="local"&&p.trim().length>0&&b.trim().length>0,U="grid gap-2 rounded-md border border-border bg-muted/30 p-3",K="px-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground";return r.jsxs("form",{className:"grid gap-3",onSubmit:X,children:[r.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[r.jsxs("fieldset",{className:`${U} sm:col-span-2`,children:[r.jsx("legend",{className:K,children:"Step 1 · Service kind"}),r.jsx("div",{className:"grid grid-cols-3 gap-1.5",children:zw.map(Y=>r.jsx(J,{className:"justify-center",disabled:l,onClick:()=>h(Y.value),size:"sm",type:"button",variant:u===Y.value?"default":"outline",children:Y.label},Y.value))}),r.jsx("p",{className:"text-[11px] text-muted-foreground",children:W.hint})]}),r.jsxs("div",{className:"grid gap-3 sm:col-start-1 sm:row-start-2 sm:self-start",children:[r.jsxs("fieldset",{className:U,children:[r.jsx("legend",{className:K,children:"Step 2 · Identity"}),r.jsxs(ai,{children:["Name",r.jsx(gt,{className:"h-8 text-sm",name:"name",onChange:Y=>d(Y.target.value),placeholder:"backend",readOnly:l,required:!0,value:m}),l?r.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Name is the service key and can't be changed here."}):null]}),r.jsxs(ai,{children:["Description",r.jsx(gt,{className:"h-8 text-sm",name:"description",onChange:Y=>E(Y.target.value),placeholder:"API server",value:N})]})]}),r.jsxs("fieldset",{className:U,children:[r.jsx("legend",{className:K,children:"Step 4 · Networking (optional)"}),r.jsxs(ai,{children:["Port",r.jsx(gt,{className:"h-8 text-sm",inputMode:"numeric",name:"port",onChange:Y=>k(Y.target.value),placeholder:"3001",value:w})]})]})]}),u==="local"?r.jsxs("fieldset",{className:`${U} sm:col-start-2 sm:row-start-2 sm:self-start`,children:[r.jsx("legend",{className:K,children:"Step 3 · Local command"}),r.jsx("div",{className:"grid grid-cols-2 gap-1.5 sm:grid-cols-4",children:C$.map(Y=>r.jsxs(J,{className:"justify-start gap-1.5",onClick:()=>{g(Y.command),E(Y.description)},size:"sm",type:"button",variant:"outline",children:[r.jsx(xx,{command:Y.badgeCommand??Y.command,compact:!0}),r.jsx("span",{className:"truncate",children:Y.label})]},Y.label))}),r.jsxs(ai,{children:["Command",r.jsx(gt,{className:"h-8 font-mono text-sm",name:"command",onChange:Y=>g(Y.target.value),placeholder:"npm run dev",required:!0,value:p})]}),r.jsxs(ai,{children:["Working Directory",r.jsx(gt,{className:"h-8 font-mono text-sm",name:"cwd",onChange:Y=>v(Y.target.value),required:!0,value:b})]})]}):null,u==="docker-compose"?r.jsxs("fieldset",{className:`${U} sm:col-start-2 sm:row-start-2 sm:self-start`,children:[r.jsx("legend",{className:K,children:"Step 3 · Docker Compose target"}),r.jsxs(ai,{children:["Compose Service",r.jsx(gt,{className:"h-8 font-mono text-sm",name:"composeService",onChange:Y=>P(Y.target.value),placeholder:"api",required:!0,value:T})]}),r.jsxs(ai,{children:["Compose File (optional)",r.jsx(gt,{className:"h-8 font-mono text-sm",name:"composeFile",onChange:Y=>j(Y.target.value),placeholder:"docker-compose.yml",value:A})]}),r.jsxs(ai,{children:["Working Directory (where compose file lives)",r.jsx(gt,{className:"h-8 font-mono text-sm",name:"cwd",onChange:Y=>v(Y.target.value),required:!0,value:b})]})]}):null,u==="ssh"?r.jsxs("fieldset",{className:`${U} sm:col-start-2 sm:row-start-2 sm:self-start`,children:[r.jsx("legend",{className:K,children:"Step 3 · SSH connection"}),r.jsxs(ai,{children:["SSH Host (alias from ~/.ssh/config)",r.jsx(gt,{className:"h-8 font-mono text-sm",name:"host",onChange:Y=>L(Y.target.value),placeholder:"devbox",required:!0,value:z})]}),r.jsxs(ai,{children:["Remote Command",r.jsx(gt,{className:"h-8 font-mono text-sm",name:"command",onChange:Y=>g(Y.target.value),placeholder:"npm run dev",required:!0,value:p})]}),r.jsxs(ai,{children:["Remote Working Directory",r.jsx(gt,{className:"h-8 font-mono text-sm",name:"cwd",onChange:Y=>v(Y.target.value),placeholder:"/srv/app",required:!0,value:b})]}),r.jsxs(tt,{variant:"muted",children:[r.jsx("div",{className:"font-medium",children:"SSH key handling"}),r.jsxs("div",{className:"mt-1 text-xs",children:["NoMoreIDE never stores key files. Add a ",r.jsxs("code",{children:["Host ",z||"<alias>"]})," entry to",r.jsx("code",{children:" ~/.ssh/config"})," with ",r.jsx("code",{children:"HostName"}),", ",r.jsx("code",{children:"User"}),", and"," ",r.jsx("code",{children:"IdentityFile ~/.ssh/your-key.pem"})," (chmod 0600). Make sure"," ",r.jsx("code",{children:"ssh-agent"})," is running or your key is loaded (",r.jsx("code",{children:"ssh-add ~/.ssh/your-key.pem"}),"). NoMoreIDE will run"," ",r.jsxs("code",{children:["ssh ",z||"<alias>"]})," using that config."]})]})]}):null,q.length>0?r.jsxs("fieldset",{className:`${U} sm:col-span-2`,children:[r.jsx("legend",{className:K,children:"Step 5 · Dependencies (optional)"}),r.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."}),r.jsx("div",{className:"flex flex-wrap gap-1.5",children:q.map(Y=>r.jsx(J,{className:"h-7 px-2.5 text-xs",onClick:()=>B(Y),size:"sm",type:"button",variant:R.includes(Y)?"default":"outline",children:Y},Y))})]}):null]}),I?r.jsx(E$,{result:I}):null,r.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[u==="local"?r.jsxs(J,{disabled:V||!Z,onClick:$,type:"button",variant:"outline",children:[r.jsx(cl,{}),V?"Testing...":"Test Command"]}):null,r.jsx(J,{type:"submit",children:l?"Save Service":"Add Service"})]})]})}function b3({initialName:e="",initialServices:t=[],onSaved:s,onRefresh:n,originalName:o,services:l,submitLabel:u="Save Group"}){const{error:h,success:m}=$s();async function d(p){p.preventDefault();const g=p.currentTarget,b=new FormData(g),v=String(b.get("name")??""),w=b.getAll("services").map(k=>String(k)).filter(Boolean);try{await ki("/api/bundles",{name:v,originalName:o,services:w.join(",")}),g.reset(),m(`${v} group saved.`),await n(),s?.()}catch(k){h($h("Save group",v||"group",k))}}return r.jsxs("form",{className:"grid gap-2.5",onSubmit:d,children:[r.jsxs(ai,{children:["Group name",r.jsx(gt,{className:"h-8 text-sm",defaultValue:e,name:"name",placeholder:"full-stack",required:!0})]}),r.jsxs("fieldset",{className:"grid gap-1.5",children:[r.jsx("legend",{className:"text-xs font-medium",children:"Services"}),l.length?l.map(p=>r.jsxs("label",{className:"flex items-center gap-2 overflow-hidden rounded-md border border-border px-2.5 py-1.5 text-sm",children:[r.jsx("input",{className:"size-4 shrink-0 accent-primary",defaultChecked:t.includes(p.name),name:"services",type:"checkbox",value:p.name}),r.jsx(xx,{command:p.command??"",compact:!0}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-sm font-medium",children:p.name}),r.jsx("span",{className:"block truncate font-mono text-[11px] text-muted-foreground",children:p.command??p.kind??""})]})]},p.name)):r.jsx(tt,{variant:"muted",children:"All services are already grouped, or none registered."})]}),r.jsx(J,{className:"h-8",disabled:!l.length,type:"submit",children:u})]})}function M$({allServices:e,group:t,onRefresh:s,ports:n,services:o,health:l,statuses:u,timeline:h,selectedService:m,onSelectService:d,onDropService:p}){const[g,b]=y.useState(!1),[v,w]=y.useState(!1),[k,N]=y.useState(!1),E=o.some(T=>$c(u[T.name]?.state));function A(T){!p||!T.dataTransfer.types.includes(Xc)||(T.preventDefault(),T.dataTransfer.dropEffect="copy",N(!0))}function j(T){if(!p)return;T.preventDefault(),N(!1);const P=T.dataTransfer.getData(Xc);P&&p(P)}return r.jsxs("section",{className:de("transition-colors",k&&"bg-primary/5 outline-dashed outline-2 -outline-offset-2 outline-primary/60"),onDragOver:A,onDragLeave:()=>N(!1),onDrop:j,children:[r.jsxs("div",{className:"flex items-center gap-1.5 bg-muted/35 px-3 py-1.5",children:[r.jsxs("button",{"aria-expanded":!v,className:"flex min-w-0 flex-1 cursor-pointer items-center gap-1.5 text-left",onClick:()=>w(T=>!T),type:"button",children:[r.jsx(vn,{className:de("size-3.5 shrink-0 text-muted-foreground transition-transform",v&&"-rotate-90")}),r.jsx("span",{className:"truncate text-sm font-medium",children:t.name}),t.services.length?r.jsx(et,{size:"small",variant:"secondary",children:t.services.length}):null]}),r.jsx(tl,{label:"Edit group",children:r.jsx(J,{"aria-expanded":g,"aria-label":`Edit ${t.name}`,className:"size-7",onClick:()=>b(T=>!T),size:"icon",type:"button",variant:"ghost",children:r.jsx(rl,{})})}),r.jsx(vx,{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 T=o[0];T&&d(T.name)}})]}),g?r.jsx("div",{className:"border-t border-border bg-background/65 p-3",children:r.jsx(b3,{initialName:t.name,initialServices:t.services,onRefresh:s,onSaved:()=>b(!1),originalName:t.name,services:e,submitLabel:"Save Group"})}):null,v?null:r.jsx("div",{className:"divide-y divide-border border-t border-border bg-background/45",children:o.length?o.map(T=>r.jsx(x3,{service:T,status:u[T.name],health:l[T.name],ports:n,onRefresh:s,timeline:h,selected:m===T.name,onSelect:()=>d(T.name)},T.name)):r.jsx(tt,{variant:"muted",className:"m-4",children:"This group does not match any registered services."})})]})}function x3({service:e,status:t,onRefresh:s,selected:n=!1,onSelect:o}){const l=t?.state??"stopped",u=$c(l),[h,m]=y.useState(!1);return r.jsxs("div",{"aria-selected":n,draggable:!0,onDragStart:d=>{d.dataTransfer.setData(Xc,e.name),e.cwd&&p3(d.dataTransfer,e.cwd),d.dataTransfer.effectAllowed="copyMove",m(!0)},onDragEnd:()=>m(!1),className:de("group grid cursor-pointer grid-cols-[1.75rem_minmax(0,1fr)_auto_auto] items-center gap-2 border-l-2 px-3 py-1.5 transition-colors",h&&"opacity-50",n?"border-l-primary bg-primary/10":"border-l-transparent hover:bg-muted"),onClick:o,role:"option",children:[r.jsx(xx,{command:e.command??""}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"truncate text-sm font-medium",children:e.name}),r.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[r.jsx(D$,{kind:e.kind}),e.port?r.jsxs("span",{children:[":",e.port]}):null]})]}),r.jsx(L$,{state:l}),r.jsx("span",{className:"flex items-center gap-1",onClick:d=>d.stopPropagation(),children:r.jsx(vx,{active:u,baseUrl:`/api/services/${encodeURIComponent(e.name)}`,compact:!0,resourceKind:"service",resourceName:e.name,targetLabel:e.name,onRefresh:s,onStarted:o})})]})}const Xc="application/x-nomoreide-service",Iw={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 D$({kind:e}){const t=Iw[e??"local"]??Iw.local;return r.jsx("span",{className:de("rounded border px-1 py-px text-[9px] font-semibold uppercase leading-none tracking-wide",t.className),children:t.label})}function $c(e){return e==="running"||e==="starting"}function O$(e){return`http://127.0.0.1:${e}`}const Pw={running:{className:"bg-emerald-500"},starting:{className:"bg-amber-500",pulse:!0},exited:{className:"bg-red-500"},stopped:{className:"bg-muted-foreground/40"}};function L$({state:e}){const t=Pw[e]??Pw.stopped;return r.jsxs("span",{className:"relative flex size-2.5 items-center justify-center",title:e,children:[t.pulse&&r.jsx("span",{className:de("absolute inline-flex size-full animate-ping rounded-full opacity-60",t.className)}),r.jsx("span",{className:de("relative inline-flex size-2 rounded-full",t.className)})]})}function v3({state:e}){return r.jsx(et,{variant:e==="running"?"success":e==="exited"?"danger":e==="starting"?"warning":"outline",className:de(e==="running"&&"font-mono"),children:e})}function z$({data:e}){const[t,s]=y.useState(!1),[n,o]=y.useState(()=>Rw()),[l,u]=y.useState(""),[h,m]=y.useState([]),[d,p]=y.useState([]),[g,b]=y.useState(null),{sendToAgent:v}=It();y.useEffect(()=>{if(!t)return;let j=!0;return b(null),Promise.allSettled([GN(),YN(20)]).then(T=>{if(!j)return;const[P,z]=T;P.status==="fulfilled"&&m(P.value),z.status==="fulfilled"&&p(z.value),T.filter(R=>R.status==="rejected").length&&b("Some AI context could not be loaded. You can still send available context.")}),()=>{j=!1}},[t]);const w=y.useMemo(()=>B$(e),[e]),k=TP(n),N=y.useMemo(()=>n.serviceNames.length+n.databaseNames.length+n.errorIds.length+n.repositoryPaths.length,[n]);function E(j,T){o(P=>{const z=P[j],L=z.includes(T)?z.filter(R=>R!==T):[...z,T];return{...P,[j]:L}})}function A(){k&&(v({prompt:AP({dashboard:e,databases:h,incidents:d,note:l,selection:n}),source:{type:"workspace-context",label:"AI Diagnose"},label:RP({note:l,selection:n})}),s(!1),u(""),o(Rw()))}return r.jsxs(r.Fragment,{children:[r.jsxs("button",{"aria-label":"Open AI Diagnose",className:zh(),onClick:()=>s(!0),title:"Open AI Diagnose",type:"button",children:[r.jsx("span",{className:Bh(),children:r.jsx(Gt,{className:"size-4"})}),r.jsx("span",{className:Ih(),children:"Diagnose"})]}),t?r.jsx(Kn,{icon:r.jsx(Gt,{}),onClose:()=>s(!1),size:"xl",title:"AI Diagnose",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium",children:"Pick the context the agent should inspect"}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Combine services, databases, incidents, and repositories into one focused prompt."})]}),r.jsxs(et,{variant:N?"secondary":"outline",children:[N," selected"]})]}),g?r.jsx(tt,{variant:"muted",children:g}):null,r.jsxs("div",{className:"grid min-h-0 gap-3 overflow-hidden lg:grid-cols-4",children:[r.jsx(Fd,{count:e.config.services.length,icon:r.jsx(LN,{}),title:"Services",children:r.jsx("div",{className:"grid gap-2",children:e.config.services.map(j=>{const T=n.serviceNames.includes(j.name),P=e.runtime.services[j.name],z=e.health[j.name];return r.jsxs(qd,{selected:T,onClick:()=>E("serviceNames",j.name),children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate font-semibold",children:j.name}),r.jsx("span",{className:"shrink-0",children:r.jsx(v3,{state:P?.state??"stopped"})})]}),r.jsxs("span",{className:"mt-1 flex flex-wrap gap-1.5 text-[11px] text-muted-foreground",children:[j.kind?r.jsx("span",{children:j.kind}):null,j.port?r.jsxs("span",{children:[":",j.port]}):null,z?.status?r.jsx("span",{children:z.status}):null]})]},j.name)})})}),r.jsx(Fd,{count:h.length,icon:r.jsx(fi,{}),title:"Databases",children:h.length?r.jsx("div",{className:"grid gap-2",children:h.map(j=>r.jsxs(qd,{selected:n.databaseNames.includes(j.name),onClick:()=>E("databaseNames",j.name),children:[r.jsx("span",{className:"truncate font-semibold",children:j.name}),r.jsx("span",{className:"mt-1 block truncate text-[11px] text-muted-foreground",children:j.engine})]},j.name))}):r.jsx($w,{text:"No database connections detected."})}),r.jsx(Fd,{count:d.length,icon:r.jsx(Nh,{}),title:"Error Inbox",children:d.length?r.jsx("div",{className:"grid gap-2",children:d.map(j=>r.jsxs(qd,{selected:n.errorIds.includes(j.id),onClick:()=>E("errorIds",j.id),children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate font-semibold",children:j.title}),r.jsx(et,{appearance:"subtle",size:"small",variant:j.level==="error"?"danger":"secondary",children:j.level})]}),r.jsxs("span",{className:"mt-1 block min-w-0 truncate font-mono text-[11px] text-muted-foreground",children:[j.service," x",j.count]})]},j.id))}):r.jsx($w,{text:"No recent incidents."})}),r.jsx(Fd,{count:w.length,icon:r.jsx(xn,{}),title:"Git Repositories",children:r.jsx("div",{className:"grid gap-2",children:w.map(j=>{const T=n.repositoryPaths.includes(j.path),P=j.path===(e.git.selectedRepository?.path??e.git.cwd),z=P?e.git.status?.files.length??0:void 0;return r.jsxs(qd,{selected:T,onClick:()=>E("repositoryPaths",j.path),children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate font-semibold",children:j.name}),P?r.jsx(et,{className:"shrink-0",size:"small",variant:"outline",children:"current"}):null]}),r.jsx("span",{className:"mt-1 block min-w-0 truncate font-mono text-[11px] text-muted-foreground",children:j.path}),z!==void 0?r.jsx("span",{className:"mt-1 block truncate text-[11px] text-muted-foreground",children:z?`${z} changed file${z===1?"":"s"}`:"No changed files"}):null]},j.path)})})})]}),r.jsxs("label",{className:"block space-y-2",children:[r.jsx("span",{className:"text-sm font-medium",children:"Extra context"}),r.jsx("textarea",{className:"min-h-24 w-full resize-y rounded-md border border-border bg-background px-3 py-2 text-sm outline-none transition-colors placeholder:text-muted-foreground focus:border-foreground/40 focus:ring-2 focus:ring-ring",onChange:j=>u(j.target.value),placeholder:"Example: checkout is failing after login, API exits when DB is selected...",value:l})]}),r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[r.jsx(J,{onClick:()=>s(!1),type:"button",variant:"outline",children:"Cancel"}),r.jsxs(J,{className:"gap-2",disabled:!k,onClick:A,type:"button",children:[r.jsx(gM,{className:"size-4"}),"Send"]})]})]})}):null]})}function Fd({children:e,count:t,icon:s,title:n}){return r.jsxs("section",{className:"flex max-h-[min(520px,calc(100vh-18rem))] min-h-0 min-w-0 flex-col space-y-2 rounded-md border border-border bg-background/45 p-3",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-sm font-semibold",children:[r.jsx("span",{className:"flex size-6 items-center justify-center rounded-md border border-border bg-background text-muted-foreground [&_svg]:size-3.5",children:s}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:n}),r.jsx(et,{className:"shrink-0",size:"small",variant:"outline",children:t})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-auto pr-1",children:e})]})}function qd({children:e,onClick:t,selected:s}){return r.jsx("button",{"aria-pressed":s,className:de("min-h-16 min-w-0 rounded-md border p-3 text-left text-sm transition-colors",s?"border-primary bg-primary/10 text-foreground":"border-border bg-background hover:border-foreground/30 hover:bg-muted/60"),onClick:t,type:"button",children:e})}function $w({text:e}){return r.jsx("div",{className:"rounded-md border border-dashed border-border bg-background/60 px-3 py-3 text-xs text-muted-foreground",children:e})}function B$(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 I$(e){const t=H$(e.capabilities);return t?`${e.prompt}
|
|
90
|
+
|
|
91
|
+
${t}`:e.prompt}function P$({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:",U$(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 $$({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 H$(e){if(!e)return"";const t=[Vd("Skills",e.skills),Vd("MCP servers",e.mcpServers),Vd("Plugins",e.plugins),Vd("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 Vd(e,t){const s=Array.from(new Set((t??[]).map(n=>n.trim()).filter(Boolean)));return s.length?`- ${e}: ${s.join(", ")}`:""}function U$(e){return e.kind==="agent"?e.prompt:e.kind==="gate"?`Gate: ${e.message}`:`Action: ${e.op}`}const Hw=/^[ \t>*_-]*WORKFLOW_STATUS:\s*(ok|blocked)\b[ \t]*[—–:-]?[ \t]*(.*)$/im,F$=/^[ \t>*_-]*BRANCH_NAME:\s*`?([A-Za-z0-9][A-Za-z0-9._/-]{0,127})`?\s*$/im,q$=/^[A-Za-z0-9][A-Za-z0-9._/-]{0,127}$/;function V$(e){const t=e.match(Hw);if(t){const s=t[1].toLowerCase()==="blocked",n=t[2]?.trim()||void 0;return{output:e.replace(Hw,"").trim(),blocked:s,reason:s?n:void 0}}return{output:e,blocked:G$(e)}}function G$(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 W$(e){const t=e.match(F$);if(t&&Uw(t[1]))return t[1];const s=e.match(/^#+\s*Recommended branch name\b([\s\S]*)$/im)?.[1]??e;for(const n of s.matchAll(/`([^`\s]+)`/g)){const o=n[1].trim();if(Uw(o))return o}return null}function Uw(e){return!(!q$.test(e)||e==="main"||e==="master"||e.includes("..")||e.endsWith(".")||e.endsWith("/"))}const K$="\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 Y$(e){const{sendToAgent:t,streaming:s,turns:n}=It(),[o,l]=y.useState(null),u=y.useRef(n);y.useEffect(()=>{u.current=n},[n]);const h=y.useRef(o);y.useEffect(()=>{h.current=o},[o]);const m=y.useRef(!1),d=y.useRef(!1),p=y.useRef(null),g=y.useRef(null),b=y.useRef(!1);y.useEffect(()=>{if(s)b.current=!0;else if(b.current&&g.current){const R=g.current;g.current=null,R()}},[s]);const v=y.useCallback(()=>new Promise(R=>{p.current=R}),[]),w=y.useCallback(()=>new Promise(R=>{let D=!1;const I=()=>{D||(D=!0,clearTimeout(V),g.current=null,R())};g.current=I;const V=setTimeout(()=>{b.current||I()},8e3)}),[]),k=y.useCallback(async R=>{const D=await Pp();return R==="committed"?D.files.length===0:R==="pushed"?D.ahead===0:!0},[]),N=y.useCallback(async(R,D,I)=>{if(R.op==="assert-pr-branch"){J$(await Pp());return}if(R.op==="push"){await lf();return}if(R.op==="checkout-default-and-pull"){await h8();return}if(R.op==="commit"){const V=await Pp();if(!V.files.length)throw new Error("Nothing to commit — the working tree is clean.");const X=Q$(V.files);X.length&&await Pb(X),await QN(Z$(I,D,V.files));return}throw new Error(`Unknown action: ${R.op}`)},[]),E=y.useCallback(async(R,D,I)=>{if(m.current)return;m.current=!0,d.current=!1;const V=I?.index??0,X=R.steps.map((B,Z)=>I&&Z<V?I.statuses[Z]??"pending":"pending"),$=R.steps.map((B,Z)=>I?.outputs[Z]??""),W=(B,Z,U)=>{X[B]=Z,l(K=>K&&{...K,index:B,statuses:[...X],outputs:[...$],...U})};l({workflow:R,startedAt:I?.startedAt??Date.now(),index:V,statuses:[...X],outputs:[...$],error:null,outcome:"running"});const q=B=>{m.current=!1,l(Z=>Z&&{...Z,outcome:B,endedAt:Date.now()})};for(let B=V;B<R.steps.length;B++){const Z=R.steps[B];if(Z.kind==="gate"){W(B,"waiting");const K=await v();if(p.current=null,K==="stop"){W(B,"skipped"),q("stopped");return}W(B,K==="skip"?"skipped":"done");continue}if(Z.kind==="action"){W(B,"running");try{await N(Z,B,$),W(B,"done"),e?.()}catch(K){if(Z.op==="assert-pr-branch"){W(B,"blocked",{error:Fw(K)}),q("blocked");return}W(B,"failed",{error:Fw(K)}),q("failed");return}if(d.current)return q("stopped");continue}W(B,"running"),b.current=!1,t({prompt:I$(Z)+K$,source:{type:"workflow",label:`${R.name}: ${Z.title}`},mode:"send",label:Z.title,autoApprove:D,background:!0,isolated:Z.isolated}),await w(),e?.();const U=V$(X$(u.current));if($[B]=U.output||"(no reply — see the dock)",U.blocked){W(B,"blocked",{error:U.reason?`Paused — ${U.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."}),q("blocked");return}if(Z.verify&&!await k(Z.verify).catch(()=>!1)){W(B,"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."}),q("failed");return}if(W(B,"done"),d.current)return q("stopped")}q("done")},[e,N,t,k,w,v]),A=y.useCallback((R,D=!1)=>E(R,D),[E]),j=y.useCallback((R=!1)=>{const D=h.current;!D||D.outcome==="running"||m.current||E(D.workflow,R,{index:D.index,statuses:D.statuses,outputs:D.outputs,startedAt:D.startedAt})},[E]),T=y.useCallback(()=>p.current?.("approve"),[]),P=y.useCallback(()=>p.current?.("skip"),[]),z=y.useCallback(()=>{d.current=!0,p.current?.("stop")},[]),L=y.useCallback(()=>{m.current||l(null)},[]);return{run:o,start:A,resume:j,approve:T,skip:P,stop:z,dismiss:L,isRunning:!!o&&o.outcome==="running"}}function Fw(e){return e instanceof Error?e.message:String(e)}function X$(e){for(let t=e.length-1;t>=0;t--)if(e[t].role==="assistant")return e[t].text.trim();return""}function Z$(e,t,s){return e[t-1]?.trim()||tH(s)}function Q$(e){return e.some(s=>s.index.trim()&&s.index!=="?")?[]:e.map(s=>s.path)}function J$(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(!eH(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 eH(e){return e==="main"||e==="master"}function tH(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 _3=y.createContext(null);function sH({onRefresh:e,children:t}){const s=Y$(e);return r.jsx(_3.Provider,{value:s,children:t})}function nH(){const e=y.useContext(_3);if(!e)throw new Error("useWorkflowRun must be used within a WorkflowRunProvider");return e}function iH({git:e,onRefresh:t}){const{sendToAgent:s}=It(),[n,o]=y.useState(!1),[l,u]=y.useState(null),[h,m]=y.useState(null),d=e.status,p=d?.branch||void 0,g=d?.files.length??0,b=d?.ahead??0,v=d?.behind??0;y.useEffect(()=>{if(!p){m(null);return}let N=!0;return ah(p,1).then(E=>{if(!N)return;const A=E[0];m(A&&rH(A)?A:null)}).catch(()=>{N&&m(null)}),()=>{N=!1}},[p]);const w=y.useMemo(()=>g>0||b>0||v>0||!!h,[g,b,v,h]);if(!d||!w)return null;async function k(){o(!0),u(null);try{await lf(),t?.()}catch(N){u(N instanceof Error?N.message:String(N))}finally{o(!1)}}return r.jsx("div",{className:"mx-auto mb-2 w-full max-w-4xl",children:r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 rounded-md border border-border bg-muted/40 px-2 py-1.5 text-[11px]",children:[r.jsxs("span",{className:"mr-0.5 inline-flex items-center gap-1 font-medium text-muted-foreground",children:[r.jsx(Gt,{className:"size-3.5"}),p??"git"]}),g>0?r.jsx(Gd,{icon:r.jsx(eR,{className:"size-3"}),label:`Commit ${g} change${g===1?"":"s"}`,ai:!0,onClick:()=>s({prompt:_P({branch:p,fileCount:g}),source:{type:"git-situation",label:"uncommitted changes"},mode:"send",label:`Commit ${g} uncommitted change${g===1?"":"s"}`})}):null,v>0?r.jsx(Gd,{icon:r.jsx(ef,{className:"size-3"}),label:`Pull ${v} behind`,ai:!0,onClick:()=>s({prompt:yP({branch:p,behind:v,upstream:d.upstream}),source:{type:"git-situation",label:"behind upstream"},mode:"send",label:`Pull & rebase (${v} behind)`})}):null,b>0?r.jsx(Gd,{icon:n?r.jsx(Et,{className:"size-3 animate-spin"}):r.jsx(Bb,{className:"size-3"}),label:`Push ${b}`,disabled:n,onClick:()=>{k()}}):null,h?r.jsx(Gd,{danger:!0,icon:r.jsx(ul,{className:"size-3"}),label:"Fix failing CI",ai:!0,onClick:()=>s({prompt:SP({branch:p,runName:h.name,url:h.html_url}),source:{type:"git-situation",label:"failing CI"},mode:"send",label:`Fix failing CI: ${h.name}`})}):null,l?r.jsx("span",{className:"text-destructive",children:l}):null]})})}function Gd({ai:e,danger:t,disabled:s,icon:n,label:o,onClick:l}){return r.jsxs("button",{className:de("inline-flex items-center gap-1 rounded-full border px-2 py-0.5 font-medium transition-colors disabled:opacity-50",t?"border-destructive/40 bg-destructive/5 text-destructive hover:bg-destructive/10":"border-border bg-background text-foreground hover:bg-muted"),disabled:s,onClick:l,type:"button",children:[n,o,e?r.jsx(Gt,{className:"size-3 opacity-70"}):null]})}function rH(e){return e.status==="completed"&&e.conclusion!==null&&!["success","neutral","skipped"].includes(e.conclusion)}const aH=new Set(["c","cpp","cs","go","java","js","jsx","kt","mjs","py","rs","swift","ts","tsx"]),oH=new Set([".env",".gitignore","components.json","dockerfile","package.json","tsconfig.json","vite.config.ts"]),lH=new Set(["conf","config","ini","toml","yaml","yml"]),cH=new Set(["csv","json","sql","xml"]),uH=new Set(["md","mdx","rst","txt"]),dH=new Set(["gif","jpeg","jpg","png","svg","webp"]),hH=new Set(["package-lock.json","pnpm-lock.yaml","yarn.lock"]),fH=new Set(["css","less","sass","scss"]);function mH(e){const t=e.split("/").pop()?.toLowerCase()??e.toLowerCase(),s=t.includes(".")?t.split(".").pop()??"":"";return hH.has(t)||t.endsWith(".lock")?"lock":pH(t)?"test":oH.has(t)||lH.has(s)?"config":fH.has(s)?"style":dH.has(s)?"image":uH.has(s)?"document":cH.has(s)?"data":aH.has(s)?"code":"generic"}function pH(e){return e.includes(".test.")||e.includes(".spec.")||e.endsWith("_test.go")}function _x({path:e,className:t}){const s=mH(e),n=gH[s];return r.jsx(n,{"aria-label":`${s} file`,className:de("size-3.5 shrink-0",bH[s],t)})}const gH={code:_N,config:vM,data:fi,document:Lb,generic:SN,image:pR,lock:NR,style:qR,test:q4},bH={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 xH(e){const t=e.lastIndexOf(".");return t>0?e.slice(t):""}function vH({onPick:e,onClose:t}){const[s,n]=y.useState(""),[o,l]=y.useState(null),[u,h]=y.useState(null),[m,d]=y.useState(!1),p=y.useRef(null),g=o?o.parent!==o.path:!1;return y.useEffect(()=>{function b(v){p.current&&!p.current.contains(v.target)&&t()}return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[t]),y.useEffect(()=>{let b=!0;return d(!0),h(null),nC(s,{files:!0}).then(v=>b&&l(v)).catch(v=>b&&h(v instanceof Error?v.message:String(v))).finally(()=>b&&d(!1)),()=>{b=!1}},[s]),r.jsxs("div",{ref:p,className:"absolute bottom-full left-2 z-10 mb-2 w-[22rem] max-w-[calc(100vw-1rem)] overflow-hidden rounded-md border border-border bg-card shadow-lg",children:[r.jsxs("div",{className:"flex items-center gap-1 border-b border-border px-2 py-1.5",children:[r.jsx(J,{"aria-label":"Parent folder",className:"size-7",disabled:!g,onClick:()=>o&&n(o.parent),size:"icon",type:"button",variant:"ghost",children:r.jsx(sf,{})}),r.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-muted-foreground",title:o?.path,children:o?.path??"…"}),m?r.jsx(Et,{className:"size-3.5 animate-spin text-muted-foreground"}):null,o?r.jsxs(J,{className:"h-7 px-2 text-[11px]",onClick:()=>e(o.path),size:"sm",title:"Attach this folder",type:"button",variant:"outline",children:[r.jsx(k4,{})," This folder"]}):null,r.jsx(J,{"aria-label":"Close",className:"size-7",onClick:t,size:"icon",type:"button",variant:"ghost",children:r.jsx(ts,{})})]}),r.jsx("div",{className:"max-h-64 overflow-auto p-1",children:u?r.jsx(tt,{variant:"destructive",className:"m-1",children:u}):o&&o.entries.length===0?r.jsx(tt,{variant:"muted",className:"m-1 text-center",children:"Empty folder."}):o?.entries.map(b=>{const v=b.isDir?"":xH(b.name);return r.jsxs("button",{className:"flex w-full items-center gap-1.5 rounded-sm px-2 py-1 text-left text-[12px] hover:bg-muted",onClick:()=>b.isDir?n(b.path):e(b.path),title:b.path,type:"button",children:[b.isDir?r.jsx(ro,{className:"size-3.5 shrink-0 text-amber-600"}):r.jsx(_x,{path:b.path}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:b.name}),v?r.jsx("span",{className:"shrink-0 rounded bg-muted px-1 font-mono text-[10px] text-muted-foreground",children:v}):null]},b.path)})})]})}const _H=/```options[^\n]*\n([\s\S]*?)```/g,yH=/```service[^\n]*\n([\s\S]*?)```/g,SH=/```sql-write[^\S\n]*([^\n]*)\n([\s\S]*?)```/g,wH=/```(?:options|service|sql-write)[^\n]*\n[\s\S]*$/;function kH(e){const t=[];let s=null,n=null,o=e.replace(_H,(l,u)=>{for(const h of u.split(`
|
|
95
|
+
`)){const m=h.replace(/^[-*\d.)\s]+/,"").trim();m&&t.push(m)}return""});return o=o.replace(yH,(l,u)=>{const h=u.split(`
|
|
96
|
+
`).map(m=>m.trim()).find(Boolean);return h&&(s=h),""}),o=o.replace(SH,(l,u,h)=>{const m=h.trim();return m&&(n={connection:u.trim(),sql:m}),""}),o=o.replace(wH,""),{body:o.trim(),options:t,service:s,sqlWrite:n}}function NH({options:e,disabled:t,onChoose:s}){return r.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.map(n=>r.jsx(J,{className:"h-7",disabled:t,onClick:()=>s(n),size:"sm",type:"button",variant:"outline",children:n},n))})}function CH({service:e,onStart:t,onOpen:s}){return r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 rounded-md border border-border bg-muted/30 px-2 py-1.5",children:[r.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["Added ",r.jsx("span",{className:"font-medium text-foreground",children:e})]}),r.jsxs("div",{className:"ml-auto flex gap-1.5",children:[r.jsxs(J,{className:"h-7",onClick:()=>t(e),size:"sm",type:"button",children:[r.jsx(Nr,{})," Start"]}),s?r.jsxs(J,{className:"h-7",onClick:()=>s(e),size:"sm",type:"button",variant:"outline",children:[r.jsx(kr,{})," Open"]}):null]})]})}function EH({proposal:e,onOpen:t}){return r.jsxs("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/[0.06] px-2.5 py-2",children:[r.jsxs("div",{className:"mb-1.5 flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[r.jsx(fi,{className:"size-3.5 text-amber-600 dark:text-amber-400"}),r.jsxs("span",{children:["Proposed write",e.connection?r.jsxs(r.Fragment,{children:[" ","on ",r.jsx("span",{className:"font-medium text-foreground",children:e.connection})]}):null," ","— runs in the console after you unlock and preview."]})]}),r.jsx("pre",{className:"mb-2 max-h-28 overflow-auto rounded bg-background px-2 py-1.5 font-mono text-[11px] text-foreground",children:e.sql}),r.jsxs(J,{className:"h-7 w-full bg-amber-600 text-white hover:bg-amber-600/90",onClick:()=>t(e.connection,e.sql),size:"sm",type:"button",children:[r.jsx(kr,{})," Open in SQL console"]})]})}function yx(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var oo=yx();function y3(e){oo=e}var Wa={exec:()=>null};function Go(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 Nt(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(an.caret,"$1"),s=s.replace(o,u),n},getRegex:()=>new RegExp(s,t)};return n}var jH=((e="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+e)}catch{return!1}})(),an={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:Go(e=>new RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Go(e=>new RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Go(e=>new RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Go(e=>new RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Go(e=>new RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:Go(e=>new RegExp(`^ {0,${e}}>`))},TH=/^(?:[ \t]*(?:\n|$))+/,AH=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,RH=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,uu=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,MH=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Sx=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,S3=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,w3=Nt(S3).replace(/bull/g,Sx).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(),DH=Nt(S3).replace(/bull/g,Sx).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(),wx=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,OH=/^[^\n]+/,kx=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,LH=Nt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",kx).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),zH=Nt(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Sx).getRegex(),gf="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",Nx=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,BH=Nt("^ {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",Nx).replace("tag",gf).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),k3=Nt(wx).replace("hr",uu).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",gf).getRegex(),IH=Nt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",k3).getRegex(),Cx={blockquote:IH,code:AH,def:LH,fences:RH,heading:MH,hr:uu,html:BH,lheading:w3,list:zH,newline:TH,paragraph:k3,table:Wa,text:OH},qw=Nt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",uu).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",gf).getRegex(),PH={...Cx,lheading:DH,table:qw,paragraph:Nt(wx).replace("hr",uu).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",qw).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",gf).getRegex()},$H={...Cx,html:Nt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Nx).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:Wa,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Nt(wx).replace("hr",uu).replace("heading",` *#{1,6} *[^
|
|
97
|
+
]`).replace("lheading",w3).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},HH=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,UH=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,N3=/^( {2,}|\\)\n(?!\s*$)/,FH=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,pl=/[\p{P}\p{S}]/u,bf=/[\s\p{P}\p{S}]/u,Ex=/[^\s\p{P}\p{S}]/u,qH=Nt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,bf).getRegex(),C3=/(?!~)[\p{P}\p{S}]/u,VH=/(?!~)[\s\p{P}\p{S}]/u,GH=/(?:[^\s\p{P}\p{S}]|~)/u,WH=Nt(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",jH?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),E3=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,KH=Nt(E3,"u").replace(/punct/g,pl).getRegex(),YH=Nt(E3,"u").replace(/punct/g,C3).getRegex(),j3="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",XH=Nt(j3,"gu").replace(/notPunctSpace/g,Ex).replace(/punctSpace/g,bf).replace(/punct/g,pl).getRegex(),ZH=Nt(j3,"gu").replace(/notPunctSpace/g,GH).replace(/punctSpace/g,VH).replace(/punct/g,C3).getRegex(),QH=Nt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ex).replace(/punctSpace/g,bf).replace(/punct/g,pl).getRegex(),JH=Nt(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,pl).getRegex(),eU="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",tU=Nt(eU,"gu").replace(/notPunctSpace/g,Ex).replace(/punctSpace/g,bf).replace(/punct/g,pl).getRegex(),sU=Nt(/\\(punct)/,"gu").replace(/punct/g,pl).getRegex(),nU=Nt(/^<(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(),iU=Nt(Nx).replace("(?:-->|$)","-->").getRegex(),rU=Nt("^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",iU).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Hh=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,aU=Nt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Hh).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),T3=Nt(/^!?\[(label)\]\[(ref)\]/).replace("label",Hh).replace("ref",kx).getRegex(),A3=Nt(/^!?\[(ref)\](?:\[\])?/).replace("ref",kx).getRegex(),oU=Nt("reflink|nolink(?!\\()","g").replace("reflink",T3).replace("nolink",A3).getRegex(),Vw=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,jx={_backpedal:Wa,anyPunctuation:sU,autolink:nU,blockSkip:WH,br:N3,code:UH,del:Wa,delLDelim:Wa,delRDelim:Wa,emStrongLDelim:KH,emStrongRDelimAst:XH,emStrongRDelimUnd:QH,escape:HH,link:aU,nolink:A3,punctuation:qH,reflink:T3,reflinkSearch:oU,tag:rU,text:FH,url:Wa},lU={...jx,link:Nt(/^!?\[(label)\]\((.*?)\)/).replace("label",Hh).getRegex(),reflink:Nt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Hh).getRegex()},O0={...jx,emStrongRDelimAst:ZH,emStrongLDelim:YH,delLDelim:JH,delRDelim:tU,url:Nt(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Vw).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Nt(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Vw).getRegex()},cU={...O0,br:Nt(N3).replace("{2,}","*").getRegex(),text:Nt(O0.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Wd={normal:Cx,gfm:PH,pedantic:$H},pc={normal:jx,gfm:O0,breaks:cU,pedantic:lU},uU={"&":"&","<":"<",">":">",'"':""","'":"'"},Gw=e=>uU[e];function $i(e,t){if(t){if(an.escapeTest.test(e))return e.replace(an.escapeReplace,Gw)}else if(an.escapeTestNoEncode.test(e))return e.replace(an.escapeReplaceNoEncode,Gw);return e}function Ww(e){try{e=encodeURI(e).replace(an.percentDecode,"%")}catch{return null}return e}function Kw(e,t){let s=e.replace(an.findPipe,(l,u,h)=>{let m=!1,d=u;for(;--d>=0&&h[d]==="\\";)m=!m;return m?"|":" |"}),n=s.split(an.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(an.slashPipe,"|");return n}function aa(e,t,s){let n=e.length;if(n===0)return"";let o=0;for(;o<n&&e.charAt(n-o-1)===t;)o++;return e.slice(0,n-o)}function Yw(e){let t=e.split(`
|
|
98
|
+
`),s=t.length-1;for(;s>=0&&an.blankLine.test(t[s]);)s--;return t.length-s<=2?e:t.slice(0,s+1).join(`
|
|
99
|
+
`)}function dU(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 hU(e,t=0){let s=t,n="";for(let o of e)if(o===" "){let l=4-s%4;n+=" ".repeat(l),s+=l}else n+=o,s++;return n}function Xw(e,t,s,n,o){let l=t.href,u=t.title||null,h=e[1].replace(o.other.outputLinkReplace,"$1");n.state.inLink=!0;let m={type:e[0].charAt(0)==="!"?"image":"link",raw:s,href:l,title:u,text:h,tokens:n.inlineTokens(h)};return n.state.inLink=!1,m}function fU(e,t,s){let n=e.match(s.other.indentCodeCompensation);if(n===null)return t;let o=n[1];return t.split(`
|
|
100
|
+
`).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(`
|
|
101
|
+
`)}var Uh=class{options;rules;lexer;constructor(e){this.options=e||oo}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let s=this.options.pedantic?t[0]:Yw(t[0]),n=s.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:s,codeBlockStyle:"indented",text:n}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let s=t[0],n=fU(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=aa(s,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(s=n.trim())}return{type:"heading",raw:aa(t[0],`
|
|
102
|
+
`),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:aa(t[0],`
|
|
103
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let s=aa(t[0],`
|
|
104
|
+
`).split(`
|
|
105
|
+
`),n="",o="",l=[];for(;s.length>0;){let u=!1,h=[],m;for(m=0;m<s.length;m++)if(this.rules.other.blockquoteStart.test(s[m]))h.push(s[m]),u=!0;else if(!u)h.push(s[m]);else break;s=s.slice(m);let d=h.join(`
|
|
106
|
+
`),p=d.replace(this.rules.other.blockquoteSetextReplace,`
|
|
107
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}
|
|
108
|
+
${d}`:d,o=o?`${o}
|
|
109
|
+
${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 b=l.at(-1);if(b?.type==="code")break;if(b?.type==="blockquote"){let v=b,w=v.raw+`
|
|
110
|
+
`+s.join(`
|
|
111
|
+
`),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(b?.type==="list"){let v=b,w=v.raw+`
|
|
112
|
+
`+s.join(`
|
|
113
|
+
`),k=this.list(w);l[l.length-1]=k,n=n.substring(0,n.length-b.raw.length)+k.raw,o=o.substring(0,o.length-v.raw.length)+k.raw,s=w.substring(l.at(-1).raw.length).split(`
|
|
114
|
+
`);continue}}return{type:"blockquote",raw:n,tokens:l,text:o}}}list(e){let t=this.rules.block.list.exec(e);if(t){let s=t[1].trim(),n=s.length>1,o={type:"list",raw:"",ordered:n,start:n?+s.slice(0,-1):"",loose:!1,items:[]};s=n?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=n?s:"[*+-]");let l=this.rules.other.listItemRegex(s),u=!1;for(;e;){let m=!1,d="",p="";if(!(t=l.exec(e))||this.rules.block.hr.test(e))break;d=t[0],e=e.substring(d.length);let g=hU(t[2].split(`
|
|
115
|
+
`,1)[0],t[1].length),b=e.split(`
|
|
116
|
+
`,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(b)&&(d+=b+`
|
|
117
|
+
`,e=e.substring(b.length+1),m=!0),!m){let k=this.rules.other.nextBulletRegex(w),N=this.rules.other.hrRegex(w),E=this.rules.other.fencesBeginRegex(w),A=this.rules.other.headingBeginRegex(w),j=this.rules.other.htmlBeginRegex(w),T=this.rules.other.blockquoteBeginRegex(w);for(;e;){let P=e.split(`
|
|
118
|
+
`,1)[0],z;if(b=P,this.options.pedantic?(b=b.replace(this.rules.other.listReplaceNesting," "),z=b):z=b.replace(this.rules.other.tabCharGlobal," "),E.test(b)||A.test(b)||j.test(b)||T.test(b)||k.test(b)||N.test(b))break;if(z.search(this.rules.other.nonSpaceChar)>=w||!b.trim())p+=`
|
|
119
|
+
`+z.slice(w);else{if(v||g.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||E.test(g)||A.test(g)||N.test(g))break;p+=`
|
|
120
|
+
`+b}v=!b.trim(),d+=P+`
|
|
121
|
+
`,e=e.substring(P.length+1),g=z.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 m of o.items){this.lexer.state.top=!1,m.tokens=this.lexer.blockTokens(m.text,[]);let d=m.tokens[0];if(m.task&&(d?.type==="text"||d?.type==="paragraph")){m.text=m.text.replace(this.rules.other.listReplaceTask,""),d.raw=d.raw.replace(this.rules.other.listReplaceTask,""),d.text=d.text.replace(this.rules.other.listReplaceTask,"");for(let g=this.lexer.inlineQueue.length-1;g>=0;g--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[g].src)){this.lexer.inlineQueue[g].src=this.lexer.inlineQueue[g].src.replace(this.rules.other.listReplaceTask,"");break}let p=this.rules.other.listTaskCheckbox.exec(m.raw);if(p){let g={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};m.checked=g.checked,o.loose?m.tokens[0]&&["paragraph","text"].includes(m.tokens[0].type)&&"tokens"in m.tokens[0]&&m.tokens[0].tokens?(m.tokens[0].raw=g.raw+m.tokens[0].raw,m.tokens[0].text=g.raw+m.tokens[0].text,m.tokens[0].tokens.unshift(g)):m.tokens.unshift({type:"paragraph",raw:g.raw,text:g.raw,tokens:[g]}):m.tokens.unshift(g)}}else m.task&&(m.task=!1);if(!o.loose){let p=m.tokens.filter(b=>b.type==="space"),g=p.length>0&&p.some(b=>this.rules.other.anyLine.test(b.raw));o.loose=g}}if(o.loose)for(let m of o.items){m.loose=!0;for(let d of m.tokens)d.type==="text"&&(d.type="paragraph")}return o}}html(e){let t=this.rules.block.html.exec(e);if(t){let s=Yw(t[0]);return{type:"html",block:!0,raw:s,pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:s}}}def(e){let t=this.rules.block.def.exec(e);if(t){let s=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",o=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:s,raw:aa(t[0],`
|
|
122
|
+
`),href:n,title:o}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let s=Kw(t[1]),n=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
123
|
+
`):[],l={type:"table",raw:aa(t[0],`
|
|
124
|
+
`),header:[],align:[],rows:[]};if(s.length===n.length){for(let u of n)this.rules.other.tableAlignRight.test(u)?l.align.push("right"):this.rules.other.tableAlignCenter.test(u)?l.align.push("center"):this.rules.other.tableAlignLeft.test(u)?l.align.push("left"):l.align.push(null);for(let u=0;u<s.length;u++)l.header.push({text:s[u],tokens:this.lexer.inline(s[u]),header:!0,align:l.align[u]});for(let u of o)l.rows.push(Kw(u,l.header.length).map((h,m)=>({text:h,tokens:this.lexer.inline(h),header:!1,align:l.align[m]})));return l}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let s=t[1].trim();return{type:"heading",raw:aa(t[0],`
|
|
125
|
+
`),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)===`
|
|
126
|
+
`?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=aa(s.slice(0,-1),"\\");if((s.length-l.length)%2===0)return}else{let l=dU(t[2],"()");if(l===-2)return;if(l>-1){let u=(t[0].indexOf("!")===0?5:4)+t[1].length+l;t[2]=t[2].substring(0,l),t[0]=t[0].substring(0,u).trim(),t[3]=""}}let n=t[2],o="";if(this.options.pedantic){let l=this.rules.other.pedanticHrefTitle.exec(n);l&&(n=l[1],o=l[3])}else o=t[3]?t[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(s)?n=n.slice(1):n=n.slice(1,-1)),Xw(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let s;if((s=this.rules.inline.reflink.exec(e))||(s=this.rules.inline.nolink.exec(e))){let n=(s[2]||s[1]).replace(this.rules.other.multipleSpaceGlobal," "),o=t[n.toLowerCase()];if(!o){let l=s[0].charAt(0);return{type:"text",raw:l,text:l}}return Xw(s,o,s[0],this.lexer,this.rules)}}emStrong(e,t,s=""){let n=this.rules.inline.emStrongLDelim.exec(e);if(!(!n||!n[1]&&!n[2]&&!n[3]&&!n[4]||n[4]&&s.match(this.rules.other.unicodeAlphaNumeric))&&(!(n[1]||n[3])||!s||this.rules.inline.punctuation.exec(s))){let o=[...n[0]].length-1,l,u,h=o,m=0,d=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+o);(n=d.exec(t))!==null;){if(l=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!l)continue;if(u=[...l].length,n[3]||n[4]){h+=u;continue}else if((n[5]||n[6])&&o%3&&!((o+u)%3)){m+=u;continue}if(h-=u,h>0)continue;u=Math.min(u,u+h+m);let p=[...n[0]][0].length,g=e.slice(0,o+n.index+p+u);if(Math.min(o,u)%2){let v=g.slice(1,-1);return{type:"em",raw:g,text:v,tokens:this.lexer.inlineTokens(v)}}let b=g.slice(2,-2);return{type:"strong",raw:g,text:b,tokens:this.lexer.inlineTokens(b)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let s=t[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(s),o=this.rules.other.startingSpaceChar.test(s)&&this.rules.other.endingSpaceChar.test(s);return n&&o&&(s=s.substring(1,s.length-1)),{type:"codespan",raw:t[0],text:s}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,s=""){let n=this.rules.inline.delLDelim.exec(e);if(n&&(!n[1]||!s||this.rules.inline.punctuation.exec(s))){let o=[...n[0]].length-1,l,u,h=o,m=this.rules.inline.delRDelim;for(m.lastIndex=0,t=t.slice(-1*e.length+o);(n=m.exec(t))!==null;){if(l=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!l||(u=[...l].length,u!==o))continue;if(n[3]||n[4]){h+=u;continue}if(h-=u,h>0)continue;u=Math.min(u,u+h);let d=[...n[0]][0].length,p=e.slice(0,o+n.index+d+u),g=p.slice(o,-o);return{type:"del",raw:p,text:g,tokens:this.lexer.inlineTokens(g)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let s,n;return t[2]==="@"?(s=t[1],n="mailto:"+s):(s=t[1],n=s),{type:"link",raw:t[0],text:s,href:n,tokens:[{type:"text",raw:s,text:s}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let s,n;if(t[2]==="@")s=t[0],n="mailto:"+s;else{let o;do o=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(o!==t[0]);s=t[0],t[1]==="www."?n="http://"+t[0]:n=t[0]}return{type:"link",raw:t[0],text:s,href:n,tokens:[{type:"text",raw:s,text:s}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let s=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:s}}}},Si=class L0{tokens;options;state;inlineQueue;tokenizer;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||oo,this.options.tokenizer=this.options.tokenizer||new Uh,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:an,block:Wd.normal,inline:pc.normal};this.options.pedantic?(s.block=Wd.pedantic,s.inline=pc.pedantic):this.options.gfm&&(s.block=Wd.gfm,this.options.breaks?s.inline=pc.breaks:s.inline=pc.gfm),this.tokenizer.rules=s}static get rules(){return{block:Wd,inline:pc}}static lex(t,s){return new L0(s).lex(t)}static lexInline(t,s){return new L0(s).inlineTokens(t)}lex(t){t=t.replace(an.carriageReturn,`
|
|
127
|
+
`),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(an.tabCharGlobal," ").replace(an.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+=`
|
|
128
|
+
`: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(`
|
|
129
|
+
`)?"":`
|
|
130
|
+
`)+l.raw,h.text+=`
|
|
131
|
+
`+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(`
|
|
132
|
+
`)?"":`
|
|
133
|
+
`)+l.raw,h.text+=`
|
|
134
|
+
`+l.raw,this.inlineQueue.at(-1).src=h.text):this.tokens.links[l.tag]||(this.tokens.links[l.tag]={href:l.href,title:l.title},s.push(l));continue}if(l=this.tokenizer.table(t)){t=t.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.lheading(t)){t=t.substring(l.raw.length),s.push(l);continue}let u=t;if(this.options.extensions?.startBlock){let h=1/0,m=t.slice(1),d;this.options.extensions.startBlock.forEach(p=>{d=p.call({lexer:this},m),typeof d=="number"&&d>=0&&(h=Math.min(h,d))}),h<1/0&&h>=0&&(u=t.substring(0,h+1))}if(this.state.top&&(l=this.tokenizer.paragraph(u))){let h=s.at(-1);n&&h?.type==="paragraph"?(h.raw+=(h.raw.endsWith(`
|
|
135
|
+
`)?"":`
|
|
136
|
+
`)+l.raw,h.text+=`
|
|
137
|
+
`+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(`
|
|
138
|
+
`)?"":`
|
|
139
|
+
`)+l.raw,h.text+=`
|
|
140
|
+
`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):s.push(l);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return this.state.top=!0,s}inline(t,s=[]){return this.inlineQueue.push({src:t,tokens:s}),s}inlineTokens(t,s=[]){this.tokenizer.lexer=this;let n=t,o=null;if(this.tokens.links){let d=Object.keys(this.tokens.links);if(d.length>0)for(;(o=this.tokenizer.rules.inline.reflinkSearch.exec(n))!==null;)d.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(o=this.tokenizer.rules.inline.anyPunctuation.exec(n))!==null;)n=n.slice(0,o.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let l;for(;(o=this.tokenizer.rules.inline.blockSkip.exec(n))!==null;)l=o[2]?o[2].length:0,n=n.slice(0,o.index+l)+"["+"a".repeat(o[0].length-l-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let u=!1,h="",m=1/0;for(;t;){if(t.length<m)m=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}u||(h=""),u=!1;let d;if(this.options.extensions?.inline?.some(g=>(d=g.call({lexer:this},t,s))?(t=t.substring(d.raw.length),s.push(d),!0):!1))continue;if(d=this.tokenizer.escape(t)){t=t.substring(d.raw.length),s.push(d);continue}if(d=this.tokenizer.tag(t)){t=t.substring(d.raw.length),s.push(d);continue}if(d=this.tokenizer.link(t)){t=t.substring(d.raw.length),s.push(d);continue}if(d=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(d.raw.length);let g=s.at(-1);d.type==="text"&&g?.type==="text"?(g.raw+=d.raw,g.text+=d.text):s.push(d);continue}if(d=this.tokenizer.emStrong(t,n,h)){t=t.substring(d.raw.length),s.push(d);continue}if(d=this.tokenizer.codespan(t)){t=t.substring(d.raw.length),s.push(d);continue}if(d=this.tokenizer.br(t)){t=t.substring(d.raw.length),s.push(d);continue}if(d=this.tokenizer.del(t,n,h)){t=t.substring(d.raw.length),s.push(d);continue}if(d=this.tokenizer.autolink(t)){t=t.substring(d.raw.length),s.push(d);continue}if(!this.state.inLink&&(d=this.tokenizer.url(t))){t=t.substring(d.raw.length),s.push(d);continue}let p=t;if(this.options.extensions?.startInline){let g=1/0,b=t.slice(1),v;this.options.extensions.startInline.forEach(w=>{v=w.call({lexer:this},b),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)}},Fh=class{options;parser;constructor(e){this.options=e||oo}space(e){return""}code({text:e,lang:t,escaped:s}){let n=(t||"").match(an.notSpaceStart)?.[0],o=e.replace(an.endingNewline,"")+`
|
|
141
|
+
`;return n?'<pre><code class="language-'+$i(n)+'">'+(s?o:$i(o,!0))+`</code></pre>
|
|
142
|
+
`:"<pre><code>"+(s?o:$i(o,!0))+`</code></pre>
|
|
143
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
144
|
+
${this.parser.parse(e)}</blockquote>
|
|
145
|
+
`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
146
|
+
`}hr(e){return`<hr>
|
|
147
|
+
`}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+`>
|
|
148
|
+
`+n+"</"+o+`>
|
|
149
|
+
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
150
|
+
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
151
|
+
`}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>
|
|
152
|
+
<thead>
|
|
153
|
+
`+t+`</thead>
|
|
154
|
+
`+n+`</table>
|
|
155
|
+
`}tablerow({text:e}){return`<tr>
|
|
156
|
+
${e}</tr>
|
|
157
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),s=e.header?"th":"td";return(e.align?`<${s} align="${e.align}">`:`<${s}>`)+t+`</${s}>
|
|
158
|
+
`}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>${$i(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:s}){let n=this.parser.parseInline(s),o=Ww(e);if(o===null)return n;e=o;let l='<a href="'+e+'"';return t&&(l+=' title="'+$i(t)+'"'),l+=">"+n+"</a>",l}image({href:e,title:t,text:s,tokens:n}){n&&(s=this.parser.parseInline(n,this.parser.textRenderer));let o=Ww(e);if(o===null)return $i(s);e=o;let l=`<img src="${e}" alt="${$i(s)}"`;return t&&(l+=` title="${$i(t)}"`),l+=">",l}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:$i(e.text)}},Tx=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}checkbox({raw:t}){return t}},wi=class z0{options;renderer;textRenderer;constructor(t){this.options=t||oo,this.options.renderer=this.options.renderer||new Fh,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Tx}static parse(t,s){return new z0(s).parse(t)}static parseInline(t,s){return new z0(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}},Ec=class{options;block;constructor(e){this.options=e||oo}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?Si.lex:Si.lexInline}provideParser(e=this.block){return e?wi.parse:wi.parseInline}},mU=class{defaults=yx();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=wi;Renderer=Fh;TextRenderer=Tx;Lexer=Si;Tokenizer=Uh;Hooks=Ec;constructor(...t){this.use(...t)}walkTokens(t,s){let n=[];for(let o of t)switch(n=n.concat(s.call(this,o)),o.type){case"table":{let l=o;for(let u of l.header)n=n.concat(this.walkTokens(u.tokens,s));for(let u of l.rows)for(let h of u)n=n.concat(this.walkTokens(h.tokens,s));break}case"list":{let l=o;n=n.concat(this.walkTokens(l.items,s));break}default:{let l=o;this.defaults.extensions?.childTokens?.[l.type]?this.defaults.extensions.childTokens[l.type].forEach(u=>{let h=l[u].flat(1/0);n=n.concat(this.walkTokens(h,s))}):l.tokens&&(n=n.concat(this.walkTokens(l.tokens,s)))}}return n}use(...t){let s=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{let o={...n};if(o.async=this.defaults.async||o.async||!1,n.extensions&&(n.extensions.forEach(l=>{if(!l.name)throw new Error("extension name required");if("renderer"in l){let u=s.renderers[l.name];u?s.renderers[l.name]=function(...h){let m=l.renderer.apply(this,h);return m===!1&&(m=u.apply(this,h)),m}:s.renderers[l.name]=l.renderer}if("tokenizer"in l){if(!l.level||l.level!=="block"&&l.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let u=s[l.level];u?u.unshift(l.tokenizer):s[l.level]=[l.tokenizer],l.start&&(l.level==="block"?s.startBlock?s.startBlock.push(l.start):s.startBlock=[l.start]:l.level==="inline"&&(s.startInline?s.startInline.push(l.start):s.startInline=[l.start]))}"childTokens"in l&&l.childTokens&&(s.childTokens[l.name]=l.childTokens)}),o.extensions=s),n.renderer){let l=this.defaults.renderer||new Fh(this.defaults);for(let u in n.renderer){if(!(u in l))throw new Error(`renderer '${u}' does not exist`);if(["options","parser"].includes(u))continue;let h=u,m=n.renderer[h],d=l[h];l[h]=(...p)=>{let g=m.apply(l,p);return g===!1&&(g=d.apply(l,p)),g||""}}o.renderer=l}if(n.tokenizer){let l=this.defaults.tokenizer||new Uh(this.defaults);for(let u in n.tokenizer){if(!(u in l))throw new Error(`tokenizer '${u}' does not exist`);if(["options","rules","lexer"].includes(u))continue;let h=u,m=n.tokenizer[h],d=l[h];l[h]=(...p)=>{let g=m.apply(l,p);return g===!1&&(g=d.apply(l,p)),g}}o.tokenizer=l}if(n.hooks){let l=this.defaults.hooks||new Ec;for(let u in n.hooks){if(!(u in l))throw new Error(`hook '${u}' does not exist`);if(["options","block"].includes(u))continue;let h=u,m=n.hooks[h],d=l[h];Ec.passThroughHooks.has(u)?l[h]=p=>{if(this.defaults.async&&Ec.passThroughHooksRespectAsync.has(u))return(async()=>{let b=await m.call(l,p);return d.call(l,b)})();let g=m.call(l,p);return d.call(l,g)}:l[h]=(...p)=>{if(this.defaults.async)return(async()=>{let b=await m.apply(l,p);return b===!1&&(b=await d.apply(l,p)),b})();let g=m.apply(l,p);return g===!1&&(g=d.apply(l,p)),g}}o.hooks=l}if(n.walkTokens){let l=this.defaults.walkTokens,u=n.walkTokens;o.walkTokens=function(h){let m=[];return m.push(u.call(this,h)),l&&(m=m.concat(l.call(this,h))),m}}this.defaults={...this.defaults,...o}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,s){return Si.lex(t,s??this.defaults)}parser(t,s){return wi.parse(t,s??this.defaults)}parseMarkdown(t){return(s,n)=>{let o={...n},l={...this.defaults,...o},u=this.onError(!!l.silent,!!l.async);if(this.defaults.async===!0&&o.async===!1)return u(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof s>"u"||s===null)return u(new Error("marked(): input parameter is undefined or null"));if(typeof s!="string")return u(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected"));if(l.hooks&&(l.hooks.options=l,l.hooks.block=t),l.async)return(async()=>{let h=l.hooks?await l.hooks.preprocess(s):s,m=await(l.hooks?await l.hooks.provideLexer(t):t?Si.lex:Si.lexInline)(h,l),d=l.hooks?await l.hooks.processAllTokens(m):m;l.walkTokens&&await Promise.all(this.walkTokens(d,l.walkTokens));let p=await(l.hooks?await l.hooks.provideParser(t):t?wi.parse:wi.parseInline)(d,l);return l.hooks?await l.hooks.postprocess(p):p})().catch(u);try{l.hooks&&(s=l.hooks.preprocess(s));let h=(l.hooks?l.hooks.provideLexer(t):t?Si.lex:Si.lexInline)(s,l);l.hooks&&(h=l.hooks.processAllTokens(h)),l.walkTokens&&this.walkTokens(h,l.walkTokens);let m=(l.hooks?l.hooks.provideParser(t):t?wi.parse:wi.parseInline)(h,l);return l.hooks&&(m=l.hooks.postprocess(m)),m}catch(h){return u(h)}}}onError(t,s){return n=>{if(n.message+=`
|
|
159
|
+
Please report this to https://github.com/markedjs/marked.`,t){let o="<p>An error occurred:</p><pre>"+$i(n.message+"",!0)+"</pre>";return s?Promise.resolve(o):o}if(s)return Promise.reject(n);throw n}}},so=new mU;function Dt(e,t){return so.parse(e,t)}Dt.options=Dt.setOptions=function(e){return so.setOptions(e),Dt.defaults=so.defaults,y3(Dt.defaults),Dt};Dt.getDefaults=yx;Dt.defaults=oo;Dt.use=function(...e){return so.use(...e),Dt.defaults=so.defaults,y3(Dt.defaults),Dt};Dt.walkTokens=function(e,t){return so.walkTokens(e,t)};Dt.parseInline=so.parseInline;Dt.Parser=wi;Dt.parser=wi.parse;Dt.Renderer=Fh;Dt.TextRenderer=Tx;Dt.Lexer=Si;Dt.lexer=Si.lex;Dt.Tokenizer=Uh;Dt.Hooks=Ec;Dt.parse=Dt;Dt.options;Dt.setOptions;Dt.use;Dt.walkTokens;Dt.parseInline;wi.parse;Si.lex;function pU(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 R3({content:e}){const t=y.useMemo(()=>{const s=Dt.parse(e,{async:!1,gfm:!0,breaks:!0});return pU(s)},[e]);return r.jsx("div",{className:"chat-md",dangerouslySetInnerHTML:{__html:t}})}function gU(e){return Math.min(e,Math.max(1,Math.ceil(e/22)))}function bU(e){const[t,s]=y.useState(e),n=y.useRef(e),o=y.useRef(e);return o.current=e,y.useEffect(()=>{e.startsWith(n.current)||(n.current=e,s(e))},[e]),y.useEffect(()=>{if(n.current.length>=o.current.length)return;const l=requestAnimationFrame(()=>{const u=o.current,h=u.slice(0,n.current.length+gU(u.length-n.current.length));n.current=h,s(h)});return()=>cancelAnimationFrame(l)},[t,e]),t}function xU(){return r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",role:"status",children:[r.jsx(Et,{className:"size-3.5 animate-spin"}),r.jsx("span",{children:"Thinking…"})]})}function vU({onOpenAgentPage:e,onOpenService:t,onOpenSqlConsole:s,git:n,onGitRefresh:o}){const{error:l,success:u}=$s(),{turns:h,streaming:m,error:d,configured:p,provider:g,providers:b,selectProvider:v,approvals:w,send:k,stop:N,clear:E,respond:A,open:j,setOpen:T,draft:P,setDraft:z,insertPath:L,activeSource:R,clearSource:D,focusNonce:I,stickNonce:V,sendToAgent:X,onboarding:$,setOnboarding:W}=It(),[q,B]=y.useState(""),[Z,U]=y.useState(!1),[K,Y]=y.useState(!1),[F,ie]=y.useState(!1),[Ee,ye]=y.useState(null),[oe,je]=y.useState(!1),Ne=y.useRef(null),Ge=y.useRef(null),Me=y.useRef(null),Qe=y.useRef(null);y.useEffect(()=>{if(!j||$)return;let Pe=0,Ct=0;const wt=()=>{const Rt=Ge.current;if(!Rt||P&&Rt.value!==P){Ct++<10&&(Pe=requestAnimationFrame(wt));return}Rt.focus();const Ft=Rt.value.length;Rt.setSelectionRange(Ft,Ft),Rt.scrollTop=Rt.scrollHeight};return Pe=requestAnimationFrame(wt),()=>cancelAnimationFrame(Pe)},[j,I,$]),y.useLayoutEffect(()=>{const Pe=Ge.current;Pe&&(Pe.style.height="auto",Pe.style.height=`${Pe.scrollHeight}px`)},[P]),y.useEffect(()=>{!j||!$||requestAnimationFrame(()=>Me.current?.focus())},[j,$]),y.useEffect(()=>{if(!j)return;const Pe=Ct=>{Qe.current?.contains(Ct.target)||T(!1)};return document.addEventListener("pointerdown",Pe),()=>document.removeEventListener("pointerdown",Pe)},[j,T]),y.useEffect(()=>{const Pe=wt=>{wt.dataTransfer&&Ow(wt.dataTransfer)&&U(!0)},Ct=()=>{U(!1),Y(!1)};return document.addEventListener("dragstart",Pe),document.addEventListener("dragend",Ct),document.addEventListener("drop",Ct),()=>{document.removeEventListener("dragstart",Pe),document.removeEventListener("dragend",Ct),document.removeEventListener("drop",Ct)}},[]);const ke=y.useRef(!0);function He(){const Pe=Ne.current;Pe&&(ke.current=Pe.scrollHeight-Pe.scrollTop-Pe.clientHeight<48)}y.useEffect(()=>{const Pe=Ne.current;Pe&&ke.current&&(Pe.scrollTop=Pe.scrollHeight)},[h,j]),y.useEffect(()=>{ke.current=!0;const Pe=Ne.current;if(!Pe)return;const Ct=requestAnimationFrame(()=>{Pe.scrollTop=Pe.scrollHeight});return()=>cancelAnimationFrame(Ct)},[V]);async function $e(){const Pe=P;z(""),ke.current=!0,await k(Pe)}function St(Pe){Pe.trim()&&(z(""),W(!1),B(""),ke.current=!0,X({prompt:hP(Pe),source:{type:"repo-onboard",label:"Onboard repo"},label:`Onboard and run this repo: ${Pe}`}))}function Us(Pe){ke.current=!0,k(Pe)}async function Fs(Pe){try{await tC(Pe),u(`Starting ${Pe}…`)}catch(Ct){l(Ct instanceof Error?Ct.message:`Could not start ${Pe}.`)}}function On(Pe){Pe.key==="Enter"&&!Pe.shiftKey&&(Pe.preventDefault(),$e())}function wn(Pe){Ow(Pe.dataTransfer)&&(Pe.preventDefault(),Pe.dataTransfer.dropEffect="copy",j||T(!0),Y(!0))}function js(Pe){Pe.currentTarget.contains(Pe.relatedTarget)||Y(!1)}function cn(Pe){Y(!1);const Ct=h$(Pe.dataTransfer);Ct&&(Pe.preventDefault(),L(Ct))}function un(Pe){if(!j)return;Pe.preventDefault(),Pe.currentTarget.setPointerCapture(Pe.pointerId),je(!0);const Ct=160,wt=window.innerHeight-48;function Rt(Qs){const Js=window.innerHeight-Qs.clientY;ye(Math.max(Ct,Math.min(wt,Js)))}function Ft(){je(!1),window.removeEventListener("pointermove",Rt),window.removeEventListener("pointerup",Ft)}window.addEventListener("pointermove",Rt),window.addEventListener("pointerup",Ft)}return r.jsx("div",{ref:Qe,className:de("fixed inset-x-0 bottom-0 z-50 flex flex-col border-t border-border bg-card/95 shadow-[0_-8px_24px_-12px_rgba(0,0,0,0.25)] backdrop-blur",oe?"select-none":"transition-[height] duration-200",j?Ee===null?"h-[50vh]":"":Z?"h-12":"h-9",Z&&!K&&"border-primary/60 bg-primary/5",K&&"outline-dashed outline-2 -outline-offset-2 outline-primary/70"),style:j&&Ee!==null?{height:Ee}:void 0,onDragOver:wn,onDragLeave:js,onDrop:cn,children:j?r.jsxs(r.Fragment,{children:[r.jsx("div",{"aria-hidden":!0,className:"absolute inset-x-0 -top-1 z-10 h-2 cursor-ns-resize",onDoubleClick:()=>ye(null),onPointerDown:un}),r.jsxs("div",{className:"pointer-events-none absolute inset-x-0 top-0 z-20 flex items-start justify-between gap-2 px-2 pt-1.5",children:[r.jsxs("div",{className:"pointer-events-auto flex items-center gap-2",children:[r.jsx(_U,{provider:g,providers:b,onSelect:v,disabled:m}),R?r.jsxs("span",{className:"flex items-center gap-1 rounded-full border border-primary/30 bg-primary/10 px-2 py-0.5 text-[11px] text-primary",children:[r.jsx(Ci,{className:"size-3"}),r.jsx("span",{className:"max-w-40 truncate",children:R.label}),r.jsx("button",{"aria-label":"Clear source",className:"opacity-60 hover:opacity-100",onClick:D,type:"button",children:r.jsx(ts,{className:"size-3"})})]}):null]}),r.jsxs("div",{className:"pointer-events-auto flex items-center gap-1",children:[e?r.jsx(J,{"aria-label":"Open agent page",className:"size-7",onClick:e,size:"icon",title:"Open the full agent page",type:"button",variant:"ghost",children:r.jsx(QR,{})}):null,r.jsx(J,{"aria-label":"Clear conversation",className:"size-7",disabled:h.length===0,onClick:E,size:"icon",title:"Clear conversation",type:"button",variant:"ghost",children:r.jsx(Er,{})}),r.jsx(J,{"aria-label":"Collapse agent",className:"size-7",onClick:()=>T(!1),size:"icon",title:"Collapse",type:"button",variant:"ghost",children:r.jsx(vn,{})})]})]}),r.jsx("div",{ref:Ne,className:"min-h-0 flex-1 overflow-auto px-3 py-3",onScroll:He,children:r.jsxs("div",{className:"mx-auto w-full max-w-4xl space-y-3",children:[h.length===0?r.jsx(yU,{configured:p,provider:g,onOnboard:()=>W(!0)}):h.map((Pe,Ct)=>r.jsx(NU,{turn:Pe,streaming:m&&Ct===h.length-1,isLast:Ct===h.length-1,onChoose:Us,onStartService:Fs,onOpenService:t,onOpenSqlConsole:s},Pe.id)),d?r.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-xs text-destructive",children:[r.jsx(ul,{className:"mt-px size-3.5 shrink-0"}),r.jsx("span",{className:"min-w-0 break-words",children:d})]}):null]})}),w.length>0?r.jsx("div",{className:"shrink-0 space-y-1.5 border-t border-amber-500/25 bg-amber-500/[0.04] px-3 py-2",children:w.map(Pe=>r.jsx(EU,{prompt:Pe,onRespond:A},Pe.requestId))}):null,r.jsxs("div",{className:de("relative shrink-0 p-2 transition-colors",Z&&"bg-primary/5"),children:[n?r.jsx(iH,{git:n,onRefresh:o}):null,F?r.jsx(vH,{onClose:()=>ie(!1),onPick:Pe=>{ie(!1),L(Pe)}}):null,r.jsxs("div",{className:"mx-auto w-full max-w-4xl",children:[$?r.jsxs("form",{className:"mb-2 flex items-center gap-2 rounded-md border border-primary/40 bg-primary/5 p-1.5",onSubmit:Pe=>{Pe.preventDefault(),St(q)},children:[r.jsx(xn,{className:"size-4 shrink-0 text-primary"}),r.jsx("input",{ref:Me,className:"min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground",onChange:Pe=>B(Pe.target.value),placeholder:"Paste a repo URL — e.g. https://github.com/owner/repo",value:q}),r.jsx(J,{disabled:!q.trim(),size:"sm",type:"submit",children:"Onboard"}),r.jsx(J,{"aria-label":"Cancel onboarding",className:"size-7",onClick:()=>{W(!1),B("")},size:"icon",type:"button",variant:"ghost",children:r.jsx(ts,{})})]}):wU(P)&&!m?r.jsxs("button",{className:"mb-2 flex w-full items-center gap-2 rounded-md border border-primary/40 bg-primary/5 px-3 py-1.5 text-left text-xs text-primary transition-colors hover:bg-primary/10",onClick:()=>St(P),type:"button",children:[r.jsx(xn,{className:"size-3.5 shrink-0"}),r.jsxs("span",{className:"min-w-0 flex-1 truncate",children:["Onboard ",r.jsx("span",{className:"font-mono",children:P.trim()})," as a service"]}),r.jsx(S4,{className:"size-3.5 shrink-0 opacity-60"})]}):null,r.jsxs("div",{className:"flex items-end gap-1.5 rounded-2xl border border-border bg-background px-1.5 py-1.5 shadow-sm transition-colors hover:border-foreground/25 focus-within:border-foreground/40 focus-within:ring-1 focus-within:ring-ring",children:[r.jsx(J,{"aria-label":"Attach a file or folder",className:"size-8 shrink-0 rounded-full text-muted-foreground hover:text-foreground",disabled:p===!1,onClick:()=>ie(!0),size:"icon",title:"Attach a file or folder",type:"button",variant:F?"secondary":"ghost",children:r.jsx(eM,{})}),r.jsx("textarea",{ref:Ge,className:"max-h-32 min-h-8 flex-1 resize-none self-center overflow-y-auto bg-transparent px-1 py-1.5 text-sm outline-none placeholder:text-muted-foreground",disabled:p===!1,onChange:Pe=>z(Pe.target.value),onKeyDown:On,placeholder:p===!1?`${g?.label??"Agent"} (\`${g?.commandName??"agent"}\`) is not installed`:`Ask ${g?.label??"the agent"} anything about this project...`,rows:1,value:P}),m?r.jsx(J,{"aria-label":"Stop generating",className:"size-8 shrink-0 rounded-full",onClick:N,size:"icon",title:"Stop",type:"button",variant:"secondary",children:r.jsx(to,{className:"size-3.5 fill-current"})}):r.jsx(J,{"aria-label":"Send message",className:"size-8 shrink-0 rounded-full",disabled:!P.trim()||p===!1,onClick:()=>{$e()},size:"icon",title:"Send",type:"button",children:r.jsx(tf,{className:"size-4"})})]})]})]})]}):r.jsx("button",{className:de("flex h-full w-full items-center gap-2 px-3 text-left text-sm hover:bg-muted/50",Z?"font-medium text-primary":"text-muted-foreground"),onClick:()=>T(!0),type:"button",children:Z?r.jsxs(r.Fragment,{children:[r.jsx(bN,{className:"size-4 animate-bounce text-primary"}),r.jsx("span",{children:"Drop here to add it to your message"})]}):r.jsxs(r.Fragment,{children:[r.jsx(gh,{provider:g,className:"size-4 text-primary"}),m?r.jsxs("span",{className:"flex items-center gap-2 text-foreground",children:[r.jsx(Et,{className:"size-3.5 animate-spin"})," ",g?.label??"Agent"," is thinking…"]}):r.jsxs("span",{children:["Ask ",g?.label??"the agent","..."]}),r.jsx("span",{className:"ml-auto text-xs text-muted-foreground/70",children:"click to expand"})]})})})}function gh({provider:e,className:t}){return e?.id==="claude"?r.jsx(ml,{className:t}):e?.id==="codex"?r.jsx(ou,{className:t}):r.jsx(Ci,{className:t})}function _U({provider:e,providers:t,onSelect:s,disabled:n}){const[o,l]=y.useState(!1),u=y.useRef(null);return y.useEffect(()=>{if(!o)return;const h=m=>{u.current?.contains(m.target)||l(!1)};return document.addEventListener("pointerdown",h),()=>document.removeEventListener("pointerdown",h)},[o]),t.length<2?r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(gh,{provider:e,className:"size-4 text-primary"}),r.jsx("span",{className:"text-sm font-medium",children:e?.label??"Agent"})]}):r.jsxs("div",{ref:u,className:"relative",children:[r.jsxs("button",{className:"flex items-center gap-1.5 rounded-md px-1.5 py-0.5 text-sm font-medium transition-colors hover:bg-muted disabled:cursor-not-allowed disabled:opacity-60",disabled:n,onClick:()=>l(h=>!h),title:n?"Finish the current message to switch agents":"Switch agent",type:"button",children:[r.jsx(gh,{provider:e,className:"size-4 text-primary"}),r.jsx("span",{children:e?.label??"Agent"}),r.jsx(vn,{className:"size-3 opacity-60"})]}),o?r.jsx("div",{className:"absolute left-0 top-full z-30 mt-1 min-w-52 overflow-hidden rounded-lg border border-border bg-card p-1 shadow-lg",children:t.map(h=>{const m=h.id===e?.id;return r.jsxs("button",{className:"flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent",disabled:!h.configured,onClick:()=>{l(!1),m||s(h.id)},type:"button",children:[r.jsx(gh,{provider:h,className:"mt-0.5 size-4 shrink-0 text-primary"}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsxs("span",{className:"flex items-center gap-1.5 text-sm font-medium",children:[h.label,h.configured?null:r.jsx("span",{className:"rounded bg-muted px-1 py-px text-[10px] font-normal text-muted-foreground",children:"not installed"})]}),!h.configured&&h.installHint?r.jsx("span",{className:"mt-0.5 block text-[11px] leading-snug text-muted-foreground",children:h.installHint}):null]}),m?r.jsx(on,{className:"mt-0.5 size-3.5 shrink-0 text-primary"}):null]},h.id)})}):null]})}function yU({configured:e,provider:t,onOnboard:s}){return e===!1?r.jsxs("div",{className:"rounded-md border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground",children:["This dock runs the ",r.jsx("code",{className:"font-mono",children:t?.commandName??"agent"})," ","CLI. ",t?.installHint??"Install the active agent CLI, then reload."]}):r.jsxs("div",{className:"space-y-2 text-xs text-muted-foreground",children:[r.jsx("p",{children:t?.intro??'This is the active agent, running in your workspace with full tools - e.g. "restart the api and tail its logs", "what changed in git and why?", "fix the failing test".'}),r.jsxs("button",{className:"inline-flex items-center gap-1.5 rounded-full border border-primary/40 bg-primary/5 px-2.5 py-1 text-primary transition-colors hover:bg-primary/10",onClick:s,type:"button",children:[r.jsx(xn,{className:"size-3.5"}),"Onboard a repo from a URL"]})]})}const SU=/^(?:https?:\/\/|git@|ssh:\/\/)\S+$/i;function wU(e){const t=e.trim();return t.includes(`
|
|
160
|
+
`)||t.includes(" ")||!SU.test(t)?!1:/github\.com|gitlab\.|bitbucket\.|\.git$/i.test(t)}function kU({turn:e}){const[t,s]=y.useState(!1),n=!!e.label&&e.label!==e.text,o=n&&!t?e.label:e.text;return r.jsx("div",{className:"flex justify-end",children:r.jsxs("div",{className:"flex max-w-[85%] flex-col items-end gap-0.5",children:[r.jsx("div",{className:"whitespace-pre-wrap break-words rounded-2xl rounded-br-sm bg-muted px-3.5 py-2 text-sm text-foreground",children:o}),n?r.jsxs("button",{className:"flex items-center gap-0.5 px-1 text-[11px] text-muted-foreground transition-colors hover:text-foreground",onClick:()=>s(l=>!l),type:"button",children:[t?r.jsx(sf,{className:"size-3"}):r.jsx(vn,{className:"size-3"}),t?"Hide full prompt":"Show full prompt"]}):null]})})}function NU({turn:e,streaming:t,isLast:s,onChoose:n,onStartService:o,onOpenService:l,onOpenSqlConsole:u}){const h=bU(e.text);if(e.role==="user")return r.jsx(kU,{turn:e});const{body:m,options:d,service:p,sqlWrite:g}=kH(h);return r.jsxs("div",{className:"space-y-1.5",children:[e.tools.map(b=>r.jsx(CU,{tool:b},b.id)),m?r.jsx("div",{className:"break-words px-0.5 text-sm text-foreground",children:r.jsx(R3,{content:m})}):null,d.length>0&&s&&!t?r.jsx(NH,{options:d,onChoose:n}):null,p&&!t?r.jsx(CH,{service:p,onStart:o,onOpen:l}):null,g&&u&&!t?r.jsx(EH,{proposal:g,onOpen:u}):null,t&&!m?r.jsx(xU,{}):null]})}function CU({tool:e}){const t=M3(e.input);return r.jsxs("div",{className:de("inline-flex max-w-[85%] items-center gap-1.5 rounded-md border px-2 py-1 font-mono text-[11px]",e.isError?"border-destructive/40 bg-destructive/5 text-destructive":"border-border bg-background text-muted-foreground"),children:[e.status==="running"?r.jsx(Et,{className:"size-3 animate-spin"}):r.jsx(qM,{className:"size-3"}),r.jsx("span",{className:"font-semibold",children:e.name}),t?r.jsx("span",{className:"truncate",children:t}):null]})}function EU({prompt:e,onRespond:t}){const s=M3(e.input).slice(0,140);return r.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-amber-500/30 bg-amber-500/5 px-2.5 py-2 text-xs",children:[r.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-md bg-amber-500/15 text-amber-600 dark:text-amber-400",children:r.jsx(zN,{className:"size-4"})}),r.jsxs("div",{className:"min-w-0 flex-1 leading-tight",children:[r.jsx("div",{className:"mb-0.5 text-[10px] font-semibold uppercase tracking-wider text-amber-600 dark:text-amber-400/90",children:"Permission needed"}),r.jsxs("div",{className:"truncate font-mono text-[11px]",children:[r.jsx("span",{className:"font-semibold text-foreground",children:e.name}),s?r.jsx("span",{className:"ml-1 text-muted-foreground",children:s}):null]})]}),r.jsxs(J,{className:"h-7 gap-1 text-muted-foreground hover:border-destructive/40 hover:bg-destructive/10 hover:text-destructive",onClick:()=>t(e.requestId,"deny"),size:"sm",type:"button",variant:"outline",children:[r.jsx(ts,{className:"size-3.5"})," Deny"]}),r.jsxs(J,{className:"h-7 gap-1",onClick:()=>t(e.requestId,"allow"),size:"sm",type:"button",children:[r.jsx(on,{className:"size-3.5"})," Allow"]})]})}function M3(e){return!e||typeof e!="object"?"":Object.values(e).filter(s=>s!==void 0&&s!=="").map(s=>String(s)).join(" ")}const D3=y.createContext(null);function jU(){const e=y.useRef(new Set),t=y.useCallback(n=>(e.current.add(n),()=>{e.current.delete(n)}),[]),s=y.useCallback(async()=>{await Promise.all([...e.current].map(n=>Promise.resolve().then(n)))},[]);return{register:t,runActive:s}}function TU({value:e,children:t}){return r.jsx(D3.Provider,{value:e,children:t})}function du(e){const t=y.useContext(D3),s=y.useRef(e);s.current=e,y.useEffect(()=>{if(t)return t.register(()=>s.current())},[t])}function sl(e,t){const s=`nomoreide:${e}`,[n,o]=y.useState(()=>{try{const u=window.localStorage.getItem(s);return u===null?t:JSON.parse(u)}catch{return t}}),l=y.useCallback(u=>{o(u);try{window.localStorage.setItem(s,JSON.stringify(u))}catch{}},[s]);return[n,l]}const ag={host:"",port:"",user:"",password:"",database:"",ssl:!1},AU="localhost";function B0(e,t,{includePassword:s=!0}={}){const n=e==="mysql"?"mysql":"postgres",o=t.host.trim()||AU,l=t.port.trim(),u=t.database.trim().replace(/^\//,""),h=t.user.trim(),m=s&&t.password,d=h?`${encodeURIComponent(h)}${m?`:${encodeURIComponent(t.password)}`:""}@`:"",p=l?`:${l}`:"",g=e==="postgres"&&t.ssl?"?sslmode=require":"";return`${n}://${d}${o}${p}/${u}${g}`}function I0(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:Zw(t.username),password:Zw(t.password),database:t.pathname.replace(/^\//,""),ssl:t.searchParams.get("sslmode")==="require"||t.searchParams.has("ssl")}}function RU(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 Zw(e){try{return decodeURIComponent(e)}catch{return e}}const MU=[{value:"postgres",label:"Postgres"},{value:"mysql",label:"MySQL"},{value:"sqlite",label:"SQLite"}];function DU({onClose:e,onSaved:t,initial:s}){const{error:n,success:o}=$s(),l=!!s,u=y.useMemo(()=>OU(s),[s]),[h,m]=y.useState(u.engine),[d,p]=y.useState(u.name),[g,b]=y.useState(u.url),[v,w]=y.useState(u.fields),[k,N]=y.useState([]),[E,A]=y.useState({status:"idle"}),[j,T]=y.useState(!1),[P,z]=y.useState(!1);y.useEffect(()=>{l||GD().then(N).catch(()=>N([]))},[l]);const L=h==="sqlite",R=L?g.trim():B0(h,v),D=L?!!g.trim():!!(v.host.trim()&&v.database.trim());function I(){A({status:"idle"})}function V(K,Y){return B0(K,Y,{includePassword:!1})}function X(K){m(K),I(),K!=="sqlite"&&b(V(K,v))}function $(K){const Y={...v,...K};w(Y),b(V(h,Y)),I()}function W(K){I();const Y=RU(K),F=Y??h;Y&&Y!==h&&m(Y);const ie=Y==="sqlite"?null:I0(K);if(!ie){b(K);return}ie.password?(w(ie),b(V(F,ie))):(w({...ie,password:v.password}),b(K))}function q(K){m(K.engine);const Y=K.engine==="sqlite"?null:I0(K.url);Y?(w(Y),b(V(K.engine,Y))):b(K.url),I(),d.trim()||p(LU(K))}function B(){return d.trim()?L?g.trim()?null:"Database file path is required.":v.host.trim()?v.database.trim()?null:"Database name is required.":"Host is required.":"Name is required."}async function Z(){if(D){T(!0),I();try{const K=await KD({engine:h,url:R});A(K.ok?{status:"ok",message:"Connected"}:{status:"fail",message:K.error??"Connection failed"})}catch(K){A({status:"fail",message:K instanceof Error?K.message:String(K)})}finally{T(!1)}}}async function U(){const K=B();if(K){n(K);return}z(!0);try{await WD({name:d.trim(),engine:h,url:R}),o(`Saved connection "${d.trim()}".`),t(),e()}catch(Y){n(Y instanceof Error?Y.message:String(Y))}finally{z(!1)}}return r.jsx(Kn,{icon:r.jsx(fi,{}),onClose:e,title:l?"Edit database connection":"Add database connection",children:r.jsxs("div",{className:"flex flex-col gap-4",children:[k.length>0?r.jsxs("section",{children:[r.jsxs("p",{className:"mb-1.5 flex items-center gap-1.5 text-xs font-medium text-muted-foreground",children:[r.jsx(PM,{className:"size-3.5"}),"Found in your services"]}),r.jsx("div",{className:"flex flex-wrap gap-1.5",children:k.map(K=>r.jsxs("button",{type:"button",onClick:()=>q(K),className:"group flex items-center gap-1.5 rounded-md border border-border bg-background px-2 py-1 text-left text-xs transition-colors hover:border-primary hover:bg-muted",title:K.maskedUrl,children:[r.jsx(et,{variant:"outline",size:"small",children:K.engine}),r.jsx("span",{className:"font-mono",children:K.service}),r.jsxs("span",{className:"font-mono text-muted-foreground",children:["·",K.key]})]},`${K.service}:${K.key}`))})]}):null,r.jsxs("section",{children:[r.jsx("p",{className:"mb-1.5 text-xs font-medium text-muted-foreground",children:"Engine"}),r.jsx("div",{className:"flex gap-1.5",children:MU.map(K=>r.jsx(J,{size:"sm",variant:h===K.value?"default":"outline",onClick:()=>X(K.value),disabled:l,type:"button",children:K.label},K.value))})]}),r.jsxs("label",{className:"flex flex-col gap-1.5",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Name"}),r.jsx(gt,{value:d,onChange:K=>p(K.target.value),placeholder:"e.g. shop-db",disabled:l}),l?r.jsx("span",{className:"text-[11px] text-muted-foreground",children:"The name identifies the connection and can't be changed here."}):null]}),L?null:r.jsxs("section",{className:"flex flex-col gap-3",children:[r.jsxs("div",{className:"flex gap-3",children:[r.jsxs("label",{className:"flex flex-1 flex-col gap-1.5",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Host"}),r.jsx(gt,{value:v.host,onChange:K=>$({host:K.target.value}),placeholder:"localhost",className:"font-mono text-xs"})]}),r.jsxs("label",{className:"flex w-24 flex-col gap-1.5",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Port"}),r.jsx(gt,{value:v.port,onChange:K=>$({port:K.target.value}),placeholder:h==="mysql"?"3306":"5432",className:"font-mono text-xs"})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsxs("label",{className:"flex flex-1 flex-col gap-1.5",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"User"}),r.jsx(gt,{value:v.user,onChange:K=>$({user:K.target.value}),placeholder:"postgres",className:"font-mono text-xs"})]}),r.jsxs("label",{className:"flex flex-1 flex-col gap-1.5",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Password"}),r.jsx(gt,{type:"password",value:v.password,onChange:K=>$({password:K.target.value}),placeholder:l?"leave blank to keep current":"••••••••",className:"font-mono text-xs"})]})]}),r.jsxs("label",{className:"flex flex-col gap-1.5",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Database"}),r.jsx(gt,{value:v.database,onChange:K=>$({database:K.target.value}),placeholder:"app",className:"font-mono text-xs"})]}),h==="postgres"?r.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("input",{type:"checkbox",checked:v.ssl,onChange:K=>$({ssl:K.target.checked}),className:"size-3.5 accent-primary"}),"Require SSL (adds ",r.jsx("span",{className:"font-mono",children:"?sslmode=require"}),")"]}):null]}),r.jsxs("label",{className:"flex flex-col gap-1.5",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:L?"Database file path":"Connection URL"}),r.jsx(gt,{value:g,onChange:K=>W(K.target.value),placeholder:L?"/abs/path/to/app.db":h==="mysql"?"mysql://user:pass@host:3306/db":"postgres://user:pass@host:5432/db",className:"font-mono text-xs"}),r.jsx("span",{className:"text-[11px] text-muted-foreground",children:L?"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."})]}),E.status!=="idle"?r.jsxs("div",{className:`flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 text-xs ${E.status==="ok"?"border-emerald-500/40 text-emerald-600 dark:text-emerald-400":"border-destructive/40 text-destructive"}`,children:[E.status==="ok"?r.jsx(on,{className:"size-3.5"}):r.jsx(ts,{className:"size-3.5"}),r.jsx("span",{className:"break-all font-mono",children:E.message})]}):null,r.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-border pt-3",children:[r.jsxs(J,{variant:"outline",size:"sm",onClick:()=>{Z()},disabled:j||!D,type:"button",children:[j?r.jsx(Et,{className:"animate-spin"}):null,"Test connection"]}),r.jsxs(J,{size:"sm",onClick:()=>{U()},disabled:P,type:"button",children:[P?r.jsx(Et,{className:"animate-spin"}):null,l?"Save changes":"Save"]})]})]})})}function OU(e){if(!e)return{engine:"postgres",name:"",fields:ag,url:""};if(e.engine==="sqlite")return{engine:"sqlite",name:e.name,fields:ag,url:e.url};const t=I0(e.url),s=t?{...t,password:""}:ag;return{engine:e.engine,name:e.name,fields:s,url:B0(e.engine,s,{includePassword:!1})}}function LU(e){try{const s=new URL(e.url).pathname.replace(/^\//,"");if(s)return`${e.service}-${s}`}catch{}return`${e.service}-${e.engine}`}function zU({connections:e,selected:t,onSelect:s,onAdd:n,onEdit:o,onRemove:l}){const[u,h]=y.useState(!1),m=y.useRef(null),d=e.find(p=>p.name===t);return y.useEffect(()=>{if(!u)return;function p(g){m.current&&g.target instanceof Node&&!m.current.contains(g.target)&&h(!1)}return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[u]),r.jsxs("div",{className:"relative z-50 flex items-center gap-2",ref:m,children:[r.jsxs(J,{className:"max-w-[240px] justify-start gap-2 rounded-md border-border bg-card",onClick:()=>h(p=>!p),size:"sm",type:"button",variant:"outline",children:[r.jsx(fi,{className:"text-muted-foreground"}),r.jsx("span",{className:"truncate",children:d?.name??"Select connection"}),d?r.jsx(et,{variant:"outline",size:"small",children:d.engine}):null,r.jsx(vn,{className:de("ml-auto transition-transform",u&&"rotate-180")})]}),u?r.jsxs("div",{className:"absolute right-0 top-10 z-50 w-[min(420px,calc(100vw-2rem))] overflow-hidden rounded-lg border border-border bg-card shadow-lg",children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[r.jsx(fi,{className:"size-3.5 text-muted-foreground"}),r.jsx("div",{className:"text-xs font-semibold",children:"Connections"}),r.jsx(et,{className:"ml-auto",variant:"outline",size:"small",children:e.length})]}),r.jsx("div",{className:"max-h-72 overflow-auto",children:e.length?r.jsx("div",{className:"divide-y divide-border",children:e.map(p=>{const g=p.name===t;return r.jsxs("div",{className:de("group grid w-full grid-cols-[1fr_auto_auto_auto] items-center gap-2 px-3 py-1.5 text-left transition-colors hover:bg-muted",g&&"bg-muted/70"),children:[r.jsxs("button",{className:"min-w-0 text-left",onClick:()=>{s(p.name),h(!1)},type:"button",children:[r.jsx("span",{className:"block truncate text-sm font-medium leading-tight",children:p.name}),r.jsx("span",{className:"block truncate font-mono text-[10px] leading-tight text-muted-foreground",children:p.url})]}),g?r.jsx(on,{className:"size-3.5"}):r.jsx("span",{className:"size-3.5"}),r.jsx(J,{"aria-label":`Edit ${p.name}`,className:"size-6 opacity-0 transition-opacity group-hover:opacity-100",onClick:()=>{o(p),h(!1)},size:"icon",title:`Edit ${p.name}`,type:"button",variant:"ghost",children:r.jsx(rl,{className:"size-3.5"})}),r.jsx(J,{"aria-label":`Remove ${p.name}`,className:"size-6 opacity-0 transition-opacity group-hover:opacity-100",onClick:()=>l(p.name),size:"icon",title:`Remove ${p.name}`,type:"button",variant:"ghost",children:r.jsx(Er,{className:"size-3.5 text-destructive"})})]},p.name)})}):r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"No saved connections yet."})}),r.jsx("div",{className:"border-t border-border bg-muted/20 p-2",children:r.jsxs(J,{className:"w-full",onClick:()=>{n(),h(!1)},size:"sm",type:"button",children:[r.jsx(Es,{className:"size-3"}),"Add connection"]})})]}):null]})}function BU({onAddManual:e,onAddWithAi:t}){const[s,n]=y.useState(!1),o=y.useRef(null);y.useEffect(()=>{if(!s)return;function u(h){o.current&&h.target instanceof Node&&!o.current.contains(h.target)&&n(!1)}return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]);function l(u){n(!1),u()}return r.jsxs("div",{className:"relative",ref:o,children:[r.jsxs(J,{"aria-label":"Add database connection",onClick:()=>n(u=>!u),size:"sm",type:"button",children:[r.jsx(Es,{className:"size-3.5"}),"Add"]}),s?r.jsxs("div",{className:"absolute right-0 top-9 z-50 w-56 overflow-hidden rounded-lg border border-border bg-card shadow-lg",children:[r.jsxs("button",{className:"flex w-full items-center gap-2 px-3 py-2 text-left text-sm transition-colors hover:bg-muted",onClick:()=>l(e),type:"button",children:[r.jsx(fi,{className:"size-3.5 text-muted-foreground"}),"Add connection"]}),r.jsxs("button",{className:"flex w-full items-center gap-2 border-t border-border px-3 py-2 text-left text-sm transition-colors hover:bg-muted",onClick:()=>l(t),type:"button",children:[r.jsx(Ci,{className:"size-3.5 text-muted-foreground"}),"Add with AI"]})]}):null]})}function IU(){const[e,t]=y.useState([]),[s,n]=y.useState(!0),[o,l]=y.useState(null),u=y.useCallback(async()=>{n(!0),l(null);try{t(await GN())}catch(h){l(h instanceof Error?h.message:String(h))}finally{n(!1)}},[]);return y.useEffect(()=>{u()},[u]),{connections:e,loading:s,error:o,refresh:u}}const O3=[50,100,500,1e3];function PU(e){const[t,s]=y.useState(null),[n,o]=y.useState(null),[l,u]=y.useState(!1);y.useEffect(()=>{s(null),o(null)},[e]);const h=y.useCallback(async(d,p)=>{if(!(!e||!d.trim())){u(!0),o(null);try{s(await XD(e,d,p))}catch(g){s(null),o(g instanceof Error?g.message:String(g))}finally{u(!1)}}},[e]),m=y.useCallback(()=>{s(null),o(null)},[]);return{result:t,error:n,running:l,run:h,reset:m}}const $U=["select","show","explain","pragma","describe","desc"];function HU(e){const t=/^\s*([a-z]+)/i.exec(e)?.[1]?.toLowerCase()??"";return $U.includes(t)}function UU(e){const[t,s]=y.useState(null),[n,o]=y.useState(null),[l,u]=y.useState(null),[h,m]=y.useState(!1),[d,p]=y.useState(!1);y.useEffect(()=>{s(null),o(null),u(null)},[e]);const g=y.useCallback(async k=>{if(!(!e||!k.trim())){m(!0),u(null),o(null);try{const N=await Fy(e,k,"preview");s({sql:k,preview:N})}catch(N){u(N instanceof Error?N.message:String(N))}finally{m(!1)}}},[e]),b=y.useCallback(async()=>{if(!e||!t)return null;p(!0),u(null);try{const k=await Fy(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=y.useCallback(()=>s(null),[]),w=y.useCallback(()=>{s(null),o(null),u(null)},[]);return{pending:t,committed:n,error:l,previewing:h,committing:d,preview:g,commit:b,cancel:v,reset:w}}function FU(e,t){const[s,n]=y.useState(!1),o=y.useCallback(async l=>{if(e){n(!0);try{await ZD(e,l),t()}finally{n(!1)}}},[e,t]);return{updating:s,setUnlocked:o}}function qU(e){const[t,s]=y.useState([]),[n,o]=y.useState(null),[l,u]=y.useState(null),[h,m]=y.useState(null),[d,p]=y.useState(null),[g,b]=y.useState(!1),[v,w]=y.useState(!1),[k,N]=y.useState(100),[E,A]=y.useState(0);y.useEffect(()=>{A(0)},[e,n]),y.useEffect(()=>{if(s([]),o(null),u(null),m(null),p(null),!e)return;let R=!1;return b(!0),WN(e).then(D=>{R||(s(D),o(D[0]?.qualifiedName??null))}).catch(D=>{R||m(D instanceof Error?D.message:String(D))}).finally(()=>{R||b(!1)}),()=>{R=!0}},[e]),y.useEffect(()=>{if(u(null),p(null),!e||!n)return;let R=!1;return w(!0),QD(e,n,k,E).then(D=>{R||u(D)}).catch(D=>{R||p(D instanceof Error?D.message:String(D))}).finally(()=>{R||w(!1)}),()=>{R=!0}},[e,n,k,E]);const j=E>0,T=l?l.rowCount===k:!1;function P(R){N(R),A(0)}function z(){T&&A(R=>R+k)}function L(){A(R=>Math.max(0,R-k))}return{tables:t,selectedTable:n,setSelectedTable:o,sample:l,tablesError:h,rowsError:d,loadingTables:g,loadingRows:v,limit:k,offset:E,canPrev:j,canNext:T,changePageSize:P,nextPage:z,prevPage:L}}function VU(e,t,s,n){const{sendToAgent:o,streaming:l,turns:u}=It(),[h,m]=y.useState(!1),[d,p]=y.useState(null),g=y.useRef(u);y.useEffect(()=>{g.current=u},[u]);const b=y.useRef(!1),v=y.useRef(null);return y.useEffect(()=>{if(l)b.current=!0;else if(b.current&&v.current){const k=v.current;v.current=null,k()}},[l]),{generate:y.useCallback(async k=>{if(!e||!k.trim()||h)return;m(!0),p(null);let N=[];try{N=await WN(e)}catch{N=[]}b.current=!1;const E=new Promise(A=>{let j=!1;const T=()=>{j||(j=!0,clearTimeout(P),v.current=null,A())};v.current=T;const P=setTimeout(()=>{b.current||T()},8e3)});o({prompt:pP(e,k,{engine:t,tables:N,unlocked:s}),source:{type:"database-sql-generate",label:"Generate SQL"},label:`Generate SQL: ${k}`,background:!0});try{await E;const A=WU(GU(g.current));A?n(A):p("The agent didn't return a SQL block — open the dock to see its reply.")}finally{m(!1)}},[e,t,s,h,n,o]),generating:h,error:d}}function GU(e){for(let t=e.length-1;t>=0;t--)if(e[t].role==="assistant")return e[t].text.trim();return""}function WU(e){if(!e)return null;const s=/```(?:sql)?\s*\n?([\s\S]*?)```/i.exec(e)?.[1]?.trim();return s||null}function L3({items:e,label:t="More actions",className:s}){const[n,o]=y.useState(!1),[l,u]=y.useState({top:0,right:0}),h=y.useRef(null),m=y.useRef(null);function d(){const p=h.current?.getBoundingClientRect();p&&u({top:p.bottom+4,right:window.innerWidth-p.right}),o(g=>!g)}return y.useEffect(()=>{if(!n)return;function p(v){const w=v.target;h.current?.contains(w)||m.current?.contains(w)||o(!1)}function g(v){v.key==="Escape"&&o(!1)}const b=()=>o(!1);return document.addEventListener("mousedown",p),document.addEventListener("keydown",g),window.addEventListener("scroll",b,!0),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",g),window.removeEventListener("scroll",b,!0)}},[n]),r.jsxs(r.Fragment,{children:[r.jsx("button",{"aria-label":t,className:de("flex size-6 items-center justify-center rounded-md text-muted-foreground opacity-0 transition-all duration-150 hover:bg-muted hover:text-foreground group-hover:opacity-100",n&&"opacity-100",s),onClick:d,ref:h,title:t,type:"button",children:r.jsx(xN,{className:"size-3.5"})}),n?va.createPortal(r.jsx("div",{className:"fixed z-50 min-w-44 overflow-hidden rounded-md border border-border bg-card p-1 shadow-md",ref:m,style:{top:l.top,right:l.right},children:e.map(p=>r.jsxs("button",{className:"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-xs text-foreground transition-colors hover:bg-muted",onClick:()=>{o(!1),p.onSelect()},type:"button",children:[p.icon?r.jsx("span",{className:"text-muted-foreground",children:p.icon}):null,p.label]},p.label))}),document.body):null]})}function KU({connection:e,sample:t}){const{sendToAgent:s}=It(),{success:n,error:o}=$s(),l=t.columns.map(p=>p.name);function u(p){s({prompt:mP(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(b){o(b instanceof Error?b.message:String(b))}}function m(p){const g=b=>{const v=Hc(b);return/[",\n]/.test(v)?`"${v.replace(/"/g,'""')}"`:v};return`${l.join(",")}
|
|
161
|
+
${l.map(b=>g(p[b])).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,"''")}'`,b=l.map(v=>g(p[v])).join(", ");return`INSERT INTO ${t.table} (${l.join(", ")}) VALUES (${b});`}return t.columns.length===0?r.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"This table has no columns."}):r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:r.jsxs("table",{className:"w-max min-w-full border-collapse text-left font-mono text-[11px]",children:[r.jsx("thead",{className:"sticky top-0 z-10 bg-card",children:r.jsxs("tr",{className:"border-b border-border",children:[t.columns.map(p=>r.jsxs("th",{className:"whitespace-nowrap px-3 py-2 font-semibold text-foreground",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[p.primaryKey?r.jsx(CN,{className:"size-3 text-amber-500"}):null,p.name]}),r.jsx("span",{className:"block text-[10px] font-normal text-muted-foreground",children:p.dataType})]},p.name)),r.jsx("th",{className:"sticky right-0 z-20 w-16 border-l border-border bg-card px-2 py-2"})]})}),r.jsxs("tbody",{children:[t.rows.map((p,g)=>r.jsxs("tr",{className:"group border-b border-border/60 hover:bg-muted/40",children:[t.columns.map(b=>r.jsx("td",{className:"max-w-[320px] truncate px-3 py-1 align-top text-muted-foreground",title:Hc(p[b.name]),children:Hc(p[b.name])},b.name)),r.jsx("td",{className:"sticky right-0 z-[1] border-l border-border/60 bg-card px-2 py-1 align-top before:pointer-events-none before:absolute before:inset-0 before:bg-muted/40 before:opacity-0 group-hover:before:opacity-100",children:r.jsxs("div",{className:"relative z-[1] flex items-center justify-end gap-0.5",children:[r.jsx(Ki,{label:"Ask AI about this row",onAsk:()=>u(p)}),r.jsx(L3,{label:"Row actions",items:[{label:"Copy as JSON",icon:r.jsx(ZA,{className:"size-3.5"}),onSelect:()=>{h(JSON.stringify(p,null,2),"row as JSON")}},{label:"Copy as CSV",icon:r.jsx($4,{className:"size-3.5"}),onSelect:()=>{h(m(p),"row as CSV")}},{label:"Copy as SQL INSERT",icon:r.jsx(fi,{className:"size-3.5"}),onSelect:()=>{h(d(p),"INSERT statement")}}]})]})})]},g)),t.rows.length===0?r.jsx("tr",{children:r.jsx("td",{colSpan:t.columns.length+1,className:"px-3 py-6 text-center text-muted-foreground",children:"No rows."})}):null]})]})})}function Hc(e){return e==null?"NULL":typeof e=="object"?JSON.stringify(e):String(e)}function YU({connection:e,busy:t,onConfirm:s,onClose:n}){return r.jsx(Kn,{icon:r.jsx(zN,{className:"text-amber-500"}),onClose:n,title:`Unlock writes on "${e}"?`,children:r.jsxs("div",{className:"flex flex-col gap-4 text-sm",children:[r.jsxs("p",{className:"text-muted-foreground",children:["This lets the SQL console run statements that ",r.jsx("strong",{children:"change data"})," ","— ",r.jsx("span",{className:"font-mono",children:"INSERT"}),","," ",r.jsx("span",{className:"font-mono",children:"UPDATE"}),","," ",r.jsx("span",{className:"font-mono",children:"DELETE"}),", and DDL like"," ",r.jsx("span",{className:"font-mono",children:"DROP"}),". Writes still preview their affected rows before they commit, but an unlocked connection can modify or destroy real data."]}),r.jsx("p",{className:"text-muted-foreground",children:"The lock stays open for this connection until you re-lock it. It is never shared with the AI agent."}),r.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-border pt-3",children:[r.jsx(J,{variant:"outline",size:"sm",onClick:n,type:"button",children:"Cancel"}),r.jsxs(J,{size:"sm",onClick:s,disabled:t,type:"button",children:[t?r.jsx(Et,{className:"animate-spin"}):r.jsx(EN,{}),"Unlock writes"]})]})]})})}function XU({sql:e,preview:t,busy:s,onConfirm:n,onClose:o}){return r.jsx(Kn,{icon:r.jsx(ul,{className:"text-amber-500"}),onClose:o,title:"Confirm write",children:r.jsxs("div",{className:"flex flex-col gap-4 text-sm",children:[r.jsx("pre",{className:"max-h-40 overflow-auto rounded-md border border-border bg-muted/40 px-3 py-2 font-mono text-[11px] whitespace-pre-wrap",children:e}),t.previewUnavailable?r.jsx("p",{className:"rounded-md border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-[13px] text-amber-700 dark:text-amber-300",children:"This statement can’t be previewed — DDL commits immediately on this engine and cannot be rolled back. Running it applies the change at once."}):r.jsxs("p",{className:"text-muted-foreground",children:["This will affect"," ",r.jsx("strong",{className:"text-foreground tabular-nums",children:t.affectedRows??0})," ","row",t.affectedRows===1?"":"s",". The preview ran in a transaction that was rolled back — nothing has changed yet."]}),r.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-border pt-3",children:[r.jsx(J,{variant:"outline",size:"sm",onClick:o,type:"button",children:"Cancel"}),r.jsxs(J,{size:"sm",className:"bg-amber-600 text-white hover:bg-amber-600/90",onClick:n,disabled:s,type:"button",children:[s?r.jsx(Et,{className:"animate-spin"}):null,"Run & commit"]})]})]})})}function ZU({connection:e,engine:t,unlocked:s,seed:n,onWriteAccessChange:o}){const{success:l}=$s(),{sendToAgent:u}=It(),h=PU(e),m=UU(e),d=FU(e,o),[p,g]=y.useState(n?.sql??""),[b,v]=y.useState(100),w=n?.nonce;y.useEffect(()=>{n&&g(n.sql)},[w]);const[k,N]=y.useState(!1),E=VU(e,t,s,g),A=p.trim().length>0&&!HU(p),j=s&&A,T=A&&!s,P=h.running||m.previewing;function z(){if(p.trim()){if(T){N(!0);return}j?(h.reset(),m.preview(p)):(m.reset(),h.run(p,b))}}function L(I){(I.metaKey||I.ctrlKey)&&I.key==="Enter"&&(I.preventDefault(),z())}function R(I){u({prompt:gP(e,t,p,I),source:{type:"database-sql-debug",label:"Debug SQL"},label:"Debug this SQL error"})}async function D(){const I=await m.commit();if(I?.committed){const V=I.affectedRows??0;l(`Committed — ${V} row${V===1?"":"s"} affected.`)}}return r.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[r.jsxs("div",{className:"shrink-0 border-b border-border p-2",children:[r.jsx(QU,{generate:E}),r.jsx("textarea",{value:p,onChange:I=>g(I.target.value),onKeyDown:L,spellCheck:!1,placeholder:s?"SELECT … / INSERT … / UPDATE … (Cmd/Ctrl+Enter to run)":"SELECT * FROM … (read-only — Cmd/Ctrl+Enter to run)",className:"h-24 w-full resize-y rounded-md border border-border bg-background px-2 py-1.5 font-mono text-[12px] outline-none focus:border-ring"}),r.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[r.jsx(JU,{unlocked:s,updating:d.updating,onUnlock:()=>N(!0),onLock:()=>{d.setUnlocked(!1)}}),r.jsxs("div",{className:"flex items-center gap-2",children:[j?null:r.jsx("select",{"aria-label":"Max rows",className:"rounded-md border border-border bg-background px-1.5 py-1 text-[11px]",value:b,onChange:I=>v(Number(I.target.value)),children:O3.map(I=>r.jsxs("option",{value:I,children:[I," rows"]},I))}),r.jsxs(J,{size:"sm",className:de("h-7 px-3",j&&"bg-amber-600 text-white hover:bg-amber-600/90"),onClick:z,disabled:P||!p.trim(),type:"button",children:[P?r.jsx(Et,{className:"size-3.5 animate-spin"}):r.jsx(Nr,{className:"size-3.5"}),j?"Preview write":"Run"]})]})]})]}),r.jsx(eF,{read:h,write:m,onDebug:R}),k?r.jsx(YU,{connection:e,busy:d.updating,onConfirm:async()=>{await d.setUnlocked(!0),N(!1)},onClose:()=>N(!1)}):null,m.pending?r.jsx(XU,{sql:m.pending.sql,preview:m.pending.preview,busy:m.committing,onConfirm:()=>{D()},onClose:m.cancel}):null]})}function QU({generate:e}){const[t,s]=y.useState("");function n(){const l=t.trim();!l||e.generating||e.generate(l)}function o(l){l.key==="Enter"&&(l.preventDefault(),n())}return r.jsxs("div",{className:"mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Gt,{className:"pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2"}),r.jsx("input",{value:t,onChange:l=>s(l.target.value),onKeyDown:o,disabled:e.generating,placeholder:"Describe the query in plain English — AI writes the SQL below",className:"h-8 w-full rounded-md border border-border bg-background pl-7 pr-2 text-[12px] outline-none focus:border-ring disabled:opacity-60"})]}),r.jsxs(J,{size:"sm",variant:"outline",className:"h-8 px-3",onClick:n,disabled:e.generating||!t.trim(),type:"button",children:[e.generating?r.jsx(Et,{className:"size-3.5 animate-spin"}):r.jsx(Gt,{className:"size-3.5"}),e.generating?"Generating…":"Ask AI"]})]}),e.error?r.jsx("p",{className:"mt-1 text-[11px] text-amber-600 dark:text-amber-400",children:e.error}):null]})}function JU({unlocked:e,updating:t,onUnlock:s,onLock:n}){return r.jsxs("button",{type:"button",onClick:e?n:s,disabled:t,className:de("flex items-center gap-1.5 rounded-md border px-2 py-1 text-[11px] font-medium transition-colors",e?"border-amber-500/50 text-amber-600 hover:bg-amber-500/10 dark:text-amber-400":"border-border text-muted-foreground hover:text-foreground"),title:e?"Writes unlocked — click to lock":"Read-only — click to unlock writes",children:[t?r.jsx(Et,{className:"size-3.5 animate-spin"}):e?r.jsx(EN,{className:"size-3.5"}):r.jsx(jR,{className:"size-3.5"}),e?"Writes unlocked":"Read-only"]})}function eF({read:e,write:t,onDebug:s}){const n=t.error??e.error;return r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:n?r.jsxs("div",{className:"space-y-3 p-4",children:[r.jsx("p",{className:"whitespace-pre-wrap font-mono text-[12px] text-destructive",children:n}),r.jsxs(J,{size:"sm",variant:"outline",className:"h-7 px-3",onClick:()=>s(n),type:"button",children:[r.jsx(Gt,{className:"size-3.5"}),"Debug with AI"]})]}):t.committed?r.jsx(tF,{outcome:t.committed}):e.result?r.jsx(z3,{columns:e.result.columns,rows:e.result.rows,truncated:e.result.truncated}):r.jsx("div",{className:"flex h-full items-center justify-center p-8 text-center text-sm text-muted-foreground",children:"Write a query and run it to see results here."})})}function tF({outcome:e}){if(!e)return null;const t=e.affectedRows??0;return r.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-1.5 border-b border-border bg-emerald-500/10 px-3 py-1.5 text-[12px] text-emerald-700 dark:text-emerald-400",children:[r.jsx(on,{className:"size-3.5"}),"Committed — ",t," row",t===1?"":"s"," affected."]}),e.rows&&e.rows.length>0&&e.columns?r.jsx(z3,{columns:e.columns,rows:e.rows}):null]})}function z3({columns:e,rows:t,truncated:s=!1}){return e.length===0?r.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"Query ran successfully — no columns returned."}):r.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[s?r.jsxs("div",{className:"flex shrink-0 items-center gap-1.5 border-b border-border bg-amber-500/10 px-3 py-1.5 text-[11px] text-amber-600 dark:text-amber-400",children:[r.jsx(ul,{className:"size-3.5"}),"Showing the first ",t.length," rows — add a LIMIT to narrow the result."]}):null,r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:r.jsxs("table",{className:"w-max min-w-full border-collapse text-left font-mono text-[11px]",children:[r.jsx("thead",{className:"sticky top-0 z-10 bg-card",children:r.jsx("tr",{className:"border-b border-border",children:e.map(n=>r.jsx("th",{className:"whitespace-nowrap px-3 py-2 font-semibold text-foreground",children:n.name},n.name))})}),r.jsxs("tbody",{children:[t.map((n,o)=>r.jsx("tr",{className:"border-b border-border/60 hover:bg-muted/40",children:e.map(l=>r.jsx("td",{className:"max-w-[320px] truncate px-3 py-1 align-top text-muted-foreground",title:Hc(n[l.name]),children:Hc(n[l.name])},l.name))},o)),t.length===0?r.jsx("tr",{children:r.jsx("td",{colSpan:e.length,className:"px-3 py-6 text-center text-muted-foreground",children:"No rows."})}):null]})]})})]})}function sF({staged:e,onStageConsumed:t}={}){const{connections:s,loading:n,error:o,refresh:l}=IU();du(l);const{error:u,success:h}=$s(),{sendToAgent:m}=It(),[d,p]=sl("database:selected",null),[g,b]=sl("database:mode","browse"),[v,w]=y.useState(null),[k,N]=y.useState(null);y.useEffect(()=>{e&&(e.connection&&p(e.connection),b("query"),N({sql:e.sql,nonce:e.nonce}),t?.())},[e?.nonce]);function E(){m({prompt:dP,source:{type:"database-setup",label:"Add a database"},label:"Help me connect a database, one step at a time."})}y.useEffect(()=>{if(s.length===0){d!==null&&p(null);return}(!d||!s.some(T=>T.name===d))&&p(s[0].name)},[s,d,p]);async function A(T){try{await YD(T),h(`Removed connection "${T}".`),await l()}catch(P){u(P instanceof Error?P.message:String(P))}}function j(T){w({mode:"edit",target:T})}return r.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/85",children:[r.jsxs("header",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(fi,{className:"size-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm font-semibold",children:"Databases"}),n&&s.length===0?r.jsx(Et,{className:"size-3.5 animate-spin text-muted-foreground"}):null]}),r.jsxs("div",{className:"flex items-center gap-2",children:[d?r.jsx(nF,{mode:g,onChange:b}):null,r.jsx(zU,{connections:s,selected:d,onSelect:p,onAdd:()=>w({mode:"add"}),onEdit:j,onRemove:T=>{A(T)}}),r.jsx(BU,{onAddManual:()=>w({mode:"add"}),onAddWithAi:E})]})]}),r.jsx("div",{className:"min-h-0 flex-1",children:o?r.jsx("div",{className:"p-4",children:r.jsx(tt,{variant:"muted",className:"border-destructive/40 text-destructive",children:o})}):d?g==="query"?r.jsx(ZU,{connection:d,engine:s.find(T=>T.name===d)?.engine,unlocked:s.find(T=>T.name===d)?.writeUnlocked??!1,seed:k,onWriteAccessChange:l},d):r.jsx(iF,{connection:d}):r.jsx(rF,{onAdd:()=>w({mode:"add"}),onAddWithAi:E})}),v?r.jsx(DU,{initial:v.mode==="edit"?v.target:void 0,onClose:()=>w(null),onSaved:l}):null]})}function nF({mode:e,onChange:t}){const s=[{value:"browse",label:"Browse",icon:PN},{value:"query",label:"SQL",icon:cl}];return r.jsx("div",{className:"flex items-center rounded-md border border-border p-0.5",children:s.map(n=>{const o=n.icon;return r.jsxs("button",{type:"button",onClick:()=>t(n.value),className:de("flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium transition-colors",e===n.value?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"),children:[r.jsx(o,{className:"size-3.5"}),n.label]},n.value)})})}function iF({connection:e}){const{sendToAgent:t}=It(),{tables:s,selectedTable:n,setSelectedTable:o,sample:l,tablesError:u,rowsError:h,loadingTables:m,loadingRows:d,limit:p,offset:g,canPrev:b,canNext:v,changePageSize:w,nextPage:k,prevPage:N}=qU(e);function E(j){t({prompt:Aw(e,j.table,{engine:j.engine,columns:j.columns}),source:{type:"database-table",label:`${j.table.name} table`},mode:"draft"})}function A(j){t({prompt:Aw(e,j),source:{type:"database-table",label:`${j.name} table`},mode:"draft"})}return r.jsxs("div",{className:"flex h-full min-h-0",children:[r.jsxs("div",{className:"flex w-56 shrink-0 flex-col border-r border-border",children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[r.jsx(PN,{className:"size-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm font-semibold",children:"Tables"}),r.jsx(et,{variant:"outline",size:"small",children:s.length}),m?r.jsx(Et,{className:"size-3.5 animate-spin"}):null]}),u?r.jsx("div",{className:"p-3",children:r.jsx(tt,{variant:"muted",className:"border-destructive/40 text-destructive",children:u})}):r.jsxs("ul",{className:"min-h-0 flex-1 overflow-auto",children:[s.map(j=>r.jsxs("li",{className:de("group flex items-center gap-1 pr-1 transition-colors hover:bg-muted/50",j.qualifiedName===n&&"bg-muted/70"),children:[r.jsx("button",{type:"button",onClick:()=>o(j.qualifiedName),className:de("min-w-0 flex-1 truncate px-3 py-1.5 text-left font-mono text-[11px]",j.qualifiedName===n&&"font-semibold"),children:j.qualifiedName}),r.jsx(Ki,{label:`Ask AI about \`${j.qualifiedName}\``,onAsk:()=>A(j)})]},j.qualifiedName)),!m&&s.length===0?r.jsx("li",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No tables."}):null]})]}),r.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[r.jsxs("div",{className:"group flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-2",children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[r.jsx("span",{className:"truncate font-mono text-xs font-semibold",children:n??"Select a table"}),l?r.jsx(Ki,{label:`Ask AI about \`${l.table.qualifiedName}\``,onAsk:()=>E(l)}):null]}),l?r.jsxs("div",{className:"flex shrink-0 items-center gap-2 text-[11px] text-muted-foreground",children:[r.jsx("span",{className:"tabular-nums",children:l.rowCount===0?"no rows":`rows ${g+1}–${g+l.rowCount}`}),r.jsx("select",{"aria-label":"Rows per page",className:"rounded-md border border-border bg-background px-1.5 py-0.5 text-[11px]",value:p,onChange:j=>w(Number(j.target.value)),children:O3.map(j=>r.jsxs("option",{value:j,children:[j," / page"]},j))}),r.jsx(J,{size:"sm",variant:"outline",className:"h-6 px-2",onClick:N,disabled:!b,type:"button",children:"Prev"}),r.jsx(J,{size:"sm",variant:"outline",className:"h-6 px-2",onClick:k,disabled:!v,type:"button",children:"Next"})]}):null]}),h?r.jsx("div",{className:"p-4",children:r.jsx(tt,{variant:"muted",className:"border-destructive/40 text-destructive",children:h})}):d?r.jsxs("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:[r.jsx(Et,{className:"mr-2 size-4 animate-spin"}),"Loading rows…"]}):l?r.jsx(KU,{connection:e,sample:l}):r.jsx("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:"Pick a table to sample its rows."})]})]})}function rF({onAdd:e,onAddWithAi:t}){return r.jsx("div",{className:"flex h-full items-center justify-center p-8 text-center",children:r.jsxs("div",{className:"max-w-sm",children:[r.jsx(fi,{className:"mx-auto size-8 text-muted-foreground/50"}),r.jsx("p",{className:"mt-3 text-sm font-medium",children:"No connections yet"}),r.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Add a read-only Postgres, MySQL, or SQLite connection to browse tables and sample rows. NoMoreIDE can auto-detect connection strings from your services' ",r.jsx("code",{children:".env"})," files."]}),r.jsxs("div",{className:"mt-4 flex items-center justify-center gap-2",children:[r.jsxs(J,{size:"sm",onClick:e,type:"button",children:[r.jsx(Es,{}),"Add connection"]}),r.jsxs(J,{size:"sm",variant:"outline",onClick:t,type:"button",children:[r.jsx(Ci,{}),"Add with AI"]})]})]})})}function aF({incident:e}){const{error:t}=$s(),{sendToAgent:s}=It(),[n,o]=y.useState(!1);async function l(){o(!0);try{const{prompt:u}=await t8(e.id);s({prompt:u,source:{type:"error",label:`${e.service} — ${e.level}`},label:`Help me debug this ${e.level} in \`${e.service}\`: ${e.title}`})}catch(u){t(u instanceof Error?u.message:String(u))}finally{o(!1)}}return r.jsxs("div",{className:"flex h-full min-h-0 min-w-0 flex-col",children:[r.jsxs("div",{className:"shrink-0 border-b border-border px-4 py-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx(et,{variant:e.level==="error"?"danger":"secondary",appearance:"subtle",size:"small",children:e.level}),r.jsx("span",{className:"truncate font-mono text-xs font-semibold",children:e.service}),e.count>1?r.jsxs(et,{variant:"outline",size:"small",children:["×",e.count]}):null]}),r.jsxs(J,{onClick:()=>{l()},disabled:n,size:"sm",variant:"outline",children:[r.jsx(Gt,{className:"size-3.5"}),n?"Sending…":"Fix with AI"]})]}),r.jsx("p",{className:"mt-1.5 break-words font-mono text-xs text-foreground",children:e.title}),e.file?r.jsxs("p",{className:"mt-1 flex items-center gap-1.5 font-mono text-[11px] text-muted-foreground",children:[r.jsx(yN,{className:"size-3.5"}),e.file,e.line?`:${e.line}`:""]}):null,r.jsxs("p",{className:"mt-1 font-mono text-[10px] text-muted-foreground/80",children:["first ",new Date(e.firstSeen).toLocaleString()," · last"," ",new Date(e.lastSeen).toLocaleTimeString()]})]}),r.jsxs("div",{className:"min-h-0 flex-1 overflow-auto p-4",children:[r.jsx("p",{className:"mb-1.5 text-xs font-medium text-muted-foreground",children:"Log excerpt"}),r.jsx("pre",{className:"overflow-x-auto rounded-md border border-border bg-muted/40 p-3 font-mono text-[11px] leading-relaxed",children:e.logExcerpt.join(`
|
|
162
|
+
`)}),r.jsx("p",{className:"mt-3 text-[11px] text-muted-foreground",children:`"Fix with AI" sends the agent this excerpt with the affected file's diff and the last 40 log lines, so it can start debugging right away.`})]})]})}function Qw(e){return[...e].sort((t,s)=>t.lastSeen<s.lastSeen?1:t.lastSeen>s.lastSeen?-1:s.id-t.id)}function oF(){const[e,t]=y.useState([]),[s,n]=y.useState(!1),[o,l]=y.useState(null),u=y.useCallback(h=>{t(m=>Qw([...m.filter(d=>d.id!==h.id),h]))},[]);return y.useEffect(()=>{let h=!0;YN().then(d=>{h&&t(Qw(d))}).catch(d=>{h&&l(d instanceof Error?d.message:String(d))});const m=new EventSource("/api/errors/stream");return m.addEventListener("open",()=>n(!0)),m.addEventListener("error",()=>n(!1)),m.addEventListener("incident",d=>{try{const p=JSON.parse(d.data);u(p)}catch{}}),()=>{h=!1,m.close()}},[u]),{incidents:e,connected:s,error:o}}function lF(){const{incidents:e,connected:t,error:s}=oF(),[n,o]=y.useState(null);y.useEffect(()=>{if(e.length===0){o(null);return}o(u=>u!==null&&e.some(h=>h.id===u)?u:e[0].id)},[e]);const l=y.useMemo(()=>e.find(u=>u.id===n)??null,[e,n]);return r.jsxs("div",{className:"flex h-full min-h-0 bg-card/85",children:[r.jsxs("div",{className:"flex w-72 shrink-0 flex-col border-r border-border",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Nh,{className:"size-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm font-semibold",children:"Incidents"}),r.jsx(et,{variant:"outline",size:"small",children:e.length})]}),r.jsx(et,{variant:"outline",size:"small",icon:r.jsx("span",{className:de("inline-block size-1.5 rounded-full",t?"animate-pulse bg-emerald-500":"bg-muted-foreground/60")}),children:t?"live":"reconnecting…"})]}),r.jsx("ul",{className:"min-h-0 flex-1 divide-y divide-border overflow-auto",children:e.map(u=>r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>o(u.id),className:de("flex w-full flex-col gap-1 px-3 py-2 text-left transition-colors hover:bg-muted/50",u.id===n&&"bg-muted/70"),children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"truncate font-mono text-[11px] font-semibold",children:u.service}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[u.count>1?r.jsxs(et,{variant:"outline",size:"small",children:["×",u.count]}):null,r.jsx(et,{variant:u.level==="error"?"danger":"secondary",appearance:"subtle",size:"small",children:u.level})]})]}),r.jsx("span",{className:"truncate font-mono text-[11px] text-muted-foreground",children:u.title}),r.jsx("span",{className:"font-mono text-[10px] text-muted-foreground/70",children:new Date(u.lastSeen).toLocaleTimeString()})]})},u.id))})]}),r.jsx("div",{className:"min-h-0 min-w-0 flex-1",children:s?r.jsx("div",{className:"p-4",children:r.jsxs(tt,{variant:"muted",className:"border-destructive/40 text-destructive",children:["Failed to load incidents: ",s]})}):l?r.jsx(aF,{incident:l}):r.jsx("div",{className:"flex h-full items-center justify-center p-8 text-center",children:r.jsxs("div",{className:"max-w-sm",children:[r.jsx(Nh,{className:"mx-auto size-8 text-muted-foreground/50"}),r.jsx("p",{className:"mt-3 text-sm font-medium",children:"No incidents yet"}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Errors and stack traces from your running services land here automatically. Each one becomes a one-click prompt for your agent."})]})})})]})}function qh({label:e}){return r.jsx(tt,{variant:"muted",className:"m-4 text-center",children:e})}const cF=900*1e3,jc=12,og=200;function uF({events:e}){const[t,s]=y.useState(null),[n,o]=y.useState(null),{rows:l,windowStart:u,windowEnd:h}=y.useMemo(()=>dF(e),[e]),m=t?l.find(d=>d.service===t)??null:null;return r.jsxs(r.Fragment,{children:[r.jsxs(Ei,{className:"rounded-none border-0 border-b border-border bg-transparent",children:[r.jsxs(ji,{className:"border-b border-border px-3 py-2",children:[r.jsxs(Ti,{className:"flex items-center gap-2",children:[r.jsx(Za,{className:"size-3.5"}),"Runtime Monitor"]}),r.jsx(Xi,{className:"text-xs",children:e.length===0?"No events yet":`${e.length} event${e.length===1?"":"s"} · last 15 min`})]}),r.jsx(Ai,{className:"p-0",children:l.length===0?r.jsx(qh,{label:"No runtime timeline events yet."}):r.jsxs("div",{className:"divide-y divide-border",children:[l.map(d=>r.jsx(fF,{onClick:()=>s(d.service),row:d,windowEnd:h,windowStart:u},d.service)),r.jsxs("div",{className:"flex justify-between px-3 py-1.5 font-mono text-[10px] text-muted-foreground",children:[r.jsx("span",{children:Vh(u)}),r.jsx("span",{children:"now"})]})]})})]}),m?r.jsx(Kn,{icon:r.jsx(Za,{}),onClose:()=>s(null),title:m.service,children:r.jsx(pF,{onSelect:o,row:m})}):null,n?r.jsx(Kn,{icon:r.jsx(Za,{}),onClose:()=>o(null),title:n.title,children:r.jsx(gF,{event:n})}):null]})}function dF(e){const t=Date.now(),s=t,n=t-cF;let o=e.filter(m=>{if(m.kind==="service.http")return!1;const d=new Date(m.timestamp).getTime();return!Number.isNaN(d)&&d>=n});o.length===0&&e.length>0?o=e.slice(-og):o.length>og&&(o=o.slice(-og));const l=new Map;for(const m of o){const d=m.service||"·system",p=l.get(d)??[];p.push(m),l.set(d,p)}const u=Math.max(s-n,1);return{rows:Array.from(l.entries()).map(([m,d])=>{const p=[...d].sort((A,j)=>A.timestamp.localeCompare(j.timestamp)),g=new Array(jc).fill(0),b=new Array(jc).fill(null);for(const A of p){const j=new Date(A.timestamp).getTime(),T=Math.max(n,Math.min(s,j)),P=Math.min(jc-1,Math.floor((T-n)/u*jc));g[P]+=1;const z=b[P];b[P]=hF(z,A.severity)}const v=p.filter(A=>A.severity==="error").length,w=p.filter(A=>A.severity==="warning").length,k=p.length-v-w,N=[...p].reverse().find(A=>A.severity!=="info")??null,E=v>0?"error":w>0?"warning":"info";return{service:m,events:p,errors:v,warnings:w,infos:k,buckets:g,bucketSeverity:b,lastNotable:N,worstSeverity:E}}).sort((m,d)=>{const p=b=>b.errors*1e3+b.warnings,g=p(d)-p(m);return g!==0?g:m.service.localeCompare(d.service)}),windowStart:n,windowEnd:s}}function hF(e,t){return e==="error"||t==="error"?"error":e==="warning"||t==="warning"?"warning":"info"}function fF({onClick:e,row:t,windowEnd:s,windowStart:n}){const o=Math.max(1,...t.buckets);return r.jsxs("button",{className:"timeline-service-row block w-full px-3 py-2 text-left transition-colors hover:bg-muted/40 focus:outline-none focus-visible:bg-muted/40","data-testid":"timeline-service-row",onClick:e,type:"button",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("span",{className:de("size-2 shrink-0 rounded-full",B3(t.worstSeverity))}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium text-foreground",dir:"rtl",children:r.jsx("bdi",{children:t.service})}),t.errors>0?r.jsxs("span",{className:"rounded bg-red-500/15 px-1 font-mono text-[10px] text-red-500",children:[t.errors,"E"]}):null,t.warnings>0?r.jsxs("span",{className:"rounded bg-amber-500/15 px-1 font-mono text-[10px] text-amber-500",children:[t.warnings,"W"]}):null,r.jsx(Yn,{className:"size-3 text-muted-foreground"})]}),r.jsx("div",{className:"timeline-density mt-1.5 grid h-3 gap-px","data-testid":"timeline-density",style:{gridTemplateColumns:`repeat(${jc}, minmax(0, 1fr))`},children:t.buckets.map((l,u)=>r.jsx(mF,{count:l,max:o,severity:t.bucketSeverity[u]},u))}),t.lastNotable?r.jsx("div",{className:"mt-1 truncate font-mono text-[10px] text-muted-foreground",children:t.lastNotable.detail??t.lastNotable.title}):r.jsxs("div",{className:"mt-1 truncate text-[10px] text-muted-foreground",children:[t.infos," info ",t.infos===1?"event":"events"]}),r.jsxs("div",{className:"mt-0.5 flex justify-between font-mono text-[9px] text-muted-foreground/60",children:[r.jsx("span",{children:Vh(n)}),r.jsx("span",{children:Vh(s)})]})]})}function mF({count:e,max:t,severity:s}){if(e===0)return r.jsx("span",{className:"rounded-sm bg-border/60"});const n=Math.min(1,.35+e/t*.65);return r.jsx("span",{className:de("rounded-sm",bF(s)),style:{opacity:n},title:`${e} event${e===1?"":"s"}`})}function pF({onSelect:e,row:t}){const s=[...t.events].sort((n,o)=>o.timestamp.localeCompare(n.timestamp));return r.jsxs("div",{className:"flex max-h-[480px] flex-col overflow-hidden",children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-4 py-2 text-xs text-muted-foreground",children:[r.jsxs("span",{children:[t.events.length," events"]}),r.jsx("span",{children:"·"}),r.jsxs("span",{children:[t.errors," error",t.errors===1?"":"s"]}),r.jsx("span",{children:"·"}),r.jsxs("span",{children:[t.warnings," warning",t.warnings===1?"":"s"]})]}),r.jsx("ul",{className:"min-h-0 divide-y divide-border overflow-auto",children:s.map(n=>r.jsx("li",{children:r.jsxs("button",{className:"block w-full px-4 py-2 text-left hover:bg-muted/40 focus:outline-none focus-visible:bg-muted/40",onClick:()=>e(n),type:"button",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:de("size-2 shrink-0 rounded-full",B3(n.severity))}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium text-foreground",children:n.title}),r.jsx("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:Vh(n.timestamp)})]}),n.detail?r.jsx("div",{className:"mt-1 truncate font-mono text-[10px] text-muted-foreground",children:n.detail}):null]})},n.id))})]})}function gF({event:e}){const t=new Date(e.timestamp);return r.jsxs("div",{className:"space-y-3 p-4 text-sm",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:de("rounded px-1.5 py-0.5 font-mono text-[10px] uppercase text-white",xF(e.severity)),children:e.severity}),r.jsx("span",{className:"rounded border border-border bg-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:e.kind}),e.service?r.jsx("span",{className:"rounded border border-border bg-background px-1.5 py-0.5 font-mono text-[10px] text-foreground",children:e.service}):null]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-xs text-muted-foreground",children:"When"}),r.jsx("div",{className:"font-mono text-xs",children:Number.isNaN(t.getTime())?e.timestamp:t.toLocaleString()})]}),e.detail?r.jsxs("div",{children:[r.jsx("div",{className:"text-xs text-muted-foreground",children:"Detail"}),r.jsx("pre",{className:"mt-1 max-h-72 overflow-auto whitespace-pre-wrap rounded border border-border bg-background p-3 font-mono text-xs",children:e.detail})]}):null]})}function B3(e){return e==="error"?"bg-red-500":e==="warning"?"bg-amber-500":"bg-zinc-400"}function bF(e){return e==="error"?"bg-red-500":e==="warning"?"bg-amber-500":"bg-zinc-500"}function xF(e){return e==="error"?"bg-red-600":e==="warning"?"bg-amber-600":"bg-zinc-700"}function Vh(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 P0=150,nl=40,Jw=200,e2=64,Kd=20;function vF({statuses:e,health:t,hasDependencies:s,onSelectService:n}){const[o,l]=y.useState(null),[u,h]=y.useState(null);y.useEffect(()=>{let p=!0;return X8().then(g=>{p&&l(g)}).catch(g=>{p&&h(g instanceof Error?g.message:String(g))}),()=>{p=!1}},[]);const m=y.useMemo(()=>o?_F(o.nodes):null,[o]);if(u)return r.jsxs(tt,{variant:"destructive",children:["Couldn't load the dependency graph: ",u]});if(!o||!m)return r.jsxs("div",{className:"flex items-center justify-center gap-2 py-10 text-sm text-muted-foreground",children:[r.jsx(Et,{className:"size-4 animate-spin"}),"Loading graph…"]});if(!s)return r.jsx("div",{className:"grid gap-3",children:r.jsxs(tt,{variant:"muted",children:[r.jsx("div",{className:"font-medium",children:"No dependencies declared yet."}),r.jsxs("div",{className:"mt-1 text-xs",children:["Edit a service and pick the services it should wait for under"," ",r.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 r.jsxs("div",{className:"grid gap-3",children:[o.cycles.length>0?r.jsxs(tt,{variant:"destructive",children:[r.jsxs("div",{className:"flex items-center gap-1.5 font-medium",children:[r.jsx(ul,{className:"size-4"}),"Dependency cycle detected"]}),r.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?r.jsx(tt,{variant:"muted",children:r.jsx("div",{className:"text-xs",children:d.map(p=>r.jsxs("div",{children:[r.jsx("span",{className:"font-medium",children:p.name})," depends on unknown service",p.missing.length>1?"s":"",": ",p.missing.join(", ")]},p.name))})}):null,r.jsx("div",{className:"overflow-auto rounded-md border border-border bg-muted/20 p-2",children:r.jsxs("svg",{"aria-label":"Service dependency graph",height:m.height,role:"img",width:m.width,children:[m.edges.map(p=>r.jsx("path",{className:"fill-none stroke-border",d:p.path,strokeWidth:1.5},`${p.from}->${p.to}`)),m.nodes.map(p=>{const g=e[p.name],b=yF(g?.state,t[p.name]?.status);return r.jsxs("g",{"aria-label":`Select ${p.name}`,className:"cursor-pointer",onClick:()=>n(p.name),transform:`translate(${p.x}, ${p.y})`,children:[r.jsx("rect",{className:de("stroke-2",b.fill,b.stroke),height:nl,rx:6,width:P0}),r.jsx("circle",{className:b.dot,cx:14,cy:nl/2,r:4}),r.jsx("text",{className:"fill-foreground text-[11px] font-medium",dominantBaseline:"middle",x:26,y:nl/2,children:SF(p.name)})]},p.name)})]})}),o.order.length>0?r.jsxs("div",{className:"text-[11px] text-muted-foreground",children:[r.jsx("span",{className:"font-medium uppercase tracking-wide",children:"Start order:"})," ",o.order.join(" → ")]}):null]})}function _F(e){const t=new Map(e.map(g=>[g.name,g.dependsOn])),s=new Map,n=new Set,o=g=>{const b=s.get(g);if(b!==void 0)return b;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 b=s.get(g.name)??0,v=l.get(b)??0;return l.set(b,v+1),{...g,x:Kd+b*Jw,y:Kd+v*e2}}),h=new Map(u.map(g=>[g.name,g])),m=u.flatMap(g=>g.dependsOn.flatMap(b=>{const v=h.get(b);if(!v)return[];const w=v.x+P0,k=v.y+nl/2,N=g.x,E=g.y+nl/2,A=(w+N)/2;return[{from:b,to:g.name,path:`M ${w} ${k} C ${A} ${k}, ${A} ${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:m,width:Kd*2+d*Jw+P0,height:Kd*2+(p-1)*e2+nl}}function yF(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 SF(e,t=18){return e.length>t?`${e.slice(0,t-1)}…`:e}function wF({onOnboardRepo:e,onOnboardWithAi:t,onCreateService:s,onCreateWithAi:n}){return r.jsx("div",{className:"flex h-full min-h-0 items-center justify-center overflow-auto bg-card/85 p-6",children:r.jsxs("div",{className:"w-full max-w-xl space-y-6",children:[r.jsxs("div",{className:"space-y-2 text-center",children:[r.jsx("h2",{className:"text-xl font-semibold",children:"Set up your first service"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"NoMoreIDE runs and watches your services so you don't have to babysit terminals. Add your first one to get started — or let the agent do it for you."})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(t2,{icon:r.jsx(xn,{className:"size-5"}),title:"Add from GitHub",description:"Point at a repo — we detect how to run it and register it for you.",onClick:e,onAi:t,aiTitle:"Onboard with AI — the agent clones, detects and runs it for you"}),r.jsx(t2,{icon:r.jsx(Es,{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 t2({icon:e,title:t,description:s,onClick:n,onAi:o,aiTitle:l}){return r.jsxs("div",{className:"group flex items-stretch overflow-hidden rounded-lg border border-border bg-card shadow-sm transition-colors hover:border-foreground/20",children:[r.jsxs("button",{className:"flex flex-1 items-start gap-3 px-4 py-4 text-left hover:bg-muted/60",onClick:n,type:"button",children:[r.jsx("span",{className:"mt-0.5 shrink-0 text-muted-foreground",children:e}),r.jsxs("span",{className:"min-w-0 space-y-1",children:[r.jsx("span",{className:"block text-sm font-semibold",children:t}),r.jsx("span",{className:"block text-xs text-muted-foreground",children:s})]})]}),r.jsxs("button",{className:"flex shrink-0 items-center gap-1.5 border-l border-border px-4 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground",onClick:o,title:l,type:"button",children:[r.jsx(Gt,{className:"size-4 shrink-0"}),"AI"]})]})}function kF({health:e}){if(!e)return null;const t=e.processTree,s=e.status==="healthy"||e.status==="unknown"?void 0:jF(e.summary);return r.jsxs("div",{className:"mt-1.5 grid min-w-0 gap-2 text-[11px] text-muted-foreground sm:grid-cols-[minmax(0,1fr)_auto] sm:items-center",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsxs("span",{className:de("inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md px-2.5 font-medium",NF(e.status)),children:[r.jsx("span",{className:"inline-flex shrink-0",children:r.jsx(Za,{className:"size-3"})}),r.jsx("span",{className:"whitespace-nowrap",children:e.status})]}),s?r.jsx("span",{className:"min-w-0 truncate",children:s}):null]}),t?r.jsxs("div",{className:"health-metrics flex min-w-max items-center gap-2 font-mono sm:justify-end",children:[r.jsxs("span",{className:"inline-flex items-center gap-1 font-mono",children:[r.jsx(C4,{className:"size-3"}),t.processCount," ",t.processCount===1?"process":"processes"]}),r.jsxs("span",{children:[EF(t.cpuPercent)," CPU"]}),r.jsxs("span",{className:"inline-flex items-center gap-1 font-mono",children:[r.jsx(RR,{className:"size-3"}),CF(t.rssMb)," RAM"]})]}):null]})}function NF(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 CF(e){return Number.isInteger(e)?`${e} MB`:`${e.toFixed(1)} MB`}function EF(e){return`${e.toFixed(1)}%`}function jF(e){return e.replace(/^Recent error log:\s*/i,"Recent stderr: ").replace(/:\s*\d+(?:\.\d+)? MB RSS\.?$/i,"").replace(/\s+RSS\.?$/i,"")}function TF({ports:e}){const t=e.filter(n=>n.state==="occupied").length,s=e.filter(n=>n.state==="managed").length;return r.jsxs(Ei,{className:"rounded-none border-0 border-b border-border bg-transparent",children:[r.jsxs(ji,{className:"border-b border-border px-3 py-2",children:[r.jsxs(Ti,{className:"flex items-center gap-2",children:[r.jsx(UR,{className:"size-3.5"}),"Ports"]}),r.jsxs(Xi,{className:"text-xs",children:[s," managed, ",t," occupied by other"]})]}),r.jsx(Ai,{className:"p-0",children:e.length?r.jsx("div",{className:"divide-y divide-border",children:e.map(n=>r.jsxs("div",{className:"grid grid-cols-[1fr_auto] items-center gap-2 px-3 py-2",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"font-mono text-xs",children:[":",n.port]}),r.jsx("div",{className:"truncate text-[11px] text-muted-foreground",children:n.services.join(", ")||"Unassigned"}),n.urls[0]?r.jsx("div",{className:"truncate font-mono text-[10px] text-muted-foreground",children:n.urls[0]}):null]}),r.jsx(AF,{port:n})]},n.port))}):r.jsx(qh,{label:"No configured ports yet."})})]})}function AF({compact:e,port:t}){const s=t.state==="managed"?"managed":t.state==="occupied"?"occupied by other":"available",n=t.state==="managed"?"success":t.state==="occupied"?"warning":"outline";return r.jsx(et,{className:de(e&&"max-w-36 truncate"),variant:n,children:s})}function RF({onChange:e,value:t}){return r.jsxs("label",{className:"relative block",children:[r.jsx(mM,{className:"pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground"}),r.jsx(gt,{"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 MF({className:e,containerRef:t,emptyText:s,logs:n,query:o}){return r.jsx("div",{className:de("h-full max-w-full overflow-auto bg-background font-mono text-[11px] leading-5 dark:bg-zinc-950",e),ref:t,role:"log",children:n.length?n.map((l,u)=>r.jsxs("div",{className:de("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:[r.jsx("span",{className:"text-muted-foreground dark:text-zinc-500",title:l.timestamp,children:DF(l.timestamp)}),r.jsxs("span",{className:"whitespace-pre-wrap break-words",children:[l.stream==="stderr"?r.jsx("span",{className:"mr-2 rounded bg-red-100 px-1 font-semibold uppercase text-red-700 dark:bg-red-500/15 dark:text-red-300 dark:ring-1 dark:ring-red-400/20",children:"stderr"}):null,LF(l.text,o)]})]},`${l.timestamp}-${l.stream}-${u}`)):r.jsx("div",{className:"p-3 text-muted-foreground",children:s})})}function DF(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 OF(e){return`${e.timestamp} ${e.stream} ${e.text}`}function LF(e,t){const s=t.trim();if(!s)return e;const n=e.toLowerCase(),o=s.toLowerCase(),l=[];let u=0,h=n.indexOf(o);for(;h!==-1;){h>u&&l.push(e.slice(u,h));const m=h+s.length;l.push(r.jsx("mark",{className:"rounded bg-amber-200 px-0.5 text-amber-950 dark:bg-amber-400/20 dark:text-amber-200",children:e.slice(h,m)},`${h}-${m}`)),u=m,h=n.indexOf(o,u)}return u<e.length&&l.push(e.slice(u)),l}function s2(e){return`${e.kind}:${e.name}`}function zF(e,t=!1,s={}){const[n,o]=y.useState(),[l,u]=y.useState(),[h,m]=y.useState(e.kind==="source"),d=JSON.stringify(s);return y.useEffect(()=>{o(void 0),u(void 0);let p=!1;const g=async()=>{try{if(e.kind==="service"){const v=await sC(e.name,s);p||(o(v.logs),m(v.queryable),u(void 0))}else{const v=await JN(e.name,s);p||(o(v),m(!0),u(void 0))}}catch(v){p||u(v instanceof Error?v.message:String(v))}};g();const b=window.setInterval(g,t?1e3:2e3);return()=>{p=!0,window.clearInterval(b)}},[e.kind,e.name,t,d]),{logs:n,error:l,queryable:h}}const BF=[{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 I3({target:e,query:t,setQuery:s,streaming:n,setStreaming:o,hideStdout:l,setHideStdout:u,fill:h=!1,leading:m,trailing:d}){const p=e.kind==="source",[g,b]=y.useState(""),[v,w]=y.useState(""),[k,N]=y.useState(t);y.useEffect(()=>{const K=window.setTimeout(()=>N(t),300);return()=>window.clearTimeout(K)},[t]);const E=y.useMemo(()=>{const K={};g&&(K.since=g),v&&(K.level=v);const Y=k.trim();return Y&&(K.grep=Y),K},[g,v,k]),{logs:A,error:j,queryable:T}=zF(e,n,E),P=p||T,z=y.useRef(null),L=y.useRef(!0),[R,D]=y.useState([]),[I,V]=y.useState(!1),X=JSON.stringify(E);y.useEffect(()=>{D([])},[X,e.kind,e.name]);const $=y.useMemo(()=>{const K=A??[];if(R.length===0)return K;const Y=new Set(R.map(F=>F.cursor).filter(Boolean));return[...R,...K.filter(F=>!F.cursor||!Y.has(F.cursor))]},[A,R]),W=(R[0]??(A??[])[0])?.cursor;async function q(){if(!(!P||!W||I)){V(!0),L.current=!1;try{const K={...E,before:W,lines:200},Y=e.kind==="source"?await JN(e.name,K):(await sC(e.name,K)).logs;Y.length&&D(F=>{const ie=new Set(F.map(ye=>ye.cursor).filter(Boolean));return[...Y.filter(ye=>!ye.cursor||!ie.has(ye.cursor)),...F]})}finally{V(!1)}}}const B=t.trim().toLowerCase(),Z=y.useMemo(()=>{let K=$;return l&&(K=K.filter(Y=>Y.stream==="stderr")),B&&(K=K.filter(Y=>OF(Y).toLowerCase().includes(B))),K},[$,l,B]);y.useEffect(()=>{const K=z.current;if(!K)return;const Y=()=>{const F=K.scrollHeight-K.scrollTop-K.clientHeight;L.current=F<40};return Y(),K.addEventListener("scroll",Y,{passive:!0}),()=>K.removeEventListener("scroll",Y)},[]),y.useEffect(()=>{if(!n||!L.current||Z.length===0)return;const K=z.current;K&&(K.scrollTop=K.scrollHeight)},[n,Z]);const U=A?B?`No log lines match "${t.trim()}".`:l?"No stderr output captured.":"No log entries.":"Loading…";return r.jsxs("div",{className:h?"flex h-full min-h-0 flex-col gap-2":"flex flex-col gap-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[m,r.jsx(RF,{onChange:s,value:t}),P?r.jsxs(r.Fragment,{children:[r.jsx("select",{"aria-label":"Time range",className:"h-8 rounded-md border border-border bg-background px-2 text-xs",onChange:K=>b(K.target.value),value:g,children:BF.map(K=>r.jsx("option",{value:K.value,children:K.label},K.label))}),r.jsxs("select",{"aria-label":"Level",className:"h-8 rounded-md border border-border bg-background px-2 text-xs",onChange:K=>w(K.target.value),value:v,children:[r.jsx("option",{value:"",children:"All levels"}),r.jsx("option",{value:"warn",children:"Warnings+"}),r.jsx("option",{value:"error",children:"Errors"})]})]}):r.jsxs(n2,{active:l,activeClassName:"border-amber-600 bg-amber-50 text-amber-700 dark:border-amber-400/40 dark:bg-amber-500/15 dark:text-amber-300",onClick:()=>u(!l),children:[r.jsx(X4,{}),"Errors only"]}),r.jsxs(n2,{active:n,activeClassName:"border-emerald-600 bg-emerald-50 text-emerald-700 dark:border-emerald-400/40 dark:bg-emerald-500/15 dark:text-emerald-300",onClick:()=>o(!n),children:[r.jsx(lM,{}),n?"Streaming":"Stream"]}),P&&W?r.jsxs(J,{disabled:I,onClick:()=>{q()},size:"sm",type:"button",variant:"outline",children:[r.jsx(sf,{}),I?"Loading…":"Load older"]}):null,d?r.jsx("div",{className:"ml-auto flex items-center gap-2",children:d}):null]}),j?r.jsx("div",{className:"text-red-600",children:j}):null,r.jsx(MF,{className:de("rounded border border-border/60",h?"min-h-0 flex-1":"max-h-80"),containerRef:z,emptyText:U,logs:Z,query:t})]})}function n2({active:e,activeClassName:t,children:s,onClick:n}){return r.jsx(J,{"aria-pressed":e,className:e?t:void 0,onClick:n,size:"sm",type:"button",variant:"outline",children:s})}function IF(e,t){return e.kind===t.kind&&e.name===t.name}function PF({options:e,target:t,onChange:s,className:n}){const o=e.findIndex(u=>IF(u.target,t)),l=[...new Set(e.map(u=>u.group))];return r.jsx("select",{"aria-label":"Log source",className:n??"h-8 max-w-44 rounded-md border border-border bg-background px-2 text-xs",onChange:u=>s(e[Number(u.target.value)].target),value:String(o),children:l.map(u=>r.jsx("optgroup",{label:u,children:e.map((h,m)=>h.group===u?r.jsx("option",{value:String(m),children:h.label},`${h.group}:${h.label}`):null)},u))})}function $F({serviceName:e}){const[t,s]=y.useState(""),[n,o]=y.useState(!1),[l,u]=y.useState(!1),[h,m]=y.useState(!1),d=r.jsx(I3,{fill:!0,hideStdout:l,query:t,setHideStdout:u,setQuery:s,setStreaming:o,streaming:n,target:{kind:"service",name:e},trailing:r.jsx(J,{"aria-label":h?"Exit fullscreen logs":"Expand logs",className:"text-muted-foreground hover:text-foreground",onClick:()=>m(p=>!p),size:"icon-sm",title:h?"Exit fullscreen":"Expand",type:"button",variant:"ghost",children:h?r.jsx(AN,{}):r.jsx(jN,{})})});return h?r.jsx(Ax,{onClose:()=>m(!1),title:`Logs — ${e}`,children:d}):r.jsx("div",{className:"h-[60vh] min-h-[24rem]",children:d})}function Ax({title:e,onClose:t,children:s,maxWidthClass:n="max-w-6xl"}){return y.useEffect(()=>{function o(l){l.key==="Escape"&&t()}return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[t]),va.createPortal(r.jsx("div",{className:"fixed inset-0 z-[1000] bg-black/40 p-4 sm:p-8",onMouseDown:t,children:r.jsxs("div",{"aria-modal":"true",className:`mx-auto flex h-full ${n} flex-col overflow-hidden rounded-lg border border-border bg-card text-xs shadow-xl`,onMouseDown:o=>o.stopPropagation(),role:"dialog",children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-2",children:[r.jsx("h2",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:e}),r.jsx(J,{"aria-label":"Close logs",onClick:t,size:"icon",type:"button",variant:"ghost",children:r.jsx(ts,{})})]}),r.jsx("div",{className:"min-h-0 flex-1 p-3",children:s})]})}),document.body)}const HF={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 UF({onClose:e,onAdded:t}){const[s,n]=y.useState(""),[o,l]=y.useState("journald"),[u,h]=y.useState(""),[m,d]=y.useState(""),[p,g]=y.useState(""),[b,v]=y.useState(""),[w,k]=y.useState(""),[N,E]=y.useState(""),[A,j]=y.useState(),[T,P]=y.useState(!1);async function z(){P(!0),j(void 0);try{const L={name:s.trim(),kind:"command"};o==="file"?(L.kind="file",L.path=m.trim()):o==="ssh"?(L.kind="ssh",L.host=u.trim(),L.path=m.trim()):o==="command"?(L.kind="command",L.command=p.trim(),b.trim()&&(L.cwd=b.trim())):o==="journald"?(L.driver="journald",L.unit=w.trim(),u.trim()&&(L.host=u.trim())):o==="docker"&&(L.driver="docker",L.container=N.trim(),u.trim()&&(L.host=u.trim()));const R=await $8(L);t(R,L.name),e()}catch(L){j(L instanceof Error?L.message:String(L))}finally{P(!1)}}return r.jsx(Kn,{icon:r.jsx(ON,{}),onClose:e,size:"md",title:"Add log source",children:r.jsxs("form",{className:"flex flex-col gap-3 p-4 text-xs",onSubmit:L=>{L.preventDefault(),z()},children:[r.jsx(xr,{label:"Name",children:r.jsx(gt,{autoFocus:!0,onChange:L=>n(L.target.value),placeholder:"PROD",value:s})}),r.jsxs(xr,{label:"Type",children:[r.jsxs("select",{className:"h-9 w-full rounded-md border border-border bg-background px-2 text-xs",onChange:L=>l(L.target.value),value:o,children:[r.jsx("option",{value:"journald",children:"systemd journal (journald)"}),r.jsx("option",{value:"docker",children:"Docker container"}),r.jsx("option",{value:"ssh",children:"Remote file (SSH)"}),r.jsx("option",{value:"file",children:"Local file"}),r.jsx("option",{value:"command",children:"Command"})]}),r.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:HF[o]})]}),o==="journald"||o==="docker"?r.jsx(xr,{label:"Host (optional — leave blank to run locally)",children:r.jsx(gt,{onChange:L=>h(L.target.value),placeholder:"jobjourney-prod (an alias from ~/.ssh/config)",value:u})}):null,o==="journald"?r.jsx(xr,{label:"Unit",children:r.jsx(gt,{onChange:L=>k(L.target.value),placeholder:"jobjourney",value:w})}):null,o==="docker"?r.jsx(xr,{label:"Container",children:r.jsx(gt,{onChange:L=>E(L.target.value),placeholder:"brainctl-api",value:N})}):null,o==="ssh"?r.jsx(xr,{label:"Host",children:r.jsx(gt,{onChange:L=>h(L.target.value),placeholder:"prod (an alias from ~/.ssh/config)",value:u})}):null,o==="file"||o==="ssh"?r.jsx(xr,{label:o==="ssh"?"Remote path":"File path",children:r.jsx(gt,{onChange:L=>d(L.target.value),placeholder:"/var/log/app/out.log",value:m})}):null,o==="command"?r.jsxs(r.Fragment,{children:[r.jsx(xr,{label:"Command",children:r.jsx(gt,{onChange:L=>g(L.target.value),placeholder:"kubectl logs -l app=myapp --tail 500",value:p})}),r.jsx(xr,{label:"Working directory (optional)",children:r.jsx(gt,{onChange:L=>v(L.target.value),placeholder:"/srv/app",value:b})})]}):null,A?r.jsx("div",{className:"text-red-600",children:A}):null,r.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[r.jsx(J,{onClick:e,size:"sm",type:"button",variant:"outline",children:"Cancel"}),r.jsx(J,{disabled:T||!s.trim(),size:"sm",type:"submit",children:T?"Saving…":"Add source"})]})]})})}function xr({label:e,children:t}){return r.jsxs("label",{className:"flex flex-col gap-1",children:[r.jsx("span",{className:"font-medium text-muted-foreground",children:e}),t]})}const i2=4;function FF({services:e,initialService:t,onClose:s}){const[n,o]=y.useState([]),[l,u]=y.useState(!1),[h,m]=y.useState(()=>[0]),[d,p]=y.useState(()=>{const j=t?{kind:"service",name:t}:e[0]?{kind:"service",name:e[0]}:void 0;return j?{0:j}:{}}),g=y.useRef(1);y.useEffect(()=>{let j=!1;return P8().then(T=>{j||o(T)}),()=>{j=!0}},[]);const b=[...e.map(j=>({target:{kind:"service",name:j},label:j,group:"Services"})),...n.map(j=>({target:{kind:"source",name:j.name},label:j.name,group:"Log sources"}))],v=b.map(j=>j.target);function w(){if(h.length>=i2||v.length===0)return;const j=g.current++,T=new Set(Object.values(d).map(s2)),P=v.find(z=>!T.has(s2(z)))??v[0];m(z=>[...z,j]),p(z=>({...z,[j]:P}))}function k(j){m(T=>T.filter(P=>P!==j)),p(T=>{const P={...T};return delete P[j],P})}function N(j,T){p(P=>({...P,[j]:T}))}function E(j,T){o(j);const P=h[0];P!==void 0&&N(P,{kind:"source",name:T})}const A=r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{children:"Logs"}),r.jsxs(J,{onClick:()=>u(!0),size:"sm",type:"button",variant:"outline",children:[r.jsx(Es,{}),"Add source"]}),r.jsxs(J,{disabled:h.length>=i2||v.length===0,onClick:w,size:"sm",type:"button",variant:"outline",children:[r.jsx(Es,{}),"Add pane"]})]});return r.jsxs(r.Fragment,{children:[r.jsx(Ax,{maxWidthClass:"max-w-[1500px]",onClose:s,title:A,children:v.length===0?r.jsx("div",{className:"grid h-full place-items-center text-center text-muted-foreground",children:r.jsxs("div",{children:[r.jsx("p",{children:"No services or log sources yet."}),r.jsxs(J,{className:"mt-2",onClick:()=>u(!0),size:"sm",type:"button",children:[r.jsx(Es,{}),"Add a log source"]})]})}):r.jsx("div",{className:de("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(j=>r.jsx(qF,{onChangeTarget:T=>N(j,T),onRemove:h.length>1?()=>k(j):void 0,options:b,target:d[j]??v[0]},j))})}),l?r.jsx(UF,{onAdded:E,onClose:()=>u(!1)}):null]})}function qF({options:e,target:t,onChangeTarget:s,onRemove:n}){const[o,l]=y.useState(""),[u,h]=y.useState(!0),[m,d]=y.useState(!1);return r.jsx("div",{className:"flex min-h-0 min-w-0 flex-col rounded-lg border border-border bg-background/60 p-2",children:r.jsx(I3,{fill:!0,hideStdout:m,leading:r.jsx(PF,{onChange:s,options:e,target:t}),query:o,setHideStdout:d,setQuery:l,setStreaming:h,streaming:u,target:t,trailing:n?r.jsx(J,{"aria-label":"Remove pane",onClick:n,size:"icon",type:"button",variant:"ghost",children:r.jsx(ts,{})}):void 0})})}function VF({rows:e,revealAll:t,onAdd:s,onRemove:n,onUpdate:o}){return e.length===0?r.jsxs("div",{className:"text-muted-foreground",children:["No variables yet."," ",r.jsx("button",{className:"underline",onClick:s,type:"button",children:"Add one"}),"."]}):r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full font-mono text-[11px]",children:[r.jsx("thead",{className:"text-left text-muted-foreground",children:r.jsxs("tr",{children:[r.jsx("th",{className:"py-1 pr-3",children:"Key"}),r.jsx("th",{className:"py-1 pr-3",children:"Value"}),r.jsx("th",{className:"py-1 w-8"})]})}),r.jsx("tbody",{children:e.map((l,u)=>{const h=!l.reveal&&!t;return r.jsxs("tr",{className:"border-t border-border/40",children:[r.jsx("td",{className:"py-1 pr-3 align-top",children:r.jsx("input",{className:"w-full rounded border border-border/60 bg-background px-1.5 py-0.5 font-mono",onChange:m=>o(u,{key:m.target.value}),placeholder:"KEY",spellCheck:!1,value:l.key})}),r.jsx("td",{className:"py-1 pr-3 align-top",children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("input",{className:"w-full rounded border border-border/60 bg-background px-1.5 py-0.5 font-mono",onChange:m=>o(u,{value:m.target.value}),spellCheck:!1,type:h?"password":"text",value:l.value}),r.jsx("button",{className:"text-muted-foreground hover:text-foreground",onClick:()=>o(u,{reveal:!l.reveal}),title:l.reveal||t?"Hide":"Reveal",type:"button",children:l.reveal||t?r.jsx(vN,{size:14}):r.jsx(Ob,{size:14})})]})}),r.jsx("td",{className:"py-1 align-top",children:r.jsx("button",{className:"text-muted-foreground hover:text-red-600",onClick:()=>n(u),type:"button",children:r.jsx(Er,{size:14})})})]},u)})})]})})}function GF({serviceName:e,onClose:t,onPick:s}){const[n,o]=y.useState(),[l,u]=y.useState(),[h,m]=y.useState(!0),[d,p]=y.useState();y.useEffect(()=>{let v=!1;return m(!0),u(void 0),(async()=>{try{const w=await eO(e,d);v||o(w)}catch(w){v||u(w instanceof Error?w.message:String(w))}finally{v||m(!1)}})(),()=>{v=!0}},[e,d]);function g(v){if(v.kind==="directory"){p(v.relativePath);return}v.supported&&s(v.relativePath)}function b(){if(!n||n.isRoot)return;const v=n.relativePath,w=v.includes("/")?v.slice(0,v.lastIndexOf("/")):"";p(w||void 0)}return r.jsx(Kn,{icon:r.jsx(rf,{}),onClose:t,size:"lg",title:"Pick a config file",children:r.jsxs("div",{className:"flex flex-col gap-2 p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[r.jsxs(J,{disabled:!n||n.isRoot,onClick:b,size:"sm",type:"button",variant:"outline",children:[r.jsx(sf,{})," Up"]}),r.jsx("code",{className:"truncate rounded bg-muted px-2 py-1 font-mono",children:n?.relativePath||"./"})]}),l?r.jsx("div",{className:"text-red-600",children:l}):h?r.jsx("div",{className:"text-muted-foreground",children:"Loading…"}):!n||n.entries.length===0?r.jsx("div",{className:"text-muted-foreground",children:"Empty directory."}):r.jsx("div",{className:"max-h-[50vh] overflow-auto rounded border border-border/60",children:r.jsx("ul",{className:"divide-y divide-border/40",children:n.entries.map(v=>{const w=v.kind==="directory",k=w||v.supported;return r.jsx("li",{children:r.jsxs("button",{className:de("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?r.jsx(ro,{size:14}):r.jsx(SN,{size:14}),r.jsx("span",{className:"flex-1 truncate font-mono",children:v.name}),!w&&v.format?r.jsx(et,{size:"small",variant:"secondary",children:v.format}):null]})},v.relativePath)})})}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Only ",r.jsx("code",{children:".env*"}),", ",r.jsx("code",{children:"appsettings*.json"}),", and"," ",r.jsx("code",{children:"application*.yml"})," can be selected. Other files are shown disabled."]})]})})}function P3(e){if(!e.trim())return e;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function WF(e){const{error:t,success:s}=$s(),[n,o]=y.useState([]),[l,u]=y.useState(),[h,m]=y.useState(),[d,p]=y.useState(!0),[g,b]=y.useState(!1),[v,w]=y.useState(!1),[k,N]=y.useState(!1),[E,A]=y.useState();y.useEffect(()=>{let I=!1;return p(!0),A(void 0),(async()=>{try{const V=await tO(e);if(I)return;o(V.files),V.files.length>0?u(X=>X??V.files[0].path):(u(void 0),m(void 0))}catch(V){I||A(V instanceof Error?V.message:String(V))}finally{I||p(!1)}})(),()=>{I=!0}},[e]);const j=y.useCallback(async I=>{b(!0),A(void 0);try{const V=await Xy(e,I),X={path:V.path,relativePath:V.relativePath,format:V.format};V.format==="env"?m({info:X,exists:V.exists,rows:V.entries.map($=>({...$,reveal:!1}))}):m({info:X,exists:V.exists,text:V.format==="json"?P3(V.content):V.content}),N(!1)}catch(V){A(V instanceof Error?V.message:String(V))}finally{b(!1)}},[e]);y.useEffect(()=>{l&&j(l)},[l,j]);function T(I,V){m(X=>{if(!X?.rows)return X;const $=X.rows.map((W,q)=>q===I?{...W,...V}:W);return{...X,rows:$}}),N(!0)}function P(){m(I=>I?.rows?{...I,rows:[...I.rows,{key:"",value:"",secret:!1,reveal:!0}]}:I),N(!0)}function z(I){m(V=>V?.rows?{...V,rows:V.rows.filter((X,$)=>$!==I)}:V),N(!0)}function L(I){m(V=>V&&{...V,text:I}),N(!0)}async function R(){if(h){w(!0);try{if(h.info.format==="env"&&h.rows){const I=await sO(e,h.info.path,h.rows.map(V=>({key:V.key.trim(),value:V.value})));m({info:{path:I.path,relativePath:I.relativePath,format:I.format},exists:I.exists,rows:I.entries.map(V=>({...V,reveal:!1}))}),s(`Saved ${I.entries.length} entries to ${I.relativePath}.`)}else if(h.text!==void 0){const I=await nO(e,h.info.path,h.text);m({info:{path:I.path,relativePath:I.relativePath,format:I.format},exists:I.exists,text:I.content}),s(`Saved ${I.relativePath}.`)}N(!1)}catch(I){t(I instanceof Error?I.message:String(I))}finally{w(!1)}}}async function D(I){try{const V=await Xy(e,I),X={path:V.path,relativePath:V.relativePath,format:V.format};return o($=>$.some(W=>W.path===X.path)?$:[...$,X]),u(X.path),s(`Loaded ${X.relativePath}.`),!0}catch(V){return t(V instanceof Error?V.message:String(V)),!1}}return{files:n,selectedPath:l,setSelectedPath:u,loaded:h,loadingList:d,loadingFile:g,saving:v,dirty:k,error:E,addRow:P,removeRow:z,updateRow:T,updateText:L,save:R,pickFile:D}}function KF({serviceName:e}){const{files:t,selectedPath:s,setSelectedPath:n,loaded:o,loadingList:l,loadingFile:u,saving:h,dirty:m,error:d,addRow:p,removeRow:g,updateRow:b,updateText:v,save:w,pickFile:k}=WF(e),[N,E]=y.useState(!1),[A,j]=y.useState(!1);return l?r.jsx("div",{className:"text-muted-foreground",children:"Loading…"}):d&&!o?r.jsx("div",{className:"text-red-600",children:d}):r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:"text-muted-foreground",children:"File:"}),t.length>0?r.jsx("select",{className:"rounded border border-border/60 bg-background px-1.5 py-0.5 font-mono text-xs",onChange:T=>n(T.target.value),value:s??"",children:t.map(T=>r.jsxs("option",{value:T.path,children:[T.relativePath," [",T.format,"]"]},T.path))}):r.jsx("span",{className:"text-muted-foreground",children:"none detected"}),r.jsxs(J,{onClick:()=>j(!0),size:"sm",type:"button",variant:"outline",children:[r.jsx(rf,{})," Browse files"]}),o?r.jsx("code",{className:"rounded bg-background px-1.5 py-0.5 font-mono text-muted-foreground",children:o.info.path}):null]}),r.jsxs("div",{className:"flex items-center gap-1",children:[o?.info.format==="env"?r.jsxs(r.Fragment,{children:[r.jsxs(J,{onClick:()=>E(T=>!T),size:"sm",type:"button",variant:"outline",children:[N?r.jsx(vN,{}):r.jsx(Ob,{}),N?"Hide secrets":"Reveal secrets"]}),r.jsxs(J,{onClick:p,size:"sm",type:"button",variant:"outline",children:[r.jsx(Es,{})," Add"]})]}):null,r.jsxs(J,{disabled:!m||h||!o,onClick:w,size:"sm",type:"button",children:[r.jsx(DN,{})," ",h?"Saving…":"Save"]})]})]}),d&&!o?r.jsx("div",{className:"text-red-600",children:d}):o?.info.format==="env"&&o.rows?r.jsx("div",{className:de(u&&"opacity-60 transition-opacity"),children:r.jsx(VF,{revealAll:N,rows:o.rows,onAdd:p,onRemove:g,onUpdate:b})}):o?.text!==void 0?r.jsxs("div",{className:de("space-y-1",u&&"opacity-60 transition-opacity"),children:[o.info.format==="json"?r.jsx("div",{className:"flex justify-end",children:r.jsx(J,{onClick:()=>v(P3(o.text??"")),size:"sm",type:"button",variant:"outline",children:"Format JSON"})}):null,r.jsx("textarea",{className:"min-h-[300px] w-full rounded border border-border/60 bg-background p-2 font-mono text-[11px] leading-relaxed",onChange:T=>v(T.target.value),spellCheck:!1,value:o.text})]}):u?r.jsx("div",{className:"text-muted-foreground",children:"Loading file…"}):null,o?r.jsxs("p",{className:"text-muted-foreground",children:[o.info.format==="env"?"Comments and blank lines are preserved.":o.info.format==="json"?"JSON is validated on save.":"YAML is saved as raw text."," ","The running process won't see changes until you restart it."]}):null,A?r.jsx(GF,{onClose:()=>j(!1),onPick:T=>{k(T).then(P=>{P&&j(!1)})},serviceName:e}):null]})}function YF({serviceName:e,status:t,timeline:s,onRefresh:n}){const{error:o,success:l}=$s(),[u,h]=y.useState(!1),m=t?.inspector,d=t?.state==="running",p=y.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 ki(`/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 r.jsx("div",{className:"text-muted-foreground",children:"Service is not running."});if(!m?.enabled)return r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-muted-foreground",children:"The HTTP inspector starts a local proxy that forwards traffic to this service and records every request. Hit the inspect URL instead of the original port to see requests appear here. The service itself is not touched."}),r.jsxs(J,{disabled:u,onClick:()=>g(!0),size:"sm",type:"button",children:[r.jsx(Nr,{})," Start HTTP inspector"]})]});const b=m.port?`http://127.0.0.1:${m.port}`:void 0;return r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:"text-muted-foreground",children:"Inspect URL:"}),b?r.jsxs(r.Fragment,{children:[r.jsx("code",{className:"rounded bg-background px-1.5 py-0.5 font-mono",children:b}),r.jsxs(J,{onClick:()=>{navigator.clipboard.writeText(b),l("Copied inspect URL.")},size:"sm",type:"button",variant:"outline",children:[r.jsx(wh,{})," Copy"]}),r.jsx(J,{onClick:()=>{of(b)},size:"sm",type:"button",variant:"outline",children:"Open"})]}):r.jsx("span",{className:"text-muted-foreground",children:"starting…"}),r.jsxs("span",{className:"text-muted-foreground",children:["→ upstream :",m.upstreamPort??"?"]}),r.jsxs(J,{disabled:u,onClick:()=>g(!1),size:"sm",type:"button",variant:"outline",children:[r.jsx(to,{})," Stop"]})]}),p.length===0?r.jsx("div",{className:"text-muted-foreground",children:"No requests captured yet. Hit the inspect URL in your browser to see traffic."}):r.jsx("div",{className:"max-h-80 overflow-auto",children:r.jsxs("table",{className:"w-full font-mono text-[11px]",children:[r.jsx("thead",{className:"sticky top-0 bg-muted/60 text-left text-muted-foreground",children:r.jsxs("tr",{children:[r.jsx("th",{className:"py-1 pr-3",children:"Time"}),r.jsx("th",{className:"py-1 pr-3",children:"Method"}),r.jsx("th",{className:"py-1 pr-3",children:"Path"}),r.jsx("th",{className:"py-1 pr-3 text-right",children:"Status"}),r.jsx("th",{className:"py-1 pr-3 text-right",children:"Size"}),r.jsx("th",{className:"py-1 pr-3 text-right",children:"ms"})]})}),r.jsx("tbody",{children:p.map(v=>r.jsxs("tr",{className:"border-t border-border/40",children:[r.jsx("td",{className:"py-1 pr-3 text-muted-foreground",children:new Date(v.startedAt).toLocaleTimeString()}),r.jsx("td",{className:"py-1 pr-3",children:v.method}),r.jsx("td",{className:"py-1 pr-3 truncate max-w-[40ch]",children:v.path}),r.jsx("td",{className:de("py-1 pr-3 text-right",XF(v.status)),children:v.status}),r.jsx("td",{className:"py-1 pr-3 text-right text-muted-foreground",children:ZF(v.resBytes)}),r.jsx("td",{className:"py-1 pr-3 text-right",children:v.durationMs.toFixed(1)})]},v.id))})]})})]})}function XF(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 ZF(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function QF({serviceName:e}){const[t,s]=y.useState(null),[n,o]=y.useState(null),[l,u]=y.useState(()=>Date.now());return y.useEffect(()=>{let h=!1;async function m(){try{const p=await iO(e);h||(s(p),u(Date.now()),o(null))}catch(p){h||o(p instanceof Error?p.message:String(p))}}m();const d=setInterval(()=>{m()},3e3);return()=>{h=!0,clearInterval(d)}},[e]),n?r.jsxs("p",{className:"text-destructive",children:["Failed to load metrics: ",n]}):t?t.samples.length===0?r.jsx("p",{className:"text-muted-foreground",children:"No samples yet. Metrics start collecting once the service is running."}):r.jsx(JF,{series:t,now:l}):r.jsx("p",{className:"text-muted-foreground",children:"Loading metrics…"})}function JF({series:e,now:t}){const{samples:s}=e,n=y.useMemo(()=>r2(s,m=>m.cpu),[s]),o=y.useMemo(()=>r2(s,m=>m.rss),[s]),l=e.startedAt?new Date(e.startedAt):null,u=l?t-l.getTime():null,h=s.length>1?s[s.length-1].t-s[0].t:0;return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:[r.jsx(Yd,{accent:"#22c55e",label:"CPU",value:`${n.last.toFixed(1)}%`,sub:`peak ${n.max.toFixed(1)}% · avg ${n.avg.toFixed(1)}%`}),r.jsx(Yd,{accent:"#3b82f6",label:"Memory",value:lg(o.last),sub:`peak ${lg(o.max)} · avg ${lg(o.avg)}`}),r.jsx(Yd,{accent:"#a855f7",label:"Uptime",value:u!=null?l2(u):"—",sub:l?`since ${l.toLocaleTimeString()}`:"not running"}),r.jsx(Yd,{accent:"#f59e0b",label:"Samples",value:String(s.length),sub:h?`over ${l2(h)}`:"collecting…"})]}),r.jsx(o2,{label:"CPU",samples:s,pick:m=>m.cpu,summary:n,color:"#22c55e",suffix:"%",unit:"percent"}),r.jsx(o2,{label:"Memory (RSS)",samples:s,pick:m=>m.rss,summary:o,color:"#3b82f6",suffix:" MB",unit:"mb"})]})}function r2(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 Yd({accent:e,label:t,value:s,sub:n}){return r.jsxs("div",{className:"rounded-lg border border-border bg-card px-3 py-2",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full",style:{backgroundColor:e}}),r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:t})]}),r.jsx("div",{className:"mt-1 font-mono text-lg leading-none tabular-nums",children:s}),r.jsx("div",{className:"mt-1 truncate font-mono text-[10px] text-muted-foreground",children:n})]})}const Wo=160,a2=44,eq=20;function o2({label:e,samples:t,pick:s,summary:n,color:o,suffix:l,unit:u}){const h=y.useMemo(()=>`metric-grad-${u}-${Math.random().toString(36).slice(2,8)}`,[u]),m=t.map(s),d=Math.max(...m,u==="percent"?10:1),p=tq(d),g=0,b=p-g||1,v=t[0].t,w=t[t.length-1].t,k=Math.max(1,w-v),N=I=>(I-v)/k*1e3,E=I=>(1-(I-g)/b)*1e3,A=t.map(I=>`${N(I.t).toFixed(1)},${E(s(I)).toFixed(1)}`),j=`M0,1000 L${A.join(" L")} L1000,1000 Z`,T=`M${A.join(" L")}`,P=N(w),z=E(n.last),L=E(n.avg),R=[1,.75,.5,.25,0],D=5;return r.jsxs("figure",{className:"space-y-1",children:[r.jsxs("figcaption",{className:"flex items-baseline justify-between",children:[r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:e}),r.jsxs("span",{className:"font-mono text-[11px] text-muted-foreground",children:["now ",r.jsxs("span",{className:"text-foreground",children:[n.last.toFixed(1),l]}),r.jsx("span",{className:"mx-1.5",children:"·"}),"peak ",n.max.toFixed(1),l,r.jsx("span",{className:"mx-1.5",children:"·"}),"avg ",n.avg.toFixed(1),l]})]}),r.jsxs("div",{className:"rounded-lg border border-border bg-card p-2",children:[r.jsxs("div",{className:"flex",children:[r.jsx("div",{className:"relative flex shrink-0 flex-col justify-between text-right font-mono text-[10px] text-muted-foreground",style:{width:a2,height:Wo},children:R.map(I=>r.jsx("span",{className:"pr-1 leading-none",children:sq(g+I*b,u)},I))}),r.jsxs("div",{className:"relative min-w-0 flex-1",style:{height:Wo},children:[R.map((I,V)=>r.jsx("div",{className:"pointer-events-none absolute inset-x-0 border-t border-border/40",style:{top:`${I===1?0:I===0?Wo-1:(1-I)*Wo}px`,borderStyle:V===R.length-1?"solid":"dashed"}},I)),r.jsx("div",{className:"pointer-events-none absolute inset-x-0 border-t border-dashed",style:{top:`${L/1e3*Wo}px`,borderColor:o,opacity:.4}}),r.jsxs("svg",{"aria-label":e,className:"absolute inset-0 h-full w-full",preserveAspectRatio:"none",role:"img",viewBox:"0 0 1000 1000",children:[r.jsx("defs",{children:r.jsxs("linearGradient",{id:h,x1:"0",x2:"0",y1:"0",y2:"1",children:[r.jsx("stop",{offset:"0%",stopColor:o,stopOpacity:.35}),r.jsx("stop",{offset:"100%",stopColor:o,stopOpacity:.02})]})}),r.jsx("path",{d:j,fill:`url(#${h})`}),r.jsx("path",{d:T,fill:"none",stroke:o,strokeWidth:2,vectorEffect:"non-scaling-stroke",strokeLinejoin:"round",strokeLinecap:"round"})]}),r.jsx("span",{className:"pointer-events-none absolute z-10 block h-2.5 w-2.5 -translate-x-1/2 -translate-y-1/2 rounded-full ring-2 ring-card",style:{left:`${P/1e3*100}%`,top:`${z/1e3*Wo}px`,backgroundColor:o,boxShadow:`0 0 0 4px ${o}33`}})]})]}),r.jsx("div",{className:"flex font-mono text-[10px] text-muted-foreground",style:{height:eq,paddingLeft:a2},children:r.jsx("div",{className:"relative flex-1",children:Array.from({length:D+1},(I,V)=>{const X=V/D,$=v+X*k;return r.jsx("span",{className:"absolute top-1 whitespace-nowrap",style:{left:`${X*100}%`,transform:V===0?"translateX(0)":V===D?"translateX(-100%)":"translateX(-50%)"},children:nq($-w)},V)})})})]})]})}function tq(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 sq(e,t){return t==="percent"?`${e.toFixed(0)}%`:e>=1024?`${(e/1024).toFixed(1)}G`:`${e.toFixed(0)}M`}function lg(e){return e>=1024?`${(e/1024).toFixed(2)} GB`:`${e.toFixed(0)} MB`}function l2(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 nq(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 iq({rows:e,running:t}){if(e.length===0)return r.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 r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full font-mono text-[11px]",children:[r.jsx("thead",{className:"text-left text-muted-foreground",children:r.jsxs("tr",{children:[r.jsx("th",{className:"py-1 pr-3",children:"PID"}),r.jsx("th",{className:"py-1 pr-3",children:"PPID"}),r.jsx("th",{className:"py-1 pr-3 text-right",children:"CPU%"}),r.jsx("th",{className:"py-1 pr-3 text-right",children:"RSS MB"}),r.jsx("th",{className:"py-1",children:"Command"})]})}),r.jsx("tbody",{children:s.map(o=>{const l=n.has(o.ppid);return r.jsxs("tr",{className:"border-t border-border/40",children:[r.jsx("td",{className:"py-1 pr-3",children:o.pid}),r.jsx("td",{className:"py-1 pr-3 text-muted-foreground",children:o.ppid}),r.jsx("td",{className:"py-1 pr-3 text-right",children:o.cpuPercent.toFixed(1)}),r.jsx("td",{className:"py-1 pr-3 text-right",children:o.rssMb.toFixed(1)}),r.jsx("td",{className:de("py-1 truncate max-w-[60ch]",l&&"pl-4"),children:o.command})]},o.pid)})})]})})}var rq=2,aq=1,oq=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,s=window.getComputedStyle(this._terminal.element.parentElement),n=parseInt(s.getPropertyValue("height")),o=Math.max(0,parseInt(s.getPropertyValue("width"))),l=window.getComputedStyle(this._terminal.element),u={top:parseInt(l.getPropertyValue("padding-top")),bottom:parseInt(l.getPropertyValue("padding-bottom")),right:parseInt(l.getPropertyValue("padding-right")),left:parseInt(l.getPropertyValue("padding-left"))},h=u.top+u.bottom,m=u.right+u.left,d=n-h,p=o-m-t;return{cols:Math.max(rq,Math.floor(p/e.css.cell.width)),rows:Math.max(aq,Math.floor(d/e.css.cell.height))}}};var $3=Object.defineProperty,lq=Object.getOwnPropertyDescriptor,cq=(e,t)=>{for(var s in t)$3(e,s,{get:t[s],enumerable:!0})},us=(e,t,s,n)=>{for(var o=n>1?void 0:n?lq(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&&$3(t,s,o),o},Fe=(e,t)=>(s,n)=>t(s,n,e),c2="Terminal input",$0={get:()=>c2,set:e=>c2=e},u2="Too much output to announce, navigate to rows manually to read",H0={get:()=>u2,set:e=>u2=e};function uq(e){return e.replace(/\r?\n/g,"\r")}function dq(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function hq(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function fq(e,t,s,n){if(e.stopPropagation(),e.clipboardData){let o=e.clipboardData.getData("text/plain");H3(o,t,s,n)}}function H3(e,t,s,n){e=uq(e),e=dq(e,s.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(e,!0),t.value=""}function U3(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 d2(e,t,s,n,o){U3(e,t,s),o&&n.rightClickSelect(e),t.value=n.selectionText,t.select()}function da(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function xf(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 mq=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}},pq=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let s=e.length;if(!s)return 0;let n=0,o,l,u,h,m=0,d=0;if(this.interim[0]){let b=!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--,b=!0;break}else this.interim[w++]=k,v<<=6,v|=k&63}b||(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(m=(o&31)<<6|l&63,m<128){g--;continue}t[n++]=m}else if((o&240)===224){if(g>=s)return this.interim[0]=o,n;if(l=e[g++],(l&192)!==128){g--;continue}if(g>=s)return this.interim[0]=o,this.interim[1]=l,n;if(u=e[g++],(u&192)!==128){g--;continue}if(m=(o&15)<<12|(l&63)<<6|u&63,m<2048||m>=55296&&m<=57343||m===65279)continue;t[n++]=m}else if((o&248)===240){if(g>=s)return this.interim[0]=o,n;if(l=e[g++],(l&192)!==128){g--;continue}if(g>=s)return this.interim[0]=o,this.interim[1]=l,n;if(u=e[g++],(u&192)!==128){g--;continue}if(g>=s)return this.interim[0]=o,this.interim[1]=l,this.interim[2]=u,n;if(h=e[g++],(h&192)!==128){g--;continue}if(m=(o&7)<<18|(l&63)<<12|(u&63)<<6|h&63,m<65536||m>1114111)continue;t[n++]=m}}return n}},F3="",fa=" ",hu=class q3{constructor(){this.fg=0,this.bg=0,this.extended=new Gh}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 q3;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}},Gh=class V3{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 V3(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},hi=class G3 extends hu{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Gh,this.combinedData=""}static fromCharData(t){let s=new G3;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?da(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()]}},h2="di$target",U0="di$dependencies",cg=new Map;function gq(e){return e[U0]||[]}function Hs(e){if(cg.has(e))return cg.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");bq(t,s,o)};return t._id=e,cg.set(e,t),t}function bq(e,t,s){t[h2]===t?t[U0].push({id:e,index:s}):(t[U0]=[{id:e,index:s}],t[h2]=t)}var _n=Hs("BufferService"),W3=Hs("CoreMouseService"),lo=Hs("CoreService"),xq=Hs("CharsetService"),Rx=Hs("InstantiationService"),K3=Hs("LogService"),yn=Hs("OptionsService"),Y3=Hs("OscLinkService"),vq=Hs("UnicodeService"),fu=Hs("DecorationService"),F0=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 hi,u=s.getTrimmedLength(),h=-1,m=-1,d=!1;for(let p=0;p<u;p++)if(!(m===-1&&!s.hasContent(p))){if(s.loadCell(p,l),l.hasExtendedAttrs()&&l.extended.urlId)if(m===-1){m=p,h=l.extended.urlId;continue}else d=l.extended.urlId!==h;else m!==-1&&(d=!0);if(d||m!==-1&&p===u-1){let g=this._oscLinkService.getLinkData(h)?.uri;if(g){let b={start:{x:m+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:b,activate:(w,k)=>o?o.activate(w,k,b):_q(w,k),hover:(w,k)=>o?.hover?.(w,k,b),leave:(w,k)=>o?.leave?.(w,k,b)})}d=!1,l.hasExtendedAttrs()&&l.extended.urlId?(m=p,h=l.extended.urlId):(m=-1,h=-1)}}t(n)}};F0=us([Fe(0,_n),Fe(1,yn),Fe(2,Y3)],F0);function _q(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
163
|
+
|
|
164
|
+
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 vf=Hs("CharSizeService"),Tr=Hs("CoreBrowserService"),Mx=Hs("MouseService"),Ar=Hs("RenderService"),yq=Hs("SelectionService"),X3=Hs("CharacterJoinerService"),gl=Hs("ThemeService"),Z3=Hs("LinkProviderService"),Sq=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?f2.isErrorNoTelemetry(e)?new f2(e.message+`
|
|
165
|
+
|
|
166
|
+
`+e.stack):new Error(e.message+`
|
|
167
|
+
|
|
168
|
+
`+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)}},wq=new Sq;function bh(e){kq(e)||wq.onUnexpectedError(e)}var q0="Canceled";function kq(e){return e instanceof Nq?!0:e instanceof Error&&e.name===q0&&e.message===q0}var Nq=class extends Error{constructor(){super(q0),this.name=this.message}};function Cq(e){return new Error(`Illegal argument: ${e}`)}var f2=class V0 extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof V0)return t;let s=new V0;return s.message=t.message,s.stack=t.stack,s}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},G0=class Q3 extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,Q3.prototype)}};function qn(e,t=0){return e[e.length-(1+t)]}var Eq;(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})(Eq||={});function jq(e,t){let s=this,n=!1,o;return function(){return n||(n=!0,t||(o=e.apply(s,arguments))),o}}var J3;(e=>{function t(T){return T&&typeof T=="object"&&typeof T[Symbol.iterator]=="function"}e.is=t;let s=Object.freeze([]);function n(){return s}e.empty=n;function*o(T){yield T}e.single=o;function l(T){return t(T)?T:o(T)}e.wrap=l;function u(T){return T||s}e.from=u;function*h(T){for(let P=T.length-1;P>=0;P--)yield T[P]}e.reverse=h;function m(T){return!T||T[Symbol.iterator]().next().done===!0}e.isEmpty=m;function d(T){return T[Symbol.iterator]().next().value}e.first=d;function p(T,P){let z=0;for(let L of T)if(P(L,z++))return!0;return!1}e.some=p;function g(T,P){for(let z of T)if(P(z))return z}e.find=g;function*b(T,P){for(let z of T)P(z)&&(yield z)}e.filter=b;function*v(T,P){let z=0;for(let L of T)yield P(L,z++)}e.map=v;function*w(T,P){let z=0;for(let L of T)yield*P(L,z++)}e.flatMap=w;function*k(...T){for(let P of T)yield*P}e.concat=k;function N(T,P,z){let L=z;for(let R of T)L=P(L,R);return L}e.reduce=N;function*E(T,P,z=T.length){for(P<0&&(P+=T.length),z<0?z+=T.length:z>T.length&&(z=T.length);P<z;P++)yield T[P]}e.slice=E;function A(T,P=Number.POSITIVE_INFINITY){let z=[];if(P===0)return[z,T];let L=T[Symbol.iterator]();for(let R=0;R<P;R++){let D=L.next();if(D.done)return[z,e.empty()];z.push(D.value)}return[z,{[Symbol.iterator](){return L}}]}e.consume=A;async function j(T){let P=[];for await(let z of T)P.push(z);return Promise.resolve(P)}e.asyncToArray=j})(J3||={});function no(e){if(J3.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 Tq(...e){return ss(()=>no(e))}function ss(e){return{dispose:jq(()=>{e()})}}var e5=class t5{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{no(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?t5.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)}};e5.DISABLE_DISPOSED_WARNING=!1;var ma=e5,mt=class{constructor(){this._store=new ma,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};mt.None=Object.freeze({dispose(){}});var ll=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},Sr=typeof window=="object"?window:globalThis,W0=class K0{constructor(t){this.element=t,this.next=K0.Undefined,this.prev=K0.Undefined}};W0.Undefined=new W0(void 0);var is=W0,m2=class{constructor(){this._first=is.Undefined,this._last=is.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===is.Undefined}clear(){let e=this._first;for(;e!==is.Undefined;){let t=e.next;e.prev=is.Undefined,e.next=is.Undefined,e=t}this._first=is.Undefined,this._last=is.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let s=new is(e);if(this._first===is.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!==is.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==is.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==is.Undefined&&e.next!==is.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===is.Undefined&&e.next===is.Undefined?(this._first=is.Undefined,this._last=is.Undefined):e.next===is.Undefined?(this._last=this._last.prev,this._last.next=is.Undefined):e.prev===is.Undefined&&(this._first=this._first.next,this._first.prev=is.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==is.Undefined;)yield e.element,e=e.next}},Aq=globalThis.performance&&typeof globalThis.performance.now=="function",Rq=class s5{static create(t){return new s5(t)}constructor(t){this._now=Aq&&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}},Xs;(e=>{e.None=()=>mt.None;function t(X,$){return g(X,()=>{},0,void 0,!0,void 0,$)}e.defer=t;function s(X){return($,W=null,q)=>{let B=!1,Z;return Z=X(U=>{if(!B)return Z?Z.dispose():B=!0,$.call(W,U)},null,q),B&&Z.dispose(),Z}}e.once=s;function n(X,$,W){return d((q,B=null,Z)=>X(U=>q.call(B,$(U)),null,Z),W)}e.map=n;function o(X,$,W){return d((q,B=null,Z)=>X(U=>{$(U),q.call(B,U)},null,Z),W)}e.forEach=o;function l(X,$,W){return d((q,B=null,Z)=>X(U=>$(U)&&q.call(B,U),null,Z),W)}e.filter=l;function u(X){return X}e.signal=u;function h(...X){return($,W=null,q)=>{let B=Tq(...X.map(Z=>Z(U=>$.call(W,U))));return p(B,q)}}e.any=h;function m(X,$,W,q){let B=W;return n(X,Z=>(B=$(B,Z),B),q)}e.reduce=m;function d(X,$){let W,q={onWillAddFirstListener(){W=X(B.fire,B)},onDidRemoveLastListener(){W?.dispose()}},B=new Oe(q);return $?.add(B),B.event}function p(X,$){return $ instanceof Array?$.push(X):$&&$.add(X),X}function g(X,$,W=100,q=!1,B=!1,Z,U){let K,Y,F,ie=0,Ee,ye={leakWarningThreshold:Z,onWillAddFirstListener(){K=X(je=>{ie++,Y=$(Y,je),q&&!F&&(oe.fire(Y),Y=void 0),Ee=()=>{let Ne=Y;Y=void 0,F=void 0,(!q||ie>1)&&oe.fire(Ne),ie=0},typeof W=="number"?(clearTimeout(F),F=setTimeout(Ee,W)):F===void 0&&(F=0,queueMicrotask(Ee))})},onWillRemoveListener(){B&&ie>0&&Ee?.()},onDidRemoveLastListener(){Ee=void 0,K.dispose()}},oe=new Oe(ye);return U?.add(oe),oe.event}e.debounce=g;function b(X,$=0,W){return e.debounce(X,(q,B)=>q?(q.push(B),q):[B],$,void 0,!0,void 0,W)}e.accumulate=b;function v(X,$=(q,B)=>q===B,W){let q=!0,B;return l(X,Z=>{let U=q||!$(Z,B);return q=!1,B=Z,U},W)}e.latch=v;function w(X,$,W){return[e.filter(X,$,W),e.filter(X,q=>!$(q),W)]}e.split=w;function k(X,$=!1,W=[],q){let B=W.slice(),Z=X(Y=>{B?B.push(Y):K.fire(Y)});q&&q.add(Z);let U=()=>{B?.forEach(Y=>K.fire(Y)),B=null},K=new Oe({onWillAddFirstListener(){Z||(Z=X(Y=>K.fire(Y)),q&&q.add(Z))},onDidAddFirstListener(){B&&($?setTimeout(U):U())},onDidRemoveLastListener(){Z&&Z.dispose(),Z=null}});return q&&q.add(K),K.event}e.buffer=k;function N(X,$){return(W,q,B)=>{let Z=$(new A);return X(function(U){let K=Z.evaluate(U);K!==E&&W.call(q,K)},void 0,B)}}e.chain=N;let E=Symbol("HaltChainable");class A{constructor(){this.steps=[]}map($){return this.steps.push($),this}forEach($){return this.steps.push(W=>($(W),W)),this}filter($){return this.steps.push(W=>$(W)?W:E),this}reduce($,W){let q=W;return this.steps.push(B=>(q=$(q,B),q)),this}latch($=(W,q)=>W===q){let W=!0,q;return this.steps.push(B=>{let Z=W||!$(B,q);return W=!1,q=B,Z?B:E}),this}evaluate($){for(let W of this.steps)if($=W($),$===E)break;return $}}function j(X,$,W=q=>q){let q=(...K)=>U.fire(W(...K)),B=()=>X.on($,q),Z=()=>X.removeListener($,q),U=new Oe({onWillAddFirstListener:B,onDidRemoveLastListener:Z});return U.event}e.fromNodeEventEmitter=j;function T(X,$,W=q=>q){let q=(...K)=>U.fire(W(...K)),B=()=>X.addEventListener($,q),Z=()=>X.removeEventListener($,q),U=new Oe({onWillAddFirstListener:B,onDidRemoveLastListener:Z});return U.event}e.fromDOMEventEmitter=T;function P(X){return new Promise($=>s(X)($))}e.toPromise=P;function z(X){let $=new Oe;return X.then(W=>{$.fire(W)},()=>{$.fire(void 0)}).finally(()=>{$.dispose()}),$.event}e.fromPromise=z;function L(X,$){return X(W=>$.fire(W))}e.forward=L;function R(X,$,W){return $(W),X(q=>$(q))}e.runAndSubscribe=R;class D{constructor($,W){this._observable=$,this._counter=0,this._hasChanged=!1;let q={onWillAddFirstListener:()=>{$.addObserver(this)},onDidRemoveLastListener:()=>{$.removeObserver(this)}};this.emitter=new Oe(q),W&&W.add(this.emitter)}beginUpdate($){this._counter++}handlePossibleChange($){}handleChange($,W){this._hasChanged=!0}endUpdate($){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function I(X,$){return new D(X,$).emitter.event}e.fromObservable=I;function V(X){return($,W,q)=>{let B=0,Z=!1,U={beginUpdate(){B++},endUpdate(){B--,B===0&&(X.reportChanges(),Z&&(Z=!1,$.call(W)))},handlePossibleChange(){},handleChange(){Z=!0}};X.addObserver(U),X.reportChanges();let K={dispose(){X.removeObserver(U)}};return q instanceof ma?q.add(K):Array.isArray(q)&&q.push(K),K}}e.fromObservableLight=V})(Xs||={});var Y0=class X0{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${X0._idPool++}`,X0.all.add(this)}start(t){this._stopWatch=new Rq,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}}};Y0.all=new Set,Y0._idPool=0;var Mq=Y0,Dq=-1,n5=class i5{constructor(t,s,n=(i5._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=s,this.name=n,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,s){let n=this.threshold;if(n<=0||s<n)return;this._stacks||(this._stacks=new Map);let o=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,o+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=n*.5;let[l,u]=this.getMostFrequentStack(),h=`[${this.name}] potential listener LEAK detected, having ${s} listeners already. MOST frequent listener (${u}):`;console.warn(h),console.warn(l);let m=new zq(h,l);this._errorHandler(m)}return()=>{let l=this._stacks.get(t.value)||0;this._stacks.set(t.value,l-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,s=0;for(let[n,o]of this._stacks)(!t||s<o)&&(t=[n,o],s=o);return t}};n5._idPool=1;var Oq=n5,Lq=class r5{constructor(t){this.value=t}static create(){let t=new Error;return new r5(t.stack??"")}print(){console.warn(this.value.split(`
|
|
169
|
+
`).slice(2).join(`
|
|
170
|
+
`))}},zq=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},Bq=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},Iq=0,ug=class{constructor(e){this.value=e,this.id=Iq++}},Pq=2,$q,Oe=class{constructor(e){this._size=0,this._options=e,this._leakageMon=this._options?.leakWarningThreshold?new Oq(e?.onListenerError??bh,this._options?.leakWarningThreshold??Dq):void 0,this._perfMon=this._options?._profName?new Mq(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,s)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let u=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(u);let h=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],m=new Bq(`${u}. HINT: Stack shows most frequent listener (${h[1]}-times)`,h[0]);return(this._options?.onListenerError||bh)(m),mt.None}if(this._disposed)return mt.None;t&&(e=e.bind(t));let n=new ug(e),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(n.stack=Lq.create(),o=this._leakageMon.check(n.stack,this._size+1)),this._listeners?this._listeners instanceof ug?(this._deliveryQueue??=new Hq,this._listeners=[this._listeners,n]):this._listeners.push(n):(this._options?.onWillAddFirstListener?.(this),this._listeners=n,this._options?.onDidAddFirstListener?.(this)),this._size++;let l=ss(()=>{o?.(),this._removeListener(n)});return s instanceof ma?s.add(l):Array.isArray(s)&&s.push(l),l},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,s=t.indexOf(e);if(s===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[s]=void 0;let n=this._deliveryQueue.current===this;if(this._size*Pq<=t.length){let o=0;for(let l=0;l<t.length;l++)t[l]?t[o++]=t[l]:n&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=o}}_deliver(e,t){if(!e)return;let s=this._options?.onListenerError||bh;if(!s){e.value(t);return}try{e.value(t)}catch(n){s(n)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof ug)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},Hq=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}},Z0=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Oe,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Oe,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}};Z0.INSTANCE=new Z0;var Dx=Z0;function Uq(e,t,s){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",s)}Dx.INSTANCE.onDidChangeZoomLevel;function Fq(e){return Dx.INSTANCE.getZoomFactor(e)}Dx.INSTANCE.onDidChangeFullscreen;var bl=typeof navigator=="object"?navigator.userAgent:"",Q0=bl.indexOf("Firefox")>=0,qq=bl.indexOf("AppleWebKit")>=0,Ox=bl.indexOf("Chrome")>=0,Vq=!Ox&&bl.indexOf("Safari")>=0;bl.indexOf("Electron/")>=0;bl.indexOf("Android")>=0;var dg=!1;if(typeof Sr.matchMedia=="function"){let e=Sr.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Sr.matchMedia("(display-mode: fullscreen)");dg=e.matches,Uq(Sr,e,({matches:s})=>{dg&&t.matches||(dg=s)})}var el="en",J0=!1,eb=!1,xh=!1,a5=!1,Xd,vh=el,p2=el,Gq,_r,eo=globalThis,Gn;typeof eo.vscode<"u"&&typeof eo.vscode.process<"u"?Gn=eo.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Gn=process);var Wq=typeof Gn?.versions?.electron=="string",Kq=Wq&&Gn?.type==="renderer";if(typeof Gn=="object"){J0=Gn.platform==="win32",eb=Gn.platform==="darwin",xh=Gn.platform==="linux",xh&&Gn.env.SNAP&&Gn.env.SNAP_REVISION,Gn.env.CI||Gn.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Xd=el,vh=el;let e=Gn.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Xd=t.userLocale,p2=t.osLocale,vh=t.resolvedLanguage||el,Gq=t.languagePack?.translationsConfigFile}catch{}a5=!0}else typeof navigator=="object"&&!Kq?(_r=navigator.userAgent,J0=_r.indexOf("Windows")>=0,eb=_r.indexOf("Macintosh")>=0,(_r.indexOf("Macintosh")>=0||_r.indexOf("iPad")>=0||_r.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,xh=_r.indexOf("Linux")>=0,_r?.indexOf("Mobi")>=0,vh=globalThis._VSCODE_NLS_LANGUAGE||el,Xd=navigator.language.toLowerCase(),p2=Xd):console.error("Unable to resolve platform.");var o5=J0,Gi=eb,Yq=xh,g2=a5,Yi=_r,oa=vh,Xq;(e=>{function t(){return oa}e.value=t;function s(){return oa.length===2?oa==="en":oa.length>=3?oa[0]==="e"&&oa[1]==="n"&&oa[2]==="-":!1}e.isDefaultVariant=s;function n(){return oa==="en"}e.isDefault=n})(Xq||={});var Zq=typeof eo.postMessage=="function"&&!eo.importScripts;(()=>{if(Zq){let e=[];eo.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}),eo.postMessage({vscodeScheduleAsyncWork:n},"*")}}return e=>setTimeout(e)})();var Qq=!!(Yi&&Yi.indexOf("Chrome")>=0);Yi&&Yi.indexOf("Firefox")>=0;!Qq&&Yi&&Yi.indexOf("Safari")>=0;Yi&&Yi.indexOf("Edg/")>=0;Yi&&Yi.indexOf("Android")>=0;var Ko=typeof navigator=="object"?navigator:{};g2||document.queryCommandSupported&&document.queryCommandSupported("copy")||Ko&&Ko.clipboard&&Ko.clipboard.writeText,g2||Ko&&Ko.clipboard&&Ko.clipboard.readText;var Lx=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}},hg=new Lx,b2=new Lx,x2=new Lx,Jq=new Array(230),l5;(e=>{function t(h){return hg.keyCodeToStr(h)}e.toString=t;function s(h){return hg.strToKeyCode(h)}e.fromString=s;function n(h){return b2.keyCodeToStr(h)}e.toUserSettingsUS=n;function o(h){return x2.keyCodeToStr(h)}e.toUserSettingsGeneral=o;function l(h){return b2.strToKeyCode(h)||x2.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 hg.keyCodeToStr(h)}e.toElectronAccelerator=u})(l5||={});var eV=class c5{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 c5&&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 tV([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},tV=class{constructor(e){if(e.length===0)throw Cq("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 sV(e){if(e.charCode){let s=String.fromCharCode(e.charCode).toUpperCase();return l5.fromString(s)}let t=e.keyCode;if(t===3)return 7;if(Q0)switch(t){case 59:return 85;case 60:if(Yq)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Gi)return 57;break}else if(qq&&(Gi&&t===93||!Gi&&t===92))return 57;return Jq[t]||0}var nV=Gi?256:2048,iV=512,rV=1024,aV=Gi?2048:256,v2=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=sV(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|=nV),this.altKey&&(t|=iV),this.shiftKey&&(t|=rV),this.metaKey&&(t|=aV),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new eV(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},_2=new WeakMap;function oV(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 lV=class{static getSameOriginWindowChain(e){let t=_2.get(e);if(!t){t=[],_2.set(e,t);let s=e,n;do n=oV(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}}},Zd=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let s=lV.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=s.left,this.posy-=s.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},y2=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(Ox){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?Q0&&!Gi?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")Vq&&o5?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?Q0&&!Gi?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()}},u5=Object.freeze(function(e,t){let s=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(s)}}}),cV;(e=>{function t(s){return s===e.None||s===e.Cancelled||s instanceof uV?!0:!s||typeof s!="object"?!1:typeof s.isCancellationRequested=="boolean"&&typeof s.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Xs.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:u5})})(cV||={});var uV=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?u5:(this._emitter||(this._emitter=new Oe),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},zx=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new G0("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new G0("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},dV=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 G0("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let n=s.setInterval(()=>{e()},t);this.disposable=ss(()=>{s.clearInterval(n),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},hV;(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})(hV||={});var S2=class oi{static fromArray(t){return new oi(s=>{s.emitMany(t)})}static fromPromise(t){return new oi(async s=>{s.emitMany(await t)})}static fromPromises(t){return new oi(async s=>{await Promise.all(t.map(async n=>s.emitOne(await n)))})}static merge(t){return new oi(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 Oe,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 Xs.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,s){return new oi(async n=>{for await(let o of t)n.emitOne(s(o))})}map(t){return oi.map(this,t)}static filter(t,s){return new oi(async n=>{for await(let o of t)s(o)&&n.emitOne(o)})}filter(t){return oi.filter(this,t)}static coalesce(t){return oi.filter(t,s=>!!s)}coalesce(){return oi.coalesce(this)}static async toPromise(t){let s=[];for await(let n of t)s.push(n);return s}toPromise(){return oi.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())}};S2.EMPTY=S2.fromArray([]);var{getWindow:qi,getWindowId:fV,onDidRegisterWindow:mV}=(function(){let e=new Map,t={window:Sr,disposables:new ma};e.set(Sr.vscodeWindowId,t);let s=new Oe,n=new Oe,o=new Oe;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 ma,m={window:u,disposables:h.add(new ma)};return e.set(u.vscodeWindowId,m),h.add(ss(()=>{e.delete(u.vscodeWindowId),n.fire(u)})),h.add(ot(u,zs.BEFORE_UNLOAD,()=>{o.fire(u)})),s.fire(m),h},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(u){return u.vscodeWindowId},hasWindow(u){return e.has(u)},getWindowById:l,getWindow(u){let h=u;if(h?.ownerDocument?.defaultView)return h.ownerDocument.defaultView.window;let m=u;return m?.view?m.view.window:Sr},getDocument(u){return qi(u).document}}})(),pV=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 ot(e,t,s,n){return new pV(e,t,s,n)}var w2=function(e,t,s,n){return ot(e,t,s,n)},Bx,gV=class extends dV{constructor(e){super(),this.defaultTarget=e&&qi(e)}cancelAndSet(e,t,s){return super.cancelAndSet(e,t,s??this.defaultTarget)}},k2=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){bh(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(k2.sort),u.shift().execute();n.set(l,!1)};Bx=(l,u,h=0)=>{let m=fV(l),d=new k2(u,h),p=e.get(m);return p||(p=[],e.set(m,p)),p.push(d),s.get(m)||(s.set(m,!0),l.requestAnimationFrame(()=>o(m))),d}})();function bV(e){let t=e.getBoundingClientRect(),s=qi(e);return{left:t.left+s.scrollX,top:t.top+s.scrollY,width:t.width,height:t.height}}var zs={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"},xV=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=Dn(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Dn(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Dn(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Dn(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Dn(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Dn(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Dn(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Dn(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Dn(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Dn(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Dn(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=Dn(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=Dn(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Dn(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 Dn(e){return typeof e=="number"?`${e}px`:e}function Uc(e){return new xV(e)}var d5=class{constructor(){this._hooks=new ma,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(ss(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{l=qi(e)}this._hooks.add(ot(l,zs.POINTER_MOVE,u=>{if(u.buttons!==s){this.stopMonitoring(!0);return}u.preventDefault(),this._pointerMoveCallback(u)})),this._hooks.add(ot(l,zs.POINTER_UP,u=>this.stopMonitoring(!0)))}};function vV(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 Hi;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Hi||={});var Tc=class nn extends mt{constructor(){super(),this.dispatched=!1,this.targets=new m2,this.ignoreTargets=new m2,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Xs.runAndSubscribe(mV,({window:t,disposables:s})=>{s.add(ot(t.document,"touchstart",n=>this.onTouchStart(n),{passive:!1})),s.add(ot(t.document,"touchend",n=>this.onTouchEnd(t,n))),s.add(ot(t.document,"touchmove",n=>this.onTouchMove(n),{passive:!1}))},{window:Sr,disposables:this._store}))}static addTarget(t){if(!nn.isTouchDevice())return mt.None;nn.INSTANCE||(nn.INSTANCE=new nn);let s=nn.INSTANCE.targets.push(t);return ss(s)}static ignoreTarget(t){if(!nn.isTouchDevice())return mt.None;nn.INSTANCE||(nn.INSTANCE=new nn);let s=nn.INSTANCE.ignoreTargets.push(t);return ss(s)}static isTouchDevice(){return"ontouchstart"in Sr||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(Hi.Start,l.target);u.pageX=l.pageX,u.pageY=l.pageY,this.dispatchEvent(u)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,s){let n=Date.now(),o=Object.keys(this.activeTouches).length;for(let l=0,u=s.changedTouches.length;l<u;l++){let h=s.changedTouches.item(l);if(!this.activeTouches.hasOwnProperty(String(h.identifier))){console.warn("move of an UNKNOWN touch",h);continue}let m=this.activeTouches[h.identifier],d=Date.now()-m.initialTimeStamp;if(d<nn.HOLD_DELAY&&Math.abs(m.initialPageX-qn(m.rollingPageX))<30&&Math.abs(m.initialPageY-qn(m.rollingPageY))<30){let p=this.newGestureEvent(Hi.Tap,m.initialTarget);p.pageX=qn(m.rollingPageX),p.pageY=qn(m.rollingPageY),this.dispatchEvent(p)}else if(d>=nn.HOLD_DELAY&&Math.abs(m.initialPageX-qn(m.rollingPageX))<30&&Math.abs(m.initialPageY-qn(m.rollingPageY))<30){let p=this.newGestureEvent(Hi.Contextmenu,m.initialTarget);p.pageX=qn(m.rollingPageX),p.pageY=qn(m.rollingPageY),this.dispatchEvent(p)}else if(o===1){let p=qn(m.rollingPageX),g=qn(m.rollingPageY),b=qn(m.rollingTimestamps)-m.rollingTimestamps[0],v=p-m.rollingPageX[0],w=g-m.rollingPageY[0],k=[...this.targets].filter(N=>m.initialTarget instanceof Node&&N.contains(m.initialTarget));this.inertia(t,k,n,Math.abs(v)/b,v>0?1:-1,p,Math.abs(w)/b,w>0?1:-1,g)}this.dispatchEvent(this.newGestureEvent(Hi.End,m.initialTarget)),delete this.activeTouches[h.identifier]}this.dispatched&&(s.preventDefault(),s.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,s){let n=document.createEvent("CustomEvent");return n.initEvent(t,!1,!0),n.initialTarget=s,n.tapCount=0,n}dispatchEvent(t){if(t.type===Hi.Tap){let s=new Date().getTime(),n=0;s-this._lastSetTapCountTime>nn.CLEAR_TAP_COUNT_TIME?n=1:n=2,this._lastSetTapCountTime=s,t.tapCount=n}else(t.type===Hi.Change||t.type===Hi.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let n of this.ignoreTargets)if(n.contains(t.initialTarget))return;let s=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let o=0,l=t.initialTarget;for(;l&&l!==n;)o++,l=l.parentElement;s.push([o,n])}s.sort((n,o)=>n[0]-o[0]);for(let[n,o]of s)o.dispatchEvent(t),this.dispatched=!0}}inertia(t,s,n,o,l,u,h,m,d){this.handle=Bx(t,()=>{let p=Date.now(),g=p-n,b=0,v=0,w=!0;o+=nn.SCROLL_FRICTION*g,h+=nn.SCROLL_FRICTION*g,o>0&&(w=!1,b=l*o*g),h>0&&(w=!1,v=m*h*g);let k=this.newGestureEvent(Hi.Change);k.translationX=b,k.translationY=v,s.forEach(N=>N.dispatchEvent(k)),w||this.inertia(t,s,p,o,l,u+b,h,m,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(Hi.Change,u.initialTarget);h.translationX=l.pageX-qn(u.rollingPageX),h.translationY=l.pageY-qn(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)}};Tc.SCROLL_FRICTION=-.005,Tc.HOLD_DELAY=700,Tc.CLEAR_TAP_COUNT_TIME=400,us([vV],Tc,"isTouchDevice",1);var _V=Tc,Ix=class extends mt{onclick(e,t){this._register(ot(e,zs.CLICK,s=>t(new Zd(qi(e),s))))}onmousedown(e,t){this._register(ot(e,zs.MOUSE_DOWN,s=>t(new Zd(qi(e),s))))}onmouseover(e,t){this._register(ot(e,zs.MOUSE_OVER,s=>t(new Zd(qi(e),s))))}onmouseleave(e,t){this._register(ot(e,zs.MOUSE_LEAVE,s=>t(new Zd(qi(e),s))))}onkeydown(e,t){this._register(ot(e,zs.KEY_DOWN,s=>t(new v2(s))))}onkeyup(e,t){this._register(ot(e,zs.KEY_UP,s=>t(new v2(s))))}oninput(e,t){this._register(ot(e,zs.INPUT,t))}onblur(e,t){this._register(ot(e,zs.BLUR,t))}onfocus(e,t){this._register(ot(e,zs.FOCUS,t))}onchange(e,t){this._register(ot(e,zs.CHANGE,t))}ignoreGesture(e){return _V.ignoreTarget(e)}},N2=11,yV=class extends Ix{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=N2+"px",this.domNode.style.height=N2+"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 d5),this._register(w2(this.bgDomNode,zs.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(w2(this.domNode,zs.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new gV),this._pointerdownScheduleRepeatTimer=this._register(new zx)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,qi(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()}},SV=class tb{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 tb(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 tb(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,s){let n=this.width!==t.width,o=this.scrollWidth!==t.scrollWidth,l=this.scrollLeft!==t.scrollLeft,u=this.height!==t.height,h=this.scrollHeight!==t.scrollHeight,m=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:s,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:o,scrollLeftChanged:l,heightChanged:u,scrollHeightChanged:h,scrollTopChanged:m}}},wV=class extends mt{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new Oe),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new SV(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 E2(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=E2.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)))}},C2=class{constructor(e,t,s){this.scrollLeft=e,this.scrollTop=t,this.isDone=s}};function fg(e,t){let s=t-e;return function(n){return e+s*CV(n)}}function kV(e,t,s){return function(n){return n<s?e(n/s):t((n-s)/(1-s))}}var E2=class sb{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),kV(fg(t,o),fg(l,s),.33)}return fg(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 C2(n,o,!1)}return new C2(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,s,n){return sb.start(t,s,n)}static start(t,s,n){n=n+10;let o=Date.now()-10;return new sb(t,s,o,n)}};function NV(e){return Math.pow(e,3)}function CV(e){return 1-NV(1-e)}var EV=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 zx)}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":"")))}},jV=140,h5=class extends Ix{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 EV(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new d5),this._shouldRender=!0,this.domNode=Uc(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(ot(this.domNode.domNode,zs.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new yV(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,s,n){this.slider=Uc(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(ot(this.slider.domNode,zs.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=bV(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(o5&&u>jV){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()}},f5=class nb{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 nb(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let s=Math.round(t);return this._visibleSize!==s?(this._visibleSize=s,this._refreshComputedValues(),!0):!1}setScrollSize(t){let s=Math.round(t);return this._scrollSize!==s?(this._scrollSize=s,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let s=Math.round(t);return this._scrollPosition!==s?(this._scrollPosition=s,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,s,n,o,l){let u=Math.max(0,n-t),h=Math.max(0,u-2*s),m=o>0&&o>n;if(!m)return{computedAvailableSize:Math.round(u),computedIsNeeded:m,computedSliderSize:Math.round(h),computedSliderRatio:0,computedSliderPosition:0};let d=Math.round(Math.max(20,Math.floor(n*h/o))),p=(h-d)/(o-n),g=l*p;return{computedAvailableSize:Math.round(u),computedIsNeeded:m,computedSliderSize:Math.round(d),computedSliderRatio:p,computedSliderPosition:Math.round(g)}}_refreshComputedValues(){let t=nb._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)}},TV=class extends h5{constructor(e,t,s){let n=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:s,scrollbarState:new f5(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}},AV=class extends h5{constructor(e,t,s){let n=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:s,scrollbarState:new f5(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}},RV=500,j2=50,MV=class{constructor(e,t,s){this.timestamp=e,this.deltaX=t,this.deltaY=s,this.score=0}},ib=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(Ox){let s=qi(t.browserEvent),n=Fq(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 MV(t,s,n);this._front===-1&&this._rear===-1?(this._memory[0]=l,this._front=0,this._rear=0):(o=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=l),l.score=this._computeScore(l,o)}_computeScore(t,s){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(n+=.25),s){let o=Math.abs(t.deltaX),l=Math.abs(t.deltaY),u=Math.abs(s.deltaX),h=Math.abs(s.deltaY),m=Math.max(Math.min(o,u),1),d=Math.max(Math.min(l,h),1),p=Math.max(o,u),g=Math.max(l,h);p%m===0&&g%d===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};ib.INSTANCE=new ib;var DV=ib,OV=class extends Ix{constructor(e,t,s){super(),this._onScroll=this._register(new Oe),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new Oe),this.onWillScroll=this._onWillScroll.event,this._options=zV(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 AV(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new TV(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=Uc(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Uc(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Uc(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 zx),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=no(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,Gi&&(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 y2(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=no(this._mouseWheelToDispose),e)){let t=s=>{this._onMouseWheel(new y2(s))};this._mouseWheelToDispose.push(ot(this._listenOnDomNode,zs.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=DV.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=!Gi&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||u)&&!l&&(l=o,o=0),e.browserEvent&&e.browserEvent.altKey&&(l=l*this._options.fastScrollSensitivity,o=o*this._options.fastScrollSensitivity);let h=this._scrollable.getFutureScrollPosition(),m={};if(o){let d=j2*o,p=h.scrollTop-(d<0?Math.floor(d):Math.ceil(d));this._verticalScrollbar.writeScrollPosition(m,p)}if(l){let d=j2*l,p=h.scrollLeft-(d<0?Math.floor(d):Math.ceil(d));this._horizontalScrollbar.writeScrollPosition(m,p)}m=this._scrollable.validateScrollPosition(m),(h.scrollLeft!==m.scrollLeft||h.scrollTop!==m.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(m):this._scrollable.setScrollPositionNow(m),s=!0)}let n=s;!n&&this._options.alwaysConsumeMouseWheel&&(n=!0),!n&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(n=!0),n&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,s=e.scrollLeft>0,n=s?" left":"",o=t?" top":"",l=s||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${n}`),this._topShadowDomNode.setClassName(`shadow${o}`),this._topLeftShadowDomNode.setClassName(`shadow${l}${o}${n}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),RV)}},LV=class extends OV{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 zV(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,Gi&&(t.className+=" mac"),t}var rb=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 Oe),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let m=this._register(new wV({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:d=>Bx(n.window,d)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{m.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new LV(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},m)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(o.onProtocolChange(d=>{this._scrollableElement.updateOptions({handleMouseWheel:!(d&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Xs.runAndSubscribe(l.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=l.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(ss(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=n.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(ss(()=>this._styleElement.remove())),this._register(Xs.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(`
|
|
171
|
+
`)})),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}};rb=us([Fe(2,_n),Fe(3,Tr),Fe(4,W3),Fe(5,gl),Fe(6,yn),Fe(7,Ar)],rb);var ab=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(ss(()=>{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()}};ab=us([Fe(1,_n),Fe(2,Tr),Fe(3,fu),Fe(4,Ar)],ab);var BV=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)}},Ii={full:0,left:0,center:0,right:0},la={full:0,left:0,center:0,right:0},gc={full:0,left:0,center:0,right:0},Wh=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 BV,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(ss(()=>this._canvas?.remove()));let m=this._canvas.getContext("2d");if(m)this._ctx=m;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);la.full=this._canvas.width,la.left=e,la.center=t,la.right=e,this._refreshDrawHeightConstants(),gc.full=1,gc.left=1,gc.center=1+la.left,gc.right=1+la.left+la.center}_refreshDrawHeightConstants(){Ii.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);Ii.left=t,Ii.center=t,Ii.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ii.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ii.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ii.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ii.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(gc[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Ii[e.position||"full"]/2),la[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Ii[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}))}};Wh=us([Fe(2,_n),Fe(3,fu),Fe(4,Ar),Fe(5,yn),Fe(6,gl),Fe(7,Tr)],Wh);var we;(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=`
|
|
172
|
+
`,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=""))(we||={});var _h;(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=""))(_h||={});var m5;(e=>e.ST=`${we.ESC}\\`)(m5||={});var ob=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(`${we.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)}}};ob=us([Fe(2,_n),Fe(3,yn),Fe(4,lo),Fe(5,Ar)],ob);var Bs=0,Is=0,Ps=0,cs=0,T2={css:"#00000000",rgba:0},Cs;(e=>{function t(o,l,u,h){return h!==void 0?`#${Ha(o)}${Ha(l)}${Ha(u)}${Ha(h)}`:`#${Ha(o)}${Ha(l)}${Ha(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})(Cs||={});var Xt;(e=>{function t(m,d){if(cs=(d.rgba&255)/255,cs===1)return{css:d.css,rgba:d.rgba};let p=d.rgba>>24&255,g=d.rgba>>16&255,b=d.rgba>>8&255,v=m.rgba>>24&255,w=m.rgba>>16&255,k=m.rgba>>8&255;Bs=v+Math.round((p-v)*cs),Is=w+Math.round((g-w)*cs),Ps=k+Math.round((b-k)*cs);let N=Cs.toCss(Bs,Is,Ps),E=Cs.toRgba(Bs,Is,Ps);return{css:N,rgba:E}}e.blend=t;function s(m){return(m.rgba&255)===255}e.isOpaque=s;function n(m,d,p){let g=yh.ensureContrastRatio(m.rgba,d.rgba,p);if(g)return Cs.toColor(g>>24&255,g>>16&255,g>>8&255)}e.ensureContrastRatio=n;function o(m){let d=(m.rgba|255)>>>0;return[Bs,Is,Ps]=yh.toChannels(d),{css:Cs.toCss(Bs,Is,Ps),rgba:d}}e.opaque=o;function l(m,d){return cs=Math.round(d*255),[Bs,Is,Ps]=yh.toChannels(m.rgba),{css:Cs.toCss(Bs,Is,Ps,cs),rgba:Cs.toRgba(Bs,Is,Ps,cs)}}e.opacity=l;function u(m,d){return cs=m.rgba&255,l(m,cs*d/255)}e.multiplyOpacity=u;function h(m){return[m.rgba>>24&255,m.rgba>>16&255,m.rgba>>8&255]}e.toColorRGB=h})(Xt||={});var rs;(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 Bs=parseInt(o.slice(1,2).repeat(2),16),Is=parseInt(o.slice(2,3).repeat(2),16),Ps=parseInt(o.slice(3,4).repeat(2),16),Cs.toColor(Bs,Is,Ps);case 5:return Bs=parseInt(o.slice(1,2).repeat(2),16),Is=parseInt(o.slice(2,3).repeat(2),16),Ps=parseInt(o.slice(3,4).repeat(2),16),cs=parseInt(o.slice(4,5).repeat(2),16),Cs.toColor(Bs,Is,Ps,cs);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 Bs=parseInt(l[1]),Is=parseInt(l[2]),Ps=parseInt(l[3]),cs=Math.round((l[5]===void 0?1:parseFloat(l[5]))*255),Cs.toColor(Bs,Is,Ps,cs);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),[Bs,Is,Ps,cs]=t.getImageData(0,0,1,1).data,cs!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Cs.toRgba(Bs,Is,Ps,cs),css:o}}e.toColor=n})(rs||={});var mn;(e=>{function t(n){return s(n>>16&255,n>>8&255,n&255)}e.relativeLuminance=t;function s(n,o,l){let u=n/255,h=o/255,m=l/255,d=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),p=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),g=m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4);return d*.2126+p*.7152+g*.0722}e.relativeLuminance2=s})(mn||={});var yh;(e=>{function t(u,h){if(cs=(h&255)/255,cs===1)return h;let m=h>>24&255,d=h>>16&255,p=h>>8&255,g=u>>24&255,b=u>>16&255,v=u>>8&255;return Bs=g+Math.round((m-g)*cs),Is=b+Math.round((d-b)*cs),Ps=v+Math.round((p-v)*cs),Cs.toRgba(Bs,Is,Ps)}e.blend=t;function s(u,h,m){let d=mn.relativeLuminance(u>>8),p=mn.relativeLuminance(h>>8);if(vr(d,p)<m){if(p<d){let v=n(u,h,m),w=vr(d,mn.relativeLuminance(v>>8));if(w<m){let k=o(u,h,m),N=vr(d,mn.relativeLuminance(k>>8));return w>N?v:k}return v}let g=o(u,h,m),b=vr(d,mn.relativeLuminance(g>>8));if(b<m){let v=n(u,h,m),w=vr(d,mn.relativeLuminance(v>>8));return b>w?g:v}return g}}e.ensureContrastRatio=s;function n(u,h,m){let d=u>>24&255,p=u>>16&255,g=u>>8&255,b=h>>24&255,v=h>>16&255,w=h>>8&255,k=vr(mn.relativeLuminance2(b,v,w),mn.relativeLuminance2(d,p,g));for(;k<m&&(b>0||v>0||w>0);)b-=Math.max(0,Math.ceil(b*.1)),v-=Math.max(0,Math.ceil(v*.1)),w-=Math.max(0,Math.ceil(w*.1)),k=vr(mn.relativeLuminance2(b,v,w),mn.relativeLuminance2(d,p,g));return(b<<24|v<<16|w<<8|255)>>>0}e.reduceLuminance=n;function o(u,h,m){let d=u>>24&255,p=u>>16&255,g=u>>8&255,b=h>>24&255,v=h>>16&255,w=h>>8&255,k=vr(mn.relativeLuminance2(b,v,w),mn.relativeLuminance2(d,p,g));for(;k<m&&(b<255||v<255||w<255);)b=Math.min(255,b+Math.ceil((255-b)*.1)),v=Math.min(255,v+Math.ceil((255-v)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),k=vr(mn.relativeLuminance2(b,v,w),mn.relativeLuminance2(d,p,g));return(b<<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})(yh||={});function Ha(e){let t=e.toString(16);return t.length<2?"0"+t:t}function vr(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var IV=class extends hu{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()]}},Kh=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new hi}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let s=[],n=t.translateToString(!0),o=0,l=0,u=0,h=t.getFg(0),m=t.getBg(0);for(let d=0;d<t.getTrimmedLength();d++)if(t.loadCell(d,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==h||this._workCell.bg!==m){if(d-o>1){let p=this._getJoinedRanges(n,u,l,t,o);for(let g=0;g<p.length;g++)s.push(p[g])}o=d,u=l,h=this._workCell.fg,m=this._workCell.bg}l+=this._workCell.getChars().length||fa.length}if(this._bufferService.cols-o>1){let d=this._getJoinedRanges(n,u,l,t,o);for(let p=0;p<d.length;p++)s.push(d[p])}return s}_getJoinedRanges(e,t,s,n,o){let l=e.substring(t,s),u=[];try{u=this._characterJoiners[0].handler(l)}catch(h){console.error(h)}for(let h=1;h<this._characterJoiners.length;h++)try{let m=this._characterJoiners[h].handler(l);for(let d=0;d<m.length;d++)Kh._mergeRanges(u,m[d])}catch(m){console.error(m)}return this._stringRangesToCellRanges(u,n,o),u}_stringRangesToCellRanges(e,t,s){let n=0,o=!1,l=0,u=e[n];if(u){for(let h=s;h<this._bufferService.cols;h++){let m=t.getWidth(h),d=t.getString(h).length||fa.length;if(m!==0){if(!o&&u[0]<=l&&(u[0]=h,o=!0),u[1]<=l){if(u[1]=h,u=e[++n],!u)break;u[0]<=l?(u[0]=h,o=!0):o=!1}l+=d}}u&&(u[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let s=!1;for(let n=0;n<e.length;n++){let o=e[n];if(s){if(t[1]<=o[0])return e[n-1][1]=t[1],e;if(t[1]<=o[1])return e[n-1][1]=Math.max(t[1],o[1]),e.splice(n,1),e;e.splice(n,1),n--}else{if(t[1]<=o[0])return e.splice(n,0,t),e;if(t[1]<=o[1])return o[0]=Math.min(t[0],o[0]),e;t[0]<o[1]&&(o[0]=Math.min(t[0],o[0]),s=!0);continue}}return s?e[e.length-1][1]=t[1]:e.push(t),e}};Kh=us([Fe(0,_n)],Kh);function PV(e){return 57508<=e&&e<=57558}function $V(e){return 9472<=e&&e<=9631}function HV(e){return PV(e)||$V(e)}function UV(){return{css:{canvas:Qd(),cell:Qd()},device:{canvas:Qd(),cell:Qd(),char:{width:0,height:0,left:0,top:0}}}}function Qd(){return{width:0,height:0}}var lb=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 hi,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,s){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=s}createRow(e,t,s,n,o,l,u,h,m,d,p){let g=[],b=this._characterJoinerService.getJoinedCharacters(t),v=this._themeService.colors,w=e.getNoBgTrimmedLength();s&&w<l+1&&(w=l+1);let k,N=0,E="",A=0,j=0,T=0,P=0,z=!1,L=0,R=!1,D=0,I=0,V=[],X=d!==-1&&p!==-1;for(let $=0;$<w;$++){e.loadCell($,this._workCell);let W=this._workCell.getWidth();if(W===0)continue;let q=!1,B=$>=I,Z=$,U=this._workCell;if(b.length>0&&$===b[0][0]&&B){let $e=b.shift(),St=this._isCellInSelection($e[0],t);for(A=$e[0]+1;A<$e[1];A++)B&&=St===this._isCellInSelection(A,t);B&&=!s||l<$e[0]||l>=$e[1],B?(q=!0,U=new IV(this._workCell,e.translateToString(!0,$e[0],$e[1]),$e[1]-$e[0]),Z=$e[1]-1,W=U.getWidth()):I=$e[1]}let K=this._isCellInSelection($,t),Y=s&&$===l,F=X&&$>=d&&$<=p,ie=!1;this._decorationService.forEachDecorationAtCell($,t,void 0,$e=>{ie=!0});let Ee=U.getChars()||fa;if(Ee===" "&&(U.isUnderline()||U.isOverline())&&(Ee=" "),D=W*h-m.get(Ee,U.isBold(),U.isItalic()),!k)k=this._document.createElement("span");else if(N&&(K&&R||!K&&!R&&U.bg===j)&&(K&&R&&v.selectionForeground||U.fg===T)&&U.extended.ext===P&&F===z&&D===L&&!Y&&!q&&!ie&&B){U.isInvisible()?E+=fa:E+=Ee,N++;continue}else N&&(k.textContent=E),k=this._document.createElement("span"),N=0,E="";if(j=U.bg,T=U.fg,P=U.extended.ext,z=F,L=D,R=K,q&&l>=$&&l<=Z&&(l=$),!this._coreService.isCursorHidden&&Y&&this._coreService.isCursorInitialized){if(V.push("xterm-cursor"),this._coreBrowserService.isFocused)u&&V.push("xterm-cursor-blink"),V.push(n==="bar"?"xterm-cursor-bar":n==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(o)switch(o){case"outline":V.push("xterm-cursor-outline");break;case"block":V.push("xterm-cursor-block");break;case"bar":V.push("xterm-cursor-bar");break;case"underline":V.push("xterm-cursor-underline");break}}if(U.isBold()&&V.push("xterm-bold"),U.isItalic()&&V.push("xterm-italic"),U.isDim()&&V.push("xterm-dim"),U.isInvisible()?E=fa:E=U.getChars()||fa,U.isUnderline()&&(V.push(`xterm-underline-${U.extended.underlineStyle}`),E===" "&&(E=" "),!U.isUnderlineColorDefault()))if(U.isUnderlineColorRGB())k.style.textDecorationColor=`rgb(${hu.toColorRGB(U.getUnderlineColor()).join(",")})`;else{let $e=U.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&U.isBold()&&$e<8&&($e+=8),k.style.textDecorationColor=v.ansi[$e].css}U.isOverline()&&(V.push("xterm-overline"),E===" "&&(E=" ")),U.isStrikethrough()&&V.push("xterm-strikethrough"),F&&(k.style.textDecoration="underline");let ye=U.getFgColor(),oe=U.getFgColorMode(),je=U.getBgColor(),Ne=U.getBgColorMode(),Ge=!!U.isInverse();if(Ge){let $e=ye;ye=je,je=$e;let St=oe;oe=Ne,Ne=St}let Me,Qe,ke=!1;this._decorationService.forEachDecorationAtCell($,t,void 0,$e=>{$e.options.layer!=="top"&&ke||($e.backgroundColorRGB&&(Ne=50331648,je=$e.backgroundColorRGB.rgba>>8&16777215,Me=$e.backgroundColorRGB),$e.foregroundColorRGB&&(oe=50331648,ye=$e.foregroundColorRGB.rgba>>8&16777215,Qe=$e.foregroundColorRGB),ke=$e.options.layer==="top")}),!ke&&K&&(Me=this._coreBrowserService.isFocused?v.selectionBackgroundOpaque:v.selectionInactiveBackgroundOpaque,je=Me.rgba>>8&16777215,Ne=50331648,ke=!0,v.selectionForeground&&(oe=50331648,ye=v.selectionForeground.rgba>>8&16777215,Qe=v.selectionForeground)),ke&&V.push("xterm-decoration-top");let He;switch(Ne){case 16777216:case 33554432:He=v.ansi[je],V.push(`xterm-bg-${je}`);break;case 50331648:He=Cs.toColor(je>>16,je>>8&255,je&255),this._addStyle(k,`background-color:#${A2((je>>>0).toString(16),"0",6)}`);break;default:Ge?(He=v.foreground,V.push("xterm-bg-257")):He=v.background}switch(Me||U.isDim()&&(Me=Xt.multiplyOpacity(He,.5)),oe){case 16777216:case 33554432:U.isBold()&&ye<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ye+=8),this._applyMinimumContrast(k,He,v.ansi[ye],U,Me,void 0)||V.push(`xterm-fg-${ye}`);break;case 50331648:let $e=Cs.toColor(ye>>16&255,ye>>8&255,ye&255);this._applyMinimumContrast(k,He,$e,U,Me,Qe)||this._addStyle(k,`color:#${A2(ye.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(k,He,v.foreground,U,Me,Qe)||Ge&&V.push("xterm-fg-257")}V.length&&(k.className=V.join(" "),V.length=0),!Y&&!q&&!ie&&B?N++:k.textContent=E,D!==this.defaultSpacing&&(k.style.letterSpacing=`${D}px`),g.push(k),$=Z}return k&&N&&(k.textContent=E),g}_applyMinimumContrast(e,t,s,n,o,l){if(this._optionsService.rawOptions.minimumContrastRatio===1||HV(n.getCode()))return!1;let u=this._getContrastCache(n),h;if(!o&&!l&&(h=u.getColor(t.rgba,s.rgba)),h===void 0){let m=this._optionsService.rawOptions.minimumContrastRatio/(n.isDim()?2:1);h=Xt.ensureContrastRatio(o||t,l||s,m),u.setColor((o||t).rgba,(l||s).rgba,h??null)}return h?(this._addStyle(e,`color:${h.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let s=this._selectionStart,n=this._selectionEnd;return!s||!n?!1:this._columnSelectMode?s[0]<=n[0]?e>=s[0]&&t>=s[1]&&e<n[0]&&t<=n[1]:e<s[0]&&t>=s[1]&&e>=n[0]&&t<=n[1]:t>s[1]&&t<n[1]||s[1]===n[1]&&t===s[1]&&e>=s[0]&&e<n[0]||s[1]<n[1]&&t===n[1]&&e<n[0]||s[1]<n[1]&&t===s[1]&&e>=s[0]}};lb=us([Fe(1,X3),Fe(2,yn),Fe(3,Tr),Fe(4,lo),Fe(5,fu),Fe(6,gl)],lb);function A2(e,t,s){for(;e.length<s;)e=t+e;return e}var FV=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}},qV=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,s,n=!1){if(this.selectionStart=t,this.selectionEnd=s,!t||!s||t[0]===s[0]&&t[1]===s[1]){this.clear();return}let o=e.buffers.active.ydisp,l=t[1]-o,u=s[1]-o,h=Math.max(l,0),m=Math.min(u,e.rows-1);if(h>=e.rows||m<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=n,this.viewportStartRow=l,this.viewportEndRow=u,this.viewportCappedStartRow=h,this.viewportCappedEndRow=m,this.startCol=t[0],this.endCol=s[0]}isCellSelected(e,t,s){return this.hasSelection?(s-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&s>=this.viewportCappedStartRow&&t<this.endCol&&s<=this.viewportCappedEndRow:t<this.startCol&&s>=this.viewportCappedStartRow&&t>=this.endCol&&s<=this.viewportCappedEndRow:s>this.viewportStartRow&&s<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&s===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportStartRow&&t>=this.startCol):!1}};function VV(){return new qV}var mg="xterm-dom-renderer-owner-",ri="xterm-rows",Jd="xterm-fg-",R2="xterm-bg-",bc="xterm-focus",eh="xterm-selection",GV=1,cb=class extends mt{constructor(e,t,s,n,o,l,u,h,m,d,p,g,b,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=m,this._optionsService=d,this._bufferService=p,this._coreService=g,this._coreBrowserService=b,this._themeService=v,this._terminalClass=GV++,this._rowElements=[],this._selectionRenderModel=VV(),this.onRequestRedraw=this._register(new Oe).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(ri),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(eh),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=UV(),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(lb,document),this._element.classList.add(mg+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(ss(()=>{this._element.classList.remove(mg+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new FV(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let s of this._rowElements)s.style.width=`${this.dimensions.css.canvas.width}px`,s.style.height=`${this.dimensions.css.cell.height}px`,s.style.lineHeight=`${this.dimensions.css.cell.height}px`,s.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${ri} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${ri} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${ri} .xterm-dim { color: ${Xt.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let s=`blink_underline_${this._terminalClass}`,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} .${ri}.${bc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${ri}.${bc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${ri}.${bc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${o} 1s step-end infinite;}${this._terminalSelector} .${ri} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${ri} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${ri} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${ri} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${ri} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${eh} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${eh} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${eh} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[l,u]of e.ansi.entries())t+=`${this._terminalSelector} .${Jd}${l} { color: ${u.css}; }${this._terminalSelector} .${Jd}${l}.xterm-dim { color: ${Xt.multiplyOpacity(u,.5).css}; }${this._terminalSelector} .${R2}${l} { background-color: ${u.css}; }`;t+=`${this._terminalSelector} .${Jd}257 { color: ${Xt.opaque(e.background).css}; }${this._terminalSelector} .${Jd}257.xterm-dim { color: ${Xt.multiplyOpacity(Xt.opaque(e.background),.5).css}; }${this._terminalSelector} .${R2}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(bc),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(bc),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,s){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,s),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,s),!this._selectionRenderModel.hasSelection))return;let n=this._selectionRenderModel.viewportStartRow,o=this._selectionRenderModel.viewportEndRow,l=this._selectionRenderModel.viewportCappedStartRow,u=this._selectionRenderModel.viewportCappedEndRow,h=this._document.createDocumentFragment();if(s){let m=e[0]>t[0];h.appendChild(this._createSelectionElement(l,m?t[0]:e[0],m?e[0]:t[0],u-l+1))}else{let m=n===l?e[0]:0,d=l===o?t[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(l,m,d));let p=u-l-1;if(h.appendChild(this._createSelectionElement(l+1,0,this._bufferService.cols,p)),l!==u){let g=o===u?t[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(u,0,g))}}this._selectionContainer.appendChild(h)}_createSelectionElement(e,t,s,n=1){let o=this._document.createElement("div"),l=t*this.dimensions.css.cell.width,u=this.dimensions.css.cell.width*(s-t);return l+u>this.dimensions.css.canvas.width&&(u=this.dimensions.css.canvas.width-l),o.style.height=`${n*this.dimensions.css.cell.height}px`,o.style.top=`${e*this.dimensions.css.cell.height}px`,o.style.left=`${l}px`,o.style.width=`${u}px`,o}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let s=this._bufferService.buffer,n=s.ybase+s.y,o=Math.min(s.x,this._bufferService.cols-1),l=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,u=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,h=this._optionsService.rawOptions.cursorInactiveStyle;for(let m=e;m<=t;m++){let d=m+s.ydisp,p=this._rowElements[m],g=s.lines.get(d);if(!p||!g)break;p.replaceChildren(...this._rowFactory.createRow(g,d,d===n,u,h,o,l,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${mg}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,s,n,o,l){s<0&&(e=0),n<0&&(t=0);let u=this._bufferService.rows-1;s=Math.max(Math.min(s,u),0),n=Math.max(Math.min(n,u),0),o=Math.min(o,this._bufferService.cols);let h=this._bufferService.buffer,m=h.ybase+h.y,d=Math.min(h.x,o-1),p=this._optionsService.rawOptions.cursorBlink,g=this._optionsService.rawOptions.cursorStyle,b=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===m,g,b,d,p,this.dimensions.css.cell.width,this._widthCache,l?v===s?e:0:-1,l?(v===n?t:o)-1:-1))}}};cb=us([Fe(7,Rx),Fe(8,vf),Fe(9,yn),Fe(10,_n),Fe(11,lo),Fe(12,Tr),Fe(13,gl)],cb);var ub=class extends mt{constructor(e,t,s){super(),this._optionsService=s,this.width=0,this.height=0,this._onCharSizeChange=this._register(new Oe),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new KV(this._optionsService))}catch{this._measureStrategy=this._register(new WV(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())}};ub=us([Fe(2,yn)],ub);var p5=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)}},WV=class extends p5{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}},KV=class extends p5{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}},YV=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 XV(this._window)),this._onDprChange=this._register(new Oe),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new Oe),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(n=>this._screenDprMonitor.setWindow(n))),this._register(Xs.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(ot(this._textarea,"focus",()=>this._isFocused=!0)),this._register(ot(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}},XV=class extends mt{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new ll),this._onDprChange=this._register(new Oe),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(ss(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=ot(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)}},ZV=class extends mt{constructor(){super(),this.linkProviders=[],this._register(ss(()=>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 Px(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 QV(e,t,s,n,o,l,u,h,m){if(!l)return;let d=Px(e,t,s);if(d)return d[0]=Math.ceil((d[0]+(m?u/2:0))/u),d[1]=Math.ceil(d[1]/h),d[0]=Math.min(Math.max(d[0],1),n+(m?1:0)),d[1]=Math.min(Math.max(d[1],1),o),d}var db=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,s,n,o){return QV(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=Px(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])}}};db=us([Fe(0,Ar),Fe(1,vf)],db);var JV=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=[]}},g5={};cq(g5,{getSafariVersion:()=>tG,isChromeOS:()=>_5,isFirefox:()=>b5,isIpad:()=>sG,isIphone:()=>nG,isLegacyEdge:()=>eG,isLinux:()=>$x,isMac:()=>Yh,isNode:()=>_f,isSafari:()=>x5,isWindows:()=>v5});var _f=typeof process<"u"&&"title"in process,mu=_f?"node":navigator.userAgent,pu=_f?"node":navigator.platform,b5=mu.includes("Firefox"),eG=mu.includes("Edge"),x5=/^((?!chrome|android).)*safari/i.test(mu);function tG(){if(!x5)return 0;let e=mu.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Yh=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(pu),sG=pu==="iPad",nG=pu==="iPhone",v5=["Windows","Win16","Win32","WinCE"].includes(pu),$x=pu.indexOf("Linux")>=0,_5=/\bCrOS\b/.test(mu),y5=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()}},iG=class extends y5{_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())}}},rG=class extends y5{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Xh=!_f&&"requestIdleCallback"in window?rG:iG,aG=class{constructor(){this._queue=new Xh}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},hb=class extends mt{constructor(e,t,s,n,o,l,u,h,m){super(),this._rowCount=e,this._optionsService=s,this._charSizeService=n,this._coreService=o,this._coreBrowserService=h,this._renderer=this._register(new ll),this._pausedResizeTask=new aG,this._observerDisposable=this._register(new ll),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 Oe),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new Oe),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new Oe),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new Oe),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new JV((d,p)=>this._renderRows(d,p),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new oG(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(ss(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(u.onResize(()=>this._fullRefresh())),this._register(u.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(l.onDecorationRegistered(()=>this._fullRefresh())),this._register(l.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(u.cols,u.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(u.buffer.y,u.buffer.y,!0))),this._register(m.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(d=>this._registerIntersectionObserver(d,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let s=new e.IntersectionObserver(n=>this._handleIntersectionChange(n[n.length-1]),{threshold:0});s.observe(t),this._observerDisposable.value=ss(()=>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()}};hb=us([Fe(2,yn),Fe(3,vf),Fe(4,lo),Fe(5,fu),Fe(6,_n),Fe(7,Tr),Fe(8,gl)],hb);var oG=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 lG(e,t,s,n){let o=s.buffer.x,l=s.buffer.y;if(!s.buffer.hasScrollback)return dG(o,l,e,t,s,n)+yf(l,t,s,n)+hG(o,l,e,t,s,n);let u;if(l===t)return u=o>e?"D":"C",Qc(Math.abs(o-e),Zc(u,n));u=l>t?"D":"C";let h=Math.abs(l-t),m=uG(l>t?e:o,s)+(h-1)*s.cols+1+cG(l>t?o:e);return Qc(m,Zc(u,n))}function cG(e,t){return e-1}function uG(e,t){return t.cols-e}function dG(e,t,s,n,o,l){return yf(t,n,o,l).length===0?"":Qc(w5(e,t,e,t-io(t,o),!1,o).length,Zc("D",l))}function yf(e,t,s,n){let o=e-io(e,s),l=t-io(t,s),u=Math.abs(o-l)-fG(e,t,s);return Qc(u,Zc(S5(e,t),n))}function hG(e,t,s,n,o,l){let u;yf(t,n,o,l).length>0?u=n-io(n,o):u=t;let h=n,m=mG(e,t,s,n,o,l);return Qc(w5(e,u,s,h,m==="C",o).length,Zc(m,l))}function fG(e,t,s){let n=0,o=e-io(e,s),l=t-io(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 io(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 mG(e,t,s,n,o,l){let u;return yf(s,n,o,l).length>0?u=n-io(n,o):u=t,e<s&&u<=n||e>=s&&u<n?"C":"D"}function S5(e,t){return e>t?"A":"B"}function w5(e,t,s,n,o,l){let u=e,h=t,m="";for(;(u!==s||h!==n)&&h>=0&&h<l.buffer.lines.length;)u+=o?1:-1,o&&u>l.cols-1?(m+=l.buffer.translateBufferLineToString(h,!1,e,u),u=0,e=0,h++):!o&&u<0&&(m+=l.buffer.translateBufferLineToString(h,!1,0,e+1),u=l.cols-1,e=u,h--);return m+l.buffer.translateBufferLineToString(h,!1,e,u)}function Zc(e,t){let s=t?"O":"[";return we.ESC+s+e}function Qc(e,t){e=Math.floor(e);let s="";for(let n=0;n<e;n++)s+=t;return s}var pG=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 M2(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 pg=50,gG=15,bG=50,xG=500,vG=" ",_G=new RegExp(vG,"g"),fb=class extends mt{constructor(e,t,s,n,o,l,u,h,m){super(),this._element=e,this._screenElement=t,this._linkifier=s,this._bufferService=n,this._coreService=o,this._mouseService=l,this._optionsService=u,this._renderService=h,this._coreBrowserService=m,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new hi,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new Oe),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new Oe),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new Oe),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new Oe),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 pG(this._bufferService),this._activeSelectionMode=0,this._register(ss(()=>{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(_G," ")).join(v5?`\r
|
|
173
|
+
`:`
|
|
174
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),$x&&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=M2(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=Px(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,-pg),pg),t/=pg,t/Math.abs(t)+Math.round(t*(gG-1)))}shouldForceSelection(e){return Yh?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(),bG)}_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&&!(Yh&&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<xG&&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=lG(s[0]-1,s[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(n,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,s=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!s){this._oldHasSelection&&this._fireOnSelectionChange(e,t,s);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,s)}_fireOnSelectionChange(e,t,s){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=s,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let s=t;for(let n=0;t>=n;n++){let o=e.loadCell(n,this._workCell).getChars().length;this._workCell.getWidth()===0?s--:o>1&&t!==n&&(s+=o-1)}return s}setSelection(e,t,s){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=s,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,s=!0,n=!0){if(e[0]>=this._bufferService.cols)return;let o=this._bufferService.buffer,l=o.lines.get(e[1]);if(!l)return;let u=o.translateBufferLineToString(e[1],!1),h=this._convertViewportColToCharacterIndex(l,e[0]),m=h,d=e[0]-h,p=0,g=0,b=0,v=0;if(u.charAt(h)===" "){for(;h>0&&u.charAt(h-1)===" ";)h--;for(;m<u.length&&u.charAt(m+1)===" ";)m++}else{let N=e[0],E=e[0];l.getWidth(N)===0&&(p++,N--),l.getWidth(E)===2&&(g++,E++);let A=l.getString(E).length;for(A>1&&(v+=A-1,m+=A-1);N>0&&h>0&&!this._isCharWordSeparator(l.loadCell(N-1,this._workCell));){l.loadCell(N-1,this._workCell);let j=this._workCell.getChars().length;this._workCell.getWidth()===0?(p++,N--):j>1&&(b+=j-1,h-=j-1),h--,N--}for(;E<l.length&&m+1<u.length&&!this._isCharWordSeparator(l.loadCell(E+1,this._workCell));){l.loadCell(E+1,this._workCell);let j=this._workCell.getChars().length;this._workCell.getWidth()===2?(g++,E++):j>1&&(v+=j-1,m+=j-1),m++,E++}}m++;let w=h+d-p+b,k=Math.min(this._bufferService.cols,m-h+p+g-b-v);if(!(!t&&u.slice(h,m).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 A=this._bufferService.cols-E.start;w-=A,k+=A}}}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=M2(s,this._bufferService.cols)}};fb=us([Fe(3,_n),Fe(4,lo),Fe(5,Mx),Fe(6,yn),Fe(7,Ar),Fe(8,Tr)],fb);var D2=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={}}},O2=class{constructor(){this._color=new D2,this._css=new D2}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()}},Rs=Object.freeze((()=>{let e=[rs.toColor("#2e3436"),rs.toColor("#cc0000"),rs.toColor("#4e9a06"),rs.toColor("#c4a000"),rs.toColor("#3465a4"),rs.toColor("#75507b"),rs.toColor("#06989a"),rs.toColor("#d3d7cf"),rs.toColor("#555753"),rs.toColor("#ef2929"),rs.toColor("#8ae234"),rs.toColor("#fce94f"),rs.toColor("#729fcf"),rs.toColor("#ad7fa8"),rs.toColor("#34e2e2"),rs.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:Cs.toCss(n,o,l),rgba:Cs.toRgba(n,o,l)})}for(let s=0;s<24;s++){let n=8+s*10;e.push({css:Cs.toCss(n,n,n),rgba:Cs.toRgba(n,n,n)})}return e})()),Va=rs.toColor("#ffffff"),Ac=rs.toColor("#000000"),L2=rs.toColor("#ffffff"),z2=Ac,xc={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},yG=Va,mb=class extends mt{constructor(e){super(),this._optionsService=e,this._contrastCache=new O2,this._halfContrastCache=new O2,this._onChangeColors=this._register(new Oe),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Va,background:Ac,cursor:L2,cursorAccent:z2,selectionForeground:void 0,selectionBackgroundTransparent:xc,selectionBackgroundOpaque:Xt.blend(Ac,xc),selectionInactiveBackgroundTransparent:xc,selectionInactiveBackgroundOpaque:Xt.blend(Ac,xc),scrollbarSliderBackground:Xt.opacity(Va,.2),scrollbarSliderHoverBackground:Xt.opacity(Va,.4),scrollbarSliderActiveBackground:Xt.opacity(Va,.5),overviewRulerBorder:Va,ansi:Rs.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=Ut(e.foreground,Va),t.background=Ut(e.background,Ac),t.cursor=Xt.blend(t.background,Ut(e.cursor,L2)),t.cursorAccent=Xt.blend(t.background,Ut(e.cursorAccent,z2)),t.selectionBackgroundTransparent=Ut(e.selectionBackground,xc),t.selectionBackgroundOpaque=Xt.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Ut(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Xt.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Ut(e.selectionForeground,T2):void 0,t.selectionForeground===T2&&(t.selectionForeground=void 0),Xt.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Xt.opacity(t.selectionBackgroundTransparent,.3)),Xt.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Xt.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Ut(e.scrollbarSliderBackground,Xt.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Ut(e.scrollbarSliderHoverBackground,Xt.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Ut(e.scrollbarSliderActiveBackground,Xt.opacity(t.foreground,.5)),t.overviewRulerBorder=Ut(e.overviewRulerBorder,yG),t.ansi=Rs.slice(),t.ansi[0]=Ut(e.black,Rs[0]),t.ansi[1]=Ut(e.red,Rs[1]),t.ansi[2]=Ut(e.green,Rs[2]),t.ansi[3]=Ut(e.yellow,Rs[3]),t.ansi[4]=Ut(e.blue,Rs[4]),t.ansi[5]=Ut(e.magenta,Rs[5]),t.ansi[6]=Ut(e.cyan,Rs[6]),t.ansi[7]=Ut(e.white,Rs[7]),t.ansi[8]=Ut(e.brightBlack,Rs[8]),t.ansi[9]=Ut(e.brightRed,Rs[9]),t.ansi[10]=Ut(e.brightGreen,Rs[10]),t.ansi[11]=Ut(e.brightYellow,Rs[11]),t.ansi[12]=Ut(e.brightBlue,Rs[12]),t.ansi[13]=Ut(e.brightMagenta,Rs[13]),t.ansi[14]=Ut(e.brightCyan,Rs[14]),t.ansi[15]=Ut(e.brightWhite,Rs[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]=Ut(e.extendedAnsi[n],Rs[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()}}};mb=us([Fe(0,yn)],mb);function Ut(e,t){if(e!==void 0)try{return rs.toColor(e)}catch{}return t}var SG=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)}},wG=class{constructor(){this._services=new SG,this._services.set(Rx,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let s=gq(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)}},kG={trace:0,debug:1,info:2,warn:3,error:4,off:5},NG="xterm.js: ",pb=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=kG[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?"":NG)+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)}};pb=us([Fe(0,yn)],pb);var B2=class extends mt{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Oe),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Oe),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Oe),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 hu),th=0,gg=2,Rc=class k5{constructor(t,s,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*ht);let o=s||hi.fromCharData([0,F3,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?da(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?da(s&2097151):""}isProtected(t){return this._data[t*ht+2]&536870912}loadCell(t,s){return th=t*ht,s.content=this._data[th+0],s.fg=this._data[th+1],s.bg=this._data[th+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]+=da(s):o&2097151?(this._combined[t]=da(o&2097151)+da(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 hi;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 hi;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*gg<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*gg<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*gg<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 k5(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 m=o-1;m>=0;m--){for(let d=0;d<ht;d++)this._data[(n+m)*ht+d]=u[(s+m)*ht+d];u[(s+m)*ht+2]&268435456&&(this._extendedAttrs[n+m]=t._extendedAttrs[s+m])}else for(let m=0;m<o;m++){for(let d=0;d<ht;d++)this._data[(n+m)*ht+d]=u[(s+m)*ht+d];u[(s+m)*ht+2]&268435456&&(this._extendedAttrs[n+m]=t._extendedAttrs[s+m])}let h=Object.keys(t._combined);for(let m=0;m<h.length;m++){let d=parseInt(h[m],10);d>=s&&(this._combined[d-s+n]=t._combined[d])}}translateToString(t,s,n,o){s=s??0,n=n??this.length,t&&(n=Math.min(n,this.getTrimmedLength())),o&&(o.length=0);let l="";for(;s<n;){let u=this._data[s*ht+0],h=u&2097151,m=u&2097152?this._combined[s]:h?da(h):fa;if(l+=m,o)for(let d=0;d<m.length;++d)o.push(s);s+=u>>22||1}return o&&o.push(s),l}};function CG(e,t,s,n,o,l){let u=[];for(let h=0;h<e.length-1;h++){let m=h,d=e.get(++m);if(!d.isWrapped)continue;let p=[e.get(h)];for(;m<e.length&&d.isWrapped;)p.push(d),d=e.get(++m);if(!l&&n>=h&&n<m){h+=p.length-1;continue}let g=0,b=Jc(p,g,t),v=1,w=0;for(;v<p.length;){let N=Jc(p,v,t),E=N-w,A=s-b,j=Math.min(E,A);p[g].copyCellsFrom(p[v],w,b,j,!1),b+=j,b===s&&(g++,b=0),w+=j,w===N&&(v++,w=0),b===0&&g!==0&&p[g-1].getWidth(s-1)===2&&(p[g].copyCellsFrom(p[g-1],s-1,b++,1,!1),p[g-1].setCell(s-1,o))}p[g].replaceCells(b,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 EG(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 jG(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 TG(e,t,s){let n=[],o=e.map((m,d)=>Jc(e,d,t)).reduce((m,d)=>m+d),l=0,u=0,h=0;for(;h<o;){if(o-h<s){n.push(o-h);break}l+=s;let m=Jc(e,u,t);l>m&&(l-=m,u++);let d=e[u].getWidth(l-1)===2;d&&l--;let p=d?s-1:s;n.push(p),h+=p}return n}function Jc(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 N5=class C5{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=C5._nextId++,this._onDispose=this.register(new Oe),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),no(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};N5._nextId=1;var AG=N5,Os={},Ga=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 I2=4294967295,P2=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=Ga,this.markers=[],this._nullCell=hi.fromCharData([0,F3,1,0]),this._whitespaceCell=hi.fromCharData([0,fa,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Xh,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new B2(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 Gh),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 Gh),this._whitespaceCell}getBlankLine(e,t){return new Rc(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>I2?I2: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 B2(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 Rc(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 Rc(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=CG(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(ws),s);if(n.length>0){let o=EG(this.lines,n);jG(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 Rc(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 m=[h];for(;h.isWrapped&&u>0;)h=this.lines.get(--u),m.unshift(h);if(!s){let j=this.ybase+this.y;if(j>=u&&j<u+m.length)continue}let d=m[m.length-1].getTrimmedLength(),p=TG(m,this._cols,e),g=p.length-m.length,b;this.ybase===0&&this.y!==this.lines.length-1?b=Math.max(0,this.y-this.lines.maxLength+g):b=Math.max(0,this.lines.length-this.lines.maxLength+g);let v=[];for(let j=0;j<g;j++){let T=this.getBlankLine(ws,!0);v.push(T)}v.length>0&&(o.push({start:u+m.length+l,newLines:v}),l+=v.length),m.push(...v);let w=p.length-1,k=p[w];k===0&&(w--,k=p[w]);let N=m.length-g-1,E=d;for(;N>=0;){let j=Math.min(E,k);if(m[w]===void 0)break;if(m[w].copyCellsFrom(m[N],E-j,k-j,j,!0),k-=j,k===0&&(w--,k=p[w]),E-=j,E===0){N--;let T=Math.max(N,0);E=Jc(m,T,this._cols)}}for(let j=0;j<m.length;j++)p[j]<e&&m[j].setCell(p[j],n);let A=g-b;for(;A-- >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 m=this.lines.length,d=m-1,p=0,g=o[p];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+l);let b=0;for(let k=Math.min(this.lines.maxLength-1,m+l-1);k>=0;k--)if(g&&g.start>d+b){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}),b+=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,m+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 AG(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)}},RG=class extends mt{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new Oe),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 P2(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new P2(!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)}},E5=2,j5=1,gb=class extends mt{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new Oe),this.onResize=this._onResize.event,this._onScroll=this._register(new Oe),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,E5),this.rows=Math.max(e.rawOptions.rows||0,j5),this.buffers=this._register(new RG(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))}};gb=us([Fe(0,yn)],gb);var Yo={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:Yh,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},MG=["normal","bold","100","200","300","400","500","600","700","800","900"],DG=class extends mt{constructor(e){super(),this._onOptionChange=this._register(new Oe),this.onOptionChange=this._onOptionChange.event;let t={...Yo};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(ss(()=>{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 Yo))throw new Error(`No option with key "${s}"`);return this.rawOptions[s]},t=(s,n)=>{if(!(s in Yo))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=Yo[e]),!OG(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Yo[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=MG.includes(t)?t:Yo[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 OG(e){return e==="block"||e==="underline"||e==="bar"}function Mc(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]&&Mc(e[n],t-1);return s}var $2=Object.freeze({insertMode:!1}),H2=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),bb=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 Oe),this.onData=this._onData.event,this._onUserInput=this._register(new Oe),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Oe),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Oe),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Mc($2),this.decPrivateModes=Mc(H2)}reset(){this.modes=Mc($2),this.decPrivateModes=Mc(H2)}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))}};bb=us([Fe(0,_n),Fe(1,K3),Fe(2,yn)],bb);var U2={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 bg(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 xg=String.fromCharCode,F2={DEFAULT:e=>{let t=[bg(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${xg(t[0])}${xg(t[1])}${xg(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${bg(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${bg(e,!0)};${e.x};${e.y}${t}`}},xb=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 Oe),this.onProtocolChange=this._onProtocolChange.event;for(let n of Object.keys(U2))this.addProtocol(n,U2[n]);for(let n of Object.keys(F2))this.addEncoding(n,F2[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)}};xb=us([Fe(0,_n),Fe(1,lo),Fe(2,yn)],xb);var vg=[[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]],LG=[[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]],Ms;function zG(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 BG=class{constructor(){if(this.version="6",!Ms){Ms=new Uint8Array(65536),Ms.fill(1),Ms[0]=0,Ms.fill(0,1,32),Ms.fill(0,127,160),Ms.fill(2,4352,4448),Ms[9001]=2,Ms[9002]=2,Ms.fill(2,11904,42192),Ms[12351]=1,Ms.fill(2,44032,55204),Ms.fill(2,63744,64256),Ms.fill(2,65040,65050),Ms.fill(2,65072,65136),Ms.fill(2,65280,65377),Ms.fill(2,65504,65511);for(let e=0;e<vg.length;++e)Ms.fill(0,vg[e][0],vg[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Ms[e]:zG(e,LG)?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=Xa.extractWidth(t);o===0?n=!1:o>s&&(s=o)}return Xa.createPropertyValue(0,s,n)}},Xa=class Sh{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Oe,this.onChange=this._onChange.event;let t=new BG;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,s,n=!1){return(t&16777215)<<3|(s&3)<<1|(n?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let s=0,n=0,o=t.length;for(let l=0;l<o;++l){let u=t.charCodeAt(l);if(55296<=u&&u<=56319){if(++l>=o)return s+this.wcwidth(u);let d=t.charCodeAt(l);56320<=d&&d<=57343?u=(u-55296)*1024+d-56320+65536:s+=this.wcwidth(d)}let h=this.charProperties(u,n),m=Sh.extractWidth(h);Sh.extractShouldJoin(h)&&(m-=Sh.extractWidth(n)),s+=m,n=h}return s}charProperties(t,s){return this._activeProvider.charProperties(t,s)}},IG=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 q2(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 vc=2147483647,PG=256,T5=class vb{constructor(t=32,s=32){if(this.maxLength=t,this.maxSubParamsLength=s,s>PG)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 vb;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 vb(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>vc?vc: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>vc?vc: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,vc):t}},_c=[],$G=class{constructor(){this._state=0,this._active=_c,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=_c}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=_c,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||_c,!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",xf(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=_c,this._id=-1,this._state=0}}},Vn=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,s){this._hitLimit||(this._data+=xf(e,t,s),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(s=>(this._data="",this._hitLimit=!1,s));return this._data="",this._hitLimit=!1,t}},yc=[],HG=class{constructor(){this._handlers=Object.create(null),this._active=yc,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=yc}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=yc,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||yc,!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",xf(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=yc,this._ident=0}},Dc=new T5;Dc.addParam(0);var V2=class{constructor(e){this._handler=e,this._data="",this._params=Dc,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Dc,this._data="",this._hitLimit=!1}put(e,t,s){this._hitLimit||(this._data+=xf(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=Dc,this._data="",this._hitLimit=!1,s));return this._params=Dc,this._data="",this._hitLimit=!1,t}},UG=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}},li=160,FG=(function(){let e=new UG(4095),t=Array.apply(null,Array(256)).map((h,m)=>m),s=(h,m)=>t.slice(h,m),n=s(32,127),o=s(0,24);o.push(25),o.push.apply(o,s(28,32));let l=s(0,14),u;e.setDefault(1,0),e.addMany(n,0,2,0);for(u in l)e.addMany([24,26,153,154],u,3,0),e.addMany(s(128,144),u,3,0),e.addMany(s(144,152),u,3,0),e.add(156,u,0,0),e.add(27,u,11,1),e.add(157,u,4,8),e.addMany([152,158,159],u,0,7),e.add(155,u,11,3),e.add(144,u,11,9);return e.addMany(o,0,3,0),e.addMany(o,1,3,1),e.add(127,1,0,1),e.addMany(o,8,0,8),e.addMany(o,3,3,3),e.add(127,3,0,3),e.addMany(o,4,3,4),e.add(127,4,0,4),e.addMany(o,6,3,6),e.addMany(o,5,3,5),e.add(127,5,0,5),e.addMany(o,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(n,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(s(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(n,7,0,7),e.addMany(o,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(s(64,127),3,7,0),e.addMany(s(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(s(48,60),4,8,4),e.addMany(s(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(s(32,64),6,0,6),e.add(127,6,0,6),e.addMany(s(64,127),6,0,0),e.addMany(s(32,48),3,9,5),e.addMany(s(32,48),5,9,5),e.addMany(s(48,64),5,0,6),e.addMany(s(64,127),5,7,0),e.addMany(s(32,48),4,9,5),e.addMany(s(32,48),1,9,2),e.addMany(s(32,48),2,9,2),e.addMany(s(48,127),2,10,0),e.addMany(s(48,80),1,10,0),e.addMany(s(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(s(96,127),1,10,0),e.add(80,1,11,9),e.addMany(o,9,0,9),e.add(127,9,0,9),e.addMany(s(28,32),9,0,9),e.addMany(s(32,48),9,9,12),e.addMany(s(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(o,11,0,11),e.addMany(s(32,128),11,0,11),e.addMany(s(28,32),11,0,11),e.addMany(o,10,0,10),e.add(127,10,0,10),e.addMany(s(28,32),10,0,10),e.addMany(s(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(s(32,48),10,9,12),e.addMany(o,12,0,12),e.add(127,12,0,12),e.addMany(s(28,32),12,0,12),e.addMany(s(32,48),12,9,12),e.addMany(s(48,64),12,0,11),e.addMany(s(64,127),12,12,13),e.addMany(s(64,127),10,12,13),e.addMany(s(64,127),9,12,13),e.addMany(o,13,13,13),e.addMany(n,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(li,0,2,0),e.add(li,8,5,8),e.add(li,6,0,6),e.add(li,11,0,11),e.add(li,13,13,13),e})(),qG=class extends mt{constructor(e=FG){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 T5,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(ss(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new $G),this._dcsParser=this._register(new HG),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let s=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(s=e.prefix.charCodeAt(0),s&&60>s||s>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let o=0;o<e.intermediates.length;++o){let l=e.intermediates.charCodeAt(o);if(32>l||l>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");s<<=8,s|=l}}if(e.final.length!==1)throw new Error("final must be a single byte");let n=e.final.charCodeAt(0);if(t[0]>n||n>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return s<<=8,s|=n,s}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let s=this._identifier(e,[48,126]);this._escHandlers[s]===void 0&&(this._escHandlers[s]=[]);let n=this._escHandlers[s];return n.push(t),{dispose:()=>{let o=n.indexOf(t);o!==-1&&n.splice(o,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let s=this._identifier(e);this._csiHandlers[s]===void 0&&(this._csiHandlers[s]=[]);let n=this._csiHandlers[s];return n.push(t),{dispose:()=>{let o=n.indexOf(t);o!==-1&&n.splice(o,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,s,n,o){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=s,this._parseStack.transition=n,this._parseStack.chunkPos=o}parse(e,t,s){let n=0,o=0,l=0,u;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,l=this._parseStack.chunkPos+1;else{if(s===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let h=this._parseStack.handlers,m=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(s===!1&&m>-1){for(;m>=0&&(u=h[m](this._params),u!==!0);m--)if(u instanceof Promise)return this._parseStack.handlerPos=m,u}this._parseStack.handlers=[];break;case 4:if(s===!1&&m>-1){for(;m>=0&&(u=h[m](),u!==!0);m--)if(u instanceof Promise)return this._parseStack.handlerPos=m,u}this._parseStack.handlers=[];break;case 6:if(n=e[this._parseStack.chunkPos],u=this._dcsParser.unhook(n!==24&&n!==26,s),u)return u;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(n=e[this._parseStack.chunkPos],u=this._oscParser.end(n!==24&&n!==26,s),u)return u;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,l=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let h=l;h<t;++h){switch(n=e[h],o=this._transitions.table[this.currentState<<8|(n<160?n:li)],o>>4){case 2:for(let b=h+1;;++b){if(b>=t||(n=e[b])<32||n>126&&n<li){this._printHandler(e,h,b),h=b-1;break}if(++b>=t||(n=e[b])<32||n>126&&n<li){this._printHandler(e,h,b),h=b-1;break}if(++b>=t||(n=e[b])<32||n>126&&n<li){this._printHandler(e,h,b),h=b-1;break}if(++b>=t||(n=e[b])<32||n>126&&n<li){this._printHandler(e,h,b),h=b-1;break}}break;case 3:this._executeHandlers[n]?this._executeHandlers[n]():this._executeHandlerFb(n),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:h,code:n,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let m=this._csiHandlers[this._collect<<8|n],d=m?m.length-1:-1;for(;d>=0&&(u=m[d](this._params),u!==!0);d--)if(u instanceof Promise)return this._preserveStack(3,m,d,o,h),u;d<0&&this._csiHandlerFb(this._collect<<8|n,this._params),this.precedingJoinState=0;break;case 8:do switch(n){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(n-48)}while(++h<t&&(n=e[h])>47&&n<60);h--;break;case 9:this._collect<<=8,this._collect|=n;break;case 10:let p=this._escHandlers[this._collect<<8|n],g=p?p.length-1:-1;for(;g>=0&&(u=p[g](),u!==!0);g--)if(u instanceof Promise)return this._preserveStack(4,p,g,o,h),u;g<0&&this._escHandlerFb(this._collect<<8|n),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|n,this._params);break;case 13:for(let b=h+1;;++b)if(b>=t||(n=e[b])===24||n===26||n===27||n>127&&n<li){this._dcsParser.put(e,h,b),h=b-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 b=h+1;;b++)if(b>=t||(n=e[b])<32||n>127&&n<li){this._oscParser.put(e,h,b),h=b-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}}},VG=/^([\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})$/,GG=/^[\da-f]+$/;function G2(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let s=VG.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),GG.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 _g(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 WG(e,t=16){let[s,n,o]=e;return`rgb:${_g(s,t)}/${_g(n,t)}/${_g(o,t)}`}var KG={"(":0,")":1,"*":2,"+":3,"-":1,".":2},ca=131072,W2=10;function K2(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 Y2=5e3,X2=0,YG=class extends mt{constructor(e,t,s,n,o,l,u,h,m=new qG){super(),this._bufferService=e,this._charsetService=t,this._coreService=s,this._logService=n,this._optionsService=o,this._oscLinkService=l,this._coreMouseService=u,this._unicodeService=h,this._parser=m,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new mq,this._utf8Decoder=new pq,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=ws.clone(),this._eraseAttrDataInternal=ws.clone(),this._onRequestBell=this._register(new Oe),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Oe),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Oe),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Oe),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Oe),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Oe),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Oe),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Oe),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Oe),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Oe),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Oe),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Oe),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Oe),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 _b(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(we.BEL,()=>this.bell()),this._parser.setExecuteHandler(we.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(we.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(we.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(we.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(we.BS,()=>this.backspace()),this._parser.setExecuteHandler(we.HT,()=>this.tab()),this._parser.setExecuteHandler(we.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(we.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(_h.IND,()=>this.index()),this._parser.setExecuteHandler(_h.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(_h.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Vn(d=>(this.setTitle(d),this.setIconName(d),!0))),this._parser.registerOscHandler(1,new Vn(d=>this.setIconName(d))),this._parser.registerOscHandler(2,new Vn(d=>this.setTitle(d))),this._parser.registerOscHandler(4,new Vn(d=>this.setOrReportIndexedColor(d))),this._parser.registerOscHandler(8,new Vn(d=>this.setHyperlink(d))),this._parser.registerOscHandler(10,new Vn(d=>this.setOrReportFgColor(d))),this._parser.registerOscHandler(11,new Vn(d=>this.setOrReportBgColor(d))),this._parser.registerOscHandler(12,new Vn(d=>this.setOrReportCursorColor(d))),this._parser.registerOscHandler(104,new Vn(d=>this.restoreIndexedColor(d))),this._parser.registerOscHandler(110,new Vn(d=>this.restoreFgColor(d))),this._parser.registerOscHandler(111,new Vn(d=>this.restoreBgColor(d))),this._parser.registerOscHandler(112,new Vn(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 V2((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"),Y2))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${Y2} 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>ca&&(l=this._parseStack.position+ca)}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<ca&&(this._parseBuffer=new Uint32Array(Math.min(e.length,ca))),u||this._dirtyRowTracker.clearRange(),e.length>ca)for(let d=l;d<e.length;d+=ca){let p=d+ca<e.length?d+ca:e.length,g=typeof e=="string"?this._stringDecoder.decode(e.substring(d,p),this._parseBuffer):this._utf8Decoder.decode(e.subarray(d,p),this._parseBuffer);if(s=this._parser.parse(this._parseBuffer,g))return this._preserveStack(n,o,g,d),this._logSlowResolvingAsync(s),s}else if(!u){let d=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(s=this._parser.parse(this._parseBuffer,d))return this._preserveStack(n,o,d,0),this._logSlowResolvingAsync(s),s}(this._activeBuffer.x!==n||this._activeBuffer.y!==o)&&this._onCursorMove.fire();let h=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),m=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);m<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(m,this._bufferService.rows-1),end:Math.min(h,this._bufferService.rows-1)})}print(e,t,s){let n,o,l=this._charsetService.charset,u=this._optionsService.rawOptions.screenReaderMode,h=this._bufferService.cols,m=this._coreService.decPrivateModes.wraparound,d=this._coreService.modes.insertMode,p=this._curAttrData,g=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&s-t>0&&g.getWidth(this._activeBuffer.x-1)===2&&g.setCellFromCodepoint(this._activeBuffer.x-1,0,1,p);let b=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,b);o=Xa.extractWidth(w);let k=Xa.extractShouldJoin(w),N=k?Xa.extractWidth(b):0;if(b=w,u&&this._onA11yChar.fire(da(n)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+o-N>h){if(m){let E=g,A=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 Rc&&g.copyCellsFrom(E,A,0,N,!1);A<h;)E.setCellFromCodepoint(A++,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 A=o-N;--A>=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=b,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=>K2(s.params[0],this._optionsService.rawOptions.windowOptions)?t(s):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new V2(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Vn(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=Xa.extractWidth(t),o=this._activeBuffer.x-n,l=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(o),u=new Uint32Array(l.length*s),h=0;for(let d=0;d<l.length;){let p=l.codePointAt(d)||0;u[h++]=p,d+=p>65535?2:1}let m=h;for(let d=1;d<s;++d)u.copyWithin(m,0,h),m+=h;return this.print(u,0,m),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(we.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(we.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(we.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(we.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(we.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,Ga),this._charsetService.setgCharset(1,Ga),this._charsetService.setgCharset(2,Ga),this._charsetService.setgCharset(3,Ga);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:m}=this._bufferService,{active:d,alt:p}=h,g=this._optionsService.rawOptions,b=(k,N)=>(u.triggerDataEvent(`${we.ESC}[${t?"":"?"}${k};${N}$y`),!0),v=k=>k?1:2,w=e.params[0];return t?w===2?b(w,4):w===4?b(w,v(u.modes.insertMode)):w===12?b(w,3):w===20?b(w,v(g.convertEol)):b(w,0):w===1?b(w,v(n.applicationCursorKeys)):w===3?b(w,g.windowOptions.setWinLines?m===80?2:m===132?1:0:0):w===6?b(w,v(n.origin)):w===7?b(w,v(n.wraparound)):w===8?b(w,3):w===9?b(w,v(o==="X10")):w===12?b(w,v(g.cursorBlink)):w===25?b(w,v(!u.isCursorHidden)):w===45?b(w,v(n.reverseWraparound)):w===66?b(w,v(n.applicationKeypad)):w===67?b(w,4):w===1e3?b(w,v(o==="VT200")):w===1002?b(w,v(o==="DRAG")):w===1003?b(w,v(o==="ANY")):w===1004?b(w,v(n.sendFocus)):w===1005?b(w,4):w===1006?b(w,v(l==="SGR")):w===1015?b(w,4):w===1016?b(w,v(l==="SGR_PIXELS")):w===1048?b(w,1):w===47||w===1047||w===1049?b(w,v(d===p)):w===2004?b(w,v(n.bracketedPasteMode)):w===2026?b(w,v(n.synchronizedOutput)):b(w,0)}_updateAttrColor(e,t,s,n,o){return t===2?(e|=50331648,e&=-16777216,e|=hu.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(`${we.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,s=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${we.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(`${we.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(!K2(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(`${we.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>W2&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>W2&&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(Z2(l))if(o==="?")t.push({type:0,index:l});else{let u=G2(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=G2(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]);Z2(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,Ga),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(KG[e[0]],Os[e[1]]||Ga),!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 hi;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(`${we.ESC}${u}${we.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)}},_b=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&&(X2=e,e=t,t=X2),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};_b=us([Fe(0,_n)],_b);function Z2(e){return 0<=e&&e<256}var XG=5e7,Q2=12,ZG=50,QG=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 Oe),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>XG)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>=Q2?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>=Q2)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>ZG&&(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()}},yb=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let h=t.addMarker(t.ybase+t.y),m={data:e,id:this._nextId++,lines:[h]};return h.onDispose(()=>this._removeMarkerFromLink(m,h)),this._dataByLinkId.set(m.id,m),m.id}let s=e,n=this._getEntryIdKey(s),o=this._entriesWithId.get(n);if(o)return this.addLineToLink(o.id,t.ybase+t.y),o.id;let l=t.addMarker(t.ybase+t.y),u={id:this._nextId++,key:this._getEntryIdKey(s),data:s,lines:[l]};return l.onDispose(()=>this._removeMarkerFromLink(u,l)),this._entriesWithId.set(u.key,u),this._dataByLinkId.set(u.id,u),u.id}addLineToLink(e,t){let s=this._dataByLinkId.get(e);if(s&&s.lines.every(n=>n.line!==t)){let n=this._bufferService.buffer.addMarker(t);s.lines.push(n),n.onDispose(()=>this._removeMarkerFromLink(s,n))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let s=e.lines.indexOf(t);s!==-1&&(e.lines.splice(s,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};yb=us([Fe(0,_n)],yb);var J2=!1,JG=class extends mt{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new ll),this._onBinary=this._register(new Oe),this.onBinary=this._onBinary.event,this._onData=this._register(new Oe),this.onData=this._onData.event,this._onLineFeed=this._register(new Oe),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Oe),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Oe),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Oe),this._instantiationService=new wG,this.optionsService=this._register(new DG(e)),this._instantiationService.setService(yn,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(gb)),this._instantiationService.setService(_n,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(pb)),this._instantiationService.setService(K3,this._logService),this.coreService=this._register(this._instantiationService.createInstance(bb)),this._instantiationService.setService(lo,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(xb)),this._instantiationService.setService(W3,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Xa)),this._instantiationService.setService(vq,this.unicodeService),this._charsetService=this._instantiationService.createInstance(IG),this._instantiationService.setService(xq,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(yb),this._instantiationService.setService(Y3,this._oscLinkService),this._inputHandler=this._register(new YG(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Xs.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Xs.forward(this._bufferService.onResize,this._onResize)),this._register(Xs.forward(this.coreService.onData,this._onData)),this._register(Xs.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 QG((t,s)=>this._inputHandler.parse(t,s))),this._register(Xs.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Oe),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&&!J2&&(this._logService.warn("writeSync is unreliable and will be removed soon."),J2=!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,E5),t=Math.max(t,j5),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(q2.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(q2(this._bufferService),!1))),this._windowsWrappingHeuristics.value=ss(()=>{for(let t of e)t.dispose()})}}},eW={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 tW(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=we.ESC+"OA":o.key=we.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?o.key=we.ESC+"OD":o.key=we.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?o.key=we.ESC+"OC":o.key=we.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?o.key=we.ESC+"OB":o.key=we.ESC+"[B");break;case 8:o.key=e.ctrlKey?"\b":we.DEL,e.altKey&&(o.key=we.ESC+o.key);break;case 9:if(e.shiftKey){o.key=we.ESC+"[Z";break}o.key=we.HT,o.cancel=!0;break;case 13:o.key=e.altKey?we.ESC+we.CR:we.CR,o.cancel=!0;break;case 27:o.key=we.ESC,e.altKey&&(o.key=we.ESC+we.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;l?o.key=we.ESC+"[1;"+(l+1)+"D":t?o.key=we.ESC+"OD":o.key=we.ESC+"[D";break;case 39:if(e.metaKey)break;l?o.key=we.ESC+"[1;"+(l+1)+"C":t?o.key=we.ESC+"OC":o.key=we.ESC+"[C";break;case 38:if(e.metaKey)break;l?o.key=we.ESC+"[1;"+(l+1)+"A":t?o.key=we.ESC+"OA":o.key=we.ESC+"[A";break;case 40:if(e.metaKey)break;l?o.key=we.ESC+"[1;"+(l+1)+"B":t?o.key=we.ESC+"OB":o.key=we.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(o.key=we.ESC+"[2~");break;case 46:l?o.key=we.ESC+"[3;"+(l+1)+"~":o.key=we.ESC+"[3~";break;case 36:l?o.key=we.ESC+"[1;"+(l+1)+"H":t?o.key=we.ESC+"OH":o.key=we.ESC+"[H";break;case 35:l?o.key=we.ESC+"[1;"+(l+1)+"F":t?o.key=we.ESC+"OF":o.key=we.ESC+"[F";break;case 33:e.shiftKey?o.type=2:e.ctrlKey?o.key=we.ESC+"[5;"+(l+1)+"~":o.key=we.ESC+"[5~";break;case 34:e.shiftKey?o.type=3:e.ctrlKey?o.key=we.ESC+"[6;"+(l+1)+"~":o.key=we.ESC+"[6~";break;case 112:l?o.key=we.ESC+"[1;"+(l+1)+"P":o.key=we.ESC+"OP";break;case 113:l?o.key=we.ESC+"[1;"+(l+1)+"Q":o.key=we.ESC+"OQ";break;case 114:l?o.key=we.ESC+"[1;"+(l+1)+"R":o.key=we.ESC+"OR";break;case 115:l?o.key=we.ESC+"[1;"+(l+1)+"S":o.key=we.ESC+"OS";break;case 116:l?o.key=we.ESC+"[15;"+(l+1)+"~":o.key=we.ESC+"[15~";break;case 117:l?o.key=we.ESC+"[17;"+(l+1)+"~":o.key=we.ESC+"[17~";break;case 118:l?o.key=we.ESC+"[18;"+(l+1)+"~":o.key=we.ESC+"[18~";break;case 119:l?o.key=we.ESC+"[19;"+(l+1)+"~":o.key=we.ESC+"[19~";break;case 120:l?o.key=we.ESC+"[20;"+(l+1)+"~":o.key=we.ESC+"[20~";break;case 121:l?o.key=we.ESC+"[21;"+(l+1)+"~":o.key=we.ESC+"[21~";break;case 122:l?o.key=we.ESC+"[23;"+(l+1)+"~":o.key=we.ESC+"[23~";break;case 123:l?o.key=we.ESC+"[24;"+(l+1)+"~":o.key=we.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=we.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?o.key=we.DEL:e.keyCode===219?o.key=we.ESC:e.keyCode===220?o.key=we.FS:e.keyCode===221&&(o.key=we.GS);else if((!s||n)&&e.altKey&&!e.metaKey){let u=eW[e.keyCode]?.[e.shiftKey?1:0];if(u)o.key=we.ESC+u;else if(e.keyCode>=65&&e.keyCode<=90){let h=e.ctrlKey?e.keyCode-64:e.keyCode+32,m=String.fromCharCode(h);e.shiftKey&&(m=m.toUpperCase()),o.key=we.ESC+m}else if(e.keyCode===32)o.key=we.ESC+(e.ctrlKey?we.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let h=e.code.slice(3,4);e.shiftKey||(h=h.toLowerCase()),o.key=we.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=we.US),e.key==="@"&&(o.key=we.NUL));break}return o}var gs=0,sW=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Xh,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Xh,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||(gs=this._search(t),gs===-1)||this._getKey(this._array[gs])!==t)return!1;do if(this._array[gs]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(gs),!0;while(++gs<this._array.length&&this._getKey(this._array[gs])===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&&(gs=this._search(e),!(gs<0||gs>=this._array.length)&&this._getKey(this._array[gs])===e))do yield this._array[gs];while(++gs<this._array.length&&this._getKey(this._array[gs])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(gs=this._search(e),!(gs<0||gs>=this._array.length)&&this._getKey(this._array[gs])===e))do t(this._array[gs]);while(++gs<this._array.length&&this._getKey(this._array[gs])===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}},yg=0,ek=0,nW=class extends mt{constructor(){super(),this._decorations=new sW(e=>e?.marker.line),this._onDecorationRegistered=this._register(new Oe),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Oe),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(ss(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new iW(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=>{yg=o.options.x??0,ek=yg+(o.options.width??1),e>=yg&&e<ek&&(!s||(o.options.layer??"bottom")===s)&&n(o)})}},iW=class extends ma{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Oe),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Oe),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=rs.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=rs.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},rW=1e3,aW=class{constructor(e,t=rW){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)}},tk=20,Zh=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 aW(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(`
|
|
175
|
+
`))),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(ot(o,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(ss(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<tk+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
176
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===tk+1&&(this._liveRegion.textContent+=H0.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let s=this._terminal.buffer,n=s.lines.length.toString();for(let o=e;o<=t;o++){let l=s.lines.get(s.ydisp+o),u=[],h=l?.translateToString(!0,void 0,void 0,u)||"",m=(s.ydisp+o+1).toString(),d=this._rowElements[o];d&&(h.length===0?(d.textContent=" ",this._rowColumns.set(d,[0,1])):(d.textContent=h,this._rowColumns.set(d,u)),d.setAttribute("aria-posinset",m),d.setAttribute("aria-setsize",n),this._alignRowWidth(d))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let s=e.target,n=this._rowElements[t===0?1:this._rowElements.length-2],o=s.getAttribute("aria-posinset"),l=t===0?"1":`${this._terminal.buffer.lines.length}`;if(o===l||e.relatedTarget!==n)return;let u,h;if(t===0?(u=s,h=this._rowElements.pop(),this._rowContainer.removeChild(h)):(u=this._rowElements.shift(),h=s,this._rowContainer.removeChild(u)),u.removeEventListener("focus",this._topBoundaryFocusListener),h.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let m=this._createAccessibilityTreeNode();this._rowElements.unshift(m),this._rowContainer.insertAdjacentElement("afterbegin",m)}else{let m=this._createAccessibilityTreeNode();this._rowElements.push(m),this._rowContainer.appendChild(m)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},s={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(s.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===s.node&&t.offset>s.offset)&&([t,s]=[s,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let n=this._rowElements.slice(-1)[0];if(s.node.compareDocumentPosition(n)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(s={node:n,offset:n.textContent?.length??0}),!this._rowContainer.contains(s.node))return;let o=({node:h,offset:m})=>{let d=h instanceof Text?h.parentNode:h,p=parseInt(d?.getAttribute("aria-posinset"),10)-1;if(isNaN(p))return console.warn("row is invalid. Race condition?"),null;let g=this._rowColumns.get(d);if(!g)return console.warn("columns is null. Race condition?"),null;let b=m<g.length?g[m]:g.slice(-1)[0]+1;return b>=this._terminal.cols&&(++p,b=0),{row:p,column:b}},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})`}};Zh=us([Fe(1,Rx),Fe(2,Tr),Fe(3,Ar)],Zh);var Sb=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 Oe),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Oe),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(ss(()=>{no(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(ot(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(ot(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(ot(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(ot(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let s=e.composedPath();for(let n=0;n<s.length;n++){let o=s[n];if(o.classList.contains("xterm"))break;if(o.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(n=>{n?.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let s=!1;for(let[n,o]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(n)&&(s=this._checkLinkProviderResult(n,e,s)):o.provideLinks(e.y,l=>{if(this._isMouseOut)return;let u=l?.map(h=>({link:h}));this._activeProviderReplies?.set(n,u),s=this._checkLinkProviderResult(n,e,s),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let s=new Set;for(let n=0;n<t.size;n++){let o=t.get(n);if(o)for(let l=0;l<o.length;l++){let u=o[l],h=u.link.range.start.y<e?0:u.link.range.start.x,m=u.link.range.end.y>e?this._bufferService.cols:u.link.range.end.x;for(let d=h;d<=m;d++){if(s.has(d)){o.splice(l--,1);break}s.add(d)}}}}_checkLinkProviderResult(e,t,s){if(!this._activeProviderReplies)return s;let n=this._activeProviderReplies.get(e),o=!1;for(let l=0;l<e;l++)(!this._activeProviderReplies.has(l)||this._activeProviderReplies.get(l))&&(o=!0);if(!o&&n){let l=n.find(u=>this._linkAtPosition(u.link,t));l&&(s=!0,this._handleNewLink(l))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!s)for(let l=0;l<this._activeProviderReplies.size;l++){let u=this._activeProviderReplies.get(l)?.find(h=>this._linkAtPosition(h.link,t));if(u){s=!0,this._handleNewLink(u);break}}return s}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&oW(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,no(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}}};Sb=us([Fe(1,Mx),Fe(2,Ar),Fe(3,_n),Fe(4,Z3)],Sb);function oW(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 lW=class extends JG{constructor(e={}){super(e),this._linkifier=this._register(new ll),this.browser=g5,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new ll),this._onCursorMove=this._register(new Oe),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Oe),this.onKey=this._onKey.event,this._onRender=this._register(new Oe),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new Oe),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Oe),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Oe),this.onBell=this._onBell.event,this._onFocus=this._register(new Oe),this._onBlur=this._register(new Oe),this._onA11yCharEmitter=this._register(new Oe),this._onA11yTabEmitter=this._register(new Oe),this._onWillOpen=this._register(new Oe),this._setup(),this._decorationService=this._instantiationService.createInstance(nW),this._instantiationService.setService(fu,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(ZV),this._instantiationService.setService(Z3,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(F0)),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(Xs.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Xs.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Xs.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Xs.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(ss(()=>{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=Xt.toColorRGB(s==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[s]);this.coreService.triggerDataEvent(`${we.ESC}]${n};${WG(o)}${m5.ST}`);break;case 1:if(s==="ansi")this._themeService.modifyColors(l=>l.ansi[t.index]=Cs.toColor(...t.color));else{let l=s;this._themeService.modifyColors(u=>u[l]=Cs.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(Zh,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(we.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(we.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(ot(this.element,"copy",t=>{this.hasSelection()&&hq(t,this._selectionService)}));let e=t=>fq(t,this.textarea,this.coreService,this.optionsService);this._register(ot(this.textarea,"paste",e)),this._register(ot(this.element,"paste",e)),b5?this._register(ot(this.element,"mousedown",t=>{t.button===2&&d2(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(ot(this.element,"contextmenu",t=>{d2(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),$x&&this._register(ot(this.element,"auxclick",t=>{t.button===1&&U3(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(ot(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(ot(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(ot(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(ot(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(ot(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(ot(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(ot(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(ot(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",$0.get()),_5||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(YV,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Tr,this._coreBrowserService),this._register(ot(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(ot(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(ub,this._document,this._helperContainer),this._instantiationService.setService(vf,this._charSizeService),this._themeService=this._instantiationService.createInstance(mb),this._instantiationService.setService(gl,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Kh),this._instantiationService.setService(X3,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(hb,this.rows,this.screenElement)),this._instantiationService.setService(Ar,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(ob,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(db),this._instantiationService.setService(Mx,this._mouseService);let n=this._linkifier.value=this._register(this._instantiationService.createInstance(Sb,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(rb,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(fb,this.element,this.screenElement,n)),this._instantiationService.setService(yq,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(Xs.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(ab,this.screenElement)),this._register(ot(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(Zh,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Wh,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Wh,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(cb,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function s(l){let u=e._mouseService.getMouseReportCoords(l,e.screenElement);if(!u)return!1;let h,m;switch(l.overrideType||l.type){case"mousemove":m=32,l.buttons===void 0?(h=3,l.button!==void 0&&(h=l.button<3?l.button:3)):h=l.buttons&1?0:l.buttons&4?1:l.buttons&2?2:3;break;case"mouseup":m=0,h=l.button<3?l.button:3;break;case"mousedown":m=1,h=l.button<3?l.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(l)===!1)return!1;let d=l.deltaY;if(d===0||e.coreMouseService.consumeWheelEvent(l,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;m=d<0?0:1,h=4;break;default:return!1}return m===void 0||h===void 0||h>4?!1:e.coreMouseService.triggerMouseEvent({col:u.col,row:u.row,x:u.x,y:u.y,button:h,action:m,ctrl:l.ctrlKey,alt:l.altKey,shift:l.shiftKey})}let n={mouseup:null,wheel:null,mousedrag:null,mousemove:null},o={mouseup:l=>(s(l),l.buttons||(this._document.removeEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.removeEventListener("mousemove",n.mousedrag)),this.cancel(l)),wheel:l=>(s(l),this.cancel(l,!0)),mousedrag:l=>{l.buttons&&s(l)},mousemove:l=>{l.buttons||s(l)}};this._register(this.coreMouseService.onProtocolChange(l=>{l?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(l)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),l&8?n.mousemove||(t.addEventListener("mousemove",o.mousemove),n.mousemove=o.mousemove):(t.removeEventListener("mousemove",n.mousemove),n.mousemove=null),l&16?n.wheel||(t.addEventListener("wheel",o.wheel,{passive:!1}),n.wheel=o.wheel):(t.removeEventListener("wheel",n.wheel),n.wheel=null),l&2?n.mouseup||(n.mouseup=o.mouseup):(this._document.removeEventListener("mouseup",n.mouseup),n.mouseup=null),l&4?n.mousedrag||(n.mousedrag=o.mousedrag):(this._document.removeEventListener("mousemove",n.mousedrag),n.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(ot(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(ot(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=we.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){H3(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=tW(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===we.ETX||s.key===we.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)&&(cW(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(we.ESC+"[I"):this.coreService.triggerDataEvent(we.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(`${we.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(`${we.ESC}[6;${o};${n}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function cW(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var uW=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)}},dW=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 hi)}translateToString(e,t,s){return this._line.translateToString(e,t,s)}},sk=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 dW(t)}getNullCell(){return new hi}},hW=class extends mt{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Oe),this.onBufferChange=this._onBufferChange.event,this._normal=new sk(this._core.buffers.normal,"normal"),this._alternate=new sk(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)}},fW=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)}},mW=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}},pW=["cols","rows"],Pi=0,gW=class extends mt{constructor(e){super(),this._core=this._register(new lW(e)),this._addonManager=this._register(new uW),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(pW.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 fW(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new mW(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 hW(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
|
|
177
|
+
`,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 $0.get()},set promptLabel(e){$0.set(e)},get tooMuchOutput(){return H0.get()},set tooMuchOutput(e){H0.set(e)}}}_verifyIntegers(...e){for(Pi of e)if(Pi===1/0||isNaN(Pi)||Pi%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Pi of e)if(Pi&&(Pi===1/0||isNaN(Pi)||Pi%1!==0||Pi<0))throw new Error("This API only accepts positive integers")}};const nk={connecting:"bg-amber-500",running:"bg-emerald-500",exited:"bg-muted-foreground/40",error:"bg-red-500"};function A5({sessionId:e,active:t,toolbarExtra:s}){const n=y.useRef(null),o=y.useRef(null),l=y.useRef(null),u=y.useRef(null),[h,m]=y.useState("Local workspace"),[d,p]=y.useState("connecting"),[g,b]=y.useState("Opening shell"),v=ln(),w=y.useCallback(()=>{const N=l.current;if(!N)return;N.fit();const E=N.proposeDimensions();if(!E)return;if(v){CD(e,E.cols,E.rows);return}const A=u.current;A?.readyState===WebSocket.OPEN&&A.send(JSON.stringify({cols:E.cols,rows:E.rows,type:"resize"}))},[v,e]);y.useEffect(()=>{if(!n.current)return;const N=new gW({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"}}),E=new oq;N.loadAddon(E),N.open(n.current),o.current=N,l.current=E;let A;if(v){let T=null,P=!1;const z=N.onData(L=>{kD(e,L)});jD(e,L=>N.write(L)).then(L=>{if(P){L();return}T=L,p("running"),b("Shell connected"),ND(e),w()},L=>{P||(p("error"),b(L instanceof Error?L.message:String(L)))}),A=()=>{P=!0,z.dispose(),T?.()}}else{const T=new WebSocket(bW(e));u.current=T;const P=N.onData(z=>{T.readyState===WebSocket.OPEN&&T.send(JSON.stringify({data:z,type:"input"}))});T.addEventListener("open",()=>{p("running"),b("Shell connected"),w()}),T.addEventListener("message",z=>{const L=xW(z.data);if(L){if(L.type==="output"){N.write(L.data);return}if(L.type==="error"){p("error"),b(L.error);return}p(L.state==="idle"?"connecting":L.state),L.cwd&&m(L.cwd),b(L.error??L.shell??"Shell connected")}}),T.addEventListener("close",()=>{p(z=>z==="exited"?z:"exited"),b("Socket closed")}),T.addEventListener("error",()=>{p("error"),b("Terminal socket error")}),A=()=>{P.dispose(),T.close(),u.current=null}}window.addEventListener("resize",w),window.setTimeout(w,0);const j=new ResizeObserver(()=>w());return j.observe(n.current),()=>{window.removeEventListener("resize",w),j.disconnect(),A(),N.dispose(),o.current=null,l.current=null}},[e,w,v]),y.useEffect(()=>{if(!t)return;const N=window.setTimeout(()=>{w(),o.current?.focus()},0);return()=>window.clearTimeout(N)},[t,w]);const k=y.useCallback(N=>{if(v)return;const E=u.current;if(!E||E.readyState!==WebSocket.OPEN)return;const A=l.current?.proposeDimensions();E.send(JSON.stringify({cols:A?.cols,rows:A?.rows,...N}))},[v]);return r.jsxs("section",{className:de("flex h-full min-h-0 flex-col bg-[#090909] text-white",!t&&"hidden"),children:[r.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-between gap-3 border-b border-white/10 bg-[#111111] px-4 py-2",children:[r.jsx("div",{className:"min-w-0",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"relative flex size-2.5 shrink-0 items-center justify-center",title:d,children:[d==="connecting"&&r.jsx("span",{className:de("absolute inline-flex size-full animate-ping rounded-full opacity-60",nk[d])}),r.jsx("span",{className:de("relative inline-flex size-2 rounded-full",nk[d])})]}),r.jsxs("span",{className:"truncate font-mono text-[11px] text-white/55",children:[h," · ",g]})]})}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(J,{"aria-label":"Restart terminal",className:"text-white/60 hover:bg-white/10 hover:text-white",size:"icon-sm",variant:"ghost",onClick:()=>k({type:"restart"}),title:"Restart terminal",type:"button",children:r.jsx(tu,{})}),r.jsx(J,{"aria-label":"Stop terminal",className:"text-white/60 hover:bg-white/10 hover:text-white",size:"icon-sm",variant:"ghost",onClick:()=>k({type:"stop"}),title:"Stop terminal",type:"button",children:r.jsx(to,{})}),s]})]}),r.jsx("div",{"aria-label":"terminal viewport",className:"min-h-0 flex-1 overflow-hidden px-3 py-0.5",children:r.jsx("div",{className:"h-full w-full",ref:n})})]})}function bW(e){const t=window.location.protocol==="https:"?"wss:":"ws:",s=encodeURIComponent(e);return`${t}//${window.location.host}/api/terminal/socket?id=${s}`}function xW(e){if(typeof e!="string")return null;try{const t=JSON.parse(e);return typeof t?.type=="string"?t:null}catch{return null}}function vW({serviceName:e,active:t}){const[s,n]=y.useState(null),[o,l]=y.useState(null),[u,h]=y.useState(!1),m=y.useRef(!1),d=y.useRef(!0);y.useEffect(()=>(d.current=!0,()=>{d.current=!1}),[]),y.useEffect(()=>{!t||m.current||(m.current=!0,(async()=>{try{const b=await oh({serviceName:e});d.current&&n(b.id)}catch(b){d.current&&(l(b instanceof Error?b.message:String(b)),m.current=!1)}})())},[t,e]);const p=r.jsx(J,{"aria-label":u?"Exit fullscreen terminal":"Expand terminal",className:"text-white/60 hover:bg-white/10 hover:text-white",onClick:()=>h(b=>!b),size:"icon-sm",title:u?"Exit fullscreen":"Expand",type:"button",variant:"ghost",children:u?r.jsx(AN,{}):r.jsx(jN,{})}),g=o?r.jsxs("div",{className:"p-3 font-mono text-[11px] text-destructive",children:["Could not open terminal: ",o]}):s?r.jsx(A5,{active:t,sessionId:s,toolbarExtra:p}):r.jsx("div",{className:"p-3 font-mono text-[11px] text-muted-foreground",children:"Opening terminal…"});return u&&t?r.jsx(Ax,{onClose:()=>h(!1),title:`Terminal — ${e}`,children:g}):r.jsx("div",{className:de("h-[60vh] min-h-[24rem] overflow-hidden rounded-md border border-border",!t&&"hidden"),children:g})}const _W=500;function yW(e){const[t,s]=y.useState(),[n,o]=y.useState([]),[l,u]=y.useState(),[h,m]=y.useState(!1),d=y.useRef(void 0);y.useEffect(()=>{d.current=void 0,s(void 0),o([]);const g=new EventSource(`/api/services/${encodeURIComponent(e)}/test/stream`),b=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(-_W))}catch{}};return g.addEventListener("status",b),g.addEventListener("output",b),()=>g.close()},[e]);const p=y.useCallback(async g=>{m(!0),u(void 0);try{await aO(e,g)}catch(b){u(b instanceof Error?b.message:String(b))}finally{m(!1)}},[e]);return{run:t,lines:n,error:l,starting:h,start:p}}const SW={running:"secondary",passed:"success",failed:"error",error:"error"},wW={running:"Running",passed:"Passed",failed:"Failed",error:"Error"};function kW({serviceName:e}){const{run:t,lines:s,error:n,starting:o,start:l}=yW(e),[u,h]=y.useState(""),m=t?.status==="running"||o,d=t?.status==="failed"||t?.status==="error";return r.jsxs("div",{className:"space-y-2",children:[r.jsxs("form",{className:"flex items-center gap-2",onSubmit:p=>{p.preventDefault(),m||l(u.trim()||void 0)},children:[r.jsx(gt,{className:"h-7 flex-1 text-[11px]",disabled:m,onChange:p=>h(p.target.value),placeholder:"Optional test pattern (e.g. config-store)",value:u}),r.jsx(J,{disabled:m,size:"sm",type:"submit",children:m?"Running…":"Run tests"})]}),n?r.jsx("div",{className:"text-red-600",children:n}):null,t?r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-muted-foreground",children:[r.jsx(et,{size:"small",variant:SW[t.status],children:wW[t.status]}),r.jsx("code",{className:"font-mono text-[11px]",children:t.command}),t.failingCount>0?r.jsxs("span",{children:["· ",t.failingCount," failing"]}):null,t.exitCode!=null?r.jsxs("span",{children:["· exit ",t.exitCode]}):null]}):r.jsx("div",{className:"text-muted-foreground",children:"No test runs yet."}),s.length>0?r.jsx("pre",{className:"max-h-72 overflow-auto whitespace-pre-wrap break-all rounded bg-background p-2 font-mono text-[11px]",children:s.map((p,g)=>r.jsx("div",{className:de(p.stream==="stderr"&&"text-red-500"),children:p.text},g))}):null,d?r.jsxs("div",{className:"rounded border border-border bg-muted/40 p-2",children:["Failures were piped into the"," ",r.jsx("a",{className:"font-medium underline",href:"/errors",children:"Error Inbox"})," ","— open an incident there to copy a debugging prompt for your agent."]}):null]})}function NW({serviceName:e,status:t,health:s,timeline:n,onRefresh:o}){const[l,u]=sl("service-detail:tab","metrics"),h=s?.processTree?.processes??[];return r.jsxs("div",{className:"border-t border-border bg-muted/30 px-3 py-2 text-xs",children:[r.jsxs("div",{className:"mb-2 flex gap-1",children:[r.jsx(Ua,{active:l==="logs",onClick:()=>u("logs"),children:"Logs"}),r.jsxs(Ua,{active:l==="processes",onClick:()=>u("processes"),children:["Processes ",h.length?r.jsx(et,{variant:"secondary",size:"small",children:h.length}):null]}),r.jsx(Ua,{active:l==="metrics",onClick:()=>u("metrics"),children:"Metrics"}),r.jsxs(Ua,{active:l==="http",onClick:()=>u("http"),children:["HTTP",t?.inspector?.enabled?r.jsx(et,{variant:"success",size:"small",children:"on"}):null]}),r.jsx(Ua,{active:l==="env",onClick:()=>u("env"),children:"Env"}),r.jsx(Ua,{active:l==="tests",onClick:()=>u("tests"),children:"Tests"}),r.jsx(Ua,{active:l==="terminal",onClick:()=>u("terminal"),children:"Terminal"})]}),l==="processes"?r.jsx(iq,{rows:h,running:t?.state==="running"}):null,l==="metrics"?r.jsx(QF,{serviceName:e}):null,l==="http"?r.jsx(YF,{serviceName:e,status:t,timeline:n,onRefresh:o}):null,l==="env"?r.jsx(KF,{serviceName:e}):null,l==="tests"?r.jsx(kW,{serviceName:e}):null,l==="logs"?r.jsx($F,{serviceName:e}):null,r.jsx(vW,{active:l==="terminal",serviceName:e},e)]})}function Ua({active:e,onClick:t,children:s}){return r.jsx("button",{className:de("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 CW={high:"success",medium:"warning",low:"secondary"};function EW({onClose:e,onRefresh:t}){const s=$s(),{sendToAgent:n}=It(),[o,l]=y.useState("url"),[u,h]=y.useState(""),[m,d]=y.useState(!1),[p,g]=y.useState(null),[b,v]=y.useState(null),[w,k]=y.useState([]),[N,E]=y.useState([]),[A,j]=y.useState(null),T=A?.kind==="docker-compose"?N.find(R=>R.composeService===A.composeService):void 0;async function P(){if(u.trim()){d(!0),g(null);try{const R=await V8(u.trim());v(R.profile),k(R.proposals),E(R.databases),j(R.proposals[0]??null),R.proposals.length===0&&g("Cloned, but couldn't detect how to run this repo. Refine with AI or add it manually."),l("review")}catch(R){g(R instanceof Error?R.message:String(R))}finally{d(!1)}}}function z(){n({prompt:`Onboard this repository and register it as a NoMoreIDE service: ${u.trim()}
|
|
178
|
+
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 L(R){if(A){d(!0),g(null);try{await G8(A,R,T),await t(),s.success(`${A.name} registered${T?" (+ database)":""}${R?" and starting":""}.`),e()}catch(D){g(D instanceof Error?D.message:String(D))}finally{d(!1)}}}return r.jsxs(Kn,{icon:r.jsx(xn,{}),onClose:e,size:"lg",title:"Add from GitHub",children:[o==="url"?r.jsx(jW,{url:u,busy:m,error:p,onChange:h,onScan:P,onRefine:z}):null,o==="review"&&b?r.jsx(TW,{profile:b,proposals:w,selected:A,database:T,error:p,onSelect:j,onEdit:j,onBack:()=>l("url"),onRefine:z,onContinue:()=>l("install")}):null,o==="install"&&A?r.jsx(RW,{proposal:A,busy:m,error:p,onBack:()=>l("review"),onRegister:L}):null]})}function jW({url:e,busy:t,error:s,onChange:n,onScan:o,onRefine:l}){return r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Paste a repository URL. NoMoreIDE clones it, detects how it runs, and proposes a service."}),r.jsx(gt,{autoFocus:!0,placeholder:"https://github.com/owner/repo",value:e,onChange:u=>n(u.target.value),onKeyDown:u=>{u.key==="Enter"&&!t&&o()}}),s?r.jsx("p",{className:"text-sm text-destructive",children:s}):null,r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs(J,{variant:"ghost",size:"sm",onClick:l,disabled:!e.trim(),children:[r.jsx(Ci,{className:"size-3.5"}),"Refine with AI"]}),r.jsxs(J,{onClick:o,disabled:t||!e.trim(),children:[t?r.jsx(Et,{className:"size-4 animate-spin"}):r.jsx(xn,{className:"size-4"}),t?"Cloning…":"Clone & detect"]})]})]})}function TW({profile:e,proposals:t,selected:s,database:n,error:o,onSelect:l,onEdit:u,onBack:h,onRefine:m,onContinue:d}){return r.jsxs("div",{className:"flex flex-col gap-4",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[r.jsx("span",{className:"text-sm font-medium",children:e.name}),e.languages.map(p=>r.jsx(et,{variant:"outline",size:"small",label:p},p))]}),o?r.jsx("p",{className:"text-sm text-destructive",children:o}):null,t.length>0?r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsxs("span",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:["Detected service",t.length>1?"s":""]}),t.map(p=>{const g=s?.name===p.name;return r.jsxs("button",{type:"button",onClick:()=>l(p),className:`rounded-md border px-3 py-2 text-left text-sm transition-colors ${g?"border-primary bg-primary/5":"border-border hover:bg-muted/50"}`,children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"font-medium",children:p.name}),r.jsx(et,{variant:CW[p.confidence],size:"small",label:p.confidence})]}),r.jsx("div",{className:"mt-0.5 font-mono text-xs text-muted-foreground",children:p.kind==="docker-compose"?`compose · ${p.composeService}`:p.command}),r.jsx("div",{className:"text-[11px] text-muted-foreground",children:p.reason})]},p.name)})]}):null,s?r.jsx(AW,{proposal:s,onChange:u}):null,n?r.jsxs("div",{className:"flex items-center gap-1.5 rounded-md border border-border bg-muted/30 px-2.5 py-1.5 text-xs text-muted-foreground",children:[r.jsx(fi,{className:"size-3.5"}),r.jsxs("span",{children:["Also registers database ",r.jsx("span",{className:"font-medium",children:n.name})," (",n.engine,") so it shows in the Database tab."]})]}):null,e.envKeys.length>0?r.jsxs("div",{className:"text-xs text-muted-foreground",children:[r.jsx("span",{className:"font-medium",children:"Env from .env.example:"})," ",e.envKeys.join(", ")]}):null,e.readmeExcerpt?r.jsxs("details",{className:"rounded-md border border-border bg-muted/30 p-2 text-xs",children:[r.jsx("summary",{className:"cursor-pointer font-medium",children:"README excerpt"}),r.jsx("pre",{className:"mt-2 max-h-40 overflow-auto whitespace-pre-wrap font-mono",children:e.readmeExcerpt})]}):null,r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs(J,{variant:"ghost",size:"sm",onClick:h,children:[r.jsx(eu,{className:"size-3.5"}),"Back"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(J,{variant:"outline",size:"sm",onClick:m,children:[r.jsx(Ci,{className:"size-3.5"}),"Refine with AI"]}),r.jsx(J,{onClick:d,disabled:!s,children:"Continue"})]})]})]})}function AW({proposal:e,onChange:t}){return r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsx(Oc,{label:"Service name",children:r.jsx(gt,{value:e.name,onChange:s=>t({...e,name:s.target.value})})}),r.jsx(Oc,{label:"Port (optional)",children:r.jsx(gt,{value:e.port?.toString()??"",placeholder:"auto",onChange:s=>t({...e,port:s.target.value?Number(s.target.value):void 0})})}),e.kind==="docker-compose"?r.jsx(Oc,{label:"Compose service",className:"col-span-2",children:r.jsx(gt,{value:e.composeService??"",onChange:s=>t({...e,composeService:s.target.value})})}):r.jsx(Oc,{label:"Run command",className:"col-span-2",children:r.jsx(gt,{value:e.command??"",onChange:s=>t({...e,command:s.target.value})})})]})}function RW({proposal:e,busy:t,error:s,onBack:n,onRegister:o}){const[l,u]=y.useState(e.installCommand??""),[h,m]=y.useState([]),[d,p]=y.useState(!1),[g,b]=y.useState(!1),v=y.useRef(null);function w(N){m(E=>[...E,N]),queueMicrotask(()=>{const E=v.current;E&&(E.scrollTop=E.scrollHeight)})}async function k(){l.trim()&&(p(!0),b(!1),m([]),await W8({clonePath:e.cwd,command:l.trim()},{onLine:N=>w(N.text),onDone:N=>{w(N===0?"✓ install complete":`✗ install exited ${N}`),p(!1),b(N===0)},onError:N=>{w(`✗ ${N}`),p(!1)}}))}return r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsxs("div",{className:"flex items-end gap-2",children:[r.jsx(Oc,{label:"Install command (optional)",className:"flex-1",children:r.jsx(gt,{value:l,placeholder:"e.g. npm install",onChange:N=>u(N.target.value)})}),r.jsxs(J,{variant:"outline",onClick:k,disabled:d||!l.trim(),children:[d?r.jsx(Et,{className:"size-4 animate-spin"}):r.jsx(bN,{className:"size-4"}),"Install"]})]}),h.length>0?r.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(`
|
|
179
|
+
`)}):null,s?r.jsx("p",{className:"text-sm text-destructive",children:s}):null,r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs(J,{variant:"ghost",size:"sm",onClick:n,children:[r.jsx(eu,{className:"size-3.5"}),"Back"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(J,{variant:"outline",onClick:()=>o(!1),disabled:t,children:"Register only"}),r.jsxs(J,{onClick:()=>o(!0),disabled:t,children:[t?r.jsx(Et,{className:"size-4 animate-spin"}):r.jsx(Nr,{className:"size-4"}),g||!l.trim()?"Register & start":"Skip install & start"]})]})]})]})}function Oc({label:e,className:t,children:s}){return r.jsxs("label",{className:`flex flex-col gap-1 text-xs ${t??""}`,children:[r.jsx("span",{className:"font-medium text-muted-foreground",children:e}),s]})}function MW({data:e,onRefresh:t,focusService:s,onServiceFocused:n}){const o=e.config.services[0]?.name??"",[l,u]=y.useState(o),[h,m]=y.useState(null),[d,p]=y.useState(!1),{sendToAgent:g,startOnboard:b}=It(),[v,w]=y.useState(!1),[k,N]=y.useState(!1),[E,A]=y.useState(!1),[j,T]=y.useState(!1),[P,z]=y.useState(!1),L=y.useRef({}),{error:R,message:D,success:I}=$s(),V=y.useMemo(()=>new Set(e.config.bundles.flatMap(oe=>oe.services)),[e.config.bundles]),X=y.useMemo(()=>{const oe=new Map;for(const je of e.config.bundles)for(const Ne of je.services)oe.has(Ne)||oe.set(Ne,je.name);return oe},[e.config.bundles]),$=y.useMemo(()=>e.config.services.filter(oe=>!V.has(oe.name)),[e.config.services,V]),W=y.useMemo(()=>e.config.services.map(oe=>oe.name),[e.config.services]),q=y.useMemo(()=>e.config.services.some(oe=>(oe.dependsOn?.length??0)>0),[e.config.services]),B=e.health??{},Z=e.config.bundles.length>0||$.length>0;y.useEffect(()=>{!e.config.services.some(je=>je.name===l)&&o&&u(o)},[e.config.services,o,l]),y.useEffect(()=>{s&&e.config.services.some(oe=>oe.name===s)&&(u(s),n?.())},[s,e.config.services,n]);const U=y.useMemo(()=>e.config.services.find(oe=>oe.name===l),[e.config.services,l]),K=l?e.runtime.services[l]:void 0,Y=l?B[l]:void 0;async function F(oe,je){if(!oe.services.includes(je))try{await oO(oe.name,oe.services,je),I(`Added ${je} to ${oe.name}.`),await t()}catch(Ne){R(Ne instanceof Error?Ne.message:String(Ne))}}async function ie(){if(U){if($c(K?.state)){R(`Stop ${U.name} before deleting it.`);return}if(window.confirm(`Delete service "${U.name}"? This removes it from your config.`))try{await J8(U.name),I(`Deleted ${U.name}.`),await t()}catch(oe){R(oe instanceof Error?oe.message:String(oe))}}}async function Ee(oe){const je=e.config.bundles.filter(Ne=>Ne.services.includes(oe));if(je.length!==0)try{for(const Ne of je)await cO(Ne.name,Ne.services,oe);D({text:`Removed ${oe} from ${je.map(Ne=>Ne.name).join(", ")}.`}),await t()}catch(Ne){R(Ne instanceof Error?Ne.message:String(Ne))}}y.useEffect(()=>{const oe=Object.fromEntries(e.config.services.map(Ne=>[Ne.name,e.runtime.services[Ne.name]?.state??"stopped"])),je=L.current;if(Object.keys(je).length){const Ne=new Map,Ge=new Map;for(const Me of e.config.services){const Qe=oe[Me.name],ke=je[Me.name];if(!ke||ke===Qe)continue;const He=e.runtime.services[Me.name],$e=X.get(Me.name);if($e){const St=Ne.get($e)??new Map;if(St.set(Qe,(St.get(Qe)??0)+1),Ne.set($e,St),Qe==="exited"){const Us=Ge.get($e)??[];Us.push(He?.exitCode),Ge.set($e,Us)}continue}if(Qe==="running")I(`${Me.name} is running.`);else if(Qe==="stopped")D({text:`${Me.name} stopped.`});else if(Qe==="starting")D({text:`${Me.name} is starting.`});else if(Qe==="exited"){const St=He?.exitCode===void 0||He.exitCode===null?"":` with code ${He.exitCode}`;R(`${Me.name} exited${St}.`)}}for(const[Me,Qe]of Ne)OW({exitCodes:Ge.get(Me)??[],groupName:Me,showErrorToast:R,showMessageToast:D,showSuccessToast:I,transitions:Qe})}L.current=oe},[e.config.services,e.runtime.services,X,R,D,I]);const ye=e.config.services.length>0;return r.jsxs(r.Fragment,{children:[ye?r.jsxs("div",{className:de("grid h-full min-h-0 overflow-hidden bg-card/85",E?"lg:grid-cols-[320px_minmax(0,1fr)]":"lg:grid-cols-[320px_minmax(0,1fr)_340px]"),children:[r.jsx("div",{className:"min-h-0 min-w-0 overflow-auto border-r border-border",children:r.jsxs(Ei,{className:"min-w-0 rounded-none border-0 border-b border-border bg-transparent",children:[r.jsx(ji,{className:"border-b border-border px-3 py-2",children:r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx(Ti,{className:"text-sm",children:"Services"}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsxs(J,{"aria-haspopup":"dialog",className:"h-7 gap-1.5 px-2 text-xs",onClick:()=>N(!0),size:"sm",type:"button",variant:"outline",children:[r.jsx(zy,{className:"size-3.5"}),"Graph"]}),r.jsxs(J,{"aria-haspopup":"dialog",className:"h-7 gap-1.5 px-2 text-xs",onClick:()=>w(!0),size:"sm",type:"button",variant:"outline",children:[r.jsx(ON,{className:"size-3.5"}),"Logs"]}),r.jsx(DW,{onCreateGroup:()=>m("group"),onCreateService:()=>m("service"),onOnboardRepo:()=>p(!0),onOnboardWithAi:b,canGroupWithAi:$.length>1,onCreateWithAi:()=>g({prompt:Tw,source:{type:"service-setup",label:"Add a service"},label:"Help me add a new service, one step at a time."}),onGroupWithAi:()=>g({prompt:wP($),source:{type:"group-services",label:"Group services"},label:"Propose how to group my ungrouped services."})})]})]})}),r.jsx(Ai,{className:"p-0",children:Z?r.jsxs("div",{className:"divide-y divide-border",children:[e.config.bundles.map(oe=>r.jsx(M$,{group:oe,onRefresh:t,ports:e.ports,allServices:e.config.services,health:B,services:e.config.services.filter(je=>oe.services.includes(je.name)),statuses:e.runtime.services,timeline:e.timeline,selectedService:l,onSelectService:u,onDropService:je=>{F(oe,je)}},oe.name)),$.length?r.jsxs("div",{className:de("transition-colors",P&&"bg-primary/5 outline-dashed outline-2 -outline-offset-2 outline-primary/60"),onDragOver:oe=>{oe.dataTransfer.types.includes(Xc)&&(oe.preventDefault(),oe.dataTransfer.dropEffect="move",z(!0))},onDragLeave:()=>z(!1),onDrop:oe=>{oe.preventDefault(),z(!1);const je=oe.dataTransfer.getData(Xc);je&&Ee(je)},children:[r.jsxs("div",{className:"flex items-center justify-between gap-2 bg-muted/55 px-3 py-1 text-[10px] font-semibold uppercase text-muted-foreground",children:[r.jsx("span",{children:"Ungrouped"}),r.jsx("span",{className:"text-muted-foreground/80",children:$.length})]}),r.jsx("div",{className:"divide-y divide-border",children:$.map(oe=>r.jsx(x3,{service:oe,status:e.runtime.services[oe.name],health:B[oe.name],ports:e.ports,onRefresh:t,timeline:e.timeline,selected:l===oe.name,onSelect:()=>u(oe.name)},oe.name))})]}):null]}):r.jsx(qh,{label:"No services registered yet."})})]})}),r.jsx("div",{className:"min-h-0 min-w-0 overflow-auto",children:U?r.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[r.jsxs("div",{className:"shrink-0 space-y-2 border-b border-border bg-background/60 px-4 py-3",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("h2",{className:"min-w-0 truncate text-base font-semibold",children:U.name}),r.jsx(v3,{state:K?.state??"stopped"}),r.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1.5",children:[(()=>{const oe=K?.url??(U.port?O$(U.port):void 0);return oe?r.jsx(tl,{label:`Open ${oe}`,children:r.jsx(J,{"aria-label":"Open in browser",className:"size-7",onClick:()=>{of(oe)},size:"icon",type:"button",variant:"outline",children:r.jsx(kr,{})})}):null})(),Y?.agentContext&&U?r.jsx(tl,{label:"Debug this service with AI",children:r.jsx(J,{"aria-label":"Debug this service with AI",className:"size-7",onClick:()=>g({prompt:jP({service:U.name,context:Y.agentContext}),source:{type:"service-debug",label:U.name},label:`Debug \`${U.name}\` with its current context.`}),size:"icon",type:"button",variant:"outline",children:r.jsx(Gt,{className:"size-3.5"})})}):null,r.jsx(vx,{active:$c(K?.state),baseUrl:`/api/services/${encodeURIComponent(U.name)}`,compact:!0,resourceKind:"service",resourceName:U.name,targetLabel:U.name,onRefresh:t}),r.jsx(L3,{className:"size-7 border border-border bg-background opacity-100 hover:border-foreground/30",items:[{icon:r.jsx(rl,{className:"size-3.5"}),label:"Edit service",onSelect:()=>T(!0)},...$c(K?.state)?[]:[{icon:r.jsx(Er,{className:"size-3.5 text-destructive"}),label:"Delete service",onSelect:()=>{ie()}}]],label:`More actions for ${U.name}`}),r.jsx(tl,{label:E?"Show Ports & Timeline":"Hide Ports & Timeline",side:"left",children:r.jsx(J,{"aria-label":E?"Show Ports & Timeline":"Hide Ports & Timeline",className:"size-7",onClick:()=>A(oe=>!oe),size:"icon",type:"button",variant:"ghost",children:E?r.jsx(a4,{}):r.jsx(Yn,{})})})]})]}),U.command?r.jsxs("div",{className:"truncate font-mono text-[11px] text-muted-foreground",title:U.command,children:["$ ",U.command]}):null,U.cwd?r.jsx("div",{className:"truncate font-mono text-[11px] text-muted-foreground",title:U.cwd,children:U.cwd}):null,r.jsx(kF,{health:Y})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:r.jsx(NW,{serviceName:U.name,status:K,health:Y,timeline:e.timeline??[],onRefresh:t},U.name)})]}):r.jsx(qh,{label:"Select a service to see details."})}),E?null:r.jsxs("div",{className:"min-h-0 overflow-auto border-l border-border",children:[r.jsx(TF,{ports:e.ports}),r.jsx(uF,{events:e.timeline??[]})]})]}):r.jsx(wF,{onOnboardRepo:()=>p(!0),onOnboardWithAi:b,onCreateService:()=>m("service"),onCreateWithAi:()=>g({prompt:Tw,source:{type:"service-setup",label:"Add a service"},label:"Help me add a new service, one step at a time."})}),j&&U?r.jsx(Kn,{icon:r.jsx(rl,{}),onClose:()=>T(!1),size:"lg",title:`Edit Service — ${U.name}`,children:r.jsx(Bw,{cwd:e.cwd,initialService:U,availableServices:W,onRefresh:t,onSaved:()=>T(!1)})}):null,h?r.jsx(Kn,{icon:h==="service"?r.jsx(Es,{}):r.jsx(mN,{}),onClose:()=>m(null),size:h==="service"?"lg":"md",title:h==="service"?"Add Service":"Create Group",children:h==="service"?r.jsx(Bw,{cwd:e.cwd,availableServices:W,onRefresh:t,onSaved:()=>m(null)}):r.jsx(b3,{services:$,onRefresh:t,onSaved:()=>m(null)})}):null,d?r.jsx(EW,{onClose:()=>p(!1),onRefresh:t}):null,v?r.jsx(FF,{initialService:l||void 0,onClose:()=>w(!1),services:e.config.services.map(oe=>oe.name)}):null,k?r.jsx(Kn,{icon:r.jsx(zy,{}),onClose:()=>N(!1),size:"lg",title:"Service Dependency Graph",children:r.jsx(vF,{statuses:e.runtime.services,health:B,hasDependencies:q,onSelectService:oe=>{u(oe),N(!1)}})}):null]})}function DW({onCreateService:e,onCreateGroup:t,onCreateWithAi:s,onGroupWithAi:n,canGroupWithAi:o,onOnboardRepo:l,onOnboardWithAi:u}){const[h,m]=y.useState(!1);function d(p){m(!1),p()}return r.jsxs("div",{className:"relative",children:[r.jsx(tl,{label:"Add",side:"bottom",children:r.jsx(J,{"aria-expanded":h,"aria-haspopup":"menu","aria-label":"Add service or group",className:"size-7",onClick:()=>m(p=>!p),size:"icon",type:"button",variant:"ghost",children:r.jsx(Es,{})})}),h?r.jsxs(r.Fragment,{children:[r.jsx("button",{"aria-hidden":!0,className:"fixed inset-0 z-[40] cursor-default",onClick:()=>m(!1),tabIndex:-1,type:"button"}),r.jsxs("div",{className:"absolute right-0 z-[50] mt-1 w-56 overflow-hidden rounded-md border border-border bg-card py-1 shadow-lg",role:"menu",children:[r.jsxs("div",{className:"group flex items-stretch",children:[r.jsxs("button",{className:"flex flex-1 items-center gap-2 whitespace-nowrap px-3 py-2 text-left text-sm hover:bg-muted/60 [&_svg]:size-4",onClick:()=>d(e),role:"menuitem",type:"button",children:[r.jsx(Es,{}),"Create Service"]}),r.jsxs("button",{className:"flex max-w-0 items-center gap-1.5 overflow-hidden whitespace-nowrap border-l border-transparent px-0 text-[11px] font-medium text-muted-foreground opacity-0 transition-all duration-200 ease-out hover:bg-muted/60 hover:text-foreground group-hover:max-w-24 group-hover:border-border group-hover:px-3 group-hover:opacity-100",onClick:()=>d(s),role:"menuitem",title:"Set up with AI — the agent walks you through it",type:"button",children:[r.jsx(Gt,{className:"size-3.5 shrink-0"}),"AI"]})]}),r.jsxs("div",{className:"group flex items-stretch",children:[r.jsxs("button",{className:"flex flex-1 items-center gap-2 whitespace-nowrap px-3 py-2 text-left text-sm hover:bg-muted/60 [&_svg]:size-4",onClick:()=>d(t),role:"menuitem",type:"button",children:[r.jsx(mN,{}),"Create Group"]}),o?r.jsxs("button",{className:"flex max-w-0 items-center gap-1.5 overflow-hidden whitespace-nowrap border-l border-transparent px-0 text-[11px] font-medium text-muted-foreground opacity-0 transition-all duration-200 ease-out hover:bg-muted/60 hover:text-foreground group-hover:max-w-24 group-hover:border-border group-hover:px-3 group-hover:opacity-100",onClick:()=>d(n),role:"menuitem",title:"Group with AI — the agent proposes groupings for your ungrouped services",type:"button",children:[r.jsx(Gt,{className:"size-3.5 shrink-0"}),"AI"]}):null]}),r.jsxs("div",{className:"group flex items-stretch",children:[r.jsxs("button",{className:"flex flex-1 items-center gap-2 whitespace-nowrap px-3 py-2 text-left text-sm hover:bg-muted/60 [&_svg]:size-4",onClick:()=>d(l),role:"menuitem",type:"button",children:[r.jsx(xn,{}),"Add from GitHub"]}),r.jsxs("button",{className:"flex max-w-0 items-center gap-1.5 overflow-hidden whitespace-nowrap border-l border-transparent px-0 text-[11px] font-medium text-muted-foreground opacity-0 transition-all duration-200 ease-out hover:bg-muted/60 hover:text-foreground group-hover:max-w-24 group-hover:border-border group-hover:px-3 group-hover:opacity-100",onClick:()=>d(u),role:"menuitem",title:"Onboard with AI — the agent clones, detects and runs it for you",type:"button",children:[r.jsx(Gt,{className:"size-3.5 shrink-0"}),"AI"]})]})]})]}):null]})}function OW({exitCodes:e,groupName:t,showErrorToast:s,showMessageToast:n,showSuccessToast:o,transitions:l}){if(l.size===1){const[m]=l.keys();if(m==="running")o(`${t} group is running.`);else if(m==="stopped")n({text:`${t} group stopped.`});else if(m==="starting")n({text:`${t} group is starting.`});else if(m==="exited"){const d=e.filter(g=>g!=null),p=d.length?` with code ${d.join(", ")}`:"";s(`${t} group exited${p}.`)}return}const u=[...l.entries()].map(([m,d])=>`${d} ${m}`).join(", "),h=`${t} group updated: ${u}.`;l.has("exited")?s(h):n({text:h})}function LW({data:e,onOpenService:t}){const s=y.useMemo(()=>zW(e),[e]);return s.length?r.jsxs("div",{className:"flex shrink-0 items-center gap-3 overflow-x-auto border-b border-border bg-card/60 px-4 py-1.5 backdrop-blur",children:[r.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 font-mono text-[10px] uppercase tracking-wider text-muted-foreground",children:[r.jsx(Za,{className:"size-3"}),"Running"]}),r.jsx("div",{className:"flex min-w-0 items-center gap-2",children:s.map(n=>r.jsxs("button",{className:"group flex shrink-0 items-center gap-2 rounded-md border border-border/60 bg-background/60 px-2.5 py-1 font-mono text-[11px] transition-colors hover:border-border hover:bg-muted",onClick:()=>t(n.name),title:n.url?`${n.name} — ${n.url}`:n.name,type:"button",children:[r.jsx("span",{className:de("size-2 shrink-0 rounded-full",IW(n.tone))}),r.jsx("span",{className:"max-w-40 truncate font-medium text-foreground",children:n.name}),n.port?r.jsxs("span",{className:"text-muted-foreground",children:[":",n.port]}):null,n.uptime?r.jsxs("span",{className:"text-muted-foreground/70",children:["↑",n.uptime]}):null]},n.name))})]}):null}function zW(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:BW(s,e.health[s.name]),port:t.get(s.name)??PW(s.url),uptime:s.state==="running"?$W(s.startedAt):"starting…",url:s.url})).sort((s,n)=>s.name.localeCompare(n.name))}function BW(e,t){return e.state==="starting"?"starting":t?.status==="healthy"?"healthy":t?.status==="warning"?"warning":t?.status==="unhealthy"?"unhealthy":"healthy"}function IW(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 PW(e){if(e)try{const t=new URL(e).port;return t?Number(t):void 0}catch{return}}function $W(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 HW(){const[e,t]=y.useState([]),[s,n]=y.useState(null),[o,l]=y.useState(!1);y.useEffect(()=>{let m=!1;return(async()=>{let d=await CO().catch(()=>[]);if(d.length===0){const p=await oh().catch(()=>null);d=p?[p]:[]}m||(t(d),n(d[0]?.id??null))})(),()=>{m=!0}},[]);const u=y.useCallback(async()=>{l(!0);try{const m=await oh();t(d=>[...d,m]),n(m.id)}finally{l(!1)}},[]),h=y.useCallback(async m=>{l(!0);try{await EO(m);const d=e.findIndex(g=>g.id===m),p=e.filter(g=>g.id!==m);if(p.length===0){const g=await oh();t([g]),n(g.id);return}if(t(p),s===m){const g=p[Math.min(d,p.length-1)];n(g.id)}}finally{l(!1)}},[e,s]);return r.jsxs("section",{className:"flex h-full min-h-0 flex-col bg-[#090909] text-white",children:[r.jsxs("div",{"aria-label":"Terminal tabs",className:"flex shrink-0 items-center gap-1 overflow-x-auto border-b border-white/10 bg-[#111111] px-2 py-1.5",role:"tablist",children:[e.map((m,d)=>{const p=m.label??`Terminal ${d+1}`;return r.jsxs("div",{className:de("group flex items-center gap-1 rounded-md border border-transparent px-2 py-1 text-xs",m.id===s?"border-white/15 bg-white/10 text-white":"text-white/60 hover:bg-white/5"),children:[r.jsx("button",{"aria-selected":m.id===s,className:"max-w-[160px] truncate font-medium",onClick:()=>n(m.id),role:"tab",type:"button",children:p}),r.jsx("button",{"aria-label":`Close ${p}`,className:"rounded p-0.5 text-white/40 opacity-0 transition hover:bg-white/10 hover:text-white group-hover:opacity-100",disabled:o,onClick:()=>{h(m.id)},type:"button",children:r.jsx(ts,{className:"size-3"})})]},m.id)}),r.jsx("button",{"aria-label":"New terminal",className:"ml-1 rounded-md p-1 text-white/60 transition hover:bg-white/10 hover:text-white disabled:opacity-40",disabled:o,onClick:()=>{u()},type:"button",children:r.jsx(Es,{className:"size-4"})})]}),r.jsx("div",{className:"relative min-h-0 flex-1",children:e.length===0?r.jsx("div",{className:"flex h-full items-center justify-center font-mono text-[11px] text-white/40",children:"Starting terminal…"}):e.map(m=>r.jsx("div",{className:"absolute inset-0",children:r.jsx(A5,{active:m.id===s,sessionId:m.id})},m.id))})]})}function R5({branch:e}){return r.jsx("span",{className:"min-w-0 max-w-40",title:e,children:r.jsx(et,{className:"w-full max-w-full shadow-none",variant:"outline",children:e})})}function M5({branch:e,error:t,files:s,selectedFile:n,onSelectFile:o,root:l,staging:u}){const h=y.useMemo(()=>VW(s).filter(p=>p.files.length),[s]),[m,d]=y.useState({staged:!1,unstaged:!1,untracked:!1});return r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border bg-card/95 px-2.5 py-1.5",children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-[12px] font-semibold tracking-tight",children:[r.jsx(xn,{className:"size-3.5"}),r.jsx("span",{className:"truncate",children:"Changes"})]}),r.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[e?r.jsx(R5,{branch:e}):null,r.jsx(et,{variant:"secondary",children:s.length})]})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-auto py-1",children:h.length?h.map(p=>r.jsx(UW,{collapsed:m[p.id],group:p,onSelectFile:o,onToggle:()=>d(g=>({...g,[p.id]:!g[p.id]})),root:l,selectedFile:n,staging:u},p.id)):r.jsx(tt,{variant:"muted",className:"m-3 text-center",children:t??"No changed files."})})]})}function UW({collapsed:e,group:t,onSelectFile:s,onToggle:n,root:o,selectedFile:l,staging:u}){const h=e?Yn:vn,m=t.files.map(p=>p.path),d=u?t.id==="staged"?{label:"Unstage all",run:()=>u.onUnstage(m)}:{label:"Stage all",run:()=>u.onStage(m)}:null;return r.jsxs("section",{className:"border-b border-border last:border-b-0",children:[r.jsxs("div",{className:"flex w-full items-center justify-between gap-2 bg-muted/45 px-2 py-0.5 text-[10px] font-semibold uppercase text-muted-foreground hover:bg-muted",children:[r.jsxs("button",{className:"flex min-w-0 flex-1 items-center gap-1.5 text-left",onClick:n,type:"button",children:[r.jsx(h,{className:"size-3.5"}),r.jsx("span",{className:"truncate",children:t.label})]}),d?r.jsx("button",{className:"shrink-0 rounded px-1 text-[10px] font-medium normal-case text-muted-foreground transition-colors hover:bg-background hover:text-foreground disabled:opacity-50",disabled:u?.busy,onClick:d.run,type:"button",children:d.label}):null,r.jsx(et,{className:"min-w-6 justify-center font-mono shadow-none",size:"small",variant:"outline",children:t.files.length})]}),e?null:r.jsx("div",{children:t.files.map(p=>r.jsx(FW,{active:l===p.path,file:p,group:t.id,onClick:()=>s(p.path),root:o,staging:u},p.path))})]})}function FW({active:e,file:t,group:s,onClick:n,root:o,staging:l}){const u=t.path.split("/").pop()||t.path,h=t.path.split("/").slice(0,-1).join("/"),m=o?g3(cu(o,t.path)):{},d=s==="staged";return r.jsxs("div",{className:de("group flex w-full items-center gap-1.5 px-1 py-0.5 text-[12px] hover:bg-muted",e&&"bg-muted font-medium"),children:[r.jsxs("button",{"aria-label":`Open changed file ${t.path}`,className:"flex min-w-0 flex-1 items-center gap-1.5 text-left",onClick:n,type:"button",...m,children:[r.jsx(_x,{path:t.path}),r.jsxs("span",{className:"flex min-w-0 flex-1 items-baseline gap-1.5 truncate",children:[r.jsx("span",{"data-testid":"changed-file-name",className:"shrink-0 truncate",children:u}),h?r.jsx("span",{"data-testid":"changed-file-dir",className:"min-w-0 truncate text-muted-foreground",children:h}):null]})]}),l?r.jsx("button",{"aria-label":`${d?"Unstage":"Stage"} ${t.path}`,className:"shrink-0 rounded p-0.5 text-muted-foreground opacity-0 transition-colors hover:bg-background hover:text-foreground focus:opacity-100 group-hover:opacity-100 disabled:opacity-50",disabled:l.busy,onClick:()=>d?l.onUnstage([t.path]):l.onStage([t.path]),title:d?"Unstage":"Stage",type:"button",children:d?r.jsx(RN,{className:"size-3.5"}):r.jsx(Es,{className:"size-3.5"})}):null,r.jsx("span",{className:de("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:qW(t,s)})]})}function qW(e,t){return t==="untracked"?"?":t==="staged"?e.index.trim():e.workingTree.trim()}function VW(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 D5({branch:e,files:t,onDone:s,repo:n}){const{sendToAgent:o}=It(),[l,u]=y.useState(""),[h,m]=y.useState(null),[d,p]=y.useState(null),[g,b]=y.useState(null),v=y.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,A){m(E),p(null),b(null);try{if(await QN(l.trim(),n),A){const j=await lf(n);b(`Committed and pushed ${j.branch}.`)}else b("Committed staged changes.");u(""),s()}catch(j){p(j instanceof Error?j.message:String(j))}finally{m(null)}}function N(){o({prompt:vP({branch:e,stagedFiles:v}),source:{type:"git-commit",label:"commit message"},mode:"send",label:"Suggest a commit message"})}return r.jsxs("div",{className:"shrink-0 space-y-2 border-t border-border bg-card/95 p-2.5",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-tight text-muted-foreground",children:"Commit"}),r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[v.length," staged"]}),r.jsxs("button",{"aria-label":"Suggest a commit message with AI",className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-50",disabled:v.length===0,onClick:N,title:"Ask the agent to draft a commit message from the staged diff",type:"button",children:[r.jsx(Gt,{className:"size-3.5"}),"AI message"]})]})]}),r.jsx("textarea",{"aria-label":"Commit message",className:"min-h-16 w-full resize-y rounded-md border border-border bg-background px-2.5 py-1.5 text-[12px] outline-none transition-colors placeholder:text-muted-foreground focus:border-foreground/40 focus:ring-2 focus:ring-ring",onChange:E=>{u(E.target.value),p(null),b(null)},placeholder:v.length?"Commit message…":"Stage files to commit",value:l}),r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs(J,{disabled:!w,onClick:()=>{k("commit",!1)},size:"sm",type:"button",variant:"outline",children:[h==="commit"?r.jsx(Et,{className:"size-3.5 animate-spin"}):r.jsx(on,{className:"size-3.5"}),"Commit"]}),r.jsxs(J,{disabled:!w,onClick:()=>{k("push",!0)},size:"sm",type:"button",children:[h==="push"?r.jsx(Et,{className:"size-3.5 animate-spin"}):r.jsx(Bb,{className:"size-3.5"}),"Commit & push"]})]}),d?r.jsx(tt,{className:"px-2.5 py-1.5 text-[11px]",variant:"destructive",children:d}):g?r.jsx(tt,{className:"px-2.5 py-1.5 text-[11px]",variant:"muted",children:g}):null]})}function GW(e){const t={name:"",path:"",children:[],isFile:!1},s=new Map;s.set("",t);const n=[...e].sort();for(const l of n){const u=l.split("/");let h="";for(let m=0;m<u.length;m+=1){const d=u[m],p=m===u.length-1,g=h?`${h}/${d}`:d;let b=s.get(g);b||(b={name:d,path:g,children:[],isFile:p},s.set(g,b),s.get(h)?.children.push(b)),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 ik(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 rk({defaultExpandAll:e=!1,paths:t,status:s,selectedFile:n,onSelectFile:o,branch:l,emptyMessage:u="No tracked files.",root:h,title:m="Files"}){const d=y.useMemo(()=>GW(t),[t]),p=y.useMemo(()=>ik(d,e),[e,d]),g=y.useMemo(()=>ik(d,!0),[d]),b=Math.max(0,Object.keys(g).length-1),v=y.useMemo(()=>{const P=new Map;for(const z of s)P.set(z.path,z);return P},[s]),[w,k]=y.useState(p),[N,E]=y.useState(!1);y.useEffect(()=>{N||d.children.length===0||(k(p),E(!0))},[p,N,d.children.length]);function A(P){k(z=>({...z,[P]:!z[P]}))}function j(){k(g)}function T(){k({"":!0})}return r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border bg-card/95 px-2.5 py-1.5",children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-[12px] font-semibold tracking-tight",children:[r.jsx(ro,{className:"size-3.5"}),r.jsx("span",{className:"truncate",children:m})]}),r.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[b>0?r.jsxs("span",{className:"flex items-center gap-0.5",children:[r.jsx("button",{"aria-label":"Expand all folders",className:"flex size-6 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:j,title:"Expand all folders",type:"button",children:r.jsx(yR,{className:"size-3.5"})}),r.jsx("button",{"aria-label":"Collapse all folders",className:"flex size-6 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:T,title:"Collapse all folders",type:"button",children:r.jsx(vR,{className:"size-3.5"})})]}):null,l?r.jsx(R5,{branch:l}):null,r.jsx(et,{variant:"secondary",children:t.length})]})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-auto py-1",children:d.children.length===0?r.jsx(tt,{variant:"muted",className:"m-3 text-center",children:u}):d.children.map(P=>r.jsx(O5,{depth:0,expanded:w,node:P,onSelectFile:o,onToggle:A,root:h,selectedFile:n,statusByPath:v},P.path))})]})}function O5({depth:e,expanded:t,node:s,onSelectFile:n,onToggle:o,root:l,selectedFile:u,statusByPath:h}){const m=t[s.path]??!1,d=6+e*12,p=l?g3(cu(l,s.path)):{};if(s.isFile){const v=h.get(s.path),w=u===s.path;return r.jsxs("button",{className:de("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:[r.jsx(_x,{path:s.path}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:s.name}),v?r.jsx(WW,{file:v}):null]})}const g=m?vn:Yn,b=m?rf:ro;return r.jsxs("div",{children:[r.jsxs("button",{className:"flex w-full items-center gap-1 py-0.5 text-left text-[12px] font-medium hover:bg-muted",onClick:()=>o(s.path),style:{paddingLeft:d},type:"button",...p,children:[r.jsx(g,{className:"size-3.5 shrink-0 text-muted-foreground"}),r.jsx(b,{className:"size-3.5 shrink-0 text-amber-600"}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:s.name})]}),m?s.children.map(v=>r.jsx(O5,{depth:e+1,expanded:t,node:v,onSelectFile:n,onToggle:o,root:l,selectedFile:u,statusByPath:h},v.path)):null]})}function WW({file:e}){const t=e.workingTree.trim()||e.index.trim();if(!t)return null;const s=e.index.trim()&&!e.workingTree.trim()?"text-emerald-700 dark:text-emerald-400":t==="?"?"text-amber-700 dark:text-amber-400":"text-zinc-700 dark:text-zinc-300";return r.jsx("span",{className:de("ml-1 shrink-0 font-mono text-[10px] font-semibold",s),children:t})}var Sg,ak;function KW(){if(ak)return Sg;ak=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(ee=>{const fe=H[ee],Be=typeof fe;(Be==="object"||Be==="function")&&!Object.isFrozen(fe)&&e(fe)}),H}class t{constructor(ee){ee.data===void 0&&(ee.data={}),this.data=ee.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function s(H){return H.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function n(H,...ee){const fe=Object.create(null);for(const Be in H)fe[Be]=H[Be];return ee.forEach(function(Be){for(const rt in Be)fe[rt]=Be[rt]}),fe}const o="</span>",l=H=>!!H.scope,u=(H,{prefix:ee})=>{if(H.startsWith("language:"))return H.replace("language:","language-");if(H.includes(".")){const fe=H.split(".");return[`${ee}${fe.shift()}`,...fe.map((Be,rt)=>`${Be}${"_".repeat(rt+1)}`)].join(" ")}return`${ee}${H}`};class h{constructor(ee,fe){this.buffer="",this.classPrefix=fe.classPrefix,ee.walk(this)}addText(ee){this.buffer+=s(ee)}openNode(ee){if(!l(ee))return;const fe=u(ee.scope,{prefix:this.classPrefix});this.span(fe)}closeNode(ee){l(ee)&&(this.buffer+=o)}value(){return this.buffer}span(ee){this.buffer+=`<span class="${ee}">`}}const m=(H={})=>{const ee={children:[]};return Object.assign(ee,H),ee};class d{constructor(){this.rootNode=m(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(ee){this.top.children.push(ee)}openNode(ee){const fe=m({scope:ee});this.add(fe),this.stack.push(fe)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(ee){return this.constructor._walk(ee,this.rootNode)}static _walk(ee,fe){return typeof fe=="string"?ee.addText(fe):fe.children&&(ee.openNode(fe),fe.children.forEach(Be=>this._walk(ee,Be)),ee.closeNode(fe)),ee}static _collapse(ee){typeof ee!="string"&&ee.children&&(ee.children.every(fe=>typeof fe=="string")?ee.children=[ee.children.join("")]:ee.children.forEach(fe=>{d._collapse(fe)}))}}class p extends d{constructor(ee){super(),this.options=ee}addText(ee){ee!==""&&this.add(ee)}startScope(ee){this.openNode(ee)}endScope(){this.closeNode()}__addSublanguage(ee,fe){const Be=ee.root;fe&&(Be.scope=`language:${fe}`),this.add(Be)}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 b(H){return k("(?=",H,")")}function v(H){return k("(?:",H,")*")}function w(H){return k("(?:",H,")?")}function k(...H){return H.map(fe=>g(fe)).join("")}function N(H){const ee=H[H.length-1];return typeof ee=="object"&&ee.constructor===Object?(H.splice(H.length-1,1),ee):{}}function E(...H){return"("+(N(H).capture?"":"?:")+H.map(Be=>g(Be)).join("|")+")"}function A(H){return new RegExp(H.toString()+"|").exec("").length-1}function j(H,ee){const fe=H&&H.exec(ee);return fe&&fe.index===0}const T=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function P(H,{joinWith:ee}){let fe=0;return H.map(Be=>{fe+=1;const rt=fe;let Mt=g(Be),qe="";for(;Mt.length>0;){const Ue=T.exec(Mt);if(!Ue){qe+=Mt;break}qe+=Mt.substring(0,Ue.index),Mt=Mt.substring(Ue.index+Ue[0].length),Ue[0][0]==="\\"&&Ue[1]?qe+="\\"+String(Number(Ue[1])+rt):(qe+=Ue[0],Ue[0]==="("&&fe++)}return qe}).map(Be=>`(${Be})`).join(ee)}const z=/\b\B/,L="[a-zA-Z]\\w*",R="[a-zA-Z_]\\w*",D="\\b\\d+(\\.\\d+)?",I="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",V="\\b(0b[01]+)",X="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",$=(H={})=>{const ee=/^#![ ]*\//;return H.binary&&(H.begin=k(ee,/.*\b/,H.binary,/\b.*/)),n({scope:"meta",begin:ee,end:/$/,relevance:0,"on:begin":(fe,Be)=>{fe.index!==0&&Be.ignoreMatch()}},H)},W={begin:"\\\\[\\s\\S]",relevance:0},q={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[W]},B={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[W]},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/},U=function(H,ee,fe={}){const Be=n({scope:"comment",begin:H,end:ee,contains:[]},fe);Be.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const rt=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 Be.contains.push({begin:k(/[ ]+/,"(",rt,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),Be},K=U("//","$"),Y=U("/\\*","\\*/"),F=U("#","$"),ie={scope:"number",begin:D,relevance:0},Ee={scope:"number",begin:I,relevance:0},ye={scope:"number",begin:V,relevance:0},oe={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[W,{begin:/\[/,end:/\]/,relevance:0,contains:[W]}]},je={scope:"title",begin:L,relevance:0},Ne={scope:"title",begin:R,relevance:0},Ge={begin:"\\.\\s*"+R,relevance:0};var Qe=Object.freeze({__proto__:null,APOS_STRING_MODE:q,BACKSLASH_ESCAPE:W,BINARY_NUMBER_MODE:ye,BINARY_NUMBER_RE:V,COMMENT:U,C_BLOCK_COMMENT_MODE:Y,C_LINE_COMMENT_MODE:K,C_NUMBER_MODE:Ee,C_NUMBER_RE:I,END_SAME_AS_BEGIN:function(H){return Object.assign(H,{"on:begin":(ee,fe)=>{fe.data._beginMatch=ee[1]},"on:end":(ee,fe)=>{fe.data._beginMatch!==ee[1]&&fe.ignoreMatch()}})},HASH_COMMENT_MODE:F,IDENT_RE:L,MATCH_NOTHING_RE:z,METHOD_GUARD:Ge,NUMBER_MODE:ie,NUMBER_RE:D,PHRASAL_WORDS_MODE:Z,QUOTE_STRING_MODE:B,REGEXP_MODE:oe,RE_STARTERS_RE:X,SHEBANG:$,TITLE_MODE:je,UNDERSCORE_IDENT_RE:R,UNDERSCORE_TITLE_MODE:Ne});function ke(H,ee){H.input[H.index-1]==="."&&ee.ignoreMatch()}function He(H,ee){H.className!==void 0&&(H.scope=H.className,delete H.className)}function $e(H,ee){ee&&H.beginKeywords&&(H.begin="\\b("+H.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",H.__beforeBegin=ke,H.keywords=H.keywords||H.beginKeywords,delete H.beginKeywords,H.relevance===void 0&&(H.relevance=0))}function St(H,ee){Array.isArray(H.illegal)&&(H.illegal=E(...H.illegal))}function Us(H,ee){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 Fs(H,ee){H.relevance===void 0&&(H.relevance=1)}const On=(H,ee)=>{if(!H.beforeMatch)return;if(H.starts)throw new Error("beforeMatch cannot be used with starts");const fe=Object.assign({},H);Object.keys(H).forEach(Be=>{delete H[Be]}),H.keywords=fe.keywords,H.begin=k(fe.beforeMatch,b(fe.begin)),H.starts={relevance:0,contains:[Object.assign(fe,{endsParent:!0})]},H.relevance=0,delete fe.beforeMatch},wn=["of","and","for","in","not","or","if","then","parent","list","value"],js="keyword";function cn(H,ee,fe=js){const Be=Object.create(null);return typeof H=="string"?rt(fe,H.split(" ")):Array.isArray(H)?rt(fe,H):Object.keys(H).forEach(function(Mt){Object.assign(Be,cn(H[Mt],ee,Mt))}),Be;function rt(Mt,qe){ee&&(qe=qe.map(Ue=>Ue.toLowerCase())),qe.forEach(function(Ue){const at=Ue.split("|");Be[at[0]]=[Mt,un(at[0],at[1])]})}}function un(H,ee){return ee?Number(ee):Pe(H)?0:1}function Pe(H){return wn.includes(H.toLowerCase())}const Ct={},wt=H=>{console.error(H)},Rt=(H,...ee)=>{console.log(`WARN: ${H}`,...ee)},Ft=(H,ee)=>{Ct[`${H}/${ee}`]||(console.log(`Deprecated as of ${H}. ${ee}`),Ct[`${H}/${ee}`]=!0)},Qs=new Error;function Js(H,ee,{key:fe}){let Be=0;const rt=H[fe],Mt={},qe={};for(let Ue=1;Ue<=ee.length;Ue++)qe[Ue+Be]=rt[Ue],Mt[Ue+Be]=!0,Be+=A(ee[Ue-1]);H[fe]=qe,H[fe]._emit=Mt,H[fe]._multi=!0}function Ri(H){if(Array.isArray(H.begin)){if(H.skip||H.excludeBegin||H.returnBegin)throw wt("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Qs;if(typeof H.beginScope!="object"||H.beginScope===null)throw wt("beginScope must be object"),Qs;Js(H,H.begin,{key:"beginScope"}),H.begin=P(H.begin,{joinWith:""})}}function S(H){if(Array.isArray(H.end)){if(H.skip||H.excludeEnd||H.returnEnd)throw wt("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Qs;if(typeof H.endScope!="object"||H.endScope===null)throw wt("endScope must be object"),Qs;Js(H,H.end,{key:"endScope"}),H.end=P(H.end,{joinWith:""})}}function se(H){H.scope&&typeof H.scope=="object"&&H.scope!==null&&(H.beginScope=H.scope,delete H.scope)}function me(H){se(H),typeof H.beginScope=="string"&&(H.beginScope={_wrap:H.beginScope}),typeof H.endScope=="string"&&(H.endScope={_wrap:H.endScope}),Ri(H),S(H)}function be(H){function ee(qe,Ue){return new RegExp(g(qe),"m"+(H.case_insensitive?"i":"")+(H.unicodeRegex?"u":"")+(Ue?"g":""))}class fe{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(Ue,at){at.position=this.position++,this.matchIndexes[this.matchAt]=at,this.regexes.push([at,Ue]),this.matchAt+=A(Ue)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const Ue=this.regexes.map(at=>at[1]);this.matcherRe=ee(P(Ue,{joinWith:"|"}),!0),this.lastIndex=0}exec(Ue){this.matcherRe.lastIndex=this.lastIndex;const at=this.matcherRe.exec(Ue);if(!at)return null;const ds=at.findIndex((Zi,co)=>co>0&&Zi!==void 0),Jt=this.matchIndexes[ds];return at.splice(0,ds),Object.assign(at,Jt)}}class Be{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(Ue){if(this.multiRegexes[Ue])return this.multiRegexes[Ue];const at=new fe;return this.rules.slice(Ue).forEach(([ds,Jt])=>at.addRule(ds,Jt)),at.compile(),this.multiRegexes[Ue]=at,at}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(Ue,at){this.rules.push([Ue,at]),at.type==="begin"&&this.count++}exec(Ue){const at=this.getMatcher(this.regexIndex);at.lastIndex=this.lastIndex;let ds=at.exec(Ue);if(this.resumingScanAtSamePosition()&&!(ds&&ds.index===this.lastIndex)){const Jt=this.getMatcher(0);Jt.lastIndex=this.lastIndex+1,ds=Jt.exec(Ue)}return ds&&(this.regexIndex+=ds.position+1,this.regexIndex===this.count&&this.considerAll()),ds}}function rt(qe){const Ue=new Be;return qe.contains.forEach(at=>Ue.addRule(at.begin,{rule:at,type:"begin"})),qe.terminatorEnd&&Ue.addRule(qe.terminatorEnd,{type:"end"}),qe.illegal&&Ue.addRule(qe.illegal,{type:"illegal"}),Ue}function Mt(qe,Ue){const at=qe;if(qe.isCompiled)return at;[He,Us,me,On].forEach(Jt=>Jt(qe,Ue)),H.compilerExtensions.forEach(Jt=>Jt(qe,Ue)),qe.__beforeBegin=null,[$e,St,Fs].forEach(Jt=>Jt(qe,Ue)),qe.isCompiled=!0;let ds=null;return typeof qe.keywords=="object"&&qe.keywords.$pattern&&(qe.keywords=Object.assign({},qe.keywords),ds=qe.keywords.$pattern,delete qe.keywords.$pattern),ds=ds||/\w+/,qe.keywords&&(qe.keywords=cn(qe.keywords,H.case_insensitive)),at.keywordPatternRe=ee(ds,!0),Ue&&(qe.begin||(qe.begin=/\B|\b/),at.beginRe=ee(at.begin),!qe.end&&!qe.endsWithParent&&(qe.end=/\B|\b/),qe.end&&(at.endRe=ee(at.end)),at.terminatorEnd=g(at.end)||"",qe.endsWithParent&&Ue.terminatorEnd&&(at.terminatorEnd+=(qe.end?"|":"")+Ue.terminatorEnd)),qe.illegal&&(at.illegalRe=ee(qe.illegal)),qe.contains||(qe.contains=[]),qe.contains=[].concat(...qe.contains.map(function(Jt){return Te(Jt==="self"?qe:Jt)})),qe.contains.forEach(function(Jt){Mt(Jt,at)}),qe.starts&&Mt(qe.starts,Ue),at.matcher=rt(at),at}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||{}),Mt(H)}function ce(H){return H?H.endsWithParent||ce(H.starts):!1}function Te(H){return H.variants&&!H.cachedVariants&&(H.cachedVariants=H.variants.map(function(ee){return n(H,{variants:null},ee)})),H.cachedVariants?H.cachedVariants:ce(H)?n(H,{starts:H.starts?n(H.starts):null}):Object.isFrozen(H)?n(H):H}var M="11.11.1";class ne extends Error{constructor(ee,fe){super(ee),this.name="HTMLInjectionError",this.html=fe}}const Ae=s,ge=n,ue=Symbol("nomatch"),Ce=7,ve=function(H){const ee=Object.create(null),fe=Object.create(null),Be=[];let rt=!0;const Mt="Could not find the language '{}', did you forget to load/include a language module?",qe={disableAutodetect:!0,name:"Plain text",contains:[]};let Ue={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:p};function at(Re){return Ue.noHighlightRe.test(Re)}function ds(Re){let Je=Re.className+" ";Je+=Re.parentNode?Re.parentNode.className:"";const pt=Ue.languageDetectRe.exec(Je);if(pt){const Ot=dn(pt[1]);return Ot||(Rt(Mt.replace("{}",pt[1])),Rt("Falling back to no-highlight mode for this block.",Re)),Ot?pt[1]:"no-highlight"}return Je.split(/\s+/).find(Ot=>at(Ot)||dn(Ot))}function Jt(Re,Je,pt){let Ot="",fs="";typeof Je=="object"?(Ot=Re,pt=Je.ignoreIllegals,fs=Je.language):(Ft("10.7.0","highlight(lang, code, ...args) has been deprecated."),Ft("10.7.0",`Please use highlight(code, options) instead.
|
|
180
|
+
https://github.com/highlightjs/highlight.js/issues/2277`),fs=Re,Ot=Je),pt===void 0&&(pt=!0);const tn={code:Ot,language:fs};ya("before:highlight",tn);const Ln=tn.result?tn.result:Zi(tn.language,tn.code,pt);return Ln.code=tn.code,ya("after:highlight",Ln),Ln}function Zi(Re,Je,pt,Ot){const fs=Object.create(null);function tn(Ie,Xe){return Ie.keywords[Xe]}function Ln(){if(!it.keywords){xs.addText(Lt);return}let Ie=0;it.keywordPatternRe.lastIndex=0;let Xe=it.keywordPatternRe.exec(Lt),ct="";for(;Xe;){ct+=Lt.substring(Ie,Xe.index);const vt=qs.case_insensitive?Xe[0].toLowerCase():Xe[0],ns=tn(it,vt);if(ns){const[Xn,wl]=ns;if(xs.addText(ct),ct="",fs[vt]=(fs[vt]||0)+1,fs[vt]<=Ce&&(Or+=wl),Xn.startsWith("_"))ct+=Xe[0];else{const ku=qs.classNameAliases[Xn]||Xn;zn(Xe[0],ku)}}else ct+=Xe[0];Ie=it.keywordPatternRe.lastIndex,Xe=it.keywordPatternRe.exec(Lt)}ct+=Lt.substring(Ie),xs.addText(ct)}function kn(){if(Lt==="")return;let Ie=null;if(typeof it.subLanguage=="string"){if(!ee[it.subLanguage]){xs.addText(Lt);return}Ie=Zi(it.subLanguage,Lt,!0,wu[it.subLanguage]),wu[it.subLanguage]=Ie._top}else Ie=uo(Lt,it.subLanguage.length?it.subLanguage:null);it.relevance>0&&(Or+=Ie.relevance),xs.__addSublanguage(Ie._emitter,Ie.language)}function Wt(){it.subLanguage!=null?kn():Ln(),Lt=""}function zn(Ie,Xe){Ie!==""&&(xs.startScope(Xe),xs.addText(Ie),xs.endScope())}function yu(Ie,Xe){let ct=1;const vt=Xe.length-1;for(;ct<=vt;){if(!Ie._emit[ct]){ct++;continue}const ns=qs.classNameAliases[Ie[ct]]||Ie[ct],Xn=Xe[ct];ns?zn(Xn,ns):(Lt=Xn,Ln(),Lt=""),ct++}}function fo(Ie,Xe){return Ie.scope&&typeof Ie.scope=="string"&&xs.openNode(qs.classNameAliases[Ie.scope]||Ie.scope),Ie.beginScope&&(Ie.beginScope._wrap?(zn(Lt,qs.classNameAliases[Ie.beginScope._wrap]||Ie.beginScope._wrap),Lt=""):Ie.beginScope._multi&&(yu(Ie.beginScope,Xe),Lt="")),it=Object.create(Ie,{parent:{value:it}}),it}function _l(Ie,Xe,ct){let vt=j(Ie.endRe,ct);if(vt){if(Ie["on:end"]){const ns=new t(Ie);Ie["on:end"](Xe,ns),ns.isMatchIgnored&&(vt=!1)}if(vt){for(;Ie.endsParent&&Ie.parent;)Ie=Ie.parent;return Ie}}if(Ie.endsWithParent)return _l(Ie.parent,Xe,ct)}function mo(Ie){return it.matcher.regexIndex===0?(Lt+=Ie[0],1):(Lr=!0,0)}function wf(Ie){const Xe=Ie[0],ct=Ie.rule,vt=new t(ct),ns=[ct.__beforeBegin,ct["on:begin"]];for(const Xn of ns)if(Xn&&(Xn(Ie,vt),vt.isMatchIgnored))return mo(Xe);return ct.skip?Lt+=Xe:(ct.excludeBegin&&(Lt+=Xe),Wt(),!ct.returnBegin&&!ct.excludeBegin&&(Lt=Xe)),fo(ct,Ie),ct.returnBegin?0:Xe.length}function Nn(Ie){const Xe=Ie[0],ct=Je.substring(Ie.index),vt=_l(it,Ie,ct);if(!vt)return ue;const ns=it;it.endScope&&it.endScope._wrap?(Wt(),zn(Xe,it.endScope._wrap)):it.endScope&&it.endScope._multi?(Wt(),yu(it.endScope,Ie)):ns.skip?Lt+=Xe:(ns.returnEnd||ns.excludeEnd||(Lt+=Xe),Wt(),ns.excludeEnd&&(Lt=Xe));do it.scope&&xs.closeNode(),!it.skip&&!it.subLanguage&&(Or+=it.relevance),it=it.parent;while(it!==vt.parent);return vt.starts&&fo(vt.starts,Ie),ns.returnEnd?0:Xe.length}function yl(){const Ie=[];for(let Xe=it;Xe!==qs;Xe=Xe.parent)Xe.scope&&Ie.unshift(Xe.scope);Ie.forEach(Xe=>xs.openNode(Xe))}let Sa={};function po(Ie,Xe){const ct=Xe&&Xe[0];if(Lt+=Ie,ct==null)return Wt(),0;if(Sa.type==="begin"&&Xe.type==="end"&&Sa.index===Xe.index&&ct===""){if(Lt+=Je.slice(Xe.index,Xe.index+1),!rt){const vt=new Error(`0 width match regex (${Re})`);throw vt.languageName=Re,vt.badRule=Sa.rule,vt}return 1}if(Sa=Xe,Xe.type==="begin")return wf(Xe);if(Xe.type==="illegal"&&!pt){const vt=new Error('Illegal lexeme "'+ct+'" for mode "'+(it.scope||"<unnamed>")+'"');throw vt.mode=it,vt}else if(Xe.type==="end"){const vt=Nn(Xe);if(vt!==ue)return vt}if(Xe.type==="illegal"&&ct==="")return Lt+=`
|
|
181
|
+
`,1;if(Sl>1e5&&Sl>Xe.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Lt+=ct,ct.length}const qs=dn(Re);if(!qs)throw wt(Mt.replace("{}",Re)),new Error('Unknown language: "'+Re+'"');const Su=be(qs);let go="",it=Ot||Su;const wu={},xs=new Ue.__emitter(Ue);yl();let Lt="",Or=0,er=0,Sl=0,Lr=!1;try{if(qs.__emitTokens)qs.__emitTokens(Je,xs);else{for(it.matcher.considerAll();;){Sl++,Lr?Lr=!1:it.matcher.considerAll(),it.matcher.lastIndex=er;const Ie=it.matcher.exec(Je);if(!Ie)break;const Xe=Je.substring(er,Ie.index),ct=po(Xe,Ie);er=Ie.index+ct}po(Je.substring(er))}return xs.finalize(),go=xs.toHTML(),{language:Re,value:go,relevance:Or,illegal:!1,_emitter:xs,_top:it}}catch(Ie){if(Ie.message&&Ie.message.includes("Illegal"))return{language:Re,value:Ae(Je),illegal:!0,relevance:0,_illegalBy:{message:Ie.message,index:er,context:Je.slice(er-100,er+100),mode:Ie.mode,resultSoFar:go},_emitter:xs};if(rt)return{language:Re,value:Ae(Je),illegal:!1,relevance:0,errorRaised:Ie,_emitter:xs,_top:it};throw Ie}}function co(Re){const Je={value:Ae(Re),illegal:!1,relevance:0,_top:qe,_emitter:new Ue.__emitter(Ue)};return Je._emitter.addText(Re),Je}function uo(Re,Je){Je=Je||Ue.languages||Object.keys(ee);const pt=co(Re),Ot=Je.filter(dn).filter(Mr).map(Wt=>Zi(Wt,Re,!1));Ot.unshift(pt);const fs=Ot.sort((Wt,zn)=>{if(Wt.relevance!==zn.relevance)return zn.relevance-Wt.relevance;if(Wt.language&&zn.language){if(dn(Wt.language).supersetOf===zn.language)return 1;if(dn(zn.language).supersetOf===Wt.language)return-1}return 0}),[tn,Ln]=fs,kn=tn;return kn.secondBest=Ln,kn}function Mi(Re,Je,pt){const Ot=Je&&fe[Je]||pt;Re.classList.add("hljs"),Re.classList.add(`language-${Ot}`)}function hs(Re){let Je=null;const pt=ds(Re);if(at(pt))return;if(ya("before:highlightElement",{el:Re,language:pt}),Re.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",Re);return}if(Re.children.length>0&&(Ue.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(Re)),Ue.throwUnescapedHTML))throw new ne("One of your code blocks includes unescaped HTML.",Re.innerHTML);Je=Re;const Ot=Je.textContent,fs=pt?Jt(Ot,{language:pt,ignoreIllegals:!0}):uo(Ot);Re.innerHTML=fs.value,Re.dataset.highlighted="yes",Mi(Re,pt,fs.language),Re.result={language:fs.language,re:fs.relevance,relevance:fs.relevance},fs.secondBest&&(Re.secondBest={language:fs.secondBest.language,relevance:fs.secondBest.relevance}),ya("after:highlightElement",{el:Re,result:fs,text:Ot})}function en(Re){Ue=ge(Ue,Re)}const Rr=()=>{ho(),Ft("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function xl(){ho(),Ft("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let xu=!1;function ho(){function Re(){ho()}if(document.readyState==="loading"){xu||window.addEventListener("DOMContentLoaded",Re,!1),xu=!0;return}document.querySelectorAll(Ue.cssSelector).forEach(hs)}function vu(Re,Je){let pt=null;try{pt=Je(H)}catch(Ot){if(wt("Language definition for '{}' could not be registered.".replace("{}",Re)),rt)wt(Ot);else throw Ot;pt=qe}pt.name||(pt.name=Re),ee[Re]=pt,pt.rawDefinition=Je.bind(null,H),pt.aliases&&Qi(pt.aliases,{languageName:Re})}function _a(Re){delete ee[Re];for(const Je of Object.keys(fe))fe[Je]===Re&&delete fe[Je]}function vl(){return Object.keys(ee)}function dn(Re){return Re=(Re||"").toLowerCase(),ee[Re]||ee[fe[Re]]}function Qi(Re,{languageName:Je}){typeof Re=="string"&&(Re=[Re]),Re.forEach(pt=>{fe[pt.toLowerCase()]=Je})}function Mr(Re){const Je=dn(Re);return Je&&!Je.disableAutodetect}function Dr(Re){Re["before:highlightBlock"]&&!Re["before:highlightElement"]&&(Re["before:highlightElement"]=Je=>{Re["before:highlightBlock"](Object.assign({block:Je.el},Je))}),Re["after:highlightBlock"]&&!Re["after:highlightElement"]&&(Re["after:highlightElement"]=Je=>{Re["after:highlightBlock"](Object.assign({block:Je.el},Je))})}function bs(Re){Dr(Re),Be.push(Re)}function _u(Re){const Je=Be.indexOf(Re);Je!==-1&&Be.splice(Je,1)}function ya(Re,Je){const pt=Re;Be.forEach(function(Ot){Ot[pt]&&Ot[pt](Je)})}function Ji(Re){return Ft("10.7.0","highlightBlock will be removed entirely in v12.0"),Ft("10.7.0","Please use highlightElement now."),hs(Re)}Object.assign(H,{highlight:Jt,highlightAuto:uo,highlightAll:ho,highlightElement:hs,highlightBlock:Ji,configure:en,initHighlighting:Rr,initHighlightingOnLoad:xl,registerLanguage:vu,unregisterLanguage:_a,listLanguages:vl,getLanguage:dn,registerAliases:Qi,autoDetection:Mr,inherit:ge,addPlugin:bs,removePlugin:_u}),H.debugMode=function(){rt=!1},H.safeMode=function(){rt=!0},H.versionString=M,H.regex={concat:k,lookahead:b,either:E,optional:w,anyNumberOfTimes:v};for(const Re in Qe)typeof Qe[Re]=="object"&&e(Qe[Re]);return Object.assign(H,Qe),H},Le=ve({});return Le.newInstance=()=>ve({}),Sg=Le,Le.HighlightJS=Le,Le.default=Le,Sg}var wg,ok;function YW(){if(ok)return wg;ok=1;function e(t){const s=t.regex,n=s.concat(/[\p{L}_]/u,s.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),o=/[\p{L}0-9._:-]+/u,l={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},u={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},h=t.inherit(u,{begin:/\(/,end:/\)/}),m=t.inherit(t.APOS_STRING_MODE,{className:"string"}),d=t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),p={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:o,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[l]},{begin:/'/,end:/'/,contains:[l]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[u,d,m,h,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[u,h,d,m]}]}]},t.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},l,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[d]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[p],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[p],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:s.concat(/</,s.lookahead(s.concat(n,s.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:p}]},{className:"tag",begin:s.concat(/<\//,s.lookahead(s.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}return wg=e,wg}var kg,lk;function XW(){if(lk)return kg;lk=1;function e(t){const s=t.regex,n={},o={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:s.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},o]});const l={className:"subst",begin:/\$\(/,end:/\)/,contains:[t.BACKSLASH_ESCAPE]},u=t.inherit(t.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),h={begin:/<<-?\s*(?=\w+)/,starts:{contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},m={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,n,l]};l.contains.push(m);const d={match:/\\"/},p={className:"string",begin:/'/,end:/'/},g={match:/\\'/},b={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"],A={match:/(\/[a-z._-]+)+/},j=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],T=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],P=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],z=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:N,literal:E,built_in:[...j,...T,"set","shopt",...P,...z]},contains:[w,t.SHEBANG(),k,b,u,h,A,m,d,p,g,n]}}return kg=e,kg}var Ng,ck;function ZW(){if(ck)return Ng;ck=1;function e(t){const s=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),o="decltype\\(auto\\)",l="[a-zA-Z_]\\w*::",h="("+o+"|"+s.optional(l)+"[a-zA-Z_]\\w*"+s.optional("<[^<>]+>")+")",m={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},p={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},g={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},b={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"},A=[b,m,n,t.C_BLOCK_COMMENT_MODE,g,p],j={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:E,contains:A.concat([{begin:/\(/,end:/\)/,keywords:E,contains:A.concat(["self"]),relevance:0}]),relevance:0},T={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,m,{begin:/\(/,end:/\)/,keywords:E,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,p,g,m]}]},m,n,t.C_BLOCK_COMMENT_MODE,b]};return{name:"C",aliases:["h"],keywords:E,disableAutodetect:!0,illegal:"</",contains:[].concat(j,T,A,[b,{begin:t.IDENT_RE+"::",keywords:E},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},t.TITLE_MODE]}]),exports:{preprocessor:b,strings:p,keywords:E}}}return Ng=e,Ng}var Cg,uk;function QW(){if(uk)return Cg;uk=1;function e(t){const s=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),o="decltype\\(auto\\)",l="[a-zA-Z_]\\w*::",h="(?!struct)("+o+"|"+s.optional(l)+"[a-zA-Z_]\\w*"+s.optional("<[^<>]+>")+")",m={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},p={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},g={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},b={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"],A=["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"],P={type:N,keyword:k,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:E},z={className:"function.dispatch",relevance:0,keywords:{_hint:A},begin:s.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,s.lookahead(/(<[^<>]+>|)\s*\(/))},L=[z,b,m,n,t.C_BLOCK_COMMENT_MODE,g,p],R={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:P,contains:L.concat([{begin:/\(/,end:/\)/,keywords:P,contains:L.concat(["self"]),relevance:0}]),relevance:0},D={className:"function",begin:"("+h+"[\\*&\\s]+)+"+w,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:P,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:o,keywords:P,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:P,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,p,g,m,{begin:/\(/,end:/\)/,keywords:P,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,p,g,m]}]},m,n,t.C_BLOCK_COMMENT_MODE,b]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:P,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(R,D,z,L,[b,{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:P,contains:["self",m]},{begin:t.IDENT_RE+"::",keywords:P},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}return Cg=e,Cg}var Eg,dk;function JW(){if(dk)return Eg;dk=1;function e(t){const s=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],n=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],o=["default","false","null","true"],l=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],u=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],h={keyword:l.concat(u),built_in:s,literal:o},m=t.inherit(t.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),d={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},p={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},g={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},b=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,b,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,d,t.inherit(t.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const A={variants:[p,N,k,g,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},j={begin:"<",end:">",contains:[{beginKeywords:"in out"},m]},T=t.IDENT_RE+"(<"+t.IDENT_RE+"(\\s*,\\s*"+t.IDENT_RE+")*>)?(\\[\\])?",P={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"}},A,d,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},m,j,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[m,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[m,j,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:"("+T+"\\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,j],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,relevance:0,contains:[A,d,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},P]}}return Eg=e,Eg}var jg,hk;function eK(){if(hk)return jg;hk=1;const e=d=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:d.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[d.APOS_STRING_MODE,d.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:d.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),t=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],s=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],n=[...t,...s],o=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),l=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),u=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),h=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function m(d){const p=d.regex,g=e(d),b={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,b,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 jg=m,jg}var Tg,fk;function tK(){if(fk)return Tg;fk=1;function e(t){const s=t.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},o={begin:"^[-\\*]{3,}",end:"$"},l={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},u={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},h={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},m=/[A-Za-z][A-Za-z0-9+.-]*/,d={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:s.concat(/\[.+?\]\(/,m,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},p={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},g={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},b=t.inherit(p,{contains:[]}),v=t.inherit(g,{contains:[]});p.contains.push(v),g.contains.push(b);let w=[n,d];return[p,g,b,v].forEach(A=>{A.contains=A.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 Tg=e,Tg}var Ag,mk;function sK(){if(mk)return Ag;mk=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 Ag=e,Ag}var Rg,pk;function nK(){if(pk)return Rg;pk=1;function e(t){const s=t.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",o=s.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),l=s.concat(o,/(::\w+)*/),h={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},m={className:"doctag",begin:"@[A-Za-z]+"},d={begin:"#<",end:">"},p=[t.COMMENT("#","$",{contains:[m]}),t.COMMENT("^=begin","^=end",{contains:[m],relevance:10}),t.COMMENT("^__END__",t.MATCH_NOTHING_RE)],g={className:"subst",begin:/#\{/,end:/\}/,keywords:h},b={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}]},L=[b,{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:[b,{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=L,N.contains=L;const V=[{begin:/^\s*=>/,starts:{end:"$",contains:L}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:h,contains:L}}];return p.unshift(d),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:h,illegal:/\/\*/,contains:[t.SHEBANG({binary:"ruby"})].concat(V).concat(p).concat(L)}}return Rg=e,Rg}var Mg,gk;function iK(){if(gk)return Mg;gk=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 Mg=e,Mg}var Dg,bk;function rK(){if(bk)return Dg;bk=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 Dg=e,Dg}var Og,xk;function aK(){if(xk)return Og;xk=1;function e(t){const s=t.regex,n={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:t.NUMBER_RE}]},o=t.COMMENT();o.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];const l={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},u={className:"literal",begin:/\bon|off|true|false|yes|no\b/},h={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},m={begin:/\[/,end:/\]/,contains:[o,u,l,h,n,"self"],relevance:0},d=/[A-Za-z0-9_-]+/,p=/"(\\"|[^"])*"/,g=/'[^']*'/,b=s.either(d,p,g),v=s.concat(b,"(\\s*\\.\\s*",b,")*",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,m,u,l,h,n]}}]}}return Og=e,Og}var Lg,vk;function oK(){if(vk)return Lg;vk=1;var e="[0-9](_*[0-9])*",t=`\\.(${e})`,s="[0-9a-fA-F](_*[0-9a-fA-F])*",n={className:"number",variants:[{begin:`(\\b(${e})((${t})|\\.)?|(${t}))[eE][+-]?(${e})[fFdD]?\\b`},{begin:`\\b(${e})((${t})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${t})[fFdD]?\\b`},{begin:`\\b(${e})[fFdD]\\b`},{begin:`\\b0[xX]((${s})\\.?|(${s})?\\.(${s}))[pP][+-]?(${e})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${s})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function o(u,h,m){return m===-1?"":u.replace(h,d=>o(u,h,m-1))}function l(u){const h=u.regex,m="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",d=m+o("(?:<"+m+"~~~(?:\\s*,\\s*"+m+"~~~)*>)?",/~~~/g,2),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:"@"+m,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+/,m],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[h.concat(/(?!else)/,m),/\s+/,m,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,m],className:{1:"keyword",3:"title.class"},contains:[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 Lg=l,Lg}var zg,_k;function lK(){if(_k)return zg;_k=1;const e="[A-Za-z$_][0-9A-Za-z$_]*",t=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],s=["true","false","null","undefined","NaN","Infinity"],n=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],o=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],l=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],u=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],h=[].concat(l,n,o);function m(d){const p=d.regex,g=(Ne,{after:Ge})=>{const Me="</"+Ne[0].slice(1);return Ne.input.indexOf(Me,Ge)!==-1},b=e,v={begin:"<>",end:"</>"},w=/<[A-Za-z0-9\\._:-]+\s*\/>/,k={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(Ne,Ge)=>{const Me=Ne[0].length+Ne.index,Qe=Ne.input[Me];if(Qe==="<"||Qe===","){Ge.ignoreMatch();return}Qe===">"&&(g(Ne,{after:Me})||Ge.ignoreMatch());let ke;const He=Ne.input.substring(Me);if(ke=He.match(/^\s*=/)){Ge.ignoreMatch();return}if((ke=He.match(/^\s+extends\s+/))&&ke.index===0){Ge.ignoreMatch();return}}},N={$pattern:e,keyword:t,literal:s,built_in:h,"variable.language":u},E="[0-9](_?[0-9])*",A=`\\.(${E})`,j="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",T={className:"number",variants:[{begin:`(\\b(${j})((${A})|\\.)?|(${A}))[eE][+-]?(${E})\\b`},{begin:`\\b(${j})\\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},P={className:"subst",begin:"\\$\\{",end:"\\}",keywords:N,contains:[]},z={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[d.BACKSLASH_ESCAPE,P],subLanguage:"xml"}},L={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[d.BACKSLASH_ESCAPE,P],subLanguage:"css"}},R={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[d.BACKSLASH_ESCAPE,P],subLanguage:"graphql"}},D={className:"string",begin:"`",end:"`",contains:[d.BACKSLASH_ESCAPE,P]},V={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:b+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),d.C_BLOCK_COMMENT_MODE,d.C_LINE_COMMENT_MODE]},X=[d.APOS_STRING_MODE,d.QUOTE_STRING_MODE,z,L,R,D,{match:/\$\d+/},T];P.contains=X.concat({begin:/\{/,end:/\}/,keywords:N,contains:["self"].concat(X)});const $=[].concat(V,P.contains),W=$.concat([{begin:/(\s*)\(/,end:/\)/,keywords:N,contains:["self"].concat($)}]),q={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:N,contains:W},B={variants:[{match:[/class/,/\s+/,b,/\s+/,/extends/,/\s+/,p.concat(b,"(",p.concat(/\./,b),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,b],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]}},U={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},K={variants:[{match:[/function/,/\s+/,b,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[q],illegal:/%/},Y={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function F(Ne){return p.concat("(?!",Ne.join("|"),")")}const ie={match:p.concat(/\b/,F([...l,"super","import"].map(Ne=>`${Ne}\\s*\\(`)),b,p.lookahead(/\s*\(/)),className:"title.function",relevance:0},Ee={begin:p.concat(/\./,p.lookahead(p.concat(b,/(?![0-9A-Za-z$_(])/))),end:b,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},ye={match:[/get|set/,/\s+/,b,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},q]},oe="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+d.UNDERSCORE_IDENT_RE+")\\s*=>",je={match:[/const|var|let/,/\s+/,b,/\s*/,/=\s*/,/(async\s*)?/,p.lookahead(oe)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[q]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:N,exports:{PARAMS_CONTAINS:W,CLASS_REFERENCE:Z},illegal:/#(?![$_A-z])/,contains:[d.SHEBANG({label:"shebang",binary:"node",relevance:5}),U,d.APOS_STRING_MODE,d.QUOTE_STRING_MODE,z,L,R,D,V,{match:/\$\d+/},T,Z,{scope:"attr",match:b+p.lookahead(":"),relevance:0},je,{begin:"("+d.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[V,d.REGEXP_MODE,{className:"function",begin:oe,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:W}]}]},{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"]}]}]},K,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+d.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[q,d.inherit(d.TITLE_MODE,{begin:b,className:"title.function"})]},{match:/\.\.\./,relevance:0},Ee,{match:"\\$"+b,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[q]},ie,Y,B,ye,{match:/\$[(.]/}]}}return zg=m,zg}var Bg,yk;function cK(){if(yk)return Bg;yk=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 Bg=e,Bg}var Ig,Sk;function uK(){if(Sk)return Ig;Sk=1;var e="[0-9](_*[0-9])*",t=`\\.(${e})`,s="[0-9a-fA-F](_*[0-9a-fA-F])*",n={className:"number",variants:[{begin:`(\\b(${e})((${t})|\\.)?|(${t}))[eE][+-]?(${e})[fFdD]?\\b`},{begin:`\\b(${e})((${t})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${t})[fFdD]?\\b`},{begin:`\\b(${e})[fFdD]\\b`},{begin:`\\b0[xX]((${s})\\.?|(${s})?\\.(${s}))[pP][+-]?(${e})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${s})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function o(l){const u={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},h={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},m={className:"symbol",begin:l.UNDERSCORE_IDENT_RE+"@"},d={className:"subst",begin:/\$\{/,end:/\}/,contains:[l.C_NUMBER_MODE]},p={className:"variable",begin:"\\$"+l.UNDERSCORE_IDENT_RE},g={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[p,d]},{begin:"'",end:"'",illegal:/\n/,contains:[l.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[l.BACKSLASH_ESCAPE,p,d]}]};d.contains.push(g);const b={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,m,b,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,b,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},b,v]},g,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:`
|
|
182
|
+
`},w]}}return Ig=o,Ig}var Pg,wk;function dK(){if(wk)return Pg;wk=1;const e=p=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:p.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[p.APOS_STRING_MODE,p.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:p.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),t=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],s=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],n=[...t,...s],o=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),l=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),u=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),h=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),m=l.concat(u).sort().reverse();function d(p){const g=e(p),b=m,v="and or not only",w="[\\w-]+",k="("+w+"|@\\{"+w+"\\})",N=[],E=[],A=function($){return{className:"string",begin:"~?"+$+".*?"+$}},j=function($,W,q){return{className:$,begin:W,relevance:q}},T={$pattern:/[a-z-]+/,keyword:v,attribute:o.join(" ")},P={begin:"\\(",end:"\\)",contains:E,keywords:T,relevance:0};E.push(p.C_LINE_COMMENT_MODE,p.C_BLOCK_COMMENT_MODE,A("'"),A('"'),g.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},g.HEXCOLOR,P,j("variable","@@?"+w,10),j("variable","@\\{"+w+"\\}"),j("built_in","~?`[^`]*?`"),{className:"attribute",begin:w+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},g.IMPORTANT,{beginKeywords:"and not"},g.FUNCTION_DISPATCH);const z=E.concat({begin:/\{/,end:/\}/,contains:N}),L={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(E)},R={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}}]},D={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:T,returnEnd:!0,contains:E,relevance:0}},I={className:"variable",variants:[{begin:"@"+w+"\\s*:",relevance:15},{begin:"@"+w}],starts:{end:"[;}]",returnEnd:!0,contains:z}},V={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:k,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[p.C_LINE_COMMENT_MODE,p.C_BLOCK_COMMENT_MODE,L,j("keyword","all\\b"),j("variable","@\\{"+w+"\\}"),{begin:"\\b("+n.join("|")+")\\b",className:"selector-tag"},g.CSS_NUMBER_MODE,j("selector-tag",k,0),j("selector-id","#"+k),j("selector-class","\\."+k,0),j("selector-tag","&",0),g.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+l.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+u.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:z},{begin:"!important"},g.FUNCTION_DISPATCH]},X={begin:w+`:(:)?(${b.join("|")})`,returnBegin:!0,contains:[V]};return N.push(p.C_LINE_COMMENT_MODE,p.C_BLOCK_COMMENT_MODE,D,I,X,R,V,L,g.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:N}}return Pg=d,Pg}var $g,kk;function hK(){if(kk)return $g;kk=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 $g=e,$g}var Hg,Nk;function fK(){if(Nk)return Hg;Nk=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 Hg=e,Hg}var Ug,Ck;function mK(){if(Ck)return Ug;Ck=1;function e(t){const s=t.regex,n=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],o=/[dualxmsipngr]{0,12}/,l={$pattern:/[\w.]+/,keyword:n.join(" ")},u={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:l},h={begin:/->\{/,end:/\}/},m={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},d={scope:"variable",variants:[{begin:/\$\d/},{begin:s.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[m]},p={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},g=[t.BACKSLASH_ESCAPE,u,d],b=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],v=(N,E,A="\\1")=>{const j=A==="\\1"?A:s.concat(A,E);return s.concat(s.concat("(?:",N,")"),E,/(?:\\.|[^\\\/])*?/,j,/(?:\\.|[^\\\/])*?/,A,o)},w=(N,E,A)=>s.concat(s.concat("(?:",N,")"),E,/(?:\\.|[^\\\/])*?/,A,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(...b,{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(...b,{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,m]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE,m,p]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return u.contains=k,h.contains=k,{name:"Perl",aliases:["pl","pm"],keywords:l,contains:k}}return Ug=e,Ug}var Fg,Ek;function pK(){if(Ek)return Fg;Ek=1;function e(t){const s={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},n=/[a-zA-Z@][a-zA-Z0-9_]*/,m={"variable.language":["this","super"],$pattern:n,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},d={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:m,illegal:"</",contains:[s,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,t.C_NUMBER_MODE,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,{className:"string",variants:[{begin:'@"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]}]},{className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),{className:"string",begin:/<.*?>/,end:/$/,illegal:"\\n"},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+d.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:d,contains:[t.UNDERSCORE_TITLE_MODE]},{begin:"\\."+t.UNDERSCORE_IDENT_RE,relevance:0}]}}return Fg=e,Fg}var qg,jk;function gK(){if(jk)return qg;jk=1;function e(t){const s=t.regex,n=/(?![A-Za-z0-9])(?![$])/,o=s.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),l=s.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),u=s.concat(/[A-Z]+/,n),h={scope:"variable",match:"\\$+"+o},m={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},d={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},p=t.inherit(t.APOS_STRING_MODE,{illegal:null}),g=t.inherit(t.QUOTE_STRING_MODE,{illegal:null,contains:t.QUOTE_STRING_MODE.contains.concat(d)}),b={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:t.QUOTE_STRING_MODE.contains.concat(d),"on:begin":(q,B)=>{B.data._beginMatch=q[1]||q[2]},"on:end":(q,B)=>{B.data._beginMatch!==q[1]&&B.ignoreMatch()}},v=t.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),w=`[
|
|
183
|
+
]`,k={scope:"string",variants:[g,p,b,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"],A=["__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"],j=["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"],P={keyword:A,literal:(q=>{const B=[];return q.forEach(Z=>{B.push(Z),Z.toLowerCase()===Z?B.push(Z.toUpperCase()):B.push(Z.toLowerCase())}),B})(E),built_in:j},z=q=>q.map(B=>B.replace(/\|\d+$/,"")),L={variants:[{match:[/new/,s.concat(w,"+"),s.concat("(?!",z(j).join("\\b|"),"\\b)"),l],scope:{1:"keyword",4:"title.class"}}]},R=s.concat(o,"\\b(?!\\()"),D={variants:[{match:[s.concat(/::/,s.lookahead(/(?!class\b)/)),R],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[l,s.concat(/::/,s.lookahead(/(?!class\b)/)),R],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"}}]},I={scope:"attr",match:s.concat(o,s.lookahead(":"),s.lookahead(/(?!::)/))},V={relevance:0,begin:/\(/,end:/\)/,keywords:P,contains:[I,h,D,t.C_BLOCK_COMMENT_MODE,k,N,L]},X={relevance:0,match:[/\b/,s.concat("(?!fn\\b|function\\b|",z(A).join("\\b|"),"|",z(j).join("\\b|"),"\\b)"),o,s.concat(w,"*"),s.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[V]};V.contains.push(X);const $=[I,D,t.C_BLOCK_COMMENT_MODE,k,N,L],W={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",...$]},...$,{scope:"meta",variants:[{match:l},{match:u}]}]};return{case_insensitive:!1,keywords:P,contains:[W,t.HASH_COMMENT_MODE,t.COMMENT("//","$"),t.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:t.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},m,{scope:"variable.language",match:/\$this\b/},h,X,D,{match:[/const/,/\s/,o],scope:{1:"keyword",3:"variable.constant"}},L,{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:P,contains:["self",W,h,D,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 qg=e,qg}var Vg,Tk;function bK(){if(Tk)return Vg;Tk=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 Vg=e,Vg}var Gg,Ak;function xK(){if(Ak)return Gg;Ak=1;function e(t){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}return Gg=e,Gg}var Wg,Rk;function vK(){if(Rk)return Wg;Rk=1;function e(t){const s=t.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),o=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],m={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:o,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},d={className:"meta",begin:/^(>>>|\.\.\.) /},p={className:"subst",begin:/\{/,end:/\}/,keywords:m,illegal:/#/},g={begin:/\{\{/,relevance:0},b={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:m,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},A={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:m,contains:["self",d,N,b,t.HASH_COMMENT_MODE]}]};return p.contains=[b,N,d],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:m,illegal:/(<\/|\?)|=>/,contains:[d,N,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},b,E,t.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[A]},{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,A,b]}]}}return Wg=e,Wg}var Kg,Mk;function _K(){if(Mk)return Kg;Mk=1;function e(t){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}return Kg=e,Kg}var Yg,Dk;function yK(){if(Dk)return Yg;Dk=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 Yg=e,Yg}var Xg,Ok;function SK(){if(Ok)return Xg;Ok=1;function e(t){const s=t.regex,n=/(r#)?/,o=s.concat(n,t.UNDERSCORE_IDENT_RE),l=s.concat(n,t.IDENT_RE),u={className:"title.function.invoke",relevance:0,begin:s.concat(/\b/,/(?!let|for|while|if|else|match\b)/,l,s.lookahead(/\s*\(/))},h="([ui](8|16|32|64|128|size)|f(32|64))?",m=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],d=["true","false","Some","None","Ok","Err"],p=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],g=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:t.IDENT_RE+"!?",type:g,keyword:m,literal:d,built_in:p},illegal:"</",contains:[t.C_LINE_COMMENT_MODE,t.COMMENT("/\\*","\\*/",{contains:["self"]}),t.inherit(t.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+h},{begin:"\\b0o([0-7_]+)"+h},{begin:"\\b0x([A-Fa-f0-9_]+)"+h},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+h}],relevance:0},{begin:[/fn/,/\s+/,o],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,o],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,o,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,o],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,o],className:{1:"keyword",3:"title.class"}},{begin:t.IDENT_RE+"::",keywords:{keyword:"Self",built_in:p,type:g}},{className:"punctuation",begin:"->"},u]}}return Xg=e,Xg}var Zg,Lk;function wK(){if(Lk)return Zg;Lk=1;const e=d=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:d.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[d.APOS_STRING_MODE,d.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:d.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),t=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],s=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],n=[...t,...s],o=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),l=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),u=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),h=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function m(d){const p=e(d),g=u,b=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:":("+b.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 Zg=m,Zg}var Qg,zk;function kK(){if(zk)return Qg;zk=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 Qg=e,Qg}var Jg,Bk;function NK(){if(Bk)return Jg;Bk=1;function e(t){const s=t.regex,n=t.COMMENT("--","$"),o={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},l={begin:/"/,end:/"/,contains:[{match:/""/}]},u=["true","false","unknown"],h=["double precision","large object","with timezone","without timezone"],m=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],d=["add","asc","collation","desc","final","first","last","view"],p=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],g=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],b=["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(z=>!g.includes(z)),N={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},E={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},A={match:s.concat(/\b/,s.either(...w),/\s*\(/),relevance:0,keywords:{built_in:w}};function j(z){return s.concat(/\b/,s.either(...z.map(L=>L.replace(/\s+/,"\\s+"))),/\b/)}const T={scope:"keyword",match:j(v),relevance:0};function P(z,{exceptions:L,when:R}={}){const D=R;return L=L||[],z.map(I=>I.match(/\|\d+$/)||L.includes(I)?I:D(I)?`${I}|0`:I)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:P(k,{when:z=>z.length<3}),literal:u,type:m,built_in:b},contains:[{scope:"type",match:j(h)},T,A,N,o,l,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,n,E]}}return Jg=e,Jg}var e0,Ik;function CK(){if(Ik)return e0;Ik=1;function e(R){return R?typeof R=="string"?R:R.source:null}function t(R){return s("(?=",R,")")}function s(...R){return R.map(I=>e(I)).join("")}function n(R){const D=R[R.length-1];return typeof D=="object"&&D.constructor===Object?(R.splice(R.length-1,1),D):{}}function o(...R){return"("+(n(R).capture?"":"?:")+R.map(V=>e(V)).join("|")+")"}const l=R=>s(/\b/,R,/\w$/.test(R)?/\b/:/\B/),u=["Protocol","Type"].map(l),h=["init","self"].map(l),m=["Any","Self"],d=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],p=["false","nil","true"],g=["assignment","associativity","higherThan","left","lowerThan","none","right"],b=["#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]/),A=o(E,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),j=s(E,A,"*"),T=s(/[A-Z]/,A,"*"),P=["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\(/,j,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],z=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function L(R){const D={match:/\s+/,relevance:0},I=R.COMMENT("/\\*","\\*/",{contains:["self"]}),V=[R.C_LINE_COMMENT_MODE,I],X={match:[/\./,o(...u,...h)],className:{2:"keyword"}},$={match:s(/\./,o(...d)),relevance:0},W=d.filter(ue=>typeof ue=="string").concat(["_|0"]),q=d.filter(ue=>typeof ue!="string").concat(m).map(l),B={variants:[{className:"keyword",match:o(...q,...h)}]},Z={$pattern:o(/\b\w+/,/#\w+/),keyword:W.concat(b),literal:p},U=[X,$,B],K={match:s(/\./,o(...v)),relevance:0},Y={className:"built_in",match:s(/\b/,o(...v),/(?=\()/)},F=[K,Y],ie={match:/->/,relevance:0},Ee={className:"operator",relevance:0,variants:[{match:N},{match:`\\.(\\.|${k})+`}]},ye=[ie,Ee],oe="([0-9]_*)+",je="([0-9a-fA-F]_*)+",Ne={className:"number",relevance:0,variants:[{match:`\\b(${oe})(\\.(${oe}))?([eE][+-]?(${oe}))?\\b`},{match:`\\b0x(${je})(\\.(${je}))?([pP][+-]?(${oe}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},Ge=(ue="")=>({className:"subst",variants:[{match:s(/\\/,ue,/[0\\tnr"']/)},{match:s(/\\/,ue,/u\{[0-9a-fA-F]{1,8}\}/)}]}),Me=(ue="")=>({className:"subst",match:s(/\\/,ue,/[\t ]*(?:[\r\n]|\r\n)/)}),Qe=(ue="")=>({className:"subst",label:"interpol",begin:s(/\\/,ue,/\(/),end:/\)/}),ke=(ue="")=>({begin:s(ue,/"""/),end:s(/"""/,ue),contains:[Ge(ue),Me(ue),Qe(ue)]}),He=(ue="")=>({begin:s(ue,/"/),end:s(/"/,ue),contains:[Ge(ue),Qe(ue)]}),$e={className:"string",variants:[ke(),ke("#"),ke("##"),ke("###"),He(),He("#"),He("##"),He("###")]},St=[R.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[R.BACKSLASH_ESCAPE]}],Us={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:St},Fs=ue=>{const Ce=s(ue,/\//),ve=s(/\//,ue);return{begin:Ce,end:ve,contains:[...St,{scope:"comment",begin:`#(?!.*${ve})`,end:/$/}]}},On={scope:"regexp",variants:[Fs("###"),Fs("##"),Fs("#"),Us]},wn={match:s(/`/,j,/`/)},js={className:"variable",match:/\$\d+/},cn={className:"variable",match:`\\$${A}+`},un=[wn,js,cn],Pe={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:z,contains:[...ye,Ne,$e]}]}},Ct={scope:"keyword",match:s(/@/,o(...P),t(o(/\(/,/\s+/)))},wt={scope:"meta",match:s(/@/,j)},Rt=[Pe,Ct,wt],Ft={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)/,A,"+")},{className:"type",match:T,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:s(/\s+&\s+/,t(T)),relevance:0}]},Qs={begin:/</,end:/>/,keywords:Z,contains:[...V,...U,...Rt,ie,Ft]};Ft.contains.push(Qs);const Js={match:s(j,/\s*:/),keywords:"_|0",relevance:0},Ri={begin:/\(/,end:/\)/,relevance:0,keywords:Z,contains:["self",Js,...V,On,...U,...F,...ye,Ne,$e,...un,...Rt,Ft]},S={begin:/</,end:/>/,keywords:"repeat each",contains:[...V,Ft]},se={begin:o(t(s(j,/\s*:/)),t(s(j,/\s+/,j,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:j}]},me={begin:/\(/,end:/\)/,keywords:Z,contains:[se,...V,...U,...ye,Ne,$e,...Rt,Ft,Ri],endsParent:!0,illegal:/["']/},be={match:[/(func|macro)/,/\s+/,o(wn.match,j,N)],className:{1:"keyword",3:"title.function"},contains:[S,me,D],illegal:[/\[/,/%/]},ce={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[S,me,D],illegal:/\[|%/},Te={match:[/operator/,/\s+/,N],className:{1:"keyword",3:"title"}},M={begin:[/precedencegroup/,/\s+/,T],className:{1:"keyword",3:"title"},contains:[Ft],keywords:[...g,...p],end:/}/},ne={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Ae={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},ge={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,j,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:Z,contains:[S,...U,{begin:/:/,end:/\{/,keywords:Z,contains:[{scope:"title.class.inherited",match:T},...U],relevance:0}]};for(const ue of $e.variants){const Ce=ue.contains.find(Le=>Le.label==="interpol");Ce.keywords=Z;const ve=[...U,...F,...ye,Ne,$e,...un];Ce.contains=[...ve,{begin:/\(/,end:/\)/,contains:["self",...ve]}]}return{name:"Swift",keywords:Z,contains:[...V,be,ce,ne,Ae,ge,Te,M,{beginKeywords:"import",end:/$/,contains:[...V],relevance:0},On,...U,...F,...ye,Ne,$e,...un,...Rt,Ft,Ri]}}return e0=L,e0}var t0,Pk;function EK(){if(Pk)return t0;Pk=1;function e(t){const s="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",o={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},l={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},u={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},h={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[t.BACKSLASH_ESCAPE,l]},m=t.inherit(h,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),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],A=[...E];return A.pop(),A.push(m),w.contains=A,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:E}}return t0=e,t0}var s0,$k;function jK(){if($k)return s0;$k=1;const e="[A-Za-z$_][0-9A-Za-z$_]*",t=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],s=["true","false","null","undefined","NaN","Infinity"],n=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],o=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],l=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],u=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],h=[].concat(l,n,o);function m(p){const g=p.regex,b=(Ge,{after:Me})=>{const Qe="</"+Ge[0].slice(1);return Ge.input.indexOf(Qe,Me)!==-1},v=e,w={begin:"<>",end:"</>"},k=/<[A-Za-z0-9\\._:-]+\s*\/>/,N={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(Ge,Me)=>{const Qe=Ge[0].length+Ge.index,ke=Ge.input[Qe];if(ke==="<"||ke===","){Me.ignoreMatch();return}ke===">"&&(b(Ge,{after:Qe})||Me.ignoreMatch());let He;const $e=Ge.input.substring(Qe);if(He=$e.match(/^\s*=/)){Me.ignoreMatch();return}if((He=$e.match(/^\s+extends\s+/))&&He.index===0){Me.ignoreMatch();return}}},E={$pattern:e,keyword:t,literal:s,built_in:h,"variable.language":u},A="[0-9](_?[0-9])*",j=`\\.(${A})`,T="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",P={className:"number",variants:[{begin:`(\\b(${T})((${j})|\\.)?|(${j}))[eE][+-]?(${A})\\b`},{begin:`\\b(${T})\\b((${j})\\b|\\.)?|(${j})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},z={className:"subst",begin:"\\$\\{",end:"\\}",keywords:E,contains:[]},L={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[p.BACKSLASH_ESCAPE,z],subLanguage:"xml"}},R={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[p.BACKSLASH_ESCAPE,z],subLanguage:"css"}},D={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[p.BACKSLASH_ESCAPE,z],subLanguage:"graphql"}},I={className:"string",begin:"`",end:"`",contains:[p.BACKSLASH_ESCAPE,z]},X={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]},$=[p.APOS_STRING_MODE,p.QUOTE_STRING_MODE,L,R,D,I,{match:/\$\d+/},P];z.contains=$.concat({begin:/\{/,end:/\}/,keywords:E,contains:["self"].concat($)});const W=[].concat(X,z.contains),q=W.concat([{begin:/(\s*)\(/,end:/\)/,keywords:E,contains:["self"].concat(W)}]),B={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:E,contains:q},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"}}]},U={relevance:0,match:g.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...n,...o]}},K={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},Y={variants:[{match:[/function/,/\s+/,v,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[B],illegal:/%/},F={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function ie(Ge){return g.concat("(?!",Ge.join("|"),")")}const Ee={match:g.concat(/\b/,ie([...l,"super","import"].map(Ge=>`${Ge}\\s*\\(`)),v,g.lookahead(/\s*\(/)),className:"title.function",relevance:0},ye={begin:g.concat(/\./,g.lookahead(g.concat(v,/(?![0-9A-Za-z$_(])/))),end:v,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},oe={match:[/get|set/,/\s+/,v,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},B]},je="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+p.UNDERSCORE_IDENT_RE+")\\s*=>",Ne={match:[/const|var|let/,/\s+/,v,/\s*/,/=\s*/,/(async\s*)?/,g.lookahead(je)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[B]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:E,exports:{PARAMS_CONTAINS:q,CLASS_REFERENCE:U},illegal:/#(?![$_A-z])/,contains:[p.SHEBANG({label:"shebang",binary:"node",relevance:5}),K,p.APOS_STRING_MODE,p.QUOTE_STRING_MODE,L,R,D,I,X,{match:/\$\d+/},P,U,{scope:"attr",match:v+g.lookahead(":"),relevance:0},Ne,{begin:"("+p.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[X,p.REGEXP_MODE,{className:"function",begin:je,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:q}]}]},{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"]}]}]},Y,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+p.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[B,p.inherit(p.TITLE_MODE,{begin:v,className:"title.function"})]},{match:/\.\.\./,relevance:0},ye,{match:"\\$"+v,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[B]},Ee,F,Z,oe,{match:/\$[(.]/}]}}function d(p){const g=p.regex,b=m(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:[b.exports.CLASS_REFERENCE]},E={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},A=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],j={$pattern:e,keyword:t.concat(A),literal:s,built_in:h.concat(w),"variable.language":u},T={className:"meta",begin:"@"+v},P=(D,I,V)=>{const X=D.contains.findIndex($=>$.label===I);if(X===-1)throw new Error("can not find mode to replace");D.contains.splice(X,1,V)};Object.assign(b.keywords,j),b.exports.PARAMS_CONTAINS.push(T);const z=b.contains.find(D=>D.scope==="attr"),L=Object.assign({},z,{match:g.concat(v,g.lookahead(/\s*\?:/))});b.exports.PARAMS_CONTAINS.push([b.exports.CLASS_REFERENCE,z,L]),b.contains=b.contains.concat([T,k,N,L]),P(b,"shebang",p.SHEBANG()),P(b,"use_strict",E);const R=b.contains.find(D=>D.label==="func.def");return R.relevance=0,Object.assign(b,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),b}return s0=d,s0}var n0,Hk;function TK(){if(Hk)return n0;Hk=1;function e(t){const s=t.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},o={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},l=/\d{1,2}\/\d{1,2}\/\d{4}/,u=/\d{4}-\d{1,2}-\d{1,2}/,h=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,m=/\d{1,2}(:\d{1,2}){1,2}/,d={className:"literal",variants:[{begin:s.concat(/# */,s.either(u,l),/ *#/)},{begin:s.concat(/# */,m,/ *#/)},{begin:s.concat(/# */,h,/ *#/)},{begin:s.concat(/# */,s.either(u,l),/ +/,s.either(h,m),/ *#/)}]},p={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},g={className:"label",begin:/^\w+:/},b=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,b,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 n0=e,n0}var i0,Uk;function AK(){if(Uk)return i0;Uk=1;function e(t){t.regex;const s=t.COMMENT(/\(;/,/;\)/);s.contains.push("self");const n=t.COMMENT(/;;/,/$/),o=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],l={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},u={className:"variable",begin:/\$[\w_]+/},h={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},m={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},d={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},p={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:o},contains:[n,s,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},u,h,l,t.QUOTE_STRING_MODE,d,p,m]}}return i0=e,i0}var r0,Fk;function RK(){if(Fk)return r0;Fk=1;var e=KW();return e.registerLanguage("xml",YW()),e.registerLanguage("bash",XW()),e.registerLanguage("c",ZW()),e.registerLanguage("cpp",QW()),e.registerLanguage("csharp",JW()),e.registerLanguage("css",eK()),e.registerLanguage("markdown",tK()),e.registerLanguage("diff",sK()),e.registerLanguage("ruby",nK()),e.registerLanguage("go",iK()),e.registerLanguage("graphql",rK()),e.registerLanguage("ini",aK()),e.registerLanguage("java",oK()),e.registerLanguage("javascript",lK()),e.registerLanguage("json",cK()),e.registerLanguage("kotlin",uK()),e.registerLanguage("less",dK()),e.registerLanguage("lua",hK()),e.registerLanguage("makefile",fK()),e.registerLanguage("perl",mK()),e.registerLanguage("objectivec",pK()),e.registerLanguage("php",gK()),e.registerLanguage("php-template",bK()),e.registerLanguage("plaintext",xK()),e.registerLanguage("python",vK()),e.registerLanguage("python-repl",_K()),e.registerLanguage("r",yK()),e.registerLanguage("rust",SK()),e.registerLanguage("scss",wK()),e.registerLanguage("shell",kK()),e.registerLanguage("sql",NK()),e.registerLanguage("swift",CK()),e.registerLanguage("yaml",EK()),e.registerLanguage("typescript",jK()),e.registerLanguage("vbnet",TK()),e.registerLanguage("wasm",AK()),e.HighlightJS=e,e.default=e,r0=e,r0}var MK=RK();const wb=kA(MK);function DK(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 L5({content:e}){const t=y.useMemo(()=>{const n=Dt.parse(e,{async:!1,gfm:!0,breaks:!1});return DK(n)},[e]),s=y.useRef(null);return y.useEffect(()=>{const n=s.current;n&&n.querySelectorAll("pre code").forEach(o=>{wb.highlightElement(o)})},[t]),r.jsx("div",{ref:s,className:"md-preview min-w-0 px-6 py-5",dangerouslySetInnerHTML:{__html:t}})}var OK=Object.create,z5=Object.defineProperty,LK=Object.getOwnPropertyDescriptor,zK=Object.getOwnPropertyNames,BK=Object.getPrototypeOf,IK=Object.prototype.hasOwnProperty,Qt=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),PK=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(var o=zK(t),l=0,u=o.length,h;l<u;l++)h=o[l],!IK.call(e,h)&&h!==s&&z5(e,h,{get:(m=>t[m]).bind(null,h),enumerable:!(n=LK(t,h))||n.enumerable});return e},$K=(e,t,s)=>(s=e!=null?OK(BK(e)):{},PK(z5(s,"default",{value:e,enumerable:!0}),e)),gu=Qt(((e,t)=>{function s(m){return typeof m>"u"||m===null}function n(m){return typeof m=="object"&&m!==null}function o(m){return Array.isArray(m)?m:s(m)?[]:[m]}function l(m,d){if(d){const p=Object.keys(d);for(let g=0,b=p.length;g<b;g+=1){const v=p[g];m[v]=d[v]}}return m}function u(m,d){let p="";for(let g=0;g<d;g+=1)p+=m;return p}function h(m){return m===0&&Number.NEGATIVE_INFINITY===1/m}t.exports.isNothing=s,t.exports.isObject=n,t.exports.toArray=o,t.exports.repeat=u,t.exports.isNegativeZero=h,t.exports.extend=l})),bu=Qt(((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+=`
|
|
184
|
+
|
|
185
|
+
`+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})),HK=Qt(((e,t)=>{var s=gu();function n(u,h,m,d,p){let g="",b="";const v=Math.floor(p/2)-1;return d-h>v&&(g=" ... ",h=d-v+g.length),m-d>v&&(b=" ...",m=d+v-b.length),{str:g+u.slice(h,m).replace(/\t/g,"→")+b,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 m=/\r?\n|\r|\0/g,d=[0],p=[];let g,b=-1;for(;g=m.exec(u.buffer);)p.push(g.index),d.push(g.index+g[0].length),u.position<=g.index&&b<0&&(b=d.length-2);b<0&&(b=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&&!(b-E<0);E++){const A=n(u.buffer,d[b-E],p[b-E],u.position-(d[b]-d[b-E]),k);v=s.repeat(" ",h.indent)+o((u.line-E+1).toString(),w)+" | "+A.str+`
|
|
186
|
+
`+v}const N=n(u.buffer,d[b],p[b],u.position,k);v+=s.repeat(" ",h.indent)+o((u.line+1).toString(),w)+" | "+N.str+`
|
|
187
|
+
`,v+=s.repeat("-",h.indent+w+3+N.pos)+`^
|
|
188
|
+
`;for(let E=1;E<=h.linesAfter&&!(b+E>=p.length);E++){const A=n(u.buffer,d[b+E],p[b+E],u.position-(d[b]-d[b+E]),k);v+=s.repeat(" ",h.indent)+o((u.line+E+1).toString(),w)+" | "+A.str+`
|
|
189
|
+
`}return v.replace(/\n$/,"")}t.exports=l})),Sn=Qt(((e,t)=>{var s=bu(),n=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],o=["scalar","sequence","mapping"];function l(h){const m={};return h!==null&&Object.keys(h).forEach(function(d){h[d].forEach(function(p){m[String(p)]=d})}),m}function u(h,m){if(m=m||{},Object.keys(m).forEach(function(d){if(n.indexOf(d)===-1)throw new s('Unknown option "'+d+'" is met in definition of "'+h+'" YAML type.')}),this.options=m,this.tag=h,this.kind=m.kind||null,this.resolve=m.resolve||function(){return!0},this.construct=m.construct||function(d){return d},this.instanceOf=m.instanceOf||null,this.predicate=m.predicate||null,this.represent=m.represent||null,this.representName=m.representName||null,this.defaultStyle=m.defaultStyle||null,this.multi=m.multi||!1,this.styleAliases=l(m.styleAliases||null),o.indexOf(this.kind)===-1)throw new s('Unknown kind "'+this.kind+'" is specified for "'+h+'" YAML type.')}t.exports=u})),B5=Qt(((e,t)=>{var s=bu(),n=Sn();function o(h,m){const d=[];return h[m].forEach(function(p){let g=d.length;d.forEach(function(b,v){b.tag===p.tag&&b.kind===p.kind&&b.multi===p.multi&&(g=v)}),d[g]=p}),d}function l(){const h={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function m(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(m);return h}function u(h){return this.extend(h)}u.prototype.extend=function(m){let d=[],p=[];if(m instanceof n)p.push(m);else if(Array.isArray(m))p=p.concat(m);else if(m&&(Array.isArray(m.implicit)||Array.isArray(m.explicit)))m.implicit&&(d=d.concat(m.implicit)),m.explicit&&(p=p.concat(m.explicit));else throw new s("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");d.forEach(function(b){if(!(b instanceof n))throw new s("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(b.loadKind&&b.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(b.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(b){if(!(b 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})),I5=Qt(((e,t)=>{t.exports=new(Sn())("tag:yaml.org,2002:str",{kind:"scalar",construct:function(s){return s!==null?s:""}})})),P5=Qt(((e,t)=>{t.exports=new(Sn())("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(s){return s!==null?s:[]}})})),$5=Qt(((e,t)=>{t.exports=new(Sn())("tag:yaml.org,2002:map",{kind:"mapping",construct:function(s){return s!==null?s:{}}})})),H5=Qt(((e,t)=>{t.exports=new(B5())({explicit:[I5(),P5(),$5()]})})),U5=Qt(((e,t)=>{var s=Sn();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"})})),F5=Qt(((e,t)=>{var s=Sn();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"})})),q5=Qt(((e,t)=>{var s=gu(),n=Sn();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 b=g.length;let v=0,w=!1;if(!b)return!1;let k=g[v];if((k==="-"||k==="+")&&(k=g[++v]),k==="0"){if(v+1===b)return!0;if(k=g[++v],k==="b"){for(v++;v<b;v++){if(k=g[v],k!=="0"&&k!=="1")return!1;w=!0}return w&&Number.isFinite(m(g))}if(k==="x"){for(v++;v<b;v++){if(!o(g.charCodeAt(v)))return!1;w=!0}return w&&Number.isFinite(m(g))}if(k==="o"){for(v++;v<b;v++){if(!l(g.charCodeAt(v)))return!1;w=!0}return w&&Number.isFinite(m(g))}}for(;v<b;v++){if(!u(g.charCodeAt(v)))return!1;w=!0}return w?Number.isFinite(m(g)):!1}function m(g){let b=g,v=1,w=b[0];if((w==="-"||w==="+")&&(w==="-"&&(v=-1),b=b.slice(1),w=b[0]),b==="0")return 0;if(w==="0"){if(b[1]==="b")return v*parseInt(b.slice(2),2);if(b[1]==="x")return v*parseInt(b.slice(2),16);if(b[1]==="o")return v*parseInt(b.slice(2),8)}return v*parseInt(b,10)}function d(g){return m(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"]}})})),V5=Qt(((e,t)=>{var s=gu(),n=Sn(),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 b=g.toLowerCase();const v=b[0]==="-"?-1:1;return"+-".indexOf(b[0])>=0&&(b=b.slice(1)),b===".inf"?v===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:b===".nan"?NaN:v*parseFloat(b,10)}var m=/^[-+]?[0-9]+e/;function d(g,b){if(isNaN(g))switch(b){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===g)switch(b){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===g)switch(b){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 m.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"})})),G5=Qt(((e,t)=>{t.exports=H5().extend({implicit:[U5(),F5(),q5(),V5()]})})),W5=Qt(((e,t)=>{t.exports=G5()})),K5=Qt(((e,t)=>{var s=Sn(),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(m){return m===null?!1:n.exec(m)!==null||o.exec(m)!==null}function u(m){let d=0,p=null,g=n.exec(m);if(g===null&&(g=o.exec(m)),g===null)throw new Error("Date resolve error");const b=+g[1],v=+g[2]-1,w=+g[3];if(!g[4])return new Date(Date.UTC(b,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 j=+g[10],T=+(g[11]||0);p=(j*60+T)*6e4,g[9]==="-"&&(p=-p)}const A=new Date(Date.UTC(b,v,w,k,N,E,d));return p&&A.setTime(A.getTime()-p),A}function h(m){return m.toISOString()}t.exports=new s("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:l,construct:u,instanceOf:Date,represent:h})})),Y5=Qt(((e,t)=>{var s=Sn();function n(o){return o==="<<"||o===null}t.exports=new s("tag:yaml.org,2002:merge",{kind:"scalar",resolve:n})})),X5=Qt(((e,t)=>{var s=Sn(),n=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
190
|
+
\r`;function o(m){if(m===null)return!1;let d=0;const p=m.length,g=n;for(let b=0;b<p;b++){const v=g.indexOf(m.charAt(b));if(!(v>64)){if(v<0)return!1;d+=6}}return d%8===0}function l(m){const d=m.replace(/[\r\n=]/g,""),p=d.length,g=n;let b=0;const v=[];for(let k=0;k<p;k++)k%4===0&&k&&(v.push(b>>16&255),v.push(b>>8&255),v.push(b&255)),b=b<<6|g.indexOf(d.charAt(k));const w=p%4*6;return w===0?(v.push(b>>16&255),v.push(b>>8&255),v.push(b&255)):w===18?(v.push(b>>10&255),v.push(b>>2&255)):w===12&&v.push(b>>4&255),new Uint8Array(v)}function u(m){let d="",p=0;const g=m.length,b=n;for(let w=0;w<g;w++)w%3===0&&w&&(d+=b[p>>18&63],d+=b[p>>12&63],d+=b[p>>6&63],d+=b[p&63]),p=(p<<8)+m[w];const v=g%3;return v===0?(d+=b[p>>18&63],d+=b[p>>12&63],d+=b[p>>6&63],d+=b[p&63]):v===2?(d+=b[p>>10&63],d+=b[p>>4&63],d+=b[p<<2&63],d+=b[64]):v===1&&(d+=b[p>>2&63],d+=b[p<<4&63],d+=b[64],d+=b[64]),d}function h(m){return Object.prototype.toString.call(m)==="[object Uint8Array]"}t.exports=new s("tag:yaml.org,2002:binary",{kind:"scalar",resolve:o,construct:l,predicate:h,represent:u})})),Z5=Qt(((e,t)=>{var s=Sn(),n=Object.prototype.hasOwnProperty,o=Object.prototype.toString;function l(h){if(h===null)return!0;const m=[],d=h;for(let p=0,g=d.length;p<g;p+=1){const b=d[p];let v=!1;if(o.call(b)!=="[object Object]")return!1;let w;for(w in b)if(n.call(b,w))if(!v)v=!0;else return!1;if(!v)return!1;if(m.indexOf(w)===-1)m.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})})),Q5=Qt(((e,t)=>{var s=Sn(),n=Object.prototype.toString;function o(u){if(u===null)return!0;const h=u,m=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 b=Object.keys(g);if(b.length!==1)return!1;m[d]=[b[0],g[b[0]]]}return!0}function l(u){if(u===null)return[];const h=u,m=new Array(h.length);for(let d=0,p=h.length;d<p;d+=1){const g=h[d],b=Object.keys(g);m[d]=[b[0],g[b[0]]]}return m}t.exports=new s("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:o,construct:l})})),J5=Qt(((e,t)=>{var s=Sn(),n=Object.prototype.hasOwnProperty;function o(u){if(u===null)return!0;const h=u;for(const m in h)if(n.call(h,m)&&h[m]!==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})})),Hx=Qt(((e,t)=>{t.exports=W5().extend({implicit:[K5(),Y5()],explicit:[X5(),Z5(),Q5(),J5()]})})),UK=Qt(((e,t)=>{var s=gu(),n=bu(),o=HK(),l=Hx(),u=Object.prototype.hasOwnProperty,h=1,m=2,d=3,p=4,g=1,b=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-]+!)$/,A=/^(?:!|[^,\[\]{}])(?:%[0-9a-f]{2}|[0-9a-z\-#;/?:@&=+$,_.!~*'()\[\]])*$/i;function j(S){return Object.prototype.toString.call(S)}function T(S){return S===10||S===13}function P(S){return S===9||S===32}function z(S){return S===9||S===32||S===10||S===13}function L(S){return S===44||S===91||S===93||S===123||S===125}function R(S){if(S>=48&&S<=57)return S-48;const se=S|32;return se>=97&&se<=102?se-97+10:-1}function D(S){return S===120?2:S===117?4:S===85?8:0}function I(S){return S>=48&&S<=57?S-48:-1}function V(S){switch(S){case 48:return"\0";case 97:return"\x07";case 98:return"\b";case 116:return" ";case 9:return" ";case 110:return`
|
|
191
|
+
`;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 X(S){return S<=65535?String.fromCharCode(S):String.fromCharCode((S-65536>>10)+55296,(S-65536&1023)+56320)}function $(S,se,me){se==="__proto__"?Object.defineProperty(S,se,{configurable:!0,enumerable:!0,writable:!0,value:me}):S[se]=me}var W=new Array(256),q=new Array(256);for(let S=0;S<256;S++)W[S]=V(S)?1:0,q[S]=V(S);function B(S,se){this.input=S,this.filename=se.filename||null,this.schema=se.schema||l,this.onWarning=se.onWarning||null,this.legacy=se.legacy||!1,this.json=se.json||!1,this.listener=se.listener||null,this.maxDepth=typeof se.maxDepth=="number"?se.maxDepth:100,this.maxMergeSeqLength=typeof se.maxMergeSeqLength=="number"?se.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,se){const me={name:S.filename,buffer:S.input.slice(0,-1),position:S.position,line:S.line,column:S.position-S.lineStart};return me.snippet=o(me),new n(se,me)}function U(S,se){throw Z(S,se)}function K(S,se){S.onWarning&&S.onWarning.call(null,Z(S,se))}function Y(S,se,me){const be=S.anchorMapTransactions;if(be.length!==0){const ce=be[be.length-1];u.call(ce,se)||(ce[se]={existed:u.call(S.anchorMap,se),value:S.anchorMap[se]})}S.anchorMap[se]=me}function F(S){S.anchorMapTransactions.push(Object.create(null))}function ie(S){const se=S.anchorMapTransactions.pop(),me=S.anchorMapTransactions;if(me.length===0)return;const be=me[me.length-1],ce=Object.keys(se);for(let Te=0,M=ce.length;Te<M;Te+=1){const ne=ce[Te];u.call(be,ne)||(be[ne]=se[ne])}}function Ee(S){const se=S.anchorMapTransactions.pop(),me=Object.keys(se);for(let be=me.length-1;be>=0;be-=1){const ce=se[me[be]];ce.existed?S.anchorMap[me[be]]=ce.value:delete S.anchorMap[me[be]]}}function ye(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 oe(S,se){S.position=se.position,S.line=se.line,S.lineStart=se.lineStart,S.lineIndent=se.lineIndent,S.firstTabInLine=se.firstTabInLine,S.tag=se.tag,S.anchor=se.anchor,S.kind=se.kind,S.result=se.result}var je={YAML:function(se,me,be){se.version!==null&&U(se,"duplication of %YAML directive"),be.length!==1&&U(se,"YAML directive accepts exactly one argument");const ce=/^([0-9]+)\.([0-9]+)$/.exec(be[0]);ce===null&&U(se,"ill-formed argument of the YAML directive");const Te=parseInt(ce[1],10),M=parseInt(ce[2],10);Te!==1&&U(se,"unacceptable YAML version of the document"),se.version=be[0],se.checkLineBreaks=M<2,M!==1&&M!==2&&K(se,"unsupported YAML version of the document")},TAG:function(se,me,be){let ce;be.length!==2&&U(se,"TAG directive accepts exactly two arguments");const Te=be[0];ce=be[1],E.test(Te)||U(se,"ill-formed tag handle (first argument) of the TAG directive"),u.call(se.tagMap,Te)&&U(se,'there is a previously declared suffix for "'+Te+'" tag handle'),A.test(ce)||U(se,"ill-formed tag prefix (second argument) of the TAG directive");try{ce=decodeURIComponent(ce)}catch{U(se,"tag prefix is malformed: "+ce)}se.tagMap[Te]=ce}};function Ne(S,se,me,be){if(se<me){const ce=S.input.slice(se,me);if(be)for(let Te=0,M=ce.length;Te<M;Te+=1){const ne=ce.charCodeAt(Te);ne===9||ne>=32&&ne<=1114111||U(S,"expected valid JSON character")}else w.test(ce)&&U(S,"the stream contains non-printable characters");S.result+=ce}}function Ge(S,se,me,be){s.isObject(me)||U(S,"cannot merge mappings; the provided source object is unacceptable");const ce=Object.keys(me);for(let Te=0,M=ce.length;Te<M;Te+=1){const ne=ce[Te];u.call(se,ne)||($(se,ne,me[ne]),be[ne]=!0)}}function Me(S,se,me,be,ce,Te,M,ne,Ae){if(Array.isArray(ce)){ce=Array.prototype.slice.call(ce);for(let ge=0,ue=ce.length;ge<ue;ge+=1)Array.isArray(ce[ge])&&U(S,"nested arrays are not supported inside keys"),typeof ce=="object"&&j(ce[ge])==="[object Object]"&&(ce[ge]="[object Object]")}if(typeof ce=="object"&&j(ce)==="[object Object]"&&(ce="[object Object]"),ce=String(ce),se===null&&(se={}),be==="tag:yaml.org,2002:merge")if(Array.isArray(Te)){Te.length>S.maxMergeSeqLength&&U(S,"merge sequence length exceeded maxMergeSeqLength ("+S.maxMergeSeqLength+")");const ge=new Set;for(let ue=0,Ce=Te.length;ue<Ce;ue+=1){const ve=Te[ue];ge.has(ve)||(ge.add(ve),Ge(S,se,ve,me))}}else Ge(S,se,Te,me);else!S.json&&!u.call(me,ce)&&u.call(se,ce)&&(S.line=M||S.line,S.lineStart=ne||S.lineStart,S.position=Ae||S.position,U(S,"duplicated mapping key")),$(se,ce,Te),delete me[ce];return se}function Qe(S){const se=S.input.charCodeAt(S.position);se===10?S.position++:se===13?(S.position++,S.input.charCodeAt(S.position)===10&&S.position++):U(S,"a line break is expected"),S.line+=1,S.lineStart=S.position,S.firstTabInLine=-1}function ke(S,se,me){let be=0,ce=S.input.charCodeAt(S.position);for(;ce!==0;){for(;P(ce);)ce===9&&S.firstTabInLine===-1&&(S.firstTabInLine=S.position),ce=S.input.charCodeAt(++S.position);if(se&&ce===35)do ce=S.input.charCodeAt(++S.position);while(ce!==10&&ce!==13&&ce!==0);if(T(ce))for(Qe(S),ce=S.input.charCodeAt(S.position),be++,S.lineIndent=0;ce===32;)S.lineIndent++,ce=S.input.charCodeAt(++S.position);else break}return me!==-1&&be!==0&&S.lineIndent<me&&K(S,"deficient indentation"),be}function He(S){let se=S.position,me=S.input.charCodeAt(se);return!!((me===45||me===46)&&me===S.input.charCodeAt(se+1)&&me===S.input.charCodeAt(se+2)&&(se+=3,me=S.input.charCodeAt(se),me===0||z(me)))}function $e(S,se){se===1?S.result+=" ":se>1&&(S.result+=s.repeat(`
|
|
192
|
+
`,se-1))}function St(S,se,me){let be,ce,Te,M,ne,Ae;const ge=S.kind,ue=S.result;let Ce=S.input.charCodeAt(S.position);if(z(Ce)||L(Ce)||Ce===35||Ce===38||Ce===42||Ce===33||Ce===124||Ce===62||Ce===39||Ce===34||Ce===37||Ce===64||Ce===96)return!1;if(Ce===63||Ce===45){const ve=S.input.charCodeAt(S.position+1);if(z(ve)||me&&L(ve))return!1}for(S.kind="scalar",S.result="",be=ce=S.position,Te=!1;Ce!==0;){if(Ce===58){const ve=S.input.charCodeAt(S.position+1);if(z(ve)||me&&L(ve))break}else if(Ce===35){if(z(S.input.charCodeAt(S.position-1)))break}else{if(S.position===S.lineStart&&He(S)||me&&L(Ce))break;if(T(Ce))if(M=S.line,ne=S.lineStart,Ae=S.lineIndent,ke(S,!1,-1),S.lineIndent>=se){Te=!0,Ce=S.input.charCodeAt(S.position);continue}else{S.position=ce,S.line=M,S.lineStart=ne,S.lineIndent=Ae;break}}Te&&(Ne(S,be,ce,!1),$e(S,S.line-M),be=ce=S.position,Te=!1),P(Ce)||(ce=S.position+1),Ce=S.input.charCodeAt(++S.position)}return Ne(S,be,ce,!1),S.result?!0:(S.kind=ge,S.result=ue,!1)}function Us(S,se){let me,be,ce=S.input.charCodeAt(S.position);if(ce!==39)return!1;for(S.kind="scalar",S.result="",S.position++,me=be=S.position;(ce=S.input.charCodeAt(S.position))!==0;)if(ce===39)if(Ne(S,me,S.position,!0),ce=S.input.charCodeAt(++S.position),ce===39)me=S.position,S.position++,be=S.position;else return!0;else T(ce)?(Ne(S,me,be,!0),$e(S,ke(S,!1,se)),me=be=S.position):S.position===S.lineStart&&He(S)?U(S,"unexpected end of the document within a single quoted scalar"):(S.position++,P(ce)||(be=S.position));U(S,"unexpected end of the stream within a single quoted scalar")}function Fs(S,se){let me,be,ce,Te=S.input.charCodeAt(S.position);if(Te!==34)return!1;for(S.kind="scalar",S.result="",S.position++,me=be=S.position;(Te=S.input.charCodeAt(S.position))!==0;){if(Te===34)return Ne(S,me,S.position,!0),S.position++,!0;if(Te===92){if(Ne(S,me,S.position,!0),Te=S.input.charCodeAt(++S.position),T(Te))ke(S,!1,se);else if(Te<256&&W[Te])S.result+=q[Te],S.position++;else if((ce=D(Te))>0){let M=ce,ne=0;for(;M>0;M--)Te=S.input.charCodeAt(++S.position),(ce=R(Te))>=0?ne=(ne<<4)+ce:U(S,"expected hexadecimal character");S.result+=X(ne),S.position++}else U(S,"unknown escape sequence");me=be=S.position}else T(Te)?(Ne(S,me,be,!0),$e(S,ke(S,!1,se)),me=be=S.position):S.position===S.lineStart&&He(S)?U(S,"unexpected end of the document within a double quoted scalar"):(S.position++,P(Te)||(be=S.position))}U(S,"unexpected end of the stream within a double quoted scalar")}function On(S,se){let me=!0,be,ce,Te;const M=S.tag;let ne;const Ae=S.anchor;let ge,ue,Ce,ve;const Le=Object.create(null);let H,ee,fe,Be=S.input.charCodeAt(S.position);if(Be===91)ge=93,ve=!1,ne=[];else if(Be===123)ge=125,ve=!0,ne={};else return!1;for(S.anchor!==null&&Y(S,S.anchor,ne),Be=S.input.charCodeAt(++S.position);Be!==0;){if(ke(S,!0,se),Be=S.input.charCodeAt(S.position),Be===ge)return S.position++,S.tag=M,S.anchor=Ae,S.kind=ve?"mapping":"sequence",S.result=ne,!0;me?Be===44&&U(S,"expected the node content, but found ','"):U(S,"missed comma between flow collection entries"),ee=H=fe=null,ue=Ce=!1,Be===63&&z(S.input.charCodeAt(S.position+1))&&(ue=Ce=!0,S.position++,ke(S,!0,se)),be=S.line,ce=S.lineStart,Te=S.position,Rt(S,se,h,!1,!0),ee=S.tag,H=S.result,ke(S,!0,se),Be=S.input.charCodeAt(S.position),(Ce||S.line===be)&&Be===58&&(ue=!0,Be=S.input.charCodeAt(++S.position),ke(S,!0,se),Rt(S,se,h,!1,!0),fe=S.result),ve?Me(S,ne,Le,ee,H,fe,be,ce,Te):ue?ne.push(Me(S,null,Le,ee,H,fe,be,ce,Te)):ne.push(H),ke(S,!0,se),Be=S.input.charCodeAt(S.position),Be===44?(me=!0,Be=S.input.charCodeAt(++S.position)):me=!1}U(S,"unexpected end of the stream within a flow collection")}function wn(S,se){let me,be=g,ce=!1,Te=!1,M=se,ne=0,Ae=!1,ge,ue=S.input.charCodeAt(S.position);if(ue===124)me=!1;else if(ue===62)me=!0;else return!1;for(S.kind="scalar",S.result="";ue!==0;)if(ue=S.input.charCodeAt(++S.position),ue===43||ue===45)g===be?be=ue===43?v:b:U(S,"repeat of a chomping mode identifier");else if((ge=I(ue))>=0)ge===0?U(S,"bad explicit indentation width of a block scalar; it cannot be less than one"):Te?U(S,"repeat of an indentation width identifier"):(M=se+ge-1,Te=!0);else break;if(P(ue)){do ue=S.input.charCodeAt(++S.position);while(P(ue));if(ue===35)do ue=S.input.charCodeAt(++S.position);while(!T(ue)&&ue!==0)}for(;ue!==0;){for(Qe(S),S.lineIndent=0,ue=S.input.charCodeAt(S.position);(!Te||S.lineIndent<M)&&ue===32;)S.lineIndent++,ue=S.input.charCodeAt(++S.position);if(!Te&&S.lineIndent>M&&(M=S.lineIndent),T(ue)){ne++;continue}if(!Te&&M===0&&U(S,"missing indentation for block scalar"),S.lineIndent<M){be===v?S.result+=s.repeat(`
|
|
193
|
+
`,ce?1+ne:ne):be===g&&ce&&(S.result+=`
|
|
194
|
+
`);break}me?P(ue)?(Ae=!0,S.result+=s.repeat(`
|
|
195
|
+
`,ce?1+ne:ne)):Ae?(Ae=!1,S.result+=s.repeat(`
|
|
196
|
+
`,ne+1)):ne===0?ce&&(S.result+=" "):S.result+=s.repeat(`
|
|
197
|
+
`,ne):S.result+=s.repeat(`
|
|
198
|
+
`,ce?1+ne:ne),ce=!0,Te=!0,ne=0;const Ce=S.position;for(;!T(ue)&&ue!==0;)ue=S.input.charCodeAt(++S.position);Ne(S,Ce,S.position,!1)}return!0}function js(S,se){const me=S.tag,be=S.anchor,ce=[];let Te=!1;if(S.firstTabInLine!==-1)return!1;S.anchor!==null&&Y(S,S.anchor,ce);let M=S.input.charCodeAt(S.position);for(;M!==0&&(S.firstTabInLine!==-1&&(S.position=S.firstTabInLine,U(S,"tab characters must not be used in indentation")),!(M!==45||!z(S.input.charCodeAt(S.position+1))));){if(Te=!0,S.position++,ke(S,!0,-1)&&S.lineIndent<=se){ce.push(null),M=S.input.charCodeAt(S.position);continue}const ne=S.line;if(Rt(S,se,d,!1,!0),ce.push(S.result),ke(S,!0,-1),M=S.input.charCodeAt(S.position),(S.line===ne||S.lineIndent>se)&&M!==0)U(S,"bad indentation of a sequence entry");else if(S.lineIndent<se)break}return Te?(S.tag=me,S.anchor=be,S.kind="sequence",S.result=ce,!0):!1}function cn(S,se,me){let be,ce,Te,M;const ne=S.tag,Ae=S.anchor,ge={},ue=Object.create(null);let Ce=null,ve=null,Le=null,H=!1,ee=!1;if(S.firstTabInLine!==-1)return!1;S.anchor!==null&&Y(S,S.anchor,ge);let fe=S.input.charCodeAt(S.position);for(;fe!==0;){!H&&S.firstTabInLine!==-1&&(S.position=S.firstTabInLine,U(S,"tab characters must not be used in indentation"));const Be=S.input.charCodeAt(S.position+1),rt=S.line;if((fe===63||fe===58)&&z(Be))fe===63?(H&&(Me(S,ge,ue,Ce,ve,null,ce,Te,M),Ce=ve=Le=null),ee=!0,H=!0,be=!0):H?(H=!1,be=!0):U(S,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),S.position+=1,fe=Be;else{if(ce=S.line,Te=S.lineStart,M=S.position,!Rt(S,me,m,!1,!0))break;if(S.line===rt){for(fe=S.input.charCodeAt(S.position);P(fe);)fe=S.input.charCodeAt(++S.position);if(fe===58)fe=S.input.charCodeAt(++S.position),z(fe)||U(S,"a whitespace character is expected after the key-value separator within a block mapping"),H&&(Me(S,ge,ue,Ce,ve,null,ce,Te,M),Ce=ve=Le=null),ee=!0,H=!1,be=!1,Ce=S.tag,ve=S.result;else if(ee)U(S,"can not read an implicit mapping pair; a colon is missed");else return S.tag=ne,S.anchor=Ae,!0}else if(ee)U(S,"can not read a block mapping entry; a multiline key may not be an implicit key");else return S.tag=ne,S.anchor=Ae,!0}if((S.line===rt||S.lineIndent>se)&&(H&&(ce=S.line,Te=S.lineStart,M=S.position),Rt(S,se,p,!0,be)&&(H?ve=S.result:Le=S.result),H||(Me(S,ge,ue,Ce,ve,Le,ce,Te,M),Ce=ve=Le=null),ke(S,!0,-1),fe=S.input.charCodeAt(S.position)),(S.line===rt||S.lineIndent>se)&&fe!==0)U(S,"bad indentation of a mapping entry");else if(S.lineIndent<se)break}return H&&Me(S,ge,ue,Ce,ve,null,ce,Te,M),ee&&(S.tag=ne,S.anchor=Ae,S.kind="mapping",S.result=ge),ee}function un(S){let se=!1,me=!1,be,ce,Te=S.input.charCodeAt(S.position);if(Te!==33)return!1;S.tag!==null&&U(S,"duplication of a tag property"),Te=S.input.charCodeAt(++S.position),Te===60?(se=!0,Te=S.input.charCodeAt(++S.position)):Te===33?(me=!0,be="!!",Te=S.input.charCodeAt(++S.position)):be="!";let M=S.position;if(se){do Te=S.input.charCodeAt(++S.position);while(Te!==0&&Te!==62);S.position<S.length?(ce=S.input.slice(M,S.position),Te=S.input.charCodeAt(++S.position)):U(S,"unexpected end of the stream within a verbatim tag")}else{for(;Te!==0&&!z(Te);)Te===33&&(me?U(S,"tag suffix cannot contain exclamation marks"):(be=S.input.slice(M-1,S.position+1),E.test(be)||U(S,"named tag handle cannot contain such characters"),me=!0,M=S.position+1)),Te=S.input.charCodeAt(++S.position);ce=S.input.slice(M,S.position),N.test(ce)&&U(S,"tag suffix cannot contain flow indicator characters")}ce&&!A.test(ce)&&U(S,"tag name cannot contain such characters: "+ce);try{ce=decodeURIComponent(ce)}catch{U(S,"tag name is malformed: "+ce)}return se?S.tag=ce:u.call(S.tagMap,be)?S.tag=S.tagMap[be]+ce:be==="!"?S.tag="!"+ce:be==="!!"?S.tag="tag:yaml.org,2002:"+ce:U(S,'undeclared tag handle "'+be+'"'),!0}function Pe(S){let se=S.input.charCodeAt(S.position);if(se!==38)return!1;S.anchor!==null&&U(S,"duplication of an anchor property"),se=S.input.charCodeAt(++S.position);const me=S.position;for(;se!==0&&!z(se)&&!L(se);)se=S.input.charCodeAt(++S.position);return S.position===me&&U(S,"name of an anchor node must contain at least one character"),S.anchor=S.input.slice(me,S.position),!0}function Ct(S){let se=S.input.charCodeAt(S.position);if(se!==42)return!1;se=S.input.charCodeAt(++S.position);const me=S.position;for(;se!==0&&!z(se)&&!L(se);)se=S.input.charCodeAt(++S.position);S.position===me&&U(S,"name of an alias node must contain at least one character");const be=S.input.slice(me,S.position);return u.call(S.anchorMap,be)||U(S,'unidentified alias "'+be+'"'),S.result=S.anchorMap[be],ke(S,!0,-1),!0}function wt(S,se,me,be){const ce=ye(S);return F(S),oe(S,se),S.tag=null,S.anchor=null,S.kind=null,S.result=null,cn(S,me,be)&&S.kind==="mapping"?(ie(S),!0):(Ee(S),oe(S,ce),!1)}function Rt(S,se,me,be,ce){let Te,M,ne=1,Ae=!1,ge=!1,ue=null,Ce,ve,Le;S.depth>=S.maxDepth&&U(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=Te=M=p===me||d===me;if(be&&ke(S,!0,-1)&&(Ae=!0,S.lineIndent>se?ne=1:S.lineIndent===se?ne=0:S.lineIndent<se&&(ne=-1)),ne===1)for(;;){const ee=S.input.charCodeAt(S.position),fe=ye(S);if(Ae&&(ee===33&&S.tag!==null||ee===38&&S.anchor!==null)||!un(S)&&!Pe(S))break;ue===null&&(ue=fe),ke(S,!0,-1)?(Ae=!0,M=H,S.lineIndent>se?ne=1:S.lineIndent===se?ne=0:S.lineIndent<se&&(ne=-1)):M=!1}if(M&&(M=Ae||ce),ne===1||p===me)if(h===me||m===me?ve=se:ve=se+1,Le=S.position-S.lineStart,ne===1)if(M&&(js(S,Le)||cn(S,Le,ve))||On(S,ve))ge=!0;else{const ee=S.input.charCodeAt(S.position);ue!==null&&H&&!M&&ee!==124&&ee!==62&&wt(S,ue,ue.position-ue.lineStart,ve)||Te&&wn(S,ve)||Us(S,ve)||Fs(S,ve)?ge=!0:Ct(S)?(ge=!0,(S.tag!==null||S.anchor!==null)&&U(S,"alias node should not have any properties")):St(S,ve,h===me)&&(ge=!0,S.tag===null&&(S.tag="?")),S.anchor!==null&&Y(S,S.anchor,S.result)}else ne===0&&(ge=M&&js(S,Le));if(S.tag===null)S.anchor!==null&&Y(S,S.anchor,S.result);else if(S.tag==="?"){S.result!==null&&S.kind!=="scalar"&&U(S,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+S.kind+'"');for(let ee=0,fe=S.implicitTypes.length;ee<fe;ee+=1)if(Ce=S.implicitTypes[ee],Ce.resolve(S.result)){S.result=Ce.construct(S.result),S.tag=Ce.tag,S.anchor!==null&&Y(S,S.anchor,S.result);break}}else if(S.tag!=="!"){if(u.call(S.typeMap[S.kind||"fallback"],S.tag))Ce=S.typeMap[S.kind||"fallback"][S.tag];else{Ce=null;const ee=S.typeMap.multi[S.kind||"fallback"];for(let fe=0,Be=ee.length;fe<Be;fe+=1)if(S.tag.slice(0,ee[fe].tag.length)===ee[fe].tag){Ce=ee[fe];break}}Ce||U(S,"unknown tag !<"+S.tag+">"),S.result!==null&&Ce.kind!==S.kind&&U(S,"unacceptable node kind for !<"+S.tag+'> tag; it should be "'+Ce.kind+'", not "'+S.kind+'"'),Ce.resolve(S.result,S.tag)?(S.result=Ce.construct(S.result,S.tag),S.anchor!==null&&Y(S,S.anchor,S.result)):U(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||ge}function Ft(S){const se=S.position;let me=!1,be;for(S.version=null,S.checkLineBreaks=S.legacy,S.tagMap=Object.create(null),S.anchorMap=Object.create(null);(be=S.input.charCodeAt(S.position))!==0&&(ke(S,!0,-1),be=S.input.charCodeAt(S.position),!(S.lineIndent>0||be!==37));){me=!0,be=S.input.charCodeAt(++S.position);let ce=S.position;for(;be!==0&&!z(be);)be=S.input.charCodeAt(++S.position);const Te=S.input.slice(ce,S.position),M=[];for(Te.length<1&&U(S,"directive name must not be less than one character in length");be!==0;){for(;P(be);)be=S.input.charCodeAt(++S.position);if(be===35){do be=S.input.charCodeAt(++S.position);while(be!==0&&!T(be));break}if(T(be))break;for(ce=S.position;be!==0&&!z(be);)be=S.input.charCodeAt(++S.position);M.push(S.input.slice(ce,S.position))}be!==0&&Qe(S),u.call(je,Te)?je[Te](S,Te,M):K(S,'unknown document directive "'+Te+'"')}if(ke(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,ke(S,!0,-1)):me&&U(S,"directives end mark is expected"),Rt(S,S.lineIndent-1,p,!1,!0),ke(S,!0,-1),S.checkLineBreaks&&k.test(S.input.slice(se,S.position))&&K(S,"non-ASCII line breaks are interpreted as content"),S.documents.push(S.result),S.position===S.lineStart&&He(S)){S.input.charCodeAt(S.position)===46&&(S.position+=3,ke(S,!0,-1));return}S.position<S.length-1&&U(S,"end of the stream or a document separator is expected")}function Qs(S,se){S=String(S),se=se||{},S.length!==0&&(S.charCodeAt(S.length-1)!==10&&S.charCodeAt(S.length-1)!==13&&(S+=`
|
|
199
|
+
`),S.charCodeAt(0)===65279&&(S=S.slice(1)));const me=new B(S,se),be=S.indexOf("\0");for(be!==-1&&(me.position=be,U(me,"null byte is not allowed in input")),me.input+="\0";me.input.charCodeAt(me.position)===32;)me.lineIndent+=1,me.position+=1;for(;me.position<me.length-1;)Ft(me);return me.documents}function Js(S,se,me){se!==null&&typeof se=="object"&&typeof me>"u"&&(me=se,se=null);const be=Qs(S,me);if(typeof se!="function")return be;for(let ce=0,Te=be.length;ce<Te;ce+=1)se(be[ce])}function Ri(S,se){const me=Qs(S,se);if(me.length!==0){if(me.length===1)return me[0];throw new n("expected a single document in the stream, but found more")}}t.exports.loadAll=Js,t.exports.load=Ri})),FK=Qt(((e,t)=>{var s=gu(),n=bu(),o=Hx(),l=Object.prototype.toString,u=Object.prototype.hasOwnProperty,h=65279,m=9,d=10,p=13,g=32,b=33,v=34,w=35,k=37,N=38,E=39,A=42,j=44,T=45,P=58,z=61,L=62,R=63,D=64,I=91,V=93,X=96,$=123,W=124,q=125,B={};B[0]="\\0",B[7]="\\a",B[8]="\\b",B[9]="\\t",B[10]="\\n",B[11]="\\v",B[12]="\\f",B[13]="\\r",B[27]="\\e",B[34]='\\"',B[92]="\\\\",B[133]="\\N",B[160]="\\_",B[8232]="\\L",B[8233]="\\P";var Z=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],U=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function K(M,ne){if(ne===null)return{};const Ae={},ge=Object.keys(ne);for(let ue=0,Ce=ge.length;ue<Ce;ue+=1){let ve=ge[ue],Le=String(ne[ve]);ve.slice(0,2)==="!!"&&(ve="tag:yaml.org,2002:"+ve.slice(2));const H=M.compiledTypeMap.fallback[ve];H&&u.call(H.styleAliases,Le)&&(Le=H.styleAliases[Le]),Ae[ve]=Le}return Ae}function Y(M){let ne,Ae;const ge=M.toString(16).toUpperCase();if(M<=255)ne="x",Ae=2;else if(M<=65535)ne="u",Ae=4;else if(M<=4294967295)ne="U",Ae=8;else throw new n("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+ne+s.repeat("0",Ae-ge.length)+ge}var F=1,ie=2;function Ee(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=K(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==='"'?ie:F,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 ye(M,ne){const Ae=s.repeat(" ",ne);let ge=0,ue="";const Ce=M.length;for(;ge<Ce;){let ve;const Le=M.indexOf(`
|
|
200
|
+
`,ge);Le===-1?(ve=M.slice(ge),ge=Ce):(ve=M.slice(ge,Le+1),ge=Le+1),ve.length&&ve!==`
|
|
201
|
+
`&&(ue+=Ae),ue+=ve}return ue}function oe(M,ne){return`
|
|
202
|
+
`+s.repeat(" ",M.indent*ne)}function je(M,ne){for(let Ae=0,ge=M.implicitTypes.length;Ae<ge;Ae+=1)if(M.implicitTypes[Ae].resolve(ne))return!0;return!1}function Ne(M){return M===g||M===m}function Ge(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 Me(M){return Ge(M)&&M!==h&&M!==p&&M!==d}function Qe(M,ne,Ae){const ge=Me(M),ue=ge&&!Ne(M);return(Ae?ge:ge&&M!==j&&M!==I&&M!==V&&M!==$&&M!==q)&&M!==w&&!(ne===P&&!ue)||Me(ne)&&!Ne(ne)&&M===w||ne===P&&ue}function ke(M){return Ge(M)&&M!==h&&!Ne(M)&&M!==T&&M!==R&&M!==P&&M!==j&&M!==I&&M!==V&&M!==$&&M!==q&&M!==w&&M!==N&&M!==A&&M!==b&&M!==W&&M!==z&&M!==L&&M!==E&&M!==v&&M!==k&&M!==D&&M!==X}function He(M){return!Ne(M)&&M!==P}function $e(M,ne){const Ae=M.charCodeAt(ne);let ge;return Ae>=55296&&Ae<=56319&&ne+1<M.length&&(ge=M.charCodeAt(ne+1),ge>=56320&&ge<=57343)?(Ae-55296)*1024+ge-56320+65536:Ae}function St(M){return/^\n* /.test(M)}var Us=1,Fs=2,On=3,wn=4,js=5;function cn(M,ne,Ae,ge,ue,Ce,ve,Le){let H,ee=0,fe=null,Be=!1,rt=!1;const Mt=ge!==-1;let qe=-1,Ue=ke($e(M,0))&&He($e(M,M.length-1));if(ne||ve)for(H=0;H<M.length;ee>=65536?H+=2:H++){if(ee=$e(M,H),!Ge(ee))return js;Ue=Ue&&Qe(ee,fe,Le),fe=ee}else{for(H=0;H<M.length;ee>=65536?H+=2:H++){if(ee=$e(M,H),ee===d)Be=!0,Mt&&(rt=rt||H-qe-1>ge&&M[qe+1]!==" ",qe=H);else if(!Ge(ee))return js;Ue=Ue&&Qe(ee,fe,Le),fe=ee}rt=rt||Mt&&H-qe-1>ge&&M[qe+1]!==" "}return!Be&&!rt?Ue&&!ve&&!ue(M)?Us:Ce===ie?js:Fs:Ae>9&&St(M)?js:ve?Ce===ie?js:Fs:rt?wn:On}function un(M,ne,Ae,ge,ue){M.dump=(function(){if(ne.length===0)return M.quotingType===ie?'""':"''";if(!M.noCompatMode&&(Z.indexOf(ne)!==-1||U.test(ne)))return M.quotingType===ie?'"'+ne+'"':"'"+ne+"'";const Ce=M.indent*Math.max(1,Ae),ve=M.lineWidth===-1?-1:Math.max(Math.min(M.lineWidth,40),M.lineWidth-Ce),Le=ge||M.flowLevel>-1&&Ae>=M.flowLevel;function H(ee){return je(M,ee)}switch(cn(ne,Le,M.indent,ve,H,M.quotingType,M.forceQuotes&&!ge,ue)){case Us:return ne;case Fs:return"'"+ne.replace(/'/g,"''")+"'";case On:return"|"+Pe(ne,M.indent)+Ct(ye(ne,Ce));case wn:return">"+Pe(ne,M.indent)+Ct(ye(wt(ne,ve),Ce));case js:return'"'+Ft(ne)+'"';default:throw new n("impossible error: invalid scalar style")}})()}function Pe(M,ne){const Ae=St(M)?String(ne):"",ge=M[M.length-1]===`
|
|
203
|
+
`;return Ae+(ge&&(M[M.length-2]===`
|
|
204
|
+
`||M===`
|
|
205
|
+
`)?"+":ge?"":"-")+`
|
|
206
|
+
`}function Ct(M){return M[M.length-1]===`
|
|
207
|
+
`?M.slice(0,-1):M}function wt(M,ne){const Ae=/(\n+)([^\n]*)/g;let ge=(function(){let Le=M.indexOf(`
|
|
208
|
+
`);return Le=Le!==-1?Le:M.length,Ae.lastIndex=Le,Rt(M.slice(0,Le),ne)})(),ue=M[0]===`
|
|
209
|
+
`||M[0]===" ",Ce,ve;for(;ve=Ae.exec(M);){const Le=ve[1],H=ve[2];Ce=H[0]===" ",ge+=Le+(!ue&&!Ce&&H!==""?`
|
|
210
|
+
`:"")+Rt(H,ne),ue=Ce}return ge}function Rt(M,ne){if(M===""||M[0]===" ")return M;const Ae=/ [^ ]/g;let ge,ue=0,Ce,ve=0,Le=0,H="";for(;ge=Ae.exec(M);)Le=ge.index,Le-ue>ne&&(Ce=ve>ue?ve:Le,H+=`
|
|
211
|
+
`+M.slice(ue,Ce),ue=Ce+1),ve=Le;return H+=`
|
|
212
|
+
`,M.length-ue>ne&&ve>ue?H+=M.slice(ue,ve)+`
|
|
213
|
+
`+M.slice(ve+1):H+=M.slice(ue),H.slice(1)}function Ft(M){let ne="",Ae=0;for(let ge=0;ge<M.length;Ae>=65536?ge+=2:ge++){Ae=$e(M,ge);const ue=B[Ae];!ue&&Ge(Ae)?(ne+=M[ge],Ae>=65536&&(ne+=M[ge+1])):ne+=ue||Y(Ae)}return ne}function Qs(M,ne,Ae){let ge="";const ue=M.tag;for(let Ce=0,ve=Ae.length;Ce<ve;Ce+=1){let Le=Ae[Ce];M.replacer&&(Le=M.replacer.call(Ae,String(Ce),Le)),(me(M,ne,Le,!1,!1)||typeof Le>"u"&&me(M,ne,null,!1,!1))&&(ge!==""&&(ge+=","+(M.condenseFlow?"":" ")),ge+=M.dump)}M.tag=ue,M.dump="["+ge+"]"}function Js(M,ne,Ae,ge){let ue="";const Ce=M.tag;for(let ve=0,Le=Ae.length;ve<Le;ve+=1){let H=Ae[ve];M.replacer&&(H=M.replacer.call(Ae,String(ve),H)),(me(M,ne+1,H,!0,!0,!1,!0)||typeof H>"u"&&me(M,ne+1,null,!0,!0,!1,!0))&&((!ge||ue!=="")&&(ue+=oe(M,ne)),M.dump&&d===M.dump.charCodeAt(0)?ue+="-":ue+="- ",ue+=M.dump)}M.tag=Ce,M.dump=ue||"[]"}function Ri(M,ne,Ae){let ge="";const ue=M.tag,Ce=Object.keys(Ae);for(let ve=0,Le=Ce.length;ve<Le;ve+=1){let H="";ge!==""&&(H+=", "),M.condenseFlow&&(H+='"');const ee=Ce[ve];let fe=Ae[ee];M.replacer&&(fe=M.replacer.call(Ae,ee,fe)),me(M,ne,ee,!1,!1)&&(M.dump.length>1024&&(H+="? "),H+=M.dump+(M.condenseFlow?'"':"")+":"+(M.condenseFlow?"":" "),me(M,ne,fe,!1,!1)&&(H+=M.dump,ge+=H))}M.tag=ue,M.dump="{"+ge+"}"}function S(M,ne,Ae,ge){let ue="";const Ce=M.tag,ve=Object.keys(Ae);if(M.sortKeys===!0)ve.sort();else if(typeof M.sortKeys=="function")ve.sort(M.sortKeys);else if(M.sortKeys)throw new n("sortKeys must be a boolean or a function");for(let Le=0,H=ve.length;Le<H;Le+=1){let ee="";(!ge||ue!=="")&&(ee+=oe(M,ne));const fe=ve[Le];let Be=Ae[fe];if(M.replacer&&(Be=M.replacer.call(Ae,fe,Be)),!me(M,ne+1,fe,!0,!0,!0))continue;const rt=M.tag!==null&&M.tag!=="?"||M.dump&&M.dump.length>1024;rt&&(M.dump&&d===M.dump.charCodeAt(0)?ee+="?":ee+="? "),ee+=M.dump,rt&&(ee+=oe(M,ne)),me(M,ne+1,Be,!0,rt)&&(M.dump&&d===M.dump.charCodeAt(0)?ee+=":":ee+=": ",ee+=M.dump,ue+=ee)}M.tag=Ce,M.dump=ue||"{}"}function se(M,ne,Ae){const ge=Ae?M.explicitTypes:M.implicitTypes;for(let ue=0,Ce=ge.length;ue<Ce;ue+=1){const ve=ge[ue];if((ve.instanceOf||ve.predicate)&&(!ve.instanceOf||typeof ne=="object"&&ne instanceof ve.instanceOf)&&(!ve.predicate||ve.predicate(ne))){if(Ae?ve.multi&&ve.representName?M.tag=ve.representName(ne):M.tag=ve.tag:M.tag="?",ve.represent){const Le=M.styleMap[ve.tag]||ve.defaultStyle;let H;if(l.call(ve.represent)==="[object Function]")H=ve.represent(ne,Le);else if(u.call(ve.represent,Le))H=ve.represent[Le](ne,Le);else throw new n("!<"+ve.tag+'> tag resolver accepts not "'+Le+'" style');M.dump=H}return!0}}return!1}function me(M,ne,Ae,ge,ue,Ce,ve){M.tag=null,M.dump=Ae,se(M,Ae,!1)||se(M,Ae,!0);const Le=l.call(M.dump),H=ge;ge&&(ge=M.flowLevel<0||M.flowLevel>ne);const ee=Le==="[object Object]"||Le==="[object Array]";let fe,Be;if(ee&&(fe=M.duplicates.indexOf(Ae),Be=fe!==-1),(M.tag!==null&&M.tag!=="?"||Be||M.indent!==2&&ne>0)&&(ue=!1),Be&&M.usedDuplicates[fe])M.dump="*ref_"+fe;else{if(ee&&Be&&!M.usedDuplicates[fe]&&(M.usedDuplicates[fe]=!0),Le==="[object Object]")ge&&Object.keys(M.dump).length!==0?(S(M,ne,M.dump,ue),Be&&(M.dump="&ref_"+fe+M.dump)):(Ri(M,ne,M.dump),Be&&(M.dump="&ref_"+fe+" "+M.dump));else if(Le==="[object Array]")ge&&M.dump.length!==0?(M.noArrayIndent&&!ve&&ne>0?Js(M,ne-1,M.dump,ue):Js(M,ne,M.dump,ue),Be&&(M.dump="&ref_"+fe+M.dump)):(Qs(M,ne,M.dump),Be&&(M.dump="&ref_"+fe+" "+M.dump));else if(Le==="[object String]")M.tag!=="?"&&un(M,M.dump,ne,Ce,H);else{if(Le==="[object Undefined]")return!1;if(M.skipInvalid)return!1;throw new n("unacceptable kind of an object to dump "+Le)}if(M.tag!==null&&M.tag!=="?"){let rt=encodeURI(M.tag[0]==="!"?M.tag.slice(1):M.tag).replace(/!/g,"%21");M.tag[0]==="!"?rt="!"+rt:rt.slice(0,18)==="tag:yaml.org,2002:"?rt="!!"+rt.slice(18):rt="!<"+rt+">",M.dump=rt+" "+M.dump}}return!0}function be(M,ne){const Ae=[],ge=[];ce(M,Ae,ge);const ue=ge.length;for(let Ce=0;Ce<ue;Ce+=1)ne.duplicates.push(Ae[ge[Ce]]);ne.usedDuplicates=new Array(ue)}function ce(M,ne,Ae){if(M!==null&&typeof M=="object"){const ge=ne.indexOf(M);if(ge!==-1)Ae.indexOf(ge)===-1&&Ae.push(ge);else if(ne.push(M),Array.isArray(M))for(let ue=0,Ce=M.length;ue<Ce;ue+=1)ce(M[ue],ne,Ae);else{const ue=Object.keys(M);for(let Ce=0,ve=ue.length;Ce<ve;Ce+=1)ce(M[ue[Ce]],ne,Ae)}}}function Te(M,ne){ne=ne||{};const Ae=new Ee(ne);Ae.noRefs||be(M,Ae);let ge=M;return Ae.replacer&&(ge=Ae.replacer.call({"":ge},"",ge)),me(Ae,0,ge,!0,!0)?Ae.dump+`
|
|
214
|
+
`:""}t.exports.dump=Te})),ej=$K(Qt(((e,t)=>{var s=UK(),n=FK();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=Sn(),t.exports.Schema=B5(),t.exports.FAILSAFE_SCHEMA=H5(),t.exports.JSON_SCHEMA=G5(),t.exports.CORE_SCHEMA=W5(),t.exports.DEFAULT_SCHEMA=Hx(),t.exports.load=s.load,t.exports.loadAll=s.loadAll,t.exports.dump=n.dump,t.exports.YAMLException=bu(),t.exports.types={binary:X5(),float:V5(),map:$5(),null:U5(),pairs:Q5(),set:J5(),timestamp:K5(),bool:F5(),int:q5(),merge:Y5(),omap:Z5(),seq:P5(),str:I5()},t.exports.safeLoad=o("safeLoad","load"),t.exports.safeLoadAll=o("safeLoadAll","loadAll"),t.exports.safeDump=o("safeDump","dump")}))()),{Type:aZ,Schema:oZ,FAILSAFE_SCHEMA:lZ,JSON_SCHEMA:cZ,CORE_SCHEMA:uZ,DEFAULT_SCHEMA:dZ,load:hZ,loadAll:fZ,dump:mZ,YAMLException:pZ,types:gZ,safeLoad:bZ,safeLoadAll:xZ,safeDump:vZ}=ej.default,qK=ej.default;function tj(e){return e!==null&&typeof e=="object"}function sj(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 nj(e){return e==null?"null":typeof e=="string"?e===""?'""':e:String(e)}function ij({label:e,value:t,depth:s,defaultOpen:n}){const[o,l]=y.useState(n),u={paddingLeft:`${s*1.1}rem`};if(!tj(t))return r.jsxs("div",{className:"flex items-baseline gap-2 py-[1px]",style:u,children:[r.jsxs("span",{className:"text-muted-foreground",children:[e,":"]}),r.jsx("span",{className:de("whitespace-pre-wrap break-words",sj(t)),children:nj(t)})]});const h=Array.isArray(t)?t.map((d,p)=>[String(p),d]):Object.entries(t),m=Array.isArray(t)?`[${h.length}]`:`{${h.length}}`;return r.jsxs("div",{children:[r.jsxs("button",{type:"button",onClick:()=>l(d=>!d),className:"flex w-full items-center gap-1 py-[1px] text-left hover:bg-muted",style:u,children:[o?r.jsx(vn,{className:"size-3.5 shrink-0 text-muted-foreground"}):r.jsx(Yn,{className:"size-3.5 shrink-0 text-muted-foreground"}),r.jsx("span",{className:"font-medium text-foreground",children:e}),r.jsx("span",{className:"text-muted-foreground",children:m})]}),o?h.map(([d,p])=>r.jsx(ij,{label:d,value:p,depth:s+1,defaultOpen:s<1},d)):null]})}function VK({content:e}){const t=y.useMemo(()=>{try{const n=qK.loadAll(e);return{value:n.length<=1?n[0]:n,error:null}}catch(n){return{value:null,error:n instanceof Error?n.message:String(n)}}},[e]);if(t.error)return r.jsx("div",{className:"p-4",children:r.jsxs(tt,{variant:"destructive",children:["Could not parse YAML: ",t.error]})});if(!tj(t.value))return r.jsx("div",{className:"p-4 font-mono text-[12px]",children:r.jsx("span",{className:sj(t.value),children:nj(t.value)})});const s=Array.isArray(t.value)?t.value.map((n,o)=>[String(o),n]):Object.entries(t.value);return r.jsx("div",{className:"min-w-max px-4 py-3 font-mono text-[12px] leading-[1.6]",children:s.map(([n,o])=>r.jsx(ij,{label:n,value:o,depth:0,defaultOpen:!0},n))})}const GK=y.lazy(()=>su(()=>import("./code-editor-BxFHS7P5.js"),[]).then(e=>({default:e.CodeEditor})));function WK(e){const t=e.split("/").pop()?.toLowerCase().split(".").pop()??"";return t==="md"||t==="mdx"||t==="markdown"?"markdown":t==="yml"||t==="yaml"?"yaml":null}function KK(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 YK(e,t){const s=e.endsWith(`
|
|
215
|
+
`)?e.slice(0,-1):e;return!t||!wb.getLanguage(t)?s.split(`
|
|
216
|
+
`).map(qk):s.split(`
|
|
217
|
+
`).map(n=>{if(!n)return"";try{return wb.highlight(n,{language:t,ignoreIllegals:!0}).value}catch{return qk(n)}})}function qk(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function XK({content:e,path:t}){const s=y.useMemo(()=>KK(t),[t]),n=y.useMemo(()=>YK(e,s),[e,s]),o=`${Math.max(2,String(n.length).length)}ch`;return r.jsx("div",{className:"min-w-max font-mono text-[12px] leading-[1.5]",children:n.map((l,u)=>r.jsxs("div",{className:"flex",children:[r.jsx("span",{className:"shrink-0 select-none border-r border-zinc-200 bg-zinc-100 px-2 text-right text-zinc-400 dark:border-zinc-800 dark:bg-zinc-900 dark:text-zinc-500",style:{minWidth:`calc(${o} + 1rem)`},children:u+1}),r.jsx("span",{className:"hljs whitespace-pre px-3 text-zinc-800 dark:text-zinc-100",dangerouslySetInnerHTML:{__html:l||" "}})]},u))})}function ZK({path:e,isModified:t,onViewDiff:s,onFileSaved:n,onSendToAi:o}){const[l,u]=y.useState(null),[h,m]=y.useState(""),[d,p]=y.useState(!1),[g,b]=y.useState(null),[v,w]=y.useState(!1),[k,N]=y.useState(!1),{success:E,error:A}=$s(),j=y.useMemo(()=>WK(e),[e]),[T,P]=y.useState("preview"),z=!!(l&&!l.binary&&!l.truncated),L=l?h!==l.content:!1;y.useEffect(()=>{P(j?"preview":"source"),p(!1)},[j]),y.useEffect(()=>{if(!e){u(null);return}let I=!0;return w(!0),b(null),p(!1),u8(e).then(V=>{I&&(u(V),m(V.content),w(!1))}).catch(V=>{I&&(b(V instanceof Error?V.message:String(V)),w(!1))}),()=>{I=!1}},[e]);async function R(){if(!(!e||!l||!L||k)){N(!0);try{await d8(e,h);const I={...l,content:h,size:new TextEncoder().encode(h).length};u(I),p(!1),E(`Saved ${e}.`),n?.(e)}catch(I){A(I instanceof Error?I.message:String(I))}finally{N(!1)}}}function D(){m(l?.content??""),p(!1)}return e?r.jsxs("section",{className:"flex min-h-0 min-w-0 flex-col border-l border-border bg-card",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-1.5",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:e}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-muted-foreground",children:[r.jsx("span",{children:"Read-only view of tracked file."}),l?.truncated?r.jsx("span",{className:"text-amber-700",children:"Truncated — file exceeds 1MB."}):null,l?.binary?r.jsx("span",{className:"text-amber-700",children:"Binary file."}):null]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[j&&!l?.binary?r.jsxs("div",{className:"flex items-center rounded-md border border-border p-0.5",children:[r.jsxs("button",{type:"button",onClick:()=>P("preview"),"aria-pressed":T==="preview",className:de("flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium transition-colors",T==="preview"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"),children:[r.jsx(Ob,{className:"size-3.5"}),"Preview"]}),r.jsxs("button",{type:"button",onClick:()=>P("source"),"aria-pressed":T==="source",className:de("flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium transition-colors",T==="source"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"),children:[r.jsx(gN,{className:"size-3.5"}),"Source"]})]}):null,t?r.jsx(J,{onClick:s,size:"sm",type:"button",variant:"outline",children:"View diff"}):null,o?r.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:r.jsx(Gt,{className:"size-4"})}):null,d?r.jsxs(r.Fragment,{children:[r.jsxs(J,{disabled:!L||k,onClick:()=>{R()},size:"sm",type:"button",children:[r.jsx(DN,{}),"Apply"]}),r.jsxs(J,{disabled:k,onClick:D,size:"sm",type:"button",variant:"outline",children:[r.jsx(ts,{}),"Cancel"]})]}):z?r.jsxs(J,{onClick:()=>{P("source"),p(!0)},size:"sm",type:"button",variant:"outline",children:[r.jsx(rl,{}),"Edit"]}):null]})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-auto bg-card",children:g?r.jsx("div",{className:"p-4",children:r.jsx(tt,{variant:"destructive",children:g})}):v?r.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading…"}):l?.binary?r.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Cannot display binary content."}):l?d?r.jsx(y.Suspense,{fallback:r.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading editor…"}),children:r.jsx(GK,{path:e,value:h,onChange:m})}):j&&T==="preview"?j==="markdown"?r.jsx(L5,{content:l.content}):r.jsx(VK,{content:l.content}):r.jsx(XK,{content:l.content,path:e}):null})]}):r.jsx("div",{className:"p-4",children:r.jsx(tt,{variant:"muted",className:"border-dashed p-12 text-center",children:"Select a file to view its contents."})})}function QK({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 Vk(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 Gk({label:e,tree:t,onSelect:s,defaultOpen:n,forceOpen:o}){const[l,u]=y.useState(n??!1),h=o||l,m=t.children.size===0;return r.jsxs("div",{className:"mb-1",children:[r.jsxs("button",{type:"button",onClick:()=>u(d=>!d),className:"flex w-full items-center gap-1 px-2 py-0.5 text-left text-[11px] font-semibold uppercase tracking-wide text-muted-foreground hover:text-foreground",children:[h?r.jsx(vn,{size:12}):r.jsx(Yn,{size:12}),e,m?null:r.jsxs("span",{className:"ml-1 text-[10px] font-normal",children:["(",t.children.size,")"]})]}),h&&!m?r.jsx("ul",{children:Array.from(t.children.values()).map(d=>r.jsx(rj,{node:d,depth:1,onSelect:s,forceOpen:o},d.fullPath))}):null]})}function rj({node:e,depth:t,onSelect:s,forceOpen:n}){const[o,l]=y.useState(!0),u=n||o,h=e.children.size>0,m=e.branch,d={paddingLeft:`${t*10}px`};return!h&&m?r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>s(m),style:d,title:m.name,className:`flex w-full items-center gap-1.5 py-0.5 pr-2 text-left text-[12px] hover:bg-muted/60 ${m.current?"font-semibold text-emerald-700":""}`,children:[r.jsx(xn,{size:11,className:"shrink-0 opacity-70"}),r.jsx("span",{className:"truncate",children:e.name}),m.current?r.jsx("span",{className:"text-[10px]",children:"●"}):null]})}):r.jsxs("li",{children:[r.jsxs("button",{type:"button",onClick:()=>{m?s(m):l(p=>!p)},style:d,className:"flex w-full items-center gap-1 py-0.5 pr-2 text-left text-[12px] hover:bg-muted/60",children:[h?u?r.jsx(vn,{size:11}):r.jsx(Yn,{size:11}):r.jsx("span",{className:"inline-block w-[11px]"}),r.jsx("span",{className:"truncate",children:e.name})]}),u&&h?r.jsx("ul",{children:Array.from(e.children.values()).map(p=>r.jsx(rj,{node:p,depth:t+1,onSelect:s,forceOpen:n},p.fullPath))}):null]})}function JK({selectedCommit:e,selectedFile:t,diff:s,diffLoading:n,diffError:o}){return r.jsxs("section",{className:"flex min-h-0 min-w-0 flex-col bg-card border-b border-border",children:[r.jsx("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-1.5",children:r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:t??(e?e.subject:"Commit")}),e?r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-muted-foreground",children:[r.jsx("span",{className:"font-mono",children:e.hash.slice(0,12)}),r.jsxs("span",{children:[e.author," <",e.email,">"]}),r.jsx("span",{children:new Date(e.timestamp*1e3).toLocaleString()})]}):null]})}),r.jsx("div",{className:"relative min-h-0 min-w-0 flex-1",children:o?r.jsx("div",{className:"p-4",children:r.jsx(tt,{variant:"destructive",children:o})}):e?n?r.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading diff…"}):s?r.jsx(lu,{activeHunkIndex:0,diff:s}):r.jsx("div",{className:"p-4",children:r.jsx(tt,{variant:"muted",className:"border-dashed p-6 text-center",children:e.parents.length>1?"Merge commit with no conflict resolution — no diff against the first parent.":"No textual changes in this commit."})}):r.jsx("div",{className:"p-4",children:r.jsx(tt,{variant:"muted",className:"border-dashed p-12 text-center",children:"Select a commit to inspect its diff."})})})]})}function eY({files:e,filesError:t,selectedHash:s,selectedFile:n,onSelect:o}){return r.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden border-r border-border",children:[r.jsx("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-1.5",children:r.jsxs("h2",{className:"text-[13px] font-semibold tracking-tight",children:["Files",e.length?r.jsx("span",{className:"ml-2 text-[11px] font-normal text-muted-foreground",children:e.length}):null]})}),r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:t?r.jsx("div",{className:"p-3",children:r.jsx(tt,{variant:"destructive",children:t})}):s?e.length===0?r.jsx("div",{className:"p-3 text-[12px] text-muted-foreground",children:"No file changes."}):r.jsx("ul",{className:"divide-y divide-border",children:e.map(l=>r.jsx("li",{children:r.jsxs("button",{onClick:()=>o(l.path),type:"button",title:l.path,className:`flex w-full items-center gap-2 px-2 py-1 text-left text-[12px] transition-colors hover:bg-muted/60 ${n===l.path?"bg-muted":""}`,children:[r.jsx("span",{className:tY(l.index),children:l.index.trim()||"·"}),r.jsx("span",{className:"truncate font-mono",children:l.path})]})},l.path))}):r.jsx("div",{className:"p-3 text-[12px] text-muted-foreground",children:"Select a commit to see its files."})})]})}function tY(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 Wk=["#3b82f6","#10b981","#f59e0b","#ec4899","#8b5cf6","#14b8a6","#ef4444","#84cc16"];function Sc(e){return Wk[e%Wk.length]}function sY({lane:e,laneCount:t,edges:s,throughLanes:n,isMerge:o,height:l=28,laneWidth:u=14}){const m=Math.max(e+1,t,1)*u,d=l/2,p=wc(e,u),g=o?4:3.5;return r.jsxs("svg",{width:m,height:l,viewBox:`0 0 ${m} ${l}`,style:{flex:"0 0 auto",display:"block"},children:[n.map(b=>r.jsx("line",{x1:wc(b,u),y1:0,x2:wc(b,u),y2:l,stroke:Sc(b),strokeWidth:1.5},`t-${b}`)),r.jsx("line",{x1:p,y1:0,x2:p,y2:d,stroke:Sc(e),strokeWidth:1.5}),s.map((b,v)=>{const w=wc(b.fromLane,u),k=wc(b.toLane,u);if(w===k)return r.jsx("line",{x1:w,y1:d,x2:k,y2:l,stroke:Sc(b.toLane),strokeWidth:1.5},`e-${v}`);const N=d+(l-d)/2;return r.jsx("path",{d:`M ${w} ${d} C ${w} ${N}, ${k} ${N}, ${k} ${l}`,fill:"none",stroke:Sc(b.toLane),strokeWidth:1.5},`e-${v}`)}),r.jsx("circle",{cx:p,cy:d,r:g,fill:Sc(e),stroke:"var(--background, #fff)",strokeWidth:1.5})]})}function wc(e,t){return e*t+t/2}const nY=5,kb=new Map,a0=new Map,Nb=[];let Cb=0;function Kk(){for(;Cb<nY&&Nb.length>0;){const e=Nb.shift();e&&(Cb++,e())}}function iY(e){return kb.get(e)}function rY(e){const t=kb.get(e);if(t)return Promise.resolve(t);const s=a0.get(e);if(s)return s;const n=new Promise((o,l)=>{Nb.push(()=>{L8(e).then(u=>{u.state!=="pending"&&kb.set(e,u),o(u)}).catch(l).finally(()=>{Cb--,a0.delete(e),Kk()})})});return a0.set(e,n),Kk(),n}function aY({sha:e}){const[t,s]=y.useState(()=>iY(e)??null),n=y.useRef(null);if(y.useEffect(()=>{if(t)return;const u=n.current;if(!u||typeof IntersectionObserver>"u")return;let h=!0;const m=new IntersectionObserver(d=>{d.some(p=>p.isIntersecting)&&(m.disconnect(),rY(e).then(p=>{h&&s(p)}).catch(()=>{}))},{rootMargin:"200px"});return m.observe(u),()=>{h=!1,m.disconnect()}},[e,t]),!t||t.state==="unknown"||t.totalCount===0)return r.jsx("span",{ref:n,"aria-hidden":!0,className:"inline-block size-2 shrink-0"});const o=oY(t.state),l=`CI: ${t.state} (${t.totalCount} check${t.totalCount!==1?"s":""})`;return r.jsx("span",{"aria-label":l,className:`shrink-0 size-2 rounded-full ${o}`,title:l})}function oY(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 Yk=28;function lY({commits:e,loading:t,error:s,selectedHash:n,maxLanes:o,rowRefs:l,onSelect:u,onLoadMore:h}){const{sendToAgent:m}=It(),[d,p]=y.useState(null);function g(b,v){p(null),m({prompt:xP(b,v),source:{type:"git-commit",label:b.hash.slice(0,7)},label:`${b.hash.slice(0,7)}: ${v}`})}return r.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden border-r border-border",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-1.5",children:[r.jsxs("h2",{className:"text-[13px] font-semibold tracking-tight",children:["Commit tree",e.length?r.jsxs("span",{className:"ml-2 text-[11px] font-normal text-muted-foreground",children:[e.length," commits"]}):null]}),r.jsx(J,{disabled:t,onClick:h,size:"sm",type:"button",variant:"outline",children:"Load more"})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:s?r.jsx("div",{className:"p-3",children:r.jsx(tt,{variant:"destructive",children:s})}):t&&e.length===0?r.jsx("div",{className:"p-3 text-[12px] text-muted-foreground",children:"Loading commits…"}):e.length===0?r.jsx("div",{className:"p-3 text-[12px] text-muted-foreground",children:"No commits."}):r.jsx("ul",{className:"divide-y divide-border",children:e.map(b=>r.jsxs("li",{ref:v=>{v?l.current.set(b.hash,v):l.current.delete(b.hash)},className:"group flex flex-col",children:[r.jsxs("div",{className:`flex items-center transition-colors hover:bg-muted/60 ${n===b.hash?"bg-muted":""}`,children:[r.jsxs("button",{onClick:()=>u(b.hash),type:"button",className:"flex min-w-0 flex-1 items-center gap-2 px-2 py-0.5 text-left",style:{minHeight:Yk},title:`${b.hash}
|
|
218
|
+
${b.author} <${b.email}>
|
|
219
|
+
${b.subject}`,children:[r.jsx(sY,{lane:b.lane,laneCount:Math.max(b.laneCount,o),edges:b.edges,throughLanes:b.throughLanes,isMerge:b.parents.length>1,height:Yk}),r.jsxs("span",{className:"flex items-center gap-1 font-mono text-[10px] text-muted-foreground",children:[b.hash.slice(0,7),r.jsx(aY,{sha:b.hash})]}),r.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[b.refs.map(v=>r.jsx("span",{className:uY(v.kind),children:v.name},`${v.kind}-${v.name}`)),r.jsx("span",{className:"truncate text-[12px]",children:b.subject})]}),r.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:b.author}),r.jsx("span",{className:"shrink-0 font-mono text-[10px] tabular-nums text-muted-foreground/70",title:new Date(b.timestamp*1e3).toLocaleString(),children:cY(b.timestamp)})]}),r.jsx(Ki,{className:`mr-1 shrink-0 ${d===b.hash?"opacity-100":""}`,label:`Ask AI about commit ${b.hash.slice(0,7)}`,onAsk:()=>p(v=>v===b.hash?null:b.hash)})]}),d===b.hash?r.jsx("div",{className:"px-2 pb-1.5 pt-0.5",children:r.jsx(jr,{placeholder:"What should the agent do with this commit? (explain, summarize, find regressions…)",onSubmit:v=>g(b,v),onCancel:()=>p(null)})}):null]},b.hash))})})]})}function cY(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 uY(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 Xk=200;function dY(){const[e,t]=y.useState([]),[s,n]=y.useState(Xk),[o,l]=y.useState(0),[u,h]=y.useState(!0),[m,d]=y.useState(null),[p,g]=y.useState(null),[b,v]=y.useState([]),[w,k]=y.useState(!1),[N,E]=y.useState(null),[A,j]=y.useState(null),[T,P]=y.useState(""),[z,L]=y.useState(!1),[R,D]=y.useState(null),I=y.useCallback($=>{g($),v([]),j(null),P("")},[]);y.useEffect(()=>{let $=!0;return h(!0),d(null),r8(s).then(W=>{$&&(t(W),W.length>0&&!W.some(q=>q.hash===p)&&I(W[0].hash))}).catch(W=>{$&&d(W instanceof Error?W.message:String(W))}).finally(()=>{$&&h(!1)}),()=>{$=!1}},[s,o]),y.useEffect(()=>{if(!p){v([]),j(null),k(!1);return}let $=!0;return E(null),k(!0),o8(p).then(W=>{$&&(v(W),j(W[0]?.path??null))}).catch(W=>{$&&E(W instanceof Error?W.message:String(W))}).finally(()=>{$&&k(!1)}),()=>{$=!1}},[p]),y.useEffect(()=>{if(!p||!A){P(""),L(!1);return}let $=!0;return D(null),L(!0),a8(p,A).then(W=>{$&&P(W)}).catch(W=>{$&&D(W instanceof Error?W.message:String(W))}).finally(()=>{$&&L(!1)}),()=>{$=!1}},[p,A]);const V=y.useMemo(()=>e.reduce(($,W)=>Math.max($,W.laneCount),1),[e]),X=e.find($=>$.hash===p)??null;return{commits:e,loading:u,error:m,selectedHash:p,setSelectedHash:I,files:b,filesError:N,selectedFile:A,setSelectedFile:j,diff:T,diffLoading:z||w,diffError:R,maxLanes:V,selectedCommit:X,loadMore:()=>n($=>$+Xk),refresh:()=>l($=>$+1)}}function hY({branches:e=[]}){const{commits:t,loading:s,error:n,selectedHash:o,setSelectedHash:l,files:u,filesError:h,selectedFile:m,setSelectedFile:d,diff:p,diffLoading:g,diffError:b,maxLanes:v,selectedCommit:w,loadMore:k,refresh:N}=dY();du(N);const[E,A]=y.useState(""),j=y.useMemo(()=>{const D=E.trim().toLowerCase();return D?e.filter(I=>I.name.toLowerCase().includes(D)):e},[e,E]),T=y.useMemo(()=>Vk(j.filter(D=>!D.remote)),[j]),P=y.useMemo(()=>Vk(j.filter(D=>D.remote)),[j]),z=E.trim().length>0,L=y.useRef(new Map);function R(D){const I=D.remote?"remote":"branch",V=t.find(W=>W.refs.some(q=>q.kind===I&&q.name===D.name));if(!V)return;l(V.hash);const X=L.current.get(V.hash),$=X?.parentElement?.parentElement;!X||!$||$.scrollTo({top:Math.max(X.offsetTop-$.clientHeight/2+X.clientHeight/2,0),behavior:"smooth"})}return r.jsxs("div",{className:"grid h-full min-h-0 overflow-hidden border-0 bg-card/85 grid-cols-[220px_minmax(0,1fr)]",children:[r.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden border-r border-border",children:[r.jsxs("div",{className:"flex shrink-0 flex-col gap-1 border-b border-border px-3 py-1.5",children:[r.jsx("h2",{className:"text-[13px] font-semibold tracking-tight",children:"Branches"}),r.jsx("input",{type:"search",value:E,onChange:D=>A(D.target.value),placeholder:"Search branches…",className:"w-full rounded border border-border bg-background px-2 py-1 text-[11px] outline-none focus:border-foreground"})]}),r.jsxs("div",{className:"min-h-0 flex-1 overflow-auto py-1",children:[r.jsx(Gk,{label:"Local",tree:T,onSelect:R,defaultOpen:!0,forceOpen:z}),r.jsx(Gk,{label:"Remote",tree:P,onSelect:R,forceOpen:z})]})]}),r.jsxs("div",{className:"grid min-h-0 min-w-0 grid-rows-[minmax(0,3fr)_minmax(0,2fr)]",children:[r.jsx(JK,{selectedCommit:w,selectedFile:m,diff:p,diffLoading:g,diffError:b}),r.jsxs("div",{className:"grid min-h-0 min-w-0 grid-cols-[minmax(0,1fr)_280px]",children:[r.jsx(lY,{commits:t,loading:s,error:n,selectedHash:o,maxLanes:v,rowRefs:L,onSelect:l,onLoadMore:k}),r.jsx(eY,{files:u,filesError:h,selectedHash:o,selectedFile:m,onSelect:d})]})]})]})}function fY({repo:e,file:t,onClose:s}){const[n,o]=y.useState(""),[l,u]=y.useState(null),[h,m]=y.useState(!0);y.useEffect(()=>{let p=!0;return m(!0),u(null),XN(t,e).then(g=>{p&&o(g)}).catch(g=>{p&&u(g instanceof Error?g.message:String(g))}).finally(()=>{p&&m(!1)}),()=>{p=!1}},[e,t]),y.useEffect(()=>{function p(g){g.key==="Escape"&&s()}return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[s]);const d=gx(n);return va.createPortal(r.jsxs("div",{className:"fixed inset-0 z-[1000] flex justify-end",children:[r.jsx("button",{"aria-label":"Close diff",className:"absolute inset-0 bg-black/35",onClick:s,type:"button"}),r.jsxs("div",{className:"relative z-10 flex h-full w-[min(900px,calc(100vw-3rem))] flex-col bg-card shadow-xl",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:t}),r.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground",children:[r.jsx("span",{className:"font-mono",children:e}),d.additions||d.deletions?r.jsxs("span",{className:"flex items-center gap-1 font-mono",children:[r.jsxs("span",{className:"text-emerald-700",children:["+",d.additions]}),r.jsxs("span",{className:"text-red-700",children:["-",d.deletions]})]}):null]})]}),r.jsx(J,{"aria-label":"Close diff",onClick:s,size:"icon",variant:"ghost",children:r.jsx(ts,{})})]}),r.jsx("div",{className:"relative min-h-0 min-w-0 flex-1",children:l?r.jsx("div",{className:"p-4",children:r.jsx(tt,{variant:"destructive",children:l})}):h?r.jsx("div",{className:"p-4 text-xs text-muted-foreground",children:"Loading diff…"}):r.jsx(lu,{diff:n||"No unstaged diff for this file."})})]})]}),document.body)}function Eb(e){return e.split(/[\\/]/).filter(Boolean).pop()??"project"}function mY({initialPath:e,onSelect:t,selectedPath:s}){const[n,o]=y.useState(e),[l,u]=y.useState(null),[h,m]=y.useState(null),[d,p]=y.useState(!1),g=pY(l);return y.useEffect(()=>{o(e)},[e]),y.useEffect(()=>{let b=!0;return p(!0),m(null),nC(n).then(v=>{b&&(u(v),t(v.path))}).catch(v=>{b&&m(v instanceof Error?v.message:String(v))}).finally(()=>{b&&p(!1)}),()=>{b=!1}},[n,t]),r.jsxs("div",{className:"rounded-md border border-border bg-background",children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border p-2",children:[g?r.jsx(J,{"aria-label":"Open parent folder",onClick:()=>l&&o(l.parent),size:"icon",type:"button",variant:"ghost",children:r.jsx(vn,{className:"rotate-90"})}):null,r.jsx("div",{className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",children:l?.path??n}),d?r.jsx(Et,{className:"size-4 animate-spin text-muted-foreground"}):null]}),r.jsxs("div",{className:"max-h-56 overflow-auto p-1",children:[h?r.jsx(tt,{variant:"destructive",className:"m-1",children:h}):null,!h&&l?.entries.length===0?r.jsx(tt,{variant:"muted",className:"m-1 text-center",children:"No folders here."}):null,l?.entries.map(b=>r.jsxs(J,{className:de("h-8 w-full justify-start rounded-sm px-2 text-left",s===b.path&&"bg-muted"),onClick:()=>o(b.path),title:b.path,type:"button",variant:"ghost",children:[r.jsx(ro,{className:"text-accent"}),r.jsx("span",{className:"truncate",children:b.name})]},b.path))]})]})}function pY(e){return!!(e&&e.parent!==e.path)}function gY({data:e,onRefresh:t}){const[s,n]=y.useState(!1),[o,l]=y.useState(e.git.cwd),[u,h]=y.useState(null),[m,d]=y.useState(!1),[p,g]=y.useState(e.git.cwd),b=y.useRef(null),v=e.git.selectedRepository,w=v?.name??(e.git.cwd?Eb(e.git.cwd):"Add Git project"),{error:k,success:N}=$s(),E=xY({gitCwd:e.git.cwd});y.useEffect(()=>{l(e.git.cwd),g(e.git.cwd)},[e.git.cwd]),y.useEffect(()=>{if(!s)return;function L(R){b.current&&R.target instanceof Node&&!b.current.contains(R.target)&&n(!1)}return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[s]);async function A(L){try{await p8(L),n(!1),await t(),N(`Switched to ${L}.`)}catch(R){k(R instanceof Error?R.message:String(R))}}async function j(L){const R=L.trim();if(!bY(R)){const D="Please add an absolute path. Paths beginning with ~ are not expanded here.";return h(D),k(D),!1}try{const D=Eb(R);return await g8(D,R),h(null),await t(),N(`Added Git project ${D}.`),!0}catch(D){const I=D instanceof Error?D.message:String(D);return h(I),k(I),!1}}async function T(L){try{await m8(L),await t(),N(`Removed Git project ${L}.`)}catch(R){k(R instanceof Error?R.message:String(R))}}async function P(L){L.preventDefault(),await j(o)&&n(!1)}function z(){h(null),g(E.selectedPath),d(!0)}return r.jsxs("div",{className:"relative z-50 flex items-center gap-2",ref:b,children:[r.jsxs(J,{className:"max-w-[220px] justify-start gap-2 rounded-md border-border bg-card",onClick:()=>n(L=>!L),size:"sm",type:"button",variant:"outline",children:[r.jsx(ro,{className:"text-muted-foreground"}),r.jsx("span",{className:"truncate",children:w}),r.jsx(vn,{className:de("ml-auto transition-transform",s&&"rotate-180")})]}),r.jsx(J,{"aria-label":"Add Git project",onClick:z,size:"sm",type:"button",variant:"outline",children:r.jsx(Es,{})}),s?r.jsxs("div",{className:"absolute right-0 top-10 z-50 w-[min(380px,calc(100vw-2rem))] overflow-hidden rounded-lg border border-border bg-card shadow-lg",children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[r.jsx(A4,{className:"size-3.5 text-muted-foreground"}),r.jsx("div",{className:"text-xs font-semibold",children:"Git Projects"}),r.jsx(et,{className:"ml-auto h-5 px-1.5 text-[10px]",variant:"outline",children:e.config.gitRepositories.length})]}),r.jsx("div",{className:"max-h-72 overflow-auto",children:e.config.gitRepositories.length?r.jsx("div",{className:"divide-y divide-border",children:e.config.gitRepositories.map(L=>{const R=L.name===v?.name;return r.jsxs("div",{className:de("group grid w-full grid-cols-[1fr_auto_auto] items-center gap-2 px-3 py-1.5 text-left transition-colors hover:bg-muted",R&&"bg-muted/70"),children:[r.jsxs("button",{className:"min-w-0 text-left",onClick:()=>{A(L.name)},type:"button",children:[r.jsx("span",{className:"block truncate text-sm font-medium leading-tight",children:L.name}),r.jsx("span",{className:"block truncate font-mono text-[10px] leading-tight text-muted-foreground",children:L.path})]}),R?r.jsx(on,{className:"size-3.5"}):r.jsx("span",{className:"size-3.5"}),r.jsx(J,{"aria-label":`Remove ${L.name}`,className:"size-6 opacity-0 transition-opacity group-hover:opacity-100",onClick:()=>{T(L.name)},size:"icon",title:`Remove ${L.name}`,type:"button",variant:"ghost",children:r.jsx(Er,{className:"size-3.5 text-destructive"})})]},L.name)})}):r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"No saved Git projects yet."})}),r.jsxs("div",{className:"border-t border-border bg-muted/20 p-2",children:[r.jsxs("form",{className:"flex gap-1.5",onSubmit:P,children:[r.jsx(gt,{"aria-label":"Paste absolute path",className:"h-7 flex-1 px-2 font-mono text-[11px]",onChange:L=>{l(L.target.value),h(null)},placeholder:"/absolute/path",value:o}),r.jsxs(J,{className:"h-7 px-2 text-[11px]",size:"sm",type:"submit",children:[r.jsx(Es,{className:"size-3"}),"Add"]}),r.jsx(J,{"aria-label":"Browse and add Git project",className:"h-7 px-2",onClick:z,size:"sm",type:"button",variant:"outline",children:r.jsx(wN,{className:"size-3"})})]}),u?r.jsx("div",{className:"mt-1.5 truncate text-[10px] text-destructive",children:u}):null]})]}):null,m?r.jsx(aj,{confirmLabel:E.confirmLabel,errorMessage:u,initialPath:E.initialPath,selectedPath:p,title:"Add Git Project",onCancel:()=>d(!1),onSelect:g,onUse:async()=>{await j(p)&&(d(!1),n(!1))}}):null]})}function bY(e){return e.startsWith("/")}function xY({gitCwd:e}){return{confirmLabel:"Add Git project",initialPath:e,selectedPath:e}}function aj({confirmLabel:e="Use this folder",errorMessage:t,initialPath:s,onCancel:n,onSelect:o,onUse:l,selectedPath:u,title:h="Choose Git Project Folder"}){return va.createPortal(r.jsx("div",{className:"fixed inset-0 z-[1000] grid place-items-center bg-black/35 px-4",children:r.jsxs("div",{className:"w-full max-w-2xl rounded-xl border border-border bg-card p-4 shadow-xl",children:[r.jsxs("div",{className:"mb-3 flex items-center gap-3",children:[r.jsx("div",{className:"flex size-8 items-center justify-center rounded-lg border border-border bg-background",children:r.jsx(ro,{className:"size-4"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"text-sm font-semibold",children:h}),r.jsx("div",{className:"truncate font-mono text-xs text-muted-foreground",children:u})]}),r.jsx(J,{"aria-label":"Close folder picker",onClick:n,size:"icon",variant:"ghost",children:r.jsx(ts,{})})]}),r.jsx(mY,{initialPath:s,onSelect:o,selectedPath:u}),t?r.jsx("div",{className:"mt-3 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:t}):null,r.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[r.jsx(J,{onClick:n,type:"button",variant:"outline",children:"Cancel"}),r.jsx(J,{onClick:()=>{l()},type:"button",children:e})]})]})}),document.body)}const kc=5,vY=240,jb=8,_Y=176+jb;function yY({currentRepoPath:e}){const[t,s]=y.useState(null),[n,o]=y.useState([]),[l,u]=y.useState(null),[h,m]=y.useState(!0),[d,p]=y.useState(null),g=y.useRef(null),b=y.useRef(null),[v,w]=y.useState(0);y.useEffect(()=>{const $=b.current;if(!$)return;const W=new ResizeObserver(q=>{w(q[0].contentRect.width)});return W.observe($),()=>W.disconnect()},[t]);const k=y.useCallback(()=>{let $=!0;return m(!0),u(null),Lp().then(W=>{$&&(s(W.repos),o(W.board))}).catch(W=>{$&&u(W instanceof Error?W.message:String(W))}).finally(()=>{$&&m(!1)}),()=>{$=!1}},[]);y.useEffect(k,[k]);const N=y.useCallback(()=>{Lp().then($=>{s($.repos),o($.board)}).catch($=>{u($ instanceof Error?$.message:String($))})},[]),E=y.useCallback($=>{o($),qy($).catch(W=>{u(W instanceof Error?W.message:String(W))})},[]),A=y.useCallback(async $=>{const W=$.trim();if(!W.startsWith("/"))return"Please add an absolute path (it must start with /).";try{const q=Eb(W);await ki("/api/git/repositories",{name:q,path:W});const B=await Lp();s(B.repos);const Z=(B.board.includes(q)?B.board:[...B.board,q]).slice(0,kc);return o(Z),await qy(Z),null}catch(q){return q instanceof Error?q.message:String(q)}},[]),j=new Map((t??[]).map($=>[$.name,$])),T=n.map($=>j.get($)).filter($=>!!$).slice(0,kc),P=(t??[]).filter($=>!n.includes($.name)),z=T.length<kc,L=Math.max(0,v-(z?_Y:0)),R=v===0?kc:Math.max(1,Math.floor((L+jb)/(vY+jb))),D=Math.min(T.length,R),I=T.slice(0,D),V=T.length-D;function X($){const W=g.current;if(g.current=null,W===null||W===$)return;const q=[...n],[B]=q.splice(W,1);q.splice($,0,B),E(q)}return r.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/85",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border bg-card/95 px-3 py-1.5",children:[r.jsxs("span",{className:"flex items-center gap-1.5 text-[12px] font-semibold tracking-tight",children:[r.jsx(zb,{className:"size-3.5"}),"Repositories",t?r.jsxs(et,{variant:"secondary",className:"ml-1",children:[T.length,t.length>T.length?` / ${t.length}`:""]}):null,V>0?r.jsxs("span",{className:"ml-1 text-[10px] font-normal text-muted-foreground",children:["+",V," hidden — widen the window or remove one"]}):null]}),r.jsxs(J,{"aria-label":"Refresh repositories",disabled:h,onClick:k,size:"sm",type:"button",variant:"outline",children:[r.jsx(Cr,{className:h?"animate-spin":void 0}),"Refresh"]})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:l?r.jsx(tt,{variant:"destructive",className:"m-3",children:l}):t&&t.length===0?r.jsx(tt,{variant:"muted",className:"m-3 text-center",children:"No Git projects registered. Add one with the project picker in the header."}):r.jsxs("div",{className:"flex h-full min-h-0 gap-2 p-2",ref:b,children:[I.map(($,W)=>r.jsx(SY,{repo:$,isCurrent:!!e&&$.path===e,selectedFile:d?.repo===$.name?d.file:"",onSelectFile:q=>p({repo:$.name,file:q}),onRemove:()=>E(n.filter(q=>q!==$.name)),onMutated:N,onDragStart:()=>{g.current=W},onDropColumn:()=>X(W)},$.name)),z?r.jsx(wY,{unpinned:P,onAdd:$=>E([...n,$].slice(0,kc)),onRegister:A}):null]})}),d?r.jsx(fY,{repo:d.repo,file:d.file,onClose:()=>p(null)}):null]})}function SY({repo:e,isCurrent:t,selectedFile:s,onSelectFile:n,onRemove:o,onMutated:l,onDragStart:u,onDropColumn:h}){const[m,d]=y.useState(!1),[p,g]=y.useState(!1),[b,v]=y.useState(!1),w=y.useCallback(async(A,j)=>{if(j.length){g(!0);try{await A(j,e.name),l()}finally{g(!1)}}},[e.name,l]),k={busy:p,onStage:A=>{w(Pb,A)},onUnstage:A=>{w(ZN,A)}},N=e.files.filter(A=>A.index.trim()&&A.index!=="?").length,E=b?vn:Yn;return r.jsxs("div",{className:de("flex min-w-0 flex-1 flex-col overflow-hidden rounded-md border border-border bg-card",t&&"border-primary/60 ring-1 ring-primary/30",m&&"ring-2 ring-foreground/40"),onDragOver:A=>{A.preventDefault(),d(!0)},onDragLeave:()=>d(!1),onDrop:()=>{d(!1),h()},children:[r.jsxs("div",{className:"flex shrink-0 cursor-grab items-center justify-between gap-1 border-b border-border bg-muted/40 px-1.5 py-1.5 active:cursor-grabbing",draggable:!0,onDragStart:u,children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[r.jsx(cR,{className:"size-3.5 shrink-0 text-muted-foreground/60"}),r.jsx("span",{className:"truncate text-[12px] font-semibold",title:e.path,children:e.name}),t?r.jsxs("span",{className:"flex shrink-0 items-center gap-0.5 rounded bg-primary px-1 py-px text-[9px] font-semibold uppercase tracking-wide text-primary-foreground",title:"The repository currently selected across NoMoreIDE",children:[r.jsx(on,{className:"size-2.5"}),"Current"]}):null]}),r.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[r.jsxs("span",{className:"flex items-center gap-1 font-mono text-[10px] text-muted-foreground",children:[e.ahead?r.jsxs("span",{className:"flex items-center",title:`${e.ahead} ahead`,children:[r.jsx(tf,{className:"size-3"}),e.ahead]}):null,e.behind?r.jsxs("span",{className:"flex items-center",title:`${e.behind} behind`,children:[r.jsx(ef,{className:"size-3"}),e.behind]}):null]}),r.jsx("button",{"aria-label":`Remove ${e.name} from board`,className:"rounded p-0.5 text-muted-foreground transition-colors hover:bg-background hover:text-foreground",onClick:o,title:"Remove from board (stays registered)",type:"button",children:r.jsx(ts,{className:"size-3.5"})})]})]}),r.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:r.jsx(M5,{branch:e.branch||void 0,error:e.error,files:e.files,onSelectFile:n,root:e.path,selectedFile:s,staging:k})}),r.jsxs("div",{className:"shrink-0 border-t border-border",children:[r.jsxs("button",{"aria-expanded":b,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(A=>!A),type:"button",children:[r.jsx(E,{className:"size-3.5 shrink-0"}),r.jsx("span",{className:"flex-1",children:"Commit"}),N?r.jsxs(et,{size:"small",variant:"secondary",children:[N," staged"]}):null]}),b?r.jsx(D5,{branch:e.branch||void 0,files:e.files,onDone:l,repo:e.name}):null]})]})}function wY({unpinned:e,onAdd:t,onRegister:s}){const[n,o]=y.useState(!1),[l,u]=y.useState(null),[h,m]=y.useState(""),[d,p]=y.useState(null),[g,b]=y.useState(!1),[v,w]=y.useState(!1),[k,N]=y.useState(""),E=y.useRef(null),A=y.useRef(null);function j(){if(n){o(!1);return}u(E.current?.getBoundingClientRect()??null),p(null),o(!0)}y.useEffect(()=>{if(!n)return;function z(L){const R=L.target;R instanceof Node&&(A.current?.contains(R)||E.current?.contains(R)||o(!1))}return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[n]);async function T(z){b(!0),p(null);const L=await s(z);return b(!1),L?(p(L),!1):(m(""),o(!1),!0)}async function P(z){z.preventDefault(),await T(h)}return r.jsxs("div",{className:"w-44 shrink-0",children:[r.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:j,type:"button",children:[r.jsx(Es,{className:"size-5"}),r.jsx("span",{className:"text-[12px] font-medium",children:"Add repository"})]}),n&&l?va.createPortal(r.jsxs("div",{ref:A,className:"fixed z-[1000] w-72 overflow-hidden rounded-lg border border-border bg-card shadow-xl",style:{left:Math.max(8,Math.min(l.left,window.innerWidth-296)),top:Math.min(l.top,window.innerHeight-320)},children:[e.length?r.jsxs("div",{className:"border-b border-border",children:[r.jsx("div",{className:"px-3 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Pin a registered repo"}),r.jsx("div",{className:"max-h-52 overflow-auto pb-1",children:e.map(z=>r.jsxs("button",{className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm hover:bg-muted",onClick:()=>{t(z.name),o(!1)},type:"button",children:[r.jsx(zb,{className:"size-3.5 shrink-0 text-muted-foreground"}),r.jsx("span",{className:"min-w-0 flex-1 truncate",title:z.path,children:z.name}),z.files.length?r.jsx(et,{variant:"outline",className:"h-5 px-1.5 text-[10px]",children:z.files.length}):null]},z.name))})]}):null,r.jsxs("div",{className:"p-2.5",children:[r.jsx("div",{className:"pb-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Add a new repository"}),r.jsxs("form",{className:"flex gap-1.5",onSubmit:P,children:[r.jsx(gt,{"aria-label":"Repository absolute path",className:"h-7 flex-1 px-2 font-mono text-[11px]",onChange:z=>{m(z.target.value),p(null)},placeholder:"/absolute/path/to/repo",value:h}),r.jsx(J,{className:"h-7 px-2 text-[11px]",disabled:g||!h.trim(),size:"sm",type:"submit",children:"Add"})]}),r.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:[r.jsx(wN,{className:"size-3"}),"Browse folders…"]}),d?r.jsx("div",{className:"mt-1.5 text-[10px] text-destructive",children:d}):null]})]}),document.body):null,v?r.jsx(aj,{confirmLabel:"Add repository",errorMessage:d,initialPath:k||"/",selectedPath:k,title:"Add Repository",onCancel:()=>w(!1),onSelect:N,onUse:async()=>{await T(k)&&w(!1)}}):null]})}const Tb=300,kY=600,NY=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 CY(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:!NY.has(t.slice(s+1))}function EY(e){return e>=kY?"danger":e>=Tb?"warn":"ok"}const jY={ok:"bg-emerald-500/60",warn:"bg-amber-500/70",danger:"bg-destructive/70"},TY={ok:"text-muted-foreground",warn:"text-amber-600 dark:text-amber-400",danger:"text-destructive"};function AY({onOpenFile:e,root:t}){const[s,n]=y.useState([]),[o,l]=y.useState(!0),[u,h]=y.useState(null),[m,d]=y.useState(!0);function p(){l(!0),h(null),c8().then(n).catch(k=>h(k instanceof Error?k.message:String(k))).finally(()=>l(!1))}y.useEffect(()=>{p()},[]);const g=y.useMemo(()=>m?s.filter(k=>CY(k.path)):s,[s,m]),b=s.length-g.length,v=g[0]?.lines??1,w=g.filter(k=>k.lines>=Tb).length;return r.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/85",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx(yN,{className:"size-4"}),r.jsx("span",{className:"font-semibold text-foreground",children:"Largest files"}),!o&&!u?r.jsxs("span",{children:[g.length," files · ",w," over ",Tb," lines",m&&b>0?` · ${b} data/docs hidden`:""]}):null]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsxs(J,{size:"sm",variant:m?"default":"outline",className:"h-7",onClick:()=>d(k=>!k),title:"Hide docs, data, config and generated files",type:"button",children:[r.jsx(gN,{}),"Code only"]}),r.jsxs(J,{size:"sm",variant:"outline",className:"h-7",onClick:p,disabled:o,type:"button",children:[o?r.jsx(Et,{className:"animate-spin"}):r.jsx(Cr,{}),"Refresh"]})]})]}),u?r.jsx(tt,{variant:"destructive",className:"m-3",children:u}):o&&s.length===0?r.jsxs("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:[r.jsx(Et,{className:"mr-2 size-4 animate-spin"}),"Scanning tracked files…"]}):g.length===0?r.jsx("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:s.length===0?"No tracked text files found.":"No code files — toggle off “Code only” to see data & docs."}):r.jsx("ul",{className:"min-h-0 flex-1 divide-y divide-border/60 overflow-auto",children:g.map((k,N)=>{const E=EY(k.lines);return r.jsxs("li",{className:"group flex items-center gap-3 px-3 transition-colors hover:bg-muted/50",children:[r.jsx("span",{className:"w-6 shrink-0 text-right font-mono text-[10px] text-muted-foreground",children:N+1}),r.jsx("button",{type:"button",onClick:()=>e(k.path),className:"min-w-0 flex-1 py-1.5 text-left",children:r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsx("span",{className:"truncate font-mono text-[11px]",children:k.path}),r.jsxs("span",{className:de("shrink-0 font-mono text-[11px] tabular-nums",TY[E]),children:[k.truncated?"≥":"",k.lines.toLocaleString()," lines"]})]}),r.jsx("div",{className:"mt-1 h-1 w-full overflow-hidden rounded-full bg-muted",children:r.jsx("div",{className:de("h-full rounded-full",jY[E]),style:{width:`${Math.max(2,k.lines/v*100)}%`}})})]})}),r.jsxs("div",{className:"flex shrink-0 items-center justify-end gap-0.5",children:[r.jsx(RY,{file:k,root:t}),r.jsx(MY,{file:k,root:t})]})]},k.path)})})]})}function RY({file:e,root:t}){const{sendToAgent:s}=It(),n=cu(t,e.path),o=e.path.split("/").pop()??e.path;function l(){s({prompt:bP({absolutePath:n,lines:e.lines,relativePath:e.path}),source:{label:o,type:"large-file"},label:`Help me split \`${e.path}\` (${e.lines.toLocaleString()} lines).`,mode:"send"})}function u(){s({prompt:n,source:{label:o,type:"large-file"},mode:"draft"})}return r.jsx(oj,{label:`AI actions for ${e.path}`,trigger:r.jsx(Gt,{className:"size-3.5"}),children:h=>r.jsxs(r.Fragment,{children:[r.jsx(Fc,{icon:r.jsx(Gt,{className:"size-3.5"}),onSelect:()=>{h(),l()},children:"Ask AI to split this file"}),r.jsx(Fc,{icon:r.jsx(_N,{className:"size-3.5"}),onSelect:()=>{h(),u()},children:"Send file path to AI"})]})})}function MY({file:e,root:t}){const{error:s,success:n}=$s(),o=cu(t,e.path),l=e.path.split("/").pop()??e.path;async function u(h,m){try{await navigator.clipboard.writeText(h),n(`Copied ${m}.`)}catch(d){s(d instanceof Error?d.message:`Could not copy ${m}.`)}}return r.jsx(oj,{label:`Copy path for ${e.path}`,trigger:r.jsxs(r.Fragment,{children:[r.jsx(xN,{className:"size-3.5"}),r.jsx("span",{className:"sr-only",children:"More actions"})]}),children:h=>r.jsxs(r.Fragment,{children:[r.jsx(Fc,{icon:r.jsx(Lb,{className:"size-3.5"}),onSelect:()=>{h(),u(l,"file name")},children:"Copy file name"}),r.jsx(Fc,{icon:r.jsx(wh,{className:"size-3.5"}),onSelect:()=>{h(),u(e.path,"relative path")},children:"Copy relative path"}),r.jsx(Fc,{icon:r.jsx(wh,{className:"size-3.5"}),onSelect:()=>{h(),u(o,"absolute path")},children:"Copy absolute path"})]})})}function oj({children:e,label:t,trigger:s}){const[n,o]=y.useState(!1),[l,u]=y.useState({right:0,top:0}),h=y.useRef(null),m=y.useRef(null);function d(){o(!1)}function p(){const g=h.current?.getBoundingClientRect();g&&u({top:g.bottom+6,right:window.innerWidth-g.right}),o(b=>!b)}return y.useEffect(()=>{if(!n)return;function g(v){const w=v.target;h.current?.contains(w)||m.current?.contains(w)||d()}function b(v){v.key==="Escape"&&d()}return document.addEventListener("mousedown",g),document.addEventListener("keydown",b),window.addEventListener("scroll",d,!0),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",b),window.removeEventListener("scroll",d,!0)}},[n]),r.jsxs(r.Fragment,{children:[r.jsx("button",{"aria-label":t,className:de("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?va.createPortal(r.jsx("div",{className:"fixed z-50 w-56 overflow-hidden rounded-md border border-border bg-card p-1 shadow-md",ref:m,style:{top:l.top,right:l.right},children:e(d)}),document.body):null]})}function Fc({children:e,icon:t,onSelect:s}){return r.jsxs("button",{className:"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-xs text-foreground transition-colors hover:bg-muted",onClick:s,type:"button",children:[r.jsx("span",{className:"text-muted-foreground",children:t}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:e})]})}function Zk(e,t,s){const n=e.trim(),o=n.toLowerCase(),l=[],u=/\breview|check|inspect|audit\b/.test(o),h=/\btest|verify|ci\b/.test(o),m=/\bcommit\b/.test(o)||/\bship|push|pr|pull request\b/.test(o),d=/\bpush|ship|pr|pull request\b/.test(o),p=/\bpr\b|pull request/.test(o),g=OY(o,s);return p&&l.push({kind:"action",id:"assert-pr-branch",title:"Check PR branch",op:"assert-pr-branch"}),u&&(l.push(sh("gate-review","Approve review","Review the current changes?")),l.push(Nc("review","Review changes","Review the current git changes. Summarize risks, likely bugs, and anything that should change before committing.",nh(g,["skills","mcpServers"])))),h&&l.push(Nc("verify","Run verification","Run the relevant tests or checks for this repository. If something fails, stop and explain the failure.",nh(g,["skills","mcpServers","plugins"]))),m&&(l.push(Nc("commit-message","Generate commit message","Stage the appropriate changed files, inspect the staged diff briefly, and draft one conventional commit message. Do not commit.",nh(g,["skills"]))),l.push(sh("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(sh("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(Nc("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.",nh(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(sh("gate-start","Approve start","Run this workflow?")),l.push(Nc("ai-step","AI step",n||"Complete this workflow step.",g))),{id:zY(lj(Qk(o))||"custom-workflow",t),name:Qk(o),description:n||"Custom AI-authored workflow.",builtin:!1,steps:LY(l)}}function DY(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(`
|
|
220
|
+
`)}function Qk(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 sh(e,t,s){return{kind:"gate",id:e,title:t,message:s}}function Nc(e,t,s,n,o){return{kind:"agent",id:e,title:t,prompt:s,capabilities:Ux(n),verify:o}}function OY(e,t){return Ux({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 nh(e,t){const s={};for(const n of t){const o=e[n];o?.length&&(s[n]=o)}return Ux(s)}function Ux(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 LY(e){const t=new Map;return e.map(s=>{const n=lj(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 zY(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 lj(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function BY(){const{run:e,start:t,resume:s,approve:n,skip:o,stop:l,dismiss:u}=nH(),[h,m]=y.useState([]),[d,p]=y.useState(null),[g,b]=y.useState(null),[v,w]=y.useState(null),[k,N]=y.useState(!0),[E,A]=y.useState(!1),[j,T]=y.useState(!0);y.useEffect(()=>{let D=!0;return N(!0),Promise.all([RO(),VN().catch(()=>null)]).then(([I,V])=>{D&&(m(I),p(V))}).catch(I=>{D&&w(I instanceof Error?I.message:String(I))}).finally(()=>{D&&N(!1)}),()=>{D=!1}},[]);function P(D){A(!0),t(D,j)}async function z(D){w(null);try{const I=await MO(D);m(I),b(null)}catch(I){w(I instanceof Error?I.message:String(I))}}async function L(D){if(!D.builtin&&window.confirm(`Delete workflow "${D.name}"?`)){w(null);try{m(await DO(D.id))}catch(I){w(I instanceof Error?I.message:String(I))}}}function R(D){b({...D,id:Fx(`${D.id}-copy`,h),name:`${D.name} copy`,builtin:!1,steps:D.steps.map((I,V)=>({...I,id:`${I.id}-${V+1}`}))})}return e&&E?r.jsx(WY,{run:e,onApprove:n,onSkip:o,onStop:l,onBack:()=>A(!1),onResume:()=>{A(!0),s(j)},onRestart:()=>{A(!0),t(e.workflow,j)}}):g?r.jsx($Y,{agent:d?ZY(d):null,existing:h,initial:g,onCancel:()=>b(null),onSave:D=>{z(D)}}):r.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-auto bg-card/85",children:[r.jsxs("div",{className:"border-b border-border px-4 py-3",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{children:[r.jsxs("h2",{className:"flex items-center gap-1.5 text-[13px] font-semibold",children:[r.jsx(Gt,{className:"size-4"})," AI Workflows"]}),r.jsx("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:"One-click rituals that exceed the IDE — the agent does the work in the dock, pausing at each gate for your OK."})]}),r.jsxs(J,{onClick:()=>b(JY(h)),size:"sm",type:"button",variant:"outline",children:[r.jsx(Es,{className:"size-3.5"})," New"]})]}),r.jsxs("label",{className:"mt-2 flex w-fit items-center gap-1.5 text-[11px] text-muted-foreground",children:[r.jsx("input",{checked:j,className:"size-3.5 accent-primary",onChange:D=>T(D.target.checked),type:"checkbox"}),"Run without step-by-step prompts",r.jsx("span",{className:"text-muted-foreground/60",children:"— gates still pause; risky shell still asks."})]})]}),v?r.jsx(tt,{variant:"destructive",className:"m-4",children:v}):k?r.jsxs("div",{className:"flex flex-1 items-center justify-center text-[12px] text-muted-foreground",children:[r.jsx(Et,{className:"mr-2 size-4 animate-spin"})," Loading workflows…"]}):r.jsxs(r.Fragment,{children:[e?r.jsx(IY,{onClear:u,onView:()=>A(!0),run:e}):null,r.jsx("div",{className:"grid gap-3 p-4 sm:grid-cols-2 xl:grid-cols-3",children:h.map(D=>r.jsx(PY,{lastRun:e?.workflow.id===D.id?e:null,workflow:D,onDelete:()=>{L(D)},onDuplicate:()=>R(D),onEdit:()=>b(D),onRun:()=>P(D)},D.id))})]})]})}function IY({onClear:e,onView:t,run:s}){const n=s.outcome==="running";return r.jsx("section",{className:"mx-4 mt-4 rounded-md border border-border bg-background p-3 shadow-sm",children:r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:n?"Workflow running":"Last workflow"}),r.jsx(hj,{outcome:s.outcome})]}),r.jsx("p",{className:"mt-1 truncate text-[13px] font-medium",children:s.workflow.name}),r.jsxs("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:[n?"Started":"Ran"," ",dj(s.startedAt)]})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[r.jsxs(J,{onClick:t,size:"sm",type:"button",children:[r.jsx(cl,{className:"size-3.5"})," View run"]}),n?null:r.jsxs(J,{onClick:e,size:"sm",type:"button",variant:"outline",children:[r.jsx(ts,{className:"size-3.5"})," Clear"]})]})]})})}function PY({lastRun:e,workflow:t,onDelete:s,onDuplicate:n,onEdit:o,onRun:l}){const[u,h]=y.useState(!1),m=t.steps.length;return r.jsxs("div",{className:"flex flex-col rounded-lg border border-border bg-background p-3.5 shadow-sm",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsx("h3",{className:"text-[13px] font-semibold",children:t.name}),t.builtin?r.jsx("span",{className:"rounded-full border border-border px-1.5 py-px text-[9px] uppercase tracking-wide text-muted-foreground",children:"Template"}):null]}),t.description?r.jsx("p",{className:"mt-1 text-[11px] leading-snug text-muted-foreground",children:t.description}):null,e?r.jsxs("p",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[r.jsx(cl,{className:"size-3"}),e.outcome==="running"?"Running now":`Last run ${dj(e.startedAt)}`]}):null,r.jsxs("button",{"aria-expanded":u,className:"mt-2.5 flex w-full items-center gap-1.5 text-[11px] text-muted-foreground transition-colors hover:text-foreground",onClick:()=>h(d=>!d),type:"button",children:[r.jsx(Yn,{className:de("size-3 shrink-0 transition-transform",u?"rotate-90":""),"aria-hidden":!0}),r.jsxs("span",{children:[m," ",m===1?"step":"steps"]})]}),u?r.jsx("ol",{className:"mt-1.5 space-y-1",children:t.steps.map(d=>r.jsxs("li",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[r.jsx(sX,{kind:d.kind}),r.jsx("span",{className:"truncate",children:Qh(d)})]},d.id))}):null,r.jsxs(J,{className:"mt-3 w-full",onClick:l,size:"sm",type:"button",children:[r.jsx(Nr,{className:"size-3.5"})," Run"]}),r.jsxs("div",{className:"mt-2 grid grid-cols-3 gap-1.5",children:[r.jsxs(J,{onClick:o,size:"sm",type:"button",variant:"outline",children:[r.jsx(sM,{className:"size-3.5"})," Edit"]}),r.jsxs(J,{onClick:n,size:"sm",type:"button",variant:"outline",children:[r.jsx(wh,{className:"size-3.5"})," Copy"]}),r.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:[r.jsx(Er,{className:"size-3.5"})," Delete"]})]})]})}function $Y({agent:e,existing:t,initial:s,onCancel:n,onSave:o}){const[l,u]=y.useState(()=>structuredClone(s)),[h,m]=y.useState(s.description??""),[d,p]=y.useState(!1),g=QY(e),{sendToAgent:b}=It(),v=!l.id.trim()||!l.name.trim()||l.steps.length===0;function w(z,L){u(R=>({...R,steps:R.steps.map((D,I)=>I===z?L(D):D)}))}function k(z,L){u(R=>{const D=z+L;if(D<0||D>=R.steps.length)return R;const I=[...R.steps],[V]=I.splice(z,1);return I.splice(D,0,V),{...R,steps:I}})}function N(z){u(L=>({...L,steps:L.steps.filter((R,D)=>D!==z)}))}function E(z,L){u(R=>{const D=[...R.steps];return D.splice(z,0,UY(L,R.steps)),{...R,steps:D}})}function A(z=h){const L=Zk(z,t,g);u(L)}function j(z){const L=Zk(z,[],g);u(R=>({...R,steps:[...R.steps,...L.steps]}))}function T(){b({prompt:DY(h||l.description||l.name),source:{type:"workflow",label:"Workflow composer"},mode:"draft"})}function P(){const z=il(l.id)||Fx(il(l.name)||"workflow",t);o({...l,id:z,name:l.name.trim(),description:(h||l.description)?.trim()||void 0,builtin:!1,steps:l.steps.map(eX)})}return r.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-card/85",children:[r.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-border px-4 py-3",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx(Gt,{className:"size-4 shrink-0"}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("input",{"aria-label":"Workflow name",className:"w-full bg-transparent text-[14px] font-semibold outline-none",onChange:z=>u(L=>({...L,name:z.target.value,id:il(z.target.value)||L.id})),placeholder:"Name your workflow",value:l.name}),r.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:l.id})]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[r.jsxs(J,{onClick:()=>p(z=>!z),size:"sm",type:"button",variant:d?"default":"outline",children:[r.jsx(Ci,{className:"size-3.5"})," AI compose"]}),r.jsxs(J,{onClick:n,size:"sm",type:"button",variant:"outline",children:[r.jsx(eu,{className:"size-3.5"})," Back"]}),r.jsxs(J,{disabled:v,onClick:P,size:"sm",type:"button",children:[r.jsx(on,{className:"size-3.5"})," Save"]})]})]}),d?r.jsx("section",{className:"shrink-0 border-b border-border bg-muted/20 p-4",children:r.jsxs("div",{className:"grid gap-3 xl:grid-cols-[minmax(0,1.1fr)_minmax(0,0.9fr)]",children:[r.jsxs("div",{className:"rounded-lg border border-border bg-background p-3 shadow-sm",children:[r.jsx(wr,{children:"Describe workflow"}),r.jsx("textarea",{className:"min-h-16 w-full resize-none bg-transparent text-[13px] leading-relaxed outline-none placeholder:text-muted-foreground",onChange:z=>m(z.target.value),placeholder:"Review my changes with code-review, ask before commit, push, then open a PR with GitHub...",value:h}),r.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[r.jsxs(J,{onClick:()=>A(),size:"sm",type:"button",children:[r.jsx(Ci,{className:"size-3.5"})," Draft timeline"]}),r.jsxs(J,{onClick:T,size:"sm",type:"button",variant:"outline",children:[r.jsx(TN,{className:"size-3.5"})," Ask AI"]}),["Commit safely","Review then push","Fix CI then PR","File issue from changes"].map(z=>r.jsx("button",{className:"rounded-md border border-border bg-muted/30 px-2 py-1 text-[11px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:()=>{m(z),A(z)},type:"button",children:z},z))]})]}),r.jsxs("div",{className:"grid gap-3",children:[r.jsx(FY,{onAdd:j}),r.jsx(qY,{capabilities:g})]})]})}):null,r.jsx("main",{className:"min-h-0 flex-1 overflow-auto p-4",children:r.jsxs("div",{className:"mx-auto max-w-3xl",children:[r.jsx(Jk,{onInsert:z=>E(0,z)}),l.steps.length?l.steps.map((z,L)=>r.jsxs(y.Fragment,{children:[r.jsxs("div",{className:"flex gap-4",children:[r.jsxs("div",{className:"relative flex w-9 shrink-0 justify-center pt-2",children:[r.jsx("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-border"}),r.jsx(HY,{index:L,kind:z.kind})]}),r.jsx("div",{className:"min-w-0 flex-1 pb-1",children:r.jsx(VY,{capabilities:g,index:L,isFirst:L===0,isLast:L===l.steps.length-1,onMove:k,onRemove:N,onUpdate:w,step:z})})]}),r.jsx(Jk,{onInsert:R=>E(L+1,R)})]},`${z.kind}:${z.id}`)):r.jsx("div",{className:"ml-[3.25rem] flex h-24 items-center justify-center rounded-lg border border-dashed border-border text-[12px] text-muted-foreground",children:"Pick a step kind above to start building."})]})})]})}function Jk({defaultOpen:e=!1,onInsert:t}){const[s,n]=y.useState(e),o=[{kind:"gate",label:"Gate"},{kind:"agent",label:"AI"},{kind:"action",label:"Auto"}];return r.jsxs("div",{className:"flex gap-4",children:[r.jsxs("div",{className:"relative flex w-9 shrink-0 justify-center",children:[r.jsx("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-border"}),r.jsx("button",{"aria-label":s?"Cancel adding step":"Add step here",className:de("relative z-10 my-1.5 flex size-5 items-center justify-center rounded-full border bg-card text-muted-foreground transition-colors",s?"border-primary/50 text-primary":"border-border hover:border-primary/50 hover:text-primary"),onClick:()=>n(l=>!l),type:"button",children:s?r.jsx(ts,{className:"size-3"}):r.jsx(Es,{className:"size-3"})})]}),r.jsx("div",{className:"flex-1 py-1",children:s?r.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:o.map(({kind:l,label:u})=>r.jsxs("button",{className:"flex items-center gap-1.5 rounded-md border border-border bg-background px-2 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary/40 hover:text-foreground",onClick:()=>{t(l),n(!1)},type:"button",children:[r.jsx(fj,{kind:l})," ",u]},l))}):null})]})}function HY({index:e,kind:t}){return r.jsxs("div",{className:"relative z-10 flex size-9 items-center justify-center rounded-full border border-border bg-card shadow-sm",children:[r.jsx("span",{className:"absolute -right-1 -top-1 flex size-4 items-center justify-center rounded-full border border-border bg-background font-mono text-[9px] text-muted-foreground",children:e+1}),r.jsx(fj,{kind:t})]})}function UY(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 FY({onAdd:e}){const[t,s]=y.useState("");return r.jsxs("form",{className:"rounded-lg border border-dashed border-border bg-background/70 p-3",onSubmit:n=>{n.preventDefault();const o=t.trim();o&&(e(o),s(""))},children:[r.jsx(wr,{children:"Add a step"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{className:"min-w-0 flex-1 bg-transparent text-[12px] outline-none placeholder:text-muted-foreground",onChange:n=>s(n.target.value),placeholder:"ask before merge, run tests, open an issue...",value:t}),r.jsxs(J,{size:"sm",type:"submit",variant:"outline",children:[r.jsx(Es,{className:"size-3.5"})," Add"]})]})]})}function qY({capabilities:e}){const t=[...e.skills.map(s=>`@skill:${s}`),...e.mcpServers.map(s=>`@mcp:${s}`),...e.plugins.map(s=>`@plugin:${s}`)].slice(0,18);return t.length?r.jsxs("div",{className:"rounded-lg border border-border bg-background p-3",children:[r.jsx(wr,{children:"Detected capabilities"}),r.jsx("div",{className:"flex max-h-20 flex-wrap gap-1.5 overflow-hidden",children:t.map(s=>r.jsx("span",{className:"rounded-md border border-border bg-muted/30 px-2 py-1 font-mono text-[11px] text-muted-foreground",children:s},s))})]}):null}function VY({capabilities:e,index:t,isFirst:s,isLast:n,onMove:o,onRemove:l,onUpdate:u,step:h}){return r.jsx("section",{className:"group rounded-lg border border-border bg-background p-3 shadow-sm",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ab,{kind:h.kind}),r.jsx("input",{className:"min-w-0 flex-1 bg-transparent text-[13px] font-semibold outline-none",onChange:m=>u(t,d=>({...d,title:m.target.value})),value:h.title})]}),h.kind==="gate"?r.jsx("textarea",{className:"mt-2 min-h-12 w-full resize-none bg-transparent text-[12px] leading-relaxed text-muted-foreground outline-none focus:text-foreground",onChange:m=>u(t,d=>d.kind==="gate"?{...d,message:m.target.value}:d),placeholder:"Question to ask before continuing…",value:h.message}):h.kind==="action"?r.jsxs("div",{className:"mt-2 space-y-1.5",children:[r.jsxs("select",{className:"w-full rounded-md border border-border bg-background px-2 py-1 text-[12px] outline-none",onChange:m=>{const d=m.target.value;u(t,p=>p.kind==="action"?{...p,op:d}:p)},value:h.op,children:[r.jsx("option",{value:"commit",children:"Commit staged changes"}),r.jsx("option",{value:"push",children:"Push branch"}),r.jsx("option",{value:"assert-pr-branch",children:"Check PR branch"}),r.jsx("option",{value:"checkout-default-and-pull",children:"Return to default branch"})]}),r.jsx("p",{className:"text-[11px] leading-relaxed text-muted-foreground",children:cj(h.op)})]}):r.jsxs(r.Fragment,{children:[r.jsx("textarea",{className:"mt-2 min-h-16 w-full resize-none bg-transparent text-[12px] leading-relaxed text-muted-foreground outline-none focus:text-foreground",onChange:m=>u(t,d=>d.kind==="agent"?{...d,prompt:m.target.value}:d),placeholder:"What should the agent do at this step?",value:h.prompt}),r.jsxs("label",{className:"mt-2 flex w-fit items-center gap-1.5 text-[11px] text-muted-foreground",children:[r.jsx("input",{checked:h.isolated??!1,className:"size-3.5 accent-primary",onChange:m=>u(t,d=>d.kind==="agent"?{...d,isolated:m.target.checked}:d),type:"checkbox"}),"Fresh session",r.jsx("span",{className:"text-muted-foreground/60",children:"— cheaper; this step won't see earlier steps' context."})]}),r.jsx(GY,{capabilities:e,selected:h.capabilities,onToggle:(m,d)=>u(t,p=>p.kind==="agent"?{...p,capabilities:tX(p.capabilities,m,d)}:p)})]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1 opacity-70 transition-opacity group-hover:opacity-100",children:[r.jsx(J,{disabled:s,onClick:()=>o(t,-1),size:"sm",type:"button",variant:"ghost",children:"↑"}),r.jsx(J,{disabled:n,onClick:()=>o(t,1),size:"sm",type:"button",variant:"ghost",children:"↓"}),r.jsx(J,{onClick:()=>l(t),size:"sm",type:"button",variant:"ghost",children:r.jsx(Er,{className:"size-3.5"})})]})]})})}function GY({capabilities:e,onToggle:t,selected:s}){const n=[{key:"skills",label:"Skills",values:e.skills},{key:"mcpServers",label:"MCP",values:e.mcpServers},{key:"plugins",label:"Plugins",values:e.plugins},{key:"hooks",label:"Hooks",values:e.hooks}];return r.jsxs("div",{className:"space-y-2",children:[r.jsx(wr,{children:"Capabilities"}),n.map(o=>r.jsxs("div",{children:[r.jsx("div",{className:"mb-1 text-[10px] text-muted-foreground",children:o.label}),o.values.length?r.jsx("div",{className:"flex flex-wrap gap-1.5",children:o.values.map(l=>{const u=s?.[o.key]?.includes(l)??!1;return r.jsx("button",{className:de("rounded-md border px-2 py-1 text-[11px] transition-colors",u?"border-primary/50 bg-primary/10 text-primary":"border-border bg-muted/30 text-muted-foreground hover:bg-muted"),onClick:()=>t(o.key,l),type:"button",children:l},l)})}):r.jsx("p",{className:"text-[11px] text-muted-foreground/70",children:"None detected."})]},o.key))]})}function WY({run:e,onApprove:t,onSkip:s,onStop:n,onBack:o,onResume:l,onRestart:u}){const{sendToAgent:h}=It(),m=e.outcome!=="running",[d,p]=y.useState(e.index);y.useEffect(()=>{p(e.index)},[e.index]);const g=e.workflow.steps[d]??e.workflow.steps[e.index],b=e.statuses[d]??"pending",v=e.outputs[d],w=e.outputs[d-1],k=g?.kind==="gate"&&b==="waiting",N=b==="failed"||b==="blocked",E=b==="blocked"&&g?.kind==="action"&&g.op==="assert-pr-branch";return r.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-card/85",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("h2",{className:"flex items-center gap-1.5 text-[13px] font-semibold",children:[r.jsx(Gt,{className:"size-4"})," ",e.workflow.name]}),r.jsxs("p",{className:"mt-0.5 flex items-center gap-1 text-[11px] text-muted-foreground",children:[r.jsx(cl,{className:"size-3"})," Watch the agent work in the dock below."]})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(hj,{outcome:e.outcome}),r.jsxs(J,{onClick:o,size:"sm",type:"button",variant:"outline",children:[r.jsx(eu,{className:"size-3.5"})," Workflows"]}),m?null:r.jsxs(J,{onClick:n,size:"sm",type:"button",variant:"outline",children:[r.jsx(to,{className:"size-3.5"})," Stop"]})]})]}),r.jsxs("div",{className:"grid min-h-0 flex-1 overflow-hidden lg:grid-cols-[minmax(240px,320px)_minmax(0,1fr)]",children:[r.jsx("aside",{className:"min-h-0 overflow-auto border-b border-border bg-background/55 p-3 lg:border-b-0 lg:border-r",children:r.jsx("ol",{className:"space-y-1",children:e.workflow.steps.map((A,j)=>{const T=e.statuses[j],P=T==="running"||T==="waiting",z=j===d;return r.jsx("li",{children:r.jsxs("button",{className:de("flex w-full items-center gap-2 rounded-md border px-2.5 py-2 text-left transition-colors",z?"border-primary/45 bg-primary/[0.06]":P?"border-primary/30 bg-primary/[0.03]":"border-transparent hover:border-border hover:bg-muted/40"),onClick:()=>p(j),type:"button",children:[r.jsx("span",{className:de("flex size-7 shrink-0 items-center justify-center rounded-full border bg-card",T==="failed"?"border-destructive/50":T==="blocked"?"border-amber-500/50":P?"border-primary/50":T==="done"?"border-emerald-500/50":"border-border"),children:r.jsx(tN,{status:T,kind:A.kind})}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-[12px] font-medium",children:Qh(A)}),r.jsxs("span",{className:"mt-0.5 flex items-center gap-1.5",children:[r.jsx(Ab,{kind:A.kind}),r.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground/70",children:eN(T)})]})]}),r.jsx(Yn,{className:de("size-3.5 shrink-0 text-muted-foreground/50 transition-transform",z?"translate-x-0.5 text-primary":"")})]})},A.id)})})}),r.jsx("main",{className:"min-h-0 overflow-auto p-4",children:g?r.jsxs("section",{className:de("min-h-full rounded-lg border bg-background p-4 shadow-sm",b==="failed"?"border-destructive/40 bg-destructive/[0.03]":b==="blocked"?"border-amber-500/40 bg-amber-500/[0.04]":b==="running"||b==="waiting"?"border-primary/40 bg-primary/[0.03]":"border-border"),children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-border pb-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(tN,{status:b,kind:g.kind}),r.jsx("h3",{className:"truncate text-[13px] font-semibold",children:Qh(g)})]}),r.jsxs("div",{className:"mt-1 flex items-center gap-1.5",children:[r.jsx(Ab,{kind:g.kind}),r.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground/70",children:eN(b)})]})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[m&&N&&d===e.index&&!E?r.jsxs(J,{"aria-label":"Resume the workflow from this step",onClick:l,size:"sm",type:"button",children:[r.jsx(Nr,{className:"size-3.5"})," Resume workflow"]}):null,N?r.jsxs(J,{"aria-label":"Debug this workflow step with AI",onClick:()=>h({prompt:P$({workflowName:e.workflow.name,step:g,status:b,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:[r.jsx(Gt,{className:"size-3.5"})," Debug with AI"]}):null,m?null:r.jsxs(J,{"aria-label":"Stop workflow run from step detail",onClick:n,size:"sm",type:"button",variant:"outline",children:[r.jsx(to,{className:"size-3.5"})," Stop after this step"]})]})]}),r.jsxs("div",{className:"py-3 text-[11px] leading-relaxed",children:[r.jsx(XY,{output:v,previousOutput:w,status:b,step:g}),k?r.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-1.5",children:[r.jsxs(J,{onClick:t,size:"sm",type:"button",children:[r.jsx(on,{className:"size-3.5"})," Approve"]}),r.jsxs(J,{onClick:s,size:"sm",type:"button",variant:"outline",children:[r.jsx(IN,{className:"size-3.5"})," Skip"]}),r.jsxs(J,{onClick:n,size:"sm",type:"button",variant:"outline",children:[r.jsx(ts,{className:"size-3.5"})," Stop"]})]}):null,b==="failed"&&e.error?r.jsx("p",{className:"mt-3 text-destructive",children:e.error}):null,E?r.jsx(KY,{error:e.error,onRestart:u,workflowName:e.workflow.name}):null,b==="blocked"&&e.error?r.jsx("p",{className:"mt-3 text-amber-700 dark:text-amber-400",children:e.error}):null]})]}):null})]})]})}function KY({error:e,onRestart:t,workflowName:s}){const{sendToAgent:n,setOpen:o,streaming:l,turns:u}=It(),[h,m]=y.useState(!1),[d,p]=y.useState(null),[g,b]=y.useState(!1),[v,w]=y.useState(null),[k,N]=y.useState(null),E=d===null?"":YY(u,d),A=W$(E),j=h&&!A&&l;function T(z){p(u.length),N(null),w(null),n({prompt:[$$({workflowName:s,error:e}),z?.trim()?z.trim():""].filter(Boolean).join(`
|
|
221
|
+
|
|
222
|
+
`),source:{type:"workflow-branch-recovery",label:s},mode:"send",label:`Recommend PR branch for ${s}`,background:!0}),m(!0)}async function P(){if(A){b(!0),N(null);try{await f8(A),w(A)}catch(z){N(z instanceof Error?z.message:String(z))}finally{b(!1)}}}return r.jsxs("div",{className:"mt-3 rounded-md border border-border bg-muted/35 p-3",children:[r.jsx(wr,{children:"Recover with AI"}),r.jsx("p",{className:"mb-2 text-[11px] text-muted-foreground",children:"Let the agent inspect the change and suggest a feature branch. You approve before anything changes."}),r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[r.jsxs(J,{onClick:()=>T(),size:"sm",type:"button",children:[r.jsx(Gt,{className:"size-3.5"})," Recommend branch with AI"]}),v?r.jsxs(J,{onClick:t,size:"sm",type:"button",variant:"outline",children:[r.jsx(Nr,{className:"size-3.5"})," Run again"]}):null]}),j?r.jsxs("p",{className:"mt-2 flex items-center gap-1 text-[11px] text-muted-foreground",children:[r.jsx(Et,{className:"size-3 animate-spin"})," Choosing a branch name in the background."]}):null,A?r.jsxs("div",{className:"mt-3 rounded-md border border-border bg-background p-2.5",children:[r.jsx(wr,{children:"Recommended branch"}),r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsx("code",{className:"min-w-0 rounded bg-muted px-2 py-1 font-mono text-[12px] text-foreground",children:A}),r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[r.jsxs(J,{disabled:g||v===A,onClick:()=>{P()},size:"sm",type:"button",children:[g?r.jsx(Et,{className:"size-3.5 animate-spin"}):r.jsx(on,{className:"size-3.5"}),"Create this branch"]}),r.jsxs(J,{disabled:g,onClick:()=>T("Recommend a different concise branch name. Keep the same output contract with `BRANCH_NAME: <branch-name>`."),size:"sm",type:"button",variant:"outline",children:[r.jsx(Gt,{className:"size-3.5"})," Ask for another"]})]})]})]}):E&&!j?r.jsxs("div",{className:"mt-3 rounded-md border border-border bg-background p-2.5",children:[r.jsx("p",{className:"text-[11px] text-muted-foreground",children:"The agent did not return a branch name the workflow could read."}),r.jsxs(J,{className:"mt-2",onClick:()=>T("Return only a concise branch suggestion using this exact line: `BRANCH_NAME: <branch-name>`."),size:"sm",type:"button",variant:"outline",children:[r.jsx(Gt,{className:"size-3.5"})," Ask for another"]})]}):null,v?r.jsxs("p",{className:"mt-2 text-[11px] text-emerald-700 dark:text-emerald-400",children:["Branch created: ",r.jsx("code",{className:"font-mono",children:v}),". Run the workflow again from here."]}):null,k?r.jsx("p",{className:"mt-2 text-[11px] text-destructive",children:k}):null,E?r.jsxs(J,{className:"mt-2",onClick:()=>o(!0),size:"sm",type:"button",variant:"outline",children:[r.jsx(TN,{className:"size-3.5"})," Open agent"]}):null]})}function YY(e,t){for(let s=e.length-1;s>=t;s--)if(e[s]?.role==="assistant")return e[s].text.trim();return""}function eN(e){return e==="running"?"Running":e==="waiting"?"Waiting":e==="done"?"Done":e==="blocked"?"Needs you":e==="failed"?"Failed":e==="skipped"?"Skipped":"Queued"}function XY({output:e,previousOutput:t,status:s,step:n}){if(n.kind==="gate"){const l=n.id==="gate-commit"?t?.trim():"";return r.jsxs("div",{children:[r.jsx("p",{className:"text-muted-foreground",children:n.message}),l?r.jsxs("div",{className:"mt-3",children:[r.jsx(wr,{children:"Generated commit message"}),r.jsx("div",{className:"whitespace-pre-wrap break-words rounded-md border border-border bg-muted/50 px-2.5 py-2 font-mono text-[11px] text-foreground",children:l})]}):null]})}if(n.kind==="action")return r.jsx("p",{className:"text-muted-foreground",children:cj(n.op)});const o=s==="done"||s==="failed"||s==="skipped";return e?r.jsxs("div",{children:[r.jsx(wr,{children:"Result"}),r.jsx("div",{className:"whitespace-pre-wrap break-words rounded-md bg-muted/50 px-2.5 py-2 font-mono text-[11px] text-foreground",children:e})]}):r.jsxs("div",{children:[r.jsx(wr,{children:o?"Result":"Task"}),o?r.jsx("p",{className:"italic text-muted-foreground",children:"No text reply — see the dock for what the agent did."}):r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"text-muted-foreground",children:n.prompt}),s==="running"?r.jsxs("p",{className:"mt-1.5 flex items-center gap-1 text-muted-foreground/80",children:[r.jsx(Et,{className:"size-3 animate-spin"})," Working in the dock…"]}):null]})]})}function ZY(e){return e.detected.name==="codex"?e.agents.codex:e.agents["claude-code"]??e}function QY(e){return e?{skills:Lc(e.skills.map(t=>t.name)),mcpServers:Lc(e.mcpServers.map(t=>t.name)),plugins:Lc(e.plugins.map(t=>t.name)),hooks:Lc(e.hooks.map(t=>t.matcher?`${t.event}: ${t.matcher}`:t.event))}:{skills:[],mcpServers:[],plugins:[],hooks:[]}}function JY(e){return{id:Fx("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 eX(e){const t=il(e.id)||e.kind,s=e.title.trim()||Qh(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=uj(e.capabilities);return{...e,id:t,title:s,prompt:e.prompt.trim()||"Complete this workflow step.",capabilities:n}}function cj(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 uj(e){if(!e)return;const t={};for(const s of["skills","mcpServers","plugins","hooks"]){const n=Lc((e[s]??[]).map(o=>o.trim()).filter(Boolean));n.length&&(t[s]=n)}return Object.keys(t).length?t:void 0}function tX(e,t,s){const n=e?.[t]??[],o=n.includes(s)?n.filter(l=>l!==s):[...n,s];return uj({...e??{},[t]:o})}function Fx(e,t){const s=new Set(t.map(l=>l.id));let n=il(e)||"workflow",o=2;for(;s.has(n);)n=`${il(e)||"workflow"}-${o}`,o++;return n}function il(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Lc(e){return Array.from(new Set(e.filter(Boolean)))}function wr({children:e}){return r.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:e})}function dj(e){return new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}).format(new Date(e))}function hj({outcome:e}){const t={running:{label:"Running",className:"border-primary/40 text-primary"},done:{label:"Done",className:"border-emerald-500/40 text-emerald-600 dark:text-emerald-400"},stopped:{label:"Stopped",className:"border-border text-muted-foreground"},failed:{label:"Failed",className:"border-destructive/40 text-destructive"},blocked:{label:"Needs you",className:"border-amber-500/40 text-amber-700 dark:text-amber-400"}},{label:s,className:n}=t[e];return r.jsx("span",{className:de("rounded-full border px-2 py-0.5 text-[10px] font-medium",n),children:s})}function fj({kind:e}){return e==="gate"?r.jsx(BN,{className:"size-4 text-amber-600 dark:text-amber-400"}):e==="agent"?r.jsx(Ci,{className:"size-4 text-primary"}):r.jsx(Nr,{className:"size-4 text-muted-foreground"})}function tN({status:e,kind:t}){return e==="running"?r.jsx(Et,{className:"size-4 shrink-0 animate-spin text-primary"}):e==="waiting"?r.jsx(BN,{className:"size-4 shrink-0 text-primary"}):e==="done"?r.jsx(on,{className:"size-4 shrink-0 text-emerald-600 dark:text-emerald-400"}):e==="blocked"?r.jsx(Mb,{className:"size-4 shrink-0 text-amber-600 dark:text-amber-400"}):e==="failed"?r.jsx(ul,{className:"size-4 shrink-0 text-destructive"}):e==="skipped"?r.jsx(IN,{className:"size-4 shrink-0 text-muted-foreground/60"}):t==="agent"?r.jsx(Ci,{className:"size-4 shrink-0 text-muted-foreground/50"}):r.jsx(h4,{className:"size-4 shrink-0 text-muted-foreground/50"})}function sX(e){return r.jsx(Yn,{className:"size-3 shrink-0 text-muted-foreground/40","aria-hidden":!0})}function Ab({kind:e}){const t=e==="agent"?"AI":e==="gate"?"Gate":"Auto",s=e==="agent"?"border-primary/30 text-primary":e==="gate"?"border-amber-500/40 text-amber-600 dark:text-amber-400":"border-border text-muted-foreground";return r.jsx("span",{className:de("shrink-0 rounded-full border px-1.5 py-px text-[9px] uppercase tracking-wide",s),children:t})}function Qh(e){return e.title}function nX({data:e,onRefresh:t}){const{insertPath:s}=It(),[n,o]=y.useState(!1),[l,u]=y.useState("changes"),[h,m]=y.useState("changes"),[d,p]=y.useState(e.git.status?.files[0]?.path??""),[g,b]=y.useState(""),[v,w]=y.useState([]),[k,N]=y.useState(null),[E,A]=y.useState(""),[j,T]=y.useState(null),[P,z]=y.useState(0),[L,R]=y.useState(null),[D,I]=y.useState(()=>new Set),V=e.git.status?.files??[],X=y.useMemo(()=>{const ke=new Set(V.map($e=>$e.path)),He=[...D].filter($e=>!ke.has($e)).sort().map($e=>({path:$e,index:" ",workingTree:"M"}));return[...V,...He]},[V,D]),$=y.useMemo(()=>X.map(ke=>ke.path),[X]),W=y.useMemo(()=>gx(E),[E]),q=y.useCallback(async(ke,He)=>{if(He.length){o(!0);try{await ke(He),t?.()}finally{o(!1)}}},[t]),B=t?{busy:n,onStage:ke=>{q(Pb,ke)},onUnstage:ke=>{q(ZN,ke)}}:void 0;y.useEffect(()=>{const ke=X[0]?.path??"";p(He=>He&&X.some($e=>$e.path===He)?He:ke)},[X]),y.useEffect(()=>{if(l!=="all"||v.length>0)return;let ke=!0;return N(null),l8().then(He=>{ke&&w(He)}).catch(He=>{ke&&N(He instanceof Error?He.message:String(He))}),()=>{ke=!1}},[l,v.length]),y.useEffect(()=>{if(!d){A("");return}let ke=!0;return T(null),XN(d).then(He=>{ke&&(A(He),z(0),R(null))}).catch(He=>{ke&&T(He instanceof Error?He.message:String(He))}),()=>{ke=!1}},[d]);function Z(ke){z(0),R(null),p(ke)}function U(){const ke=QK({activeHunkIndex:P,filePaths:$,hunkCount:W.hunks,pendingNextFilePath:L,selectedFile:d});ke.kind==="hunk"?(R(null),z(ke.activeHunkIndex)):ke.kind==="confirm-next-file"?R(ke.filePath):ke.kind==="file"?Z(ke.filePath):R(null)}function K(){if(R(null),P>0){z($e=>$e-1);return}const ke=X.findIndex($e=>$e.path===d),He=X[ke-1];He&&Z(He.path)}const Y=X.findIndex(ke=>ke.path===d),F=!!(W.hunks&&P<W.hunks-1||X[Y+1]),ie=!!(P>0||X[Y-1]),Ee=L?`End of file. Click Next again to open ${L}.`:null,ye=ke=>`rounded px-2 py-0.5 text-[11px] font-medium transition-colors ${ke?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,oe=ke=>`flex-1 px-2 py-0.5 text-[11px] font-medium transition-colors ${ke?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,je=y.useMemo(()=>{const ke=new Set(X.map(He=>He.path));for(const He of D)ke.add(He);return ke},[X,D]);if(!e.git.selectedRepository)return r.jsx(iX,{});function Ne(){g&&(u("changes"),m("changes"),Z(g))}function Ge(ke){I(He=>new Set(He).add(ke)),b(ke),u("changes"),m("changes"),Z(ke)}function Me(ke){b(ke),u("all")}function Qe(ke){ke&&s(cu(e.git.cwd,ke))}return r.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-card/85",children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-1 border-b border-border bg-card/95 px-3 py-1",children:[r.jsx("button",{type:"button",className:ye(l==="changes"),onClick:()=>u("changes"),children:"Changes"}),r.jsx("button",{type:"button","aria-label":"Show changed files across all repositories",className:ye(l==="board"),onClick:()=>u("board"),children:"Board"}),r.jsx("button",{type:"button","aria-label":"Open all tracked files",className:ye(l==="all"),onClick:()=>u("all"),children:"All files"}),r.jsx("button",{type:"button",className:ye(l==="graph"),onClick:()=>u("graph"),children:"Tree"}),r.jsx("button",{type:"button",className:ye(l==="largest"),onClick:()=>u("largest"),children:"Largest files"}),r.jsx("button",{type:"button",className:ye(l==="snapshots"),onClick:()=>u("snapshots"),children:"Snapshots"}),r.jsx("button",{type:"button",className:ye(l==="workflows"),onClick:()=>u("workflows"),children:r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Gt,{className:"size-3"}),"Workflows"]})})]}),r.jsx("div",{className:"min-h-0 flex-1",children:l==="workflows"?r.jsx(BY,{}):l==="board"?r.jsx(yY,{currentRepoPath:e.git.cwd}):l==="graph"?r.jsx(hY,{branches:e.git.branches??[]}):l==="largest"?r.jsx(AY,{onOpenFile:Me,root:e.git.cwd}):l==="snapshots"?r.jsx(BI,{}):l==="all"?r.jsxs("div",{className:"grid h-full min-h-0 overflow-hidden border-0 bg-card/85 xl:grid-cols-[320px_minmax(0,1fr)]",children:[r.jsx("aside",{className:"flex min-h-0 flex-col overflow-hidden",children:k?r.jsx(tt,{variant:"destructive",className:"m-3",children:k}):r.jsx(rk,{branch:e.git.status?.branch||void 0,onSelectFile:b,paths:v,root:e.git.cwd,selectedFile:g,status:X})}),r.jsx(ZK,{isModified:je.has(g),onFileSaved:Ge,onSendToAi:()=>Qe(g),onViewDiff:Ne,path:g})]}):r.jsxs("div",{className:"grid h-full min-h-0 overflow-hidden border-0 bg-card/85 xl:grid-cols-[320px_minmax(0,1fr)]",children:[r.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden",children:[r.jsxs("div",{className:"flex shrink-0 gap-0.5 border-b border-border bg-card/95 p-1",children:[r.jsx("button",{"aria-label":"Show changed files as a list",className:oe(h==="changes"),onClick:()=>m("changes"),type:"button",children:"Changes"}),r.jsx("button",{"aria-label":"Show changed files as a tree",className:oe(h==="tree"),onClick:()=>m("tree"),type:"button",children:"Tree"})]}),h==="changes"?r.jsx(M5,{branch:e.git.status?.branch||void 0,error:e.git.error,files:X,selectedFile:d,onSelectFile:Z,root:e.git.cwd,staging:B}):r.jsx(rk,{branch:e.git.status?.branch||void 0,defaultExpandAll:!0,emptyMessage:e.git.error??"No changed files.",onSelectFile:Z,paths:$,root:e.git.cwd,selectedFile:d,status:X,title:"Changes"}),t&&e.git.status?r.jsx(D5,{branch:e.git.status.branch||void 0,files:X,onDone:t}):null]}),r.jsxs("section",{className:"flex min-h-0 min-w-0 flex-col border-l border-border bg-card",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-1.5",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:d||"Diff"}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-muted-foreground",children:[r.jsx("span",{children:"Long rows wrap inside the editor pane."}),W.additions||W.deletions?r.jsxs("span",{className:"flex items-center gap-1 font-mono",children:[r.jsxs("span",{className:"text-emerald-700",children:["+",W.additions]}),r.jsxs("span",{className:"text-red-700",children:["-",W.deletions]})]}):null]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[Ee?r.jsx("span",{className:"max-w-72 truncate rounded border border-amber-200 bg-amber-50 px-2 py-1 text-[11px] text-amber-900",children:Ee}):null,r.jsxs(J,{disabled:!d||!ie,onClick:K,size:"sm",type:"button",variant:"outline",children:[r.jsx(tf,{}),"Previous"]}),r.jsxs(J,{disabled:!d||!F,onClick:U,size:"sm",type:"button",variant:"outline",children:[r.jsx(ef,{}),"Next"]}),r.jsx(J,{"aria-label":"Send selected file to AI input",className:"size-8",disabled:!d,onClick:()=>Qe(d),size:"icon",title:"Send selected file path to AI input",type:"button",variant:"outline",children:r.jsx(Gt,{className:"size-4"})})]})]}),r.jsx("div",{className:"relative min-h-0 min-w-0 flex-1",children:j?r.jsx("div",{className:"p-4",children:r.jsx(tt,{variant:"destructive",children:j})}):d?r.jsx(lu,{activeHunkIndex:P,diff:E||"No unstaged diff for this file."}):r.jsx("div",{className:"p-4",children:r.jsx(tt,{variant:"muted",className:"border-dashed p-12 text-center",children:"Select a changed file to inspect its diff."})})})]})]})})]})}function iX(){return r.jsx("div",{className:"flex h-full items-center justify-center p-8 text-center",children:r.jsxs("div",{className:"max-w-sm",children:[r.jsx(zb,{className:"mx-auto size-8 text-muted-foreground/50"}),r.jsx("p",{className:"mt-3 text-sm font-medium",children:"No Git project registered"}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Add a folder that is a Git worktree to review changes, browse files, and inspect history. Use the project picker in the header to add one."})]})})}const rX={sm:"size-3.5",md:"size-4",lg:"size-6"};function qx({size:e="md",className:t}){return r.jsx(Et,{"aria-hidden":!0,className:de("animate-spin",rX[e],t)})}function Sf({label:e,size:t="md",fill:s=!1,className:n}){return r.jsxs("div",{className:de("flex items-center justify-center gap-2 text-[12px] text-muted-foreground",s&&"h-full",n),role:"status",children:[r.jsx(qx,{size:t}),e?r.jsx("span",{children:e}):null]})}function aX(){const[e,t]=y.useState(!1),[s,n]=y.useState(!1),[o,l]=y.useState(!0),[u,h]=y.useState("checking"),[m,d]=y.useState(null),[p,g]=y.useState(null);function b(){l(!0),h("checking"),d(null),_8().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 y.useEffect(()=>{b()},[]),{configured:e,deviceFlowAvailable:s,loading:o,status:u,error:m,info:p,isConnected:u==="connected",needsLogin:u==="not_configured"||u==="auth_error",refresh:b}}const o0=30;function oX(e="open"){const[t,s]=y.useState([]),[n,o]=y.useState(!0),[l,u]=y.useState(!1),[h,m]=y.useState(!1),[d,p]=y.useState(1),[g,b]=y.useState(null),[v,w]=y.useState(null),[k,N]=y.useState(null),[E,A]=y.useState(""),[j,T]=y.useState(!1),[P,z]=y.useState(null);y.useEffect(()=>{let D=!0;return o(!0),b(null),p(1),zp(e,1).then(I=>{D&&(s(I),m(I.length===o0),I.length>0&&!I.some(V=>V.number===v)&&w(I[0]?.number??null))}).catch(I=>{D&&b(I instanceof Error?I.message:String(I))}).finally(()=>{D&&o(!1)}),()=>{D=!1}},[e]),y.useEffect(()=>{if(!v){N(null);return}let D=!0;return C8(v).then(I=>{D&&N(I)}).catch(()=>{}),()=>{D=!1}},[v]),y.useEffect(()=>{if(!v){A("");return}let D=!0;return T(!0),z(null),E8(v).then(I=>{D&&A(I)}).catch(I=>{D&&z(I instanceof Error?I.message:String(I))}).finally(()=>{D&&T(!1)}),()=>{D=!1}},[v]);function L(){if(l||!h)return;const D=d+1;u(!0),zp(e,D).then(I=>{s(V=>{const X=new Set(V.map($=>$.number));return[...V,...I.filter($=>!X.has($.number))]}),m(I.length===o0),p(D)}).catch(I=>b(I instanceof Error?I.message:String(I))).finally(()=>u(!1))}function R(){let D=!0;return o(!0),b(null),p(1),zp(e,1).then(I=>{D&&(s(I),m(I.length===o0))}).catch(I=>{D&&b(I instanceof Error?I.message:String(I))}).finally(()=>{D&&o(!1)}),()=>{D=!1}}return{prs:t,loading:n,loadingMore:l,hasMore:h,error:g,selectedNumber:v,setSelectedNumber:w,selectedPR:k,diff:E,diffLoading:j,diffError:P,loadMore:L,refresh:R}}const l0=30;function lX(e="open"){const[t,s]=y.useState([]),[n,o]=y.useState(!0),[l,u]=y.useState(!1),[h,m]=y.useState(!1),[d,p]=y.useState(1),[g,b]=y.useState(null),[v,w]=y.useState(null),[k,N]=y.useState(null),[E,A]=y.useState([]),[j,T]=y.useState(!1),[P,z]=y.useState(null),[L,R]=y.useState(!1);y.useEffect(()=>{let X=!0;return o(!0),b(null),p(1),Bp(e,1).then($=>{X&&(s($),m($.length===l0),$.length>0&&!$.some(W=>W.number===v)&&w($[0]?.number??null))}).catch($=>{X&&b($ instanceof Error?$.message:String($))}).finally(()=>{X&&o(!1)}),()=>{X=!1}},[e]),y.useEffect(()=>{if(!v){N(null),A([]);return}let X=!0;return T(!0),Promise.all([M8(v),D8(v)]).then(([$,W])=>{X&&(N($),A(W))}).catch(()=>{}).finally(()=>{X&&T(!1)}),()=>{X=!1}},[v]);async function D(X){if(v){R(!0),z(null);try{const $=await O8(v,X);A(W=>[...W,$])}catch($){z($ instanceof Error?$.message:String($))}finally{R(!1)}}}function I(){if(l||!h)return;const X=d+1;u(!0),Bp(e,X).then($=>{s(W=>{const q=new Set(W.map(B=>B.number));return[...W,...$.filter(B=>!q.has(B.number))]}),m($.length===l0),p(X)}).catch($=>b($ instanceof Error?$.message:String($))).finally(()=>u(!1))}function V(){let X=!0;return o(!0),p(1),Bp(e,1).then($=>{X&&(s($),m($.length===l0))}).catch(()=>{}).finally(()=>{X&&o(!1)}),()=>{X=!1}}return{issues:t,loading:n,loadingMore:l,hasMore:h,error:g,selectedNumber:v,setSelectedNumber:w,selectedIssue:k,comments:E,commentsLoading:j,commentError:P,submitting:L,addComment:D,loadMore:I,refresh:V}}function Vx({className:e}){return r.jsx("svg",{className:de("size-3.5",e),viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:r.jsx("path",{d:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"})})}function mj({deviceFlowAvailable:e,initialMode:t,onSaved:s}){const[n,o]=y.useState(()=>t==="device-pending"&&!e?"pat":t??(e?"choose":"pat"));return n==="device-pending"?r.jsx(cX,{onSuccess:s,onCancel:()=>o("choose")}):n==="pat"?r.jsx(uX,{onSaved:s,onBack:e?()=>o("choose"):void 0}):r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-6 p-8",children:[r.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[r.jsx("div",{className:"flex size-12 items-center justify-center rounded-xl bg-muted",children:r.jsx(Oy,{className:"size-6 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-base font-semibold",children:"Connect GitHub"}),r.jsx("p",{className:"mt-1 max-w-sm text-[13px] text-muted-foreground",children:"Authorize NoMoreIDE to read pull requests, issues, and CI status for your repositories."})]})]}),r.jsxs("div",{className:"flex w-full max-w-xs flex-col gap-2",children:[r.jsxs(J,{className:"w-full",onClick:()=>o("device-pending"),type:"button",children:[r.jsx(Oy,{className:"mr-2 size-4"}),"Authorize with GitHub"]}),r.jsx("button",{className:"text-[12px] text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",onClick:()=>o("pat"),type:"button",children:"Use a Personal Access Token instead"})]})]})}function cX({onSuccess:e,onCancel:t}){const[s,n]=y.useState(null),[o,l]=y.useState(null),[u,h]=y.useState(!0),[m,d]=y.useState(!1),p=y.useRef(null),g=y.useRef(5),b=y.useRef(!1);y.useEffect(()=>{let N=!0;return y8().then(E=>{if(!N)return;n(E),g.current=E.interval,h(!1);const A=E.verification_uri_complete||E.verification_uri;A&&of(A),v(E.device_code,E.interval),setTimeout(()=>{b.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(b.current){l("Authorization expired. Please try again.");return}try{const A=await S8(N);if(A.done){e();return}const j=A.slowDown?E+5:E;g.current=j,v(N,j)}catch{v(N,g.current)}}function k(){s&&navigator.clipboard.writeText(s.user_code).then(()=>{d(!0),setTimeout(()=>d(!1),2e3)})}return u?r.jsx("div",{className:"flex h-full items-center justify-center",children:r.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[r.jsx(Ly,{className:"size-6 animate-spin text-muted-foreground"}),r.jsx("p",{className:"text-[13px] text-muted-foreground",children:"Requesting authorization…"})]})}):o?r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-4 p-8",children:[r.jsx(tt,{variant:"destructive",children:o}),r.jsx(J,{onClick:t,variant:"outline",children:"Go back"})]}):r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-6 p-8",children:[r.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[r.jsx("div",{className:"flex size-12 items-center justify-center rounded-xl bg-emerald-100 dark:bg-emerald-500/15",children:r.jsx(nf,{className:"size-6 text-emerald-600 dark:text-emerald-400"})}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-base font-semibold",children:"Authorize on GitHub"}),r.jsxs("p",{className:"mt-1 max-w-sm text-[13px] text-muted-foreground",children:["A GitHub page just opened in a new tab. Enter the code below and click"," ",r.jsx("strong",{children:"Authorize"}),"."]})]})]}),r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx("div",{className:"flex cursor-pointer select-all items-center gap-3 rounded-xl border-2 border-border bg-muted px-6 py-4 font-mono text-2xl font-bold tracking-[0.3em] transition-colors hover:border-ring",onClick:k,title:"Click to copy",children:s?.user_code}),r.jsx("button",{className:"text-[11px] text-muted-foreground transition-colors hover:text-foreground",onClick:k,type:"button",children:m?"Copied!":"Click code to copy"})]}),r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-muted-foreground",children:[r.jsx(Ly,{className:"size-3.5 animate-spin"}),"Waiting for authorization…"]}),r.jsx("a",{className:"text-[12px] text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",href:s?.verification_uri_complete||s?.verification_uri,rel:"noopener noreferrer",target:"_blank",children:"Open GitHub again"}),r.jsx("button",{className:"text-[12px] text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",onClick:t,type:"button",children:"Cancel"})]})]})}function uX({onSaved:e,onBack:t}){const[s,n]=y.useState(""),[o,l]=y.useState(!1),[u,h]=y.useState(null);async function m(d){d.preventDefault();const p=s.trim();if(p){l(!0),h(null);try{await w8("github.com",p),e()}catch(g){h(g instanceof Error?g.message:String(g))}finally{l(!1)}}}return r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-6 p-8",children:[r.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[r.jsx("div",{className:"flex size-12 items-center justify-center rounded-xl bg-muted",children:r.jsx(CN,{className:"size-6 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-base font-semibold",children:"Personal Access Token"}),r.jsxs("p",{className:"mt-1 max-w-sm text-[13px] text-muted-foreground",children:["Create a token at"," ",r.jsx("a",{className:"underline underline-offset-2 hover:text-foreground",href:"https://github.com/settings/tokens/new?scopes=repo,workflow",rel:"noopener noreferrer",target:"_blank",children:"github.com/settings/tokens"})," ","with ",r.jsx("code",{className:"rounded bg-muted px-1 py-px text-[11px]",children:"repo"})," and"," ",r.jsx("code",{className:"rounded bg-muted px-1 py-px text-[11px]",children:"workflow"})," scopes."]})]})]}),r.jsxs("form",{className:"flex w-full max-w-sm flex-col gap-3",onSubmit:d=>{m(d)},children:[r.jsx("input",{autoComplete:"off",className:"w-full rounded-md border border-border bg-background px-3 py-2 font-mono text-[13px] placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring",onChange:d=>n(d.target.value),placeholder:"ghp_...",spellCheck:!1,type:"password",value:s}),u?r.jsx(tt,{variant:"destructive",children:u}):null,r.jsx(J,{disabled:!s.trim()||o,type:"submit",children:o?"Saving…":"Save token"}),t?r.jsx("button",{className:"text-[12px] text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",onClick:t,type:"button",children:"← Back"}):null]})]})}function Gx({hasMore:e,loading:t,onLoadMore:s}){return e?r.jsx("div",{className:"p-2",children:r.jsxs("button",{className:"flex w-full items-center justify-center gap-1.5 rounded-md border border-border py-1.5 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground disabled:opacity-60",disabled:t,onClick:s,type:"button",children:[t?r.jsx(Et,{className:"size-3 animate-spin"}):null,t?"Loading…":"Load more"]})}):null}function dX({prs:e,loading:t,loadingMore:s,hasMore:n,error:o,selectedNumber:l,onSelect:u,onLoadMore:h}){return t&&e.length===0?r.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading pull requests…"}):o?r.jsx("div",{className:"p-4 text-[12px] text-red-500",children:o}):e.length===0?r.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"No pull requests found."}):r.jsxs(r.Fragment,{children:[r.jsx("ul",{className:"divide-y divide-border",children:e.map(m=>r.jsx("li",{children:r.jsxs("button",{className:`flex w-full items-start gap-3 px-3 py-2.5 text-left transition-colors hover:bg-muted/60 ${l===m.number?"bg-muted":""}`,onClick:()=>u(m.number),type:"button",children:[r.jsx("span",{className:"mt-0.5 shrink-0",children:r.jsx(hX,{pr:m})}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-[13px] font-medium",children:m.title}),r.jsxs("span",{className:"block text-[11px] text-muted-foreground",children:["#",m.number," · ",m.base.ref," ← ",m.head.ref," · ",m.user.login]})]}),m.draft?r.jsx("span",{className:"shrink-0 rounded border border-border px-1.5 py-px text-[10px] text-muted-foreground",children:"Draft"}):null]})},m.number))}),r.jsx(Gx,{hasMore:n,loading:s,onLoadMore:h})]})}function hX({pr:e}){return e.state==="merged"?r.jsx(kh,{className:"size-4 text-purple-500"}):e.state==="closed"?r.jsx(iR,{className:"size-4 text-red-500"}):r.jsx(NN,{className:"size-4 text-emerald-500"})}function pj({body:e,title:t="Description"}){const[s,n]=y.useState("rendered"),o=l=>de("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 r.jsxs("section",{className:"overflow-hidden rounded-md border border-border bg-muted/25",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-1.5",children:[r.jsx("span",{className:"text-[11px] font-medium text-muted-foreground",children:t}),r.jsxs("div",{className:"flex items-center gap-0.5 rounded-md bg-background/60 p-0.5",children:[r.jsx("button",{className:o(s==="rendered"),onClick:()=>n("rendered"),type:"button",children:"Rendered"}),r.jsx("button",{className:o(s==="raw"),onClick:()=>n("raw"),type:"button",children:"Raw"})]})]}),s==="rendered"?r.jsx(L5,{content:e}):r.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap px-3 py-3 font-mono text-[12px]",children:e})]})}function fX({title:e,message:t,confirmLabel:s="Confirm",cancelLabel:n="Cancel",tone:o="default",icon:l,loading:u=!1,onConfirm:h,onCancel:m}){y.useEffect(()=>{function p(g){g.key==="Escape"&&!u&&m()}return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[m,u]);const d=o==="danger"?"destructive":o==="success"?"success":"default";return va.createPortal(r.jsx("div",{className:"fixed inset-0 z-[1000] grid place-items-center bg-black/35 px-4",onMouseDown:()=>!u&&m(),children:r.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:[r.jsxs("div",{className:"flex items-start gap-3 px-4 py-4",children:[l?r.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,r.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[r.jsx("h2",{className:"text-sm font-semibold",children:e}),r.jsx("div",{className:"text-[13px] text-muted-foreground",children:t})]})]}),r.jsxs("div",{className:"flex justify-end gap-2 border-t border-border bg-muted/30 px-4 py-3",children:[r.jsx(J,{disabled:u,onClick:m,size:"sm",type:"button",variant:"outline",children:n}),r.jsx(J,{disabled:u,onClick:h,size:"sm",type:"button",variant:d,children:s})]})]})}),document.body)}function mX({pr:e,diff:t,diffLoading:s,diffError:n,onMerged:o}){const[l,u]=y.useState("cockpit"),[h,m]=y.useState(null),[d,p]=y.useState(!1),[g,b]=y.useState(null),[v,w]=y.useState(!1),[k,N]=y.useState(null),[E,A]=y.useState(!1),[j,T]=y.useState(null),[P,z]=y.useState(!1),{sendToAgent:L}=It(),R=y.useMemo(()=>MI(t),[t]);y.useEffect(()=>{T(q=>q&&R.some(B=>B.path===q)?q:R[0]?.path??null)},[R]);const D=R.find(q=>q.path===j)??R[0]??null;function I(q){T(q),u("diff")}function V(q,B){e&&(z(!1),L({prompt:B?NP(e,B,q):kP(e,q),source:{type:"github-pr",label:`PR #${e.number}${B?` · ${Jh(B)}`:""}`},label:`PR #${e.number}${B?` (${Jh(B)})`:""}: ${q}`}))}if(y.useEffect(()=>{if(z(!1),!e){m(null);return}let q=!0;return p(!0),b(null),j8(e.number).then(B=>{q&&m(B)}).catch(B=>{q&&b(B instanceof Error?B.message:String(B))}).finally(()=>{q&&p(!1)}),()=>{q=!1}},[e]),!e)return r.jsx("div",{className:"flex h-full items-center justify-center text-[12px] text-muted-foreground",children:"Select a pull request"});const X=e.state==="open"&&!e.draft;async function $(){if(!(!e||v)){w(!0),N(null);try{await R8(e.number,{method:"squash"}),A(!1),o?.()}catch(q){N(q instanceof Error?q.message:String(q)),A(!1)}finally{w(!1)}}}const W=q=>`rounded px-2 py-0.5 text-[11px] font-medium transition-colors ${q?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`;return r.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[r.jsxs("div",{className:"group flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] font-semibold",children:e.title}),r.jsx(Ki,{className:de("shrink-0",P&&"opacity-100"),label:`Ask AI about PR #${e.number}`,onAsk:()=>z(q=>!q)}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[r.jsx("button",{className:W(l==="cockpit"),onClick:()=>u("cockpit"),type:"button",children:"Review"}),r.jsx("button",{className:W(l==="diff"),onClick:()=>u("diff"),type:"button",children:"Diff"})]}),X?r.jsxs(J,{className:"shrink-0",disabled:v,onClick:()=>A(!0),size:"sm",title:"Squash & merge this pull request",type:"button",variant:"success",children:[r.jsx(kh,{}),"Squash & merge"]}):null,r.jsx("a",{"aria-label":"Open on GitHub",className:"shrink-0 rounded p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",href:e.html_url,rel:"noopener noreferrer",target:"_blank",title:"Open on GitHub",children:r.jsx(kr,{className:"size-3.5"})})]}),k?r.jsx("div",{className:"shrink-0 border-b border-border bg-red-500/10 px-3 py-1.5 text-[11px] text-red-500",children:k}):null,P?r.jsx("div",{className:"shrink-0 border-b border-border px-3 py-1.5",children:r.jsx(jr,{placeholder:"What should the agent do with this PR? (review, summarize, find regressions…)",onSubmit:q=>V(q),onCancel:()=>z(!1)})}):null,l==="cockpit"?r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:r.jsx(pX,{cockpit:h,error:g,loading:d,onOpenFile:I,pr:e})}):s?r.jsx(Sf,{className:"flex-1",label:"Loading diff…"}):n?r.jsx("div",{className:"p-4 text-[12px] text-red-500",children:n}):R.length?r.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1",children:[r.jsx(gX,{files:R,onAsk:(q,B)=>V(B,q),onSelect:T,selected:D?.path??null}),r.jsx("div",{className:"relative min-h-0 min-w-0 flex-1",children:D?r.jsx(lu,{diff:D.diff}):null})]}):r.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"No diff available."}),E?r.jsx(fX,{confirmLabel:v?r.jsxs(r.Fragment,{children:[r.jsx(qx,{size:"sm"})," Merging…"]}):"Squash & merge",icon:r.jsx(kh,{}),loading:v,message:r.jsxs(r.Fragment,{children:["Squash & merge PR ",r.jsxs("span",{className:"font-mono",children:["#",e.number]})," ",r.jsx("span",{className:"font-medium text-foreground",children:e.title})," into"," ",r.jsx("span",{className:"font-mono",children:e.base.ref}),"?"]}),onCancel:()=>A(!1),onConfirm:()=>{$()},title:"Squash & merge",tone:"success"}):null]})}function pX({pr:e,cockpit:t,loading:s,error:n,onOpenFile:o}){const[l,u]=y.useState(!1),h=t?.pr??e,m=t?.files??[],d=t?.reviews??[],p=t?.comments??[],g=t?.checks??null,b=g?.runs.filter(v=>v.conclusion==="failure"||v.conclusion==="timed_out"||v.conclusion==="cancelled")??[];return r.jsxs("div",{className:"space-y-3 p-4",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 text-[12px]",children:[r.jsx(vX,{pr:h}),r.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md border border-border bg-muted/40 px-2 py-1 font-mono text-[11px]",children:[r.jsx(xn,{className:"size-3 shrink-0 text-muted-foreground"}),h.base.ref,r.jsx(eu,{className:"size-3 shrink-0 text-muted-foreground"}),h.head.ref]}),r.jsxs("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[r.jsx(BM,{className:"size-3 shrink-0"}),h.user.login]}),r.jsxs("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[r.jsx(e4,{className:"size-3 shrink-0"}),new Date(h.created_at).toLocaleDateString()]})]}),n?r.jsx("div",{className:"rounded-md border border-red-500/30 bg-red-500/10 px-3 py-2 text-[12px] text-red-500",children:n}):null,s?r.jsx(Sf,{className:"justify-start",label:"Loading review cockpit…"}):null,r.jsxs("div",{className:"grid gap-2 md:grid-cols-4",children:[r.jsx(ih,{title:"Merge readiness",value:gj(h,g),tone:bX(h,g)}),r.jsx(ih,{title:"Review state",value:bj(d),tone:xX(d)}),r.jsx(ih,{title:"Checks",value:g?`${g.state} (${g.totalCount})`:"unknown",tone:g?.state==="success"?"success":g?.state==="failure"||g?.state==="error"?"danger":"muted"}),r.jsx(ih,{title:"Changed files",value:String(m.length),tone:"muted"})]}),b.length>0?r.jsxs("section",{className:"rounded-md border border-red-500/25 bg-red-500/10 px-3 py-2",children:[r.jsx("div",{className:"mb-1 text-[11px] font-medium text-red-500",children:"Failing checks"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:b.slice(0,4).map(v=>r.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:[r.jsx(Db,{className:"size-3"}),"Open failing check: ",v.name]},v.id))})]}):null,r.jsxs("section",{className:"rounded-md border border-border bg-muted/25 p-3",children:[r.jsxs("button",{className:"flex w-full items-center gap-2 text-[12px] font-medium",onClick:()=>u(v=>!v),type:"button",children:[l?r.jsx(vn,{className:"size-3.5 text-muted-foreground"}):r.jsx(Yn,{className:"size-3.5 text-muted-foreground"}),r.jsx(Lb,{className:"size-3.5 text-muted-foreground"}),"Changed files",m.length?r.jsxs("span",{className:"font-mono text-[11px] text-muted-foreground",children:["(",m.length,")"]}):null]}),l?m.length?r.jsx("ul",{className:"mt-2 divide-y divide-border",children:m.slice(0,12).map(v=>r.jsx("li",{children:r.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:[r.jsx("span",{className:"w-16 shrink-0 font-mono text-[10px] uppercase text-muted-foreground",children:v.status}),r.jsx("span",{className:"min-w-0 flex-1 truncate font-mono",children:v.path}),r.jsxs("span",{className:"shrink-0 font-mono text-[11px] text-emerald-600",children:["+",v.additions]}),r.jsxs("span",{className:"shrink-0 font-mono text-[11px] text-red-500",children:["-",v.deletions]})]})},v.path))}):r.jsx("p",{className:"mt-2 text-[12px] text-muted-foreground",children:"No changed file metadata available."}):null]}),r.jsxs("section",{className:"rounded-md border border-border bg-muted/25 p-3",children:[r.jsxs("div",{className:"mb-2 flex items-center gap-2 text-[12px] font-medium",children:[r.jsx(zR,{className:"size-3.5 text-muted-foreground"}),"Review state"]}),d.length||p.length?r.jsxs("div",{className:"space-y-2",children:[d.slice(-4).map(v=>r.jsx(sN,{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=>r.jsx(sN,{href:v.html_url,meta:`${v.user.login} - comment`,text:v.body},`comment:${v.id}`))]}):r.jsx("p",{className:"text-[12px] text-muted-foreground",children:"No reviews or PR comments yet."})]}),h.body?r.jsx(pj,{body:h.body}):r.jsx("p",{className:"text-[12px] italic text-muted-foreground",children:"No description provided."})]})}function gX({files:e,selected:t,onSelect:s,onAsk:n}){const[o,l]=y.useState(null);return r.jsx("div",{className:"w-44 shrink-0 overflow-y-auto border-r border-border bg-card/60",children:r.jsx("ul",{className:"py-1",children:e.map(u=>r.jsxs("li",{className:"group flex flex-col",children:[r.jsxs("div",{className:de("flex items-center transition-colors",u.path===t?"bg-muted":"hover:bg-muted/60"),children:[r.jsxs("button",{className:de("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:[r.jsx("span",{className:"min-w-0 flex-1 truncate font-mono",children:Jh(u.path)}),r.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-emerald-600",children:["+",u.additions]}),r.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-red-500",children:["-",u.deletions]})]}),r.jsx(Ki,{className:de("mr-1 shrink-0",o===u.path&&"opacity-100"),label:`Ask AI about ${Jh(u.path)}`,onAsk:()=>l(h=>h===u.path?null:u.path)})]}),o===u.path?r.jsx("div",{className:"px-2 pb-1.5 pt-0.5",children:r.jsx(jr,{placeholder:"What about this file? (review, explain, find bugs…)",onSubmit:h=>{l(null),n(u.path,h)},onCancel:()=>l(null)})}):null]},u.path))})})}function Jh(e){const t=e.split("/");return t[t.length-1]||e}function ih({title:e,value:t,tone:s}){const n=s==="success"?"bg-emerald-500":s==="warning"?"bg-amber-500":s==="danger"?"bg-red-500":"bg-muted-foreground";return r.jsxs("div",{className:"rounded-md border border-border bg-card px-3 py-2",children:[r.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:e}),r.jsxs("div",{className:"mt-1 flex items-center gap-1.5 text-[12px] font-medium",children:[r.jsx("span",{className:`size-1.5 rounded-full ${n}`}),t]})]})}function sN({meta:e,text:t,href:s}){return r.jsxs("a",{className:"block rounded border border-border bg-card px-2.5 py-2 text-[12px] transition-colors hover:bg-muted/60",href:s,rel:"noopener noreferrer",target:"_blank",children:[r.jsxs("span",{className:"mb-1 flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[r.jsx(kr,{className:"size-3"}),e]}),r.jsx("span",{className:"line-clamp-2 whitespace-pre-wrap",children:t})]})}function gj(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 bX(e,t){const s=gj(e,t);return s==="ready"?"success":s==="blocked"||s==="checks failing"?"danger":s==="draft"||s==="checks pending"?"warning":"muted"}function bj(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 xX(e){const t=bj(e);return t==="approved"?"success":t==="changes requested"?"danger":t==="commented"?"warning":"muted"}function vX({pr:e}){const{label:t,dot:s}=e.state==="merged"?{label:"Merged",dot:"bg-violet-500"}:e.state==="closed"?{label:"Closed",dot:"bg-red-500"}:e.draft?{label:"Draft",dot:"bg-muted-foreground"}:{label:"Open",dot:"bg-emerald-500"};return r.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground",children:[r.jsx("span",{className:`size-1.5 rounded-full ${s}`}),t==="Merged"?r.jsx(kh,{className:"size-3"}):t==="Open"?r.jsx(nf,{className:"size-3"}):r.jsx(qc,{className:"size-3"}),t]})}function xj({label:e}){return r.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5 text-[10px] font-medium text-muted-foreground",title:e.name,children:[r.jsx("span",{className:"size-2 shrink-0 rounded-sm",style:{backgroundColor:`#${e.color}`}}),r.jsx("span",{className:"truncate",children:e.name})]})}function _X({issues:e,loading:t,loadingMore:s,hasMore:n,error:o,selectedNumber:l,onSelect:u,onLoadMore:h}){return t&&e.length===0?r.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading issues…"}):o?r.jsx("div",{className:"p-4 text-[12px] text-red-500",children:o}):e.length===0?r.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"No issues found."}):r.jsxs(r.Fragment,{children:[r.jsx("ul",{className:"divide-y divide-border",children:e.map(m=>r.jsx("li",{children:r.jsxs("button",{className:`flex w-full items-start gap-3 px-3 py-2.5 text-left transition-colors hover:bg-muted/60 ${l===m.number?"bg-muted":""}`,onClick:()=>u(m.number),type:"button",children:[r.jsx(m4,{className:`mt-0.5 size-4 shrink-0 ${m.state==="open"?"text-emerald-500":"text-red-500"}`}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-[13px] font-medium",children:m.title}),r.jsxs("span",{className:"block text-[11px] text-muted-foreground",children:["#",m.number," · ",m.user.login," · ",m.comments," comment",m.comments!==1?"s":""]})]}),m.labels.length>0?r.jsx("span",{className:"flex max-w-40 shrink-0 flex-wrap justify-end gap-x-2 gap-y-0.5",children:m.labels.slice(0,3).map(d=>r.jsx(xj,{label:d},d.name))}):null]})},m.number))}),r.jsx(Gx,{hasMore:n,loading:s,onLoadMore:h})]})}const rh=6,yX=6,SX=8;function wX(e,t,s,n){const o=Math.max(0,Math.min(yX,e/2,t/2)),l=Math.max(0,Math.min(SX,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 kX({value:e,onChange:t,placeholder:s,rows:n=3,action:o}){const l=y.useRef(null),u=y.useRef(null),[h,m]=y.useState(null),[d,p]=y.useState({w:0,h:0});y.useLayoutEffect(()=>{const b=l.current,v=u.current;if(!b||!v)return;const w=()=>{m({w:b.clientWidth,h:b.clientHeight}),p({w:v.offsetWidth+rh*2,h:v.offsetHeight+rh*2})};w();const k=new ResizeObserver(w);return k.observe(b),k.observe(v),()=>k.disconnect()},[]);const g=h&&d.w&&d.h?wX(h.w,h.h,d.w,d.h):null;return r.jsxs("div",{className:"relative",ref:l,children:[r.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:b=>t(b.target.value),placeholder:s,rows:n,style:{clipPath:g?`path('${g}')`:void 0,paddingBottom:d.h||44},value:e}),h&&g?r.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:[r.jsx("title",{children:"Comment field border"}),r.jsx("path",{d:g,stroke:"currentColor",strokeWidth:1})]}):null,r.jsx("div",{className:"absolute",ref:u,style:{bottom:rh,right:rh},children:o})]})}function NX({issue:e,comments:t,commentsLoading:s,commentError:n,submitting:o,onAddComment:l}){const[u,h]=y.useState(""),[m,d]=y.useState(!1),{sendToAgent:p}=It();y.useEffect(()=>{d(!1)},[e?.number]);function g(v){e&&(d(!1),p({prompt:CP(e,v),source:{type:"github-issue",label:`Issue #${e.number}`},label:`Issue #${e.number}: ${v}`}))}if(!e)return r.jsx("div",{className:"flex h-full items-center justify-center text-[12px] text-muted-foreground",children:"Select an issue"});async function b(v){v.preventDefault();const w=u.trim();w&&(await l(w),h(""))}return r.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[r.jsxs("div",{className:"group flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] font-semibold",children:e.title}),r.jsx(Ki,{className:de("shrink-0",m&&"opacity-100"),label:`Ask AI about issue #${e.number}`,onAsk:()=>d(v=>!v)}),r.jsx("a",{"aria-label":"Open on GitHub",className:"shrink-0 rounded p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",href:e.html_url,rel:"noopener noreferrer",target:"_blank",children:r.jsx(kr,{className:"size-3.5"})})]}),m?r.jsx("div",{className:"shrink-0 border-b border-border px-3 py-1.5",children:r.jsx(jr,{placeholder:"What should the agent do with this issue? (summarize, draft a fix plan, reproduce…)",onSubmit:g,onCancel:()=>d(!1)})}):null,r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:r.jsxs("div",{className:"space-y-3 p-4",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1.5 text-[12px]",children:[r.jsxs("span",{className:"text-[11px]",children:[r.jsx("span",{className:"text-muted-foreground",children:"Author: "}),r.jsx("span",{className:"font-medium",children:e.user.login})]}),r.jsxs("span",{className:"text-[11px]",children:[r.jsx("span",{className:"text-muted-foreground",children:"Opened: "}),r.jsx("span",{className:"font-medium",children:new Date(e.created_at).toLocaleDateString()})]}),e.labels.map(v=>r.jsx(xj,{label:v},v.name))]}),e.body?r.jsx(pj,{body:e.body}):r.jsx("p",{className:"text-[12px] text-muted-foreground italic",children:"No description provided."}),s?r.jsx(Sf,{className:"justify-start",label:"Loading comments…"}):r.jsx("div",{className:"space-y-2",children:t.map(v=>r.jsxs("div",{className:"rounded-md border border-border bg-muted/20 p-3",children:[r.jsxs("div",{className:"mb-1 flex items-baseline gap-2",children:[r.jsx("span",{className:"text-[11px] font-semibold",children:v.user.login}),r.jsx("span",{className:"text-[10px] text-muted-foreground",children:new Date(v.created_at).toLocaleDateString()})]}),r.jsx(R3,{content:v.body})]},v.id))})]})}),r.jsx("div",{className:"shrink-0 border-t border-border p-3",children:r.jsxs("form",{className:"flex flex-col gap-2",onSubmit:v=>{b(v)},children:[r.jsx(kX,{action:r.jsx(J,{disabled:!u.trim()||o,size:"sm",type:"submit",children:o?r.jsxs(r.Fragment,{children:[r.jsx(qx,{size:"sm"})," Posting…"]}):"Comment"}),onChange:h,placeholder:"Add a comment…",value:u}),n?r.jsx(tt,{variant:"destructive",children:n}):null]})})]})}const nN=30,CX=4e3;function EX(e){return e.status==="in_progress"||e.status==="queued"}function iN(e){return e.map(t=>`${t.id}:${t.status}:${t.conclusion}`).join("|")}function rN(e){return e.map(t=>`${t.id}:${t.status}:${t.conclusion}:`+t.steps.map(s=>`${s.number}:${s.status}:${s.conclusion}`).join(",")).join("|")}function jX(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 TX(e){const[t,s]=y.useState([]),[n,o]=y.useState(null),[l,u]=y.useState([]),[h,m]=y.useState(!0),[d,p]=y.useState(!1),[g,b]=y.useState(!1),[v,w]=y.useState(1),[k,N]=y.useState(!1),[E,A]=y.useState(null),[j,T]=y.useState(null);function P(){let D=!0;return m(!0),A(null),w(1),ah(e,1).then(I=>{D&&(s(I),b(I.length===nN))}).catch(I=>{D&&A(I instanceof Error?I.message:String(I))}).finally(()=>{D&&m(!1)}),()=>{D=!1}}function z(){if(d||!g)return;const D=v+1;p(!0),ah(e,D).then(I=>{s(V=>{const X=new Set(V.map($=>$.id));return[...V,...I.filter($=>!X.has($.id))]}),b(I.length===nN),w(D)}).catch(I=>A(I instanceof Error?I.message:String(I))).finally(()=>p(!1))}const L=y.useCallback(()=>{ah(e,1).then(D=>s(I=>{const V=jX(I,D);return iN(I)===iN(V)?I:V})).catch(()=>{}),n&&Wy(n).then(D=>u(I=>rN(I)===rN(D)?I:D)).catch(()=>{})},[e,n]);y.useEffect(P,[e]),y.useEffect(()=>{o(D=>D&&t.some(I=>I.id===D)?D:t[0]?.id??null)},[t]),y.useEffect(()=>{if(!n){u([]);return}let D=!0;return N(!0),T(null),Wy(n).then(I=>{D&&u(I)}).catch(I=>{D&&T(I instanceof Error?I.message:String(I))}).finally(()=>{D&&N(!1)}),()=>{D=!1}},[n]);const R=t.some(EX);return y.useEffect(()=>{if(!R)return;const D=window.setInterval(()=>{document.visibilityState==="visible"&&L()},CX);return()=>window.clearInterval(D)},[R,L]),{runs:t,selectedRunId:n,jobs:l,loading:h,loadingMore:d,hasMore:g,jobsLoading:k,error:E,jobsError:j,loadMore:z,refresh:P,syncLatest:L,setSelectedRunId:o}}function vj(e){return e.conclusion==="failure"||e.conclusion==="timed_out"||e.conclusion==="cancelled"}function AX({branch:e,onClearBranch:t}){const{runs:s,selectedRunId:n,jobs:o,loading:l,loadingMore:u,hasMore:h,jobsLoading:m,error:d,jobsError:p,loadMore:g,refresh:b,syncLatest:v,setSelectedRunId:w}=TX(e);du(v);const k=s.find(T=>T.id===n)??null,{sendToAgent:N}=It(),[E,A]=y.useState(null);function j(T,P){A(null),N({prompt:EP(T,P),source:{type:"github-run",label:`Run #${T.run_number}`},label:`Run #${T.run_number}: ${P??"fix failing run"}`})}return r.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-1.5",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"text-[13px] font-semibold",children:"Workflow Runs"}),e?r.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 text-[11px] text-muted-foreground",children:[r.jsx("span",{className:"shrink-0",children:"Filtered to"}),r.jsx("span",{className:"min-w-0 truncate font-mono",children:e}),t?r.jsx("button",{"aria-label":"Clear branch filter",className:"shrink-0 rounded p-0.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:t,title:"Clear branch filter",type:"button",children:r.jsx(ts,{className:"size-3"})}):null]}):null]}),r.jsxs(J,{disabled:l,onClick:()=>{b()},size:"sm",type:"button",variant:"outline",children:[r.jsx(Cr,{className:`mr-1 size-3.5 ${l?"animate-spin":""}`}),"Refresh"]})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:d?r.jsx("div",{className:"p-4 text-[12px] text-red-500",children:d}):l&&s.length===0?r.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading workflow runs…"}):s.length===0?r.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"No workflow runs found."}):r.jsxs("div",{className:"grid h-full min-h-0 grid-cols-[minmax(280px,380px)_minmax(0,1fr)] divide-x divide-border",children:[r.jsxs("div",{className:"min-h-0 overflow-auto",children:[r.jsx("ul",{className:"divide-y divide-border",children:s.map(T=>r.jsxs("li",{className:"group flex flex-col",children:[r.jsxs("div",{className:`flex items-center transition-colors hover:bg-muted/60 ${T.id===n?"bg-muted/70":""}`,children:[r.jsxs("button",{className:"flex min-w-0 flex-1 items-center gap-3 px-3 py-2.5 text-left",onClick:()=>w(T.id),type:"button",children:[r.jsx(RX,{run:T}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-[13px] font-medium",children:T.name}),r.jsxs("span",{className:"block text-[11px] text-muted-foreground",children:["#",T.run_number," · ",T.head_branch," · ",T.event," ·"," ",r.jsx("span",{title:new Date(T.created_at).toLocaleString(),children:EL(T.created_at)})]})]}),r.jsx(MX,{run:T})]}),vj(T)?r.jsx(Ki,{className:`mr-2 shrink-0 ${E===T.id?"opacity-100":""}`,label:`Fix failing run #${T.run_number} with AI`,onAsk:()=>A(P=>P===T.id?null:T.id)}):null]}),E===T.id?r.jsx("div",{className:"px-3 pb-2 pt-0.5",children:r.jsx(jr,{onCancel:()=>A(null),onSubmit:P=>j(T,P),placeholder:"What should the agent do? (fix it, explain the failure, find the broken step…)"})}):null]},T.id))}),r.jsx(Gx,{hasMore:h,loading:u,onLoadMore:g})]}),r.jsx(DX,{error:p,jobs:o,loading:m,onFix:T=>j(T),run:k})]})})]})}function RX({run:e}){return e.status==="in_progress"||e.status==="queued"?r.jsx(qc,{className:"size-4 shrink-0 animate-pulse text-amber-400"}):e.conclusion==="success"?r.jsx(nf,{className:"size-4 shrink-0 text-emerald-500"}):e.conclusion==="failure"||e.conclusion==="timed_out"?r.jsx(Db,{className:"size-4 shrink-0 text-red-500"}):r.jsx(qc,{className:"size-4 shrink-0 text-zinc-400"})}function MX({run:e}){const t=e.status==="completed"?e.conclusion??"completed":e.status,s=t==="success"?"bg-emerald-500":t==="failure"||t==="timed_out"?"bg-red-500":t==="in_progress"||t==="queued"?"bg-amber-500":"bg-muted-foreground";return r.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1.5 text-[10px] font-medium text-muted-foreground",children:[r.jsx("span",{className:`size-1.5 rounded-full ${s}`}),t]})}function DX({run:e,jobs:t,loading:s,error:n,onFix:o}){return e?r.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-[13px] font-semibold",children:e.name}),r.jsxs("span",{className:"block text-[11px] text-muted-foreground",children:["Run #",e.run_number," · ",e.head_branch," · ",e.head_sha.slice(0,7)]})]}),vj(e)?r.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:[r.jsx(Gt,{className:"size-3.5"}),"Fix with AI"]}):null,r.jsx("a",{"aria-label":"Open run on GitHub",className:"shrink-0 rounded p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",href:e.html_url,rel:"noopener noreferrer",target:"_blank",title:"Open run on GitHub",children:r.jsx(kr,{className:"size-3.5"})})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:n?r.jsx("div",{className:"p-4 text-[12px] text-red-500",children:n}):s?r.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading jobs…"}):t.length===0?r.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"No jobs found for this run."}):r.jsx("ul",{className:"divide-y divide-border",children:t.map(l=>r.jsxs("li",{className:"px-3 py-3",children:[r.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[r.jsx(aN,{item:l}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] font-medium",children:l.name}),r.jsx("span",{className:"shrink-0 font-mono text-[11px] text-muted-foreground",children:oN(l.started_at,l.completed_at)}),r.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:r.jsx(kr,{className:"size-3.5"})})]}),l.steps.length?r.jsx("ol",{className:"space-y-1.5 pl-6",children:l.steps.map(u=>r.jsxs("li",{className:"flex items-center gap-2 text-[12px]",children:[r.jsx(aN,{item:u}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:u.name}),r.jsx("span",{className:"shrink-0 font-mono text-[11px] text-muted-foreground",children:oN(u.started_at,u.completed_at)})]},`${l.id}:${u.number}`))}):r.jsx("p",{className:"pl-6 text-[12px] text-muted-foreground",children:"No step details available."})]},l.id))})})]}):r.jsx("div",{className:"flex h-full items-center justify-center text-[12px] text-muted-foreground",children:"Select a workflow run"})}function aN({item:e}){return e.status==="in_progress"||e.status==="queued"?r.jsx(qc,{className:"size-3.5 shrink-0 animate-pulse text-amber-400"}):e.conclusion==="success"||e.conclusion==="skipped"?r.jsx(nf,{className:"size-3.5 shrink-0 text-emerald-500"}):e.conclusion==="failure"||e.conclusion==="timed_out"||e.conclusion==="cancelled"?r.jsx(Db,{className:"size-3.5 shrink-0 text-red-500"}):r.jsx(qc,{className:"size-3.5 shrink-0 text-zinc-400"})}function oN(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 OX({onCreatePR:e,onViewRuns:t}){const[s,n]=y.useState(null),[o,l]=y.useState(!0),[u,h]=y.useState(null);function m(){let p=!0;return l(!0),h(null),N8().then(g=>{p&&n(g)}).catch(g=>{p&&h(g instanceof Error?g.message:String(g))}).finally(()=>{p&&l(!1)}),()=>{p=!1}}y.useEffect(m,[]),du(()=>{m()});const d=y.useMemo(()=>[...s?.branches??[]].sort((g,b)=>{const v=cN(g,s),w=cN(b,s);return v-w||g.name.localeCompare(b.name)}),[s]);return r.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-1.5",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"text-[13px] font-semibold",children:"Branches"}),r.jsx("p",{className:"truncate text-[11px] text-muted-foreground",children:s?.repository.full_name??"Selected repository"})]}),r.jsxs(J,{disabled:o,onClick:()=>{m()},size:"sm",type:"button",variant:"outline",children:[r.jsx(Cr,{className:`mr-1 size-3.5 ${o?"animate-spin":""}`}),"Refresh"]})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:u?r.jsx("div",{className:"p-4 text-[12px] text-red-500",children:u}):o&&!s?r.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading branches..."}):d.length===0?r.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"No branches found."}):r.jsx("ul",{className:"divide-y divide-border",children:d.map(p=>r.jsx(LX,{branch:p,currentBranch:s?.currentBranch??null,defaultBranch:s?.defaultBranch??null,onCreatePR:e,onViewRuns:t},p.name))})})]})}function LX({branch:e,defaultBranch:t,currentBranch:s,onCreatePR:n,onViewRuns:o}){const l=e.name===t,u=e.name===s,h=!l;return r.jsxs("li",{className:"flex flex-wrap items-center gap-3 px-3 py-2.5",children:[r.jsx(xn,{className:"size-4 shrink-0 text-muted-foreground"}),r.jsxs("div",{className:"min-w-48 flex-1",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("span",{className:"truncate font-mono text-[13px] font-medium",children:e.name}),l?r.jsx(lN,{label:"Default",tone:"success"}):null,u?r.jsx(lN,{label:"Current",tone:"warning"}):null,e.protected?r.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 text-[10px] text-muted-foreground",children:[r.jsx(SM,{className:"size-3"}),"protected"]}):null]}),r.jsx("div",{className:"mt-0.5 font-mono text-[11px] text-muted-foreground",children:e.commit.sha.slice(0,7)})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[r.jsxs(J,{onClick:()=>o(e.name),size:"sm",title:`View workflow runs for ${e.name}`,type:"button",variant:"outline",children:[r.jsx(g4,{className:"size-3.5"}),"View runs"]}),r.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:[r.jsx(NN,{className:"size-3.5"}),"Open PR"]})]})]})}function lN({label:e,tone:t}){const s=t==="success"?"bg-emerald-500":"bg-amber-500";return r.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 text-[10px] text-muted-foreground",children:[r.jsx("span",{className:`size-1.5 rounded-full ${s}`}),e]})}function cN(e,t){return e.name===t?.currentBranch?0:e.name===t?.defaultBranch?1:e.protected?2:3}function zX(){const e=aX();let t;return e.loading||e.status==="checking"?t=r.jsx(Sf,{fill:!0,label:"Loading…"}):e.status==="not_configured"?t=r.jsx(mj,{deviceFlowAvailable:e.deviceFlowAvailable,onSaved:e.refresh}):e.status==="auth_error"||e.status==="connection_error"?t=r.jsx(BX,{token:e}):t=r.jsx(IX,{token:e}),r.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-card/85",children:t})}function BX({token:e}){const[t,s]=y.useState(null);if(t)return r.jsx(mj,{deviceFlowAvailable:e.deviceFlowAvailable,initialMode:t,onSaved:e.refresh});const n=e.status==="auth_error";return r.jsx("div",{className:"flex h-full items-center justify-center p-8",children:r.jsxs("div",{className:"w-full max-w-lg space-y-4 rounded-md border border-border bg-card p-5",children:[r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(Vx,{className:"size-5"}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("h2",{className:"text-sm font-semibold",children:"GitHub connection failed"}),r.jsx("p",{className:"text-[12px] text-muted-foreground",children:n?"The saved GitHub token is no longer accepted.":"NoMoreIDE could not validate the GitHub connection."})]}),r.jsx(_j,{label:n?"Needs re-login":"Connection problem",tone:n?"danger":"warning"})]}),e.error?r.jsx(tt,{variant:"destructive",children:e.error}):null,r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(J,{onClick:e.refresh,type:"button",variant:n?"outline":"default",children:[r.jsx(Cr,{}),"Refresh"]}),r.jsx(J,{onClick:()=>s(e.deviceFlowAvailable?"device-pending":"pat"),type:"button",variant:n?"default":"outline",children:"Reconnect GitHub"}),r.jsx(J,{onClick:()=>s("pat"),type:"button",variant:"outline",children:"Use token instead"})]})]})})}function IX({token:e}){const[t,s]=sl("github:tab","prs"),[n,o]=sl("github:pr-state","open"),[l,u]=sl("github:issue-state","open"),[h,m]=y.useState(null),[d,p]=y.useState(null),[g,b]=y.useState(!1),[v,w]=y.useState(null),k=oX(n),N=lX(l);du(()=>{t==="prs"?k.refresh():t==="issues"&&N.refresh()});const E=T=>`rounded px-2 py-0.5 text-[11px] font-medium transition-colors ${T?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,A=T=>`rounded px-2 py-0.5 text-[10px] font-medium transition-colors ${T?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`;async function j(){b(!0),w(null);try{await k8("github.com"),e.refresh()}catch(T){w(T instanceof Error?T.message:String(T))}finally{b(!1)}}return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-1 border-b border-border bg-card/95 px-3 py-1",children:[r.jsx("button",{className:E(t==="prs"),onClick:()=>s("prs"),type:"button",children:"Pull Requests"}),r.jsx("button",{className:E(t==="issues"),onClick:()=>s("issues"),type:"button",children:"Issues"}),r.jsx("button",{className:E(t==="branches"),onClick:()=>s("branches"),type:"button",children:"Branches"}),r.jsx("button",{className:E(t==="actions"),onClick:()=>s("actions"),type:"button",children:"Actions"}),r.jsxs("div",{className:"ml-auto flex min-w-0 items-center gap-2",children:[r.jsx(PX,{token:e}),r.jsxs(J,{onClick:e.refresh,size:"sm",title:"Re-check the GitHub connection",type:"button",variant:"outline",children:[r.jsx(Cr,{}),"Reconnect"]}),r.jsx(J,{disabled:g,onClick:()=>{j()},size:"sm",type:"button",variant:"outline",children:g?"Disconnecting…":"Disconnect"})]}),t==="prs"?r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("div",{className:"flex items-center gap-0.5 rounded-md bg-muted/60 p-0.5",children:[r.jsx("button",{className:A(n==="open"),onClick:()=>o("open"),type:"button",children:"Open"}),r.jsx("button",{className:A(n==="closed"),onClick:()=>o("closed"),type:"button",children:"Closed"})]}),r.jsx(J,{onClick:()=>m(""),size:"sm",type:"button",variant:"outline",children:"New PR"})]}):t==="issues"?r.jsxs("div",{className:"flex items-center gap-0.5 rounded-md bg-muted/60 p-0.5",children:[r.jsx("button",{className:A(l==="open"),onClick:()=>u("open"),type:"button",children:"Open"}),r.jsx("button",{className:A(l==="closed"),onClick:()=>u("closed"),type:"button",children:"Closed"})]}):null]}),v?r.jsx(tt,{variant:"destructive",className:"m-3",children:v}):null,h!==null?r.jsx($X,{initialHead:h,onCreated:T=>{m(null),s("prs"),k.setSelectedNumber(T.number),k.refresh()},onCancel:()=>m(null)}):r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:t==="prs"?r.jsxs("div",{className:"grid h-full min-h-0 grid-cols-[minmax(0,1fr)_minmax(0,2fr)] divide-x divide-border",children:[r.jsx("div",{className:"min-h-0 overflow-auto",children:r.jsx(dX,{error:k.error,hasMore:k.hasMore,loading:k.loading,loadingMore:k.loadingMore,onLoadMore:k.loadMore,onSelect:k.setSelectedNumber,prs:k.prs,selectedNumber:k.selectedNumber})}),r.jsx("div",{className:"flex min-h-0 min-w-0 flex-col overflow-hidden",children:r.jsx(mX,{diff:k.diff,diffError:k.diffError,diffLoading:k.diffLoading,onMerged:()=>k.refresh(),pr:k.selectedPR})})]}):t==="issues"?r.jsxs("div",{className:"grid h-full min-h-0 grid-cols-[minmax(0,1fr)_minmax(0,2fr)] divide-x divide-border",children:[r.jsx("div",{className:"min-h-0 overflow-auto",children:r.jsx(_X,{error:N.error,hasMore:N.hasMore,issues:N.issues,loading:N.loading,loadingMore:N.loadingMore,onLoadMore:N.loadMore,onSelect:N.setSelectedNumber,selectedNumber:N.selectedNumber})}),r.jsx("div",{className:"flex min-h-0 min-w-0 flex-col overflow-hidden",children:r.jsx(NX,{commentError:N.commentError,comments:N.comments,commentsLoading:N.commentsLoading,issue:N.selectedIssue,onAddComment:N.addComment,submitting:N.submitting})})]}):t==="branches"?r.jsx(OX,{onCreatePR:T=>m(T),onViewRuns:T=>{p(T),s("actions")}}):r.jsx(AX,{branch:d??void 0,onClearBranch:()=>p(null)})})]})}function PX({token:e}){const t=e.info?.repository?.full_name??(e.info?.user?`@${e.info.user.login}`:"GitHub");return r.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 border-r border-border pr-2",children:[r.jsx(Vx,{className:"size-4 shrink-0 text-foreground"}),r.jsx(_j,{label:"Connected",tone:"success"}),r.jsx("span",{className:"max-w-48 truncate font-mono text-[10px] text-muted-foreground",children:t})]})}function _j({label:e,tone:t}){const s=t==="success"?"bg-emerald-500":t==="danger"?"bg-red-500":"bg-amber-500";return r.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1.5 text-[11px] font-medium text-muted-foreground",children:[r.jsx("span",{className:`size-1.5 rounded-full ${s}`}),e]})}function $X({initialHead:e,onCreated:t,onCancel:s}){const[n,o]=y.useState(""),[l,u]=y.useState(""),[h,m]=y.useState(""),[d,p]=y.useState("main"),[g,b]=y.useState(!1),[v,w]=y.useState(null),[k,N]=y.useState(!0),[E,A]=y.useState(!1),[j,T]=y.useState(null);y.useEffect(()=>{let R=!0;return N(!0),T(null),T8().then(D=>{R&&(w(D),o(D.title),u(D.body),m(e||D.head),p(D.base||D.suggestedBase||"main"),b(D.draft))}).catch(D=>{R&&T(D instanceof Error?D.message:String(D))}).finally(()=>{R&&N(!1)}),()=>{R=!1}},[e]);async function P(R){if(R.preventDefault(),!(!n.trim()||!h.trim()||!d.trim())){A(!0),T(null);try{const D=await A8({title:n.trim(),body:l.trim()||void 0,head:h.trim(),base:d.trim(),draft:g});t(D)}catch(D){T(D instanceof Error?D.message:String(D))}finally{A(!1)}}}const z="w-full rounded-md border border-border bg-background px-3 py-2 text-[13px] placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring",L=v?.warnings??[];return r.jsxs("form",{className:"flex min-h-0 flex-col gap-3 overflow-auto bg-muted/20 p-4",onSubmit:R=>{P(R)},children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h3",{className:"text-[13px] font-semibold",children:"Branch to PR Assistant"}),r.jsxs("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:[v?.repository?.full_name??"Selected repository",v?.currentBranch?` - ${v.currentBranch}`:""]})]}),r.jsx("span",{className:"shrink-0 text-[11px] text-muted-foreground",children:k?"Detecting branch...":"Editable draft"})]}),r.jsx(HX,{template:v,loading:k}),L.length>0?r.jsx("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-[12px] text-amber-700 dark:text-amber-300",children:L[0]}):null,r.jsx("input",{className:z,disabled:k,onChange:R=>o(R.target.value),placeholder:"Title",required:!0,value:n}),r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs("label",{className:"space-y-1",children:[r.jsx("span",{className:"text-[10px] uppercase text-muted-foreground",children:"Head"}),r.jsx("input",{className:z,disabled:k,onChange:R=>m(R.target.value),placeholder:"Head branch",required:!0,value:h})]}),r.jsxs("label",{className:"space-y-1",children:[r.jsx("span",{className:"text-[10px] uppercase text-muted-foreground",children:"Base"}),r.jsx("input",{className:z,disabled:k,onChange:R=>p(R.target.value),placeholder:"Base branch",required:!0,value:d})]})]}),r.jsx("textarea",{className:`${z} resize-none`,disabled:k,onChange:R=>u(R.target.value),placeholder:"Description (optional)",rows:7,value:l}),r.jsxs("label",{className:"flex items-center gap-2 text-[12px]",children:[r.jsx("input",{checked:g,className:"size-3.5",disabled:k,onChange:R=>b(R.target.checked),type:"checkbox"}),"Create as draft"]}),j?r.jsx(tt,{variant:"destructive",children:j}):null,r.jsxs("div",{className:"flex gap-2",children:[r.jsx(J,{disabled:k||E||!n.trim()||!h.trim()||!d.trim(),type:"submit",children:E?"Creating…":"Create PR"}),r.jsx(J,{onClick:s,type:"button",variant:"outline",children:"Cancel"})]})]})}function HX({template:e,loading:t}){const s=e?.compare,n=s?.ciStatus,o=[{label:"base branch",value:s?.base||e?.base||"main"},{label:"head branch",value:s?.head||e?.head||"manual"},{label:"commits ahead",value:t?"...":String(s?.aheadBy??0)},{label:"changed files",value:t?"...":String(s?.files.length??0)},{label:"head CI",value:n?`${n.state} (${n.totalCount})`:"unavailable"}];return r.jsxs("div",{className:"rounded-md border border-border bg-card px-3 py-2",children:[r.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[r.jsx("span",{className:"text-[11px] font-medium text-foreground",children:"Compare summary"}),s?.headSha?r.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:s.headSha.slice(0,7)}):null]}),r.jsx("div",{className:"grid grid-cols-5 gap-2",children:o.map(l=>r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"truncate text-[10px] uppercase text-muted-foreground",children:l.label}),r.jsx("div",{className:"truncate font-mono text-[11px] text-foreground",children:l.value})]},l.label))}),s?.files.length?r.jsx("div",{className:"mt-2 flex flex-wrap gap-x-3 gap-y-1 text-[11px] text-muted-foreground",children:s.files.slice(0,4).map(l=>r.jsxs("span",{className:"max-w-52 truncate",children:[l.status," ",l.path]},`${l.status}:${l.path}`))}):null]})}function UX({ahead:e=0,behind:t=0,branches:s,currentBranch:n,disabled:o,onRefresh:l,upstream:u}){const[h,m]=y.useState(!1),[d,p]=y.useState(""),[g,b]=y.useState(null),[v,w]=y.useState(null),[k,N]=y.useState(null),E=s.filter(D=>!D.remote),A=s.filter(D=>D.remote);async function j(D,I){b(D),N(null),w(null);try{await I(),await l()}catch(V){N(V instanceof Error?V.message:String(V))}finally{b(null)}}async function T(D){await j(`switch:${D}`,async()=>{await ki("/api/git/branches/switch",{name:D}),m(!1)})}async function P(){await j("fetch",async()=>{await ki("/api/git/fetch",{}),w("Fetched latest branch refs.")})}async function z(){await j("push",async()=>{const D=await lf();w(D.setUpstream?`Pushed ${D.branch} and set upstream.`:`Pushed ${D.branch}.`)})}const L=!!n&&(e>0||!u&&t===0);async function R(D){D.preventDefault();const I=d.trim();if(!I){N("Branch name is required.");return}await j("create",async()=>{await ki("/api/git/branches",{name:I}),p(""),m(!1)})}return r.jsxs("div",{className:"fixed bottom-12 right-4 z-50 flex items-end",children:[h?r.jsxs("div",{"aria-label":"Switch Git branch",className:"mb-11 w-[min(460px,calc(100vw-2rem))] rounded-lg border border-border bg-card shadow-xl",role:"dialog",children:[r.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-border p-3",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx(xn,{className:"size-4 text-muted-foreground"}),r.jsx("span",{className:"truncate text-sm font-semibold",children:n||"Branches"})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[L?r.jsxs(J,{"aria-label":"Push current branch",className:"gap-1.5 px-2 text-xs",disabled:o||g!==null,onClick:()=>{z()},size:"sm",title:u?`Push ${e} commit${e===1?"":"s"} to ${u}`:"Push and set upstream",type:"button",variant:"default",children:[r.jsx(Bb,{className:de("size-3.5",g==="push"&&"animate-pulse")}),"Push",e>0?` ${e}`:""]}):null,r.jsx(J,{"aria-label":"Fetch branches",disabled:o||g!==null,onClick:()=>{P()},size:"icon",title:"Fetch branches",type:"button",variant:"ghost",children:r.jsx(Cr,{className:de(g==="fetch"&&"animate-spin")})}),r.jsx(J,{"aria-label":"Close branch dialog",onClick:()=>m(!1),size:"icon",type:"button",variant:"ghost",children:r.jsx(ts,{})})]})]}),r.jsx("div",{className:"max-h-72 overflow-auto",children:s.length?r.jsxs(r.Fragment,{children:[r.jsx(uN,{branches:E,busy:g!==null,disabled:o,label:"Local",onSwitch:T}),r.jsx(uN,{branches:A,busy:g!==null,disabled:o,label:"Remote",onSwitch:T})]}):r.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"No branches found."})}),r.jsxs("div",{className:"border-t border-border p-3",children:[r.jsxs("form",{className:"grid gap-2 sm:grid-cols-[1fr_auto]",onSubmit:R,children:[r.jsx(gt,{"aria-label":"New branch name",disabled:o||g!==null,onChange:D=>{p(D.target.value),N(null),w(null)},placeholder:"feature/new-work",value:d}),r.jsxs(J,{disabled:o||g!==null,type:"submit",children:[r.jsx(aR,{}),"Create"]})]}),k||v?r.jsx(tt,{className:"mt-3 px-3 py-2 text-xs",variant:k?"destructive":"muted",children:k??v}):null]})]}):null,r.jsxs(J,{className:"h-8 max-w-[260px] gap-2 rounded-md shadow-lg",disabled:o,onClick:()=>m(D=>!D),size:"sm",title:"Switch Git branch",type:"button",variant:"default",children:[r.jsx(xn,{className:"size-4"}),r.jsx("span",{className:"truncate font-mono text-xs",children:n||"No branch"}),n&&(e>0||t>0)?r.jsxs("span",{className:"flex items-center gap-1 font-mono text-[11px] tabular-nums",title:u?`${e} ahead / ${t} behind ${u}`:`${e} ahead / ${t} behind`,children:[t>0?r.jsxs("span",{className:"flex items-center",children:[r.jsx(ef,{className:"size-3"}),t]}):null,e>0?r.jsxs("span",{className:"flex items-center",children:[r.jsx(tf,{className:"size-3"}),e]}):null]}):null,r.jsx(vn,{className:de("size-4 transition-transform",h&&"rotate-180")})]})]})}function uN({branches:e,busy:t,disabled:s,label:n,onSwitch:o}){return r.jsxs("section",{children:[r.jsx("div",{className:"border-b border-border bg-muted/60 px-3 py-1.5 text-[11px] font-semibold uppercase text-muted-foreground",children:n}),e.length?e.map(l=>r.jsxs("button",{className:de("grid w-full grid-cols-[1fr_auto] items-center gap-2 border-b border-border px-3 py-2 text-left text-sm last:border-b-0 hover:bg-muted",l.current&&"bg-muted/70"),disabled:s||t||l.current,onClick:()=>{o(l.name)},type:"button",children:[r.jsxs("span",{className:"min-w-0",children:[r.jsx("span",{className:"block truncate font-medium",children:l.name}),l.upstream?r.jsxs("span",{className:"block truncate font-mono text-[11px] text-muted-foreground",children:["tracks ",l.upstream]}):null]}),r.jsx(et,{variant:l.current?"success":l.remote?"outline":"secondary",children:l.current?"current":l.remote?"remote":"local"})]},`${l.remote?"remote":"local"}:${l.name}`)):r.jsxs("div",{className:"border-b border-border px-3 py-3 text-sm text-muted-foreground",children:["No ",n.toLowerCase()," branches."]})]})}const yj="nomoreide-theme-choice";function FX(){if(typeof window>"u")return"dark";const e=window.localStorage.getItem(yj);return e==="light"||e==="dark"?e:"dark"}function qX(e){const t=document.documentElement;t.classList.toggle("dark",e==="dark"),t.style.colorScheme=e}function VX(){const[e,t]=y.useState(()=>FX()),s=y.useRef(null);y.useEffect(()=>{qX(e),window.localStorage.setItem(yj,e)},[e]);const n=y.useCallback(()=>{const o=e==="dark"?"light":"dark",l=s.current,u=document;if(!l||!u.startViewTransition||window.matchMedia("(prefers-reduced-motion: reduce)").matches){t(o);return}const h=l.getBoundingClientRect(),m=h.left+h.width/2,d=h.top+h.height/2,p=Math.hypot(Math.max(m,window.innerWidth-m),Math.max(d,window.innerHeight-d));u.startViewTransition(()=>{t(o)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${m}px ${d}px)`,`circle(${p}px at ${m}px ${d}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},[e]);return r.jsxs("button",{ref:s,type:"button",onClick:n,title:e==="dark"?"Switch to light mode":"Switch to dark mode","aria-label":"Toggle theme",className:zh(),children:[r.jsx("span",{className:Bh(),children:e==="dark"?r.jsx(AM,{}):r.jsx($R,{})}),r.jsx("span",{className:Ih(),children:"Theme"})]})}function GX(){return ln()?r.jsxs("div",{className:"flex items-center justify-between h-8 bg-background border-b border-border select-none",style:{WebkitAppRegion:"drag"},onMouseDown:()=>JM(),children:[r.jsx("span",{className:"px-3 text-xs font-medium text-muted-foreground",children:"NoMoreIDE"}),r.jsxs("div",{className:"flex items-center",style:{WebkitAppRegion:"no-drag"},children:[r.jsx("button",{type:"button",onClick:XM,className:"h-8 w-10 flex items-center justify-center hover:bg-muted transition-colors","aria-label":"Minimize",children:r.jsx(RN,{className:"h-3 w-3"})}),r.jsx("button",{type:"button",onClick:ZM,className:"h-8 w-10 flex items-center justify-center hover:bg-muted transition-colors","aria-label":"Maximize",children:r.jsx(to,{className:"h-3 w-3"})}),r.jsx("button",{type:"button",onClick:QM,className:"h-8 w-10 flex items-center justify-center hover:bg-destructive hover:text-destructive-foreground transition-colors","aria-label":"Close",children:r.jsx(ts,{className:"h-3 w-3"})})]})]}):null}function WX(e=!1){return de("group/sidebar hidden h-full shrink-0 overflow-x-hidden overflow-y-auto border-r border-border bg-card/85 py-5 backdrop-blur transition-[width,padding] duration-200 md:flex md:flex-col",e?"w-64 px-4":"w-16 px-2 hover:w-64 hover:px-4")}function KX(e,t=!1){return de("relative grid h-12 grid-cols-[48px_minmax(0,1fr)] items-center justify-start gap-0 overflow-hidden rounded-md px-0 text-[15px] font-medium transition-[background-color,color,width] duration-150",t?"w-full":"w-12 group-hover/sidebar:w-full",e?"bg-primary text-primary-foreground hover:bg-primary/90":"hover:bg-muted")}function YX(e=!1,t=!1){return de("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 XX(e=!1){return de("flex size-12 items-center justify-center text-current transition-transform duration-150 [&_svg]:size-5",e?"translate-x-0":"-translate-x-px group-hover/sidebar:translate-x-0")}function ZX({docked:e,onToggleDock:t}){return r.jsxs("div",{className:de("mt-auto flex h-10 min-w-0 items-center overflow-hidden border-t border-border/60 text-[11px] text-muted-foreground transition-[height,opacity,width] duration-150",e?"w-full justify-start opacity-100":"w-12 justify-center group-hover/sidebar:w-full group-hover/sidebar:justify-start group-hover/sidebar:opacity-100"),children:[r.jsxs("span",{className:de("flex min-w-0 items-center gap-1.5 overflow-hidden whitespace-pre transition-[opacity,width] duration-150",e?"flex-1 opacity-100":"w-0 flex-none opacity-0 group-hover/sidebar:w-auto group-hover/sidebar:flex-1 group-hover/sidebar:opacity-100"),children:[r.jsx("span",{children:"Made with"}),r.jsx(dR,{"aria-label":"love",className:"size-3 shrink-0 fill-red-500 text-red-500"}),r.jsx("span",{children:"by Robert Wang"}),r.jsx("a",{"aria-label":"Robert Wang on LinkedIn",className:"shrink-0 rounded p-0.5 text-muted-foreground transition-colors hover:bg-muted hover:text-[#0A66C2]",href:"https://www.linkedin.com/in/robert-wang-cs/",rel:"noopener noreferrer",target:"_blank",title:"LinkedIn",children:r.jsxs("svg",{className:"size-3 fill-current",role:"img",viewBox:"0 0 24 24",children:[r.jsx("title",{children:"LinkedIn"}),r.jsx("path",{d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.063 2.063 0 1 1 0-4.126 2.063 2.063 0 0 1 0 4.126zM7.119 20.452H3.554V9h3.565v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.225 0z"})]})})]}),r.jsx("button",{"aria-label":e?"Undock sidebar":"Dock sidebar","aria-pressed":e,className:de("flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground [&_svg]:size-4",e?"ml-auto bg-muted text-foreground":"group-hover/sidebar:ml-auto"),onClick:t,title:e?"Undock sidebar":"Dock sidebar",type:"button",children:e?r.jsx(GR,{}):r.jsx(KR,{})})]})}function QX({className:e}){return r.jsxs("div",{className:de("min-w-0",e),children:[r.jsxs("div",{className:"flex items-baseline gap-1.5",children:[r.jsx("div",{className:"text-sm font-semibold",children:"NoMoreIDE"}),r.jsxs("div",{className:"font-mono text-[10px] text-muted-foreground",children:["v","0.1.57"]})]}),r.jsx("div",{className:"font-mono text-[11px] text-muted-foreground",children:"127.0.0.1 console"})]})}function JX({syncLocation:e=!0}={}){const[t,s]=y.useState(()=>e?window.location.pathname.startsWith("/agent")?"agent":window.location.pathname.startsWith("/errors")?"errors":window.location.pathname.startsWith("/database")?"database":window.location.pathname.startsWith("/terminal")?"terminal":window.location.pathname.startsWith("/github")?"github":window.location.pathname.startsWith("/git")?"git":"services":"services"),[n,o]=y.useState(null),[l,u]=y.useState(null),[h,m]=y.useState(null),[d,p]=y.useState(null),[g,b]=y.useState(!0),{error:v,success:w}=$s(),[k,N]=y.useState(()=>window.localStorage.getItem("nomoreide:sidebar-docked")==="true"),E=jU(),A=y.useCallback(async(z={})=>{z.silent||b(!0),p(null);try{o(await Y8()),z.notify&&w("Dashboard refreshed.")}catch(L){const R=L instanceof Error?L.message:String(L);p(R),v(R)}finally{b(!1)}},[v,w]),j=y.useCallback(()=>{A({notify:!0}),E.runActive()},[A,E]);y.useEffect(()=>{A()},[A]),y.useEffect(()=>{function z(){document.visibilityState==="visible"&&(A({silent:!0}),E.runActive())}const L=window.setInterval(z,5e3);return window.addEventListener("focus",z),document.addEventListener("visibilitychange",z),()=>{window.clearInterval(L),window.removeEventListener("focus",z),document.removeEventListener("visibilitychange",z)}},[t,A,E.runActive]),y.useEffect(()=>{if(!e)return;const z=t==="git"?"/git":t==="github"?"/github":t==="agent"?"/agent":t==="errors"?"/errors":t==="database"?"/database":t==="terminal"?"/terminal":"/";window.location.pathname!==z&&window.history.pushState(null,"",z)},[t,e]),y.useEffect(()=>{window.localStorage.setItem("nomoreide:sidebar-docked",String(k))},[k]);const T=y.useMemo(()=>n?Object.values(n.runtime.services).filter(z=>z.state==="running").length:0,[n]),P=n?.git.selectedRepository?.name??n?.git.cwd??"no-git-repository";return r.jsx(qI,{children:r.jsx(TU,{value:E,children:r.jsx(sH,{onRefresh:()=>{A({silent:!0})},children:r.jsxs("div",{className:"flex flex-col h-screen overflow-hidden",children:[r.jsx(GX,{}),r.jsxs("div",{className:"flex-1 overflow-hidden pb-9",children:[r.jsxs("div",{className:"mx-auto flex h-full max-w-[1500px]",children:[r.jsxs("aside",{className:WX(k),children:[r.jsxs("div",{className:de("grid h-12 grid-cols-[48px_minmax(0,1fr)] items-center overflow-hidden transition-[width] duration-150",k?"w-full":"w-12 group-hover/sidebar:w-full"),children:[r.jsx("div",{className:"flex size-12 items-center justify-center",children:r.jsx("div",{className:"flex size-9 items-center justify-center overflow-hidden rounded-md bg-primary text-primary-foreground",children:r.jsxs("svg",{"aria-label":"NoMoreIDE",className:"size-6",fill:"none",role:"img",viewBox:"0 0 64 64",xmlns:"http://www.w3.org/2000/svg",children:[r.jsx("path",{d:"M5 17C5 13.69 7.69 11 11 11H25L31 17H53C56.31 17 59 19.69 59 23V53C59 56.31 56.31 59 53 59H11C7.69 59 5 56.31 5 53V17Z",fill:"currentColor"}),r.jsx("path",{d:"M22 31L30 39L22 47",stroke:"hsl(var(--primary))",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"4.5"}),r.jsx("path",{d:"M36 47H48",stroke:"hsl(var(--primary))",strokeLinecap:"round",strokeWidth:"4.5"})]})})}),r.jsx(QX,{className:de("min-w-0 translate-x-1 overflow-hidden transition-opacity duration-200",k?"opacity-100":"opacity-0 group-hover/sidebar:opacity-100")})]}),r.jsxs("nav",{className:"mt-5 grid flex-1 content-start gap-1",children:[r.jsx(Fa,{active:t==="services",badge:T,docked:k,icon:r.jsx(LN,{}),label:"Services",onClick:()=>s("services")}),r.jsx(Fa,{active:t==="git",docked:k,icon:r.jsx(xn,{}),label:"Git Review",onClick:()=>s("git")}),r.jsx(Fa,{active:t==="github",docked:k,icon:r.jsx(Vx,{}),label:"GitHub",onClick:()=>s("github")}),r.jsx(Fa,{active:t==="errors",docked:k,icon:r.jsx(Nh,{}),label:"Error Inbox",onClick:()=>s("errors")}),r.jsx(Fa,{active:t==="database",docked:k,icon:r.jsx(fi,{}),label:"Database",onClick:()=>s("database")}),r.jsx(Fa,{active:t==="terminal",docked:k,icon:r.jsx(EM,{}),label:"Terminal",onClick:()=>s("terminal")}),r.jsx(Fa,{active:t==="agent",docked:k,icon:r.jsx(KA,{}),label:"Agent",onClick:()=>s("agent")})]}),r.jsx(ZX,{docked:k,onToggleDock:()=>N(z=>!z)})]}),r.jsxs("main",{className:"flex h-full min-w-0 flex-1 flex-col px-0 py-0",children:[r.jsxs("header",{className:de("relative z-40 flex shrink-0 flex-wrap items-center justify-between gap-3 border border-border bg-card/90 px-4 py-3 backdrop-blur","border-x-0 border-t-0 border-b"),children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(XR,{className:"size-4 text-muted-foreground md:hidden"}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-lg font-semibold tracking-tight",children:t==="git"?"Git Review":t==="github"?"GitHub":t==="agent"?"Agent":t==="errors"?"Error Inbox":t==="database"?"Database":t==="terminal"?"Terminal":"Services"}),r.jsx("p",{className:"font-mono text-xs text-muted-foreground",children:n?.git.selectedRepository?.name??n?.git.cwd??"Local workspace"})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[d?r.jsx(et,{variant:"danger",children:d}):null,n&&(t==="git"||t==="github")?r.jsx(gY,{data:n,onRefresh:A}):null,r.jsxs("div",{"aria-label":"Dashboard quick actions",className:"flex items-center gap-1 rounded-lg border border-border bg-background p-px",role:"toolbar",children:[r.jsxs("button",{"aria-label":"Refresh",className:zh(),onClick:j,title:"Refresh this page",type:"button",children:[r.jsx("span",{className:Bh(),children:r.jsx(Cr,{className:de(g&&"animate-spin")})}),r.jsx("span",{className:Ih(),children:"Refresh"})]}),r.jsx(VX,{}),r.jsxs("a",{"aria-label":"Open NoMoreIDE documentation",className:zh(),href:"https://www.nomoreide.com/docs",rel:"noreferrer",target:"_blank",title:"Open NoMoreIDE documentation",children:[r.jsx("span",{className:Bh(),children:r.jsx(GA,{})}),r.jsx("span",{className:Ih(),children:"Docs"})]}),n?r.jsx(z$,{data:n}):null]})]})]}),n?r.jsx(LW,{data:n,onOpenService:z=>{u(z),s("services"),A({silent:!0})}}):null,g&&!n?r.jsx(tt,{variant:"muted",children:"Loading NoMoreIDE state..."}):null,r.jsxs("div",{className:"min-h-0 flex-1 overflow-hidden",children:[n&&t==="services"?r.jsx(MW,{data:n,onRefresh:A,focusService:l,onServiceFocused:()=>u(null)}):null,n&&t==="git"?r.jsx(nX,{data:n,onRefresh:()=>{A({silent:!0})}}):null,t==="github"?r.jsx(zX,{},P):null,t==="agent"?r.jsx(u$,{}):null,t==="errors"?r.jsx(lF,{}):null,t==="database"?r.jsx(sF,{staged:h,onStageConsumed:()=>m(null)}):null,t==="terminal"?r.jsx(HW,{}):null]})]})]}),n&&t==="git"?r.jsx(UX,{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:A,upstream:n.git.status?.upstream}):null,r.jsx(vU,{git:n?.git,onGitRefresh:()=>{A({silent:!0})},onOpenAgentPage:t==="agent"?void 0:()=>s("agent"),onOpenService:z=>{u(z),s("services"),A({silent:!0})},onOpenSqlConsole:(z,L)=>{m(R=>({connection:z,sql:L,nonce:(R?.nonce??0)+1})),s("database")}})]})]})})})})}function Fa({active:e,badge:t,docked:s,icon:n,label:o,onClick:l}){const u=t!==void 0&&t>0;return r.jsxs(J,{"aria-label":o,title:o,className:KX(e,s),variant:"ghost",onClick:l,type:"button",children:[r.jsx("span",{className:XX(s),children:n}),r.jsx("span",{className:YX(s,u),children:o}),t!==void 0&&t>0?r.jsx(et,{appearance:t>0?"solid":"outline",className:de("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]})}hN.createRoot(document.getElementById("root")).render(r.jsx(y.StrictMode,{children:r.jsx(JX,{})}));export{r as j,y as r};
|