nomoreide 0.1.72 → 0.1.74
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/README.md +48 -0
- package/dist/cli/agents.d.ts +2 -0
- package/dist/cli/agents.js +43 -0
- package/dist/cli/agents.js.map +1 -0
- package/dist/cli/commands.d.ts +3 -1
- package/dist/cli/commands.js +21 -14
- package/dist/cli/commands.js.map +1 -1
- package/dist/cli/daemon.d.ts +15 -0
- package/dist/cli/daemon.js +139 -0
- package/dist/cli/daemon.js.map +1 -0
- package/dist/cli/profile.d.ts +2 -0
- package/dist/cli/profile.js +167 -0
- package/dist/cli/profile.js.map +1 -0
- package/dist/core/agent-env-actions.d.ts +4 -4
- package/dist/core/agent-profiles/registry-config.d.ts +1 -1
- package/dist/core/agent-profiles/registry-config.js +4 -1
- package/dist/core/agent-profiles/registry-config.js.map +1 -1
- package/dist/core/agent-terminal.d.ts +6 -0
- package/dist/core/agent-terminal.js +16 -0
- package/dist/core/agent-terminal.js.map +1 -0
- package/dist/core/app-version.d.ts +2 -0
- package/dist/core/app-version.js +16 -0
- package/dist/core/app-version.js.map +1 -0
- package/dist/core/config-store.js +1 -0
- package/dist/core/config-store.js.map +1 -1
- package/dist/core/daemon-client.d.ts +66 -0
- package/dist/core/daemon-client.js +121 -0
- package/dist/core/daemon-client.js.map +1 -0
- package/dist/core/daemon-lifecycle.d.ts +59 -0
- package/dist/core/daemon-lifecycle.js +147 -0
- package/dist/core/daemon-lifecycle.js.map +1 -0
- package/dist/core/db-peek.d.ts +4 -0
- package/dist/core/db-peek.js +2 -0
- package/dist/core/db-peek.js.map +1 -1
- package/dist/core/repo-onboard.d.ts +8 -8
- package/dist/core/service-health.js +6 -1
- package/dist/core/service-health.js.map +1 -1
- package/dist/core/service-registry.d.ts +5 -3
- package/dist/core/service-registry.js +8 -5
- package/dist/core/service-registry.js.map +1 -1
- package/dist/core/terminal-manager.d.ts +3 -0
- package/dist/core/terminal-manager.js +2 -0
- package/dist/core/terminal-manager.js.map +1 -1
- package/dist/core/terminal-session.d.ts +7 -0
- package/dist/core/terminal-session.js +6 -0
- package/dist/core/terminal-session.js.map +1 -1
- package/dist/core/types.d.ts +6 -0
- package/dist/core/workflows.d.ts +7 -19
- package/dist/core/workflows.js +9 -21
- package/dist/core/workflows.js.map +1 -1
- package/dist/index.js +22 -5
- package/dist/index.js.map +1 -1
- package/dist/mcp/server.d.ts +11 -7
- package/dist/mcp/server.js +15 -34
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools/agent.js +15 -5
- package/dist/mcp/tools/agent.js.map +1 -1
- package/dist/mcp/tools/context.d.ts +6 -8
- package/dist/mcp/tools/context.js.map +1 -1
- package/dist/mcp/tools/database.js +13 -17
- package/dist/mcp/tools/database.js.map +1 -1
- package/dist/mcp/tools/services.d.ts +5 -0
- package/dist/mcp/tools/services.js +31 -21
- package/dist/mcp/tools/services.js.map +1 -1
- package/dist/tui/app.d.ts +4 -2
- package/dist/tui/app.js +19 -16
- package/dist/tui/app.js.map +1 -1
- package/dist/web/client/assets/{code-editor-fZ2dpXfw.js → code-editor-GK07_DNL.js} +1 -1
- package/dist/web/client/assets/index-C8kH2Crm.css +1 -0
- package/dist/web/client/assets/index-D7ZrdlUm.js +219 -0
- package/dist/web/client/index.html +2 -2
- package/dist/web/routes/agent-chat-routes.d.ts +1 -1
- package/dist/web/routes/agent-chat-routes.js +3 -4
- package/dist/web/routes/agent-chat-routes.js.map +1 -1
- package/dist/web/routes/context.d.ts +6 -0
- package/dist/web/routes/context.js.map +1 -1
- package/dist/web/routes/dashboard-routes.js +27 -1
- package/dist/web/routes/dashboard-routes.js.map +1 -1
- package/dist/web/routes/database-routes.js +3 -0
- package/dist/web/routes/database-routes.js.map +1 -1
- package/dist/web/routes/shell-routes.js +1 -0
- package/dist/web/routes/shell-routes.js.map +1 -1
- package/dist/web/routes/terminal-routes.js +33 -0
- package/dist/web/routes/terminal-routes.js.map +1 -1
- package/dist/web/routes/workflow-routes.d.ts +2 -2
- package/dist/web/routes/workflow-routes.js +2 -2
- package/dist/web/server.d.ts +2 -0
- package/dist/web/server.js +2 -1
- package/dist/web/server.js.map +1 -1
- package/package.json +2 -1
- package/dist/web/client/assets/index-CraqLFuO.js +0 -222
- package/dist/web/client/assets/index-n7aEcfkd.css +0 -1
- package/dist/web/ui-lifecycle.d.ts +0 -30
- package/dist/web/ui-lifecycle.js +0 -129
- package/dist/web/ui-lifecycle.js.map +0 -1
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/window-DlR023_X.js","assets/core-DhEqZVGG.js","assets/event-BK_86lmQ.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))n(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&n(u)}).observe(document,{childList:!0,subtree:!0});function s(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function n(o){if(o.ep)return;o.ep=!0;const l=s(o);fetch(o.href,l)}})();function JT(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Op={exports:{}},gc={};var My;function e4(){if(My)return gc;My=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function s(n,o,l){var u=null;if(l!==void 0&&(u=""+l),o.key!==void 0&&(u=""+o.key),"key"in o){l={};for(var h in o)h!=="key"&&(l[h]=o[h])}else l=o;return o=l.ref,{$$typeof:e,type:n,key:u,ref:o!==void 0?o:null,props:l}}return gc.Fragment=t,gc.jsx=s,gc.jsxs=s,gc}var Dy;function t4(){return Dy||(Dy=1,Op.exports=e4()),Op.exports}var r=t4(),Lp={exports:{}},lt={};var Oy;function s4(){if(Oy)return lt;Oy=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),x=Symbol.iterator;function v(V){return V===null||typeof V!="object"?null:(V=x&&V[x]||V["@@iterator"],typeof V=="function"?V:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,C={};function N(V,ie,Ee){this.props=V,this.context=ie,this.refs=C,this.updater=Ee||w}N.prototype.isReactComponent={},N.prototype.setState=function(V,ie){if(typeof V!="object"&&typeof V!="function"&&V!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,V,ie,"setState")},N.prototype.forceUpdate=function(V){this.updater.enqueueForceUpdate(this,V,"forceUpdate")};function T(){}T.prototype=N.prototype;function j(V,ie,Ee){this.props=V,this.context=ie,this.refs=C,this.updater=Ee||w}var A=j.prototype=new T;A.constructor=j,k(A,N.prototype),A.isPureReactComponent=!0;var B=Array.isArray;function O(){}var I={H:null,A:null,T:null,S:null},R=Object.prototype.hasOwnProperty;function D(V,ie,Ee){var ye=Ee.ref;return{$$typeof:e,type:V,key:ie,ref:ye!==void 0?ye:null,props:Ee}}function P(V,ie){return D(V.type,ie,V.props)}function G(V){return typeof V=="object"&&V!==null&&V.$$typeof===e}function Z(V){var ie={"=":"=0",":":"=2"};return"$"+V.replace(/[=:]/g,function(Ee){return ie[Ee]})}var $=/\/+/g;function q(V,ie){return typeof V=="object"&&V!==null&&V.key!=null?Z(""+V.key):ie.toString(36)}function F(V){switch(V.status){case"fulfilled":return V.value;case"rejected":throw V.reason;default:switch(typeof V.status=="string"?V.then(O,O):(V.status="pending",V.then(function(ie){V.status==="pending"&&(V.status="fulfilled",V.value=ie)},function(ie){V.status==="pending"&&(V.status="rejected",V.reason=ie)})),V.status){case"fulfilled":return V.value;case"rejected":throw V.reason}}throw V}function L(V,ie,Ee,ye,oe){var je=typeof V;(je==="undefined"||je==="boolean")&&(V=null);var Ne=!1;if(V===null)Ne=!0;else switch(je){case"bigint":case"string":case"number":Ne=!0;break;case"object":switch(V.$$typeof){case e:case t:Ne=!0;break;case p:return Ne=V._init,L(Ne(V._payload),ie,Ee,ye,oe)}}if(Ne)return oe=oe(V),Ne=ye===""?"."+q(V,0):ye,B(oe)?(Ee="",Ne!=null&&(Ee=Ne.replace($,"$&/")+"/"),L(oe,ie,Ee,"",function(et){return et})):oe!=null&&(G(oe)&&(oe=P(oe,Ee+(oe.key==null||V&&V.key===oe.key?"":(""+oe.key).replace($,"$&/")+"/")+Ne)),ie.push(oe)),1;Ne=0;var Ge=ye===""?".":ye+":";if(B(V))for(var De=0;De<V.length;De++)ye=V[De],je=Ge+q(ye,De),Ne+=L(ye,ie,Ee,je,oe);else if(De=v(V),typeof De=="function")for(V=De.call(V),De=0;!(ye=V.next()).done;)ye=ye.value,je=Ge+q(ye,De++),Ne+=L(ye,ie,Ee,je,oe);else if(je==="object"){if(typeof V.then=="function")return L(F(V),ie,Ee,ye,oe);throw ie=String(V),Error("Objects are not valid as a React child (found: "+(ie==="[object Object]"?"object with keys {"+Object.keys(V).join(", ")+"}":ie)+"). If you meant to render a collection of children, use an array instead.")}return Ne}function X(V,ie,Ee){if(V==null)return V;var ye=[],oe=0;return L(V,ye,"","",function(je){return ie.call(Ee,je,oe++)}),ye}function U(V){if(V._status===-1){var ie=V._result;ie=ie(),ie.then(function(Ee){(V._status===0||V._status===-1)&&(V._status=1,V._result=Ee)},function(Ee){(V._status===0||V._status===-1)&&(V._status=2,V._result=Ee)}),V._status===-1&&(V._status=0,V._result=ie)}if(V._status===1)return V._result.default;throw V._result}var K=typeof reportError=="function"?reportError:function(V){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var ie=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof V=="object"&&V!==null&&typeof V.message=="string"?String(V.message):String(V),error:V});if(!window.dispatchEvent(ie))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",V);return}console.error(V)},Y={map:X,forEach:function(V,ie,Ee){X(V,function(){ie.apply(this,arguments)},Ee)},count:function(V){var ie=0;return X(V,function(){ie++}),ie},toArray:function(V){return X(V,function(ie){return ie})||[]},only:function(V){if(!G(V))throw Error("React.Children.only expected to receive a single React element child.");return V}};return lt.Activity=g,lt.Children=Y,lt.Component=N,lt.Fragment=s,lt.Profiler=o,lt.PureComponent=j,lt.StrictMode=n,lt.Suspense=f,lt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=I,lt.__COMPILER_RUNTIME={__proto__:null,c:function(V){return I.H.useMemoCache(V)}},lt.cache=function(V){return function(){return V.apply(null,arguments)}},lt.cacheSignal=function(){return null},lt.cloneElement=function(V,ie,Ee){if(V==null)throw Error("The argument must be a React element, but you passed "+V+".");var ye=k({},V.props),oe=V.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(V.type,oe,ye)},lt.createContext=function(V){return V={$$typeof:u,_currentValue:V,_currentValue2:V,_threadCount:0,Provider:null,Consumer:null},V.Provider=V,V.Consumer={$$typeof:l,_context:V},V},lt.createElement=function(V,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),De=0;De<Ne;De++)Ge[De]=arguments[De+2];oe.children=Ge}if(V&&V.defaultProps)for(ye in Ne=V.defaultProps,Ne)oe[ye]===void 0&&(oe[ye]=Ne[ye]);return D(V,je,oe)},lt.createRef=function(){return{current:null}},lt.forwardRef=function(V){return{$$typeof:h,render:V}},lt.isValidElement=G,lt.lazy=function(V){return{$$typeof:p,_payload:{_status:-1,_result:V},_init:U}},lt.memo=function(V,ie){return{$$typeof:d,type:V,compare:ie===void 0?null:ie}},lt.startTransition=function(V){var ie=I.T,Ee={};I.T=Ee;try{var ye=V(),oe=I.S;oe!==null&&oe(Ee,ye),typeof ye=="object"&&ye!==null&&typeof ye.then=="function"&&ye.then(O,K)}catch(je){K(je)}finally{ie!==null&&Ee.types!==null&&(ie.types=Ee.types),I.T=ie}},lt.unstable_useCacheRefresh=function(){return I.H.useCacheRefresh()},lt.use=function(V){return I.H.use(V)},lt.useActionState=function(V,ie,Ee){return I.H.useActionState(V,ie,Ee)},lt.useCallback=function(V,ie){return I.H.useCallback(V,ie)},lt.useContext=function(V){return I.H.useContext(V)},lt.useDebugValue=function(){},lt.useDeferredValue=function(V,ie){return I.H.useDeferredValue(V,ie)},lt.useEffect=function(V,ie){return I.H.useEffect(V,ie)},lt.useEffectEvent=function(V){return I.H.useEffectEvent(V)},lt.useId=function(){return I.H.useId()},lt.useImperativeHandle=function(V,ie,Ee){return I.H.useImperativeHandle(V,ie,Ee)},lt.useInsertionEffect=function(V,ie){return I.H.useInsertionEffect(V,ie)},lt.useLayoutEffect=function(V,ie){return I.H.useLayoutEffect(V,ie)},lt.useMemo=function(V,ie){return I.H.useMemo(V,ie)},lt.useOptimistic=function(V,ie){return I.H.useOptimistic(V,ie)},lt.useReducer=function(V,ie,Ee){return I.H.useReducer(V,ie,Ee)},lt.useRef=function(V){return I.H.useRef(V)},lt.useState=function(V){return I.H.useState(V)},lt.useSyncExternalStore=function(V,ie,Ee){return I.H.useSyncExternalStore(V,ie,Ee)},lt.useTransition=function(){return I.H.useTransition()},lt.version="19.2.6",lt}var Ly;function H0(){return Ly||(Ly=1,Lp.exports=s4()),Lp.exports}var _=H0(),zp={exports:{}},xc={},Bp={exports:{}},Pp={};var zy;function n4(){return zy||(zy=1,(function(e){function t(L,X){var U=L.length;L.push(X);e:for(;0<U;){var K=U-1>>>1,Y=L[K];if(0<o(Y,X))L[K]=X,L[U]=Y,U=K;else break e}}function s(L){return L.length===0?null:L[0]}function n(L){if(L.length===0)return null;var X=L[0],U=L.pop();if(U!==X){L[0]=U;e:for(var K=0,Y=L.length,V=Y>>>1;K<V;){var ie=2*(K+1)-1,Ee=L[ie],ye=ie+1,oe=L[ye];if(0>o(Ee,U))ye<Y&&0>o(oe,Ee)?(L[K]=oe,L[ye]=U,K=ye):(L[K]=Ee,L[ie]=U,K=ie);else if(ye<Y&&0>o(oe,U))L[K]=oe,L[ye]=U,K=ye;else break e}}return X}function o(L,X){var U=L.sortIndex-X.sortIndex;return U!==0?U:L.id-X.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var u=Date,h=u.now();e.unstable_now=function(){return u.now()-h}}var f=[],d=[],p=1,g=null,x=3,v=!1,w=!1,k=!1,C=!1,N=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;function A(L){for(var X=s(d);X!==null;){if(X.callback===null)n(d);else if(X.startTime<=L)n(d),X.sortIndex=X.expirationTime,t(f,X);else break;X=s(d)}}function B(L){if(k=!1,A(L),!w)if(s(f)!==null)w=!0,O||(O=!0,Z());else{var X=s(d);X!==null&&F(B,X.startTime-L)}}var O=!1,I=-1,R=5,D=-1;function P(){return C?!0:!(e.unstable_now()-D<R)}function G(){if(C=!1,O){var L=e.unstable_now();D=L;var X=!0;try{e:{w=!1,k&&(k=!1,T(I),I=-1),v=!0;var U=x;try{t:{for(A(L),g=s(f);g!==null&&!(g.expirationTime>L&&P());){var K=g.callback;if(typeof K=="function"){g.callback=null,x=g.priorityLevel;var Y=K(g.expirationTime<=L);if(L=e.unstable_now(),typeof Y=="function"){g.callback=Y,A(L),X=!0;break t}g===s(f)&&n(f),A(L)}else n(f);g=s(f)}if(g!==null)X=!0;else{var V=s(d);V!==null&&F(B,V.startTime-L),X=!1}}break e}finally{g=null,x=U,v=!1}X=void 0}}finally{X?Z():O=!1}}}var Z;if(typeof j=="function")Z=function(){j(G)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,q=$.port2;$.port1.onmessage=G,Z=function(){q.postMessage(null)}}else Z=function(){N(G,0)};function F(L,X){I=N(function(){L(e.unstable_now())},X)}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(L){L.callback=null},e.unstable_forceFrameRate=function(L){0>L||125<L?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<L?Math.floor(1e3/L):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function(L){switch(x){case 1:case 2:case 3:var X=3;break;default:X=x}var U=x;x=X;try{return L()}finally{x=U}},e.unstable_requestPaint=function(){C=!0},e.unstable_runWithPriority=function(L,X){switch(L){case 1:case 2:case 3:case 4:case 5:break;default:L=3}var U=x;x=L;try{return X()}finally{x=U}},e.unstable_scheduleCallback=function(L,X,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,L){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,L={id:p++,callback:X,priorityLevel:L,startTime:U,expirationTime:Y,sortIndex:-1},U>K?(L.sortIndex=U,t(d,L),s(f)===null&&L===s(d)&&(k?(T(I),I=-1):k=!0,F(B,U-K))):(L.sortIndex=Y,t(f,L),w||v||(w=!0,O||(O=!0,Z()))),L},e.unstable_shouldYield=P,e.unstable_wrapCallback=function(L){var X=x;return function(){var U=x;x=X;try{return L.apply(this,arguments)}finally{x=U}}}})(Pp)),Pp}var By;function i4(){return By||(By=1,Bp.exports=n4()),Bp.exports}var Ip={exports:{}},nn={};var Py;function r4(){if(Py)return nn;Py=1;var e=H0();function t(f){var d="https://react.dev/errors/"+f;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)d+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+f+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(){}var n={d:{f:s,r:function(){throw Error(t(522))},D:s,C:s,L:s,m:s,X:s,S:s,M:s},p:0,findDOMNode:null},o=Symbol.for("react.portal");function l(f,d,p){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:g==null?null:""+g,children:f,containerInfo:d,implementation:p}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(f,d){if(f==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return nn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,nn.createPortal=function(f,d){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(t(299));return l(f,d,null,p)},nn.flushSync=function(f){var d=u.T,p=n.p;try{if(u.T=null,n.p=2,f)return f()}finally{u.T=d,n.p=p,n.d.f()}},nn.preconnect=function(f,d){typeof f=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,n.d.C(f,d))},nn.prefetchDNS=function(f){typeof f=="string"&&n.d.D(f)},nn.preinit=function(f,d){if(typeof f=="string"&&d&&typeof d.as=="string"){var p=d.as,g=h(p,d.crossOrigin),x=typeof d.integrity=="string"?d.integrity:void 0,v=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;p==="style"?n.d.S(f,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:g,integrity:x,fetchPriority:v}):p==="script"&&n.d.X(f,{crossOrigin:g,integrity:x,fetchPriority:v,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},nn.preinitModule=function(f,d){if(typeof f=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var p=h(d.as,d.crossOrigin);n.d.M(f,{crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&n.d.M(f)},nn.preload=function(f,d){if(typeof f=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var p=d.as,g=h(p,d.crossOrigin);n.d.L(f,p,{crossOrigin:g,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},nn.preloadModule=function(f,d){if(typeof f=="string")if(d){var p=h(d.as,d.crossOrigin);n.d.m(f,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else n.d.m(f)},nn.requestFormReset=function(f){n.d.r(f)},nn.unstable_batchedUpdates=function(f,d){return f(d)},nn.useFormState=function(f,d,p){return u.H.useFormState(f,d,p)},nn.useFormStatus=function(){return u.H.useHostTransitionStatus()},nn.version="19.2.6",nn}var Iy;function RN(){if(Iy)return Ip.exports;Iy=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(),Ip.exports=r4(),Ip.exports}var $y;function a4(){if($y)return xc;$y=1;var e=i4(),t=H0(),s=RN();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 f(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,m=a;;){var b=c.return;if(b===null)break;var y=b.alternate;if(y===null){if(m=b.return,m!==null){c=m;continue}break}if(b.child===y.child){for(y=b.child;y;){if(y===c)return f(b),i;if(y===m)return f(b),a;y=y.sibling}throw Error(n(188))}if(c.return!==m.return)c=b,m=y;else{for(var E=!1,z=b.child;z;){if(z===c){E=!0,c=b,m=y;break}if(z===m){E=!0,m=b,c=y;break}z=z.sibling}if(!E){for(z=y.child;z;){if(z===c){E=!0,c=y,m=b;break}if(z===m){E=!0,m=y,c=b;break}z=z.sibling}if(!E)throw Error(n(189))}}if(c.alternate!==m)throw Error(n(190))}if(c.tag!==3)throw Error(n(188));return c.stateNode.current===c?i:a}function p(i){var a=i.tag;if(a===5||a===26||a===27||a===6)return i;for(i=i.child;i!==null;){if(a=p(i),a!==null)return a;i=i.sibling}return null}var g=Object.assign,x=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),j=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),R=Symbol.for("react.lazy"),D=Symbol.for("react.activity"),P=Symbol.for("react.memo_cache_sentinel"),G=Symbol.iterator;function Z(i){return i===null||typeof i!="object"?null:(i=G&&i[G]||i["@@iterator"],typeof i=="function"?i:null)}var $=Symbol.for("react.client.reference");function q(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===$?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case k:return"Fragment";case N:return"Profiler";case C:return"StrictMode";case B:return"Suspense";case O:return"SuspenseList";case D:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case w:return"Portal";case j:return i.displayName||"Context";case T:return(i._context.displayName||"Context")+".Consumer";case A:var a=i.render;return i=i.displayName,i||(i=a.displayName||a.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case I:return a=i.displayName||null,a!==null?a:q(i.type)||"Memo";case R:a=i._payload,i=i._init;try{return q(i(a))}catch{}}return null}var F=Array.isArray,L=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=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 V(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=V(null),oe=V(null),je=V(null),Ne=V(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)?ty(i):0;break;default:if(i=a.tagName,a=a.namespaceURI)a=ty(a),i=sy(a,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}ie(ye),Ee(ye,i)}function De(){ie(ye),ie(oe),ie(je)}function et(i){i.memoizedState!==null&&Ee(Ne,i);var a=ye.current,c=sy(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),hc._currentValue=U)}var He,$e;function wt(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 m={DetermineComponentFrameRoot:function(){try{if(a){var we=function(){throw Error()};if(Object.defineProperty(we.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(we,[])}catch(he){var le=he}Reflect.construct(i,[],we)}else{try{we.call()}catch(he){le=he}i.call(we.prototype)}}else{try{throw Error()}catch(he){le=he}(we=i())&&typeof we.catch=="function"&&we.catch(function(){})}}catch(he){if(he&&le&&typeof he.stack=="string")return[he.stack,le.stack]}return[null,null]}};m.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var b=Object.getOwnPropertyDescriptor(m.DetermineComponentFrameRoot,"name");b&&b.configurable&&Object.defineProperty(m.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var y=m.DetermineComponentFrameRoot(),E=y[0],z=y[1];if(E&&z){var W=E.split(`
|
|
5
|
-
`),ae=z.split(`
|
|
6
|
-
`);for(b=m=0;m<W.length&&!W[m].includes("DetermineComponentFrameRoot");)m++;for(;b<ae.length&&!ae[b].includes("DetermineComponentFrameRoot");)b++;if(m===W.length||b===ae.length)for(m=W.length-1,b=ae.length-1;1<=m&&0<=b&&W[m]!==ae[b];)b--;for(;1<=m&&0<=b;m--,b--)if(W[m]!==ae[b]){if(m!==1||b!==1)do if(m--,b--,0>b||W[m]!==ae[b]){var ge=`
|
|
7
|
-
`+W[m].replace(" at new "," at ");return i.displayName&&ge.includes("<anonymous>")&&(ge=ge.replace("<anonymous>",i.displayName)),ge}while(1<=m&&0<=b);break}}}finally{Us=!1,Error.prepareStackTrace=c}return(c=i?i.displayName||i.name:"")?wt(c):""}function Ln(i,a){switch(i.tag){case 26:case 27:case 5:return wt(i.type);case 16:return wt("Lazy");case 13:return i.child!==a&&a!==null?wt("Suspense Fallback"):wt("Suspense");case 19:return wt("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 wt("Activity");default:return""}}function Sn(i){try{var a="",c=null;do a+=Ln(i,c),c=i,i=i.return;while(i);return a}catch(m){return`
|
|
8
|
-
Error generating stack: `+m.message+`
|
|
9
|
-
`+m.stack}}var As=Object.prototype.hasOwnProperty,cn=e.unstable_scheduleCallback,un=e.unstable_cancelCallback,Ie=e.unstable_shouldYield,Ct=e.unstable_requestPaint,St=e.unstable_now,Rt=e.unstable_getCurrentPriorityLevel,Ft=e.unstable_ImmediatePriority,Js=e.unstable_UserBlockingPriority,en=e.unstable_NormalPriority,Di=e.unstable_LowPriority,S=e.unstable_IdlePriority,se=e.log,me=e.unstable_setDisableYieldValue,be=null,ce=null;function Ae(i){if(typeof se=="function"&&me(i),ce&&typeof ce.setStrictMode=="function")try{ce.setStrictMode(be,i)}catch{}}var M=Math.clz32?Math.clz32:xe,ne=Math.log,Te=Math.LN2;function xe(i){return i>>>=0,i===0?32:31-(ne(i)/Te|0)|0}var ue=256,Ce=262144,_e=4194304;function ze(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 m=i.pendingLanes;if(m===0)return 0;var b=0,y=i.suspendedLanes,E=i.pingedLanes;i=i.warmLanes;var z=m&134217727;return z!==0?(m=z&~y,m!==0?b=ze(m):(E&=z,E!==0?b=ze(E):c||(c=z&~i,c!==0&&(b=ze(c))))):(z=m&~y,z!==0?b=ze(z):E!==0?b=ze(E):c||(c=m&~i,c!==0&&(b=ze(c)))),b===0?0:a!==0&&a!==b&&(a&y)===0&&(y=b&-b,c=a&-a,y>=c||y===32&&(c&4194048)!==0)?a:b}function 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=_e;return _e<<=1,(_e&62914560)===0&&(_e=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,m,b,y){var E=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 z=i.entanglements,W=i.expirationTimes,ae=i.hiddenUpdates;for(c=E&~c;0<c;){var ge=31-M(c),we=1<<ge;z[ge]=0,W[ge]=-1;var le=ae[ge];if(le!==null)for(ae[ge]=null,ge=0;ge<le.length;ge++){var he=le[ge];he!==null&&(he.lane&=-536870913)}c&=~we}m!==0&&Ue(i,m,0),y!==0&&b===0&&i.tag!==0&&(i.suspendedLanes|=y&~(E&~a))}function Ue(i,a,c){i.pendingLanes|=a,i.suspendedLanes&=~a;var m=31-M(a);i.entangledLanes|=a,i.entanglements[m]=i.entanglements[m]|1073741824|c&261930}function at(i,a){var c=i.entangledLanes|=a;for(i=i.entanglements;c;){var m=31-M(c),b=1<<m;b&a|i[m]&a&&(i[m]|=a),c&=~b}}function hs(i,a){var c=a&-a;return c=(c&42)!==0?1:es(c),(c&(i.suspendedLanes|a))!==0?0:c}function es(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 sr(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function mo(){var i=X.p;return i!==0?i:(i=window.event,i===void 0?32:Ny(i.type))}function po(i,a){var c=X.p;try{return X.p=i,a()}finally{X.p=c}}var Oi=Math.random().toString(36).slice(2),fs="__reactFiber$"+Oi,tn="__reactProps$"+Oi,Or="__reactContainer$"+Oi,Sl="__reactEvents$"+Oi,Su="__reactListeners$"+Oi,go="__reactHandles$"+Oi,ku="__reactResources$"+Oi,Na="__reactMarker$"+Oi;function kl(i){delete i[fs],delete i[tn],delete i[Sl],delete i[Su],delete i[go]}function dn(i){var a=i[fs];if(a)return a;for(var c=i.parentNode;c;){if(a=c[Or]||c[fs]){if(c=a.alternate,a.child!==null||c!==null&&c.child!==null)for(i=cy(i);i!==null;){if(c=i[fs])return c;i=cy(i)}return a}i=c,c=i.parentNode}return null}function nr(i){if(i=i[fs]||i[Or]){var a=i.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return i}return null}function Lr(i){var a=i.tag;if(a===5||a===26||a===27||a===6)return i.stateNode;throw Error(n(33))}function zr(i){var a=i[ku];return a||(a=i[ku]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function vs(i){i[Na]=!0}var Nu=new Set,Ca={};function ir(i,a){Me(i,a),Me(i+"Capture",a)}function Me(i,a){for(Ca[i]=a,i=0;i<a.length;i++)Nu.add(a[i])}var tt=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]*$"),gt={},Ot={};function ms(i){return As.call(Ot,i)?!0:As.call(gt,i)?!1:tt.test(i)?Ot[i]=!0:(gt[i]=!0,!1)}function sn(i,a,c){if(ms(a))if(c===null)i.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":i.removeAttribute(a);return;case"boolean":var m=a.toLowerCase().slice(0,5);if(m!=="data-"&&m!=="aria-"){i.removeAttribute(a);return}}i.setAttribute(a,""+c)}}function zn(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,m){if(m===null)i.removeAttribute(c);else{switch(typeof m){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(c);return}i.setAttributeNS(a,c,""+m)}}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 Bn(i){var a=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function Cu(i,a,c){var m=Object.getOwnPropertyDescriptor(i.constructor.prototype,a);if(!i.hasOwnProperty(a)&&typeof m<"u"&&typeof m.get=="function"&&typeof m.set=="function"){var b=m.get,y=m.set;return Object.defineProperty(i,a,{configurable:!0,get:function(){return b.call(this)},set:function(E){c=""+E,y.call(this,E)}}),Object.defineProperty(i,a,{enumerable:m.enumerable}),{getValue:function(){return c},setValue:function(E){c=""+E},stopTracking:function(){i._valueTracker=null,delete i[a]}}}}function xo(i){if(!i._valueTracker){var a=Bn(i)?"checked":"value";i._valueTracker=Cu(i,a,""+i[a])}}function Nl(i){if(!i)return!1;var a=i._valueTracker;if(!a)return!0;var c=a.getValue(),m="";return i&&(m=Bn(i)?i.checked?"true":"false":i.value),i=m,i!==c?(a.setValue(i),!0):!1}function bo(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 Df=/[\n"\\]/g;function Nn(i){return i.replace(Df,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Cl(i,a,c,m,b,y,E,z){i.name="",E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?i.type=E:i.removeAttribute("type"),a!=null?E==="number"?(a===0&&i.value===""||i.value!=a)&&(i.value=""+Wt(a)):i.value!==""+Wt(a)&&(i.value=""+Wt(a)):E!=="submit"&&E!=="reset"||i.removeAttribute("value"),a!=null?vo(i,E,Wt(a)):c!=null?vo(i,E,Wt(c)):m!=null&&i.removeAttribute("value"),b==null&&y!=null&&(i.defaultChecked=!!y),b!=null&&(i.checked=b&&typeof b!="function"&&typeof b!="symbol"),z!=null&&typeof z!="function"&&typeof z!="symbol"&&typeof z!="boolean"?i.name=""+Wt(z):i.removeAttribute("name")}function Ea(i,a,c,m,b,y,E,z){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(i.type=y),a!=null||c!=null){if(!(y!=="submit"&&y!=="reset"||a!=null)){xo(i);return}c=c!=null?""+Wt(c):"",a=a!=null?""+Wt(a):c,z||a===i.value||(i.value=a),i.defaultValue=a}m=m??b,m=typeof m!="function"&&typeof m!="symbol"&&!!m,i.checked=z?i.checked:!!m,i.defaultChecked=!!m,E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"&&(i.name=E),xo(i)}function vo(i,a,c){a==="number"&&bo(i.ownerDocument)===i||i.defaultValue===""+c||(i.defaultValue=""+c)}function qs(i,a,c,m){if(i=i.options,a){a={};for(var b=0;b<c.length;b++)a["$"+c[b]]=!0;for(c=0;c<i.length;c++)b=a.hasOwnProperty("$"+i[c].value),i[c].selected!==b&&(i[c].selected=b),b&&m&&(i[c].defaultSelected=!0)}else{for(c=""+Wt(c),a=null,b=0;b<i.length;b++){if(i[b].value===c){i[b].selected=!0,m&&(i[b].defaultSelected=!0);return}a!==null||i[b].disabled||(a=i[b])}a!==null&&(a.selected=!0)}}function Eu(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 _o(i,a,c,m){if(a==null){if(m!=null){if(c!=null)throw Error(n(92));if(F(m)){if(1<m.length)throw Error(n(93));m=m[0]}c=m}c==null&&(c=""),a=c}c=Wt(a),i.defaultValue=c,m=i.textContent,m===c&&m!==""&&m!==null&&(i.value=m),xo(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 ju=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function _s(i,a,c){var m=a.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?m?i.setProperty(a,""):a==="float"?i.cssFloat="":i[a]="":m?i.setProperty(a,c):typeof c!="number"||c===0||ju.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 m in c)!c.hasOwnProperty(m)||a!=null&&a.hasOwnProperty(m)||(m.indexOf("--")===0?i.setProperty(m,""):m==="float"?i.cssFloat="":i[m]="");for(var b in a)m=a[b],a.hasOwnProperty(b)&&c[b]!==m&&_s(i,b,m)}else for(var y in a)a.hasOwnProperty(y)&&_s(i,y,a[y])}function Br(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 rr=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),El=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Pr(i){return El.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function Pe(){}var Qe=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 Qn(i){var a=nr(i);if(a&&(i=a.stateNode)){var c=i[tn]||null;e:switch(i=a.stateNode,a.type){case"input":if(Cl(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 m=c[a];if(m!==i&&m.form===i.form){var b=m[tn]||null;if(!b)throw Error(n(90));Cl(m,b.value,b.defaultValue,b.defaultValue,b.checked,b.defaultChecked,b.type,b.name)}}for(a=0;a<c.length;a++)m=c[a],m.form===i.form&&Nl(m)}break e;case"textarea":Eu(i,c.value,c.defaultValue);break e;case"select":a=c.value,a!=null&&qs(i,!!c.multiple,a,!1)}}}var jl=!1;function Au(i,a,c){if(jl)return i(a,c);jl=!0;try{var m=i(a);return m}finally{if(jl=!1,(vt!==null||ns!==null)&&(gd(),vt&&(a=vt,i=ns,ns=vt=null,Qn(a),i)))for(a=0;a<i.length;a++)Qn(i[a])}}function Al(i,a){var c=i.stateNode;if(c===null)return null;var m=c[tn]||null;if(m===null)return null;c=m[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(m=!m.disabled)||(i=i.type,m=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!m;break e;default:i=!1}if(i)return null;if(c&&typeof c!="function")throw Error(n(231,a,typeof c));return c}var ar=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Of=!1;if(ar)try{var Tl={};Object.defineProperty(Tl,"passive",{get:function(){Of=!0}}),window.addEventListener("test",Tl,Tl),window.removeEventListener("test",Tl,Tl)}catch{Of=!1}var Ir=null,Lf=null,Tu=null;function sv(){if(Tu)return Tu;var i,a=Lf,c=a.length,m,b="value"in Ir?Ir.value:Ir.textContent,y=b.length;for(i=0;i<c&&a[i]===b[i];i++);var E=c-i;for(m=1;m<=E&&a[c-m]===b[y-m];m++);return Tu=b.slice(i,1<m?1-m:void 0)}function Ru(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 Mu(){return!0}function nv(){return!1}function Cn(i){function a(c,m,b,y,E){this._reactName=c,this._targetInst=b,this.type=m,this.nativeEvent=y,this.target=E,this.currentTarget=null;for(var z in i)i.hasOwnProperty(z)&&(c=i[z],this[z]=c?c(y):y[z]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?Mu:nv,this.isPropagationStopped=nv,this}return g(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=Mu)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Mu)},persist:function(){},isPersistent:Mu}),a}var ja={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Du=Cn(ja),Rl=g({},ja,{view:0,detail:0}),Z5=Cn(Rl),zf,Bf,Ml,Ou=g({},Rl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:If,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!==Ml&&(Ml&&i.type==="mousemove"?(zf=i.screenX-Ml.screenX,Bf=i.screenY-Ml.screenY):Bf=zf=0,Ml=i),zf)},movementY:function(i){return"movementY"in i?i.movementY:Bf}}),iv=Cn(Ou),Q5=g({},Ou,{dataTransfer:0}),J5=Cn(Q5),eA=g({},Rl,{relatedTarget:0}),Pf=Cn(eA),tA=g({},ja,{animationName:0,elapsedTime:0,pseudoElement:0}),sA=Cn(tA),nA=g({},ja,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),iA=Cn(nA),rA=g({},ja,{data:0}),rv=Cn(rA),aA={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},oA={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"},lA={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function cA(i){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(i):(i=lA[i])?!!a[i]:!1}function If(){return cA}var uA=g({},Rl,{key:function(i){if(i.key){var a=aA[i.key]||i.key;if(a!=="Unidentified")return a}return i.type==="keypress"?(i=Ru(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?oA[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:If,charCode:function(i){return i.type==="keypress"?Ru(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Ru(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),dA=Cn(uA),hA=g({},Ou,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),av=Cn(hA),fA=g({},Rl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:If}),mA=Cn(fA),pA=g({},ja,{propertyName:0,elapsedTime:0,pseudoElement:0}),gA=Cn(pA),xA=g({},Ou,{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}),bA=Cn(xA),vA=g({},ja,{newState:0,oldState:0}),_A=Cn(vA),yA=[9,13,27,32],$f=ar&&"CompositionEvent"in window,Dl=null;ar&&"documentMode"in document&&(Dl=document.documentMode);var wA=ar&&"TextEvent"in window&&!Dl,ov=ar&&(!$f||Dl&&8<Dl&&11>=Dl),lv=" ",cv=!1;function uv(i,a){switch(i){case"keyup":return yA.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function dv(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var yo=!1;function SA(i,a){switch(i){case"compositionend":return dv(a);case"keypress":return a.which!==32?null:(cv=!0,lv);case"textInput":return i=a.data,i===lv&&cv?null:i;default:return null}}function kA(i,a){if(yo)return i==="compositionend"||!$f&&uv(i,a)?(i=sv(),Tu=Lf=Ir=null,yo=!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 ov&&a.locale!=="ko"?null:a.data;default:return null}}var NA={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 hv(i){var a=i&&i.nodeName&&i.nodeName.toLowerCase();return a==="input"?!!NA[i.type]:a==="textarea"}function fv(i,a,c,m){vt?ns?ns.push(m):ns=[m]:vt=m,a=Sd(a,"onChange"),0<a.length&&(c=new Du("onChange","change",null,c,m),i.push({event:c,listeners:a}))}var Ol=null,Ll=null;function CA(i){Y_(i,0)}function Lu(i){var a=Lr(i);if(Nl(a))return i}function mv(i,a){if(i==="change")return a}var pv=!1;if(ar){var Hf;if(ar){var Uf="oninput"in document;if(!Uf){var gv=document.createElement("div");gv.setAttribute("oninput","return;"),Uf=typeof gv.oninput=="function"}Hf=Uf}else Hf=!1;pv=Hf&&(!document.documentMode||9<document.documentMode)}function xv(){Ol&&(Ol.detachEvent("onpropertychange",bv),Ll=Ol=null)}function bv(i){if(i.propertyName==="value"&&Lu(Ll)){var a=[];fv(a,Ll,i,ct(i)),Au(CA,a)}}function EA(i,a,c){i==="focusin"?(xv(),Ol=a,Ll=c,Ol.attachEvent("onpropertychange",bv)):i==="focusout"&&xv()}function jA(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Lu(Ll)}function AA(i,a){if(i==="click")return Lu(a)}function TA(i,a){if(i==="input"||i==="change")return Lu(a)}function RA(i,a){return i===a&&(i!==0||1/i===1/a)||i!==i&&a!==a}var Pn=typeof Object.is=="function"?Object.is:RA;function zl(i,a){if(Pn(i,a))return!0;if(typeof i!="object"||i===null||typeof a!="object"||a===null)return!1;var c=Object.keys(i),m=Object.keys(a);if(c.length!==m.length)return!1;for(m=0;m<c.length;m++){var b=c[m];if(!As.call(a,b)||!Pn(i[b],a[b]))return!1}return!0}function vv(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function _v(i,a){var c=vv(i);i=0;for(var m;c;){if(c.nodeType===3){if(m=i+c.textContent.length,i<=a&&m>=a)return{node:c,offset:a-i};i=m}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=vv(c)}}function yv(i,a){return i&&a?i===a?!0:i&&i.nodeType===3?!1:a&&a.nodeType===3?yv(i,a.parentNode):"contains"in i?i.contains(a):i.compareDocumentPosition?!!(i.compareDocumentPosition(a)&16):!1:!1}function wv(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var a=bo(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=bo(i.document)}return a}function Ff(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 MA=ar&&"documentMode"in document&&11>=document.documentMode,wo=null,qf=null,Bl=null,Vf=!1;function Sv(i,a,c){var m=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Vf||wo==null||wo!==bo(m)||(m=wo,"selectionStart"in m&&Ff(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),Bl&&zl(Bl,m)||(Bl=m,m=Sd(qf,"onSelect"),0<m.length&&(a=new Du("onSelect","select",null,a,c),i.push({event:a,listeners:m}),a.target=wo)))}function Aa(i,a){var c={};return c[i.toLowerCase()]=a.toLowerCase(),c["Webkit"+i]="webkit"+a,c["Moz"+i]="moz"+a,c}var So={animationend:Aa("Animation","AnimationEnd"),animationiteration:Aa("Animation","AnimationIteration"),animationstart:Aa("Animation","AnimationStart"),transitionrun:Aa("Transition","TransitionRun"),transitionstart:Aa("Transition","TransitionStart"),transitioncancel:Aa("Transition","TransitionCancel"),transitionend:Aa("Transition","TransitionEnd")},Gf={},kv={};ar&&(kv=document.createElement("div").style,"AnimationEvent"in window||(delete So.animationend.animation,delete So.animationiteration.animation,delete So.animationstart.animation),"TransitionEvent"in window||delete So.transitionend.transition);function Ta(i){if(Gf[i])return Gf[i];if(!So[i])return i;var a=So[i],c;for(c in a)if(a.hasOwnProperty(c)&&c in kv)return Gf[i]=a[c];return i}var Nv=Ta("animationend"),Cv=Ta("animationiteration"),Ev=Ta("animationstart"),DA=Ta("transitionrun"),OA=Ta("transitionstart"),LA=Ta("transitioncancel"),jv=Ta("transitionend"),Av=new Map,Wf="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(" ");Wf.push("scrollEnd");function ki(i,a){Av.set(i,a),ir(a,[i])}var zu=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)},Jn=[],ko=0,Kf=0;function Bu(){for(var i=ko,a=Kf=ko=0;a<i;){var c=Jn[a];Jn[a++]=null;var m=Jn[a];Jn[a++]=null;var b=Jn[a];Jn[a++]=null;var y=Jn[a];if(Jn[a++]=null,m!==null&&b!==null){var E=m.pending;E===null?b.next=b:(b.next=E.next,E.next=b),m.pending=b}y!==0&&Tv(c,b,y)}}function Pu(i,a,c,m){Jn[ko++]=i,Jn[ko++]=a,Jn[ko++]=c,Jn[ko++]=m,Kf|=m,i.lanes|=m,i=i.alternate,i!==null&&(i.lanes|=m)}function Yf(i,a,c,m){return Pu(i,a,c,m),Iu(i)}function Ra(i,a){return Pu(i,null,null,a),Iu(i)}function Tv(i,a,c){i.lanes|=c;var m=i.alternate;m!==null&&(m.lanes|=c);for(var b=!1,y=i.return;y!==null;)y.childLanes|=c,m=y.alternate,m!==null&&(m.childLanes|=c),y.tag===22&&(i=y.stateNode,i===null||i._visibility&1||(b=!0)),i=y,y=y.return;return i.tag===3?(y=i.stateNode,b&&a!==null&&(b=31-M(c),i=y.hiddenUpdates,m=i[b],m===null?i[b]=[a]:m.push(a),a.lane=c|536870912),y):null}function Iu(i){if(50<rc)throw rc=0,ip=null,Error(n(185));for(var a=i.return;a!==null;)i=a,a=i.return;return i.tag===3?i.stateNode:null}var No={};function zA(i,a,c,m){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=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function In(i,a,c,m){return new zA(i,a,c,m)}function Xf(i){return i=i.prototype,!(!i||!i.isReactComponent)}function or(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 Rv(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 $u(i,a,c,m,b,y){var E=0;if(m=i,typeof i=="function")Xf(i)&&(E=1);else if(typeof i=="string")E=HT(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,b),i.elementType=D,i.lanes=y,i;case k:return Ma(c.children,b,y,a);case C:E=8,b|=24;break;case N:return i=In(12,c,a,b|2),i.elementType=N,i.lanes=y,i;case B:return i=In(13,c,a,b),i.elementType=B,i.lanes=y,i;case O:return i=In(19,c,a,b),i.elementType=O,i.lanes=y,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case j:E=10;break e;case T:E=9;break e;case A:E=11;break e;case I:E=14;break e;case R:E=16,m=null;break e}E=29,c=Error(n(130,i===null?"null":typeof i,"")),m=null}return a=In(E,c,a,b),a.elementType=i,a.type=m,a.lanes=y,a}function Ma(i,a,c,m){return i=In(7,i,m,a),i.lanes=c,i}function Zf(i,a,c){return i=In(6,i,null,a),i.lanes=c,i}function Mv(i){var a=In(18,null,null,0);return a.stateNode=i,a}function Qf(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 Dv=new WeakMap;function ei(i,a){if(typeof i=="object"&&i!==null){var c=Dv.get(i);return c!==void 0?c:(a={value:i,source:a,stack:Sn(a)},Dv.set(i,a),a)}return{value:i,source:a,stack:Sn(a)}}var Co=[],Eo=0,Hu=null,Pl=0,ti=[],si=0,$r=null,Li=1,zi="";function lr(i,a){Co[Eo++]=Pl,Co[Eo++]=Hu,Hu=i,Pl=a}function Ov(i,a,c){ti[si++]=Li,ti[si++]=zi,ti[si++]=$r,$r=i;var m=Li;i=zi;var b=32-M(m)-1;m&=~(1<<b),c+=1;var y=32-M(a)+b;if(30<y){var E=b-b%5;y=(m&(1<<E)-1).toString(32),m>>=E,b-=E,Li=1<<32-M(a)+b|c<<b|m,zi=y+i}else Li=1<<y|c<<b|m,zi=i}function Jf(i){i.return!==null&&(lr(i,1),Ov(i,1,0))}function em(i){for(;i===Hu;)Hu=Co[--Eo],Co[Eo]=null,Pl=Co[--Eo],Co[Eo]=null;for(;i===$r;)$r=ti[--si],ti[si]=null,zi=ti[--si],ti[si]=null,Li=ti[--si],ti[si]=null}function Lv(i,a){ti[si++]=Li,ti[si++]=zi,ti[si++]=$r,Li=a.id,zi=a.overflow,$r=i}var Vs=null,Yt=null,kt=!1,Hr=null,ni=!1,tm=Error(n(519));function Ur(i){var a=Error(n(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Il(ei(a,i)),tm}function zv(i){var a=i.stateNode,c=i.type,m=i.memoizedProps;switch(a[fs]=i,a[tn]=m,c){case"dialog":bt("cancel",a),bt("close",a);break;case"iframe":case"object":case"embed":bt("load",a);break;case"video":case"audio":for(c=0;c<oc.length;c++)bt(oc[c],a);break;case"source":bt("error",a);break;case"img":case"image":case"link":bt("error",a),bt("load",a);break;case"details":bt("toggle",a);break;case"input":bt("invalid",a),Ea(a,m.value,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name,!0);break;case"select":bt("invalid",a);break;case"textarea":bt("invalid",a),_o(a,m.value,m.defaultValue,m.children)}c=m.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||a.textContent===""+c||m.suppressHydrationWarning===!0||J_(a.textContent,c)?(m.popover!=null&&(bt("beforetoggle",a),bt("toggle",a)),m.onScroll!=null&&bt("scroll",a),m.onScrollEnd!=null&&bt("scrollend",a),m.onClick!=null&&(a.onclick=Pe),a=!0):a=!1,a||Ur(i,!0)}function Bv(i){for(Vs=i.return;Vs;)switch(Vs.tag){case 5:case 31:case 13:ni=!1;return;case 27:case 3:ni=!0;return;default:Vs=Vs.return}}function jo(i){if(i!==Vs)return!1;if(!kt)return Bv(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")||vp(i.type,i.memoizedProps)),c=!c),c&&Yt&&Ur(i),Bv(i),a===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(n(317));Yt=ly(i)}else if(a===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(n(317));Yt=ly(i)}else a===27?(a=Yt,sa(i.type)?(i=kp,kp=null,Yt=i):Yt=a):Yt=Vs?ri(i.stateNode.nextSibling):null;return!0}function Da(){Yt=Vs=null,kt=!1}function sm(){var i=Hr;return i!==null&&(Tn===null?Tn=i:Tn.push.apply(Tn,i),Hr=null),i}function Il(i){Hr===null?Hr=[i]:Hr.push(i)}var nm=V(null),Oa=null,cr=null;function Fr(i,a,c){Ee(nm,a._currentValue),a._currentValue=c}function ur(i){i._currentValue=nm.current,ie(nm)}function im(i,a,c){for(;i!==null;){var m=i.alternate;if((i.childLanes&a)!==a?(i.childLanes|=a,m!==null&&(m.childLanes|=a)):m!==null&&(m.childLanes&a)!==a&&(m.childLanes|=a),i===c)break;i=i.return}}function rm(i,a,c,m){var b=i.child;for(b!==null&&(b.return=i);b!==null;){var y=b.dependencies;if(y!==null){var E=b.child;y=y.firstContext;e:for(;y!==null;){var z=y;y=b;for(var W=0;W<a.length;W++)if(z.context===a[W]){y.lanes|=c,z=y.alternate,z!==null&&(z.lanes|=c),im(y.return,c,i),m||(E=null);break e}y=z.next}}else if(b.tag===18){if(E=b.return,E===null)throw Error(n(341));E.lanes|=c,y=E.alternate,y!==null&&(y.lanes|=c),im(E,c,i),E=null}else E=b.child;if(E!==null)E.return=b;else for(E=b;E!==null;){if(E===i){E=null;break}if(b=E.sibling,b!==null){b.return=E.return,E=b;break}E=E.return}b=E}}function Ao(i,a,c,m){i=null;for(var b=a,y=!1;b!==null;){if(!y){if((b.flags&524288)!==0)y=!0;else if((b.flags&262144)!==0)break}if(b.tag===10){var E=b.alternate;if(E===null)throw Error(n(387));if(E=E.memoizedProps,E!==null){var z=b.type;Pn(b.pendingProps.value,E.value)||(i!==null?i.push(z):i=[z])}}else if(b===Ne.current){if(E=b.alternate,E===null)throw Error(n(387));E.memoizedState.memoizedState!==b.memoizedState.memoizedState&&(i!==null?i.push(hc):i=[hc])}b=b.return}i!==null&&rm(a,i,c,m),a.flags|=262144}function Uu(i){for(i=i.firstContext;i!==null;){if(!Pn(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function La(i){Oa=i,cr=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function Gs(i){return Pv(Oa,i)}function Fu(i,a){return Oa===null&&La(i),Pv(i,a)}function Pv(i,a){var c=a._currentValue;if(a={context:a,memoizedValue:c,next:null},cr===null){if(i===null)throw Error(n(308));cr=a,i.dependencies={lanes:0,firstContext:a},i.flags|=524288}else cr=cr.next=a;return c}var BA=typeof AbortController<"u"?AbortController:function(){var i=[],a=this.signal={aborted:!1,addEventListener:function(c,m){i.push(m)}};this.abort=function(){a.aborted=!0,i.forEach(function(c){return c()})}},PA=e.unstable_scheduleCallback,IA=e.unstable_NormalPriority,ys={$$typeof:j,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function am(){return{controller:new BA,data:new Map,refCount:0}}function $l(i){i.refCount--,i.refCount===0&&PA(IA,function(){i.controller.abort()})}var Hl=null,om=0,To=0,Ro=null;function $A(i,a){if(Hl===null){var c=Hl=[];om=0,To=up(),Ro={status:"pending",value:void 0,then:function(m){c.push(m)}}}return om++,a.then(Iv,Iv),a}function Iv(){if(--om===0&&Hl!==null){Ro!==null&&(Ro.status="fulfilled");var i=Hl;Hl=null,To=0,Ro=null;for(var a=0;a<i.length;a++)(0,i[a])()}}function HA(i,a){var c=[],m={status:"pending",value:null,reason:null,then:function(b){c.push(b)}};return i.then(function(){m.status="fulfilled",m.value=a;for(var b=0;b<c.length;b++)(0,c[b])(a)},function(b){for(m.status="rejected",m.reason=b,b=0;b<c.length;b++)(0,c[b])(void 0)}),m}var $v=L.S;L.S=function(i,a){S_=St(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&$A(i,a),$v!==null&&$v(i,a)};var za=V(null);function lm(){var i=za.current;return i!==null?i:qt.pooledCache}function qu(i,a){a===null?Ee(za,za.current):Ee(za,a.pool)}function Hv(){var i=lm();return i===null?null:{parent:ys._currentValue,pool:i}}var Mo=Error(n(460)),cm=Error(n(474)),Vu=Error(n(542)),Gu={then:function(){}};function Uv(i){return i=i.status,i==="fulfilled"||i==="rejected"}function Fv(i,a,c){switch(c=i[c],c===void 0?i.push(a):c!==a&&(a.then(Pe,Pe),a=c),a.status){case"fulfilled":return a.value;case"rejected":throw i=a.reason,Vv(i),i;default:if(typeof a.status=="string")a.then(Pe,Pe);else{if(i=qt,i!==null&&100<i.shellSuspendCounter)throw Error(n(482));i=a,i.status="pending",i.then(function(m){if(a.status==="pending"){var b=a;b.status="fulfilled",b.value=m}},function(m){if(a.status==="pending"){var b=a;b.status="rejected",b.reason=m}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw i=a.reason,Vv(i),i}throw Pa=a,Mo}}function Ba(i){try{var a=i._init;return a(i._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(Pa=c,Mo):c}}var Pa=null;function qv(){if(Pa===null)throw Error(n(459));var i=Pa;return Pa=null,i}function Vv(i){if(i===Mo||i===Vu)throw Error(n(483))}var Do=null,Ul=0;function Wu(i){var a=Ul;return Ul+=1,Do===null&&(Do=[]),Fv(Do,i,a)}function Fl(i,a){a=a.props.ref,i.ref=a!==void 0?a:null}function Ku(i,a){throw a.$$typeof===x?Error(n(525)):(i=Object.prototype.toString.call(a),Error(n(31,i==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":i)))}function Gv(i){function a(te,J){if(i){var re=te.deletions;re===null?(te.deletions=[J],te.flags|=16):re.push(J)}}function c(te,J){if(!i)return null;for(;J!==null;)a(te,J),J=J.sibling;return null}function m(te){for(var J=new Map;te!==null;)te.key!==null?J.set(te.key,te):J.set(te.index,te),te=te.sibling;return J}function b(te,J){return te=or(te,J),te.index=0,te.sibling=null,te}function y(te,J,re){return te.index=re,i?(re=te.alternate,re!==null?(re=re.index,re<J?(te.flags|=67108866,J):re):(te.flags|=67108866,J)):(te.flags|=1048576,J)}function E(te){return i&&te.alternate===null&&(te.flags|=67108866),te}function z(te,J,re,ve){return J===null||J.tag!==6?(J=Zf(re,te.mode,ve),J.return=te,J):(J=b(J,re),J.return=te,J)}function W(te,J,re,ve){var st=re.type;return st===k?ge(te,J,re.props.children,ve,re.key):J!==null&&(J.elementType===st||typeof st=="object"&&st!==null&&st.$$typeof===R&&Ba(st)===J.type)?(J=b(J,re.props),Fl(J,re),J.return=te,J):(J=$u(re.type,re.key,re.props,null,te.mode,ve),Fl(J,re),J.return=te,J)}function ae(te,J,re,ve){return J===null||J.tag!==4||J.stateNode.containerInfo!==re.containerInfo||J.stateNode.implementation!==re.implementation?(J=Qf(re,te.mode,ve),J.return=te,J):(J=b(J,re.children||[]),J.return=te,J)}function ge(te,J,re,ve,st){return J===null||J.tag!==7?(J=Ma(re,te.mode,ve,st),J.return=te,J):(J=b(J,re),J.return=te,J)}function we(te,J,re){if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return J=Zf(""+J,te.mode,re),J.return=te,J;if(typeof J=="object"&&J!==null){switch(J.$$typeof){case v:return re=$u(J.type,J.key,J.props,null,te.mode,re),Fl(re,J),re.return=te,re;case w:return J=Qf(J,te.mode,re),J.return=te,J;case R:return J=Ba(J),we(te,J,re)}if(F(J)||Z(J))return J=Ma(J,te.mode,re,null),J.return=te,J;if(typeof J.then=="function")return we(te,Wu(J),re);if(J.$$typeof===j)return we(te,Fu(te,J),re);Ku(te,J)}return null}function le(te,J,re,ve){var st=J!==null?J.key:null;if(typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint")return st!==null?null:z(te,J,""+re,ve);if(typeof re=="object"&&re!==null){switch(re.$$typeof){case v:return re.key===st?W(te,J,re,ve):null;case w:return re.key===st?ae(te,J,re,ve):null;case R:return re=Ba(re),le(te,J,re,ve)}if(F(re)||Z(re))return st!==null?null:ge(te,J,re,ve,null);if(typeof re.then=="function")return le(te,J,Wu(re),ve);if(re.$$typeof===j)return le(te,J,Fu(te,re),ve);Ku(te,re)}return null}function he(te,J,re,ve,st){if(typeof ve=="string"&&ve!==""||typeof ve=="number"||typeof ve=="bigint")return te=te.get(re)||null,z(J,te,""+ve,st);if(typeof ve=="object"&&ve!==null){switch(ve.$$typeof){case v:return te=te.get(ve.key===null?re:ve.key)||null,W(J,te,ve,st);case w:return te=te.get(ve.key===null?re:ve.key)||null,ae(J,te,ve,st);case R:return ve=Ba(ve),he(te,J,re,ve,st)}if(F(ve)||Z(ve))return te=te.get(re)||null,ge(J,te,ve,st,null);if(typeof ve.then=="function")return he(te,J,re,Wu(ve),st);if(ve.$$typeof===j)return he(te,J,re,Fu(J,ve),st);Ku(J,ve)}return null}function Ke(te,J,re,ve){for(var st=null,jt=null,Je=J,dt=J=0,yt=null;Je!==null&&dt<re.length;dt++){Je.index>dt?(yt=Je,Je=null):yt=Je.sibling;var At=le(te,Je,re[dt],ve);if(At===null){Je===null&&(Je=yt);break}i&&Je&&At.alternate===null&&a(te,Je),J=y(At,J,dt),jt===null?st=At:jt.sibling=At,jt=At,Je=yt}if(dt===re.length)return c(te,Je),kt&&lr(te,dt),st;if(Je===null){for(;dt<re.length;dt++)Je=we(te,re[dt],ve),Je!==null&&(J=y(Je,J,dt),jt===null?st=Je:jt.sibling=Je,jt=Je);return kt&&lr(te,dt),st}for(Je=m(Je);dt<re.length;dt++)yt=he(Je,te,dt,re[dt],ve),yt!==null&&(i&&yt.alternate!==null&&Je.delete(yt.key===null?dt:yt.key),J=y(yt,J,dt),jt===null?st=yt:jt.sibling=yt,jt=yt);return i&&Je.forEach(function(oa){return a(te,oa)}),kt&&lr(te,dt),st}function nt(te,J,re,ve){if(re==null)throw Error(n(151));for(var st=null,jt=null,Je=J,dt=J=0,yt=null,At=re.next();Je!==null&&!At.done;dt++,At=re.next()){Je.index>dt?(yt=Je,Je=null):yt=Je.sibling;var oa=le(te,Je,At.value,ve);if(oa===null){Je===null&&(Je=yt);break}i&&Je&&oa.alternate===null&&a(te,Je),J=y(oa,J,dt),jt===null?st=oa:jt.sibling=oa,jt=oa,Je=yt}if(At.done)return c(te,Je),kt&&lr(te,dt),st;if(Je===null){for(;!At.done;dt++,At=re.next())At=we(te,At.value,ve),At!==null&&(J=y(At,J,dt),jt===null?st=At:jt.sibling=At,jt=At);return kt&&lr(te,dt),st}for(Je=m(Je);!At.done;dt++,At=re.next())At=he(Je,te,dt,At.value,ve),At!==null&&(i&&At.alternate!==null&&Je.delete(At.key===null?dt:At.key),J=y(At,J,dt),jt===null?st=At:jt.sibling=At,jt=At);return i&&Je.forEach(function(QT){return a(te,QT)}),kt&&lr(te,dt),st}function Ht(te,J,re,ve){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;J!==null;){if(J.key===st){if(st=re.type,st===k){if(J.tag===7){c(te,J.sibling),ve=b(J,re.props.children),ve.return=te,te=ve;break e}}else if(J.elementType===st||typeof st=="object"&&st!==null&&st.$$typeof===R&&Ba(st)===J.type){c(te,J.sibling),ve=b(J,re.props),Fl(ve,re),ve.return=te,te=ve;break e}c(te,J);break}else a(te,J);J=J.sibling}re.type===k?(ve=Ma(re.props.children,te.mode,ve,re.key),ve.return=te,te=ve):(ve=$u(re.type,re.key,re.props,null,te.mode,ve),Fl(ve,re),ve.return=te,te=ve)}return E(te);case w:e:{for(st=re.key;J!==null;){if(J.key===st)if(J.tag===4&&J.stateNode.containerInfo===re.containerInfo&&J.stateNode.implementation===re.implementation){c(te,J.sibling),ve=b(J,re.children||[]),ve.return=te,te=ve;break e}else{c(te,J);break}else a(te,J);J=J.sibling}ve=Qf(re,te.mode,ve),ve.return=te,te=ve}return E(te);case R:return re=Ba(re),Ht(te,J,re,ve)}if(F(re))return Ke(te,J,re,ve);if(Z(re)){if(st=Z(re),typeof st!="function")throw Error(n(150));return re=st.call(re),nt(te,J,re,ve)}if(typeof re.then=="function")return Ht(te,J,Wu(re),ve);if(re.$$typeof===j)return Ht(te,J,Fu(te,re),ve);Ku(te,re)}return typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint"?(re=""+re,J!==null&&J.tag===6?(c(te,J.sibling),ve=b(J,re),ve.return=te,te=ve):(c(te,J),ve=Zf(re,te.mode,ve),ve.return=te,te=ve),E(te)):c(te,J)}return function(te,J,re,ve){try{Ul=0;var st=Ht(te,J,re,ve);return Do=null,st}catch(Je){if(Je===Mo||Je===Vu)throw Je;var jt=In(29,Je,null,te.mode);return jt.lanes=ve,jt.return=te,jt}}}var Ia=Gv(!0),Wv=Gv(!1),qr=!1;function um(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function dm(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 Vr(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function Gr(i,a,c){var m=i.updateQueue;if(m===null)return null;if(m=m.shared,(Tt&2)!==0){var b=m.pending;return b===null?a.next=a:(a.next=b.next,b.next=a),m.pending=a,a=Iu(i),Tv(i,null,c),a}return Pu(i,m,a,c),Iu(i)}function ql(i,a,c){if(a=a.updateQueue,a!==null&&(a=a.shared,(c&4194048)!==0)){var m=a.lanes;m&=i.pendingLanes,c|=m,a.lanes=c,at(i,c)}}function hm(i,a){var c=i.updateQueue,m=i.alternate;if(m!==null&&(m=m.updateQueue,c===m)){var b=null,y=null;if(c=c.firstBaseUpdate,c!==null){do{var E={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};y===null?b=y=E:y=y.next=E,c=c.next}while(c!==null);y===null?b=y=a:y=y.next=a}else b=y=a;c={baseState:m.baseState,firstBaseUpdate:b,lastBaseUpdate:y,shared:m.shared,callbacks:m.callbacks},i.updateQueue=c;return}i=c.lastBaseUpdate,i===null?c.firstBaseUpdate=a:i.next=a,c.lastBaseUpdate=a}var fm=!1;function Vl(){if(fm){var i=Ro;if(i!==null)throw i}}function Gl(i,a,c,m){fm=!1;var b=i.updateQueue;qr=!1;var y=b.firstBaseUpdate,E=b.lastBaseUpdate,z=b.shared.pending;if(z!==null){b.shared.pending=null;var W=z,ae=W.next;W.next=null,E===null?y=ae:E.next=ae,E=W;var ge=i.alternate;ge!==null&&(ge=ge.updateQueue,z=ge.lastBaseUpdate,z!==E&&(z===null?ge.firstBaseUpdate=ae:z.next=ae,ge.lastBaseUpdate=W))}if(y!==null){var we=b.baseState;E=0,ge=ae=W=null,z=y;do{var le=z.lane&-536870913,he=le!==z.lane;if(he?(_t&le)===le:(m&le)===le){le!==0&&le===To&&(fm=!0),ge!==null&&(ge=ge.next={lane:0,tag:z.tag,payload:z.payload,callback:null,next:null});e:{var Ke=i,nt=z;le=a;var Ht=c;switch(nt.tag){case 1:if(Ke=nt.payload,typeof Ke=="function"){we=Ke.call(Ht,we,le);break e}we=Ke;break e;case 3:Ke.flags=Ke.flags&-65537|128;case 0:if(Ke=nt.payload,le=typeof Ke=="function"?Ke.call(Ht,we,le):Ke,le==null)break e;we=g({},we,le);break e;case 2:qr=!0}}le=z.callback,le!==null&&(i.flags|=64,he&&(i.flags|=8192),he=b.callbacks,he===null?b.callbacks=[le]:he.push(le))}else he={lane:le,tag:z.tag,payload:z.payload,callback:z.callback,next:null},ge===null?(ae=ge=he,W=we):ge=ge.next=he,E|=le;if(z=z.next,z===null){if(z=b.shared.pending,z===null)break;he=z,z=he.next,he.next=null,b.lastBaseUpdate=he,b.shared.pending=null}}while(!0);ge===null&&(W=we),b.baseState=W,b.firstBaseUpdate=ae,b.lastBaseUpdate=ge,y===null&&(b.shared.lanes=0),Zr|=E,i.lanes=E,i.memoizedState=we}}function Kv(i,a){if(typeof i!="function")throw Error(n(191,i));i.call(a)}function Yv(i,a){var c=i.callbacks;if(c!==null)for(i.callbacks=null,i=0;i<c.length;i++)Kv(c[i],a)}var Oo=V(null),Yu=V(0);function Xv(i,a){i=vr,Ee(Yu,i),Ee(Oo,a),vr=i|a.baseLanes}function mm(){Ee(Yu,vr),Ee(Oo,Oo.current)}function pm(){vr=Yu.current,ie(Oo),ie(Yu)}var $n=V(null),ii=null;function Wr(i){var a=i.alternate;Ee(ps,ps.current&1),Ee($n,i),ii===null&&(a===null||Oo.current!==null||a.memoizedState!==null)&&(ii=i)}function gm(i){Ee(ps,ps.current),Ee($n,i),ii===null&&(ii=i)}function Zv(i){i.tag===22?(Ee(ps,ps.current),Ee($n,i),ii===null&&(ii=i)):Kr()}function Kr(){Ee(ps,ps.current),Ee($n,$n.current)}function Hn(i){ie($n),ii===i&&(ii=null),ie(ps)}var ps=V(0);function Xu(i){for(var a=i;a!==null;){if(a.tag===13){var c=a.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||wp(c)||Sp(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 dr=0,ut=null,It=null,ws=null,Zu=!1,Lo=!1,$a=!1,Qu=0,Wl=0,zo=null,UA=0;function as(){throw Error(n(321))}function xm(i,a){if(a===null)return!1;for(var c=0;c<a.length&&c<i.length;c++)if(!Pn(i[c],a[c]))return!1;return!0}function bm(i,a,c,m,b,y){return dr=y,ut=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,L.H=i===null||i.memoizedState===null?O1:Dm,$a=!1,y=c(m,b),$a=!1,Lo&&(y=Jv(a,c,m,b)),Qv(i),y}function Qv(i){L.H=Xl;var a=It!==null&&It.next!==null;if(dr=0,ws=It=ut=null,Zu=!1,Wl=0,zo=null,a)throw Error(n(300));i===null||Ss||(i=i.dependencies,i!==null&&Uu(i)&&(Ss=!0))}function Jv(i,a,c,m){ut=i;var b=0;do{if(Lo&&(zo=null),Wl=0,Lo=!1,25<=b)throw Error(n(301));if(b+=1,ws=It=null,i.updateQueue!=null){var y=i.updateQueue;y.lastEffect=null,y.events=null,y.stores=null,y.memoCache!=null&&(y.memoCache.index=0)}L.H=L1,y=a(c,m)}while(Lo);return y}function FA(){var i=L.H,a=i.useState()[0];return a=typeof a.then=="function"?Kl(a):a,i=i.useState()[0],(It!==null?It.memoizedState:null)!==i&&(ut.flags|=1024),a}function vm(){var i=Qu!==0;return Qu=0,i}function _m(i,a,c){a.updateQueue=i.updateQueue,a.flags&=-2053,i.lanes&=~c}function ym(i){if(Zu){for(i=i.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}Zu=!1}dr=0,ws=It=ut=null,Lo=!1,Wl=Qu=0,zo=null}function hn(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ws===null?ut.memoizedState=ws=i:ws=ws.next=i,ws}function gs(){if(It===null){var i=ut.alternate;i=i!==null?i.memoizedState:null}else i=It.next;var a=ws===null?ut.memoizedState:ws.next;if(a!==null)ws=a,It=i;else{if(i===null)throw ut.alternate===null?Error(n(467)):Error(n(310));It=i,i={memoizedState:It.memoizedState,baseState:It.baseState,baseQueue:It.baseQueue,queue:It.queue,next:null},ws===null?ut.memoizedState=ws=i:ws=ws.next=i}return ws}function Ju(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Kl(i){var a=Wl;return Wl+=1,zo===null&&(zo=[]),i=Fv(zo,i,a),a=ut,(ws===null?a.memoizedState:ws.next)===null&&(a=a.alternate,L.H=a===null||a.memoizedState===null?O1:Dm),i}function ed(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return Kl(i);if(i.$$typeof===j)return Gs(i)}throw Error(n(438,String(i)))}function wm(i){var a=null,c=ut.updateQueue;if(c!==null&&(a=c.memoCache),a==null){var m=ut.alternate;m!==null&&(m=m.updateQueue,m!==null&&(m=m.memoCache,m!=null&&(a={data:m.data.map(function(b){return b.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),c===null&&(c=Ju(),ut.updateQueue=c),c.memoCache=a,c=a.data[a.index],c===void 0)for(c=a.data[a.index]=Array(i),m=0;m<i;m++)c[m]=P;return a.index++,c}function hr(i,a){return typeof a=="function"?a(i):a}function td(i){var a=gs();return Sm(a,It,i)}function Sm(i,a,c){var m=i.queue;if(m===null)throw Error(n(311));m.lastRenderedReducer=c;var b=i.baseQueue,y=m.pending;if(y!==null){if(b!==null){var E=b.next;b.next=y.next,y.next=E}a.baseQueue=b=y,m.pending=null}if(y=i.baseState,b===null)i.memoizedState=y;else{a=b.next;var z=E=null,W=null,ae=a,ge=!1;do{var we=ae.lane&-536870913;if(we!==ae.lane?(_t&we)===we:(dr&we)===we){var le=ae.revertLane;if(le===0)W!==null&&(W=W.next={lane:0,revertLane:0,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null}),we===To&&(ge=!0);else if((dr&le)===le){ae=ae.next,le===To&&(ge=!0);continue}else we={lane:0,revertLane:ae.revertLane,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},W===null?(z=W=we,E=y):W=W.next=we,ut.lanes|=le,Zr|=le;we=ae.action,$a&&c(y,we),y=ae.hasEagerState?ae.eagerState:c(y,we)}else le={lane:we,revertLane:ae.revertLane,gesture:ae.gesture,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},W===null?(z=W=le,E=y):W=W.next=le,ut.lanes|=we,Zr|=we;ae=ae.next}while(ae!==null&&ae!==a);if(W===null?E=y:W.next=z,!Pn(y,i.memoizedState)&&(Ss=!0,ge&&(c=Ro,c!==null)))throw c;i.memoizedState=y,i.baseState=E,i.baseQueue=W,m.lastRenderedState=y}return b===null&&(m.lanes=0),[i.memoizedState,m.dispatch]}function km(i){var a=gs(),c=a.queue;if(c===null)throw Error(n(311));c.lastRenderedReducer=i;var m=c.dispatch,b=c.pending,y=a.memoizedState;if(b!==null){c.pending=null;var E=b=b.next;do y=i(y,E.action),E=E.next;while(E!==b);Pn(y,a.memoizedState)||(Ss=!0),a.memoizedState=y,a.baseQueue===null&&(a.baseState=y),c.lastRenderedState=y}return[y,m]}function e1(i,a,c){var m=ut,b=gs(),y=kt;if(y){if(c===void 0)throw Error(n(407));c=c()}else c=a();var E=!Pn((It||b).memoizedState,c);if(E&&(b.memoizedState=c,Ss=!0),b=b.queue,Em(n1.bind(null,m,b,i),[i]),b.getSnapshot!==a||E||ws!==null&&ws.memoizedState.tag&1){if(m.flags|=2048,Bo(9,{destroy:void 0},s1.bind(null,m,b,c,a),null),qt===null)throw Error(n(349));y||(dr&127)!==0||t1(m,a,c)}return c}function t1(i,a,c){i.flags|=16384,i={getSnapshot:a,value:c},a=ut.updateQueue,a===null?(a=Ju(),ut.updateQueue=a,a.stores=[i]):(c=a.stores,c===null?a.stores=[i]:c.push(i))}function s1(i,a,c,m){a.value=c,a.getSnapshot=m,i1(a)&&r1(i)}function n1(i,a,c){return c(function(){i1(a)&&r1(i)})}function i1(i){var a=i.getSnapshot;i=i.value;try{var c=a();return!Pn(i,c)}catch{return!0}}function r1(i){var a=Ra(i,2);a!==null&&Rn(a,i,2)}function Nm(i){var a=hn();if(typeof i=="function"){var c=i;if(i=c(),$a){Ae(!0);try{c()}finally{Ae(!1)}}}return a.memoizedState=a.baseState=i,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:hr,lastRenderedState:i},a}function a1(i,a,c,m){return i.baseState=c,Sm(i,It,typeof m=="function"?m:hr)}function qA(i,a,c,m,b){if(id(i))throw Error(n(485));if(i=a.action,i!==null){var y={payload:b,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(E){y.listeners.push(E)}};L.T!==null?c(!0):y.isTransition=!1,m(y),c=a.pending,c===null?(y.next=a.pending=y,o1(a,y)):(y.next=c.next,a.pending=c.next=y)}}function o1(i,a){var c=a.action,m=a.payload,b=i.state;if(a.isTransition){var y=L.T,E={};L.T=E;try{var z=c(b,m),W=L.S;W!==null&&W(E,z),l1(i,a,z)}catch(ae){Cm(i,a,ae)}finally{y!==null&&E.types!==null&&(y.types=E.types),L.T=y}}else try{y=c(b,m),l1(i,a,y)}catch(ae){Cm(i,a,ae)}}function l1(i,a,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(m){c1(i,a,m)},function(m){return Cm(i,a,m)}):c1(i,a,c)}function c1(i,a,c){a.status="fulfilled",a.value=c,u1(a),i.state=c,a=i.pending,a!==null&&(c=a.next,c===a?i.pending=null:(c=c.next,a.next=c,o1(i,c)))}function Cm(i,a,c){var m=i.pending;if(i.pending=null,m!==null){m=m.next;do a.status="rejected",a.reason=c,u1(a),a=a.next;while(a!==m)}i.action=null}function u1(i){i=i.listeners;for(var a=0;a<i.length;a++)(0,i[a])()}function d1(i,a){return a}function h1(i,a){if(kt){var c=qt.formState;if(c!==null){e:{var m=ut;if(kt){if(Yt){t:{for(var b=Yt,y=ni;b.nodeType!==8;){if(!y){b=null;break t}if(b=ri(b.nextSibling),b===null){b=null;break t}}y=b.data,b=y==="F!"||y==="F"?b:null}if(b){Yt=ri(b.nextSibling),m=b.data==="F!";break e}}Ur(m)}m=!1}m&&(a=c[0])}}return c=hn(),c.memoizedState=c.baseState=a,m={pending:null,lanes:0,dispatch:null,lastRenderedReducer:d1,lastRenderedState:a},c.queue=m,c=R1.bind(null,ut,m),m.dispatch=c,m=Nm(!1),y=Mm.bind(null,ut,!1,m.queue),m=hn(),b={state:a,dispatch:null,action:i,pending:null},m.queue=b,c=qA.bind(null,ut,b,y,c),b.dispatch=c,m.memoizedState=i,[a,c,!1]}function f1(i){var a=gs();return m1(a,It,i)}function m1(i,a,c){if(a=Sm(i,a,d1)[0],i=td(hr)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var m=Kl(a)}catch(E){throw E===Mo?Vu:E}else m=a;a=gs();var b=a.queue,y=b.dispatch;return c!==a.memoizedState&&(ut.flags|=2048,Bo(9,{destroy:void 0},VA.bind(null,b,c),null)),[m,y,i]}function VA(i,a){i.action=a}function p1(i){var a=gs(),c=It;if(c!==null)return m1(a,c,i);gs(),a=a.memoizedState,c=gs();var m=c.queue.dispatch;return c.memoizedState=i,[a,m,!1]}function Bo(i,a,c,m){return i={tag:i,create:c,deps:m,inst:a,next:null},a=ut.updateQueue,a===null&&(a=Ju(),ut.updateQueue=a),c=a.lastEffect,c===null?a.lastEffect=i.next=i:(m=c.next,c.next=i,i.next=m,a.lastEffect=i),i}function g1(){return gs().memoizedState}function sd(i,a,c,m){var b=hn();ut.flags|=i,b.memoizedState=Bo(1|a,{destroy:void 0},c,m===void 0?null:m)}function nd(i,a,c,m){var b=gs();m=m===void 0?null:m;var y=b.memoizedState.inst;It!==null&&m!==null&&xm(m,It.memoizedState.deps)?b.memoizedState=Bo(a,y,c,m):(ut.flags|=i,b.memoizedState=Bo(1|a,y,c,m))}function x1(i,a){sd(8390656,8,i,a)}function Em(i,a){nd(2048,8,i,a)}function GA(i){ut.flags|=4;var a=ut.updateQueue;if(a===null)a=Ju(),ut.updateQueue=a,a.events=[i];else{var c=a.events;c===null?a.events=[i]:c.push(i)}}function b1(i){var a=gs().memoizedState;return GA({ref:a,nextImpl:i}),function(){if((Tt&2)!==0)throw Error(n(440));return a.impl.apply(void 0,arguments)}}function v1(i,a){return nd(4,2,i,a)}function _1(i,a){return nd(4,4,i,a)}function y1(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 w1(i,a,c){c=c!=null?c.concat([i]):null,nd(4,4,y1.bind(null,a,i),c)}function jm(){}function S1(i,a){var c=gs();a=a===void 0?null:a;var m=c.memoizedState;return a!==null&&xm(a,m[1])?m[0]:(c.memoizedState=[i,a],i)}function k1(i,a){var c=gs();a=a===void 0?null:a;var m=c.memoizedState;if(a!==null&&xm(a,m[1]))return m[0];if(m=i(),$a){Ae(!0);try{i()}finally{Ae(!1)}}return c.memoizedState=[m,a],m}function Am(i,a,c){return c===void 0||(dr&1073741824)!==0&&(_t&261930)===0?i.memoizedState=a:(i.memoizedState=c,i=N_(),ut.lanes|=i,Zr|=i,c)}function N1(i,a,c,m){return Pn(c,a)?c:Oo.current!==null?(i=Am(i,c,m),Pn(i,a)||(Ss=!0),i):(dr&42)===0||(dr&1073741824)!==0&&(_t&261930)===0?(Ss=!0,i.memoizedState=c):(i=N_(),ut.lanes|=i,Zr|=i,a)}function C1(i,a,c,m,b){var y=X.p;X.p=y!==0&&8>y?y:8;var E=L.T,z={};L.T=z,Mm(i,!1,a,c);try{var W=b(),ae=L.S;if(ae!==null&&ae(z,W),W!==null&&typeof W=="object"&&typeof W.then=="function"){var ge=HA(W,m);Yl(i,a,ge,qn(i))}else Yl(i,a,m,qn(i))}catch(we){Yl(i,a,{then:function(){},status:"rejected",reason:we},qn())}finally{X.p=y,E!==null&&z.types!==null&&(E.types=z.types),L.T=E}}function WA(){}function Tm(i,a,c,m){if(i.tag!==5)throw Error(n(476));var b=E1(i).queue;C1(i,b,a,U,c===null?WA:function(){return j1(i),c(m)})}function E1(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:hr,lastRenderedState:U},next:null};var c={};return a.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:hr,lastRenderedState:c},next:null},i.memoizedState=a,i=i.alternate,i!==null&&(i.memoizedState=a),a}function j1(i){var a=E1(i);a.next===null&&(a=i.alternate.memoizedState),Yl(i,a.next.queue,{},qn())}function Rm(){return Gs(hc)}function A1(){return gs().memoizedState}function T1(){return gs().memoizedState}function KA(i){for(var a=i.return;a!==null;){switch(a.tag){case 24:case 3:var c=qn();i=Vr(c);var m=Gr(a,i,c);m!==null&&(Rn(m,a,c),ql(m,a,c)),a={cache:am()},i.payload=a;return}a=a.return}}function YA(i,a,c){var m=qn();c={lane:m,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},id(i)?M1(a,c):(c=Yf(i,a,c,m),c!==null&&(Rn(c,i,m),D1(c,a,m)))}function R1(i,a,c){var m=qn();Yl(i,a,c,m)}function Yl(i,a,c,m){var b={lane:m,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(id(i))M1(a,b);else{var y=i.alternate;if(i.lanes===0&&(y===null||y.lanes===0)&&(y=a.lastRenderedReducer,y!==null))try{var E=a.lastRenderedState,z=y(E,c);if(b.hasEagerState=!0,b.eagerState=z,Pn(z,E))return Pu(i,a,b,0),qt===null&&Bu(),!1}catch{}if(c=Yf(i,a,b,m),c!==null)return Rn(c,i,m),D1(c,a,m),!0}return!1}function Mm(i,a,c,m){if(m={lane:2,revertLane:up(),gesture:null,action:m,hasEagerState:!1,eagerState:null,next:null},id(i)){if(a)throw Error(n(479))}else a=Yf(i,c,m,2),a!==null&&Rn(a,i,2)}function id(i){var a=i.alternate;return i===ut||a!==null&&a===ut}function M1(i,a){Lo=Zu=!0;var c=i.pending;c===null?a.next=a:(a.next=c.next,c.next=a),i.pending=a}function D1(i,a,c){if((c&4194048)!==0){var m=a.lanes;m&=i.pendingLanes,c|=m,a.lanes=c,at(i,c)}}var Xl={readContext:Gs,use:ed,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};Xl.useEffectEvent=as;var O1={readContext:Gs,use:ed,useCallback:function(i,a){return hn().memoizedState=[i,a===void 0?null:a],i},useContext:Gs,useEffect:x1,useImperativeHandle:function(i,a,c){c=c!=null?c.concat([i]):null,sd(4194308,4,y1.bind(null,a,i),c)},useLayoutEffect:function(i,a){return sd(4194308,4,i,a)},useInsertionEffect:function(i,a){sd(4,2,i,a)},useMemo:function(i,a){var c=hn();a=a===void 0?null:a;var m=i();if($a){Ae(!0);try{i()}finally{Ae(!1)}}return c.memoizedState=[m,a],m},useReducer:function(i,a,c){var m=hn();if(c!==void 0){var b=c(a);if($a){Ae(!0);try{c(a)}finally{Ae(!1)}}}else b=a;return m.memoizedState=m.baseState=b,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:b},m.queue=i,i=i.dispatch=YA.bind(null,ut,i),[m.memoizedState,i]},useRef:function(i){var a=hn();return i={current:i},a.memoizedState=i},useState:function(i){i=Nm(i);var a=i.queue,c=R1.bind(null,ut,a);return a.dispatch=c,[i.memoizedState,c]},useDebugValue:jm,useDeferredValue:function(i,a){var c=hn();return Am(c,i,a)},useTransition:function(){var i=Nm(!1);return i=C1.bind(null,ut,i.queue,!0,!1),hn().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,a,c){var m=ut,b=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||t1(m,a,c)}b.memoizedState=c;var y={value:c,getSnapshot:a};return b.queue=y,x1(n1.bind(null,m,y,i),[i]),m.flags|=2048,Bo(9,{destroy:void 0},s1.bind(null,m,y,c,a),null),c},useId:function(){var i=hn(),a=qt.identifierPrefix;if(kt){var c=zi,m=Li;c=(m&~(1<<32-M(m)-1)).toString(32)+c,a="_"+a+"R_"+c,c=Qu++,0<c&&(a+="H"+c.toString(32)),a+="_"}else c=UA++,a="_"+a+"r_"+c.toString(32)+"_";return i.memoizedState=a},useHostTransitionStatus:Rm,useFormState:h1,useActionState:h1,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=Mm.bind(null,ut,!0,c),c.dispatch=a,[i,a]},useMemoCache:wm,useCacheRefresh:function(){return hn().memoizedState=KA.bind(null,ut)},useEffectEvent:function(i){var a=hn(),c={impl:i};return a.memoizedState=c,function(){if((Tt&2)!==0)throw Error(n(440));return c.impl.apply(void 0,arguments)}}},Dm={readContext:Gs,use:ed,useCallback:S1,useContext:Gs,useEffect:Em,useImperativeHandle:w1,useInsertionEffect:v1,useLayoutEffect:_1,useMemo:k1,useReducer:td,useRef:g1,useState:function(){return td(hr)},useDebugValue:jm,useDeferredValue:function(i,a){var c=gs();return N1(c,It.memoizedState,i,a)},useTransition:function(){var i=td(hr)[0],a=gs().memoizedState;return[typeof i=="boolean"?i:Kl(i),a]},useSyncExternalStore:e1,useId:A1,useHostTransitionStatus:Rm,useFormState:f1,useActionState:f1,useOptimistic:function(i,a){var c=gs();return a1(c,It,i,a)},useMemoCache:wm,useCacheRefresh:T1};Dm.useEffectEvent=b1;var L1={readContext:Gs,use:ed,useCallback:S1,useContext:Gs,useEffect:Em,useImperativeHandle:w1,useInsertionEffect:v1,useLayoutEffect:_1,useMemo:k1,useReducer:km,useRef:g1,useState:function(){return km(hr)},useDebugValue:jm,useDeferredValue:function(i,a){var c=gs();return It===null?Am(c,i,a):N1(c,It.memoizedState,i,a)},useTransition:function(){var i=km(hr)[0],a=gs().memoizedState;return[typeof i=="boolean"?i:Kl(i),a]},useSyncExternalStore:e1,useId:A1,useHostTransitionStatus:Rm,useFormState:p1,useActionState:p1,useOptimistic:function(i,a){var c=gs();return It!==null?a1(c,It,i,a):(c.baseState=i,[i,c.queue.dispatch])},useMemoCache:wm,useCacheRefresh:T1};L1.useEffectEvent=b1;function Om(i,a,c,m){a=i.memoizedState,c=c(m,a),c=c==null?a:g({},a,c),i.memoizedState=c,i.lanes===0&&(i.updateQueue.baseState=c)}var Lm={enqueueSetState:function(i,a,c){i=i._reactInternals;var m=qn(),b=Vr(m);b.payload=a,c!=null&&(b.callback=c),a=Gr(i,b,m),a!==null&&(Rn(a,i,m),ql(a,i,m))},enqueueReplaceState:function(i,a,c){i=i._reactInternals;var m=qn(),b=Vr(m);b.tag=1,b.payload=a,c!=null&&(b.callback=c),a=Gr(i,b,m),a!==null&&(Rn(a,i,m),ql(a,i,m))},enqueueForceUpdate:function(i,a){i=i._reactInternals;var c=qn(),m=Vr(c);m.tag=2,a!=null&&(m.callback=a),a=Gr(i,m,c),a!==null&&(Rn(a,i,c),ql(a,i,c))}};function z1(i,a,c,m,b,y,E){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(m,y,E):a.prototype&&a.prototype.isPureReactComponent?!zl(c,m)||!zl(b,y):!0}function B1(i,a,c,m){i=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(c,m),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(c,m),a.state!==i&&Lm.enqueueReplaceState(a,a.state,null)}function Ha(i,a){var c=a;if("ref"in a){c={};for(var m in a)m!=="ref"&&(c[m]=a[m])}if(i=i.defaultProps){c===a&&(c=g({},c));for(var b in i)c[b]===void 0&&(c[b]=i[b])}return c}function P1(i){zu(i)}function I1(i){console.error(i)}function $1(i){zu(i)}function rd(i,a){try{var c=i.onUncaughtError;c(a.value,{componentStack:a.stack})}catch(m){setTimeout(function(){throw m})}}function H1(i,a,c){try{var m=i.onCaughtError;m(c.value,{componentStack:c.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(b){setTimeout(function(){throw b})}}function zm(i,a,c){return c=Vr(c),c.tag=3,c.payload={element:null},c.callback=function(){rd(i,a)},c}function U1(i){return i=Vr(i),i.tag=3,i}function F1(i,a,c,m){var b=c.type.getDerivedStateFromError;if(typeof b=="function"){var y=m.value;i.payload=function(){return b(y)},i.callback=function(){H1(a,c,m)}}var E=c.stateNode;E!==null&&typeof E.componentDidCatch=="function"&&(i.callback=function(){H1(a,c,m),typeof b!="function"&&(Qr===null?Qr=new Set([this]):Qr.add(this));var z=m.stack;this.componentDidCatch(m.value,{componentStack:z!==null?z:""})})}function XA(i,a,c,m,b){if(c.flags|=32768,m!==null&&typeof m=="object"&&typeof m.then=="function"){if(a=c.alternate,a!==null&&Ao(a,c,b,!0),c=$n.current,c!==null){switch(c.tag){case 31:case 13:return ii===null?xd():c.alternate===null&&os===0&&(os=3),c.flags&=-257,c.flags|=65536,c.lanes=b,m===Gu?c.flags|=16384:(a=c.updateQueue,a===null?c.updateQueue=new Set([m]):a.add(m),op(i,m,b)),!1;case 22:return c.flags|=65536,m===Gu?c.flags|=16384:(a=c.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([m])},c.updateQueue=a):(c=a.retryQueue,c===null?a.retryQueue=new Set([m]):c.add(m)),op(i,m,b)),!1}throw Error(n(435,c.tag))}return op(i,m,b),xd(),!1}if(kt)return a=$n.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=b,m!==tm&&(i=Error(n(422),{cause:m}),Il(ei(i,c)))):(m!==tm&&(a=Error(n(423),{cause:m}),Il(ei(a,c))),i=i.current.alternate,i.flags|=65536,b&=-b,i.lanes|=b,m=ei(m,c),b=zm(i.stateNode,m,b),hm(i,b),os!==4&&(os=2)),!1;var y=Error(n(520),{cause:m});if(y=ei(y,c),ic===null?ic=[y]:ic.push(y),os!==4&&(os=2),a===null)return!0;m=ei(m,c),c=a;do{switch(c.tag){case 3:return c.flags|=65536,i=b&-b,c.lanes|=i,i=zm(c.stateNode,m,i),hm(c,i),!1;case 1:if(a=c.type,y=c.stateNode,(c.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(Qr===null||!Qr.has(y))))return c.flags|=65536,b&=-b,c.lanes|=b,b=U1(b),F1(b,i,c,m),hm(c,b),!1}c=c.return}while(c!==null);return!1}var Bm=Error(n(461)),Ss=!1;function Ws(i,a,c,m){a.child=i===null?Wv(a,null,c,m):Ia(a,i.child,c,m)}function q1(i,a,c,m,b){c=c.render;var y=a.ref;if("ref"in m){var E={};for(var z in m)z!=="ref"&&(E[z]=m[z])}else E=m;return La(a),m=bm(i,a,c,E,y,b),z=vm(),i!==null&&!Ss?(_m(i,a,b),fr(i,a,b)):(kt&&z&&Jf(a),a.flags|=1,Ws(i,a,m,b),a.child)}function V1(i,a,c,m,b){if(i===null){var y=c.type;return typeof y=="function"&&!Xf(y)&&y.defaultProps===void 0&&c.compare===null?(a.tag=15,a.type=y,G1(i,a,y,m,b)):(i=$u(c.type,null,m,a,a.mode,b),i.ref=a.ref,i.return=a,a.child=i)}if(y=i.child,!Vm(i,b)){var E=y.memoizedProps;if(c=c.compare,c=c!==null?c:zl,c(E,m)&&i.ref===a.ref)return fr(i,a,b)}return a.flags|=1,i=or(y,m),i.ref=a.ref,i.return=a,a.child=i}function G1(i,a,c,m,b){if(i!==null){var y=i.memoizedProps;if(zl(y,m)&&i.ref===a.ref)if(Ss=!1,a.pendingProps=m=y,Vm(i,b))(i.flags&131072)!==0&&(Ss=!0);else return a.lanes=i.lanes,fr(i,a,b)}return Pm(i,a,c,m,b)}function W1(i,a,c,m){var b=m.children,y=i!==null?i.memoizedState:null;if(i===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),m.mode==="hidden"){if((a.flags&128)!==0){if(y=y!==null?y.baseLanes|c:c,i!==null){for(m=a.child=i.child,b=0;m!==null;)b=b|m.lanes|m.childLanes,m=m.sibling;m=b&~y}else m=0,a.child=null;return K1(i,a,y,c,m)}if((c&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},i!==null&&qu(a,y!==null?y.cachePool:null),y!==null?Xv(a,y):mm(),Zv(a);else return m=a.lanes=536870912,K1(i,a,y!==null?y.baseLanes|c:c,c,m)}else y!==null?(qu(a,y.cachePool),Xv(a,y),Kr(),a.memoizedState=null):(i!==null&&qu(a,null),mm(),Kr());return Ws(i,a,b,c),a.child}function Zl(i,a){return i!==null&&i.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function K1(i,a,c,m,b){var y=lm();return y=y===null?null:{parent:ys._currentValue,pool:y},a.memoizedState={baseLanes:c,cachePool:y},i!==null&&qu(a,null),mm(),Zv(a),i!==null&&Ao(i,a,m,!0),a.childLanes=b,null}function ad(i,a){return a=ld({mode:a.mode,children:a.children},i.mode),a.ref=i.ref,i.child=a,a.return=i,a}function Y1(i,a,c){return Ia(a,i.child,null,c),i=ad(a,a.pendingProps),i.flags|=2,Hn(a),a.memoizedState=null,i}function ZA(i,a,c){var m=a.pendingProps,b=(a.flags&128)!==0;if(a.flags&=-129,i===null){if(kt){if(m.mode==="hidden")return i=ad(a,m),a.lanes=536870912,Zl(null,i);if(gm(a),(i=Yt)?(i=oy(i,ni),i=i!==null&&i.data==="&"?i:null,i!==null&&(a.memoizedState={dehydrated:i,treeContext:$r!==null?{id:Li,overflow:zi}:null,retryLane:536870912,hydrationErrors:null},c=Mv(i),c.return=a,a.child=c,Vs=a,Yt=null)):i=null,i===null)throw Ur(a);return a.lanes=536870912,null}return ad(a,m)}var y=i.memoizedState;if(y!==null){var E=y.dehydrated;if(gm(a),b)if(a.flags&256)a.flags&=-257,a=Y1(i,a,c);else if(a.memoizedState!==null)a.child=i.child,a.flags|=128,a=null;else throw Error(n(558));else if(Ss||Ao(i,a,c,!1),b=(c&i.childLanes)!==0,Ss||b){if(m=qt,m!==null&&(E=hs(m,c),E!==0&&E!==y.retryLane))throw y.retryLane=E,Ra(i,E),Rn(m,i,E),Bm;xd(),a=Y1(i,a,c)}else i=y.treeContext,Yt=ri(E.nextSibling),Vs=a,kt=!0,Hr=null,ni=!1,i!==null&&Lv(a,i),a=ad(a,m),a.flags|=4096;return a}return i=or(i.child,{mode:m.mode,children:m.children}),i.ref=a.ref,a.child=i,i.return=a,i}function od(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 Pm(i,a,c,m,b){return La(a),c=bm(i,a,c,m,void 0,b),m=vm(),i!==null&&!Ss?(_m(i,a,b),fr(i,a,b)):(kt&&m&&Jf(a),a.flags|=1,Ws(i,a,c,b),a.child)}function X1(i,a,c,m,b,y){return La(a),a.updateQueue=null,c=Jv(a,m,c,b),Qv(i),m=vm(),i!==null&&!Ss?(_m(i,a,y),fr(i,a,y)):(kt&&m&&Jf(a),a.flags|=1,Ws(i,a,c,y),a.child)}function Z1(i,a,c,m,b){if(La(a),a.stateNode===null){var y=No,E=c.contextType;typeof E=="object"&&E!==null&&(y=Gs(E)),y=new c(m,y),a.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=Lm,a.stateNode=y,y._reactInternals=a,y=a.stateNode,y.props=m,y.state=a.memoizedState,y.refs={},um(a),E=c.contextType,y.context=typeof E=="object"&&E!==null?Gs(E):No,y.state=a.memoizedState,E=c.getDerivedStateFromProps,typeof E=="function"&&(Om(a,c,E,m),y.state=a.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(E=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),E!==y.state&&Lm.enqueueReplaceState(y,y.state,null),Gl(a,m,y,b),Vl(),y.state=a.memoizedState),typeof y.componentDidMount=="function"&&(a.flags|=4194308),m=!0}else if(i===null){y=a.stateNode;var z=a.memoizedProps,W=Ha(c,z);y.props=W;var ae=y.context,ge=c.contextType;E=No,typeof ge=="object"&&ge!==null&&(E=Gs(ge));var we=c.getDerivedStateFromProps;ge=typeof we=="function"||typeof y.getSnapshotBeforeUpdate=="function",z=a.pendingProps!==z,ge||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(z||ae!==E)&&B1(a,y,m,E),qr=!1;var le=a.memoizedState;y.state=le,Gl(a,m,y,b),Vl(),ae=a.memoizedState,z||le!==ae||qr?(typeof we=="function"&&(Om(a,c,we,m),ae=a.memoizedState),(W=qr||z1(a,c,W,m,le,ae,E))?(ge||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(a.flags|=4194308)):(typeof y.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=m,a.memoizedState=ae),y.props=m,y.state=ae,y.context=E,m=W):(typeof y.componentDidMount=="function"&&(a.flags|=4194308),m=!1)}else{y=a.stateNode,dm(i,a),E=a.memoizedProps,ge=Ha(c,E),y.props=ge,we=a.pendingProps,le=y.context,ae=c.contextType,W=No,typeof ae=="object"&&ae!==null&&(W=Gs(ae)),z=c.getDerivedStateFromProps,(ae=typeof z=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(E!==we||le!==W)&&B1(a,y,m,W),qr=!1,le=a.memoizedState,y.state=le,Gl(a,m,y,b),Vl();var he=a.memoizedState;E!==we||le!==he||qr||i!==null&&i.dependencies!==null&&Uu(i.dependencies)?(typeof z=="function"&&(Om(a,c,z,m),he=a.memoizedState),(ge=qr||z1(a,c,ge,m,le,he,W)||i!==null&&i.dependencies!==null&&Uu(i.dependencies))?(ae||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(m,he,W),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(m,he,W)),typeof y.componentDidUpdate=="function"&&(a.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof y.componentDidUpdate!="function"||E===i.memoizedProps&&le===i.memoizedState||(a.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||E===i.memoizedProps&&le===i.memoizedState||(a.flags|=1024),a.memoizedProps=m,a.memoizedState=he),y.props=m,y.state=he,y.context=W,m=ge):(typeof y.componentDidUpdate!="function"||E===i.memoizedProps&&le===i.memoizedState||(a.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||E===i.memoizedProps&&le===i.memoizedState||(a.flags|=1024),m=!1)}return y=m,od(i,a),m=(a.flags&128)!==0,y||m?(y=a.stateNode,c=m&&typeof c.getDerivedStateFromError!="function"?null:y.render(),a.flags|=1,i!==null&&m?(a.child=Ia(a,i.child,null,b),a.child=Ia(a,null,c,b)):Ws(i,a,c,b),a.memoizedState=y.state,i=a.child):i=fr(i,a,b),i}function Q1(i,a,c,m){return Da(),a.flags|=256,Ws(i,a,c,m),a.child}var Im={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function $m(i){return{baseLanes:i,cachePool:Hv()}}function Hm(i,a,c){return i=i!==null?i.childLanes&~c:0,a&&(i|=Fn),i}function J1(i,a,c){var m=a.pendingProps,b=!1,y=(a.flags&128)!==0,E;if((E=y)||(E=i!==null&&i.memoizedState===null?!1:(ps.current&2)!==0),E&&(b=!0,a.flags&=-129),E=(a.flags&32)!==0,a.flags&=-33,i===null){if(kt){if(b?Wr(a):Kr(),(i=Yt)?(i=oy(i,ni),i=i!==null&&i.data!=="&"?i:null,i!==null&&(a.memoizedState={dehydrated:i,treeContext:$r!==null?{id:Li,overflow:zi}:null,retryLane:536870912,hydrationErrors:null},c=Mv(i),c.return=a,a.child=c,Vs=a,Yt=null)):i=null,i===null)throw Ur(a);return Sp(i)?a.lanes=32:a.lanes=536870912,null}var z=m.children;return m=m.fallback,b?(Kr(),b=a.mode,z=ld({mode:"hidden",children:z},b),m=Ma(m,b,c,null),z.return=a,m.return=a,z.sibling=m,a.child=z,m=a.child,m.memoizedState=$m(c),m.childLanes=Hm(i,E,c),a.memoizedState=Im,Zl(null,m)):(Wr(a),Um(a,z))}var W=i.memoizedState;if(W!==null&&(z=W.dehydrated,z!==null)){if(y)a.flags&256?(Wr(a),a.flags&=-257,a=Fm(i,a,c)):a.memoizedState!==null?(Kr(),a.child=i.child,a.flags|=128,a=null):(Kr(),z=m.fallback,b=a.mode,m=ld({mode:"visible",children:m.children},b),z=Ma(z,b,c,null),z.flags|=2,m.return=a,z.return=a,m.sibling=z,a.child=m,Ia(a,i.child,null,c),m=a.child,m.memoizedState=$m(c),m.childLanes=Hm(i,E,c),a.memoizedState=Im,a=Zl(null,m));else if(Wr(a),Sp(z)){if(E=z.nextSibling&&z.nextSibling.dataset,E)var ae=E.dgst;E=ae,m=Error(n(419)),m.stack="",m.digest=E,Il({value:m,source:null,stack:null}),a=Fm(i,a,c)}else if(Ss||Ao(i,a,c,!1),E=(c&i.childLanes)!==0,Ss||E){if(E=qt,E!==null&&(m=hs(E,c),m!==0&&m!==W.retryLane))throw W.retryLane=m,Ra(i,m),Rn(E,i,m),Bm;wp(z)||xd(),a=Fm(i,a,c)}else wp(z)?(a.flags|=192,a.child=i.child,a=null):(i=W.treeContext,Yt=ri(z.nextSibling),Vs=a,kt=!0,Hr=null,ni=!1,i!==null&&Lv(a,i),a=Um(a,m.children),a.flags|=4096);return a}return b?(Kr(),z=m.fallback,b=a.mode,W=i.child,ae=W.sibling,m=or(W,{mode:"hidden",children:m.children}),m.subtreeFlags=W.subtreeFlags&65011712,ae!==null?z=or(ae,z):(z=Ma(z,b,c,null),z.flags|=2),z.return=a,m.return=a,m.sibling=z,a.child=m,Zl(null,m),m=a.child,z=i.child.memoizedState,z===null?z=$m(c):(b=z.cachePool,b!==null?(W=ys._currentValue,b=b.parent!==W?{parent:W,pool:W}:b):b=Hv(),z={baseLanes:z.baseLanes|c,cachePool:b}),m.memoizedState=z,m.childLanes=Hm(i,E,c),a.memoizedState=Im,Zl(i.child,m)):(Wr(a),c=i.child,i=c.sibling,c=or(c,{mode:"visible",children:m.children}),c.return=a,c.sibling=null,i!==null&&(E=a.deletions,E===null?(a.deletions=[i],a.flags|=16):E.push(i)),a.child=c,a.memoizedState=null,c)}function Um(i,a){return a=ld({mode:"visible",children:a},i.mode),a.return=i,i.child=a}function ld(i,a){return i=In(22,i,null,a),i.lanes=0,i}function Fm(i,a,c){return Ia(a,i.child,null,c),i=Um(a,a.pendingProps.children),i.flags|=2,a.memoizedState=null,i}function e_(i,a,c){i.lanes|=a;var m=i.alternate;m!==null&&(m.lanes|=a),im(i.return,a,c)}function qm(i,a,c,m,b,y){var E=i.memoizedState;E===null?i.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:m,tail:c,tailMode:b,treeForkCount:y}:(E.isBackwards=a,E.rendering=null,E.renderingStartTime=0,E.last=m,E.tail=c,E.tailMode=b,E.treeForkCount=y)}function t_(i,a,c){var m=a.pendingProps,b=m.revealOrder,y=m.tail;m=m.children;var E=ps.current,z=(E&2)!==0;if(z?(E=E&1|2,a.flags|=128):E&=1,Ee(ps,E),Ws(i,a,m,c),m=kt?Pl:0,!z&&i!==null&&(i.flags&128)!==0)e:for(i=a.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&e_(i,c,a);else if(i.tag===19)e_(i,c,a);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===a)break e;for(;i.sibling===null;){if(i.return===null||i.return===a)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(b){case"forwards":for(c=a.child,b=null;c!==null;)i=c.alternate,i!==null&&Xu(i)===null&&(b=c),c=c.sibling;c=b,c===null?(b=a.child,a.child=null):(b=c.sibling,c.sibling=null),qm(a,!1,b,c,y,m);break;case"backwards":case"unstable_legacy-backwards":for(c=null,b=a.child,a.child=null;b!==null;){if(i=b.alternate,i!==null&&Xu(i)===null){a.child=b;break}i=b.sibling,b.sibling=c,c=b,b=i}qm(a,!0,c,null,y,m);break;case"together":qm(a,!1,null,null,void 0,m);break;default:a.memoizedState=null}return a.child}function fr(i,a,c){if(i!==null&&(a.dependencies=i.dependencies),Zr|=a.lanes,(c&a.childLanes)===0)if(i!==null){if(Ao(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=or(i,i.pendingProps),a.child=c,c.return=a;i.sibling!==null;)i=i.sibling,c=c.sibling=or(i,i.pendingProps),c.return=a;c.sibling=null}return a.child}function Vm(i,a){return(i.lanes&a)!==0?!0:(i=i.dependencies,!!(i!==null&&Uu(i)))}function QA(i,a,c){switch(a.tag){case 3:Ge(a,a.stateNode.containerInfo),Fr(a,ys,i.memoizedState.cache),Da();break;case 27:case 5:et(a);break;case 4:Ge(a,a.stateNode.containerInfo);break;case 10:Fr(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,gm(a),null;break;case 13:var m=a.memoizedState;if(m!==null)return m.dehydrated!==null?(Wr(a),a.flags|=128,null):(c&a.child.childLanes)!==0?J1(i,a,c):(Wr(a),i=fr(i,a,c),i!==null?i.sibling:null);Wr(a);break;case 19:var b=(i.flags&128)!==0;if(m=(c&a.childLanes)!==0,m||(Ao(i,a,c,!1),m=(c&a.childLanes)!==0),b){if(m)return t_(i,a,c);a.flags|=128}if(b=a.memoizedState,b!==null&&(b.rendering=null,b.tail=null,b.lastEffect=null),Ee(ps,ps.current),m)break;return null;case 22:return a.lanes=0,W1(i,a,c,a.pendingProps);case 24:Fr(a,ys,i.memoizedState.cache)}return fr(i,a,c)}function s_(i,a,c){if(i!==null)if(i.memoizedProps!==a.pendingProps)Ss=!0;else{if(!Vm(i,c)&&(a.flags&128)===0)return Ss=!1,QA(i,a,c);Ss=(i.flags&131072)!==0}else Ss=!1,kt&&(a.flags&1048576)!==0&&Ov(a,Pl,a.index);switch(a.lanes=0,a.tag){case 16:e:{var m=a.pendingProps;if(i=Ba(a.elementType),a.type=i,typeof i=="function")Xf(i)?(m=Ha(i,m),a.tag=1,a=Z1(null,a,i,m,c)):(a.tag=0,a=Pm(null,a,i,m,c));else{if(i!=null){var b=i.$$typeof;if(b===A){a.tag=11,a=q1(null,a,i,m,c);break e}else if(b===I){a.tag=14,a=V1(null,a,i,m,c);break e}}throw a=q(i)||i,Error(n(306,a,""))}}return a;case 0:return Pm(i,a,a.type,a.pendingProps,c);case 1:return m=a.type,b=Ha(m,a.pendingProps),Z1(i,a,m,b,c);case 3:e:{if(Ge(a,a.stateNode.containerInfo),i===null)throw Error(n(387));m=a.pendingProps;var y=a.memoizedState;b=y.element,dm(i,a),Gl(a,m,null,c);var E=a.memoizedState;if(m=E.cache,Fr(a,ys,m),m!==y.cache&&rm(a,[ys],c,!0),Vl(),m=E.element,y.isDehydrated)if(y={element:m,isDehydrated:!1,cache:E.cache},a.updateQueue.baseState=y,a.memoizedState=y,a.flags&256){a=Q1(i,a,m,c);break e}else if(m!==b){b=ei(Error(n(424)),a),Il(b),a=Q1(i,a,m,c);break e}else for(i=a.stateNode.containerInfo,i.nodeType===9?i=i.body:i=i.nodeName==="HTML"?i.ownerDocument.body:i,Yt=ri(i.firstChild),Vs=a,kt=!0,Hr=null,ni=!0,c=Wv(a,null,m,c),a.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(Da(),m===b){a=fr(i,a,c);break e}Ws(i,a,m,c)}a=a.child}return a;case 26:return od(i,a),i===null?(c=fy(a.type,null,a.pendingProps,null))?a.memoizedState=c:kt||(c=a.type,i=a.pendingProps,m=kd(je.current).createElement(c),m[fs]=a,m[tn]=i,Ks(m,c,i),vs(m),a.stateNode=m):a.memoizedState=fy(a.type,i.memoizedProps,a.pendingProps,i.memoizedState),null;case 27:return et(a),i===null&&kt&&(m=a.stateNode=uy(a.type,a.pendingProps,je.current),Vs=a,ni=!0,b=Yt,sa(a.type)?(kp=b,Yt=ri(m.firstChild)):Yt=b),Ws(i,a,a.pendingProps.children,c),od(i,a),i===null&&(a.flags|=4194304),a.child;case 5:return i===null&&kt&&((b=m=Yt)&&(m=jT(m,a.type,a.pendingProps,ni),m!==null?(a.stateNode=m,Vs=a,Yt=ri(m.firstChild),ni=!1,b=!0):b=!1),b||Ur(a)),et(a),b=a.type,y=a.pendingProps,E=i!==null?i.memoizedProps:null,m=y.children,vp(b,y)?m=null:E!==null&&vp(b,E)&&(a.flags|=32),a.memoizedState!==null&&(b=bm(i,a,FA,null,null,c),hc._currentValue=b),od(i,a),Ws(i,a,m,c),a.child;case 6:return i===null&&kt&&((i=c=Yt)&&(c=AT(c,a.pendingProps,ni),c!==null?(a.stateNode=c,Vs=a,Yt=null,i=!0):i=!1),i||Ur(a)),null;case 13:return J1(i,a,c);case 4:return Ge(a,a.stateNode.containerInfo),m=a.pendingProps,i===null?a.child=Ia(a,null,m,c):Ws(i,a,m,c),a.child;case 11:return q1(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 m=a.pendingProps,Fr(a,a.type,m.value),Ws(i,a,m.children,c),a.child;case 9:return b=a.type._context,m=a.pendingProps.children,La(a),b=Gs(b),m=m(b),a.flags|=1,Ws(i,a,m,c),a.child;case 14:return V1(i,a,a.type,a.pendingProps,c);case 15:return G1(i,a,a.type,a.pendingProps,c);case 19:return t_(i,a,c);case 31:return ZA(i,a,c);case 22:return W1(i,a,c,a.pendingProps);case 24:return La(a),m=Gs(ys),i===null?(b=lm(),b===null&&(b=qt,y=am(),b.pooledCache=y,y.refCount++,y!==null&&(b.pooledCacheLanes|=c),b=y),a.memoizedState={parent:m,cache:b},um(a),Fr(a,ys,b)):((i.lanes&c)!==0&&(dm(i,a),Gl(a,null,null,c),Vl()),b=i.memoizedState,y=a.memoizedState,b.parent!==m?(b={parent:m,cache:m},a.memoizedState=b,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=b),Fr(a,ys,m)):(m=y.cache,Fr(a,ys,m),m!==b.cache&&rm(a,[ys],c,!0))),Ws(i,a,a.pendingProps.children,c),a.child;case 29:throw a.pendingProps}throw Error(n(156,a.tag))}function mr(i){i.flags|=4}function Gm(i,a,c,m,b){if((a=(i.mode&32)!==0)&&(a=!1),a){if(i.flags|=16777216,(b&335544128)===b)if(i.stateNode.complete)i.flags|=8192;else if(A_())i.flags|=8192;else throw Pa=Gu,cm}else i.flags&=-16777217}function n_(i,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!by(a))if(A_())i.flags|=8192;else throw Pa=Gu,cm}function cd(i,a){a!==null&&(i.flags|=4),i.flags&16384&&(a=i.tag!==22?Be():536870912,i.lanes|=a,Ho|=a)}function Ql(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 m=null;c!==null;)c.alternate!==null&&(m=c),c=c.sibling;m===null?a||i.tail===null?i.tail=null:i.tail.sibling=null:m.sibling=null}}function Xt(i){var a=i.alternate!==null&&i.alternate.child===i.child,c=0,m=0;if(a)for(var b=i.child;b!==null;)c|=b.lanes|b.childLanes,m|=b.subtreeFlags&65011712,m|=b.flags&65011712,b.return=i,b=b.sibling;else for(b=i.child;b!==null;)c|=b.lanes|b.childLanes,m|=b.subtreeFlags,m|=b.flags,b.return=i,b=b.sibling;return i.subtreeFlags|=m,i.childLanes=c,a}function JA(i,a,c){var m=a.pendingProps;switch(em(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Xt(a),null;case 1:return Xt(a),null;case 3:return c=a.stateNode,m=null,i!==null&&(m=i.memoizedState.cache),a.memoizedState.cache!==m&&(a.flags|=2048),ur(ys),De(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(i===null||i.child===null)&&(jo(a)?mr(a):i===null||i.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,sm())),Xt(a),null;case 26:var b=a.type,y=a.memoizedState;return i===null?(mr(a),y!==null?(Xt(a),n_(a,y)):(Xt(a),Gm(a,b,null,m,c))):y?y!==i.memoizedState?(mr(a),Xt(a),n_(a,y)):(Xt(a),a.flags&=-16777217):(i=i.memoizedProps,i!==m&&mr(a),Xt(a),Gm(a,b,i,m,c)),null;case 27:if(ke(a),c=je.current,b=a.type,i!==null&&a.stateNode!=null)i.memoizedProps!==m&&mr(a);else{if(!m){if(a.stateNode===null)throw Error(n(166));return Xt(a),null}i=ye.current,jo(a)?zv(a):(i=uy(b,m,c),a.stateNode=i,mr(a))}return Xt(a),null;case 5:if(ke(a),b=a.type,i!==null&&a.stateNode!=null)i.memoizedProps!==m&&mr(a);else{if(!m){if(a.stateNode===null)throw Error(n(166));return Xt(a),null}if(y=ye.current,jo(a))zv(a);else{var E=kd(je.current);switch(y){case 1:y=E.createElementNS("http://www.w3.org/2000/svg",b);break;case 2:y=E.createElementNS("http://www.w3.org/1998/Math/MathML",b);break;default:switch(b){case"svg":y=E.createElementNS("http://www.w3.org/2000/svg",b);break;case"math":y=E.createElementNS("http://www.w3.org/1998/Math/MathML",b);break;case"script":y=E.createElement("div"),y.innerHTML="<script><\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof m.is=="string"?E.createElement("select",{is:m.is}):E.createElement("select"),m.multiple?y.multiple=!0:m.size&&(y.size=m.size);break;default:y=typeof m.is=="string"?E.createElement(b,{is:m.is}):E.createElement(b)}}y[fs]=a,y[tn]=m;e:for(E=a.child;E!==null;){if(E.tag===5||E.tag===6)y.appendChild(E.stateNode);else if(E.tag!==4&&E.tag!==27&&E.child!==null){E.child.return=E,E=E.child;continue}if(E===a)break e;for(;E.sibling===null;){if(E.return===null||E.return===a)break e;E=E.return}E.sibling.return=E.return,E=E.sibling}a.stateNode=y;e:switch(Ks(y,b,m),b){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}m&&mr(a)}}return Xt(a),Gm(a,a.type,i===null?null:i.memoizedProps,a.pendingProps,c),null;case 6:if(i&&a.stateNode!=null)i.memoizedProps!==m&&mr(a);else{if(typeof m!="string"&&a.stateNode===null)throw Error(n(166));if(i=je.current,jo(a)){if(i=a.stateNode,c=a.memoizedProps,m=null,b=Vs,b!==null)switch(b.tag){case 27:case 5:m=b.memoizedProps}i[fs]=a,i=!!(i.nodeValue===c||m!==null&&m.suppressHydrationWarning===!0||J_(i.nodeValue,c)),i||Ur(a,!0)}else i=kd(i).createTextNode(m),i[fs]=a,a.stateNode=i}return Xt(a),null;case 31:if(c=a.memoizedState,i===null||i.memoizedState!==null){if(m=jo(a),c!==null){if(i===null){if(!m)throw Error(n(318));if(i=a.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(n(557));i[fs]=a}else Da(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Xt(a),i=!1}else c=sm(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=c),i=!0;if(!i)return a.flags&256?(Hn(a),a):(Hn(a),null);if((a.flags&128)!==0)throw Error(n(558))}return Xt(a),null;case 13:if(m=a.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(b=jo(a),m!==null&&m.dehydrated!==null){if(i===null){if(!b)throw Error(n(318));if(b=a.memoizedState,b=b!==null?b.dehydrated:null,!b)throw Error(n(317));b[fs]=a}else Da(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Xt(a),b=!1}else b=sm(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=b),b=!0;if(!b)return a.flags&256?(Hn(a),a):(Hn(a),null)}return Hn(a),(a.flags&128)!==0?(a.lanes=c,a):(c=m!==null,i=i!==null&&i.memoizedState!==null,c&&(m=a.child,b=null,m.alternate!==null&&m.alternate.memoizedState!==null&&m.alternate.memoizedState.cachePool!==null&&(b=m.alternate.memoizedState.cachePool.pool),y=null,m.memoizedState!==null&&m.memoizedState.cachePool!==null&&(y=m.memoizedState.cachePool.pool),y!==b&&(m.flags|=2048)),c!==i&&c&&(a.child.flags|=8192),cd(a,a.updateQueue),Xt(a),null);case 4:return De(),i===null&&mp(a.stateNode.containerInfo),Xt(a),null;case 10:return ur(a.type),Xt(a),null;case 19:if(ie(ps),m=a.memoizedState,m===null)return Xt(a),null;if(b=(a.flags&128)!==0,y=m.rendering,y===null)if(b)Ql(m,!1);else{if(os!==0||i!==null&&(i.flags&128)!==0)for(i=a.child;i!==null;){if(y=Xu(i),y!==null){for(a.flags|=128,Ql(m,!1),i=y.updateQueue,a.updateQueue=i,cd(a,i),a.subtreeFlags=0,i=c,c=a.child;c!==null;)Rv(c,i),c=c.sibling;return Ee(ps,ps.current&1|2),kt&&lr(a,m.treeForkCount),a.child}i=i.sibling}m.tail!==null&&St()>md&&(a.flags|=128,b=!0,Ql(m,!1),a.lanes=4194304)}else{if(!b)if(i=Xu(y),i!==null){if(a.flags|=128,b=!0,i=i.updateQueue,a.updateQueue=i,cd(a,i),Ql(m,!0),m.tail===null&&m.tailMode==="hidden"&&!y.alternate&&!kt)return Xt(a),null}else 2*St()-m.renderingStartTime>md&&c!==536870912&&(a.flags|=128,b=!0,Ql(m,!1),a.lanes=4194304);m.isBackwards?(y.sibling=a.child,a.child=y):(i=m.last,i!==null?i.sibling=y:a.child=y,m.last=y)}return m.tail!==null?(i=m.tail,m.rendering=i,m.tail=i.sibling,m.renderingStartTime=St(),i.sibling=null,c=ps.current,Ee(ps,b?c&1|2:c&1),kt&&lr(a,m.treeForkCount),i):(Xt(a),null);case 22:case 23:return Hn(a),pm(),m=a.memoizedState!==null,i!==null?i.memoizedState!==null!==m&&(a.flags|=8192):m&&(a.flags|=8192),m?(c&536870912)!==0&&(a.flags&128)===0&&(Xt(a),a.subtreeFlags&6&&(a.flags|=8192)):Xt(a),c=a.updateQueue,c!==null&&cd(a,c.retryQueue),c=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(c=i.memoizedState.cachePool.pool),m=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(m=a.memoizedState.cachePool.pool),m!==c&&(a.flags|=2048),i!==null&&ie(za),null;case 24:return c=null,i!==null&&(c=i.memoizedState.cache),a.memoizedState.cache!==c&&(a.flags|=2048),ur(ys),Xt(a),null;case 25:return null;case 30:return null}throw Error(n(156,a.tag))}function eT(i,a){switch(em(a),a.tag){case 1:return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 3:return ur(ys),De(),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(Hn(a),a.alternate===null)throw Error(n(340));Da()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 13:if(Hn(a),i=a.memoizedState,i!==null&&i.dehydrated!==null){if(a.alternate===null)throw Error(n(340));Da()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 19:return ie(ps),null;case 4:return De(),null;case 10:return ur(a.type),null;case 22:case 23:return Hn(a),pm(),i!==null&&ie(za),i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 24:return ur(ys),null;case 25:return null;default:return null}}function i_(i,a){switch(em(a),a.tag){case 3:ur(ys),De();break;case 26:case 27:case 5:ke(a);break;case 4:De();break;case 31:a.memoizedState!==null&&Hn(a);break;case 13:Hn(a);break;case 19:ie(ps);break;case 10:ur(a.type);break;case 22:case 23:Hn(a),pm(),i!==null&&ie(za);break;case 24:ur(ys)}}function Jl(i,a){try{var c=a.updateQueue,m=c!==null?c.lastEffect:null;if(m!==null){var b=m.next;c=b;do{if((c.tag&i)===i){m=void 0;var y=c.create,E=c.inst;m=y(),E.destroy=m}c=c.next}while(c!==b)}}catch(z){Bt(a,a.return,z)}}function Yr(i,a,c){try{var m=a.updateQueue,b=m!==null?m.lastEffect:null;if(b!==null){var y=b.next;m=y;do{if((m.tag&i)===i){var E=m.inst,z=E.destroy;if(z!==void 0){E.destroy=void 0,b=a;var W=c,ae=z;try{ae()}catch(ge){Bt(b,W,ge)}}}m=m.next}while(m!==y)}}catch(ge){Bt(a,a.return,ge)}}function r_(i){var a=i.updateQueue;if(a!==null){var c=i.stateNode;try{Yv(a,c)}catch(m){Bt(i,i.return,m)}}}function a_(i,a,c){c.props=Ha(i.type,i.memoizedProps),c.state=i.memoizedState;try{c.componentWillUnmount()}catch(m){Bt(i,a,m)}}function ec(i,a){try{var c=i.ref;if(c!==null){switch(i.tag){case 26:case 27:case 5:var m=i.stateNode;break;case 30:m=i.stateNode;break;default:m=i.stateNode}typeof c=="function"?i.refCleanup=c(m):c.current=m}}catch(b){Bt(i,a,b)}}function Bi(i,a){var c=i.ref,m=i.refCleanup;if(c!==null)if(typeof m=="function")try{m()}catch(b){Bt(i,a,b)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(b){Bt(i,a,b)}else c.current=null}function o_(i){var a=i.type,c=i.memoizedProps,m=i.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":c.autoFocus&&m.focus();break e;case"img":c.src?m.src=c.src:c.srcSet&&(m.srcset=c.srcSet)}}catch(b){Bt(i,i.return,b)}}function Wm(i,a,c){try{var m=i.stateNode;wT(m,i.type,c,a),m[tn]=a}catch(b){Bt(i,i.return,b)}}function l_(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&sa(i.type)||i.tag===4}function Km(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||l_(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&&sa(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 Ym(i,a,c){var m=i.tag;if(m===5||m===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=Pe));else if(m!==4&&(m===27&&sa(i.type)&&(c=i.stateNode,a=null),i=i.child,i!==null))for(Ym(i,a,c),i=i.sibling;i!==null;)Ym(i,a,c),i=i.sibling}function ud(i,a,c){var m=i.tag;if(m===5||m===6)i=i.stateNode,a?c.insertBefore(i,a):c.appendChild(i);else if(m!==4&&(m===27&&sa(i.type)&&(c=i.stateNode),i=i.child,i!==null))for(ud(i,a,c),i=i.sibling;i!==null;)ud(i,a,c),i=i.sibling}function c_(i){var a=i.stateNode,c=i.memoizedProps;try{for(var m=i.type,b=a.attributes;b.length;)a.removeAttributeNode(b[0]);Ks(a,m,c),a[fs]=i,a[tn]=c}catch(y){Bt(i,i.return,y)}}var pr=!1,ks=!1,Xm=!1,u_=typeof WeakSet=="function"?WeakSet:Set,zs=null;function tT(i,a){if(i=i.containerInfo,xp=Rd,i=wv(i),Ff(i)){if("selectionStart"in i)var c={start:i.selectionStart,end:i.selectionEnd};else e:{c=(c=i.ownerDocument)&&c.defaultView||window;var m=c.getSelection&&c.getSelection();if(m&&m.rangeCount!==0){c=m.anchorNode;var b=m.anchorOffset,y=m.focusNode;m=m.focusOffset;try{c.nodeType,y.nodeType}catch{c=null;break e}var E=0,z=-1,W=-1,ae=0,ge=0,we=i,le=null;t:for(;;){for(var he;we!==c||b!==0&&we.nodeType!==3||(z=E+b),we!==y||m!==0&&we.nodeType!==3||(W=E+m),we.nodeType===3&&(E+=we.nodeValue.length),(he=we.firstChild)!==null;)le=we,we=he;for(;;){if(we===i)break t;if(le===c&&++ae===b&&(z=E),le===y&&++ge===m&&(W=E),(he=we.nextSibling)!==null)break;we=le,le=we.parentNode}we=he}c=z===-1||W===-1?null:{start:z,end:W}}else c=null}c=c||{start:0,end:0}}else c=null;for(bp={focusedElem:i,selectionRange:c},Rd=!1,zs=a;zs!==null;)if(a=zs,i=a.child,(a.subtreeFlags&1028)!==0&&i!==null)i.return=a,zs=i;else for(;zs!==null;){switch(a=zs,y=a.alternate,i=a.flags,a.tag){case 0:if((i&4)!==0&&(i=a.updateQueue,i=i!==null?i.events:null,i!==null))for(c=0;c<i.length;c++)b=i[c],b.ref.impl=b.nextImpl;break;case 11:case 15:break;case 1:if((i&1024)!==0&&y!==null){i=void 0,c=a,b=y.memoizedProps,y=y.memoizedState,m=c.stateNode;try{var Ke=Ha(c.type,b);i=m.getSnapshotBeforeUpdate(Ke,y),m.__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)yp(i);else if(c===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":yp(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,zs=i;break}zs=a.return}}function d_(i,a,c){var m=c.flags;switch(c.tag){case 0:case 11:case 15:xr(i,c),m&4&&Jl(5,c);break;case 1:if(xr(i,c),m&4)if(i=c.stateNode,a===null)try{i.componentDidMount()}catch(E){Bt(c,c.return,E)}else{var b=Ha(c.type,a.memoizedProps);a=a.memoizedState;try{i.componentDidUpdate(b,a,i.__reactInternalSnapshotBeforeUpdate)}catch(E){Bt(c,c.return,E)}}m&64&&r_(c),m&512&&ec(c,c.return);break;case 3:if(xr(i,c),m&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{Yv(i,a)}catch(E){Bt(c,c.return,E)}}break;case 27:a===null&&m&4&&c_(c);case 26:case 5:xr(i,c),a===null&&m&4&&o_(c),m&512&&ec(c,c.return);break;case 12:xr(i,c);break;case 31:xr(i,c),m&4&&m_(i,c);break;case 13:xr(i,c),m&4&&p_(i,c),m&64&&(i=c.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(c=uT.bind(null,c),TT(i,c))));break;case 22:if(m=c.memoizedState!==null||pr,!m){a=a!==null&&a.memoizedState!==null||ks,b=pr;var y=ks;pr=m,(ks=a)&&!y?br(i,c,(c.subtreeFlags&8772)!==0):xr(i,c),pr=b,ks=y}break;case 30:break;default:xr(i,c)}}function h_(i){var a=i.alternate;a!==null&&(i.alternate=null,h_(a)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(a=i.stateNode,a!==null&&kl(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 ts=null,En=!1;function gr(i,a,c){for(c=c.child;c!==null;)f_(i,a,c),c=c.sibling}function f_(i,a,c){if(ce&&typeof ce.onCommitFiberUnmount=="function")try{ce.onCommitFiberUnmount(be,c)}catch{}switch(c.tag){case 26:ks||Bi(c,a),gr(i,a,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:ks||Bi(c,a);var m=ts,b=En;sa(c.type)&&(ts=c.stateNode,En=!1),gr(i,a,c),cc(c.stateNode),ts=m,En=b;break;case 5:ks||Bi(c,a);case 6:if(m=ts,b=En,ts=null,gr(i,a,c),ts=m,En=b,ts!==null)if(En)try{(ts.nodeType===9?ts.body:ts.nodeName==="HTML"?ts.ownerDocument.body:ts).removeChild(c.stateNode)}catch(y){Bt(c,a,y)}else try{ts.removeChild(c.stateNode)}catch(y){Bt(c,a,y)}break;case 18:ts!==null&&(En?(i=ts,ry(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,c.stateNode),Yo(i)):ry(ts,c.stateNode));break;case 4:m=ts,b=En,ts=c.stateNode.containerInfo,En=!0,gr(i,a,c),ts=m,En=b;break;case 0:case 11:case 14:case 15:Yr(2,c,a),ks||Yr(4,c,a),gr(i,a,c);break;case 1:ks||(Bi(c,a),m=c.stateNode,typeof m.componentWillUnmount=="function"&&a_(c,a,m)),gr(i,a,c);break;case 21:gr(i,a,c);break;case 22:ks=(m=ks)||c.memoizedState!==null,gr(i,a,c),ks=m;break;default:gr(i,a,c)}}function m_(i,a){if(a.memoizedState===null&&(i=a.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{Yo(i)}catch(c){Bt(a,a.return,c)}}}function p_(i,a){if(a.memoizedState===null&&(i=a.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{Yo(i)}catch(c){Bt(a,a.return,c)}}function sT(i){switch(i.tag){case 31:case 13:case 19:var a=i.stateNode;return a===null&&(a=i.stateNode=new u_),a;case 22:return i=i.stateNode,a=i._retryCache,a===null&&(a=i._retryCache=new u_),a;default:throw Error(n(435,i.tag))}}function dd(i,a){var c=sT(i);a.forEach(function(m){if(!c.has(m)){c.add(m);var b=dT.bind(null,i,m);m.then(b,b)}})}function jn(i,a){var c=a.deletions;if(c!==null)for(var m=0;m<c.length;m++){var b=c[m],y=i,E=a,z=E;e:for(;z!==null;){switch(z.tag){case 27:if(sa(z.type)){ts=z.stateNode,En=!1;break e}break;case 5:ts=z.stateNode,En=!1;break e;case 3:case 4:ts=z.stateNode.containerInfo,En=!0;break e}z=z.return}if(ts===null)throw Error(n(160));f_(y,E,b),ts=null,En=!1,y=b.alternate,y!==null&&(y.return=null),b.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)g_(a,i),a=a.sibling}var Ni=null;function g_(i,a){var c=i.alternate,m=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:jn(a,i),An(i),m&4&&(Yr(3,i,i.return),Jl(3,i),Yr(5,i,i.return));break;case 1:jn(a,i),An(i),m&512&&(ks||c===null||Bi(c,c.return)),m&64&&pr&&(i=i.updateQueue,i!==null&&(m=i.callbacks,m!==null&&(c=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=c===null?m:c.concat(m))));break;case 26:var b=Ni;if(jn(a,i),An(i),m&512&&(ks||c===null||Bi(c,c.return)),m&4){var y=c!==null?c.memoizedState:null;if(m=i.memoizedState,c===null)if(m===null)if(i.stateNode===null){e:{m=i.type,c=i.memoizedProps,b=b.ownerDocument||b;t:switch(m){case"title":y=b.getElementsByTagName("title")[0],(!y||y[Na]||y[fs]||y.namespaceURI==="http://www.w3.org/2000/svg"||y.hasAttribute("itemprop"))&&(y=b.createElement(m),b.head.insertBefore(y,b.querySelector("head > title"))),Ks(y,m,c),y[fs]=i,vs(y),m=y;break e;case"link":var E=gy("link","href",b).get(m+(c.href||""));if(E){for(var z=0;z<E.length;z++)if(y=E[z],y.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&y.getAttribute("rel")===(c.rel==null?null:c.rel)&&y.getAttribute("title")===(c.title==null?null:c.title)&&y.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){E.splice(z,1);break t}}y=b.createElement(m),Ks(y,m,c),b.head.appendChild(y);break;case"meta":if(E=gy("meta","content",b).get(m+(c.content||""))){for(z=0;z<E.length;z++)if(y=E[z],y.getAttribute("content")===(c.content==null?null:""+c.content)&&y.getAttribute("name")===(c.name==null?null:c.name)&&y.getAttribute("property")===(c.property==null?null:c.property)&&y.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&y.getAttribute("charset")===(c.charSet==null?null:c.charSet)){E.splice(z,1);break t}}y=b.createElement(m),Ks(y,m,c),b.head.appendChild(y);break;default:throw Error(n(468,m))}y[fs]=i,vs(y),m=y}i.stateNode=m}else xy(b,i.type,i.stateNode);else i.stateNode=py(b,m,i.memoizedProps);else y!==m?(y===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):y.count--,m===null?xy(b,i.type,i.stateNode):py(b,m,i.memoizedProps)):m===null&&i.stateNode!==null&&Wm(i,i.memoizedProps,c.memoizedProps)}break;case 27:jn(a,i),An(i),m&512&&(ks||c===null||Bi(c,c.return)),c!==null&&m&4&&Wm(i,i.memoizedProps,c.memoizedProps);break;case 5:if(jn(a,i),An(i),m&512&&(ks||c===null||Bi(c,c.return)),i.flags&32){b=i.stateNode;try{it(b,"")}catch(Ke){Bt(i,i.return,Ke)}}m&4&&i.stateNode!=null&&(b=i.memoizedProps,Wm(i,b,c!==null?c.memoizedProps:b)),m&1024&&(Xm=!0);break;case 6:if(jn(a,i),An(i),m&4){if(i.stateNode===null)throw Error(n(162));m=i.memoizedProps,c=i.stateNode;try{c.nodeValue=m}catch(Ke){Bt(i,i.return,Ke)}}break;case 3:if(Ed=null,b=Ni,Ni=Nd(a.containerInfo),jn(a,i),Ni=b,An(i),m&4&&c!==null&&c.memoizedState.isDehydrated)try{Yo(a.containerInfo)}catch(Ke){Bt(i,i.return,Ke)}Xm&&(Xm=!1,x_(i));break;case 4:m=Ni,Ni=Nd(i.stateNode.containerInfo),jn(a,i),An(i),Ni=m;break;case 12:jn(a,i),An(i);break;case 31:jn(a,i),An(i),m&4&&(m=i.updateQueue,m!==null&&(i.updateQueue=null,dd(i,m)));break;case 13:jn(a,i),An(i),i.child.flags&8192&&i.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(fd=St()),m&4&&(m=i.updateQueue,m!==null&&(i.updateQueue=null,dd(i,m)));break;case 22:b=i.memoizedState!==null;var W=c!==null&&c.memoizedState!==null,ae=pr,ge=ks;if(pr=ae||b,ks=ge||W,jn(a,i),ks=ge,pr=ae,An(i),m&8192)e:for(a=i.stateNode,a._visibility=b?a._visibility&-2:a._visibility|1,b&&(c===null||W||pr||ks||Ua(i)),c=null,a=i;;){if(a.tag===5||a.tag===26){if(c===null){W=c=a;try{if(y=W.stateNode,b)E=y.style,typeof E.setProperty=="function"?E.setProperty("display","none","important"):E.display="none";else{z=W.stateNode;var we=W.memoizedProps.style,le=we!=null&&we.hasOwnProperty("display")?we.display:null;z.style.display=le==null||typeof le=="boolean"?"":(""+le).trim()}}catch(Ke){Bt(W,W.return,Ke)}}}else if(a.tag===6){if(c===null){W=a;try{W.stateNode.nodeValue=b?"":W.memoizedProps}catch(Ke){Bt(W,W.return,Ke)}}}else if(a.tag===18){if(c===null){W=a;try{var he=W.stateNode;b?ay(he,!0):ay(W.stateNode,!1)}catch(Ke){Bt(W,W.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}m&4&&(m=i.updateQueue,m!==null&&(c=m.retryQueue,c!==null&&(m.retryQueue=null,dd(i,c))));break;case 19:jn(a,i),An(i),m&4&&(m=i.updateQueue,m!==null&&(i.updateQueue=null,dd(i,m)));break;case 30:break;case 21:break;default:jn(a,i),An(i)}}function An(i){var a=i.flags;if(a&2){try{for(var c,m=i.return;m!==null;){if(l_(m)){c=m;break}m=m.return}if(c==null)throw Error(n(160));switch(c.tag){case 27:var b=c.stateNode,y=Km(i);ud(i,y,b);break;case 5:var E=c.stateNode;c.flags&32&&(it(E,""),c.flags&=-33);var z=Km(i);ud(i,z,E);break;case 3:case 4:var W=c.stateNode.containerInfo,ae=Km(i);Ym(i,ae,W);break;default:throw Error(n(161))}}catch(ge){Bt(i,i.return,ge)}i.flags&=-3}a&4096&&(i.flags&=-4097)}function x_(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var a=i;x_(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),i=i.sibling}}function xr(i,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)d_(i,a.alternate,a),a=a.sibling}function Ua(i){for(i=i.child;i!==null;){var a=i;switch(a.tag){case 0:case 11:case 14:case 15:Yr(4,a,a.return),Ua(a);break;case 1:Bi(a,a.return);var c=a.stateNode;typeof c.componentWillUnmount=="function"&&a_(a,a.return,c),Ua(a);break;case 27:cc(a.stateNode);case 26:case 5:Bi(a,a.return),Ua(a);break;case 22:a.memoizedState===null&&Ua(a);break;case 30:Ua(a);break;default:Ua(a)}i=i.sibling}}function br(i,a,c){for(c=c&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var m=a.alternate,b=i,y=a,E=y.flags;switch(y.tag){case 0:case 11:case 15:br(b,y,c),Jl(4,y);break;case 1:if(br(b,y,c),m=y,b=m.stateNode,typeof b.componentDidMount=="function")try{b.componentDidMount()}catch(ae){Bt(m,m.return,ae)}if(m=y,b=m.updateQueue,b!==null){var z=m.stateNode;try{var W=b.shared.hiddenCallbacks;if(W!==null)for(b.shared.hiddenCallbacks=null,b=0;b<W.length;b++)Kv(W[b],z)}catch(ae){Bt(m,m.return,ae)}}c&&E&64&&r_(y),ec(y,y.return);break;case 27:c_(y);case 26:case 5:br(b,y,c),c&&m===null&&E&4&&o_(y),ec(y,y.return);break;case 12:br(b,y,c);break;case 31:br(b,y,c),c&&E&4&&m_(b,y);break;case 13:br(b,y,c),c&&E&4&&p_(b,y);break;case 22:y.memoizedState===null&&br(b,y,c),ec(y,y.return);break;case 30:break;default:br(b,y,c)}a=a.sibling}}function Zm(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&&$l(c))}function Qm(i,a){i=null,a.alternate!==null&&(i=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==i&&(a.refCount++,i!=null&&$l(i))}function Ci(i,a,c,m){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)b_(i,a,c,m),a=a.sibling}function b_(i,a,c,m){var b=a.flags;switch(a.tag){case 0:case 11:case 15:Ci(i,a,c,m),b&2048&&Jl(9,a);break;case 1:Ci(i,a,c,m);break;case 3:Ci(i,a,c,m),b&2048&&(i=null,a.alternate!==null&&(i=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==i&&(a.refCount++,i!=null&&$l(i)));break;case 12:if(b&2048){Ci(i,a,c,m),i=a.stateNode;try{var y=a.memoizedProps,E=y.id,z=y.onPostCommit;typeof z=="function"&&z(E,a.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(W){Bt(a,a.return,W)}}else Ci(i,a,c,m);break;case 31:Ci(i,a,c,m);break;case 13:Ci(i,a,c,m);break;case 23:break;case 22:y=a.stateNode,E=a.alternate,a.memoizedState!==null?y._visibility&2?Ci(i,a,c,m):tc(i,a):y._visibility&2?Ci(i,a,c,m):(y._visibility|=2,Po(i,a,c,m,(a.subtreeFlags&10256)!==0||!1)),b&2048&&Zm(E,a);break;case 24:Ci(i,a,c,m),b&2048&&Qm(a.alternate,a);break;default:Ci(i,a,c,m)}}function Po(i,a,c,m,b){for(b=b&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var y=i,E=a,z=c,W=m,ae=E.flags;switch(E.tag){case 0:case 11:case 15:Po(y,E,z,W,b),Jl(8,E);break;case 23:break;case 22:var ge=E.stateNode;E.memoizedState!==null?ge._visibility&2?Po(y,E,z,W,b):tc(y,E):(ge._visibility|=2,Po(y,E,z,W,b)),b&&ae&2048&&Zm(E.alternate,E);break;case 24:Po(y,E,z,W,b),b&&ae&2048&&Qm(E.alternate,E);break;default:Po(y,E,z,W,b)}a=a.sibling}}function tc(i,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var c=i,m=a,b=m.flags;switch(m.tag){case 22:tc(c,m),b&2048&&Zm(m.alternate,m);break;case 24:tc(c,m),b&2048&&Qm(m.alternate,m);break;default:tc(c,m)}a=a.sibling}}var sc=8192;function Io(i,a,c){if(i.subtreeFlags&sc)for(i=i.child;i!==null;)v_(i,a,c),i=i.sibling}function v_(i,a,c){switch(i.tag){case 26:Io(i,a,c),i.flags&sc&&i.memoizedState!==null&&UT(c,Ni,i.memoizedState,i.memoizedProps);break;case 5:Io(i,a,c);break;case 3:case 4:var m=Ni;Ni=Nd(i.stateNode.containerInfo),Io(i,a,c),Ni=m;break;case 22:i.memoizedState===null&&(m=i.alternate,m!==null&&m.memoizedState!==null?(m=sc,sc=16777216,Io(i,a,c),sc=m):Io(i,a,c));break;default:Io(i,a,c)}}function __(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 nc(i){var a=i.deletions;if((i.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var m=a[c];zs=m,w_(m,i)}__(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)y_(i),i=i.sibling}function y_(i){switch(i.tag){case 0:case 11:case 15:nc(i),i.flags&2048&&Yr(9,i,i.return);break;case 3:nc(i);break;case 12:nc(i);break;case 22:var a=i.stateNode;i.memoizedState!==null&&a._visibility&2&&(i.return===null||i.return.tag!==13)?(a._visibility&=-3,hd(i)):nc(i);break;default:nc(i)}}function hd(i){var a=i.deletions;if((i.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var m=a[c];zs=m,w_(m,i)}__(i)}for(i=i.child;i!==null;){switch(a=i,a.tag){case 0:case 11:case 15:Yr(8,a,a.return),hd(a);break;case 22:c=a.stateNode,c._visibility&2&&(c._visibility&=-3,hd(a));break;default:hd(a)}i=i.sibling}}function w_(i,a){for(;zs!==null;){var c=zs;switch(c.tag){case 0:case 11:case 15:Yr(8,c,a);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var m=c.memoizedState.cachePool.pool;m!=null&&m.refCount++}break;case 24:$l(c.memoizedState.cache)}if(m=c.child,m!==null)m.return=c,zs=m;else e:for(c=i;zs!==null;){m=zs;var b=m.sibling,y=m.return;if(h_(m),m===c){zs=null;break e}if(b!==null){b.return=y,zs=b;break e}zs=y}}}var nT={getCacheForType:function(i){var a=Gs(ys),c=a.data.get(i);return c===void 0&&(c=i(),a.data.set(i,c)),c},cacheSignal:function(){return Gs(ys).controller.signal}},iT=typeof WeakMap=="function"?WeakMap:Map,Tt=0,qt=null,xt=null,_t=0,zt=0,Un=null,Xr=!1,$o=!1,Jm=!1,vr=0,os=0,Zr=0,Fa=0,ep=0,Fn=0,Ho=0,ic=null,Tn=null,tp=!1,fd=0,S_=0,md=1/0,pd=null,Qr=null,Ts=0,Jr=null,Uo=null,_r=0,sp=0,np=null,k_=null,rc=0,ip=null;function qn(){return(Tt&2)!==0&&_t!==0?_t&-_t:L.T!==null?up():mo()}function N_(){if(Fn===0)if((_t&536870912)===0||kt){var i=Ce;Ce<<=1,(Ce&3932160)===0&&(Ce=262144),Fn=i}else Fn=536870912;return i=$n.current,i!==null&&(i.flags|=32),Fn}function Rn(i,a,c){(i===qt&&(zt===2||zt===9)||i.cancelPendingCommit!==null)&&(Fo(i,0),ea(i,_t,Fn,!1)),Mt(i,c),((Tt&2)===0||i!==qt)&&(i===qt&&((Tt&2)===0&&(Fa|=c),os===4&&ea(i,_t,Fn,!1)),Pi(i))}function C_(i,a,c){if((Tt&6)!==0)throw Error(n(327));var m=!c&&(a&127)===0&&(a&i.expiredLanes)===0||ee(i,a),b=m?oT(i,a):ap(i,a,!0),y=m;do{if(b===0){$o&&!m&&ea(i,a,0,!1);break}else{if(c=i.current.alternate,y&&!rT(c)){b=ap(i,a,!1),y=!1;continue}if(b===2){if(y=a,i.errorRecoveryDisabledLanes&y)var E=0;else E=i.pendingLanes&-536870913,E=E!==0?E:E&536870912?536870912:0;if(E!==0){a=E;e:{var z=i;b=ic;var W=z.current.memoizedState.isDehydrated;if(W&&(Fo(z,E).flags|=256),E=ap(z,E,!1),E!==2){if(Jm&&!W){z.errorRecoveryDisabledLanes|=y,Fa|=y,b=4;break e}y=Tn,Tn=b,y!==null&&(Tn===null?Tn=y:Tn.push.apply(Tn,y))}b=E}if(y=!1,b!==2)continue}}if(b===1){Fo(i,0),ea(i,a,0,!0);break}e:{switch(m=i,y=b,y){case 0:case 1:throw Error(n(345));case 4:if((a&4194048)!==a)break;case 6:ea(m,a,Fn,!Xr);break e;case 2:Tn=null;break;case 3:case 5:break;default:throw Error(n(329))}if((a&62914560)===a&&(b=fd+300-St(),10<b)){if(ea(m,a,Fn,!Xr),H(m,0,!0)!==0)break e;_r=a,m.timeoutHandle=ny(E_.bind(null,m,c,Tn,pd,tp,a,Fn,Fa,Ho,Xr,y,"Throttled",-0,0),b);break e}E_(m,c,Tn,pd,tp,a,Fn,Fa,Ho,Xr,y,null,-0,0)}}break}while(!0);Pi(i)}function E_(i,a,c,m,b,y,E,z,W,ae,ge,we,le,he){if(i.timeoutHandle=-1,we=a.subtreeFlags,we&8192||(we&16785408)===16785408){we={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Pe},v_(a,y,we);var Ke=(y&62914560)===y?fd-St():(y&4194048)===y?S_-St():0;if(Ke=FT(we,Ke),Ke!==null){_r=y,i.cancelPendingCommit=Ke(L_.bind(null,i,a,y,c,m,b,E,z,W,ge,we,null,le,he)),ea(i,y,E,!ae);return}}L_(i,a,y,c,m,b,E,z,W)}function rT(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 m=0;m<c.length;m++){var b=c[m],y=b.getSnapshot;b=b.value;try{if(!Pn(y(),b))return!1}catch{return!1}}if(c=a.child,a.subtreeFlags&16384&&c!==null)c.return=a,a=c;else{if(a===i)break;for(;a.sibling===null;){if(a.return===null||a.return===i)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function ea(i,a,c,m){a&=~ep,a&=~Fa,i.suspendedLanes|=a,i.pingedLanes&=~a,m&&(i.warmLanes|=a),m=i.expirationTimes;for(var b=a;0<b;){var y=31-M(b),E=1<<y;m[y]=-1,b&=~E}c!==0&&Ue(i,c,a)}function gd(){return(Tt&6)===0?(ac(0),!1):!0}function rp(){if(xt!==null){if(zt===0)var i=xt.return;else i=xt,cr=Oa=null,ym(i),Do=null,Ul=0,i=xt;for(;i!==null;)i_(i.alternate,i),i=i.return;xt=null}}function Fo(i,a){var c=i.timeoutHandle;c!==-1&&(i.timeoutHandle=-1,NT(c)),c=i.cancelPendingCommit,c!==null&&(i.cancelPendingCommit=null,c()),_r=0,rp(),qt=i,xt=c=or(i.current,null),_t=a,zt=0,Un=null,Xr=!1,$o=ee(i,a),Jm=!1,Ho=Fn=ep=Fa=Zr=os=0,Tn=ic=null,tp=!1,(a&8)!==0&&(a|=a&32);var m=i.entangledLanes;if(m!==0)for(i=i.entanglements,m&=a;0<m;){var b=31-M(m),y=1<<b;a|=i[b],m&=~y}return vr=a,Bu(),c}function j_(i,a){ut=null,L.H=Xl,a===Mo||a===Vu?(a=qv(),zt=3):a===cm?(a=qv(),zt=4):zt=a===Bm?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,Un=a,xt===null&&(os=1,rd(i,ei(a,i.current)))}function A_(){var i=$n.current;return i===null?!0:(_t&4194048)===_t?ii===null:(_t&62914560)===_t||(_t&536870912)!==0?i===ii:!1}function T_(){var i=L.H;return L.H=Xl,i===null?Xl:i}function R_(){var i=L.A;return L.A=nT,i}function xd(){os=4,Xr||(_t&4194048)!==_t&&$n.current!==null||($o=!0),(Zr&134217727)===0&&(Fa&134217727)===0||qt===null||ea(qt,_t,Fn,!1)}function ap(i,a,c){var m=Tt;Tt|=2;var b=T_(),y=R_();(qt!==i||_t!==a)&&(pd=null,Fo(i,a)),a=!1;var E=os;e:do try{if(zt!==0&&xt!==null){var z=xt,W=Un;switch(zt){case 8:rp(),E=6;break e;case 3:case 2:case 9:case 6:$n.current===null&&(a=!0);var ae=zt;if(zt=0,Un=null,qo(i,z,W,ae),c&&$o){E=0;break e}break;default:ae=zt,zt=0,Un=null,qo(i,z,W,ae)}}aT(),E=os;break}catch(ge){j_(i,ge)}while(!0);return a&&i.shellSuspendCounter++,cr=Oa=null,Tt=m,L.H=b,L.A=y,xt===null&&(qt=null,_t=0,Bu()),E}function aT(){for(;xt!==null;)M_(xt)}function oT(i,a){var c=Tt;Tt|=2;var m=T_(),b=R_();qt!==i||_t!==a?(pd=null,md=St()+500,Fo(i,a)):$o=ee(i,a);e:do try{if(zt!==0&&xt!==null){a=xt;var y=Un;t:switch(zt){case 1:zt=0,Un=null,qo(i,a,y,1);break;case 2:case 9:if(Uv(y)){zt=0,Un=null,D_(a);break}a=function(){zt!==2&&zt!==9||qt!==i||(zt=7),Pi(i)},y.then(a,a);break e;case 3:zt=7;break e;case 4:zt=5;break e;case 7:Uv(y)?(zt=0,Un=null,D_(a)):(zt=0,Un=null,qo(i,a,y,7));break;case 5:var E=null;switch(xt.tag){case 26:E=xt.memoizedState;case 5:case 27:var z=xt;if(E?by(E):z.stateNode.complete){zt=0,Un=null;var W=z.sibling;if(W!==null)xt=W;else{var ae=z.return;ae!==null?(xt=ae,bd(ae)):xt=null}break t}}zt=0,Un=null,qo(i,a,y,5);break;case 6:zt=0,Un=null,qo(i,a,y,6);break;case 8:rp(),os=6;break e;default:throw Error(n(462))}}lT();break}catch(ge){j_(i,ge)}while(!0);return cr=Oa=null,L.H=m,L.A=b,Tt=c,xt!==null?0:(qt=null,_t=0,Bu(),os)}function lT(){for(;xt!==null&&!Ie();)M_(xt)}function M_(i){var a=s_(i.alternate,i,vr);i.memoizedProps=i.pendingProps,a===null?bd(i):xt=a}function D_(i){var a=i,c=a.alternate;switch(a.tag){case 15:case 0:a=X1(c,a,a.pendingProps,a.type,void 0,_t);break;case 11:a=X1(c,a,a.pendingProps,a.type.render,a.ref,_t);break;case 5:ym(a);default:i_(c,a),a=xt=Rv(a,vr),a=s_(c,a,vr)}i.memoizedProps=i.pendingProps,a===null?bd(i):xt=a}function qo(i,a,c,m){cr=Oa=null,ym(a),Do=null,Ul=0;var b=a.return;try{if(XA(i,b,a,c,_t)){os=1,rd(i,ei(c,i.current)),xt=null;return}}catch(y){if(b!==null)throw xt=b,y;os=1,rd(i,ei(c,i.current)),xt=null;return}a.flags&32768?(kt||m===1?i=!0:$o||(_t&536870912)!==0?i=!1:(Xr=i=!0,(m===2||m===9||m===3||m===6)&&(m=$n.current,m!==null&&m.tag===13&&(m.flags|=16384))),O_(a,i)):bd(a)}function bd(i){var a=i;do{if((a.flags&32768)!==0){O_(a,Xr);return}i=a.return;var c=JA(a.alternate,a,vr);if(c!==null){xt=c;return}if(a=a.sibling,a!==null){xt=a;return}xt=a=i}while(a!==null);os===0&&(os=5)}function O_(i,a){do{var c=eT(i.alternate,i);if(c!==null){c.flags&=32767,xt=c;return}if(c=i.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!a&&(i=i.sibling,i!==null)){xt=i;return}xt=i=c}while(i!==null);os=6,xt=null}function L_(i,a,c,m,b,y,E,z,W){i.cancelPendingCommit=null;do vd();while(Ts!==0);if((Tt&6)!==0)throw Error(n(327));if(a!==null){if(a===i.current)throw Error(n(177));if(y=a.lanes|a.childLanes,y|=Kf,qe(i,c,y,E,z,W),i===qt&&(xt=qt=null,_t=0),Uo=a,Jr=i,_r=c,sp=y,np=b,k_=m,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,hT(en,function(){return $_(),null})):(i.callbackNode=null,i.callbackPriority=0),m=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||m){m=L.T,L.T=null,b=X.p,X.p=2,E=Tt,Tt|=4;try{tT(i,a,c)}finally{Tt=E,X.p=b,L.T=m}}Ts=1,z_(),B_(),P_()}}function z_(){if(Ts===1){Ts=0;var i=Jr,a=Uo,c=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||c){c=L.T,L.T=null;var m=X.p;X.p=2;var b=Tt;Tt|=4;try{g_(a,i);var y=bp,E=wv(i.containerInfo),z=y.focusedElem,W=y.selectionRange;if(E!==z&&z&&z.ownerDocument&&yv(z.ownerDocument.documentElement,z)){if(W!==null&&Ff(z)){var ae=W.start,ge=W.end;if(ge===void 0&&(ge=ae),"selectionStart"in z)z.selectionStart=ae,z.selectionEnd=Math.min(ge,z.value.length);else{var we=z.ownerDocument||document,le=we&&we.defaultView||window;if(le.getSelection){var he=le.getSelection(),Ke=z.textContent.length,nt=Math.min(W.start,Ke),Ht=W.end===void 0?nt:Math.min(W.end,Ke);!he.extend&&nt>Ht&&(E=Ht,Ht=nt,nt=E);var te=_v(z,nt),J=_v(z,Ht);if(te&&J&&(he.rangeCount!==1||he.anchorNode!==te.node||he.anchorOffset!==te.offset||he.focusNode!==J.node||he.focusOffset!==J.offset)){var re=we.createRange();re.setStart(te.node,te.offset),he.removeAllRanges(),nt>Ht?(he.addRange(re),he.extend(J.node,J.offset)):(re.setEnd(J.node,J.offset),he.addRange(re))}}}}for(we=[],he=z;he=he.parentNode;)he.nodeType===1&&we.push({element:he,left:he.scrollLeft,top:he.scrollTop});for(typeof z.focus=="function"&&z.focus(),z=0;z<we.length;z++){var ve=we[z];ve.element.scrollLeft=ve.left,ve.element.scrollTop=ve.top}}Rd=!!xp,bp=xp=null}finally{Tt=b,X.p=m,L.T=c}}i.current=a,Ts=2}}function B_(){if(Ts===2){Ts=0;var i=Jr,a=Uo,c=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||c){c=L.T,L.T=null;var m=X.p;X.p=2;var b=Tt;Tt|=4;try{d_(i,a.alternate,a)}finally{Tt=b,X.p=m,L.T=c}}Ts=3}}function P_(){if(Ts===4||Ts===3){Ts=0,Ct();var i=Jr,a=Uo,c=_r,m=k_;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?Ts=5:(Ts=0,Uo=Jr=null,I_(i,i.pendingLanes));var b=i.pendingLanes;if(b===0&&(Qr=null),sr(c),a=a.stateNode,ce&&typeof ce.onCommitFiberRoot=="function")try{ce.onCommitFiberRoot(be,a,void 0,(a.current.flags&128)===128)}catch{}if(m!==null){a=L.T,b=X.p,X.p=2,L.T=null;try{for(var y=i.onRecoverableError,E=0;E<m.length;E++){var z=m[E];y(z.value,{componentStack:z.stack})}}finally{L.T=a,X.p=b}}(_r&3)!==0&&vd(),Pi(i),b=i.pendingLanes,(c&261930)!==0&&(b&42)!==0?i===ip?rc++:(rc=0,ip=i):rc=0,ac(0)}}function I_(i,a){(i.pooledCacheLanes&=a)===0&&(a=i.pooledCache,a!=null&&(i.pooledCache=null,$l(a)))}function vd(){return z_(),B_(),P_(),$_()}function $_(){if(Ts!==5)return!1;var i=Jr,a=sp;sp=0;var c=sr(_r),m=L.T,b=X.p;try{X.p=32>c?32:c,L.T=null,c=np,np=null;var y=Jr,E=_r;if(Ts=0,Uo=Jr=null,_r=0,(Tt&6)!==0)throw Error(n(331));var z=Tt;if(Tt|=4,y_(y.current),b_(y,y.current,E,c),Tt=z,ac(0,!1),ce&&typeof ce.onPostCommitFiberRoot=="function")try{ce.onPostCommitFiberRoot(be,y)}catch{}return!0}finally{X.p=b,L.T=m,I_(i,a)}}function H_(i,a,c){a=ei(c,a),a=zm(i.stateNode,a,2),i=Gr(i,a,2),i!==null&&(Mt(i,2),Pi(i))}function Bt(i,a,c){if(i.tag===3)H_(i,i,c);else for(;a!==null;){if(a.tag===3){H_(a,i,c);break}else if(a.tag===1){var m=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(Qr===null||!Qr.has(m))){i=ei(c,i),c=U1(2),m=Gr(a,c,2),m!==null&&(F1(c,m,a,i),Mt(m,2),Pi(m));break}}a=a.return}}function op(i,a,c){var m=i.pingCache;if(m===null){m=i.pingCache=new iT;var b=new Set;m.set(a,b)}else b=m.get(a),b===void 0&&(b=new Set,m.set(a,b));b.has(c)||(Jm=!0,b.add(c),i=cT.bind(null,i,a,c),a.then(i,i))}function cT(i,a,c){var m=i.pingCache;m!==null&&m.delete(a),i.pingedLanes|=i.suspendedLanes&c,i.warmLanes&=~c,qt===i&&(_t&c)===c&&(os===4||os===3&&(_t&62914560)===_t&&300>St()-fd?(Tt&2)===0&&Fo(i,0):ep|=c,Ho===_t&&(Ho=0)),Pi(i)}function U_(i,a){a===0&&(a=Be()),i=Ra(i,a),i!==null&&(Mt(i,a),Pi(i))}function uT(i){var a=i.memoizedState,c=0;a!==null&&(c=a.retryLane),U_(i,c)}function dT(i,a){var c=0;switch(i.tag){case 31:case 13:var m=i.stateNode,b=i.memoizedState;b!==null&&(c=b.retryLane);break;case 19:m=i.stateNode;break;case 22:m=i.stateNode._retryCache;break;default:throw Error(n(314))}m!==null&&m.delete(a),U_(i,c)}function hT(i,a){return cn(i,a)}var _d=null,Vo=null,lp=!1,yd=!1,cp=!1,ta=0;function Pi(i){i!==Vo&&i.next===null&&(Vo===null?_d=Vo=i:Vo=Vo.next=i),yd=!0,lp||(lp=!0,mT())}function ac(i,a){if(!cp&&yd){cp=!0;do for(var c=!1,m=_d;m!==null;){if(i!==0){var b=m.pendingLanes;if(b===0)var y=0;else{var E=m.suspendedLanes,z=m.pingedLanes;y=(1<<31-M(42|i)+1)-1,y&=b&~(E&~z),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(c=!0,G_(m,y))}else y=_t,y=H(m,m===qt?y:0,m.cancelPendingCommit!==null||m.timeoutHandle!==-1),(y&3)===0||ee(m,y)||(c=!0,G_(m,y));m=m.next}while(c);cp=!1}}function fT(){F_()}function F_(){yd=lp=!1;var i=0;ta!==0&&kT()&&(i=ta);for(var a=St(),c=null,m=_d;m!==null;){var b=m.next,y=q_(m,a);y===0?(m.next=null,c===null?_d=b:c.next=b,b===null&&(Vo=c)):(c=m,(i!==0||(y&3)!==0)&&(yd=!0)),m=b}Ts!==0&&Ts!==5||ac(i),ta!==0&&(ta=0)}function q_(i,a){for(var c=i.suspendedLanes,m=i.pingedLanes,b=i.expirationTimes,y=i.pendingLanes&-62914561;0<y;){var E=31-M(y),z=1<<E,W=b[E];W===-1?((z&c)===0||(z&m)!==0)&&(b[E]=fe(z,a)):W<=a&&(i.expiredLanes|=z),y&=~z}if(a=qt,c=_t,c=H(i,i===a?c:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),m=i.callbackNode,c===0||i===a&&(zt===2||zt===9)||i.cancelPendingCommit!==null)return m!==null&&m!==null&&un(m),i.callbackNode=null,i.callbackPriority=0;if((c&3)===0||ee(i,c)){if(a=c&-c,a===i.callbackPriority)return a;switch(m!==null&&un(m),sr(c)){case 2:case 8:c=Js;break;case 32:c=en;break;case 268435456:c=S;break;default:c=en}return m=V_.bind(null,i),c=cn(c,m),i.callbackPriority=a,i.callbackNode=c,a}return m!==null&&m!==null&&un(m),i.callbackPriority=2,i.callbackNode=null,2}function V_(i,a){if(Ts!==0&&Ts!==5)return i.callbackNode=null,i.callbackPriority=0,null;var c=i.callbackNode;if(vd()&&i.callbackNode!==c)return null;var m=_t;return m=H(i,i===qt?m:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),m===0?null:(C_(i,m,a),q_(i,St()),i.callbackNode!=null&&i.callbackNode===c?V_.bind(null,i):null)}function G_(i,a){if(vd())return null;C_(i,a,!0)}function mT(){CT(function(){(Tt&6)!==0?cn(Ft,fT):F_()})}function up(){if(ta===0){var i=To;i===0&&(i=ue,ue<<=1,(ue&261888)===0&&(ue=256)),ta=i}return ta}function W_(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:Pr(""+i)}function K_(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 pT(i,a,c,m,b){if(a==="submit"&&c&&c.stateNode===b){var y=W_((b[tn]||null).action),E=m.submitter;E&&(a=(a=E[tn]||null)?W_(a.formAction):E.getAttribute("formAction"),a!==null&&(y=a,E=null));var z=new Du("action","action",null,m,b);i.push({event:z,listeners:[{instance:null,listener:function(){if(m.defaultPrevented){if(ta!==0){var W=E?K_(b,E):new FormData(b);Tm(c,{pending:!0,data:W,method:b.method,action:y},null,W)}}else typeof y=="function"&&(z.preventDefault(),W=E?K_(b,E):new FormData(b),Tm(c,{pending:!0,data:W,method:b.method,action:y},y,W))},currentTarget:b}]})}}for(var dp=0;dp<Wf.length;dp++){var hp=Wf[dp],gT=hp.toLowerCase(),xT=hp[0].toUpperCase()+hp.slice(1);ki(gT,"on"+xT)}ki(Nv,"onAnimationEnd"),ki(Cv,"onAnimationIteration"),ki(Ev,"onAnimationStart"),ki("dblclick","onDoubleClick"),ki("focusin","onFocus"),ki("focusout","onBlur"),ki(DA,"onTransitionRun"),ki(OA,"onTransitionStart"),ki(LA,"onTransitionCancel"),ki(jv,"onTransitionEnd"),Me("onMouseEnter",["mouseout","mouseover"]),Me("onMouseLeave",["mouseout","mouseover"]),Me("onPointerEnter",["pointerout","pointerover"]),Me("onPointerLeave",["pointerout","pointerover"]),ir("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ir("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ir("onBeforeInput",["compositionend","keypress","textInput","paste"]),ir("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ir("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ir("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var oc="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),bT=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(oc));function Y_(i,a){a=(a&4)!==0;for(var c=0;c<i.length;c++){var m=i[c],b=m.event;m=m.listeners;e:{var y=void 0;if(a)for(var E=m.length-1;0<=E;E--){var z=m[E],W=z.instance,ae=z.currentTarget;if(z=z.listener,W!==y&&b.isPropagationStopped())break e;y=z,b.currentTarget=ae;try{y(b)}catch(ge){zu(ge)}b.currentTarget=null,y=W}else for(E=0;E<m.length;E++){if(z=m[E],W=z.instance,ae=z.currentTarget,z=z.listener,W!==y&&b.isPropagationStopped())break e;y=z,b.currentTarget=ae;try{y(b)}catch(ge){zu(ge)}b.currentTarget=null,y=W}}}}function bt(i,a){var c=a[Sl];c===void 0&&(c=a[Sl]=new Set);var m=i+"__bubble";c.has(m)||(X_(a,i,2,!1),c.add(m))}function fp(i,a,c){var m=0;a&&(m|=4),X_(c,i,m,a)}var wd="_reactListening"+Math.random().toString(36).slice(2);function mp(i){if(!i[wd]){i[wd]=!0,Nu.forEach(function(c){c!=="selectionchange"&&(bT.has(c)||fp(c,!1,i),fp(c,!0,i))});var a=i.nodeType===9?i:i.ownerDocument;a===null||a[wd]||(a[wd]=!0,fp("selectionchange",!1,a))}}function X_(i,a,c,m){switch(Ny(a)){case 2:var b=GT;break;case 8:b=WT;break;default:b=Ap}c=b.bind(null,a,c,i),b=void 0,!Of||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(b=!0),m?b!==void 0?i.addEventListener(a,c,{capture:!0,passive:b}):i.addEventListener(a,c,!0):b!==void 0?i.addEventListener(a,c,{passive:b}):i.addEventListener(a,c,!1)}function pp(i,a,c,m,b){var y=m;if((a&1)===0&&(a&2)===0&&m!==null)e:for(;;){if(m===null)return;var E=m.tag;if(E===3||E===4){var z=m.stateNode.containerInfo;if(z===b)break;if(E===4)for(E=m.return;E!==null;){var W=E.tag;if((W===3||W===4)&&E.stateNode.containerInfo===b)return;E=E.return}for(;z!==null;){if(E=dn(z),E===null)return;if(W=E.tag,W===5||W===6||W===26||W===27){m=y=E;continue e}z=z.parentNode}}m=m.return}Au(function(){var ae=y,ge=ct(c),we=[];e:{var le=Av.get(i);if(le!==void 0){var he=Du,Ke=i;switch(i){case"keypress":if(Ru(c)===0)break e;case"keydown":case"keyup":he=dA;break;case"focusin":Ke="focus",he=Pf;break;case"focusout":Ke="blur",he=Pf;break;case"beforeblur":case"afterblur":he=Pf;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=iv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":he=J5;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":he=mA;break;case Nv:case Cv:case Ev:he=sA;break;case jv:he=gA;break;case"scroll":case"scrollend":he=Z5;break;case"wheel":he=bA;break;case"copy":case"cut":case"paste":he=iA;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":he=av;break;case"toggle":case"beforetoggle":he=_A}var nt=(a&4)!==0,Ht=!nt&&(i==="scroll"||i==="scrollend"),te=nt?le!==null?le+"Capture":null:le;nt=[];for(var J=ae,re;J!==null;){var ve=J;if(re=ve.stateNode,ve=ve.tag,ve!==5&&ve!==26&&ve!==27||re===null||te===null||(ve=Al(J,te),ve!=null&&nt.push(lc(J,ve,re))),Ht)break;J=J.return}0<nt.length&&(le=new he(le,Ke,null,c,ge),we.push({event:le,listeners:nt}))}}if((a&7)===0){e:{if(le=i==="mouseover"||i==="pointerover",he=i==="mouseout"||i==="pointerout",le&&c!==Qe&&(Ke=c.relatedTarget||c.fromElement)&&(dn(Ke)||Ke[Or]))break e;if((he||le)&&(le=ge.window===ge?ge:(le=ge.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=iv,ve="onMouseLeave",te="onMouseEnter",J="mouse",(i==="pointerout"||i==="pointerover")&&(nt=av,ve="onPointerLeave",te="onPointerEnter",J="pointer"),Ht=he==null?le:Lr(he),re=Ke==null?le:Lr(Ke),le=new nt(ve,J+"leave",he,c,ge),le.target=Ht,le.relatedTarget=re,ve=null,dn(ge)===ae&&(nt=new nt(te,J+"enter",Ke,c,ge),nt.target=re,nt.relatedTarget=Ht,ve=nt),Ht=ve,he&&Ke)t:{for(nt=vT,te=he,J=Ke,re=0,ve=te;ve;ve=nt(ve))re++;ve=0;for(var st=J;st;st=nt(st))ve++;for(;0<re-ve;)te=nt(te),re--;for(;0<ve-re;)J=nt(J),ve--;for(;re--;){if(te===J||J!==null&&te===J.alternate){nt=te;break t}te=nt(te),J=nt(J)}nt=null}else nt=null;he!==null&&Z_(we,le,he,nt,!1),Ke!==null&&Ht!==null&&Z_(we,Ht,Ke,nt,!0)}}e:{if(le=ae?Lr(ae):window,he=le.nodeName&&le.nodeName.toLowerCase(),he==="select"||he==="input"&&le.type==="file")var jt=mv;else if(hv(le))if(pv)jt=TA;else{jt=jA;var Je=EA}else he=le.nodeName,!he||he.toLowerCase()!=="input"||le.type!=="checkbox"&&le.type!=="radio"?ae&&Br(ae.elementType)&&(jt=mv):jt=AA;if(jt&&(jt=jt(i,ae))){fv(we,jt,c,ge);break e}Je&&Je(i,le,ae),i==="focusout"&&ae&&le.type==="number"&&ae.memoizedProps.value!=null&&vo(le,"number",le.value)}switch(Je=ae?Lr(ae):window,i){case"focusin":(hv(Je)||Je.contentEditable==="true")&&(wo=Je,qf=ae,Bl=null);break;case"focusout":Bl=qf=wo=null;break;case"mousedown":Vf=!0;break;case"contextmenu":case"mouseup":case"dragend":Vf=!1,Sv(we,c,ge);break;case"selectionchange":if(MA)break;case"keydown":case"keyup":Sv(we,c,ge)}var dt;if($f)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 yo?uv(i,c)&&(yt="onCompositionEnd"):i==="keydown"&&c.keyCode===229&&(yt="onCompositionStart");yt&&(ov&&c.locale!=="ko"&&(yo||yt!=="onCompositionStart"?yt==="onCompositionEnd"&&yo&&(dt=sv()):(Ir=ge,Lf="value"in Ir?Ir.value:Ir.textContent,yo=!0)),Je=Sd(ae,yt),0<Je.length&&(yt=new rv(yt,i,null,c,ge),we.push({event:yt,listeners:Je}),dt?yt.data=dt:(dt=dv(c),dt!==null&&(yt.data=dt)))),(dt=wA?SA(i,c):kA(i,c))&&(yt=Sd(ae,"onBeforeInput"),0<yt.length&&(Je=new rv("onBeforeInput","beforeinput",null,c,ge),we.push({event:Je,listeners:yt}),Je.data=dt)),pT(we,i,ae,c,ge)}Y_(we,a)})}function lc(i,a,c){return{instance:i,listener:a,currentTarget:c}}function Sd(i,a){for(var c=a+"Capture",m=[];i!==null;){var b=i,y=b.stateNode;if(b=b.tag,b!==5&&b!==26&&b!==27||y===null||(b=Al(i,c),b!=null&&m.unshift(lc(i,b,y)),b=Al(i,a),b!=null&&m.push(lc(i,b,y))),i.tag===3)return m;i=i.return}return[]}function vT(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function Z_(i,a,c,m,b){for(var y=a._reactName,E=[];c!==null&&c!==m;){var z=c,W=z.alternate,ae=z.stateNode;if(z=z.tag,W!==null&&W===m)break;z!==5&&z!==26&&z!==27||ae===null||(W=ae,b?(ae=Al(c,y),ae!=null&&E.unshift(lc(c,ae,W))):b||(ae=Al(c,y),ae!=null&&E.push(lc(c,ae,W)))),c=c.return}E.length!==0&&i.push({event:a,listeners:E})}var _T=/\r\n?/g,yT=/\u0000|\uFFFD/g;function Q_(i){return(typeof i=="string"?i:""+i).replace(_T,`
|
|
10
|
-
`).replace(yT,"")}function J_(i,a){return a=Q_(a),Q_(i)===a}function $t(i,a,c,m,b,y){switch(c){case"children":typeof m=="string"?a==="body"||a==="textarea"&&m===""||it(i,m):(typeof m=="number"||typeof m=="bigint")&&a!=="body"&&it(i,""+m);break;case"className":zn(i,"class",m);break;case"tabIndex":zn(i,"tabindex",m);break;case"dir":case"role":case"viewBox":case"width":case"height":zn(i,c,m);break;case"style":Lt(i,m,y);break;case"data":if(a!=="object"){zn(i,"data",m);break}case"src":case"href":if(m===""&&(a!=="a"||c!=="href")){i.removeAttribute(c);break}if(m==null||typeof m=="function"||typeof m=="symbol"||typeof m=="boolean"){i.removeAttribute(c);break}m=Pr(""+m),i.setAttribute(c,m);break;case"action":case"formAction":if(typeof m=="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 y=="function"&&(c==="formAction"?(a!=="input"&&$t(i,a,"name",b.name,b,null),$t(i,a,"formEncType",b.formEncType,b,null),$t(i,a,"formMethod",b.formMethod,b,null),$t(i,a,"formTarget",b.formTarget,b,null)):($t(i,a,"encType",b.encType,b,null),$t(i,a,"method",b.method,b,null),$t(i,a,"target",b.target,b,null)));if(m==null||typeof m=="symbol"||typeof m=="boolean"){i.removeAttribute(c);break}m=Pr(""+m),i.setAttribute(c,m);break;case"onClick":m!=null&&(i.onclick=Pe);break;case"onScroll":m!=null&&bt("scroll",i);break;case"onScrollEnd":m!=null&&bt("scrollend",i);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(n(61));if(c=m.__html,c!=null){if(b.children!=null)throw Error(n(60));i.innerHTML=c}}break;case"multiple":i.multiple=m&&typeof m!="function"&&typeof m!="symbol";break;case"muted":i.muted=m&&typeof m!="function"&&typeof m!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(m==null||typeof m=="function"||typeof m=="boolean"||typeof m=="symbol"){i.removeAttribute("xlink:href");break}c=Pr(""+m),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":m!=null&&typeof m!="function"&&typeof m!="symbol"?i.setAttribute(c,""+m):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":m&&typeof m!="function"&&typeof m!="symbol"?i.setAttribute(c,""):i.removeAttribute(c);break;case"capture":case"download":m===!0?i.setAttribute(c,""):m!==!1&&m!=null&&typeof m!="function"&&typeof m!="symbol"?i.setAttribute(c,m):i.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":m!=null&&typeof m!="function"&&typeof m!="symbol"&&!isNaN(m)&&1<=m?i.setAttribute(c,m):i.removeAttribute(c);break;case"rowSpan":case"start":m==null||typeof m=="function"||typeof m=="symbol"||isNaN(m)?i.removeAttribute(c):i.setAttribute(c,m);break;case"popover":bt("beforetoggle",i),bt("toggle",i),sn(i,"popover",m);break;case"xlinkActuate":kn(i,"http://www.w3.org/1999/xlink","xlink:actuate",m);break;case"xlinkArcrole":kn(i,"http://www.w3.org/1999/xlink","xlink:arcrole",m);break;case"xlinkRole":kn(i,"http://www.w3.org/1999/xlink","xlink:role",m);break;case"xlinkShow":kn(i,"http://www.w3.org/1999/xlink","xlink:show",m);break;case"xlinkTitle":kn(i,"http://www.w3.org/1999/xlink","xlink:title",m);break;case"xlinkType":kn(i,"http://www.w3.org/1999/xlink","xlink:type",m);break;case"xmlBase":kn(i,"http://www.w3.org/XML/1998/namespace","xml:base",m);break;case"xmlLang":kn(i,"http://www.w3.org/XML/1998/namespace","xml:lang",m);break;case"xmlSpace":kn(i,"http://www.w3.org/XML/1998/namespace","xml:space",m);break;case"is":sn(i,"is",m);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=rr.get(c)||c,sn(i,c,m))}}function gp(i,a,c,m,b,y){switch(c){case"style":Lt(i,m,y);break;case"dangerouslySetInnerHTML":if(m!=null){if(typeof m!="object"||!("__html"in m))throw Error(n(61));if(c=m.__html,c!=null){if(b.children!=null)throw Error(n(60));i.innerHTML=c}}break;case"children":typeof m=="string"?it(i,m):(typeof m=="number"||typeof m=="bigint")&&it(i,""+m);break;case"onScroll":m!=null&&bt("scroll",i);break;case"onScrollEnd":m!=null&&bt("scrollend",i);break;case"onClick":m!=null&&(i.onclick=Pe);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ca.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(b=c.endsWith("Capture"),a=c.slice(2,b?c.length-7:void 0),y=i[tn]||null,y=y!=null?y[c]:null,typeof y=="function"&&i.removeEventListener(a,y,b),typeof m=="function")){typeof y!="function"&&y!==null&&(c in i?i[c]=null:i.hasAttribute(c)&&i.removeAttribute(c)),i.addEventListener(a,m,b);break e}c in i?i[c]=m:m===!0?i.setAttribute(c,""):sn(i,c,m)}}}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":bt("error",i),bt("load",i);var m=!1,b=!1,y;for(y in c)if(c.hasOwnProperty(y)){var E=c[y];if(E!=null)switch(y){case"src":m=!0;break;case"srcSet":b=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(n(137,a));default:$t(i,a,y,E,c,null)}}b&&$t(i,a,"srcSet",c.srcSet,c,null),m&&$t(i,a,"src",c.src,c,null);return;case"input":bt("invalid",i);var z=y=E=b=null,W=null,ae=null;for(m in c)if(c.hasOwnProperty(m)){var ge=c[m];if(ge!=null)switch(m){case"name":b=ge;break;case"type":E=ge;break;case"checked":W=ge;break;case"defaultChecked":ae=ge;break;case"value":y=ge;break;case"defaultValue":z=ge;break;case"children":case"dangerouslySetInnerHTML":if(ge!=null)throw Error(n(137,a));break;default:$t(i,a,m,ge,c,null)}}Ea(i,y,z,W,ae,E,b,!1);return;case"select":bt("invalid",i),m=E=y=null;for(b in c)if(c.hasOwnProperty(b)&&(z=c[b],z!=null))switch(b){case"value":y=z;break;case"defaultValue":E=z;break;case"multiple":m=z;default:$t(i,a,b,z,c,null)}a=y,c=E,i.multiple=!!m,a!=null?qs(i,!!m,a,!1):c!=null&&qs(i,!!m,c,!0);return;case"textarea":bt("invalid",i),y=b=m=null;for(E in c)if(c.hasOwnProperty(E)&&(z=c[E],z!=null))switch(E){case"value":m=z;break;case"defaultValue":b=z;break;case"children":y=z;break;case"dangerouslySetInnerHTML":if(z!=null)throw Error(n(91));break;default:$t(i,a,E,z,c,null)}_o(i,m,b,y);return;case"option":for(W in c)c.hasOwnProperty(W)&&(m=c[W],m!=null)&&(W==="selected"?i.selected=m&&typeof m!="function"&&typeof m!="symbol":$t(i,a,W,m,c,null));return;case"dialog":bt("beforetoggle",i),bt("toggle",i),bt("cancel",i),bt("close",i);break;case"iframe":case"object":bt("load",i);break;case"video":case"audio":for(m=0;m<oc.length;m++)bt(oc[m],i);break;case"image":bt("error",i),bt("load",i);break;case"details":bt("toggle",i);break;case"embed":case"source":case"link":bt("error",i),bt("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)&&(m=c[ae],m!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":throw Error(n(137,a));default:$t(i,a,ae,m,c,null)}return;default:if(Br(a)){for(ge in c)c.hasOwnProperty(ge)&&(m=c[ge],m!==void 0&&gp(i,a,ge,m,c,void 0));return}}for(z in c)c.hasOwnProperty(z)&&(m=c[z],m!=null&&$t(i,a,z,m,c,null))}function wT(i,a,c,m){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var b=null,y=null,E=null,z=null,W=null,ae=null,ge=null;for(he in c){var we=c[he];if(c.hasOwnProperty(he)&&we!=null)switch(he){case"checked":break;case"value":break;case"defaultValue":W=we;default:m.hasOwnProperty(he)||$t(i,a,he,null,m,we)}}for(var le in m){var he=m[le];if(we=c[le],m.hasOwnProperty(le)&&(he!=null||we!=null))switch(le){case"type":y=he;break;case"name":b=he;break;case"checked":ae=he;break;case"defaultChecked":ge=he;break;case"value":E=he;break;case"defaultValue":z=he;break;case"children":case"dangerouslySetInnerHTML":if(he!=null)throw Error(n(137,a));break;default:he!==we&&$t(i,a,le,he,m,we)}}Cl(i,E,z,W,ae,ge,y,b);return;case"select":he=E=z=le=null;for(y in c)if(W=c[y],c.hasOwnProperty(y)&&W!=null)switch(y){case"value":break;case"multiple":he=W;default:m.hasOwnProperty(y)||$t(i,a,y,null,m,W)}for(b in m)if(y=m[b],W=c[b],m.hasOwnProperty(b)&&(y!=null||W!=null))switch(b){case"value":le=y;break;case"defaultValue":z=y;break;case"multiple":E=y;default:y!==W&&$t(i,a,b,y,m,W)}a=z,c=E,m=he,le!=null?qs(i,!!c,le,!1):!!m!=!!c&&(a!=null?qs(i,!!c,a,!0):qs(i,!!c,c?[]:"",!1));return;case"textarea":he=le=null;for(z in c)if(b=c[z],c.hasOwnProperty(z)&&b!=null&&!m.hasOwnProperty(z))switch(z){case"value":break;case"children":break;default:$t(i,a,z,null,m,b)}for(E in m)if(b=m[E],y=c[E],m.hasOwnProperty(E)&&(b!=null||y!=null))switch(E){case"value":le=b;break;case"defaultValue":he=b;break;case"children":break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(n(91));break;default:b!==y&&$t(i,a,E,b,m,y)}Eu(i,le,he);return;case"option":for(var Ke in c)le=c[Ke],c.hasOwnProperty(Ke)&&le!=null&&!m.hasOwnProperty(Ke)&&(Ke==="selected"?i.selected=!1:$t(i,a,Ke,null,m,le));for(W in m)le=m[W],he=c[W],m.hasOwnProperty(W)&&le!==he&&(le!=null||he!=null)&&(W==="selected"?i.selected=le&&typeof le!="function"&&typeof le!="symbol":$t(i,a,W,le,m,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&&!m.hasOwnProperty(nt)&&$t(i,a,nt,null,m,le);for(ae in m)if(le=m[ae],he=c[ae],m.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,m,he)}return;default:if(Br(a)){for(var Ht in c)le=c[Ht],c.hasOwnProperty(Ht)&&le!==void 0&&!m.hasOwnProperty(Ht)&&gp(i,a,Ht,void 0,m,le);for(ge in m)le=m[ge],he=c[ge],!m.hasOwnProperty(ge)||le===he||le===void 0&&he===void 0||gp(i,a,ge,le,m,he);return}}for(var te in c)le=c[te],c.hasOwnProperty(te)&&le!=null&&!m.hasOwnProperty(te)&&$t(i,a,te,null,m,le);for(we in m)le=m[we],he=c[we],!m.hasOwnProperty(we)||le===he||le==null&&he==null||$t(i,a,we,le,m,he)}function ey(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function ST(){if(typeof performance.getEntriesByType=="function"){for(var i=0,a=0,c=performance.getEntriesByType("resource"),m=0;m<c.length;m++){var b=c[m],y=b.transferSize,E=b.initiatorType,z=b.duration;if(y&&z&&ey(E)){for(E=0,z=b.responseEnd,m+=1;m<c.length;m++){var W=c[m],ae=W.startTime;if(ae>z)break;var ge=W.transferSize,we=W.initiatorType;ge&&ey(we)&&(W=W.responseEnd,E+=ge*(W<z?1:(z-ae)/(W-ae)))}if(--m,a+=8*(y+E)/(b.duration/1e3),i++,10<i)break}}if(0<i)return a/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var xp=null,bp=null;function kd(i){return i.nodeType===9?i:i.ownerDocument}function ty(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 sy(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 vp(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 _p=null;function kT(){var i=window.event;return i&&i.type==="popstate"?i===_p?!1:(_p=i,!0):(_p=null,!1)}var ny=typeof setTimeout=="function"?setTimeout:void 0,NT=typeof clearTimeout=="function"?clearTimeout:void 0,iy=typeof Promise=="function"?Promise:void 0,CT=typeof queueMicrotask=="function"?queueMicrotask:typeof iy<"u"?function(i){return iy.resolve(null).then(i).catch(ET)}:ny;function ET(i){setTimeout(function(){throw i})}function sa(i){return i==="head"}function ry(i,a){var c=a,m=0;do{var b=c.nextSibling;if(i.removeChild(c),b&&b.nodeType===8)if(c=b.data,c==="/$"||c==="/&"){if(m===0){i.removeChild(b),Yo(a);return}m--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")m++;else if(c==="html")cc(i.ownerDocument.documentElement);else if(c==="head"){c=i.ownerDocument.head,cc(c);for(var y=c.firstChild;y;){var E=y.nextSibling,z=y.nodeName;y[Na]||z==="SCRIPT"||z==="STYLE"||z==="LINK"&&y.rel.toLowerCase()==="stylesheet"||c.removeChild(y),y=E}}else c==="body"&&cc(i.ownerDocument.body);c=b}while(c);Yo(a)}function ay(i,a){var c=i;i=0;do{var m=c.nextSibling;if(c.nodeType===1?a?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(a?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),m&&m.nodeType===8)if(c=m.data,c==="/$"){if(i===0)break;i--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||i++;c=m}while(c)}function yp(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":yp(c),kl(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}i.removeChild(c)}}function jT(i,a,c,m){for(;i.nodeType===1;){var b=c;if(i.nodeName.toLowerCase()!==a.toLowerCase()){if(!m&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(m){if(!i[Na])switch(a){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(y=i.getAttribute("rel"),y==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(y!==b.rel||i.getAttribute("href")!==(b.href==null||b.href===""?null:b.href)||i.getAttribute("crossorigin")!==(b.crossOrigin==null?null:b.crossOrigin)||i.getAttribute("title")!==(b.title==null?null:b.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(y=i.getAttribute("src"),(y!==(b.src==null?null:b.src)||i.getAttribute("type")!==(b.type==null?null:b.type)||i.getAttribute("crossorigin")!==(b.crossOrigin==null?null:b.crossOrigin))&&y&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(a==="input"&&i.type==="hidden"){var y=b.name==null?null:""+b.name;if(b.type==="hidden"&&i.getAttribute("name")===y)return i}else return i;if(i=ri(i.nextSibling),i===null)break}return null}function AT(i,a,c){if(a==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!c||(i=ri(i.nextSibling),i===null))return null;return i}function oy(i,a){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!a||(i=ri(i.nextSibling),i===null))return null;return i}function wp(i){return i.data==="$?"||i.data==="$~"}function Sp(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function TT(i,a){var c=i.ownerDocument;if(i.data==="$~")i._reactRetry=a;else if(i.data!=="$?"||c.readyState!=="loading")a();else{var m=function(){a(),c.removeEventListener("DOMContentLoaded",m)};c.addEventListener("DOMContentLoaded",m),i._reactRetry=m}}function ri(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 kp=null;function ly(i){i=i.nextSibling;for(var a=0;i;){if(i.nodeType===8){var c=i.data;if(c==="/$"||c==="/&"){if(a===0)return ri(i.nextSibling);a--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||a++}i=i.nextSibling}return null}function cy(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 uy(i,a,c){switch(a=kd(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 cc(i){for(var a=i.attributes;a.length;)i.removeAttributeNode(a[0]);kl(i)}var ai=new Map,dy=new Set;function Nd(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var yr=X.d;X.d={f:RT,r:MT,D:DT,C:OT,L:LT,m:zT,X:PT,S:BT,M:IT};function RT(){var i=yr.f(),a=gd();return i||a}function MT(i){var a=nr(i);a!==null&&a.tag===5&&a.type==="form"?j1(a):yr.r(i)}var Go=typeof document>"u"?null:document;function hy(i,a,c){var m=Go;if(m&&typeof a=="string"&&a){var b=Nn(a);b='link[rel="'+i+'"][href="'+b+'"]',typeof c=="string"&&(b+='[crossorigin="'+c+'"]'),dy.has(b)||(dy.add(b),i={rel:i,crossOrigin:c,href:a},m.querySelector(b)===null&&(a=m.createElement("link"),Ks(a,"link",i),vs(a),m.head.appendChild(a)))}}function DT(i){yr.D(i),hy("dns-prefetch",i,null)}function OT(i,a){yr.C(i,a),hy("preconnect",i,a)}function LT(i,a,c){yr.L(i,a,c);var m=Go;if(m&&i&&a){var b='link[rel="preload"][as="'+Nn(a)+'"]';a==="image"&&c&&c.imageSrcSet?(b+='[imagesrcset="'+Nn(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(b+='[imagesizes="'+Nn(c.imageSizes)+'"]')):b+='[href="'+Nn(i)+'"]';var y=b;switch(a){case"style":y=Wo(i);break;case"script":y=Ko(i)}ai.has(y)||(i=g({rel:"preload",href:a==="image"&&c&&c.imageSrcSet?void 0:i,as:a},c),ai.set(y,i),m.querySelector(b)!==null||a==="style"&&m.querySelector(uc(y))||a==="script"&&m.querySelector(dc(y))||(a=m.createElement("link"),Ks(a,"link",i),vs(a),m.head.appendChild(a)))}}function zT(i,a){yr.m(i,a);var c=Go;if(c&&i){var m=a&&typeof a.as=="string"?a.as:"script",b='link[rel="modulepreload"][as="'+Nn(m)+'"][href="'+Nn(i)+'"]',y=b;switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=Ko(i)}if(!ai.has(y)&&(i=g({rel:"modulepreload",href:i},a),ai.set(y,i),c.querySelector(b)===null)){switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(dc(y)))return}m=c.createElement("link"),Ks(m,"link",i),vs(m),c.head.appendChild(m)}}}function BT(i,a,c){yr.S(i,a,c);var m=Go;if(m&&i){var b=zr(m).hoistableStyles,y=Wo(i);a=a||"default";var E=b.get(y);if(!E){var z={loading:0,preload:null};if(E=m.querySelector(uc(y)))z.loading=5;else{i=g({rel:"stylesheet",href:i,"data-precedence":a},c),(c=ai.get(y))&&Np(i,c);var W=E=m.createElement("link");vs(W),Ks(W,"link",i),W._p=new Promise(function(ae,ge){W.onload=ae,W.onerror=ge}),W.addEventListener("load",function(){z.loading|=1}),W.addEventListener("error",function(){z.loading|=2}),z.loading|=4,Cd(E,a,m)}E={type:"stylesheet",instance:E,count:1,state:z},b.set(y,E)}}}function PT(i,a){yr.X(i,a);var c=Go;if(c&&i){var m=zr(c).hoistableScripts,b=Ko(i),y=m.get(b);y||(y=c.querySelector(dc(b)),y||(i=g({src:i,async:!0},a),(a=ai.get(b))&&Cp(i,a),y=c.createElement("script"),vs(y),Ks(y,"link",i),c.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},m.set(b,y))}}function IT(i,a){yr.M(i,a);var c=Go;if(c&&i){var m=zr(c).hoistableScripts,b=Ko(i),y=m.get(b);y||(y=c.querySelector(dc(b)),y||(i=g({src:i,async:!0,type:"module"},a),(a=ai.get(b))&&Cp(i,a),y=c.createElement("script"),vs(y),Ks(y,"link",i),c.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},m.set(b,y))}}function fy(i,a,c,m){var b=(b=je.current)?Nd(b):null;if(!b)throw Error(n(446));switch(i){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(a=Wo(c.href),c=zr(b).hoistableStyles,m=c.get(a),m||(m={type:"style",instance:null,count:0,state:null},c.set(a,m)),m):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){i=Wo(c.href);var y=zr(b).hoistableStyles,E=y.get(i);if(E||(b=b.ownerDocument||b,E={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(i,E),(y=b.querySelector(uc(i)))&&!y._p&&(E.instance=y,E.state.loading=5),ai.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},ai.set(i,c),y||$T(b,i,c,E.state))),a&&m===null)throw Error(n(528,""));return E}if(a&&m!==null)throw Error(n(529,""));return null;case"script":return a=c.async,c=c.src,typeof c=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=Ko(c),c=zr(b).hoistableScripts,m=c.get(a),m||(m={type:"script",instance:null,count:0,state:null},c.set(a,m)),m):{type:"void",instance:null,count:0,state:null};default:throw Error(n(444,i))}}function Wo(i){return'href="'+Nn(i)+'"'}function uc(i){return'link[rel="stylesheet"]['+i+"]"}function my(i){return g({},i,{"data-precedence":i.precedence,precedence:null})}function $T(i,a,c,m){i.querySelector('link[rel="preload"][as="style"]['+a+"]")?m.loading=1:(a=i.createElement("link"),m.preload=a,a.addEventListener("load",function(){return m.loading|=1}),a.addEventListener("error",function(){return m.loading|=2}),Ks(a,"link",c),vs(a),i.head.appendChild(a))}function Ko(i){return'[src="'+Nn(i)+'"]'}function dc(i){return"script[async]"+i}function py(i,a,c){if(a.count++,a.instance===null)switch(a.type){case"style":var m=i.querySelector('style[data-href~="'+Nn(c.href)+'"]');if(m)return a.instance=m,vs(m),m;var b=g({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return m=(i.ownerDocument||i).createElement("style"),vs(m),Ks(m,"style",b),Cd(m,c.precedence,i),a.instance=m;case"stylesheet":b=Wo(c.href);var y=i.querySelector(uc(b));if(y)return a.state.loading|=4,a.instance=y,vs(y),y;m=my(c),(b=ai.get(b))&&Np(m,b),y=(i.ownerDocument||i).createElement("link"),vs(y);var E=y;return E._p=new Promise(function(z,W){E.onload=z,E.onerror=W}),Ks(y,"link",m),a.state.loading|=4,Cd(y,c.precedence,i),a.instance=y;case"script":return y=Ko(c.src),(b=i.querySelector(dc(y)))?(a.instance=b,vs(b),b):(m=c,(b=ai.get(y))&&(m=g({},c),Cp(m,b)),i=i.ownerDocument||i,b=i.createElement("script"),vs(b),Ks(b,"link",m),i.head.appendChild(b),a.instance=b);case"void":return null;default:throw Error(n(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(m=a.instance,a.state.loading|=4,Cd(m,c.precedence,i));return a.instance}function Cd(i,a,c){for(var m=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),b=m.length?m[m.length-1]:null,y=b,E=0;E<m.length;E++){var z=m[E];if(z.dataset.precedence===a)y=z;else if(y!==b)break}y?y.parentNode.insertBefore(i,y.nextSibling):(a=c.nodeType===9?c.head:c,a.insertBefore(i,a.firstChild))}function Np(i,a){i.crossOrigin==null&&(i.crossOrigin=a.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=a.referrerPolicy),i.title==null&&(i.title=a.title)}function Cp(i,a){i.crossOrigin==null&&(i.crossOrigin=a.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=a.referrerPolicy),i.integrity==null&&(i.integrity=a.integrity)}var Ed=null;function gy(i,a,c){if(Ed===null){var m=new Map,b=Ed=new Map;b.set(c,m)}else b=Ed,m=b.get(c),m||(m=new Map,b.set(c,m));if(m.has(i))return m;for(m.set(i,null),c=c.getElementsByTagName(i),b=0;b<c.length;b++){var y=c[b];if(!(y[Na]||y[fs]||i==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var E=y.getAttribute(a)||"";E=i+E;var z=m.get(E);z?z.push(y):m.set(E,[y])}}return m}function xy(i,a,c){i=i.ownerDocument||i,i.head.insertBefore(c,a==="title"?i.querySelector("head > title"):null)}function HT(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 by(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function UT(i,a,c,m){if(c.type==="stylesheet"&&(typeof m.media!="string"||matchMedia(m.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var b=Wo(m.href),y=a.querySelector(uc(b));if(y){a=y._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(i.count++,i=jd.bind(i),a.then(i,i)),c.state.loading|=4,c.instance=y,vs(y);return}y=a.ownerDocument||a,m=my(m),(b=ai.get(b))&&Np(m,b),y=y.createElement("link"),vs(y);var E=y;E._p=new Promise(function(z,W){E.onload=z,E.onerror=W}),Ks(y,"link",m),c.instance=y}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(c,a),(a=c.state.preload)&&(c.state.loading&3)===0&&(i.count++,c=jd.bind(i),a.addEventListener("load",c),a.addEventListener("error",c))}}var Ep=0;function FT(i,a){return i.stylesheets&&i.count===0&&Td(i,i.stylesheets),0<i.count||0<i.imgCount?function(c){var m=setTimeout(function(){if(i.stylesheets&&Td(i,i.stylesheets),i.unsuspend){var y=i.unsuspend;i.unsuspend=null,y()}},6e4+a);0<i.imgBytes&&Ep===0&&(Ep=62500*ST());var b=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&Td(i,i.stylesheets),i.unsuspend)){var y=i.unsuspend;i.unsuspend=null,y()}},(i.imgBytes>Ep?50:800)+a);return i.unsuspend=c,function(){i.unsuspend=null,clearTimeout(m),clearTimeout(b)}}:null}function jd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Td(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var Ad=null;function Td(i,a){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Ad=new Map,a.forEach(qT,i),Ad=null,jd.call(i))}function qT(i,a){if(!(a.state.loading&4)){var c=Ad.get(i);if(c)var m=c.get(null);else{c=new Map,Ad.set(i,c);for(var b=i.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y<b.length;y++){var E=b[y];(E.nodeName==="LINK"||E.getAttribute("media")!=="not all")&&(c.set(E.dataset.precedence,E),m=E)}m&&c.set(null,m)}b=a.instance,E=b.getAttribute("data-precedence"),y=c.get(E)||m,y===m&&c.set(null,b),c.set(E,b),this.count++,m=jd.bind(this),b.addEventListener("load",m),b.addEventListener("error",m),y?y.parentNode.insertBefore(b,y.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(b,i.firstChild)),a.state.loading|=4}}var hc={$$typeof:j,Provider:null,Consumer:null,_currentValue:U,_currentValue2:U,_threadCount:0};function VT(i,a,c,m,b,y,E,z,W){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=m,this.onUncaughtError=b,this.onCaughtError=y,this.onRecoverableError=E,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=W,this.incompleteTransitions=new Map}function vy(i,a,c,m,b,y,E,z,W,ae,ge,we){return i=new VT(i,a,c,E,W,ae,ge,we,z),a=1,y===!0&&(a|=24),y=In(3,null,null,a),i.current=y,y.stateNode=i,a=am(),a.refCount++,i.pooledCache=a,a.refCount++,y.memoizedState={element:m,isDehydrated:c,cache:a},um(y),i}function _y(i){return i?(i=No,i):No}function yy(i,a,c,m,b,y){b=_y(b),m.context===null?m.context=b:m.pendingContext=b,m=Vr(a),m.payload={element:c},y=y===void 0?null:y,y!==null&&(m.callback=y),c=Gr(i,m,a),c!==null&&(Rn(c,i,a),ql(c,i,a))}function wy(i,a){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var c=i.retryLane;i.retryLane=c!==0&&c<a?c:a}}function jp(i,a){wy(i,a),(i=i.alternate)&&wy(i,a)}function Sy(i){if(i.tag===13||i.tag===31){var a=Ra(i,67108864);a!==null&&Rn(a,i,67108864),jp(i,67108864)}}function ky(i){if(i.tag===13||i.tag===31){var a=qn();a=es(a);var c=Ra(i,a);c!==null&&Rn(c,i,a),jp(i,a)}}var Rd=!0;function GT(i,a,c,m){var b=L.T;L.T=null;var y=X.p;try{X.p=2,Ap(i,a,c,m)}finally{X.p=y,L.T=b}}function WT(i,a,c,m){var b=L.T;L.T=null;var y=X.p;try{X.p=8,Ap(i,a,c,m)}finally{X.p=y,L.T=b}}function Ap(i,a,c,m){if(Rd){var b=Tp(m);if(b===null)pp(i,a,m,Md,c),Cy(i,m);else if(YT(b,i,a,c,m))m.stopPropagation();else if(Cy(i,m),a&4&&-1<KT.indexOf(i)){for(;b!==null;){var y=nr(b);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var E=ze(y.pendingLanes);if(E!==0){var z=y;for(z.pendingLanes|=2,z.entangledLanes|=2;E;){var W=1<<31-M(E);z.entanglements[1]|=W,E&=~W}Pi(y),(Tt&6)===0&&(md=St()+500,ac(0))}}break;case 31:case 13:z=Ra(y,2),z!==null&&Rn(z,y,2),gd(),jp(y,2)}if(y=Tp(m),y===null&&pp(i,a,m,Md,c),y===b)break;b=y}b!==null&&m.stopPropagation()}else pp(i,a,m,null,c)}}function Tp(i){return i=ct(i),Rp(i)}var Md=null;function Rp(i){if(Md=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 Md=i,null}function Ny(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 Js:return 8;case en:case Di:return 32;case S:return 268435456;default:return 32}default:return 32}}var Mp=!1,na=null,ia=null,ra=null,fc=new Map,mc=new Map,aa=[],KT="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 Cy(i,a){switch(i){case"focusin":case"focusout":na=null;break;case"dragenter":case"dragleave":ia=null;break;case"mouseover":case"mouseout":ra=null;break;case"pointerover":case"pointerout":fc.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":mc.delete(a.pointerId)}}function pc(i,a,c,m,b,y){return i===null||i.nativeEvent!==y?(i={blockedOn:a,domEventName:c,eventSystemFlags:m,nativeEvent:y,targetContainers:[b]},a!==null&&(a=nr(a),a!==null&&Sy(a)),i):(i.eventSystemFlags|=m,a=i.targetContainers,b!==null&&a.indexOf(b)===-1&&a.push(b),i)}function YT(i,a,c,m,b){switch(a){case"focusin":return na=pc(na,i,a,c,m,b),!0;case"dragenter":return ia=pc(ia,i,a,c,m,b),!0;case"mouseover":return ra=pc(ra,i,a,c,m,b),!0;case"pointerover":var y=b.pointerId;return fc.set(y,pc(fc.get(y)||null,i,a,c,m,b)),!0;case"gotpointercapture":return y=b.pointerId,mc.set(y,pc(mc.get(y)||null,i,a,c,m,b)),!0}return!1}function Ey(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,po(i.priority,function(){ky(c)});return}}else if(a===31){if(a=h(c),a!==null){i.blockedOn=a,po(i.priority,function(){ky(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 Dd(i){if(i.blockedOn!==null)return!1;for(var a=i.targetContainers;0<a.length;){var c=Tp(i.nativeEvent);if(c===null){c=i.nativeEvent;var m=new c.constructor(c.type,c);Qe=m,c.target.dispatchEvent(m),Qe=null}else return a=nr(c),a!==null&&Sy(a),i.blockedOn=c,!1;a.shift()}return!0}function jy(i,a,c){Dd(i)&&c.delete(a)}function XT(){Mp=!1,na!==null&&Dd(na)&&(na=null),ia!==null&&Dd(ia)&&(ia=null),ra!==null&&Dd(ra)&&(ra=null),fc.forEach(jy),mc.forEach(jy)}function Od(i,a){i.blockedOn===a&&(i.blockedOn=null,Mp||(Mp=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,XT)))}var Ld=null;function Ay(i){Ld!==i&&(Ld=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Ld===i&&(Ld=null);for(var a=0;a<i.length;a+=3){var c=i[a],m=i[a+1],b=i[a+2];if(typeof m!="function"){if(Rp(m||c)===null)continue;break}var y=nr(c);y!==null&&(i.splice(a,3),a-=3,Tm(y,{pending:!0,data:b,method:c.method,action:m},m,b))}}))}function Yo(i){function a(W){return Od(W,i)}na!==null&&Od(na,i),ia!==null&&Od(ia,i),ra!==null&&Od(ra,i),fc.forEach(a),mc.forEach(a);for(var c=0;c<aa.length;c++){var m=aa[c];m.blockedOn===i&&(m.blockedOn=null)}for(;0<aa.length&&(c=aa[0],c.blockedOn===null);)Ey(c),c.blockedOn===null&&aa.shift();if(c=(i.ownerDocument||i).$$reactFormReplay,c!=null)for(m=0;m<c.length;m+=3){var b=c[m],y=c[m+1],E=b[tn]||null;if(typeof y=="function")E||Ay(c);else if(E){var z=null;if(y&&y.hasAttribute("formAction")){if(b=y,E=y[tn]||null)z=E.formAction;else if(Rp(b)!==null)continue}else z=E.action;typeof z=="function"?c[m+1]=z:(c.splice(m,3),m-=3),Ay(c)}}}function Ty(){function i(y){y.canIntercept&&y.info==="react-transition"&&y.intercept({handler:function(){return new Promise(function(E){return b=E})},focusReset:"manual",scroll:"manual"})}function a(){b!==null&&(b(),b=null),m||setTimeout(c,20)}function c(){if(!m&&!navigation.transition){var y=navigation.currentEntry;y&&y.url!=null&&navigation.navigate(y.url,{state:y.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var m=!1,b=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(c,100),function(){m=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),b!==null&&(b(),b=null)}}}function Dp(i){this._internalRoot=i}zd.prototype.render=Dp.prototype.render=function(i){var a=this._internalRoot;if(a===null)throw Error(n(409));var c=a.current,m=qn();yy(c,m,i,a,null,null)},zd.prototype.unmount=Dp.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var a=i.containerInfo;yy(i.current,2,null,i,null,null),gd(),a[Or]=null}};function zd(i){this._internalRoot=i}zd.prototype.unstable_scheduleHydration=function(i){if(i){var a=mo();i={blockedOn:null,target:i,priority:a};for(var c=0;c<aa.length&&a!==0&&a<aa[c].priority;c++);aa.splice(c,0,i),c===0&&Ey(i)}};var Ry=t.version;if(Ry!=="19.2.6")throw Error(n(527,Ry,"19.2.6"));X.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 ZT={bundleType:0,version:"19.2.6",rendererPackageName:"react-dom",currentDispatcherRef:L,reconcilerVersion:"19.2.6"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Bd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Bd.isDisabled&&Bd.supportsFiber)try{be=Bd.inject(ZT),ce=Bd}catch{}}return xc.createRoot=function(i,a){if(!o(i))throw Error(n(299));var c=!1,m="",b=P1,y=I1,E=$1;return a!=null&&(a.unstable_strictMode===!0&&(c=!0),a.identifierPrefix!==void 0&&(m=a.identifierPrefix),a.onUncaughtError!==void 0&&(b=a.onUncaughtError),a.onCaughtError!==void 0&&(y=a.onCaughtError),a.onRecoverableError!==void 0&&(E=a.onRecoverableError)),a=vy(i,1,!1,null,null,c,m,null,b,y,E,Ty),i[Or]=a.current,mp(i),new Dp(a)},xc.hydrateRoot=function(i,a,c){if(!o(i))throw Error(n(299));var m=!1,b="",y=P1,E=I1,z=$1,W=null;return c!=null&&(c.unstable_strictMode===!0&&(m=!0),c.identifierPrefix!==void 0&&(b=c.identifierPrefix),c.onUncaughtError!==void 0&&(y=c.onUncaughtError),c.onCaughtError!==void 0&&(E=c.onCaughtError),c.onRecoverableError!==void 0&&(z=c.onRecoverableError),c.formState!==void 0&&(W=c.formState)),a=vy(i,1,!0,a,c??null,m,b,W,y,E,z,Ty),a.context=_y(null),c=a.current,m=qn(),m=es(m),b=Vr(m),b.callback=null,Gr(c,b,m),c=m,a.current.lanes=c,Mt(a,c),Pi(a),i[Or]=a.current,mp(i),new zd(a)},xc.version="19.2.6",xc}var Hy;function o4(){if(Hy)return zp.exports;Hy=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),zp.exports=a4(),zp.exports}var MN=o4();const DN=(...e)=>e.filter((t,s,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===s).join(" ").trim();const l4=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const c4=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,s,n)=>n?n.toUpperCase():s.toLowerCase());const Uy=e=>{const t=c4(e);return t.charAt(0).toUpperCase()+t.slice(1)};var $p={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 u4=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},d4=_.createContext({}),h4=()=>_.useContext(d4),f4=_.forwardRef(({color:e,size:t,strokeWidth:s,absoluteStrokeWidth:n,className:o="",children:l,iconNode:u,...h},f)=>{const{size:d=24,strokeWidth:p=2,absoluteStrokeWidth:g=!1,color:x="currentColor",className:v=""}=h4()??{},w=n??g?Number(s??p)*24/Number(t??d):s??p;return _.createElement("svg",{ref:f,...$p,width:t??d??$p.width,height:t??d??$p.height,stroke:e??x,strokeWidth:w,className:DN("lucide",v,o),...!l&&!u4(h)&&{"aria-hidden":"true"},...h},[...u.map(([k,C])=>_.createElement(k,C)),...Array.isArray(l)?l:[l]])});const pe=(e,t)=>{const s=_.forwardRef(({className:n,...o},l)=>_.createElement(f4,{ref:l,iconNode:t,className:DN(`lucide-${l4(Uy(e))}`,`lucide-${e}`,n),...o}));return s.displayName=Uy(e),s};const m4=[["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"}]],to=pe("activity",m4);const p4=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],Fy=pe("archive",p4);const g4=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],cf=pe("arrow-down",g4);const x4=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],ru=pe("arrow-left",x4);const b4=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],uf=pe("arrow-up",b4);const v4=[["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"}]],_4=pe("blocks",v4);const y4=[["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"}]],w4=pe("book-open",y4);const S4=[["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"}]],k4=pe("bot",S4);const N4=[["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"}]],ON=pe("box",N4);const C4=[["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"}]],E4=pe("braces",C4);const j4=[["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"}]],LN=pe("brain",j4);const A4=[["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"}]],T4=pe("calendar",A4);const R4=[["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"}]],zN=pe("camera",R4);const M4=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ln=pe("check",M4);const D4=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],vn=pe("chevron-down",D4);const O4=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],L4=pe("chevron-left",O4);const z4=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Zn=pe("chevron-right",z4);const B4=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],df=pe("chevron-up",B4);const P4=[["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"}]],U0=pe("circle-alert",P4);const I4=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],hf=pe("circle-check-big",I4);const $4=[["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=pe("circle-dashed",$4);const U4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],F4=pe("circle-dot",U4);const q4=[["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"}]],V4=pe("circle-play",q4);const G4=[["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"}]],F0=pe("circle-x",G4);const W4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Yc=pe("circle",W4);const K4=[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],BN=pe("cloud-upload",K4);const Y4=[["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"}]],PN=pe("code-xml",Y4);const X4=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Th=pe("copy",X4);const Z4=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],Q4=pe("corner-down-left",Z4);const J4=[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],eR=pe("corner-down-right",J4);const tR=[["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"}]],sR=pe("cpu",tR);const nR=[["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"}]],mi=pe("database",nR);const iR=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],rR=pe("dollar-sign",iR);const aR=[["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"}]],cl=pe("download",aR);const oR=[["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"}]],lR=pe("earth",oR);const cR=[["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"}]],IN=pe("ellipsis",cR);const uR=[["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"}]],Ar=pe("external-link",uR);const dR=[["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"}]],$N=pe("eye-off",dR);const hR=[["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"}]],q0=pe("eye",hR);const fR=[["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"}]],HN=pe("file-code-corner",fR);const mR=[["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"}]],UN=pe("file-diff",mR);const pR=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],FN=pe("file-exclamation-point",pR);const gR=[["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"}]],xR=pe("file-spreadsheet",gR);const bR=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"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"}]],V0=pe("file-text",bR);const vR=[["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"}]],qN=pe("file",vR);const _R=[["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"}]],yR=pe("flask-conical",_R);const wR=[["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"}]],G0=pe("folder-git-2",wR);const SR=[["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"}]],ff=pe("folder-open",SR);const kR=[["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"}]],VN=pe("folder-plus",kR);const NR=[["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"}]],va=pe("folder",NR);const CR=[["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"}]],ER=pe("funnel",CR);const jR=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],GN=pe("gauge",jR);const AR=[["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"}]],bn=pe("git-branch",AR);const TR=[["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"}]],RR=pe("git-commit-horizontal",TR);const MR=[["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"}]],qy=pe("git-fork",MR);const DR=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]],Rh=pe("git-merge",DR);const OR=[["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"}]],LR=pe("git-pull-request-closed",OR);const zR=[["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"}]],BR=pe("git-pull-request-create",zR);const PR=[["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"}]],WN=pe("git-pull-request",PR);const IR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],KN=pe("globe",IR);const $R=[["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"}]],HR=pe("grip-vertical",$R);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"}]],FR=pe("heart",UR);const qR=[["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"}]],VR=pe("history",qR);const GR=[["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"}]],WR=pe("image",GR);const KR=[["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"}]],Mh=pe("inbox",KR);const YR=[["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"}]],YN=pe("key-round",YR);const XR=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],ZR=pe("layers",XR);const QR=[["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"}]],JR=pe("list-collapse",QR);const eM=[["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"}]],tM=pe("list-tree",eM);const sM=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Et=pe("loader-circle",sM);const nM=[["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"}]],Vy=pe("loader",nM);const iM=[["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"}]],rM=pe("lock-keyhole",iM);const aM=[["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"}]],XN=pe("lock-open",aM);const oM=[["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"}]],lM=pe("lock",oM);const cM=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],uM=pe("log-in",cM);const dM=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],hM=pe("log-out",dM);const fM=[["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"}]],ZN=pe("maximize-2",fM);const mM=[["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"}]],pM=pe("memory-stick",mM);const gM=[["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"}]],xM=pe("message-circle-warning",gM);const bM=[["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"}]],QN=pe("message-square-plus",bM);const vM=[["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"}]],_M=pe("message-square",vM);const yM=[["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"}]],JN=pe("minimize-2",yM);const wM=[["path",{d:"M5 12h14",key:"1ays0h"}]],eC=pe("minus",wM);const SM=[["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"}]],kM=pe("moon",SM);const NM=[["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"}]],CM=pe("network",NM);const EM=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],jM=pe("package",EM);const AM=[["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"}]],TM=pe("palette",AM);const RM=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],MM=pe("panel-left-close",RM);const DM=[["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"}]],OM=pe("panel-left-open",DM);const LM=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],zM=pe("panel-left",LM);const BM=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]],PM=pe("panel-top",BM);const IM=[["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"}]],$M=pe("paperclip",IM);const HM=[["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"}]],UM=pe("pen-line",HM);const FM=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],ul=pe("pencil",FM);const qM=[["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"}]],er=pe("play",qM);const VM=[["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"}]],tC=pe("plug",VM);const GM=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],bs=pe("plus",GM);const WM=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],KM=pe("puzzle",WM);const YM=[["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"}]],XM=pe("radio",YM);const ZM=[["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"}]],Tr=pe("refresh-cw",ZM);const QM=[["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"}]],au=pe("rotate-ccw",QM);const JM=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],e6=pe("rotate-cw",JM);const t6=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],sC=pe("save",t6);const s6=[["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"}]],nC=pe("scroll-text",s6);const n6=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],i6=pe("search",n6);const r6=[["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"}]],a6=pe("send-horizontal",r6);const o6=[["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"}]],iC=pe("server",o6);const l6=[["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"}]],c6=pe("settings-2",l6);const u6=[["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"}]],rC=pe("shield-alert",u6);const d6=[["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"}]],h6=pe("shield-check",d6);const f6=[["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"}]],aC=pe("shield-question-mark",f6);const m6=[["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"}]],oC=pe("skip-forward",m6);const p6=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],pi=pe("sparkles",p6);const g6=[["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"}]],lC=pe("square-terminal",g6);const x6=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],ro=pe("square",x6);const b6=[["path",{d:"M11 2v2",key:"1539x4"}],["path",{d:"M5 2v2",key:"1yf1q8"}],["path",{d:"M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1",key:"rb5t3r"}],["path",{d:"M8 15a6 6 0 0 0 12 0v-3",key:"x18d4x"}],["circle",{cx:"20",cy:"10",r:"2",key:"ts1r5v"}]],v6=pe("stethoscope",b6);const _6=[["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"}]],y6=pe("sun",_6);const w6=[["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"}]],cC=pe("table-2",w6);const S6=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],ml=pe("terminal",S6);const k6=[["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"}]],gi=pe("trash-2",k6);const N6=[["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"}]],Xi=pe("triangle-alert",N6);const C6=[["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"}]],mf=pe("upload",C6);const E6=[["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"}]],j6=pe("user",E6);const A6=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],T6=pe("wand-sparkles",A6);const R6=[["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"}]],M6=pe("webhook",R6);const D6=[["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"}]],Gy=pe("workflow",D6);const O6=[["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"}]],L6=pe("wrench",O6);const z6=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Kt=pe("x",z6);const B6=[["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"}]],uC=pe("zap",B6);class dC extends Error{conflict;constructor(t,s){super(t),this.name="PortConflictResponseError",this.conflict=s}}async function Re(e,t){const s=await fetch(e,t),n=await s.json().catch(()=>{});if(!s.ok)throw s.status===409&&n?.conflict?.code==="PORT_IN_USE"?new dC(n?.error||"Port already in use",n.conflict):new Error(n?.error||s.statusText);return n}async function Ri(e,t){const s=new URLSearchParams;for(const[n,o]of Object.entries(t))o!==void 0&&String(o).trim()&&s.set(n,String(o));await Re(e,{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:s})}async function Kn(e,t){const s=new URLSearchParams;for(const[n,o]of Object.entries(t))o!==void 0&&String(o).trim()&&s.set(n,String(o));return Re(e,{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:s})}const P6="modulepreload",I6=function(e){return"/"+e},Wy={},ou=function(t,s,n){let o=Promise.resolve();if(s&&s.length>0){let f=function(d){return Promise.all(d.map(p=>Promise.resolve(p).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),h=u?.nonce||u?.getAttribute("nonce");o=f(s.map(d=>{if(d=I6(d),d in Wy)return;Wy[d]=!0;const p=d.endsWith(".css"),g=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${g}`))return;const x=document.createElement("link");if(x.rel=p?"stylesheet":P6,p||(x.as="script"),x.crossOrigin="",x.href=d,h&&x.setAttribute("nonce",h),document.head.appendChild(x),p)return new Promise((v,w)=>{x.addEventListener("load",v),x.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${d}`)))})}))}function l(u){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=u,window.dispatchEvent(h),!h.defaultPrevented)throw u}return o.then(u=>{for(const h of u||[])h.status==="rejected"&&l(h.reason);return t().catch(l)})},Qs=()=>typeof window<"u"&&(!!window.__TAURI_INTERNALS__||!!window.__TAURI__);async function pf(){if(!Qs())return null;try{return await ou(()=>import("./window-DlR023_X.js"),__vite__mapDeps([0,1,2]))}catch{return null}}async function $6(){await(await pf())?.getCurrentWindow().minimize()}async function H6(){await(await pf())?.getCurrentWindow().toggleMaximize()}async function U6(){await(await pf())?.getCurrentWindow().hide()}async function F6(){await(await pf())?.getCurrentWindow().startDragging()}async function gf(e){if(Qs())try{const{invoke:t}=await ou(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 Hp=null,Up=null;async function q6(){return Hp||(Hp=(await ou(()=>import("./core-DhEqZVGG.js"),[])).invoke),Hp}async function V6(){return Up||(Up=(await ou(()=>import("./event-BK_86lmQ.js"),__vite__mapDeps([2,1]))).listen),Up}async function Oe(e,t){return(await q6())(e,t)}async function W0(e,t){return(await V6())(e,n=>t(n.payload))}function G6(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 W6(e){const t={};for(const s of e.runtime.services)t[s.name]=G6(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 K6(e){const t=[];return e.map(s=>{let n=t.indexOf(s.hash);n===-1&&(n=t.indexOf(null),n===-1&&(n=t.length,t.push(null))),t[n]=null;const o=[];for(let h=0;h<s.parents.length;h++){const f=s.parents[h],d=t.indexOf(f);if(d!==-1){const g=d===n?"straight":"merge";o.push({fromLane:n,toLane:d,parentHash:f,kind:g});continue}let p;h===0?(p=n,t[n]=f,o.push({fromLane:n,toLane:n,parentHash:f,kind:"straight"})):(p=t.indexOf(null),p===-1?(p=t.length,t.push(f)):t[p]=f,o.push({fromLane:n,toLane:p,parentHash:f,kind:"branch"}))}const l=t.map((h,f)=>h!==null&&f!==n?f:-1).filter(h=>h!==-1),u=t.reduce((h,f,d)=>f!==null?Math.max(h,d+1):h,n+1);return{lane:n,laneCount:u,edges:o,throughLanes:l}})}function Y6(e){const t=K6(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 X6(e){return e.map(t=>({name:t.name,current:t.isCurrent,remote:t.isRemote}))}async function Z6(e){return Oe("service_processes",{name:e})}async function Q6(){const e=await Oe("get_dashboard"),t=W6(e),s=e.runtime.services.filter(d=>d.state.toLowerCase()==="running"),n={};await Promise.all(s.map(async d=>{const p=await Z6(d.name).catch(()=>null);p&&(n[d.name]={service:d.name,status:"unknown",summary:"",checkedAt:new Date().toISOString(),checks:[],processTree:p,ports:[],agentContext:""})})),t.health=n;const o=e.config.gitRepositories??[],l=e.config.selectedGitRepository,u=l?o.find(d=>d.name===l)??null:null;if(!u)return t;const[h,f]=await Promise.all([fC().catch(()=>null),gD().catch(()=>[])]);return{...t,git:{cwd:u.path,selectedRepository:u,status:h,branches:f}}}async function hC(e){await Oe("start_service",{name:e})}async function J6(e){await Oe("stop_service",{name:e})}async function eD(e){await Oe("restart_service",{name:e})}async function tD(e){await Oe("start_bundle",{name:e})}async function sD(e){await Oe("stop_bundle",{name:e})}async function nD(e){await Oe("remove_service",{name:e})}async function iD(e){return Oe("register_service",{service:e})}async function rD(e){return Oe("register_bundle",{bundle:e})}async function aD(e,t){return{logs:await Oe("get_logs",{service:e,limit:t??200}),queryable:!1}}async function fC(e){return Oe("git_status",{repo:null})}async function oD(e,t){return Oe("git_diff",{file:e??null,repo:t??null})}async function lD(e=200){const t=await Oe("git_graph",{limit:e,repo:null});return Y6(t)}async function cD(e,t){return Oe("git_commit_diff",{hash:e,file:t??null,repo:null})}async function uD(e){return await Oe("git_commit_files",{hash:e,repo:null})}async function dD(e,t){await Oe("git_stage",{paths:e,repo:t??null})}async function hD(e,t){await Oe("git_unstage",{paths:e,repo:t??null})}async function fD(e,t){return Oe("git_commit",{message:e,repo:t??null})}async function mD(e){return{output:await Oe("git_push",{remote:null,repo:e??null}),branch:"",setUpstream:!1}}async function pD(e,t){return await Oe("git_create_branch",{name:e,repo:null}),""}async function gD(e){const t=await Oe("git_branches",{repo:null});return X6(t)}async function xD(e){return{output:await Oe("git_pull_default",{repo:null}),branch:""}}async function bD(e){return Oe("git_list_files",{repo:null})}async function vD(e){return Oe("git_file_sizes",{repo:null})}async function _D(e){await Oe("select_git_repository",{name:e})}async function yD(e,t){const s=await Oe("git_read_file",{path:e,repo:null});return{content:s,truncated:!1,binary:!1,size:s.length}}async function wD(e,t,s){await Oe("git_write_file",{path:e,content:t,repo:null})}async function SD(e){await Oe("remove_git_repository",{name:e})}async function mC(e){return Oe("register_git_repository",{repo:e})}async function kD(e){return Oe("clone_git_repository",{url:e})}async function ND(e){return await Oe("set_git_board_repositories",{names:e}),e}async function CD(){const e=await Oe("get_dashboard"),t=e.config.gitRepositories,s=e.config.gitBoardRepositories;return{repos:(await Promise.allSettled(t.map(async l=>{const u=await Oe("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 ED(){return Oe("get_github_token_status")}async function Ky(e,t){await Oe("set_github_token",{host:e,token:t})}async function jD(e){await Oe("remove_github_token",{host:e})}async function fn(e){return Oe("get_github_repo",{repo:null})}async function AD(e,t,s){return Oe("list_pull_requests",{owner:e,repo:t,stateFilter:s??"open"})}async function TD(e,t,s){return Oe("list_issues",{owner:e,repo:t,stateFilter:s??"open"})}async function Yy(e,t,s){return Oe("get_pull_request",{owner:e,repo:t,number:s})}async function RD(e){return Oe("create_pull_request",e)}async function MD(e){return Oe("github_oauth_start",{clientId:e})}async function DD(e,t){return Oe("github_oauth_poll",{clientId:e,deviceCode:t})}async function OD(e,t,s){return Oe("get_pr_diff",{owner:e,repo:t,number:s})}async function LD(e,t,s){return Oe("list_pr_files",{owner:e,repo:t,number:s})}async function zD(e,t,s){return Oe("list_pr_reviews",{owner:e,repo:t,number:s})}async function BD(e,t,s){return Oe("list_pr_comments",{owner:e,repo:t,number:s})}async function PD(e,t,s,n={}){return Oe("merge_pull_request",{owner:e,repo:t,number:s,method:n.method??null,commitTitle:n.commitTitle??null,commitMessage:n.commitMessage??null})}async function ID(e,t,s){return Oe("get_github_issue",{owner:e,repo:t,number:s})}async function $D(e,t,s){return Oe("list_issue_comments",{owner:e,repo:t,number:s})}async function HD(e,t,s,n){return Oe("add_issue_comment",{owner:e,repo:t,number:s,body:n})}async function UD(e,t){return Oe("list_github_branches",{owner:e,repo:t})}async function Xy(e,t){return Oe("get_github_repo_info",{owner:e,repo:t})}async function Zy(e,t,s){return Oe("list_commit_check_runs",{owner:e,repo:t,sha:s})}async function FD(e,t,s,n){return Oe("list_workflow_runs",{owner:e,repo:t,branch:s??null,page:n??null})}async function qD(e,t,s){return Oe("list_workflow_run_jobs",{owner:e,repo:t,runId:s})}async function VD(){return Oe("list_databases")}async function Fp(e,t,s){return Oe("query_database",{name:e,sql:t,limit:s??null})}async function GD(e,t){return Oe("execute_database",{name:e,sql:t})}async function WD(e){return Oe("list_tables",{name:e})}async function pC(e){await Oe("register_database",{db:e})}async function KD(e){await Oe("remove_database",{name:e})}async function YD(e,t){await Oe("set_database_write_access",{name:e,unlocked:t})}async function XD(){return(await Oe("get_config")).logSources}async function ZD(e){await Oe("register_log_source",{source:e})}async function QD(e){return Oe("list_snapshots",{repo:null})}async function JD(e,t){return Oe("create_snapshot",{label:e??null,repo:null})}async function e8(e,t){await Oe("restore_snapshot",{sha:e,repo:null})}async function t8(e,t){await Oe("delete_snapshot",{sha:e,repo:null})}async function s8(e,t){return Oe("get_snapshot_files",{sha:e,repo:null})}async function n8(e,t,s){return Oe("get_snapshot_diff",{sha:e,path:t??null,repo:null})}async function i8(){return Oe("list_workflows")}async function r8(e){return Oe("save_workflow",{workflow:e})}async function a8(e){return Oe("delete_workflow",{id:e})}async function o8(){return Oe("get_agent_info")}async function l8(){return Oe("get_agent_chat_status")}async function c8(e){return Oe("set_chat_provider",{provider:e})}async function u8(e,t,s){await Oe("start_agent_chat",{message:e,resumeSessionId:t??null,provider:s??null})}async function d8(e){return Oe("scan_repo_url",{url:e})}async function h8(e,t){await Oe("run_install_command",{cwd:e,command:t})}async function f8(){return(await Oe("list_terminal_sessions")).map(t=>({...t,serviceName:t.serviceName??void 0,label:t.serviceName??void 0}))}async function m8(e){const t=await Oe("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 p8(e,t){await Oe("write_terminal_input",{id:e,data:t})}async function g8(e){await Oe("start_terminal_stream",{id:e})}async function x8(e,t,s){await Oe("resize_terminal",{id:e,cols:t,rows:s})}async function b8(e){await Oe("close_terminal_session",{id:e})}async function v8(e,t){return W0(`terminal-output-${e}`,s=>t(s))}const _8={async getAgentInfo(){return(await Re("/api/agent")).agent},async getMcpAuthStatuses(e){return(await Re(`/api/agent/mcp-status?agent=${encodeURIComponent(e)}`)).statuses},async getAgentUsage(){return(await Re("/api/agent/usage")).usage},async getAgentUsageHistory(e){const t=e?`?since=${encodeURIComponent(e)}`:"",s=await Re(`/api/agent/usage/history${t}`);return{entries:s.entries,summary:s.summary}},async getClaudeAgentSettings(){return(await Re("/api/agent/claude-settings")).settings},async updateClaudeAgentSettings(e){return(await Re("/api/agent/claude-settings",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})).settings}},y8={getAgentInfo:()=>o8(),getMcpAuthStatuses:async()=>[],getAgentUsage:async()=>({}),getAgentUsageHistory:async()=>({entries:[],summary:{runs:0,totalCostUSD:0,totalInputTokens:0,totalOutputTokens:0,totalTokens:0,byDay:[],codexTotalTokens:0}}),getClaudeAgentSettings:async()=>({coAuthorWithClaude:!0}),updateClaudeAgentSettings:async e=>({coAuthorWithClaude:e.coAuthorWithClaude??!0})},w8=Qs()?y8:_8,{getAgentInfo:gC,getMcpAuthStatuses:S8,getAgentUsage:k8,getAgentUsageHistory:N8,getClaudeAgentSettings:C8,updateClaudeAgentSettings:E8}=w8,j8={async getAgentChatStatus(){const e=await Re("/api/agent/chat/status");return{configured:e.configured,approvals:e.approvals,provider:e.provider,providers:e.providers??[]}},async setChatProvider(e){return(await Re("/api/agent/chat/provider",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({provider:e})})).provider},async approveAgentTool(e,t,s){await Re("/api/agent/chat/approve",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({sessionId:e,requestId:t,decision:s})})},async streamAgentChat(e,t,s,n,o,l){const u=await fetch("/api/agent/chat",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({message:e,resumeSessionId:t,autoApprove:o,provider:l}),signal:n});if(!u.ok||!u.body){const p=await u.json().catch(()=>{});throw new Error(p?.error||u.statusText||"Agent request failed")}const h=u.body.getReader(),f=new TextDecoder;let d="";for(;;){const{done:p,value:g}=await h.read();if(p)break;d+=f.decode(g,{stream:!0});let x=d.indexOf(`
|
|
11
|
-
|
|
12
|
-
`);for(;x!==-1;){const v=d.slice(0,x);d=d.slice(x+2);const w=v.split(`
|
|
13
|
-
`).find(k=>k.startsWith("data:"));if(w){const k=w.slice(5).trim();if(k)try{s(JSON.parse(k))}catch{}}x=d.indexOf(`
|
|
14
|
-
|
|
15
|
-
`)}}}};let qp="claude";const A8={async getAgentChatStatus(){const t=await l8();return qp=t.provider?.id??"claude",{...t,providers:t.providers??[]}},async setChatProvider(e){const s=await c8(e)??null;return qp=s?.id??e,s??{id:e}},approveAgentTool:async()=>{},streamAgentChat(e,t,s,n,o,l){let u,h=!1;return new Promise(f=>{(async()=>{if(u=await W0("agent-chat-event",d=>{if(h)return;const p=d;s(p),(p.type==="done"||p.type==="error")&&(h=!0,u?.(),f())}),n?.aborted){h=!0,u?.(),f();return}n?.addEventListener("abort",()=>{h||(h=!0,u?.(),f())});try{await u8(e,t,l??qp)}catch(d){h=!0,u?.(),s({type:"error",message:String(d)}),s({type:"done",stopReason:"error"}),f()}})().catch(d=>{h||(h=!0,u?.(),s({type:"error",message:String(d)}),s({type:"done",stopReason:"error"}),f())})})}},T8=Qs()?A8:j8,{getAgentChatStatus:R8,setChatProvider:M8,approveAgentTool:D8,streamAgentChat:O8}=T8;function Ii(e,t){return Re(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)})}const L8={async getAgentEnvAgents(){return(await Re("/api/agent-env/agents")).agents},async getAgentEnvConfigs(){return(await Re("/api/agent-env/live")).configs},async getAgentEnvDoctor(){const e=await Re("/api/agent-env/doctor");return{checks:e.checks,hasIssues:e.hasIssues}},async previewAgentEnvChanges(e){const t=await Ii("/api/agent-env/changes/preview",{changes:e});return{valid:t.valid,items:t.items,agents:t.agents}},async applyAgentEnvChanges(e){return Ii("/api/agent-env/changes/apply",{changes:e})},async listAgentEnvProfiles(){return(await Re("/api/agent-env/profiles")).profiles},async deleteAgentEnvProfile(e){await Re(`/api/agent-env/profiles/${encodeURIComponent(e)}`,{method:"DELETE"})},async snapshotAgentEnvProfile(e){return(await Ii("/api/agent-env/profiles/snapshot",e)).profile},async previewAgentEnvProfileApply(e,t){return Ii(`/api/agent-env/profiles/${encodeURIComponent(e)}/apply-preview`,{agent:t})},async applyAgentEnvProfile({name:e,agent:t,skip:s}){return Ii(`/api/agent-env/profiles/${encodeURIComponent(e)}/apply`,{agent:t,skip:s})},async exportAgentEnvProfile(e){return{archivePath:(await Ii(`/api/agent-env/profiles/${encodeURIComponent(e)}/export`,{})).archivePath}},async importAgentEnvProfile(e,t){return Re(`/api/agent-env/profiles/import${t?.force?"?force=1":""}`,{method:"POST",headers:{"content-type":"application/gzip"},body:e})},async getRegistryAuthStatus(){const e=await Re("/api/agent-env/auth/status"),{ok:t,...s}=e;return s},async startRegistryAuth(){const e=await Ii("/api/agent-env/auth/start",{});return{url:e.url,state:e.state}},async getRegistryAuthOutcome(e){return Re(`/api/agent-env/auth/outcome?state=${encodeURIComponent(e)}`)},async registryLogout(){await Ii("/api/agent-env/auth/logout",{})},async publishAgentEnvProfile({name:e,...t}){return Ii(`/api/agent-env/profiles/${encodeURIComponent(e)}/publish`,t)},async installAgentEnvProfileFromRegistry(e){return Ii("/api/agent-env/profiles/install-from-registry",e)}},Mn=()=>Promise.reject(new Error("Agent Environments is not available in desktop mode yet.")),z8={getAgentEnvAgents:async()=>[],getAgentEnvConfigs:async()=>[],getAgentEnvDoctor:async()=>({checks:[{label:"Desktop mode",status:"warn",message:"Agent Environments is not available in desktop mode yet."}],hasIssues:!0}),previewAgentEnvChanges:Mn,applyAgentEnvChanges:Mn,listAgentEnvProfiles:async()=>[],deleteAgentEnvProfile:Mn,snapshotAgentEnvProfile:Mn,previewAgentEnvProfileApply:Mn,applyAgentEnvProfile:Mn,exportAgentEnvProfile:Mn,importAgentEnvProfile:Mn,getRegistryAuthStatus:Mn,startRegistryAuth:Mn,getRegistryAuthOutcome:Mn,registryLogout:Mn,publishAgentEnvProfile:Mn,installAgentEnvProfileFromRegistry:Mn},B8=Qs()?z8:L8,{getAgentEnvAgents:P8,getAgentEnvConfigs:I8,getAgentEnvDoctor:$8,previewAgentEnvChanges:H8,applyAgentEnvChanges:U8,listAgentEnvProfiles:F8,deleteAgentEnvProfile:q8,snapshotAgentEnvProfile:V8,previewAgentEnvProfileApply:G8,applyAgentEnvProfile:W8,exportAgentEnvProfile:K8,importAgentEnvProfile:Qy,getRegistryAuthStatus:Y8,startRegistryAuth:X8,getRegistryAuthOutcome:Z8,registryLogout:Q8,publishAgentEnvProfile:J8,installAgentEnvProfileFromRegistry:Jy}=B8,eO={async listDatabases(){return(await Re("/api/databases")).connections},async detectDatabases(){return(await Re("/api/databases/detect")).detected},async addDatabase(e){await Kn("/api/databases",e)},testDatabase(e){return Kn("/api/databases/test",e)},async deleteDatabase(e){await Re(`/api/databases/${encodeURIComponent(e)}`,{method:"DELETE"})},async getDatabaseTables(e){return(await Re(`/api/databases/${encodeURIComponent(e)}/tables`)).tables},runDatabaseQuery(e,t,s=100){return Kn(`/api/databases/${encodeURIComponent(e)}/query`,{sql:t,limit:s})},async setDatabaseWriteAccess(e,t){await Kn(`/api/databases/${encodeURIComponent(e)}/write-access`,{unlocked:String(t)})},executeDatabaseWrite(e,t,s){return Kn(`/api/databases/${encodeURIComponent(e)}/execute`,{sql:t,mode:s})},getDatabaseRows(e,t,s=100,n=0){return Re(`/api/databases/${encodeURIComponent(e)}/rows?table=${encodeURIComponent(t)}&limit=${s}&offset=${n}`)}};function ew(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 tO={async listDatabases(){return await VD()},detectDatabases:async()=>[],async addDatabase(e){await pC(e)},async testDatabase(){try{return await Fp("__test__","SELECT 1",1),{ok:!0}}catch(e){return{ok:!1,error:String(e)}}},async deleteDatabase(e){await KD(e)},async getDatabaseTables(e){return(await WD(e)).map(s=>({name:s,qualifiedName:s}))},async runDatabaseQuery(e,t,s=100){const n=await Fp(e,t,s),{columns:o,rows:l,rowCount:u}=ew(n);return{engine:"sqlite",columns:o,rows:l,rowCount:u,truncated:!1}},async setDatabaseWriteAccess(e,t){await YD(e,t)},async executeDatabaseWrite(e,t,s){return s==="preview"?{engine:"sqlite",previewUnavailable:!0}:{engine:"sqlite",previewUnavailable:!1,affectedRows:await GD(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 Fp(e,o,s),{columns:u,rows:h,rowCount:f}=ew(l);return{engine:"sqlite",table:{name:t,qualifiedName:t},columns:u,rows:h,rowCount:f,limit:s,offset:n}}},sO=Qs()?tO:eO,{listDatabases:xC,detectDatabases:nO,addDatabase:iO,testDatabase:rO,deleteDatabase:aO,getDatabaseTables:bC,runDatabaseQuery:oO,setDatabaseWriteAccess:lO,executeDatabaseWrite:tw,getDatabaseRows:cO}=sO,vC={async getErrorIncidents(e=100){return(await Re(`/api/errors?limit=${e}`)).incidents},getErrorPrompt(e){return Re(`/api/errors/${e}/prompt`)},getErrorBundle(e,t=!1){return Re(`/api/errors/${e}/bundle${t?"?save=1":""}`)},startFix(e){return Re(`/api/errors/${e}/fix`,{method:"POST"})}},uO={...vC,getErrorIncidents:async()=>[]},dO=Qs()?uO:vC,{getErrorIncidents:_C,startFix:hO}=dO,fO={async getGitGraph(e=200){return(await Re(`/api/git/graph?limit=${e}`)).commits},async getGitCommitDiff(e,t){const s=new URLSearchParams({hash:e});t&&s.set("file",t);const n=await fetch(`/api/git/commit?${s.toString()}`);if(!n.ok){const o=await n.json().catch(()=>({error:n.statusText}));throw new Error(o.error||"Unable to load commit diff")}return n.text()},async getGitCommitFiles(e){return(await Re(`/api/git/commit/files?hash=${encodeURIComponent(e)}`)).files},async getGitFiles(){return(await Re("/api/git/files")).files},async getFileSizeRanking(){return(await Re("/api/git/file-sizes")).files},async getGitFile(e){const t=await Re(`/api/git/file?path=${encodeURIComponent(e)}`);return{content:t.content,truncated:t.truncated,binary:t.binary,size:t.size}},async updateGitFile(e,t){await Re("/api/git/file",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({path:e,content:t})})},async getGitDiff(e,t){const s=new URLSearchParams({file:e});t&&s.set("repo",t);const n=await fetch(`/api/git/diff?${s.toString()}`);if(!n.ok){const o=await n.json().catch(()=>({error:n.statusText}));throw new Error(o.error||"Unable to load diff")}return n.text()},async getGitOverview(){const e=await Re("/api/git/overview"),t=e.repos??[],s=e.board??t.map(n=>n.name);return{repos:t,board:s}},async setGitBoard(e){return(await Re("/api/git/board",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({names:e})})).board},async gitStage(e,t){await Re("/api/git/stage",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t?{paths:e,repo:t}:{paths:e})})},async gitUnstage(e,t){await Re("/api/git/unstage",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t?{paths:e,repo:t}:{paths:e})})},async gitCommit(e,t){return(await Kn("/api/git/commit",{message:e,...t?{repo:t}:{}})).output},async gitPush(e){const t=await Kn("/api/git/push",e?{repo:e}:{});return{output:t.output,branch:t.branch,setUpstream:t.setUpstream}},async gitCheckoutDefaultAndPull(){const e=await Kn("/api/git/default-branch/pull",{});return{output:e.output,branch:e.branch}},async gitCreateBranch(e){return(await Kn("/api/git/branches",{name:e})).output},async deleteGitRepository(e){await Re(`/api/git/repositories/${encodeURIComponent(e)}`,{method:"DELETE"})},async selectGitRepository(e){await Ri("/api/git/select",{name:e})},async registerGitRepository(e,t){await Ri("/api/git/repositories",{name:e,path:t})},async cloneGitRepository(e){const t=await Kn("/api/git/clone",{url:e});return{name:t.name,path:t.path}}},mO={getGitGraph:(e=200)=>lD(e),getGitCommitDiff:(e,t)=>cD(e,t),getGitCommitFiles:e=>uD(e),getGitFiles:()=>bD(),getFileSizeRanking:()=>vD(),getGitFile:e=>yD(e),updateGitFile:(e,t)=>wD(e,t),getGitDiff:(e,t)=>oD(e,t),getGitOverview:()=>CD(),setGitBoard:e=>ND(e),gitStage:(e,t)=>dD(e,t),gitUnstage:(e,t)=>hD(e,t),gitCommit:(e,t)=>fD(e,t),gitPush:e=>mD(e),gitCheckoutDefaultAndPull:()=>xD(),gitCreateBranch:e=>pD(e),deleteGitRepository:e=>SD(e),selectGitRepository:e=>_D(e),registerGitRepository:async(e,t)=>{await mC({name:e,path:t})},cloneGitRepository:e=>kD(e)},pO=Qs()?mO:fO,{getGitGraph:gO,getGitCommitDiff:xO,getGitCommitFiles:bO,getGitFiles:vO,getFileSizeRanking:_O,getGitFile:yO,updateGitFile:wO,getGitDiff:yC,getGitOverview:Vp,setGitBoard:sw,gitStage:K0,gitUnstage:wC,gitCommit:SC,gitPush:xf,gitCheckoutDefaultAndPull:SO,gitCreateBranch:kO,deleteGitRepository:NO,selectGitRepository:CO,registerGitRepository:EO,cloneGitRepository:jO}=pO,AO={getGitHubTokenInfo(){return Re("/api/github/token")},startGitHubDeviceFlow(){return Re("/api/github/oauth/start",{method:"POST"})},async pollGitHubDeviceFlow(e){const t=await Re("/api/github/oauth/poll",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({device_code:e})});return{done:t.done,slowDown:t.slowDown}},async setGitHubToken(e,t){const s=new URLSearchParams({host:e,token:t});await Re("/api/github/token",{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:s})},async removeGitHubToken(e){await Re(`/api/github/token/${encodeURIComponent(e)}`,{method:"DELETE"})},async listGitHubBranches(){const e=await Re("/api/github/branches");return{repository:e.repository,defaultBranch:e.defaultBranch,currentBranch:e.currentBranch,branches:e.branches}},async listGitHubPRs(e="open",t=1){return(await Re(`/api/github/prs?state=${e}&page=${t}`)).prs},async getGitHubPR(e){return(await Re(`/api/github/prs/${e}`)).pr},async getGitHubPRDiff(e){const t=await fetch(`/api/github/prs/${e}/diff`);if(!t.ok){const s=await t.json().catch(()=>({error:t.statusText}));throw new Error(s.error||"Unable to load PR diff")}return t.text()},async getGitHubPRReviewCockpit(e){return(await Re(`/api/github/prs/${e}/review`)).cockpit},async getGitHubPRTemplate(){return(await Re("/api/github/pr-template")).template},async createGitHubPR(e){return(await Re("/api/github/prs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})).pr},async mergeGitHubPR(e,t={}){const s=await Re(`/api/github/prs/${e}/merge`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({method:t.method??"squash",...t})});return{merged:s.merged,sha:s.sha,message:s.message}},async listGitHubIssues(e="open",t=1){return(await Re(`/api/github/issues?state=${e}&page=${t}`)).issues},async getGitHubIssue(e){return(await Re(`/api/github/issues/${e}`)).issue},async listGitHubIssueComments(e){return(await Re(`/api/github/issues/${e}/comments`)).comments},async addGitHubIssueComment(e,t){return(await Re(`/api/github/issues/${e}/comments`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({body:t})})).comment},async getCommitCIStatus(e){return(await Re(`/api/github/ci/${encodeURIComponent(e)}`)).status},async listGitHubWorkflowRuns(e,t=1){const s=new URLSearchParams({page:String(t)});return e&&s.set("branch",e),(await Re(`/api/github/runs?${s}`)).runs},async listGitHubWorkflowRunJobs(e){return(await Re(`/api/github/runs/${e}/jobs`)).jobs}},nw="Iv23liCxW0Mv0KJP1Svr";function iw(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 TO={async getGitHubTokenInfo(){const e=await ED();return{configured:e.configured,deviceFlowAvailable:!0,status:e.configured?"connected":"not_configured"}},async startGitHubDeviceFlow(){return await MD(nw)},async pollGitHubDeviceFlow(e){const t=await DD(nw,e);return t.access_token?(await Ky("github.com",t.access_token),{done:!0}):{done:!1,slowDown:t.error==="slow_down"}},async setGitHubToken(e,t){await Ky(e,t)},async removeGitHubToken(e){await jD(e)},async listGitHubBranches(){const[e,t]=await fn(),[s,n]=await Promise.all([UD(e,t),Xy(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 AD(s,n,e)).slice((t-1)*50,t*50)},async getGitHubPR(e){const[t,s]=await fn();return Yy(t,s,e)},async getGitHubPRDiff(e){const[t,s]=await fn();return OD(t,s,e)},async getGitHubPRReviewCockpit(e){const[t,s]=await fn(),n=await Yy(t,s,e),[o,l,u,h]=await Promise.all([LD(t,s,e),zD(t,s,e),BD(t,s,e),Zy(t,s,n.head.sha)]),f=h.check_runs??[];return{pr:n,files:Array.isArray(o)?o:[],reviews:Array.isArray(l)?l:[],comments:Array.isArray(u)?u:[],checks:{sha:n.head.sha,state:iw(f),totalCount:h.total_count??f.length,runs:f}}},async getGitHubPRTemplate(){const[e,t]=await fn(),s=await Xy(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 RD({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 PD(s,n,e,t)},async listGitHubIssues(e="open",t=1){const[s,n]=await fn();return(await TD(s,n,e)).slice((t-1)*50,t*50)},async getGitHubIssue(e){const[t,s]=await fn();return ID(t,s,e)},async listGitHubIssueComments(e){const[t,s]=await fn();return $D(t,s,e)},async addGitHubIssueComment(e,t){const[s,n]=await fn();return HD(s,n,e,t)},async getCommitCIStatus(e){const[t,s]=await fn(),n=await Zy(t,s,e),o=n.check_runs??[];return{sha:e,state:iw(o),totalCount:n.total_count??o.length,runs:o}},async listGitHubWorkflowRuns(e,t=1){const[s,n]=await fn();return(await FD(s,n,e,t)).workflow_runs??[]},async listGitHubWorkflowRunJobs(e){const[t,s]=await fn();return(await qD(t,s,e)).jobs??[]}},RO=Qs()?TO:AO,{getGitHubTokenInfo:MO,startGitHubDeviceFlow:DO,pollGitHubDeviceFlow:OO,setGitHubToken:LO,removeGitHubToken:zO,listGitHubBranches:BO,listGitHubPRs:Gp,getGitHubPR:PO,getGitHubPRDiff:IO,getGitHubPRReviewCockpit:$O,getGitHubPRTemplate:HO,createGitHubPR:UO,mergeGitHubPR:FO,listGitHubIssues:Wp,getGitHubIssue:qO,listGitHubIssueComments:VO,addGitHubIssueComment:GO,getCommitCIStatus:WO,listGitHubWorkflowRuns:fh,listGitHubWorkflowRunJobs:rw}=RO,KO={async listLogSources(){return(await Re("/api/log-sources")).sources},async addLogSource(e){return(await Kn("/api/log-sources",e)).sources},async getLogSourceLogs(e,t={}){const s=new URLSearchParams;return s.set("lines",String(t.lines??500)),t.since&&s.set("since",t.since),t.until&&s.set("until",t.until),t.grep&&s.set("grep",t.grep),t.level&&s.set("level",t.level),t.cursor&&s.set("cursor",t.cursor),t.before&&s.set("before",t.before),(await Re(`/api/log-sources/${encodeURIComponent(e)}/logs?${s.toString()}`)).logs}};async function aw(){return await XD()??[]}const YO={listLogSources:aw,async addLogSource(e){return await ZD(e),aw()},getLogSourceLogs:async()=>[]},XO=Qs()?YO:KO,{listLogSources:ZO,addLogSource:QO,getLogSourceLogs:kC}=XO,Kp={"content-type":"application/json"};function JO(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 eL={async scanRepo(e){const t=await Re("/api/onboard/scan",{method:"POST",headers:Kp,body:JSON.stringify({url:e})});return{profile:t.profile,proposals:t.proposals,databases:t.databases??[]}},async registerOnboarded(e,t,s){const n=s?{name:s.name,engine:s.engine,url:s.url}:void 0;await Re("/api/onboard/register",{method:"POST",headers:Kp,body:JSON.stringify({...e,start:t,database:n})})},async streamInstall(e,t){const s=await fetch("/api/onboard/install/stream",{method:"POST",headers:Kp,body:JSON.stringify(e)});if(!s.ok||!s.body){const u=await s.json().catch(()=>{});t.onError(u?.error||s.statusText);return}const n=s.body.getReader(),o=new TextDecoder;let l="";for(;;){const{done:u,value:h}=await n.read();if(u)break;l+=o.decode(h,{stream:!0});const f=l.split(`
|
|
17
|
-
|
|
18
|
-
`);l=f.pop()??"";for(const d of f)JO(d,t)}}},tL={scanRepo:e=>d8(e),async registerOnboarded(e,t,s){await mC({name:e.name,path:e.cwd}),await iD({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 pC({name:s.name,engine:s.engine,url:s.url}),t&&await hC(e.name)},async streamInstall(e,t){let s;s=await W0("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 h8(e.clonePath,e.command)}catch(n){s?.(),t.onError(String(n))}}},sL=Qs()?tL:eL,{scanRepo:nL,registerOnboarded:iL,streamInstall:rL}=sL,NC={getDashboard(){return Re("/api/dashboard")},async getServiceGraph(){return(await Re("/api/services/graph")).graph},async startService(e){await Re(`/api/services/${encodeURIComponent(e)}/start`,{method:"POST"})},async stopService(e){await Re(`/api/services/${encodeURIComponent(e)}/stop`,{method:"POST"})},async restartService(e){await Re(`/api/services/${encodeURIComponent(e)}/restart`,{method:"POST"})},async startBundle(e){await Re(`/api/bundles/${encodeURIComponent(e)}/start`,{method:"POST"})},async stopBundle(e){await Re(`/api/bundles/${encodeURIComponent(e)}/stop`,{method:"POST"})},async deleteService(e){await Re(`/api/services/${encodeURIComponent(e)}`,{method:"DELETE"})},async registerBundle(e){await Ri("/api/bundles",{name:e.name,originalName:e.name,services:e.services.join(",")})},async getServiceLogs(e,t={}){const s=new URLSearchParams;s.set("lines",String(t.lines??500)),t.since&&s.set("since",t.since),t.until&&s.set("until",t.until),t.grep&&s.set("grep",t.grep),t.level&&s.set("level",t.level),t.cursor&&s.set("cursor",t.cursor),t.before&&s.set("before",t.before);const n=await Re(`/api/services/${encodeURIComponent(e)}/logs?${s.toString()}`);return{logs:n.logs,queryable:!!n.queryable}},getDirectories(e,{files:t=!1}={}){const s=new URLSearchParams({path:e});return t&&s.set("files","1"),Re(`/api/fs/directories?${s.toString()}`)},browseServiceConfig(e,t){const s=t?`?path=${encodeURIComponent(t)}`:"";return Re(`/api/services/${encodeURIComponent(e)}/config-browse${s}`)},async getServiceConfigFiles(e){const t=await Re(`/api/services/${encodeURIComponent(e)}/config-files`);return{cwd:t.cwd,files:t.files}},getServiceConfigFile(e,t){return Re(`/api/services/${encodeURIComponent(e)}/config-file?path=${encodeURIComponent(t)}`)},putServiceConfigFileEnv(e,t,s){return Re(`/api/services/${encodeURIComponent(e)}/config-file?path=${encodeURIComponent(t)}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({entries:s})})},putServiceConfigFileText(e,t,s){return Re(`/api/services/${encodeURIComponent(e)}/config-file?path=${encodeURIComponent(t)}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({content:s})})},async getServiceEnvRuntime(e){return(await Re(`/api/services/${encodeURIComponent(e)}/env/runtime`)).runtime},async getServiceMetrics(e){return(await Re(`/api/services/${encodeURIComponent(e)}/metrics`)).metrics},testServiceCommand(e){return Kn("/api/services/test",e)},runServiceTests(e,t){return Kn(`/api/services/${encodeURIComponent(e)}/test`,t?{pattern:t}:{})}},aL={...NC,getDashboard:()=>Q6(),startService:e=>hC(e),stopService:e=>J6(e),restartService:e=>eD(e),startBundle:e=>tD(e),stopBundle:e=>sD(e),deleteService:e=>nD(e),registerBundle:e=>rD(e).then(()=>{}),getServiceLogs:(e,t={})=>aD(e,t.lines)},Cr=Qs()?aL:NC,{getDashboard:oL,getServiceGraph:lL,startService:CC,stopService:cL,restartService:EC,startBundle:$Q,stopBundle:ow,deleteService:uL,getServiceLogs:jC,getDirectories:AC,browseServiceConfig:dL,getServiceConfigFiles:hL,getServiceConfigFile:lw,putServiceConfigFileEnv:fL,putServiceConfigFileText:mL,getServiceEnvRuntime:pL,getServiceMetrics:gL,testServiceCommand:xL,runServiceTests:bL}=Cr;async function vL(e,t,s){t.includes(s)||await Cr.registerBundle({name:e,services:[...t,s]})}async function cw(e,t){let s,n;try{s=await Cr.getDashboard(),n=await Cr.getServiceGraph()}catch{await Cr.startBundle(e);return}const o=s.config.bundles.find(g=>g.name===e);if(!o){await Cr.startBundle(e);return}const l=new Map(n.nodes.map(g=>[g.name,g.dependsOn])),u=new Map(s.config.services.map(g=>[g.name,g.port])),h=new Set,f=[...o.services];for(;f.length>0;){const g=f.pop();if(!(h.has(g)||!l.has(g))){h.add(g);for(const x of l.get(g)??[])f.push(x)}}const d=n.order.filter(g=>h.has(g)),p=d.length>0?d:o.services;for(const g of p){for(const x of l.get(g)??[]){const v=u.get(x);v&&await _L(v)}await Cr.startService(g),await t?.(g)}}async function _L(e,t=15e3){const s=Date.now()+t;for(;Date.now()<s;){try{if((await Cr.getDashboard()).ports.some(o=>o.port===e&&!o.available))return}catch{return}await new Promise(n=>setTimeout(n,400))}}async function yL(e,t,s){t.includes(s)&&await Cr.registerBundle({name:e,services:t.filter(n=>n!==s)})}async function uw(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 wL={async listSnapshots(){return(await Re("/api/snapshots")).snapshots},async createSnapshot(e){return(await Re("/api/snapshots",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({label:e})})).snapshot},async renameSnapshot(e,t){return(await Re(`/api/snapshots/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({label:t})})).snapshot},async deleteSnapshot(e){await Re(`/api/snapshots/${encodeURIComponent(e)}`,{method:"DELETE"})},async getSnapshotFiles(e){return(await Re(`/api/snapshots/${encodeURIComponent(e)}/files`)).files},getSnapshotDiff(e,t){const s=t?`?path=${encodeURIComponent(t)}`:"";return uw(`/api/snapshots/${encodeURIComponent(e)}/diff${s}`)},restoreSnapshot(e){return Re(`/api/snapshots/${encodeURIComponent(e)}/restore`,{method:"POST"})},async listChangeSets(){return(await Re("/api/agent/change-sets")).sessions},getChangeSet(e){return Re(`/api/agent/change-sets/${encodeURIComponent(e)}`)},getChangeSetDiff(e,t){const s=t?`?path=${encodeURIComponent(t)}`:"";return uw(`/api/agent/change-sets/${encodeURIComponent(e)}/diff${s}`)},restoreChangeSet(e){return Re(`/api/agent/change-sets/${encodeURIComponent(e)}/restore`,{method:"POST"})}},SL={listSnapshots:()=>QD(),createSnapshot:e=>JD(e),renameSnapshot:async()=>{throw new Error("Snapshot rename is not supported in desktop mode")},deleteSnapshot:e=>t8(e),getSnapshotFiles:e=>s8(e),getSnapshotDiff:(e,t)=>n8(e,t),async restoreSnapshot(e){return await e8(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")}},kL=Qs()?SL:wL,{listSnapshots:NL,createSnapshot:CL,renameSnapshot:EL,deleteSnapshot:jL,getSnapshotFiles:AL,getSnapshotDiff:TL,restoreSnapshot:RL,listChangeSets:ML,getChangeSet:DL,getChangeSetDiff:OL,restoreChangeSet:LL}=kL,zL={async listTerminalSessions(){return(await Re("/api/terminal/sessions")).sessions},async createTerminalSession(e){return(await Re("/api/terminal/sessions",{method:"POST",...e?.serviceName?{headers:{"content-type":"application/json"},body:JSON.stringify({serviceName:e.serviceName})}:{}})).session},async closeTerminalSession(e){await Re(`/api/terminal/sessions/${encodeURIComponent(e)}`,{method:"DELETE"})}},BL={listTerminalSessions:()=>f8(),createTerminalSession:e=>m8(e),closeTerminalSession:e=>b8(e)};function Y0(){return Qs()?BL:zL}function PL(){return Y0().listTerminalSessions()}function mh(e){return Y0().createTerminalSession(e)}function IL(e){return Y0().closeTerminalSession(e)}const $L={async listWorkflows(){return(await Re("/api/workflows")).workflows},async saveWorkflow(e){return(await Re("/api/workflows",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})).workflows},async deleteWorkflow(e){return(await Re(`/api/workflows/${encodeURIComponent(e)}`,{method:"DELETE"})).workflows},async getGitStatus(){return(await Re("/api/git/status")).status},async listWorkflowTriggers(){return(await Re("/api/workflow-triggers")).triggers},async saveWorkflowTrigger(e){return(await Re("/api/workflow-triggers",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})).triggers},async deleteWorkflowTrigger(e){return(await Re(`/api/workflow-triggers/${encodeURIComponent(e)}`,{method:"DELETE"})).triggers},async listPendingRuns(){return(await Re("/api/workflow-triggers/pending")).pending},async ackPendingRun(e){await Re(`/api/workflow-triggers/pending/${encodeURIComponent(e)}/ack`,{method:"POST"})}},HL={listWorkflows:()=>i8(),saveWorkflow:e=>r8(e),deleteWorkflow:e=>a8(e),async getGitStatus(){const e=await fC();return{branch:e.branch,upstream:e.upstream??void 0,ahead:e.ahead,behind:e.behind,files:e.files}},listWorkflowTriggers:async()=>[],saveWorkflowTrigger:async()=>[],deleteWorkflowTrigger:async()=>[],listPendingRuns:async()=>[],ackPendingRun:async()=>{}},UL=Qs()?HL:$L,{listWorkflows:TC,saveWorkflow:FL,deleteWorkflow:qL,getGitStatus:Yp,listWorkflowTriggers:VL,saveWorkflowTrigger:GL,deleteWorkflowTrigger:WL,listPendingRuns:KL,ackPendingRun:YL}=UL;function RC(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=RC(e[t]))&&(n&&(n+=" "),n+=s)}else for(s in e)e[s]&&(n&&(n+=" "),n+=s);return n}function Xc(){for(var e,t,s=0,n="",o=arguments.length;s<o;s++)(e=arguments[s])&&(t=RC(e))&&(n&&(n+=" "),n+=t);return n}const dw=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,hw=Xc,MC=(e,t)=>s=>{var n;if(t?.variants==null)return hw(e,s?.class,s?.className);const{variants:o,defaultVariants:l}=t,u=Object.keys(o).map(d=>{const p=s?.[d],g=l?.[d];if(p===null)return null;const x=dw(p)||dw(g);return o[d][x]}),h=s&&Object.entries(s).reduce((d,p)=>{let[g,x]=p;return x===void 0||(d[g]=x),d},{}),f=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((d,p)=>{let{class:g,className:x,...v}=p;return Object.entries(v).every(w=>{let[k,C]=w;return Array.isArray(C)?C.includes({...l,...h}[k]):{...l,...h}[k]===C})?[...d,g,x]:d},[]);return hw(e,u,f,s?.class,s?.className)},XL=(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},ZL=(e,t)=>({classGroupId:e,validator:t}),DC=(e=new Map,t=null,s)=>({nextPart:e,validators:t,classGroupId:s}),Dh="-",fw=[],QL="arbitrary..",JL=e=>{const t=t7(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return e7(u);const h=u.split(Dh),f=h[0]===""&&h.length>1?1:0;return OC(h,f,t)},getConflictingClassGroupIds:(u,h)=>{if(h){const f=n[u],d=s[u];return f?d?XL(d,f):f:d||fw}return s[u]||fw}}},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(Dh):e.slice(t).join(Dh),f=u.length;for(let d=0;d<f;d++){const p=u[d];if(p.validator(h))return p.classGroupId}},e7=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?QL+n:void 0})(),t7=e=>{const{theme:t,classGroups:s}=e;return s7(s,t)},s7=(e,t)=>{const s=DC();for(const n in e){const o=e[n];X0(o,s,n,t)}return s},X0=(e,t,s,n)=>{const o=e.length;for(let l=0;l<o;l++){const u=e[l];n7(u,t,s,n)}},n7=(e,t,s,n)=>{if(typeof e=="string"){i7(e,t,s);return}if(typeof e=="function"){r7(e,t,s,n);return}a7(e,t,s,n)},i7=(e,t,s)=>{const n=e===""?t:LC(t,e);n.classGroupId=s},r7=(e,t,s,n)=>{if(o7(e)){X0(e(n),t,s,n);return}t.validators===null&&(t.validators=[]),t.validators.push(ZL(s,e))},a7=(e,t,s,n)=>{const o=Object.entries(e),l=o.length;for(let u=0;u<l;u++){const[h,f]=o[u];X0(f,LC(t,h),s,n)}},LC=(e,t)=>{let s=e;const n=t.split(Dh),o=n.length;for(let l=0;l<o;l++){const u=n[l];let h=s.nextPart.get(u);h||(h=DC(),s.nextPart.set(u,h)),s=h}return s},o7=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,l7=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)}}},vx="!",mw=":",c7=[],pw=(e,t,s,n,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:s,maybePostfixModifierPosition:n,isExternal:o}),u7=e=>{const{prefix:t,experimentalParseClassName:s}=e;let n=o=>{const l=[];let u=0,h=0,f=0,d;const p=o.length;for(let k=0;k<p;k++){const C=o[k];if(u===0&&h===0){if(C===mw){l.push(o.slice(f,k)),f=k+1;continue}if(C==="/"){d=k;continue}}C==="["?u++:C==="]"?u--:C==="("?h++:C===")"&&h--}const g=l.length===0?o:o.slice(f);let x=g,v=!1;g.endsWith(vx)?(x=g.slice(0,-1),v=!0):g.startsWith(vx)&&(x=g.slice(1),v=!0);const w=d&&d>f?d-f:void 0;return pw(l,v,x,w)};if(t){const o=t+mw,l=n;n=u=>u.startsWith(o)?l(u.slice(o.length)):pw(c7,!1,u,void 0,!0)}if(s){const o=n;n=l=>s({className:l,parseClassName:o})}return n},d7=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((s,n)=>{t.set(s,1e6+n)}),s=>{const n=[];let o=[];for(let l=0;l<s.length;l++){const u=s[l],h=u[0]==="[",f=t.has(u);h||f?(o.length>0&&(o.sort(),n.push(...o),o=[]),n.push(u)):o.push(u)}return o.length>0&&(o.sort(),n.push(...o)),n}},h7=e=>({cache:l7(e.cacheSize),parseClassName:u7(e),sortModifiers:d7(e),postfixLookupClassGroupIds:f7(e),...JL(e)}),f7=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},m7=/\s+/,p7=(e,t)=>{const{parseClassName:s,getClassGroupId:n,getConflictingClassGroupIds:o,sortModifiers:l,postfixLookupClassGroupIds:u}=t,h=[],f=e.trim().split(m7);let d="";for(let p=f.length-1;p>=0;p-=1){const g=f[p],{isExternal:x,modifiers:v,hasImportantModifier:w,baseClassName:k,maybePostfixModifierPosition:C}=s(g);if(x){d=g+(d.length>0?" "+d:d);continue}let N=!!C,T;if(N){const I=k.substring(0,C);T=n(I);const R=T&&u[T]?n(k):void 0;R&&R!==T&&(T=R,N=!1)}else T=n(k);if(!T){if(!N){d=g+(d.length>0?" "+d:d);continue}if(T=n(k),!T){d=g+(d.length>0?" "+d:d);continue}N=!1}const j=v.length===0?"":v.length===1?v[0]:l(v).join(":"),A=w?j+vx:j,B=A+T;if(h.indexOf(B)>-1)continue;h.push(B);const O=o(T,N);for(let I=0;I<O.length;++I){const R=O[I];h.push(A+R)}d=g+(d.length>0?" "+d:d)}return d},g7=(...e)=>{let t=0,s,n,o="";for(;t<e.length;)(s=e[t++])&&(n=zC(s))&&(o&&(o+=" "),o+=n);return o},zC=e=>{if(typeof e=="string")return e;let t,s="";for(let n=0;n<e.length;n++)e[n]&&(t=zC(e[n]))&&(s&&(s+=" "),s+=t);return s},x7=(e,...t)=>{let s,n,o,l;const u=f=>{const d=t.reduce((p,g)=>g(p),e());return s=h7(d),n=s.cache.get,o=s.cache.set,l=h,h(f)},h=f=>{const d=n(f);if(d)return d;const p=p7(f,s);return o(f,p),p};return l=u,(...f)=>l(g7(...f))},b7=[],Rs=e=>{const t=s=>s[e]||b7;return t.isThemeGetter=!0,t},BC=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,PC=/^\((?:(\w[\w-]*):)?(.+)\)$/i,v7=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,_7=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,y7=/\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$/,w7=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,S7=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,k7=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,la=e=>v7.test(e),mt=e=>!!e&&!Number.isNaN(Number(e)),$i=e=>!!e&&Number.isInteger(Number(e)),Xp=e=>e.endsWith("%")&&mt(e.slice(0,-1)),wr=e=>_7.test(e),IC=()=>!0,N7=e=>y7.test(e)&&!w7.test(e),Z0=()=>!1,C7=e=>S7.test(e),E7=e=>k7.test(e),j7=e=>!Ve(e)&&!We(e),A7=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)),T7=e=>wa(e,UC,Z0),Ve=e=>BC.test(e),qa=e=>wa(e,FC,N7),gw=e=>wa(e,P7,mt),R7=e=>wa(e,VC,IC),M7=e=>wa(e,qC,Z0),xw=e=>wa(e,$C,Z0),D7=e=>wa(e,HC,E7),Pd=e=>wa(e,GC,C7),We=e=>PC.test(e),bc=e=>uo(e,FC),O7=e=>uo(e,qC),bw=e=>uo(e,$C),L7=e=>uo(e,UC),z7=e=>uo(e,HC),Id=e=>uo(e,GC,!0),B7=e=>uo(e,VC,!0),wa=(e,t,s)=>{const n=BC.exec(e);return n?n[1]?t(n[1]):s(n[2]):!1},uo=(e,t,s=!1)=>{const n=PC.exec(e);return n?n[1]?t(n[1]):s:!1},$C=e=>e==="position"||e==="percentage",HC=e=>e==="image"||e==="url",UC=e=>e==="length"||e==="size"||e==="bg-size",FC=e=>e==="length",P7=e=>e==="number",qC=e=>e==="family-name",VC=e=>e==="number"||e==="weight",GC=e=>e==="shadow",I7=()=>{const e=Rs("color"),t=Rs("font"),s=Rs("text"),n=Rs("font-weight"),o=Rs("tracking"),l=Rs("leading"),u=Rs("breakpoint"),h=Rs("container"),f=Rs("spacing"),d=Rs("radius"),p=Rs("shadow"),g=Rs("inset-shadow"),x=Rs("text-shadow"),v=Rs("drop-shadow"),w=Rs("blur"),k=Rs("perspective"),C=Rs("aspect"),N=Rs("ease"),T=Rs("animate"),j=()=>["auto","avoid","all","avoid-page","page","left","right","column"],A=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],B=()=>[...A(),We,Ve],O=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto","contain","none"],R=()=>[We,Ve,f],D=()=>[la,"full","auto",...R()],P=()=>[$i,"none","subgrid",We,Ve],G=()=>["auto",{span:["full",$i,We,Ve]},$i,We,Ve],Z=()=>[$i,"auto",We,Ve],$=()=>["auto","min","max","fr",We,Ve],q=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],F=()=>["start","end","center","stretch","center-safe","end-safe"],L=()=>["auto",...R()],X=()=>[la,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],U=()=>[la,"screen","full","dvw","lvw","svw","min","max","fit",...R()],K=()=>[la,"screen","full","lh","dvh","lvh","svh","min","max","fit",...R()],Y=()=>[e,We,Ve],V=()=>[...A(),bw,xw,{position:[We,Ve]}],ie=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Ee=()=>["auto","cover","contain",L7,T7,{size:[We,Ve]}],ye=()=>[Xp,bc,qa],oe=()=>["","none","full",d,We,Ve],je=()=>["",mt,bc,qa],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"],De=()=>[mt,Xp,bw,xw],et=()=>["","none",w,We,Ve],ke=()=>["none",mt,We,Ve],He=()=>["none",mt,We,Ve],$e=()=>[mt,We,Ve],wt=()=>[la,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[wr],breakpoint:[wr],color:[IC],container:[wr],"drop-shadow":[wr],ease:["in","out","in-out"],font:[j7],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[wr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[wr],shadow:[wr],spacing:["px",mt],text:[wr],"text-shadow":[wr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",la,Ve,We,C]}],container:["container"],"container-type":[{"@container":["","normal","size",We,Ve]}],"container-named":[A7],columns:[{columns:[mt,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:B()}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],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:[$i,"auto",We,Ve]}],basis:[{basis:[la,"full","auto",h,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[mt,la,"auto","initial","none",Ve]}],grow:[{grow:["",mt,We,Ve]}],shrink:[{shrink:["",mt,We,Ve]}],order:[{order:[$i,"first","last","none",We,Ve]}],"grid-cols":[{"grid-cols":P()}],"col-start-end":[{col:G()}],"col-start":[{"col-start":Z()}],"col-end":[{"col-end":Z()}],"grid-rows":[{"grid-rows":P()}],"row-start-end":[{row:G()}],"row-start":[{"row-start":Z()}],"row-end":[{"row-end":Z()}],"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:[...q(),"normal"]}],"justify-items":[{"justify-items":[...F(),"normal"]}],"justify-self":[{"justify-self":["auto",...F()]}],"align-content":[{content:["normal",...q()]}],"align-items":[{items:[...F(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...F(),{baseline:["","last"]}]}],"place-content":[{"place-content":q()}],"place-items":[{"place-items":[...F(),"baseline"]}],"place-self":[{"place-self":["auto",...F()]}],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:L()}],mx:[{mx:L()}],my:[{my:L()}],ms:[{ms:L()}],me:[{me:L()}],mbs:[{mbs:L()}],mbe:[{mbe:L()}],mt:[{mt:L()}],mr:[{mr:L()}],mb:[{mb:L()}],ml:[{ml:L()}],"space-x":[{"space-x":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:X()}],"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",...X()]}],"min-w":[{"min-w":[h,"screen","none",...X()]}],"max-w":[{"max-w":[h,"screen","none","prose",{screen:[u]},...X()]}],h:[{h:["screen","lh",...X()]}],"min-h":[{"min-h":["screen","lh","none",...X()]}],"max-h":[{"max-h":["screen","lh",...X()]}],"font-size":[{text:["base",s,bc,qa]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,B7,R7]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Xp,Ve]}],"font-family":[{font:[O7,M7,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":[mt,"none",We,gw]}],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:[mt,"from-font","auto",We,qa]}],"text-decoration-color":[{decoration:Y()}],"underline-offset":[{"underline-offset":[mt,"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:[$i,We,Ve]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",We,Ve]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",We,Ve]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:V()}],"bg-repeat":[{bg:ie()}],"bg-size":[{bg:Ee()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},$i,We,Ve],radial:["",We,Ve],conic:[$i,We,Ve]},z7,D7]}],"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":[mt,We,Ve]}],"outline-w":[{outline:["",mt,bc,qa]}],"outline-color":[{outline:Y()}],shadow:[{shadow:["","none",p,Id,Pd]}],"shadow-color":[{shadow:Y()}],"inset-shadow":[{"inset-shadow":["none",g,Id,Pd]}],"inset-shadow-color":[{"inset-shadow":Y()}],"ring-w":[{ring:je()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:Y()}],"ring-offset-w":[{"ring-offset":[mt,qa]}],"ring-offset-color":[{"ring-offset":Y()}],"inset-ring-w":[{"inset-ring":je()}],"inset-ring-color":[{"inset-ring":Y()}],"text-shadow":[{"text-shadow":["none",x,Id,Pd]}],"text-shadow-color":[{"text-shadow":Y()}],opacity:[{opacity:[mt,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":[mt]}],"mask-image-linear-from-pos":[{"mask-linear-from":De()}],"mask-image-linear-to-pos":[{"mask-linear-to":De()}],"mask-image-linear-from-color":[{"mask-linear-from":Y()}],"mask-image-linear-to-color":[{"mask-linear-to":Y()}],"mask-image-t-from-pos":[{"mask-t-from":De()}],"mask-image-t-to-pos":[{"mask-t-to":De()}],"mask-image-t-from-color":[{"mask-t-from":Y()}],"mask-image-t-to-color":[{"mask-t-to":Y()}],"mask-image-r-from-pos":[{"mask-r-from":De()}],"mask-image-r-to-pos":[{"mask-r-to":De()}],"mask-image-r-from-color":[{"mask-r-from":Y()}],"mask-image-r-to-color":[{"mask-r-to":Y()}],"mask-image-b-from-pos":[{"mask-b-from":De()}],"mask-image-b-to-pos":[{"mask-b-to":De()}],"mask-image-b-from-color":[{"mask-b-from":Y()}],"mask-image-b-to-color":[{"mask-b-to":Y()}],"mask-image-l-from-pos":[{"mask-l-from":De()}],"mask-image-l-to-pos":[{"mask-l-to":De()}],"mask-image-l-from-color":[{"mask-l-from":Y()}],"mask-image-l-to-color":[{"mask-l-to":Y()}],"mask-image-x-from-pos":[{"mask-x-from":De()}],"mask-image-x-to-pos":[{"mask-x-to":De()}],"mask-image-x-from-color":[{"mask-x-from":Y()}],"mask-image-x-to-color":[{"mask-x-to":Y()}],"mask-image-y-from-pos":[{"mask-y-from":De()}],"mask-image-y-to-pos":[{"mask-y-to":De()}],"mask-image-y-from-color":[{"mask-y-from":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":De()}],"mask-image-radial-to-pos":[{"mask-radial-to":De()}],"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":A()}],"mask-image-conic-pos":[{"mask-conic":[mt]}],"mask-image-conic-from-pos":[{"mask-conic-from":De()}],"mask-image-conic-to-pos":[{"mask-conic-to":De()}],"mask-image-conic-from-color":[{"mask-conic-from":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:V()}],"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:et()}],brightness:[{brightness:[mt,We,Ve]}],contrast:[{contrast:[mt,We,Ve]}],"drop-shadow":[{"drop-shadow":["","none",v,Id,Pd]}],"drop-shadow-color":[{"drop-shadow":Y()}],grayscale:[{grayscale:["",mt,We,Ve]}],"hue-rotate":[{"hue-rotate":[mt,We,Ve]}],invert:[{invert:["",mt,We,Ve]}],saturate:[{saturate:[mt,We,Ve]}],sepia:[{sepia:["",mt,We,Ve]}],"backdrop-filter":[{"backdrop-filter":["","none",We,Ve]}],"backdrop-blur":[{"backdrop-blur":et()}],"backdrop-brightness":[{"backdrop-brightness":[mt,We,Ve]}],"backdrop-contrast":[{"backdrop-contrast":[mt,We,Ve]}],"backdrop-grayscale":[{"backdrop-grayscale":["",mt,We,Ve]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[mt,We,Ve]}],"backdrop-invert":[{"backdrop-invert":["",mt,We,Ve]}],"backdrop-opacity":[{"backdrop-opacity":[mt,We,Ve]}],"backdrop-saturate":[{"backdrop-saturate":[mt,We,Ve]}],"backdrop-sepia":[{"backdrop-sepia":["",mt,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:[mt,"initial",We,Ve]}],ease:[{ease:["linear","initial",N,We,Ve]}],delay:[{delay:[mt,We,Ve]}],animate:[{animate:["none",T,We,Ve]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[k,We,Ve]}],"perspective-origin":[{"perspective-origin":B()}],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:B()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:wt()}],"translate-x":[{"translate-x":wt()}],"translate-y":[{"translate-y":wt()}],"translate-z":[{"translate-z":wt()}],"translate-none":["translate-none"],zoom:[{zoom:[$i,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:[mt,bc,qa,gw]}],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"]}},$7=x7(I7);function de(...e){return $7(Xc(e))}const H7=[{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}],U7=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});function F7(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 H7)if(n>=l)return U7.format(Math.round(s/l),o);return"just now"}const q7=MC("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 Q({className:e,variant:t,size:s,...n}){return r.jsx("button",{className:de(q7({variant:t,size:s,className:e})),...n})}const WC=_.createContext({});function V7(e){const t=_.useRef(null);return t.current===null&&(t.current=e()),t.current}const G7=typeof window<"u",W7=G7?_.useLayoutEffect:_.useEffect,Q0=_.createContext(null);function J0(e,t){e.indexOf(t)===-1&&e.push(t)}function Oh(e,t){const s=e.indexOf(t);s>-1&&e.splice(s,1)}const Zi=(e,t,s)=>s>t?t:s<e?e:s;let eb=()=>{};const _a={},KC=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function YC(e){return typeof e=="object"&&e!==null}const XC=e=>/^0[^.\s]+$/u.test(e);function ZC(e){let t;return()=>(t===void 0&&(t=e()),t)}const hi=e=>e,K7=(e,t)=>s=>t(e(s)),lu=(...e)=>e.reduce(K7),Zc=(e,t,s)=>{const n=t-e;return n===0?1:(s-e)/n};class tb{constructor(){this.subscriptions=[]}add(t){return J0(this.subscriptions,t),()=>Oh(this.subscriptions,t)}notify(t,s,n){const o=this.subscriptions.length;if(o)if(o===1)this.subscriptions[0](t,s,n);else for(let l=0;l<o;l++){const u=this.subscriptions[l];u&&u(t,s,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Yn=e=>e*1e3,di=e=>e/1e3;function QC(e,t){return t?e*(1e3/t):0}const JC=(e,t,s)=>(((1-3*s+3*t)*e+(3*s-6*t))*e+3*t)*e,Y7=1e-7,X7=12;function Z7(e,t,s,n,o){let l,u,h=0;do u=t+(s-t)/2,l=JC(u,n,o)-e,l>0?s=u:t=u;while(Math.abs(l)>Y7&&++h<X7);return u}function cu(e,t,s,n){if(e===t&&s===n)return hi;const o=l=>Z7(l,0,1,e,s);return l=>l===0||l===1?l:JC(o(l),t,n)}const eE=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,tE=e=>t=>1-e(1-t),sE=cu(.33,1.53,.69,.99),sb=tE(sE),nE=eE(sb),iE=e=>e>=1?1:(e*=2)<1?.5*sb(e):.5*(2-Math.pow(2,-10*(e-1))),nb=e=>1-Math.sin(Math.acos(e)),rE=tE(nb),aE=eE(nb),Q7=cu(.42,0,1,1),J7=cu(0,0,.58,1),oE=cu(.42,0,.58,1),e9=e=>Array.isArray(e)&&typeof e[0]!="number",lE=e=>Array.isArray(e)&&typeof e[0]=="number",t9={linear:hi,easeIn:Q7,easeInOut:oE,easeOut:J7,circIn:nb,circInOut:aE,circOut:rE,backIn:sb,backInOut:nE,backOut:sE,anticipate:iE},s9=e=>typeof e=="string",vw=e=>{if(lE(e)){eb(e.length===4);const[t,s,n,o]=e;return cu(t,s,n,o)}else if(s9(e))return t9[e];return e},$d=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function n9(e,t){let s=new Set,n=new Set,o=!1,l=!1;const u=new WeakSet;let h={delta:0,timestamp:0,isProcessing:!1};function f(p){u.has(p)&&(d.schedule(p),e()),p(h)}const d={schedule:(p,g=!1,x=!1)=>{const w=x&&o?s:n;return g&&u.add(p),w.add(p),p},cancel:p=>{n.delete(p),u.delete(p)},process:p=>{if(h=p,o){l=!0;return}o=!0;const g=s;s=n,n=g,s.forEach(f),s.clear(),o=!1,l&&(l=!1,d.process(p))}};return d}const i9=40;function cE(e,t){let s=!1,n=!0;const o={delta:0,timestamp:0,isProcessing:!1},l=()=>s=!0,u=$d.reduce((j,A)=>(j[A]=n9(l),j),{}),{setup:h,read:f,resolveKeyframes:d,preUpdate:p,update:g,preRender:x,render:v,postRender:w}=u,k=()=>{const j=_a.useManualTiming,A=j?o.timestamp:performance.now();s=!1,j||(o.delta=n?1e3/60:Math.max(Math.min(A-o.timestamp,i9),1)),o.timestamp=A,o.isProcessing=!0,h.process(o),f.process(o),d.process(o),p.process(o),g.process(o),x.process(o),v.process(o),w.process(o),o.isProcessing=!1,s&&t&&(n=!1,e(k))},C=()=>{s=!0,n=!0,o.isProcessing||e(k)};return{schedule:$d.reduce((j,A)=>{const B=u[A];return j[A]=(O,I=!1,R=!1)=>(s||C(),B.schedule(O,I,R)),j},{}),cancel:j=>{for(let A=0;A<$d.length;A++)u[$d[A]].cancel(j)},state:o,steps:u}}const{schedule:Vt,cancel:ya,state:Ys,steps:Zp}=cE(typeof requestAnimationFrame<"u"?requestAnimationFrame:hi,!0);let ph;function r9(){ph=void 0}const gn={now:()=>(ph===void 0&&gn.set(Ys.isProcessing||_a.useManualTiming?Ys.timestamp:performance.now()),ph),set:e=>{ph=e,queueMicrotask(r9)}},uE=e=>t=>typeof t=="string"&&t.startsWith(e),dE=uE("--"),a9=uE("var(--"),ib=e=>a9(e)?o9.test(e.split("/*")[0].trim()):!1,o9=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function _w(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const pl={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Qc={...pl,transform:e=>Zi(0,1,e)},Hd={...pl,default:1},Hc=e=>Math.round(e*1e5)/1e5,rb=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function l9(e){return e==null}const c9=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,ab=(e,t)=>s=>!!(typeof s=="string"&&c9.test(s)&&s.startsWith(e)||t&&!l9(s)&&Object.prototype.hasOwnProperty.call(s,t)),hE=(e,t,s)=>n=>{if(typeof n!="string")return n;const[o,l,u,h]=n.match(rb);return{[e]:parseFloat(o),[t]:parseFloat(l),[s]:parseFloat(u),alpha:h!==void 0?parseFloat(h):1}},u9=e=>Zi(0,255,e),Qp={...pl,transform:e=>Math.round(u9(e))},Qa={test:ab("rgb","red"),parse:hE("red","green","blue"),transform:({red:e,green:t,blue:s,alpha:n=1})=>"rgba("+Qp.transform(e)+", "+Qp.transform(t)+", "+Qp.transform(s)+", "+Hc(Qc.transform(n))+")"};function d9(e){let t="",s="",n="",o="";return e.length>5?(t=e.substring(1,3),s=e.substring(3,5),n=e.substring(5,7),o=e.substring(7,9)):(t=e.substring(1,2),s=e.substring(2,3),n=e.substring(3,4),o=e.substring(4,5),t+=t,s+=s,n+=n,o+=o),{red:parseInt(t,16),green:parseInt(s,16),blue:parseInt(n,16),alpha:o?parseInt(o,16)/255:1}}const _x={test:ab("#"),parse:d9,transform:Qa.transform},uu=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),ma=uu("deg"),Ki=uu("%"),Ye=uu("px"),h9=uu("vh"),f9=uu("vw"),yw={...Ki,parse:e=>Ki.parse(e)/100,transform:e=>Ki.transform(e*100)},tl={test:ab("hsl","hue"),parse:hE("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:s,alpha:n=1})=>"hsla("+Math.round(e)+", "+Ki.transform(Hc(t))+", "+Ki.transform(Hc(s))+", "+Hc(Qc.transform(n))+")"},Cs={test:e=>Qa.test(e)||_x.test(e)||tl.test(e),parse:e=>Qa.test(e)?Qa.parse(e):tl.test(e)?tl.parse(e):_x.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Qa.transform(e):tl.transform(e),getAnimatableNone:e=>{const t=Cs.parse(e);return t.alpha=0,Cs.transform(t)}},m9=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function p9(e){return isNaN(e)&&typeof e=="string"&&(e.match(rb)?.length||0)+(e.match(m9)?.length||0)>0}const fE="number",mE="color",g9="var",x9="var(",ww="${}",b9=/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 dl(e){const t=e.toString(),s=[],n={color:[],number:[],var:[]},o=[];let l=0;const h=t.replace(b9,f=>(Cs.test(f)?(n.color.push(l),o.push(mE),s.push(Cs.parse(f))):f.startsWith(x9)?(n.var.push(l),o.push(g9),s.push(f)):(n.number.push(l),o.push(fE),s.push(parseFloat(f))),++l,ww)).split(ww);return{values:s,split:h,indexes:n,types:o}}function v9(e){return dl(e).values}function pE({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===fE?o+=Hc(n[l]):u===mE?o+=Cs.transform(n[l]):o+=n[l]}return o}}function _9(e){return pE(dl(e))}const y9=e=>typeof e=="number"?0:Cs.test(e)?Cs.getAnimatableNone(e):e,w9=(e,t)=>typeof e=="number"?t?.trim().endsWith("/")?e:0:y9(e);function S9(e){const t=dl(e);return pE(t)(t.values.map((n,o)=>w9(n,t.split[o])))}const Mi={test:p9,parse:v9,createTransformer:_9,getAnimatableNone:S9};function Jp(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 k9({hue:e,saturation:t,lightness:s,alpha:n}){e/=360,t/=100,s/=100;let o=0,l=0,u=0;if(!t)o=l=u=s;else{const h=s<.5?s*(1+t):s+t-s*t,f=2*s-h;o=Jp(f,h,e+1/3),l=Jp(f,h,e),u=Jp(f,h,e-1/3)}return{red:Math.round(o*255),green:Math.round(l*255),blue:Math.round(u*255),alpha:n}}function Lh(e,t){return s=>s>0?t:e}const Qt=(e,t,s)=>e+(t-e)*s,eg=(e,t,s)=>{const n=e*e,o=s*(t*t-n)+n;return o<0?0:Math.sqrt(o)},N9=[_x,Qa,tl],C9=e=>N9.find(t=>t.test(e));function Sw(e){const t=C9(e);if(!t)return!1;let s=t.parse(e);return t===tl&&(s=k9(s)),s}const kw=(e,t)=>{const s=Sw(e),n=Sw(t);if(!s||!n)return Lh(e,t);const o={...s};return l=>(o.red=eg(s.red,n.red,l),o.green=eg(s.green,n.green,l),o.blue=eg(s.blue,n.blue,l),o.alpha=Qt(s.alpha,n.alpha,l),Qa.transform(o))},yx=new Set(["none","hidden"]);function E9(e,t){return yx.has(e)?s=>s<=0?e:t:s=>s>=1?t:e}function j9(e,t){return s=>Qt(e,t,s)}function ob(e){return typeof e=="number"?j9:typeof e=="string"?ib(e)?Lh:Cs.test(e)?kw:R9:Array.isArray(e)?gE:typeof e=="object"?Cs.test(e)?kw:A9:Lh}function gE(e,t){const s=[...e],n=s.length,o=e.map((l,u)=>ob(l)(l,t[u]));return l=>{for(let u=0;u<n;u++)s[u]=o[u](l);return s}}function A9(e,t){const s={...e,...t},n={};for(const o in s)e[o]!==void 0&&t[o]!==void 0&&(n[o]=ob(e[o])(e[o],t[o]));return o=>{for(const l in n)s[l]=n[l](o);return s}}function T9(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 R9=(e,t)=>{const s=Mi.createTransformer(t),n=dl(e),o=dl(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?yx.has(e)&&!o.values.length||yx.has(t)&&!n.values.length?E9(e,t):lu(gE(T9(n,o),o.values),s):Lh(e,t)};function xE(e,t,s){return typeof e=="number"&&typeof t=="number"&&typeof s=="number"?Qt(e,t,s):ob(e)(e,t)}const M9=e=>{const t=({timestamp:s})=>e(s);return{start:(s=!0)=>Vt.update(t,s),stop:()=>ya(t),now:()=>Ys.isProcessing?Ys.timestamp:gn.now()}},bE=(e,t,s=10)=>{let n="";const o=Math.max(Math.round(t/s),2);for(let l=0;l<o;l++)n+=Math.round(e(l/(o-1))*1e4)/1e4+", ";return`linear(${n.substring(0,n.length-2)})`},zh=2e4;function lb(e){let t=0;const s=50;let n=e.next(t);for(;!n.done&&t<zh;)t+=s,n=e.next(t);return t>=zh?1/0:t}function D9(e,t=100,s){const n=s({...e,keyframes:[0,t]}),o=Math.min(lb(n),zh);return{type:"keyframes",ease:l=>n.next(o*l).value/t,duration:di(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 wx(e,t){return e*Math.sqrt(1-t*t)}const O9=12;function L9(e,t,s){let n=s;for(let o=1;o<O9;o++)n=n-e(n)/t(n);return n}const tg=.001;function z9({duration:e=ls.duration,bounce:t=ls.bounce,velocity:s=ls.velocity,mass:n=ls.mass}){let o,l,u=1-t;u=Zi(ls.minDamping,ls.maxDamping,u),e=Zi(ls.minDuration,ls.maxDuration,di(e)),u<1?(o=d=>{const p=d*u,g=p*e,x=p-s,v=wx(d,u),w=Math.exp(-g);return tg-x/v*w},l=d=>{const g=d*u*e,x=g*s+s,v=Math.pow(u,2)*Math.pow(d,2)*e,w=Math.exp(-g),k=wx(Math.pow(d,2),u);return(-o(d)+tg>0?-1:1)*((x-v)*w)/k}):(o=d=>{const p=Math.exp(-d*e),g=(d-s)*e+1;return-tg+p*g},l=d=>{const p=Math.exp(-d*e),g=(s-d)*(e*e);return p*g});const h=5/e,f=L9(o,l,h);if(e=Yn(e),isNaN(f))return{stiffness:ls.stiffness,damping:ls.damping,duration:e};{const d=Math.pow(f,2)*n;return{stiffness:d,damping:u*2*Math.sqrt(n*d),duration:e}}}const B9=["duration","bounce"],P9=["stiffness","damping","mass"];function Nw(e,t){return t.some(s=>e[s]!==void 0)}function I9(e){let t={velocity:ls.velocity,stiffness:ls.stiffness,damping:ls.damping,mass:ls.mass,isResolvedFromDuration:!1,...e};if(!Nw(e,P9)&&Nw(e,B9))if(t.velocity=0,e.visualDuration){const s=e.visualDuration,n=2*Math.PI/(s*1.2),o=n*n,l=2*Zi(.05,1,1-(e.bounce||0))*Math.sqrt(o);t={...t,mass:ls.mass,stiffness:o,damping:l}}else{const s=z9({...e,velocity:0});t={...t,...s,mass:ls.mass},t.isResolvedFromDuration=!0}return t}function Bh(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:f,damping:d,mass:p,duration:g,velocity:x,isResolvedFromDuration:v}=I9({...s,velocity:-di(s.velocity||0)}),w=x||0,k=d/(2*Math.sqrt(f*p)),C=u-l,N=di(Math.sqrt(f/p)),T=Math.abs(C)<5;n||(n=T?ls.restSpeed.granular:ls.restSpeed.default),o||(o=T?ls.restDelta.granular:ls.restDelta.default);let j,A,B,O,I,R;if(k<1)B=wx(N,k),O=(w+k*N*C)/B,j=P=>{const G=Math.exp(-k*N*P);return u-G*(O*Math.sin(B*P)+C*Math.cos(B*P))},I=k*N*O+C*B,R=k*N*C-O*B,A=P=>Math.exp(-k*N*P)*(I*Math.sin(B*P)+R*Math.cos(B*P));else if(k===1){j=G=>u-Math.exp(-N*G)*(C+(w+N*C)*G);const P=w+N*C;A=G=>Math.exp(-N*G)*(N*P*G-w)}else{const P=N*Math.sqrt(k*k-1);j=q=>{const F=Math.exp(-k*N*q),L=Math.min(P*q,300);return u-F*((w+k*N*C)*Math.sinh(L)+P*C*Math.cosh(L))/P};const G=(w+k*N*C)/P,Z=k*N*G-C*P,$=k*N*C-G*P;A=q=>{const F=Math.exp(-k*N*q),L=Math.min(P*q,300);return F*(Z*Math.sinh(L)+$*Math.cosh(L))}}const D={calculatedDuration:v&&g||null,velocity:P=>Yn(A(P)),next:P=>{if(!v&&k<1){const Z=Math.exp(-k*N*P),$=Math.sin(B*P),q=Math.cos(B*P),F=u-Z*(O*$+C*q),L=Yn(Z*(I*$+R*q));return h.done=Math.abs(L)<=n&&Math.abs(u-F)<=o,h.value=h.done?u:F,h}const G=j(P);if(v)h.done=P>=g;else{const Z=Yn(A(P));h.done=Math.abs(Z)<=n&&Math.abs(u-G)<=o}return h.value=h.done?u:G,h},toString:()=>{const P=Math.min(lb(D),zh),G=bE(Z=>D.next(P*Z).value,P,30);return P+"ms "+G},toTransition:()=>{}};return D}Bh.applyToOptions=e=>{const t=D9(e,100,Bh);return e.ease=t.ease,e.duration=Yn(t.duration),e.type="keyframes",e};const $9=5;function vE(e,t,s){const n=Math.max(t-$9,0);return QC(s-e(n),t-n)}function Sx({keyframes:e,velocity:t=0,power:s=.8,timeConstant:n=325,bounceDamping:o=10,bounceStiffness:l=500,modifyTarget:u,min:h,max:f,restDelta:d=.5,restSpeed:p}){const g=e[0],x={done:!1,value:g},v=R=>h!==void 0&&R<h||f!==void 0&&R>f,w=R=>h===void 0?f:f===void 0||Math.abs(h-R)<Math.abs(f-R)?h:f;let k=s*t;const C=g+k,N=u===void 0?C:u(C);N!==C&&(k=N-g);const T=R=>-k*Math.exp(-R/n),j=R=>N+T(R),A=R=>{const D=T(R),P=j(R);x.done=Math.abs(D)<=d,x.value=x.done?N:P};let B,O;const I=R=>{v(x.value)&&(B=R,O=Bh({keyframes:[x.value,w(x.value)],velocity:vE(j,R,x.value),damping:o,stiffness:l,restDelta:d,restSpeed:p}))};return I(0),{calculatedDuration:null,next:R=>{let D=!1;return!O&&B===void 0&&(D=!0,A(R),I(R)),B!==void 0&&R>=B?O.next(R-B):(!D&&A(R),x)}}}function H9(e,t,s){const n=[],o=s||_a.mix||xE,l=e.length-1;for(let u=0;u<l;u++){let h=o(e[u],e[u+1]);if(t){const f=Array.isArray(t)?t[u]||hi:t;h=lu(f,h)}n.push(h)}return n}function U9(e,t,{clamp:s=!0,ease:n,mixer:o}={}){const l=e.length;if(eb(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=H9(t,n,o),f=h.length,d=p=>{if(u&&p<e[0])return t[0];let g=0;if(f>1)for(;g<e.length-2&&!(p<e[g+1]);g++);const x=Zc(e[g],e[g+1],p);return h[g](x)};return s?p=>d(Zi(e[0],e[l-1],p)):d}function F9(e,t){const s=e[e.length-1];for(let n=1;n<=t;n++){const o=Zc(0,t,n);e.push(Qt(s,1,o))}}function q9(e){const t=[0];return F9(t,e.length-1),t}function V9(e,t){return e.map(s=>s*t)}function G9(e,t){return e.map(()=>t||oE).splice(0,e.length-1)}function Uc({duration:e=300,keyframes:t,times:s,ease:n="easeInOut"}){const o=e9(n)?n.map(vw):vw(n),l={done:!1,value:t[0]},u=V9(s&&s.length===t.length?s:q9(t),e),h=U9(u,t,{ease:Array.isArray(o)?o:G9(t,o)});return{calculatedDuration:e,next:f=>(l.value=h(f),l.done=f>=e,l)}}const W9=e=>e!==null;function bf(e,{repeat:t,repeatType:s="loop"},n,o=1){const l=e.filter(W9),h=o<0||t&&s!=="loop"&&t%2===1?0:l.length-1;return!h||n===void 0?l[h]:n}const K9={decay:Sx,inertia:Sx,tween:Uc,keyframes:Uc,spring:Bh};function _E(e){typeof e.type=="string"&&(e.type=K9[e.type])}class cb{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 Y9=e=>e/100;class Ph extends cb{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;_E(t);const{type:s=Uc,repeat:n=0,repeatDelay:o=0,repeatType:l,velocity:u=0}=t;let{keyframes:h}=t;const f=s||Uc;f!==Uc&&typeof h[0]!="number"&&(this.mixKeyframes=lu(Y9,xE(h[0],h[1])),h=[0,100]);const d=f({...t,keyframes:h});l==="mirror"&&(this.mirroredGenerator=f({...t,keyframes:[...h].reverse(),velocity:-u})),d.calculatedDuration===null&&(d.calculatedDuration=lb(d));const{calculatedDuration:p}=d;this.calculatedDuration=p,this.resolvedDuration=p+o,this.totalDuration=this.resolvedDuration*(n+1)-o,this.generator=d}updateTime(t){const s=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=s}tick(t,s=!1){const{generator:n,totalDuration:o,mixKeyframes:l,mirroredGenerator:u,resolvedDuration:h,calculatedDuration:f}=this;if(this.startTime===null)return n.next(0);const{delay:d=0,keyframes:p,repeat:g,repeatType:x,repeatDelay:v,type:w,onUpdate:k,finalKeyframe:C}=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 N=this.currentTime-d*(this.playbackSpeed>=0?1:-1),T=this.playbackSpeed>=0?N<0:N>o;this.currentTime=Math.max(N,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=o);let j=this.currentTime,A=n;if(g){const R=Math.min(this.currentTime,o)/h;let D=Math.floor(R),P=R%1;!P&&R>=1&&(P=1),P===1&&D--,D=Math.min(D,g+1),D%2&&(x==="reverse"?(P=1-P,v&&(P-=v/h)):x==="mirror"&&(A=u)),j=Zi(0,1,P)*h}let B;T?(this.delayState.value=p[0],B=this.delayState):B=A.next(j),l&&!T&&(B.value=l(B.value));let{done:O}=B;!T&&f!==null&&(O=this.playbackSpeed>=0?this.currentTime>=o:this.currentTime<=0);const I=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&O);return I&&w!==Sx&&(B.value=bf(p,this.options,C,this.speed)),k&&k(B.value),I&&this.finish(),B}then(t,s){return this.finished.then(t,s)}get duration(){return di(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+di(t)}get time(){return di(this.currentTime)}set time(t){t=Yn(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 vE(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=di(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=M9,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 X9(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Ja=e=>e*180/Math.PI,kx=e=>{const t=Ja(Math.atan2(e[1],e[0]));return Nx(t)},Z9={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:kx,rotateZ:kx,skewX:e=>Ja(Math.atan(e[1])),skewY:e=>Ja(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Nx=e=>(e=e%360,e<0&&(e+=360),e),Cw=kx,Ew=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),jw=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),Q9={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Ew,scaleY:jw,scale:e=>(Ew(e)+jw(e))/2,rotateX:e=>Nx(Ja(Math.atan2(e[6],e[5]))),rotateY:e=>Nx(Ja(Math.atan2(-e[2],e[0]))),rotateZ:Cw,rotate:Cw,skewX:e=>Ja(Math.atan(e[4])),skewY:e=>Ja(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Cx(e){return e.includes("scale")?1:0}function Ex(e,t){if(!e||e==="none")return Cx(t);const s=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let n,o;if(s)n=Q9,o=s;else{const h=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);n=Z9,o=h}if(!o)return Cx(t);const l=n[t],u=o[1].split(",").map(ez);return typeof l=="function"?l(u):u[l]}const J9=(e,t)=>{const{transform:s="none"}=getComputedStyle(e);return Ex(s,t)};function ez(e){return parseFloat(e.trim())}const gl=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],xl=new Set(gl),Aw=e=>e===pl||e===Ye,tz=new Set(["x","y","z"]),sz=gl.filter(e=>!tz.has(e));function nz(e){const t=[];return sz.forEach(s=>{const n=e.getValue(s);n!==void 0&&(t.push([s,n.get()]),n.set(s.startsWith("scale")?1:0))}),t}const ga={width:({x:e},{paddingLeft:t="0",paddingRight:s="0",boxSizing:n})=>{const o=e.max-e.min;return n==="border-box"?o:o-parseFloat(t)-parseFloat(s)},height:({y:e},{paddingTop:t="0",paddingBottom:s="0",boxSizing:n})=>{const o=e.max-e.min;return n==="border-box"?o:o-parseFloat(t)-parseFloat(s)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>Ex(t,"x"),y:(e,{transform:t})=>Ex(t,"y")};ga.translateX=ga.x;ga.translateY=ga.y;const so=new Set;let jx=!1,Ax=!1,Tx=!1;function yE(){if(Ax){const e=Array.from(so).filter(n=>n.needsMeasurement),t=new Set(e.map(n=>n.element)),s=new Map;t.forEach(n=>{const o=nz(n);o.length&&(s.set(n,o),n.render())}),e.forEach(n=>n.measureInitialState()),t.forEach(n=>{n.render();const o=s.get(n);o&&o.forEach(([l,u])=>{n.getValue(l)?.set(u)})}),e.forEach(n=>n.measureEndState()),e.forEach(n=>{n.suspendedScrollY!==void 0&&window.scrollTo(0,n.suspendedScrollY)})}Ax=!1,jx=!1,so.forEach(e=>e.complete(Tx)),so.clear()}function wE(){so.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Ax=!0)})}function iz(){Tx=!0,wE(),yE(),Tx=!1}class ub{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?(so.add(this),jx||(jx=!0,Vt.read(wE),Vt.resolveKeyframes(yE))):(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])}X9(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),so.delete(this)}cancel(){this.state==="scheduled"&&(so.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const rz=e=>e.startsWith("--");function SE(e,t,s){rz(t)?e.style.setProperty(t,s):e.style[t]=s}const az={};function kE(e,t){const s=ZC(e);return()=>az[t]??s()}const oz=kE(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),NE=kE(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Rc=([e,t,s,n])=>`cubic-bezier(${e}, ${t}, ${s}, ${n})`,Tw={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Rc([0,.65,.55,1]),circOut:Rc([.55,0,1,.45]),backIn:Rc([.31,.01,.66,-.59]),backOut:Rc([.33,1.53,.69,.99])};function CE(e,t){if(e)return typeof e=="function"?NE()?bE(e,t):"ease-out":lE(e)?Rc(e):Array.isArray(e)?e.map(s=>CE(s,t)||Tw.easeOut):Tw[e]}function lz(e,t,s,{delay:n=0,duration:o=300,repeat:l=0,repeatType:u="loop",ease:h="easeOut",times:f}={},d=void 0){const p={[t]:s};f&&(p.offset=f);const g=CE(h,o);Array.isArray(g)&&(p.easing=g);const x={delay:n,duration:o,easing:Array.isArray(g)?"linear":g,fill:"both",iterations:l+1,direction:u==="reverse"?"alternate":"normal"};return d&&(x.pseudoElement=d),e.animate(p,x)}function EE(e){return typeof e=="function"&&"applyToOptions"in e}function cz({type:e,...t}){return EE(e)&&NE()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class jE extends cb{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:s,name:n,keyframes:o,pseudoElement:l,allowFlatten:u=!1,finalKeyframe:h,onComplete:f}=t;this.isPseudoElement=!!l,this.allowFlatten=u,this.options=t,eb(typeof t.type!="string");const d=cz(t);this.animation=lz(s,n,o,d,l),d.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!l){const p=bf(o,this.options,h,this.speed);this.updateMotionValue&&this.updateMotionValue(p),SE(s,n,p),this.animation.cancel()}f?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const t=this.options?.element;!this.isPseudoElement&&t?.isConnected&&this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return di(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+di(t)}get time(){return di(Number(this.animation.currentTime)||0)}set time(t){const s=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Yn(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&&oz()?(this.animation.timeline=t,s&&(this.animation.rangeStart=s),n&&(this.animation.rangeEnd=n),hi):o(this)}}const AE={anticipate:iE,backInOut:nE,circInOut:aE};function uz(e){return e in AE}function dz(e){typeof e.ease=="string"&&uz(e.ease)&&(e.ease=AE[e.ease])}const sg=10;class hz extends jE{constructor(t){dz(t),_E(t),super(t),t.startTime!==void 0&&t.autoplay!==!1&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:s,onUpdate:n,onComplete:o,element:l,...u}=this.options;if(!s)return;if(t!==void 0){s.set(t);return}const h=new Ph({...u,autoplay:!1}),f=Math.max(sg,gn.now()-this.startTime),d=Zi(0,sg,f-sg),p=h.sample(f).value,{name:g}=this.options;l&&g&&SE(l,g,p),s.setWithVelocity(h.sample(Math.max(0,f-d)).value,p,d),h.stop()}}const Rw=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Mi.test(e)||e==="0")&&!e.startsWith("url("));function fz(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 mz(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=Rw(o,t),h=Rw(l,t);return!u||!h?!1:fz(e)||(s==="spring"||EE(s))&&n}function Rx(e){e.duration=0,e.type="keyframes"}const TE=new Set(["opacity","clipPath","filter","transform"]),pz=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function gz(e){for(let t=0;t<e.length;t++)if(typeof e[t]=="string"&&pz.test(e[t]))return!0;return!1}const xz=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),bz=ZC(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function vz(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 bz()&&s&&(TE.has(s)||xz.has(s)&&gz(h))&&(s!=="transform"||!p)&&!d&&!n&&o!=="mirror"&&l!==0&&u!=="inertia"}const _z=40;class yz extends cb{constructor({autoplay:t=!0,delay:s=0,type:n="keyframes",repeat:o=0,repeatDelay:l=0,repeatType:u="loop",keyframes:h,name:f,motionValue:d,element:p,...g}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=gn.now();const x={autoplay:t,delay:s,type:n,repeat:o,repeatDelay:l,repeatType:u,name:f,motionValue:d,element:p,...g},v=p?.KeyframeResolver||ub;this.keyframeResolver=new v(h,(w,k,C)=>this.onKeyframesResolved(w,k,x,!C),f,d,p),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,s,n,o){this.keyframeResolver=void 0;const{name:l,type:u,velocity:h,delay:f,isHandoff:d,onUpdate:p}=n;this.resolvedAt=gn.now();let g=!0;mz(t,l,u,h)||(g=!1,(_a.instantAnimations||!f)&&p?.(bf(t,n,s)),t[0]=t[t.length-1],Rx(n),n.repeat=0);const v={startTime:o?this.resolvedAt?this.resolvedAt-this.createdAt>_z?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:s,...n,keyframes:t},w=g&&!d&&vz(v),k=v.motionValue?.owner?.current;let C;if(w)try{C=new hz({...v,element:k})}catch{C=new Ph(v)}else C=new Ph(v);C.finished.then(()=>{this.notifyFinished()}).catch(hi),this.pendingTimeline&&(this.stopTimeline=C.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=C}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(),iz()),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 RE(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 wz=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Sz(e){const t=wz.exec(e);if(!t)return[,];const[,s,n,o]=t;return[`--${s??n}`,o]}function ME(e,t,s=1){const[n,o]=Sz(e);if(!n)return;const l=window.getComputedStyle(t).getPropertyValue(n);if(l){const u=l.trim();return KC(u)?parseFloat(u):u}return ib(o)?ME(o,t,s+1):o}const kz={type:"spring",stiffness:500,damping:25,restSpeed:10},Nz=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),Cz={type:"keyframes",duration:.8},Ez={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},jz=(e,{keyframes:t})=>t.length>2?Cz:xl.has(e)?e.startsWith("scale")?Nz(t[1]):kz:Ez;function DE(e,t){if(e?.inherit&&t){const{inherit:s,...n}=e;return{...t,...n}}return e}function db(e,t){const s=e?.[t]??e?.default??e;return s!==e?DE(s,e):s}const Az=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function Tz(e){for(const t in e)if(!Az.has(t))return!0;return!1}const hb=(e,t,s,n={},o,l)=>u=>{const h=db(n,e)||{},f=h.delay||n.delay||0;let{elapsed:d=0}=n;d=d-Yn(f);const p={keyframes:Array.isArray(s)?s:[null,s],ease:"easeOut",velocity:t.getVelocity(),...h,delay:-d,onUpdate:x=>{t.set(x),h.onUpdate&&h.onUpdate(x)},onComplete:()=>{u(),h.onComplete&&h.onComplete()},name:e,motionValue:t,element:l?void 0:o};Tz(h)||Object.assign(p,jz(e,p)),p.duration&&(p.duration=Yn(p.duration)),p.repeatDelay&&(p.repeatDelay=Yn(p.repeatDelay)),p.from!==void 0&&(p.keyframes[0]=p.from);let g=!1;if((p.type===!1||p.duration===0&&!p.repeatDelay)&&(Rx(p),p.delay===0&&(g=!0)),(_a.instantAnimations||_a.skipAnimations||o?.shouldSkipAnimations)&&(g=!0,Rx(p),p.delay=0),p.allowFlatten=!h.type&&!h.ease,g&&!l&&t.get()!==void 0){const x=bf(p.keyframes,h);if(x!==void 0){Vt.update(()=>{p.onUpdate(x),p.onComplete()});return}}return h.isSync?new Ph(p):new yz(p)};function Mw(e){const t=[{},{}];return e?.values.forEach((s,n)=>{t[0][n]=s.get(),t[1][n]=s.getVelocity()}),t}function fb(e,t,s,n){if(typeof t=="function"){const[o,l]=Mw(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]=Mw(n);t=t(s!==void 0?s:e.custom,o,l)}return t}function no(e,t,s){const n=e.getProps();return fb(n,t,s!==void 0?s:n.custom,e)}const OE=new Set(["width","height","top","left","right","bottom",...gl]),Dw=30,Rz=e=>!isNaN(parseFloat(e));class Mz{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=Rz(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 tb);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>Dw)return 0;const s=Math.min(this.updatedAt-this.prevUpdatedAt,Dw);return QC(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 hl(e,t){return new Mz(e,t)}const Mx=e=>Array.isArray(e);function Dz(e,t,s){e.hasValue(t)?e.getValue(t).set(s):e.addValue(t,hl(s))}function Oz(e){return Mx(e)?e[e.length-1]||0:e}function Lz(e,t){const s=no(e,t);let{transitionEnd:n={},transition:o={},...l}=s||{};l={...l,...n};for(const u in l){const h=Oz(l[u]);Dz(e,u,h)}}const Zs=e=>!!(e&&e.getVelocity);function zz(e){return!!(Zs(e)&&e.add)}function Dx(e,t){const s=e.getValue("willChange");if(zz(s))return s.add(t);if(!s&&_a.WillChange){const n=new _a.WillChange("auto");e.addValue("willChange",n),n.add(t)}}function mb(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const Bz="framerAppearId",LE="data-"+mb(Bz);function zE(e){return e.props[LE]}function Pz({protectedKeys:e,needsAnimating:t},s){const n=e.hasOwnProperty(s)&&t[s]!==!0;return t[s]=!1,n}function BE(e,t,{delay:s=0,transitionOverride:n,type:o}={}){let{transition:l,transitionEnd:u,...h}=t;const f=e.getDefaultTransition();l=l?DE(l,f):f;const d=l?.reduceMotion;n&&(l=n);const p=[],g=o&&e.animationState&&e.animationState.getState()[o];for(const x in h){const v=e.getValue(x,e.latestValues[x]??null),w=h[x];if(w===void 0||g&&Pz(g,x))continue;const k={delay:s,...db(l||{},x)},C=v.get();if(C!==void 0&&!v.isAnimating()&&!Array.isArray(w)&&w===C&&!k.velocity){Vt.update(()=>v.set(w));continue}let N=!1;if(window.MotionHandoffAnimation){const A=zE(e);if(A){const B=window.MotionHandoffAnimation(A,x,Vt);B!==null&&(k.startTime=B,N=!0)}}Dx(e,x);const T=d??e.shouldReduceMotion;v.start(hb(x,v,w,T&&OE.has(x)?{type:!1}:k,e,N));const j=v.animation;j&&p.push(j)}if(u){const x=()=>Vt.update(()=>{u&&Lz(e,u)});p.length?Promise.all(p).then(x):x()}return p}function Ox(e,t,s={}){const n=no(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(BE(e,n,s)):()=>Promise.resolve(),u=e.variantChildren&&e.variantChildren.size?(f=0)=>{const{delayChildren:d=0,staggerChildren:p,staggerDirection:g}=o;return Iz(e,t,f,d,p,g,s)}:()=>Promise.resolve(),{when:h}=o;if(h){const[f,d]=h==="beforeChildren"?[l,u]:[u,l];return f().then(()=>d())}else return Promise.all([l(),u(s.delay)])}function Iz(e,t,s=0,n=0,o=0,l=1,u){const h=[];for(const f of e.variantChildren)f.notify("AnimationStart",t),h.push(Ox(f,t,{...u,delay:s+(typeof n=="function"?0:n)+RE(e.variantChildren,f,n,o,l)}).then(()=>f.notify("AnimationComplete",t)));return Promise.all(h)}function $z(e,t,s={}){e.notify("AnimationStart",t);let n;if(Array.isArray(t)){const o=t.map(l=>Ox(e,l,s));n=Promise.all(o)}else if(typeof t=="string")n=Ox(e,t,s);else{const o=typeof t=="function"?no(e,t,s.custom):t;n=Promise.all(BE(e,o,s))}return n.then(()=>{e.notify("AnimationComplete",t)})}const Hz={test:e=>e==="auto",parse:e=>e},PE=e=>t=>t.test(e),IE=[pl,Ye,Ki,ma,f9,h9,Hz],Ow=e=>IE.find(PE(e));function Uz(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||XC(e):!0}const Fz=new Set(["brightness","contrast","saturate","opacity"]);function qz(e){const[t,s]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[n]=s.match(rb)||[];if(!n)return e;const o=s.replace(n,"");let l=Fz.has(t)?1:0;return n!==s&&(l*=100),t+"("+l+o+")"}const Vz=/\b([a-z-]*)\(.*?\)/gu,Lx={...Mi,getAnimatableNone:e=>{const t=e.match(Vz);return t?t.map(qz).join(" "):e}},zx={...Mi,getAnimatableNone:e=>{const t=Mi.parse(e);return Mi.createTransformer(e)(t.map(n=>typeof n=="number"?0:typeof n=="object"?{...n,alpha:1}:n))}},Lw={...pl,transform:Math.round},Gz={rotate:ma,rotateX:ma,rotateY:ma,rotateZ:ma,scale:Hd,scaleX:Hd,scaleY:Hd,scaleZ:Hd,skew:ma,skewX:ma,skewY:ma,distance:Ye,translateX:Ye,translateY:Ye,translateZ:Ye,x:Ye,y:Ye,z:Ye,perspective:Ye,transformPerspective:Ye,opacity:Qc,originX:yw,originY:yw,originZ:Ye},pb={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,...Gz,zIndex:Lw,fillOpacity:Qc,strokeOpacity:Qc,numOctaves:Lw},Wz={...pb,color:Cs,backgroundColor:Cs,outlineColor:Cs,fill:Cs,stroke:Cs,borderColor:Cs,borderTopColor:Cs,borderRightColor:Cs,borderBottomColor:Cs,borderLeftColor:Cs,filter:Lx,WebkitFilter:Lx,mask:zx,WebkitMask:zx},$E=e=>Wz[e],Kz=new Set([Lx,zx]);function HE(e,t){let s=$E(e);return Kz.has(s)||(s=Mi),s.getAnimatableNone?s.getAnimatableNone(t):void 0}const Yz=new Set(["auto","none","0"]);function Xz(e,t,s){let n=0,o;for(;n<e.length&&!o;){const l=e[n];typeof l=="string"&&!Yz.has(l)&&dl(l).values.length&&(o=e[n]),n++}if(o&&s)for(const l of t)e[l]=HE(s,o)}class Zz extends ub{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(),ib(g))){const x=ME(g,s.current);x!==void 0&&(t[p]=x),p===t.length-1&&(this.finalKeyframe=g)}}if(this.resolveNoneKeyframes(),!OE.has(n)||t.length!==2)return;const[o,l]=t,u=Ow(o),h=Ow(l),f=_w(o),d=_w(l);if(f!==d&&ga[n]){this.needsMeasurement=!0;return}if(u!==h)if(Aw(u)&&Aw(h))for(let p=0;p<t.length;p++){const g=t[p];typeof g=="string"&&(t[p]=parseFloat(g))}else ga[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:s}=this,n=[];for(let o=0;o<t.length;o++)(t[o]===null||Uz(t[o]))&&n.push(o);n.length&&Xz(t,n,s)}measureInitialState(){const{element:t,unresolvedKeyframes:s,name:n}=this;if(!t||!t.current)return;n==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=ga[n](t.measureViewportBox(),window.getComputedStyle(t.current)),s[0]=this.measuredOrigin;const o=s[s.length-1];o!==void 0&&t.getValue(n,o).jump(o,!1)}measureEndState(){const{element:t,name:s,unresolvedKeyframes:n}=this;if(!t||!t.current)return;const o=t.getValue(s);o&&o.jump(this.measuredOrigin,!1);const l=n.length-1,u=n[l];n[l]=ga[s](t.measureViewportBox(),window.getComputedStyle(t.current)),u!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=u),this.removedTransforms?.length&&this.removedTransforms.forEach(([h,f])=>{t.getValue(h).set(f)}),this.resolveNoneKeyframes()}}function UE(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 FE=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function Qz(e){return YC(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}const{schedule:gb}=cE(queueMicrotask,!1),ji={x:!1,y:!1};function qE(){return ji.x||ji.y}function Jz(e){return e==="x"||e==="y"?ji[e]?null:(ji[e]=!0,()=>{ji[e]=!1}):ji.x||ji.y?null:(ji.x=ji.y=!0,()=>{ji.x=ji.y=!1})}function VE(e,t){const s=UE(e),n=new AbortController,o={passive:!0,...t,signal:n.signal};return[s,o,()=>n.abort()]}function eB(e){return!(e.pointerType==="touch"||qE())}function tB(e,t,s={}){const[n,o,l]=VE(e,s);return n.forEach(u=>{let h=!1,f=!1,d;const p=()=>{u.removeEventListener("pointerleave",w)},g=C=>{d&&(d(C),d=void 0),p()},x=C=>{h=!1,window.removeEventListener("pointerup",x),window.removeEventListener("pointercancel",x),f&&(f=!1,g(C))},v=()=>{h=!0,window.addEventListener("pointerup",x,o),window.addEventListener("pointercancel",x,o)},w=C=>{if(C.pointerType!=="touch"){if(h){f=!0;return}g(C)}},k=C=>{if(!eB(C))return;f=!1;const N=t(u,C);typeof N=="function"&&(d=N,u.addEventListener("pointerleave",w,o))};u.addEventListener("pointerenter",k,o),u.addEventListener("pointerdown",v,o)}),l}const GE=(e,t)=>t?e===t?!0:GE(e,t.parentElement):!1,xb=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,sB=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function nB(e){return sB.has(e.tagName)||e.isContentEditable===!0}const iB=new Set(["INPUT","SELECT","TEXTAREA"]);function rB(e){return iB.has(e.tagName)||e.isContentEditable===!0}const gh=new WeakSet;function zw(e){return t=>{t.key==="Enter"&&e(t)}}function ng(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const aB=(e,t)=>{const s=e.currentTarget;if(!s)return;const n=zw(()=>{if(gh.has(s))return;ng(s,"down");const o=zw(()=>{ng(s,"up")}),l=()=>ng(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 Bw(e){return xb(e)&&!qE()}const Pw=new WeakSet;function oB(e,t,s={}){const[n,o,l]=VE(e,s),u=h=>{const f=h.currentTarget;if(!Bw(h)||Pw.has(h))return;gh.add(f),s.stopPropagation&&Pw.add(h);const d=t(f,h),p=(v,w)=>{window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",x),gh.has(f)&&gh.delete(f),Bw(v)&&typeof d=="function"&&d(v,{success:w})},g=v=>{p(v,f===window||f===document||s.useGlobalTarget||GE(f,v.target))},x=v=>{p(v,!1)};window.addEventListener("pointerup",g,o),window.addEventListener("pointercancel",x,o)};return n.forEach(h=>{(s.useGlobalTarget?window:h).addEventListener("pointerdown",u,o),Qz(h)&&(h.addEventListener("focus",d=>aB(d,o)),!nB(h)&&!h.hasAttribute("tabindex")&&(h.tabIndex=0))}),l}function bb(e){return YC(e)&&"ownerSVGElement"in e}const xh=new WeakMap;let bh;const WE=(e,t,s)=>(n,o)=>o&&o[0]?o[0][e+"Size"]:bb(n)&&"getBBox"in n?n.getBBox()[t]:n[s],lB=WE("inline","width","offsetWidth"),cB=WE("block","height","offsetHeight");function uB({target:e,borderBoxSize:t}){xh.get(e)?.forEach(s=>{s(e,{get width(){return lB(e,t)},get height(){return cB(e,t)}})})}function dB(e){e.forEach(uB)}function hB(){typeof ResizeObserver>"u"||(bh=new ResizeObserver(dB))}function fB(e,t){bh||hB();const s=UE(e);return s.forEach(n=>{let o=xh.get(n);o||(o=new Set,xh.set(n,o)),o.add(t),bh?.observe(n)}),()=>{s.forEach(n=>{const o=xh.get(n);o?.delete(t),o?.size||bh?.unobserve(n)})}}const vh=new Set;let sl;function mB(){sl=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};vh.forEach(t=>t(e))},window.addEventListener("resize",sl)}function pB(e){return vh.add(e),sl||mB(),()=>{vh.delete(e),!vh.size&&typeof sl=="function"&&(window.removeEventListener("resize",sl),sl=void 0)}}function Iw(e,t){return typeof e=="function"?pB(e):fB(e,t)}function gB(e){return bb(e)&&e.tagName==="svg"}const xB=[...IE,Cs,Mi],bB=e=>xB.find(PE(e)),$w=()=>({translate:0,scale:1,origin:0,originPoint:0}),nl=()=>({x:$w(),y:$w()}),Hw=()=>({min:0,max:0}),Os=()=>({x:Hw(),y:Hw()}),vB=new WeakMap;function vf(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function Jc(e){return typeof e=="string"||Array.isArray(e)}const vb=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],_b=["initial",...vb];function _f(e){return vf(e.animate)||_b.some(t=>Jc(e[t]))}function KE(e){return!!(_f(e)||e.variants)}function _B(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,hl(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,hl(u!==void 0?u:o,{owner:e}))}}for(const n in s)t[n]===void 0&&e.removeValue(n);return t}const Bx={current:null},YE={current:!1},yB=typeof window<"u";function wB(){if(YE.current=!0,!!yB)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Bx.current=e.matches;e.addEventListener("change",t),t()}else Bx.current=!1}const Uw=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Ih={};function XE(e){Ih=e}function SB(){return Ih}class kB{scrapeMotionValuesFromProps(t,s,n){return{}}constructor({parent:t,props:s,presenceContext:n,reducedMotionConfig:o,skipAnimations:l,blockInitialAnimation:u,visualState:h},f={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=ub,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=f,this.blockInitialAnimation=!!u,this.isControllingVariants=_f(s),this.isVariantNode=KE(s),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:g,...x}=this.scrapeMotionValuesFromProps(s,{},this);for(const v in x){const w=x[v];d[v]!==void 0&&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,vB.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:(YE.current||wB(),this.shouldReduceMotion=Bx.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(),ya(this.notifyUpdate),ya(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&&TE.has(t)&&this.current instanceof HTMLElement){const{factory:u,keyframes:h,times:f,ease:d,duration:p}=s.accelerate,g=new jE({element:this.current,name:t,keyframes:h,times:f,ease:d,duration:Yn(p)}),x=u(g);this.valueSubscriptions.set(t,()=>{x(),g.cancel()});return}const n=xl.has(t);n&&this.onBindTransform&&this.onBindTransform();const o=s.on("change",u=>{this.latestValues[t]=u,this.props.onUpdate&&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 Ih){const s=Ih[t];if(!s)continue;const{isEnabled:n,Feature:o}=s;if(!this.features[t]&&o&&n(this.props)&&(this.features[t]=new o(this)),this.features[t]){const l=this.features[t];l.isMounted?l.update():(l.mount(),l.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Os()}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<Uw.length;n++){const o=Uw[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=_B(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=hl(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"&&(KC(n)||XC(n))?n=parseFloat(n):!bB(n)&&Mi.test(s)&&(n=HE(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=fb(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 tb),this.events[t].add(s)}notify(t,...s){this.events[t]&&this.events[t].notify(...s)}scheduleRenderMicrotask(){gb.render(this.render)}}class ZE extends kB{constructor(){super(...arguments),this.KeyframeResolver=Zz}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 Sa{constructor(t){this.isMounted=!1,this.node=t}update(){}}function QE({top:e,left:t,right:s,bottom:n}){return{x:{min:t,max:s},y:{min:e,max:n}}}function NB({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function CB(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 ig(e){return e===void 0||e===1}function Px({scale:e,scaleX:t,scaleY:s}){return!ig(e)||!ig(t)||!ig(s)}function Ka(e){return Px(e)||JE(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function JE(e){return Fw(e.x)||Fw(e.y)}function Fw(e){return e&&e!=="0%"}function $h(e,t,s){const n=e-s,o=t*n;return s+o}function qw(e,t,s,n,o){return o!==void 0&&(e=$h(e,o,n)),$h(e,s,n)+t}function Ix(e,t=0,s=1,n,o){e.min=qw(e.min,t,s,n,o),e.max=qw(e.max,t,s,n,o)}function e3(e,{x:t,y:s}){Ix(e.x,t.translate,t.scale,t.originPoint),Ix(e.y,s.translate,s.scale,s.originPoint)}const Vw=.999999999999,Gw=1.0000000000001;function EB(e,t,s,n=!1){const o=s.length;if(!o)return;t.x=t.y=1;let l,u;for(let h=0;h<o;h++){l=s[h],u=l.projectionDelta;const{visualElement:f}=l.options;f&&f.props.style&&f.props.style.display==="contents"||(n&&l.options.layoutScroll&&l.scroll&&l!==l.root&&(Gi(e.x,-l.scroll.offset.x),Gi(e.y,-l.scroll.offset.y)),u&&(t.x*=u.x.scale,t.y*=u.y.scale,e3(e,u)),n&&Ka(l.latestValues)&&_h(e,l.latestValues,l.layout?.layoutBox))}t.x<Gw&&t.x>Vw&&(t.x=1),t.y<Gw&&t.y>Vw&&(t.y=1)}function Gi(e,t){e.min+=t,e.max+=t}function Ww(e,t,s,n,o=.5){const l=Qt(e.min,e.max,o);Ix(e,t,s,l,n)}function Kw(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function _h(e,t,s){const n=s??e;Ww(e.x,Kw(t.x,n.x),t.scaleX,t.scale,t.originX),Ww(e.y,Kw(t.y,n.y),t.scaleY,t.scale,t.originY)}function t3(e,t){return QE(CB(e.getBoundingClientRect(),t))}function jB(e,t,s){const n=t3(e,s),{scroll:o}=t;return o&&(Gi(n.x,o.offset.x),Gi(n.y,o.offset.y)),n}const AB={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},TB=gl.length;function RB(e,t,s){let n="",o=!0;for(let l=0;l<TB;l++){const u=gl[l],h=e[u];if(h===void 0)continue;let f=!0;if(typeof h=="number")f=h===(u.startsWith("scale")?1:0);else{const d=parseFloat(h);f=u.startsWith("scale")?d===1:d===0}if(!f||s){const d=FE(h,pb[u]);if(!f){o=!1;const p=AB[u]||u;n+=`${p}(${d}) `}s&&(t[u]=d)}}return n=n.trim(),s?n=s(t,o?"":n):o&&(n="none"),n}function yb(e,t,s){const{style:n,vars:o,transformOrigin:l}=e;let u=!1,h=!1;for(const f in t){const d=t[f];if(xl.has(f)){u=!0;continue}else if(dE(f)){o[f]=d;continue}else{const p=FE(d,pb[f]);f.startsWith("origin")?(h=!0,l[f]=p):n[f]=p}}if(t.transform||(u||s?n.transform=RB(t,e.transform,s):n.transform&&(n.transform="none")),h){const{originX:f="50%",originY:d="50%",originZ:p=0}=l;n.transformOrigin=`${f} ${d} ${p}`}}function s3(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 Yw(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const vc={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Ye.test(e))e=parseFloat(e);else return e;const s=Yw(e,t.target.x),n=Yw(e,t.target.y);return`${s}% ${n}%`}},MB={correct:(e,{treeScale:t,projectionDelta:s})=>{const n=e,o=Mi.parse(e);if(o.length>5)return n;const l=Mi.createTransformer(e),u=typeof o[0]!="number"?1:0,h=s.x.scale*t.x,f=s.y.scale*t.y;o[0+u]/=h,o[1+u]/=f;const d=Qt(h,f,.5);return typeof o[2+u]=="number"&&(o[2+u]/=d),typeof o[3+u]=="number"&&(o[3+u]/=d),l(o)}},$x={borderRadius:{...vc,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:vc,borderTopRightRadius:vc,borderBottomLeftRadius:vc,borderBottomRightRadius:vc,boxShadow:MB};function n3(e,{layout:t,layoutId:s}){return xl.has(e)||e.startsWith("origin")||(t||s!==void 0)&&(!!$x[e]||e==="opacity")}function wb(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])||n3(u,e)||s?.getValue(u)?.liveStyle!==void 0)&&(l[u]=n[u]);return l}function DB(e){return window.getComputedStyle(e)}class OB extends ZE{constructor(){super(...arguments),this.type="html",this.renderInstance=s3}readValueFromInstance(t,s){if(xl.has(s))return this.projection?.isProjecting?Cx(s):J9(t,s);{const n=DB(t),o=(dE(s)?n.getPropertyValue(s):n[s])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(t,{transformPagePoint:s}){return t3(t,s)}build(t,s,n){yb(t,s,n.transformTemplate)}scrapeMotionValuesFromProps(t,s,n){return wb(t,s,n)}}const LB={offset:"stroke-dashoffset",array:"stroke-dasharray"},zB={offset:"strokeDashoffset",array:"strokeDasharray"};function BB(e,t,s=1,n=0,o=!0){e.pathLength=1;const l=o?LB:zB;e[l.offset]=`${-n}`,e[l.array]=`${t} ${s}`}const PB=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function i3(e,{attrX:t,attrY:s,attrScale:n,pathLength:o,pathSpacing:l=1,pathOffset:u=0,...h},f,d,p){if(yb(e,h,d),f){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:g,style:x}=e;g.transform&&(x.transform=g.transform,delete g.transform),(x.transform||g.transformOrigin)&&(x.transformOrigin=g.transformOrigin??"50% 50%",delete g.transformOrigin),x.transform&&(x.transformBox=p?.transformBox??"fill-box",delete g.transformBox);for(const v of PB)g[v]!==void 0&&(x[v]=g[v],delete g[v]);t!==void 0&&(g.x=t),s!==void 0&&(g.y=s),n!==void 0&&(g.scale=n),o!==void 0&&BB(g,o,l,u,!1)}const r3=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"]),a3=e=>typeof e=="string"&&e.toLowerCase()==="svg";function IB(e,t,s,n){s3(e,t,void 0,n);for(const o in t.attrs)e.setAttribute(r3.has(o)?o:mb(o),t.attrs[o])}function o3(e,t,s){const n=wb(e,t,s);for(const o in e)if(Zs(e[o])||Zs(t[o])){const l=gl.indexOf(o)!==-1?"attr"+o.charAt(0).toUpperCase()+o.substring(1):o;n[l]=e[o]}return n}class $B extends ZE{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Os}getBaseTargetFromProps(t,s){return t[s]}readValueFromInstance(t,s){if(xl.has(s)){const n=$E(s);return n&&n.default||0}return s=r3.has(s)?s:mb(s),t.getAttribute(s)}scrapeMotionValuesFromProps(t,s,n){return o3(t,s,n)}build(t,s,n){i3(t,s,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(t,s,n,o){IB(t,s,n,o)}mount(t){this.isSVGTag=a3(t.tagName),super.mount(t)}}const HB=_b.length;function l3(e){if(!e)return;if(!e.isControllingVariants){const s=e.parent?l3(e.parent)||{}:{};return e.props.initial!==void 0&&(s.initial=e.props.initial),s}const t={};for(let s=0;s<HB;s++){const n=_b[s],o=e.props[n];(Jc(o)||o===!1)&&(t[n]=o)}return t}function c3(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 UB=[...vb].reverse(),FB=vb.length;function qB(e){return t=>Promise.all(t.map(({animation:s,options:n})=>$z(e,s,n)))}function VB(e){let t=qB(e),s=Xw(),n=!0,o=!1;const l=d=>(p,g)=>{const x=no(e,g,d==="exit"?e.presenceContext?.custom:void 0);if(x){const{transition:v,transitionEnd:w,...k}=x;p={...p,...k,...w}}return p};function u(d){t=d(e)}function h(d){const{props:p}=e,g=l3(e.parent)||{},x=[],v=new Set;let w={},k=1/0;for(let N=0;N<FB;N++){const T=UB[N],j=s[T],A=p[T]!==void 0?p[T]:g[T],B=Jc(A),O=T===d?j.isActive:null;O===!1&&(k=N);let I=A===g[T]&&A!==p[T]&&B;if(I&&(n||o)&&e.manuallyAnimateOnMount&&(I=!1),j.protectedKeys={...w},!j.isActive&&O===null||!A&&!j.prevProp||vf(A)||typeof A=="boolean")continue;if(T==="exit"&&j.isActive&&O!==!0){j.prevResolvedValues&&(w={...w,...j.prevResolvedValues});continue}const R=GB(j.prevProp,A);let D=R||T===d&&j.isActive&&!I&&B||N>k&&B,P=!1;const G=Array.isArray(A)?A:[A];let Z=G.reduce(l(T),{});O===!1&&(Z={});const{prevResolvedValues:$={}}=j,q={...$,...Z},F=U=>{D=!0,v.has(U)&&(P=!0,v.delete(U)),j.needsAnimating[U]=!0;const K=e.getValue(U);K&&(K.liveStyle=!1)};for(const U in q){const K=Z[U],Y=$[U];if(w.hasOwnProperty(U))continue;let V=!1;Mx(K)&&Mx(Y)?V=!c3(K,Y):V=K!==Y,V?K!=null?F(U):v.add(U):K!==void 0&&v.has(U)?F(U):j.protectedKeys[U]=!0}j.prevProp=A,j.prevResolvedValues=Z,j.isActive&&(w={...w,...Z}),(n||o)&&e.blockInitialAnimation&&(D=!1);const L=I&&R;D&&(!L||P)&&x.push(...G.map(U=>{const K={type:T};if(typeof U=="string"&&(n||o)&&!L&&e.manuallyAnimateOnMount&&e.parent){const{parent:Y}=e,V=no(Y,U);if(Y.enteringChildren&&V){const{delayChildren:ie}=V.transition||{};K.delay=RE(Y.enteringChildren,e,ie)}}return{animation:U,options:K}}))}if(v.size){const N={};if(typeof p.initial!="boolean"){const T=no(e,Array.isArray(p.initial)?p.initial[0]:p.initial);T&&T.transition&&(N.transition=T.transition)}v.forEach(T=>{const j=e.getBaseTarget(T),A=e.getValue(T);A&&(A.liveStyle=!0),N[T]=j??null}),x.push({animation:N})}let C=!!x.length;return n&&(p.initial===!1||p.initial===p.animate)&&!e.manuallyAnimateOnMount&&(C=!1),n=!1,o=!1,C?t(x):Promise.resolve()}function f(d,p){if(s[d].isActive===p)return Promise.resolve();e.variantChildren?.forEach(x=>x.animationState?.setActive(d,p)),s[d].isActive=p;const g=h(d);for(const x in s)s[x].protectedKeys={};return g}return{animateChanges:h,setActive:f,setAnimateFunction:u,getState:()=>s,reset:()=>{s=Xw(),o=!0}}}function GB(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!c3(t,e):!1}function Va(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Xw(){return{animate:Va(!0),whileInView:Va(),whileHover:Va(),whileTap:Va(),whileDrag:Va(),whileFocus:Va(),exit:Va()}}function Hx(e,t){e.min=t.min,e.max=t.max}function Ei(e,t){Hx(e.x,t.x),Hx(e.y,t.y)}function Zw(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const u3=1e-4,WB=1-u3,KB=1+u3,d3=.01,YB=0-d3,XB=0+d3;function xn(e){return e.max-e.min}function ZB(e,t,s){return Math.abs(e-t)<=s}function Qw(e,t,s,n=.5){e.origin=n,e.originPoint=Qt(t.min,t.max,e.origin),e.scale=xn(s)/xn(t),e.translate=Qt(s.min,s.max,e.origin)-e.originPoint,(e.scale>=WB&&e.scale<=KB||isNaN(e.scale))&&(e.scale=1),(e.translate>=YB&&e.translate<=XB||isNaN(e.translate))&&(e.translate=0)}function Fc(e,t,s,n){Qw(e.x,t.x,s.x,n?n.originX:void 0),Qw(e.y,t.y,s.y,n?n.originY:void 0)}function Jw(e,t,s,n=0){const o=n?Qt(s.min,s.max,n):s.min;e.min=o+t.min,e.max=e.min+xn(t)}function QB(e,t,s,n){Jw(e.x,t.x,s.x,n?.x),Jw(e.y,t.y,s.y,n?.y)}function eS(e,t,s,n=0){const o=n?Qt(s.min,s.max,n):s.min;e.min=t.min-o,e.max=e.min+xn(t)}function Hh(e,t,s,n){eS(e.x,t.x,s.x,n?.x),eS(e.y,t.y,s.y,n?.y)}function tS(e,t,s,n,o){return e-=t,e=$h(e,1/s,n),o!==void 0&&(e=$h(e,1/o,n)),e}function JB(e,t=0,s=1,n=.5,o,l=e,u=e){if(Ki.test(t)&&(t=parseFloat(t),t=Qt(u.min,u.max,t/100)-u.min),typeof t!="number")return;let h=Qt(l.min,l.max,n);e===l&&(h-=t),e.min=tS(e.min,t,s,h,o),e.max=tS(e.max,t,s,h,o)}function sS(e,t,[s,n,o],l,u){JB(e,t[s],t[n],t[o],t.scale,l,u)}const eP=["x","scaleX","originX"],tP=["y","scaleY","originY"];function nS(e,t,s,n){sS(e.x,t,eP,s?s.x:void 0,n?n.x:void 0),sS(e.y,t,tP,s?s.y:void 0,n?n.y:void 0)}function iS(e){return e.translate===0&&e.scale===1}function h3(e){return iS(e.x)&&iS(e.y)}function rS(e,t){return e.min===t.min&&e.max===t.max}function sP(e,t){return rS(e.x,t.x)&&rS(e.y,t.y)}function aS(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function f3(e,t){return aS(e.x,t.x)&&aS(e.y,t.y)}function oS(e){return xn(e.x)/xn(e.y)}function lS(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Vi(e){return[e("x"),e("y")]}function nP(e,t,s){let n="";const o=e.x.translate/t.x,l=e.y.translate/t.y,u=s?.z||0;if((o||l||u)&&(n=`translate3d(${o}px, ${l}px, ${u}px) `),(t.x!==1||t.y!==1)&&(n+=`scale(${1/t.x}, ${1/t.y}) `),s){const{transformPerspective:d,rotate:p,rotateX:g,rotateY:x,skewX:v,skewY:w}=s;d&&(n=`perspective(${d}px) ${n}`),p&&(n+=`rotate(${p}deg) `),g&&(n+=`rotateX(${g}deg) `),x&&(n+=`rotateY(${x}deg) `),v&&(n+=`skewX(${v}deg) `),w&&(n+=`skewY(${w}deg) `)}const h=e.x.scale*t.x,f=e.y.scale*t.y;return(h!==1||f!==1)&&(n+=`scale(${h}, ${f})`),n||"none"}const m3=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],iP=m3.length,cS=e=>typeof e=="string"?parseFloat(e):e,uS=e=>typeof e=="number"||Ye.test(e);function rP(e,t,s,n,o,l){o?(e.opacity=Qt(0,s.opacity??1,aP(n)),e.opacityExit=Qt(t.opacity??1,0,oP(n))):l&&(e.opacity=Qt(t.opacity??1,s.opacity??1,n));for(let u=0;u<iP;u++){const h=m3[u];let f=dS(t,h),d=dS(s,h);if(f===void 0&&d===void 0)continue;f||(f=0),d||(d=0),f===0||d===0||uS(f)===uS(d)?(e[h]=Math.max(Qt(cS(f),cS(d),n),0),(Ki.test(d)||Ki.test(f))&&(e[h]+="%")):e[h]=d}(t.rotate||s.rotate)&&(e.rotate=Qt(t.rotate||0,s.rotate||0,n))}function dS(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const aP=p3(0,.5,rE),oP=p3(.5,.95,hi);function p3(e,t,s){return n=>n<e?0:n>t?1:s(Zc(e,t,n))}function lP(e,t,s){const n=Zs(e)?e:hl(e);return n.start(hb("",n,t,s)),n.animation}function eu(e,t,s,n={passive:!0}){return e.addEventListener(t,s,n),()=>e.removeEventListener(t,s)}const cP=(e,t)=>e.depth-t.depth;class uP{constructor(){this.children=[],this.isDirty=!1}add(t){J0(this.children,t),this.isDirty=!0}remove(t){Oh(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(cP),this.isDirty=!1,this.children.forEach(t)}}function dP(e,t){const s=gn.now(),n=({timestamp:o})=>{const l=o-s;l>=t&&(ya(n),e(l-t))};return Vt.setup(n,!0),()=>ya(n)}function yh(e){return Zs(e)?e.get():e}class hP{constructor(){this.members=[]}add(t){J0(this.members,t);for(let s=this.members.length-1;s>=0;s--){const n=this.members[s];if(n===t||n===this.lead||n===this.prevLead)continue;const o=n.instance;(!o||o.isConnected===!1)&&!n.snapshot&&(Oh(this.members,n),n.unmount())}t.scheduleRender()}remove(t){if(Oh(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const s=this.members[this.members.length-1];s&&this.promote(s)}}relegate(t){for(let s=this.members.indexOf(t)-1;s>=0;s--){const n=this.members[s];if(n.isPresent!==!1&&n.instance?.isConnected!==!1)return this.promote(n),!0}return!1}promote(t,s){const n=this.lead;if(t!==n&&(this.prevLead=n,this.lead=t,t.show(),n)){n.updateSnapshot(),t.scheduleRender();const{layoutDependency:o}=n.options,{layoutDependency:l}=t.options;(o===void 0||o!==l)&&(t.resumeFrom=n,s&&(n.preserveOpacity=!0),n.snapshot&&(t.snapshot=n.snapshot,t.snapshot.latestValues=n.animationValues||n.latestValues),t.root?.isUpdating&&(t.isLayoutDirty=!0)),t.options.crossfade===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(t=>{t.options.onExitComplete?.(),t.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(t=>t.instance&&t.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}}const wh={hasAnimatedSinceResize:!0,hasEverUpdated:!1},rg=["","X","Y","Z"],fP=1e3;let mP=0;function ag(e,t,s,n){const{latestValues:o}=t;o[e]&&(s[e]=o[e],t.setStaticValue(e,0),n&&(n[e]=0))}function g3(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const s=zE(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&&g3(n)}function x3({attachResizeListener:e,defaultParent:t,measureScroll:s,checkIsScrollRoot:n,resetTransform:o}){return class{constructor(u={},h=t?.()){this.id=mP++,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(xP),this.nodes.forEach(SP),this.nodes.forEach(kP),this.nodes.forEach(bP)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=u,this.root=h?h.root||h:this,this.path=h?[...h.path,h]:[],this.parent=h,this.depth=h?h.depth+1:0;for(let f=0;f<this.path.length;f++)this.path[f].shouldResetTransform=!0;this.root===this&&(this.nodes=new uP)}addEventListener(u,h){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new tb),this.eventHandlers.get(u).add(h)}notifyListeners(u,...h){const f=this.eventHandlers.get(u);f&&f.notify(...h)}hasListeners(u){return this.eventHandlers.has(u)}mount(u){if(this.instance)return;this.isSVG=bb(u)&&!gB(u),this.instance=u;const{layoutId:h,layout:f,visualElement:d}=this.options;if(d&&!d.current&&d.mount(u),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(f||h)&&(this.isLayoutDirty=!0),e){let p,g=0;const x=()=>this.root.updateBlockedByResize=!1;Vt.read(()=>{g=window.innerWidth}),e(u,()=>{const v=window.innerWidth;v!==g&&(g=v,this.root.updateBlockedByResize=!0,p&&p(),p=dP(x,250),wh.hasAnimatedSinceResize&&(wh.hasAnimatedSinceResize=!1,this.nodes.forEach(mS)))})}h&&this.root.registerSharedNode(h,this),this.options.animate!==!1&&d&&(h||f)&&this.addEventListener("didUpdate",({delta:p,hasLayoutChanged:g,hasRelativeLayoutChanged:x,layout:v})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const w=this.options.transition||d.getDefaultTransition()||AP,{onLayoutAnimationStart:k,onLayoutAnimationComplete:C}=d.getProps(),N=!this.targetLayout||!f3(this.targetLayout,v),T=!g&&x;if(this.options.layoutRoot||this.resumeFrom||T||g&&(N||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const j={...db(w,"layout"),onPlay:k,onComplete:C};(d.shouldReduceMotion||this.options.layoutRoot)&&(j.delay=0,j.type=!1),this.startAnimation(j),this.setAnimationOrigin(p,T)}else g||mS(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(),ya(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(NP),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&&g3(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let p=0;p<this.path.length;p++){const g=this.path[p];g.shouldResetTransform=!0,(typeof g.latestValues.x=="string"||typeof g.latestValues.y=="string")&&(g.isLayoutDirty=!0),g.updateScroll("snapshot"),g.options.layoutRoot&&g.willUpdate(!1)}const{layoutId:h,layout:f}=this.options;if(h===void 0&&!f)return;const d=this.getTransformTemplate();this.prevTransformTemplateValue=d?d(this.latestValues,""):void 0,this.updateSnapshot(),u&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const f=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),f&&this.nodes.forEach(_P),this.nodes.forEach(hS);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(fS);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(yP),this.nodes.forEach(wP),this.nodes.forEach(pP),this.nodes.forEach(gP)):this.nodes.forEach(fS),this.clearAllSnapshots();const h=gn.now();Ys.delta=Zi(0,1e3/60,h-Ys.timestamp),Ys.timestamp=h,Ys.isProcessing=!0,Zp.update.process(Ys),Zp.preRender.process(Ys),Zp.render.process(Ys),Ys.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,gb.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(vP),this.sharedNodes.forEach(CP)}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&&!xn(this.snapshot.measuredBox.x)&&!xn(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let f=0;f<this.path.length;f++)this.path[f].updateScroll();const u=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=Os()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:h}=this.options;h&&h.notify("LayoutMeasure",this.layout.layoutBox,u?u.layoutBox:void 0)}updateScroll(u="measure"){let h=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===u&&(h=!1),h&&this.instance){const f=n(this.instance);this.scroll={animationId:this.root.animationId,phase:u,isRoot:f,offset:s(this.instance),wasRoot:this.scroll?this.scroll.isRoot:f}}}resetTransform(){if(!o)return;const u=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,h=this.projectionDelta&&!h3(this.projectionDelta),f=this.getTransformTemplate(),d=f?f(this.latestValues,""):void 0,p=d!==this.prevTransformTemplateValue;u&&this.instance&&(h||Ka(this.latestValues)||p)&&(o(this.instance,d),this.shouldResetTransform=!1,this.scheduleRender())}measure(u=!0){const h=this.measurePageBox();let f=this.removeElementScroll(h);return u&&(f=this.removeTransform(f)),TP(f),{animationId:this.root.animationId,measuredBox:h,layoutBox:f,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:u}=this.options;if(!u)return Os();const h=u.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(RP))){const{scroll:d}=this.root;d&&(Gi(h.x,d.offset.x),Gi(h.y,d.offset.y))}return h}removeElementScroll(u){const h=Os();if(Ei(h,u),this.scroll?.wasRoot)return h;for(let f=0;f<this.path.length;f++){const d=this.path[f],{scroll:p,options:g}=d;d!==this.root&&p&&g.layoutScroll&&(p.wasRoot&&Ei(h,u),Gi(h.x,p.offset.x),Gi(h.y,p.offset.y))}return h}applyTransform(u,h=!1,f){const d=f||Os();Ei(d,u);for(let p=0;p<this.path.length;p++){const g=this.path[p];!h&&g.options.layoutScroll&&g.scroll&&g!==g.root&&(Gi(d.x,-g.scroll.offset.x),Gi(d.y,-g.scroll.offset.y)),Ka(g.latestValues)&&_h(d,g.latestValues,g.layout?.layoutBox)}return Ka(this.latestValues)&&_h(d,this.latestValues,this.layout?.layoutBox),d}removeTransform(u){const h=Os();Ei(h,u);for(let f=0;f<this.path.length;f++){const d=this.path[f];if(!Ka(d.latestValues))continue;let p;d.instance&&(Px(d.latestValues)&&d.updateSnapshot(),p=Os(),Ei(p,d.measurePageBox())),nS(h,d.latestValues,d.snapshot?.layoutBox,p)}return Ka(this.latestValues)&&nS(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 f=!!this.resumingFrom||this!==h;if(!(u||f&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:p,layoutId:g}=this.options;if(!this.layout||!(p||g))return;this.resolvedRelativeTargetAt=Ys.timestamp;const x=this.getClosestProjectingParent();x&&this.linkedParentVersion!==x.layoutVersion&&!x.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&x&&x.layout?this.createRelativeTarget(x,this.layout.layoutBox,x.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Os(),this.targetWithTransforms=Os()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),QB(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):Ei(this.target,this.layout.layoutBox),e3(this.target,this.targetDelta)):Ei(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&x&&!!x.resumingFrom==!!this.resumingFrom&&!x.options.layoutScroll&&x.target&&this.animationProgress!==1?this.createRelativeTarget(x,this.target,x.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||Px(this.parent.latestValues)||JE(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(u,h,f){this.relativeParent=u,this.linkedParentVersion=u.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Os(),this.relativeTargetOrigin=Os(),Hh(this.relativeTargetOrigin,h,f,this.options.layoutAnchor||void 0),Ei(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const u=this.getLead(),h=!!this.resumingFrom||this!==u;let f=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(f=!1),h&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(f=!1),this.resolvedRelativeTargetAt===Ys.timestamp&&(f=!1),f)return;const{layout:d,layoutId:p}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(d||p))return;Ei(this.layoutCorrected,this.layout.layoutBox);const g=this.treeScale.x,x=this.treeScale.y;EB(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=Os());const{target:v}=u;if(!v){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Zw(this.prevProjectionDelta.x,this.projectionDelta.x),Zw(this.prevProjectionDelta.y,this.projectionDelta.y)),Fc(this.projectionDelta,this.layoutCorrected,v,this.latestValues),(this.treeScale.x!==g||this.treeScale.y!==x||!lS(this.projectionDelta.x,this.prevProjectionDelta.x)||!lS(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=nl(),this.projectionDelta=nl(),this.projectionDeltaWithTransform=nl()}setAnimationOrigin(u,h=!1){const f=this.snapshot,d=f?f.latestValues:{},p={...this.latestValues},g=nl();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!h;const x=Os(),v=f?f.source:void 0,w=this.layout?this.layout.source:void 0,k=v!==w,C=this.getStack(),N=!C||C.members.length<=1,T=!!(k&&!N&&this.options.crossfade===!0&&!this.path.some(jP));this.animationProgress=0;let j;this.mixTargetDelta=A=>{const B=A/1e3;pS(g.x,u.x,B),pS(g.y,u.y,B),this.setTargetDelta(g),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Hh(x,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),EP(this.relativeTarget,this.relativeTargetOrigin,x,B),j&&sP(this.relativeTarget,j)&&(this.isProjectionDirty=!1),j||(j=Os()),Ei(j,this.relativeTarget)),k&&(this.animationValues=p,rP(p,d,this.latestValues,B,T,N)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=B},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(u){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(ya(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Vt.update(()=>{wh.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=hl(0)),this.motionValue.jump(0,!1),this.currentAnimation=lP(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(fP),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const u=this.getLead();let{targetWithTransforms:h,target:f,layout:d,latestValues:p}=u;if(!(!h||!f||!d)){if(this!==u&&this.layout&&d&&b3(this.options.animationType,this.layout.layoutBox,d.layoutBox)){f=this.target||Os();const g=xn(this.layout.layoutBox.x);f.x.min=u.target.x.min,f.x.max=f.x.min+g;const x=xn(this.layout.layoutBox.y);f.y.min=u.target.y.min,f.y.max=f.y.min+x}Ei(h,f),_h(h,p),Fc(this.projectionDeltaWithTransform,this.layoutCorrected,h,p)}}registerSharedNode(u,h){this.sharedNodes.has(u)||this.sharedNodes.set(u,new hP),this.sharedNodes.get(u).add(h);const d=h.options.initialPromotionConfig;h.promote({transition:d?d.transition:void 0,preserveFollowOpacity:d&&d.shouldPreserveFollowOpacity?d.shouldPreserveFollowOpacity(h):void 0})}isLead(){const u=this.getStack();return u?u.lead===this:!0}getLead(){const{layoutId:u}=this.options;return u?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:u}=this.options;return u?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:u}=this.options;if(u)return this.root.sharedNodes.get(u)}promote({needsReset:u,transition:h,preserveFollowOpacity:f}={}){const d=this.getStack();d&&d.promote(this,f),u&&(this.projectionDelta=void 0,this.needsReset=!0),h&&this.setOptions({transition:h})}relegate(){const u=this.getStack();return u?u.relegate(this):!1}resetSkewAndRotation(){const{visualElement:u}=this.options;if(!u)return;let h=!1;const{latestValues:f}=u;if((f.z||f.rotate||f.rotateX||f.rotateY||f.rotateZ||f.skewX||f.skewY)&&(h=!0),!h)return;const d={};f.z&&ag("z",u,d,this.animationValues);for(let p=0;p<rg.length;p++)ag(`rotate${rg[p]}`,u,d,this.animationValues),ag(`skew${rg[p]}`,u,d,this.animationValues);u.render();for(const p in d)u.setStaticValue(p,d[p]),this.animationValues&&(this.animationValues[p]=d[p]);u.scheduleRender()}applyProjectionStyles(u,h){if(!this.instance||this.isSVG)return;if(!this.isVisible){u.visibility="hidden";return}const f=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,u.visibility="",u.opacity="",u.pointerEvents=yh(h?.pointerEvents)||"",u.transform=f?f(this.latestValues,""):"none";return}const d=this.getLead();if(!this.projectionDelta||!this.layout||!d.target){this.options.layoutId&&(u.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,u.pointerEvents=yh(h?.pointerEvents)||""),this.hasProjected&&!Ka(this.latestValues)&&(u.transform=f?f({},""):"none",this.hasProjected=!1);return}u.visibility="";const p=d.animationValues||d.latestValues;this.applyTransformsToTarget();let g=nP(this.projectionDeltaWithTransform,this.treeScale,p);f&&(g=f(p,g)),u.transform=g;const{x,y:v}=this.projectionDelta;u.transformOrigin=`${x.origin*100}% ${v.origin*100}% 0`,d.animationValues?u.opacity=d===this?p.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:p.opacityExit:u.opacity=d===this?p.opacity!==void 0?p.opacity:"":p.opacityExit!==void 0?p.opacityExit:0;for(const w in $x){if(p[w]===void 0)continue;const{correct:k,applyTo:C,isCSSVariable:N}=$x[w],T=g==="none"?p[w]:k(p[w],d);if(C){const j=C.length;for(let A=0;A<j;A++)u[C[A]]=T}else N?this.options.visualElement.renderState.vars[w]=T:u[w]=T}this.options.layoutId&&(u.pointerEvents=d===this?yh(h?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(u=>u.currentAnimation?.stop()),this.root.nodes.forEach(hS),this.root.sharedNodes.clear()}}}function pP(e){e.updateLayout()}function gP(e){const t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:n}=e.layout,{animationType:o}=e.options,l=t.source!==e.layout.source;if(o==="size")Vi(p=>{const g=l?t.measuredBox[p]:t.layoutBox[p],x=xn(g);g.min=s[p].min,g.max=g.min+x});else if(o==="x"||o==="y"){const p=o==="x"?"y":"x";Hx(l?t.measuredBox[p]:t.layoutBox[p],s[p])}else b3(o,t.layoutBox,s)&&Vi(p=>{const g=l?t.measuredBox[p]:t.layoutBox[p],x=xn(s[p]);g.max=g.min+x,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[p].max=e.relativeTarget[p].min+x)});const u=nl();Fc(u,s,t.layoutBox);const h=nl();l?Fc(h,e.applyTransform(n,!0),t.measuredBox):Fc(h,s,t.layoutBox);const f=!h3(u);let d=!1;if(!e.resumeFrom){const p=e.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:g,layout:x}=p;if(g&&x){const v=e.options.layoutAnchor||void 0,w=Os();Hh(w,t.layoutBox,g.layoutBox,v);const k=Os();Hh(k,s,x.layoutBox,v),f3(w,k)||(d=!0),p.options.layoutRoot&&(e.relativeTarget=k,e.relativeTargetOrigin=w,e.relativeParent=p)}}}e.notifyListeners("didUpdate",{layout:s,snapshot:t,delta:h,layoutDelta:u,hasLayoutChanged:f,hasRelativeLayoutChanged:d})}else if(e.isLead()){const{onExitComplete:s}=e.options;s&&s()}e.options.transition=void 0}function xP(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 bP(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function vP(e){e.clearSnapshot()}function hS(e){e.clearMeasurements()}function _P(e){e.isLayoutDirty=!0,e.updateLayout()}function fS(e){e.isLayoutDirty=!1}function yP(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function wP(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function mS(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function SP(e){e.resolveTargetDelta()}function kP(e){e.calcProjection()}function NP(e){e.resetSkewAndRotation()}function CP(e){e.removeLeadSnapshot()}function pS(e,t,s){e.translate=Qt(t.translate,0,s),e.scale=Qt(t.scale,1,s),e.origin=t.origin,e.originPoint=t.originPoint}function gS(e,t,s,n){e.min=Qt(t.min,s.min,n),e.max=Qt(t.max,s.max,n)}function EP(e,t,s,n){gS(e.x,t.x,s.x,n),gS(e.y,t.y,s.y,n)}function jP(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const AP={duration:.45,ease:[.4,0,.1,1]},xS=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),bS=xS("applewebkit/")&&!xS("chrome/")?Math.round:hi;function vS(e){e.min=bS(e.min),e.max=bS(e.max)}function TP(e){vS(e.x),vS(e.y)}function b3(e,t,s){return e==="position"||e==="preserve-aspect"&&!ZB(oS(t),oS(s),.2)}function RP(e){return e!==e.root&&e.scroll?.wasRoot}const MP=x3({attachResizeListener:(e,t)=>eu(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),og={current:void 0},v3=x3({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!og.current){const e=new MP({});e.mount(window),e.setOptions({layoutScroll:!0}),og.current=e}return og.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),_3=_.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function DP(e=!0){const t=_.useContext(Q0);if(t===null)return[!0,null];const{isPresent:s,onExitComplete:n,register:o}=t,l=_.useId();_.useEffect(()=>{if(e)return o(l)},[e]);const u=_.useCallback(()=>e&&n&&n(l),[l,n,e]);return!s&&n?[!1,u]:[!0]}const y3=_.createContext({strict:!1}),_S={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 yS=!1;function OP(){if(yS)return;const e={};for(const t in _S)e[t]={isEnabled:s=>_S[t].some(n=>!!s[n])};XE(e),yS=!0}function w3(){return OP(),SB()}function LP(e){const t=w3();for(const s in e)t[s]={...t[s],...e[s]};XE(t)}const zP=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function Uh(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||zP.has(e)}let S3=e=>!Uh(e);function BP(e){typeof e=="function"&&(S3=t=>t.startsWith("on")?!Uh(t):e(t))}try{BP(require("@emotion/is-prop-valid").default)}catch{}function PP(e,t,s){const n={};for(const o in e)o==="values"&&typeof e.values=="object"||Zs(e[o])||(S3(o)||s===!0&&Uh(o)||!t&&!Uh(o)||e.draggable&&o.startsWith("onDrag"))&&(n[o]=e[o]);return n}const yf=_.createContext({});function IP(e,t){if(_f(e)){const{initial:s,animate:n}=e;return{initial:s===!1||Jc(s)?s:void 0,animate:Jc(n)?n:void 0}}return e.inherit!==!1?t:{}}function $P(e){const{initial:t,animate:s}=IP(e,_.useContext(yf));return _.useMemo(()=>({initial:t,animate:s}),[wS(t),wS(s)])}function wS(e){return Array.isArray(e)?e.join(" "):e}const Sb=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function k3(e,t,s){for(const n in t)!Zs(t[n])&&!n3(n,s)&&(e[n]=t[n])}function HP({transformTemplate:e},t){return _.useMemo(()=>{const s=Sb();return yb(s,t,e),Object.assign({},s.vars,s.style)},[t])}function UP(e,t){const s=e.style||{},n={};return k3(n,s,e),Object.assign(n,HP(e,t)),n}function FP(e,t){const s={},n=UP(e,t);return e.drag&&e.dragListener!==!1&&(s.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(s.tabIndex=0),s.style=n,s}const N3=()=>({...Sb(),attrs:{}});function qP(e,t,s,n){const o=_.useMemo(()=>{const l=N3();return i3(l,t,a3(n),e.transformTemplate,e.style),{...l.attrs,style:{...l.style}}},[t]);if(e.style){const l={};k3(l,e.style,e),o.style={...l,...o.style}}return o}const VP=["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 kb(e){return typeof e!="string"||e.includes("-")?!1:!!(VP.indexOf(e)>-1||/[A-Z]/u.test(e))}function GP(e,t,s,{latestValues:n},o,l=!1,u){const f=(u??kb(e)?qP:FP)(t,n,o,e),d=PP(t,typeof e=="string",l),p=e!==_.Fragment?{...d,...f,ref:s}:{},{children:g}=t,x=_.useMemo(()=>Zs(g)?g.get():g,[g]);return _.createElement(e,{...p,children:x})}function WP({scrapeMotionValuesFromProps:e,createRenderState:t},s,n,o){return{latestValues:KP(s,n,o,e),renderState:t()}}function KP(e,t,s,n){const o={},l=n(e,{});for(const x in l)o[x]=yh(l[x]);let{initial:u,animate:h}=e;const f=_f(e),d=KE(e);t&&d&&!f&&e.inherit!==!1&&(u===void 0&&(u=t.initial),h===void 0&&(h=t.animate));let p=s?s.initial===!1:!1;p=p||u===!1;const g=p?h:u;if(g&&typeof g!="boolean"&&!vf(g)){const x=Array.isArray(g)?g:[g];for(let v=0;v<x.length;v++){const w=fb(e,x[v]);if(w){const{transitionEnd:k,transition:C,...N}=w;for(const T in N){let j=N[T];if(Array.isArray(j)){const A=p?j.length-1:0;j=j[A]}j!==null&&(o[T]=j)}for(const T in k)o[T]=k[T]}}}return o}const C3=e=>(t,s)=>{const n=_.useContext(yf),o=_.useContext(Q0),l=()=>WP(e,t,n,o);return s?l():V7(l)},YP=C3({scrapeMotionValuesFromProps:wb,createRenderState:Sb}),XP=C3({scrapeMotionValuesFromProps:o3,createRenderState:N3}),ZP=Symbol.for("motionComponentSymbol");function QP(e,t,s){const n=_.useRef(s);_.useInsertionEffect(()=>{n.current=s});const o=_.useRef(null);return _.useCallback(l=>{l&&e.onMount?.(l);const u=n.current;if(typeof u=="function")if(l){const h=u(l);typeof h=="function"&&(o.current=h)}else o.current?(o.current(),o.current=null):u(l);else u&&(u.current=l);t&&(l?t.mount(l):t.unmount())},[t])}const E3=_.createContext({});function el(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function JP(e,t,s,n,o,l){const{visualElement:u}=_.useContext(yf),h=_.useContext(y3),f=_.useContext(Q0),d=_.useContext(_3),p=d.reducedMotion,g=d.skipAnimations,x=_.useRef(null),v=_.useRef(!1);n=n||h.renderer,!x.current&&n&&(x.current=n(e,{visualState:t,parent:u,props:s,presenceContext:f,blockInitialAnimation:f?f.initial===!1:!1,reducedMotionConfig:p,skipAnimations:g,isSVG:l}),v.current&&x.current&&(x.current.manuallyAnimateOnMount=!0));const w=x.current,k=_.useContext(E3);w&&!w.projection&&o&&(w.type==="html"||w.type==="svg")&&eI(x.current,s,o,k);const C=_.useRef(!1);_.useInsertionEffect(()=>{w&&C.current&&w.update(s,f)});const N=s[LE],T=_.useRef(!!N&&typeof window<"u"&&!window.MotionHandoffIsComplete?.(N)&&window.MotionHasOptimisedAnimation?.(N));return W7(()=>{v.current=!0,w&&(C.current=!0,window.MotionIsMounted=!0,w.updateFeatures(),w.scheduleRenderMicrotask(),T.current&&w.animationState&&w.animationState.animateChanges())}),_.useEffect(()=>{w&&(!T.current&&w.animationState&&w.animationState.animateChanges(),T.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(N)}),T.current=!1),w.enteringChildren=void 0)}),w}function eI(e,t,s,n){const{layoutId:o,layout:l,drag:u,dragConstraints:h,layoutScroll:f,layoutRoot:d,layoutAnchor:p,layoutCrossfade:g}=t;e.projection=new s(e.latestValues,t["data-framer-portal-id"]?void 0:j3(e.parent)),e.projection.setOptions({layoutId:o,layout:l,alwaysMeasureLayout:!!u||h&&el(h),visualElement:e,animationType:typeof l=="string"?l:"both",initialPromotionConfig:n,crossfade:g,layoutScroll:f,layoutRoot:d,layoutAnchor:p})}function j3(e){if(e)return e.options.allowProjection!==!1?e.projection:j3(e.parent)}function lg(e,{forwardMotionProps:t=!1,type:s}={},n,o){n&&LP(n);const l=s?s==="svg":kb(e),u=l?XP:YP;function h(d,p){let g;const x={..._.useContext(_3),...d,layoutId:tI(d)},{isStatic:v}=x,w=$P(d),k=u(d,v);if(!v&&typeof window<"u"){sI();const C=nI(x);g=C.MeasureLayout,w.visualElement=JP(e,k,x,o,C.ProjectionNode,l)}return r.jsxs(yf.Provider,{value:w,children:[g&&w.visualElement?r.jsx(g,{visualElement:w.visualElement,...x}):null,GP(e,d,QP(k,w.visualElement,p),k,v,t,l)]})}h.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const f=_.forwardRef(h);return f[ZP]=e,f}function tI({layoutId:e}){const t=_.useContext(WC).id;return t&&e!==void 0?t+"-"+e:e}function sI(e,t){_.useContext(y3).strict}function nI(e){const t=w3(),{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 iI(e,t){if(typeof Proxy>"u")return lg;const s=new Map,n=(l,u)=>lg(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,lg(u,void 0,e,t)),s.get(u))})}const rI=(e,t)=>t.isSVG??kb(e)?new $B(t):new OB(t,{allowProjection:e!==_.Fragment});class aI extends Sa{constructor(t){super(t),t.animationState||(t.animationState=VB(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();vf(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 oI=0;class lI extends Sa{constructor(){super(...arguments),this.id=oI++,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=no(this.node,l,u);if(h){const{transition:f,transitionEnd:d,...p}=h;for(const g in p)this.node.getValue(g)?.jump(p[g])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const o=this.node.animationState.setActive("exit",!t);s&&!t&&o.then(()=>{this.isExitComplete=!0,s(this.id)})}mount(){const{register:t,onExitComplete:s}=this.node.presenceContext||{};s&&s(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const cI={animation:{Feature:aI},exit:{Feature:lI}};function du(e){return{point:{x:e.pageX,y:e.pageY}}}const uI=e=>t=>xb(t)&&e(t,du(t));function qc(e,t,s,n){return eu(e,t,uI(s),n)}const A3=({current:e})=>e?e.ownerDocument.defaultView:null,SS=(e,t)=>Math.abs(e-t);function dI(e,t){const s=SS(e.x,t.x),n=SS(e.y,t.y);return Math.sqrt(s**2+n**2)}const kS=new Set(["auto","scroll"]);class T3{constructor(t,s,{transformPagePoint:n,contextWindow:o=window,dragSnapToOrigin:l=!1,distanceThreshold:u=3,element:h}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=v=>{this.handleScroll(v.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Ud(this.lastRawMoveEventInfo,this.transformPagePoint));const v=cg(this.lastMoveEventInfo,this.history),w=this.startEvent!==null,k=dI(v.offset,{x:0,y:0})>=this.distanceThreshold;if(!w&&!k)return;const{point:C}=v,{timestamp:N}=Ys;this.history.push({...C,timestamp:N});const{onStart:T,onMove:j}=this.handlers;w||(T&&T(this.lastMoveEvent,v),this.startEvent=this.lastMoveEvent),j&&j(this.lastMoveEvent,v)},this.handlePointerMove=(v,w)=>{this.lastMoveEvent=v,this.lastRawMoveEventInfo=w,this.lastMoveEventInfo=Ud(w,this.transformPagePoint),Vt.update(this.updatePoint,!0)},this.handlePointerUp=(v,w)=>{this.end();const{onEnd:k,onSessionEnd:C,resumeAnimation:N}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&N&&N(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const T=cg(v.type==="pointercancel"?this.lastMoveEventInfo:Ud(w,this.transformPagePoint),this.history);this.startEvent&&k&&k(v,T),C&&C(v,T)},!xb(t))return;this.dragSnapToOrigin=l,this.handlers=s,this.transformPagePoint=n,this.distanceThreshold=u,this.contextWindow=o||window;const f=du(t),d=Ud(f,this.transformPagePoint),{point:p}=d,{timestamp:g}=Ys;this.history=[{...p,timestamp:g}];const{onSessionStart:x}=s;x&&x(t,cg(d,this.history)),this.removeListeners=lu(qc(this.contextWindow,"pointermove",this.handlePointerMove),qc(this.contextWindow,"pointerup",this.handlePointerUp),qc(this.contextWindow,"pointercancel",this.handlePointerUp)),h&&this.startScrollTracking(h)}startScrollTracking(t){let s=t.parentElement;for(;s;){const n=getComputedStyle(s);(kS.has(n.overflowX)||kS.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(),ya(this.updatePoint)}}function Ud(e,t){return t?{point:t(e.point)}:e}function NS(e,t){return{x:e.x-t.x,y:e.y-t.y}}function cg({point:e},t){return{point:e,delta:NS(e,R3(t)),offset:NS(e,hI(t)),velocity:fI(t,.1)}}function hI(e){return e[0]}function R3(e){return e[e.length-1]}function fI(e,t){if(e.length<2)return{x:0,y:0};let s=e.length-1,n=null;const o=R3(e);for(;s>=0&&(n=e[s],!(o.timestamp-n.timestamp>Yn(t)));)s--;if(!n)return{x:0,y:0};n===e[0]&&e.length>2&&o.timestamp-n.timestamp>Yn(t)*2&&(n=e[1]);const l=di(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 mI(e,{min:t,max:s},n){return t!==void 0&&e<t?e=n?Qt(t,e,n.min):Math.max(e,t):s!==void 0&&e>s&&(e=n?Qt(s,e,n.max):Math.min(e,s)),e}function CS(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 pI(e,{top:t,left:s,bottom:n,right:o}){return{x:CS(e.x,s,o),y:CS(e.y,t,n)}}function ES(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 gI(e,t){return{x:ES(e.x,t.x),y:ES(e.y,t.y)}}function xI(e,t){let s=.5;const n=xn(e),o=xn(t);return o>n?s=Zc(t.min,t.max-n,e.min):n>o&&(s=Zc(e.min,e.max-o,t.min)),Zi(0,1,s)}function bI(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 Ux=.35;function vI(e=Ux){return e===!1?e=0:e===!0&&(e=Ux),{x:jS(e,"left","right"),y:jS(e,"top","bottom")}}function jS(e,t,s){return{min:AS(e,t),max:AS(e,s)}}function AS(e,t){return typeof e=="number"?e:e[t]||0}const _I=new WeakMap;class yI{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=Os(),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(du(g).point),this.stopAnimation()},u=(g,x)=>{const{drag:v,dragPropagation:w,onDragStart:k}=this.getProps();if(v&&!w&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Jz(v),!this.openDragLock))return;this.latestPointerEvent=g,this.latestPanInfo=x,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Vi(N=>{let T=this.getAxisMotionValue(N).get()||0;if(Ki.test(T)){const{projection:j}=this.visualElement;if(j&&j.layout){const A=j.layout.layoutBox[N];A&&(T=xn(A)*(parseFloat(T)/100))}}this.originPoint[N]=T}),k&&Vt.update(()=>k(g,x),!1,!0),Dx(this.visualElement,"transform");const{animationState:C}=this.visualElement;C&&C.setActive("whileDrag",!0)},h=(g,x)=>{this.latestPointerEvent=g,this.latestPanInfo=x;const{dragPropagation:v,dragDirectionLock:w,onDirectionLock:k,onDrag:C}=this.getProps();if(!v&&!this.openDragLock)return;const{offset:N}=x;if(w&&this.currentDirection===null){this.currentDirection=SI(N),this.currentDirection!==null&&k&&k(this.currentDirection);return}this.updateAxis("x",x.point,N),this.updateAxis("y",x.point,N),this.visualElement.render(),C&&Vt.update(()=>C(g,x),!1,!0)},f=(g,x)=>{this.latestPointerEvent=g,this.latestPanInfo=x,this.stop(g,x),this.latestPointerEvent=null,this.latestPanInfo=null},d=()=>{const{dragSnapToOrigin:g}=this.getProps();(g||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:p}=this.getProps();this.panSession=new T3(t,{onSessionStart:l,onStart:u,onMove:h,onSessionEnd:f,resumeAnimation:d},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:p,distanceThreshold:n,contextWindow:A3(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||!Fd(t,o,this.currentDirection))return;const l=this.getAxisMotionValue(t);let u=this.originPoint[t]+n[t];this.constraints&&this.constraints[t]&&(u=mI(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&&el(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&n?this.constraints=pI(n.layoutBox,t):this.constraints=!1,this.elastic=vI(s),o!==this.constraints&&!el(t)&&n&&this.constraints&&!this.hasMutatedConstraints&&Vi(l=>{this.constraints!==!1&&this.getAxisMotionValue(l)&&(this.constraints[l]=bI(n.layoutBox[l],this.constraints[l]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:s}=this.getProps();if(!t||!el(t))return!1;const n=t.current,{projection:o}=this.visualElement;if(!o||!o.layout)return!1;const l=jB(n,o.root,this.visualElement.getTransformPagePoint());let u=gI(o.layout.layoutBox,l);if(s){const h=s(NB(u));this.hasMutatedConstraints=!!h,h&&(u=QE(h))}return u}startAnimation(t){const{drag:s,dragMomentum:n,dragElastic:o,dragTransition:l,dragSnapToOrigin:u,onDragTransitionEnd:h}=this.getProps(),f=this.constraints||{},d=Vi(p=>{if(!Fd(p,s,this.currentDirection))return;let g=f&&f[p]||{};(u===!0||u===p)&&(g={min:0,max:0});const x=o?200:1e6,v=o?40:1e7,w={type:"inertia",velocity:n?t[p]:0,bounceStiffness:x,bounceDamping:v,timeConstant:750,restDelta:1,restSpeed:10,...l,...g};return this.startAxisValueAnimation(p,w)});return Promise.all(d).then(h)}startAxisValueAnimation(t,s){const n=this.getAxisMotionValue(t);return Dx(this.visualElement,t),n.start(hb(t,n,0,s,this.visualElement,!1))}stopAnimation(){Vi(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const s=`_drag${t.toUpperCase()}`,n=this.visualElement.getProps(),o=n[s];return o||this.visualElement.getValue(t,(n.initial?n.initial[t]:void 0)||0)}snapToCursor(t){Vi(s=>{const{drag:n}=this.getProps();if(!Fd(s,n,this.currentDirection))return;const{projection:o}=this.visualElement,l=this.getAxisMotionValue(s);if(o&&o.layout){const{min:u,max:h}=o.layout.layoutBox[s],f=l.get()||0;l.set(t[s]-Qt(u,h,.5)+f)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:s}=this.getProps(),{projection:n}=this.visualElement;if(!el(s)||!n||!this.constraints)return;this.stopAnimation();const o={x:0,y:0};Vi(u=>{const h=this.getAxisMotionValue(u);if(h&&this.constraints!==!1){const f=h.get();o[u]=xI({min:f,max:f},this.constraints[u])}});const{transformTemplate:l}=this.visualElement.getProps();this.visualElement.current.style.transform=l?l({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),Vi(u=>{if(!Fd(u,t,null))return;const h=this.getAxisMotionValue(u),{min:f,max:d}=this.constraints[u];h.set(Qt(f,d,o[u]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;_I.set(this.visualElement,this);const t=this.visualElement.current,s=qc(t,"pointerdown",d=>{const{drag:p,dragListener:g=!0}=this.getProps(),x=d.target,v=x!==t&&rB(x);p&&g&&!v&&this.start(d)});let n;const o=()=>{const{dragConstraints:d}=this.getProps();el(d)&&d.current&&(this.constraints=this.resolveRefConstraints(),n||(n=wI(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=eu(window,"resize",()=>this.scalePositionWithinConstraints()),f=l.addEventListener("didUpdate",(({delta:d,hasLayoutChanged:p})=>{this.isDragging&&p&&(Vi(g=>{const x=this.getAxisMotionValue(g);x&&(this.originPoint[g]+=d[g].translate,x.set(x.get()+d[g].translate))}),this.visualElement.render())}));return()=>{h(),s(),u(),f&&f(),n&&n()}}getProps(){const t=this.visualElement.getProps(),{drag:s=!1,dragDirectionLock:n=!1,dragPropagation:o=!1,dragConstraints:l=!1,dragElastic:u=Ux,dragMomentum:h=!0}=t;return{...t,drag:s,dragDirectionLock:n,dragPropagation:o,dragConstraints:l,dragElastic:u,dragMomentum:h}}}function TS(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function wI(e,t,s){const n=Iw(e,TS(s)),o=Iw(t,TS(s));return()=>{n(),o()}}function Fd(e,t,s){return(t===!0||t===e)&&(s===null||s===e)}function SI(e,t=10){let s=null;return Math.abs(e.y)>t?s="y":Math.abs(e.x)>t&&(s="x"),s}class kI extends Sa{constructor(t){super(t),this.removeGroupControls=hi,this.removeListeners=hi,this.controls=new yI(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||hi}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 ug=e=>(t,s)=>{e&&Vt.update(()=>e(t,s),!1,!0)};class NI extends Sa{constructor(){super(...arguments),this.removePointerDownListener=hi}onPointerDown(t){this.session=new T3(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:A3(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:s,onPan:n,onPanEnd:o}=this.node.getProps();return{onSessionStart:ug(t),onStart:ug(s),onMove:ug(n),onEnd:(l,u)=>{delete this.session,o&&Vt.postRender(()=>o(l,u))}}}mount(){this.removePointerDownListener=qc(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 dg=!1;class CI extends _.Component{componentDidMount(){const{visualElement:t,layoutGroup:s,switchLayoutGroup:n,layoutId:o}=this.props,{projection:l}=t;l&&(s.group&&s.group.add(l),n&&n.register&&o&&n.register(l),dg&&l.root.didUpdate(),l.addEventListener("animationComplete",()=>{this.safeToRemove()}),l.setOptions({...l.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),wh.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:s,visualElement:n,drag:o,isPresent:l}=this.props,{projection:u}=n;return u&&(u.isPresent=l,t.layoutDependency!==s&&u.setOptions({...u.options,layoutDependency:s}),dg=!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(),gb.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:s,switchLayoutGroup:n}=this.props,{projection:o}=t;dg=!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 M3(e){const[t,s]=DP(),n=_.useContext(WC);return r.jsx(CI,{...e,layoutGroup:n,switchLayoutGroup:_.useContext(E3),isPresent:t,safeToRemove:s})}const EI={pan:{Feature:NI},drag:{Feature:kI,ProjectionNode:v3,MeasureLayout:M3}};function RS(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,du(t)))}class jI extends Sa{mount(){const{current:t}=this.node;t&&(this.unmount=tB(t,(s,n)=>(RS(this.node,n,"Start"),o=>RS(this.node,o,"End"))))}unmount(){}}class AI extends Sa{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=lu(eu(this.node.current,"focus",()=>this.onFocus()),eu(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function MS(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,du(t)))}class TI extends Sa{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:s,propagate:n}=this.node.props;this.unmount=oB(t,(o,l)=>(MS(this.node,l,"Start"),(u,{success:h})=>MS(this.node,u,h?"End":"Cancel")),{useGlobalTarget:s,stopPropagation:n?.tap===!1})}unmount(){}}const Fx=new WeakMap,hg=new WeakMap,RI=e=>{const t=Fx.get(e.target);t&&t(e)},MI=e=>{e.forEach(RI)};function DI({root:e,...t}){const s=e||document;hg.has(s)||hg.set(s,{});const n=hg.get(s),o=JSON.stringify(t);return n[o]||(n[o]=new IntersectionObserver(MI,{root:e,...t})),n[o]}function OI(e,t,s){const n=DI(t);return Fx.set(e,s),n.observe(e),()=>{Fx.delete(e),n.unobserve(e)}}const LI={some:0,all:1};class zI extends Sa{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:LI[o]},h=f=>{const{isIntersecting:d}=f;if(this.isInView===d||(this.isInView=d,l&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:p,onViewportLeave:g}=this.node.getProps(),x=d?p:g;x&&x(f)};this.stopObserver=OI(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(BI(t,s))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}}function BI({viewport:e={}},{viewport:t={}}={}){return s=>e[s]!==t[s]}const PI={inView:{Feature:zI},tap:{Feature:TI},focus:{Feature:AI},hover:{Feature:jI}},II={layout:{ProjectionNode:v3,MeasureLayout:M3}},$I={...cI,...PI,...EI,...II},fg=iI($I,rI),Xe=({label:e,children:t,variant:s="primary",size:n="medium",icon:o,onClick:l,removable:u=!1,className:h,maxWidth:f,appearance:d,onRemove:p,isLoading:g=!1})=>{const x=HI(s),v=d??(s==="outline"?"outline":"solid"),w=e??t,k=!!l,C={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"}},N={small:"text-xs px-2 py-1",medium:"text-xs px-2.5 py-1",large:"text-sm px-3 py-1.5"},T=A=>{A.stopPropagation(),l?.()},j=A=>{A.stopPropagation(),p?.()};return r.jsxs(fg.div,{initial:{opacity:0,scale:.95,y:8,filter:"blur(8px)"},animate:{opacity:1,scale:1,y:0,filter:"blur(0px)"},transition:{duration:.32,ease:"easeInOut",type:"spring"},whileHover:{scale:k?1.04:1,transition:{duration:.2,ease:"easeInOut",type:"spring"}},onClick:T,style:{maxWidth:f},className: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",C[x][v],N[n],k&&"cursor-pointer",h),children:[g?r.jsx(fg.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(fg.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(Kt,{className:"size-3.5"})})]})};function HI(e){return e==="danger"?"error":e==="default"||e==="outline"?"primary":e}const UI=MC("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 Ze({className:e,variant:t,...s}){return r.jsx("div",{className:de(UI({variant:t,className:e})),...s})}function D3({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 Fh(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 qh(e){return de("flex size-7 shrink-0 items-center justify-center [&_svg]:size-4 [&_svg]:shrink-0",e)}function Vh(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 xi({className:e,...t}){return r.jsx("div",{className:de("rounded-lg border border-border bg-card text-card-foreground",e),...t})}function bi({className:e,...t}){return r.jsx("div",{className:de("grid gap-1.5 p-4",e),...t})}function vi({className:e,...t}){return r.jsx("h3",{className:de("text-sm font-semibold tracking-tight",e),...t})}function tr({className:e,...t}){return r.jsx("p",{className:de("text-sm text-muted-foreground",e),...t})}function _i({className:e,...t}){return r.jsx("div",{className:de("p-4 pt-0",e),...t})}const DS=100;function FI(){const[e,t]=_.useState([]),[s,n]=_.useState(!1),o=_.useRef(new Set);_.useEffect(()=>{const u=new EventSource("/api/agent/tool-calls/stream");return u.addEventListener("open",()=>n(!0)),u.addEventListener("error",()=>n(!1)),u.addEventListener("tool-call",h=>{try{const f=JSON.parse(h.data);t(d=>{if(o.current.has(f.id))return d;o.current.add(f.id);const p=[...d,f];return p.length>DS&&p.splice(0,p.length-DS),p})}catch{}}),()=>{u.close()}},[]);const l=[...e].reverse();return r.jsxs(xi,{className:"min-w-0 rounded-none border-0 border-b border-border bg-transparent",children:[r.jsxs(bi,{className:"border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(to,{className:"size-4 text-muted-foreground"}),r.jsx(vi,{children:"Live MCP Tool Calls"}),r.jsx(Xe,{variant:"outline",size:"small",children:e.length})]}),r.jsx(Xe,{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(tr,{className:"text-xs",children:"Streamed from this NoMoreIDE MCP server. Newest at the top."})]}),r.jsx(_i,{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(Xe,{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 qI({agent:e}){return r.jsxs(r.Fragment,{children:[r.jsx(FI,{}),r.jsxs(xi,{className:"min-w-0 rounded-none border-0 bg-transparent",children:[r.jsxs(bi,{className:"border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ff,{className:"size-4 text-muted-foreground"}),r.jsx(vi,{children:"Recent Projects"})]}),r.jsx(Xe,{variant:"outline",size:"small",children:e.projects.length})]}),r.jsx(tr,{className:"text-xs",children:"Most recently active projects known to the agent."})]}),r.jsx(_i,{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(Xe,{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:VI(t.lastSessionModified)}):null]})]},t.path))}):r.jsx("p",{className:"px-3 py-4 text-xs text-muted-foreground",children:"No known projects."})})]})]})}function VI(e){const t=Date.parse(e);return Number.isNaN(t)?e:new Date(t).toLocaleString()}function bl({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 hu({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 GI({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 WI=800;function fu({activeHunkIndex:e=0,diff:t}){const s=XI(t),n=_.useRef(null),o=_.useRef([]),[l,u]=_.useState(!1),h=_.useMemo(()=>s.reduce((d,p)=>Math.max(d,p.content.length),0),[s]),f=h>WI;if(_.useEffect(()=>{u(!1)},[t]),_.useEffect(()=>{if(f&&!l)return;const d=o.current[e],p=n.current;!d||!p||p.scrollTo({top:Math.max(d.offsetTop-8,0),behavior:"smooth"})},[e,t,f,l]),f&&!l){const d=s.filter(g=>g.kind==="add").length,p=s.filter(g=>g.kind==="delete").length;return 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(Q,{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",OS(s,p)&&d.hunkIndex===e&&"outline outline-1 outline-offset-[-1px] outline-primary/35"),ref:d.hunkIndex!==null&&OS(s,p)?g=>{o.current[d.hunkIndex??0]=g}:void 0,children:[r.jsx(LS,{value:d.oldLine}),r.jsx(LS,{value:d.newLine}),r.jsx("span",{className:"min-w-0 whitespace-pre-wrap break-all px-2",children:d.content||" "})]},`${p}-${d.content}`))})})}function KI(e){const t=[];let s=null;const n=()=>{if(!s)return;const o=s.join(`
|
|
19
|
-
`),l=Nb(o);t.push({path:YI(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 YI(e){const t=/^diff --git a\/(.+?) b\/(.+)$/.exec(e);return t?t[2]:e.replace(/^diff --git /,"")}function Nb(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 XI(e){const t=ZI(e);return t.some(s=>s.kind==="hunk")?t.filter(s=>s.kind!=="meta"&&s.kind!=="hunk"):t}function ZI(e){let t=null,s=null,n=null;return e.split(`
|
|
22
|
-
`).map(o=>{if(QI(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 OS(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 QI(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 LS({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 JI(){const[e,t]=_.useState([]),[s,n]=_.useState(""),[o,l]=_.useState(null),[u,h]=_.useState(!1),[f,d]=_.useState(null),p=_.useCallback(async()=>{try{const C=await NL();t(C),n(N=>N&&C.some(T=>T.sha===N)?N:C[0]?.sha??""),l(null)}catch(C){l(C instanceof Error?C.message:String(C))}},[]);_.useEffect(()=>{p()},[p]);async function g(){h(!0),d(null);try{const C=await CL("manual snapshot");await p(),n(C.sha),d(`Snapshot ${C.sha.slice(0,7)} created.`)}catch(C){l(C instanceof Error?C.message:String(C))}finally{h(!1)}}async function x(C,N){h(!0),d(null);try{const T=await EL(C,N);await p(),n(T.sha),d(`Snapshot renamed to “${T.label}”.`)}catch(T){l(T instanceof Error?T.message:String(T))}finally{h(!1)}}async function v(C){h(!0),d(null);try{await jL(C),await p(),d(`Snapshot ${C.slice(0,7)} deleted.`)}catch(N){l(N instanceof Error?N.message:String(N))}finally{h(!1)}}async function w(C){h(!0),d(null);try{const N=await RL(C);await p(),d(`Restored ${N.restoredFiles} file(s)`+(N.deletedPaths.length?`, removed ${N.deletedPaths.length} added since`:"")+`. Undo via pre-restore snapshot ${N.preRestore.sha.slice(0,7)}.`)}catch(N){l(N instanceof Error?N.message:String(N))}finally{h(!1)}}const k=e.find(C=>C.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(VR,{className:"size-3.5"}),"Snapshots"]}),r.jsxs(Q,{disabled:u,onClick:()=>{g()},size:"sm",type:"button",children:[r.jsx(zN,{className:"size-3.5"}),"Snapshot now"]})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:o?r.jsxs(Ze,{variant:"destructive",className:"m-3",children:[r.jsx(U0,{}),r.jsxs("div",{className:"min-w-0",children:[r.jsx(D3,{children:"Couldn’t load snapshots"}),r.jsx(O3,{className:"break-words",children:o})]})]}):e.length===0?r.jsx(Ze,{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(C=>r.jsx(e$,{busy:u,onDelete:v,onRename:x,onSelect:n,selected:C.sha===s,snapshot:C},C.ref))})})]}),r.jsxs("section",{className:"flex min-h-0 min-w-0 flex-col",children:[f?r.jsx(Ze,{variant:"muted",className:"m-3 mb-0",children:f}):null,k?r.jsx(t$,{busy:u,onRestore:w,snapshot:k}):r.jsx("div",{className:"p-4",children:r.jsx(Ze,{variant:"muted",className:"border-dashed p-12 text-center",children:"Select a snapshot to compare it with the current working tree."})})]})]})}function e$({busy:e,onDelete:t,onRename:s,onSelect:n,selected:o,snapshot:l}){const[u,h]=_.useState(!1),[f,d]=_.useState(l.label),[p,g]=_.useState(!1);function x(){d(l.label),h(!0)}function v(){const w=f.trim();h(!1),w&&w!==l.label&&s(l.sha,w)}return 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:f,onChange:w=>d(w.target.value),onKeyDown:w=>{w.key==="Enter"&&v(),w.key==="Escape"&&h(!1)},className:"min-w-0 flex-1 rounded border border-border bg-background px-1.5 py-1 text-xs","aria-label":"Snapshot label"}),r.jsx(Q,{disabled:e,onClick:v,size:"icon-sm",type:"button",variant:"ghost",children:r.jsx(ln,{className:"size-3.5"})}),r.jsx(Q,{onClick:()=>h(!1),size:"icon-sm",type:"button",variant:"ghost",children:r.jsx(Kt,{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(Q,{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(ln,{className:"size-3.5"})}),r.jsx(Q,{onClick:()=>g(!1),size:"icon-sm",title:"Cancel",type:"button",variant:"ghost",children:r.jsx(Kt,{className:"size-3.5"})})]}):r.jsxs("span",{className:"hidden items-center gap-0.5 group-hover:flex",children:[r.jsx(Q,{disabled:e,onClick:x,size:"icon-sm",title:"Rename snapshot",type:"button",variant:"ghost",children:r.jsx(ul,{className:"size-3.5"})}),r.jsx(Q,{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(gi,{className:"size-3.5"})})]})})]})})}function t$({busy:e,onRestore:t,snapshot:s}){const[n,o]=_.useState([]),[l,u]=_.useState(""),[h,f]=_.useState(""),[d,p]=_.useState(null),[g,x]=_.useState(!1);return _.useEffect(()=>{let v=!0;return x(!1),p(null),AL(s.sha).then(w=>{v&&(o(w),u(k=>k&&w.some(C=>C.path===k)?k:w[0]?.path??""))}).catch(w=>{v&&p(w instanceof Error?w.message:String(w))}),()=>{v=!1}},[s.sha]),_.useEffect(()=>{if(!l){f("");return}let v=!0;return TL(s.sha,l).then(w=>{v&&f(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(Q,{disabled:e,onClick:()=>{x(!1),t(s.sha)},size:"sm",type:"button",variant:"destructive",children:"Confirm restore"}),r.jsx(Q,{onClick:()=>x(!1),size:"sm",type:"button",variant:"outline",children:"Cancel"})]}):r.jsxs(Q,{disabled:e||n.length===0,onClick:()=>x(!0),size:"sm",title:"Reset the working tree to this snapshot (a pre-restore snapshot is taken first)",type:"button",variant:"outline",children:[r.jsx(au,{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(Ze,{variant:"destructive",children:[r.jsx(U0,{}),r.jsxs("div",{className:"min-w-0",children:[r.jsx(D3,{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(fu,{diff:e||"No diff for this file."}):r.jsx("div",{className:"p-4",children:r.jsx(Ze,{variant:"muted",className:"border-dashed p-8 text-center",children:"Select a file to see how it differs from the snapshot."})})})]})}function s$(){const[e,t]=_.useState([]),[s,n]=_.useState(""),[o,l]=_.useState(null),[u,h]=_.useState(null),[f,d]=_.useState(!1),p=_.useCallback(async()=>{try{const x=await ML();t(x),n(v=>v&&x.some(w=>w.id===v)?v:x[0]?.id??""),l(null)}catch(x){l(x instanceof Error?x.message:String(x))}},[]);_.useEffect(()=>{p()},[p]);async function g(x){d(!0),h(null);try{const v=await LL(x);await p(),h(`Restored ${v.restoredFiles} file(s)`+(v.deletedPaths.length?`, removed ${v.deletedPaths.length} created by the session`:"")+`. Undo via pre-restore snapshot ${v.preRestore.sha.slice(0,7)} in Git → Snapshots.`)}catch(v){l(v instanceof Error?v.message:String(v))}finally{d(!1)}}return e.length===0?r.jsx("div",{className:"p-4",children:r.jsx(Ze,{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(Ze,{variant:"muted",className:"m-3 mb-0",children:u}):null,r.jsxs("div",{className:"grid min-h-0 flex-1 xl:grid-cols-[280px_minmax(0,1fr)]",children:[r.jsx("aside",{className:"min-h-0 overflow-auto border-r border-border",children:r.jsx("ul",{children:e.map(x=>r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>n(x.id),className:de("w-full border-b border-border/60 px-3 py-2 text-left transition-colors",x.id===s?"bg-background":"hover:bg-muted/50"),children:[r.jsx("span",{className:"block truncate text-xs font-medium",children:new Date(x.startedAt).toLocaleString()}),r.jsxs("span",{className:"mt-0.5 flex items-center gap-2 text-[10px] text-muted-foreground",children:[r.jsxs("span",{children:[x.toolCount," tool call(s)"]}),x.snapshotSha?r.jsx("span",{className:"font-mono",children:x.snapshotSha.slice(0,7)}):r.jsx("span",{children:"no snapshot"})]})]})},x.id))})}),r.jsx("section",{className:"flex min-h-0 min-w-0 flex-col",children:s?r.jsx(n$,{busy:f,id:s,onRestore:g}):null})]})]})}function n$({busy:e,id:t,onRestore:s}){const[n,o]=_.useState(null),[l,u]=_.useState([]),[h,f]=_.useState(""),[d,p]=_.useState(""),[g,x]=_.useState(null),[v,w]=_.useState(!1);return _.useEffect(()=>{let k=!0;return w(!1),x(null),DL(t).then(C=>{k&&(o(C.session),u(C.files),f(N=>N&&C.files.some(T=>T.path===N)?N:C.files[0]?.path??""))}).catch(C=>{k&&x(C instanceof Error?C.message:String(C))}),()=>{k=!1}},[t]),_.useEffect(()=>{if(!h){p("");return}let k=!0;return OL(t,h).then(C=>{k&&p(C)}).catch(C=>{k&&x(C instanceof Error?C.message:String(C))}),()=>{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(Q,{disabled:e,onClick:()=>{w(!1),s(t)},size:"sm",type:"button",variant:"destructive",children:"Confirm restore"}),r.jsx(Q,{onClick:()=>w(!1),size:"sm",type:"button",variant:"outline",children:"Cancel"})]}):r.jsxs(Q,{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(au,{className:"size-3.5"}),"Restore to before this session…"]}):null]}),r.jsx(L3,{diff:d,error:g,files:l,onSelectPath:f,selectedPath:h})]})}let zS=0;const BS=()=>(zS+=1,`t${Date.now()}-${zS}`);function i$(e){return e==="codex"?{id:e,label:"Codex",commandName:"codex",installHint:"",intro:""}:{id:e,label:"Claude Code",commandName:"claude",installHint:"",intro:""}}function r$(){const[e,t]=_.useState([]),[s,n]=_.useState(!1),[o,l]=_.useState(null),[u,h]=_.useState(null),[f,d]=_.useState(null),[p,g]=_.useState([]),[x,v]=_.useState([]),w=_.useRef(void 0),k=_.useRef(null),C=_.useRef(void 0),N=_.useRef(void 0);_.useEffect(()=>{R8().then(I=>{h(I.configured),d(I.provider),g(I.providers),w.current=I.provider?.id}).catch(()=>h(!1))},[]);const T=_.useCallback(async I=>{const R=p.find(D=>D.id===I);d(R??i$(I)),w.current=I,R&&h(R.configured);try{const D=await M8(I);d(D),w.current=D.id}catch{}},[p]),j=_.useCallback(async(I,R)=>{v(P=>P.filter(G=>G.requestId!==I));const D=N.current??C.current;if(D)try{await D8(D,I,R)}catch{}},[]),A=_.useCallback(()=>{k.current?.abort(),k.current=null,n(!1)},[]),B=_.useCallback(async(I,R)=>{const D=I.trim();if(!D||s)return;l(null);const P={id:BS(),createdAt:Date.now(),role:"user",text:D,label:R?.label,tools:[]},G=BS(),Z={id:G,createdAt:Date.now(),role:"assistant",text:"",tools:[]};t(F=>[...F,P,Z]);const $=F=>t(L=>L.map(X=>X.id===G?F(X):X)),q=new AbortController;k.current=q,n(!0);try{await O8(D,R?.isolated?void 0:C.current,F=>{switch(F.type){case"session":N.current=F.sessionId,R?.isolated||(C.current=F.sessionId);break;case"text":$(L=>({...L,text:L.text+F.text}));break;case"tool_use":$(L=>({...L,tools:[...L.tools,{id:F.id,name:F.name,input:F.input,status:"running"}]}));break;case"tool_result":$(L=>({...L,tools:L.tools.map(X=>X.id===F.id?{...X,preview:F.preview,isError:F.isError,status:"done"}:X)}));break;case"approval_request":v(L=>[...L,{requestId:F.requestId,name:F.name,input:F.input}]);break;case"error":l(F.message);break;case"done":break}},q.signal,R?.autoApprove,w.current)}catch(F){q.signal.aborted||l(F instanceof Error?F.message:String(F))}finally{k.current=null,n(!1)}},[s]),O=_.useCallback(()=>{A(),C.current=void 0,N.current=void 0,t([]),v([]),l(null)},[A]);return{turns:e,streaming:s,error:o,configured:u,provider:f,providers:p,selectProvider:T,approvals:x,send:B,stop:A,clear:O,respond:j}}const z3=_.createContext(null);function a$({children:e}){const t=r$(),{streaming:s}=t,[n,o]=_.useState(!1),[l,u]=_.useState(""),[h,f]=_.useState(null),[d,p]=_.useState(0),[g,x]=_.useState(0),[v,w]=_.useState(!1),k=_.useRef([]),C=_.useCallback(()=>p(D=>D+1),[]),N=_.useCallback(()=>x(D=>D+1),[]),T=_.useCallback((D,P)=>(N(),t.send(D,P)),[t,N]),j=_.useCallback(()=>f(null),[]),A=_.useCallback(()=>{o(!0),w(!0)},[]),B=_.useCallback(D=>{o(!0),u(P=>P.trim()?`${P.replace(/\s*$/,"")}
|
|
23
|
-
${D}`:D),C()},[C]);_.useEffect(()=>{if(s)return;const D=k.current.shift();D&&T(D.prompt,{label:D.label,autoApprove:D.autoApprove,isolated:D.isolated})},[s,T]);const O=_.useCallback(({prompt:D,source:P,mode:G="send",label:Z,autoApprove:$,background:q,isolated:F})=>(q||o(!0),f(P??null),N(),G==="draft"?(u(D),C(),{queued:!1}):s?(k.current.push({prompt:D,label:Z,autoApprove:$,isolated:F}),{queued:!0}):(T(D,{label:Z,autoApprove:$,isolated:F}),{queued:!1})),[s,T,C,N]),I=_.useCallback(()=>{k.current=[],f(null),t.clear()},[t]),R={...t,send:T,clear:I,open:n,setOpen:o,draft:l,setDraft:u,insertPath:B,activeSource:h,clearSource:j,focusNonce:d,stickNonce:g,sendToAgent:O,onboarding:v,setOnboarding:w,startOnboard:A};return r.jsx(z3.Provider,{value:R,children:e})}function Pt(){const e=_.useContext(z3);if(!e)throw new Error("useAgentDock must be used within an AgentProvider");return e}function o$(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 l$(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?o$(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 c$({now:e,onNewChat:t,turns:s}){const[n,o]=_.useState(()=>Date.now());_.useEffect(()=>{const h=window.setInterval(()=>o(Date.now()),3e4);return()=>window.clearInterval(h)},[]);const l=l$(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(xM,{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(Xe,{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(Q,{className:"h-7 gap-1.5 px-2 text-xs",disabled:!u,onClick:t,size:"sm",type:"button",variant:"outline",children:[r.jsx(au,{className:"size-3.5"}),"New chat"]})]})}function u$({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(xi,{className:"min-w-0 rounded-none border-0 bg-transparent",children:[r.jsxs(bi,{className:"border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(LN,{className:"size-4 text-muted-foreground"}),r.jsx(vi,{children:"Project Memory"})]}),r.jsx(Xe,{variant:"outline",size:"small",children:o})]}),r.jsx(tr,{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(_i,{className:"space-y-2 p-3",children:[s?r.jsx(PS,{title:s,preview:n,defaultOpen:!0}):null,e.project.memoryFiles.length?e.project.memoryFiles.map(l=>r.jsx(PS,{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 PS({title:e,subtitle:t,preview:s,defaultOpen:n=!1}){const[o,l]=_.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(Zn,{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 d$=[{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%)"}],h$=({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:d$.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))})}),f$=[{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"}],m$={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"},p$={square:{tiny:"rounded",small:"rounded-md",medium:"rounded-md",large:"rounded-lg"},circle:{tiny:"rounded-[100%]",small:"rounded-[100%]",medium:"rounded-[100%]",large:"rounded-[100%]"},rounded:{tiny:"rounded-[100px]",small:"rounded-[100px]",medium:"rounded-[100px]",large:"rounded-[100px]"}},qd=({size:e="medium",type:t="primary",variant:s="styled",shape:n="square",svgOnly:o=!1,children:l,prefix:u,suffix:h,shadow:f=!1,loading:d=!1,disabled:p=!1,fullWidth:g=!1,className:x,...v})=>r.jsxs("button",{disabled:p,tabIndex:0,className:Xc("flex items-center justify-center gap-0.5 duration-150",f$[+o][e],p||d?"cursor-not-allowed border border-gray-400 bg-gray-100 text-gray-700":m$[t],p$[n][e],f&&"shadow-border-small border-none",g&&"w-full",s==="unstyled"?"h-fit bg-transparent px-0 text-gray-1000 outline-none hover:bg-transparent":"focus:shadow-focus-ring focus:outline-0",x),type:"button",...v,children:[d?r.jsx(h$,{size:e==="large"?24:16}):u,r.jsx("span",{className:Xc("relative overflow-hidden overflow-ellipsis whitespace-nowrap font-sans",e!=="tiny"&&s!=="unstyled"&&"px-1.5"),children:l}),!d&&h]}),g$=({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"})}),x$=()=>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 mg=null,b$=0;const Es={toasts:[],listeners:new Set,add(e,t,s,n,o,l){const u=b$++,h={id:u,text:e,preserve:s,action:n,onAction:o,onUndoAction:l,type:t};if(!h.preserve){h.remaining=3e3,h.start=Date.now();const f=()=>{this.toasts=this.toasts.filter(d=>d.id!==u),this.notify()};h.timeout=setTimeout(f,h.remaining),h.pause=()=>{h.timeout&&(clearTimeout(h.timeout),h.timeout=void 0,h.remaining-=Date.now()-h.start)},h.resume=()=>{h.timeout||(h.start=Date.now(),h.timeout=setTimeout(f,h.remaining))}}this.toasts.push(h),this.notify()},remove(e){Es.toasts=Es.toasts.filter(t=>t.id!==e),Es.notify()},subscribe(e){return Es.listeners.add(e),()=>{Es.listeners.delete(e)}},notify(){Es.listeners.forEach(e=>{e()})}},v$=()=>{const[e,t]=_.useState([]),[s,n]=_.useState([]),[o,l]=_.useState(!1),u=w=>k=>{k&&w.measuredHeight==null&&(w.measuredHeight=k.getBoundingClientRect().height,Es.notify())};_.useEffect(()=>(t([...Es.toasts]),Es.subscribe(()=>{t([...Es.toasts])})),[]),_.useEffect(()=>{const w=e.filter(k=>!s.includes(k.id)).map(k=>k.id);w.length>0&&requestAnimationFrame(()=>{n(k=>[...k,...w])})},[s,e]);const f=Math.max(0,e.length-3),d=(w,k)=>{if(w===k-1)return"none";const C=k-1-w;let N=e[k-1]?.measuredHeight||63;for(let A=k-1;A>w;A--)o?N+=(e[A-1]?.measuredHeight||63)+10:N+=20;const T=-C,j=o?1:1-.05*C;return`translate3d(0, calc(100% - ${N}px), ${T}px) scale(${j})`},p=()=>{l(!0),Es.toasts.forEach(w=>{w.pause?.()})},g=()=>{l(!1),Es.toasts.forEach(w=>{w.resume?.()})},v=e.slice(f).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 C=k>=f;return r.jsx("div",{ref:u(w),className:Xc("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],C?"opacity-100":"opacity-0",k<f&&"pointer-events-none"),style:{width:"100%",transition:"all .35s cubic-bezier(.25,.75,.6,.98)",transform:s.includes(w.id)?d(k,e.length):"translate3d(0, 100%, 150px) scale(1)"},children: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(qd,{type:"tertiary",svgOnly:!0,size:"small",onClick:()=>{w.onUndoAction?.(),Es.remove(w.id)},children:r.jsx(x$,{})}),r.jsx(qd,{type:"tertiary",svgOnly:!0,size:"small",onClick:()=>Es.remove(w.id),children:r.jsx(g$,{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(qd,{type:"tertiary",size:"small",onClick:()=>Es.remove(w.id),children:"Dismiss"}),r.jsx(qd,{type:"primary",size:"small",onClick:()=>{w.onAction?.(),Es.remove(w.id)},children:w.action})]})]})},w.id)})})})},Vd=()=>{if(mg)return;const e=document.createElement("div");e.className="fixed bottom-4 right-4 z-[9999]",document.body.appendChild(e),mg=MN.createRoot(e),mg.render(r.jsx(v$,{}))},us=()=>({message:_.useCallback(({text:e,preserve:t,action:s,onAction:n,onUndoAction:o})=>{Vd(),Es.add(e,"message",t,s,n,o)},[]),success:_.useCallback(e=>{Vd(),Es.add(e,"success")},[]),warning:_.useCallback(e=>{Vd(),Es.add(e,"warning")},[]),error:_.useCallback(e=>{Vd(),Es.add(e,"error")},[])});function _$({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(bl,{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(B3,{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(an,{label:"Input",value:pn(e.inputTokens)}),r.jsx(an,{label:"Output",value:pn(e.outputTokens)}),r.jsx(an,{label:"Cache read",value:pn(e.cacheReadInputTokens)}),r.jsx(an,{label:"Cache create",value:pn(e.cacheCreationInputTokens)}),r.jsx(an,{label:"Lines +",value:String(e.linesAdded)}),r.jsx(an,{label:"Lines −",value:String(e.linesRemoved)}),r.jsx(an,{label:"Wall",value:IS(e.durationMs)}),r.jsx(an,{label:"API",value:IS(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(Gh,{label:"5h block",window:e.fiveHour}):null,e.weekly?r.jsx(Gh,{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 y$({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(hu,{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(B3,{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(an,{label:"Input",value:pn(e.inputTokens)}),r.jsx(an,{label:"Output",value:pn(e.outputTokens)}),r.jsx(an,{label:"Cache read",value:pn(e.cachedInputTokens)}),r.jsx(an,{label:"Reasoning",value:pn(e.reasoningOutputTokens)}),r.jsx(an,{label:"Total",value:pn(e.totalTokens)}),r.jsx(an,{label:"Last turn",value:pn(e.lastTotalTokens)}),r.jsx(an,{label:"Context",value:e.contextWindow?pn(e.contextWindow):"n/a"}),r.jsx(an,{label:"Cost",value:"n/a"})]}),e.contextWindow?r.jsx("div",{className:"border-t border-border px-3 py-2",children:r.jsx(w$,{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(Gh,{label:"5h window",window:e.primary}):null,e.secondary?r.jsx(Gh,{label:"Weekly window",window:e.secondary}):null]}):null]})}function B3({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 w$({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 Gh({label:e,window:t}){const s=Math.min(100,Math.max(0,t.usedPercent)),n=t.resetsAtUnix?new Date(t.resetsAtUnix*1e3).toLocaleString():null,o=s>=90?"bg-red-500":s>=70?"bg-amber-500":"bg-emerald-500";return 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 an({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 IS(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 S$(e=1e4){const[t,s]=_.useState(null),[n,o]=_.useState(null);return _.useEffect(()=>{let l=!0;const u=()=>{k8().then(f=>{l&&(s(f),o(null))}).catch(f=>{l&&o(f instanceof Error?f.message:String(f))})};u();const h=window.setInterval(u,e);return()=>{l=!1,window.clearInterval(h)}},[e]),{usage:t,error:n}}const k$={"claude-code":{label:"Claude Code",icon:r.jsx(bl,{})},codex:{label:"Codex",icon:r.jsx(hu,{})}};function N$({agent:e,agentId:t,isDetected:s}){const{usage:n,error:o}=S$(),l=k$[t],u=t==="codex";return r.jsxs(xi,{className:"min-w-0 rounded-none border-0 bg-transparent",children:[r.jsxs(bi,{className:"border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx(GN,{className:"size-4 text-muted-foreground"}),r.jsx(vi,{children:u?"Token Usage & Rate Limits":"Token & Cost Usage"}),r.jsx(Xe,{variant:"outline",size:"small",icon:l.icon,children:l.label}),s?r.jsx(Xe,{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(C$,{className:"ml-auto"})]}),r.jsxs(tr,{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(_i,{className:"p-3",children:[o?r.jsx("p",{className:"text-xs text-destructive",children:o}):null,u?n?.codex?r.jsx(y$,{usage:n.codex}):o?null:r.jsx($S,{agent:"Codex CLI"}):n?.claude?r.jsx(_$,{usage:n.claude}):o?null:r.jsx($S,{agent:"Claude Code"})]})]})}function C$({className:e}){const[t,s]=_.useState(!0),[n,o]=_.useState(!0),[l,u]=_.useState(!1),h=us();_.useEffect(()=>{let d=!0;return C8().then(p=>d&&s(p.coAuthorWithClaude)).catch(()=>{}).finally(()=>d&&o(!1)),()=>{d=!1}},[]);const f=async()=>{const d=!t;u(!0),s(d);try{const p=await E8({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(Q,{type:"button",variant:t?"default":"outline",size:"sm",onClick:f,disabled:n||l,"aria-pressed":t,title:t?"Claude will be added as commit co-author. Click to disable.":"Co-author trailer disabled. Click to enable.",className:de("gap-1.5",e),children:[r.jsx(bl,{className:"size-3.5"}),"Co-author"]})}function $S({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 HS=["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
|
-
`),E$=["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 j$(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 A$(e){return e.map(t=>`- ${t.name}: ${t.dataType}${t.primaryKey?" (PK)":""}${t.nullable?"":" NOT NULL"}`).join(`
|
|
27
|
-
`)}function P3(e){return e?.length?["## Table schema",A$(e),""].join(`
|
|
28
|
-
`):""}const I3="Your prompt: ";function T$(e,t,s,n,o){return[`I'm looking at a row in my ${t} database (connection "${e}", table \`${s.qualifiedName}\`).`,"",P3(n),"## Row","```json",JSON.stringify(o,null,2),"```","",I3].join(`
|
|
29
|
-
`)}function US(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=P3(s?.columns);return l&&o.push(l),o.push(I3),o.join(`
|
|
30
|
-
`)}function R$(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 M$(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 D$({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 O$(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 L$(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 z$(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 B$(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 P$(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 I$(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 $3(e){return`Pull request #${e.number} — "${e.title}" (${e.head.ref} → ${e.base.ref}, by ${e.user.login}):`}function $$(e,t){return[$3(e),"",t,"",`Pull the diff with \`gh pr diff ${e.number}\` (or your GitHub tools) if you need it.`].join(`
|
|
42
|
-
`)}function H$(e,t,s){return[$3(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 U$(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 F$(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 q$({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 FS(){return{serviceNames:[],databaseNames:[],errorIds:[],repositoryPaths:[]}}function V$(e){return e.serviceNames.length>0||e.databaseNames.length>0||e.errorIds.length>0||e.repositoryPaths.length>0}function G$({dashboard:e,databases:t,incidents:s,note:n,selection:o}){const l=[K$(e,o.serviceNames),Y$(t,o.databaseNames),X$(s,o.errorIds),Z$(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 W$({note:e,selection:t}){const s=[Gd(t.serviceNames.length,"service"),Gd(t.databaseNames.length,"database"),Gd(t.errorIds.length,"error"),Gd(t.repositoryPaths.length,"repo")].filter(Boolean),n=e?.trim().replace(/\s+/g," ");return n?`Diagnose: ${s.join(", ")}. Note: ${n.slice(0,80)}`:`Diagnose: ${s.join(", ")}`}function K$(e,t){return t.length?["Services",t.map(n=>{const o=e.config.services.find(f=>f.name===n),l=e.runtime.services[n],u=e.health[n],h=e.logs.filter(f=>f.service===n).slice(-8).map(f=>`${f.timestamp} ${f.stream}: ${f.text}`);return[`Service: ${n}`,o?.kind?`kind: ${o.kind}`:null,o?.command?`command: ${o.command}`:null,o?.cwd?`cwd: ${o.cwd}`:null,o?.port?`port: ${o.port}`:null,l?`state: ${l.state}`:"state: unknown",l?.pid?`pid: ${l.pid}`:null,l?.url?`url: ${l.url}`:null,l?.exitCode!==void 0&&l.exitCode!==null?`exitCode: ${l.exitCode}`:null,u?`health: ${u.status} - ${u.summary}`:null,u?.agentContext?`agent debug context:
|
|
53
|
-
${u.agentContext}`:null,h.length?`recent logs:
|
|
54
|
-
${h.join(`
|
|
55
|
-
`)}`:null].filter(Boolean).join(`
|
|
56
|
-
`)}).join(`
|
|
57
|
-
|
|
58
|
-
`)].join(`
|
|
59
|
-
`):null}function Y$(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 X$(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 Z$(e,t){if(!t.length)return null;const s=Q$(e),n=e.git.selectedRepository?.path??e.git.cwd,o=e.git.status?.files.map(u=>`${u.index}${u.workingTree}: ${u.path}`)??[];return["Git Repositories",t.map(u=>{const h=s.find(d=>d.path===u),f=u===n;return[`Repository: ${h?.name??u.split("/").pop()??u}`,`path: ${u}`,f?"current: yes":"current: no",f?o.length?`changed files:
|
|
70
|
-
${o.join(`
|
|
71
|
-
`)}`:"changed files: none":"changed files: not loaded for this repository in the current dashboard view"].join(`
|
|
72
|
-
`)}).join(`
|
|
73
|
-
|
|
74
|
-
`)].join(`
|
|
75
|
-
`)}function Q$(e){return e.config.gitRepositories.length?e.config.gitRepositories:e.git.selectedRepository?[e.git.selectedRepository]:[{name:e.git.cwd.split("/").pop()??"repository",path:e.git.cwd}]}function Gd(e,t){return e?`${e} ${t}${e===1?"":"s"}`:null}function wf(e){return e==="codex"?"Codex":"Claude Code"}function J$(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 ${wf(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 eH(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 tH(e){const t=[`I'm looking at the ${e.scope} skill \`${e.name}\`${e.path?` (at \`${e.path}\`)`:""}.`];return e.description&&t.push("",`Its description: ${e.description}`),t.push("","My question: "),t.join(`
|
|
78
|
-
`)}function sH(e,t){const s=e==="codex"?"by adding an `[mcp_servers.<name>]` section to `~/.codex/config.toml`":"with `claude mcp add` (or by editing `~/.claude.json`)";return[`Register a new MCP server for ${wf(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 nH(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 iH(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 rH(e,t){return[`Install a plugin for ${wf(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 aH(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 oH(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 lH(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 ${wf(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 cH(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 uH(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 H3({id:e,className:t}){return e==="codex"?r.jsx(hu,{className:de("text-foreground",t)}):e==="gemini"?r.jsx(GI,{className:de("text-[#1A73E8]",t)}):r.jsx(bl,{className:de("text-[#D97757]",t)})}function Gt({className:e}){const{provider:t}=Pt();return r.jsx(H3,{id:t?.id,className:e})}function Qi({onAsk:e,label:t,className:s}){const{provider:n}=Pt(),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(H3,{id:n?.id,className:"size-3.5"})})}function Rr({placeholder:e,onSubmit:t,onCancel:s,className:n}){const[o,l]=_.useState(""),u=()=>{const f=o.trim();f&&t(f)},h=_.useCallback(f=>{f?.focus()},[]);return 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:f=>{f.preventDefault(),u()},children:[r.jsx(Qi,{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:f=>l(f.target.value),onKeyDown:f=>{f.key==="Escape"&&s()},placeholder:e,value:o}),r.jsx(Q,{type:"submit",size:"icon",className:"size-6",disabled:!o.trim(),title:"Send",children:r.jsx(ln,{className:"size-3.5"})}),r.jsx(Q,{type:"button",size:"icon",variant:"ghost",className:"size-6",onClick:s,"aria-label":"Cancel",title:"Cancel",children:r.jsx(Kt,{className:"size-3.5"})})]})}function Sf({label:e,onClick:t}){return r.jsxs(Q,{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(bs,{className:"size-3.5"}),"Add"]})}function kf({askLabel:e,removeLabel:t,onAsk:s,onRemove:n}){return r.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[r.jsx(Qi,{label:e,onAsk:s}),r.jsx(dH,{label:t,onConfirm:n})]})}function dH({label:e,onConfirm:t}){const[s,n]=_.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(ln,{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(Kt,{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(gi,{className:"size-3.5"})})}function hH({agent:e,agentId:t,alternateHooks:s}){const{sendToAgent:n}=Pt(),[o,l]=_.useState(!1),u=e.hooks??[];function h(p){l(!1),n({prompt:lH(t,p),source:{type:"agent-hook",label:"New hook"},label:`Add hook: ${p}`})}function f(p){n({prompt:uH(p),source:{type:"agent-hook",label:`${p.event} hook`},mode:"draft"})}function d(p){n({prompt:cH(p),source:{type:"agent-hook",label:`Remove ${p.event}`},label:`Remove hook: ${p.event}`})}return r.jsxs(xi,{className:"min-w-0 rounded-none border-0 border-t border-border bg-transparent md:border-l lg:border-t-0",children:[r.jsxs(bi,{className:"border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(M6,{className:"size-4 text-muted-foreground"}),r.jsx(vi,{children:"Hooks"})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(Xe,{variant:"outline",size:"small",children:u.length}),r.jsx(Sf,{label:"Add a hook with AI",onClick:()=>l(p=>!p)})]})]}),o?r.jsx(Rr,{className:"mt-1.5",placeholder:"Describe the event, matcher, and command…",onSubmit:h,onCancel:()=>l(!1)}):r.jsx(tr,{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(_i,{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(kf,{askLabel:`Ask AI about the ${p.event} hook`,removeLabel:`Remove the ${p.event} hook`,onAsk:()=>f(p),onRemove:()=>d(p)})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[r.jsx(mH,{hook:p}),r.jsx(pH,{hook:p}),r.jsx(Xe,{variant:"outline",size:"small",children:p.scope})]})]}),r.jsx("div",{className:"mt-1 truncate font-mono text-[11px] text-muted-foreground",title:qS(p),children:qS(p)})]},p.id))}):r.jsx(fH,{agentId:t,alternateHooks:s})})]})}function fH({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 mH({hook:e}){return e.status==="enabled"?r.jsx(Xe,{variant:"success",appearance:"subtle",size:"small",children:"Enabled"}):e.status==="disabled"?r.jsx(Xe,{variant:"error",appearance:"subtle",size:"small",children:"Disabled"}):r.jsx(Xe,{variant:"warning",appearance:"subtle",size:"small",children:"Default"})}function pH({hook:e}){return e.trusted===void 0?null:r.jsx(Xe,{variant:e.trusted?"success":"warning",appearance:"subtle",size:"small",children:e.trusted?"Trusted":"Untrusted"})}function gH(e){return e.command?e.command:e.type??e.settingsPath}function qS(e){return`${e.matcher?`matcher ${e.matcher} · `:""}${gH(e)}`}function xH({agent:e,agentId:t}){const{sendToAgent:s}=Pt(),[n,o]=_.useState([]),[l,u]=_.useState(!1),[h,f]=_.useState(!1),d=_.useCallback(async()=>{u(!0);try{o(await S8(t))}catch{o([])}finally{u(!1)}},[t]);_.useEffect(()=>{d()},[d]);const p=_.useMemo(()=>{const k={};for(const C of n)k[C.name]=C.state;return k},[n]),g=_.useMemo(()=>{const k=new Set(e.mcpServers.map(N=>N.name)),C=n.filter(N=>!k.has(N.name)).map(N=>({name:N.name,scope:"user",synthetic:!0}));return[...e.mcpServers,...C]},[e.mcpServers,n]);function x(k){f(!1),s({prompt:sH(t,k),source:{type:"agent-mcp",label:"New MCP server"},label:`Add MCP server: ${k}`})}function v(k){s({prompt:iH(k),source:{type:"agent-mcp",label:`${k.name} server`},mode:"draft"})}function w(k){s({prompt:nH(k,t),source:{type:"agent-mcp",label:`Remove ${k.name}`},label:`Remove MCP server: ${k.name}`})}return r.jsxs(xi,{className:"min-w-0 rounded-none border-0 bg-transparent md:border-l md:border-border",children:[r.jsxs(bi,{className:"border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(tC,{className:"size-4 text-muted-foreground"}),r.jsx(vi,{children:"MCP Servers"})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(Xe,{variant:"outline",size:"small",children:g.length}),r.jsx(Q,{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(Tr,{className:l?"animate-spin":void 0})}),r.jsx(Sf,{label:"Register an MCP server with AI",onClick:()=>f(k=>!k)})]})]}),h?r.jsx(Rr,{className:"mt-1.5",placeholder:"Paste the MCP install command or URL…",onSubmit:x,onCancel:()=>f(!1)}):r.jsxs(tr,{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(_i,{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(kf,{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(vH,{state:p[k.name],loading:l}),r.jsx(Xe,{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":VS(k),children:k.synthetic?"claude.ai managed connector":VS(k)})]},`${k.scope}:${k.name}`))}):r.jsx("p",{className:"px-3 py-4 text-xs text-muted-foreground",children:"No MCP servers configured."})})]})}const bH={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 vH({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:bH[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 VS(e){return e.command?[e.command,...e.args??[]].join(" "):e.url??e.type??"-"}function _H({agent:e,agentId:t}){const{sendToAgent:s}=Pt(),[n,o]=_.useState(!1),l=e.plugins??[];function u(d){o(!1),s({prompt:rH(t,d),source:{type:"agent-plugin",label:"New plugin"},label:`Install plugin: ${d}`})}function h(d){s({prompt:oH(d),source:{type:"agent-plugin",label:`${d.name} plugin`},mode:"draft"})}function f(d){s({prompt:aH(d),source:{type:"agent-plugin",label:`Remove ${d.name}`},label:`Uninstall plugin: ${d.name}`})}return r.jsxs(xi,{className:"min-w-0 rounded-none border-0 border-t border-border bg-transparent lg:border-l lg:border-t-0",children:[r.jsxs(bi,{className:"border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(_4,{className:"size-4 text-muted-foreground"}),r.jsx(vi,{children:"Plugins"})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(Xe,{variant:"outline",size:"small",children:l.length}),r.jsx(Sf,{label:"Install a plugin with AI",onClick:()=>o(d=>!d)})]})]}),n?r.jsx(Rr,{className:"mt-1.5",placeholder:"Paste a plugin name, marketplace, or install command…",onSubmit:u,onCancel:()=>o(!1)}):r.jsx(tr,{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(_i,{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(kf,{askLabel:`Ask AI about the ${d.name} plugin`,removeLabel:`Uninstall the ${d.name} plugin`,onAsk:()=>h(d),onRemove:()=>f(d)})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[d.version&&d.version!=="unknown"?r.jsxs(Xe,{variant:"outline",size:"small",children:["v",d.version]}):null,d.marketplace?r.jsx(Xe,{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(yH,{plugin:d})]},`${d.name}@${d.marketplace??""}`))}):r.jsx("p",{className:"px-3 py-4 text-xs text-muted-foreground",children:"No plugins installed."})})]})}function yH({plugin:e}){const t=[];return e.skills.length&&t.push(`${e.skills.length} skill${Wd(e.skills.length)}`),e.commands.length&&t.push(`${e.commands.length} command${Wd(e.commands.length)}`),e.agents.length&&t.push(`${e.agents.length} agent${Wd(e.agents.length)}`),e.mcpServers.length&&t.push(`${e.mcpServers.length} MCP server${Wd(e.mcpServers.length)}`),t.length?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 Wd(e){return e===1?"":"s"}function wH({agent:e,agentId:t}){const{sendToAgent:s}=Pt(),[n,o]=_.useState(!1);function l(f){o(!1),s({prompt:J$(t,f),source:{type:"agent-skill",label:"New skill"},label:`Add skill: ${f}`})}function u(f){s({prompt:tH(f),source:{type:"agent-skill",label:`${f.name} skill`},mode:"draft"})}function h(f){s({prompt:eH(f),source:{type:"agent-skill",label:`Remove ${f.name}`},label:`Remove skill: ${f.name}`})}return r.jsxs(xi,{className:"min-w-0 rounded-none border-0 bg-transparent",children:[r.jsxs(bi,{className:"border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(pi,{className:"size-4 text-muted-foreground"}),r.jsx(vi,{children:"Skills"})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(Xe,{variant:"outline",size:"small",children:e.skills.length}),r.jsx(Sf,{label:"Add a skill with AI",onClick:()=>o(f=>!f)})]})]}),n?r.jsx(Rr,{className:"mt-1.5",placeholder:"Paste a skill URL/repo, or describe the skill…",onSubmit:l,onCancel:()=>o(!1)}):r.jsx(tr,{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(_i,{className:"p-0",children:e.skills.length?r.jsx("ul",{className:"divide-y divide-border",children:e.skills.map(f=>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:f.name,children:f.name}),r.jsx(kf,{askLabel:`Ask AI about the ${f.name} skill`,removeLabel:`Remove the ${f.name} skill`,onAsk:()=>u(f),onRemove:()=>h(f)})]}),r.jsx("div",{className:"flex shrink-0 items-center gap-1.5",children:r.jsx(Xe,{variant:"outline",size:"small",children:f.scope})})]}),f.description?r.jsx("p",{className:"mt-1 truncate text-[11px] text-muted-foreground",title:f.description,children:f.description}):null]},`${f.scope}:${f.name}`))}):r.jsx("p",{className:"px-3 py-4 text-xs text-muted-foreground",children:"No skills found."})})]})}function SH({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(wH,{agent:e,agentId:t}),r.jsx(xH,{agent:e,agentId:t}),r.jsx(_H,{agent:e,agentId:t}),r.jsx(hH,{agent:e,agentId:t,alternateHooks:s})]})}function kH(e=3e4){const[t,s]=_.useState(null),[n,o]=_.useState(null),[l,u]=_.useState(!0),h=_.useCallback(async()=>{try{s(await N8()),o(null)}catch(f){o(f instanceof Error?f.message:String(f))}finally{u(!1)}},[]);return _.useEffect(()=>{h();const f=window.setInterval(()=>{h()},e);return()=>window.clearInterval(f)},[h,e]),{data:t,error:n,loading:l,refresh:h}}function NH(){const{data:e,error:t,loading:s}=kH();if(s&&!e)return r.jsx(Kd,{children:r.jsx(Ze,{variant:"muted",children:"Loading usage history…"})});if(t)return r.jsx(Kd,{children:r.jsxs(Ze,{variant:"muted",className:"border-destructive/40 text-destructive",children:["Failed to load usage history: ",t]})});const n=e?.summary;return!n||n.runs===0&&n.codexTotalTokens===0?r.jsx(Kd,{children:r.jsx(Ze,{variant:"muted",children:"No usage recorded yet. History accrues as you run the in-dock agent — check back after a session."})}):r.jsxs(Kd,{children:[r.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:[r.jsx(Yd,{label:"Total cost",value:`$${n.totalCostUSD.toFixed(2)}`,accent:!0}),r.jsx(Yd,{label:"Agent runs",value:String(n.runs)}),r.jsx(Yd,{label:"Tokens (in+out)",value:GS(n.totalTokens)}),r.jsx(Yd,{label:"Codex tokens",value:GS(n.codexTotalTokens)})]}),n.byDay.length>0?r.jsxs("div",{className:"rounded-md border border-border p-3",children:[r.jsx("div",{className:"mb-2 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Cost by day"}),r.jsx(CH,{days:n.byDay})]}):null,r.jsx(EH,{summary:n})]})}function CH({days:e}){const t=Math.max(...e.map(s=>s.costUSD),1e-4);return r.jsx("div",{className:"space-y-1.5",children:e.map(s=>r.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[r.jsx("span",{className:"w-20 shrink-0 font-mono text-muted-foreground",children:s.date.slice(5)}),r.jsx("div",{className:"h-3.5 flex-1 overflow-hidden rounded bg-muted/50",children:r.jsx("div",{className:"h-full rounded bg-emerald-500/80",style:{width:`${Math.max(2,s.costUSD/t*100)}%`}})}),r.jsxs("span",{className:"w-14 shrink-0 text-right font-mono text-emerald-700",children:["$",s.costUSD.toFixed(2)]}),r.jsxs("span",{className:"w-12 shrink-0 text-right text-muted-foreground",children:[s.runs," run",s.runs===1?"":"s"]})]},s.date))})}function EH({summary:e}){if(!e.firstAt||!e.lastAt)return null;const t=e.firstAt.slice(0,10),s=e.lastAt.slice(0,10);return r.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[t===s?`Recorded on ${t}.`:`Recorded ${t} → ${s}.`," Costs are Claude per-session figures; Codex reports lifetime token totals only."]})}function Kd({children:e}){return r.jsx("div",{className:"space-y-3 p-4",children:e})}function Yd({label:e,value:t,accent:s}){return r.jsxs("div",{className:"rounded-md border border-border px-3 py-2",children:[r.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:e}),r.jsx("div",{className:s?"font-mono text-lg font-semibold text-emerald-700":"font-mono text-lg font-semibold",children:t})]})}function GS(e){return e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}const jH=[{id:"claude-code",chatId:"claude",label:"Claude Code",icon:r.jsx(bl,{className:"size-4"})},{id:"codex",chatId:"codex",label:"Codex",icon:r.jsx(hu,{className:"size-4"})}],AH=[{id:"overview",label:"Overview",icon:r.jsx(GN,{className:"size-3.5"})},{id:"memory",label:"Memory",icon:r.jsx(LN,{className:"size-3.5"})},{id:"tools",label:"Skills, MCPs, Plugins & Hooks",icon:r.jsx(tC,{className:"size-3.5"})},{id:"activity",label:"Activity",icon:r.jsx(to,{className:"size-3.5"})},{id:"changes",label:"Changes",icon:r.jsx(UN,{className:"size-3.5"})},{id:"usage",label:"Usage",icon:r.jsx(rR,{className:"size-3.5"})}];function TH({focusChanges:e}={}){const[t,s]=_.useState(null),[n,o]=_.useState(null),[l,u]=_.useState("claude-code"),[h,f]=_.useState("overview"),{clear:d,turns:p,provider:g,providers:x,selectProvider:v}=Pt();_.useEffect(()=>{e&&f("changes")},[e]);function w(N,T){u(N),g?.id!==T&&v(T)}if(_.useEffect(()=>{g&&u(g.id==="codex"?"codex":"claude-code")},[g]),_.useEffect(()=>{let N=!0;return gC().then(T=>{N&&s(T)}).catch(T=>{N&&o(T instanceof Error?T.message:String(T))}),()=>{N=!1}},[]),n)return r.jsx("div",{className:"h-full overflow-auto bg-card/85 p-4",children:r.jsxs(Ze,{variant:"muted",className:"border-destructive/40 text-destructive",children:["Failed to load agent info: ",n]})});if(!t)return r.jsx("div",{className:"h-full overflow-auto bg-card/85 p-4",children:r.jsx(Ze,{variant:"muted",children:"Loading agent info…"})});const k=t.agents?.[l]??t,C=l==="codex"?{agentLabel:"Claude Code",count:t.agents["claude-code"].hooks.length}:{agentLabel:"Codex",count:t.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:jH.map(N=>{const T=l===N.id,j=t.detected.name===N.id,A=g?.id===N.chatId,O=x.find(I=>I.id===N.chatId)?.configured??!0;return r.jsxs("button",{type:"button",onClick:()=>w(N.id,N.chatId),title:O?`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",T?"border-border bg-background text-foreground shadow-sm":"border-transparent text-muted-foreground hover:bg-muted/60 hover:text-foreground",!O&&"opacity-60"),children:[N.icon,N.label,A?r.jsx("span",{className:"rounded-full bg-primary/15 px-1.5 py-px text-[10px] font-medium text-primary",children:"In use"}):j?r.jsx("span",{className:"size-1.5 rounded-full bg-emerald-500",title:"Detected agent","aria-hidden":!0}):O?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:AH.map(N=>r.jsxs("button",{type:"button",onClick:()=>f(N.id),className:de("relative flex items-center gap-1.5 px-2.5 py-2 text-xs font-medium transition-colors",h===N.id?"text-foreground":"text-muted-foreground hover:text-foreground"),children:[N.icon,N.label,h===N.id?r.jsx("span",{className:"absolute inset-x-1 -bottom-px h-0.5 bg-primary"}):null]},N.id))}),r.jsx(c$,{onNewChat:d,turns:p}),r.jsxs("div",{className:"min-h-0 flex-1 overflow-auto",children:[h==="overview"?r.jsx(N$,{agent:k,agentId:l,isDetected:t.detected.name===l}):null,h==="memory"?r.jsx(u$,{agent:k,agentId:l}):null,h==="tools"?r.jsx(SH,{agent:k,agentId:l,alternateHooks:C}):null,h==="activity"?r.jsx(qI,{agent:k,agentId:l}):null,h==="changes"?r.jsx(s$,{}):null,h==="usage"?r.jsx(NH,{}):null]})]})}const U3=_.createContext(null);function RH(){const e=_.useRef(new Set),t=_.useCallback(n=>(e.current.add(n),()=>{e.current.delete(n)}),[]),s=_.useCallback(async()=>{await Promise.all([...e.current].map(n=>Promise.resolve().then(n)))},[]);return{register:t,runActive:s}}function MH({value:e,children:t}){return r.jsx(U3.Provider,{value:e,children:t})}function vl(e){const t=_.useContext(U3),s=_.useRef(e);s.current=e,_.useEffect(()=>{if(t)return t.register(()=>s.current())},[t])}var ka=RN();function mu({items:e,label:t="More actions",className:s}){const[n,o]=_.useState(!1),[l,u]=_.useState({top:0,right:0}),h=_.useRef(null),f=_.useRef(null);function d(){const p=h.current?.getBoundingClientRect();p&&u({top:p.bottom+4,right:window.innerWidth-p.right}),o(g=>!g)}return _.useEffect(()=>{if(!n)return;function p(v){const w=v.target;h.current?.contains(w)||f.current?.contains(w)||o(!1)}function g(v){v.key==="Escape"&&o(!1)}const x=()=>o(!1);return document.addEventListener("mousedown",p),document.addEventListener("keydown",g),window.addEventListener("scroll",x,!0),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",g),window.removeEventListener("scroll",x,!0)}},[n]),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(IN,{className:"size-3.5"})}),n?ka.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:f,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]})}const ao={claude:"Claude Code",codex:"Codex CLI",antigravity:"Antigravity"},DH=["claude","codex","antigravity"];function OH({availability:e,config:t,onStage:s}){const n=[...Object.entries(t.mcpServers).map(([l,u])=>({name:l,detail:KS(u),remote:!1})),...Object.entries(t.remoteMcpServers).map(([l,u])=>({name:l,detail:YS(u),remote:!0}))],o=[...Object.entries(t.projectMcpServers).map(([l,u])=>({name:l,detail:KS(u),remote:!1})),...Object.entries(t.projectRemoteMcpServers).map(([l,u])=>({name:l,detail:YS(u),remote:!0}))];return r.jsxs(xi,{className:"flex min-h-0 flex-col",children:[r.jsxs(bi,{className:"shrink-0",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx(vi,{children:ao[t.agent]}),e?r.jsx(Xe,{size:"small",variant:e.available?"success":"warning",children:e.available?"installed":"not on PATH"}):null]}),r.jsx("p",{className:"truncate font-mono text-[11px] text-muted-foreground",title:t.configPath,children:t.exists?t.configPath:`no config — ${t.configPath}`})]}),r.jsxs(_i,{className:"min-h-0 flex-1 space-y-4 overflow-y-auto",children:[r.jsx(WS,{agent:t.agent,label:"MCP servers",mcps:n,onStage:s,scope:"user"}),o.length>0?r.jsx(WS,{agent:t.agent,label:"Project MCP servers",mcps:o,onStage:s,scope:"project"}):null,r.jsx(LH,{agent:t.agent,onStage:s,skills:t.skills})]})]})}function F3(e,t,s){const n=DH.filter(o=>o!==e.sourceAgent);return[...n.map(o=>({label:`Copy to ${ao[o]}`,onSelect:()=>t({...e,action:"copy",targetAgent:o,targetScope:s(o)})})),...n.map(o=>({label:`Move to ${ao[o]}`,onSelect:()=>t({...e,action:"move",targetAgent:o,targetScope:s(o)})})),{label:"Remove",onSelect:()=>t({...e,action:"remove"})}]}function WS({agent:e,label:t,mcps:s,scope:n,onStage:o}){return r.jsxs("section",{children:[r.jsx("h4",{className:"mb-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:t}),s.length===0?r.jsx("p",{className:"text-xs text-muted-foreground",children:"None configured."}):r.jsx("ul",{className:"space-y-1",children:s.map(l=>r.jsxs("li",{className:"group flex items-start gap-2 rounded-md border border-border/60 bg-background/60 px-2 py-1.5",children:[r.jsx("span",{className:"mt-0.5 text-muted-foreground [&_svg]:size-3.5",children:l.remote?r.jsx(KN,{}):r.jsx(lC,{})}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block text-xs font-medium",children:l.name}),r.jsx("span",{className:"block truncate font-mono text-[11px] text-muted-foreground",title:l.detail,children:l.detail})]}),o?r.jsx(mu,{items:F3({category:"mcp",name:l.name,sourceAgent:e,sourceScope:n},o,()=>n)}):null]},l.name))})]})}function LH({agent:e,skills:t,onStage:s}){return r.jsxs("section",{children:[r.jsx("h4",{className:"mb-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Skills & plugins"}),t.length===0?r.jsx("p",{className:"text-xs text-muted-foreground",children:"None installed."}):r.jsx("ul",{className:"space-y-1",children:t.map(n=>r.jsxs("li",{className:"group flex items-start gap-2 rounded-md border border-border/60 bg-background/60 px-2 py-1.5",children:[r.jsx("span",{className:"mt-0.5 text-muted-foreground [&_svg]:size-3.5",children:n.kind==="plugin"?r.jsx(jM,{}):r.jsx(pi,{})}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"truncate text-xs font-medium",children:n.name}),n.scope==="project"?r.jsx(Xe,{size:"small",variant:"outline",children:"project"}):null]}),n.kind==="plugin"&&n.pluginSkills?.length?r.jsxs("span",{className:"block truncate text-[11px] text-muted-foreground",title:n.pluginSkills.join(", "),children:[n.pluginSkills.length," skill",n.pluginSkills.length===1?"":"s",n.pluginMcps?.length?`, ${n.pluginMcps.length} MCP${n.pluginMcps.length===1?"":"s"}`:""]}):null]}),s&&n.kind!=="plugin"?r.jsx(mu,{items:F3({category:"skill",name:n.name,sourceAgent:e,sourceScope:n.scope},s,o=>o==="claude"?n.scope:"user")}):null]},`${n.scope}:${n.name}`))})]})}function KS(e){return[e.command,...e.args??[]].join(" ").trim()||"(no command)"}function YS(e){return`${e.transport} · ${e.url}`}function Nf({title:e,message:t,confirmLabel:s="Confirm",cancelLabel:n="Cancel",tone:o="default",icon:l,loading:u=!1,onConfirm:h,onCancel:f}){_.useEffect(()=>{function p(g){g.key==="Escape"&&!u&&f()}return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[f,u]);const d=o==="danger"?"destructive":o==="success"?"success":"default";return ka.createPortal(r.jsx("div",{className:"fixed inset-0 z-[1000] grid place-items-center bg-black/35 px-4",onMouseDown:()=>!u&&f(),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(Q,{disabled:u,onClick:f,size:"sm",type:"button",variant:"outline",children:n}),r.jsx(Q,{disabled:u,onClick:h,size:"sm",type:"button",variant:d,children:s})]})]})}),document.body)}function zH({pending:e,busy:t,onToggle:s,onConfirm:n,onCancel:o}){const{preview:l,skipped:u}=e,h=l.items.filter(f=>!u.has(`${f.category}:${f.name}`)).length;return r.jsx(Nf,{confirmLabel:t?"Applying...":`Apply ${h} item${h===1?"":"s"}`,icon:r.jsx(cl,{}),loading:t,message:r.jsxs("div",{className:"space-y-2",children:[r.jsxs("p",{children:["Apply profile ",r.jsx("span",{className:"font-medium text-foreground",children:l.profile})," ","to ",ao[l.agent],". A config backup is written first."]}),r.jsx("ul",{className:"max-h-56 space-y-1 overflow-y-auto",children:l.items.map(f=>{const d=`${f.category}:${f.name}`;return r.jsxs("li",{className:"flex items-start gap-2",children:[r.jsx("input",{checked:!u.has(d),className:"mt-0.5",disabled:t,id:`apply-${d}`,onChange:()=>s(d),type:"checkbox"}),r.jsxs("label",{className:"min-w-0 flex-1 cursor-pointer",htmlFor:`apply-${d}`,children:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsxs("span",{className:"truncate text-xs text-foreground",children:[f.category==="mcp"?"MCP":"Skill"," ",f.name]}),r.jsx(Xe,{size:"small",variant:f.status==="conflict"?"warning":f.status==="identical"?"outline":"success",children:f.status==="conflict"?"overwrites existing":f.status==="identical"?"already identical":"new"})]}),f.warnings.map(p=>r.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-amber-600 dark:text-amber-500",children:[r.jsx(Xi,{className:"size-3 shrink-0"}),p]},p))]})]},d)})}),l.unresolvedCredentials.length>0?r.jsxs("p",{className:"flex items-center gap-1 text-[11px] text-amber-600 dark:text-amber-500",children:[r.jsx(Xi,{className:"size-3 shrink-0"}),"Unfilled credentials applied as placeholders:"," ",l.unresolvedCredentials.join(", ")]}):null]}),onCancel:o,onConfirm:n,title:`Apply profile to ${ao[l.agent]}`,tone:"success"})}function XS(e){return e.trim().toLowerCase().replace(/[\s_]+/g,"-").replace(/[^a-z0-9.-]/g,"").replace(/-+/g,"-").replace(/^[-.]+|[-.]+$/g,"")}function BH({profileName:e,busy:t,onConfirm:s,onCancel:n}){const[o,l]=_.useState(XS(e)),[u,h]=_.useState(e),[f,d]=_.useState("1.0.0"),[p,g]=_.useState(""),x=o.trim().length>0&&u.trim().length>0,v="h-8 w-full rounded-md border border-border bg-background px-2 text-xs";return r.jsx(Nf,{confirmLabel:t?"Publishing...":"Publish",icon:r.jsx(BN,{}),loading:t,message:r.jsxs("div",{className:"space-y-2",children:[r.jsxs("p",{children:["Publish ",r.jsx("span",{className:"font-medium text-foreground",children:e})," to the registry. The uploaded archive is credential-redacted — installers supply their own secrets."]}),r.jsxs("label",{className:"block space-y-1",children:[r.jsx("span",{className:"text-[11px] font-medium",children:"Slug"}),r.jsx("input",{className:v,onChange:w=>l(XS(w.target.value)),value:o})]}),r.jsxs("label",{className:"block space-y-1",children:[r.jsx("span",{className:"text-[11px] font-medium",children:"Title"}),r.jsx("input",{className:v,onChange:w=>h(w.target.value),value:u})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs("label",{className:"block w-24 space-y-1",children:[r.jsx("span",{className:"text-[11px] font-medium",children:"Version"}),r.jsx("input",{className:v,onChange:w=>d(w.target.value),value:f})]}),r.jsxs("label",{className:"block flex-1 space-y-1",children:[r.jsx("span",{className:"text-[11px] font-medium",children:"Summary (optional)"}),r.jsx("input",{className:v,onChange:w=>g(w.target.value),value:p})]})]})]}),onCancel:n,onConfirm:()=>{!x||t||s({name:e,slug:o.trim(),title:u.trim(),version:f.trim()||void 0,summary:p.trim()||void 0})},title:"Publish to registry",tone:"success"})}const ZS=["claude","codex","antigravity"];function PH({profiles:e,loading:t,busy:s,onSnapshot:n,onApply:o,onExport:l,onImport:u,onDelete:h,onPublish:f}){const d=_.useRef(null),[p,g]=_.useState("claude"),[x,v]=_.useState(""),[w,k]=_.useState(null),C=()=>{const N=x.trim();N&&(n(p,N),v(""))};return r.jsxs("div",{className:"shrink-0 rounded-lg border border-border bg-card/80",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-border/60 px-3 py-2",children:[r.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-semibold",children:[r.jsx(Fy,{className:"size-3.5 text-muted-foreground"}),"Profiles",e.length>0?r.jsx(Xe,{size:"small",variant:"outline",children:e.length}):null]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("select",{"aria-label":"Agent to snapshot",className:"h-8 rounded-md border border-border bg-background px-2 text-xs",onChange:N=>g(N.target.value),value:p,children:ZS.map(N=>r.jsx("option",{value:N,children:ao[N]},N))}),r.jsx("input",{"aria-label":"New profile name",className:"h-8 w-36 rounded-md border border-border bg-background px-2 text-xs",onChange:N=>v(N.target.value),onKeyDown:N=>{N.key==="Enter"&&C()},placeholder:"profile name",value:x}),r.jsxs(Q,{disabled:s||x.trim().length===0,onClick:C,size:"sm",variant:"outline",children:[r.jsx(zN,{}),"Snapshot"]}),r.jsxs(Q,{disabled:s,onClick:()=>d.current?.click(),size:"sm",variant:"outline",children:[r.jsx(mf,{}),"Import"]}),r.jsx("input",{accept:".tar.gz,.tgz,application/gzip",className:"hidden",onChange:N=>{const T=N.target.files?.[0];T&&u(T),N.target.value=""},ref:d,type:"file"})]})]}),t?r.jsx("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:"Loading profiles..."}):e.length===0?r.jsx("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No profiles yet. Snapshot an agent to capture its MCPs and skills as a reusable bundle, or import a shared .tar.gz."}):r.jsx("ul",{className:"divide-y divide-border/60",children:e.map(N=>r.jsxs("li",{className:"group flex items-center gap-3 px-3 py-2",children:[r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"truncate text-xs font-medium",children:N.name}),r.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[N.mcpCount," MCP",N.mcpCount===1?"":"s"," ·"," ",N.skillCount," skill",N.skillCount===1?"":"s"]})]}),N.description?r.jsx("span",{className:"block truncate text-[11px] text-muted-foreground",children:N.description}):null]}),r.jsx(mu,{className:"opacity-100",items:[...ZS.map(T=>({label:`Apply to ${ao[T]}`,onSelect:()=>o(N.name,T)})),{label:"Export .tar.gz",icon:r.jsx(Fy,{className:"size-3.5"}),onSelect:()=>l(N.name)},{label:"Publish to registry...",icon:r.jsx(BN,{className:"size-3.5"}),onSelect:()=>f(N.name)},{label:"Delete",icon:r.jsx(gi,{className:"size-3.5"}),onSelect:()=>k(N.name)}],label:`Actions for ${N.name}`})]},N.name))}),w?r.jsx(Nf,{confirmLabel:"Delete",icon:r.jsx(gi,{}),message:`Delete profile "${w}"? Agents' live configs are not touched.`,onCancel:()=>k(null),onConfirm:()=>{h(w),k(null)},title:"Delete profile",tone:"danger"}):null]})}function IH({status:e,busy:t,signingIn:s,onSignIn:n,onSignOut:o,onInstall:l}){const[u,h]=_.useState(""),f=()=>{const d=u.trim();d&&(l(d),h(""))};return r.jsxs("div",{className:"flex shrink-0 flex-wrap items-center gap-2 rounded-lg border border-border bg-card/80 px-3 py-2",children:[r.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-semibold",children:[r.jsx(KN,{className:"size-3.5 text-muted-foreground"}),"Registry"]}),e===null?r.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Checking sign-in..."}):e.signedIn?r.jsxs(r.Fragment,{children:[r.jsx(Xe,{size:"small",variant:"success",children:e.user?.displayName||e.user?.email||"signed in"}),e.source==="env"?r.jsx("span",{className:"text-[11px] text-muted-foreground",children:"token from environment"}):r.jsxs(Q,{disabled:t,onClick:o,size:"sm",variant:"ghost",children:[r.jsx(hM,{}),"Sign out"]})]}):r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"text-[11px] text-muted-foreground",children:e.error?`Signed out (${e.error})`:"Signed out"}),r.jsxs(Q,{disabled:s,onClick:n,size:"sm",variant:"outline",children:[r.jsx(uM,{}),s?"Waiting for browser...":"Sign in"]})]}),e&&e.apiMode!=="prod"?r.jsx(Xe,{size:"small",variant:"warning",children:e.apiMode==="local"?"local registry":e.apiBaseUrl}):null,r.jsx("span",{className:"flex-1"}),r.jsx("input",{"aria-label":"Registry profile slug",className:"h-8 w-44 rounded-md border border-border bg-background px-2 text-xs",onChange:d=>h(d.target.value),onKeyDown:d=>{d.key==="Enter"&&f()},placeholder:"profile slug",value:u}),r.jsxs(Q,{disabled:t||u.trim().length===0,onClick:f,size:"sm",variant:"outline",children:[r.jsx(cl,{}),"Install"]})]})}function $H({count:e,preview:t,applying:s,onUnstage:n,onClear:o,onApply:l}){return e===0?null:r.jsxs("div",{className:"shrink-0 rounded-lg border border-border bg-card/80 shadow-sm",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border/60 px-3 py-2",children:[r.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-semibold",children:[r.jsx(ZR,{className:"size-3.5 text-muted-foreground"}),"Staged changes",r.jsx(Xe,{size:"small",variant:"outline",children:e})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Q,{disabled:s,onClick:o,size:"sm",variant:"ghost",children:"Clear"}),r.jsx(Q,{disabled:s||t!==null&&!t.valid,onClick:l,size:"sm",children:s?"Applying...":"Save & apply"})]})]}),t===null?r.jsx("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:"Validating staged changes..."}):null,r.jsx("ul",{className:"max-h-48 space-y-1 overflow-y-auto p-2",children:(t?.items??[]).map((u,h)=>r.jsxs("li",{className:"flex items-start gap-2 rounded-md border border-border/60 bg-background/60 px-2 py-1.5",children:[r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:`block text-xs ${u.ok?"":"text-destructive"}`,children:u.summary}),u.error?r.jsx("span",{className:"block text-[11px] text-destructive",children:u.error}):null,u.warnings.map(f=>r.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-amber-600 dark:text-amber-500",children:[r.jsx(Xi,{className:"size-3 shrink-0"}),f]},f))]}),r.jsx("button",{"aria-label":"Unstage change",className:"mt-0.5 text-muted-foreground transition-colors hover:text-foreground",disabled:s,onClick:()=>n(h),type:"button",children:r.jsx(Kt,{className:"size-3.5"})})]},`${u.summary}-${h}`))}),t&&t.agents.length>0?r.jsx("div",{className:"flex flex-wrap gap-2 border-t border-border/60 px-3 py-2",children:t.agents.map(u=>r.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[r.jsx("span",{className:"font-medium text-foreground",children:u.agent}),u.add.length>0?` +${u.add.length}`:"",u.remove.length>0?` −${u.remove.length}`:""]},u.agent))}):null]})}function HH(){const[e,t]=_.useState([]),[s,n]=_.useState([]),[o,l]=_.useState(null),[u,h]=_.useState(!0),[f,d]=_.useState(null),p=_.useCallback(async()=>{h(!0),d(null);try{const[g,x,v]=await Promise.all([P8(),I8(),$8()]);t(g),n(x),l(v)}catch(g){d(g instanceof Error?g.message:String(g))}finally{h(!1)}},[]);return _.useEffect(()=>{p()},[p]),{agents:e,configs:s,doctor:o,loading:u,error:f,refresh:p}}function UH(e){const[t,s]=_.useState([]),[n,o]=_.useState(!0),[l,u]=_.useState(!1),[h,f]=_.useState(null),d=us(),p=_.useCallback(async()=>{try{s(await F8())}catch{}finally{o(!1)}},[]);_.useEffect(()=>{p()},[p]);const g=_.useCallback(async j=>{if(!l){u(!0);try{await j()}catch(A){d.error(A instanceof Error?A.message:String(A))}finally{u(!1)}}},[l,d]),x=_.useCallback((j,A)=>g(async()=>{const B=await V8({agent:j,name:A});d.success(`Snapshotted ${j} into "${B.name}" (${Object.keys(B.mcps).length} MCPs, ${B.skills.length} skills)`),await p()}),[p,g,d]),v=_.useCallback((j,A)=>g(async()=>{const B=await G8(j,A),O=new Set(B.items.filter(I=>I.status==="conflict").map(I=>`${I.category}:${I.name}`));f({preview:B,skipped:O})}),[g]),w=_.useCallback(j=>{f(A=>{if(!A)return A;const B=new Set(A.skipped);return B.has(j)?B.delete(j):B.add(j),{...A,skipped:B}})},[]),k=_.useCallback(()=>g(async()=>{if(!h)return;const{preview:j,skipped:A}=h,B=await W8({name:j.profile,agent:j.agent,skip:{mcps:j.items.filter(O=>O.category==="mcp"&&A.has(`mcp:${O.name}`)).map(O=>O.name),skills:j.items.filter(O=>O.category==="skill"&&A.has(`skill:${O.name}`)).map(O=>O.name)}});f(null),d.success(`Applied "${B.profile}" to ${B.agent}: ${B.mcpsApplied.length} MCPs, ${B.skillsApplied.length} skills — ${B.backups.length} backup${B.backups.length===1?"":"s"} written`),e()}),[e,h,g,d]),C=_.useCallback(j=>g(async()=>{const{archivePath:A}=await K8(j);d.message({text:`Exported to ${A} (credentials redacted)`,preserve:!0})}),[g,d]),N=_.useCallback(j=>g(async()=>{try{const A=await Qy(j);d.success(QS(A.name,A.missingCredentials.length)),await p()}catch(A){if(!(A instanceof Error?A.message:String(A)).includes("already exists"))throw A;const O=await Qy(j,{force:!0});d.success(`${QS(O.name,O.missingCredentials.length)} (overwrote existing)`),await p()}}),[p,g,d]),T=_.useCallback(j=>g(async()=>{await q8(j),d.success(`Deleted profile "${j}"`),await p()}),[p,g,d]);return{profiles:t,loading:n,busy:l,pendingApply:h,refresh:p,snapshot:x,startApply:v,toggleSkip:w,confirmApply:k,cancelApply:()=>f(null),exportOne:C,importArchive:N,deleteOne:T}}function QS(e,t){return t>0?`Imported "${e}" — ${t} credential${t===1?"":"s"} still needed`:`Imported "${e}"`}const FH=1500,qH=300*1e3;function VH(e){const[t,s]=_.useState(null),[n,o]=_.useState(!1),[l,u]=_.useState(!1),h=_.useRef(!1),f=us(),d=_.useCallback(async()=>{try{s(await Y8())}catch{}},[]);_.useEffect(()=>(d(),()=>{h.current=!0}),[d]);const p=_.useCallback(async()=>{if(!l){u(!0);try{const{url:k,state:C}=await X8();window.open(k,"_blank","noopener");const N=Date.now()+qH;for(;Date.now()<N&&!h.current;){await new Promise(j=>setTimeout(j,FH));const T=await Z8(C).catch(()=>null);if(!(!T||T.status==="pending")){T.status==="success"?f.success("Signed in to the profile registry"):f.error(T.message??"Registry sign-in failed"),await d();return}}h.current||f.error("Registry sign-in timed out")}catch(k){f.error(k instanceof Error?k.message:String(k))}finally{u(!1)}}},[d,l,f]),g=_.useCallback(async k=>{if(n)return!1;o(!0);try{return await k(),!0}catch(C){return f.error(C instanceof Error?C.message:String(C)),!1}finally{o(!1)}},[n,f]),x=_.useCallback(()=>g(async()=>{await Q8(),f.success("Signed out of the profile registry"),await d()}),[d,g,f]),v=_.useCallback(k=>g(async()=>{try{const C=await Jy({slug:k});f.success(JS(C.name,C.missingCredentials.length))}catch(C){if(!(C instanceof Error?C.message:String(C)).includes("already exists"))throw C;const T=await Jy({slug:k,force:!0});f.success(`${JS(T.name,T.missingCredentials.length)} (overwrote existing)`)}e()}),[e,g,f]),w=_.useCallback(k=>g(async()=>{const C=await J8(k);f.message({text:`Published "${C.slug}" v${C.version} to the registry (credentials redacted)`,preserve:!0})}),[g,f]);return{status:t,busy:n,signingIn:l,refreshStatus:d,signIn:p,signOut:x,install:v,publish:w}}function JS(e,t){return t>0?`Installed "${e}" — ${t} credential${t===1?"":"s"} still needed`:`Installed "${e}" from the registry`}function GH(e,t){return e.category===t.category&&e.action===t.action&&e.name===t.name&&e.sourceAgent===t.sourceAgent&&e.sourceScope===t.sourceScope&&e.targetAgent===t.targetAgent&&e.targetScope===t.targetScope}function WH(e){const[t,s]=_.useState([]),[n,o]=_.useState(null),[l,u]=_.useState(!1),h=us(),f=_.useCallback(x=>{s(v=>v.some(w=>GH(w,x))?v:[...v,x])},[]),d=_.useCallback(x=>{s(v=>v.filter((w,k)=>k!==x))},[]),p=_.useCallback(()=>s([]),[]);_.useEffect(()=>{if(t.length===0){o(null);return}let x=!1;return H8(t).then(v=>{x||o(v)}).catch(v=>{x||o({valid:!1,agents:[],items:t.map(w=>({change:w,ok:!1,summary:`${w.action} ${w.category} "${w.name}"`,warnings:[],error:v instanceof Error?v.message:String(v)}))})}),()=>{x=!0}},[t]);const g=_.useCallback(async()=>{if(!(t.length===0||l)){u(!0);try{const x=await U8(t);if(x.ok)h.success(`Applied ${x.applied} change${x.applied===1?"":"s"} — ${x.backups.length} backup${x.backups.length===1?"":"s"} written`),s([]);else{const v=x.results.find(w=>w.error)?.error;h.error(`Applied ${x.applied} of ${t.length} changes${v?` — ${v}`:""}`),s(w=>w.slice(x.applied))}x.applied>0&&e()}catch(x){h.error(x instanceof Error?x.message:String(x))}finally{u(!1)}}},[l,e,t,h]);return{staged:t,preview:n,applying:l,stage:f,unstage:d,clear:p,apply:g}}function KH(){const{agents:e,configs:t,doctor:s,loading:n,error:o,refresh:l}=HH();vl(l);const{staged:u,preview:h,applying:f,stage:d,unstage:p,clear:g,apply:x}=WH(l),v=UH(l),w=VH(v.refresh),[k,C]=_.useState(null),N=new Map(e.map(j=>[j.agent,j])),T=s?.checks.filter(j=>j.status!=="ok")??[];return r.jsxs("div",{className:"flex h-full min-h-0 flex-col gap-4 overflow-y-auto p-4",children:[o?r.jsx(Ze,{variant:"muted",children:o}):null,n&&t.length===0?r.jsx(Ze,{variant:"muted",children:"Reading agent configurations..."}):null,T.length>0?r.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-lg border border-border bg-card/70 px-3 py-2",children:[r.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground",children:[r.jsx(v6,{className:"size-3.5"}),"Doctor"]}),T.map(j=>r.jsx(Xe,{size:"small",variant:"warning",children:j.message},j.message))]}):null,!n&&t.length===0&&!o?r.jsx(Ze,{variant:"muted",children:"No agent configurations found. Agent Environments reads Claude Code, Codex CLI, and Antigravity configs from your home directory."}):null,r.jsx(PH,{busy:v.busy,loading:v.loading,onApply:v.startApply,onDelete:v.deleteOne,onExport:v.exportOne,onImport:v.importArchive,onPublish:C,onSnapshot:v.snapshot,profiles:v.profiles}),r.jsx(IH,{busy:w.busy,onInstall:w.install,onSignIn:()=>{w.signIn()},onSignOut:w.signOut,signingIn:w.signingIn,status:w.status}),t.length>0?r.jsx("div",{className:"grid min-h-0 flex-1 grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:t.map(j=>r.jsx(OH,{availability:N.get(j.agent),config:j,onStage:d},j.agent))}):null,r.jsx($H,{applying:f,count:u.length,onApply:()=>{x()},onClear:g,onUnstage:p,preview:h}),k?r.jsx(BH,{busy:w.busy,onCancel:()=>C(null),onConfirm:j=>{w.publish(j).then(A=>{A&&C(null)})},profileName:k}):null,v.pendingApply?r.jsx(zH,{busy:v.busy,onCancel:v.cancelApply,onConfirm:()=>{v.confirmApply()},onToggle:v.toggleSkip,pending:v.pendingApply}):null]})}function Xn({children:e,icon:t,onClose:s,title:n,size:o="md"}){return _.useEffect(()=>{function l(u){u.key==="Escape"&&s()}return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[s]),ka.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(Q,{"aria-label":"Close dialog",onClick:s,size:"icon",type:"button",variant:"ghost",children:r.jsx(Kt,{})})]}),r.jsx("div",{className:"min-h-0 overflow-auto p-4",children:e})]})}),document.body)}function ht({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 YH={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 rl({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",YH[s]),children:e})]})}const Cb="application/x-nomoreide-path";function pu(e,t){return`${e.replace(/\/+$/,"")}/${t.replace(/^\/+/,"")}`}function q3(e,t){e.setData(Cb,t)}function e2(e){return e.types.includes(Cb)}function XH(e){return e.getData(Cb)||null}function V3(e){return{draggable:!0,onDragStart:t=>{q3(t.dataTransfer,e),t.dataTransfer.effectAllowed="copy"}}}const yi='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>',wi='</title><path d="',Si='"/></svg>',ZH={title:".NET",slug:"dotnet",get svg(){return yi+".NET"+wi+this.path+Si},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"}},QH={title:"Bun",slug:"bun",get svg(){return yi+"Bun"+wi+this.path+Si},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"},JH={title:"Deno",slug:"deno",get svg(){return yi+"Deno"+wi+this.path+Si},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"}},eU={title:"Docker",slug:"docker",get svg(){return yi+"Docker"+wi+this.path+Si},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"},tU={title:"Go",slug:"go",get svg(){return yi+"Go"+wi+this.path+Si},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"},sU={title:"Node.js",slug:"nodedotjs",get svg(){return yi+"Node.js"+wi+this.path+Si},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"},nU={title:"npm",slug:"npm",get svg(){return yi+"npm"+wi+this.path+Si},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"},iU={title:"pnpm",slug:"pnpm",get svg(){return yi+"pnpm"+wi+this.path+Si},path:"M0 0v7.5h7.5V0zm8.25 0v7.5h7.498V0zm8.25 0v7.5H24V0zM2 2h3.5v3.5H2zm8.25 0h3.498v3.5H10.25zm8.25 0H22v3.5h-3.5zM8.25 8.25v7.5h7.498v-7.5zm8.25 0v7.5H24v-7.5zm2 2H22v3.5h-3.5zM0 16.5V24h7.5v-7.5zm8.25 0V24h7.498v-7.5zm8.25 0V24H24v-7.5z",source:"https://pnpm.io/logos",hex:"F69220"},rU={title:"Python",slug:"python",get svg(){return yi+"Python"+wi+this.path+Si},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/"},t2={title:"Rust",slug:"rust",get svg(){return yi+"Rust"+wi+this.path+Si},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"}},aU={title:"Vite",slug:"vite",get svg(){return yi+"Vite"+wi+this.path+Si},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"},oU={title:"Yarn",slug:"yarn",get svg(){return yi+"Yarn"+wi+this.path+Si},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 lU(e){const t=e.toLowerCase();return/\bvite\b/.test(t)?Dn.vite:/\bcargo\s+/.test(t)?Dn.cargo:/\brustc\b/.test(t)?Dn.rust:/\bdotnet\b/.test(t)?Dn.dotnet:/\bdocker(?:\s+compose|-compose|\s+)/.test(t)?Dn.docker:/\bpython3?\b|\buvicorn\b|\bfastapi\b/.test(t)?Dn.python:/\bgo\s+(run|test|build)\b|\bair\b/.test(t)?Dn.go:/\bbun\b/.test(t)?Dn.bun:/\bdeno\b/.test(t)?Dn.deno:/\bpnpm\b/.test(t)?Dn.pnpm:/\byarn\b/.test(t)?Dn.yarn:/\bnpm\b/.test(t)?Dn.npm:/\bnode\b/.test(t)?Dn.node:Dn.generic}const Dn={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 Eb({command:e,compact:t}){const s=lU(e),n=cU[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(ml,{className:t?"size-3.5":"size-4"})})}const cU={bun:QH,cargo:t2,deno:JH,dotnet:ZH,docker:eU,generic:null,go:tU,node:sU,npm:nU,pnpm:iU,python:rU,rust:t2,vite:aU,yarn:oU};function li({className:e,...t}){return r.jsx("label",{className:de("grid gap-1.5 text-xs font-medium text-muted-foreground",e),...t})}const uU=[{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"}],s2=[{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 dU({result:e}){const t=[...e.stdout,...e.stderr].slice(0,4);return r.jsxs(Ze,{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 hU(e,t,s,n){if(t==="bundle"){if(e==="start")return cw(s,()=>n?.());if(e==="stop")return ow(s);await ow(s),await cw(s,()=>n?.());return}return e==="start"?CC(s):e==="stop"?cL(s):EC(s)}function jb({active:e,baseUrl:t,compact:s=!1,onRefresh:n,onStarted:o,resourceKind:l,resourceName:u,solidStart:h=!1,targetLabel:f}){return e?r.jsxs(r.Fragment,{children:[r.jsx(pg,{baseUrl:t,compact:s,intent:"restart",icon:r.jsx(au,{}),label:"Restart",op:"restart",resourceKind:l,resourceName:u,targetLabel:f,onRefresh:n,onSuccess:o}),r.jsx(pg,{baseUrl:t,compact:s,intent:"stop",icon:r.jsx(ro,{}),label:"Stop",op:"stop",resourceKind:l,resourceName:u,targetLabel:f,onRefresh:n})]}):r.jsx(pg,{baseUrl:t,compact:s,intent:h?"startSolid":"start",icon:r.jsx(er,{}),label:"Start",op:"start",resourceKind:l,resourceName:u,targetLabel:f,onRefresh:n,onSuccess:o})}function Wh(e,t,s){const n=s instanceof Error?s.message:String(s);return`${e} failed for ${t}: ${n}`}function pg({baseUrl:e,compact:t=!1,intent:s="neutral",icon:n,label:o,op:l,resourceKind:u,resourceName:h,targetLabel:f,onRefresh:d,onSuccess:p}){const[g,x]=_.useState(!1),[v,w]=_.useState(null),{error:k,success:C}=us();async function N(j=!1){x(!0);try{j?await Ri(`${e}/start`,{strategy:"killHolder"}):await hU(l,u,h,()=>d()),C(`${o} requested for ${f}.`),await d(),w(null),p?.()}catch(A){A instanceof dC?w(A.conflict):k(Wh(o,f,A))}finally{x(!1)}}const T=r.jsxs(Q,{"aria-label":o,className:`${mU[s]} ${t?"size-7":""}`.trim(),disabled:g,onClick:()=>N(),size:t?"icon":"sm",variant:"outline",children:[n,t?null:o]});return r.jsxs(r.Fragment,{children:[t?r.jsx(rl,{label:o,children:T}):T,v?r.jsx(fU,{busy:g,conflict:v,onCancel:()=>w(null),onKillAndStart:()=>N(!0),targetLabel:f}):null]})}function fU({busy:e,conflict:t,onCancel:s,onKillAndStart:n,targetLabel:o}){const l=t.holder,u=`http://localhost:${t.port}/`;return r.jsx(Xn,{icon:r.jsx(uC,{}),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(Q,{onClick:s,size:"sm",type:"button",variant:"outline",disabled:e,children:"Cancel"}),r.jsxs(Q,{onClick:()=>{gf(u)},size:"sm",type:"button",variant:"outline",disabled:e,children:[r.jsx(Ar,{}),"Open in browser"]}),r.jsx(Q,{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 mU={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 pU({cwd:e,onRefresh:t,onSaved:s,initialService:n}){const{error:o,success:l}=us(),u=!!n,[h,f]=_.useState(n?.kind??"local"),[d,p]=_.useState(n?.name??""),[g,x]=_.useState(n?.command??""),[v,w]=_.useState(n?.cwd??e),[k,C]=_.useState(n?.port?String(n.port):""),[N,T]=_.useState(n?.description??""),[j,A]=_.useState(n?.composeFile??""),[B,O]=_.useState(n?.composeService??""),[I,R]=_.useState(n?.host??""),[D,P]=_.useState(n?.dependsOn??[]),[G,Z]=_.useState(null),[$,q]=_.useState(!1);_.useEffect(()=>{Z(null)},[g,v,k,h]);function F(){p(""),x(""),w(e),C(""),T(""),A(""),O(""),R(""),P([]),Z(null)}async function L(U){U.preventDefault();try{const K={name:d,kind:h,cwd:v,port:k,description:N};(h==="local"||h==="ssh")&&(K.command=g),h==="docker-compose"&&(K.composeFile=j,K.composeService=B),h==="ssh"&&(K.host=I),K.dependsOn=D.filter(Y=>Y!==d).join(","),await Ri("/api/services",K),u||F(),l(u?`${d} updated.`:`${d} added.`),await t(),s?.()}catch(K){o(Wh(u?"Update service":"Add service",d||"service",K))}}async function X(){if(!g.trim()){o("Test command failed for service: command is required.");return}q(!0);try{Z(await xL({command:g,cwd:v,port:k}))}catch(U){o(Wh("Test command",d||"service",U))}finally{q(!1)}}return{editing:u,kind:h,setKind:f,name:d,setName:p,command:g,setCommand:x,formCwd:v,setFormCwd:w,port:k,setPort:C,description:N,setDescription:T,composeFile:j,setComposeFile:A,composeService:B,setComposeService:O,host:I,setHost:R,dependsOn:D,setDependsOn:P,testResult:G,testing:$,submit:L,testCommand:X}}function n2({cwd:e,onRefresh:t,onSaved:s,initialService:n,availableServices:o=[]}){const{editing:l,kind:u,setKind:h,name:f,setName:d,command:p,setCommand:g,formCwd:x,setFormCwd:v,port:w,setPort:k,description:C,setDescription:N,composeFile:T,setComposeFile:j,composeService:A,setComposeService:B,host:O,setHost:I,dependsOn:R,setDependsOn:D,testResult:P,testing:G,submit:Z,testCommand:$}=pU({cwd:e,onRefresh:t,onSaved:s,initialService:n}),q=s2.find(Y=>Y.value===u),F=o.filter(Y=>Y!==f),L=Y=>D(V=>V.includes(Y)?V.filter(ie=>ie!==Y):[...V,Y]),X=u==="local"&&p.trim().length>0&&x.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:Z,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:s2.map(Y=>r.jsx(Q,{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:q.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(li,{children:["Name",r.jsx(ht,{className:"h-8 text-sm",name:"name",onChange:Y=>d(Y.target.value),placeholder:"backend",readOnly:l,required:!0,value:f}),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(li,{children:["Description",r.jsx(ht,{className:"h-8 text-sm",name:"description",onChange:Y=>N(Y.target.value),placeholder:"API server",value:C})]})]}),r.jsxs("fieldset",{className:U,children:[r.jsx("legend",{className:K,children:"Step 4 · Networking (optional)"}),r.jsxs(li,{children:["Port",r.jsx(ht,{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:uU.map(Y=>r.jsxs(Q,{className:"justify-start gap-1.5",onClick:()=>{g(Y.command),N(Y.description)},size:"sm",type:"button",variant:"outline",children:[r.jsx(Eb,{command:Y.badgeCommand??Y.command,compact:!0}),r.jsx("span",{className:"truncate",children:Y.label})]},Y.label))}),r.jsxs(li,{children:["Command",r.jsx(ht,{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(li,{children:["Working Directory",r.jsx(ht,{className:"h-8 font-mono text-sm",name:"cwd",onChange:Y=>v(Y.target.value),required:!0,value:x})]})]}):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(li,{children:["Compose Service",r.jsx(ht,{className:"h-8 font-mono text-sm",name:"composeService",onChange:Y=>B(Y.target.value),placeholder:"api",required:!0,value:A})]}),r.jsxs(li,{children:["Compose File (optional)",r.jsx(ht,{className:"h-8 font-mono text-sm",name:"composeFile",onChange:Y=>j(Y.target.value),placeholder:"docker-compose.yml",value:T})]}),r.jsxs(li,{children:["Working Directory (where compose file lives)",r.jsx(ht,{className:"h-8 font-mono text-sm",name:"cwd",onChange:Y=>v(Y.target.value),required:!0,value:x})]})]}):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(li,{children:["SSH Host (alias from ~/.ssh/config)",r.jsx(ht,{className:"h-8 font-mono text-sm",name:"host",onChange:Y=>I(Y.target.value),placeholder:"devbox",required:!0,value:O})]}),r.jsxs(li,{children:["Remote Command",r.jsx(ht,{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(li,{children:["Remote Working Directory",r.jsx(ht,{className:"h-8 font-mono text-sm",name:"cwd",onChange:Y=>v(Y.target.value),placeholder:"/srv/app",required:!0,value:x})]}),r.jsxs(Ze,{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 ",O||"<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 ",O||"<alias>"]})," using that config."]})]})]}):null,F.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:F.map(Y=>r.jsx(Q,{className:"h-7 px-2.5 text-xs",onClick:()=>L(Y),size:"sm",type:"button",variant:R.includes(Y)?"default":"outline",children:Y},Y))})]}):null]}),P?r.jsx(dU,{result:P}):null,r.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[u==="local"?r.jsxs(Q,{disabled:G||!X,onClick:$,type:"button",variant:"outline",children:[r.jsx(ml,{}),G?"Testing...":"Test Command"]}):null,r.jsx(Q,{type:"submit",children:l?"Save Service":"Add Service"})]})]})}function G3({initialName:e="",initialServices:t=[],onSaved:s,onRefresh:n,originalName:o,services:l,submitLabel:u="Save Group"}){const{error:h,success:f}=us();async function d(p){p.preventDefault();const g=p.currentTarget,x=new FormData(g),v=String(x.get("name")??""),w=x.getAll("services").map(k=>String(k)).filter(Boolean);try{await Ri("/api/bundles",{name:v,originalName:o,services:w.join(",")}),g.reset(),f(`${v} group saved.`),await n(),s?.()}catch(k){h(Wh("Save group",v||"group",k))}}return r.jsxs("form",{className:"grid gap-2.5",onSubmit:d,children:[r.jsxs(li,{children:["Group name",r.jsx(ht,{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(Eb,{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(Ze,{variant:"muted",children:"All services are already grouped, or none registered."})]}),r.jsx(Q,{className:"h-8",disabled:!l.length,type:"submit",children:u})]})}function gU({allServices:e,group:t,onRefresh:s,ports:n,services:o,health:l,statuses:u,timeline:h,selectedService:f,onSelectService:d,onDropService:p}){const[g,x]=_.useState(!1),[v,w]=_.useState(!1),[k,C]=_.useState(!1),N=o.some(A=>Vc(u[A.name]?.state));function T(A){!p||!A.dataTransfer.types.includes(tu)||(A.preventDefault(),A.dataTransfer.dropEffect="copy",C(!0))}function j(A){if(!p)return;A.preventDefault(),C(!1);const B=A.dataTransfer.getData(tu);B&&p(B)}return r.jsxs("section",{className:de("transition-colors",k&&"bg-primary/5 outline-dashed outline-2 -outline-offset-2 outline-primary/60"),onDragOver:T,onDragLeave:()=>C(!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(A=>!A),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(Xe,{size:"small",variant:"secondary",children:t.services.length}):null]}),r.jsx(rl,{label:"Edit group",children:r.jsx(Q,{"aria-expanded":g,"aria-label":`Edit ${t.name}`,className:"size-7",onClick:()=>x(A=>!A),size:"icon",type:"button",variant:"ghost",children:r.jsx(ul,{})})}),r.jsx(jb,{active:N,baseUrl:`/api/bundles/${encodeURIComponent(t.name)}`,compact:!0,resourceKind:"bundle",resourceName:t.name,solidStart:!0,targetLabel:`group ${t.name}`,onRefresh:s,onStarted:()=>{const A=o[0];A&&d(A.name)}})]}),g?r.jsx("div",{className:"border-t border-border bg-background/65 p-3",children:r.jsx(G3,{initialName:t.name,initialServices:t.services,onRefresh:s,onSaved:()=>x(!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(A=>r.jsx(W3,{service:A,status:u[A.name],health:l[A.name],ports:n,onRefresh:s,timeline:h,selected:f===A.name,onSelect:()=>d(A.name)},A.name)):r.jsx(Ze,{variant:"muted",className:"m-4",children:"This group does not match any registered services."})})]})}function W3({service:e,status:t,onRefresh:s,selected:n=!1,onSelect:o}){const l=t?.state??"stopped",u=Vc(l),[h,f]=_.useState(!1);return r.jsxs("div",{"aria-selected":n,draggable:!0,onDragStart:d=>{d.dataTransfer.setData(tu,e.name),e.cwd&&q3(d.dataTransfer,e.cwd),d.dataTransfer.effectAllowed="copyMove",f(!0)},onDragEnd:()=>f(!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(Eb,{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(xU,{kind:e.kind}),e.port?r.jsxs("span",{children:[":",e.port]}):null]})]}),r.jsx(vU,{state:l}),r.jsx("span",{className:"flex items-center gap-1",onClick:d=>d.stopPropagation(),children:r.jsx(jb,{active:u,baseUrl:`/api/services/${encodeURIComponent(e.name)}`,compact:!0,resourceKind:"service",resourceName:e.name,targetLabel:e.name,onRefresh:s,onStarted:o})})]})}const tu="application/x-nomoreide-service",i2={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 xU({kind:e}){const t=i2[e??"local"]??i2.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 Vc(e){return e==="running"||e==="starting"}function bU(e){return`http://127.0.0.1:${e}`}const r2={running:{className:"bg-emerald-500"},starting:{className:"bg-amber-500",pulse:!0},exited:{className:"bg-red-500"},stopped:{className:"bg-muted-foreground/40"}};function vU({state:e}){const t=r2[e]??r2.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 K3({state:e}){return r.jsx(Xe,{variant:e==="running"?"success":e==="exited"?"danger":e==="starting"?"warning":"outline",className:de(e==="running"&&"font-mono"),children:e})}function _U({data:e}){const[t,s]=_.useState(!1),[n,o]=_.useState(()=>FS()),[l,u]=_.useState(""),[h,f]=_.useState([]),[d,p]=_.useState([]),[g,x]=_.useState(null),{sendToAgent:v}=Pt();_.useEffect(()=>{if(!t)return;let j=!0;return x(null),Promise.allSettled([xC(),_C(20)]).then(A=>{if(!j)return;const[B,O]=A;B.status==="fulfilled"&&f(B.value),O.status==="fulfilled"&&p(O.value),A.filter(R=>R.status==="rejected").length&&x("Some AI context could not be loaded. You can still send available context.")}),()=>{j=!1}},[t]);const w=_.useMemo(()=>yU(e),[e]),k=V$(n),C=_.useMemo(()=>n.serviceNames.length+n.databaseNames.length+n.errorIds.length+n.repositoryPaths.length,[n]);function N(j,A){o(B=>{const O=B[j],I=O.includes(A)?O.filter(R=>R!==A):[...O,A];return{...B,[j]:I}})}function T(){k&&(v({prompt:G$({dashboard:e,databases:h,incidents:d,note:l,selection:n}),source:{type:"workspace-context",label:"AI Diagnose"},label:W$({note:l,selection:n})}),s(!1),u(""),o(FS()))}return r.jsxs(r.Fragment,{children:[r.jsxs("button",{"aria-label":"Open AI Diagnose",className:Fh(),onClick:()=>s(!0),title:"Open AI Diagnose",type:"button",children:[r.jsx("span",{className:qh(),children:r.jsx(Gt,{className:"size-4"})}),r.jsx("span",{className:Vh(),children:"Diagnose"})]}),t?r.jsx(Xn,{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(Xe,{variant:C?"secondary":"outline",children:[C," selected"]})]}),g?r.jsx(Ze,{variant:"muted",children:g}):null,r.jsxs("div",{className:"grid min-h-0 gap-3 overflow-hidden lg:grid-cols-4",children:[r.jsx(Xd,{count:e.config.services.length,icon:r.jsx(iC,{}),title:"Services",children:r.jsx("div",{className:"grid gap-2",children:e.config.services.map(j=>{const A=n.serviceNames.includes(j.name),B=e.runtime.services[j.name],O=e.health[j.name];return r.jsxs(Zd,{selected:A,onClick:()=>N("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(K3,{state:B?.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,O?.status?r.jsx("span",{children:O.status}):null]})]},j.name)})})}),r.jsx(Xd,{count:h.length,icon:r.jsx(mi,{}),title:"Databases",children:h.length?r.jsx("div",{className:"grid gap-2",children:h.map(j=>r.jsxs(Zd,{selected:n.databaseNames.includes(j.name),onClick:()=>N("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(a2,{text:"No database connections detected."})}),r.jsx(Xd,{count:d.length,icon:r.jsx(Mh,{}),title:"Error Inbox",children:d.length?r.jsx("div",{className:"grid gap-2",children:d.map(j=>r.jsxs(Zd,{selected:n.errorIds.includes(j.id),onClick:()=>N("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(Xe,{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(a2,{text:"No recent incidents."})}),r.jsx(Xd,{count:w.length,icon:r.jsx(bn,{}),title:"Git Repositories",children:r.jsx("div",{className:"grid gap-2",children:w.map(j=>{const A=n.repositoryPaths.includes(j.path),B=j.path===(e.git.selectedRepository?.path??e.git.cwd),O=B?e.git.status?.files.length??0:void 0;return r.jsxs(Zd,{selected:A,onClick:()=>N("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}),B?r.jsx(Xe,{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}),O!==void 0?r.jsx("span",{className:"mt-1 block truncate text-[11px] text-muted-foreground",children:O?`${O} changed file${O===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(Q,{onClick:()=>s(!1),type:"button",variant:"outline",children:"Cancel"}),r.jsxs(Q,{className:"gap-2",disabled:!k,onClick:T,type:"button",children:[r.jsx(a6,{className:"size-4"}),"Send"]})]})]})}):null]})}function Xd({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(Xe,{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 Zd({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 a2({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 yU(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 wU(e){const t=NU(e.capabilities);return t?`${e.prompt}
|
|
90
|
-
|
|
91
|
-
${t}`:e.prompt}function SU({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:",CU(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 kU({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 NU(e){if(!e)return"";const t=[Qd("Skills",e.skills),Qd("MCP servers",e.mcpServers),Qd("Plugins",e.plugins),Qd("Hooks/context",e.hooks)].filter(Boolean);return t.length?["Use these selected capabilities if they are available and relevant:",...t,"If a selected capability is unavailable, say so briefly and continue with the best fallback."].join(`
|
|
94
|
-
`):""}function Qd(e,t){const s=Array.from(new Set((t??[]).map(n=>n.trim()).filter(Boolean)));return s.length?`- ${e}: ${s.join(", ")}`:""}function CU(e){return e.kind==="agent"?e.prompt:e.kind==="gate"?`Gate: ${e.message}`:`Action: ${e.op}`}const o2=/^[ \t>*_-]*WORKFLOW_STATUS:\s*(ok|blocked)\b[ \t]*[—–:-]?[ \t]*(.*)$/im,EU=/^[ \t>*_-]*BRANCH_NAME:\s*`?([A-Za-z0-9][A-Za-z0-9._/-]{0,127})`?\s*$/im,jU=/^[A-Za-z0-9][A-Za-z0-9._/-]{0,127}$/;function AU(e){const t=e.match(o2);if(t){const s=t[1].toLowerCase()==="blocked",n=t[2]?.trim()||void 0;return{output:e.replace(o2,"").trim(),blocked:s,reason:s?n:void 0}}return{output:e,blocked:TU(e)}}function TU(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 RU(e){const t=e.match(EU);if(t&&l2(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(l2(o))return o}return null}function l2(e){return!(!jU.test(e)||e==="main"||e==="master"||e.includes("..")||e.endsWith(".")||e.endsWith("/"))}const MU="\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 DU(e){const{sendToAgent:t,streaming:s,turns:n}=Pt(),[o,l]=_.useState(null),u=_.useRef(n);_.useEffect(()=>{u.current=n},[n]);const h=_.useRef(o);_.useEffect(()=>{h.current=o},[o]);const f=_.useRef(!1),d=_.useRef(!1),p=_.useRef(null),g=_.useRef(null),x=_.useRef(!1);_.useEffect(()=>{if(s)x.current=!0;else if(x.current&&g.current){const R=g.current;g.current=null,R()}},[s]);const v=_.useCallback(()=>new Promise(R=>{p.current=R}),[]),w=_.useCallback(()=>new Promise(R=>{let D=!1;const P=()=>{D||(D=!0,clearTimeout(G),g.current=null,R())};g.current=P;const G=setTimeout(()=>{x.current||P()},8e3)}),[]),k=_.useCallback(async R=>{const D=await Yp();return R==="committed"?D.files.length===0:R==="pushed"?D.ahead===0:!0},[]),C=_.useCallback(async(R,D,P)=>{if(R.op==="assert-pr-branch"){BU(await Yp());return}if(R.op==="push"){await xf();return}if(R.op==="checkout-default-and-pull"){await SO();return}if(R.op==="commit"){const G=await Yp();if(!G.files.length)throw new Error("Nothing to commit — the working tree is clean.");const Z=zU(G.files);Z.length&&await K0(Z),await SC(LU(P,D,G.files));return}throw new Error(`Unknown action: ${R.op}`)},[]),N=_.useCallback(async(R,D,P)=>{if(f.current)return;f.current=!0,d.current=!1;const G=P?.index??0,Z=R.steps.map((L,X)=>P&&X<G?P.statuses[X]??"pending":"pending"),$=R.steps.map((L,X)=>P?.outputs[X]??""),q=(L,X,U)=>{Z[L]=X,l(K=>K&&{...K,index:L,statuses:[...Z],outputs:[...$],...U})};l({workflow:R,startedAt:P?.startedAt??Date.now(),index:G,statuses:[...Z],outputs:[...$],error:null,outcome:"running"});const F=L=>{f.current=!1,l(X=>X&&{...X,outcome:L,endedAt:Date.now()})};for(let L=G;L<R.steps.length;L++){const X=R.steps[L];if(X.kind==="gate"){q(L,"waiting");const K=await v();if(p.current=null,K==="stop"){q(L,"skipped"),F("stopped");return}q(L,K==="skip"?"skipped":"done");continue}if(X.kind==="action"){q(L,"running");try{await C(X,L,$),q(L,"done"),e?.()}catch(K){if(X.op==="assert-pr-branch"){q(L,"blocked",{error:c2(K)}),F("blocked");return}q(L,"failed",{error:c2(K)}),F("failed");return}if(d.current)return F("stopped");continue}q(L,"running"),x.current=!1,t({prompt:wU(X)+MU,source:{type:"workflow",label:`${R.name}: ${X.title}`},mode:"send",label:X.title,autoApprove:D,background:!0,isolated:X.isolated}),await w(),e?.();const U=AU(OU(u.current));if($[L]=U.output||"(no reply — see the dock)",U.blocked){q(L,"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."}),F("blocked");return}if(X.verify&&!await k(X.verify).catch(()=>!1)){q(L,"failed",{error:X.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."}),F("failed");return}if(q(L,"done"),d.current)return F("stopped")}F("done")},[e,C,t,k,w,v]),T=_.useCallback((R,D=!1)=>N(R,D),[N]),j=_.useCallback((R=!1)=>{const D=h.current;!D||D.outcome==="running"||f.current||N(D.workflow,R,{index:D.index,statuses:D.statuses,outputs:D.outputs,startedAt:D.startedAt})},[N]),A=_.useCallback(()=>p.current?.("approve"),[]),B=_.useCallback(()=>p.current?.("skip"),[]),O=_.useCallback(()=>{d.current=!0,p.current?.("stop")},[]),I=_.useCallback(()=>{f.current||l(null)},[]);return{run:o,start:T,resume:j,approve:A,skip:B,stop:O,dismiss:I,isRunning:!!o&&o.outcome==="running"}}function c2(e){return e instanceof Error?e.message:String(e)}function OU(e){for(let t=e.length-1;t>=0;t--)if(e[t].role==="assistant")return e[t].text.trim();return""}function LU(e,t,s){return e[t-1]?.trim()||IU(s)}function zU(e){return e.some(s=>s.index.trim()&&s.index!=="?")?[]:e.map(s=>s.path)}function BU(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(!PU(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 PU(e){return e==="main"||e==="master"}function IU(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 Y3=_.createContext(null);function $U({onRefresh:e,children:t}){const s=DU(e);return r.jsx(Y3.Provider,{value:s,children:t})}function X3(){const e=_.useContext(Y3);if(!e)throw new Error("useWorkflowRun must be used within a WorkflowRunProvider");return e}const Z3=_.createContext(null);function HU({children:e}){const{start:t,isRunning:s}=X3(),[n,o]=_.useState([]),[l,u]=_.useState([]),[h,f]=_.useState([]),[d,p]=_.useState(null),g=_.useRef(new Set),x=_.useCallback(N=>{u(T=>[N,...T.filter(j=>j.id!==N.id)])},[]);_.useEffect(()=>{let N=!0;Promise.all([VL().catch(()=>[]),TC().catch(()=>[]),KL().catch(()=>[])]).then(([j,A,B])=>{N&&(o(Array.isArray(j)?j:[]),f(Array.isArray(A)?A:[]),u(Array.isArray(B)?B:[]))});const T=new EventSource("/api/workflow-triggers/pending/stream");return T.addEventListener("pending",j=>{try{x(JSON.parse(j.data))}catch{}}),()=>{N=!1,T.close()}},[x]);const v=_.useCallback(async N=>{u(T=>T.filter(j=>j.id!==N)),await YL(N).catch(()=>{})},[]),w=_.useCallback(N=>{const T=h.find(j=>j.id===N.workflowId);g.current.add(N.id),v(N.id),T?t(T,!0):p(`Trigger references a missing workflow: ${N.workflowId}`)},[h,t,v]);_.useEffect(()=>{if(s)return;const N=[...l].reverse().find(T=>T.autoRun&&!g.current.has(T.id));N&&w(N)},[l,s,w]);const k=_.useCallback(async N=>{try{o(await GL(N)),p(null)}catch(T){p(T instanceof Error?T.message:String(T))}},[]),C=_.useCallback(async N=>{try{o(await WL(N))}catch(T){p(T instanceof Error?T.message:String(T))}},[]);return r.jsx(Z3.Provider,{value:{triggers:n,pending:l,workflows:h,error:d,saveTrigger:k,removeTrigger:C,runPending:w,dismissPending:v},children:e})}function UU(){const e=_.useContext(Z3);if(!e)throw new Error("useWorkflowTriggers must be used within a WorkflowTriggerProvider");return e}function FU({git:e,onRefresh:t}){const{sendToAgent:s}=Pt(),[n,o]=_.useState(!1),[l,u]=_.useState(null),[h,f]=_.useState(null),d=e.status,p=d?.branch||void 0,g=d?.files.length??0,x=d?.ahead??0,v=d?.behind??0;_.useEffect(()=>{if(!p){f(null);return}let C=!0;return fh(p,1).then(N=>{if(!C)return;const T=N[0];f(T&&qU(T)?T:null)}).catch(()=>{C&&f(null)}),()=>{C=!1}},[p]);const w=_.useMemo(()=>g>0||x>0||v>0||!!h,[g,x,v,h]);if(!d||!w)return null;async function k(){o(!0),u(null);try{await xf(),t?.()}catch(C){u(C instanceof Error?C.message:String(C))}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(Jd,{icon:r.jsx(RR,{className:"size-3"}),label:`Commit ${g} change${g===1?"":"s"}`,ai:!0,onClick:()=>s({prompt:z$({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(Jd,{icon:r.jsx(cf,{className:"size-3"}),label:`Pull ${v} behind`,ai:!0,onClick:()=>s({prompt:B$({branch:p,behind:v,upstream:d.upstream}),source:{type:"git-situation",label:"behind upstream"},mode:"send",label:`Pull & rebase (${v} behind)`})}):null,x>0?r.jsx(Jd,{icon:n?r.jsx(Et,{className:"size-3 animate-spin"}):r.jsx(mf,{className:"size-3"}),label:`Push ${x}`,disabled:n,onClick:()=>{k()}}):null,h?r.jsx(Jd,{danger:!0,icon:r.jsx(Xi,{className:"size-3"}),label:"Fix failing CI",ai:!0,onClick:()=>s({prompt:P$({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 Jd({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 qU(e){return e.status==="completed"&&e.conclusion!==null&&!["success","neutral","skipped"].includes(e.conclusion)}const VU=new Set(["c","cpp","cs","go","java","js","jsx","kt","mjs","py","rs","swift","ts","tsx"]),GU=new Set([".env",".gitignore","components.json","dockerfile","package.json","tsconfig.json","vite.config.ts"]),WU=new Set(["conf","config","ini","toml","yaml","yml"]),KU=new Set(["csv","json","sql","xml"]),YU=new Set(["md","mdx","rst","txt"]),XU=new Set(["gif","jpeg","jpg","png","svg","webp"]),ZU=new Set(["package-lock.json","pnpm-lock.yaml","yarn.lock"]),QU=new Set(["css","less","sass","scss"]);function JU(e){const t=e.split("/").pop()?.toLowerCase()??e.toLowerCase(),s=t.includes(".")?t.split(".").pop()??"":"";return ZU.has(t)||t.endsWith(".lock")?"lock":eF(t)?"test":GU.has(t)||WU.has(s)?"config":QU.has(s)?"style":XU.has(s)?"image":YU.has(s)?"document":KU.has(s)?"data":VU.has(s)?"code":"generic"}function eF(e){return e.includes(".test.")||e.includes(".spec.")||e.endsWith("_test.go")}function Ab({path:e,className:t}){const s=JU(e),n=tF[s];return r.jsx(n,{"aria-label":`${s} file`,className:de("size-3.5 shrink-0",sF[s],t)})}const tF={code:HN,config:c6,data:mi,document:V0,generic:qN,image:WR,lock:rM,style:TM,test:yR},sF={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 nF(e){const t=e.lastIndexOf(".");return t>0?e.slice(t):""}function iF({onPick:e,onClose:t}){const[s,n]=_.useState(""),[o,l]=_.useState(null),[u,h]=_.useState(null),[f,d]=_.useState(!1),p=_.useRef(null),g=o?o.parent!==o.path:!1;return _.useEffect(()=>{function x(v){p.current&&!p.current.contains(v.target)&&t()}return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[t]),_.useEffect(()=>{let x=!0;return d(!0),h(null),AC(s,{files:!0}).then(v=>x&&l(v)).catch(v=>x&&h(v instanceof Error?v.message:String(v))).finally(()=>x&&d(!1)),()=>{x=!1}},[s]),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(Q,{"aria-label":"Parent folder",className:"size-7",disabled:!g,onClick:()=>o&&n(o.parent),size:"icon",type:"button",variant:"ghost",children:r.jsx(df,{})}),r.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-muted-foreground",title:o?.path,children:o?.path??"…"}),f?r.jsx(Et,{className:"size-3.5 animate-spin text-muted-foreground"}):null,o?r.jsxs(Q,{className:"h-7 px-2 text-[11px]",onClick:()=>e(o.path),size:"sm",title:"Attach this folder",type:"button",variant:"outline",children:[r.jsx(eR,{})," This folder"]}):null,r.jsx(Q,{"aria-label":"Close",className:"size-7",onClick:t,size:"icon",type:"button",variant:"ghost",children:r.jsx(Kt,{})})]}),r.jsx("div",{className:"max-h-64 overflow-auto p-1",children:u?r.jsx(Ze,{variant:"destructive",className:"m-1",children:u}):o&&o.entries.length===0?r.jsx(Ze,{variant:"muted",className:"m-1 text-center",children:"Empty folder."}):o?.entries.map(x=>{const v=x.isDir?"":nF(x.name);return r.jsxs("button",{className:"flex w-full items-center gap-1.5 rounded-sm px-2 py-1 text-left text-[12px] hover:bg-muted",onClick:()=>x.isDir?n(x.path):e(x.path),title:x.path,type:"button",children:[x.isDir?r.jsx(va,{className:"size-3.5 shrink-0 text-amber-600"}):r.jsx(Ab,{path:x.path}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:x.name}),v?r.jsx("span",{className:"shrink-0 rounded bg-muted px-1 font-mono text-[10px] text-muted-foreground",children:v}):null]},x.path)})})]})}const rF=/```options[^\n]*\n([\s\S]*?)```/g,aF=/```service[^\n]*\n([\s\S]*?)```/g,oF=/```sql-write[^\S\n]*([^\n]*)\n([\s\S]*?)```/g,lF=/```(?:options|service|sql-write)[^\n]*\n[\s\S]*$/;function cF(e){const t=[];let s=null,n=null,o=e.replace(rF,(l,u)=>{for(const h of u.split(`
|
|
95
|
-
`)){const f=h.replace(/^[-*\d.)\s]+/,"").trim();f&&t.push(f)}return""});return o=o.replace(aF,(l,u)=>{const h=u.split(`
|
|
96
|
-
`).map(f=>f.trim()).find(Boolean);return h&&(s=h),""}),o=o.replace(oF,(l,u,h)=>{const f=h.trim();return f&&(n={connection:u.trim(),sql:f}),""}),o=o.replace(lF,""),{body:o.trim(),options:t,service:s,sqlWrite:n}}function uF({options:e,disabled:t,onChoose:s}){return r.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.map(n=>r.jsx(Q,{className:"h-7",disabled:t,onClick:()=>s(n),size:"sm",type:"button",variant:"outline",children:n},n))})}function dF({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(Q,{className:"h-7",onClick:()=>t(e),size:"sm",type:"button",children:[r.jsx(er,{})," Start"]}),s?r.jsxs(Q,{className:"h-7",onClick:()=>s(e),size:"sm",type:"button",variant:"outline",children:[r.jsx(Ar,{})," Open"]}):null]})]})}function hF({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(mi,{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(Q,{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(Ar,{})," Open in SQL console"]})]})}function Tb(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ho=Tb();function Q3(e){ho=e}var Za={exec:()=>null};function Xo(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(on.caret,"$1"),s=s.replace(o,u),n},getRegex:()=>new RegExp(s,t)};return n}var fF=((e="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+e)}catch{return!1}})(),on={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:Xo(e=>new RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Xo(e=>new RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Xo(e=>new RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Xo(e=>new RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Xo(e=>new RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:Xo(e=>new RegExp(`^ {0,${e}}>`))},mF=/^(?:[ \t]*(?:\n|$))+/,pF=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,gF=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,gu=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,xF=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Rb=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,J3=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ej=Nt(J3).replace(/bull/g,Rb).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(),bF=Nt(J3).replace(/bull/g,Rb).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(),Mb=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,vF=/^[^\n]+/,Db=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,_F=Nt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Db).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),yF=Nt(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Rb).getRegex(),Cf="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",Ob=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,wF=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",Ob).replace("tag",Cf).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),tj=Nt(Mb).replace("hr",gu).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",Cf).getRegex(),SF=Nt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",tj).getRegex(),Lb={blockquote:SF,code:pF,def:_F,fences:gF,heading:xF,hr:gu,html:wF,lheading:ej,list:yF,newline:mF,paragraph:tj,table:Za,text:vF},u2=Nt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",gu).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",Cf).getRegex(),kF={...Lb,lheading:bF,table:u2,paragraph:Nt(Mb).replace("hr",gu).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",u2).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",Cf).getRegex()},NF={...Lb,html:Nt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ob).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:Za,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Nt(Mb).replace("hr",gu).replace("heading",` *#{1,6} *[^
|
|
97
|
-
]`).replace("lheading",ej).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},CF=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,EF=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,sj=/^( {2,}|\\)\n(?!\s*$)/,jF=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,_l=/[\p{P}\p{S}]/u,Ef=/[\s\p{P}\p{S}]/u,zb=/[^\s\p{P}\p{S}]/u,AF=Nt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Ef).getRegex(),nj=/(?!~)[\p{P}\p{S}]/u,TF=/(?!~)[\s\p{P}\p{S}]/u,RF=/(?:[^\s\p{P}\p{S}]|~)/u,MF=Nt(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",fF?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),ij=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,DF=Nt(ij,"u").replace(/punct/g,_l).getRegex(),OF=Nt(ij,"u").replace(/punct/g,nj).getRegex(),rj="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",LF=Nt(rj,"gu").replace(/notPunctSpace/g,zb).replace(/punctSpace/g,Ef).replace(/punct/g,_l).getRegex(),zF=Nt(rj,"gu").replace(/notPunctSpace/g,RF).replace(/punctSpace/g,TF).replace(/punct/g,nj).getRegex(),BF=Nt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,zb).replace(/punctSpace/g,Ef).replace(/punct/g,_l).getRegex(),PF=Nt(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,_l).getRegex(),IF="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",$F=Nt(IF,"gu").replace(/notPunctSpace/g,zb).replace(/punctSpace/g,Ef).replace(/punct/g,_l).getRegex(),HF=Nt(/\\(punct)/,"gu").replace(/punct/g,_l).getRegex(),UF=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(),FF=Nt(Ob).replace("(?:-->|$)","-->").getRegex(),qF=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",FF).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Kh=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,VF=Nt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Kh).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),aj=Nt(/^!?\[(label)\]\[(ref)\]/).replace("label",Kh).replace("ref",Db).getRegex(),oj=Nt(/^!?\[(ref)\](?:\[\])?/).replace("ref",Db).getRegex(),GF=Nt("reflink|nolink(?!\\()","g").replace("reflink",aj).replace("nolink",oj).getRegex(),d2=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Bb={_backpedal:Za,anyPunctuation:HF,autolink:UF,blockSkip:MF,br:sj,code:EF,del:Za,delLDelim:Za,delRDelim:Za,emStrongLDelim:DF,emStrongRDelimAst:LF,emStrongRDelimUnd:BF,escape:CF,link:VF,nolink:oj,punctuation:AF,reflink:aj,reflinkSearch:GF,tag:qF,text:jF,url:Za},WF={...Bb,link:Nt(/^!?\[(label)\]\((.*?)\)/).replace("label",Kh).getRegex(),reflink:Nt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Kh).getRegex()},qx={...Bb,emStrongRDelimAst:zF,emStrongLDelim:OF,delLDelim:PF,delRDelim:$F,url:Nt(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",d2).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",d2).getRegex()},KF={...qx,br:Nt(sj).replace("{2,}","*").getRegex(),text:Nt(qx.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},eh={normal:Lb,gfm:kF,pedantic:NF},_c={normal:Bb,gfm:qx,breaks:KF,pedantic:WF},YF={"&":"&","<":"<",">":">",'"':""","'":"'"},h2=e=>YF[e];function Fi(e,t){if(t){if(on.escapeTest.test(e))return e.replace(on.escapeReplace,h2)}else if(on.escapeTestNoEncode.test(e))return e.replace(on.escapeReplaceNoEncode,h2);return e}function f2(e){try{e=encodeURI(e).replace(on.percentDecode,"%")}catch{return null}return e}function m2(e,t){let s=e.replace(on.findPipe,(l,u,h)=>{let f=!1,d=u;for(;--d>=0&&h[d]==="\\";)f=!f;return f?"|":" |"}),n=s.split(on.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(on.slashPipe,"|");return n}function ca(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 p2(e){let t=e.split(`
|
|
98
|
-
`),s=t.length-1;for(;s>=0&&on.blankLine.test(t[s]);)s--;return t.length-s<=2?e:t.slice(0,s+1).join(`
|
|
99
|
-
`)}function XF(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 ZF(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 g2(e,t,s,n,o){let l=t.href,u=t.title||null,h=e[1].replace(o.other.outputLinkReplace,"$1");n.state.inLink=!0;let f={type:e[0].charAt(0)==="!"?"image":"link",raw:s,href:l,title:u,text:h,tokens:n.inlineTokens(h)};return n.state.inLink=!1,f}function QF(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 Yh=class{options;rules;lexer;constructor(e){this.options=e||ho}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]:p2(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=QF(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=ca(s,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(s=n.trim())}return{type:"heading",raw:ca(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:ca(t[0],`
|
|
103
|
-
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let s=ca(t[0],`
|
|
104
|
-
`).split(`
|
|
105
|
-
`),n="",o="",l=[];for(;s.length>0;){let u=!1,h=[],f;for(f=0;f<s.length;f++)if(this.rules.other.blockquoteStart.test(s[f]))h.push(s[f]),u=!0;else if(!u)h.push(s[f]);else break;s=s.slice(f);let d=h.join(`
|
|
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 x=l.at(-1);if(x?.type==="code")break;if(x?.type==="blockquote"){let v=x,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(x?.type==="list"){let v=x,w=v.raw+`
|
|
112
|
-
`+s.join(`
|
|
113
|
-
`),k=this.list(w);l[l.length-1]=k,n=n.substring(0,n.length-x.raw.length)+k.raw,o=o.substring(0,o.length-v.raw.length)+k.raw,s=w.substring(l.at(-1).raw.length).split(`
|
|
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 f=!1,d="",p="";if(!(t=l.exec(e))||this.rules.block.hr.test(e))break;d=t[0],e=e.substring(d.length);let g=ZF(t[2].split(`
|
|
115
|
-
`,1)[0],t[1].length),x=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(x)&&(d+=x+`
|
|
117
|
-
`,e=e.substring(x.length+1),f=!0),!f){let k=this.rules.other.nextBulletRegex(w),C=this.rules.other.hrRegex(w),N=this.rules.other.fencesBeginRegex(w),T=this.rules.other.headingBeginRegex(w),j=this.rules.other.htmlBeginRegex(w),A=this.rules.other.blockquoteBeginRegex(w);for(;e;){let B=e.split(`
|
|
118
|
-
`,1)[0],O;if(x=B,this.options.pedantic?(x=x.replace(this.rules.other.listReplaceNesting," "),O=x):O=x.replace(this.rules.other.tabCharGlobal," "),N.test(x)||T.test(x)||j.test(x)||A.test(x)||k.test(x)||C.test(x))break;if(O.search(this.rules.other.nonSpaceChar)>=w||!x.trim())p+=`
|
|
119
|
-
`+O.slice(w);else{if(v||g.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||N.test(g)||T.test(g)||C.test(g))break;p+=`
|
|
120
|
-
`+x}v=!x.trim(),d+=B+`
|
|
121
|
-
`,e=e.substring(B.length+1),g=O.slice(w)}}o.loose||(u?o.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(u=!0)),o.items.push({type:"list_item",raw:d,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]}),o.raw+=d}let h=o.items.at(-1);if(h)h.raw=h.raw.trimEnd(),h.text=h.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let f of o.items){this.lexer.state.top=!1,f.tokens=this.lexer.blockTokens(f.text,[]);let d=f.tokens[0];if(f.task&&(d?.type==="text"||d?.type==="paragraph")){f.text=f.text.replace(this.rules.other.listReplaceTask,""),d.raw=d.raw.replace(this.rules.other.listReplaceTask,""),d.text=d.text.replace(this.rules.other.listReplaceTask,"");for(let g=this.lexer.inlineQueue.length-1;g>=0;g--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[g].src)){this.lexer.inlineQueue[g].src=this.lexer.inlineQueue[g].src.replace(this.rules.other.listReplaceTask,"");break}let p=this.rules.other.listTaskCheckbox.exec(f.raw);if(p){let g={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};f.checked=g.checked,o.loose?f.tokens[0]&&["paragraph","text"].includes(f.tokens[0].type)&&"tokens"in f.tokens[0]&&f.tokens[0].tokens?(f.tokens[0].raw=g.raw+f.tokens[0].raw,f.tokens[0].text=g.raw+f.tokens[0].text,f.tokens[0].tokens.unshift(g)):f.tokens.unshift({type:"paragraph",raw:g.raw,text:g.raw,tokens:[g]}):f.tokens.unshift(g)}}else f.task&&(f.task=!1);if(!o.loose){let p=f.tokens.filter(x=>x.type==="space"),g=p.length>0&&p.some(x=>this.rules.other.anyLine.test(x.raw));o.loose=g}}if(o.loose)for(let f of o.items){f.loose=!0;for(let d of f.tokens)d.type==="text"&&(d.type="paragraph")}return o}}html(e){let t=this.rules.block.html.exec(e);if(t){let s=p2(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:ca(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=m2(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:ca(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(m2(u,l.header.length).map((h,f)=>({text:h,tokens:this.lexer.inline(h),header:!1,align:l.align[f]})));return l}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let s=t[1].trim();return{type:"heading",raw:ca(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=ca(s.slice(0,-1),"\\");if((s.length-l.length)%2===0)return}else{let l=XF(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)),g2(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 g2(s,o,s[0],this.lexer,this.rules)}}emStrong(e,t,s=""){let n=this.rules.inline.emStrongLDelim.exec(e);if(!(!n||!n[1]&&!n[2]&&!n[3]&&!n[4]||n[4]&&s.match(this.rules.other.unicodeAlphaNumeric))&&(!(n[1]||n[3])||!s||this.rules.inline.punctuation.exec(s))){let o=[...n[0]].length-1,l,u,h=o,f=0,d=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+o);(n=d.exec(t))!==null;){if(l=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!l)continue;if(u=[...l].length,n[3]||n[4]){h+=u;continue}else if((n[5]||n[6])&&o%3&&!((o+u)%3)){f+=u;continue}if(h-=u,h>0)continue;u=Math.min(u,u+h+f);let p=[...n[0]][0].length,g=e.slice(0,o+n.index+p+u);if(Math.min(o,u)%2){let v=g.slice(1,-1);return{type:"em",raw:g,text:v,tokens:this.lexer.inlineTokens(v)}}let x=g.slice(2,-2);return{type:"strong",raw:g,text:x,tokens:this.lexer.inlineTokens(x)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let s=t[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(s),o=this.rules.other.startingSpaceChar.test(s)&&this.rules.other.endingSpaceChar.test(s);return n&&o&&(s=s.substring(1,s.length-1)),{type:"codespan",raw:t[0],text:s}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,s=""){let n=this.rules.inline.delLDelim.exec(e);if(n&&(!n[1]||!s||this.rules.inline.punctuation.exec(s))){let o=[...n[0]].length-1,l,u,h=o,f=this.rules.inline.delRDelim;for(f.lastIndex=0,t=t.slice(-1*e.length+o);(n=f.exec(t))!==null;){if(l=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!l||(u=[...l].length,u!==o))continue;if(n[3]||n[4]){h+=u;continue}if(h-=u,h>0)continue;u=Math.min(u,u+h);let d=[...n[0]][0].length,p=e.slice(0,o+n.index+d+u),g=p.slice(o,-o);return{type:"del",raw:p,text:g,tokens:this.lexer.inlineTokens(g)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let s,n;return t[2]==="@"?(s=t[1],n="mailto:"+s):(s=t[1],n=s),{type:"link",raw:t[0],text:s,href:n,tokens:[{type:"text",raw:s,text:s}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let s,n;if(t[2]==="@")s=t[0],n="mailto:"+s;else{let o;do o=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(o!==t[0]);s=t[0],t[1]==="www."?n="http://"+t[0]:n=t[0]}return{type:"link",raw:t[0],text:s,href:n,tokens:[{type:"text",raw:s,text:s}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let s=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:s}}}},Ai=class Vx{tokens;options;state;inlineQueue;tokenizer;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||ho,this.options.tokenizer=this.options.tokenizer||new Yh,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:on,block:eh.normal,inline:_c.normal};this.options.pedantic?(s.block=eh.pedantic,s.inline=_c.pedantic):this.options.gfm&&(s.block=eh.gfm,this.options.breaks?s.inline=_c.breaks:s.inline=_c.gfm),this.tokenizer.rules=s}static get rules(){return{block:eh,inline:_c}}static lex(t,s){return new Vx(s).lex(t)}static lexInline(t,s){return new Vx(s).inlineTokens(t)}lex(t){t=t.replace(on.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(on.tabCharGlobal," ").replace(on.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,f=t.slice(1),d;this.options.extensions.startBlock.forEach(p=>{d=p.call({lexer:this},f),typeof d=="number"&&d>=0&&(h=Math.min(h,d))}),h<1/0&&h>=0&&(u=t.substring(0,h+1))}if(this.state.top&&(l=this.tokenizer.paragraph(u))){let h=s.at(-1);n&&h?.type==="paragraph"?(h.raw+=(h.raw.endsWith(`
|
|
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="",f=1/0;for(;t;){if(t.length<f)f=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}u||(h=""),u=!1;let d;if(this.options.extensions?.inline?.some(g=>(d=g.call({lexer:this},t,s))?(t=t.substring(d.raw.length),s.push(d),!0):!1))continue;if(d=this.tokenizer.escape(t)){t=t.substring(d.raw.length),s.push(d);continue}if(d=this.tokenizer.tag(t)){t=t.substring(d.raw.length),s.push(d);continue}if(d=this.tokenizer.link(t)){t=t.substring(d.raw.length),s.push(d);continue}if(d=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(d.raw.length);let g=s.at(-1);d.type==="text"&&g?.type==="text"?(g.raw+=d.raw,g.text+=d.text):s.push(d);continue}if(d=this.tokenizer.emStrong(t,n,h)){t=t.substring(d.raw.length),s.push(d);continue}if(d=this.tokenizer.codespan(t)){t=t.substring(d.raw.length),s.push(d);continue}if(d=this.tokenizer.br(t)){t=t.substring(d.raw.length),s.push(d);continue}if(d=this.tokenizer.del(t,n,h)){t=t.substring(d.raw.length),s.push(d);continue}if(d=this.tokenizer.autolink(t)){t=t.substring(d.raw.length),s.push(d);continue}if(!this.state.inLink&&(d=this.tokenizer.url(t))){t=t.substring(d.raw.length),s.push(d);continue}let p=t;if(this.options.extensions?.startInline){let g=1/0,x=t.slice(1),v;this.options.extensions.startInline.forEach(w=>{v=w.call({lexer:this},x),typeof v=="number"&&v>=0&&(g=Math.min(g,v))}),g<1/0&&g>=0&&(p=t.substring(0,g+1))}if(d=this.tokenizer.inlineText(p)){t=t.substring(d.raw.length),d.raw.slice(-1)!=="_"&&(h=d.raw.slice(-1)),u=!0;let g=s.at(-1);g?.type==="text"?(g.raw+=d.raw,g.text+=d.text):s.push(d);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return s}infiniteLoopError(t){let s="Infinite loop on byte: "+t;if(this.options.silent)console.error(s);else throw new Error(s)}},Xh=class{options;parser;constructor(e){this.options=e||ho}space(e){return""}code({text:e,lang:t,escaped:s}){let n=(t||"").match(on.notSpaceStart)?.[0],o=e.replace(on.endingNewline,"")+`
|
|
141
|
-
`;return n?'<pre><code class="language-'+Fi(n)+'">'+(s?o:Fi(o,!0))+`</code></pre>
|
|
142
|
-
`:"<pre><code>"+(s?o:Fi(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>${Fi(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=f2(e);if(o===null)return n;e=o;let l='<a href="'+e+'"';return t&&(l+=' title="'+Fi(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=f2(e);if(o===null)return Fi(s);e=o;let l=`<img src="${e}" alt="${Fi(s)}"`;return t&&(l+=` title="${Fi(t)}"`),l+=">",l}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Fi(e.text)}},Pb=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}},Ti=class Gx{options;renderer;textRenderer;constructor(t){this.options=t||ho,this.options.renderer=this.options.renderer||new Xh,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Pb}static parse(t,s){return new Gx(s).parse(t)}static parseInline(t,s){return new Gx(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}},Mc=class{options;block;constructor(e){this.options=e||ho}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?Ai.lex:Ai.lexInline}provideParser(e=this.block){return e?Ti.parse:Ti.parseInline}},JF=class{defaults=Tb();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Ti;Renderer=Xh;TextRenderer=Pb;Lexer=Ai;Tokenizer=Yh;Hooks=Mc;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 f=l.renderer.apply(this,h);return f===!1&&(f=u.apply(this,h)),f}: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 Xh(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,f=n.renderer[h],d=l[h];l[h]=(...p)=>{let g=f.apply(l,p);return g===!1&&(g=d.apply(l,p)),g||""}}o.renderer=l}if(n.tokenizer){let l=this.defaults.tokenizer||new Yh(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,f=n.tokenizer[h],d=l[h];l[h]=(...p)=>{let g=f.apply(l,p);return g===!1&&(g=d.apply(l,p)),g}}o.tokenizer=l}if(n.hooks){let l=this.defaults.hooks||new Mc;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,f=n.hooks[h],d=l[h];Mc.passThroughHooks.has(u)?l[h]=p=>{if(this.defaults.async&&Mc.passThroughHooksRespectAsync.has(u))return(async()=>{let x=await f.call(l,p);return d.call(l,x)})();let g=f.call(l,p);return d.call(l,g)}:l[h]=(...p)=>{if(this.defaults.async)return(async()=>{let x=await f.apply(l,p);return x===!1&&(x=await d.apply(l,p)),x})();let g=f.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 f=[];return f.push(u.call(this,h)),l&&(f=f.concat(l.call(this,h))),f}}this.defaults={...this.defaults,...o}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,s){return Ai.lex(t,s??this.defaults)}parser(t,s){return Ti.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,f=await(l.hooks?await l.hooks.provideLexer(t):t?Ai.lex:Ai.lexInline)(h,l),d=l.hooks?await l.hooks.processAllTokens(f):f;l.walkTokens&&await Promise.all(this.walkTokens(d,l.walkTokens));let p=await(l.hooks?await l.hooks.provideParser(t):t?Ti.parse:Ti.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?Ai.lex:Ai.lexInline)(s,l);l.hooks&&(h=l.hooks.processAllTokens(h)),l.walkTokens&&this.walkTokens(h,l.walkTokens);let f=(l.hooks?l.hooks.provideParser(t):t?Ti.parse:Ti.parseInline)(h,l);return l.hooks&&(f=l.hooks.postprocess(f)),f}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>"+Fi(n.message+"",!0)+"</pre>";return s?Promise.resolve(o):o}if(s)return Promise.reject(n);throw n}}},oo=new JF;function Dt(e,t){return oo.parse(e,t)}Dt.options=Dt.setOptions=function(e){return oo.setOptions(e),Dt.defaults=oo.defaults,Q3(Dt.defaults),Dt};Dt.getDefaults=Tb;Dt.defaults=ho;Dt.use=function(...e){return oo.use(...e),Dt.defaults=oo.defaults,Q3(Dt.defaults),Dt};Dt.walkTokens=function(e,t){return oo.walkTokens(e,t)};Dt.parseInline=oo.parseInline;Dt.Parser=Ti;Dt.parser=Ti.parse;Dt.Renderer=Xh;Dt.TextRenderer=Pb;Dt.Lexer=Ai;Dt.lexer=Ai.lex;Dt.Tokenizer=Yh;Dt.Hooks=Mc;Dt.parse=Dt;Dt.options;Dt.setOptions;Dt.use;Dt.walkTokens;Dt.parseInline;Ti.parse;Ai.lex;function eq(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 lj({content:e}){const t=_.useMemo(()=>{const s=Dt.parse(e,{async:!1,gfm:!0,breaks:!0});return eq(s)},[e]);return r.jsx("div",{className:"chat-md",dangerouslySetInnerHTML:{__html:t}})}function tq(e){return Math.min(e,Math.max(1,Math.ceil(e/22)))}function sq(e){const[t,s]=_.useState(e),n=_.useRef(e),o=_.useRef(e);return o.current=e,_.useEffect(()=>{e.startsWith(n.current)||(n.current=e,s(e))},[e]),_.useEffect(()=>{if(n.current.length>=o.current.length)return;const l=requestAnimationFrame(()=>{const u=o.current,h=u.slice(0,n.current.length+tq(u.length-n.current.length));n.current=h,s(h)});return()=>cancelAnimationFrame(l)},[t,e]),t}function nq(){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 iq({onOpenAgentPage:e,onOpenService:t,onOpenSqlConsole:s,git:n,onGitRefresh:o}){const{error:l,success:u}=us(),{turns:h,streaming:f,error:d,configured:p,provider:g,providers:x,selectProvider:v,approvals:w,send:k,stop:C,clear:N,respond:T,open:j,setOpen:A,draft:B,setDraft:O,insertPath:I,activeSource:R,clearSource:D,focusNonce:P,stickNonce:G,sendToAgent:Z,onboarding:$,setOnboarding:q}=Pt(),[F,L]=_.useState(""),[X,U]=_.useState(!1),[K,Y]=_.useState(!1),[V,ie]=_.useState(!1),[Ee,ye]=_.useState(null),[oe,je]=_.useState(!1),Ne=_.useRef(null),Ge=_.useRef(null),De=_.useRef(null),et=_.useRef(null);_.useEffect(()=>{if(!j||$)return;let Ie=0,Ct=0;const St=()=>{const Rt=Ge.current;if(!Rt||B&&Rt.value!==B){Ct++<10&&(Ie=requestAnimationFrame(St));return}Rt.focus();const Ft=Rt.value.length;Rt.setSelectionRange(Ft,Ft),Rt.scrollTop=Rt.scrollHeight};return Ie=requestAnimationFrame(St),()=>cancelAnimationFrame(Ie)},[j,P,$]),_.useLayoutEffect(()=>{const Ie=Ge.current;Ie&&(Ie.style.height="auto",Ie.style.height=`${Ie.scrollHeight}px`)},[B]),_.useEffect(()=>{!j||!$||requestAnimationFrame(()=>De.current?.focus())},[j,$]),_.useEffect(()=>{if(!j)return;const Ie=Ct=>{et.current?.contains(Ct.target)||A(!1)};return document.addEventListener("pointerdown",Ie),()=>document.removeEventListener("pointerdown",Ie)},[j,A]),_.useEffect(()=>{const Ie=St=>{St.dataTransfer&&e2(St.dataTransfer)&&U(!0)},Ct=()=>{U(!1),Y(!1)};return document.addEventListener("dragstart",Ie),document.addEventListener("dragend",Ct),document.addEventListener("drop",Ct),()=>{document.removeEventListener("dragstart",Ie),document.removeEventListener("dragend",Ct),document.removeEventListener("drop",Ct)}},[]);const ke=_.useRef(!0);function He(){const Ie=Ne.current;Ie&&(ke.current=Ie.scrollHeight-Ie.scrollTop-Ie.clientHeight<48)}_.useEffect(()=>{const Ie=Ne.current;Ie&&ke.current&&(Ie.scrollTop=Ie.scrollHeight)},[h,j]),_.useEffect(()=>{ke.current=!0;const Ie=Ne.current;if(!Ie)return;const Ct=requestAnimationFrame(()=>{Ie.scrollTop=Ie.scrollHeight});return()=>cancelAnimationFrame(Ct)},[G]);async function $e(){const Ie=B;O(""),ke.current=!0,await k(Ie)}function wt(Ie){Ie.trim()&&(O(""),q(!1),L(""),ke.current=!0,Z({prompt:j$(Ie),source:{type:"repo-onboard",label:"Onboard repo"},label:`Onboard and run this repo: ${Ie}`}))}function Us(Ie){ke.current=!0,k(Ie)}async function Fs(Ie){try{await CC(Ie),u(`Starting ${Ie}…`)}catch(Ct){l(Ct instanceof Error?Ct.message:`Could not start ${Ie}.`)}}function Ln(Ie){Ie.key==="Enter"&&!Ie.shiftKey&&(Ie.preventDefault(),$e())}function Sn(Ie){e2(Ie.dataTransfer)&&(Ie.preventDefault(),Ie.dataTransfer.dropEffect="copy",j||A(!0),Y(!0))}function As(Ie){Ie.currentTarget.contains(Ie.relatedTarget)||Y(!1)}function cn(Ie){Y(!1);const Ct=XH(Ie.dataTransfer);Ct&&(Ie.preventDefault(),I(Ct))}function un(Ie){if(!j)return;Ie.preventDefault(),Ie.currentTarget.setPointerCapture(Ie.pointerId),je(!0);const Ct=160,St=window.innerHeight-48;function Rt(Js){const en=window.innerHeight-Js.clientY;ye(Math.max(Ct,Math.min(St,en)))}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:et,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]":"":X?"h-12":"h-9",X&&!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:Sn,onDragLeave:As,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(rq,{provider:g,providers:x,onSelect:v,disabled:f}),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(pi,{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(Kt,{className:"size-3"})})]}):null]}),r.jsxs("div",{className:"pointer-events-auto flex items-center gap-1",children:[e?r.jsx(Q,{"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(PM,{})}):null,r.jsx(Q,{"aria-label":"Clear conversation",className:"size-7",disabled:h.length===0,onClick:N,size:"icon",title:"Clear conversation",type:"button",variant:"ghost",children:r.jsx(gi,{})}),r.jsx(Q,{"aria-label":"Collapse agent",className:"size-7",onClick:()=>A(!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(aq,{configured:p,provider:g,onOnboard:()=>q(!0)}):h.map((Ie,Ct)=>r.jsx(uq,{turn:Ie,streaming:f&&Ct===h.length-1,isLast:Ct===h.length-1,onChoose:Us,onStartService:Fs,onOpenService:t,onOpenSqlConsole:s},Ie.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(Xi,{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(Ie=>r.jsx(hq,{prompt:Ie,onRespond:T},Ie.requestId))}):null,r.jsxs("div",{className:de("relative shrink-0 p-2 transition-colors",X&&"bg-primary/5"),children:[n?r.jsx(FU,{git:n,onRefresh:o}):null,V?r.jsx(iF,{onClose:()=>ie(!1),onPick:Ie=>{ie(!1),I(Ie)}}):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:Ie=>{Ie.preventDefault(),wt(F)},children:[r.jsx(bn,{className:"size-4 shrink-0 text-primary"}),r.jsx("input",{ref:De,className:"min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground",onChange:Ie=>L(Ie.target.value),placeholder:"Paste a repo URL — e.g. https://github.com/owner/repo",value:F}),r.jsx(Q,{disabled:!F.trim(),size:"sm",type:"submit",children:"Onboard"}),r.jsx(Q,{"aria-label":"Cancel onboarding",className:"size-7",onClick:()=>{q(!1),L("")},size:"icon",type:"button",variant:"ghost",children:r.jsx(Kt,{})})]}):lq(B)&&!f?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:()=>wt(B),type:"button",children:[r.jsx(bn,{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:B.trim()})," as a service"]}),r.jsx(Q4,{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(Q,{"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:V?"secondary":"ghost",children:r.jsx($M,{})}),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:Ie=>O(Ie.target.value),onKeyDown:Ln,placeholder:p===!1?`${g?.label??"Agent"} (\`${g?.commandName??"agent"}\`) is not installed`:`Ask ${g?.label??"the agent"} anything about this project...`,rows:1,value:B}),f?r.jsx(Q,{"aria-label":"Stop generating",className:"size-8 shrink-0 rounded-full",onClick:C,size:"icon",title:"Stop",type:"button",variant:"secondary",children:r.jsx(ro,{className:"size-3.5 fill-current"})}):r.jsx(Q,{"aria-label":"Send message",className:"size-8 shrink-0 rounded-full",disabled:!B.trim()||p===!1,onClick:()=>{$e()},size:"icon",title:"Send",type:"button",children:r.jsx(uf,{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",X?"font-medium text-primary":"text-muted-foreground"),onClick:()=>A(!0),type:"button",children:X?r.jsxs(r.Fragment,{children:[r.jsx(cl,{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(Sh,{provider:g,className:"size-4 text-primary"}),f?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 Sh({provider:e,className:t}){return e?.id==="claude"?r.jsx(bl,{className:t}):e?.id==="codex"?r.jsx(hu,{className:t}):r.jsx(pi,{className:t})}function rq({provider:e,providers:t,onSelect:s,disabled:n}){const[o,l]=_.useState(!1),u=_.useRef(null);return _.useEffect(()=>{if(!o)return;const h=f=>{u.current?.contains(f.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(Sh,{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(Sh,{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 f=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),f||s(h.id)},type:"button",children:[r.jsx(Sh,{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]}),f?r.jsx(ln,{className:"mt-0.5 size-3.5 shrink-0 text-primary"}):null]},h.id)})}):null]})}function aq({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(bn,{className:"size-3.5"}),"Onboard a repo from a URL"]})]})}const oq=/^(?:https?:\/\/|git@|ssh:\/\/)\S+$/i;function lq(e){const t=e.trim();return t.includes(`
|
|
160
|
-
`)||t.includes(" ")||!oq.test(t)?!1:/github\.com|gitlab\.|bitbucket\.|\.git$/i.test(t)}function cq({turn:e}){const[t,s]=_.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(df,{className:"size-3"}):r.jsx(vn,{className:"size-3"}),t?"Hide full prompt":"Show full prompt"]}):null]})})}function uq({turn:e,streaming:t,isLast:s,onChoose:n,onStartService:o,onOpenService:l,onOpenSqlConsole:u}){const h=sq(e.text);if(e.role==="user")return r.jsx(cq,{turn:e});const{body:f,options:d,service:p,sqlWrite:g}=cF(h);return r.jsxs("div",{className:"space-y-1.5",children:[e.tools.map(x=>r.jsx(dq,{tool:x},x.id)),f?r.jsx("div",{className:"break-words px-0.5 text-sm text-foreground",children:r.jsx(lj,{content:f})}):null,d.length>0&&s&&!t?r.jsx(uF,{options:d,onChoose:n}):null,p&&!t?r.jsx(dF,{service:p,onStart:o,onOpen:l}):null,g&&u&&!t?r.jsx(hF,{proposal:g,onOpen:u}):null,t&&!f?r.jsx(nq,{}):null]})}function dq({tool:e}){const t=cj(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(L6,{className:"size-3"}),r.jsx("span",{className:"font-semibold",children:e.name}),t?r.jsx("span",{className:"truncate",children:t}):null]})}function hq({prompt:e,onRespond:t}){const s=cj(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(rC,{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(Q,{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(Kt,{className:"size-3.5"})," Deny"]}),r.jsxs(Q,{className:"h-7 gap-1",onClick:()=>t(e.requestId,"allow"),size:"sm",type:"button",children:[r.jsx(ln,{className:"size-3.5"})," Allow"]})]})}function cj(e){return!e||typeof e!="object"?"":Object.values(e).filter(s=>s!==void 0&&s!=="").map(s=>String(s)).join(" ")}function al(e,t){const s=`nomoreide:${e}`,[n,o]=_.useState(()=>{try{const u=window.localStorage.getItem(s);return u===null?t:JSON.parse(u)}catch{return t}}),l=_.useCallback(u=>{o(u);try{window.localStorage.setItem(s,JSON.stringify(u))}catch{}},[s]);return[n,l]}const gg={host:"",port:"",user:"",password:"",database:"",ssl:!1},fq="localhost";function Wx(e,t,{includePassword:s=!0}={}){const n=e==="mysql"?"mysql":"postgres",o=t.host.trim()||fq,l=t.port.trim(),u=t.database.trim().replace(/^\//,""),h=t.user.trim(),f=s&&t.password,d=h?`${encodeURIComponent(h)}${f?`:${encodeURIComponent(t.password)}`:""}@`:"",p=l?`:${l}`:"",g=e==="postgres"&&t.ssl?"?sslmode=require":"";return`${n}://${d}${o}${p}/${u}${g}`}function Kx(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:x2(t.username),password:x2(t.password),database:t.pathname.replace(/^\//,""),ssl:t.searchParams.get("sslmode")==="require"||t.searchParams.has("ssl")}}function mq(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 x2(e){try{return decodeURIComponent(e)}catch{return e}}const pq=[{value:"postgres",label:"Postgres"},{value:"mysql",label:"MySQL"},{value:"sqlite",label:"SQLite"}];function gq({onClose:e,onSaved:t,initial:s}){const{error:n,success:o}=us(),l=!!s,u=_.useMemo(()=>xq(s),[s]),[h,f]=_.useState(u.engine),[d,p]=_.useState(u.name),[g,x]=_.useState(u.url),[v,w]=_.useState(u.fields),[k,C]=_.useState([]),[N,T]=_.useState({status:"idle"}),[j,A]=_.useState(!1),[B,O]=_.useState(!1);_.useEffect(()=>{l||nO().then(C).catch(()=>C([]))},[l]);const I=h==="sqlite",R=I?g.trim():Wx(h,v),D=I?!!g.trim():!!(v.host.trim()&&v.database.trim());function P(){T({status:"idle"})}function G(K,Y){return Wx(K,Y,{includePassword:!1})}function Z(K){f(K),P(),K!=="sqlite"&&x(G(K,v))}function $(K){const Y={...v,...K};w(Y),x(G(h,Y)),P()}function q(K){P();const Y=mq(K),V=Y??h;Y&&Y!==h&&f(Y);const ie=Y==="sqlite"?null:Kx(K);if(!ie){x(K);return}ie.password?(w(ie),x(G(V,ie))):(w({...ie,password:v.password}),x(K))}function F(K){f(K.engine);const Y=K.engine==="sqlite"?null:Kx(K.url);Y?(w(Y),x(G(K.engine,Y))):x(K.url),P(),d.trim()||p(bq(K))}function L(){return d.trim()?I?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 X(){if(D){A(!0),P();try{const K=await rO({engine:h,url:R});T(K.ok?{status:"ok",message:"Connected"}:{status:"fail",message:K.error??"Connection failed"})}catch(K){T({status:"fail",message:K instanceof Error?K.message:String(K)})}finally{A(!1)}}}async function U(){const K=L();if(K){n(K);return}O(!0);try{await iO({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{O(!1)}}return r.jsx(Xn,{icon:r.jsx(mi,{}),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(T6,{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:()=>F(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(Xe,{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:pq.map(K=>r.jsx(Q,{size:"sm",variant:h===K.value?"default":"outline",onClick:()=>Z(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(ht,{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]}),I?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(ht,{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(ht,{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(ht,{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(ht,{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(ht,{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:I?"Database file path":"Connection URL"}),r.jsx(ht,{value:g,onChange:K=>q(K.target.value),placeholder:I?"/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:I?"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."})]}),N.status!=="idle"?r.jsxs("div",{className:`flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 text-xs ${N.status==="ok"?"border-emerald-500/40 text-emerald-600 dark:text-emerald-400":"border-destructive/40 text-destructive"}`,children:[N.status==="ok"?r.jsx(ln,{className:"size-3.5"}):r.jsx(Kt,{className:"size-3.5"}),r.jsx("span",{className:"break-all font-mono",children:N.message})]}):null,r.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-border pt-3",children:[r.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>{X()},disabled:j||!D,type:"button",children:[j?r.jsx(Et,{className:"animate-spin"}):null,"Test connection"]}),r.jsxs(Q,{size:"sm",onClick:()=>{U()},disabled:B,type:"button",children:[B?r.jsx(Et,{className:"animate-spin"}):null,l?"Save changes":"Save"]})]})]})})}function xq(e){if(!e)return{engine:"postgres",name:"",fields:gg,url:""};if(e.engine==="sqlite")return{engine:"sqlite",name:e.name,fields:gg,url:e.url};const t=Kx(e.url),s=t?{...t,password:""}:gg;return{engine:e.engine,name:e.name,fields:s,url:Wx(e.engine,s,{includePassword:!1})}}function bq(e){try{const s=new URL(e.url).pathname.replace(/^\//,"");if(s)return`${e.service}-${s}`}catch{}return`${e.service}-${e.engine}`}function vq({connections:e,selected:t,onSelect:s,onAdd:n,onEdit:o,onRemove:l}){const[u,h]=_.useState(!1),f=_.useRef(null),d=e.find(p=>p.name===t);return _.useEffect(()=>{if(!u)return;function p(g){f.current&&g.target instanceof Node&&!f.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:f,children:[r.jsxs(Q,{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(mi,{className:"text-muted-foreground"}),r.jsx("span",{className:"truncate",children:d?.name??"Select connection"}),d?r.jsx(Xe,{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(mi,{className:"size-3.5 text-muted-foreground"}),r.jsx("div",{className:"text-xs font-semibold",children:"Connections"}),r.jsx(Xe,{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(ln,{className:"size-3.5"}):r.jsx("span",{className:"size-3.5"}),r.jsx(Q,{"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(ul,{className:"size-3.5"})}),r.jsx(Q,{"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(gi,{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(Q,{className:"w-full",onClick:()=>{n(),h(!1)},size:"sm",type:"button",children:[r.jsx(bs,{className:"size-3"}),"Add connection"]})})]}):null]})}function _q({onAddManual:e,onAddWithAi:t}){const[s,n]=_.useState(!1),o=_.useRef(null);_.useEffect(()=>{if(!s)return;function u(h){o.current&&h.target instanceof Node&&!o.current.contains(h.target)&&n(!1)}return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]);function l(u){n(!1),u()}return r.jsxs("div",{className:"relative",ref:o,children:[r.jsxs(Q,{"aria-label":"Add database connection",onClick:()=>n(u=>!u),size:"sm",type:"button",children:[r.jsx(bs,{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(mi,{className:"size-3.5 text-muted-foreground"}),"Add connection"]}),r.jsxs("button",{className:"flex w-full items-center gap-2 border-t border-border px-3 py-2 text-left text-sm transition-colors hover:bg-muted",onClick:()=>l(t),type:"button",children:[r.jsx(pi,{className:"size-3.5 text-muted-foreground"}),"Add with AI"]})]}):null]})}function yq(){const[e,t]=_.useState([]),[s,n]=_.useState(!0),[o,l]=_.useState(null),u=_.useCallback(async()=>{n(!0),l(null);try{t(await xC())}catch(h){l(h instanceof Error?h.message:String(h))}finally{n(!1)}},[]);return _.useEffect(()=>{u()},[u]),{connections:e,loading:s,error:o,refresh:u}}const uj=[50,100,500,1e3];function wq(e){const[t,s]=_.useState(null),[n,o]=_.useState(null),[l,u]=_.useState(!1);_.useEffect(()=>{s(null),o(null)},[e]);const h=_.useCallback(async(d,p)=>{if(!(!e||!d.trim())){u(!0),o(null);try{s(await oO(e,d,p))}catch(g){s(null),o(g instanceof Error?g.message:String(g))}finally{u(!1)}}},[e]),f=_.useCallback(()=>{s(null),o(null)},[]);return{result:t,error:n,running:l,run:h,reset:f}}const Sq=["select","show","explain","pragma","describe","desc"];function kq(e){const t=/^\s*([a-z]+)/i.exec(e)?.[1]?.toLowerCase()??"";return Sq.includes(t)}function Nq(e){const[t,s]=_.useState(null),[n,o]=_.useState(null),[l,u]=_.useState(null),[h,f]=_.useState(!1),[d,p]=_.useState(!1);_.useEffect(()=>{s(null),o(null),u(null)},[e]);const g=_.useCallback(async k=>{if(!(!e||!k.trim())){f(!0),u(null),o(null);try{const C=await tw(e,k,"preview");s({sql:k,preview:C})}catch(C){u(C instanceof Error?C.message:String(C))}finally{f(!1)}}},[e]),x=_.useCallback(async()=>{if(!e||!t)return null;p(!0),u(null);try{const k=await tw(e,t.sql,"commit");return o(k),s(null),k}catch(k){return s(null),u(k instanceof Error?k.message:String(k)),null}finally{p(!1)}},[e,t]),v=_.useCallback(()=>s(null),[]),w=_.useCallback(()=>{s(null),o(null),u(null)},[]);return{pending:t,committed:n,error:l,previewing:h,committing:d,preview:g,commit:x,cancel:v,reset:w}}function Cq(e,t){const[s,n]=_.useState(!1),o=_.useCallback(async l=>{if(e){n(!0);try{await lO(e,l),t()}finally{n(!1)}}},[e,t]);return{updating:s,setUnlocked:o}}function Eq(e){const[t,s]=_.useState([]),[n,o]=_.useState(null),[l,u]=_.useState(null),[h,f]=_.useState(null),[d,p]=_.useState(null),[g,x]=_.useState(!1),[v,w]=_.useState(!1),[k,C]=_.useState(100),[N,T]=_.useState(0);_.useEffect(()=>{T(0)},[e,n]),_.useEffect(()=>{if(s([]),o(null),u(null),f(null),p(null),!e)return;let R=!1;return x(!0),bC(e).then(D=>{R||(s(D),o(D[0]?.qualifiedName??null))}).catch(D=>{R||f(D instanceof Error?D.message:String(D))}).finally(()=>{R||x(!1)}),()=>{R=!0}},[e]),_.useEffect(()=>{if(u(null),p(null),!e||!n)return;let R=!1;return w(!0),cO(e,n,k,N).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,N]);const j=N>0,A=l?l.rowCount===k:!1;function B(R){C(R),T(0)}function O(){A&&T(R=>R+k)}function I(){T(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:N,canPrev:j,canNext:A,changePageSize:B,nextPage:O,prevPage:I}}function jq(e,t,s,n){const{sendToAgent:o,streaming:l,turns:u}=Pt(),[h,f]=_.useState(!1),[d,p]=_.useState(null),g=_.useRef(u);_.useEffect(()=>{g.current=u},[u]);const x=_.useRef(!1),v=_.useRef(null);return _.useEffect(()=>{if(l)x.current=!0;else if(x.current&&v.current){const k=v.current;v.current=null,k()}},[l]),{generate:_.useCallback(async k=>{if(!e||!k.trim()||h)return;f(!0),p(null);let C=[];try{C=await bC(e)}catch{C=[]}x.current=!1;const N=new Promise(T=>{let j=!1;const A=()=>{j||(j=!0,clearTimeout(B),v.current=null,T())};v.current=A;const B=setTimeout(()=>{x.current||A()},8e3)});o({prompt:R$(e,k,{engine:t,tables:C,unlocked:s}),source:{type:"database-sql-generate",label:"Generate SQL"},label:`Generate SQL: ${k}`,background:!0});try{await N;const T=Tq(Aq(g.current));T?n(T):p("The agent didn't return a SQL block — open the dock to see its reply.")}finally{f(!1)}},[e,t,s,h,n,o]),generating:h,error:d}}function Aq(e){for(let t=e.length-1;t>=0;t--)if(e[t].role==="assistant")return e[t].text.trim();return""}function Tq(e){if(!e)return null;const s=/```(?:sql)?\s*\n?([\s\S]*?)```/i.exec(e)?.[1]?.trim();return s||null}function Rq({connection:e,sample:t}){const{sendToAgent:s}=Pt(),{success:n,error:o}=us(),l=t.columns.map(p=>p.name);function u(p){s({prompt:T$(e,t.engine,t.table,t.columns,p),source:{type:"database-row",label:`${t.table} row`},mode:"draft"})}async function h(p,g){try{await navigator.clipboard.writeText(p),n(`Copied ${g}.`)}catch(x){o(x instanceof Error?x.message:String(x))}}function f(p){const g=x=>{const v=Gc(x);return/[",\n]/.test(v)?`"${v.replace(/"/g,'""')}"`:v};return`${l.join(",")}
|
|
161
|
-
${l.map(x=>g(p[x])).join(",")}`}function d(p){const g=v=>v==null?"NULL":typeof v=="number"||typeof v=="boolean"?String(v):`'${(typeof v=="object"?JSON.stringify(v):String(v)).replace(/'/g,"''")}'`,x=l.map(v=>g(p[v])).join(", ");return`INSERT INTO ${t.table} (${l.join(", ")}) VALUES (${x});`}return t.columns.length===0?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(YN,{className:"size-3 text-amber-500"}):null,p.name]}),r.jsx("span",{className:"block text-[10px] font-normal text-muted-foreground",children:p.dataType})]},p.name)),r.jsx("th",{className:"sticky right-0 z-20 w-16 border-l border-border bg-card px-2 py-2"})]})}),r.jsxs("tbody",{children:[t.rows.map((p,g)=>r.jsxs("tr",{className:"group border-b border-border/60 hover:bg-muted/40",children:[t.columns.map(x=>r.jsx("td",{className:"max-w-[320px] truncate px-3 py-1 align-top text-muted-foreground",title:Gc(p[x.name]),children:Gc(p[x.name])},x.name)),r.jsx("td",{className:"sticky right-0 z-[1] border-l border-border/60 bg-card px-2 py-1 align-top before:pointer-events-none before:absolute before:inset-0 before:bg-muted/40 before:opacity-0 group-hover:before:opacity-100",children:r.jsxs("div",{className:"relative z-[1] flex items-center justify-end gap-0.5",children:[r.jsx(Qi,{label:"Ask AI about this row",onAsk:()=>u(p)}),r.jsx(mu,{label:"Row actions",items:[{label:"Copy as JSON",icon:r.jsx(E4,{className:"size-3.5"}),onSelect:()=>{h(JSON.stringify(p,null,2),"row as JSON")}},{label:"Copy as CSV",icon:r.jsx(xR,{className:"size-3.5"}),onSelect:()=>{h(f(p),"row as CSV")}},{label:"Copy as SQL INSERT",icon:r.jsx(mi,{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 Gc(e){return e==null?"NULL":typeof e=="object"?JSON.stringify(e):String(e)}function Mq({connection:e,busy:t,onConfirm:s,onClose:n}){return r.jsx(Xn,{icon:r.jsx(rC,{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(Q,{variant:"outline",size:"sm",onClick:n,type:"button",children:"Cancel"}),r.jsxs(Q,{size:"sm",onClick:s,disabled:t,type:"button",children:[t?r.jsx(Et,{className:"animate-spin"}):r.jsx(XN,{}),"Unlock writes"]})]})]})})}function Dq({sql:e,preview:t,busy:s,onConfirm:n,onClose:o}){return r.jsx(Xn,{icon:r.jsx(Xi,{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(Q,{variant:"outline",size:"sm",onClick:o,type:"button",children:"Cancel"}),r.jsxs(Q,{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 Oq({connection:e,engine:t,unlocked:s,seed:n,onWriteAccessChange:o}){const{success:l}=us(),{sendToAgent:u}=Pt(),h=wq(e),f=Nq(e),d=Cq(e,o),[p,g]=_.useState(n?.sql??""),[x,v]=_.useState(100),w=n?.nonce;_.useEffect(()=>{n&&g(n.sql)},[w]);const[k,C]=_.useState(!1),N=jq(e,t,s,g),T=p.trim().length>0&&!kq(p),j=s&&T,A=T&&!s,B=h.running||f.previewing;function O(){if(p.trim()){if(A){C(!0);return}j?(h.reset(),f.preview(p)):(f.reset(),h.run(p,x))}}function I(P){(P.metaKey||P.ctrlKey)&&P.key==="Enter"&&(P.preventDefault(),O())}function R(P){u({prompt:M$(e,t,p,P),source:{type:"database-sql-debug",label:"Debug SQL"},label:"Debug this SQL error"})}async function D(){const P=await f.commit();if(P?.committed){const G=P.affectedRows??0;l(`Committed — ${G} row${G===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(Lq,{generate:N}),r.jsx("textarea",{value:p,onChange:P=>g(P.target.value),onKeyDown:I,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(zq,{unlocked:s,updating:d.updating,onUnlock:()=>C(!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:x,onChange:P=>v(Number(P.target.value)),children:uj.map(P=>r.jsxs("option",{value:P,children:[P," rows"]},P))}),r.jsxs(Q,{size:"sm",className:de("h-7 px-3",j&&"bg-amber-600 text-white hover:bg-amber-600/90"),onClick:O,disabled:B||!p.trim(),type:"button",children:[B?r.jsx(Et,{className:"size-3.5 animate-spin"}):r.jsx(er,{className:"size-3.5"}),j?"Preview write":"Run"]})]})]})]}),r.jsx(Bq,{read:h,write:f,onDebug:R}),k?r.jsx(Mq,{connection:e,busy:d.updating,onConfirm:async()=>{await d.setUnlocked(!0),C(!1)},onClose:()=>C(!1)}):null,f.pending?r.jsx(Dq,{sql:f.pending.sql,preview:f.pending.preview,busy:f.committing,onConfirm:()=>{D()},onClose:f.cancel}):null]})}function Lq({generate:e}){const[t,s]=_.useState("");function n(){const l=t.trim();!l||e.generating||e.generate(l)}function o(l){l.key==="Enter"&&(l.preventDefault(),n())}return 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(Q,{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 zq({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(XN,{className:"size-3.5"}):r.jsx(lM,{className:"size-3.5"}),e?"Writes unlocked":"Read-only"]})}function Bq({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(Q,{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(Pq,{outcome:t.committed}):e.result?r.jsx(dj,{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 Pq({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(ln,{className:"size-3.5"}),"Committed — ",t," row",t===1?"":"s"," affected."]}),e.rows&&e.rows.length>0&&e.columns?r.jsx(dj,{columns:e.columns,rows:e.rows}):null]})}function dj({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(Xi,{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:Gc(n[l.name]),children:Gc(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 Iq({staged:e,onStageConsumed:t}={}){const{connections:s,loading:n,error:o,refresh:l}=yq();vl(l);const{error:u,success:h}=us(),{sendToAgent:f}=Pt(),[d,p]=al("database:selected",null),[g,x]=al("database:mode","browse"),[v,w]=_.useState(null),[k,C]=_.useState(null);_.useEffect(()=>{e&&(e.connection&&p(e.connection),x("query"),C({sql:e.sql,nonce:e.nonce}),t?.())},[e?.nonce]);function N(){f({prompt:E$,source:{type:"database-setup",label:"Add a database"},label:"Help me connect a database, one step at a time."})}_.useEffect(()=>{if(s.length===0){d!==null&&p(null);return}(!d||!s.some(A=>A.name===d))&&p(s[0].name)},[s,d,p]);async function T(A){try{await aO(A),h(`Removed connection "${A}".`),await l()}catch(B){u(B instanceof Error?B.message:String(B))}}function j(A){w({mode:"edit",target:A})}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(mi,{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($q,{mode:g,onChange:x}):null,r.jsx(vq,{connections:s,selected:d,onSelect:p,onAdd:()=>w({mode:"add"}),onEdit:j,onRemove:A=>{T(A)}}),r.jsx(_q,{onAddManual:()=>w({mode:"add"}),onAddWithAi:N})]})]}),r.jsx("div",{className:"min-h-0 flex-1",children:o?r.jsx("div",{className:"p-4",children:r.jsx(Ze,{variant:"muted",className:"border-destructive/40 text-destructive",children:o})}):d?g==="query"?r.jsx(Oq,{connection:d,engine:s.find(A=>A.name===d)?.engine,unlocked:s.find(A=>A.name===d)?.writeUnlocked??!1,seed:k,onWriteAccessChange:l},d):r.jsx(Hq,{connection:d}):r.jsx(Uq,{onAdd:()=>w({mode:"add"}),onAddWithAi:N})}),v?r.jsx(gq,{initial:v.mode==="edit"?v.target:void 0,onClose:()=>w(null),onSaved:l}):null]})}function $q({mode:e,onChange:t}){const s=[{value:"browse",label:"Browse",icon:cC},{value:"query",label:"SQL",icon:ml}];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 Hq({connection:e}){const{sendToAgent:t}=Pt(),{tables:s,selectedTable:n,setSelectedTable:o,sample:l,tablesError:u,rowsError:h,loadingTables:f,loadingRows:d,limit:p,offset:g,canPrev:x,canNext:v,changePageSize:w,nextPage:k,prevPage:C}=Eq(e);function N(j){t({prompt:US(e,j.table,{engine:j.engine,columns:j.columns}),source:{type:"database-table",label:`${j.table.name} table`},mode:"draft"})}function T(j){t({prompt:US(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(cC,{className:"size-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm font-semibold",children:"Tables"}),r.jsx(Xe,{variant:"outline",size:"small",children:s.length}),f?r.jsx(Et,{className:"size-3.5 animate-spin"}):null]}),u?r.jsx("div",{className:"p-3",children:r.jsx(Ze,{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(Qi,{label:`Ask AI about \`${j.qualifiedName}\``,onAsk:()=>T(j)})]},j.qualifiedName)),!f&&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(Qi,{label:`Ask AI about \`${l.table.qualifiedName}\``,onAsk:()=>N(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:uj.map(j=>r.jsxs("option",{value:j,children:[j," / page"]},j))}),r.jsx(Q,{size:"sm",variant:"outline",className:"h-6 px-2",onClick:C,disabled:!x,type:"button",children:"Prev"}),r.jsx(Q,{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(Ze,{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(Rq,{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 Uq({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(mi,{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(Q,{size:"sm",onClick:e,type:"button",children:[r.jsx(bs,{}),"Add connection"]}),r.jsxs(Q,{size:"sm",variant:"outline",onClick:t,type:"button",children:[r.jsx(pi,{}),"Add with AI"]})]})]})})}function Fq({incident:e,onReviewChanges:t}){const{error:s}=us(),{sendToAgent:n}=Pt(),[o,l]=_.useState(!1),[u,h]=_.useState(null);async function f(){l(!0);try{const{prompt:d,sessionId:p}=await hO(e.id);n({prompt:d,source:{type:"error",label:`${e.service} — ${e.level}`},label:`Fix this ${e.level} in \`${e.service}\`: ${e.title}`}),h(p)}catch(d){s(d instanceof Error?d.message:String(d))}finally{l(!1)}}return 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(Xe,{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(Xe,{variant:"outline",size:"small",children:["×",e.count]}):null]}),r.jsxs(Q,{onClick:()=>{f()},disabled:o,size:"sm",variant:"outline",children:[r.jsx(Gt,{className:"size-3.5"}),o?"Starting…":"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(FN,{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:[u?r.jsx(Ze,{variant:"muted",className:"mb-3",children:r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsx("span",{className:"text-xs",children:"The agent is working on this in the dock. A snapshot was taken first — review or undo its edits as one change-set."}),t?r.jsxs(Q,{onClick:()=>t(u),size:"sm",variant:"outline",children:[r.jsx(UN,{className:"size-3.5"}),"Review changes"]}):null]})}):null,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" snapshots the working tree, then sends the agent a repro bundle (this error, the affected file's diff, recent logs, service state, and masked env) so it can fix it — and you can revert the whole change-set if it goes sideways.`})]})]})}function b2(e){return[...e].sort((t,s)=>t.lastSeen<s.lastSeen?1:t.lastSeen>s.lastSeen?-1:s.id-t.id)}function qq(){const[e,t]=_.useState([]),[s,n]=_.useState(!1),[o,l]=_.useState(null),u=_.useCallback(h=>{t(f=>b2([...f.filter(d=>d.id!==h.id),h]))},[]);return _.useEffect(()=>{let h=!0;_C().then(d=>{h&&t(b2(d))}).catch(d=>{h&&l(d instanceof Error?d.message:String(d))});const f=new EventSource("/api/errors/stream");return f.addEventListener("open",()=>n(!0)),f.addEventListener("error",()=>n(!1)),f.addEventListener("incident",d=>{try{const p=JSON.parse(d.data);u(p)}catch{}}),()=>{h=!1,f.close()}},[u]),{incidents:e,connected:s,error:o}}function Vq({onReviewChanges:e}={}){const{incidents:t,connected:s,error:n}=qq(),[o,l]=_.useState(null);_.useEffect(()=>{if(t.length===0){l(null);return}l(h=>h!==null&&t.some(f=>f.id===h)?h:t[0].id)},[t]);const u=_.useMemo(()=>t.find(h=>h.id===o)??null,[t,o]);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(Mh,{className:"size-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm font-semibold",children:"Incidents"}),r.jsx(Xe,{variant:"outline",size:"small",children:t.length})]}),r.jsx(Xe,{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("ul",{className:"min-h-0 flex-1 divide-y divide-border overflow-auto",children:t.map(h=>r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>l(h.id),className:de("flex w-full flex-col gap-1 px-3 py-2 text-left transition-colors hover:bg-muted/50",h.id===o&&"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:h.service}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[h.count>1?r.jsxs(Xe,{variant:"outline",size:"small",children:["×",h.count]}):null,r.jsx(Xe,{variant:h.level==="error"?"danger":"secondary",appearance:"subtle",size:"small",children:h.level})]})]}),r.jsx("span",{className:"truncate font-mono text-[11px] text-muted-foreground",children:h.title}),r.jsx("span",{className:"font-mono text-[10px] text-muted-foreground/70",children:new Date(h.lastSeen).toLocaleTimeString()})]})},h.id))})]}),r.jsx("div",{className:"min-h-0 min-w-0 flex-1",children:n?r.jsx("div",{className:"p-4",children:r.jsxs(Ze,{variant:"muted",className:"border-destructive/40 text-destructive",children:["Failed to load incidents: ",n]})}):u?r.jsx(Fq,{incident:u,onReviewChanges:e}):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(Mh,{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 Zh({label:e}){return r.jsx(Ze,{variant:"muted",className:"m-4 text-center",children:e})}const Gq=900*1e3,Dc=12,xg=200;function Wq({events:e}){const[t,s]=_.useState(null),[n,o]=_.useState(null),{rows:l,windowStart:u,windowEnd:h}=_.useMemo(()=>Kq(e),[e]),f=t?l.find(d=>d.service===t)??null:null;return r.jsxs(r.Fragment,{children:[r.jsxs(xi,{className:"rounded-none border-0 border-b border-border bg-transparent",children:[r.jsxs(bi,{className:"border-b border-border px-3 py-2",children:[r.jsxs(vi,{className:"flex items-center gap-2",children:[r.jsx(to,{className:"size-3.5"}),"Runtime Monitor"]}),r.jsx(tr,{className:"text-xs",children:e.length===0?"No events yet":`${e.length} event${e.length===1?"":"s"} · last 15 min`})]}),r.jsx(_i,{className:"p-0",children:l.length===0?r.jsx(Zh,{label:"No runtime timeline events yet."}):r.jsxs("div",{className:"divide-y divide-border",children:[l.map(d=>r.jsx(Xq,{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:Qh(u)}),r.jsx("span",{children:"now"})]})]})})]}),f?r.jsx(Xn,{icon:r.jsx(to,{}),onClose:()=>s(null),title:f.service,children:r.jsx(Qq,{onSelect:o,row:f})}):null,n?r.jsx(Xn,{icon:r.jsx(to,{}),onClose:()=>o(null),title:n.title,children:r.jsx(Jq,{event:n})}):null]})}function Kq(e){const t=Date.now(),s=t,n=t-Gq;let o=e.filter(f=>{if(f.kind==="service.http")return!1;const d=new Date(f.timestamp).getTime();return!Number.isNaN(d)&&d>=n});o.length===0&&e.length>0?o=e.slice(-xg):o.length>xg&&(o=o.slice(-xg));const l=new Map;for(const f of o){const d=f.service||"·system",p=l.get(d)??[];p.push(f),l.set(d,p)}const u=Math.max(s-n,1);return{rows:Array.from(l.entries()).map(([f,d])=>{const p=[...d].sort((T,j)=>T.timestamp.localeCompare(j.timestamp)),g=new Array(Dc).fill(0),x=new Array(Dc).fill(null);for(const T of p){const j=new Date(T.timestamp).getTime(),A=Math.max(n,Math.min(s,j)),B=Math.min(Dc-1,Math.floor((A-n)/u*Dc));g[B]+=1;const O=x[B];x[B]=Yq(O,T.severity)}const v=p.filter(T=>T.severity==="error").length,w=p.filter(T=>T.severity==="warning").length,k=p.length-v-w,C=[...p].reverse().find(T=>T.severity!=="info")??null,N=v>0?"error":w>0?"warning":"info";return{service:f,events:p,errors:v,warnings:w,infos:k,buckets:g,bucketSeverity:x,lastNotable:C,worstSeverity:N}}).sort((f,d)=>{const p=x=>x.errors*1e3+x.warnings,g=p(d)-p(f);return g!==0?g:f.service.localeCompare(d.service)}),windowStart:n,windowEnd:s}}function Yq(e,t){return e==="error"||t==="error"?"error":e==="warning"||t==="warning"?"warning":"info"}function Xq({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",hj(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(Zn,{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(${Dc}, minmax(0, 1fr))`},children:t.buckets.map((l,u)=>r.jsx(Zq,{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:Qh(n)}),r.jsx("span",{children:Qh(s)})]})]})}function Zq({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",eV(s)),style:{opacity:n},title:`${e} event${e===1?"":"s"}`})}function Qq({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",hj(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:Qh(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 Jq({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",tV(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 hj(e){return e==="error"?"bg-red-500":e==="warning"?"bg-amber-500":"bg-zinc-400"}function eV(e){return e==="error"?"bg-red-500":e==="warning"?"bg-amber-500":"bg-zinc-500"}function tV(e){return e==="error"?"bg-red-600":e==="warning"?"bg-amber-600":"bg-zinc-700"}function Qh(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 Yx=150,ol=40,v2=200,_2=64,th=20;function sV({statuses:e,health:t,hasDependencies:s,onSelectService:n}){const[o,l]=_.useState(null),[u,h]=_.useState(null);_.useEffect(()=>{let p=!0;return lL().then(g=>{p&&l(g)}).catch(g=>{p&&h(g instanceof Error?g.message:String(g))}),()=>{p=!1}},[]);const f=_.useMemo(()=>o?nV(o.nodes):null,[o]);if(u)return r.jsxs(Ze,{variant:"destructive",children:["Couldn't load the dependency graph: ",u]});if(!o||!f)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(Ze,{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(Ze,{variant:"destructive",children:[r.jsxs("div",{className:"flex items-center gap-1.5 font-medium",children:[r.jsx(Xi,{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(Ze,{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:f.height,role:"img",width:f.width,children:[f.edges.map(p=>r.jsx("path",{className:"fill-none stroke-border",d:p.path,strokeWidth:1.5},`${p.from}->${p.to}`)),f.nodes.map(p=>{const g=e[p.name],x=iV(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",x.fill,x.stroke),height:ol,rx:6,width:Yx}),r.jsx("circle",{className:x.dot,cx:14,cy:ol/2,r:4}),r.jsx("text",{className:"fill-foreground text-[11px] font-medium",dominantBaseline:"middle",x:26,y:ol/2,children:rV(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 nV(e){const t=new Map(e.map(g=>[g.name,g.dependsOn])),s=new Map,n=new Set,o=g=>{const x=s.get(g);if(x!==void 0)return x;if(n.has(g))return 0;n.add(g);const v=t.get(g)??[],w=v.length===0?0:Math.max(...v.map(k=>o(k)+1));return n.delete(g),s.set(g,w),w};for(const g of e)o(g.name);const l=new Map,u=e.map(g=>{const x=s.get(g.name)??0,v=l.get(x)??0;return l.set(x,v+1),{...g,x:th+x*v2,y:th+v*_2}}),h=new Map(u.map(g=>[g.name,g])),f=u.flatMap(g=>g.dependsOn.flatMap(x=>{const v=h.get(x);if(!v)return[];const w=v.x+Yx,k=v.y+ol/2,C=g.x,N=g.y+ol/2,T=(w+C)/2;return[{from:x,to:g.name,path:`M ${w} ${k} C ${T} ${k}, ${T} ${N}, ${C} ${N}`}]})),d=Math.max(0,...u.map(g=>s.get(g.name)??0)),p=Math.max(1,...l.values());return{nodes:u,edges:f,width:th*2+d*v2+Yx,height:th*2+(p-1)*_2+ol}}function iV(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 rV(e,t=18){return e.length>t?`${e.slice(0,t-1)}…`:e}function aV({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(y2,{icon:r.jsx(bn,{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(y2,{icon:r.jsx(bs,{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 y2({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 oV({health:e}){if(!e)return null;const t=e.processTree,s=e.status==="healthy"||e.status==="unknown"?void 0:dV(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",lV(e.status)),children:[r.jsx("span",{className:"inline-flex shrink-0",children:r.jsx(to,{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(sR,{className:"size-3"}),t.processCount," ",t.processCount===1?"process":"processes"]}),r.jsxs("span",{children:[uV(t.cpuPercent)," CPU"]}),r.jsxs("span",{className:"inline-flex items-center gap-1 font-mono",children:[r.jsx(pM,{className:"size-3"}),cV(t.rssMb)," RAM"]})]}):null]})}function lV(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 cV(e){return Number.isInteger(e)?`${e} MB`:`${e.toFixed(1)} MB`}function uV(e){return`${e.toFixed(1)}%`}function dV(e){return e.replace(/^Recent error log:\s*/i,"Recent stderr: ").replace(/:\s*\d+(?:\.\d+)? MB RSS\.?$/i,"").replace(/\s+RSS\.?$/i,"")}function hV({ports:e}){const t=e.filter(n=>n.state==="occupied").length,s=e.filter(n=>n.state==="managed").length;return r.jsxs(xi,{className:"rounded-none border-0 border-b border-border bg-transparent",children:[r.jsxs(bi,{className:"border-b border-border px-3 py-2",children:[r.jsxs(vi,{className:"flex items-center gap-2",children:[r.jsx(CM,{className:"size-3.5"}),"Ports"]}),r.jsxs(tr,{className:"text-xs",children:[s," managed, ",t," occupied by other"]})]}),r.jsx(_i,{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(fV,{port:n})]},n.port))}):r.jsx(Zh,{label:"No configured ports yet."})})]})}function fV({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(Xe,{className:de(e&&"max-w-36 truncate"),variant:n,children:s})}function mV({onChange:e,value:t}){return r.jsxs("label",{className:"relative block",children:[r.jsx(i6,{className:"pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground"}),r.jsx(ht,{"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 pV({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:gV(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,bV(l.text,o)]})]},`${l.timestamp}-${l.stream}-${u}`)):r.jsx("div",{className:"p-3 text-muted-foreground",children:s})})}function gV(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 xV(e){return`${e.timestamp} ${e.stream} ${e.text}`}function bV(e,t){const s=t.trim();if(!s)return e;const n=e.toLowerCase(),o=s.toLowerCase(),l=[];let u=0,h=n.indexOf(o);for(;h!==-1;){h>u&&l.push(e.slice(u,h));const f=h+s.length;l.push(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,f)},`${h}-${f}`)),u=f,h=n.indexOf(o,u)}return u<e.length&&l.push(e.slice(u)),l}function w2(e){return`${e.kind}:${e.name}`}function vV(e,t=!1,s={}){const[n,o]=_.useState(),[l,u]=_.useState(),[h,f]=_.useState(e.kind==="source"),d=JSON.stringify(s);return _.useEffect(()=>{o(void 0),u(void 0);let p=!1;const g=async()=>{try{if(e.kind==="service"){const v=await jC(e.name,s);p||(o(v.logs),f(v.queryable),u(void 0))}else{const v=await kC(e.name,s);p||(o(v),f(!0),u(void 0))}}catch(v){p||u(v instanceof Error?v.message:String(v))}};g();const x=window.setInterval(g,t?1e3:2e3);return()=>{p=!0,window.clearInterval(x)}},[e.kind,e.name,t,d]),{logs:n,error:l,queryable:h}}const _V=[{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 fj({target:e,query:t,setQuery:s,streaming:n,setStreaming:o,hideStdout:l,setHideStdout:u,fill:h=!1,leading:f,trailing:d}){const p=e.kind==="source",[g,x]=_.useState(""),[v,w]=_.useState(""),[k,C]=_.useState(t);_.useEffect(()=>{const K=window.setTimeout(()=>C(t),300);return()=>window.clearTimeout(K)},[t]);const N=_.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:T,error:j,queryable:A}=vV(e,n,N),B=p||A,O=_.useRef(null),I=_.useRef(!0),[R,D]=_.useState([]),[P,G]=_.useState(!1),Z=JSON.stringify(N);_.useEffect(()=>{D([])},[Z,e.kind,e.name]);const $=_.useMemo(()=>{const K=T??[];if(R.length===0)return K;const Y=new Set(R.map(V=>V.cursor).filter(Boolean));return[...R,...K.filter(V=>!V.cursor||!Y.has(V.cursor))]},[T,R]),q=(R[0]??(T??[])[0])?.cursor;async function F(){if(!(!B||!q||P)){G(!0),I.current=!1;try{const K={...N,before:q,lines:200},Y=e.kind==="source"?await kC(e.name,K):(await jC(e.name,K)).logs;Y.length&&D(V=>{const ie=new Set(V.map(ye=>ye.cursor).filter(Boolean));return[...Y.filter(ye=>!ye.cursor||!ie.has(ye.cursor)),...V]})}finally{G(!1)}}}const L=t.trim().toLowerCase(),X=_.useMemo(()=>{let K=$;return l&&(K=K.filter(Y=>Y.stream==="stderr")),L&&(K=K.filter(Y=>xV(Y).toLowerCase().includes(L))),K},[$,l,L]);_.useEffect(()=>{const K=O.current;if(!K)return;const Y=()=>{const V=K.scrollHeight-K.scrollTop-K.clientHeight;I.current=V<40};return Y(),K.addEventListener("scroll",Y,{passive:!0}),()=>K.removeEventListener("scroll",Y)},[]),_.useEffect(()=>{if(!n||!I.current||X.length===0)return;const K=O.current;K&&(K.scrollTop=K.scrollHeight)},[n,X]);const U=T?L?`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:[f,r.jsx(mV,{onChange:s,value:t}),B?r.jsxs(r.Fragment,{children:[r.jsx("select",{"aria-label":"Time range",className:"h-8 rounded-md border border-border bg-background px-2 text-xs",onChange:K=>x(K.target.value),value:g,children:_V.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(S2,{active:l,activeClassName:"border-amber-600 bg-amber-50 text-amber-700 dark:border-amber-400/40 dark:bg-amber-500/15 dark:text-amber-300",onClick:()=>u(!l),children:[r.jsx(ER,{}),"Errors only"]}),r.jsxs(S2,{active:n,activeClassName:"border-emerald-600 bg-emerald-50 text-emerald-700 dark:border-emerald-400/40 dark:bg-emerald-500/15 dark:text-emerald-300",onClick:()=>o(!n),children:[r.jsx(XM,{}),n?"Streaming":"Stream"]}),B&&q?r.jsxs(Q,{disabled:P,onClick:()=>{F()},size:"sm",type:"button",variant:"outline",children:[r.jsx(df,{}),P?"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(pV,{className:de("rounded border border-border/60",h?"min-h-0 flex-1":"max-h-80"),containerRef:O,emptyText:U,logs:X,query:t})]})}function S2({active:e,activeClassName:t,children:s,onClick:n}){return r.jsx(Q,{"aria-pressed":e,className:e?t:void 0,onClick:n,size:"sm",type:"button",variant:"outline",children:s})}function yV(e,t){return e.kind===t.kind&&e.name===t.name}function wV({options:e,target:t,onChange:s,className:n}){const o=e.findIndex(u=>yV(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,f)=>h.group===u?r.jsx("option",{value:String(f),children:h.label},`${h.group}:${h.label}`):null)},u))})}function SV({serviceName:e}){const[t,s]=_.useState(""),[n,o]=_.useState(!1),[l,u]=_.useState(!1),[h,f]=_.useState(!1),d=r.jsx(fj,{fill:!0,hideStdout:l,query:t,setHideStdout:u,setQuery:s,setStreaming:o,streaming:n,target:{kind:"service",name:e},trailing:r.jsx(Q,{"aria-label":h?"Exit fullscreen logs":"Expand logs",className:"text-muted-foreground hover:text-foreground",onClick:()=>f(p=>!p),size:"icon-sm",title:h?"Exit fullscreen":"Expand",type:"button",variant:"ghost",children:h?r.jsx(JN,{}):r.jsx(ZN,{})})});return h?r.jsx(Ib,{onClose:()=>f(!1),title:`Logs — ${e}`,children:d}):r.jsx("div",{className:"h-[60vh] min-h-[24rem]",children:d})}function Ib({title:e,onClose:t,children:s,maxWidthClass:n="max-w-6xl"}){return _.useEffect(()=>{function o(l){l.key==="Escape"&&t()}return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[t]),ka.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(Q,{"aria-label":"Close logs",onClick:t,size:"icon",type:"button",variant:"ghost",children:r.jsx(Kt,{})})]}),r.jsx("div",{className:"min-h-0 flex-1 p-3",children:s})]})}),document.body)}const kV={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 NV({onClose:e,onAdded:t}){const[s,n]=_.useState(""),[o,l]=_.useState("journald"),[u,h]=_.useState(""),[f,d]=_.useState(""),[p,g]=_.useState(""),[x,v]=_.useState(""),[w,k]=_.useState(""),[C,N]=_.useState(""),[T,j]=_.useState(),[A,B]=_.useState(!1);async function O(){B(!0),j(void 0);try{const I={name:s.trim(),kind:"command"};o==="file"?(I.kind="file",I.path=f.trim()):o==="ssh"?(I.kind="ssh",I.host=u.trim(),I.path=f.trim()):o==="command"?(I.kind="command",I.command=p.trim(),x.trim()&&(I.cwd=x.trim())):o==="journald"?(I.driver="journald",I.unit=w.trim(),u.trim()&&(I.host=u.trim())):o==="docker"&&(I.driver="docker",I.container=C.trim(),u.trim()&&(I.host=u.trim()));const R=await QO(I);t(R,I.name),e()}catch(I){j(I instanceof Error?I.message:String(I))}finally{B(!1)}}return r.jsx(Xn,{icon:r.jsx(nC,{}),onClose:e,size:"md",title:"Add log source",children:r.jsxs("form",{className:"flex flex-col gap-3 p-4 text-xs",onSubmit:I=>{I.preventDefault(),O()},children:[r.jsx(Sr,{label:"Name",children:r.jsx(ht,{autoFocus:!0,onChange:I=>n(I.target.value),placeholder:"PROD",value:s})}),r.jsxs(Sr,{label:"Type",children:[r.jsxs("select",{className:"h-9 w-full rounded-md border border-border bg-background px-2 text-xs",onChange:I=>l(I.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:kV[o]})]}),o==="journald"||o==="docker"?r.jsx(Sr,{label:"Host (optional — leave blank to run locally)",children:r.jsx(ht,{onChange:I=>h(I.target.value),placeholder:"jobjourney-prod (an alias from ~/.ssh/config)",value:u})}):null,o==="journald"?r.jsx(Sr,{label:"Unit",children:r.jsx(ht,{onChange:I=>k(I.target.value),placeholder:"jobjourney",value:w})}):null,o==="docker"?r.jsx(Sr,{label:"Container",children:r.jsx(ht,{onChange:I=>N(I.target.value),placeholder:"brainctl-api",value:C})}):null,o==="ssh"?r.jsx(Sr,{label:"Host",children:r.jsx(ht,{onChange:I=>h(I.target.value),placeholder:"prod (an alias from ~/.ssh/config)",value:u})}):null,o==="file"||o==="ssh"?r.jsx(Sr,{label:o==="ssh"?"Remote path":"File path",children:r.jsx(ht,{onChange:I=>d(I.target.value),placeholder:"/var/log/app/out.log",value:f})}):null,o==="command"?r.jsxs(r.Fragment,{children:[r.jsx(Sr,{label:"Command",children:r.jsx(ht,{onChange:I=>g(I.target.value),placeholder:"kubectl logs -l app=myapp --tail 500",value:p})}),r.jsx(Sr,{label:"Working directory (optional)",children:r.jsx(ht,{onChange:I=>v(I.target.value),placeholder:"/srv/app",value:x})})]}):null,T?r.jsx("div",{className:"text-red-600",children:T}):null,r.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[r.jsx(Q,{onClick:e,size:"sm",type:"button",variant:"outline",children:"Cancel"}),r.jsx(Q,{disabled:A||!s.trim(),size:"sm",type:"submit",children:A?"Saving…":"Add source"})]})]})})}function Sr({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 k2=4;function CV({services:e,initialService:t,onClose:s}){const[n,o]=_.useState([]),[l,u]=_.useState(!1),[h,f]=_.useState(()=>[0]),[d,p]=_.useState(()=>{const j=t?{kind:"service",name:t}:e[0]?{kind:"service",name:e[0]}:void 0;return j?{0:j}:{}}),g=_.useRef(1);_.useEffect(()=>{let j=!1;return ZO().then(A=>{j||o(A)}),()=>{j=!0}},[]);const x=[...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=x.map(j=>j.target);function w(){if(h.length>=k2||v.length===0)return;const j=g.current++,A=new Set(Object.values(d).map(w2)),B=v.find(O=>!A.has(w2(O)))??v[0];f(O=>[...O,j]),p(O=>({...O,[j]:B}))}function k(j){f(A=>A.filter(B=>B!==j)),p(A=>{const B={...A};return delete B[j],B})}function C(j,A){p(B=>({...B,[j]:A}))}function N(j,A){o(j);const B=h[0];B!==void 0&&C(B,{kind:"source",name:A})}const T=r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{children:"Logs"}),r.jsxs(Q,{onClick:()=>u(!0),size:"sm",type:"button",variant:"outline",children:[r.jsx(bs,{}),"Add source"]}),r.jsxs(Q,{disabled:h.length>=k2||v.length===0,onClick:w,size:"sm",type:"button",variant:"outline",children:[r.jsx(bs,{}),"Add pane"]})]});return r.jsxs(r.Fragment,{children:[r.jsx(Ib,{maxWidthClass:"max-w-[1500px]",onClose:s,title:T,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(Q,{className:"mt-2",onClick:()=>u(!0),size:"sm",type:"button",children:[r.jsx(bs,{}),"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(EV,{onChangeTarget:A=>C(j,A),onRemove:h.length>1?()=>k(j):void 0,options:x,target:d[j]??v[0]},j))})}),l?r.jsx(NV,{onAdded:N,onClose:()=>u(!1)}):null]})}function EV({options:e,target:t,onChangeTarget:s,onRemove:n}){const[o,l]=_.useState(""),[u,h]=_.useState(!0),[f,d]=_.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(fj,{fill:!0,hideStdout:f,leading:r.jsx(wV,{onChange:s,options:e,target:t}),query:o,setHideStdout:d,setQuery:l,setStreaming:h,streaming:u,target:t,trailing:n?r.jsx(Q,{"aria-label":"Remove pane",onClick:n,size:"icon",type:"button",variant:"ghost",children:r.jsx(Kt,{})}):void 0})})}function jV({runtime:e,reloading:t,onReload:s}){if(!e?.stale)return null;const n=e.staleFiles,o=n.length===1?`${n[0].relativePath} was edited`:`${n.length} config files were edited`;return r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 rounded border border-amber-500/40 bg-amber-500/10 px-2.5 py-1.5 text-amber-700 dark:text-amber-400",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Xi,{className:"size-4 shrink-0"}),r.jsxs("span",{children:["Running with a stale configuration — ",o," after this service started. Reload to apply."]})]}),r.jsxs(Q,{disabled:t,onClick:s,size:"sm",type:"button",variant:"outline",children:[r.jsx(e6,{})," ",t?"Reloading…":"Reload service"]})]})}function AV({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:f=>o(u,{key:f.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:f=>o(u,{value:f.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($N,{size:14}):r.jsx(q0,{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(gi,{size:14})})})]},u)})})]})})}function TV({serviceName:e,onClose:t,onPick:s}){const[n,o]=_.useState(),[l,u]=_.useState(),[h,f]=_.useState(!0),[d,p]=_.useState();_.useEffect(()=>{let v=!1;return f(!0),u(void 0),(async()=>{try{const w=await dL(e,d);v||o(w)}catch(w){v||u(w instanceof Error?w.message:String(w))}finally{v||f(!1)}})(),()=>{v=!0}},[e,d]);function g(v){if(v.kind==="directory"){p(v.relativePath);return}v.supported&&s(v.relativePath)}function x(){if(!n||n.isRoot)return;const v=n.relativePath,w=v.includes("/")?v.slice(0,v.lastIndexOf("/")):"";p(w||void 0)}return r.jsx(Xn,{icon:r.jsx(ff,{}),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(Q,{disabled:!n||n.isRoot,onClick:x,size:"sm",type:"button",variant:"outline",children:[r.jsx(df,{})," 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(va,{size:14}):r.jsx(qN,{size:14}),r.jsx("span",{className:"flex-1 truncate font-mono",children:v.name}),!w&&v.format?r.jsx(Xe,{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 RV(e){const{error:t,success:s}=us(),[n,o]=_.useState(),[l,u]=_.useState(!1),h=_.useCallback(async()=>{try{o(await pL(e))}catch{o(void 0)}},[e]);_.useEffect(()=>{h()},[h]);const f=_.useCallback(async()=>{u(!0);try{await EC(e),s(`Reloaded ${e} with the latest configuration.`),await h()}catch(d){t(d instanceof Error?d.message:String(d))}finally{u(!1)}},[e,h,t,s]);return{runtime:n,reloading:l,refresh:h,reload:f}}function mj(e){if(!e.trim())return e;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function MV(e){const{error:t,success:s}=us(),[n,o]=_.useState([]),[l,u]=_.useState(),[h,f]=_.useState(),[d,p]=_.useState(!0),[g,x]=_.useState(!1),[v,w]=_.useState(!1),[k,C]=_.useState(!1),[N,T]=_.useState();_.useEffect(()=>{let P=!1;return p(!0),T(void 0),(async()=>{try{const G=await hL(e);if(P)return;o(G.files),G.files.length>0?u(Z=>Z??G.files[0].path):(u(void 0),f(void 0))}catch(G){P||T(G instanceof Error?G.message:String(G))}finally{P||p(!1)}})(),()=>{P=!0}},[e]);const j=_.useCallback(async P=>{x(!0),T(void 0);try{const G=await lw(e,P),Z={path:G.path,relativePath:G.relativePath,format:G.format};G.format==="env"?f({info:Z,exists:G.exists,rows:G.entries.map($=>({...$,reveal:!1}))}):f({info:Z,exists:G.exists,text:G.format==="json"?mj(G.content):G.content}),C(!1)}catch(G){T(G instanceof Error?G.message:String(G))}finally{x(!1)}},[e]);_.useEffect(()=>{l&&j(l)},[l,j]);function A(P,G){f(Z=>{if(!Z?.rows)return Z;const $=Z.rows.map((q,F)=>F===P?{...q,...G}:q);return{...Z,rows:$}}),C(!0)}function B(){f(P=>P?.rows?{...P,rows:[...P.rows,{key:"",value:"",secret:!1,reveal:!0}]}:P),C(!0)}function O(P){f(G=>G?.rows?{...G,rows:G.rows.filter((Z,$)=>$!==P)}:G),C(!0)}function I(P){f(G=>G&&{...G,text:P}),C(!0)}async function R(){if(h){w(!0);try{if(h.info.format==="env"&&h.rows){const P=await fL(e,h.info.path,h.rows.map(G=>({key:G.key.trim(),value:G.value})));f({info:{path:P.path,relativePath:P.relativePath,format:P.format},exists:P.exists,rows:P.entries.map(G=>({...G,reveal:!1}))}),s(`Saved ${P.entries.length} entries to ${P.relativePath}.`)}else if(h.text!==void 0){const P=await mL(e,h.info.path,h.text);f({info:{path:P.path,relativePath:P.relativePath,format:P.format},exists:P.exists,text:P.content}),s(`Saved ${P.relativePath}.`)}C(!1)}catch(P){t(P instanceof Error?P.message:String(P))}finally{w(!1)}}}async function D(P){try{const G=await lw(e,P),Z={path:G.path,relativePath:G.relativePath,format:G.format};return o($=>$.some(q=>q.path===Z.path)?$:[...$,Z]),u(Z.path),s(`Loaded ${Z.relativePath}.`),!0}catch(G){return t(G instanceof Error?G.message:String(G)),!1}}return{files:n,selectedPath:l,setSelectedPath:u,loaded:h,loadingList:d,loadingFile:g,saving:v,dirty:k,error:N,addRow:B,removeRow:O,updateRow:A,updateText:I,save:R,pickFile:D}}function DV({serviceName:e}){const{files:t,selectedPath:s,setSelectedPath:n,loaded:o,loadingList:l,loadingFile:u,saving:h,dirty:f,error:d,addRow:p,removeRow:g,updateRow:x,updateText:v,save:w,pickFile:k}=MV(e),C=RV(e),[N,T]=_.useState(!1),[j,A]=_.useState(!1);async function B(){await w(),await C.refresh()}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.jsx(jV,{onReload:()=>{C.reload()},reloading:C.reloading,runtime:C.runtime}),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:O=>n(O.target.value),value:s??"",children:t.map(O=>r.jsxs("option",{value:O.path,children:[O.relativePath," [",O.format,"]"]},O.path))}):r.jsx("span",{className:"text-muted-foreground",children:"none detected"}),r.jsxs(Q,{onClick:()=>A(!0),size:"sm",type:"button",variant:"outline",children:[r.jsx(ff,{})," 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(Q,{onClick:()=>T(O=>!O),size:"sm",type:"button",variant:"outline",children:[N?r.jsx($N,{}):r.jsx(q0,{}),N?"Hide secrets":"Reveal secrets"]}),r.jsxs(Q,{onClick:p,size:"sm",type:"button",variant:"outline",children:[r.jsx(bs,{})," Add"]})]}):null,r.jsxs(Q,{disabled:!f||h||!o,onClick:()=>{B()},size:"sm",type:"button",children:[r.jsx(sC,{})," ",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(AV,{revealAll:N,rows:o.rows,onAdd:p,onRemove:g,onUpdate:x})}):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(Q,{onClick:()=>v(mj(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:O=>v(O.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,j?r.jsx(TV,{onClose:()=>A(!1),onPick:O=>{k(O).then(I=>{I&&A(!1)})},serviceName:e}):null]})}function OV({serviceName:e,status:t,timeline:s,onRefresh:n}){const{error:o,success:l}=us(),[u,h]=_.useState(!1),f=t?.inspector,d=t?.state==="running",p=_.useMemo(()=>s.filter(v=>v.kind==="service.http"&&v.service===e).map(v=>{const w=v.data??{};return{id:w.id??v.id,startedAt:v.timestamp,method:w.method??"?",path:w.path??"?",status:w.status??0,durationMs:w.durationMs??0,reqBytes:w.reqBytes??0,resBytes:w.resBytes??0}}).slice(-500).reverse(),[s,e]);async function g(v){h(!0);try{await Ri(`/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(!f?.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(Q,{disabled:u,onClick:()=>g(!0),size:"sm",type:"button",children:[r.jsx(er,{})," Start HTTP inspector"]})]});const x=f.port?`http://127.0.0.1:${f.port}`:void 0;return r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:"text-muted-foreground",children:"Inspect URL:"}),x?r.jsxs(r.Fragment,{children:[r.jsx("code",{className:"rounded bg-background px-1.5 py-0.5 font-mono",children:x}),r.jsxs(Q,{onClick:()=>{navigator.clipboard.writeText(x),l("Copied inspect URL.")},size:"sm",type:"button",variant:"outline",children:[r.jsx(Th,{})," Copy"]}),r.jsx(Q,{onClick:()=>{gf(x)},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 :",f.upstreamPort??"?"]}),r.jsxs(Q,{disabled:u,onClick:()=>g(!1),size:"sm",type:"button",variant:"outline",children:[r.jsx(ro,{})," 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",LV(v.status)),children:v.status}),r.jsx("td",{className:"py-1 pr-3 text-right text-muted-foreground",children:zV(v.resBytes)}),r.jsx("td",{className:"py-1 pr-3 text-right",children:v.durationMs.toFixed(1)})]},v.id))})]})})]})}function LV(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 zV(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function BV({serviceName:e}){const[t,s]=_.useState(null),[n,o]=_.useState(null),[l,u]=_.useState(()=>Date.now());return _.useEffect(()=>{let h=!1;async function f(){try{const p=await gL(e);h||(s(p),u(Date.now()),o(null))}catch(p){h||o(p instanceof Error?p.message:String(p))}}f();const d=setInterval(()=>{f()},3e3);return()=>{h=!0,clearInterval(d)}},[e]),n?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(PV,{series:t,now:l}):r.jsx("p",{className:"text-muted-foreground",children:"Loading metrics…"})}function PV({series:e,now:t}){const{samples:s}=e,n=_.useMemo(()=>N2(s,f=>f.cpu),[s]),o=_.useMemo(()=>N2(s,f=>f.rss),[s]),l=e.startedAt?new Date(e.startedAt):null,u=l?t-l.getTime():null,h=s.length>1?s[s.length-1].t-s[0].t:0;return 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(sh,{accent:"#22c55e",label:"CPU",value:`${n.last.toFixed(1)}%`,sub:`peak ${n.max.toFixed(1)}% · avg ${n.avg.toFixed(1)}%`}),r.jsx(sh,{accent:"#3b82f6",label:"Memory",value:bg(o.last),sub:`peak ${bg(o.max)} · avg ${bg(o.avg)}`}),r.jsx(sh,{accent:"#a855f7",label:"Uptime",value:u!=null?j2(u):"—",sub:l?`since ${l.toLocaleTimeString()}`:"not running"}),r.jsx(sh,{accent:"#f59e0b",label:"Samples",value:String(s.length),sub:h?`over ${j2(h)}`:"collecting…"})]}),r.jsx(E2,{label:"CPU",samples:s,pick:f=>f.cpu,summary:n,color:"#22c55e",suffix:"%",unit:"percent"}),r.jsx(E2,{label:"Memory (RSS)",samples:s,pick:f=>f.rss,summary:o,color:"#3b82f6",suffix:" MB",unit:"mb"})]})}function N2(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 sh({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 Zo=160,C2=44,IV=20;function E2({label:e,samples:t,pick:s,summary:n,color:o,suffix:l,unit:u}){const h=_.useMemo(()=>`metric-grad-${u}-${Math.random().toString(36).slice(2,8)}`,[u]),f=t.map(s),d=Math.max(...f,u==="percent"?10:1),p=$V(d),g=0,x=p-g||1,v=t[0].t,w=t[t.length-1].t,k=Math.max(1,w-v),C=P=>(P-v)/k*1e3,N=P=>(1-(P-g)/x)*1e3,T=t.map(P=>`${C(P.t).toFixed(1)},${N(s(P)).toFixed(1)}`),j=`M0,1000 L${T.join(" L")} L1000,1000 Z`,A=`M${T.join(" L")}`,B=C(w),O=N(n.last),I=N(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:C2,height:Zo},children:R.map(P=>r.jsx("span",{className:"pr-1 leading-none",children:HV(g+P*x,u)},P))}),r.jsxs("div",{className:"relative min-w-0 flex-1",style:{height:Zo},children:[R.map((P,G)=>r.jsx("div",{className:"pointer-events-none absolute inset-x-0 border-t border-border/40",style:{top:`${P===1?0:P===0?Zo-1:(1-P)*Zo}px`,borderStyle:G===R.length-1?"solid":"dashed"}},P)),r.jsx("div",{className:"pointer-events-none absolute inset-x-0 border-t border-dashed",style:{top:`${I/1e3*Zo}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:A,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:`${B/1e3*100}%`,top:`${O/1e3*Zo}px`,backgroundColor:o,boxShadow:`0 0 0 4px ${o}33`}})]})]}),r.jsx("div",{className:"flex font-mono text-[10px] text-muted-foreground",style:{height:IV,paddingLeft:C2},children:r.jsx("div",{className:"relative flex-1",children:Array.from({length:D+1},(P,G)=>{const Z=G/D,$=v+Z*k;return r.jsx("span",{className:"absolute top-1 whitespace-nowrap",style:{left:`${Z*100}%`,transform:G===0?"translateX(0)":G===D?"translateX(-100%)":"translateX(-50%)"},children:UV($-w)},G)})})})]})]})}function $V(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 HV(e,t){return t==="percent"?`${e.toFixed(0)}%`:e>=1024?`${(e/1024).toFixed(1)}G`:`${e.toFixed(0)}M`}function bg(e){return e>=1024?`${(e/1024).toFixed(2)} GB`:`${e.toFixed(0)} MB`}function j2(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 UV(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 FV({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 qV=2,VV=1,GV=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,s=window.getComputedStyle(this._terminal.element.parentElement),n=parseInt(s.getPropertyValue("height")),o=Math.max(0,parseInt(s.getPropertyValue("width"))),l=window.getComputedStyle(this._terminal.element),u={top:parseInt(l.getPropertyValue("padding-top")),bottom:parseInt(l.getPropertyValue("padding-bottom")),right:parseInt(l.getPropertyValue("padding-right")),left:parseInt(l.getPropertyValue("padding-left"))},h=u.top+u.bottom,f=u.right+u.left,d=n-h,p=o-f-t;return{cols:Math.max(qV,Math.floor(p/e.css.cell.width)),rows:Math.max(VV,Math.floor(d/e.css.cell.height))}}};var pj=Object.defineProperty,WV=Object.getOwnPropertyDescriptor,KV=(e,t)=>{for(var s in t)pj(e,s,{get:t[s],enumerable:!0})},ds=(e,t,s,n)=>{for(var o=n>1?void 0:n?WV(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&&pj(t,s,o),o},Fe=(e,t)=>(s,n)=>t(s,n,e),A2="Terminal input",Xx={get:()=>A2,set:e=>A2=e},T2="Too much output to announce, navigate to rows manually to read",Zx={get:()=>T2,set:e=>T2=e};function YV(e){return e.replace(/\r?\n/g,"\r")}function XV(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function ZV(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function QV(e,t,s,n){if(e.stopPropagation(),e.clipboardData){let o=e.clipboardData.getData("text/plain");gj(o,t,s,n)}}function gj(e,t,s,n){e=YV(e),e=XV(e,s.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(e,!0),t.value=""}function xj(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 R2(e,t,s,n,o){xj(e,t,s),o&&n.rightClickSelect(e),t.value=n.selectionText,t.select()}function pa(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function jf(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 JV=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}},eG=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let s=e.length;if(!s)return 0;let n=0,o,l,u,h,f=0,d=0;if(this.interim[0]){let x=!1,v=this.interim[0];v&=(v&224)===192?31:(v&240)===224?15:7;let w=0,k;for(;(k=this.interim[++w]&63)&&w<4;)v<<=6,v|=k;let C=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,N=C-w;for(;d<N;){if(d>=s)return 0;if(k=e[d++],(k&192)!==128){d--,x=!0;break}else this.interim[w++]=k,v<<=6,v|=k&63}x||(C===2?v<128?d--:t[n++]=v:C===3?v<2048||v>=55296&&v<=57343||v===65279||(t[n++]=v):v<65536||v>1114111||(t[n++]=v)),this.interim.fill(0)}let p=s-4,g=d;for(;g<s;){for(;g<p&&!((o=e[g])&128)&&!((l=e[g+1])&128)&&!((u=e[g+2])&128)&&!((h=e[g+3])&128);)t[n++]=o,t[n++]=l,t[n++]=u,t[n++]=h,g+=4;if(o=e[g++],o<128)t[n++]=o;else if((o&224)===192){if(g>=s)return this.interim[0]=o,n;if(l=e[g++],(l&192)!==128){g--;continue}if(f=(o&31)<<6|l&63,f<128){g--;continue}t[n++]=f}else if((o&240)===224){if(g>=s)return this.interim[0]=o,n;if(l=e[g++],(l&192)!==128){g--;continue}if(g>=s)return this.interim[0]=o,this.interim[1]=l,n;if(u=e[g++],(u&192)!==128){g--;continue}if(f=(o&15)<<12|(l&63)<<6|u&63,f<2048||f>=55296&&f<=57343||f===65279)continue;t[n++]=f}else if((o&248)===240){if(g>=s)return this.interim[0]=o,n;if(l=e[g++],(l&192)!==128){g--;continue}if(g>=s)return this.interim[0]=o,this.interim[1]=l,n;if(u=e[g++],(u&192)!==128){g--;continue}if(g>=s)return this.interim[0]=o,this.interim[1]=l,this.interim[2]=u,n;if(h=e[g++],(h&192)!==128){g--;continue}if(f=(o&7)<<18|(l&63)<<12|(u&63)<<6|h&63,f<65536||f>1114111)continue;t[n++]=f}}return n}},bj="",xa=" ",xu=class vj{constructor(){this.fg=0,this.bg=0,this.extended=new Jh}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 vj;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}},Jh=class _j{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 _j(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},fi=class yj extends xu{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Jh,this.combinedData=""}static fromCharData(t){let s=new yj;return s.setFromCharData(t),s}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?pa(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let s=!1;if(t[1].length>2)s=!0;else if(t[1].length===2){let n=t[1].charCodeAt(0);if(55296<=n&&n<=56319){let o=t[1].charCodeAt(1);56320<=o&&o<=57343?this.content=(n-55296)*1024+o-56320+65536|t[2]<<22:s=!0}else s=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;s&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},M2="di$target",Qx="di$dependencies",vg=new Map;function tG(e){return e[Qx]||[]}function Hs(e){if(vg.has(e))return vg.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");sG(t,s,o)};return t._id=e,vg.set(e,t),t}function sG(e,t,s){t[M2]===t?t[Qx].push({id:e,index:s}):(t[Qx]=[{id:e,index:s}],t[M2]=t)}var _n=Hs("BufferService"),wj=Hs("CoreMouseService"),fo=Hs("CoreService"),nG=Hs("CharsetService"),$b=Hs("InstantiationService"),Sj=Hs("LogService"),yn=Hs("OptionsService"),kj=Hs("OscLinkService"),iG=Hs("UnicodeService"),bu=Hs("DecorationService"),Jx=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 fi,u=s.getTrimmedLength(),h=-1,f=-1,d=!1;for(let p=0;p<u;p++)if(!(f===-1&&!s.hasContent(p))){if(s.loadCell(p,l),l.hasExtendedAttrs()&&l.extended.urlId)if(f===-1){f=p,h=l.extended.urlId;continue}else d=l.extended.urlId!==h;else f!==-1&&(d=!0);if(d||f!==-1&&p===u-1){let g=this._oscLinkService.getLinkData(h)?.uri;if(g){let x={start:{x:f+1,y:e},end:{x:p+(!d&&p===u-1?1:0),y:e}},v=!1;if(!o?.allowNonHttpProtocols)try{let w=new URL(g);["http:","https:"].includes(w.protocol)||(v=!0)}catch{v=!0}v||n.push({text:g,range:x,activate:(w,k)=>o?o.activate(w,k,x):rG(w,k),hover:(w,k)=>o?.hover?.(w,k,x),leave:(w,k)=>o?.leave?.(w,k,x)})}d=!1,l.hasExtendedAttrs()&&l.extended.urlId?(f=p,h=l.extended.urlId):(f=-1,h=-1)}}t(n)}};Jx=ds([Fe(0,_n),Fe(1,yn),Fe(2,kj)],Jx);function rG(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 Af=Hs("CharSizeService"),Mr=Hs("CoreBrowserService"),Hb=Hs("MouseService"),Dr=Hs("RenderService"),aG=Hs("SelectionService"),Nj=Hs("CharacterJoinerService"),yl=Hs("ThemeService"),Cj=Hs("LinkProviderService"),oG=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?D2.isErrorNoTelemetry(e)?new D2(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)}},lG=new oG;function kh(e){cG(e)||lG.onUnexpectedError(e)}var e0="Canceled";function cG(e){return e instanceof uG?!0:e instanceof Error&&e.name===e0&&e.message===e0}var uG=class extends Error{constructor(){super(e0),this.name=this.message}};function dG(e){return new Error(`Illegal argument: ${e}`)}var D2=class t0 extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof t0)return t;let s=new t0;return s.message=t.message,s.stack=t.stack,s}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},s0=class Ej extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,Ej.prototype)}};function Vn(e,t=0){return e[e.length-(1+t)]}var hG;(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})(hG||={});function fG(e,t){let s=this,n=!1,o;return function(){return n||(n=!0,t||(o=e.apply(s,arguments))),o}}var jj;(e=>{function t(A){return A&&typeof A=="object"&&typeof A[Symbol.iterator]=="function"}e.is=t;let s=Object.freeze([]);function n(){return s}e.empty=n;function*o(A){yield A}e.single=o;function l(A){return t(A)?A:o(A)}e.wrap=l;function u(A){return A||s}e.from=u;function*h(A){for(let B=A.length-1;B>=0;B--)yield A[B]}e.reverse=h;function f(A){return!A||A[Symbol.iterator]().next().done===!0}e.isEmpty=f;function d(A){return A[Symbol.iterator]().next().value}e.first=d;function p(A,B){let O=0;for(let I of A)if(B(I,O++))return!0;return!1}e.some=p;function g(A,B){for(let O of A)if(B(O))return O}e.find=g;function*x(A,B){for(let O of A)B(O)&&(yield O)}e.filter=x;function*v(A,B){let O=0;for(let I of A)yield B(I,O++)}e.map=v;function*w(A,B){let O=0;for(let I of A)yield*B(I,O++)}e.flatMap=w;function*k(...A){for(let B of A)yield*B}e.concat=k;function C(A,B,O){let I=O;for(let R of A)I=B(I,R);return I}e.reduce=C;function*N(A,B,O=A.length){for(B<0&&(B+=A.length),O<0?O+=A.length:O>A.length&&(O=A.length);B<O;B++)yield A[B]}e.slice=N;function T(A,B=Number.POSITIVE_INFINITY){let O=[];if(B===0)return[O,A];let I=A[Symbol.iterator]();for(let R=0;R<B;R++){let D=I.next();if(D.done)return[O,e.empty()];O.push(D.value)}return[O,{[Symbol.iterator](){return I}}]}e.consume=T;async function j(A){let B=[];for await(let O of A)B.push(O);return Promise.resolve(B)}e.asyncToArray=j})(jj||={});function lo(e){if(jj.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 mG(...e){return ss(()=>lo(e))}function ss(e){return{dispose:fG(()=>{e()})}}var Aj=class Tj{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{lo(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?Tj.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)}};Aj.DISABLE_DISPOSED_WARNING=!1;var ba=Aj,pt=class{constructor(){this._store=new ba,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)}};pt.None=Object.freeze({dispose(){}});var fl=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},Er=typeof window=="object"?window:globalThis,n0=class i0{constructor(t){this.element=t,this.next=i0.Undefined,this.prev=i0.Undefined}};n0.Undefined=new n0(void 0);var is=n0,O2=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}},pG=globalThis.performance&&typeof globalThis.performance.now=="function",gG=class Rj{static create(t){return new Rj(t)}constructor(t){this._now=pG&&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=()=>pt.None;function t(Z,$){return g(Z,()=>{},0,void 0,!0,void 0,$)}e.defer=t;function s(Z){return($,q=null,F)=>{let L=!1,X;return X=Z(U=>{if(!L)return X?X.dispose():L=!0,$.call(q,U)},null,F),L&&X.dispose(),X}}e.once=s;function n(Z,$,q){return d((F,L=null,X)=>Z(U=>F.call(L,$(U)),null,X),q)}e.map=n;function o(Z,$,q){return d((F,L=null,X)=>Z(U=>{$(U),F.call(L,U)},null,X),q)}e.forEach=o;function l(Z,$,q){return d((F,L=null,X)=>Z(U=>$(U)&&F.call(L,U),null,X),q)}e.filter=l;function u(Z){return Z}e.signal=u;function h(...Z){return($,q=null,F)=>{let L=mG(...Z.map(X=>X(U=>$.call(q,U))));return p(L,F)}}e.any=h;function f(Z,$,q,F){let L=q;return n(Z,X=>(L=$(L,X),L),F)}e.reduce=f;function d(Z,$){let q,F={onWillAddFirstListener(){q=Z(L.fire,L)},onDidRemoveLastListener(){q?.dispose()}},L=new Le(F);return $?.add(L),L.event}function p(Z,$){return $ instanceof Array?$.push(Z):$&&$.add(Z),Z}function g(Z,$,q=100,F=!1,L=!1,X,U){let K,Y,V,ie=0,Ee,ye={leakWarningThreshold:X,onWillAddFirstListener(){K=Z(je=>{ie++,Y=$(Y,je),F&&!V&&(oe.fire(Y),Y=void 0),Ee=()=>{let Ne=Y;Y=void 0,V=void 0,(!F||ie>1)&&oe.fire(Ne),ie=0},typeof q=="number"?(clearTimeout(V),V=setTimeout(Ee,q)):V===void 0&&(V=0,queueMicrotask(Ee))})},onWillRemoveListener(){L&&ie>0&&Ee?.()},onDidRemoveLastListener(){Ee=void 0,K.dispose()}},oe=new Le(ye);return U?.add(oe),oe.event}e.debounce=g;function x(Z,$=0,q){return e.debounce(Z,(F,L)=>F?(F.push(L),F):[L],$,void 0,!0,void 0,q)}e.accumulate=x;function v(Z,$=(F,L)=>F===L,q){let F=!0,L;return l(Z,X=>{let U=F||!$(X,L);return F=!1,L=X,U},q)}e.latch=v;function w(Z,$,q){return[e.filter(Z,$,q),e.filter(Z,F=>!$(F),q)]}e.split=w;function k(Z,$=!1,q=[],F){let L=q.slice(),X=Z(Y=>{L?L.push(Y):K.fire(Y)});F&&F.add(X);let U=()=>{L?.forEach(Y=>K.fire(Y)),L=null},K=new Le({onWillAddFirstListener(){X||(X=Z(Y=>K.fire(Y)),F&&F.add(X))},onDidAddFirstListener(){L&&($?setTimeout(U):U())},onDidRemoveLastListener(){X&&X.dispose(),X=null}});return F&&F.add(K),K.event}e.buffer=k;function C(Z,$){return(q,F,L)=>{let X=$(new T);return Z(function(U){let K=X.evaluate(U);K!==N&&q.call(F,K)},void 0,L)}}e.chain=C;let N=Symbol("HaltChainable");class T{constructor(){this.steps=[]}map($){return this.steps.push($),this}forEach($){return this.steps.push(q=>($(q),q)),this}filter($){return this.steps.push(q=>$(q)?q:N),this}reduce($,q){let F=q;return this.steps.push(L=>(F=$(F,L),F)),this}latch($=(q,F)=>q===F){let q=!0,F;return this.steps.push(L=>{let X=q||!$(L,F);return q=!1,F=L,X?L:N}),this}evaluate($){for(let q of this.steps)if($=q($),$===N)break;return $}}function j(Z,$,q=F=>F){let F=(...K)=>U.fire(q(...K)),L=()=>Z.on($,F),X=()=>Z.removeListener($,F),U=new Le({onWillAddFirstListener:L,onDidRemoveLastListener:X});return U.event}e.fromNodeEventEmitter=j;function A(Z,$,q=F=>F){let F=(...K)=>U.fire(q(...K)),L=()=>Z.addEventListener($,F),X=()=>Z.removeEventListener($,F),U=new Le({onWillAddFirstListener:L,onDidRemoveLastListener:X});return U.event}e.fromDOMEventEmitter=A;function B(Z){return new Promise($=>s(Z)($))}e.toPromise=B;function O(Z){let $=new Le;return Z.then(q=>{$.fire(q)},()=>{$.fire(void 0)}).finally(()=>{$.dispose()}),$.event}e.fromPromise=O;function I(Z,$){return Z(q=>$.fire(q))}e.forward=I;function R(Z,$,q){return $(q),Z(F=>$(F))}e.runAndSubscribe=R;class D{constructor($,q){this._observable=$,this._counter=0,this._hasChanged=!1;let F={onWillAddFirstListener:()=>{$.addObserver(this)},onDidRemoveLastListener:()=>{$.removeObserver(this)}};this.emitter=new Le(F),q&&q.add(this.emitter)}beginUpdate($){this._counter++}handlePossibleChange($){}handleChange($,q){this._hasChanged=!0}endUpdate($){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function P(Z,$){return new D(Z,$).emitter.event}e.fromObservable=P;function G(Z){return($,q,F)=>{let L=0,X=!1,U={beginUpdate(){L++},endUpdate(){L--,L===0&&(Z.reportChanges(),X&&(X=!1,$.call(q)))},handlePossibleChange(){},handleChange(){X=!0}};Z.addObserver(U),Z.reportChanges();let K={dispose(){Z.removeObserver(U)}};return F instanceof ba?F.add(K):Array.isArray(F)&&F.push(K),K}}e.fromObservableLight=G})(Xs||={});var r0=class a0{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${a0._idPool++}`,a0.all.add(this)}start(t){this._stopWatch=new gG,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}}};r0.all=new Set,r0._idPool=0;var xG=r0,bG=-1,Mj=class Dj{constructor(t,s,n=(Dj._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=s,this.name=n,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,s){let n=this.threshold;if(n<=0||s<n)return;this._stacks||(this._stacks=new Map);let o=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,o+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=n*.5;let[l,u]=this.getMostFrequentStack(),h=`[${this.name}] potential listener LEAK detected, having ${s} listeners already. MOST frequent listener (${u}):`;console.warn(h),console.warn(l);let f=new yG(h,l);this._errorHandler(f)}return()=>{let l=this._stacks.get(t.value)||0;this._stacks.set(t.value,l-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,s=0;for(let[n,o]of this._stacks)(!t||s<o)&&(t=[n,o],s=o);return t}};Mj._idPool=1;var vG=Mj,_G=class Oj{constructor(t){this.value=t}static create(){let t=new Error;return new Oj(t.stack??"")}print(){console.warn(this.value.split(`
|
|
169
|
-
`).slice(2).join(`
|
|
170
|
-
`))}},yG=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},wG=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},SG=0,_g=class{constructor(e){this.value=e,this.id=SG++}},kG=2,NG,Le=class{constructor(e){this._size=0,this._options=e,this._leakageMon=this._options?.leakWarningThreshold?new vG(e?.onListenerError??kh,this._options?.leakWarningThreshold??bG):void 0,this._perfMon=this._options?._profName?new xG(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],f=new wG(`${u}. HINT: Stack shows most frequent listener (${h[1]}-times)`,h[0]);return(this._options?.onListenerError||kh)(f),pt.None}if(this._disposed)return pt.None;t&&(e=e.bind(t));let n=new _g(e),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(n.stack=_G.create(),o=this._leakageMon.check(n.stack,this._size+1)),this._listeners?this._listeners instanceof _g?(this._deliveryQueue??=new CG,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 ba?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*kG<=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||kh;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 _g)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}},CG=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}},o0=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Le,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Le,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}};o0.INSTANCE=new o0;var Ub=o0;function EG(e,t,s){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",s)}Ub.INSTANCE.onDidChangeZoomLevel;function jG(e){return Ub.INSTANCE.getZoomFactor(e)}Ub.INSTANCE.onDidChangeFullscreen;var wl=typeof navigator=="object"?navigator.userAgent:"",l0=wl.indexOf("Firefox")>=0,AG=wl.indexOf("AppleWebKit")>=0,Fb=wl.indexOf("Chrome")>=0,TG=!Fb&&wl.indexOf("Safari")>=0;wl.indexOf("Electron/")>=0;wl.indexOf("Android")>=0;var yg=!1;if(typeof Er.matchMedia=="function"){let e=Er.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Er.matchMedia("(display-mode: fullscreen)");yg=e.matches,EG(Er,e,({matches:s})=>{yg&&t.matches||(yg=s)})}var il="en",c0=!1,u0=!1,Nh=!1,Lj=!1,nh,Ch=il,L2=il,RG,Nr,io=globalThis,Wn;typeof io.vscode<"u"&&typeof io.vscode.process<"u"?Wn=io.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Wn=process);var MG=typeof Wn?.versions?.electron=="string",DG=MG&&Wn?.type==="renderer";if(typeof Wn=="object"){c0=Wn.platform==="win32",u0=Wn.platform==="darwin",Nh=Wn.platform==="linux",Nh&&Wn.env.SNAP&&Wn.env.SNAP_REVISION,Wn.env.CI||Wn.env.BUILD_ARTIFACTSTAGINGDIRECTORY,nh=il,Ch=il;let e=Wn.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);nh=t.userLocale,L2=t.osLocale,Ch=t.resolvedLanguage||il,RG=t.languagePack?.translationsConfigFile}catch{}Lj=!0}else typeof navigator=="object"&&!DG?(Nr=navigator.userAgent,c0=Nr.indexOf("Windows")>=0,u0=Nr.indexOf("Macintosh")>=0,(Nr.indexOf("Macintosh")>=0||Nr.indexOf("iPad")>=0||Nr.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Nh=Nr.indexOf("Linux")>=0,Nr?.indexOf("Mobi")>=0,Ch=globalThis._VSCODE_NLS_LANGUAGE||il,nh=navigator.language.toLowerCase(),L2=nh):console.error("Unable to resolve platform.");var zj=c0,Yi=u0,OG=Nh,z2=Lj,Ji=Nr,ua=Ch,LG;(e=>{function t(){return ua}e.value=t;function s(){return ua.length===2?ua==="en":ua.length>=3?ua[0]==="e"&&ua[1]==="n"&&ua[2]==="-":!1}e.isDefaultVariant=s;function n(){return ua==="en"}e.isDefault=n})(LG||={});var zG=typeof io.postMessage=="function"&&!io.importScripts;(()=>{if(zG){let e=[];io.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}),io.postMessage({vscodeScheduleAsyncWork:n},"*")}}return e=>setTimeout(e)})();var BG=!!(Ji&&Ji.indexOf("Chrome")>=0);Ji&&Ji.indexOf("Firefox")>=0;!BG&&Ji&&Ji.indexOf("Safari")>=0;Ji&&Ji.indexOf("Edg/")>=0;Ji&&Ji.indexOf("Android")>=0;var Qo=typeof navigator=="object"?navigator:{};z2||document.queryCommandSupported&&document.queryCommandSupported("copy")||Qo&&Qo.clipboard&&Qo.clipboard.writeText,z2||Qo&&Qo.clipboard&&Qo.clipboard.readText;var qb=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}},wg=new qb,B2=new qb,P2=new qb,PG=new Array(230),Bj;(e=>{function t(h){return wg.keyCodeToStr(h)}e.toString=t;function s(h){return wg.strToKeyCode(h)}e.fromString=s;function n(h){return B2.keyCodeToStr(h)}e.toUserSettingsUS=n;function o(h){return P2.keyCodeToStr(h)}e.toUserSettingsGeneral=o;function l(h){return B2.strToKeyCode(h)||P2.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 wg.keyCodeToStr(h)}e.toElectronAccelerator=u})(Bj||={});var IG=class Pj{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 Pj&&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 $G([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},$G=class{constructor(e){if(e.length===0)throw dG("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 HG(e){if(e.charCode){let s=String.fromCharCode(e.charCode).toUpperCase();return Bj.fromString(s)}let t=e.keyCode;if(t===3)return 7;if(l0)switch(t){case 59:return 85;case 60:if(OG)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Yi)return 57;break}else if(AG&&(Yi&&t===93||!Yi&&t===92))return 57;return PG[t]||0}var UG=Yi?256:2048,FG=512,qG=1024,VG=Yi?2048:256,I2=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=HG(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|=UG),this.altKey&&(t|=FG),this.shiftKey&&(t|=qG),this.metaKey&&(t|=VG),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new IG(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},$2=new WeakMap;function GG(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 WG=class{static getSameOriginWindowChain(e){let t=$2.get(e);if(!t){t=[],$2.set(e,t);let s=e,n;do n=GG(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}}},ih=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=WG.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=s.left,this.posy-=s.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},H2=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(Fb){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?l0&&!Yi?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")TG&&zj?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?l0&&!Yi?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()}},Ij=Object.freeze(function(e,t){let s=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(s)}}}),KG;(e=>{function t(s){return s===e.None||s===e.Cancelled||s instanceof YG?!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:Ij})})(KG||={});var YG=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?Ij:(this._emitter||(this._emitter=new Le),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Vb=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 s0("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new s0("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},XG=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 s0("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}},ZG;(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})(ZG||={});var U2=class ci{static fromArray(t){return new ci(s=>{s.emitMany(t)})}static fromPromise(t){return new ci(async s=>{s.emitMany(await t)})}static fromPromises(t){return new ci(async s=>{await Promise.all(t.map(async n=>s.emitOne(await n)))})}static merge(t){return new ci(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 Le,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 ci(async n=>{for await(let o of t)n.emitOne(s(o))})}map(t){return ci.map(this,t)}static filter(t,s){return new ci(async n=>{for await(let o of t)s(o)&&n.emitOne(o)})}filter(t){return ci.filter(this,t)}static coalesce(t){return ci.filter(t,s=>!!s)}coalesce(){return ci.coalesce(this)}static async toPromise(t){let s=[];for await(let n of t)s.push(n);return s}toPromise(){return ci.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())}};U2.EMPTY=U2.fromArray([]);var{getWindow:Wi,getWindowId:QG,onDidRegisterWindow:JG}=(function(){let e=new Map,t={window:Er,disposables:new ba};e.set(Er.vscodeWindowId,t);let s=new Le,n=new Le,o=new Le;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 pt.None;let h=new ba,f={window:u,disposables:h.add(new ba)};return e.set(u.vscodeWindowId,f),h.add(ss(()=>{e.delete(u.vscodeWindowId),n.fire(u)})),h.add(ot(u,Bs.BEFORE_UNLOAD,()=>{o.fire(u)})),s.fire(f),h},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(u){return u.vscodeWindowId},hasWindow(u){return e.has(u)},getWindowById:l,getWindow(u){let h=u;if(h?.ownerDocument?.defaultView)return h.ownerDocument.defaultView.window;let f=u;return f?.view?f.view.window:Er},getDocument(u){return Wi(u).document}}})(),eW=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 eW(e,t,s,n)}var F2=function(e,t,s,n){return ot(e,t,s,n)},Gb,tW=class extends XG{constructor(e){super(),this.defaultTarget=e&&Wi(e)}cancelAndSet(e,t,s){return super.cancelAndSet(e,t,s??this.defaultTarget)}},q2=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){kh(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(q2.sort),u.shift().execute();n.set(l,!1)};Gb=(l,u,h=0)=>{let f=QG(l),d=new q2(u,h),p=e.get(f);return p||(p=[],e.set(f,p)),p.push(d),s.get(f)||(s.set(f,!0),l.requestAnimationFrame(()=>o(f))),d}})();function sW(e){let t=e.getBoundingClientRect(),s=Wi(e);return{left:t.left+s.scrollX,top:t.top+s.scrollY,width:t.width,height:t.height}}var Bs={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"},nW=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=On(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=On(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=On(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=On(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=On(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=On(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=On(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=On(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=On(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=On(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=On(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=On(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=On(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=On(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 On(e){return typeof e=="number"?`${e}px`:e}function Wc(e){return new nW(e)}var $j=class{constructor(){this._hooks=new ba,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let s=this._onStopCallback;this._onStopCallback=null,e&&s&&s(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,s,n,o){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=n,this._onStopCallback=o;let l=e;try{e.setPointerCapture(t),this._hooks.add(ss(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{l=Wi(e)}this._hooks.add(ot(l,Bs.POINTER_MOVE,u=>{if(u.buttons!==s){this.stopMonitoring(!0);return}u.preventDefault(),this._pointerMoveCallback(u)})),this._hooks.add(ot(l,Bs.POINTER_UP,u=>this.stopMonitoring(!0)))}};function iW(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 qi;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(qi||={});var Oc=class rn extends pt{constructor(){super(),this.dispatched=!1,this.targets=new O2,this.ignoreTargets=new O2,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Xs.runAndSubscribe(JG,({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:Er,disposables:this._store}))}static addTarget(t){if(!rn.isTouchDevice())return pt.None;rn.INSTANCE||(rn.INSTANCE=new rn);let s=rn.INSTANCE.targets.push(t);return ss(s)}static ignoreTarget(t){if(!rn.isTouchDevice())return pt.None;rn.INSTANCE||(rn.INSTANCE=new rn);let s=rn.INSTANCE.ignoreTargets.push(t);return ss(s)}static isTouchDevice(){return"ontouchstart"in Er||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let s=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let n=0,o=t.targetTouches.length;n<o;n++){let l=t.targetTouches.item(n);this.activeTouches[l.identifier]={id:l.identifier,initialTarget:l.target,initialTimeStamp:s,initialPageX:l.pageX,initialPageY:l.pageY,rollingTimestamps:[s],rollingPageX:[l.pageX],rollingPageY:[l.pageY]};let u=this.newGestureEvent(qi.Start,l.target);u.pageX=l.pageX,u.pageY=l.pageY,this.dispatchEvent(u)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,s){let n=Date.now(),o=Object.keys(this.activeTouches).length;for(let l=0,u=s.changedTouches.length;l<u;l++){let h=s.changedTouches.item(l);if(!this.activeTouches.hasOwnProperty(String(h.identifier))){console.warn("move of an UNKNOWN touch",h);continue}let f=this.activeTouches[h.identifier],d=Date.now()-f.initialTimeStamp;if(d<rn.HOLD_DELAY&&Math.abs(f.initialPageX-Vn(f.rollingPageX))<30&&Math.abs(f.initialPageY-Vn(f.rollingPageY))<30){let p=this.newGestureEvent(qi.Tap,f.initialTarget);p.pageX=Vn(f.rollingPageX),p.pageY=Vn(f.rollingPageY),this.dispatchEvent(p)}else if(d>=rn.HOLD_DELAY&&Math.abs(f.initialPageX-Vn(f.rollingPageX))<30&&Math.abs(f.initialPageY-Vn(f.rollingPageY))<30){let p=this.newGestureEvent(qi.Contextmenu,f.initialTarget);p.pageX=Vn(f.rollingPageX),p.pageY=Vn(f.rollingPageY),this.dispatchEvent(p)}else if(o===1){let p=Vn(f.rollingPageX),g=Vn(f.rollingPageY),x=Vn(f.rollingTimestamps)-f.rollingTimestamps[0],v=p-f.rollingPageX[0],w=g-f.rollingPageY[0],k=[...this.targets].filter(C=>f.initialTarget instanceof Node&&C.contains(f.initialTarget));this.inertia(t,k,n,Math.abs(v)/x,v>0?1:-1,p,Math.abs(w)/x,w>0?1:-1,g)}this.dispatchEvent(this.newGestureEvent(qi.End,f.initialTarget)),delete this.activeTouches[h.identifier]}this.dispatched&&(s.preventDefault(),s.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,s){let n=document.createEvent("CustomEvent");return n.initEvent(t,!1,!0),n.initialTarget=s,n.tapCount=0,n}dispatchEvent(t){if(t.type===qi.Tap){let s=new Date().getTime(),n=0;s-this._lastSetTapCountTime>rn.CLEAR_TAP_COUNT_TIME?n=1:n=2,this._lastSetTapCountTime=s,t.tapCount=n}else(t.type===qi.Change||t.type===qi.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let n of this.ignoreTargets)if(n.contains(t.initialTarget))return;let s=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let o=0,l=t.initialTarget;for(;l&&l!==n;)o++,l=l.parentElement;s.push([o,n])}s.sort((n,o)=>n[0]-o[0]);for(let[n,o]of s)o.dispatchEvent(t),this.dispatched=!0}}inertia(t,s,n,o,l,u,h,f,d){this.handle=Gb(t,()=>{let p=Date.now(),g=p-n,x=0,v=0,w=!0;o+=rn.SCROLL_FRICTION*g,h+=rn.SCROLL_FRICTION*g,o>0&&(w=!1,x=l*o*g),h>0&&(w=!1,v=f*h*g);let k=this.newGestureEvent(qi.Change);k.translationX=x,k.translationY=v,s.forEach(C=>C.dispatchEvent(k)),w||this.inertia(t,s,p,o,l,u+x,h,f,d+v)})}onTouchMove(t){let s=Date.now();for(let n=0,o=t.changedTouches.length;n<o;n++){let l=t.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("end of an UNKNOWN touch",l);continue}let u=this.activeTouches[l.identifier],h=this.newGestureEvent(qi.Change,u.initialTarget);h.translationX=l.pageX-Vn(u.rollingPageX),h.translationY=l.pageY-Vn(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)}};Oc.SCROLL_FRICTION=-.005,Oc.HOLD_DELAY=700,Oc.CLEAR_TAP_COUNT_TIME=400,ds([iW],Oc,"isTouchDevice",1);var rW=Oc,Wb=class extends pt{onclick(e,t){this._register(ot(e,Bs.CLICK,s=>t(new ih(Wi(e),s))))}onmousedown(e,t){this._register(ot(e,Bs.MOUSE_DOWN,s=>t(new ih(Wi(e),s))))}onmouseover(e,t){this._register(ot(e,Bs.MOUSE_OVER,s=>t(new ih(Wi(e),s))))}onmouseleave(e,t){this._register(ot(e,Bs.MOUSE_LEAVE,s=>t(new ih(Wi(e),s))))}onkeydown(e,t){this._register(ot(e,Bs.KEY_DOWN,s=>t(new I2(s))))}onkeyup(e,t){this._register(ot(e,Bs.KEY_UP,s=>t(new I2(s))))}oninput(e,t){this._register(ot(e,Bs.INPUT,t))}onblur(e,t){this._register(ot(e,Bs.BLUR,t))}onfocus(e,t){this._register(ot(e,Bs.FOCUS,t))}onchange(e,t){this._register(ot(e,Bs.CHANGE,t))}ignoreGesture(e){return rW.ignoreTarget(e)}},V2=11,aW=class extends Wb{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=V2+"px",this.domNode.style.height=V2+"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 $j),this._register(F2(this.bgDomNode,Bs.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(F2(this.domNode,Bs.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new tW),this._pointerdownScheduleRepeatTimer=this._register(new Vb)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Wi(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,s=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},oW=class d0{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 d0(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 d0(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,s){let n=this.width!==t.width,o=this.scrollWidth!==t.scrollWidth,l=this.scrollLeft!==t.scrollLeft,u=this.height!==t.height,h=this.scrollHeight!==t.scrollHeight,f=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:s,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:o,scrollLeftChanged:l,heightChanged:u,scrollHeightChanged:h,scrollTopChanged:f}}},lW=class extends pt{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new Le),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new oW(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 W2(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=W2.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)))}},G2=class{constructor(e,t,s){this.scrollLeft=e,this.scrollTop=t,this.isDone=s}};function Sg(e,t){let s=t-e;return function(n){return e+s*dW(n)}}function cW(e,t,s){return function(n){return n<s?e(n/s):t((n-s)/(1-s))}}var W2=class h0{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),cW(Sg(t,o),Sg(l,s),.33)}return Sg(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 G2(n,o,!1)}return new G2(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,s,n){return h0.start(t,s,n)}static start(t,s,n){n=n+10;let o=Date.now()-10;return new h0(t,s,o,n)}};function uW(e){return Math.pow(e,3)}function dW(e){return 1-uW(1-e)}var hW=class extends pt{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 Vb)}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":"")))}},fW=140,Hj=class extends Wb{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 hW(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new $j),this._shouldRender=!0,this.domNode=Wc(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(ot(this.domNode.domNode,Bs.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new aW(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,s,n){this.slider=Wc(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof s=="number"&&this.slider.setWidth(s),typeof n=="number"&&this.slider.setHeight(n),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(ot(this.slider.domNode,Bs.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=sW(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(zj&&u>fW){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()}},Uj=class f0{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 f0(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let s=Math.round(t);return this._visibleSize!==s?(this._visibleSize=s,this._refreshComputedValues(),!0):!1}setScrollSize(t){let s=Math.round(t);return this._scrollSize!==s?(this._scrollSize=s,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let s=Math.round(t);return this._scrollPosition!==s?(this._scrollPosition=s,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,s,n,o,l){let u=Math.max(0,n-t),h=Math.max(0,u-2*s),f=o>0&&o>n;if(!f)return{computedAvailableSize:Math.round(u),computedIsNeeded:f,computedSliderSize:Math.round(h),computedSliderRatio:0,computedSliderPosition:0};let d=Math.round(Math.max(20,Math.floor(n*h/o))),p=(h-d)/(o-n),g=l*p;return{computedAvailableSize:Math.round(u),computedIsNeeded:f,computedSliderSize:Math.round(d),computedSliderRatio:p,computedSliderPosition:Math.round(g)}}_refreshComputedValues(){let t=f0._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)}},mW=class extends Hj{constructor(e,t,s){let n=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:s,scrollbarState:new Uj(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}},pW=class extends Hj{constructor(e,t,s){let n=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:s,scrollbarState:new Uj(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}},gW=500,K2=50,xW=class{constructor(e,t,s){this.timestamp=e,this.deltaX=t,this.deltaY=s,this.score=0}},m0=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(Fb){let s=Wi(t.browserEvent),n=jG(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 xW(t,s,n);this._front===-1&&this._rear===-1?(this._memory[0]=l,this._front=0,this._rear=0):(o=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=l),l.score=this._computeScore(l,o)}_computeScore(t,s){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(n+=.25),s){let o=Math.abs(t.deltaX),l=Math.abs(t.deltaY),u=Math.abs(s.deltaX),h=Math.abs(s.deltaY),f=Math.max(Math.min(o,u),1),d=Math.max(Math.min(l,h),1),p=Math.max(o,u),g=Math.max(l,h);p%f===0&&g%d===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};m0.INSTANCE=new m0;var bW=m0,vW=class extends Wb{constructor(e,t,s){super(),this._onScroll=this._register(new Le),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new Le),this.onWillScroll=this._onWillScroll.event,this._options=yW(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 pW(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new mW(this._scrollable,this._options,n)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=Wc(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Wc(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Wc(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,o=>this._onMouseOver(o)),this.onmouseleave(this._listenOnDomNode,o=>this._onMouseLeave(o)),this._hideTimeout=this._register(new Vb),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=lo(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,Yi&&(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 H2(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=lo(this._mouseWheelToDispose),e)){let t=s=>{this._onMouseWheel(new H2(s))};this._mouseWheelToDispose.push(ot(this._listenOnDomNode,Bs.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=bW.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=!Yi&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||u)&&!l&&(l=o,o=0),e.browserEvent&&e.browserEvent.altKey&&(l=l*this._options.fastScrollSensitivity,o=o*this._options.fastScrollSensitivity);let h=this._scrollable.getFutureScrollPosition(),f={};if(o){let d=K2*o,p=h.scrollTop-(d<0?Math.floor(d):Math.ceil(d));this._verticalScrollbar.writeScrollPosition(f,p)}if(l){let d=K2*l,p=h.scrollLeft-(d<0?Math.floor(d):Math.ceil(d));this._horizontalScrollbar.writeScrollPosition(f,p)}f=this._scrollable.validateScrollPosition(f),(h.scrollLeft!==f.scrollLeft||h.scrollTop!==f.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(f):this._scrollable.setScrollPositionNow(f),s=!0)}let n=s;!n&&this._options.alwaysConsumeMouseWheel&&(n=!0),!n&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(n=!0),n&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,s=e.scrollLeft>0,n=s?" left":"",o=t?" top":"",l=s||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${n}`),this._topShadowDomNode.setClassName(`shadow${o}`),this._topLeftShadowDomNode.setClassName(`shadow${l}${o}${n}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),gW)}},_W=class extends vW{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 yW(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,Yi&&(t.className+=" mac"),t}var p0=class extends pt{constructor(e,t,s,n,o,l,u,h){super(),this._bufferService=s,this._optionsService=u,this._renderService=h,this._onRequestScrollLines=this._register(new Le),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let f=this._register(new lW({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:d=>Gb(n.window,d)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{f.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new _W(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},f)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(o.onProtocolChange(d=>{this._scrollableElement.updateOptions({handleMouseWheel:!(d&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(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}};p0=ds([Fe(2,_n),Fe(3,Mr),Fe(4,wj),Fe(5,yl),Fe(6,yn),Fe(7,Dr)],p0);var g0=class extends pt{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()}};g0=ds([Fe(1,_n),Fe(2,Mr),Fe(3,bu),Fe(4,Dr)],g0);var wW=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,s){return t>=e.startBufferLine-this._linePadding[s||"full"]&&t<=e.endBufferLine+this._linePadding[s||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Hi={full:0,left:0,center:0,right:0},da={full:0,left:0,center:0,right:0},yc={full:0,left:0,center:0,right:0},ef=class extends pt{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 wW,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 f=this._canvas.getContext("2d");if(f)this._ctx=f;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);da.full=this._canvas.width,da.left=e,da.center=t,da.right=e,this._refreshDrawHeightConstants(),yc.full=1,yc.left=1,yc.center=1+da.left,yc.right=1+da.left+da.center}_refreshDrawHeightConstants(){Hi.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);Hi.left=t,Hi.center=t,Hi.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Hi.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Hi.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Hi.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Hi.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(yc[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Hi[e.position||"full"]/2),da[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Hi[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};ef=ds([Fe(2,_n),Fe(3,bu),Fe(4,Dr),Fe(5,yn),Fe(6,yl),Fe(7,Mr)],ef);var Se;(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=""))(Se||={});var Eh;(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=""))(Eh||={});var Fj;(e=>e.ST=`${Se.ESC}\\`)(Fj||={});var x0=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(`${Se.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)}}};x0=ds([Fe(2,_n),Fe(3,yn),Fe(4,fo),Fe(5,Dr)],x0);var Ps=0,Is=0,$s=0,cs=0,Y2={css:"#00000000",rgba:0},js;(e=>{function t(o,l,u,h){return h!==void 0?`#${Ga(o)}${Ga(l)}${Ga(u)}${Ga(h)}`:`#${Ga(o)}${Ga(l)}${Ga(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})(js||={});var Zt;(e=>{function t(f,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,x=d.rgba>>8&255,v=f.rgba>>24&255,w=f.rgba>>16&255,k=f.rgba>>8&255;Ps=v+Math.round((p-v)*cs),Is=w+Math.round((g-w)*cs),$s=k+Math.round((x-k)*cs);let C=js.toCss(Ps,Is,$s),N=js.toRgba(Ps,Is,$s);return{css:C,rgba:N}}e.blend=t;function s(f){return(f.rgba&255)===255}e.isOpaque=s;function n(f,d,p){let g=jh.ensureContrastRatio(f.rgba,d.rgba,p);if(g)return js.toColor(g>>24&255,g>>16&255,g>>8&255)}e.ensureContrastRatio=n;function o(f){let d=(f.rgba|255)>>>0;return[Ps,Is,$s]=jh.toChannels(d),{css:js.toCss(Ps,Is,$s),rgba:d}}e.opaque=o;function l(f,d){return cs=Math.round(d*255),[Ps,Is,$s]=jh.toChannels(f.rgba),{css:js.toCss(Ps,Is,$s,cs),rgba:js.toRgba(Ps,Is,$s,cs)}}e.opacity=l;function u(f,d){return cs=f.rgba&255,l(f,cs*d/255)}e.multiplyOpacity=u;function h(f){return[f.rgba>>24&255,f.rgba>>16&255,f.rgba>>8&255]}e.toColorRGB=h})(Zt||={});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 Ps=parseInt(o.slice(1,2).repeat(2),16),Is=parseInt(o.slice(2,3).repeat(2),16),$s=parseInt(o.slice(3,4).repeat(2),16),js.toColor(Ps,Is,$s);case 5:return Ps=parseInt(o.slice(1,2).repeat(2),16),Is=parseInt(o.slice(2,3).repeat(2),16),$s=parseInt(o.slice(3,4).repeat(2),16),cs=parseInt(o.slice(4,5).repeat(2),16),js.toColor(Ps,Is,$s,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 Ps=parseInt(l[1]),Is=parseInt(l[2]),$s=parseInt(l[3]),cs=Math.round((l[5]===void 0?1:parseFloat(l[5]))*255),js.toColor(Ps,Is,$s,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),[Ps,Is,$s,cs]=t.getImageData(0,0,1,1).data,cs!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:js.toRgba(Ps,Is,$s,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,f=l/255,d=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),p=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),g=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4);return d*.2126+p*.7152+g*.0722}e.relativeLuminance2=s})(mn||={});var jh;(e=>{function t(u,h){if(cs=(h&255)/255,cs===1)return h;let f=h>>24&255,d=h>>16&255,p=h>>8&255,g=u>>24&255,x=u>>16&255,v=u>>8&255;return Ps=g+Math.round((f-g)*cs),Is=x+Math.round((d-x)*cs),$s=v+Math.round((p-v)*cs),js.toRgba(Ps,Is,$s)}e.blend=t;function s(u,h,f){let d=mn.relativeLuminance(u>>8),p=mn.relativeLuminance(h>>8);if(kr(d,p)<f){if(p<d){let v=n(u,h,f),w=kr(d,mn.relativeLuminance(v>>8));if(w<f){let k=o(u,h,f),C=kr(d,mn.relativeLuminance(k>>8));return w>C?v:k}return v}let g=o(u,h,f),x=kr(d,mn.relativeLuminance(g>>8));if(x<f){let v=n(u,h,f),w=kr(d,mn.relativeLuminance(v>>8));return x>w?g:v}return g}}e.ensureContrastRatio=s;function n(u,h,f){let d=u>>24&255,p=u>>16&255,g=u>>8&255,x=h>>24&255,v=h>>16&255,w=h>>8&255,k=kr(mn.relativeLuminance2(x,v,w),mn.relativeLuminance2(d,p,g));for(;k<f&&(x>0||v>0||w>0);)x-=Math.max(0,Math.ceil(x*.1)),v-=Math.max(0,Math.ceil(v*.1)),w-=Math.max(0,Math.ceil(w*.1)),k=kr(mn.relativeLuminance2(x,v,w),mn.relativeLuminance2(d,p,g));return(x<<24|v<<16|w<<8|255)>>>0}e.reduceLuminance=n;function o(u,h,f){let d=u>>24&255,p=u>>16&255,g=u>>8&255,x=h>>24&255,v=h>>16&255,w=h>>8&255,k=kr(mn.relativeLuminance2(x,v,w),mn.relativeLuminance2(d,p,g));for(;k<f&&(x<255||v<255||w<255);)x=Math.min(255,x+Math.ceil((255-x)*.1)),v=Math.min(255,v+Math.ceil((255-v)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),k=kr(mn.relativeLuminance2(x,v,w),mn.relativeLuminance2(d,p,g));return(x<<24|v<<16|w<<8|255)>>>0}e.increaseLuminance=o;function l(u){return[u>>24&255,u>>16&255,u>>8&255,u&255]}e.toChannels=l})(jh||={});function Ga(e){let t=e.toString(16);return t.length<2?"0"+t:t}function kr(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var SW=class extends xu{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()]}},tf=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new fi}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let s=[],n=t.translateToString(!0),o=0,l=0,u=0,h=t.getFg(0),f=t.getBg(0);for(let d=0;d<t.getTrimmedLength();d++)if(t.loadCell(d,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==h||this._workCell.bg!==f){if(d-o>1){let p=this._getJoinedRanges(n,u,l,t,o);for(let g=0;g<p.length;g++)s.push(p[g])}o=d,u=l,h=this._workCell.fg,f=this._workCell.bg}l+=this._workCell.getChars().length||xa.length}if(this._bufferService.cols-o>1){let d=this._getJoinedRanges(n,u,l,t,o);for(let p=0;p<d.length;p++)s.push(d[p])}return s}_getJoinedRanges(e,t,s,n,o){let l=e.substring(t,s),u=[];try{u=this._characterJoiners[0].handler(l)}catch(h){console.error(h)}for(let h=1;h<this._characterJoiners.length;h++)try{let f=this._characterJoiners[h].handler(l);for(let d=0;d<f.length;d++)tf._mergeRanges(u,f[d])}catch(f){console.error(f)}return this._stringRangesToCellRanges(u,n,o),u}_stringRangesToCellRanges(e,t,s){let n=0,o=!1,l=0,u=e[n];if(u){for(let h=s;h<this._bufferService.cols;h++){let f=t.getWidth(h),d=t.getString(h).length||xa.length;if(f!==0){if(!o&&u[0]<=l&&(u[0]=h,o=!0),u[1]<=l){if(u[1]=h,u=e[++n],!u)break;u[0]<=l?(u[0]=h,o=!0):o=!1}l+=d}}u&&(u[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let s=!1;for(let n=0;n<e.length;n++){let o=e[n];if(s){if(t[1]<=o[0])return e[n-1][1]=t[1],e;if(t[1]<=o[1])return e[n-1][1]=Math.max(t[1],o[1]),e.splice(n,1),e;e.splice(n,1),n--}else{if(t[1]<=o[0])return e.splice(n,0,t),e;if(t[1]<=o[1])return o[0]=Math.min(t[0],o[0]),e;t[0]<o[1]&&(o[0]=Math.min(t[0],o[0]),s=!0);continue}}return s?e[e.length-1][1]=t[1]:e.push(t),e}};tf=ds([Fe(0,_n)],tf);function kW(e){return 57508<=e&&e<=57558}function NW(e){return 9472<=e&&e<=9631}function CW(e){return kW(e)||NW(e)}function EW(){return{css:{canvas:rh(),cell:rh()},device:{canvas:rh(),cell:rh(),char:{width:0,height:0,left:0,top:0}}}}function rh(){return{width:0,height:0}}var b0=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 fi,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,s){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=s}createRow(e,t,s,n,o,l,u,h,f,d,p){let g=[],x=this._characterJoinerService.getJoinedCharacters(t),v=this._themeService.colors,w=e.getNoBgTrimmedLength();s&&w<l+1&&(w=l+1);let k,C=0,N="",T=0,j=0,A=0,B=0,O=!1,I=0,R=!1,D=0,P=0,G=[],Z=d!==-1&&p!==-1;for(let $=0;$<w;$++){e.loadCell($,this._workCell);let q=this._workCell.getWidth();if(q===0)continue;let F=!1,L=$>=P,X=$,U=this._workCell;if(x.length>0&&$===x[0][0]&&L){let $e=x.shift(),wt=this._isCellInSelection($e[0],t);for(T=$e[0]+1;T<$e[1];T++)L&&=wt===this._isCellInSelection(T,t);L&&=!s||l<$e[0]||l>=$e[1],L?(F=!0,U=new SW(this._workCell,e.translateToString(!0,$e[0],$e[1]),$e[1]-$e[0]),X=$e[1]-1,q=U.getWidth()):P=$e[1]}let K=this._isCellInSelection($,t),Y=s&&$===l,V=Z&&$>=d&&$<=p,ie=!1;this._decorationService.forEachDecorationAtCell($,t,void 0,$e=>{ie=!0});let Ee=U.getChars()||xa;if(Ee===" "&&(U.isUnderline()||U.isOverline())&&(Ee=" "),D=q*h-f.get(Ee,U.isBold(),U.isItalic()),!k)k=this._document.createElement("span");else if(C&&(K&&R||!K&&!R&&U.bg===j)&&(K&&R&&v.selectionForeground||U.fg===A)&&U.extended.ext===B&&V===O&&D===I&&!Y&&!F&&!ie&&L){U.isInvisible()?N+=xa:N+=Ee,C++;continue}else C&&(k.textContent=N),k=this._document.createElement("span"),C=0,N="";if(j=U.bg,A=U.fg,B=U.extended.ext,O=V,I=D,R=K,F&&l>=$&&l<=X&&(l=$),!this._coreService.isCursorHidden&&Y&&this._coreService.isCursorInitialized){if(G.push("xterm-cursor"),this._coreBrowserService.isFocused)u&&G.push("xterm-cursor-blink"),G.push(n==="bar"?"xterm-cursor-bar":n==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(o)switch(o){case"outline":G.push("xterm-cursor-outline");break;case"block":G.push("xterm-cursor-block");break;case"bar":G.push("xterm-cursor-bar");break;case"underline":G.push("xterm-cursor-underline");break}}if(U.isBold()&&G.push("xterm-bold"),U.isItalic()&&G.push("xterm-italic"),U.isDim()&&G.push("xterm-dim"),U.isInvisible()?N=xa:N=U.getChars()||xa,U.isUnderline()&&(G.push(`xterm-underline-${U.extended.underlineStyle}`),N===" "&&(N=" "),!U.isUnderlineColorDefault()))if(U.isUnderlineColorRGB())k.style.textDecorationColor=`rgb(${xu.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()&&(G.push("xterm-overline"),N===" "&&(N=" ")),U.isStrikethrough()&&G.push("xterm-strikethrough"),V&&(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 wt=oe;oe=Ne,Ne=wt}let De,et,ke=!1;this._decorationService.forEachDecorationAtCell($,t,void 0,$e=>{$e.options.layer!=="top"&&ke||($e.backgroundColorRGB&&(Ne=50331648,je=$e.backgroundColorRGB.rgba>>8&16777215,De=$e.backgroundColorRGB),$e.foregroundColorRGB&&(oe=50331648,ye=$e.foregroundColorRGB.rgba>>8&16777215,et=$e.foregroundColorRGB),ke=$e.options.layer==="top")}),!ke&&K&&(De=this._coreBrowserService.isFocused?v.selectionBackgroundOpaque:v.selectionInactiveBackgroundOpaque,je=De.rgba>>8&16777215,Ne=50331648,ke=!0,v.selectionForeground&&(oe=50331648,ye=v.selectionForeground.rgba>>8&16777215,et=v.selectionForeground)),ke&&G.push("xterm-decoration-top");let He;switch(Ne){case 16777216:case 33554432:He=v.ansi[je],G.push(`xterm-bg-${je}`);break;case 50331648:He=js.toColor(je>>16,je>>8&255,je&255),this._addStyle(k,`background-color:#${X2((je>>>0).toString(16),"0",6)}`);break;default:Ge?(He=v.foreground,G.push("xterm-bg-257")):He=v.background}switch(De||U.isDim()&&(De=Zt.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,De,void 0)||G.push(`xterm-fg-${ye}`);break;case 50331648:let $e=js.toColor(ye>>16&255,ye>>8&255,ye&255);this._applyMinimumContrast(k,He,$e,U,De,et)||this._addStyle(k,`color:#${X2(ye.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(k,He,v.foreground,U,De,et)||Ge&&G.push("xterm-fg-257")}G.length&&(k.className=G.join(" "),G.length=0),!Y&&!F&&!ie&&L?C++:k.textContent=N,D!==this.defaultSpacing&&(k.style.letterSpacing=`${D}px`),g.push(k),$=X}return k&&C&&(k.textContent=N),g}_applyMinimumContrast(e,t,s,n,o,l){if(this._optionsService.rawOptions.minimumContrastRatio===1||CW(n.getCode()))return!1;let u=this._getContrastCache(n),h;if(!o&&!l&&(h=u.getColor(t.rgba,s.rgba)),h===void 0){let f=this._optionsService.rawOptions.minimumContrastRatio/(n.isDim()?2:1);h=Zt.ensureContrastRatio(o||t,l||s,f),u.setColor((o||t).rgba,(l||s).rgba,h??null)}return h?(this._addStyle(e,`color:${h.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let s=this._selectionStart,n=this._selectionEnd;return!s||!n?!1:this._columnSelectMode?s[0]<=n[0]?e>=s[0]&&t>=s[1]&&e<n[0]&&t<=n[1]:e<s[0]&&t>=s[1]&&e>=n[0]&&t<=n[1]:t>s[1]&&t<n[1]||s[1]===n[1]&&t===s[1]&&e>=s[0]&&e<n[0]||s[1]<n[1]&&t===n[1]&&e<n[0]||s[1]<n[1]&&t===s[1]&&e>=s[0]}};b0=ds([Fe(1,Nj),Fe(2,yn),Fe(3,Mr),Fe(4,fo),Fe(5,bu),Fe(6,yl)],b0);function X2(e,t,s){for(;e.length<s;)e=t+e;return e}var jW=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}},AW=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,s,n=!1){if(this.selectionStart=t,this.selectionEnd=s,!t||!s||t[0]===s[0]&&t[1]===s[1]){this.clear();return}let o=e.buffers.active.ydisp,l=t[1]-o,u=s[1]-o,h=Math.max(l,0),f=Math.min(u,e.rows-1);if(h>=e.rows||f<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=n,this.viewportStartRow=l,this.viewportEndRow=u,this.viewportCappedStartRow=h,this.viewportCappedEndRow=f,this.startCol=t[0],this.endCol=s[0]}isCellSelected(e,t,s){return this.hasSelection?(s-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&s>=this.viewportCappedStartRow&&t<this.endCol&&s<=this.viewportCappedEndRow:t<this.startCol&&s>=this.viewportCappedStartRow&&t>=this.endCol&&s<=this.viewportCappedEndRow:s>this.viewportStartRow&&s<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&s===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportStartRow&&t>=this.startCol):!1}};function TW(){return new AW}var kg="xterm-dom-renderer-owner-",oi="xterm-rows",ah="xterm-fg-",Z2="xterm-bg-",wc="xterm-focus",oh="xterm-selection",RW=1,v0=class extends pt{constructor(e,t,s,n,o,l,u,h,f,d,p,g,x,v){super(),this._terminal=e,this._document=t,this._element=s,this._screenElement=n,this._viewportElement=o,this._helperContainer=l,this._linkifier2=u,this._charSizeService=f,this._optionsService=d,this._bufferService=p,this._coreService=g,this._coreBrowserService=x,this._themeService=v,this._terminalClass=RW++,this._rowElements=[],this._selectionRenderModel=TW(),this.onRequestRedraw=this._register(new Le).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(oi),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(oh),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=EW(),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(b0,document),this._element.classList.add(kg+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(kg+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new jW(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} .${oi} 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} .${oi} { 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} .${oi} .xterm-dim { color: ${Zt.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} .${oi}.${wc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${oi}.${wc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${oi}.${wc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${o} 1s step-end infinite;}${this._terminalSelector} .${oi} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${oi} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${oi} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${oi} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${oi} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${oh} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${oh} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${oh} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[l,u]of e.ansi.entries())t+=`${this._terminalSelector} .${ah}${l} { color: ${u.css}; }${this._terminalSelector} .${ah}${l}.xterm-dim { color: ${Zt.multiplyOpacity(u,.5).css}; }${this._terminalSelector} .${Z2}${l} { background-color: ${u.css}; }`;t+=`${this._terminalSelector} .${ah}257 { color: ${Zt.opaque(e.background).css}; }${this._terminalSelector} .${ah}257.xterm-dim { color: ${Zt.multiplyOpacity(Zt.opaque(e.background),.5).css}; }${this._terminalSelector} .${Z2}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let s=this._rowElements.length;s<=t;s++){let n=this._document.createElement("div");this._rowContainer.appendChild(n),this._rowElements.push(n)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(wc),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(wc),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,s){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,s),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,s),!this._selectionRenderModel.hasSelection))return;let n=this._selectionRenderModel.viewportStartRow,o=this._selectionRenderModel.viewportEndRow,l=this._selectionRenderModel.viewportCappedStartRow,u=this._selectionRenderModel.viewportCappedEndRow,h=this._document.createDocumentFragment();if(s){let f=e[0]>t[0];h.appendChild(this._createSelectionElement(l,f?t[0]:e[0],f?e[0]:t[0],u-l+1))}else{let f=n===l?e[0]:0,d=l===o?t[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(l,f,d));let p=u-l-1;if(h.appendChild(this._createSelectionElement(l+1,0,this._bufferService.cols,p)),l!==u){let g=o===u?t[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(u,0,g))}}this._selectionContainer.appendChild(h)}_createSelectionElement(e,t,s,n=1){let o=this._document.createElement("div"),l=t*this.dimensions.css.cell.width,u=this.dimensions.css.cell.width*(s-t);return l+u>this.dimensions.css.canvas.width&&(u=this.dimensions.css.canvas.width-l),o.style.height=`${n*this.dimensions.css.cell.height}px`,o.style.top=`${e*this.dimensions.css.cell.height}px`,o.style.left=`${l}px`,o.style.width=`${u}px`,o}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let s=this._bufferService.buffer,n=s.ybase+s.y,o=Math.min(s.x,this._bufferService.cols-1),l=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,u=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,h=this._optionsService.rawOptions.cursorInactiveStyle;for(let f=e;f<=t;f++){let d=f+s.ydisp,p=this._rowElements[f],g=s.lines.get(d);if(!p||!g)break;p.replaceChildren(...this._rowFactory.createRow(g,d,d===n,u,h,o,l,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${kg}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,s,n,o,l){s<0&&(e=0),n<0&&(t=0);let u=this._bufferService.rows-1;s=Math.max(Math.min(s,u),0),n=Math.max(Math.min(n,u),0),o=Math.min(o,this._bufferService.cols);let h=this._bufferService.buffer,f=h.ybase+h.y,d=Math.min(h.x,o-1),p=this._optionsService.rawOptions.cursorBlink,g=this._optionsService.rawOptions.cursorStyle,x=this._optionsService.rawOptions.cursorInactiveStyle;for(let v=s;v<=n;++v){let w=v+h.ydisp,k=this._rowElements[v],C=h.lines.get(w);if(!k||!C)break;k.replaceChildren(...this._rowFactory.createRow(C,w,w===f,g,x,d,p,this.dimensions.css.cell.width,this._widthCache,l?v===s?e:0:-1,l?(v===n?t:o)-1:-1))}}};v0=ds([Fe(7,$b),Fe(8,Af),Fe(9,yn),Fe(10,_n),Fe(11,fo),Fe(12,Mr),Fe(13,yl)],v0);var _0=class extends pt{constructor(e,t,s){super(),this._optionsService=s,this.width=0,this.height=0,this._onCharSizeChange=this._register(new Le),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new DW(this._optionsService))}catch{this._measureStrategy=this._register(new MW(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())}};_0=ds([Fe(2,yn)],_0);var qj=class extends pt{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)}},MW=class extends qj{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}},DW=class extends qj{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}},OW=class extends pt{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 LW(this._window)),this._onDprChange=this._register(new Le),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new Le),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}},LW=class extends pt{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new fl),this._onDprChange=this._register(new Le),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)}},zW=class extends pt{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 Kb(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 BW(e,t,s,n,o,l,u,h,f){if(!l)return;let d=Kb(e,t,s);if(d)return d[0]=Math.ceil((d[0]+(f?u/2:0))/u),d[1]=Math.ceil(d[1]/h),d[0]=Math.min(Math.max(d[0],1),n+(f?1:0)),d[1]=Math.min(Math.max(d[1],1),o),d}var y0=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,s,n,o){return BW(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=Kb(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])}}};y0=ds([Fe(0,Dr),Fe(1,Af)],y0);var PW=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=[]}},Vj={};KV(Vj,{getSafariVersion:()=>$W,isChromeOS:()=>Yj,isFirefox:()=>Gj,isIpad:()=>HW,isIphone:()=>UW,isLegacyEdge:()=>IW,isLinux:()=>Yb,isMac:()=>sf,isNode:()=>Tf,isSafari:()=>Wj,isWindows:()=>Kj});var Tf=typeof process<"u"&&"title"in process,vu=Tf?"node":navigator.userAgent,_u=Tf?"node":navigator.platform,Gj=vu.includes("Firefox"),IW=vu.includes("Edge"),Wj=/^((?!chrome|android).)*safari/i.test(vu);function $W(){if(!Wj)return 0;let e=vu.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var sf=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(_u),HW=_u==="iPad",UW=_u==="iPhone",Kj=["Windows","Win16","Win32","WinCE"].includes(_u),Yb=_u.indexOf("Linux")>=0,Yj=/\bCrOS\b/.test(vu),Xj=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()}},FW=class extends Xj{_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())}}},qW=class extends Xj{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},nf=!Tf&&"requestIdleCallback"in window?qW:FW,VW=class{constructor(){this._queue=new nf}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},w0=class extends pt{constructor(e,t,s,n,o,l,u,h,f){super(),this._rowCount=e,this._optionsService=s,this._charSizeService=n,this._coreService=o,this._coreBrowserService=h,this._renderer=this._register(new fl),this._pausedResizeTask=new VW,this._observerDisposable=this._register(new fl),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new Le),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new Le),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new Le),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new Le),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new PW((d,p)=>this._renderRows(d,p),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new GW(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(f.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(d=>this._registerIntersectionObserver(d,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let s=new e.IntersectionObserver(n=>this._handleIntersectionChange(n[n.length-1]),{threshold:0});s.observe(t),this._observerDisposable.value=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()}};w0=ds([Fe(2,yn),Fe(3,Af),Fe(4,fo),Fe(5,bu),Fe(6,_n),Fe(7,Mr),Fe(8,yl)],w0);var GW=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 WW(e,t,s,n){let o=s.buffer.x,l=s.buffer.y;if(!s.buffer.hasScrollback)return XW(o,l,e,t,s,n)+Rf(l,t,s,n)+ZW(o,l,e,t,s,n);let u;if(l===t)return u=o>e?"D":"C",nu(Math.abs(o-e),su(u,n));u=l>t?"D":"C";let h=Math.abs(l-t),f=YW(l>t?e:o,s)+(h-1)*s.cols+1+KW(l>t?o:e);return nu(f,su(u,n))}function KW(e,t){return e-1}function YW(e,t){return t.cols-e}function XW(e,t,s,n,o,l){return Rf(t,n,o,l).length===0?"":nu(Qj(e,t,e,t-co(t,o),!1,o).length,su("D",l))}function Rf(e,t,s,n){let o=e-co(e,s),l=t-co(t,s),u=Math.abs(o-l)-QW(e,t,s);return nu(u,su(Zj(e,t),n))}function ZW(e,t,s,n,o,l){let u;Rf(t,n,o,l).length>0?u=n-co(n,o):u=t;let h=n,f=JW(e,t,s,n,o,l);return nu(Qj(e,u,s,h,f==="C",o).length,su(f,l))}function QW(e,t,s){let n=0,o=e-co(e,s),l=t-co(t,s);for(let u=0;u<Math.abs(o-l);u++){let h=Zj(e,t)==="A"?-1:1;s.buffer.lines.get(o+h*u)?.isWrapped&&n++}return n}function co(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 JW(e,t,s,n,o,l){let u;return Rf(s,n,o,l).length>0?u=n-co(n,o):u=t,e<s&&u<=n||e>=s&&u<n?"C":"D"}function Zj(e,t){return e>t?"A":"B"}function Qj(e,t,s,n,o,l){let u=e,h=t,f="";for(;(u!==s||h!==n)&&h>=0&&h<l.buffer.lines.length;)u+=o?1:-1,o&&u>l.cols-1?(f+=l.buffer.translateBufferLineToString(h,!1,e,u),u=0,e=0,h++):!o&&u<0&&(f+=l.buffer.translateBufferLineToString(h,!1,0,e+1),u=l.cols-1,e=u,h--);return f+l.buffer.translateBufferLineToString(h,!1,e,u)}function su(e,t){let s=t?"O":"[";return Se.ESC+s+e}function nu(e,t){e=Math.floor(e);let s="";for(let n=0;n<e;n++)s+=t;return s}var eK=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 Q2(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 Ng=50,tK=15,sK=50,nK=500,iK=" ",rK=new RegExp(iK,"g"),S0=class extends pt{constructor(e,t,s,n,o,l,u,h,f){super(),this._element=e,this._screenElement=t,this._linkifier=s,this._bufferService=n,this._coreService=o,this._mouseService=l,this._optionsService=u,this._renderService=h,this._coreBrowserService=f,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new fi,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new Le),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new Le),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new Le),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new Le),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 eK(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(rK," ")).join(Kj?`\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())),Yb&&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=Q2(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=Kb(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,-Ng),Ng),t/=Ng,t/Math.abs(t)+Math.round(t*(tK-1)))}shouldForceSelection(e){return sf?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(),sK)}_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&&!(sf&&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<nK&&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=WW(s[0]-1,s[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(n,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,s=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!s){this._oldHasSelection&&this._fireOnSelectionChange(e,t,s);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,s)}_fireOnSelectionChange(e,t,s){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=s,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let s=t;for(let n=0;t>=n;n++){let o=e.loadCell(n,this._workCell).getChars().length;this._workCell.getWidth()===0?s--:o>1&&t!==n&&(s+=o-1)}return s}setSelection(e,t,s){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=s,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,s=!0,n=!0){if(e[0]>=this._bufferService.cols)return;let o=this._bufferService.buffer,l=o.lines.get(e[1]);if(!l)return;let u=o.translateBufferLineToString(e[1],!1),h=this._convertViewportColToCharacterIndex(l,e[0]),f=h,d=e[0]-h,p=0,g=0,x=0,v=0;if(u.charAt(h)===" "){for(;h>0&&u.charAt(h-1)===" ";)h--;for(;f<u.length&&u.charAt(f+1)===" ";)f++}else{let C=e[0],N=e[0];l.getWidth(C)===0&&(p++,C--),l.getWidth(N)===2&&(g++,N++);let T=l.getString(N).length;for(T>1&&(v+=T-1,f+=T-1);C>0&&h>0&&!this._isCharWordSeparator(l.loadCell(C-1,this._workCell));){l.loadCell(C-1,this._workCell);let j=this._workCell.getChars().length;this._workCell.getWidth()===0?(p++,C--):j>1&&(x+=j-1,h-=j-1),h--,C--}for(;N<l.length&&f+1<u.length&&!this._isCharWordSeparator(l.loadCell(N+1,this._workCell));){l.loadCell(N+1,this._workCell);let j=this._workCell.getChars().length;this._workCell.getWidth()===2?(g++,N++):j>1&&(v+=j-1,f+=j-1),f++,N++}}f++;let w=h+d-p+x,k=Math.min(this._bufferService.cols,f-h+p+g-x-v);if(!(!t&&u.slice(h,f).trim()==="")){if(s&&w===0&&l.getCodePoint(0)!==32){let C=o.lines.get(e[1]-1);if(C&&l.isWrapped&&C.getCodePoint(this._bufferService.cols-1)!==32){let N=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(N){let T=this._bufferService.cols-N.start;w-=T,k+=T}}}if(n&&w+k===this._bufferService.cols&&l.getCodePoint(this._bufferService.cols-1)!==32){let C=o.lines.get(e[1]+1);if(C?.isWrapped&&C.getCodePoint(0)!==32){let N=this._getWordAt([0,e[1]+1],!1,!1,!0);N&&(k+=N.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=Q2(s,this._bufferService.cols)}};S0=ds([Fe(3,_n),Fe(4,fo),Fe(5,Hb),Fe(6,yn),Fe(7,Dr),Fe(8,Mr)],S0);var J2=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={}}},ek=class{constructor(){this._color=new J2,this._css=new J2}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()}},Ms=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:js.toCss(n,o,l),rgba:js.toRgba(n,o,l)})}for(let s=0;s<24;s++){let n=8+s*10;e.push({css:js.toCss(n,n,n),rgba:js.toRgba(n,n,n)})}return e})()),Ya=rs.toColor("#ffffff"),Lc=rs.toColor("#000000"),tk=rs.toColor("#ffffff"),sk=Lc,Sc={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},aK=Ya,k0=class extends pt{constructor(e){super(),this._optionsService=e,this._contrastCache=new ek,this._halfContrastCache=new ek,this._onChangeColors=this._register(new Le),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Ya,background:Lc,cursor:tk,cursorAccent:sk,selectionForeground:void 0,selectionBackgroundTransparent:Sc,selectionBackgroundOpaque:Zt.blend(Lc,Sc),selectionInactiveBackgroundTransparent:Sc,selectionInactiveBackgroundOpaque:Zt.blend(Lc,Sc),scrollbarSliderBackground:Zt.opacity(Ya,.2),scrollbarSliderHoverBackground:Zt.opacity(Ya,.4),scrollbarSliderActiveBackground:Zt.opacity(Ya,.5),overviewRulerBorder:Ya,ansi:Ms.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,Ya),t.background=Ut(e.background,Lc),t.cursor=Zt.blend(t.background,Ut(e.cursor,tk)),t.cursorAccent=Zt.blend(t.background,Ut(e.cursorAccent,sk)),t.selectionBackgroundTransparent=Ut(e.selectionBackground,Sc),t.selectionBackgroundOpaque=Zt.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Ut(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Zt.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Ut(e.selectionForeground,Y2):void 0,t.selectionForeground===Y2&&(t.selectionForeground=void 0),Zt.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Zt.opacity(t.selectionBackgroundTransparent,.3)),Zt.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Zt.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Ut(e.scrollbarSliderBackground,Zt.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Ut(e.scrollbarSliderHoverBackground,Zt.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Ut(e.scrollbarSliderActiveBackground,Zt.opacity(t.foreground,.5)),t.overviewRulerBorder=Ut(e.overviewRulerBorder,aK),t.ansi=Ms.slice(),t.ansi[0]=Ut(e.black,Ms[0]),t.ansi[1]=Ut(e.red,Ms[1]),t.ansi[2]=Ut(e.green,Ms[2]),t.ansi[3]=Ut(e.yellow,Ms[3]),t.ansi[4]=Ut(e.blue,Ms[4]),t.ansi[5]=Ut(e.magenta,Ms[5]),t.ansi[6]=Ut(e.cyan,Ms[6]),t.ansi[7]=Ut(e.white,Ms[7]),t.ansi[8]=Ut(e.brightBlack,Ms[8]),t.ansi[9]=Ut(e.brightRed,Ms[9]),t.ansi[10]=Ut(e.brightGreen,Ms[10]),t.ansi[11]=Ut(e.brightYellow,Ms[11]),t.ansi[12]=Ut(e.brightBlue,Ms[12]),t.ansi[13]=Ut(e.brightMagenta,Ms[13]),t.ansi[14]=Ut(e.brightCyan,Ms[14]),t.ansi[15]=Ut(e.brightWhite,Ms[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],Ms[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()}}};k0=ds([Fe(0,yn)],k0);function Ut(e,t){if(e!==void 0)try{return rs.toColor(e)}catch{}return t}var oK=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)}},lK=class{constructor(){this._services=new oK,this._services.set($b,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let s=tG(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)}},cK={trace:0,debug:1,info:2,warn:3,error:4,off:5},uK="xterm.js: ",N0=class extends pt{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=cK[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?"":uK)+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)}};N0=ds([Fe(0,yn)],N0);var nk=class extends pt{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Le),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Le),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Le),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}},ft=3,Ns=Object.freeze(new xu),lh=0,Cg=2,zc=class Jj{constructor(t,s,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*ft);let o=s||fi.fromCharData([0,bj,1,0]);for(let l=0;l<t;++l)this.setCell(l,o);this.length=t}get(t){let s=this._data[t*ft+0],n=s&2097151;return[this._data[t*ft+1],s&2097152?this._combined[t]:n?pa(n):"",s>>22,s&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n]}set(t,s){this._data[t*ft+1]=s[0],s[1].length>1?(this._combined[t]=s[1],this._data[t*ft+0]=t|2097152|s[2]<<22):this._data[t*ft+0]=s[1].charCodeAt(0)|s[2]<<22}getWidth(t){return this._data[t*ft+0]>>22}hasWidth(t){return this._data[t*ft+0]&12582912}getFg(t){return this._data[t*ft+1]}getBg(t){return this._data[t*ft+2]}hasContent(t){return this._data[t*ft+0]&4194303}getCodePoint(t){let s=this._data[t*ft+0];return s&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):s&2097151}isCombined(t){return this._data[t*ft+0]&2097152}getString(t){let s=this._data[t*ft+0];return s&2097152?this._combined[t]:s&2097151?pa(s&2097151):""}isProtected(t){return this._data[t*ft+2]&536870912}loadCell(t,s){return lh=t*ft,s.content=this._data[lh+0],s.fg=this._data[lh+1],s.bg=this._data[lh+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*ft+0]=s.content,this._data[t*ft+1]=s.fg,this._data[t*ft+2]=s.bg}setCellFromCodepoint(t,s,n,o){o.bg&268435456&&(this._extendedAttrs[t]=o.extended),this._data[t*ft+0]=s|n<<22,this._data[t*ft+1]=o.fg,this._data[t*ft+2]=o.bg}addCodepointToCell(t,s,n){let o=this._data[t*ft+0];o&2097152?this._combined[t]+=pa(s):o&2097151?(this._combined[t]=pa(o&2097151)+pa(s),o&=-2097152,o|=2097152):o=s|1<<22,n&&(o&=-12582913,o|=n<<22),this._data[t*ft+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 fi;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 fi;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*Cg<this._data.buffer.byteLength;let n=t*ft;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*Cg<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Cg<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 Jj(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*ft+0]&4194303)return t+(this._data[t*ft+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*ft+0]&4194303||this._data[t*ft+2]&50331648)return t+(this._data[t*ft+0]>>22);return 0}copyCellsFrom(t,s,n,o,l){let u=t._data;if(l)for(let f=o-1;f>=0;f--){for(let d=0;d<ft;d++)this._data[(n+f)*ft+d]=u[(s+f)*ft+d];u[(s+f)*ft+2]&268435456&&(this._extendedAttrs[n+f]=t._extendedAttrs[s+f])}else for(let f=0;f<o;f++){for(let d=0;d<ft;d++)this._data[(n+f)*ft+d]=u[(s+f)*ft+d];u[(s+f)*ft+2]&268435456&&(this._extendedAttrs[n+f]=t._extendedAttrs[s+f])}let h=Object.keys(t._combined);for(let f=0;f<h.length;f++){let d=parseInt(h[f],10);d>=s&&(this._combined[d-s+n]=t._combined[d])}}translateToString(t,s,n,o){s=s??0,n=n??this.length,t&&(n=Math.min(n,this.getTrimmedLength())),o&&(o.length=0);let l="";for(;s<n;){let u=this._data[s*ft+0],h=u&2097151,f=u&2097152?this._combined[s]:h?pa(h):xa;if(l+=f,o)for(let d=0;d<f.length;++d)o.push(s);s+=u>>22||1}return o&&o.push(s),l}};function dK(e,t,s,n,o,l){let u=[];for(let h=0;h<e.length-1;h++){let f=h,d=e.get(++f);if(!d.isWrapped)continue;let p=[e.get(h)];for(;f<e.length&&d.isWrapped;)p.push(d),d=e.get(++f);if(!l&&n>=h&&n<f){h+=p.length-1;continue}let g=0,x=iu(p,g,t),v=1,w=0;for(;v<p.length;){let C=iu(p,v,t),N=C-w,T=s-x,j=Math.min(N,T);p[g].copyCellsFrom(p[v],w,x,j,!1),x+=j,x===s&&(g++,x=0),w+=j,w===C&&(v++,w=0),x===0&&g!==0&&p[g-1].getWidth(s-1)===2&&(p[g].copyCellsFrom(p[g-1],s-1,x++,1,!1),p[g-1].setCell(s-1,o))}p[g].replaceCells(x,s,o);let k=0;for(let C=p.length-1;C>0&&(C>g||p[C].getTrimmedLength()===0);C--)k++;k>0&&(u.push(h+p.length-k),u.push(k)),h+=p.length-1}return u}function hK(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 fK(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 mK(e,t,s){let n=[],o=e.map((f,d)=>iu(e,d,t)).reduce((f,d)=>f+d),l=0,u=0,h=0;for(;h<o;){if(o-h<s){n.push(o-h);break}l+=s;let f=iu(e,u,t);l>f&&(l-=f,u++);let d=e[u].getWidth(l-1)===2;d&&l--;let p=d?s-1:s;n.push(p),h+=p}return n}function iu(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 e5=class t5{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=t5._nextId++,this._onDispose=this.register(new Le),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),lo(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};e5._nextId=1;var pK=e5,Ls={},Xa=Ls.B;Ls[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Ls.A={"#":"£"};Ls.B=void 0;Ls[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Ls.C=Ls[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Ls.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Ls.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Ls.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Ls.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Ls.E=Ls[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Ls.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Ls.H=Ls[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Ls["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var ik=4294967295,rk=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=Ns.clone(),this.savedCharset=Xa,this.markers=[],this._nullCell=fi.fromCharData([0,bj,1,0]),this._whitespaceCell=fi.fromCharData([0,xa,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new nf,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new nk(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 Jh),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 Jh),this._whitespaceCell}getBlankLine(e,t){return new zc(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>ik?ik:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Ns);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 nk(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let s=this.getNullCell(Ns),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 zc(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 zc(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=dK(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Ns),s);if(n.length>0){let o=hK(this.lines,n);fK(this.lines,o.layout),this._reflowLargerAdjustViewport(e,t,o.countRemoved)}}_reflowLargerAdjustViewport(e,t,s){let n=this.getNullCell(Ns),o=s;for(;o-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new zc(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(Ns),o=[],l=0;for(let u=this.lines.length-1;u>=0;u--){let h=this.lines.get(u);if(!h||!h.isWrapped&&h.getTrimmedLength()<=e)continue;let f=[h];for(;h.isWrapped&&u>0;)h=this.lines.get(--u),f.unshift(h);if(!s){let j=this.ybase+this.y;if(j>=u&&j<u+f.length)continue}let d=f[f.length-1].getTrimmedLength(),p=mK(f,this._cols,e),g=p.length-f.length,x;this.ybase===0&&this.y!==this.lines.length-1?x=Math.max(0,this.y-this.lines.maxLength+g):x=Math.max(0,this.lines.length-this.lines.maxLength+g);let v=[];for(let j=0;j<g;j++){let A=this.getBlankLine(Ns,!0);v.push(A)}v.length>0&&(o.push({start:u+f.length+l,newLines:v}),l+=v.length),f.push(...v);let w=p.length-1,k=p[w];k===0&&(w--,k=p[w]);let C=f.length-g-1,N=d;for(;C>=0;){let j=Math.min(N,k);if(f[w]===void 0)break;if(f[w].copyCellsFrom(f[C],N-j,k-j,j,!0),k-=j,k===0&&(w--,k=p[w]),N-=j,N===0){C--;let A=Math.max(C,0);N=iu(f,A,this._cols)}}for(let j=0;j<f.length;j++)p[j]<e&&f[j].setCell(p[j],n);let T=g-x;for(;T-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+l)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+g,this.ybase+t-1)}if(o.length>0){let u=[],h=[];for(let k=0;k<this.lines.length;k++)h.push(this.lines.get(k));let f=this.lines.length,d=f-1,p=0,g=o[p];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+l);let x=0;for(let k=Math.min(this.lines.maxLength-1,f+l-1);k>=0;k--)if(g&&g.start>d+x){for(let C=g.newLines.length-1;C>=0;C--)this.lines.set(k--,g.newLines[C]);k++,u.push({index:d+1,amount:g.newLines.length}),x+=g.newLines.length,g=o[++p]}else this.lines.set(k,h[d--]);let v=0;for(let k=u.length-1;k>=0;k--)u[k].index+=v,this.lines.onInsertEmitter.fire(u[k]),v+=u[k].amount;let w=Math.max(0,f+l-this.lines.maxLength);w>0&&this.lines.onTrimEmitter.fire(w)}}translateBufferLineToString(e,t,s=0,n){let o=this.lines.get(e);return o?o.translateToString(t,s,n):""}getWrappedRangeForLine(e){let t=e,s=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;s+1<this.lines.length&&this.lines.get(s+1).isWrapped;)s++;return{first:t,last:s}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new pK(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)}},gK=class extends pt{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new Le),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 rk(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new rk(!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)}},s5=2,n5=1,C0=class extends pt{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new Le),this.onResize=this._onResize.event,this._onScroll=this._register(new Le),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,s5),this.rows=Math.max(e.rawOptions.rows||0,n5),this.buffers=this._register(new gK(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))}};C0=ds([Fe(0,yn)],C0);var Jo={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:sf,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},xK=["normal","bold","100","200","300","400","500","600","700","800","900"],bK=class extends pt{constructor(e){super(),this._onOptionChange=this._register(new Le),this.onOptionChange=this._onOptionChange.event;let t={...Jo};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 Jo))throw new Error(`No option with key "${s}"`);return this.rawOptions[s]},t=(s,n)=>{if(!(s in Jo))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=Jo[e]),!vK(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Jo[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=xK.includes(t)?t:Jo[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 vK(e){return e==="block"||e==="underline"||e==="bar"}function Bc(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]&&Bc(e[n],t-1);return s}var ak=Object.freeze({insertMode:!1}),ok=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),E0=class extends pt{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 Le),this.onData=this._onData.event,this._onUserInput=this._register(new Le),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Le),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Le),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Bc(ak),this.decPrivateModes=Bc(ok)}reset(){this.modes=Bc(ak),this.decPrivateModes=Bc(ok)}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))}};E0=ds([Fe(0,_n),Fe(1,Sj),Fe(2,yn)],E0);var lk={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 Eg(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 jg=String.fromCharCode,ck={DEFAULT:e=>{let t=[Eg(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${jg(t[0])}${jg(t[1])}${jg(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Eg(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Eg(e,!0)};${e.x};${e.y}${t}`}},j0=class extends pt{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 Le),this.onProtocolChange=this._onProtocolChange.event;for(let n of Object.keys(lk))this.addProtocol(n,lk[n]);for(let n of Object.keys(ck))this.addEncoding(n,ck[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)}};j0=ds([Fe(0,_n),Fe(1,fo),Fe(2,yn)],j0);var Ag=[[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]],_K=[[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]],Ds;function yK(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 wK=class{constructor(){if(this.version="6",!Ds){Ds=new Uint8Array(65536),Ds.fill(1),Ds[0]=0,Ds.fill(0,1,32),Ds.fill(0,127,160),Ds.fill(2,4352,4448),Ds[9001]=2,Ds[9002]=2,Ds.fill(2,11904,42192),Ds[12351]=1,Ds.fill(2,44032,55204),Ds.fill(2,63744,64256),Ds.fill(2,65040,65050),Ds.fill(2,65072,65136),Ds.fill(2,65280,65377),Ds.fill(2,65504,65511);for(let e=0;e<Ag.length;++e)Ds.fill(0,Ag[e][0],Ag[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Ds[e]:yK(e,_K)?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=eo.extractWidth(t);o===0?n=!1:o>s&&(s=o)}return eo.createPropertyValue(0,s,n)}},eo=class Ah{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Le,this.onChange=this._onChange.event;let t=new wK;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,s,n=!1){return(t&16777215)<<3|(s&3)<<1|(n?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let s=0,n=0,o=t.length;for(let l=0;l<o;++l){let u=t.charCodeAt(l);if(55296<=u&&u<=56319){if(++l>=o)return s+this.wcwidth(u);let d=t.charCodeAt(l);56320<=d&&d<=57343?u=(u-55296)*1024+d-56320+65536:s+=this.wcwidth(d)}let h=this.charProperties(u,n),f=Ah.extractWidth(h);Ah.extractShouldJoin(h)&&(f-=Ah.extractWidth(n)),s+=f,n=h}return s}charProperties(t,s){return this._activeProvider.charProperties(t,s)}},SK=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 uk(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),s=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);s&&t&&(s.isWrapped=t[3]!==0&&t[3]!==32)}var kc=2147483647,kK=256,i5=class A0{constructor(t=32,s=32){if(this.maxLength=t,this.maxSubParamsLength=s,s>kK)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 A0;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 A0(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let s=0;s<this.length;++s){t.push(this.params[s]);let n=this._subParamsIdx[s]>>8,o=this._subParamsIdx[s]&255;o-n>0&&t.push(Array.prototype.slice.call(this._subParams,n,o))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>kc?kc:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>kc?kc:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let s=this._subParamsIdx[t]>>8,n=this._subParamsIdx[t]&255;return n-s>0?this._subParams.subarray(s,n):null}getSubParamsAll(){let t={};for(let s=0;s<this.length;++s){let n=this._subParamsIdx[s]>>8,o=this._subParamsIdx[s]&255;o-n>0&&(t[s]=this._subParams.slice(n,o))}return t}addDigit(t){let s;if(this._rejectDigits||!(s=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,o=n[s-1];n[s-1]=~o?Math.min(o*10+t,kc):t}},Nc=[],NK=class{constructor(){this._state=0,this._active=Nc,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let s=this._handlers[e];return s.push(t),{dispose:()=>{let n=s.indexOf(t);n!==-1&&s.splice(n,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Nc}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=Nc,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Nc,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,s){if(!this._active.length)this._handlerFb(this._id,"PUT",jf(e,t,s));else for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,s)}start(){this.reset(),this._state=1}put(e,t,s){if(this._state!==3){if(this._state===1)for(;t<s;){let n=e[t++];if(n===59){this._state=2,this._start();break}if(n<48||57<n){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+n-48}this._state===2&&s-t>0&&this._put(e,t,s)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let s=!1,n=this._active.length-1,o=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,s=t,o=this._stack.fallThrough,this._stack.paused=!1),!o&&s===!1){for(;n>=0&&(s=this._active[n].end(e),s!==!0);n--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,s;n--}for(;n>=0;n--)if(s=this._active[n].end(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,s}this._active=Nc,this._id=-1,this._state=0}}},Gn=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+=jf(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}},Cc=[],CK=class{constructor(){this._handlers=Object.create(null),this._active=Cc,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Cc}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let s=this._handlers[e];return s.push(t),{dispose:()=>{let n=s.indexOf(t);n!==-1&&s.splice(n,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=Cc,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Cc,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let s=this._active.length-1;s>=0;s--)this._active[s].hook(t)}put(e,t,s){if(!this._active.length)this._handlerFb(this._ident,"PUT",jf(e,t,s));else for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,s)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let s=!1,n=this._active.length-1,o=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,s=t,o=this._stack.fallThrough,this._stack.paused=!1),!o&&s===!1){for(;n>=0&&(s=this._active[n].unhook(e),s!==!0);n--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,s;n--}for(;n>=0;n--)if(s=this._active[n].unhook(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,s}this._active=Cc,this._ident=0}},Pc=new i5;Pc.addParam(0);var dk=class{constructor(e){this._handler=e,this._data="",this._params=Pc,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Pc,this._data="",this._hitLimit=!1}put(e,t,s){this._hitLimit||(this._data+=jf(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=Pc,this._data="",this._hitLimit=!1,s));return this._params=Pc,this._data="",this._hitLimit=!1,t}},EK=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}},ui=160,jK=(function(){let e=new EK(4095),t=Array.apply(null,Array(256)).map((h,f)=>f),s=(h,f)=>t.slice(h,f),n=s(32,127),o=s(0,24);o.push(25),o.push.apply(o,s(28,32));let l=s(0,14),u;e.setDefault(1,0),e.addMany(n,0,2,0);for(u in l)e.addMany([24,26,153,154],u,3,0),e.addMany(s(128,144),u,3,0),e.addMany(s(144,152),u,3,0),e.add(156,u,0,0),e.add(27,u,11,1),e.add(157,u,4,8),e.addMany([152,158,159],u,0,7),e.add(155,u,11,3),e.add(144,u,11,9);return e.addMany(o,0,3,0),e.addMany(o,1,3,1),e.add(127,1,0,1),e.addMany(o,8,0,8),e.addMany(o,3,3,3),e.add(127,3,0,3),e.addMany(o,4,3,4),e.add(127,4,0,4),e.addMany(o,6,3,6),e.addMany(o,5,3,5),e.add(127,5,0,5),e.addMany(o,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(n,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(s(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(n,7,0,7),e.addMany(o,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(s(64,127),3,7,0),e.addMany(s(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(s(48,60),4,8,4),e.addMany(s(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(s(32,64),6,0,6),e.add(127,6,0,6),e.addMany(s(64,127),6,0,0),e.addMany(s(32,48),3,9,5),e.addMany(s(32,48),5,9,5),e.addMany(s(48,64),5,0,6),e.addMany(s(64,127),5,7,0),e.addMany(s(32,48),4,9,5),e.addMany(s(32,48),1,9,2),e.addMany(s(32,48),2,9,2),e.addMany(s(48,127),2,10,0),e.addMany(s(48,80),1,10,0),e.addMany(s(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(s(96,127),1,10,0),e.add(80,1,11,9),e.addMany(o,9,0,9),e.add(127,9,0,9),e.addMany(s(28,32),9,0,9),e.addMany(s(32,48),9,9,12),e.addMany(s(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(o,11,0,11),e.addMany(s(32,128),11,0,11),e.addMany(s(28,32),11,0,11),e.addMany(o,10,0,10),e.add(127,10,0,10),e.addMany(s(28,32),10,0,10),e.addMany(s(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(s(32,48),10,9,12),e.addMany(o,12,0,12),e.add(127,12,0,12),e.addMany(s(28,32),12,0,12),e.addMany(s(32,48),12,9,12),e.addMany(s(48,64),12,0,11),e.addMany(s(64,127),12,12,13),e.addMany(s(64,127),10,12,13),e.addMany(s(64,127),9,12,13),e.addMany(o,13,13,13),e.addMany(n,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(ui,0,2,0),e.add(ui,8,5,8),e.add(ui,6,0,6),e.add(ui,11,0,11),e.add(ui,13,13,13),e})(),AK=class extends pt{constructor(e=jK){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 i5,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 NK),this._dcsParser=this._register(new CK),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let s=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(s=e.prefix.charCodeAt(0),s&&60>s||s>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let o=0;o<e.intermediates.length;++o){let l=e.intermediates.charCodeAt(o);if(32>l||l>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");s<<=8,s|=l}}if(e.final.length!==1)throw new Error("final must be a single byte");let n=e.final.charCodeAt(0);if(t[0]>n||n>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return s<<=8,s|=n,s}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let s=this._identifier(e,[48,126]);this._escHandlers[s]===void 0&&(this._escHandlers[s]=[]);let n=this._escHandlers[s];return n.push(t),{dispose:()=>{let o=n.indexOf(t);o!==-1&&n.splice(o,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let s=this._identifier(e);this._csiHandlers[s]===void 0&&(this._csiHandlers[s]=[]);let n=this._csiHandlers[s];return n.push(t),{dispose:()=>{let o=n.indexOf(t);o!==-1&&n.splice(o,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,s,n,o){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=s,this._parseStack.transition=n,this._parseStack.chunkPos=o}parse(e,t,s){let n=0,o=0,l=0,u;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,l=this._parseStack.chunkPos+1;else{if(s===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let h=this._parseStack.handlers,f=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(s===!1&&f>-1){for(;f>=0&&(u=h[f](this._params),u!==!0);f--)if(u instanceof Promise)return this._parseStack.handlerPos=f,u}this._parseStack.handlers=[];break;case 4:if(s===!1&&f>-1){for(;f>=0&&(u=h[f](),u!==!0);f--)if(u instanceof Promise)return this._parseStack.handlerPos=f,u}this._parseStack.handlers=[];break;case 6:if(n=e[this._parseStack.chunkPos],u=this._dcsParser.unhook(n!==24&&n!==26,s),u)return u;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(n=e[this._parseStack.chunkPos],u=this._oscParser.end(n!==24&&n!==26,s),u)return u;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,l=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let h=l;h<t;++h){switch(n=e[h],o=this._transitions.table[this.currentState<<8|(n<160?n:ui)],o>>4){case 2:for(let x=h+1;;++x){if(x>=t||(n=e[x])<32||n>126&&n<ui){this._printHandler(e,h,x),h=x-1;break}if(++x>=t||(n=e[x])<32||n>126&&n<ui){this._printHandler(e,h,x),h=x-1;break}if(++x>=t||(n=e[x])<32||n>126&&n<ui){this._printHandler(e,h,x),h=x-1;break}if(++x>=t||(n=e[x])<32||n>126&&n<ui){this._printHandler(e,h,x),h=x-1;break}}break;case 3:this._executeHandlers[n]?this._executeHandlers[n]():this._executeHandlerFb(n),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:h,code:n,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let f=this._csiHandlers[this._collect<<8|n],d=f?f.length-1:-1;for(;d>=0&&(u=f[d](this._params),u!==!0);d--)if(u instanceof Promise)return this._preserveStack(3,f,d,o,h),u;d<0&&this._csiHandlerFb(this._collect<<8|n,this._params),this.precedingJoinState=0;break;case 8:do switch(n){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(n-48)}while(++h<t&&(n=e[h])>47&&n<60);h--;break;case 9:this._collect<<=8,this._collect|=n;break;case 10:let p=this._escHandlers[this._collect<<8|n],g=p?p.length-1:-1;for(;g>=0&&(u=p[g](),u!==!0);g--)if(u instanceof Promise)return this._preserveStack(4,p,g,o,h),u;g<0&&this._escHandlerFb(this._collect<<8|n),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|n,this._params);break;case 13:for(let x=h+1;;++x)if(x>=t||(n=e[x])===24||n===26||n===27||n>127&&n<ui){this._dcsParser.put(e,h,x),h=x-1;break}break;case 14:if(u=this._dcsParser.unhook(n!==24&&n!==26),u)return this._preserveStack(6,[],0,o,h),u;n===27&&(o|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let x=h+1;;x++)if(x>=t||(n=e[x])<32||n>127&&n<ui){this._oscParser.put(e,h,x),h=x-1;break}break;case 6:if(u=this._oscParser.end(n!==24&&n!==26),u)return this._preserveStack(5,[],0,o,h),u;n===27&&(o|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=o&15}}},TK=/^([\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})$/,RK=/^[\da-f]+$/;function hk(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let s=TK.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),RK.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 Tg(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 MK(e,t=16){let[s,n,o]=e;return`rgb:${Tg(s,t)}/${Tg(n,t)}/${Tg(o,t)}`}var DK={"(":0,")":1,"*":2,"+":3,"-":1,".":2},ha=131072,fk=10;function mk(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 pk=5e3,gk=0,OK=class extends pt{constructor(e,t,s,n,o,l,u,h,f=new AK){super(),this._bufferService=e,this._charsetService=t,this._coreService=s,this._logService=n,this._optionsService=o,this._oscLinkService=l,this._coreMouseService=u,this._unicodeService=h,this._parser=f,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new JV,this._utf8Decoder=new eG,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Ns.clone(),this._eraseAttrDataInternal=Ns.clone(),this._onRequestBell=this._register(new Le),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Le),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Le),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Le),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Le),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Le),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Le),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Le),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Le),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Le),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Le),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Le),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Le),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 T0(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(Se.BEL,()=>this.bell()),this._parser.setExecuteHandler(Se.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(Se.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(Se.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(Se.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(Se.BS,()=>this.backspace()),this._parser.setExecuteHandler(Se.HT,()=>this.tab()),this._parser.setExecuteHandler(Se.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(Se.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Eh.IND,()=>this.index()),this._parser.setExecuteHandler(Eh.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Eh.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Gn(d=>(this.setTitle(d),this.setIconName(d),!0))),this._parser.registerOscHandler(1,new Gn(d=>this.setIconName(d))),this._parser.registerOscHandler(2,new Gn(d=>this.setTitle(d))),this._parser.registerOscHandler(4,new Gn(d=>this.setOrReportIndexedColor(d))),this._parser.registerOscHandler(8,new Gn(d=>this.setHyperlink(d))),this._parser.registerOscHandler(10,new Gn(d=>this.setOrReportFgColor(d))),this._parser.registerOscHandler(11,new Gn(d=>this.setOrReportBgColor(d))),this._parser.registerOscHandler(12,new Gn(d=>this.setOrReportCursorColor(d))),this._parser.registerOscHandler(104,new Gn(d=>this.restoreIndexedColor(d))),this._parser.registerOscHandler(110,new Gn(d=>this.restoreFgColor(d))),this._parser.registerOscHandler(111,new Gn(d=>this.restoreBgColor(d))),this._parser.registerOscHandler(112,new Gn(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 Ls)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 dk((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"),pk))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${pk} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let s,n=this._activeBuffer.x,o=this._activeBuffer.y,l=0,u=this._parseStack.paused;if(u){if(s=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(s),s;n=this._parseStack.cursorStartX,o=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>ha&&(l=this._parseStack.position+ha)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,d=>String.fromCharCode(d)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(d=>d.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<ha&&(this._parseBuffer=new Uint32Array(Math.min(e.length,ha))),u||this._dirtyRowTracker.clearRange(),e.length>ha)for(let d=l;d<e.length;d+=ha){let p=d+ha<e.length?d+ha:e.length,g=typeof e=="string"?this._stringDecoder.decode(e.substring(d,p),this._parseBuffer):this._utf8Decoder.decode(e.subarray(d,p),this._parseBuffer);if(s=this._parser.parse(this._parseBuffer,g))return this._preserveStack(n,o,g,d),this._logSlowResolvingAsync(s),s}else if(!u){let d=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(s=this._parser.parse(this._parseBuffer,d))return this._preserveStack(n,o,d,0),this._logSlowResolvingAsync(s),s}(this._activeBuffer.x!==n||this._activeBuffer.y!==o)&&this._onCursorMove.fire();let h=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),f=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);f<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(f,this._bufferService.rows-1),end:Math.min(h,this._bufferService.rows-1)})}print(e,t,s){let n,o,l=this._charsetService.charset,u=this._optionsService.rawOptions.screenReaderMode,h=this._bufferService.cols,f=this._coreService.decPrivateModes.wraparound,d=this._coreService.modes.insertMode,p=this._curAttrData,g=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&s-t>0&&g.getWidth(this._activeBuffer.x-1)===2&&g.setCellFromCodepoint(this._activeBuffer.x-1,0,1,p);let x=this._parser.precedingJoinState;for(let v=t;v<s;++v){if(n=e[v],n<127&&l){let N=l[String.fromCharCode(n)];N&&(n=N.charCodeAt(0))}let w=this._unicodeService.charProperties(n,x);o=eo.extractWidth(w);let k=eo.extractShouldJoin(w),C=k?eo.extractWidth(x):0;if(x=w,u&&this._onA11yChar.fire(pa(n)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+o-C>h){if(f){let N=g,T=this._activeBuffer.x-C;for(this._activeBuffer.x=C,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),C>0&&g instanceof zc&&g.copyCellsFrom(N,T,0,C,!1);T<h;)N.setCellFromCodepoint(T++,0,1,p)}else if(this._activeBuffer.x=h-1,o===2)continue}if(k&&this._activeBuffer.x){let N=g.getWidth(this._activeBuffer.x-1)?1:2;g.addCodepointToCell(this._activeBuffer.x-N,n,o);for(let T=o-C;--T>=0;)g.setCellFromCodepoint(this._activeBuffer.x++,0,0,p);continue}if(d&&(g.insertCells(this._activeBuffer.x,o-C,this._activeBuffer.getNullCell(p)),g.getWidth(h-1)===2&&g.setCellFromCodepoint(h-1,0,1,p)),g.setCellFromCodepoint(this._activeBuffer.x++,n,o,p),o>0)for(;--o;)g.setCellFromCodepoint(this._activeBuffer.x++,0,0,p)}this._parser.precedingJoinState=x,this._activeBuffer.x<h&&s-t>0&&g.getWidth(this._activeBuffer.x)===0&&!g.hasContent(this._activeBuffer.x)&&g.setCellFromCodepoint(this._activeBuffer.x,0,1,p),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,s=>mk(s.params[0],this._optionsService.rawOptions.windowOptions)?t(s):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new dk(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Gn(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(Ns));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=eo.extractWidth(t),o=this._activeBuffer.x-n,l=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(o),u=new Uint32Array(l.length*s),h=0;for(let d=0;d<l.length;){let p=l.codePointAt(d)||0;u[h++]=p,d+=p>65535?2:1}let f=h;for(let d=1;d<s;++d)u.copyWithin(f,0,h),f+=h;return this.print(u,0,f),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(Se.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(Se.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(Se.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(Se.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(Se.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,Xa),this._charsetService.setgCharset(1,Xa),this._charsetService.setgCharset(2,Xa),this._charsetService.setgCharset(3,Xa);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){let s;(k=>(k[k.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",k[k.SET=1]="SET",k[k.RESET=2]="RESET",k[k.PERMANENTLY_SET=3]="PERMANENTLY_SET",k[k.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(s||={});let n=this._coreService.decPrivateModes,{activeProtocol:o,activeEncoding:l}=this._coreMouseService,u=this._coreService,{buffers:h,cols:f}=this._bufferService,{active:d,alt:p}=h,g=this._optionsService.rawOptions,x=(k,C)=>(u.triggerDataEvent(`${Se.ESC}[${t?"":"?"}${k};${C}$y`),!0),v=k=>k?1:2,w=e.params[0];return t?w===2?x(w,4):w===4?x(w,v(u.modes.insertMode)):w===12?x(w,3):w===20?x(w,v(g.convertEol)):x(w,0):w===1?x(w,v(n.applicationCursorKeys)):w===3?x(w,g.windowOptions.setWinLines?f===80?2:f===132?1:0:0):w===6?x(w,v(n.origin)):w===7?x(w,v(n.wraparound)):w===8?x(w,3):w===9?x(w,v(o==="X10")):w===12?x(w,v(g.cursorBlink)):w===25?x(w,v(!u.isCursorHidden)):w===45?x(w,v(n.reverseWraparound)):w===66?x(w,v(n.applicationKeypad)):w===67?x(w,4):w===1e3?x(w,v(o==="VT200")):w===1002?x(w,v(o==="DRAG")):w===1003?x(w,v(o==="ANY")):w===1004?x(w,v(n.sendFocus)):w===1005?x(w,4):w===1006?x(w,v(l==="SGR")):w===1015?x(w,4):w===1016?x(w,v(l==="SGR_PIXELS")):w===1048?x(w,1):w===47||w===1047||w===1049?x(w,v(d===p)):w===2004?x(w,v(n.bracketedPasteMode)):w===2026?x(w,v(n.synchronizedOutput)):x(w,0)}_updateAttrColor(e,t,s,n,o){return t===2?(e|=50331648,e&=-16777216,e|=xu.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=Ns.fg,e.bg=Ns.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|=Ns.fg&16777215):s===49?(n.bg&=-67108864,n.bg|=Ns.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|=Ns.fg&16777215,n.bg&=-67108864,n.bg|=Ns.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",s);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${Se.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,s=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Se.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(`${Se.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=Ns.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(!mk(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(`${Se.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>fk&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>fk&&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(xk(l))if(o==="?")t.push({type:0,index:l});else{let u=hk(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=hk(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]);xk(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,Xa),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(DK[e[0]],Ls[e[1]]||Xa),!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=Ns.clone(),this._eraseAttrDataInternal=Ns.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 fi;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(`${Se.ESC}${u}${Se.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)}},T0=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&&(gk=e,e=t,t=gk),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};T0=ds([Fe(0,_n)],T0);function xk(e){return 0<=e&&e<256}var LK=5e7,bk=12,zK=50,BK=class extends pt{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 Le),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>LK)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>=bk?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>=bk)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>zK&&(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()}},R0=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let h=t.addMarker(t.ybase+t.y),f={data:e,id:this._nextId++,lines:[h]};return h.onDispose(()=>this._removeMarkerFromLink(f,h)),this._dataByLinkId.set(f.id,f),f.id}let s=e,n=this._getEntryIdKey(s),o=this._entriesWithId.get(n);if(o)return this.addLineToLink(o.id,t.ybase+t.y),o.id;let l=t.addMarker(t.ybase+t.y),u={id:this._nextId++,key:this._getEntryIdKey(s),data:s,lines:[l]};return l.onDispose(()=>this._removeMarkerFromLink(u,l)),this._entriesWithId.set(u.key,u),this._dataByLinkId.set(u.id,u),u.id}addLineToLink(e,t){let s=this._dataByLinkId.get(e);if(s&&s.lines.every(n=>n.line!==t)){let n=this._bufferService.buffer.addMarker(t);s.lines.push(n),n.onDispose(()=>this._removeMarkerFromLink(s,n))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let s=e.lines.indexOf(t);s!==-1&&(e.lines.splice(s,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};R0=ds([Fe(0,_n)],R0);var vk=!1,PK=class extends pt{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new fl),this._onBinary=this._register(new Le),this.onBinary=this._onBinary.event,this._onData=this._register(new Le),this.onData=this._onData.event,this._onLineFeed=this._register(new Le),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Le),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Le),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Le),this._instantiationService=new lK,this.optionsService=this._register(new bK(e)),this._instantiationService.setService(yn,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(C0)),this._instantiationService.setService(_n,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(N0)),this._instantiationService.setService(Sj,this._logService),this.coreService=this._register(this._instantiationService.createInstance(E0)),this._instantiationService.setService(fo,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(j0)),this._instantiationService.setService(wj,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(eo)),this._instantiationService.setService(iG,this.unicodeService),this._charsetService=this._instantiationService.createInstance(SK),this._instantiationService.setService(nG,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(R0),this._instantiationService.setService(kj,this._oscLinkService),this._inputHandler=this._register(new OK(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 BK((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 Le),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&&!vk&&(this._logService.warn("writeSync is unreliable and will be removed soon."),vk=!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,s5),t=Math.max(t,n5),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(uk.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(uk(this._bufferService),!1))),this._windowsWrappingHeuristics.value=ss(()=>{for(let t of e)t.dispose()})}}},IK={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 $K(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=Se.ESC+"OA":o.key=Se.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?o.key=Se.ESC+"OD":o.key=Se.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?o.key=Se.ESC+"OC":o.key=Se.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?o.key=Se.ESC+"OB":o.key=Se.ESC+"[B");break;case 8:o.key=e.ctrlKey?"\b":Se.DEL,e.altKey&&(o.key=Se.ESC+o.key);break;case 9:if(e.shiftKey){o.key=Se.ESC+"[Z";break}o.key=Se.HT,o.cancel=!0;break;case 13:o.key=e.altKey?Se.ESC+Se.CR:Se.CR,o.cancel=!0;break;case 27:o.key=Se.ESC,e.altKey&&(o.key=Se.ESC+Se.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;l?o.key=Se.ESC+"[1;"+(l+1)+"D":t?o.key=Se.ESC+"OD":o.key=Se.ESC+"[D";break;case 39:if(e.metaKey)break;l?o.key=Se.ESC+"[1;"+(l+1)+"C":t?o.key=Se.ESC+"OC":o.key=Se.ESC+"[C";break;case 38:if(e.metaKey)break;l?o.key=Se.ESC+"[1;"+(l+1)+"A":t?o.key=Se.ESC+"OA":o.key=Se.ESC+"[A";break;case 40:if(e.metaKey)break;l?o.key=Se.ESC+"[1;"+(l+1)+"B":t?o.key=Se.ESC+"OB":o.key=Se.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(o.key=Se.ESC+"[2~");break;case 46:l?o.key=Se.ESC+"[3;"+(l+1)+"~":o.key=Se.ESC+"[3~";break;case 36:l?o.key=Se.ESC+"[1;"+(l+1)+"H":t?o.key=Se.ESC+"OH":o.key=Se.ESC+"[H";break;case 35:l?o.key=Se.ESC+"[1;"+(l+1)+"F":t?o.key=Se.ESC+"OF":o.key=Se.ESC+"[F";break;case 33:e.shiftKey?o.type=2:e.ctrlKey?o.key=Se.ESC+"[5;"+(l+1)+"~":o.key=Se.ESC+"[5~";break;case 34:e.shiftKey?o.type=3:e.ctrlKey?o.key=Se.ESC+"[6;"+(l+1)+"~":o.key=Se.ESC+"[6~";break;case 112:l?o.key=Se.ESC+"[1;"+(l+1)+"P":o.key=Se.ESC+"OP";break;case 113:l?o.key=Se.ESC+"[1;"+(l+1)+"Q":o.key=Se.ESC+"OQ";break;case 114:l?o.key=Se.ESC+"[1;"+(l+1)+"R":o.key=Se.ESC+"OR";break;case 115:l?o.key=Se.ESC+"[1;"+(l+1)+"S":o.key=Se.ESC+"OS";break;case 116:l?o.key=Se.ESC+"[15;"+(l+1)+"~":o.key=Se.ESC+"[15~";break;case 117:l?o.key=Se.ESC+"[17;"+(l+1)+"~":o.key=Se.ESC+"[17~";break;case 118:l?o.key=Se.ESC+"[18;"+(l+1)+"~":o.key=Se.ESC+"[18~";break;case 119:l?o.key=Se.ESC+"[19;"+(l+1)+"~":o.key=Se.ESC+"[19~";break;case 120:l?o.key=Se.ESC+"[20;"+(l+1)+"~":o.key=Se.ESC+"[20~";break;case 121:l?o.key=Se.ESC+"[21;"+(l+1)+"~":o.key=Se.ESC+"[21~";break;case 122:l?o.key=Se.ESC+"[23;"+(l+1)+"~":o.key=Se.ESC+"[23~";break;case 123:l?o.key=Se.ESC+"[24;"+(l+1)+"~":o.key=Se.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=Se.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?o.key=Se.DEL:e.keyCode===219?o.key=Se.ESC:e.keyCode===220?o.key=Se.FS:e.keyCode===221&&(o.key=Se.GS);else if((!s||n)&&e.altKey&&!e.metaKey){let u=IK[e.keyCode]?.[e.shiftKey?1:0];if(u)o.key=Se.ESC+u;else if(e.keyCode>=65&&e.keyCode<=90){let h=e.ctrlKey?e.keyCode-64:e.keyCode+32,f=String.fromCharCode(h);e.shiftKey&&(f=f.toUpperCase()),o.key=Se.ESC+f}else if(e.keyCode===32)o.key=Se.ESC+(e.ctrlKey?Se.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let h=e.code.slice(3,4);e.shiftKey||(h=h.toLowerCase()),o.key=Se.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=Se.US),e.key==="@"&&(o.key=Se.NUL));break}return o}var xs=0,HK=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new nf,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new nf,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||(xs=this._search(t),xs===-1)||this._getKey(this._array[xs])!==t)return!1;do if(this._array[xs]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(xs),!0;while(++xs<this._array.length&&this._getKey(this._array[xs])===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&&(xs=this._search(e),!(xs<0||xs>=this._array.length)&&this._getKey(this._array[xs])===e))do yield this._array[xs];while(++xs<this._array.length&&this._getKey(this._array[xs])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(xs=this._search(e),!(xs<0||xs>=this._array.length)&&this._getKey(this._array[xs])===e))do t(this._array[xs]);while(++xs<this._array.length&&this._getKey(this._array[xs])===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}},Rg=0,_k=0,UK=class extends pt{constructor(){super(),this._decorations=new HK(e=>e?.marker.line),this._onDecorationRegistered=this._register(new Le),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Le),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 FK(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=>{Rg=o.options.x??0,_k=Rg+(o.options.width??1),e>=Rg&&e<_k&&(!s||(o.options.layer??"bottom")===s)&&n(o)})}},FK=class extends ba{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Le),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Le),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()}},qK=1e3,VK=class{constructor(e,t=qK){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)}},yk=20,rf=class extends pt{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 VK(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<yk+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
176
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===yk+1&&(this._liveRegion.textContent+=Zx.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let s=this._terminal.buffer,n=s.lines.length.toString();for(let o=e;o<=t;o++){let l=s.lines.get(s.ydisp+o),u=[],h=l?.translateToString(!0,void 0,void 0,u)||"",f=(s.ydisp+o+1).toString(),d=this._rowElements[o];d&&(h.length===0?(d.textContent=" ",this._rowColumns.set(d,[0,1])):(d.textContent=h,this._rowColumns.set(d,u)),d.setAttribute("aria-posinset",f),d.setAttribute("aria-setsize",n),this._alignRowWidth(d))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let s=e.target,n=this._rowElements[t===0?1:this._rowElements.length-2],o=s.getAttribute("aria-posinset"),l=t===0?"1":`${this._terminal.buffer.lines.length}`;if(o===l||e.relatedTarget!==n)return;let u,h;if(t===0?(u=s,h=this._rowElements.pop(),this._rowContainer.removeChild(h)):(u=this._rowElements.shift(),h=s,this._rowContainer.removeChild(u)),u.removeEventListener("focus",this._topBoundaryFocusListener),h.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let f=this._createAccessibilityTreeNode();this._rowElements.unshift(f),this._rowContainer.insertAdjacentElement("afterbegin",f)}else{let f=this._createAccessibilityTreeNode();this._rowElements.push(f),this._rowContainer.appendChild(f)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},s={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(s.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===s.node&&t.offset>s.offset)&&([t,s]=[s,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let n=this._rowElements.slice(-1)[0];if(s.node.compareDocumentPosition(n)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(s={node:n,offset:n.textContent?.length??0}),!this._rowContainer.contains(s.node))return;let o=({node:h,offset:f})=>{let d=h instanceof Text?h.parentNode:h,p=parseInt(d?.getAttribute("aria-posinset"),10)-1;if(isNaN(p))return console.warn("row is invalid. Race condition?"),null;let g=this._rowColumns.get(d);if(!g)return console.warn("columns is null. Race condition?"),null;let x=f<g.length?g[f]:g.slice(-1)[0]+1;return x>=this._terminal.cols&&(++p,x=0),{row:p,column:x}},l=o(t),u=o(s);if(!(!l||!u)){if(l.row>u.row||l.row===u.row&&l.column>=u.column)throw new Error("invalid range");this._terminal.select(l.column,l.row,(u.row-l.row)*this._terminal.cols-l.column+u.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform="";let t=e.getBoundingClientRect().width,s=this._rowColumns.get(e)?.slice(-1)?.[0];if(!s)return;let n=s*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${n/t})`}};rf=ds([Fe(1,$b),Fe(2,Mr),Fe(3,Dr)],rf);var M0=class extends pt{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 Le),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Le),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(ss(()=>{lo(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,f=u.link.range.end.y>e?this._bufferService.cols:u.link.range.end.x;for(let d=h;d<=f;d++){if(s.has(d)){o.splice(l--,1);break}s.add(d)}}}}_checkLinkProviderResult(e,t,s){if(!this._activeProviderReplies)return s;let n=this._activeProviderReplies.get(e),o=!1;for(let l=0;l<e;l++)(!this._activeProviderReplies.has(l)||this._activeProviderReplies.get(l))&&(o=!0);if(!o&&n){let l=n.find(u=>this._linkAtPosition(u.link,t));l&&(s=!0,this._handleNewLink(l))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!s)for(let l=0;l<this._activeProviderReplies.size;l++){let u=this._activeProviderReplies.get(l)?.find(h=>this._linkAtPosition(h.link,t));if(u){s=!0,this._handleNewLink(u);break}}return s}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&GK(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,lo(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}}};M0=ds([Fe(1,Hb),Fe(2,Dr),Fe(3,_n),Fe(4,Cj)],M0);function GK(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 WK=class extends PK{constructor(e={}){super(e),this._linkifier=this._register(new fl),this.browser=Vj,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new fl),this._onCursorMove=this._register(new Le),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Le),this.onKey=this._onKey.event,this._onRender=this._register(new Le),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new Le),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Le),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Le),this.onBell=this._onBell.event,this._onFocus=this._register(new Le),this._onBlur=this._register(new Le),this._onA11yCharEmitter=this._register(new Le),this._onA11yTabEmitter=this._register(new Le),this._onWillOpen=this._register(new Le),this._setup(),this._decorationService=this._instantiationService.createInstance(UK),this._instantiationService.setService(bu,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(zW),this._instantiationService.setService(Cj,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Jx)),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=Zt.toColorRGB(s==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[s]);this.coreService.triggerDataEvent(`${Se.ESC}]${n};${MK(o)}${Fj.ST}`);break;case 1:if(s==="ansi")this._themeService.modifyColors(l=>l.ansi[t.index]=js.toColor(...t.color));else{let l=s;this._themeService.modifyColors(u=>u[l]=js.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(rf,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Se.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(Se.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()&&ZV(t,this._selectionService)}));let e=t=>QV(t,this.textarea,this.coreService,this.optionsService);this._register(ot(this.textarea,"paste",e)),this._register(ot(this.element,"paste",e)),Gj?this._register(ot(this.element,"mousedown",t=>{t.button===2&&R2(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(ot(this.element,"contextmenu",t=>{R2(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Yb&&this._register(ot(this.element,"auxclick",t=>{t.button===1&&xj(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",Xx.get()),Yj||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(OW,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Mr,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(_0,this._document,this._helperContainer),this._instantiationService.setService(Af,this._charSizeService),this._themeService=this._instantiationService.createInstance(k0),this._instantiationService.setService(yl,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(tf),this._instantiationService.setService(Nj,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(w0,this.rows,this.screenElement)),this._instantiationService.setService(Dr,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(x0,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(y0),this._instantiationService.setService(Hb,this._mouseService);let n=this._linkifier.value=this._register(this._instantiationService.createInstance(M0,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(p0,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(S0,this.element,this.screenElement,n)),this._instantiationService.setService(aG,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(g0,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(rf,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(ef,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(ef,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(v0,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function s(l){let u=e._mouseService.getMouseReportCoords(l,e.screenElement);if(!u)return!1;let h,f;switch(l.overrideType||l.type){case"mousemove":f=32,l.buttons===void 0?(h=3,l.button!==void 0&&(h=l.button<3?l.button:3)):h=l.buttons&1?0:l.buttons&4?1:l.buttons&2?2:3;break;case"mouseup":f=0,h=l.button<3?l.button:3;break;case"mousedown":f=1,h=l.button<3?l.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(l)===!1)return!1;let d=l.deltaY;if(d===0||e.coreMouseService.consumeWheelEvent(l,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;f=d<0?0:1,h=4;break;default:return!1}return f===void 0||h===void 0||h>4?!1:e.coreMouseService.triggerMouseEvent({col:u.col,row:u.row,x:u.x,y:u.y,button:h,action:f,ctrl:l.ctrlKey,alt:l.altKey,shift:l.shiftKey})}let n={mouseup:null,wheel:null,mousedrag:null,mousemove:null},o={mouseup:l=>(s(l),l.buttons||(this._document.removeEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.removeEventListener("mousemove",n.mousedrag)),this.cancel(l)),wheel:l=>(s(l),this.cancel(l,!0)),mousedrag:l=>{l.buttons&&s(l)},mousemove:l=>{l.buttons||s(l)}};this._register(this.coreMouseService.onProtocolChange(l=>{l?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(l)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),l&8?n.mousemove||(t.addEventListener("mousemove",o.mousemove),n.mousemove=o.mousemove):(t.removeEventListener("mousemove",n.mousemove),n.mousemove=null),l&16?n.wheel||(t.addEventListener("wheel",o.wheel,{passive:!1}),n.wheel=o.wheel):(t.removeEventListener("wheel",n.wheel),n.wheel=null),l&2?n.mouseup||(n.mouseup=o.mouseup):(this._document.removeEventListener("mouseup",n.mouseup),n.mouseup=null),l&4?n.mousedrag||(n.mousedrag=o.mousedrag):(this._document.removeEventListener("mousemove",n.mousedrag),n.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(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=Se.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){gj(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=$K(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===Se.ETX||s.key===Se.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)&&(KK(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(Ns));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(Se.ESC+"[I"):this.coreService.triggerDataEvent(Se.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(`${Se.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(`${Se.ESC}[6;${o};${n}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function KK(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var YK=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)}},XK=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 fi)}translateToString(e,t,s){return this._line.translateToString(e,t,s)}},wk=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 XK(t)}getNullCell(){return new fi}},ZK=class extends pt{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Le),this.onBufferChange=this._onBufferChange.event,this._normal=new wk(this._core.buffers.normal,"normal"),this._alternate=new wk(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)}},QK=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)}},JK=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}},eY=["cols","rows"],Ui=0,tY=class extends pt{constructor(e){super(),this._core=this._register(new WK(e)),this._addonManager=this._register(new YK),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(eY.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 QK(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new JK(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 ZK(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 Xx.get()},set promptLabel(e){Xx.set(e)},get tooMuchOutput(){return Zx.get()},set tooMuchOutput(e){Zx.set(e)}}}_verifyIntegers(...e){for(Ui of e)if(Ui===1/0||isNaN(Ui)||Ui%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Ui of e)if(Ui&&(Ui===1/0||isNaN(Ui)||Ui%1!==0||Ui<0))throw new Error("This API only accepts positive integers")}};const Sk={connecting:"bg-amber-500",running:"bg-emerald-500",exited:"bg-muted-foreground/40",error:"bg-red-500"};function r5({sessionId:e,active:t,toolbarExtra:s}){const n=_.useRef(null),o=_.useRef(null),l=_.useRef(null),u=_.useRef(null),[h,f]=_.useState("Local workspace"),[d,p]=_.useState("connecting"),[g,x]=_.useState("Opening shell"),v=Qs(),w=_.useCallback(()=>{const C=l.current;if(!C)return;C.fit();const N=C.proposeDimensions();if(!N)return;if(v){x8(e,N.cols,N.rows);return}const T=u.current;T?.readyState===WebSocket.OPEN&&T.send(JSON.stringify({cols:N.cols,rows:N.rows,type:"resize"}))},[v,e]);_.useEffect(()=>{if(!n.current)return;const C=new tY({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"}}),N=new GV;C.loadAddon(N),C.open(n.current),o.current=C,l.current=N;let T;if(v){let A=null,B=!1;const O=C.onData(I=>{p8(e,I)});v8(e,I=>C.write(I)).then(I=>{if(B){I();return}A=I,p("running"),x("Shell connected"),g8(e),w()},I=>{B||(p("error"),x(I instanceof Error?I.message:String(I)))}),T=()=>{B=!0,O.dispose(),A?.()}}else{const A=new WebSocket(sY(e));u.current=A;const B=C.onData(O=>{A.readyState===WebSocket.OPEN&&A.send(JSON.stringify({data:O,type:"input"}))});A.addEventListener("open",()=>{p("running"),x("Shell connected"),w()}),A.addEventListener("message",O=>{const I=nY(O.data);if(I){if(I.type==="output"){C.write(I.data);return}if(I.type==="error"){p("error"),x(I.error);return}p(I.state==="idle"?"connecting":I.state),I.cwd&&f(I.cwd),x(I.error??I.shell??"Shell connected")}}),A.addEventListener("close",()=>{p(O=>O==="exited"?O:"exited"),x("Socket closed")}),A.addEventListener("error",()=>{p("error"),x("Terminal socket error")}),T=()=>{B.dispose(),A.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(),T(),C.dispose(),o.current=null,l.current=null}},[e,w,v]),_.useEffect(()=>{if(!t)return;const C=window.setTimeout(()=>{w(),o.current?.focus()},0);return()=>window.clearTimeout(C)},[t,w]);const k=_.useCallback(C=>{if(v)return;const N=u.current;if(!N||N.readyState!==WebSocket.OPEN)return;const T=l.current?.proposeDimensions();N.send(JSON.stringify({cols:T?.cols,rows:T?.rows,...C}))},[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",Sk[d])}),r.jsx("span",{className:de("relative inline-flex size-2 rounded-full",Sk[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(Q,{"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(au,{})}),r.jsx(Q,{"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(ro,{})}),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 sY(e){const t=window.location.protocol==="https:"?"wss:":"ws:",s=encodeURIComponent(e);return`${t}//${window.location.host}/api/terminal/socket?id=${s}`}function nY(e){if(typeof e!="string")return null;try{const t=JSON.parse(e);return typeof t?.type=="string"?t:null}catch{return null}}function iY({serviceName:e,active:t}){const[s,n]=_.useState(null),[o,l]=_.useState(null),[u,h]=_.useState(!1),f=_.useRef(!1),d=_.useRef(!0);_.useEffect(()=>(d.current=!0,()=>{d.current=!1}),[]),_.useEffect(()=>{!t||f.current||(f.current=!0,(async()=>{try{const x=await mh({serviceName:e});d.current&&n(x.id)}catch(x){d.current&&(l(x instanceof Error?x.message:String(x)),f.current=!1)}})())},[t,e]);const p=r.jsx(Q,{"aria-label":u?"Exit fullscreen terminal":"Expand terminal",className:"text-white/60 hover:bg-white/10 hover:text-white",onClick:()=>h(x=>!x),size:"icon-sm",title:u?"Exit fullscreen":"Expand",type:"button",variant:"ghost",children:u?r.jsx(JN,{}):r.jsx(ZN,{})}),g=o?r.jsxs("div",{className:"p-3 font-mono text-[11px] text-destructive",children:["Could not open terminal: ",o]}):s?r.jsx(r5,{active:t,sessionId:s,toolbarExtra:p}):r.jsx("div",{className:"p-3 font-mono text-[11px] text-muted-foreground",children:"Opening terminal…"});return u&&t?r.jsx(Ib,{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 rY=500;function aY(e){const[t,s]=_.useState(),[n,o]=_.useState([]),[l,u]=_.useState(),[h,f]=_.useState(!1),d=_.useRef(void 0);_.useEffect(()=>{d.current=void 0,s(void 0),o([]);const g=new EventSource(`/api/services/${encodeURIComponent(e)}/test/stream`),x=v=>{try{const w=JSON.parse(v.data);w.run.id!==d.current&&(d.current=w.run.id,o([])),s(w.run),w.line&&o(k=>[...k,w.line].slice(-rY))}catch{}};return g.addEventListener("status",x),g.addEventListener("output",x),()=>g.close()},[e]);const p=_.useCallback(async g=>{f(!0),u(void 0);try{await bL(e,g)}catch(x){u(x instanceof Error?x.message:String(x))}finally{f(!1)}},[e]);return{run:t,lines:n,error:l,starting:h,start:p}}const oY={running:"secondary",passed:"success",failed:"error",error:"error"},lY={running:"Running",passed:"Passed",failed:"Failed",error:"Error"};function cY({serviceName:e}){const{run:t,lines:s,error:n,starting:o,start:l}=aY(e),[u,h]=_.useState(""),f=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(),f||l(u.trim()||void 0)},children:[r.jsx(ht,{className:"h-7 flex-1 text-[11px]",disabled:f,onChange:p=>h(p.target.value),placeholder:"Optional test pattern (e.g. config-store)",value:u}),r.jsx(Q,{disabled:f,size:"sm",type:"submit",children:f?"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(Xe,{size:"small",variant:oY[t.status],children:lY[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 uY({serviceName:e,status:t,health:s,timeline:n,onRefresh:o}){const[l,u]=al("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(Wa,{active:l==="logs",onClick:()=>u("logs"),children:"Logs"}),r.jsxs(Wa,{active:l==="processes",onClick:()=>u("processes"),children:["Processes ",h.length?r.jsx(Xe,{variant:"secondary",size:"small",children:h.length}):null]}),r.jsx(Wa,{active:l==="metrics",onClick:()=>u("metrics"),children:"Metrics"}),r.jsxs(Wa,{active:l==="http",onClick:()=>u("http"),children:["HTTP",t?.inspector?.enabled?r.jsx(Xe,{variant:"success",size:"small",children:"on"}):null]}),r.jsx(Wa,{active:l==="env",onClick:()=>u("env"),children:"Env"}),r.jsx(Wa,{active:l==="tests",onClick:()=>u("tests"),children:"Tests"}),r.jsx(Wa,{active:l==="terminal",onClick:()=>u("terminal"),children:"Terminal"})]}),l==="processes"?r.jsx(FV,{rows:h,running:t?.state==="running"}):null,l==="metrics"?r.jsx(BV,{serviceName:e}):null,l==="http"?r.jsx(OV,{serviceName:e,status:t,timeline:n,onRefresh:o}):null,l==="env"?r.jsx(DV,{serviceName:e}):null,l==="tests"?r.jsx(cY,{serviceName:e}):null,l==="logs"?r.jsx(SV,{serviceName:e}):null,r.jsx(iY,{active:l==="terminal",serviceName:e},e)]})}function Wa({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 dY={high:"success",medium:"warning",low:"secondary"};function hY({onClose:e,onRefresh:t}){const s=us(),{sendToAgent:n}=Pt(),[o,l]=_.useState("url"),[u,h]=_.useState(""),[f,d]=_.useState(!1),[p,g]=_.useState(null),[x,v]=_.useState(null),[w,k]=_.useState([]),[C,N]=_.useState([]),[T,j]=_.useState(null),A=T?.kind==="docker-compose"?C.find(R=>R.composeService===T.composeService):void 0;async function B(){if(u.trim()){d(!0),g(null);try{const R=await nL(u.trim());v(R.profile),k(R.proposals),N(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 O(){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 I(R){if(T){d(!0),g(null);try{await iL(T,R,A),await t(),s.success(`${T.name} registered${A?" (+ database)":""}${R?" and starting":""}.`),e()}catch(D){g(D instanceof Error?D.message:String(D))}finally{d(!1)}}}return r.jsxs(Xn,{icon:r.jsx(bn,{}),onClose:e,size:"lg",title:"Add from GitHub",children:[o==="url"?r.jsx(fY,{url:u,busy:f,error:p,onChange:h,onScan:B,onRefine:O}):null,o==="review"&&x?r.jsx(mY,{profile:x,proposals:w,selected:T,database:A,error:p,onSelect:j,onEdit:j,onBack:()=>l("url"),onRefine:O,onContinue:()=>l("install")}):null,o==="install"&&T?r.jsx(gY,{proposal:T,busy:f,error:p,onBack:()=>l("review"),onRegister:I}):null]})}function fY({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(ht,{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(Q,{variant:"ghost",size:"sm",onClick:l,disabled:!e.trim(),children:[r.jsx(pi,{className:"size-3.5"}),"Refine with AI"]}),r.jsxs(Q,{onClick:o,disabled:t||!e.trim(),children:[t?r.jsx(Et,{className:"size-4 animate-spin"}):r.jsx(bn,{className:"size-4"}),t?"Cloning…":"Clone & detect"]})]})]})}function mY({profile:e,proposals:t,selected:s,database:n,error:o,onSelect:l,onEdit:u,onBack:h,onRefine:f,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(Xe,{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(Xe,{variant:dY[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(pY,{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(mi,{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(Q,{variant:"ghost",size:"sm",onClick:h,children:[r.jsx(ru,{className:"size-3.5"}),"Back"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(Q,{variant:"outline",size:"sm",onClick:f,children:[r.jsx(pi,{className:"size-3.5"}),"Refine with AI"]}),r.jsx(Q,{onClick:d,disabled:!s,children:"Continue"})]})]})]})}function pY({proposal:e,onChange:t}){return r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsx(Ic,{label:"Service name",children:r.jsx(ht,{value:e.name,onChange:s=>t({...e,name:s.target.value})})}),r.jsx(Ic,{label:"Port (optional)",children:r.jsx(ht,{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(Ic,{label:"Compose service",className:"col-span-2",children:r.jsx(ht,{value:e.composeService??"",onChange:s=>t({...e,composeService:s.target.value})})}):r.jsx(Ic,{label:"Run command",className:"col-span-2",children:r.jsx(ht,{value:e.command??"",onChange:s=>t({...e,command:s.target.value})})})]})}function gY({proposal:e,busy:t,error:s,onBack:n,onRegister:o}){const[l,u]=_.useState(e.installCommand??""),[h,f]=_.useState([]),[d,p]=_.useState(!1),[g,x]=_.useState(!1),v=_.useRef(null);function w(C){f(N=>[...N,C]),queueMicrotask(()=>{const N=v.current;N&&(N.scrollTop=N.scrollHeight)})}async function k(){l.trim()&&(p(!0),x(!1),f([]),await rL({clonePath:e.cwd,command:l.trim()},{onLine:C=>w(C.text),onDone:C=>{w(C===0?"✓ install complete":`✗ install exited ${C}`),p(!1),x(C===0)},onError:C=>{w(`✗ ${C}`),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(Ic,{label:"Install command (optional)",className:"flex-1",children:r.jsx(ht,{value:l,placeholder:"e.g. npm install",onChange:C=>u(C.target.value)})}),r.jsxs(Q,{variant:"outline",onClick:k,disabled:d||!l.trim(),children:[d?r.jsx(Et,{className:"size-4 animate-spin"}):r.jsx(cl,{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(Q,{variant:"ghost",size:"sm",onClick:n,children:[r.jsx(ru,{className:"size-3.5"}),"Back"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Q,{variant:"outline",onClick:()=>o(!1),disabled:t,children:"Register only"}),r.jsxs(Q,{onClick:()=>o(!0),disabled:t,children:[t?r.jsx(Et,{className:"size-4 animate-spin"}):r.jsx(er,{className:"size-4"}),g||!l.trim()?"Register & start":"Skip install & start"]})]})]})]})}function Ic({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 xY({data:e,onRefresh:t,focusService:s,onServiceFocused:n}){const o=e.config.services[0]?.name??"",[l,u]=_.useState(o),[h,f]=_.useState(null),[d,p]=_.useState(!1),{sendToAgent:g,startOnboard:x}=Pt(),[v,w]=_.useState(!1),[k,C]=_.useState(!1),[N,T]=_.useState(!1),[j,A]=_.useState(!1),[B,O]=_.useState(!1),I=_.useRef({}),{error:R,message:D,success:P}=us(),G=_.useMemo(()=>new Set(e.config.bundles.flatMap(oe=>oe.services)),[e.config.bundles]),Z=_.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]),$=_.useMemo(()=>e.config.services.filter(oe=>!G.has(oe.name)),[e.config.services,G]),q=_.useMemo(()=>e.config.services.map(oe=>oe.name),[e.config.services]),F=_.useMemo(()=>e.config.services.some(oe=>(oe.dependsOn?.length??0)>0),[e.config.services]),L=e.health??{},X=e.config.bundles.length>0||$.length>0;_.useEffect(()=>{!e.config.services.some(je=>je.name===l)&&o&&u(o)},[e.config.services,o,l]),_.useEffect(()=>{s&&e.config.services.some(oe=>oe.name===s)&&(u(s),n?.())},[s,e.config.services,n]);const U=_.useMemo(()=>e.config.services.find(oe=>oe.name===l),[e.config.services,l]),K=l?e.runtime.services[l]:void 0,Y=l?L[l]:void 0;async function V(oe,je){if(!oe.services.includes(je))try{await vL(oe.name,oe.services,je),P(`Added ${je} to ${oe.name}.`),await t()}catch(Ne){R(Ne instanceof Error?Ne.message:String(Ne))}}async function ie(){if(U){if(Vc(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 uL(U.name),P(`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 yL(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))}}_.useEffect(()=>{const oe=Object.fromEntries(e.config.services.map(Ne=>[Ne.name,e.runtime.services[Ne.name]?.state??"stopped"])),je=I.current;if(Object.keys(je).length){const Ne=new Map,Ge=new Map;for(const De of e.config.services){const et=oe[De.name],ke=je[De.name];if(!ke||ke===et)continue;const He=e.runtime.services[De.name],$e=Z.get(De.name);if($e){const wt=Ne.get($e)??new Map;if(wt.set(et,(wt.get(et)??0)+1),Ne.set($e,wt),et==="exited"){const Us=Ge.get($e)??[];Us.push(He?.exitCode),Ge.set($e,Us)}continue}if(et==="running")P(`${De.name} is running.`);else if(et==="stopped")D({text:`${De.name} stopped.`});else if(et==="starting")D({text:`${De.name} is starting.`});else if(et==="exited"){const wt=He?.exitCode===void 0||He.exitCode===null?"":` with code ${He.exitCode}`;R(`${De.name} exited${wt}.`)}}for(const[De,et]of Ne)vY({exitCodes:Ge.get(De)??[],groupName:De,showErrorToast:R,showMessageToast:D,showSuccessToast:P,transitions:et})}I.current=oe},[e.config.services,e.runtime.services,Z,R,D,P]);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",N?"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(xi,{className:"min-w-0 rounded-none border-0 border-b border-border bg-transparent",children:[r.jsx(bi,{className:"border-b border-border px-3 py-2",children:r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx(vi,{className:"text-sm",children:"Services"}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsxs(Q,{"aria-haspopup":"dialog",className:"h-7 gap-1.5 px-2 text-xs",onClick:()=>C(!0),size:"sm",type:"button",variant:"outline",children:[r.jsx(Gy,{className:"size-3.5"}),"Graph"]}),r.jsxs(Q,{"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(nC,{className:"size-3.5"}),"Logs"]}),r.jsx(bY,{onCreateGroup:()=>f("group"),onCreateService:()=>f("service"),onOnboardRepo:()=>p(!0),onOnboardWithAi:x,canGroupWithAi:$.length>1,onCreateWithAi:()=>g({prompt:HS,source:{type:"service-setup",label:"Add a service"},label:"Help me add a new service, one step at a time."}),onGroupWithAi:()=>g({prompt:I$($),source:{type:"group-services",label:"Group services"},label:"Propose how to group my ungrouped services."})})]})]})}),r.jsx(_i,{className:"p-0",children:X?r.jsxs("div",{className:"divide-y divide-border",children:[e.config.bundles.map(oe=>r.jsx(gU,{group:oe,onRefresh:t,ports:e.ports,allServices:e.config.services,health:L,services:e.config.services.filter(je=>oe.services.includes(je.name)),statuses:e.runtime.services,timeline:e.timeline,selectedService:l,onSelectService:u,onDropService:je=>{V(oe,je)}},oe.name)),$.length?r.jsxs("div",{className:de("transition-colors",B&&"bg-primary/5 outline-dashed outline-2 -outline-offset-2 outline-primary/60"),onDragOver:oe=>{oe.dataTransfer.types.includes(tu)&&(oe.preventDefault(),oe.dataTransfer.dropEffect="move",O(!0))},onDragLeave:()=>O(!1),onDrop:oe=>{oe.preventDefault(),O(!1);const je=oe.dataTransfer.getData(tu);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(W3,{service:oe,status:e.runtime.services[oe.name],health:L[oe.name],ports:e.ports,onRefresh:t,timeline:e.timeline,selected:l===oe.name,onSelect:()=>u(oe.name)},oe.name))})]}):null]}):r.jsx(Zh,{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(K3,{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?bU(U.port):void 0);return oe?r.jsx(rl,{label:`Open ${oe}`,children:r.jsx(Q,{"aria-label":"Open in browser",className:"size-7",onClick:()=>{gf(oe)},size:"icon",type:"button",variant:"outline",children:r.jsx(Ar,{})})}):null})(),Y?.agentContext&&U?r.jsx(rl,{label:"Debug this service with AI",children:r.jsx(Q,{"aria-label":"Debug this service with AI",className:"size-7",onClick:()=>g({prompt:q$({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(jb,{active:Vc(K?.state),baseUrl:`/api/services/${encodeURIComponent(U.name)}`,compact:!0,resourceKind:"service",resourceName:U.name,targetLabel:U.name,onRefresh:t}),r.jsx(mu,{className:"size-7 border border-border bg-background opacity-100 hover:border-foreground/30",items:[{icon:r.jsx(ul,{className:"size-3.5"}),label:"Edit service",onSelect:()=>A(!0)},...Vc(K?.state)?[]:[{icon:r.jsx(gi,{className:"size-3.5 text-destructive"}),label:"Delete service",onSelect:()=>{ie()}}]],label:`More actions for ${U.name}`}),r.jsx(rl,{label:N?"Show Ports & Timeline":"Hide Ports & Timeline",side:"left",children:r.jsx(Q,{"aria-label":N?"Show Ports & Timeline":"Hide Ports & Timeline",className:"size-7",onClick:()=>T(oe=>!oe),size:"icon",type:"button",variant:"ghost",children:N?r.jsx(L4,{}):r.jsx(Zn,{})})})]})]}),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(oV,{health:Y})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:r.jsx(uY,{serviceName:U.name,status:K,health:Y,timeline:e.timeline??[],onRefresh:t},U.name)})]}):r.jsx(Zh,{label:"Select a service to see details."})}),N?null:r.jsxs("div",{className:"min-h-0 overflow-auto border-l border-border",children:[r.jsx(hV,{ports:e.ports}),r.jsx(Wq,{events:e.timeline??[]})]})]}):r.jsx(aV,{onOnboardRepo:()=>p(!0),onOnboardWithAi:x,onCreateService:()=>f("service"),onCreateWithAi:()=>g({prompt:HS,source:{type:"service-setup",label:"Add a service"},label:"Help me add a new service, one step at a time."})}),j&&U?r.jsx(Xn,{icon:r.jsx(ul,{}),onClose:()=>A(!1),size:"lg",title:`Edit Service — ${U.name}`,children:r.jsx(n2,{cwd:e.cwd,initialService:U,availableServices:q,onRefresh:t,onSaved:()=>A(!1)})}):null,h?r.jsx(Xn,{icon:h==="service"?r.jsx(bs,{}):r.jsx(ON,{}),onClose:()=>f(null),size:h==="service"?"lg":"md",title:h==="service"?"Add Service":"Create Group",children:h==="service"?r.jsx(n2,{cwd:e.cwd,availableServices:q,onRefresh:t,onSaved:()=>f(null)}):r.jsx(G3,{services:$,onRefresh:t,onSaved:()=>f(null)})}):null,d?r.jsx(hY,{onClose:()=>p(!1),onRefresh:t}):null,v?r.jsx(CV,{initialService:l||void 0,onClose:()=>w(!1),services:e.config.services.map(oe=>oe.name)}):null,k?r.jsx(Xn,{icon:r.jsx(Gy,{}),onClose:()=>C(!1),size:"lg",title:"Service Dependency Graph",children:r.jsx(sV,{statuses:e.runtime.services,health:L,hasDependencies:F,onSelectService:oe=>{u(oe),C(!1)}})}):null]})}function bY({onCreateService:e,onCreateGroup:t,onCreateWithAi:s,onGroupWithAi:n,canGroupWithAi:o,onOnboardRepo:l,onOnboardWithAi:u}){const[h,f]=_.useState(!1);function d(p){f(!1),p()}return r.jsxs("div",{className:"relative",children:[r.jsx(rl,{label:"Add",side:"bottom",children:r.jsx(Q,{"aria-expanded":h,"aria-haspopup":"menu","aria-label":"Add service or group",className:"size-7",onClick:()=>f(p=>!p),size:"icon",type:"button",variant:"ghost",children:r.jsx(bs,{})})}),h?r.jsxs(r.Fragment,{children:[r.jsx("button",{"aria-hidden":!0,className:"fixed inset-0 z-[40] cursor-default",onClick:()=>f(!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(bs,{}),"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(ON,{}),"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(bn,{}),"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 vY({exitCodes:e,groupName:t,showErrorToast:s,showMessageToast:n,showSuccessToast:o,transitions:l}){if(l.size===1){const[f]=l.keys();if(f==="running")o(`${t} group is running.`);else if(f==="stopped")n({text:`${t} group stopped.`});else if(f==="starting")n({text:`${t} group is starting.`});else if(f==="exited"){const d=e.filter(g=>g!=null),p=d.length?` with code ${d.join(", ")}`:"";s(`${t} group exited${p}.`)}return}const u=[...l.entries()].map(([f,d])=>`${d} ${f}`).join(", "),h=`${t} group updated: ${u}.`;l.has("exited")?s(h):n({text:h})}function _Y({data:e,onOpenService:t}){const s=_.useMemo(()=>yY(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(to,{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",SY(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 yY(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:wY(s,e.health[s.name]),port:t.get(s.name)??kY(s.url),uptime:s.state==="running"?NY(s.startedAt):"starting…",url:s.url})).sort((s,n)=>s.name.localeCompare(n.name))}function wY(e,t){return e.state==="starting"?"starting":t?.status==="healthy"?"healthy":t?.status==="warning"?"warning":t?.status==="unhealthy"?"unhealthy":"healthy"}function SY(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 kY(e){if(e)try{const t=new URL(e).port;return t?Number(t):void 0}catch{return}}function NY(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 CY(){const[e,t]=_.useState([]),[s,n]=_.useState(null),[o,l]=_.useState(!1);_.useEffect(()=>{let f=!1;return(async()=>{let d=await PL().catch(()=>[]);if(d.length===0){const p=await mh().catch(()=>null);d=p?[p]:[]}f||(t(d),n(d[0]?.id??null))})(),()=>{f=!0}},[]);const u=_.useCallback(async()=>{l(!0);try{const f=await mh();t(d=>[...d,f]),n(f.id)}finally{l(!1)}},[]),h=_.useCallback(async f=>{l(!0);try{await IL(f);const d=e.findIndex(g=>g.id===f),p=e.filter(g=>g.id!==f);if(p.length===0){const g=await mh();t([g]),n(g.id);return}if(t(p),s===f){const g=p[Math.min(d,p.length-1)];n(g.id)}}finally{l(!1)}},[e,s]);return 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((f,d)=>{const p=f.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",f.id===s?"border-white/15 bg-white/10 text-white":"text-white/60 hover:bg-white/5"),children:[r.jsx("button",{"aria-selected":f.id===s,className:"max-w-[160px] truncate font-medium",onClick:()=>n(f.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(f.id)},type:"button",children:r.jsx(Kt,{className:"size-3"})})]},f.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(bs,{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(f=>r.jsx("div",{className:"absolute inset-0",children:r.jsx(r5,{active:f.id===s,sessionId:f.id})},f.id))})]})}function a5({branch:e}){return r.jsx("span",{className:"min-w-0 max-w-40",title:e,children:r.jsx(Xe,{className:"w-full max-w-full shadow-none",variant:"outline",children:e})})}function o5({branch:e,error:t,files:s,selectedFile:n,onSelectFile:o,root:l,staging:u}){const h=_.useMemo(()=>TY(s).filter(p=>p.files.length),[s]),[f,d]=_.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(bn,{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(a5,{branch:e}):null,r.jsx(Xe,{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(EY,{collapsed:f[p.id],group:p,onSelectFile:o,onToggle:()=>d(g=>({...g,[p.id]:!g[p.id]})),root:l,selectedFile:n,staging:u},p.id)):r.jsx(Ze,{variant:"muted",className:"m-3 text-center",children:t??"No changed files."})})]})}function EY({collapsed:e,group:t,onSelectFile:s,onToggle:n,root:o,selectedFile:l,staging:u}){const h=e?Zn:vn,f=t.files.map(p=>p.path),d=u?t.id==="staged"?{label:"Unstage all",run:()=>u.onUnstage(f)}:{label:"Stage all",run:()=>u.onStage(f)}:null;return 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(Xe,{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(jY,{active:l===p.path,file:p,group:t.id,onClick:()=>s(p.path),root:o,staging:u},p.path))})]})}function jY({active:e,file:t,group:s,onClick:n,root:o,staging:l}){const u=t.path.split("/").pop()||t.path,h=t.path.split("/").slice(0,-1).join("/"),f=o?V3(pu(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",...f,children:[r.jsx(Ab,{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(eC,{className:"size-3.5"}):r.jsx(bs,{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:AY(t,s)})]})}function AY(e,t){return t==="untracked"?"?":t==="staged"?e.index.trim():e.workingTree.trim()}function TY(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 l5({branch:e,files:t,onDone:s,repo:n}){const{sendToAgent:o}=Pt(),[l,u]=_.useState(""),[h,f]=_.useState(null),[d,p]=_.useState(null),[g,x]=_.useState(null),v=_.useMemo(()=>t.filter(N=>N.index.trim()&&N.index!=="?").map(N=>N.path),[t]),w=v.length>0&&l.trim().length>0&&h===null;async function k(N,T){f(N),p(null),x(null);try{if(await SC(l.trim(),n),T){const j=await xf(n);x(`Committed and pushed ${j.branch}.`)}else x("Committed staged changes.");u(""),s()}catch(j){p(j instanceof Error?j.message:String(j))}finally{f(null)}}function C(){o({prompt:L$({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:C,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:N=>{u(N.target.value),p(null),x(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(Q,{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(ln,{className:"size-3.5"}),"Commit"]}),r.jsxs(Q,{disabled:!w,onClick:()=>{k("push",!0)},size:"sm",type:"button",children:[h==="push"?r.jsx(Et,{className:"size-3.5 animate-spin"}):r.jsx(mf,{className:"size-3.5"}),"Commit & push"]})]}),d?r.jsx(Ze,{className:"px-2.5 py-1.5 text-[11px]",variant:"destructive",children:d}):g?r.jsx(Ze,{className:"px-2.5 py-1.5 text-[11px]",variant:"muted",children:g}):null]})}function RY(e){const t={name:"",path:"",children:[],isFile:!1},s=new Map;s.set("",t);const n=[...e].sort();for(const l of n){const u=l.split("/");let h="";for(let f=0;f<u.length;f+=1){const d=u[f],p=f===u.length-1,g=h?`${h}/${d}`:d;let x=s.get(g);x||(x={name:d,path:g,children:[],isFile:p},s.set(g,x),s.get(h)?.children.push(x)),h=g}}const o=l=>{l.children.sort((u,h)=>u.isFile!==h.isFile?u.isFile?1:-1:u.name.localeCompare(h.name)),l.children.forEach(o)};return o(t),t}function kk(e,t){const s={"":!0},n=o=>{for(const l of o.children)l.isFile||(s[l.path]=!0,t&&n(l))};return n(e),s}function Nk({defaultExpandAll:e=!1,paths:t,status:s,selectedFile:n,onSelectFile:o,branch:l,emptyMessage:u="No tracked files.",root:h,title:f="Files"}){const d=_.useMemo(()=>RY(t),[t]),p=_.useMemo(()=>kk(d,e),[e,d]),g=_.useMemo(()=>kk(d,!0),[d]),x=Math.max(0,Object.keys(g).length-1),v=_.useMemo(()=>{const B=new Map;for(const O of s)B.set(O.path,O);return B},[s]),[w,k]=_.useState(p),[C,N]=_.useState(!1);_.useEffect(()=>{C||d.children.length===0||(k(p),N(!0))},[p,C,d.children.length]);function T(B){k(O=>({...O,[B]:!O[B]}))}function j(){k(g)}function A(){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(va,{className:"size-3.5"}),r.jsx("span",{className:"truncate",children:f})]}),r.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[x>0?r.jsxs("span",{className:"flex items-center gap-0.5",children:[r.jsx("button",{"aria-label":"Expand all folders",className:"flex size-6 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:j,title:"Expand all folders",type:"button",children:r.jsx(tM,{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:A,title:"Collapse all folders",type:"button",children:r.jsx(JR,{className:"size-3.5"})})]}):null,l?r.jsx(a5,{branch:l}):null,r.jsx(Xe,{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(Ze,{variant:"muted",className:"m-3 text-center",children:u}):d.children.map(B=>r.jsx(c5,{depth:0,expanded:w,node:B,onSelectFile:o,onToggle:T,root:h,selectedFile:n,statusByPath:v},B.path))})]})}function c5({depth:e,expanded:t,node:s,onSelectFile:n,onToggle:o,root:l,selectedFile:u,statusByPath:h}){const f=t[s.path]??!1,d=6+e*12,p=l?V3(pu(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(Ab,{path:s.path}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:s.name}),v?r.jsx(MY,{file:v}):null]})}const g=f?vn:Zn,x=f?ff:va;return r.jsxs("div",{children:[r.jsxs("button",{className:"flex w-full items-center gap-1 py-0.5 text-left text-[12px] font-medium hover:bg-muted",onClick:()=>o(s.path),style:{paddingLeft:d},type:"button",...p,children:[r.jsx(g,{className:"size-3.5 shrink-0 text-muted-foreground"}),r.jsx(x,{className:"size-3.5 shrink-0 text-amber-600"}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:s.name})]}),f?s.children.map(v=>r.jsx(c5,{depth:e+1,expanded:t,node:v,onSelectFile:n,onToggle:o,root:l,selectedFile:u,statusByPath:h},v.path)):null]})}function MY({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 Mg,Ck;function DY(){if(Ck)return Mg;Ck=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 f=(H={})=>{const ee={children:[]};return Object.assign(ee,H),ee};class d{constructor(){this.rootNode=f(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(ee){this.top.children.push(ee)}openNode(ee){const fe=f({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 x(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 C(H){const ee=H[H.length-1];return typeof ee=="object"&&ee.constructor===Object?(H.splice(H.length-1,1),ee):{}}function N(...H){return"("+(C(H).capture?"":"?:")+H.map(Be=>g(Be)).join("|")+")"}function T(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 A=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function B(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=A.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 O=/\b\B/,I="[a-zA-Z]\\w*",R="[a-zA-Z_]\\w*",D="\\b\\d+(\\.\\d+)?",P="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",G="\\b(0b[01]+)",Z="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",$=(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)},q={begin:"\\\\[\\s\\S]",relevance:0},F={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[q]},L={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[q]},X={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=N("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("/\\*","\\*/"),V=U("#","$"),ie={scope:"number",begin:D,relevance:0},Ee={scope:"number",begin:P,relevance:0},ye={scope:"number",begin:G,relevance:0},oe={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[q,{begin:/\[/,end:/\]/,relevance:0,contains:[q]}]},je={scope:"title",begin:I,relevance:0},Ne={scope:"title",begin:R,relevance:0},Ge={begin:"\\.\\s*"+R,relevance:0};var et=Object.freeze({__proto__:null,APOS_STRING_MODE:F,BACKSLASH_ESCAPE:q,BINARY_NUMBER_MODE:ye,BINARY_NUMBER_RE:G,COMMENT:U,C_BLOCK_COMMENT_MODE:Y,C_LINE_COMMENT_MODE:K,C_NUMBER_MODE:Ee,C_NUMBER_RE:P,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:V,IDENT_RE:I,MATCH_NOTHING_RE:O,METHOD_GUARD:Ge,NUMBER_MODE:ie,NUMBER_RE:D,PHRASAL_WORDS_MODE:X,QUOTE_STRING_MODE:L,REGEXP_MODE:oe,RE_STARTERS_RE:Z,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 wt(H,ee){Array.isArray(H.illegal)&&(H.illegal=N(...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 Ln=(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,x(fe.begin)),H.starts={relevance:0,contains:[Object.assign(fe,{endsParent:!0})]},H.relevance=0,delete fe.beforeMatch},Sn=["of","and","for","in","not","or","if","then","parent","list","value"],As="keyword";function cn(H,ee,fe=As){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):Ie(H)?0:1}function Ie(H){return Sn.includes(H.toLowerCase())}const Ct={},St=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)},Js=new Error;function en(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+=T(ee[Ue-1]);H[fe]=qe,H[fe]._emit=Mt,H[fe]._multi=!0}function Di(H){if(Array.isArray(H.begin)){if(H.skip||H.excludeBegin||H.returnBegin)throw St("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Js;if(typeof H.beginScope!="object"||H.beginScope===null)throw St("beginScope must be object"),Js;en(H,H.begin,{key:"beginScope"}),H.begin=B(H.begin,{joinWith:""})}}function S(H){if(Array.isArray(H.end)){if(H.skip||H.excludeEnd||H.returnEnd)throw St("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Js;if(typeof H.endScope!="object"||H.endScope===null)throw St("endScope must be object"),Js;en(H,H.end,{key:"endScope"}),H.end=B(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}),Di(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+=T(Ue)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const Ue=this.regexes.map(at=>at[1]);this.matcherRe=ee(B(Ue,{joinWith:"|"}),!0),this.lastIndex=0}exec(Ue){this.matcherRe.lastIndex=this.lastIndex;const at=this.matcherRe.exec(Ue);if(!at)return null;const hs=at.findIndex((sr,mo)=>mo>0&&sr!==void 0),es=this.matchIndexes[hs];return at.splice(0,hs),Object.assign(at,es)}}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(([hs,es])=>at.addRule(hs,es)),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 hs=at.exec(Ue);if(this.resumingScanAtSamePosition()&&!(hs&&hs.index===this.lastIndex)){const es=this.getMatcher(0);es.lastIndex=this.lastIndex+1,hs=es.exec(Ue)}return hs&&(this.regexIndex+=hs.position+1,this.regexIndex===this.count&&this.considerAll()),hs}}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,Ln].forEach(es=>es(qe,Ue)),H.compilerExtensions.forEach(es=>es(qe,Ue)),qe.__beforeBegin=null,[$e,wt,Fs].forEach(es=>es(qe,Ue)),qe.isCompiled=!0;let hs=null;return typeof qe.keywords=="object"&&qe.keywords.$pattern&&(qe.keywords=Object.assign({},qe.keywords),hs=qe.keywords.$pattern,delete qe.keywords.$pattern),hs=hs||/\w+/,qe.keywords&&(qe.keywords=cn(qe.keywords,H.case_insensitive)),at.keywordPatternRe=ee(hs,!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(es){return Ae(es==="self"?qe:es)})),qe.contains.forEach(function(es){Mt(es,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 Ae(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 Te=s,xe=n,ue=Symbol("nomatch"),Ce=7,_e=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(Me){return Ue.noHighlightRe.test(Me)}function hs(Me){let tt=Me.className+" ";tt+=Me.parentNode?Me.parentNode.className:"";const gt=Ue.languageDetectRe.exec(tt);if(gt){const Ot=dn(gt[1]);return Ot||(Rt(Mt.replace("{}",gt[1])),Rt("Falling back to no-highlight mode for this block.",Me)),Ot?gt[1]:"no-highlight"}return tt.split(/\s+/).find(Ot=>at(Ot)||dn(Ot))}function es(Me,tt,gt){let Ot="",ms="";typeof tt=="object"?(Ot=Me,gt=tt.ignoreIllegals,ms=tt.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`),ms=Me,Ot=tt),gt===void 0&&(gt=!0);const sn={code:Ot,language:ms};Ca("before:highlight",sn);const zn=sn.result?sn.result:sr(sn.language,sn.code,gt);return zn.code=sn.code,Ca("after:highlight",zn),zn}function sr(Me,tt,gt,Ot){const ms=Object.create(null);function sn(Pe,Qe){return Pe.keywords[Qe]}function zn(){if(!it.keywords){_s.addText(Lt);return}let Pe=0;it.keywordPatternRe.lastIndex=0;let Qe=it.keywordPatternRe.exec(Lt),ct="";for(;Qe;){ct+=Lt.substring(Pe,Qe.index);const vt=qs.case_insensitive?Qe[0].toLowerCase():Qe[0],ns=sn(it,vt);if(ns){const[Qn,jl]=ns;if(_s.addText(ct),ct="",ms[vt]=(ms[vt]||0)+1,ms[vt]<=Ce&&(Br+=jl),Qn.startsWith("_"))ct+=Qe[0];else{const Au=qs.classNameAliases[Qn]||Qn;Bn(Qe[0],Au)}}else ct+=Qe[0];Pe=it.keywordPatternRe.lastIndex,Qe=it.keywordPatternRe.exec(Lt)}ct+=Lt.substring(Pe),_s.addText(ct)}function kn(){if(Lt==="")return;let Pe=null;if(typeof it.subLanguage=="string"){if(!ee[it.subLanguage]){_s.addText(Lt);return}Pe=sr(it.subLanguage,Lt,!0,ju[it.subLanguage]),ju[it.subLanguage]=Pe._top}else Pe=po(Lt,it.subLanguage.length?it.subLanguage:null);it.relevance>0&&(Br+=Pe.relevance),_s.__addSublanguage(Pe._emitter,Pe.language)}function Wt(){it.subLanguage!=null?kn():zn(),Lt=""}function Bn(Pe,Qe){Pe!==""&&(_s.startScope(Qe),_s.addText(Pe),_s.endScope())}function Cu(Pe,Qe){let ct=1;const vt=Qe.length-1;for(;ct<=vt;){if(!Pe._emit[ct]){ct++;continue}const ns=qs.classNameAliases[Pe[ct]]||Pe[ct],Qn=Qe[ct];ns?Bn(Qn,ns):(Lt=Qn,zn(),Lt=""),ct++}}function xo(Pe,Qe){return Pe.scope&&typeof Pe.scope=="string"&&_s.openNode(qs.classNameAliases[Pe.scope]||Pe.scope),Pe.beginScope&&(Pe.beginScope._wrap?(Bn(Lt,qs.classNameAliases[Pe.beginScope._wrap]||Pe.beginScope._wrap),Lt=""):Pe.beginScope._multi&&(Cu(Pe.beginScope,Qe),Lt="")),it=Object.create(Pe,{parent:{value:it}}),it}function Nl(Pe,Qe,ct){let vt=j(Pe.endRe,ct);if(vt){if(Pe["on:end"]){const ns=new t(Pe);Pe["on:end"](Qe,ns),ns.isMatchIgnored&&(vt=!1)}if(vt){for(;Pe.endsParent&&Pe.parent;)Pe=Pe.parent;return Pe}}if(Pe.endsWithParent)return Nl(Pe.parent,Qe,ct)}function bo(Pe){return it.matcher.regexIndex===0?(Lt+=Pe[0],1):(Pr=!0,0)}function Df(Pe){const Qe=Pe[0],ct=Pe.rule,vt=new t(ct),ns=[ct.__beforeBegin,ct["on:begin"]];for(const Qn of ns)if(Qn&&(Qn(Pe,vt),vt.isMatchIgnored))return bo(Qe);return ct.skip?Lt+=Qe:(ct.excludeBegin&&(Lt+=Qe),Wt(),!ct.returnBegin&&!ct.excludeBegin&&(Lt=Qe)),xo(ct,Pe),ct.returnBegin?0:Qe.length}function Nn(Pe){const Qe=Pe[0],ct=tt.substring(Pe.index),vt=Nl(it,Pe,ct);if(!vt)return ue;const ns=it;it.endScope&&it.endScope._wrap?(Wt(),Bn(Qe,it.endScope._wrap)):it.endScope&&it.endScope._multi?(Wt(),Cu(it.endScope,Pe)):ns.skip?Lt+=Qe:(ns.returnEnd||ns.excludeEnd||(Lt+=Qe),Wt(),ns.excludeEnd&&(Lt=Qe));do it.scope&&_s.closeNode(),!it.skip&&!it.subLanguage&&(Br+=it.relevance),it=it.parent;while(it!==vt.parent);return vt.starts&&xo(vt.starts,Pe),ns.returnEnd?0:Qe.length}function Cl(){const Pe=[];for(let Qe=it;Qe!==qs;Qe=Qe.parent)Qe.scope&&Pe.unshift(Qe.scope);Pe.forEach(Qe=>_s.openNode(Qe))}let Ea={};function vo(Pe,Qe){const ct=Qe&&Qe[0];if(Lt+=Pe,ct==null)return Wt(),0;if(Ea.type==="begin"&&Qe.type==="end"&&Ea.index===Qe.index&&ct===""){if(Lt+=tt.slice(Qe.index,Qe.index+1),!rt){const vt=new Error(`0 width match regex (${Me})`);throw vt.languageName=Me,vt.badRule=Ea.rule,vt}return 1}if(Ea=Qe,Qe.type==="begin")return Df(Qe);if(Qe.type==="illegal"&&!gt){const vt=new Error('Illegal lexeme "'+ct+'" for mode "'+(it.scope||"<unnamed>")+'"');throw vt.mode=it,vt}else if(Qe.type==="end"){const vt=Nn(Qe);if(vt!==ue)return vt}if(Qe.type==="illegal"&&ct==="")return Lt+=`
|
|
181
|
-
`,1;if(El>1e5&&El>Qe.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Lt+=ct,ct.length}const qs=dn(Me);if(!qs)throw St(Mt.replace("{}",Me)),new Error('Unknown language: "'+Me+'"');const Eu=be(qs);let _o="",it=Ot||Eu;const ju={},_s=new Ue.__emitter(Ue);Cl();let Lt="",Br=0,rr=0,El=0,Pr=!1;try{if(qs.__emitTokens)qs.__emitTokens(tt,_s);else{for(it.matcher.considerAll();;){El++,Pr?Pr=!1:it.matcher.considerAll(),it.matcher.lastIndex=rr;const Pe=it.matcher.exec(tt);if(!Pe)break;const Qe=tt.substring(rr,Pe.index),ct=vo(Qe,Pe);rr=Pe.index+ct}vo(tt.substring(rr))}return _s.finalize(),_o=_s.toHTML(),{language:Me,value:_o,relevance:Br,illegal:!1,_emitter:_s,_top:it}}catch(Pe){if(Pe.message&&Pe.message.includes("Illegal"))return{language:Me,value:Te(tt),illegal:!0,relevance:0,_illegalBy:{message:Pe.message,index:rr,context:tt.slice(rr-100,rr+100),mode:Pe.mode,resultSoFar:_o},_emitter:_s};if(rt)return{language:Me,value:Te(tt),illegal:!1,relevance:0,errorRaised:Pe,_emitter:_s,_top:it};throw Pe}}function mo(Me){const tt={value:Te(Me),illegal:!1,relevance:0,_top:qe,_emitter:new Ue.__emitter(Ue)};return tt._emitter.addText(Me),tt}function po(Me,tt){tt=tt||Ue.languages||Object.keys(ee);const gt=mo(Me),Ot=tt.filter(dn).filter(Lr).map(Wt=>sr(Wt,Me,!1));Ot.unshift(gt);const ms=Ot.sort((Wt,Bn)=>{if(Wt.relevance!==Bn.relevance)return Bn.relevance-Wt.relevance;if(Wt.language&&Bn.language){if(dn(Wt.language).supersetOf===Bn.language)return 1;if(dn(Bn.language).supersetOf===Wt.language)return-1}return 0}),[sn,zn]=ms,kn=sn;return kn.secondBest=zn,kn}function Oi(Me,tt,gt){const Ot=tt&&fe[tt]||gt;Me.classList.add("hljs"),Me.classList.add(`language-${Ot}`)}function fs(Me){let tt=null;const gt=hs(Me);if(at(gt))return;if(Ca("before:highlightElement",{el:Me,language:gt}),Me.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",Me);return}if(Me.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(Me)),Ue.throwUnescapedHTML))throw new ne("One of your code blocks includes unescaped HTML.",Me.innerHTML);tt=Me;const Ot=tt.textContent,ms=gt?es(Ot,{language:gt,ignoreIllegals:!0}):po(Ot);Me.innerHTML=ms.value,Me.dataset.highlighted="yes",Oi(Me,gt,ms.language),Me.result={language:ms.language,re:ms.relevance,relevance:ms.relevance},ms.secondBest&&(Me.secondBest={language:ms.secondBest.language,relevance:ms.secondBest.relevance}),Ca("after:highlightElement",{el:Me,result:ms,text:Ot})}function tn(Me){Ue=xe(Ue,Me)}const Or=()=>{go(),Ft("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Sl(){go(),Ft("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Su=!1;function go(){function Me(){go()}if(document.readyState==="loading"){Su||window.addEventListener("DOMContentLoaded",Me,!1),Su=!0;return}document.querySelectorAll(Ue.cssSelector).forEach(fs)}function ku(Me,tt){let gt=null;try{gt=tt(H)}catch(Ot){if(St("Language definition for '{}' could not be registered.".replace("{}",Me)),rt)St(Ot);else throw Ot;gt=qe}gt.name||(gt.name=Me),ee[Me]=gt,gt.rawDefinition=tt.bind(null,H),gt.aliases&&nr(gt.aliases,{languageName:Me})}function Na(Me){delete ee[Me];for(const tt of Object.keys(fe))fe[tt]===Me&&delete fe[tt]}function kl(){return Object.keys(ee)}function dn(Me){return Me=(Me||"").toLowerCase(),ee[Me]||ee[fe[Me]]}function nr(Me,{languageName:tt}){typeof Me=="string"&&(Me=[Me]),Me.forEach(gt=>{fe[gt.toLowerCase()]=tt})}function Lr(Me){const tt=dn(Me);return tt&&!tt.disableAutodetect}function zr(Me){Me["before:highlightBlock"]&&!Me["before:highlightElement"]&&(Me["before:highlightElement"]=tt=>{Me["before:highlightBlock"](Object.assign({block:tt.el},tt))}),Me["after:highlightBlock"]&&!Me["after:highlightElement"]&&(Me["after:highlightElement"]=tt=>{Me["after:highlightBlock"](Object.assign({block:tt.el},tt))})}function vs(Me){zr(Me),Be.push(Me)}function Nu(Me){const tt=Be.indexOf(Me);tt!==-1&&Be.splice(tt,1)}function Ca(Me,tt){const gt=Me;Be.forEach(function(Ot){Ot[gt]&&Ot[gt](tt)})}function ir(Me){return Ft("10.7.0","highlightBlock will be removed entirely in v12.0"),Ft("10.7.0","Please use highlightElement now."),fs(Me)}Object.assign(H,{highlight:es,highlightAuto:po,highlightAll:go,highlightElement:fs,highlightBlock:ir,configure:tn,initHighlighting:Or,initHighlightingOnLoad:Sl,registerLanguage:ku,unregisterLanguage:Na,listLanguages:kl,getLanguage:dn,registerAliases:nr,autoDetection:Lr,inherit:xe,addPlugin:vs,removePlugin:Nu}),H.debugMode=function(){rt=!1},H.safeMode=function(){rt=!0},H.versionString=M,H.regex={concat:k,lookahead:x,either:N,optional:w,anyNumberOfTimes:v};for(const Me in et)typeof et[Me]=="object"&&e(et[Me]);return Object.assign(H,et),H},ze=_e({});return ze.newInstance=()=>_e({}),Mg=ze,ze.HighlightJS=ze,ze.default=ze,Mg}var Dg,Ek;function OY(){if(Ek)return Dg;Ek=1;function e(t){const s=t.regex,n=s.concat(/[\p{L}_]/u,s.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),o=/[\p{L}0-9._:-]+/u,l={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},u={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},h=t.inherit(u,{begin:/\(/,end:/\)/}),f=t.inherit(t.APOS_STRING_MODE,{className:"string"}),d=t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),p={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:o,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[l]},{begin:/'/,end:/'/,contains:[l]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[u,d,f,h,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[u,h,d,f]}]}]},t.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},l,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[d]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[p],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[p],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:s.concat(/</,s.lookahead(s.concat(n,s.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:p}]},{className:"tag",begin:s.concat(/<\//,s.lookahead(s.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}return Dg=e,Dg}var Og,jk;function LY(){if(jk)return Og;jk=1;function e(t){const s=t.regex,n={},o={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:s.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},o]});const l={className:"subst",begin:/\$\(/,end:/\)/,contains:[t.BACKSLASH_ESCAPE]},u=t.inherit(t.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),h={begin:/<<-?\s*(?=\w+)/,starts:{contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},f={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,n,l]};l.contains.push(f);const d={match:/\\"/},p={className:"string",begin:/'/,end:/'/},g={match:/\\'/},x={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},t.NUMBER_MODE,n]},v=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],w=t.SHEBANG({binary:`(${v.join("|")})`,relevance:10}),k={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[t.inherit(t.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},C=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],N=["true","false"],T={match:/(\/[a-z._-]+)+/},j=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],A=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],B=["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"],O=["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:C,literal:N,built_in:[...j,...A,"set","shopt",...B,...O]},contains:[w,t.SHEBANG(),k,x,u,h,T,f,d,p,g,n]}}return Og=e,Og}var Lg,Ak;function zY(){if(Ak)return Lg;Ak=1;function e(t){const s=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),o="decltype\\(auto\\)",l="[a-zA-Z_]\\w*::",h="("+o+"|"+s.optional(l)+"[a-zA-Z_]\\w*"+s.optional("<[^<>]+>")+")",f={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},p={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},g={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},x={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(p,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},v={className:"title",begin:s.optional(l)+t.IDENT_RE,relevance:0},w=s.optional(l)+t.IDENT_RE+"\\s*\\(",N={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},T=[x,f,n,t.C_BLOCK_COMMENT_MODE,g,p],j={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:N,contains:T.concat([{begin:/\(/,end:/\)/,keywords:N,contains:T.concat(["self"]),relevance:0}]),relevance:0},A={begin:"("+h+"[\\*&\\s]+)+"+w,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:N,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:o,keywords:N,relevance:0},{begin:w,returnBegin:!0,contains:[t.inherit(v,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:N,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,p,g,f,{begin:/\(/,end:/\)/,keywords:N,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,p,g,f]}]},f,n,t.C_BLOCK_COMMENT_MODE,x]};return{name:"C",aliases:["h"],keywords:N,disableAutodetect:!0,illegal:"</",contains:[].concat(j,A,T,[x,{begin:t.IDENT_RE+"::",keywords:N},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},t.TITLE_MODE]}]),exports:{preprocessor:x,strings:p,keywords:N}}}return Lg=e,Lg}var zg,Tk;function BY(){if(Tk)return zg;Tk=1;function e(t){const s=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),o="decltype\\(auto\\)",l="[a-zA-Z_]\\w*::",h="(?!struct)("+o+"|"+s.optional(l)+"[a-zA-Z_]\\w*"+s.optional("<[^<>]+>")+")",f={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},p={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},g={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},x={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(p,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},v={className:"title",begin:s.optional(l)+t.IDENT_RE,relevance:0},w=s.optional(l)+t.IDENT_RE+"\\s*\\(",k=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],C=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],N=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],T=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],B={type:C,keyword:k,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:N},O={className:"function.dispatch",relevance:0,keywords:{_hint:T},begin:s.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,s.lookahead(/(<[^<>]+>|)\s*\(/))},I=[O,x,f,n,t.C_BLOCK_COMMENT_MODE,g,p],R={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:B,contains:I.concat([{begin:/\(/,end:/\)/,keywords:B,contains:I.concat(["self"]),relevance:0}]),relevance:0},D={className:"function",begin:"("+h+"[\\*&\\s]+)+"+w,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:B,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:o,keywords:B,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:B,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,p,g,f,{begin:/\(/,end:/\)/,keywords:B,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,p,g,f]}]},f,n,t.C_BLOCK_COMMENT_MODE,x]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:B,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(R,D,O,I,[x,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:B,contains:["self",f]},{begin:t.IDENT_RE+"::",keywords:B},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}return zg=e,zg}var Bg,Rk;function PY(){if(Rk)return Bg;Rk=1;function e(t){const s=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],n=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],o=["default","false","null","true"],l=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],u=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],h={keyword:l.concat(u),built_in:s,literal:o},f=t.inherit(t.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),d={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},p={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},g={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},x=t.inherit(g,{illegal:/\n/}),v={className:"subst",begin:/\{/,end:/\}/,keywords:h},w=t.inherit(v,{illegal:/\n/}),k={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},t.BACKSLASH_ESCAPE,w]},C={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},v]},N=t.inherit(C,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},w]});v.contains=[C,k,g,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,d,t.C_BLOCK_COMMENT_MODE],w.contains=[N,k,x,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,d,t.inherit(t.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const T={variants:[p,C,k,g,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},j={begin:"<",end:">",contains:[{beginKeywords:"in out"},f]},A=t.IDENT_RE+"(<"+t.IDENT_RE+"(\\s*,\\s*"+t.IDENT_RE+")*>)?(\\[\\])?",B={begin:"@"+t.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:h,illegal:/::/,contains:[t.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:"<!--|-->"},{begin:"</?",end:">"}]}]}),t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},T,d,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},f,j,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[f,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[f,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:"("+A+"\\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:[T,d,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},B]}}return Bg=e,Bg}var Pg,Mk;function IY(){if(Mk)return Pg;Mk=1;const e=d=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:d.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[d.APOS_STRING_MODE,d.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:d.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),t=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],s=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],n=[...t,...s],o=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),l=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),u=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),h=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function f(d){const p=d.regex,g=e(d),x={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},v="and or not only",w=/@-?\w[\w]*(-\w+)*/,k="[a-zA-Z-][a-zA-Z0-9_-]*",C=[d.APOS_STRING_MODE,d.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[g.BLOCK_COMMENT,x,g.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+k,relevance:0},g.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+l.join("|")+")"},{begin:":(:)?("+u.join("|")+")"}]},g.CSS_VARIABLE,{className:"attribute",begin:"\\b("+h.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[g.BLOCK_COMMENT,g.HEXCOLOR,g.IMPORTANT,g.CSS_NUMBER_MODE,...C,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...C,{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"},...C,g.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+n.join("|")+")\\b"}]}}return Pg=f,Pg}var Ig,Dk;function $Y(){if(Dk)return Ig;Dk=1;function e(t){const s=t.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},o={begin:"^[-\\*]{3,}",end:"$"},l={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},u={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},h={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},f=/[A-Za-z][A-Za-z0-9+.-]*/,d={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:s.concat(/\[.+?\]\(/,f,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},p={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},g={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},x=t.inherit(p,{contains:[]}),v=t.inherit(g,{contains:[]});p.contains.push(v),g.contains.push(x);let w=[n,d];return[p,g,x,v].forEach(T=>{T.contains=T.contains.concat(w)}),w=w.concat(p,g),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:w},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:w}]}]},n,u,p,g,{className:"quote",begin:"^>\\s+",contains:w,end:"$"},l,o,d,h,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}return Ig=e,Ig}var $g,Ok;function HY(){if(Ok)return $g;Ok=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 $g=e,$g}var Hg,Lk;function UY(){if(Lk)return Hg;Lk=1;function e(t){const s=t.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",o=s.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),l=s.concat(o,/(::\w+)*/),h={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},f={className:"doctag",begin:"@[A-Za-z]+"},d={begin:"#<",end:">"},p=[t.COMMENT("#","$",{contains:[f]}),t.COMMENT("^=begin","^=end",{contains:[f],relevance:10}),t.COMMENT("^__END__",t.MATCH_NOTHING_RE)],g={className:"subst",begin:/#\{/,end:/\}/,keywords:h},x={className:"string",contains:[t.BACKSLASH_ESCAPE,g],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:s.concat(/<<[-~]?'?/,s.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[t.BACKSLASH_ESCAPE,g]})]}]},v="[1-9](_?[0-9])*|0",w="[0-9](_?[0-9])*",k={className:"number",relevance:0,variants:[{begin:`\\b(${v})(\\.(${w}))?([eE][+-]?(${w})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},C={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:h}]},I=[x,{variants:[{match:[/class\s+/,l,/\s+<\s+/,l]},{match:[/\b(class|module)\s+/,l]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:h},{match:[/(include|extend)\s+/,l],scope:{2:"title.class"},keywords:h},{relevance:0,match:[l,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:o,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[C]},{begin:t.IDENT_RE+"::"},{className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[x,{begin:n}],relevance:0},k,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:h},{begin:"("+t.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[t.BACKSLASH_ESCAPE,g],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(d,p),relevance:0}].concat(d,p);g.contains=I,C.contains=I;const G=[{begin:/^\s*=>/,starts:{end:"$",contains:I}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:h,contains:I}}];return p.unshift(d),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:h,illegal:/\/\*/,contains:[t.SHEBANG({binary:"ruby"})].concat(G).concat(p).concat(I)}}return Hg=e,Hg}var Ug,zk;function FY(){if(zk)return Ug;zk=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 Ug=e,Ug}var Fg,Bk;function qY(){if(Bk)return Fg;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 Fg=e,Fg}var qg,Pk;function VY(){if(Pk)return qg;Pk=1;function e(t){const s=t.regex,n={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:t.NUMBER_RE}]},o=t.COMMENT();o.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];const l={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},u={className:"literal",begin:/\bon|off|true|false|yes|no\b/},h={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},f={begin:/\[/,end:/\]/,contains:[o,u,l,h,n,"self"],relevance:0},d=/[A-Za-z0-9_-]+/,p=/"(\\"|[^"])*"/,g=/'[^']*'/,x=s.either(d,p,g),v=s.concat(x,"(\\s*\\.\\s*",x,")*",s.lookahead(/\s*=\s*[^#\s]/));return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[o,{className:"section",begin:/\[+/,end:/\]+/},{begin:v,className:"attr",starts:{end:/$/,contains:[o,f,u,l,h,n]}}]}}return qg=e,qg}var Vg,Ik;function GY(){if(Ik)return Vg;Ik=1;var e="[0-9](_*[0-9])*",t=`\\.(${e})`,s="[0-9a-fA-F](_*[0-9a-fA-F])*",n={className:"number",variants:[{begin:`(\\b(${e})((${t})|\\.)?|(${t}))[eE][+-]?(${e})[fFdD]?\\b`},{begin:`\\b(${e})((${t})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${t})[fFdD]?\\b`},{begin:`\\b(${e})[fFdD]\\b`},{begin:`\\b0[xX]((${s})\\.?|(${s})?\\.(${s}))[pP][+-]?(${e})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${s})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function o(u,h,f){return f===-1?"":u.replace(h,d=>o(u,h,f-1))}function l(u){const h=u.regex,f="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",d=f+o("(?:<"+f+"~~~(?:\\s*,\\s*"+f+"~~~)*>)?",/~~~/g,2),w={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},k={className:"meta",begin:"@"+f,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},C={className:"params",begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:[u.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:w,illegal:/<\/|#/,contains:[u.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},u.C_LINE_COMMENT_MODE,u.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[u.BACKSLASH_ESCAPE]},u.APOS_STRING_MODE,u.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,f],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[h.concat(/(?!else)/,f),/\s+/,f,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,f],className:{1:"keyword",3:"title.class"},contains:[C,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 Vg=l,Vg}var Gg,$k;function WY(){if($k)return Gg;$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 f(d){const p=d.regex,g=(Ne,{after:Ge})=>{const De="</"+Ne[0].slice(1);return Ne.input.indexOf(De,Ge)!==-1},x=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 De=Ne[0].length+Ne.index,et=Ne.input[De];if(et==="<"||et===","){Ge.ignoreMatch();return}et===">"&&(g(Ne,{after:De})||Ge.ignoreMatch());let ke;const He=Ne.input.substring(De);if(ke=He.match(/^\s*=/)){Ge.ignoreMatch();return}if((ke=He.match(/^\s+extends\s+/))&&ke.index===0){Ge.ignoreMatch();return}}},C={$pattern:e,keyword:t,literal:s,built_in:h,"variable.language":u},N="[0-9](_?[0-9])*",T=`\\.(${N})`,j="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",A={className:"number",variants:[{begin:`(\\b(${j})((${T})|\\.)?|(${T}))[eE][+-]?(${N})\\b`},{begin:`\\b(${j})\\b((${T})\\b|\\.)?|(${T})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},B={className:"subst",begin:"\\$\\{",end:"\\}",keywords:C,contains:[]},O={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[d.BACKSLASH_ESCAPE,B],subLanguage:"xml"}},I={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[d.BACKSLASH_ESCAPE,B],subLanguage:"css"}},R={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[d.BACKSLASH_ESCAPE,B],subLanguage:"graphql"}},D={className:"string",begin:"`",end:"`",contains:[d.BACKSLASH_ESCAPE,B]},G={className:"comment",variants:[d.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:x+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),d.C_BLOCK_COMMENT_MODE,d.C_LINE_COMMENT_MODE]},Z=[d.APOS_STRING_MODE,d.QUOTE_STRING_MODE,O,I,R,D,{match:/\$\d+/},A];B.contains=Z.concat({begin:/\{/,end:/\}/,keywords:C,contains:["self"].concat(Z)});const $=[].concat(G,B.contains),q=$.concat([{begin:/(\s*)\(/,end:/\)/,keywords:C,contains:["self"].concat($)}]),F={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:C,contains:q},L={variants:[{match:[/class/,/\s+/,x,/\s+/,/extends/,/\s+/,p.concat(x,"(",p.concat(/\./,x),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,x],scope:{1:"keyword",3:"title.class"}}]},X={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+/,x,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[F],illegal:/%/},Y={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function V(Ne){return p.concat("(?!",Ne.join("|"),")")}const ie={match:p.concat(/\b/,V([...l,"super","import"].map(Ne=>`${Ne}\\s*\\(`)),x,p.lookahead(/\s*\(/)),className:"title.function",relevance:0},Ee={begin:p.concat(/\./,p.lookahead(p.concat(x,/(?![0-9A-Za-z$_(])/))),end:x,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},ye={match:[/get|set/,/\s+/,x,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},F]},oe="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+d.UNDERSCORE_IDENT_RE+")\\s*=>",je={match:[/const|var|let/,/\s+/,x,/\s*/,/=\s*/,/(async\s*)?/,p.lookahead(oe)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[F]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:C,exports:{PARAMS_CONTAINS:q,CLASS_REFERENCE:X},illegal:/#(?![$_A-z])/,contains:[d.SHEBANG({label:"shebang",binary:"node",relevance:5}),U,d.APOS_STRING_MODE,d.QUOTE_STRING_MODE,O,I,R,D,G,{match:/\$\d+/},A,X,{scope:"attr",match:x+p.lookahead(":"),relevance:0},je,{begin:"("+d.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[G,d.REGEXP_MODE,{className:"function",begin: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:C,contains:q}]}]},{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:[F,d.inherit(d.TITLE_MODE,{begin:x,className:"title.function"})]},{match:/\.\.\./,relevance:0},Ee,{match:"\\$"+x,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[F]},ie,Y,L,ye,{match:/\$[(.]/}]}}return Gg=f,Gg}var Wg,Hk;function KY(){if(Hk)return Wg;Hk=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 Wg=e,Wg}var Kg,Uk;function YY(){if(Uk)return Kg;Uk=1;var e="[0-9](_*[0-9])*",t=`\\.(${e})`,s="[0-9a-fA-F](_*[0-9a-fA-F])*",n={className:"number",variants:[{begin:`(\\b(${e})((${t})|\\.)?|(${t}))[eE][+-]?(${e})[fFdD]?\\b`},{begin:`\\b(${e})((${t})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${t})[fFdD]?\\b`},{begin:`\\b(${e})[fFdD]\\b`},{begin:`\\b0[xX]((${s})\\.?|(${s})?\\.(${s}))[pP][+-]?(${e})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${s})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function o(l){const u={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},h={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},f={className:"symbol",begin:l.UNDERSCORE_IDENT_RE+"@"},d={className:"subst",begin:/\$\{/,end:/\}/,contains:[l.C_NUMBER_MODE]},p={className:"variable",begin:"\\$"+l.UNDERSCORE_IDENT_RE},g={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[p,d]},{begin:"'",end:"'",illegal:/\n/,contains:[l.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[l.BACKSLASH_ESCAPE,p,d]}]};d.contains.push(g);const x={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+l.UNDERSCORE_IDENT_RE+")?"},v={className:"meta",begin:"@"+l.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[l.inherit(g,{className:"string"}),"self"]}]},w=n,k=l.COMMENT("/\\*","\\*/",{contains:[l.C_BLOCK_COMMENT_MODE]}),C={variants:[{className:"type",begin:l.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},N=C;return N.variants[1].contains=[C],C.variants[1].contains=[N],{name:"Kotlin",aliases:["kt","kts"],keywords:u,contains:[l.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),l.C_LINE_COMMENT_MODE,k,h,f,x,v,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:u,relevance:5,contains:[{begin:l.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[l.UNDERSCORE_TITLE_MODE]},{className:"type",begin:/</,end:/>/,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:u,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[C,l.C_LINE_COMMENT_MODE,k],relevance:0},l.C_LINE_COMMENT_MODE,k,x,v,g,l.C_NUMBER_MODE]},k]},{begin:[/class|interface|trait/,/\s+/,l.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},l.UNDERSCORE_TITLE_MODE,{className:"type",begin:/</,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},x,v]},g,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:`
|
|
182
|
-
`},w]}}return Kg=o,Kg}var Yg,Fk;function XY(){if(Fk)return Yg;Fk=1;const e=p=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:p.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[p.APOS_STRING_MODE,p.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:p.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),t=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],s=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],n=[...t,...s],o=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),l=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),u=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),h=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),f=l.concat(u).sort().reverse();function d(p){const g=e(p),x=f,v="and or not only",w="[\\w-]+",k="("+w+"|@\\{"+w+"\\})",C=[],N=[],T=function($){return{className:"string",begin:"~?"+$+".*?"+$}},j=function($,q,F){return{className:$,begin:q,relevance:F}},A={$pattern:/[a-z-]+/,keyword:v,attribute:o.join(" ")},B={begin:"\\(",end:"\\)",contains:N,keywords:A,relevance:0};N.push(p.C_LINE_COMMENT_MODE,p.C_BLOCK_COMMENT_MODE,T("'"),T('"'),g.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},g.HEXCOLOR,B,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 O=N.concat({begin:/\{/,end:/\}/,contains:C}),I={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(N)},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:N}}]},D={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:A,returnEnd:!0,contains:N,relevance:0}},P={className:"variable",variants:[{begin:"@"+w+"\\s*:",relevance:15},{begin:"@"+w}],starts:{end:"[;}]",returnEnd:!0,contains:O}},G={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:k,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[p.C_LINE_COMMENT_MODE,p.C_BLOCK_COMMENT_MODE,I,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:O},{begin:"!important"},g.FUNCTION_DISPATCH]},Z={begin:w+`:(:)?(${x.join("|")})`,returnBegin:!0,contains:[G]};return C.push(p.C_LINE_COMMENT_MODE,p.C_BLOCK_COMMENT_MODE,D,P,Z,R,G,I,g.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:C}}return Yg=d,Yg}var Xg,qk;function ZY(){if(qk)return Xg;qk=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 Xg=e,Xg}var Zg,Vk;function QY(){if(Vk)return Zg;Vk=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 Zg=e,Zg}var Qg,Gk;function JY(){if(Gk)return Qg;Gk=1;function e(t){const s=t.regex,n=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],o=/[dualxmsipngr]{0,12}/,l={$pattern:/[\w.]+/,keyword:n.join(" ")},u={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:l},h={begin:/->\{/,end:/\}/},f={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},d={scope:"variable",variants:[{begin:/\$\d/},{begin:s.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[f]},p={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},g=[t.BACKSLASH_ESCAPE,u,d],x=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],v=(C,N,T="\\1")=>{const j=T==="\\1"?T:s.concat(T,N);return s.concat(s.concat("(?:",C,")"),N,/(?:\\.|[^\\\/])*?/,j,/(?:\\.|[^\\\/])*?/,T,o)},w=(C,N,T)=>s.concat(s.concat("(?:",C,")"),N,/(?:\\.|[^\\\/])*?/,T,o),k=[d,t.HASH_COMMENT_MODE,t.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),h,{className:"string",contains:g,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},p,{begin:"(\\/\\/|"+t.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[t.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:v("s|tr|y",s.either(...x,{capture:!0}))},{begin:v("s|tr|y","\\(","\\)")},{begin:v("s|tr|y","\\[","\\]")},{begin:v("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:w("(?:m|qr)?",/\//,/\//)},{begin:w("m|qr",s.either(...x,{capture:!0}),/\1/)},{begin:w("m|qr",/\(/,/\)/)},{begin:w("m|qr",/\[/,/\]/)},{begin:w("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE,f]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE,f,p]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return u.contains=k,h.contains=k,{name:"Perl",aliases:["pl","pm"],keywords:l,contains:k}}return Qg=e,Qg}var Jg,Wk;function eX(){if(Wk)return Jg;Wk=1;function e(t){const s={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},n=/[a-zA-Z@][a-zA-Z0-9_]*/,f={"variable.language":["this","super"],$pattern:n,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},d={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:f,illegal:"</",contains:[s,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,t.C_NUMBER_MODE,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,{className:"string",variants:[{begin:'@"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]}]},{className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),{className:"string",begin:/<.*?>/,end:/$/,illegal:"\\n"},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+d.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:d,contains:[t.UNDERSCORE_TITLE_MODE]},{begin:"\\."+t.UNDERSCORE_IDENT_RE,relevance:0}]}}return Jg=e,Jg}var ex,Kk;function tX(){if(Kk)return ex;Kk=1;function e(t){const s=t.regex,n=/(?![A-Za-z0-9])(?![$])/,o=s.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),l=s.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),u=s.concat(/[A-Z]+/,n),h={scope:"variable",match:"\\$+"+o},f={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},d={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},p=t.inherit(t.APOS_STRING_MODE,{illegal:null}),g=t.inherit(t.QUOTE_STRING_MODE,{illegal:null,contains:t.QUOTE_STRING_MODE.contains.concat(d)}),x={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:t.QUOTE_STRING_MODE.contains.concat(d),"on:begin":(F,L)=>{L.data._beginMatch=F[1]||F[2]},"on:end":(F,L)=>{L.data._beginMatch!==F[1]&&L.ignoreMatch()}},v=t.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),w=`[
|
|
183
|
-
]`,k={scope:"string",variants:[g,p,x,v]},C={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},N=["false","null","true"],T=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],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"],B={keyword:T,literal:(F=>{const L=[];return F.forEach(X=>{L.push(X),X.toLowerCase()===X?L.push(X.toUpperCase()):L.push(X.toLowerCase())}),L})(N),built_in:j},O=F=>F.map(L=>L.replace(/\|\d+$/,"")),I={variants:[{match:[/new/,s.concat(w,"+"),s.concat("(?!",O(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"}}]},P={scope:"attr",match:s.concat(o,s.lookahead(":"),s.lookahead(/(?!::)/))},G={relevance:0,begin:/\(/,end:/\)/,keywords:B,contains:[P,h,D,t.C_BLOCK_COMMENT_MODE,k,C,I]},Z={relevance:0,match:[/\b/,s.concat("(?!fn\\b|function\\b|",O(T).join("\\b|"),"|",O(j).join("\\b|"),"\\b)"),o,s.concat(w,"*"),s.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[G]};G.contains.push(Z);const $=[P,D,t.C_BLOCK_COMMENT_MODE,k,C,I],q={begin:s.concat(/#\[\s*\\?/,s.either(l,u)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:N,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:N,keyword:["new","array"]},contains:["self",...$]},...$,{scope:"meta",variants:[{match:l},{match:u}]}]};return{case_insensitive:!1,keywords:B,contains:[q,t.HASH_COMMENT_MODE,t.COMMENT("//","$"),t.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:t.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},f,{scope:"variable.language",match:/\$this\b/},h,Z,D,{match:[/const/,/\s/,o],scope:{1:"keyword",3:"variable.constant"}},I,{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:B,contains:["self",q,h,D,t.C_BLOCK_COMMENT_MODE,k,C]}]},{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,C]}}return ex=e,ex}var tx,Yk;function sX(){if(Yk)return tx;Yk=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 tx=e,tx}var sx,Xk;function nX(){if(Xk)return sx;Xk=1;function e(t){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}return sx=e,sx}var nx,Zk;function iX(){if(Zk)return nx;Zk=1;function e(t){const s=t.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),o=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],f={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:o,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},d={className:"meta",begin:/^(>>>|\.\.\.) /},p={className:"subst",begin:/\{/,end:/\}/,keywords:f,illegal:/#/},g={begin:/\{\{/,relevance:0},x={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,d],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,d],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,d,g,p]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,d,g,p]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[t.BACKSLASH_ESCAPE,g,p]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,g,p]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},v="[0-9](_?[0-9])*",w=`(\\b(${v}))?\\.(${v})|\\b(${v})\\.`,k=`\\b|${o.join("|")}`,C={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})`}]},N={className:"comment",begin:s.lookahead(/# type:/),end:/$/,keywords:f,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},T={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:f,contains:["self",d,C,x,t.HASH_COMMENT_MODE]}]};return p.contains=[x,C,d],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:f,illegal:/(<\/|\?)|=>/,contains:[d,C,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},x,N,t.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[T]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[C,T,x]}]}}return nx=e,nx}var ix,Qk;function rX(){if(Qk)return ix;Qk=1;function e(t){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}return ix=e,ix}var rx,Jk;function aX(){if(Jk)return rx;Jk=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 rx=e,rx}var ax,eN;function oX(){if(eN)return ax;eN=1;function e(t){const s=t.regex,n=/(r#)?/,o=s.concat(n,t.UNDERSCORE_IDENT_RE),l=s.concat(n,t.IDENT_RE),u={className:"title.function.invoke",relevance:0,begin:s.concat(/\b/,/(?!let|for|while|if|else|match\b)/,l,s.lookahead(/\s*\(/))},h="([ui](8|16|32|64|128|size)|f(32|64))?",f=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],d=["true","false","Some","None","Ok","Err"],p=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],g=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:t.IDENT_RE+"!?",type:g,keyword:f,literal:d,built_in:p},illegal:"</",contains:[t.C_LINE_COMMENT_MODE,t.COMMENT("/\\*","\\*/",{contains:["self"]}),t.inherit(t.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+h},{begin:"\\b0o([0-7_]+)"+h},{begin:"\\b0x([A-Fa-f0-9_]+)"+h},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+h}],relevance:0},{begin:[/fn/,/\s+/,o],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,o],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,o,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,o],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,o],className:{1:"keyword",3:"title.class"}},{begin:t.IDENT_RE+"::",keywords:{keyword:"Self",built_in:p,type:g}},{className:"punctuation",begin:"->"},u]}}return ax=e,ax}var ox,tN;function lX(){if(tN)return ox;tN=1;const e=d=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:d.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[d.APOS_STRING_MODE,d.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:d.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),t=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],s=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],n=[...t,...s],o=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),l=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),u=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),h=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function f(d){const p=e(d),g=u,x=l,v="@[a-z-]+",w="and or not only",C={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[d.C_LINE_COMMENT_MODE,d.C_BLOCK_COMMENT_MODE,p.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},p.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+n.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+x.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+g.join("|")+")"},C,{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,C,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"},C,d.QUOTE_STRING_MODE,d.APOS_STRING_MODE,p.HEXCOLOR,p.CSS_NUMBER_MODE]},p.FUNCTION_DISPATCH]}}return ox=f,ox}var lx,sN;function cX(){if(sN)return lx;sN=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 lx=e,lx}var cx,nN;function uX(){if(nN)return cx;nN=1;function e(t){const s=t.regex,n=t.COMMENT("--","$"),o={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},l={begin:/"/,end:/"/,contains:[{match:/""/}]},u=["true","false","unknown"],h=["double precision","large object","with timezone","without timezone"],f=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],d=["add","asc","collation","desc","final","first","last","view"],p=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],g=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],x=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],v=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],w=g,k=[...p,...d].filter(O=>!g.includes(O)),C={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},N={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},T={match:s.concat(/\b/,s.either(...w),/\s*\(/),relevance:0,keywords:{built_in:w}};function j(O){return s.concat(/\b/,s.either(...O.map(I=>I.replace(/\s+/,"\\s+"))),/\b/)}const A={scope:"keyword",match:j(v),relevance:0};function B(O,{exceptions:I,when:R}={}){const D=R;return I=I||[],O.map(P=>P.match(/\|\d+$/)||I.includes(P)?P:D(P)?`${P}|0`:P)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:B(k,{when:O=>O.length<3}),literal:u,type:f,built_in:x},contains:[{scope:"type",match:j(h)},A,T,C,o,l,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,n,N]}}return cx=e,cx}var ux,iN;function dX(){if(iN)return ux;iN=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(P=>e(P)).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(G=>e(G)).join("|")+")"}const l=R=>s(/\b/,R,/\w$/.test(R)?/\b/:/\B/),u=["Protocol","Type"].map(l),h=["init","self"].map(l),f=["Any","Self"],d=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],p=["false","nil","true"],g=["assignment","associativity","higherThan","left","lowerThan","none","right"],x=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],v=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],w=o(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),k=o(w,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),C=s(w,k,"*"),N=o(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),T=o(N,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),j=s(N,T,"*"),A=s(/[A-Z]/,T,"*"),B=["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"],O=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function I(R){const D={match:/\s+/,relevance:0},P=R.COMMENT("/\\*","\\*/",{contains:["self"]}),G=[R.C_LINE_COMMENT_MODE,P],Z={match:[/\./,o(...u,...h)],className:{2:"keyword"}},$={match:s(/\./,o(...d)),relevance:0},q=d.filter(ue=>typeof ue=="string").concat(["_|0"]),F=d.filter(ue=>typeof ue!="string").concat(f).map(l),L={variants:[{className:"keyword",match:o(...F,...h)}]},X={$pattern:o(/\b\w+/,/#\w+/),keyword:q.concat(x),literal:p},U=[Z,$,L],K={match:s(/\./,o(...v)),relevance:0},Y={className:"built_in",match:s(/\b/,o(...v),/(?=\()/)},V=[K,Y],ie={match:/->/,relevance:0},Ee={className:"operator",relevance:0,variants:[{match:C},{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}\}/)}]}),De=(ue="")=>({className:"subst",match:s(/\\/,ue,/[\t ]*(?:[\r\n]|\r\n)/)}),et=(ue="")=>({className:"subst",label:"interpol",begin:s(/\\/,ue,/\(/),end:/\)/}),ke=(ue="")=>({begin:s(ue,/"""/),end:s(/"""/,ue),contains:[Ge(ue),De(ue),et(ue)]}),He=(ue="")=>({begin:s(ue,/"/),end:s(/"/,ue),contains:[Ge(ue),et(ue)]}),$e={className:"string",variants:[ke(),ke("#"),ke("##"),ke("###"),He(),He("#"),He("##"),He("###")]},wt=[R.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[R.BACKSLASH_ESCAPE]}],Us={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:wt},Fs=ue=>{const Ce=s(ue,/\//),_e=s(/\//,ue);return{begin:Ce,end:_e,contains:[...wt,{scope:"comment",begin:`#(?!.*${_e})`,end:/$/}]}},Ln={scope:"regexp",variants:[Fs("###"),Fs("##"),Fs("#"),Us]},Sn={match:s(/`/,j,/`/)},As={className:"variable",match:/\$\d+/},cn={className:"variable",match:`\\$${T}+`},un=[Sn,As,cn],Ie={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:O,contains:[...ye,Ne,$e]}]}},Ct={scope:"keyword",match:s(/@/,o(...B),t(o(/\(/,/\s+/)))},St={scope:"meta",match:s(/@/,j)},Rt=[Ie,Ct,St],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)/,T,"+")},{className:"type",match:A,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:s(/\s+&\s+/,t(A)),relevance:0}]},Js={begin:/</,end:/>/,keywords:X,contains:[...G,...U,...Rt,ie,Ft]};Ft.contains.push(Js);const en={match:s(j,/\s*:/),keywords:"_|0",relevance:0},Di={begin:/\(/,end:/\)/,relevance:0,keywords:X,contains:["self",en,...G,Ln,...U,...V,...ye,Ne,$e,...un,...Rt,Ft]},S={begin:/</,end:/>/,keywords:"repeat each",contains:[...G,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:X,contains:[se,...G,...U,...ye,Ne,$e,...Rt,Ft,Di],endsParent:!0,illegal:/["']/},be={match:[/(func|macro)/,/\s+/,o(Sn.match,j,C)],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:/\[|%/},Ae={match:[/operator/,/\s+/,C],className:{1:"keyword",3:"title"}},M={begin:[/precedencegroup/,/\s+/,A],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"}},Te={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},xe={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,j,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:X,contains:[S,...U,{begin:/:/,end:/\{/,keywords:X,contains:[{scope:"title.class.inherited",match:A},...U],relevance:0}]};for(const ue of $e.variants){const Ce=ue.contains.find(ze=>ze.label==="interpol");Ce.keywords=X;const _e=[...U,...V,...ye,Ne,$e,...un];Ce.contains=[..._e,{begin:/\(/,end:/\)/,contains:["self",..._e]}]}return{name:"Swift",keywords:X,contains:[...G,be,ce,ne,Te,xe,Ae,M,{beginKeywords:"import",end:/$/,contains:[...G],relevance:0},Ln,...U,...V,...ye,Ne,$e,...un,...Rt,Ft,Di]}}return ux=I,ux}var dx,rN;function hX(){if(rN)return dx;rN=1;function e(t){const s="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",o={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},l={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},u={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},h={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[t.BACKSLASH_ESCAPE,l]},f=t.inherit(h,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),v={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},w={end:",",endsWithParent:!0,excludeEnd:!0,keywords:s,relevance:0},k={begin:/\{/,end:/\}/,contains:[w],illegal:"\\n",relevance:0},C={begin:"\\[",end:"\\]",contains:[w],illegal:"\\n",relevance:0},N=[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,C,u,h],T=[...N];return T.pop(),T.push(f),w.contains=T,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:N}}return dx=e,dx}var hx,aN;function fX(){if(aN)return hx;aN=1;const e="[A-Za-z$_][0-9A-Za-z$_]*",t=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],s=["true","false","null","undefined","NaN","Infinity"],n=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],o=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],l=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],u=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],h=[].concat(l,n,o);function f(p){const g=p.regex,x=(Ge,{after:De})=>{const et="</"+Ge[0].slice(1);return Ge.input.indexOf(et,De)!==-1},v=e,w={begin:"<>",end:"</>"},k=/<[A-Za-z0-9\\._:-]+\s*\/>/,C={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(Ge,De)=>{const et=Ge[0].length+Ge.index,ke=Ge.input[et];if(ke==="<"||ke===","){De.ignoreMatch();return}ke===">"&&(x(Ge,{after:et})||De.ignoreMatch());let He;const $e=Ge.input.substring(et);if(He=$e.match(/^\s*=/)){De.ignoreMatch();return}if((He=$e.match(/^\s+extends\s+/))&&He.index===0){De.ignoreMatch();return}}},N={$pattern:e,keyword:t,literal:s,built_in:h,"variable.language":u},T="[0-9](_?[0-9])*",j=`\\.(${T})`,A="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",B={className:"number",variants:[{begin:`(\\b(${A})((${j})|\\.)?|(${j}))[eE][+-]?(${T})\\b`},{begin:`\\b(${A})\\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},O={className:"subst",begin:"\\$\\{",end:"\\}",keywords:N,contains:[]},I={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[p.BACKSLASH_ESCAPE,O],subLanguage:"xml"}},R={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[p.BACKSLASH_ESCAPE,O],subLanguage:"css"}},D={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[p.BACKSLASH_ESCAPE,O],subLanguage:"graphql"}},P={className:"string",begin:"`",end:"`",contains:[p.BACKSLASH_ESCAPE,O]},Z={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,I,R,D,P,{match:/\$\d+/},B];O.contains=$.concat({begin:/\{/,end:/\}/,keywords:N,contains:["self"].concat($)});const q=[].concat(Z,O.contains),F=q.concat([{begin:/(\s*)\(/,end:/\)/,keywords:N,contains:["self"].concat(q)}]),L={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:N,contains:F},X={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:[L],illegal:/%/},V={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:/\(\)/},L]},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:[L]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:N,exports:{PARAMS_CONTAINS:F,CLASS_REFERENCE:U},illegal:/#(?![$_A-z])/,contains:[p.SHEBANG({label:"shebang",binary:"node",relevance:5}),K,p.APOS_STRING_MODE,p.QUOTE_STRING_MODE,I,R,D,P,Z,{match:/\$\d+/},B,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:[Z,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:N,contains:F}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:w.begin,end:w.end},{match:k},{begin:C.begin,"on:begin":C.isTrulyOpeningTag,end:C.end}],subLanguage:"xml",contains:[{begin:C.begin,end:C.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:[L,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:[L]},Ee,V,X,oe,{match:/\$[(.]/}]}}function d(p){const g=p.regex,x=f(p),v=e,w=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],k={begin:[/namespace/,/\s+/,p.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},C={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:w},contains:[x.exports.CLASS_REFERENCE]},N={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},T=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],j={$pattern:e,keyword:t.concat(T),literal:s,built_in:h.concat(w),"variable.language":u},A={className:"meta",begin:"@"+v},B=(D,P,G)=>{const Z=D.contains.findIndex($=>$.label===P);if(Z===-1)throw new Error("can not find mode to replace");D.contains.splice(Z,1,G)};Object.assign(x.keywords,j),x.exports.PARAMS_CONTAINS.push(A);const O=x.contains.find(D=>D.scope==="attr"),I=Object.assign({},O,{match:g.concat(v,g.lookahead(/\s*\?:/))});x.exports.PARAMS_CONTAINS.push([x.exports.CLASS_REFERENCE,O,I]),x.contains=x.contains.concat([A,k,C,I]),B(x,"shebang",p.SHEBANG()),B(x,"use_strict",N);const R=x.contains.find(D=>D.label==="func.def");return R.relevance=0,Object.assign(x,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),x}return hx=d,hx}var fx,oN;function mX(){if(oN)return fx;oN=1;function e(t){const s=t.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},o={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},l=/\d{1,2}\/\d{1,2}\/\d{4}/,u=/\d{4}-\d{1,2}-\d{1,2}/,h=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,f=/\d{1,2}(:\d{1,2}){1,2}/,d={className:"literal",variants:[{begin:s.concat(/# */,s.either(u,l),/ *#/)},{begin:s.concat(/# */,f,/ *#/)},{begin:s.concat(/# */,h,/ *#/)},{begin:s.concat(/# */,s.either(u,l),/ +/,s.either(h,f),/ *#/)}]},p={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},g={className:"label",begin:/^\w+:/},x=t.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),v=t.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[n,o,d,p,g,x,v,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[v]}]}}return fx=e,fx}var mx,lN;function pX(){if(lN)return mx;lN=1;function e(t){t.regex;const s=t.COMMENT(/\(;/,/;\)/);s.contains.push("self");const n=t.COMMENT(/;;/,/$/),o=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],l={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},u={className:"variable",begin:/\$[\w_]+/},h={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},f={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},d={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},p={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:o},contains:[n,s,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},u,h,l,t.QUOTE_STRING_MODE,d,p,f]}}return mx=e,mx}var px,cN;function gX(){if(cN)return px;cN=1;var e=DY();return e.registerLanguage("xml",OY()),e.registerLanguage("bash",LY()),e.registerLanguage("c",zY()),e.registerLanguage("cpp",BY()),e.registerLanguage("csharp",PY()),e.registerLanguage("css",IY()),e.registerLanguage("markdown",$Y()),e.registerLanguage("diff",HY()),e.registerLanguage("ruby",UY()),e.registerLanguage("go",FY()),e.registerLanguage("graphql",qY()),e.registerLanguage("ini",VY()),e.registerLanguage("java",GY()),e.registerLanguage("javascript",WY()),e.registerLanguage("json",KY()),e.registerLanguage("kotlin",YY()),e.registerLanguage("less",XY()),e.registerLanguage("lua",ZY()),e.registerLanguage("makefile",QY()),e.registerLanguage("perl",JY()),e.registerLanguage("objectivec",eX()),e.registerLanguage("php",tX()),e.registerLanguage("php-template",sX()),e.registerLanguage("plaintext",nX()),e.registerLanguage("python",iX()),e.registerLanguage("python-repl",rX()),e.registerLanguage("r",aX()),e.registerLanguage("rust",oX()),e.registerLanguage("scss",lX()),e.registerLanguage("shell",cX()),e.registerLanguage("sql",uX()),e.registerLanguage("swift",dX()),e.registerLanguage("yaml",hX()),e.registerLanguage("typescript",fX()),e.registerLanguage("vbnet",mX()),e.registerLanguage("wasm",pX()),e.HighlightJS=e,e.default=e,px=e,px}var xX=gX();const D0=JT(xX);function bX(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 u5({content:e}){const t=_.useMemo(()=>{const n=Dt.parse(e,{async:!1,gfm:!0,breaks:!1});return bX(n)},[e]),s=_.useRef(null);return _.useEffect(()=>{const n=s.current;n&&n.querySelectorAll("pre code").forEach(o=>{D0.highlightElement(o)})},[t]),r.jsx("div",{ref:s,className:"md-preview min-w-0 px-6 py-5",dangerouslySetInnerHTML:{__html:t}})}var vX=Object.create,d5=Object.defineProperty,_X=Object.getOwnPropertyDescriptor,yX=Object.getOwnPropertyNames,wX=Object.getPrototypeOf,SX=Object.prototype.hasOwnProperty,Jt=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),kX=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(var o=yX(t),l=0,u=o.length,h;l<u;l++)h=o[l],!SX.call(e,h)&&h!==s&&d5(e,h,{get:(f=>t[f]).bind(null,h),enumerable:!(n=_X(t,h))||n.enumerable});return e},NX=(e,t,s)=>(s=e!=null?vX(wX(e)):{},kX(d5(s,"default",{value:e,enumerable:!0}),e)),yu=Jt(((e,t)=>{function s(f){return typeof f>"u"||f===null}function n(f){return typeof f=="object"&&f!==null}function o(f){return Array.isArray(f)?f:s(f)?[]:[f]}function l(f,d){if(d){const p=Object.keys(d);for(let g=0,x=p.length;g<x;g+=1){const v=p[g];f[v]=d[v]}}return f}function u(f,d){let p="";for(let g=0;g<d;g+=1)p+=f;return p}function h(f){return f===0&&Number.NEGATIVE_INFINITY===1/f}t.exports.isNothing=s,t.exports.isObject=n,t.exports.toArray=o,t.exports.repeat=u,t.exports.isNegativeZero=h,t.exports.extend=l})),wu=Jt(((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})),CX=Jt(((e,t)=>{var s=yu();function n(u,h,f,d,p){let g="",x="";const v=Math.floor(p/2)-1;return d-h>v&&(g=" ... ",h=d-v+g.length),f-d>v&&(x=" ...",f=d+v-x.length),{str:g+u.slice(h,f).replace(/\t/g,"→")+x,pos:d-h+g.length}}function o(u,h){return s.repeat(" ",h-u.length)+u}function l(u,h){if(h=Object.create(h||null),!u.buffer)return null;h.maxLength||(h.maxLength=79),typeof h.indent!="number"&&(h.indent=1),typeof h.linesBefore!="number"&&(h.linesBefore=3),typeof h.linesAfter!="number"&&(h.linesAfter=2);const f=/\r?\n|\r|\0/g,d=[0],p=[];let g,x=-1;for(;g=f.exec(u.buffer);)p.push(g.index),d.push(g.index+g[0].length),u.position<=g.index&&x<0&&(x=d.length-2);x<0&&(x=d.length-1);let v="";const w=Math.min(u.line+h.linesAfter,p.length).toString().length,k=h.maxLength-(h.indent+w+3);for(let N=1;N<=h.linesBefore&&!(x-N<0);N++){const T=n(u.buffer,d[x-N],p[x-N],u.position-(d[x]-d[x-N]),k);v=s.repeat(" ",h.indent)+o((u.line-N+1).toString(),w)+" | "+T.str+`
|
|
186
|
-
`+v}const C=n(u.buffer,d[x],p[x],u.position,k);v+=s.repeat(" ",h.indent)+o((u.line+1).toString(),w)+" | "+C.str+`
|
|
187
|
-
`,v+=s.repeat("-",h.indent+w+3+C.pos)+`^
|
|
188
|
-
`;for(let N=1;N<=h.linesAfter&&!(x+N>=p.length);N++){const T=n(u.buffer,d[x+N],p[x+N],u.position-(d[x]-d[x+N]),k);v+=s.repeat(" ",h.indent)+o((u.line+N+1).toString(),w)+" | "+T.str+`
|
|
189
|
-
`}return v.replace(/\n$/,"")}t.exports=l})),wn=Jt(((e,t)=>{var s=wu(),n=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],o=["scalar","sequence","mapping"];function l(h){const f={};return h!==null&&Object.keys(h).forEach(function(d){h[d].forEach(function(p){f[String(p)]=d})}),f}function u(h,f){if(f=f||{},Object.keys(f).forEach(function(d){if(n.indexOf(d)===-1)throw new s('Unknown option "'+d+'" is met in definition of "'+h+'" YAML type.')}),this.options=f,this.tag=h,this.kind=f.kind||null,this.resolve=f.resolve||function(){return!0},this.construct=f.construct||function(d){return d},this.instanceOf=f.instanceOf||null,this.predicate=f.predicate||null,this.represent=f.represent||null,this.representName=f.representName||null,this.defaultStyle=f.defaultStyle||null,this.multi=f.multi||!1,this.styleAliases=l(f.styleAliases||null),o.indexOf(this.kind)===-1)throw new s('Unknown kind "'+this.kind+'" is specified for "'+h+'" YAML type.')}t.exports=u})),h5=Jt(((e,t)=>{var s=wu(),n=wn();function o(h,f){const d=[];return h[f].forEach(function(p){let g=d.length;d.forEach(function(x,v){x.tag===p.tag&&x.kind===p.kind&&x.multi===p.multi&&(g=v)}),d[g]=p}),d}function l(){const h={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function f(d){d.multi?(h.multi[d.kind].push(d),h.multi.fallback.push(d)):h[d.kind][d.tag]=h.fallback[d.tag]=d}for(let d=0,p=arguments.length;d<p;d+=1)arguments[d].forEach(f);return h}function u(h){return this.extend(h)}u.prototype.extend=function(f){let d=[],p=[];if(f instanceof n)p.push(f);else if(Array.isArray(f))p=p.concat(f);else if(f&&(Array.isArray(f.implicit)||Array.isArray(f.explicit)))f.implicit&&(d=d.concat(f.implicit)),f.explicit&&(p=p.concat(f.explicit));else throw new s("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");d.forEach(function(x){if(!(x instanceof n))throw new s("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(x.loadKind&&x.loadKind!=="scalar")throw new s("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(x.multi)throw new s("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),p.forEach(function(x){if(!(x instanceof n))throw new s("Specified list of YAML types (or a single Type object) contains a non-Type object.")});const g=Object.create(u.prototype);return g.implicit=(this.implicit||[]).concat(d),g.explicit=(this.explicit||[]).concat(p),g.compiledImplicit=o(g,"implicit"),g.compiledExplicit=o(g,"explicit"),g.compiledTypeMap=l(g.compiledImplicit,g.compiledExplicit),g},t.exports=u})),f5=Jt(((e,t)=>{t.exports=new(wn())("tag:yaml.org,2002:str",{kind:"scalar",construct:function(s){return s!==null?s:""}})})),m5=Jt(((e,t)=>{t.exports=new(wn())("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(s){return s!==null?s:[]}})})),p5=Jt(((e,t)=>{t.exports=new(wn())("tag:yaml.org,2002:map",{kind:"mapping",construct:function(s){return s!==null?s:{}}})})),g5=Jt(((e,t)=>{t.exports=new(h5())({explicit:[f5(),m5(),p5()]})})),x5=Jt(((e,t)=>{var s=wn();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"})})),b5=Jt(((e,t)=>{var s=wn();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"})})),v5=Jt(((e,t)=>{var s=yu(),n=wn();function o(g){return g>=48&&g<=57||g>=65&&g<=70||g>=97&&g<=102}function l(g){return g>=48&&g<=55}function u(g){return g>=48&&g<=57}function h(g){if(g===null)return!1;const x=g.length;let v=0,w=!1;if(!x)return!1;let k=g[v];if((k==="-"||k==="+")&&(k=g[++v]),k==="0"){if(v+1===x)return!0;if(k=g[++v],k==="b"){for(v++;v<x;v++){if(k=g[v],k!=="0"&&k!=="1")return!1;w=!0}return w&&Number.isFinite(f(g))}if(k==="x"){for(v++;v<x;v++){if(!o(g.charCodeAt(v)))return!1;w=!0}return w&&Number.isFinite(f(g))}if(k==="o"){for(v++;v<x;v++){if(!l(g.charCodeAt(v)))return!1;w=!0}return w&&Number.isFinite(f(g))}}for(;v<x;v++){if(!u(g.charCodeAt(v)))return!1;w=!0}return w?Number.isFinite(f(g)):!1}function f(g){let x=g,v=1,w=x[0];if((w==="-"||w==="+")&&(w==="-"&&(v=-1),x=x.slice(1),w=x[0]),x==="0")return 0;if(w==="0"){if(x[1]==="b")return v*parseInt(x.slice(2),2);if(x[1]==="x")return v*parseInt(x.slice(2),16);if(x[1]==="o")return v*parseInt(x.slice(2),8)}return v*parseInt(x,10)}function d(g){return f(g)}function p(g){return Object.prototype.toString.call(g)==="[object Number]"&&g%1===0&&!s.isNegativeZero(g)}t.exports=new n("tag:yaml.org,2002:int",{kind:"scalar",resolve:h,construct:d,predicate:p,represent:{binary:function(g){return g>=0?"0b"+g.toString(2):"-0b"+g.toString(2).slice(1)},octal:function(g){return g>=0?"0o"+g.toString(8):"-0o"+g.toString(8).slice(1)},decimal:function(g){return g.toString(10)},hexadecimal:function(g){return g>=0?"0x"+g.toString(16).toUpperCase():"-0x"+g.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})})),_5=Jt(((e,t)=>{var s=yu(),n=wn(),o=new RegExp("^(?:[-+]?(?:[0-9]+)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),l=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function u(g){return g===null||!o.test(g)?!1:Number.isFinite(parseFloat(g,10))?!0:l.test(g)}function h(g){let x=g.toLowerCase();const v=x[0]==="-"?-1:1;return"+-".indexOf(x[0])>=0&&(x=x.slice(1)),x===".inf"?v===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:x===".nan"?NaN:v*parseFloat(x,10)}var f=/^[-+]?[0-9]+e/;function d(g,x){if(isNaN(g))switch(x){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===g)switch(x){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===g)switch(x){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(s.isNegativeZero(g))return"-0.0";const v=g.toString(10);return f.test(v)?v.replace("e",".e"):v}function p(g){return Object.prototype.toString.call(g)==="[object Number]"&&(g%1!==0||s.isNegativeZero(g))}t.exports=new n("tag:yaml.org,2002:float",{kind:"scalar",resolve:u,construct:h,predicate:p,represent:d,defaultStyle:"lowercase"})})),y5=Jt(((e,t)=>{t.exports=g5().extend({implicit:[x5(),b5(),v5(),_5()]})})),w5=Jt(((e,t)=>{t.exports=y5()})),S5=Jt(((e,t)=>{var s=wn(),n=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),o=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function l(f){return f===null?!1:n.exec(f)!==null||o.exec(f)!==null}function u(f){let d=0,p=null,g=n.exec(f);if(g===null&&(g=o.exec(f)),g===null)throw new Error("Date resolve error");const x=+g[1],v=+g[2]-1,w=+g[3];if(!g[4])return new Date(Date.UTC(x,v,w));const k=+g[4],C=+g[5],N=+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],A=+(g[11]||0);p=(j*60+A)*6e4,g[9]==="-"&&(p=-p)}const T=new Date(Date.UTC(x,v,w,k,C,N,d));return p&&T.setTime(T.getTime()-p),T}function h(f){return f.toISOString()}t.exports=new s("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:l,construct:u,instanceOf:Date,represent:h})})),k5=Jt(((e,t)=>{var s=wn();function n(o){return o==="<<"||o===null}t.exports=new s("tag:yaml.org,2002:merge",{kind:"scalar",resolve:n})})),N5=Jt(((e,t)=>{var s=wn(),n=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
190
|
-
\r`;function o(f){if(f===null)return!1;let d=0;const p=f.length,g=n;for(let x=0;x<p;x++){const v=g.indexOf(f.charAt(x));if(!(v>64)){if(v<0)return!1;d+=6}}return d%8===0}function l(f){const d=f.replace(/[\r\n=]/g,""),p=d.length,g=n;let x=0;const v=[];for(let k=0;k<p;k++)k%4===0&&k&&(v.push(x>>16&255),v.push(x>>8&255),v.push(x&255)),x=x<<6|g.indexOf(d.charAt(k));const w=p%4*6;return w===0?(v.push(x>>16&255),v.push(x>>8&255),v.push(x&255)):w===18?(v.push(x>>10&255),v.push(x>>2&255)):w===12&&v.push(x>>4&255),new Uint8Array(v)}function u(f){let d="",p=0;const g=f.length,x=n;for(let w=0;w<g;w++)w%3===0&&w&&(d+=x[p>>18&63],d+=x[p>>12&63],d+=x[p>>6&63],d+=x[p&63]),p=(p<<8)+f[w];const v=g%3;return v===0?(d+=x[p>>18&63],d+=x[p>>12&63],d+=x[p>>6&63],d+=x[p&63]):v===2?(d+=x[p>>10&63],d+=x[p>>4&63],d+=x[p<<2&63],d+=x[64]):v===1&&(d+=x[p>>2&63],d+=x[p<<4&63],d+=x[64],d+=x[64]),d}function h(f){return Object.prototype.toString.call(f)==="[object Uint8Array]"}t.exports=new s("tag:yaml.org,2002:binary",{kind:"scalar",resolve:o,construct:l,predicate:h,represent:u})})),C5=Jt(((e,t)=>{var s=wn(),n=Object.prototype.hasOwnProperty,o=Object.prototype.toString;function l(h){if(h===null)return!0;const f=[],d=h;for(let p=0,g=d.length;p<g;p+=1){const x=d[p];let v=!1;if(o.call(x)!=="[object Object]")return!1;let w;for(w in x)if(n.call(x,w))if(!v)v=!0;else return!1;if(!v)return!1;if(f.indexOf(w)===-1)f.push(w);else return!1}return!0}function u(h){return h!==null?h:[]}t.exports=new s("tag:yaml.org,2002:omap",{kind:"sequence",resolve:l,construct:u})})),E5=Jt(((e,t)=>{var s=wn(),n=Object.prototype.toString;function o(u){if(u===null)return!0;const h=u,f=new Array(h.length);for(let d=0,p=h.length;d<p;d+=1){const g=h[d];if(n.call(g)!=="[object Object]")return!1;const x=Object.keys(g);if(x.length!==1)return!1;f[d]=[x[0],g[x[0]]]}return!0}function l(u){if(u===null)return[];const h=u,f=new Array(h.length);for(let d=0,p=h.length;d<p;d+=1){const g=h[d],x=Object.keys(g);f[d]=[x[0],g[x[0]]]}return f}t.exports=new s("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:o,construct:l})})),j5=Jt(((e,t)=>{var s=wn(),n=Object.prototype.hasOwnProperty;function o(u){if(u===null)return!0;const h=u;for(const f in h)if(n.call(h,f)&&h[f]!==null)return!1;return!0}function l(u){return u!==null?u:{}}t.exports=new s("tag:yaml.org,2002:set",{kind:"mapping",resolve:o,construct:l})})),Xb=Jt(((e,t)=>{t.exports=w5().extend({implicit:[S5(),k5()],explicit:[N5(),C5(),E5(),j5()]})})),EX=Jt(((e,t)=>{var s=yu(),n=wu(),o=CX(),l=Xb(),u=Object.prototype.hasOwnProperty,h=1,f=2,d=3,p=4,g=1,x=2,v=3,w=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,k=/[\x85\u2028\u2029]/,C=/[,\[\]{}]/,N=/^(?:!|!!|![0-9A-Za-z-]+!)$/,T=/^(?:!|[^,\[\]{}])(?:%[0-9a-f]{2}|[0-9a-z\-#;/?:@&=+$,_.!~*'()\[\]])*$/i;function j(S){return Object.prototype.toString.call(S)}function A(S){return S===10||S===13}function B(S){return S===9||S===32}function O(S){return S===9||S===32||S===10||S===13}function I(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 P(S){return S>=48&&S<=57?S-48:-1}function G(S){switch(S){case 48:return"\0";case 97:return"\x07";case 98:return"\b";case 116:return" ";case 9:return" ";case 110:return`
|
|
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 Z(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 q=new Array(256),F=new Array(256);for(let S=0;S<256;S++)q[S]=G(S)?1:0,F[S]=G(S);function L(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 X(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 X(S,se)}function K(S,se){S.onWarning&&S.onWarning.call(null,X(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 V(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 Ae=0,M=ce.length;Ae<M;Ae+=1){const ne=ce[Ae];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 Ae=parseInt(ce[1],10),M=parseInt(ce[2],10);Ae!==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 Ae=be[0];ce=be[1],N.test(Ae)||U(se,"ill-formed tag handle (first argument) of the TAG directive"),u.call(se.tagMap,Ae)&&U(se,'there is a previously declared suffix for "'+Ae+'" tag handle'),T.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[Ae]=ce}};function Ne(S,se,me,be){if(se<me){const ce=S.input.slice(se,me);if(be)for(let Ae=0,M=ce.length;Ae<M;Ae+=1){const ne=ce.charCodeAt(Ae);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 Ae=0,M=ce.length;Ae<M;Ae+=1){const ne=ce[Ae];u.call(se,ne)||($(se,ne,me[ne]),be[ne]=!0)}}function De(S,se,me,be,ce,Ae,M,ne,Te){if(Array.isArray(ce)){ce=Array.prototype.slice.call(ce);for(let xe=0,ue=ce.length;xe<ue;xe+=1)Array.isArray(ce[xe])&&U(S,"nested arrays are not supported inside keys"),typeof ce=="object"&&j(ce[xe])==="[object Object]"&&(ce[xe]="[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(Ae)){Ae.length>S.maxMergeSeqLength&&U(S,"merge sequence length exceeded maxMergeSeqLength ("+S.maxMergeSeqLength+")");const xe=new Set;for(let ue=0,Ce=Ae.length;ue<Ce;ue+=1){const _e=Ae[ue];xe.has(_e)||(xe.add(_e),Ge(S,se,_e,me))}}else Ge(S,se,Ae,me);else!S.json&&!u.call(me,ce)&&u.call(se,ce)&&(S.line=M||S.line,S.lineStart=ne||S.lineStart,S.position=Te||S.position,U(S,"duplicated mapping key")),$(se,ce,Ae),delete me[ce];return se}function et(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(;B(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(A(ce))for(et(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||O(me)))}function $e(S,se){se===1?S.result+=" ":se>1&&(S.result+=s.repeat(`
|
|
192
|
-
`,se-1))}function wt(S,se,me){let be,ce,Ae,M,ne,Te;const xe=S.kind,ue=S.result;let Ce=S.input.charCodeAt(S.position);if(O(Ce)||I(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 _e=S.input.charCodeAt(S.position+1);if(O(_e)||me&&I(_e))return!1}for(S.kind="scalar",S.result="",be=ce=S.position,Ae=!1;Ce!==0;){if(Ce===58){const _e=S.input.charCodeAt(S.position+1);if(O(_e)||me&&I(_e))break}else if(Ce===35){if(O(S.input.charCodeAt(S.position-1)))break}else{if(S.position===S.lineStart&&He(S)||me&&I(Ce))break;if(A(Ce))if(M=S.line,ne=S.lineStart,Te=S.lineIndent,ke(S,!1,-1),S.lineIndent>=se){Ae=!0,Ce=S.input.charCodeAt(S.position);continue}else{S.position=ce,S.line=M,S.lineStart=ne,S.lineIndent=Te;break}}Ae&&(Ne(S,be,ce,!1),$e(S,S.line-M),be=ce=S.position,Ae=!1),B(Ce)||(ce=S.position+1),Ce=S.input.charCodeAt(++S.position)}return Ne(S,be,ce,!1),S.result?!0:(S.kind=xe,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 A(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++,B(ce)||(be=S.position));U(S,"unexpected end of the stream within a single quoted scalar")}function Fs(S,se){let me,be,ce,Ae=S.input.charCodeAt(S.position);if(Ae!==34)return!1;for(S.kind="scalar",S.result="",S.position++,me=be=S.position;(Ae=S.input.charCodeAt(S.position))!==0;){if(Ae===34)return Ne(S,me,S.position,!0),S.position++,!0;if(Ae===92){if(Ne(S,me,S.position,!0),Ae=S.input.charCodeAt(++S.position),A(Ae))ke(S,!1,se);else if(Ae<256&&q[Ae])S.result+=F[Ae],S.position++;else if((ce=D(Ae))>0){let M=ce,ne=0;for(;M>0;M--)Ae=S.input.charCodeAt(++S.position),(ce=R(Ae))>=0?ne=(ne<<4)+ce:U(S,"expected hexadecimal character");S.result+=Z(ne),S.position++}else U(S,"unknown escape sequence");me=be=S.position}else A(Ae)?(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++,B(Ae)||(be=S.position))}U(S,"unexpected end of the stream within a double quoted scalar")}function Ln(S,se){let me=!0,be,ce,Ae;const M=S.tag;let ne;const Te=S.anchor;let xe,ue,Ce,_e;const ze=Object.create(null);let H,ee,fe,Be=S.input.charCodeAt(S.position);if(Be===91)xe=93,_e=!1,ne=[];else if(Be===123)xe=125,_e=!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===xe)return S.position++,S.tag=M,S.anchor=Te,S.kind=_e?"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&&O(S.input.charCodeAt(S.position+1))&&(ue=Ce=!0,S.position++,ke(S,!0,se)),be=S.line,ce=S.lineStart,Ae=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),_e?De(S,ne,ze,ee,H,fe,be,ce,Ae):ue?ne.push(De(S,null,ze,ee,H,fe,be,ce,Ae)):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 Sn(S,se){let me,be=g,ce=!1,Ae=!1,M=se,ne=0,Te=!1,xe,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:x:U(S,"repeat of a chomping mode identifier");else if((xe=P(ue))>=0)xe===0?U(S,"bad explicit indentation width of a block scalar; it cannot be less than one"):Ae?U(S,"repeat of an indentation width identifier"):(M=se+xe-1,Ae=!0);else break;if(B(ue)){do ue=S.input.charCodeAt(++S.position);while(B(ue));if(ue===35)do ue=S.input.charCodeAt(++S.position);while(!A(ue)&&ue!==0)}for(;ue!==0;){for(et(S),S.lineIndent=0,ue=S.input.charCodeAt(S.position);(!Ae||S.lineIndent<M)&&ue===32;)S.lineIndent++,ue=S.input.charCodeAt(++S.position);if(!Ae&&S.lineIndent>M&&(M=S.lineIndent),A(ue)){ne++;continue}if(!Ae&&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?B(ue)?(Te=!0,S.result+=s.repeat(`
|
|
195
|
-
`,ce?1+ne:ne)):Te?(Te=!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,Ae=!0,ne=0;const Ce=S.position;for(;!A(ue)&&ue!==0;)ue=S.input.charCodeAt(++S.position);Ne(S,Ce,S.position,!1)}return!0}function As(S,se){const me=S.tag,be=S.anchor,ce=[];let Ae=!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||!O(S.input.charCodeAt(S.position+1))));){if(Ae=!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 Ae?(S.tag=me,S.anchor=be,S.kind="sequence",S.result=ce,!0):!1}function cn(S,se,me){let be,ce,Ae,M;const ne=S.tag,Te=S.anchor,xe={},ue=Object.create(null);let Ce=null,_e=null,ze=null,H=!1,ee=!1;if(S.firstTabInLine!==-1)return!1;S.anchor!==null&&Y(S,S.anchor,xe);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)&&O(Be))fe===63?(H&&(De(S,xe,ue,Ce,_e,null,ce,Ae,M),Ce=_e=ze=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,Ae=S.lineStart,M=S.position,!Rt(S,me,f,!1,!0))break;if(S.line===rt){for(fe=S.input.charCodeAt(S.position);B(fe);)fe=S.input.charCodeAt(++S.position);if(fe===58)fe=S.input.charCodeAt(++S.position),O(fe)||U(S,"a whitespace character is expected after the key-value separator within a block mapping"),H&&(De(S,xe,ue,Ce,_e,null,ce,Ae,M),Ce=_e=ze=null),ee=!0,H=!1,be=!1,Ce=S.tag,_e=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=Te,!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=Te,!0}if((S.line===rt||S.lineIndent>se)&&(H&&(ce=S.line,Ae=S.lineStart,M=S.position),Rt(S,se,p,!0,be)&&(H?_e=S.result:ze=S.result),H||(De(S,xe,ue,Ce,_e,ze,ce,Ae,M),Ce=_e=ze=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&&De(S,xe,ue,Ce,_e,null,ce,Ae,M),ee&&(S.tag=ne,S.anchor=Te,S.kind="mapping",S.result=xe),ee}function un(S){let se=!1,me=!1,be,ce,Ae=S.input.charCodeAt(S.position);if(Ae!==33)return!1;S.tag!==null&&U(S,"duplication of a tag property"),Ae=S.input.charCodeAt(++S.position),Ae===60?(se=!0,Ae=S.input.charCodeAt(++S.position)):Ae===33?(me=!0,be="!!",Ae=S.input.charCodeAt(++S.position)):be="!";let M=S.position;if(se){do Ae=S.input.charCodeAt(++S.position);while(Ae!==0&&Ae!==62);S.position<S.length?(ce=S.input.slice(M,S.position),Ae=S.input.charCodeAt(++S.position)):U(S,"unexpected end of the stream within a verbatim tag")}else{for(;Ae!==0&&!O(Ae);)Ae===33&&(me?U(S,"tag suffix cannot contain exclamation marks"):(be=S.input.slice(M-1,S.position+1),N.test(be)||U(S,"named tag handle cannot contain such characters"),me=!0,M=S.position+1)),Ae=S.input.charCodeAt(++S.position);ce=S.input.slice(M,S.position),C.test(ce)&&U(S,"tag suffix cannot contain flow indicator characters")}ce&&!T.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 Ie(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&&!O(se)&&!I(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&&!O(se)&&!I(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 St(S,se,me,be){const ce=ye(S);return V(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 Ae,M,ne=1,Te=!1,xe=!1,ue=null,Ce,_e,ze;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=Ae=M=p===me||d===me;if(be&&ke(S,!0,-1)&&(Te=!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(Te&&(ee===33&&S.tag!==null||ee===38&&S.anchor!==null)||!un(S)&&!Ie(S))break;ue===null&&(ue=fe),ke(S,!0,-1)?(Te=!0,M=H,S.lineIndent>se?ne=1:S.lineIndent===se?ne=0:S.lineIndent<se&&(ne=-1)):M=!1}if(M&&(M=Te||ce),ne===1||p===me)if(h===me||f===me?_e=se:_e=se+1,ze=S.position-S.lineStart,ne===1)if(M&&(As(S,ze)||cn(S,ze,_e))||Ln(S,_e))xe=!0;else{const ee=S.input.charCodeAt(S.position);ue!==null&&H&&!M&&ee!==124&&ee!==62&&St(S,ue,ue.position-ue.lineStart,_e)||Ae&&Sn(S,_e)||Us(S,_e)||Fs(S,_e)?xe=!0:Ct(S)?(xe=!0,(S.tag!==null||S.anchor!==null)&&U(S,"alias node should not have any properties")):wt(S,_e,h===me)&&(xe=!0,S.tag===null&&(S.tag="?")),S.anchor!==null&&Y(S,S.anchor,S.result)}else ne===0&&(xe=M&&As(S,ze));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||xe}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&&!O(be);)be=S.input.charCodeAt(++S.position);const Ae=S.input.slice(ce,S.position),M=[];for(Ae.length<1&&U(S,"directive name must not be less than one character in length");be!==0;){for(;B(be);)be=S.input.charCodeAt(++S.position);if(be===35){do be=S.input.charCodeAt(++S.position);while(be!==0&&!A(be));break}if(A(be))break;for(ce=S.position;be!==0&&!O(be);)be=S.input.charCodeAt(++S.position);M.push(S.input.slice(ce,S.position))}be!==0&&et(S),u.call(je,Ae)?je[Ae](S,Ae,M):K(S,'unknown document directive "'+Ae+'"')}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 Js(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 L(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 en(S,se,me){se!==null&&typeof se=="object"&&typeof me>"u"&&(me=se,se=null);const be=Js(S,me);if(typeof se!="function")return be;for(let ce=0,Ae=be.length;ce<Ae;ce+=1)se(be[ce])}function Di(S,se){const me=Js(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=en,t.exports.load=Di})),jX=Jt(((e,t)=>{var s=yu(),n=wu(),o=Xb(),l=Object.prototype.toString,u=Object.prototype.hasOwnProperty,h=65279,f=9,d=10,p=13,g=32,x=33,v=34,w=35,k=37,C=38,N=39,T=42,j=44,A=45,B=58,O=61,I=62,R=63,D=64,P=91,G=93,Z=96,$=123,q=124,F=125,L={};L[0]="\\0",L[7]="\\a",L[8]="\\b",L[9]="\\t",L[10]="\\n",L[11]="\\v",L[12]="\\f",L[13]="\\r",L[27]="\\e",L[34]='\\"',L[92]="\\\\",L[133]="\\N",L[160]="\\_",L[8232]="\\L",L[8233]="\\P";var X=["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 Te={},xe=Object.keys(ne);for(let ue=0,Ce=xe.length;ue<Ce;ue+=1){let _e=xe[ue],ze=String(ne[_e]);_e.slice(0,2)==="!!"&&(_e="tag:yaml.org,2002:"+_e.slice(2));const H=M.compiledTypeMap.fallback[_e];H&&u.call(H.styleAliases,ze)&&(ze=H.styleAliases[ze]),Te[_e]=ze}return Te}function Y(M){let ne,Te;const xe=M.toString(16).toUpperCase();if(M<=255)ne="x",Te=2;else if(M<=65535)ne="u",Te=4;else if(M<=4294967295)ne="U",Te=8;else throw new n("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+ne+s.repeat("0",Te-xe.length)+xe}var V=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:V,this.forceQuotes=M.forceQuotes||!1,this.replacer=typeof M.replacer=="function"?M.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function ye(M,ne){const Te=s.repeat(" ",ne);let xe=0,ue="";const Ce=M.length;for(;xe<Ce;){let _e;const ze=M.indexOf(`
|
|
200
|
-
`,xe);ze===-1?(_e=M.slice(xe),xe=Ce):(_e=M.slice(xe,ze+1),xe=ze+1),_e.length&&_e!==`
|
|
201
|
-
`&&(ue+=Te),ue+=_e}return ue}function oe(M,ne){return`
|
|
202
|
-
`+s.repeat(" ",M.indent*ne)}function je(M,ne){for(let Te=0,xe=M.implicitTypes.length;Te<xe;Te+=1)if(M.implicitTypes[Te].resolve(ne))return!0;return!1}function Ne(M){return M===g||M===f}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 De(M){return Ge(M)&&M!==h&&M!==p&&M!==d}function et(M,ne,Te){const xe=De(M),ue=xe&&!Ne(M);return(Te?xe:xe&&M!==j&&M!==P&&M!==G&&M!==$&&M!==F)&&M!==w&&!(ne===B&&!ue)||De(ne)&&!Ne(ne)&&M===w||ne===B&&ue}function ke(M){return Ge(M)&&M!==h&&!Ne(M)&&M!==A&&M!==R&&M!==B&&M!==j&&M!==P&&M!==G&&M!==$&&M!==F&&M!==w&&M!==C&&M!==T&&M!==x&&M!==q&&M!==O&&M!==I&&M!==N&&M!==v&&M!==k&&M!==D&&M!==Z}function He(M){return!Ne(M)&&M!==B}function $e(M,ne){const Te=M.charCodeAt(ne);let xe;return Te>=55296&&Te<=56319&&ne+1<M.length&&(xe=M.charCodeAt(ne+1),xe>=56320&&xe<=57343)?(Te-55296)*1024+xe-56320+65536:Te}function wt(M){return/^\n* /.test(M)}var Us=1,Fs=2,Ln=3,Sn=4,As=5;function cn(M,ne,Te,xe,ue,Ce,_e,ze){let H,ee=0,fe=null,Be=!1,rt=!1;const Mt=xe!==-1;let qe=-1,Ue=ke($e(M,0))&&He($e(M,M.length-1));if(ne||_e)for(H=0;H<M.length;ee>=65536?H+=2:H++){if(ee=$e(M,H),!Ge(ee))return As;Ue=Ue&&et(ee,fe,ze),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>xe&&M[qe+1]!==" ",qe=H);else if(!Ge(ee))return As;Ue=Ue&&et(ee,fe,ze),fe=ee}rt=rt||Mt&&H-qe-1>xe&&M[qe+1]!==" "}return!Be&&!rt?Ue&&!_e&&!ue(M)?Us:Ce===ie?As:Fs:Te>9&&wt(M)?As:_e?Ce===ie?As:Fs:rt?Sn:Ln}function un(M,ne,Te,xe,ue){M.dump=(function(){if(ne.length===0)return M.quotingType===ie?'""':"''";if(!M.noCompatMode&&(X.indexOf(ne)!==-1||U.test(ne)))return M.quotingType===ie?'"'+ne+'"':"'"+ne+"'";const Ce=M.indent*Math.max(1,Te),_e=M.lineWidth===-1?-1:Math.max(Math.min(M.lineWidth,40),M.lineWidth-Ce),ze=xe||M.flowLevel>-1&&Te>=M.flowLevel;function H(ee){return je(M,ee)}switch(cn(ne,ze,M.indent,_e,H,M.quotingType,M.forceQuotes&&!xe,ue)){case Us:return ne;case Fs:return"'"+ne.replace(/'/g,"''")+"'";case Ln:return"|"+Ie(ne,M.indent)+Ct(ye(ne,Ce));case Sn:return">"+Ie(ne,M.indent)+Ct(ye(St(ne,_e),Ce));case As:return'"'+Ft(ne)+'"';default:throw new n("impossible error: invalid scalar style")}})()}function Ie(M,ne){const Te=wt(M)?String(ne):"",xe=M[M.length-1]===`
|
|
203
|
-
`;return Te+(xe&&(M[M.length-2]===`
|
|
204
|
-
`||M===`
|
|
205
|
-
`)?"+":xe?"":"-")+`
|
|
206
|
-
`}function Ct(M){return M[M.length-1]===`
|
|
207
|
-
`?M.slice(0,-1):M}function St(M,ne){const Te=/(\n+)([^\n]*)/g;let xe=(function(){let ze=M.indexOf(`
|
|
208
|
-
`);return ze=ze!==-1?ze:M.length,Te.lastIndex=ze,Rt(M.slice(0,ze),ne)})(),ue=M[0]===`
|
|
209
|
-
`||M[0]===" ",Ce,_e;for(;_e=Te.exec(M);){const ze=_e[1],H=_e[2];Ce=H[0]===" ",xe+=ze+(!ue&&!Ce&&H!==""?`
|
|
210
|
-
`:"")+Rt(H,ne),ue=Ce}return xe}function Rt(M,ne){if(M===""||M[0]===" ")return M;const Te=/ [^ ]/g;let xe,ue=0,Ce,_e=0,ze=0,H="";for(;xe=Te.exec(M);)ze=xe.index,ze-ue>ne&&(Ce=_e>ue?_e:ze,H+=`
|
|
211
|
-
`+M.slice(ue,Ce),ue=Ce+1),_e=ze;return H+=`
|
|
212
|
-
`,M.length-ue>ne&&_e>ue?H+=M.slice(ue,_e)+`
|
|
213
|
-
`+M.slice(_e+1):H+=M.slice(ue),H.slice(1)}function Ft(M){let ne="",Te=0;for(let xe=0;xe<M.length;Te>=65536?xe+=2:xe++){Te=$e(M,xe);const ue=L[Te];!ue&&Ge(Te)?(ne+=M[xe],Te>=65536&&(ne+=M[xe+1])):ne+=ue||Y(Te)}return ne}function Js(M,ne,Te){let xe="";const ue=M.tag;for(let Ce=0,_e=Te.length;Ce<_e;Ce+=1){let ze=Te[Ce];M.replacer&&(ze=M.replacer.call(Te,String(Ce),ze)),(me(M,ne,ze,!1,!1)||typeof ze>"u"&&me(M,ne,null,!1,!1))&&(xe!==""&&(xe+=","+(M.condenseFlow?"":" ")),xe+=M.dump)}M.tag=ue,M.dump="["+xe+"]"}function en(M,ne,Te,xe){let ue="";const Ce=M.tag;for(let _e=0,ze=Te.length;_e<ze;_e+=1){let H=Te[_e];M.replacer&&(H=M.replacer.call(Te,String(_e),H)),(me(M,ne+1,H,!0,!0,!1,!0)||typeof H>"u"&&me(M,ne+1,null,!0,!0,!1,!0))&&((!xe||ue!=="")&&(ue+=oe(M,ne)),M.dump&&d===M.dump.charCodeAt(0)?ue+="-":ue+="- ",ue+=M.dump)}M.tag=Ce,M.dump=ue||"[]"}function Di(M,ne,Te){let xe="";const ue=M.tag,Ce=Object.keys(Te);for(let _e=0,ze=Ce.length;_e<ze;_e+=1){let H="";xe!==""&&(H+=", "),M.condenseFlow&&(H+='"');const ee=Ce[_e];let fe=Te[ee];M.replacer&&(fe=M.replacer.call(Te,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,xe+=H))}M.tag=ue,M.dump="{"+xe+"}"}function S(M,ne,Te,xe){let ue="";const Ce=M.tag,_e=Object.keys(Te);if(M.sortKeys===!0)_e.sort();else if(typeof M.sortKeys=="function")_e.sort(M.sortKeys);else if(M.sortKeys)throw new n("sortKeys must be a boolean or a function");for(let ze=0,H=_e.length;ze<H;ze+=1){let ee="";(!xe||ue!=="")&&(ee+=oe(M,ne));const fe=_e[ze];let Be=Te[fe];if(M.replacer&&(Be=M.replacer.call(Te,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,Te){const xe=Te?M.explicitTypes:M.implicitTypes;for(let ue=0,Ce=xe.length;ue<Ce;ue+=1){const _e=xe[ue];if((_e.instanceOf||_e.predicate)&&(!_e.instanceOf||typeof ne=="object"&&ne instanceof _e.instanceOf)&&(!_e.predicate||_e.predicate(ne))){if(Te?_e.multi&&_e.representName?M.tag=_e.representName(ne):M.tag=_e.tag:M.tag="?",_e.represent){const ze=M.styleMap[_e.tag]||_e.defaultStyle;let H;if(l.call(_e.represent)==="[object Function]")H=_e.represent(ne,ze);else if(u.call(_e.represent,ze))H=_e.represent[ze](ne,ze);else throw new n("!<"+_e.tag+'> tag resolver accepts not "'+ze+'" style');M.dump=H}return!0}}return!1}function me(M,ne,Te,xe,ue,Ce,_e){M.tag=null,M.dump=Te,se(M,Te,!1)||se(M,Te,!0);const ze=l.call(M.dump),H=xe;xe&&(xe=M.flowLevel<0||M.flowLevel>ne);const ee=ze==="[object Object]"||ze==="[object Array]";let fe,Be;if(ee&&(fe=M.duplicates.indexOf(Te),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),ze==="[object Object]")xe&&Object.keys(M.dump).length!==0?(S(M,ne,M.dump,ue),Be&&(M.dump="&ref_"+fe+M.dump)):(Di(M,ne,M.dump),Be&&(M.dump="&ref_"+fe+" "+M.dump));else if(ze==="[object Array]")xe&&M.dump.length!==0?(M.noArrayIndent&&!_e&&ne>0?en(M,ne-1,M.dump,ue):en(M,ne,M.dump,ue),Be&&(M.dump="&ref_"+fe+M.dump)):(Js(M,ne,M.dump),Be&&(M.dump="&ref_"+fe+" "+M.dump));else if(ze==="[object String]")M.tag!=="?"&&un(M,M.dump,ne,Ce,H);else{if(ze==="[object Undefined]")return!1;if(M.skipInvalid)return!1;throw new n("unacceptable kind of an object to dump "+ze)}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 Te=[],xe=[];ce(M,Te,xe);const ue=xe.length;for(let Ce=0;Ce<ue;Ce+=1)ne.duplicates.push(Te[xe[Ce]]);ne.usedDuplicates=new Array(ue)}function ce(M,ne,Te){if(M!==null&&typeof M=="object"){const xe=ne.indexOf(M);if(xe!==-1)Te.indexOf(xe)===-1&&Te.push(xe);else if(ne.push(M),Array.isArray(M))for(let ue=0,Ce=M.length;ue<Ce;ue+=1)ce(M[ue],ne,Te);else{const ue=Object.keys(M);for(let Ce=0,_e=ue.length;Ce<_e;Ce+=1)ce(M[ue[Ce]],ne,Te)}}}function Ae(M,ne){ne=ne||{};const Te=new Ee(ne);Te.noRefs||be(M,Te);let xe=M;return Te.replacer&&(xe=Te.replacer.call({"":xe},"",xe)),me(Te,0,xe,!0,!0)?Te.dump+`
|
|
214
|
-
`:""}t.exports.dump=Ae})),A5=NX(Jt(((e,t)=>{var s=EX(),n=jX();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=wn(),t.exports.Schema=h5(),t.exports.FAILSAFE_SCHEMA=g5(),t.exports.JSON_SCHEMA=y5(),t.exports.CORE_SCHEMA=w5(),t.exports.DEFAULT_SCHEMA=Xb(),t.exports.load=s.load,t.exports.loadAll=s.loadAll,t.exports.dump=n.dump,t.exports.YAMLException=wu(),t.exports.types={binary:N5(),float:_5(),map:p5(),null:x5(),pairs:E5(),set:j5(),timestamp:S5(),bool:b5(),int:v5(),merge:k5(),omap:C5(),seq:m5(),str:f5()},t.exports.safeLoad=o("safeLoad","load"),t.exports.safeLoadAll=o("safeLoadAll","loadAll"),t.exports.safeDump=o("safeDump","dump")}))()),{Type:GQ,Schema:WQ,FAILSAFE_SCHEMA:KQ,JSON_SCHEMA:YQ,CORE_SCHEMA:XQ,DEFAULT_SCHEMA:ZQ,load:QQ,loadAll:JQ,dump:eJ,YAMLException:tJ,types:sJ,safeLoad:nJ,safeLoadAll:iJ,safeDump:rJ}=A5.default,AX=A5.default;function T5(e){return e!==null&&typeof e=="object"}function R5(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 M5(e){return e==null?"null":typeof e=="string"?e===""?'""':e:String(e)}function D5({label:e,value:t,depth:s,defaultOpen:n}){const[o,l]=_.useState(n),u={paddingLeft:`${s*1.1}rem`};if(!T5(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",R5(t)),children:M5(t)})]});const h=Array.isArray(t)?t.map((d,p)=>[String(p),d]):Object.entries(t),f=Array.isArray(t)?`[${h.length}]`:`{${h.length}}`;return 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(Zn,{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:f})]}),o?h.map(([d,p])=>r.jsx(D5,{label:d,value:p,depth:s+1,defaultOpen:s<1},d)):null]})}function TX({content:e}){const t=_.useMemo(()=>{try{const n=AX.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(Ze,{variant:"destructive",children:["Could not parse YAML: ",t.error]})});if(!T5(t.value))return r.jsx("div",{className:"p-4 font-mono text-[12px]",children:r.jsx("span",{className:R5(t.value),children:M5(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(D5,{label:n,value:o,depth:0,defaultOpen:!0},n))})}const RX=_.lazy(()=>ou(()=>import("./code-editor-fZ2dpXfw.js"),[]).then(e=>({default:e.CodeEditor})));function MX(e){const t=e.split("/").pop()?.toLowerCase().split(".").pop()??"";return t==="md"||t==="mdx"||t==="markdown"?"markdown":t==="yml"||t==="yaml"?"yaml":null}function DX(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 OX(e,t){const s=e.endsWith(`
|
|
215
|
-
`)?e.slice(0,-1):e;return!t||!D0.getLanguage(t)?s.split(`
|
|
216
|
-
`).map(uN):s.split(`
|
|
217
|
-
`).map(n=>{if(!n)return"";try{return D0.highlight(n,{language:t,ignoreIllegals:!0}).value}catch{return uN(n)}})}function uN(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function LX({content:e,path:t}){const s=_.useMemo(()=>DX(t),[t]),n=_.useMemo(()=>OX(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 zX({path:e,isModified:t,onViewDiff:s,onFileSaved:n,onSendToAi:o}){const[l,u]=_.useState(null),[h,f]=_.useState(""),[d,p]=_.useState(!1),[g,x]=_.useState(null),[v,w]=_.useState(!1),[k,C]=_.useState(!1),{success:N,error:T}=us(),j=_.useMemo(()=>MX(e),[e]),[A,B]=_.useState("preview"),O=!!(l&&!l.binary&&!l.truncated),I=l?h!==l.content:!1;_.useEffect(()=>{B(j?"preview":"source"),p(!1)},[j]),_.useEffect(()=>{if(!e){u(null);return}let P=!0;return w(!0),x(null),p(!1),yO(e).then(G=>{P&&(u(G),f(G.content),w(!1))}).catch(G=>{P&&(x(G instanceof Error?G.message:String(G)),w(!1))}),()=>{P=!1}},[e]);async function R(){if(!(!e||!l||!I||k)){C(!0);try{await wO(e,h);const P={...l,content:h,size:new TextEncoder().encode(h).length};u(P),p(!1),N(`Saved ${e}.`),n?.(e)}catch(P){T(P instanceof Error?P.message:String(P))}finally{C(!1)}}}function D(){f(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:()=>B("preview"),"aria-pressed":A==="preview",className:de("flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium transition-colors",A==="preview"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"),children:[r.jsx(q0,{className:"size-3.5"}),"Preview"]}),r.jsxs("button",{type:"button",onClick:()=>B("source"),"aria-pressed":A==="source",className:de("flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium transition-colors",A==="source"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"),children:[r.jsx(PN,{className:"size-3.5"}),"Source"]})]}):null,t?r.jsx(Q,{onClick:s,size:"sm",type:"button",variant:"outline",children:"View diff"}):null,o?r.jsx(Q,{"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(Q,{disabled:!I||k,onClick:()=>{R()},size:"sm",type:"button",children:[r.jsx(sC,{}),"Apply"]}),r.jsxs(Q,{disabled:k,onClick:D,size:"sm",type:"button",variant:"outline",children:[r.jsx(Kt,{}),"Cancel"]})]}):O?r.jsxs(Q,{onClick:()=>{B("source"),p(!0)},size:"sm",type:"button",variant:"outline",children:[r.jsx(ul,{}),"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(Ze,{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(_.Suspense,{fallback:r.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading editor…"}),children:r.jsx(RX,{path:e,value:h,onChange:f})}):j&&A==="preview"?j==="markdown"?r.jsx(u5,{content:l.content}):r.jsx(TX,{content:l.content}):r.jsx(LX,{content:l.content,path:e}):null})]}):r.jsx("div",{className:"p-4",children:r.jsx(Ze,{variant:"muted",className:"border-dashed p-12 text-center",children:"Select a file to view its contents."})})}function BX({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 dN(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 hN({label:e,tree:t,onSelect:s,defaultOpen:n,forceOpen:o}){const[l,u]=_.useState(n??!1),h=o||l,f=t.children.size===0;return 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(Zn,{size:12}),e,f?null:r.jsxs("span",{className:"ml-1 text-[10px] font-normal",children:["(",t.children.size,")"]})]}),h&&!f?r.jsx("ul",{children:Array.from(t.children.values()).map(d=>r.jsx(O5,{node:d,depth:1,onSelect:s,forceOpen:o},d.fullPath))}):null]})}function O5({node:e,depth:t,onSelect:s,forceOpen:n}){const[o,l]=_.useState(!0),u=n||o,h=e.children.size>0,f=e.branch,d={paddingLeft:`${t*10}px`};return!h&&f?r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>s(f),style:d,title:f.name,className:`flex w-full items-center gap-1.5 py-0.5 pr-2 text-left text-[12px] hover:bg-muted/60 ${f.current?"font-semibold text-emerald-700":""}`,children:[r.jsx(bn,{size:11,className:"shrink-0 opacity-70"}),r.jsx("span",{className:"truncate",children:e.name}),f.current?r.jsx("span",{className:"text-[10px]",children:"●"}):null]})}):r.jsxs("li",{children:[r.jsxs("button",{type:"button",onClick:()=>{f?s(f):l(p=>!p)},style:d,className:"flex w-full items-center gap-1 py-0.5 pr-2 text-left text-[12px] hover:bg-muted/60",children:[h?u?r.jsx(vn,{size:11}):r.jsx(Zn,{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(O5,{node:p,depth:t+1,onSelect:s,forceOpen:n},p.fullPath))}):null]})}function PX({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(Ze,{variant:"destructive",children:o})}):e?n?r.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading diff…"}):s?r.jsx(fu,{activeHunkIndex:0,diff:s}):r.jsx("div",{className:"p-4",children:r.jsx(Ze,{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(Ze,{variant:"muted",className:"border-dashed p-12 text-center",children:"Select a commit to inspect its diff."})})})]})}function IX({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(Ze,{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:$X(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 $X(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 fN=["#3b82f6","#10b981","#f59e0b","#ec4899","#8b5cf6","#14b8a6","#ef4444","#84cc16"];function Ec(e){return fN[e%fN.length]}function HX({lane:e,laneCount:t,edges:s,throughLanes:n,isMerge:o,height:l=28,laneWidth:u=14}){const f=Math.max(e+1,t,1)*u,d=l/2,p=jc(e,u),g=o?4:3.5;return r.jsxs("svg",{width:f,height:l,viewBox:`0 0 ${f} ${l}`,style:{flex:"0 0 auto",display:"block"},children:[n.map(x=>r.jsx("line",{x1:jc(x,u),y1:0,x2:jc(x,u),y2:l,stroke:Ec(x),strokeWidth:1.5},`t-${x}`)),r.jsx("line",{x1:p,y1:0,x2:p,y2:d,stroke:Ec(e),strokeWidth:1.5}),s.map((x,v)=>{const w=jc(x.fromLane,u),k=jc(x.toLane,u);if(w===k)return r.jsx("line",{x1:w,y1:d,x2:k,y2:l,stroke:Ec(x.toLane),strokeWidth:1.5},`e-${v}`);const C=d+(l-d)/2;return r.jsx("path",{d:`M ${w} ${d} C ${w} ${C}, ${k} ${C}, ${k} ${l}`,fill:"none",stroke:Ec(x.toLane),strokeWidth:1.5},`e-${v}`)}),r.jsx("circle",{cx:p,cy:d,r:g,fill:Ec(e),stroke:"var(--background, #fff)",strokeWidth:1.5})]})}function jc(e,t){return e*t+t/2}const UX=5,O0=new Map,gx=new Map,L0=[];let z0=0;function mN(){for(;z0<UX&&L0.length>0;){const e=L0.shift();e&&(z0++,e())}}function FX(e){return O0.get(e)}function qX(e){const t=O0.get(e);if(t)return Promise.resolve(t);const s=gx.get(e);if(s)return s;const n=new Promise((o,l)=>{L0.push(()=>{WO(e).then(u=>{u.state!=="pending"&&O0.set(e,u),o(u)}).catch(l).finally(()=>{z0--,gx.delete(e),mN()})})});return gx.set(e,n),mN(),n}function VX({sha:e}){const[t,s]=_.useState(()=>FX(e)??null),n=_.useRef(null);if(_.useEffect(()=>{if(t)return;const u=n.current;if(!u||typeof IntersectionObserver>"u")return;let h=!0;const f=new IntersectionObserver(d=>{d.some(p=>p.isIntersecting)&&(f.disconnect(),qX(e).then(p=>{h&&s(p)}).catch(()=>{}))},{rootMargin:"200px"});return f.observe(u),()=>{h=!1,f.disconnect()}},[e,t]),!t||t.state==="unknown"||t.totalCount===0)return r.jsx("span",{ref:n,"aria-hidden":!0,className:"inline-block size-2 shrink-0"});const o=GX(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 GX(e){switch(e){case"success":return"bg-emerald-500";case"pending":return"bg-amber-400 animate-pulse";case"failure":return"bg-red-500";case"error":return"bg-orange-500";default:return"bg-zinc-400"}}const pN=28;function WX({commits:e,loading:t,error:s,selectedHash:n,maxLanes:o,rowRefs:l,onSelect:u,onLoadMore:h}){const{sendToAgent:f}=Pt(),[d,p]=_.useState(null);function g(x,v){p(null),f({prompt:O$(x,v),source:{type:"git-commit",label:x.hash.slice(0,7)},label:`${x.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(Q,{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(Ze,{variant:"destructive",children:s})}):t&&e.length===0?r.jsx("div",{className:"p-3 text-[12px] text-muted-foreground",children:"Loading commits…"}):e.length===0?r.jsx("div",{className:"p-3 text-[12px] text-muted-foreground",children:"No commits."}):r.jsx("ul",{className:"divide-y divide-border",children:e.map(x=>r.jsxs("li",{ref:v=>{v?l.current.set(x.hash,v):l.current.delete(x.hash)},className:"group flex flex-col",children:[r.jsxs("div",{className:`flex items-center transition-colors hover:bg-muted/60 ${n===x.hash?"bg-muted":""}`,children:[r.jsxs("button",{onClick:()=>u(x.hash),type:"button",className:"flex min-w-0 flex-1 items-center gap-2 px-2 py-0.5 text-left",style:{minHeight:pN},title:`${x.hash}
|
|
218
|
-
${x.author} <${x.email}>
|
|
219
|
-
${x.subject}`,children:[r.jsx(HX,{lane:x.lane,laneCount:Math.max(x.laneCount,o),edges:x.edges,throughLanes:x.throughLanes,isMerge:x.parents.length>1,height:pN}),r.jsxs("span",{className:"flex items-center gap-1 font-mono text-[10px] text-muted-foreground",children:[x.hash.slice(0,7),r.jsx(VX,{sha:x.hash})]}),r.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[x.refs.map(v=>r.jsx("span",{className:YX(v.kind),children:v.name},`${v.kind}-${v.name}`)),r.jsx("span",{className:"truncate text-[12px]",children:x.subject})]}),r.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:x.author}),r.jsx("span",{className:"shrink-0 font-mono text-[10px] tabular-nums text-muted-foreground/70",title:new Date(x.timestamp*1e3).toLocaleString(),children:KX(x.timestamp)})]}),r.jsx(Qi,{className:`mr-1 shrink-0 ${d===x.hash?"opacity-100":""}`,label:`Ask AI about commit ${x.hash.slice(0,7)}`,onAsk:()=>p(v=>v===x.hash?null:x.hash)})]}),d===x.hash?r.jsx("div",{className:"px-2 pb-1.5 pt-0.5",children:r.jsx(Rr,{placeholder:"What should the agent do with this commit? (explain, summarize, find regressions…)",onSubmit:v=>g(x,v),onCancel:()=>p(null)})}):null]},x.hash))})})]})}function KX(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 YX(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 gN=200;function XX(){const[e,t]=_.useState([]),[s,n]=_.useState(gN),[o,l]=_.useState(0),[u,h]=_.useState(!0),[f,d]=_.useState(null),[p,g]=_.useState(null),[x,v]=_.useState([]),[w,k]=_.useState(!1),[C,N]=_.useState(null),[T,j]=_.useState(null),[A,B]=_.useState(""),[O,I]=_.useState(!1),[R,D]=_.useState(null),P=_.useCallback($=>{g($),v([]),j(null),B("")},[]);_.useEffect(()=>{let $=!0;return h(!0),d(null),gO(s).then(q=>{$&&(t(q),q.length>0&&!q.some(F=>F.hash===p)&&P(q[0].hash))}).catch(q=>{$&&d(q instanceof Error?q.message:String(q))}).finally(()=>{$&&h(!1)}),()=>{$=!1}},[s,o]),_.useEffect(()=>{if(!p){v([]),j(null),k(!1);return}let $=!0;return N(null),k(!0),bO(p).then(q=>{$&&(v(q),j(q[0]?.path??null))}).catch(q=>{$&&N(q instanceof Error?q.message:String(q))}).finally(()=>{$&&k(!1)}),()=>{$=!1}},[p]),_.useEffect(()=>{if(!p||!T){B(""),I(!1);return}let $=!0;return D(null),I(!0),xO(p,T).then(q=>{$&&B(q)}).catch(q=>{$&&D(q instanceof Error?q.message:String(q))}).finally(()=>{$&&I(!1)}),()=>{$=!1}},[p,T]);const G=_.useMemo(()=>e.reduce(($,q)=>Math.max($,q.laneCount),1),[e]),Z=e.find($=>$.hash===p)??null;return{commits:e,loading:u,error:f,selectedHash:p,setSelectedHash:P,files:x,filesError:C,selectedFile:T,setSelectedFile:j,diff:A,diffLoading:O||w,diffError:R,maxLanes:G,selectedCommit:Z,loadMore:()=>n($=>$+gN),refresh:()=>l($=>$+1)}}function ZX({branches:e=[]}){const{commits:t,loading:s,error:n,selectedHash:o,setSelectedHash:l,files:u,filesError:h,selectedFile:f,setSelectedFile:d,diff:p,diffLoading:g,diffError:x,maxLanes:v,selectedCommit:w,loadMore:k,refresh:C}=XX();vl(C);const[N,T]=_.useState(""),j=_.useMemo(()=>{const D=N.trim().toLowerCase();return D?e.filter(P=>P.name.toLowerCase().includes(D)):e},[e,N]),A=_.useMemo(()=>dN(j.filter(D=>!D.remote)),[j]),B=_.useMemo(()=>dN(j.filter(D=>D.remote)),[j]),O=N.trim().length>0,I=_.useRef(new Map);function R(D){const P=D.remote?"remote":"branch",G=t.find(q=>q.refs.some(F=>F.kind===P&&F.name===D.name));if(!G)return;l(G.hash);const Z=I.current.get(G.hash),$=Z?.parentElement?.parentElement;!Z||!$||$.scrollTo({top:Math.max(Z.offsetTop-$.clientHeight/2+Z.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:N,onChange:D=>T(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(hN,{label:"Local",tree:A,onSelect:R,defaultOpen:!0,forceOpen:O}),r.jsx(hN,{label:"Remote",tree:B,onSelect:R,forceOpen:O})]})]}),r.jsxs("div",{className:"grid min-h-0 min-w-0 grid-rows-[minmax(0,3fr)_minmax(0,2fr)]",children:[r.jsx(PX,{selectedCommit:w,selectedFile:f,diff:p,diffLoading:g,diffError:x}),r.jsxs("div",{className:"grid min-h-0 min-w-0 grid-cols-[minmax(0,1fr)_280px]",children:[r.jsx(WX,{commits:t,loading:s,error:n,selectedHash:o,maxLanes:v,rowRefs:I,onSelect:l,onLoadMore:k}),r.jsx(IX,{files:u,filesError:h,selectedHash:o,selectedFile:f,onSelect:d})]})]})]})}function QX({repo:e,file:t,onClose:s}){const[n,o]=_.useState(""),[l,u]=_.useState(null),[h,f]=_.useState(!0);_.useEffect(()=>{let p=!0;return f(!0),u(null),yC(t,e).then(g=>{p&&o(g)}).catch(g=>{p&&u(g instanceof Error?g.message:String(g))}).finally(()=>{p&&f(!1)}),()=>{p=!1}},[e,t]),_.useEffect(()=>{function p(g){g.key==="Escape"&&s()}return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[s]);const d=Nb(n);return ka.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(Q,{"aria-label":"Close diff",onClick:s,size:"icon",variant:"ghost",children:r.jsx(Kt,{})})]}),r.jsx("div",{className:"relative min-h-0 min-w-0 flex-1",children:l?r.jsx("div",{className:"p-4",children:r.jsx(Ze,{variant:"destructive",children:l})}):h?r.jsx("div",{className:"p-4 text-xs text-muted-foreground",children:"Loading diff…"}):r.jsx(fu,{diff:n||"No unstaged diff for this file."})})]})]}),document.body)}function B0(e){return e.split(/[\\/]/).filter(Boolean).pop()??"project"}function JX({initialPath:e,onSelect:t,selectedPath:s}){const[n,o]=_.useState(e),[l,u]=_.useState(e),[h,f]=_.useState(null),[d,p]=_.useState(null),[g,x]=_.useState(!1),v=eZ(h);return _.useEffect(()=>{o(e)},[e]),_.useEffect(()=>{h&&u(h.path)},[h]),_.useEffect(()=>{let w=!0;return x(!0),p(null),AC(n).then(k=>{w&&(f(k),t(k.path))}).catch(k=>{w&&p(k instanceof Error?k.message:String(k))}).finally(()=>{w&&x(!1)}),()=>{w=!1}},[n,t]),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:[v?r.jsx(Q,{"aria-label":"Open parent folder",onClick:()=>h&&o(h.parent),size:"icon",type:"button",variant:"ghost",children:r.jsx(vn,{className:"rotate-90"})}):null,r.jsx(ht,{"aria-label":"Folder path",className:"h-7 min-w-0 flex-1 font-mono text-xs",onChange:w=>u(w.target.value),onKeyDown:w=>{if(w.key==="Enter"){w.preventDefault();const k=l.trim();k&&o(k)}},spellCheck:!1,value:l}),g?r.jsx(Et,{className:"size-4 shrink-0 animate-spin text-muted-foreground"}):null]}),r.jsxs("div",{className:"max-h-56 overflow-auto p-1",children:[d?r.jsx(Ze,{variant:"destructive",className:"m-1",children:d}):null,!d&&h?.entries.length===0?r.jsx(Ze,{variant:"muted",className:"m-1 text-center",children:"No folders here."}):null,h?.entries.map(w=>r.jsxs(Q,{className:de("h-8 w-full justify-start rounded-sm px-2 text-left",s===w.path&&"bg-muted"),onClick:()=>o(w.path),title:w.path,type:"button",variant:"ghost",children:[r.jsx(va,{className:"text-accent"}),r.jsx("span",{className:"truncate",children:w.name})]},w.path))]})]})}function eZ(e){return!!(e&&e.parent!==e.path)}function tZ({data:e,onRefresh:t}){const[s,n]=_.useState(!1),[o,l]=_.useState("path"),[u,h]=_.useState(e.git.cwd),[f,d]=_.useState(""),[p,g]=_.useState(!1),[x,v]=_.useState(null),[w,k]=_.useState(!1),[C,N]=_.useState(e.git.cwd),T=_.useRef(null),j=e.git.selectedRepository,A=j?.name??(e.git.cwd?B0(e.git.cwd):"Add Git project"),{error:B,success:O}=us(),I=nZ({gitCwd:e.git.cwd});_.useEffect(()=>{h(e.git.cwd),N(e.git.cwd)},[e.git.cwd]),_.useEffect(()=>{if(!s)return;function q(F){T.current&&F.target instanceof Node&&!T.current.contains(F.target)&&n(!1)}return document.addEventListener("mousedown",q),()=>document.removeEventListener("mousedown",q)},[s]);async function R(q){try{await CO(q),n(!1),await t(),O(`Switched to ${q}.`)}catch(F){B(F instanceof Error?F.message:String(F))}}async function D(q){const F=q.trim();if(!sZ(F)){const L="Please add an absolute path. Paths beginning with ~ are not expanded here.";return v(L),B(L),!1}try{const L=B0(F);return await EO(L,F),v(null),await t(),O(`Added Git project ${L}.`),!0}catch(L){const X=L instanceof Error?L.message:String(L);return v(X),B(X),!1}}async function P(q){try{await NO(q),await t(),O(`Removed Git project ${q}.`)}catch(F){B(F instanceof Error?F.message:String(F))}}async function G(q){q.preventDefault(),await D(u)&&n(!1)}async function Z(q){q.preventDefault();const F=f.trim();if(F){g(!0),v(null);try{const{name:L}=await jO(F);d(""),await t(),O(`Cloned and added ${L}.`),n(!1)}catch(L){const X=L instanceof Error?L.message:String(L);v(X),B(X)}finally{g(!1)}}}function $(){v(null),N(I.selectedPath),k(!0)}return r.jsxs("div",{className:"relative z-50 flex items-center gap-2",ref:T,children:[r.jsxs(Q,{className:"max-w-[220px] justify-start gap-2 rounded-md border-border bg-card",onClick:()=>n(q=>!q),size:"sm",type:"button",variant:"outline",children:[r.jsx(va,{className:"text-muted-foreground"}),r.jsx("span",{className:"truncate",children:A}),r.jsx(vn,{className:de("ml-auto transition-transform",s&&"rotate-180")})]}),r.jsx(Q,{"aria-label":"Add Git project",onClick:$,size:"sm",type:"button",variant:"outline",children:r.jsx(bs,{})}),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(lR,{className:"size-3.5 text-muted-foreground"}),r.jsx("div",{className:"text-xs font-semibold",children:"Git Projects"}),r.jsx(Xe,{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(q=>{const F=q.name===j?.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",F&&"bg-muted/70"),children:[r.jsxs("button",{className:"min-w-0 text-left",onClick:()=>{R(q.name)},type:"button",children:[r.jsx("span",{className:"block truncate text-sm font-medium leading-tight",children:q.name}),r.jsx("span",{className:"block truncate font-mono text-[10px] leading-tight text-muted-foreground",children:q.path})]}),F?r.jsx(ln,{className:"size-3.5"}):r.jsx("span",{className:"size-3.5"}),r.jsx(Q,{"aria-label":`Remove ${q.name}`,className:"size-6 opacity-0 transition-opacity group-hover:opacity-100",onClick:()=>{P(q.name)},size:"icon",title:`Remove ${q.name}`,type:"button",variant:"ghost",children:r.jsx(gi,{className:"size-3.5 text-destructive"})})]},q.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("div",{className:"mb-1.5 flex gap-1 text-[11px]",children:[r.jsxs("button",{className:de("flex items-center gap-1 rounded px-2 py-0.5 transition-colors",o==="path"?"bg-muted font-medium text-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>{l("path"),v(null)},type:"button",children:[r.jsx(va,{className:"size-3"}),"Local path"]}),r.jsxs("button",{className:de("flex items-center gap-1 rounded px-2 py-0.5 transition-colors",o==="url"?"bg-muted font-medium text-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>{l("url"),v(null)},type:"button",children:[r.jsx(cl,{className:"size-3"}),"Clone URL"]})]}),o==="path"?r.jsxs("form",{className:"flex gap-1.5",onSubmit:G,children:[r.jsx(ht,{"aria-label":"Paste absolute path",className:"h-7 flex-1 px-2 font-mono text-[11px]",onChange:q=>{h(q.target.value),v(null)},placeholder:"/absolute/path",value:u}),r.jsxs(Q,{className:"h-7 px-2 text-[11px]",size:"sm",type:"submit",children:[r.jsx(bs,{className:"size-3"}),"Add"]}),r.jsx(Q,{"aria-label":"Browse and add Git project",className:"h-7 px-2",onClick:$,size:"sm",type:"button",variant:"outline",children:r.jsx(VN,{className:"size-3"})})]}):r.jsxs("form",{className:"flex gap-1.5",onSubmit:Z,children:[r.jsx(ht,{"aria-label":"Git remote URL",className:"h-7 flex-1 px-2 font-mono text-[11px]",onChange:q=>{d(q.target.value),v(null)},placeholder:"https://… or git@host:owner/repo.git",value:f}),r.jsxs(Q,{className:"h-7 px-2 text-[11px]",disabled:p||!f.trim(),size:"sm",type:"submit",children:[r.jsx(cl,{className:"size-3"}),p?"Cloning…":"Clone"]})]}),x?r.jsx("div",{className:"mt-1.5 truncate text-[10px] text-destructive",children:x}):null,o==="url"?r.jsx("div",{className:"mt-1 text-[10px] text-muted-foreground",children:"Private github.com repos reuse your GitHub login; SSH uses your machine's keys. Clones into ~/.nomoreide/repos."}):null]})]}):null,w?r.jsx(L5,{confirmLabel:I.confirmLabel,errorMessage:x,initialPath:I.initialPath,selectedPath:C,title:"Add Git Project",onCancel:()=>k(!1),onSelect:N,onUse:async()=>{await D(C)&&(k(!1),n(!1))}}):null]})}function sZ(e){return e.startsWith("/")}function nZ({gitCwd:e}){return{confirmLabel:"Add Git project",initialPath:e,selectedPath:e}}function L5({confirmLabel:e="Use this folder",errorMessage:t,initialPath:s,onCancel:n,onSelect:o,onUse:l,selectedPath:u,title:h="Choose Git Project Folder"}){return ka.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(va,{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(Q,{"aria-label":"Close folder picker",onClick:n,size:"icon",variant:"ghost",children:r.jsx(Kt,{})})]}),r.jsx(JX,{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(Q,{onClick:n,type:"button",variant:"outline",children:"Cancel"}),r.jsx(Q,{onClick:()=>{l()},type:"button",children:e})]})]})}),document.body)}const Ac=5,iZ=240,P0=8,rZ=176+P0;function aZ({currentRepoPath:e}){const[t,s]=_.useState(null),[n,o]=_.useState([]),[l,u]=_.useState(null),[h,f]=_.useState(!0),[d,p]=_.useState(null),g=_.useRef(null),x=_.useRef(null),[v,w]=_.useState(0);_.useEffect(()=>{const $=x.current;if(!$)return;const q=new ResizeObserver(F=>{w(F[0].contentRect.width)});return q.observe($),()=>q.disconnect()},[t]);const k=_.useCallback(()=>{let $=!0;return f(!0),u(null),Vp().then(q=>{$&&(s(q.repos),o(q.board))}).catch(q=>{$&&u(q instanceof Error?q.message:String(q))}).finally(()=>{$&&f(!1)}),()=>{$=!1}},[]);_.useEffect(k,[k]);const C=_.useCallback(()=>{Vp().then($=>{s($.repos),o($.board)}).catch($=>{u($ instanceof Error?$.message:String($))})},[]),N=_.useCallback($=>{o($),sw($).catch(q=>{u(q instanceof Error?q.message:String(q))})},[]),T=_.useCallback(async $=>{const q=$.trim();if(!q.startsWith("/"))return"Please add an absolute path (it must start with /).";try{const F=B0(q);await Ri("/api/git/repositories",{name:F,path:q});const L=await Vp();s(L.repos);const X=(L.board.includes(F)?L.board:[...L.board,F]).slice(0,Ac);return o(X),await sw(X),null}catch(F){return F instanceof Error?F.message:String(F)}},[]),j=new Map((t??[]).map($=>[$.name,$])),A=n.map($=>j.get($)).filter($=>!!$).slice(0,Ac),B=(t??[]).filter($=>!n.includes($.name)),O=A.length<Ac,I=Math.max(0,v-(O?rZ:0)),R=v===0?Ac:Math.max(1,Math.floor((I+P0)/(iZ+P0))),D=Math.min(A.length,R),P=A.slice(0,D),G=A.length-D;function Z($){const q=g.current;if(g.current=null,q===null||q===$)return;const F=[...n],[L]=F.splice(q,1);F.splice($,0,L),N(F)}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(G0,{className:"size-3.5"}),"Repositories",t?r.jsxs(Xe,{variant:"secondary",className:"ml-1",children:[A.length,t.length>A.length?` / ${t.length}`:""]}):null,G>0?r.jsxs("span",{className:"ml-1 text-[10px] font-normal text-muted-foreground",children:["+",G," hidden — widen the window or remove one"]}):null]}),r.jsxs(Q,{"aria-label":"Refresh repositories",disabled:h,onClick:k,size:"sm",type:"button",variant:"outline",children:[r.jsx(Tr,{className:h?"animate-spin":void 0}),"Refresh"]})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:l?r.jsx(Ze,{variant:"destructive",className:"m-3",children:l}):t&&t.length===0?r.jsx(Ze,{variant:"muted",className:"m-3 text-center",children:"No Git projects registered. Add one with the project picker in the header."}):r.jsxs("div",{className:"flex h-full min-h-0 gap-2 p-2",ref:x,children:[P.map(($,q)=>r.jsx(oZ,{repo:$,isCurrent:!!e&&$.path===e,selectedFile:d?.repo===$.name?d.file:"",onSelectFile:F=>p({repo:$.name,file:F}),onRemove:()=>N(n.filter(F=>F!==$.name)),onMutated:C,onDragStart:()=>{g.current=q},onDropColumn:()=>Z(q)},$.name)),O?r.jsx(lZ,{unpinned:B,onAdd:$=>N([...n,$].slice(0,Ac)),onRegister:T}):null]})}),d?r.jsx(QX,{repo:d.repo,file:d.file,onClose:()=>p(null)}):null]})}function oZ({repo:e,isCurrent:t,selectedFile:s,onSelectFile:n,onRemove:o,onMutated:l,onDragStart:u,onDropColumn:h}){const[f,d]=_.useState(!1),[p,g]=_.useState(!1),[x,v]=_.useState(!1),w=_.useCallback(async(T,j)=>{if(j.length){g(!0);try{await T(j,e.name),l()}finally{g(!1)}}},[e.name,l]),k={busy:p,onStage:T=>{w(K0,T)},onUnstage:T=>{w(wC,T)}},C=e.files.filter(T=>T.index.trim()&&T.index!=="?").length,N=x?vn:Zn;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",f&&"ring-2 ring-foreground/40"),onDragOver:T=>{T.preventDefault(),d(!0)},onDragLeave:()=>d(!1),onDrop:()=>{d(!1),h()},children:[r.jsxs("div",{className:"flex shrink-0 cursor-grab items-center justify-between gap-1 border-b border-border bg-muted/40 px-1.5 py-1.5 active:cursor-grabbing",draggable:!0,onDragStart:u,children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[r.jsx(HR,{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(ln,{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(uf,{className:"size-3"}),e.ahead]}):null,e.behind?r.jsxs("span",{className:"flex items-center",title:`${e.behind} behind`,children:[r.jsx(cf,{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(Kt,{className:"size-3.5"})})]})]}),r.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:r.jsx(o5,{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":x,className:"flex w-full items-center gap-1.5 bg-muted/40 px-2 py-1 text-left text-[11px] font-semibold uppercase tracking-tight text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:()=>v(T=>!T),type:"button",children:[r.jsx(N,{className:"size-3.5 shrink-0"}),r.jsx("span",{className:"flex-1",children:"Commit"}),C?r.jsxs(Xe,{size:"small",variant:"secondary",children:[C," staged"]}):null]}),x?r.jsx(l5,{branch:e.branch||void 0,files:e.files,onDone:l,repo:e.name}):null]})]})}function lZ({unpinned:e,onAdd:t,onRegister:s}){const[n,o]=_.useState(!1),[l,u]=_.useState(null),[h,f]=_.useState(""),[d,p]=_.useState(null),[g,x]=_.useState(!1),[v,w]=_.useState(!1),[k,C]=_.useState(""),N=_.useRef(null),T=_.useRef(null);function j(){if(n){o(!1);return}u(N.current?.getBoundingClientRect()??null),p(null),o(!0)}_.useEffect(()=>{if(!n)return;function O(I){const R=I.target;R instanceof Node&&(T.current?.contains(R)||N.current?.contains(R)||o(!1))}return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[n]);async function A(O){x(!0),p(null);const I=await s(O);return x(!1),I?(p(I),!1):(f(""),o(!1),!0)}async function B(O){O.preventDefault(),await A(h)}return r.jsxs("div",{className:"w-44 shrink-0",children:[r.jsxs("button",{ref:N,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(bs,{className:"size-5"}),r.jsx("span",{className:"text-[12px] font-medium",children:"Add repository"})]}),n&&l?ka.createPortal(r.jsxs("div",{ref:T,className:"fixed z-[1000] w-72 overflow-hidden rounded-lg border border-border bg-card shadow-xl",style:{left:Math.max(8,Math.min(l.left,window.innerWidth-296)),top:Math.min(l.top,window.innerHeight-320)},children:[e.length?r.jsxs("div",{className:"border-b border-border",children:[r.jsx("div",{className:"px-3 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Pin a registered repo"}),r.jsx("div",{className:"max-h-52 overflow-auto pb-1",children:e.map(O=>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(O.name),o(!1)},type:"button",children:[r.jsx(G0,{className:"size-3.5 shrink-0 text-muted-foreground"}),r.jsx("span",{className:"min-w-0 flex-1 truncate",title:O.path,children:O.name}),O.files.length?r.jsx(Xe,{variant:"outline",className:"h-5 px-1.5 text-[10px]",children:O.files.length}):null]},O.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:B,children:[r.jsx(ht,{"aria-label":"Repository absolute path",className:"h-7 flex-1 px-2 font-mono text-[11px]",onChange:O=>{f(O.target.value),p(null)},placeholder:"/absolute/path/to/repo",value:h}),r.jsx(Q,{className:"h-7 px-2 text-[11px]",disabled:g||!h.trim(),size:"sm",type:"submit",children:"Add"})]}),r.jsxs(Q,{className:"mt-1.5 h-7 w-full gap-1.5 text-[11px]",disabled:g,onClick:()=>{C(h.trim()||""),w(!0)},size:"sm",type:"button",variant:"outline",children:[r.jsx(VN,{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(L5,{confirmLabel:"Add repository",errorMessage:d,initialPath:k||"/",selectedPath:k,title:"Add Repository",onCancel:()=>w(!1),onSelect:C,onUse:async()=>{await A(k)&&w(!1)}}):null]})}const I0=300,cZ=600,uZ=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 dZ(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:!uZ.has(t.slice(s+1))}function hZ(e){return e>=cZ?"danger":e>=I0?"warn":"ok"}const fZ={ok:"bg-emerald-500/60",warn:"bg-amber-500/70",danger:"bg-destructive/70"},mZ={ok:"text-muted-foreground",warn:"text-amber-600 dark:text-amber-400",danger:"text-destructive"};function pZ({onOpenFile:e,root:t}){const[s,n]=_.useState([]),[o,l]=_.useState(!0),[u,h]=_.useState(null),[f,d]=_.useState(!0);function p(){l(!0),h(null),_O().then(n).catch(k=>h(k instanceof Error?k.message:String(k))).finally(()=>l(!1))}_.useEffect(()=>{p()},[]);const g=_.useMemo(()=>f?s.filter(k=>dZ(k.path)):s,[s,f]),x=s.length-g.length,v=g[0]?.lines??1,w=g.filter(k=>k.lines>=I0).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(FN,{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 ",I0," lines",f&&x>0?` · ${x} data/docs hidden`:""]}):null]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsxs(Q,{size:"sm",variant:f?"default":"outline",className:"h-7",onClick:()=>d(k=>!k),title:"Hide docs, data, config and generated files",type:"button",children:[r.jsx(PN,{}),"Code only"]}),r.jsxs(Q,{size:"sm",variant:"outline",className:"h-7",onClick:p,disabled:o,type:"button",children:[o?r.jsx(Et,{className:"animate-spin"}):r.jsx(Tr,{}),"Refresh"]})]})]}),u?r.jsx(Ze,{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,C)=>{const N=hZ(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:C+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",mZ[N]),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",fZ[N]),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(gZ,{file:k,root:t}),r.jsx(xZ,{file:k,root:t})]})]},k.path)})})]})}function gZ({file:e,root:t}){const{sendToAgent:s}=Pt(),n=pu(t,e.path),o=e.path.split("/").pop()??e.path;function l(){s({prompt:D$({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(z5,{label:`AI actions for ${e.path}`,trigger:r.jsx(Gt,{className:"size-3.5"}),children:h=>r.jsxs(r.Fragment,{children:[r.jsx(Kc,{icon:r.jsx(Gt,{className:"size-3.5"}),onSelect:()=>{h(),l()},children:"Ask AI to split this file"}),r.jsx(Kc,{icon:r.jsx(HN,{className:"size-3.5"}),onSelect:()=>{h(),u()},children:"Send file path to AI"})]})})}function xZ({file:e,root:t}){const{error:s,success:n}=us(),o=pu(t,e.path),l=e.path.split("/").pop()??e.path;async function u(h,f){try{await navigator.clipboard.writeText(h),n(`Copied ${f}.`)}catch(d){s(d instanceof Error?d.message:`Could not copy ${f}.`)}}return r.jsx(z5,{label:`Copy path for ${e.path}`,trigger:r.jsxs(r.Fragment,{children:[r.jsx(IN,{className:"size-3.5"}),r.jsx("span",{className:"sr-only",children:"More actions"})]}),children:h=>r.jsxs(r.Fragment,{children:[r.jsx(Kc,{icon:r.jsx(V0,{className:"size-3.5"}),onSelect:()=>{h(),u(l,"file name")},children:"Copy file name"}),r.jsx(Kc,{icon:r.jsx(Th,{className:"size-3.5"}),onSelect:()=>{h(),u(e.path,"relative path")},children:"Copy relative path"}),r.jsx(Kc,{icon:r.jsx(Th,{className:"size-3.5"}),onSelect:()=>{h(),u(o,"absolute path")},children:"Copy absolute path"})]})})}function z5({children:e,label:t,trigger:s}){const[n,o]=_.useState(!1),[l,u]=_.useState({right:0,top:0}),h=_.useRef(null),f=_.useRef(null);function d(){o(!1)}function p(){const g=h.current?.getBoundingClientRect();g&&u({top:g.bottom+6,right:window.innerWidth-g.right}),o(x=>!x)}return _.useEffect(()=>{if(!n)return;function g(v){const w=v.target;h.current?.contains(w)||f.current?.contains(w)||d()}function x(v){v.key==="Escape"&&d()}return document.addEventListener("mousedown",g),document.addEventListener("keydown",x),window.addEventListener("scroll",d,!0),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",x),window.removeEventListener("scroll",d,!0)}},[n]),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?ka.createPortal(r.jsx("div",{className:"fixed z-50 w-56 overflow-hidden rounded-md border border-border bg-card p-1 shadow-md",ref:f,style:{top:l.top,right:l.right},children:e(d)}),document.body):null]})}function Kc({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 xN(e,t,s){const n=e.trim(),o=n.toLowerCase(),l=[],u=/\breview|check|inspect|audit\b/.test(o),h=/\btest|verify|ci\b/.test(o),f=/\bcommit\b/.test(o)||/\bship|push|pr|pull request\b/.test(o),d=/\bpush|ship|pr|pull request\b/.test(o),p=/\bpr\b|pull request/.test(o),g=vZ(o,s);return p&&l.push({kind:"action",id:"assert-pr-branch",title:"Check PR branch",op:"assert-pr-branch"}),u&&(l.push(ch("gate-review","Approve review","Review the current changes?")),l.push(Tc("review","Review changes","Review the current git changes. Summarize risks, likely bugs, and anything that should change before committing.",uh(g,["skills","mcpServers"])))),h&&l.push(Tc("verify","Run verification","Run the relevant tests or checks for this repository. If something fails, stop and explain the failure.",uh(g,["skills","mcpServers","plugins"]))),f&&(l.push(Tc("commit-message","Generate commit message","Stage the appropriate changed files, inspect the staged diff briefly, and draft one conventional commit message. Do not commit.",uh(g,["skills"]))),l.push(ch("gate-commit","Approve commit","Commit with this generated message?")),l.push({kind:"action",id:"commit",title:"Commit with approved message",op:"commit"})),d&&(l.push(ch("gate-push","Approve push",p?"Push and continue toward a PR?":"Push this branch?")),l.push({kind:"action",id:"push",title:"Push branch",op:"push"})),p&&(l.push(Tc("open-pr","Open PR","Open a pull request for the current branch. Use the latest commit subject as the title and summarize the commit list in the body.",uh(g,["mcpServers","plugins"]))),l.push({kind:"action",id:"checkout-default-and-pull",title:"Return to default branch",op:"checkout-default-and-pull"})),l.length||(l.push(ch("gate-start","Approve start","Run this workflow?")),l.push(Tc("ai-step","AI step",n||"Complete this workflow step.",g))),{id:yZ(B5(bN(o))||"custom-workflow",t),name:bN(o),description:n||"Custom AI-authored workflow.",builtin:!1,steps:_Z(l)}}function bZ(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 bN(e){const t=/\breview|check|inspect|audit\b/.test(e),s=/\bcommit\b|\bship|push|pr|pull request\b/.test(e),n=/\bpr\b|pull request/.test(e),o=/\btest|verify|ci\b/.test(e);return t&&s&&n?"Review, Commit & PR":o&&s&&n?"Verify, Commit & PR":t&&s?"Review & Commit":s&&n?"Commit & PR":s?"Commit workflow":t?"Review workflow":"Custom workflow"}function ch(e,t,s){return{kind:"gate",id:e,title:t,message:s}}function Tc(e,t,s,n,o){return{kind:"agent",id:e,title:t,prompt:s,capabilities:Zb(n),verify:o}}function vZ(e,t){return Zb({skills:t.skills.filter(s=>e.includes(s.toLowerCase())),mcpServers:t.mcpServers.filter(s=>e.includes(s.toLowerCase())),plugins:t.plugins.filter(s=>e.includes(s.toLowerCase())),hooks:t.hooks.filter(s=>e.includes(s.toLowerCase()))})??{}}function uh(e,t){const s={};for(const n of t){const o=e[n];o?.length&&(s[n]=o)}return Zb(s)}function Zb(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 _Z(e){const t=new Map;return e.map(s=>{const n=B5(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 yZ(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 B5(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}const af={"error-incident":"Error incident","service-crash":"Service crash"};function wZ({workflows:e}){const{triggers:t,pending:s,error:n,saveTrigger:o,removeTrigger:l,runPending:u,dismissPending:h}=UU(),[f,d]=_.useState(!1),p=g=>e.find(x=>x.id===g)?.name??g;return r.jsxs("section",{className:"border-t border-border px-4 py-3",children:[r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsxs("div",{children:[r.jsxs("h3",{className:"flex items-center gap-1.5 text-[12px] font-semibold",children:[r.jsx(uC,{className:"size-3.5 text-amber-500"})," Triggers"]}),r.jsx("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:"Run a workflow automatically when an error or crash is detected."})]}),r.jsxs(Q,{onClick:()=>d(g=>!g),size:"sm",type:"button",variant:"outline",children:[r.jsx(bs,{className:"size-3.5"})," Add trigger"]})]}),n?r.jsx("p",{className:"mt-2 text-[11px] text-destructive",children:n}):null,s.length>0?r.jsx("div",{className:"mt-3 space-y-1.5",children:s.map(g=>r.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-amber-500/40 bg-amber-500/5 px-2.5 py-1.5",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"truncate text-[11px] font-medium",children:[p(g.workflowId),r.jsxs("span",{className:"ml-1.5 text-muted-foreground",children:["· ",af[g.event]]})]}),r.jsx("div",{className:"truncate text-[10px] text-muted-foreground",children:g.summary})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[r.jsxs(Q,{onClick:()=>u(g),size:"sm",type:"button",variant:"outline",children:[r.jsx(er,{className:"size-3"})," Run"]}),r.jsx(Q,{onClick:()=>{h(g.id)},size:"icon",type:"button",variant:"ghost","aria-label":"Dismiss",children:r.jsx(Kt,{className:"size-3.5"})})]})]},g.id))}):null,f?r.jsx(SZ,{workflows:e,onCancel:()=>d(!1),onSave:async g=>{await o(g),d(!1)}}):null,r.jsxs("div",{className:"mt-3 space-y-1.5",children:[t.length===0&&!f?r.jsx("p",{className:"text-[11px] text-muted-foreground/70",children:"No triggers yet."}):null,t.map(g=>r.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-border px-2.5 py-1.5",children:[r.jsxs("label",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("input",{checked:g.enabled,className:"size-3.5 accent-primary",onChange:x=>{o({...g,enabled:x.target.checked})},type:"checkbox"}),r.jsxs("span",{className:"min-w-0 truncate text-[11px]",children:[r.jsx("span",{className:"font-medium",children:af[g.event]}),g.filter?r.jsxs("span",{className:"text-muted-foreground",children:[" · “",g.filter,"”"]}):null,r.jsxs("span",{className:"text-muted-foreground",children:[" → ",p(g.workflowId)]}),g.autoRun?r.jsx("span",{className:"ml-1.5 rounded bg-amber-500/15 px-1 py-px text-[9px] font-semibold uppercase text-amber-600",children:"auto"}):null]})]}),r.jsx(Q,{onClick:()=>{l(g.id)},size:"icon",type:"button",variant:"ghost","aria-label":"Delete trigger",children:r.jsx(gi,{className:"size-3.5"})})]},g.id))]})]})}function SZ({workflows:e,onCancel:t,onSave:s}){const[n,o]=_.useState("error-incident"),[l,u]=_.useState(e[0]?.id??""),[h,f]=_.useState(""),[d,p]=_.useState(!1),g="rounded border border-border bg-background px-2 py-1 text-[11px] outline-none focus:border-primary";return r.jsxs("div",{className:"mt-3 space-y-2 rounded-md border border-border bg-background p-3",children:[r.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[r.jsxs("label",{className:"flex flex-col gap-1 text-[10px] font-medium text-muted-foreground",children:["When",r.jsx("select",{className:g,value:n,onChange:x=>o(x.target.value),children:Object.keys(af).map(x=>r.jsx("option",{value:x,children:af[x]},x))})]}),r.jsxs("label",{className:"flex flex-col gap-1 text-[10px] font-medium text-muted-foreground",children:["Run workflow",r.jsx("select",{className:g,value:l,onChange:x=>u(x.target.value),children:e.map(x=>r.jsx("option",{value:x.id,children:x.name},x.id))})]})]}),r.jsxs("label",{className:"flex flex-col gap-1 text-[10px] font-medium text-muted-foreground",children:["Only when the service name / message contains (optional)",r.jsx("input",{className:g,value:h,onChange:x=>f(x.target.value),placeholder:"e.g. api",type:"text"})]}),r.jsxs("label",{className:"flex w-fit items-center gap-1.5 text-[11px] text-muted-foreground",children:[r.jsx("input",{checked:d,className:"size-3.5 accent-primary",onChange:x=>p(x.target.checked),type:"checkbox"}),"Start automatically (otherwise it waits for one click)"]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[r.jsx(Q,{onClick:t,size:"sm",type:"button",variant:"ghost",children:"Cancel"}),r.jsx(Q,{disabled:!l,onClick:()=>{s({id:`trigger-${Date.now().toString(36)}`,event:n,workflowId:l,filter:h.trim()||void 0,enabled:!0,autoRun:d})},size:"sm",type:"button",children:"Add"})]})]})}function kZ(){const{run:e,start:t,resume:s,approve:n,skip:o,stop:l,dismiss:u}=X3(),[h,f]=_.useState([]),[d,p]=_.useState(null),[g,x]=_.useState(null),[v,w]=_.useState(null),[k,C]=_.useState(!0),[N,T]=_.useState(!1),[j,A]=_.useState(!0);_.useEffect(()=>{let D=!0;return C(!0),Promise.all([TC(),gC().catch(()=>null)]).then(([P,G])=>{D&&(f(P),p(G))}).catch(P=>{D&&w(P instanceof Error?P.message:String(P))}).finally(()=>{D&&C(!1)}),()=>{D=!1}},[]);function B(D){T(!0),t(D,j)}async function O(D){w(null);try{const P=await FL(D);f(P),x(null)}catch(P){w(P instanceof Error?P.message:String(P))}}async function I(D){if(!D.builtin&&window.confirm(`Delete workflow "${D.name}"?`)){w(null);try{f(await qL(D.id))}catch(P){w(P instanceof Error?P.message:String(P))}}}function R(D){x({...D,id:Qb(`${D.id}-copy`,h),name:`${D.name} copy`,builtin:!1,steps:D.steps.map((P,G)=>({...P,id:`${P.id}-${G+1}`}))})}return e&&N?r.jsx(OZ,{run:e,onApprove:n,onSkip:o,onStop:l,onBack:()=>T(!1),onResume:()=>{T(!0),s(j)},onRestart:()=>{T(!0),t(e.workflow,j)}}):g?r.jsx(EZ,{agent:d?PZ(d):null,existing:h,initial:g,onCancel:()=>x(null),onSave:D=>{O(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(Q,{onClick:()=>x($Z(h)),size:"sm",type:"button",variant:"outline",children:[r.jsx(bs,{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=>A(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(Ze,{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(NZ,{onClear:u,onView:()=>T(!0),run:e}):null,r.jsx("div",{className:"grid gap-3 p-4 sm:grid-cols-2 xl:grid-cols-3",children:h.map(D=>r.jsx(CZ,{lastRun:e?.workflow.id===D.id?e:null,workflow:D,onDelete:()=>{I(D)},onDuplicate:()=>R(D),onEdit:()=>x(D),onRun:()=>B(D)},D.id))}),r.jsx(wZ,{workflows:h})]})]})}function NZ({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(H5,{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"," ",$5(s.startedAt)]})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[r.jsxs(Q,{onClick:t,size:"sm",type:"button",children:[r.jsx(ml,{className:"size-3.5"})," View run"]}),n?null:r.jsxs(Q,{onClick:e,size:"sm",type:"button",variant:"outline",children:[r.jsx(Kt,{className:"size-3.5"})," Clear"]})]})]})})}function CZ({lastRun:e,workflow:t,onDelete:s,onDuplicate:n,onEdit:o,onRun:l}){const[u,h]=_.useState(!1),f=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(ml,{className:"size-3"}),e.outcome==="running"?"Running now":`Last run ${$5(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(Zn,{className:de("size-3 shrink-0 transition-transform",u?"rotate-90":""),"aria-hidden":!0}),r.jsxs("span",{children:[f," ",f===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(FZ,{kind:d.kind}),r.jsx("span",{className:"truncate",children:of(d)})]},d.id))}):null,r.jsxs(Q,{className:"mt-3 w-full",onClick:l,size:"sm",type:"button",children:[r.jsx(er,{className:"size-3.5"})," Run"]}),r.jsxs("div",{className:"mt-2 grid grid-cols-3 gap-1.5",children:[r.jsxs(Q,{onClick:o,size:"sm",type:"button",variant:"outline",children:[r.jsx(UM,{className:"size-3.5"})," Edit"]}),r.jsxs(Q,{onClick:n,size:"sm",type:"button",variant:"outline",children:[r.jsx(Th,{className:"size-3.5"})," Copy"]}),r.jsxs(Q,{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(gi,{className:"size-3.5"})," Delete"]})]})]})}function EZ({agent:e,existing:t,initial:s,onCancel:n,onSave:o}){const[l,u]=_.useState(()=>structuredClone(s)),[h,f]=_.useState(s.description??""),[d,p]=_.useState(!1),g=IZ(e),{sendToAgent:x}=Pt(),v=!l.id.trim()||!l.name.trim()||l.steps.length===0;function w(O,I){u(R=>({...R,steps:R.steps.map((D,P)=>P===O?I(D):D)}))}function k(O,I){u(R=>{const D=O+I;if(D<0||D>=R.steps.length)return R;const P=[...R.steps],[G]=P.splice(O,1);return P.splice(D,0,G),{...R,steps:P}})}function C(O){u(I=>({...I,steps:I.steps.filter((R,D)=>D!==O)}))}function N(O,I){u(R=>{const D=[...R.steps];return D.splice(O,0,AZ(I,R.steps)),{...R,steps:D}})}function T(O=h){const I=xN(O,t,g);u(I)}function j(O){const I=xN(O,[],g);u(R=>({...R,steps:[...R.steps,...I.steps]}))}function A(){x({prompt:bZ(h||l.description||l.name),source:{type:"workflow",label:"Workflow composer"},mode:"draft"})}function B(){const O=ll(l.id)||Qb(ll(l.name)||"workflow",t);o({...l,id:O,name:l.name.trim(),description:(h||l.description)?.trim()||void 0,builtin:!1,steps:l.steps.map(HZ)})}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:O=>u(I=>({...I,name:O.target.value,id:ll(O.target.value)||I.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(Q,{onClick:()=>p(O=>!O),size:"sm",type:"button",variant:d?"default":"outline",children:[r.jsx(pi,{className:"size-3.5"})," AI compose"]}),r.jsxs(Q,{onClick:n,size:"sm",type:"button",variant:"outline",children:[r.jsx(ru,{className:"size-3.5"})," Back"]}),r.jsxs(Q,{disabled:v,onClick:B,size:"sm",type:"button",children:[r.jsx(ln,{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(jr,{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:O=>f(O.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(Q,{onClick:()=>T(),size:"sm",type:"button",children:[r.jsx(pi,{className:"size-3.5"})," Draft timeline"]}),r.jsxs(Q,{onClick:A,size:"sm",type:"button",variant:"outline",children:[r.jsx(QN,{className:"size-3.5"})," Ask AI"]}),["Commit safely","Review then push","Fix CI then PR","File issue from changes"].map(O=>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:()=>{f(O),T(O)},type:"button",children:O},O))]})]}),r.jsxs("div",{className:"grid gap-3",children:[r.jsx(TZ,{onAdd:j}),r.jsx(RZ,{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(vN,{onInsert:O=>N(0,O)}),l.steps.length?l.steps.map((O,I)=>r.jsxs(_.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(jZ,{index:I,kind:O.kind})]}),r.jsx("div",{className:"min-w-0 flex-1 pb-1",children:r.jsx(MZ,{capabilities:g,index:I,isFirst:I===0,isLast:I===l.steps.length-1,onMove:k,onRemove:C,onUpdate:w,step:O})})]}),r.jsx(vN,{onInsert:R=>N(I+1,R)})]},`${O.kind}:${O.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 vN({defaultOpen:e=!1,onInsert:t}){const[s,n]=_.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(Kt,{className:"size-3"}):r.jsx(bs,{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(U5,{kind:l})," ",u]},l))}):null})]})}function jZ({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(U5,{kind:t})]})}function AZ(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 TZ({onAdd:e}){const[t,s]=_.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(jr,{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(Q,{size:"sm",type:"submit",variant:"outline",children:[r.jsx(bs,{className:"size-3.5"})," Add"]})]})]})}function RZ({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(jr,{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 MZ({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($0,{kind:h.kind}),r.jsx("input",{className:"min-w-0 flex-1 bg-transparent text-[13px] font-semibold outline-none",onChange:f=>u(t,d=>({...d,title:f.target.value})),value:h.title})]}),h.kind==="gate"?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:f=>u(t,d=>d.kind==="gate"?{...d,message:f.target.value}:d),placeholder:"Question to ask before continuing…",value:h.message}):h.kind==="action"?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:f=>{const d=f.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:P5(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:f=>u(t,d=>d.kind==="agent"?{...d,prompt:f.target.value}:d),placeholder:"What should the agent do at this step?",value:h.prompt}),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:f=>u(t,d=>d.kind==="agent"?{...d,isolated:f.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(DZ,{capabilities:e,selected:h.capabilities,onToggle:(f,d)=>u(t,p=>p.kind==="agent"?{...p,capabilities:UZ(p.capabilities,f,d)}:p)})]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1 opacity-70 transition-opacity group-hover:opacity-100",children:[r.jsx(Q,{disabled:s,onClick:()=>o(t,-1),size:"sm",type:"button",variant:"ghost",children:"↑"}),r.jsx(Q,{disabled:n,onClick:()=>o(t,1),size:"sm",type:"button",variant:"ghost",children:"↓"}),r.jsx(Q,{onClick:()=>l(t),size:"sm",type:"button",variant:"ghost",children:r.jsx(gi,{className:"size-3.5"})})]})]})})}function DZ({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(jr,{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 OZ({run:e,onApprove:t,onSkip:s,onStop:n,onBack:o,onResume:l,onRestart:u}){const{sendToAgent:h}=Pt(),f=e.outcome!=="running",[d,p]=_.useState(e.index);_.useEffect(()=>{p(e.index)},[e.index]);const g=e.workflow.steps[d]??e.workflow.steps[e.index],x=e.statuses[d]??"pending",v=e.outputs[d],w=e.outputs[d-1],k=g?.kind==="gate"&&x==="waiting",C=x==="failed"||x==="blocked",N=x==="blocked"&&g?.kind==="action"&&g.op==="assert-pr-branch";return r.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-card/85",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("h2",{className:"flex items-center gap-1.5 text-[13px] font-semibold",children:[r.jsx(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(ml,{className:"size-3"})," Watch the agent work in the dock below."]})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(H5,{outcome:e.outcome}),r.jsxs(Q,{onClick:o,size:"sm",type:"button",variant:"outline",children:[r.jsx(ru,{className:"size-3.5"})," Workflows"]}),f?null:r.jsxs(Q,{onClick:n,size:"sm",type:"button",variant:"outline",children:[r.jsx(ro,{className:"size-3.5"})," Stop"]})]})]}),r.jsxs("div",{className:"grid min-h-0 flex-1 overflow-hidden lg:grid-cols-[minmax(240px,320px)_minmax(0,1fr)]",children:[r.jsx("aside",{className:"min-h-0 overflow-auto border-b border-border bg-background/55 p-3 lg:border-b-0 lg:border-r",children:r.jsx("ol",{className:"space-y-1",children:e.workflow.steps.map((T,j)=>{const A=e.statuses[j],B=A==="running"||A==="waiting",O=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",O?"border-primary/45 bg-primary/[0.06]":B?"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",A==="failed"?"border-destructive/50":A==="blocked"?"border-amber-500/50":B?"border-primary/50":A==="done"?"border-emerald-500/50":"border-border"),children:r.jsx(yN,{status:A,kind:T.kind})}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-[12px] font-medium",children:of(T)}),r.jsxs("span",{className:"mt-0.5 flex items-center gap-1.5",children:[r.jsx($0,{kind:T.kind}),r.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground/70",children:_N(A)})]})]}),r.jsx(Zn,{className:de("size-3.5 shrink-0 text-muted-foreground/50 transition-transform",O?"translate-x-0.5 text-primary":"")})]})},T.id)})})}),r.jsx("main",{className:"min-h-0 overflow-auto p-4",children:g?r.jsxs("section",{className:de("min-h-full rounded-lg border bg-background p-4 shadow-sm",x==="failed"?"border-destructive/40 bg-destructive/[0.03]":x==="blocked"?"border-amber-500/40 bg-amber-500/[0.04]":x==="running"||x==="waiting"?"border-primary/40 bg-primary/[0.03]":"border-border"),children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-border pb-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(yN,{status:x,kind:g.kind}),r.jsx("h3",{className:"truncate text-[13px] font-semibold",children:of(g)})]}),r.jsxs("div",{className:"mt-1 flex items-center gap-1.5",children:[r.jsx($0,{kind:g.kind}),r.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground/70",children:_N(x)})]})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[f&&C&&d===e.index&&!N?r.jsxs(Q,{"aria-label":"Resume the workflow from this step",onClick:l,size:"sm",type:"button",children:[r.jsx(er,{className:"size-3.5"})," Resume workflow"]}):null,C?r.jsxs(Q,{"aria-label":"Debug this workflow step with AI",onClick:()=>h({prompt:SU({workflowName:e.workflow.name,step:g,status:x,error:e.error,previousOutput:w,output:v}),source:{type:"workflow-debug",label:g.title},mode:"send",label:`Debug workflow step: ${g.title}`,background:!0}),size:"sm",type:"button",variant:"outline",children:[r.jsx(Gt,{className:"size-3.5"})," Debug with AI"]}):null,f?null:r.jsxs(Q,{"aria-label":"Stop workflow run from step detail",onClick:n,size:"sm",type:"button",variant:"outline",children:[r.jsx(ro,{className:"size-3.5"})," Stop after this step"]})]})]}),r.jsxs("div",{className:"py-3 text-[11px] leading-relaxed",children:[r.jsx(BZ,{output:v,previousOutput:w,status:x,step:g}),k?r.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-1.5",children:[r.jsxs(Q,{onClick:t,size:"sm",type:"button",children:[r.jsx(ln,{className:"size-3.5"})," Approve"]}),r.jsxs(Q,{onClick:s,size:"sm",type:"button",variant:"outline",children:[r.jsx(oC,{className:"size-3.5"})," Skip"]}),r.jsxs(Q,{onClick:n,size:"sm",type:"button",variant:"outline",children:[r.jsx(Kt,{className:"size-3.5"})," Stop"]})]}):null,x==="failed"&&e.error?r.jsx("p",{className:"mt-3 text-destructive",children:e.error}):null,N?r.jsx(LZ,{error:e.error,onRestart:u,workflowName:e.workflow.name}):null,x==="blocked"&&e.error?r.jsx("p",{className:"mt-3 text-amber-700 dark:text-amber-400",children:e.error}):null]})]}):null})]})]})}function LZ({error:e,onRestart:t,workflowName:s}){const{sendToAgent:n,setOpen:o,streaming:l,turns:u}=Pt(),[h,f]=_.useState(!1),[d,p]=_.useState(null),[g,x]=_.useState(!1),[v,w]=_.useState(null),[k,C]=_.useState(null),N=d===null?"":zZ(u,d),T=RU(N),j=h&&!T&&l;function A(O){p(u.length),C(null),w(null),n({prompt:[kU({workflowName:s,error:e}),O?.trim()?O.trim():""].filter(Boolean).join(`
|
|
221
|
-
|
|
222
|
-
`),source:{type:"workflow-branch-recovery",label:s},mode:"send",label:`Recommend PR branch for ${s}`,background:!0}),f(!0)}async function B(){if(T){x(!0),C(null);try{await kO(T),w(T)}catch(O){C(O instanceof Error?O.message:String(O))}finally{x(!1)}}}return r.jsxs("div",{className:"mt-3 rounded-md border border-border bg-muted/35 p-3",children:[r.jsx(jr,{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(Q,{onClick:()=>A(),size:"sm",type:"button",children:[r.jsx(Gt,{className:"size-3.5"})," Recommend branch with AI"]}),v?r.jsxs(Q,{onClick:t,size:"sm",type:"button",variant:"outline",children:[r.jsx(er,{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,T?r.jsxs("div",{className:"mt-3 rounded-md border border-border bg-background p-2.5",children:[r.jsx(jr,{children:"Recommended branch"}),r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsx("code",{className:"min-w-0 rounded bg-muted px-2 py-1 font-mono text-[12px] text-foreground",children:T}),r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[r.jsxs(Q,{disabled:g||v===T,onClick:()=>{B()},size:"sm",type:"button",children:[g?r.jsx(Et,{className:"size-3.5 animate-spin"}):r.jsx(ln,{className:"size-3.5"}),"Create this branch"]}),r.jsxs(Q,{disabled:g,onClick:()=>A("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"]})]})]})]}):N&&!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(Q,{className:"mt-2",onClick:()=>A("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,N?r.jsxs(Q,{className:"mt-2",onClick:()=>o(!0),size:"sm",type:"button",variant:"outline",children:[r.jsx(QN,{className:"size-3.5"})," Open agent"]}):null]})}function zZ(e,t){for(let s=e.length-1;s>=t;s--)if(e[s]?.role==="assistant")return e[s].text.trim();return""}function _N(e){return e==="running"?"Running":e==="waiting"?"Waiting":e==="done"?"Done":e==="blocked"?"Needs you":e==="failed"?"Failed":e==="skipped"?"Skipped":"Queued"}function BZ({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(jr,{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:P5(n.op)});const o=s==="done"||s==="failed"||s==="skipped";return e?r.jsxs("div",{children:[r.jsx(jr,{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(jr,{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 PZ(e){return e.detected.name==="codex"?e.agents.codex:e.agents["claude-code"]??e}function IZ(e){return e?{skills:$c(e.skills.map(t=>t.name)),mcpServers:$c(e.mcpServers.map(t=>t.name)),plugins:$c(e.plugins.map(t=>t.name)),hooks:$c(e.hooks.map(t=>t.matcher?`${t.event}: ${t.matcher}`:t.event))}:{skills:[],mcpServers:[],plugins:[],hooks:[]}}function $Z(e){return{id:Qb("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 HZ(e){const t=ll(e.id)||e.kind,s=e.title.trim()||of(e);if(e.kind==="gate")return{...e,id:t,title:s,message:e.message.trim()||"Continue?"};if(e.kind==="action")return{...e,id:t,title:s};const n=I5(e.capabilities);return{...e,id:t,title:s,prompt:e.prompt.trim()||"Complete this workflow step.",capabilities:n}}function P5(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 I5(e){if(!e)return;const t={};for(const s of["skills","mcpServers","plugins","hooks"]){const n=$c((e[s]??[]).map(o=>o.trim()).filter(Boolean));n.length&&(t[s]=n)}return Object.keys(t).length?t:void 0}function UZ(e,t,s){const n=e?.[t]??[],o=n.includes(s)?n.filter(l=>l!==s):[...n,s];return I5({...e??{},[t]:o})}function Qb(e,t){const s=new Set(t.map(l=>l.id));let n=ll(e)||"workflow",o=2;for(;s.has(n);)n=`${ll(e)||"workflow"}-${o}`,o++;return n}function ll(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function $c(e){return Array.from(new Set(e.filter(Boolean)))}function jr({children:e}){return r.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:e})}function $5(e){return new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}).format(new Date(e))}function H5({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 U5({kind:e}){return e==="gate"?r.jsx(aC,{className:"size-4 text-amber-600 dark:text-amber-400"}):e==="agent"?r.jsx(pi,{className:"size-4 text-primary"}):r.jsx(er,{className:"size-4 text-muted-foreground"})}function yN({status:e,kind:t}){return e==="running"?r.jsx(Et,{className:"size-4 shrink-0 animate-spin text-primary"}):e==="waiting"?r.jsx(aC,{className:"size-4 shrink-0 text-primary"}):e==="done"?r.jsx(ln,{className:"size-4 shrink-0 text-emerald-600 dark:text-emerald-400"}):e==="blocked"?r.jsx(U0,{className:"size-4 shrink-0 text-amber-600 dark:text-amber-400"}):e==="failed"?r.jsx(Xi,{className:"size-4 shrink-0 text-destructive"}):e==="skipped"?r.jsx(oC,{className:"size-4 shrink-0 text-muted-foreground/60"}):t==="agent"?r.jsx(pi,{className:"size-4 shrink-0 text-muted-foreground/50"}):r.jsx(H4,{className:"size-4 shrink-0 text-muted-foreground/50"})}function FZ(e){return r.jsx(Zn,{className:"size-3 shrink-0 text-muted-foreground/40","aria-hidden":!0})}function $0({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 of(e){return e.title}function qZ({data:e,onRefresh:t}){const{insertPath:s}=Pt(),[n,o]=_.useState(!1),[l,u]=_.useState("changes"),[h,f]=_.useState("changes"),[d,p]=_.useState(e.git.status?.files[0]?.path??""),[g,x]=_.useState(""),[v,w]=_.useState([]),[k,C]=_.useState(null),[N,T]=_.useState(""),[j,A]=_.useState(null),[B,O]=_.useState(0),[I,R]=_.useState(null),[D,P]=_.useState(()=>new Set),G=e.git.status?.files??[],Z=_.useMemo(()=>{const ke=new Set(G.map($e=>$e.path)),He=[...D].filter($e=>!ke.has($e)).sort().map($e=>({path:$e,index:" ",workingTree:"M"}));return[...G,...He]},[G,D]),$=_.useMemo(()=>Z.map(ke=>ke.path),[Z]),q=_.useMemo(()=>Nb(N),[N]),F=_.useCallback(async(ke,He)=>{if(He.length){o(!0);try{await ke(He),t?.()}finally{o(!1)}}},[t]),L=t?{busy:n,onStage:ke=>{F(K0,ke)},onUnstage:ke=>{F(wC,ke)}}:void 0;_.useEffect(()=>{const ke=Z[0]?.path??"";p(He=>He&&Z.some($e=>$e.path===He)?He:ke)},[Z]),_.useEffect(()=>{if(l!=="all"||v.length>0)return;let ke=!0;return C(null),vO().then(He=>{ke&&w(He)}).catch(He=>{ke&&C(He instanceof Error?He.message:String(He))}),()=>{ke=!1}},[l,v.length]),_.useEffect(()=>{if(!d){T("");return}let ke=!0;return A(null),yC(d).then(He=>{ke&&(T(He),O(0),R(null))}).catch(He=>{ke&&A(He instanceof Error?He.message:String(He))}),()=>{ke=!1}},[d]);function X(ke){O(0),R(null),p(ke)}function U(){const ke=BX({activeHunkIndex:B,filePaths:$,hunkCount:q.hunks,pendingNextFilePath:I,selectedFile:d});ke.kind==="hunk"?(R(null),O(ke.activeHunkIndex)):ke.kind==="confirm-next-file"?R(ke.filePath):ke.kind==="file"?X(ke.filePath):R(null)}function K(){if(R(null),B>0){O($e=>$e-1);return}const ke=Z.findIndex($e=>$e.path===d),He=Z[ke-1];He&&X(He.path)}const Y=Z.findIndex(ke=>ke.path===d),V=!!(q.hunks&&B<q.hunks-1||Z[Y+1]),ie=!!(B>0||Z[Y-1]),Ee=I?`End of file. Click Next again to open ${I}.`: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=_.useMemo(()=>{const ke=new Set(Z.map(He=>He.path));for(const He of D)ke.add(He);return ke},[Z,D]);if(!e.git.selectedRepository)return r.jsx(VZ,{});function Ne(){g&&(u("changes"),f("changes"),X(g))}function Ge(ke){P(He=>new Set(He).add(ke)),x(ke),u("changes"),f("changes"),X(ke)}function De(ke){x(ke),u("all")}function et(ke){ke&&s(pu(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(kZ,{}):l==="board"?r.jsx(aZ,{currentRepoPath:e.git.cwd}):l==="graph"?r.jsx(ZX,{branches:e.git.branches??[]}):l==="largest"?r.jsx(pZ,{onOpenFile:De,root:e.git.cwd}):l==="snapshots"?r.jsx(JI,{}):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(Ze,{variant:"destructive",className:"m-3",children:k}):r.jsx(Nk,{branch:e.git.status?.branch||void 0,onSelectFile:x,paths:v,root:e.git.cwd,selectedFile:g,status:Z})}),r.jsx(zX,{isModified:je.has(g),onFileSaved:Ge,onSendToAi:()=>et(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:()=>f("changes"),type:"button",children:"Changes"}),r.jsx("button",{"aria-label":"Show changed files as a tree",className:oe(h==="tree"),onClick:()=>f("tree"),type:"button",children:"Tree"})]}),h==="changes"?r.jsx(o5,{branch:e.git.status?.branch||void 0,error:e.git.error,files:Z,selectedFile:d,onSelectFile:X,root:e.git.cwd,staging:L}):r.jsx(Nk,{branch:e.git.status?.branch||void 0,defaultExpandAll:!0,emptyMessage:e.git.error??"No changed files.",onSelectFile:X,paths:$,root:e.git.cwd,selectedFile:d,status:Z,title:"Changes"}),t&&e.git.status?r.jsx(l5,{branch:e.git.status.branch||void 0,files:Z,onDone:t}):null]}),r.jsxs("section",{className:"flex min-h-0 min-w-0 flex-col border-l border-border bg-card",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-1.5",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:d||"Diff"}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[10px] text-muted-foreground",children:[r.jsx("span",{children:"Long rows wrap inside the editor pane."}),q.additions||q.deletions?r.jsxs("span",{className:"flex items-center gap-1 font-mono",children:[r.jsxs("span",{className:"text-emerald-700",children:["+",q.additions]}),r.jsxs("span",{className:"text-red-700",children:["-",q.deletions]})]}):null]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[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(Q,{disabled:!d||!ie,onClick:K,size:"sm",type:"button",variant:"outline",children:[r.jsx(uf,{}),"Previous"]}),r.jsxs(Q,{disabled:!d||!V,onClick:U,size:"sm",type:"button",variant:"outline",children:[r.jsx(cf,{}),"Next"]}),r.jsx(Q,{"aria-label":"Send selected file to AI input",className:"size-8",disabled:!d,onClick:()=>et(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(Ze,{variant:"destructive",children:j})}):d?r.jsx(fu,{activeHunkIndex:B,diff:N||"No unstaged diff for this file."}):r.jsx("div",{className:"p-4",children:r.jsx(Ze,{variant:"muted",className:"border-dashed p-12 text-center",children:"Select a changed file to inspect its diff."})})})]})]})})]})}function VZ(){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(G0,{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 GZ={sm:"size-3.5",md:"size-4",lg:"size-6"};function Jb({size:e="md",className:t}){return r.jsx(Et,{"aria-hidden":!0,className:de("animate-spin",GZ[e],t)})}function Mf({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(Jb,{size:t}),e?r.jsx("span",{children:e}):null]})}function WZ(){const[e,t]=_.useState(!1),[s,n]=_.useState(!1),[o,l]=_.useState(!0),[u,h]=_.useState("checking"),[f,d]=_.useState(null),[p,g]=_.useState(null);function x(){l(!0),h("checking"),d(null),MO().then(v=>{t(v.configured),n(v.deviceFlowAvailable),h(v.status),d(v.error??null),g(v)}).catch(v=>{t(!1),n(!1),h("connection_error"),d(v instanceof Error?v.message:String(v)),g(null)}).finally(()=>l(!1))}return _.useEffect(()=>{x()},[]),{configured:e,deviceFlowAvailable:s,loading:o,status:u,error:f,info:p,isConnected:u==="connected",needsLogin:u==="not_configured"||u==="auth_error",refresh:x}}const xx=30;function KZ(e="open"){const[t,s]=_.useState([]),[n,o]=_.useState(!0),[l,u]=_.useState(!1),[h,f]=_.useState(!1),[d,p]=_.useState(1),[g,x]=_.useState(null),[v,w]=_.useState(null),[k,C]=_.useState(null),[N,T]=_.useState(""),[j,A]=_.useState(!1),[B,O]=_.useState(null);_.useEffect(()=>{let D=!0;return o(!0),x(null),p(1),Gp(e,1).then(P=>{D&&(s(P),f(P.length===xx),P.length>0&&!P.some(G=>G.number===v)&&w(P[0]?.number??null))}).catch(P=>{D&&x(P instanceof Error?P.message:String(P))}).finally(()=>{D&&o(!1)}),()=>{D=!1}},[e]),_.useEffect(()=>{if(!v){C(null);return}let D=!0;return PO(v).then(P=>{D&&C(P)}).catch(()=>{}),()=>{D=!1}},[v]),_.useEffect(()=>{if(!v){T("");return}let D=!0;return A(!0),O(null),IO(v).then(P=>{D&&T(P)}).catch(P=>{D&&O(P instanceof Error?P.message:String(P))}).finally(()=>{D&&A(!1)}),()=>{D=!1}},[v]);function I(){if(l||!h)return;const D=d+1;u(!0),Gp(e,D).then(P=>{s(G=>{const Z=new Set(G.map($=>$.number));return[...G,...P.filter($=>!Z.has($.number))]}),f(P.length===xx),p(D)}).catch(P=>x(P instanceof Error?P.message:String(P))).finally(()=>u(!1))}function R(){let D=!0;return o(!0),x(null),p(1),Gp(e,1).then(P=>{D&&(s(P),f(P.length===xx))}).catch(P=>{D&&x(P instanceof Error?P.message:String(P))}).finally(()=>{D&&o(!1)}),()=>{D=!1}}return{prs:t,loading:n,loadingMore:l,hasMore:h,error:g,selectedNumber:v,setSelectedNumber:w,selectedPR:k,diff:N,diffLoading:j,diffError:B,loadMore:I,refresh:R}}const bx=30;function YZ(e="open"){const[t,s]=_.useState([]),[n,o]=_.useState(!0),[l,u]=_.useState(!1),[h,f]=_.useState(!1),[d,p]=_.useState(1),[g,x]=_.useState(null),[v,w]=_.useState(null),[k,C]=_.useState(null),[N,T]=_.useState([]),[j,A]=_.useState(!1),[B,O]=_.useState(null),[I,R]=_.useState(!1);_.useEffect(()=>{let Z=!0;return o(!0),x(null),p(1),Wp(e,1).then($=>{Z&&(s($),f($.length===bx),$.length>0&&!$.some(q=>q.number===v)&&w($[0]?.number??null))}).catch($=>{Z&&x($ instanceof Error?$.message:String($))}).finally(()=>{Z&&o(!1)}),()=>{Z=!1}},[e]),_.useEffect(()=>{if(!v){C(null),T([]);return}let Z=!0;return A(!0),Promise.all([qO(v),VO(v)]).then(([$,q])=>{Z&&(C($),T(q))}).catch(()=>{}).finally(()=>{Z&&A(!1)}),()=>{Z=!1}},[v]);async function D(Z){if(v){R(!0),O(null);try{const $=await GO(v,Z);T(q=>[...q,$])}catch($){O($ instanceof Error?$.message:String($))}finally{R(!1)}}}function P(){if(l||!h)return;const Z=d+1;u(!0),Wp(e,Z).then($=>{s(q=>{const F=new Set(q.map(L=>L.number));return[...q,...$.filter(L=>!F.has(L.number))]}),f($.length===bx),p(Z)}).catch($=>x($ instanceof Error?$.message:String($))).finally(()=>u(!1))}function G(){let Z=!0;return o(!0),p(1),Wp(e,1).then($=>{Z&&(s($),f($.length===bx))}).catch(()=>{}).finally(()=>{Z&&o(!1)}),()=>{Z=!1}}return{issues:t,loading:n,loadingMore:l,hasMore:h,error:g,selectedNumber:v,setSelectedNumber:w,selectedIssue:k,comments:N,commentsLoading:j,commentError:B,submitting:I,addComment:D,loadMore:P,refresh:G}}function ev({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 F5({deviceFlowAvailable:e,initialMode:t,onSaved:s}){const[n,o]=_.useState(()=>t==="device-pending"&&!e?"pat":t??(e?"choose":"pat"));return n==="device-pending"?r.jsx(XZ,{onSuccess:s,onCancel:()=>o("choose")}):n==="pat"?r.jsx(ZZ,{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(qy,{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(Q,{className:"w-full",onClick:()=>o("device-pending"),type:"button",children:[r.jsx(qy,{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 XZ({onSuccess:e,onCancel:t}){const[s,n]=_.useState(null),[o,l]=_.useState(null),[u,h]=_.useState(!0),[f,d]=_.useState(!1),p=_.useRef(null),g=_.useRef(5),x=_.useRef(!1);_.useEffect(()=>{let C=!0;return DO().then(N=>{if(!C)return;n(N),g.current=N.interval,h(!1);const T=N.verification_uri_complete||N.verification_uri;T&&gf(T),v(N.device_code,N.interval),setTimeout(()=>{x.current=!0},N.expires_in*1e3)}).catch(N=>{C&&(l(N instanceof Error?N.message:String(N)),h(!1))}),()=>{C=!1,p.current&&clearTimeout(p.current)}},[]);function v(C,N){p.current=setTimeout(()=>{w(C,N)},N*1e3)}async function w(C,N){if(x.current){l("Authorization expired. Please try again.");return}try{const T=await OO(C);if(T.done){e();return}const j=T.slowDown?N+5:N;g.current=j,v(C,j)}catch{v(C,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(Vy,{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(Ze,{variant:"destructive",children:o}),r.jsx(Q,{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(hf,{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:f?"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(Vy,{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 ZZ({onSaved:e,onBack:t}){const[s,n]=_.useState(""),[o,l]=_.useState(!1),[u,h]=_.useState(null);async function f(d){d.preventDefault();const p=s.trim();if(p){l(!0),h(null);try{await LO("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(YN,{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=>{f(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(Ze,{variant:"destructive",children:u}):null,r.jsx(Q,{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 tv({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 QZ({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(f=>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===f.number?"bg-muted":""}`,onClick:()=>u(f.number),type:"button",children:[r.jsx("span",{className:"mt-0.5 shrink-0",children:r.jsx(JZ,{pr:f})}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-[13px] font-medium",children:f.title}),r.jsxs("span",{className:"block text-[11px] text-muted-foreground",children:["#",f.number," · ",f.base.ref," ← ",f.head.ref," · ",f.user.login]})]}),f.draft?r.jsx("span",{className:"shrink-0 rounded border border-border px-1.5 py-px text-[10px] text-muted-foreground",children:"Draft"}):null]})},f.number))}),r.jsx(tv,{hasMore:n,loading:s,onLoadMore:h})]})}function JZ({pr:e}){return e.state==="merged"?r.jsx(Rh,{className:"size-4 text-purple-500"}):e.state==="closed"?r.jsx(LR,{className:"size-4 text-red-500"}):r.jsx(WN,{className:"size-4 text-emerald-500"})}function q5({body:e,title:t="Description"}){const[s,n]=_.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(u5,{content:e}):r.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap px-3 py-3 font-mono text-[12px]",children:e})]})}function eQ({pr:e,diff:t,diffLoading:s,diffError:n,onMerged:o}){const[l,u]=_.useState("cockpit"),[h,f]=_.useState(null),[d,p]=_.useState(!1),[g,x]=_.useState(null),[v,w]=_.useState(!1),[k,C]=_.useState(null),[N,T]=_.useState(!1),[j,A]=_.useState(null),[B,O]=_.useState(!1),{sendToAgent:I}=Pt(),R=_.useMemo(()=>KI(t),[t]);_.useEffect(()=>{A(F=>F&&R.some(L=>L.path===F)?F:R[0]?.path??null)},[R]);const D=R.find(F=>F.path===j)??R[0]??null;function P(F){A(F),u("diff")}function G(F,L){e&&(O(!1),I({prompt:L?H$(e,L,F):$$(e,F),source:{type:"github-pr",label:`PR #${e.number}${L?` · ${lf(L)}`:""}`},label:`PR #${e.number}${L?` (${lf(L)})`:""}: ${F}`}))}if(_.useEffect(()=>{if(O(!1),!e){f(null);return}let F=!0;return p(!0),x(null),$O(e.number).then(L=>{F&&f(L)}).catch(L=>{F&&x(L instanceof Error?L.message:String(L))}).finally(()=>{F&&p(!1)}),()=>{F=!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 Z=e.state==="open"&&!e.draft;async function $(){if(!(!e||v)){w(!0),C(null);try{await FO(e.number,{method:"squash"}),T(!1),o?.()}catch(F){C(F instanceof Error?F.message:String(F)),T(!1)}finally{w(!1)}}}const q=F=>`rounded px-2 py-0.5 text-[11px] font-medium transition-colors ${F?"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(Qi,{className:de("shrink-0",B&&"opacity-100"),label:`Ask AI about PR #${e.number}`,onAsk:()=>O(F=>!F)}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[r.jsx("button",{className:q(l==="cockpit"),onClick:()=>u("cockpit"),type:"button",children:"Review"}),r.jsx("button",{className:q(l==="diff"),onClick:()=>u("diff"),type:"button",children:"Diff"})]}),Z?r.jsxs(Q,{className:"shrink-0",disabled:v,onClick:()=>T(!0),size:"sm",title:"Squash & merge this pull request",type:"button",variant:"success",children:[r.jsx(Rh,{}),"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(Ar,{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,B?r.jsx("div",{className:"shrink-0 border-b border-border px-3 py-1.5",children:r.jsx(Rr,{placeholder:"What should the agent do with this PR? (review, summarize, find regressions…)",onSubmit:F=>G(F),onCancel:()=>O(!1)})}):null,l==="cockpit"?r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:r.jsx(tQ,{cockpit:h,error:g,loading:d,onOpenFile:P,pr:e})}):s?r.jsx(Mf,{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(sQ,{files:R,onAsk:(F,L)=>G(L,F),onSelect:A,selected:D?.path??null}),r.jsx("div",{className:"relative min-h-0 min-w-0 flex-1",children:D?r.jsx(fu,{diff:D.diff}):null})]}):r.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"No diff available."}),N?r.jsx(Nf,{confirmLabel:v?r.jsxs(r.Fragment,{children:[r.jsx(Jb,{size:"sm"})," Merging…"]}):"Squash & merge",icon:r.jsx(Rh,{}),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:()=>T(!1),onConfirm:()=>{$()},title:"Squash & merge",tone:"success"}):null]})}function tQ({pr:e,cockpit:t,loading:s,error:n,onOpenFile:o}){const[l,u]=_.useState(!1),h=t?.pr??e,f=t?.files??[],d=t?.reviews??[],p=t?.comments??[],g=t?.checks??null,x=g?.runs.filter(v=>v.conclusion==="failure"||v.conclusion==="timed_out"||v.conclusion==="cancelled")??[];return 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(rQ,{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(bn,{className:"size-3 shrink-0 text-muted-foreground"}),h.base.ref,r.jsx(ru,{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(j6,{className:"size-3 shrink-0"}),h.user.login]}),r.jsxs("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[r.jsx(T4,{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(Mf,{className:"justify-start",label:"Loading review cockpit…"}):null,r.jsxs("div",{className:"grid gap-2 md:grid-cols-4",children:[r.jsx(dh,{title:"Merge readiness",value:V5(h,g),tone:nQ(h,g)}),r.jsx(dh,{title:"Review state",value:G5(d),tone:iQ(d)}),r.jsx(dh,{title:"Checks",value:g?`${g.state} (${g.totalCount})`:"unknown",tone:g?.state==="success"?"success":g?.state==="failure"||g?.state==="error"?"danger":"muted"}),r.jsx(dh,{title:"Changed files",value:String(f.length),tone:"muted"})]}),x.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:x.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(F0,{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(Zn,{className:"size-3.5 text-muted-foreground"}),r.jsx(V0,{className:"size-3.5 text-muted-foreground"}),"Changed files",f.length?r.jsxs("span",{className:"font-mono text-[11px] text-muted-foreground",children:["(",f.length,")"]}):null]}),l?f.length?r.jsx("ul",{className:"mt-2 divide-y divide-border",children:f.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(_M,{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(wN,{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(wN,{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(q5,{body:h.body}):r.jsx("p",{className:"text-[12px] italic text-muted-foreground",children:"No description provided."})]})}function sQ({files:e,selected:t,onSelect:s,onAsk:n}){const[o,l]=_.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:lf(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(Qi,{className:de("mr-1 shrink-0",o===u.path&&"opacity-100"),label:`Ask AI about ${lf(u.path)}`,onAsk:()=>l(h=>h===u.path?null:u.path)})]}),o===u.path?r.jsx("div",{className:"px-2 pb-1.5 pt-0.5",children:r.jsx(Rr,{placeholder:"What about this file? (review, explain, find bugs…)",onSubmit:h=>{l(null),n(u.path,h)},onCancel:()=>l(null)})}):null]},u.path))})})}function lf(e){const t=e.split("/");return t[t.length-1]||e}function dh({title:e,value:t,tone:s}){const n=s==="success"?"bg-emerald-500":s==="warning"?"bg-amber-500":s==="danger"?"bg-red-500":"bg-muted-foreground";return 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 wN({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(Ar,{className:"size-3"}),e]}),r.jsx("span",{className:"line-clamp-2 whitespace-pre-wrap",children:t})]})}function V5(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 nQ(e,t){const s=V5(e,t);return s==="ready"?"success":s==="blocked"||s==="checks failing"?"danger":s==="draft"||s==="checks pending"?"warning":"muted"}function G5(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 iQ(e){const t=G5(e);return t==="approved"?"success":t==="changes requested"?"danger":t==="commented"?"warning":"muted"}function rQ({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(Rh,{className:"size-3"}):t==="Open"?r.jsx(hf,{className:"size-3"}):r.jsx(Yc,{className:"size-3"}),t]})}function W5({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 aQ({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(f=>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===f.number?"bg-muted":""}`,onClick:()=>u(f.number),type:"button",children:[r.jsx(F4,{className:`mt-0.5 size-4 shrink-0 ${f.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:f.title}),r.jsxs("span",{className:"block text-[11px] text-muted-foreground",children:["#",f.number," · ",f.user.login," · ",f.comments," comment",f.comments!==1?"s":""]})]}),f.labels.length>0?r.jsx("span",{className:"flex max-w-40 shrink-0 flex-wrap justify-end gap-x-2 gap-y-0.5",children:f.labels.slice(0,3).map(d=>r.jsx(W5,{label:d},d.name))}):null]})},f.number))}),r.jsx(tv,{hasMore:n,loading:s,onLoadMore:h})]})}const hh=6,oQ=6,lQ=8;function cQ(e,t,s,n){const o=Math.max(0,Math.min(oQ,e/2,t/2)),l=Math.max(0,Math.min(lQ,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 uQ({value:e,onChange:t,placeholder:s,rows:n=3,action:o}){const l=_.useRef(null),u=_.useRef(null),[h,f]=_.useState(null),[d,p]=_.useState({w:0,h:0});_.useLayoutEffect(()=>{const x=l.current,v=u.current;if(!x||!v)return;const w=()=>{f({w:x.clientWidth,h:x.clientHeight}),p({w:v.offsetWidth+hh*2,h:v.offsetHeight+hh*2})};w();const k=new ResizeObserver(w);return k.observe(x),k.observe(v),()=>k.disconnect()},[]);const g=h&&d.w&&d.h?cQ(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:x=>t(x.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:hh,right:hh},children:o})]})}function dQ({issue:e,comments:t,commentsLoading:s,commentError:n,submitting:o,onAddComment:l}){const[u,h]=_.useState(""),[f,d]=_.useState(!1),{sendToAgent:p}=Pt();_.useEffect(()=>{d(!1)},[e?.number]);function g(v){e&&(d(!1),p({prompt:U$(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 x(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(Qi,{className:de("shrink-0",f&&"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(Ar,{className:"size-3.5"})})]}),f?r.jsx("div",{className:"shrink-0 border-b border-border px-3 py-1.5",children:r.jsx(Rr,{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(W5,{label:v},v.name))]}),e.body?r.jsx(q5,{body:e.body}):r.jsx("p",{className:"text-[12px] text-muted-foreground italic",children:"No description provided."}),s?r.jsx(Mf,{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(lj,{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=>{x(v)},children:[r.jsx(uQ,{action:r.jsx(Q,{disabled:!u.trim()||o,size:"sm",type:"submit",children:o?r.jsxs(r.Fragment,{children:[r.jsx(Jb,{size:"sm"})," Posting…"]}):"Comment"}),onChange:h,placeholder:"Add a comment…",value:u}),n?r.jsx(Ze,{variant:"destructive",children:n}):null]})})]})}const SN=30,hQ=4e3;function fQ(e){return e.status==="in_progress"||e.status==="queued"}function kN(e){return e.map(t=>`${t.id}:${t.status}:${t.conclusion}`).join("|")}function NN(e){return e.map(t=>`${t.id}:${t.status}:${t.conclusion}:`+t.steps.map(s=>`${s.number}:${s.status}:${s.conclusion}`).join(",")).join("|")}function mQ(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 pQ(e){const[t,s]=_.useState([]),[n,o]=_.useState(null),[l,u]=_.useState([]),[h,f]=_.useState(!0),[d,p]=_.useState(!1),[g,x]=_.useState(!1),[v,w]=_.useState(1),[k,C]=_.useState(!1),[N,T]=_.useState(null),[j,A]=_.useState(null);function B(){let D=!0;return f(!0),T(null),w(1),fh(e,1).then(P=>{D&&(s(P),x(P.length===SN))}).catch(P=>{D&&T(P instanceof Error?P.message:String(P))}).finally(()=>{D&&f(!1)}),()=>{D=!1}}function O(){if(d||!g)return;const D=v+1;p(!0),fh(e,D).then(P=>{s(G=>{const Z=new Set(G.map($=>$.id));return[...G,...P.filter($=>!Z.has($.id))]}),x(P.length===SN),w(D)}).catch(P=>T(P instanceof Error?P.message:String(P))).finally(()=>p(!1))}const I=_.useCallback(()=>{fh(e,1).then(D=>s(P=>{const G=mQ(P,D);return kN(P)===kN(G)?P:G})).catch(()=>{}),n&&rw(n).then(D=>u(P=>NN(P)===NN(D)?P:D)).catch(()=>{})},[e,n]);_.useEffect(B,[e]),_.useEffect(()=>{o(D=>D&&t.some(P=>P.id===D)?D:t[0]?.id??null)},[t]),_.useEffect(()=>{if(!n){u([]);return}let D=!0;return C(!0),A(null),rw(n).then(P=>{D&&u(P)}).catch(P=>{D&&A(P instanceof Error?P.message:String(P))}).finally(()=>{D&&C(!1)}),()=>{D=!1}},[n]);const R=t.some(fQ);return _.useEffect(()=>{if(!R)return;const D=window.setInterval(()=>{document.visibilityState==="visible"&&I()},hQ);return()=>window.clearInterval(D)},[R,I]),{runs:t,selectedRunId:n,jobs:l,loading:h,loadingMore:d,hasMore:g,jobsLoading:k,error:N,jobsError:j,loadMore:O,refresh:B,syncLatest:I,setSelectedRunId:o}}function K5(e){return e.conclusion==="failure"||e.conclusion==="timed_out"||e.conclusion==="cancelled"}function gQ({branch:e,onClearBranch:t}){const{runs:s,selectedRunId:n,jobs:o,loading:l,loadingMore:u,hasMore:h,jobsLoading:f,error:d,jobsError:p,loadMore:g,refresh:x,syncLatest:v,setSelectedRunId:w}=pQ(e);vl(v);const k=s.find(A=>A.id===n)??null,{sendToAgent:C}=Pt(),[N,T]=_.useState(null);function j(A,B){T(null),C({prompt:F$(A,B),source:{type:"github-run",label:`Run #${A.run_number}`},label:`Run #${A.run_number}: ${B??"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(Kt,{className:"size-3"})}):null]}):null]}),r.jsxs(Q,{disabled:l,onClick:()=>{x()},size:"sm",type:"button",variant:"outline",children:[r.jsx(Tr,{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(A=>r.jsxs("li",{className:"group flex flex-col",children:[r.jsxs("div",{className:`flex items-center transition-colors hover:bg-muted/60 ${A.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(A.id),type:"button",children:[r.jsx(xQ,{run:A}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-[13px] font-medium",children:A.name}),r.jsxs("span",{className:"block text-[11px] text-muted-foreground",children:["#",A.run_number," · ",A.head_branch," · ",A.event," ·"," ",r.jsx("span",{title:new Date(A.created_at).toLocaleString(),children:F7(A.created_at)})]})]}),r.jsx(bQ,{run:A})]}),K5(A)?r.jsx(Qi,{className:`mr-2 shrink-0 ${N===A.id?"opacity-100":""}`,label:`Fix failing run #${A.run_number} with AI`,onAsk:()=>T(B=>B===A.id?null:A.id)}):null]}),N===A.id?r.jsx("div",{className:"px-3 pb-2 pt-0.5",children:r.jsx(Rr,{onCancel:()=>T(null),onSubmit:B=>j(A,B),placeholder:"What should the agent do? (fix it, explain the failure, find the broken step…)"})}):null]},A.id))}),r.jsx(tv,{hasMore:h,loading:u,onLoadMore:g})]}),r.jsx(vQ,{error:p,jobs:o,loading:f,onFix:A=>j(A),run:k})]})})]})}function xQ({run:e}){return e.status==="in_progress"||e.status==="queued"?r.jsx(Yc,{className:"size-4 shrink-0 animate-pulse text-amber-400"}):e.conclusion==="success"?r.jsx(hf,{className:"size-4 shrink-0 text-emerald-500"}):e.conclusion==="failure"||e.conclusion==="timed_out"?r.jsx(F0,{className:"size-4 shrink-0 text-red-500"}):r.jsx(Yc,{className:"size-4 shrink-0 text-zinc-400"})}function bQ({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 vQ({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)]})]}),K5(e)?r.jsxs(Q,{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(Ar,{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(CN,{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:EN(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(Ar,{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(CN,{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:EN(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 CN({item:e}){return e.status==="in_progress"||e.status==="queued"?r.jsx(Yc,{className:"size-3.5 shrink-0 animate-pulse text-amber-400"}):e.conclusion==="success"||e.conclusion==="skipped"?r.jsx(hf,{className:"size-3.5 shrink-0 text-emerald-500"}):e.conclusion==="failure"||e.conclusion==="timed_out"||e.conclusion==="cancelled"?r.jsx(F0,{className:"size-3.5 shrink-0 text-red-500"}):r.jsx(Yc,{className:"size-3.5 shrink-0 text-zinc-400"})}function EN(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 _Q({onCreatePR:e,onViewRuns:t}){const[s,n]=_.useState(null),[o,l]=_.useState(!0),[u,h]=_.useState(null);function f(){let p=!0;return l(!0),h(null),BO().then(g=>{p&&n(g)}).catch(g=>{p&&h(g instanceof Error?g.message:String(g))}).finally(()=>{p&&l(!1)}),()=>{p=!1}}_.useEffect(f,[]),vl(()=>{f()});const d=_.useMemo(()=>[...s?.branches??[]].sort((g,x)=>{const v=AN(g,s),w=AN(x,s);return v-w||g.name.localeCompare(x.name)}),[s]);return r.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-1.5",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"text-[13px] font-semibold",children:"Branches"}),r.jsx("p",{className:"truncate text-[11px] text-muted-foreground",children:s?.repository.full_name??"Selected repository"})]}),r.jsxs(Q,{disabled:o,onClick:()=>{f()},size:"sm",type:"button",variant:"outline",children:[r.jsx(Tr,{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(yQ,{branch:p,currentBranch:s?.currentBranch??null,defaultBranch:s?.defaultBranch??null,onCreatePR:e,onViewRuns:t},p.name))})})]})}function yQ({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(bn,{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(jN,{label:"Default",tone:"success"}):null,u?r.jsx(jN,{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(h6,{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(Q,{onClick:()=>o(e.name),size:"sm",title:`View workflow runs for ${e.name}`,type:"button",variant:"outline",children:[r.jsx(V4,{className:"size-3.5"}),"View runs"]}),r.jsxs(Q,{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(WN,{className:"size-3.5"}),"Open PR"]})]})]})}function jN({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 AN(e,t){return e.name===t?.currentBranch?0:e.name===t?.defaultBranch?1:e.protected?2:3}function wQ(){const e=WZ();let t;return e.loading||e.status==="checking"?t=r.jsx(Mf,{fill:!0,label:"Loading…"}):e.status==="not_configured"?t=r.jsx(F5,{deviceFlowAvailable:e.deviceFlowAvailable,onSaved:e.refresh}):e.status==="auth_error"||e.status==="connection_error"?t=r.jsx(SQ,{token:e}):t=r.jsx(kQ,{token:e}),r.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-card/85",children:t})}function SQ({token:e}){const[t,s]=_.useState(null);if(t)return r.jsx(F5,{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(ev,{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(Y5,{label:n?"Needs re-login":"Connection problem",tone:n?"danger":"warning"})]}),e.error?r.jsx(Ze,{variant:"destructive",children:e.error}):null,r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(Q,{onClick:e.refresh,type:"button",variant:n?"outline":"default",children:[r.jsx(Tr,{}),"Refresh"]}),r.jsx(Q,{onClick:()=>s(e.deviceFlowAvailable?"device-pending":"pat"),type:"button",variant:n?"default":"outline",children:"Reconnect GitHub"}),r.jsx(Q,{onClick:()=>s("pat"),type:"button",variant:"outline",children:"Use token instead"})]})]})})}function kQ({token:e}){const[t,s]=al("github:tab","prs"),[n,o]=al("github:pr-state","open"),[l,u]=al("github:issue-state","open"),[h,f]=_.useState(null),[d,p]=_.useState(null),[g,x]=_.useState(!1),[v,w]=_.useState(null),k=KZ(n),C=YZ(l);vl(()=>{t==="prs"?k.refresh():t==="issues"&&C.refresh()});const N=A=>`rounded px-2 py-0.5 text-[11px] font-medium transition-colors ${A?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,T=A=>`rounded px-2 py-0.5 text-[10px] font-medium transition-colors ${A?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`;async function j(){x(!0),w(null);try{await zO("github.com"),e.refresh()}catch(A){w(A instanceof Error?A.message:String(A))}finally{x(!1)}}return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-1 border-b border-border bg-card/95 px-3 py-1",children:[r.jsx("button",{className:N(t==="prs"),onClick:()=>s("prs"),type:"button",children:"Pull Requests"}),r.jsx("button",{className:N(t==="issues"),onClick:()=>s("issues"),type:"button",children:"Issues"}),r.jsx("button",{className:N(t==="branches"),onClick:()=>s("branches"),type:"button",children:"Branches"}),r.jsx("button",{className:N(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(NQ,{token:e}),r.jsxs(Q,{onClick:e.refresh,size:"sm",title:"Re-check the GitHub connection",type:"button",variant:"outline",children:[r.jsx(Tr,{}),"Reconnect"]}),r.jsx(Q,{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:T(n==="open"),onClick:()=>o("open"),type:"button",children:"Open"}),r.jsx("button",{className:T(n==="closed"),onClick:()=>o("closed"),type:"button",children:"Closed"})]}),r.jsx(Q,{onClick:()=>f(""),size:"sm",type:"button",variant:"outline",children:"New PR"})]}):t==="issues"?r.jsxs("div",{className:"flex items-center gap-0.5 rounded-md bg-muted/60 p-0.5",children:[r.jsx("button",{className:T(l==="open"),onClick:()=>u("open"),type:"button",children:"Open"}),r.jsx("button",{className:T(l==="closed"),onClick:()=>u("closed"),type:"button",children:"Closed"})]}):null]}),v?r.jsx(Ze,{variant:"destructive",className:"m-3",children:v}):null,h!==null?r.jsx(CQ,{initialHead:h,onCreated:A=>{f(null),s("prs"),k.setSelectedNumber(A.number),k.refresh()},onCancel:()=>f(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(QZ,{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(eQ,{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(aQ,{error:C.error,hasMore:C.hasMore,issues:C.issues,loading:C.loading,loadingMore:C.loadingMore,onLoadMore:C.loadMore,onSelect:C.setSelectedNumber,selectedNumber:C.selectedNumber})}),r.jsx("div",{className:"flex min-h-0 min-w-0 flex-col overflow-hidden",children:r.jsx(dQ,{commentError:C.commentError,comments:C.comments,commentsLoading:C.commentsLoading,issue:C.selectedIssue,onAddComment:C.addComment,submitting:C.submitting})})]}):t==="branches"?r.jsx(_Q,{onCreatePR:A=>f(A),onViewRuns:A=>{p(A),s("actions")}}):r.jsx(gQ,{branch:d??void 0,onClearBranch:()=>p(null)})})]})}function NQ({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(ev,{className:"size-4 shrink-0 text-foreground"}),r.jsx(Y5,{label:"Connected",tone:"success"}),r.jsx("span",{className:"max-w-48 truncate font-mono text-[10px] text-muted-foreground",children:t})]})}function Y5({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 CQ({initialHead:e,onCreated:t,onCancel:s}){const[n,o]=_.useState(""),[l,u]=_.useState(""),[h,f]=_.useState(""),[d,p]=_.useState("main"),[g,x]=_.useState(!1),[v,w]=_.useState(null),[k,C]=_.useState(!0),[N,T]=_.useState(!1),[j,A]=_.useState(null);_.useEffect(()=>{let R=!0;return C(!0),A(null),HO().then(D=>{R&&(w(D),o(D.title),u(D.body),f(e||D.head),p(D.base||D.suggestedBase||"main"),x(D.draft))}).catch(D=>{R&&A(D instanceof Error?D.message:String(D))}).finally(()=>{R&&C(!1)}),()=>{R=!1}},[e]);async function B(R){if(R.preventDefault(),!(!n.trim()||!h.trim()||!d.trim())){T(!0),A(null);try{const D=await UO({title:n.trim(),body:l.trim()||void 0,head:h.trim(),base:d.trim(),draft:g});t(D)}catch(D){A(D instanceof Error?D.message:String(D))}finally{T(!1)}}}const O="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",I=v?.warnings??[];return r.jsxs("form",{className:"flex min-h-0 flex-col gap-3 overflow-auto bg-muted/20 p-4",onSubmit:R=>{B(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(EQ,{template:v,loading:k}),I.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:I[0]}):null,r.jsx("input",{className:O,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:O,disabled:k,onChange:R=>f(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:O,disabled:k,onChange:R=>p(R.target.value),placeholder:"Base branch",required:!0,value:d})]})]}),r.jsx("textarea",{className:`${O} 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=>x(R.target.checked),type:"checkbox"}),"Create as draft"]}),j?r.jsx(Ze,{variant:"destructive",children:j}):null,r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Q,{disabled:k||N||!n.trim()||!h.trim()||!d.trim(),type:"submit",children:N?"Creating…":"Create PR"}),r.jsx(Q,{onClick:s,type:"button",variant:"outline",children:"Cancel"})]})]})}function EQ({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 jQ({ahead:e=0,behind:t=0,branches:s,currentBranch:n,disabled:o,onRefresh:l,upstream:u}){const[h,f]=_.useState(!1),[d,p]=_.useState(""),[g,x]=_.useState(null),[v,w]=_.useState(null),[k,C]=_.useState(null),N=s.filter(D=>!D.remote),T=s.filter(D=>D.remote);async function j(D,P){x(D),C(null),w(null);try{await P(),await l()}catch(G){C(G instanceof Error?G.message:String(G))}finally{x(null)}}async function A(D){await j(`switch:${D}`,async()=>{await Ri("/api/git/branches/switch",{name:D}),f(!1)})}async function B(){await j("fetch",async()=>{await Ri("/api/git/fetch",{}),w("Fetched latest branch refs.")})}async function O(){await j("push",async()=>{const D=await xf();w(D.setUpstream?`Pushed ${D.branch} and set upstream.`:`Pushed ${D.branch}.`)})}const I=!!n&&(e>0||!u&&t===0);async function R(D){D.preventDefault();const P=d.trim();if(!P){C("Branch name is required.");return}await j("create",async()=>{await Ri("/api/git/branches",{name:P}),p(""),f(!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(bn,{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:[I?r.jsxs(Q,{"aria-label":"Push current branch",className:"gap-1.5 px-2 text-xs",disabled:o||g!==null,onClick:()=>{O()},size:"sm",title:u?`Push ${e} commit${e===1?"":"s"} to ${u}`:"Push and set upstream",type:"button",variant:"default",children:[r.jsx(mf,{className:de("size-3.5",g==="push"&&"animate-pulse")}),"Push",e>0?` ${e}`:""]}):null,r.jsx(Q,{"aria-label":"Fetch branches",disabled:o||g!==null,onClick:()=>{B()},size:"icon",title:"Fetch branches",type:"button",variant:"ghost",children:r.jsx(Tr,{className:de(g==="fetch"&&"animate-spin")})}),r.jsx(Q,{"aria-label":"Close branch dialog",onClick:()=>f(!1),size:"icon",type:"button",variant:"ghost",children:r.jsx(Kt,{})})]})]}),r.jsx("div",{className:"max-h-72 overflow-auto",children:s.length?r.jsxs(r.Fragment,{children:[r.jsx(TN,{branches:N,busy:g!==null,disabled:o,label:"Local",onSwitch:A}),r.jsx(TN,{branches:T,busy:g!==null,disabled:o,label:"Remote",onSwitch:A})]}):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(ht,{"aria-label":"New branch name",disabled:o||g!==null,onChange:D=>{p(D.target.value),C(null),w(null)},placeholder:"feature/new-work",value:d}),r.jsxs(Q,{disabled:o||g!==null,type:"submit",children:[r.jsx(BR,{}),"Create"]})]}),k||v?r.jsx(Ze,{className:"mt-3 px-3 py-2 text-xs",variant:k?"destructive":"muted",children:k??v}):null]})]}):null,r.jsxs(Q,{className:"h-8 max-w-[260px] gap-2 rounded-md shadow-lg",disabled:o,onClick:()=>f(D=>!D),size:"sm",title:"Switch Git branch",type:"button",variant:"default",children:[r.jsx(bn,{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(cf,{className:"size-3"}),t]}):null,e>0?r.jsxs("span",{className:"flex items-center",children:[r.jsx(uf,{className:"size-3"}),e]}):null]}):null,r.jsx(vn,{className:de("size-4 transition-transform",h&&"rotate-180")})]})]})}function TN({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(Xe,{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 X5="nomoreide-theme-choice";function AQ(){if(typeof window>"u")return"dark";const e=window.localStorage.getItem(X5);return e==="light"||e==="dark"?e:"dark"}function TQ(e){const t=document.documentElement;t.classList.toggle("dark",e==="dark"),t.style.colorScheme=e}function RQ(){const[e,t]=_.useState(()=>AQ()),s=_.useRef(null);_.useEffect(()=>{TQ(e),window.localStorage.setItem(X5,e)},[e]);const n=_.useCallback(()=>{const o=e==="dark"?"light":"dark",l=s.current,u=document;if(!l||!u.startViewTransition||window.matchMedia("(prefers-reduced-motion: reduce)").matches){t(o);return}const h=l.getBoundingClientRect(),f=h.left+h.width/2,d=h.top+h.height/2,p=Math.hypot(Math.max(f,window.innerWidth-f),Math.max(d,window.innerHeight-d));u.startViewTransition(()=>{t(o)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${f}px ${d}px)`,`circle(${p}px at ${f}px ${d}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},[e]);return 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:Fh(),children:[r.jsx("span",{className:qh(),children:e==="dark"?r.jsx(y6,{}):r.jsx(kM,{})}),r.jsx("span",{className:Vh(),children:"Theme"})]})}function MQ(){return Qs()?r.jsxs("div",{className:"flex items-center justify-between h-8 bg-background border-b border-border select-none",style:{WebkitAppRegion:"drag"},onMouseDown:()=>F6(),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:$6,className:"h-8 w-10 flex items-center justify-center hover:bg-muted transition-colors","aria-label":"Minimize",children:r.jsx(eC,{className:"h-3 w-3"})}),r.jsx("button",{type:"button",onClick:H6,className:"h-8 w-10 flex items-center justify-center hover:bg-muted transition-colors","aria-label":"Maximize",children:r.jsx(ro,{className:"h-3 w-3"})}),r.jsx("button",{type:"button",onClick:U6,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(Kt,{className:"h-3 w-3"})})]})]}):null}function DQ(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 OQ(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 LQ(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 zQ(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 BQ({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(FR,{"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(MM,{}):r.jsx(OM,{})})]})}function PQ({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.72"]})]}),r.jsx("div",{className:"font-mono text-[11px] text-muted-foreground",children:"127.0.0.1 console"})]})}function IQ({syncLocation:e=!0}={}){const[t,s]=_.useState(()=>e?window.location.pathname.startsWith("/agent-env")?"agent-env":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]=_.useState(null),[l,u]=_.useState(null),[h,f]=_.useState(null),[d,p]=_.useState(0),[g,x]=_.useState(null),[v,w]=_.useState(!0),{error:k,success:C}=us(),[N,T]=_.useState(()=>window.localStorage.getItem("nomoreide:sidebar-docked")==="true"),j=RH(),A=_.useCallback(async(R={})=>{R.silent||w(!0),x(null);try{o(await oL()),R.notify&&C("Dashboard refreshed.")}catch(D){const P=D instanceof Error?D.message:String(D);x(P),k(P)}finally{w(!1)}},[k,C]),B=_.useCallback(()=>{A({notify:!0}),j.runActive()},[A,j]);_.useEffect(()=>{A()},[A]),_.useEffect(()=>{function R(){document.visibilityState==="visible"&&(A({silent:!0}),j.runActive())}const D=window.setInterval(R,5e3);return window.addEventListener("focus",R),document.addEventListener("visibilitychange",R),()=>{window.clearInterval(D),window.removeEventListener("focus",R),document.removeEventListener("visibilitychange",R)}},[t,A,j.runActive]),_.useEffect(()=>{if(!e)return;const R=t==="git"?"/git":t==="github"?"/github":t==="agent-env"?"/agent-env":t==="agent"?"/agent":t==="errors"?"/errors":t==="database"?"/database":t==="terminal"?"/terminal":"/";window.location.pathname!==R&&window.history.pushState(null,"",R)},[t,e]),_.useEffect(()=>{window.localStorage.setItem("nomoreide:sidebar-docked",String(N))},[N]);const O=_.useMemo(()=>n?Object.values(n.runtime.services).filter(R=>R.state==="running").length:0,[n]),I=n?.git.selectedRepository?.name??n?.git.cwd??"no-git-repository";return r.jsx(a$,{children:r.jsx(MH,{value:j,children:r.jsx($U,{onRefresh:()=>{A({silent:!0})},children:r.jsx(HU,{children:r.jsxs("div",{className:"flex flex-col h-screen overflow-hidden",children:[r.jsx(MQ,{}),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:DQ(N),children:[r.jsxs("div",{className:de("grid h-12 grid-cols-[48px_minmax(0,1fr)] items-center overflow-hidden transition-[width] duration-150",N?"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(PQ,{className:de("min-w-0 translate-x-1 overflow-hidden transition-opacity duration-200",N?"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:O,docked:N,icon:r.jsx(iC,{}),label:"Services",onClick:()=>s("services")}),r.jsx(fa,{active:t==="git",docked:N,icon:r.jsx(bn,{}),label:"Git Review",onClick:()=>s("git")}),r.jsx(fa,{active:t==="github",docked:N,icon:r.jsx(ev,{}),label:"GitHub",onClick:()=>s("github")}),r.jsx(fa,{active:t==="errors",docked:N,icon:r.jsx(Mh,{}),label:"Error Inbox",onClick:()=>s("errors")}),r.jsx(fa,{active:t==="database",docked:N,icon:r.jsx(mi,{}),label:"Database",onClick:()=>s("database")}),r.jsx(fa,{active:t==="terminal",docked:N,icon:r.jsx(lC,{}),label:"Terminal",onClick:()=>s("terminal")}),r.jsx(fa,{active:t==="agent",docked:N,icon:r.jsx(k4,{}),label:"Agent",onClick:()=>s("agent")}),r.jsx(fa,{active:t==="agent-env",docked:N,icon:r.jsx(KM,{}),label:"Agent Env",onClick:()=>s("agent-env")})]}),r.jsx(BQ,{docked:N,onToggleDock:()=>T(R=>!R)})]}),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(zM,{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-env"?"Agent Env":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:[g?r.jsx(Xe,{variant:"danger",children:g}):null,n&&(t==="git"||t==="github")?r.jsx(tZ,{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:Fh(),onClick:B,title:"Refresh this page",type:"button",children:[r.jsx("span",{className:qh(),children:r.jsx(Tr,{className:de(v&&"animate-spin")})}),r.jsx("span",{className:Vh(),children:"Refresh"})]}),r.jsx(RQ,{}),r.jsxs("a",{"aria-label":"Open NoMoreIDE documentation",className:Fh(),href:"https://www.nomoreide.com/docs",rel:"noreferrer",target:"_blank",title:"Open NoMoreIDE documentation",children:[r.jsx("span",{className:qh(),children:r.jsx(w4,{})}),r.jsx("span",{className:Vh(),children:"Docs"})]}),n?r.jsx(_U,{data:n}):null]})]})]}),n?r.jsx(_Y,{data:n,onOpenService:R=>{u(R),s("services"),A({silent:!0})}}):null,v&&!n?r.jsx(Ze,{variant:"muted",children:"Loading NoMoreIDE state..."}):null,r.jsxs("div",{className:"min-h-0 flex-1 overflow-hidden",children:[n&&t==="services"?r.jsx(xY,{data:n,onRefresh:A,focusService:l,onServiceFocused:()=>u(null)}):null,n&&t==="git"?r.jsx(qZ,{data:n,onRefresh:()=>{A({silent:!0})}}):null,t==="github"?r.jsx(wQ,{},I):null,t==="agent"?r.jsx(TH,{focusChanges:d}):null,t==="agent-env"?r.jsx(KH,{}):null,t==="errors"?r.jsx(Vq,{onReviewChanges:()=>{p(R=>R+1),s("agent")}}):null,t==="database"?r.jsx(Iq,{staged:h,onStageConsumed:()=>f(null)}):null,t==="terminal"?r.jsx(CY,{}):null]})]})]}),n&&t==="git"?r.jsx(jQ,{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(iq,{git:n?.git,onGitRefresh:()=>{A({silent:!0})},onOpenAgentPage:t==="agent"?void 0:()=>s("agent"),onOpenService:R=>{u(R),s("services"),A({silent:!0})},onOpenSqlConsole:(R,D)=>{f(P=>({connection:R,sql:D,nonce:(P?.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(Q,{"aria-label":o,title:o,className:OQ(e,s),variant:"ghost",onClick:l,type:"button",children:[r.jsx("span",{className:zQ(s),children:n}),r.jsx("span",{className:LQ(s,u),children:o}),t!==void 0&&t>0?r.jsx(Xe,{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]})}MN.createRoot(document.getElementById("root")).render(r.jsx(_.StrictMode,{children:r.jsx(IQ,{})}));export{r as j,_ as r};
|