nomoreide 0.1.73 → 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/dist/cli/commands.d.ts +3 -1
- package/dist/cli/commands.js +13 -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/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 +10 -4
- 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-DetFymBD.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-ZEkxfpgl.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
|
@@ -0,0 +1,219 @@
|
|
|
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 n4(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ip={exports:{}},gc={};var Vy;function i4(){if(Vy)return gc;Vy=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 Gy;function r4(){return Gy||(Gy=1,Ip.exports=i4()),Ip.exports}var r=r4(),$p={exports:{}},ot={};var Wy;function a4(){if(Wy)return ot;Wy=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),x=Symbol.iterator;function v(V){return V===null||typeof V!="object"?null:(V=x&&V[x]||V["@@iterator"],typeof V=="function"?V:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,N={};function C(V,q,oe){this.props=V,this.context=q,this.refs=N,this.updater=oe||w}C.prototype.isReactComponent={},C.prototype.setState=function(V,q){if(typeof V!="object"&&typeof V!="function"&&V!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,V,q,"setState")},C.prototype.forceUpdate=function(V){this.updater.enqueueForceUpdate(this,V,"forceUpdate")};function A(){}A.prototype=C.prototype;function j(V,q,oe){this.props=V,this.context=q,this.refs=N,this.updater=oe||w}var T=j.prototype=new A;T.constructor=j,k(T,C.prototype),T.isPureReactComponent=!0;var M=Array.isArray;function O(){}var $={H:null,A:null,T:null,S:null},D=Object.prototype.hasOwnProperty;function P(V,q,oe){var ee=oe.ref;return{$$typeof:e,type:V,key:q,ref:ee!==void 0?ee:null,props:oe}}function B(V,q){return P(V.type,q,V.props)}function G(V){return typeof V=="object"&&V!==null&&V.$$typeof===e}function F(V){var q={"=":"=0",":":"=2"};return"$"+V.replace(/[=:]/g,function(oe){return q[oe]})}var z=/\/+/g;function U(V,q){return typeof V=="object"&&V!==null&&V.key!=null?F(""+V.key):q.toString(36)}function K(V){switch(V.status){case"fulfilled":return V.value;case"rejected":throw V.reason;default:switch(typeof V.status=="string"?V.then(O,O):(V.status="pending",V.then(function(q){V.status==="pending"&&(V.status="fulfilled",V.value=q)},function(q){V.status==="pending"&&(V.status="rejected",V.reason=q)})),V.status){case"fulfilled":return V.value;case"rejected":throw V.reason}}throw V}function I(V,q,oe,ee,fe){var ie=typeof V;(ie==="undefined"||ie==="boolean")&&(V=null);var Se=!1;if(V===null)Se=!0;else switch(ie){case"bigint":case"string":case"number":Se=!0;break;case"object":switch(V.$$typeof){case e:case t:Se=!0;break;case p:return Se=V._init,I(Se(V._payload),q,oe,ee,fe)}}if(Se)return fe=fe(V),Se=ee===""?"."+U(V,0):ee,M(fe)?(oe="",Se!=null&&(oe=Se.replace(z,"$&/")+"/"),I(fe,q,oe,"",function(Je){return Je})):fe!=null&&(G(fe)&&(fe=B(fe,oe+(fe.key==null||V&&V.key===fe.key?"":(""+fe.key).replace(z,"$&/")+"/")+Se)),q.push(fe)),1;Se=0;var Re=ee===""?".":ee+":";if(M(V))for(var De=0;De<V.length;De++)ee=V[De],ie=Re+U(ee,De),Se+=I(ee,q,oe,ie,fe);else if(De=v(V),typeof De=="function")for(V=De.call(V),De=0;!(ee=V.next()).done;)ee=ee.value,ie=Re+U(ee,De++),Se+=I(ee,q,oe,ie,fe);else if(ie==="object"){if(typeof V.then=="function")return I(K(V),q,oe,ee,fe);throw q=String(V),Error("Objects are not valid as a React child (found: "+(q==="[object Object]"?"object with keys {"+Object.keys(V).join(", ")+"}":q)+"). If you meant to render a collection of children, use an array instead.")}return Se}function Z(V,q,oe){if(V==null)return V;var ee=[],fe=0;return I(V,ee,"","",function(ie){return q.call(oe,ie,fe++)}),ee}function W(V){if(V._status===-1){var q=V._result;q=q(),q.then(function(oe){(V._status===0||V._status===-1)&&(V._status=1,V._result=oe)},function(oe){(V._status===0||V._status===-1)&&(V._status=2,V._result=oe)}),V._status===-1&&(V._status=0,V._result=q)}if(V._status===1)return V._result.default;throw V._result}var te=typeof reportError=="function"?reportError:function(V){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof V=="object"&&V!==null&&typeof V.message=="string"?String(V.message):String(V),error:V});if(!window.dispatchEvent(q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",V);return}console.error(V)},X={map:Z,forEach:function(V,q,oe){Z(V,function(){q.apply(this,arguments)},oe)},count:function(V){var q=0;return Z(V,function(){q++}),q},toArray:function(V){return Z(V,function(q){return q})||[]},only:function(V){if(!G(V))throw Error("React.Children.only expected to receive a single React element child.");return V}};return ot.Activity=g,ot.Children=X,ot.Component=C,ot.Fragment=s,ot.Profiler=o,ot.PureComponent=j,ot.StrictMode=n,ot.Suspense=f,ot.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=$,ot.__COMPILER_RUNTIME={__proto__:null,c:function(V){return $.H.useMemoCache(V)}},ot.cache=function(V){return function(){return V.apply(null,arguments)}},ot.cacheSignal=function(){return null},ot.cloneElement=function(V,q,oe){if(V==null)throw Error("The argument must be a React element, but you passed "+V+".");var ee=k({},V.props),fe=V.key;if(q!=null)for(ie in q.key!==void 0&&(fe=""+q.key),q)!D.call(q,ie)||ie==="key"||ie==="__self"||ie==="__source"||ie==="ref"&&q.ref===void 0||(ee[ie]=q[ie]);var ie=arguments.length-2;if(ie===1)ee.children=oe;else if(1<ie){for(var Se=Array(ie),Re=0;Re<ie;Re++)Se[Re]=arguments[Re+2];ee.children=Se}return P(V.type,fe,ee)},ot.createContext=function(V){return V={$$typeof:u,_currentValue:V,_currentValue2:V,_threadCount:0,Provider:null,Consumer:null},V.Provider=V,V.Consumer={$$typeof:l,_context:V},V},ot.createElement=function(V,q,oe){var ee,fe={},ie=null;if(q!=null)for(ee in q.key!==void 0&&(ie=""+q.key),q)D.call(q,ee)&&ee!=="key"&&ee!=="__self"&&ee!=="__source"&&(fe[ee]=q[ee]);var Se=arguments.length-2;if(Se===1)fe.children=oe;else if(1<Se){for(var Re=Array(Se),De=0;De<Se;De++)Re[De]=arguments[De+2];fe.children=Re}if(V&&V.defaultProps)for(ee in Se=V.defaultProps,Se)fe[ee]===void 0&&(fe[ee]=Se[ee]);return P(V,ie,fe)},ot.createRef=function(){return{current:null}},ot.forwardRef=function(V){return{$$typeof:h,render:V}},ot.isValidElement=G,ot.lazy=function(V){return{$$typeof:p,_payload:{_status:-1,_result:V},_init:W}},ot.memo=function(V,q){return{$$typeof:d,type:V,compare:q===void 0?null:q}},ot.startTransition=function(V){var q=$.T,oe={};$.T=oe;try{var ee=V(),fe=$.S;fe!==null&&fe(oe,ee),typeof ee=="object"&&ee!==null&&typeof ee.then=="function"&&ee.then(O,te)}catch(ie){te(ie)}finally{q!==null&&oe.types!==null&&(q.types=oe.types),$.T=q}},ot.unstable_useCacheRefresh=function(){return $.H.useCacheRefresh()},ot.use=function(V){return $.H.use(V)},ot.useActionState=function(V,q,oe){return $.H.useActionState(V,q,oe)},ot.useCallback=function(V,q){return $.H.useCallback(V,q)},ot.useContext=function(V){return $.H.useContext(V)},ot.useDebugValue=function(){},ot.useDeferredValue=function(V,q){return $.H.useDeferredValue(V,q)},ot.useEffect=function(V,q){return $.H.useEffect(V,q)},ot.useEffectEvent=function(V){return $.H.useEffectEvent(V)},ot.useId=function(){return $.H.useId()},ot.useImperativeHandle=function(V,q,oe){return $.H.useImperativeHandle(V,q,oe)},ot.useInsertionEffect=function(V,q){return $.H.useInsertionEffect(V,q)},ot.useLayoutEffect=function(V,q){return $.H.useLayoutEffect(V,q)},ot.useMemo=function(V,q){return $.H.useMemo(V,q)},ot.useOptimistic=function(V,q){return $.H.useOptimistic(V,q)},ot.useReducer=function(V,q,oe){return $.H.useReducer(V,q,oe)},ot.useRef=function(V){return $.H.useRef(V)},ot.useState=function(V){return $.H.useState(V)},ot.useSyncExternalStore=function(V,q,oe){return $.H.useSyncExternalStore(V,q,oe)},ot.useTransition=function(){return $.H.useTransition()},ot.version="19.2.6",ot}var Ky;function K0(){return Ky||(Ky=1,$p.exports=a4()),$p.exports}var _=K0(),Hp={exports:{}},xc={},Up={exports:{}},Fp={};var Yy;function o4(){return Yy||(Yy=1,(function(e){function t(I,Z){var W=I.length;I.push(Z);e:for(;0<W;){var te=W-1>>>1,X=I[te];if(0<o(X,Z))I[te]=Z,I[W]=X,W=te;else break e}}function s(I){return I.length===0?null:I[0]}function n(I){if(I.length===0)return null;var Z=I[0],W=I.pop();if(W!==Z){I[0]=W;e:for(var te=0,X=I.length,V=X>>>1;te<V;){var q=2*(te+1)-1,oe=I[q],ee=q+1,fe=I[ee];if(0>o(oe,W))ee<X&&0>o(fe,oe)?(I[te]=fe,I[ee]=W,te=ee):(I[te]=oe,I[q]=W,te=q);else if(ee<X&&0>o(fe,W))I[te]=fe,I[ee]=W,te=ee;else break e}}return Z}function o(I,Z){var W=I.sortIndex-Z.sortIndex;return W!==0?W:I.id-Z.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var u=Date,h=u.now();e.unstable_now=function(){return u.now()-h}}var f=[],d=[],p=1,g=null,x=3,v=!1,w=!1,k=!1,N=!1,C=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;function T(I){for(var Z=s(d);Z!==null;){if(Z.callback===null)n(d);else if(Z.startTime<=I)n(d),Z.sortIndex=Z.expirationTime,t(f,Z);else break;Z=s(d)}}function M(I){if(k=!1,T(I),!w)if(s(f)!==null)w=!0,O||(O=!0,F());else{var Z=s(d);Z!==null&&K(M,Z.startTime-I)}}var O=!1,$=-1,D=5,P=-1;function B(){return N?!0:!(e.unstable_now()-P<D)}function G(){if(N=!1,O){var I=e.unstable_now();P=I;var Z=!0;try{e:{w=!1,k&&(k=!1,A($),$=-1),v=!0;var W=x;try{t:{for(T(I),g=s(f);g!==null&&!(g.expirationTime>I&&B());){var te=g.callback;if(typeof te=="function"){g.callback=null,x=g.priorityLevel;var X=te(g.expirationTime<=I);if(I=e.unstable_now(),typeof X=="function"){g.callback=X,T(I),Z=!0;break t}g===s(f)&&n(f),T(I)}else n(f);g=s(f)}if(g!==null)Z=!0;else{var V=s(d);V!==null&&K(M,V.startTime-I),Z=!1}}break e}finally{g=null,x=W,v=!1}Z=void 0}}finally{Z?F():O=!1}}}var F;if(typeof j=="function")F=function(){j(G)};else if(typeof MessageChannel<"u"){var z=new MessageChannel,U=z.port2;z.port1.onmessage=G,F=function(){U.postMessage(null)}}else F=function(){C(G,0)};function K(I,Z){$=C(function(){I(e.unstable_now())},Z)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(I){I.callback=null},e.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<I?Math.floor(1e3/I):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function(I){switch(x){case 1:case 2:case 3:var Z=3;break;default:Z=x}var W=x;x=Z;try{return I()}finally{x=W}},e.unstable_requestPaint=function(){N=!0},e.unstable_runWithPriority=function(I,Z){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var W=x;x=I;try{return Z()}finally{x=W}},e.unstable_scheduleCallback=function(I,Z,W){var te=e.unstable_now();switch(typeof W=="object"&&W!==null?(W=W.delay,W=typeof W=="number"&&0<W?te+W:te):W=te,I){case 1:var X=-1;break;case 2:X=250;break;case 5:X=1073741823;break;case 4:X=1e4;break;default:X=5e3}return X=W+X,I={id:p++,callback:Z,priorityLevel:I,startTime:W,expirationTime:X,sortIndex:-1},W>te?(I.sortIndex=W,t(d,I),s(f)===null&&I===s(d)&&(k?(A($),$=-1):k=!0,K(M,W-te))):(I.sortIndex=X,t(f,I),w||v||(w=!0,O||(O=!0,F()))),I},e.unstable_shouldYield=B,e.unstable_wrapCallback=function(I){var Z=x;return function(){var W=x;x=Z;try{return I.apply(this,arguments)}finally{x=W}}}})(Fp)),Fp}var Xy;function l4(){return Xy||(Xy=1,Up.exports=o4()),Up.exports}var qp={exports:{}},en={};var Zy;function c4(){if(Zy)return en;Zy=1;var e=K0();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 en.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,en.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)},en.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()}},en.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))},en.prefetchDNS=function(f){typeof f=="string"&&n.d.D(f)},en.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})}},en.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)},en.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})}},en.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)},en.requestFormReset=function(f){n.d.r(f)},en.unstable_batchedUpdates=function(f,d){return f(d)},en.useFormState=function(f,d,p){return u.H.useFormState(f,d,p)},en.useFormStatus=function(){return u.H.useHostTransitionStatus()},en.version="19.2.6",en}var Qy;function HN(){if(Qy)return qp.exports;Qy=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),qp.exports=c4(),qp.exports}var Jy;function u4(){if(Jy)return xc;Jy=1;var e=l4(),t=K0(),s=HN();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,L=b.child;L;){if(L===c){E=!0,c=b,m=y;break}if(L===m){E=!0,m=b,c=y;break}L=L.sibling}if(!E){for(L=y.child;L;){if(L===c){E=!0,c=y,m=b;break}if(L===m){E=!0,m=y,c=b;break}L=L.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"),N=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),j=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),P=Symbol.for("react.activity"),B=Symbol.for("react.memo_cache_sentinel"),G=Symbol.iterator;function F(i){return i===null||typeof i!="object"?null:(i=G&&i[G]||i["@@iterator"],typeof i=="function"?i:null)}var z=Symbol.for("react.client.reference");function U(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===z?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case k:return"Fragment";case C:return"Profiler";case N:return"StrictMode";case M:return"Suspense";case O:return"SuspenseList";case P:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case w:return"Portal";case j:return i.displayName||"Context";case A:return(i._context.displayName||"Context")+".Consumer";case T:var a=i.render;return i=i.displayName,i||(i=a.displayName||a.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case $:return a=i.displayName||null,a!==null?a:U(i.type)||"Memo";case D:a=i._payload,i=i._init;try{return U(i(a))}catch{}}return null}var K=Array.isArray,I=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W={pending:!1,data:null,method:null,action:null},te=[],X=-1;function V(i){return{current:i}}function q(i){0>X||(i.current=te[X],te[X]=null,X--)}function oe(i,a){X++,te[X]=i.current,i.current=a}var ee=V(null),fe=V(null),ie=V(null),Se=V(null);function Re(i,a){switch(oe(ie,a),oe(fe,i),oe(ee,null),a.nodeType){case 9:case 11:i=(i=a.documentElement)&&(i=i.namespaceURI)?my(i):0;break;default:if(i=a.tagName,a=a.namespaceURI)a=my(a),i=py(a,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}q(ee),oe(ee,i)}function De(){q(ee),q(fe),q(ie)}function Je(i){i.memoizedState!==null&&oe(Se,i);var a=ee.current,c=py(a,i.type);a!==c&&(oe(fe,i),oe(ee,c))}function Ne(i){fe.current===i&&(q(ee),q(fe)),Se.current===i&&(q(Se),hc._currentValue=W)}var Ue,$e;function St(i){if(Ue===void 0)try{throw Error()}catch(c){var a=c.stack.trim().match(/\n( *(at )?)/);Ue=a&&a[1]||"",$e=-1<c.stack.indexOf(`
|
|
3
|
+
at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
4
|
+
`+Ue+i+$e}var Ds=!1;function Os(i,a){if(!i||Ds)return"";Ds=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var m={DetermineComponentFrameRoot:function(){try{if(a){var Ce=function(){throw Error()};if(Object.defineProperty(Ce.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ce,[])}catch(pe){var de=pe}Reflect.construct(i,[],Ce)}else{try{Ce.call()}catch(pe){de=pe}i.call(Ce.prototype)}}else{try{throw Error()}catch(pe){de=pe}(Ce=i())&&typeof Ce.catch=="function"&&Ce.catch(function(){})}}catch(pe){if(pe&&de&&typeof pe.stack=="string")return[pe.stack,de.stack]}return[null,null]}};m.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var b=Object.getOwnPropertyDescriptor(m.DetermineComponentFrameRoot,"name");b&&b.configurable&&Object.defineProperty(m.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var y=m.DetermineComponentFrameRoot(),E=y[0],L=y[1];if(E&&L){var Y=E.split(`
|
|
5
|
+
`),ce=L.split(`
|
|
6
|
+
`);for(b=m=0;m<Y.length&&!Y[m].includes("DetermineComponentFrameRoot");)m++;for(;b<ce.length&&!ce[b].includes("DetermineComponentFrameRoot");)b++;if(m===Y.length||b===ce.length)for(m=Y.length-1,b=ce.length-1;1<=m&&0<=b&&Y[m]!==ce[b];)b--;for(;1<=m&&0<=b;m--,b--)if(Y[m]!==ce[b]){if(m!==1||b!==1)do if(m--,b--,0>b||Y[m]!==ce[b]){var be=`
|
|
7
|
+
`+Y[m].replace(" at new "," at ");return i.displayName&&be.includes("<anonymous>")&&(be=be.replace("<anonymous>",i.displayName)),be}while(1<=m&&0<=b);break}}}finally{Ds=!1,Error.prepareStackTrace=c}return(c=i?i.displayName||i.name:"")?St(c):""}function vi(i,a){switch(i.tag){case 26:case 27:case 5:return St(i.type);case 16:return St("Lazy");case 13:return i.child!==a&&a!==null?St("Suspense Fallback"):St("Suspense");case 19:return St("SuspenseList");case 0:case 15:return Os(i.type,!1);case 11:return Os(i.type.render,!1);case 1:return Os(i.type,!0);case 31:return St("Activity");default:return""}}function Kn(i){try{var a="",c=null;do a+=vi(i,c),c=i,i=i.return;while(i);return a}catch(m){return`
|
|
8
|
+
Error generating stack: `+m.message+`
|
|
9
|
+
`+m.stack}}var Us=Object.prototype.hasOwnProperty,jn=e.unstable_scheduleCallback,An=e.unstable_cancelCallback,Ri=e.unstable_shouldYield,_i=e.unstable_requestPaint,It=e.unstable_now,Cs=e.unstable_getCurrentPriorityLevel,ls=e.unstable_ImmediatePriority,pn=e.unstable_UserBlockingPriority,gn=e.unstable_NormalPriority,Mi=e.unstable_LowPriority,S=e.unstable_IdlePriority,re=e.log,xe=e.unstable_setDisableYieldValue,ye=null,he=null;function Ae(i){if(typeof re=="function"&&xe(i),he&&typeof he.setStrictMode=="function")try{he.setStrictMode(ye,i)}catch{}}var R=Math.clz32?Math.clz32:_e,ae=Math.log,Te=Math.LN2;function _e(i){return i>>>=0,i===0?32:31-(ae(i)/Te|0)|0}var me=256,je=262144,ke=4194304;function Be(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 L=m&134217727;return L!==0?(m=L&~y,m!==0?b=Be(m):(E&=L,E!==0?b=Be(E):c||(c=L&~i,c!==0&&(b=Be(c))))):(L=m&~y,L!==0?b=Be(L):E!==0?b=Be(E):c||(c=m&~i,c!==0&&(b=Be(c)))),b===0?0:a!==0&&a!==b&&(a&y)===0&&(y=b&-b,c=a&-a,y>=c||y===32&&(c&4194048)!==0)?a:b}function se(i,a){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&a)===0}function ge(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 Pe(){var i=ke;return ke<<=1,(ke&62914560)===0&&(ke=4194304),i}function it(i){for(var a=[],c=0;31>c;c++)a.push(i);return a}function Et(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 L=i.entanglements,Y=i.expirationTimes,ce=i.hiddenUpdates;for(c=E&~c;0<c;){var be=31-R(c),Ce=1<<be;L[be]=0,Y[be]=-1;var de=ce[be];if(de!==null)for(ce[be]=null,be=0;be<de.length;be++){var pe=de[be];pe!==null&&(pe.lane&=-536870913)}c&=~Ce}m!==0&&He(i,m,0),y!==0&&b===0&&i.tag!==0&&(i.suspendedLanes|=y&~(E&~a))}function He(i,a,c){i.pendingLanes|=a,i.suspendedLanes&=~a;var m=31-R(a);i.entangledLanes|=a,i.entanglements[m]=i.entanglements[m]|1073741824|c&261930}function rt(i,a){var c=i.entangledLanes|=a;for(i=i.entanglements;c;){var m=31-R(c),b=1<<m;b&a|i[m]&a&&(i[m]|=a),c&=~b}}function cs(i,a){var c=a&-a;return c=(c&42)!==0?1:Xt(c),(c&(i.suspendedLanes|a))!==0?0:c}function Xt(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 er(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function mo(){var i=Z.p;return i!==0?i:(i=window.event,i===void 0?32:Py(i.type))}function po(i,a){var c=Z.p;try{return Z.p=i,a()}finally{Z.p=c}}var Di=Math.random().toString(36).slice(2),us="__reactFiber$"+Di,Qs="__reactProps$"+Di,Or="__reactContainer$"+Di,Sl="__reactEvents$"+Di,Su="__reactListeners$"+Di,go="__reactHandles$"+Di,ku="__reactResources$"+Di,wa="__reactMarker$"+Di;function kl(i){delete i[us],delete i[Qs],delete i[Sl],delete i[Su],delete i[go]}function rn(i){var a=i[us];if(a)return a;for(var c=i.parentNode;c;){if(a=c[Or]||c[us]){if(c=a.alternate,a.child!==null||c!==null&&c.child!==null)for(i=wy(i);i!==null;){if(c=i[us])return c;i=wy(i)}return a}i=c,c=i.parentNode}return null}function tr(i){if(i=i[us]||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 gs(i){i[wa]=!0}var Nu=new Set,Sa={};function sr(i,a){Oe(i,a),Oe(i+"Capture",a)}function Oe(i,a){for(Sa[i]=a,i=0;i<a.length;i++)Nu.add(a[i])}var et=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),pt={},Tt={};function ds(i){return Us.call(Tt,i)?!0:Us.call(pt,i)?!1:et.test(i)?Tt[i]=!0:(pt[i]=!0,!1)}function Js(i,a,c){if(ds(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 Tn(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 xn(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 Ut(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function Rn(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=Rn(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=Rn(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 Pf=/[\n"\\]/g;function bn(i){return i.replace(Pf,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Cl(i,a,c,m,b,y,E,L){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=""+Ut(a)):i.value!==""+Ut(a)&&(i.value=""+Ut(a)):E!=="submit"&&E!=="reset"||i.removeAttribute("value"),a!=null?vo(i,E,Ut(a)):c!=null?vo(i,E,Ut(c)):m!=null&&i.removeAttribute("value"),b==null&&y!=null&&(i.defaultChecked=!!y),b!=null&&(i.checked=b&&typeof b!="function"&&typeof b!="symbol"),L!=null&&typeof L!="function"&&typeof L!="symbol"&&typeof L!="boolean"?i.name=""+Ut(L):i.removeAttribute("name")}function ka(i,a,c,m,b,y,E,L){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?""+Ut(c):"",a=a!=null?""+Ut(a):c,L||a===i.value||(i.value=a),i.defaultValue=a}m=m??b,m=typeof m!="function"&&typeof m!="symbol"&&!!m,i.checked=L?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 Fs(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=""+Ut(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=""+Ut(a),a!==i.value&&(i.value=a),c==null)){i.defaultValue!==a&&(i.defaultValue=a);return}i.defaultValue=c!=null?""+Ut(c):""}function _o(i,a,c,m){if(a==null){if(m!=null){if(c!=null)throw Error(n(92));if(K(m)){if(1<m.length)throw Error(n(93));m=m[0]}c=m}c==null&&(c=""),a=c}c=Ut(a),i.defaultValue=c,m=i.textContent,m===c&&m!==""&&m!==null&&(i.value=m),xo(i)}function nt(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 xs(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 Rt(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&&xs(i,b,m)}else for(var y in a)a.hasOwnProperty(y)&&xs(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 nr=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 Ie(){}var Xe=null;function lt(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var bt=null,Jt=null;function Yn(i){var a=tr(i);if(a&&(i=a.stateNode)){var c=i[Qs]||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="'+bn(""+a)+'"][type="radio"]'),a=0;a<c.length;a++){var m=c[a];if(m!==i&&m.form===i.form){var b=m[Qs]||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&&Fs(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,(bt!==null||Jt!==null)&&(gd(),bt&&(a=bt,i=Jt,Jt=bt=null,Yn(a),i)))for(a=0;a<i.length;a++)Yn(i[a])}}function Al(i,a){var c=i.stateNode;if(c===null)return null;var m=c[Qs]||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 ir=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),If=!1;if(ir)try{var Tl={};Object.defineProperty(Tl,"passive",{get:function(){If=!0}}),window.addEventListener("test",Tl,Tl),window.removeEventListener("test",Tl,Tl)}catch{If=!1}var Ir=null,$f=null,Tu=null;function pv(){if(Tu)return Tu;var i,a=$f,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 gv(){return!1}function vn(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 L in i)i.hasOwnProperty(L)&&(c=i[L],this[L]=c?c(y):y[L]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?Mu:gv,this.isPropagationStopped=gv,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 Na={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Du=vn(Na),Rl=g({},Na,{view:0,detail:0}),tA=vn(Rl),Hf,Uf,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:qf,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"?(Hf=i.screenX-Ml.screenX,Uf=i.screenY-Ml.screenY):Uf=Hf=0,Ml=i),Hf)},movementY:function(i){return"movementY"in i?i.movementY:Uf}}),xv=vn(Ou),sA=g({},Ou,{dataTransfer:0}),nA=vn(sA),iA=g({},Rl,{relatedTarget:0}),Ff=vn(iA),rA=g({},Na,{animationName:0,elapsedTime:0,pseudoElement:0}),aA=vn(rA),oA=g({},Na,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),lA=vn(oA),cA=g({},Na,{data:0}),bv=vn(cA),uA={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},dA={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"},hA={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function fA(i){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(i):(i=hA[i])?!!a[i]:!1}function qf(){return fA}var mA=g({},Rl,{key:function(i){if(i.key){var a=uA[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"?dA[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:qf,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}}),pA=vn(mA),gA=g({},Ou,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),vv=vn(gA),xA=g({},Rl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:qf}),bA=vn(xA),vA=g({},Na,{propertyName:0,elapsedTime:0,pseudoElement:0}),_A=vn(vA),yA=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}),wA=vn(yA),SA=g({},Na,{newState:0,oldState:0}),kA=vn(SA),NA=[9,13,27,32],Vf=ir&&"CompositionEvent"in window,Dl=null;ir&&"documentMode"in document&&(Dl=document.documentMode);var CA=ir&&"TextEvent"in window&&!Dl,_v=ir&&(!Vf||Dl&&8<Dl&&11>=Dl),yv=" ",wv=!1;function Sv(i,a){switch(i){case"keyup":return NA.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function kv(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var yo=!1;function EA(i,a){switch(i){case"compositionend":return kv(a);case"keypress":return a.which!==32?null:(wv=!0,yv);case"textInput":return i=a.data,i===yv&&wv?null:i;default:return null}}function jA(i,a){if(yo)return i==="compositionend"||!Vf&&Sv(i,a)?(i=pv(),Tu=$f=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 _v&&a.locale!=="ko"?null:a.data;default:return null}}var AA={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Nv(i){var a=i&&i.nodeName&&i.nodeName.toLowerCase();return a==="input"?!!AA[i.type]:a==="textarea"}function Cv(i,a,c,m){bt?Jt?Jt.push(m):Jt=[m]:bt=m,a=Sd(a,"onChange"),0<a.length&&(c=new Du("onChange","change",null,c,m),i.push({event:c,listeners:a}))}var Ol=null,Ll=null;function TA(i){ly(i,0)}function Lu(i){var a=Lr(i);if(Nl(a))return i}function Ev(i,a){if(i==="change")return a}var jv=!1;if(ir){var Gf;if(ir){var Wf="oninput"in document;if(!Wf){var Av=document.createElement("div");Av.setAttribute("oninput","return;"),Wf=typeof Av.oninput=="function"}Gf=Wf}else Gf=!1;jv=Gf&&(!document.documentMode||9<document.documentMode)}function Tv(){Ol&&(Ol.detachEvent("onpropertychange",Rv),Ll=Ol=null)}function Rv(i){if(i.propertyName==="value"&&Lu(Ll)){var a=[];Cv(a,Ll,i,lt(i)),Au(TA,a)}}function RA(i,a,c){i==="focusin"?(Tv(),Ol=a,Ll=c,Ol.attachEvent("onpropertychange",Rv)):i==="focusout"&&Tv()}function MA(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Lu(Ll)}function DA(i,a){if(i==="click")return Lu(a)}function OA(i,a){if(i==="input"||i==="change")return Lu(a)}function LA(i,a){return i===a&&(i!==0||1/i===1/a)||i!==i&&a!==a}var Mn=typeof Object.is=="function"?Object.is:LA;function zl(i,a){if(Mn(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(!Us.call(a,b)||!Mn(i[b],a[b]))return!1}return!0}function Mv(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function Dv(i,a){var c=Mv(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=Mv(c)}}function Ov(i,a){return i&&a?i===a?!0:i&&i.nodeType===3?!1:a&&a.nodeType===3?Ov(i,a.parentNode):"contains"in i?i.contains(a):i.compareDocumentPosition?!!(i.compareDocumentPosition(a)&16):!1:!1}function Lv(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 Kf(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 zA=ir&&"documentMode"in document&&11>=document.documentMode,wo=null,Yf=null,Bl=null,Xf=!1;function zv(i,a,c){var m=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Xf||wo==null||wo!==bo(m)||(m=wo,"selectionStart"in m&&Kf(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(Yf,"onSelect"),0<m.length&&(a=new Du("onSelect","select",null,a,c),i.push({event:a,listeners:m}),a.target=wo)))}function Ca(i,a){var c={};return c[i.toLowerCase()]=a.toLowerCase(),c["Webkit"+i]="webkit"+a,c["Moz"+i]="moz"+a,c}var So={animationend:Ca("Animation","AnimationEnd"),animationiteration:Ca("Animation","AnimationIteration"),animationstart:Ca("Animation","AnimationStart"),transitionrun:Ca("Transition","TransitionRun"),transitionstart:Ca("Transition","TransitionStart"),transitioncancel:Ca("Transition","TransitionCancel"),transitionend:Ca("Transition","TransitionEnd")},Zf={},Bv={};ir&&(Bv=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 Ea(i){if(Zf[i])return Zf[i];if(!So[i])return i;var a=So[i],c;for(c in a)if(a.hasOwnProperty(c)&&c in Bv)return Zf[i]=a[c];return i}var Pv=Ea("animationend"),Iv=Ea("animationiteration"),$v=Ea("animationstart"),BA=Ea("transitionrun"),PA=Ea("transitionstart"),IA=Ea("transitioncancel"),Hv=Ea("transitionend"),Uv=new Map,Qf="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Qf.push("scrollEnd");function yi(i,a){Uv.set(i,a),sr(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)},Xn=[],ko=0,Jf=0;function Bu(){for(var i=ko,a=Jf=ko=0;a<i;){var c=Xn[a];Xn[a++]=null;var m=Xn[a];Xn[a++]=null;var b=Xn[a];Xn[a++]=null;var y=Xn[a];if(Xn[a++]=null,m!==null&&b!==null){var E=m.pending;E===null?b.next=b:(b.next=E.next,E.next=b),m.pending=b}y!==0&&Fv(c,b,y)}}function Pu(i,a,c,m){Xn[ko++]=i,Xn[ko++]=a,Xn[ko++]=c,Xn[ko++]=m,Jf|=m,i.lanes|=m,i=i.alternate,i!==null&&(i.lanes|=m)}function em(i,a,c,m){return Pu(i,a,c,m),Iu(i)}function ja(i,a){return Pu(i,null,null,a),Iu(i)}function Fv(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-R(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,cp=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 $A(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 Dn(i,a,c,m){return new $A(i,a,c,m)}function tm(i){return i=i.prototype,!(!i||!i.isReactComponent)}function rr(i,a){var c=i.alternate;return c===null?(c=Dn(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 qv(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")tm(i)&&(E=1);else if(typeof i=="string")E=VT(i,c,ee.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case P:return i=Dn(31,c,a,b),i.elementType=P,i.lanes=y,i;case k:return Aa(c.children,b,y,a);case N:E=8,b|=24;break;case C:return i=Dn(12,c,a,b|2),i.elementType=C,i.lanes=y,i;case M:return i=Dn(13,c,a,b),i.elementType=M,i.lanes=y,i;case O:return i=Dn(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 A:E=9;break e;case T:E=11;break e;case $:E=14;break e;case D:E=16,m=null;break e}E=29,c=Error(n(130,i===null?"null":typeof i,"")),m=null}return a=Dn(E,c,a,b),a.elementType=i,a.type=m,a.lanes=y,a}function Aa(i,a,c,m){return i=Dn(7,i,m,a),i.lanes=c,i}function sm(i,a,c){return i=Dn(6,i,null,a),i.lanes=c,i}function Vv(i){var a=Dn(18,null,null,0);return a.stateNode=i,a}function nm(i,a,c){return a=Dn(4,i.children!==null?i.children:[],i.key,a),a.lanes=c,a.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},a}var Gv=new WeakMap;function Zn(i,a){if(typeof i=="object"&&i!==null){var c=Gv.get(i);return c!==void 0?c:(a={value:i,source:a,stack:Kn(a)},Gv.set(i,a),a)}return{value:i,source:a,stack:Kn(a)}}var Co=[],Eo=0,Hu=null,Pl=0,Qn=[],Jn=0,$r=null,Oi=1,Li="";function ar(i,a){Co[Eo++]=Pl,Co[Eo++]=Hu,Hu=i,Pl=a}function Wv(i,a,c){Qn[Jn++]=Oi,Qn[Jn++]=Li,Qn[Jn++]=$r,$r=i;var m=Oi;i=Li;var b=32-R(m)-1;m&=~(1<<b),c+=1;var y=32-R(a)+b;if(30<y){var E=b-b%5;y=(m&(1<<E)-1).toString(32),m>>=E,b-=E,Oi=1<<32-R(a)+b|c<<b|m,Li=y+i}else Oi=1<<y|c<<b|m,Li=i}function im(i){i.return!==null&&(ar(i,1),Wv(i,1,0))}function rm(i){for(;i===Hu;)Hu=Co[--Eo],Co[Eo]=null,Pl=Co[--Eo],Co[Eo]=null;for(;i===$r;)$r=Qn[--Jn],Qn[Jn]=null,Li=Qn[--Jn],Qn[Jn]=null,Oi=Qn[--Jn],Qn[Jn]=null}function Kv(i,a){Qn[Jn++]=Oi,Qn[Jn++]=Li,Qn[Jn++]=$r,Oi=a.id,Li=a.overflow,$r=i}var qs=null,Vt=null,yt=!1,Hr=null,ei=!1,am=Error(n(519));function Ur(i){var a=Error(n(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Il(Zn(a,i)),am}function Yv(i){var a=i.stateNode,c=i.type,m=i.memoizedProps;switch(a[us]=i,a[Qs]=m,c){case"dialog":xt("cancel",a),xt("close",a);break;case"iframe":case"object":case"embed":xt("load",a);break;case"video":case"audio":for(c=0;c<oc.length;c++)xt(oc[c],a);break;case"source":xt("error",a);break;case"img":case"image":case"link":xt("error",a),xt("load",a);break;case"details":xt("toggle",a);break;case"input":xt("invalid",a),ka(a,m.value,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name,!0);break;case"select":xt("invalid",a);break;case"textarea":xt("invalid",a),_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||hy(a.textContent,c)?(m.popover!=null&&(xt("beforetoggle",a),xt("toggle",a)),m.onScroll!=null&&xt("scroll",a),m.onScrollEnd!=null&&xt("scrollend",a),m.onClick!=null&&(a.onclick=Ie),a=!0):a=!1,a||Ur(i,!0)}function Xv(i){for(qs=i.return;qs;)switch(qs.tag){case 5:case 31:case 13:ei=!1;return;case 27:case 3:ei=!0;return;default:qs=qs.return}}function jo(i){if(i!==qs)return!1;if(!yt)return Xv(i),yt=!0,!1;var a=i.tag,c;if((c=a!==3&&a!==27)&&((c=a===5)&&(c=i.type,c=!(c!=="form"&&c!=="button")||kp(i.type,i.memoizedProps)),c=!c),c&&Vt&&Ur(i),Xv(i),a===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(n(317));Vt=yy(i)}else if(a===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(n(317));Vt=yy(i)}else a===27?(a=Vt,sa(i.type)?(i=Ap,Ap=null,Vt=i):Vt=a):Vt=qs?si(i.stateNode.nextSibling):null;return!0}function Ta(){Vt=qs=null,yt=!1}function om(){var i=Hr;return i!==null&&(Sn===null?Sn=i:Sn.push.apply(Sn,i),Hr=null),i}function Il(i){Hr===null?Hr=[i]:Hr.push(i)}var lm=V(null),Ra=null,or=null;function Fr(i,a,c){oe(lm,a._currentValue),a._currentValue=c}function lr(i){i._currentValue=lm.current,q(lm)}function cm(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 um(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 L=y;y=b;for(var Y=0;Y<a.length;Y++)if(L.context===a[Y]){y.lanes|=c,L=y.alternate,L!==null&&(L.lanes|=c),cm(y.return,c,i),m||(E=null);break e}y=L.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),cm(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 L=b.type;Mn(b.pendingProps.value,E.value)||(i!==null?i.push(L):i=[L])}}else if(b===Se.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&&um(a,i,c,m),a.flags|=262144}function Uu(i){for(i=i.firstContext;i!==null;){if(!Mn(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function Ma(i){Ra=i,or=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function Vs(i){return Zv(Ra,i)}function Fu(i,a){return Ra===null&&Ma(i),Zv(i,a)}function Zv(i,a){var c=a._currentValue;if(a={context:a,memoizedValue:c,next:null},or===null){if(i===null)throw Error(n(308));or=a,i.dependencies={lanes:0,firstContext:a},i.flags|=524288}else or=or.next=a;return c}var HA=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()})}},UA=e.unstable_scheduleCallback,FA=e.unstable_NormalPriority,bs={$$typeof:j,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function dm(){return{controller:new HA,data:new Map,refCount:0}}function $l(i){i.refCount--,i.refCount===0&&UA(FA,function(){i.controller.abort()})}var Hl=null,hm=0,To=0,Ro=null;function qA(i,a){if(Hl===null){var c=Hl=[];hm=0,To=pp(),Ro={status:"pending",value:void 0,then:function(m){c.push(m)}}}return hm++,a.then(Qv,Qv),a}function Qv(){if(--hm===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 VA(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 Jv=I.S;I.S=function(i,a){z_=It(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&qA(i,a),Jv!==null&&Jv(i,a)};var Da=V(null);function fm(){var i=Da.current;return i!==null?i:$t.pooledCache}function qu(i,a){a===null?oe(Da,Da.current):oe(Da,a.pool)}function e1(){var i=fm();return i===null?null:{parent:bs._currentValue,pool:i}}var Mo=Error(n(460)),mm=Error(n(474)),Vu=Error(n(542)),Gu={then:function(){}};function t1(i){return i=i.status,i==="fulfilled"||i==="rejected"}function s1(i,a,c){switch(c=i[c],c===void 0?i.push(a):c!==a&&(a.then(Ie,Ie),a=c),a.status){case"fulfilled":return a.value;case"rejected":throw i=a.reason,i1(i),i;default:if(typeof a.status=="string")a.then(Ie,Ie);else{if(i=$t,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,i1(i),i}throw La=a,Mo}}function Oa(i){try{var a=i._init;return a(i._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(La=c,Mo):c}}var La=null;function n1(){if(La===null)throw Error(n(459));var i=La;return La=null,i}function i1(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=[]),s1(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 r1(i){function a(ne,Q){if(i){var le=ne.deletions;le===null?(ne.deletions=[Q],ne.flags|=16):le.push(Q)}}function c(ne,Q){if(!i)return null;for(;Q!==null;)a(ne,Q),Q=Q.sibling;return null}function m(ne){for(var Q=new Map;ne!==null;)ne.key!==null?Q.set(ne.key,ne):Q.set(ne.index,ne),ne=ne.sibling;return Q}function b(ne,Q){return ne=rr(ne,Q),ne.index=0,ne.sibling=null,ne}function y(ne,Q,le){return ne.index=le,i?(le=ne.alternate,le!==null?(le=le.index,le<Q?(ne.flags|=67108866,Q):le):(ne.flags|=67108866,Q)):(ne.flags|=1048576,Q)}function E(ne){return i&&ne.alternate===null&&(ne.flags|=67108866),ne}function L(ne,Q,le,we){return Q===null||Q.tag!==6?(Q=sm(le,ne.mode,we),Q.return=ne,Q):(Q=b(Q,le),Q.return=ne,Q)}function Y(ne,Q,le,we){var tt=le.type;return tt===k?be(ne,Q,le.props.children,we,le.key):Q!==null&&(Q.elementType===tt||typeof tt=="object"&&tt!==null&&tt.$$typeof===D&&Oa(tt)===Q.type)?(Q=b(Q,le.props),Fl(Q,le),Q.return=ne,Q):(Q=$u(le.type,le.key,le.props,null,ne.mode,we),Fl(Q,le),Q.return=ne,Q)}function ce(ne,Q,le,we){return Q===null||Q.tag!==4||Q.stateNode.containerInfo!==le.containerInfo||Q.stateNode.implementation!==le.implementation?(Q=nm(le,ne.mode,we),Q.return=ne,Q):(Q=b(Q,le.children||[]),Q.return=ne,Q)}function be(ne,Q,le,we,tt){return Q===null||Q.tag!==7?(Q=Aa(le,ne.mode,we,tt),Q.return=ne,Q):(Q=b(Q,le),Q.return=ne,Q)}function Ce(ne,Q,le){if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return Q=sm(""+Q,ne.mode,le),Q.return=ne,Q;if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case v:return le=$u(Q.type,Q.key,Q.props,null,ne.mode,le),Fl(le,Q),le.return=ne,le;case w:return Q=nm(Q,ne.mode,le),Q.return=ne,Q;case D:return Q=Oa(Q),Ce(ne,Q,le)}if(K(Q)||F(Q))return Q=Aa(Q,ne.mode,le,null),Q.return=ne,Q;if(typeof Q.then=="function")return Ce(ne,Wu(Q),le);if(Q.$$typeof===j)return Ce(ne,Fu(ne,Q),le);Ku(ne,Q)}return null}function de(ne,Q,le,we){var tt=Q!==null?Q.key:null;if(typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint")return tt!==null?null:L(ne,Q,""+le,we);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case v:return le.key===tt?Y(ne,Q,le,we):null;case w:return le.key===tt?ce(ne,Q,le,we):null;case D:return le=Oa(le),de(ne,Q,le,we)}if(K(le)||F(le))return tt!==null?null:be(ne,Q,le,we,null);if(typeof le.then=="function")return de(ne,Q,Wu(le),we);if(le.$$typeof===j)return de(ne,Q,Fu(ne,le),we);Ku(ne,le)}return null}function pe(ne,Q,le,we,tt){if(typeof we=="string"&&we!==""||typeof we=="number"||typeof we=="bigint")return ne=ne.get(le)||null,L(Q,ne,""+we,tt);if(typeof we=="object"&&we!==null){switch(we.$$typeof){case v:return ne=ne.get(we.key===null?le:we.key)||null,Y(Q,ne,we,tt);case w:return ne=ne.get(we.key===null?le:we.key)||null,ce(Q,ne,we,tt);case D:return we=Oa(we),pe(ne,Q,le,we,tt)}if(K(we)||F(we))return ne=ne.get(le)||null,be(Q,ne,we,tt,null);if(typeof we.then=="function")return pe(ne,Q,le,Wu(we),tt);if(we.$$typeof===j)return pe(ne,Q,le,Fu(Q,we),tt);Ku(Q,we)}return null}function We(ne,Q,le,we){for(var tt=null,kt=null,Ze=Q,ut=Q=0,_t=null;Ze!==null&&ut<le.length;ut++){Ze.index>ut?(_t=Ze,Ze=null):_t=Ze.sibling;var Nt=de(ne,Ze,le[ut],we);if(Nt===null){Ze===null&&(Ze=_t);break}i&&Ze&&Nt.alternate===null&&a(ne,Ze),Q=y(Nt,Q,ut),kt===null?tt=Nt:kt.sibling=Nt,kt=Nt,Ze=_t}if(ut===le.length)return c(ne,Ze),yt&&ar(ne,ut),tt;if(Ze===null){for(;ut<le.length;ut++)Ze=Ce(ne,le[ut],we),Ze!==null&&(Q=y(Ze,Q,ut),kt===null?tt=Ze:kt.sibling=Ze,kt=Ze);return yt&&ar(ne,ut),tt}for(Ze=m(Ze);ut<le.length;ut++)_t=pe(Ze,ne,ut,le[ut],we),_t!==null&&(i&&_t.alternate!==null&&Ze.delete(_t.key===null?ut:_t.key),Q=y(_t,Q,ut),kt===null?tt=_t:kt.sibling=_t,kt=_t);return i&&Ze.forEach(function(oa){return a(ne,oa)}),yt&&ar(ne,ut),tt}function st(ne,Q,le,we){if(le==null)throw Error(n(151));for(var tt=null,kt=null,Ze=Q,ut=Q=0,_t=null,Nt=le.next();Ze!==null&&!Nt.done;ut++,Nt=le.next()){Ze.index>ut?(_t=Ze,Ze=null):_t=Ze.sibling;var oa=de(ne,Ze,Nt.value,we);if(oa===null){Ze===null&&(Ze=_t);break}i&&Ze&&oa.alternate===null&&a(ne,Ze),Q=y(oa,Q,ut),kt===null?tt=oa:kt.sibling=oa,kt=oa,Ze=_t}if(Nt.done)return c(ne,Ze),yt&&ar(ne,ut),tt;if(Ze===null){for(;!Nt.done;ut++,Nt=le.next())Nt=Ce(ne,Nt.value,we),Nt!==null&&(Q=y(Nt,Q,ut),kt===null?tt=Nt:kt.sibling=Nt,kt=Nt);return yt&&ar(ne,ut),tt}for(Ze=m(Ze);!Nt.done;ut++,Nt=le.next())Nt=pe(Ze,ne,ut,Nt.value,we),Nt!==null&&(i&&Nt.alternate!==null&&Ze.delete(Nt.key===null?ut:Nt.key),Q=y(Nt,Q,ut),kt===null?tt=Nt:kt.sibling=Nt,kt=Nt);return i&&Ze.forEach(function(s4){return a(ne,s4)}),yt&&ar(ne,ut),tt}function Bt(ne,Q,le,we){if(typeof le=="object"&&le!==null&&le.type===k&&le.key===null&&(le=le.props.children),typeof le=="object"&&le!==null){switch(le.$$typeof){case v:e:{for(var tt=le.key;Q!==null;){if(Q.key===tt){if(tt=le.type,tt===k){if(Q.tag===7){c(ne,Q.sibling),we=b(Q,le.props.children),we.return=ne,ne=we;break e}}else if(Q.elementType===tt||typeof tt=="object"&&tt!==null&&tt.$$typeof===D&&Oa(tt)===Q.type){c(ne,Q.sibling),we=b(Q,le.props),Fl(we,le),we.return=ne,ne=we;break e}c(ne,Q);break}else a(ne,Q);Q=Q.sibling}le.type===k?(we=Aa(le.props.children,ne.mode,we,le.key),we.return=ne,ne=we):(we=$u(le.type,le.key,le.props,null,ne.mode,we),Fl(we,le),we.return=ne,ne=we)}return E(ne);case w:e:{for(tt=le.key;Q!==null;){if(Q.key===tt)if(Q.tag===4&&Q.stateNode.containerInfo===le.containerInfo&&Q.stateNode.implementation===le.implementation){c(ne,Q.sibling),we=b(Q,le.children||[]),we.return=ne,ne=we;break e}else{c(ne,Q);break}else a(ne,Q);Q=Q.sibling}we=nm(le,ne.mode,we),we.return=ne,ne=we}return E(ne);case D:return le=Oa(le),Bt(ne,Q,le,we)}if(K(le))return We(ne,Q,le,we);if(F(le)){if(tt=F(le),typeof tt!="function")throw Error(n(150));return le=tt.call(le),st(ne,Q,le,we)}if(typeof le.then=="function")return Bt(ne,Q,Wu(le),we);if(le.$$typeof===j)return Bt(ne,Q,Fu(ne,le),we);Ku(ne,le)}return typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint"?(le=""+le,Q!==null&&Q.tag===6?(c(ne,Q.sibling),we=b(Q,le),we.return=ne,ne=we):(c(ne,Q),we=sm(le,ne.mode,we),we.return=ne,ne=we),E(ne)):c(ne,Q)}return function(ne,Q,le,we){try{Ul=0;var tt=Bt(ne,Q,le,we);return Do=null,tt}catch(Ze){if(Ze===Mo||Ze===Vu)throw Ze;var kt=Dn(29,Ze,null,ne.mode);return kt.lanes=we,kt.return=ne,kt}}}var za=r1(!0),a1=r1(!1),qr=!1;function pm(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function gm(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,(Ct&2)!==0){var b=m.pending;return b===null?a.next=a:(a.next=b.next,b.next=a),m.pending=a,a=Iu(i),Fv(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,rt(i,c)}}function xm(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 bm=!1;function Vl(){if(bm){var i=Ro;if(i!==null)throw i}}function Gl(i,a,c,m){bm=!1;var b=i.updateQueue;qr=!1;var y=b.firstBaseUpdate,E=b.lastBaseUpdate,L=b.shared.pending;if(L!==null){b.shared.pending=null;var Y=L,ce=Y.next;Y.next=null,E===null?y=ce:E.next=ce,E=Y;var be=i.alternate;be!==null&&(be=be.updateQueue,L=be.lastBaseUpdate,L!==E&&(L===null?be.firstBaseUpdate=ce:L.next=ce,be.lastBaseUpdate=Y))}if(y!==null){var Ce=b.baseState;E=0,be=ce=Y=null,L=y;do{var de=L.lane&-536870913,pe=de!==L.lane;if(pe?(vt&de)===de:(m&de)===de){de!==0&&de===To&&(bm=!0),be!==null&&(be=be.next={lane:0,tag:L.tag,payload:L.payload,callback:null,next:null});e:{var We=i,st=L;de=a;var Bt=c;switch(st.tag){case 1:if(We=st.payload,typeof We=="function"){Ce=We.call(Bt,Ce,de);break e}Ce=We;break e;case 3:We.flags=We.flags&-65537|128;case 0:if(We=st.payload,de=typeof We=="function"?We.call(Bt,Ce,de):We,de==null)break e;Ce=g({},Ce,de);break e;case 2:qr=!0}}de=L.callback,de!==null&&(i.flags|=64,pe&&(i.flags|=8192),pe=b.callbacks,pe===null?b.callbacks=[de]:pe.push(de))}else pe={lane:de,tag:L.tag,payload:L.payload,callback:L.callback,next:null},be===null?(ce=be=pe,Y=Ce):be=be.next=pe,E|=de;if(L=L.next,L===null){if(L=b.shared.pending,L===null)break;pe=L,L=pe.next,pe.next=null,b.lastBaseUpdate=pe,b.shared.pending=null}}while(!0);be===null&&(Y=Ce),b.baseState=Y,b.firstBaseUpdate=ce,b.lastBaseUpdate=be,y===null&&(b.shared.lanes=0),Zr|=E,i.lanes=E,i.memoizedState=Ce}}function o1(i,a){if(typeof i!="function")throw Error(n(191,i));i.call(a)}function l1(i,a){var c=i.callbacks;if(c!==null)for(i.callbacks=null,i=0;i<c.length;i++)o1(c[i],a)}var Oo=V(null),Yu=V(0);function c1(i,a){i=xr,oe(Yu,i),oe(Oo,a),xr=i|a.baseLanes}function vm(){oe(Yu,xr),oe(Oo,Oo.current)}function _m(){xr=Yu.current,q(Oo),q(Yu)}var On=V(null),ti=null;function Wr(i){var a=i.alternate;oe(hs,hs.current&1),oe(On,i),ti===null&&(a===null||Oo.current!==null||a.memoizedState!==null)&&(ti=i)}function ym(i){oe(hs,hs.current),oe(On,i),ti===null&&(ti=i)}function u1(i){i.tag===22?(oe(hs,hs.current),oe(On,i),ti===null&&(ti=i)):Kr()}function Kr(){oe(hs,hs.current),oe(On,On.current)}function Ln(i){q(On),ti===i&&(ti=null),q(hs)}var hs=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||Ep(c)||jp(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 cr=0,ct=null,Lt=null,vs=null,Zu=!1,Lo=!1,Ba=!1,Qu=0,Wl=0,zo=null,GA=0;function ss(){throw Error(n(321))}function wm(i,a){if(a===null)return!1;for(var c=0;c<a.length&&c<i.length;c++)if(!Mn(i[c],a[c]))return!1;return!0}function Sm(i,a,c,m,b,y){return cr=y,ct=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,I.H=i===null||i.memoizedState===null?W1:Pm,Ba=!1,y=c(m,b),Ba=!1,Lo&&(y=h1(a,c,m,b)),d1(i),y}function d1(i){I.H=Xl;var a=Lt!==null&&Lt.next!==null;if(cr=0,vs=Lt=ct=null,Zu=!1,Wl=0,zo=null,a)throw Error(n(300));i===null||_s||(i=i.dependencies,i!==null&&Uu(i)&&(_s=!0))}function h1(i,a,c,m){ct=i;var b=0;do{if(Lo&&(zo=null),Wl=0,Lo=!1,25<=b)throw Error(n(301));if(b+=1,vs=Lt=null,i.updateQueue!=null){var y=i.updateQueue;y.lastEffect=null,y.events=null,y.stores=null,y.memoCache!=null&&(y.memoCache.index=0)}I.H=K1,y=a(c,m)}while(Lo);return y}function WA(){var i=I.H,a=i.useState()[0];return a=typeof a.then=="function"?Kl(a):a,i=i.useState()[0],(Lt!==null?Lt.memoizedState:null)!==i&&(ct.flags|=1024),a}function km(){var i=Qu!==0;return Qu=0,i}function Nm(i,a,c){a.updateQueue=i.updateQueue,a.flags&=-2053,i.lanes&=~c}function Cm(i){if(Zu){for(i=i.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}Zu=!1}cr=0,vs=Lt=ct=null,Lo=!1,Wl=Qu=0,zo=null}function an(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return vs===null?ct.memoizedState=vs=i:vs=vs.next=i,vs}function fs(){if(Lt===null){var i=ct.alternate;i=i!==null?i.memoizedState:null}else i=Lt.next;var a=vs===null?ct.memoizedState:vs.next;if(a!==null)vs=a,Lt=i;else{if(i===null)throw ct.alternate===null?Error(n(467)):Error(n(310));Lt=i,i={memoizedState:Lt.memoizedState,baseState:Lt.baseState,baseQueue:Lt.baseQueue,queue:Lt.queue,next:null},vs===null?ct.memoizedState=vs=i:vs=vs.next=i}return vs}function Ju(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Kl(i){var a=Wl;return Wl+=1,zo===null&&(zo=[]),i=s1(zo,i,a),a=ct,(vs===null?a.memoizedState:vs.next)===null&&(a=a.alternate,I.H=a===null||a.memoizedState===null?W1:Pm),i}function ed(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return Kl(i);if(i.$$typeof===j)return Vs(i)}throw Error(n(438,String(i)))}function Em(i){var a=null,c=ct.updateQueue;if(c!==null&&(a=c.memoCache),a==null){var m=ct.alternate;m!==null&&(m=m.updateQueue,m!==null&&(m=m.memoCache,m!=null&&(a={data:m.data.map(function(b){return b.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),c===null&&(c=Ju(),ct.updateQueue=c),c.memoCache=a,c=a.data[a.index],c===void 0)for(c=a.data[a.index]=Array(i),m=0;m<i;m++)c[m]=B;return a.index++,c}function ur(i,a){return typeof a=="function"?a(i):a}function td(i){var a=fs();return jm(a,Lt,i)}function jm(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 L=E=null,Y=null,ce=a,be=!1;do{var Ce=ce.lane&-536870913;if(Ce!==ce.lane?(vt&Ce)===Ce:(cr&Ce)===Ce){var de=ce.revertLane;if(de===0)Y!==null&&(Y=Y.next={lane:0,revertLane:0,gesture:null,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null}),Ce===To&&(be=!0);else if((cr&de)===de){ce=ce.next,de===To&&(be=!0);continue}else Ce={lane:0,revertLane:ce.revertLane,gesture:null,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null},Y===null?(L=Y=Ce,E=y):Y=Y.next=Ce,ct.lanes|=de,Zr|=de;Ce=ce.action,Ba&&c(y,Ce),y=ce.hasEagerState?ce.eagerState:c(y,Ce)}else de={lane:Ce,revertLane:ce.revertLane,gesture:ce.gesture,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null},Y===null?(L=Y=de,E=y):Y=Y.next=de,ct.lanes|=Ce,Zr|=Ce;ce=ce.next}while(ce!==null&&ce!==a);if(Y===null?E=y:Y.next=L,!Mn(y,i.memoizedState)&&(_s=!0,be&&(c=Ro,c!==null)))throw c;i.memoizedState=y,i.baseState=E,i.baseQueue=Y,m.lastRenderedState=y}return b===null&&(m.lanes=0),[i.memoizedState,m.dispatch]}function Am(i){var a=fs(),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);Mn(y,a.memoizedState)||(_s=!0),a.memoizedState=y,a.baseQueue===null&&(a.baseState=y),c.lastRenderedState=y}return[y,m]}function f1(i,a,c){var m=ct,b=fs(),y=yt;if(y){if(c===void 0)throw Error(n(407));c=c()}else c=a();var E=!Mn((Lt||b).memoizedState,c);if(E&&(b.memoizedState=c,_s=!0),b=b.queue,Mm(g1.bind(null,m,b,i),[i]),b.getSnapshot!==a||E||vs!==null&&vs.memoizedState.tag&1){if(m.flags|=2048,Bo(9,{destroy:void 0},p1.bind(null,m,b,c,a),null),$t===null)throw Error(n(349));y||(cr&127)!==0||m1(m,a,c)}return c}function m1(i,a,c){i.flags|=16384,i={getSnapshot:a,value:c},a=ct.updateQueue,a===null?(a=Ju(),ct.updateQueue=a,a.stores=[i]):(c=a.stores,c===null?a.stores=[i]:c.push(i))}function p1(i,a,c,m){a.value=c,a.getSnapshot=m,x1(a)&&b1(i)}function g1(i,a,c){return c(function(){x1(a)&&b1(i)})}function x1(i){var a=i.getSnapshot;i=i.value;try{var c=a();return!Mn(i,c)}catch{return!0}}function b1(i){var a=ja(i,2);a!==null&&kn(a,i,2)}function Tm(i){var a=an();if(typeof i=="function"){var c=i;if(i=c(),Ba){Ae(!0);try{c()}finally{Ae(!1)}}}return a.memoizedState=a.baseState=i,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ur,lastRenderedState:i},a}function v1(i,a,c,m){return i.baseState=c,jm(i,Lt,typeof m=="function"?m:ur)}function KA(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)}};I.T!==null?c(!0):y.isTransition=!1,m(y),c=a.pending,c===null?(y.next=a.pending=y,_1(a,y)):(y.next=c.next,a.pending=c.next=y)}}function _1(i,a){var c=a.action,m=a.payload,b=i.state;if(a.isTransition){var y=I.T,E={};I.T=E;try{var L=c(b,m),Y=I.S;Y!==null&&Y(E,L),y1(i,a,L)}catch(ce){Rm(i,a,ce)}finally{y!==null&&E.types!==null&&(y.types=E.types),I.T=y}}else try{y=c(b,m),y1(i,a,y)}catch(ce){Rm(i,a,ce)}}function y1(i,a,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(m){w1(i,a,m)},function(m){return Rm(i,a,m)}):w1(i,a,c)}function w1(i,a,c){a.status="fulfilled",a.value=c,S1(a),i.state=c,a=i.pending,a!==null&&(c=a.next,c===a?i.pending=null:(c=c.next,a.next=c,_1(i,c)))}function Rm(i,a,c){var m=i.pending;if(i.pending=null,m!==null){m=m.next;do a.status="rejected",a.reason=c,S1(a),a=a.next;while(a!==m)}i.action=null}function S1(i){i=i.listeners;for(var a=0;a<i.length;a++)(0,i[a])()}function k1(i,a){return a}function N1(i,a){if(yt){var c=$t.formState;if(c!==null){e:{var m=ct;if(yt){if(Vt){t:{for(var b=Vt,y=ei;b.nodeType!==8;){if(!y){b=null;break t}if(b=si(b.nextSibling),b===null){b=null;break t}}y=b.data,b=y==="F!"||y==="F"?b:null}if(b){Vt=si(b.nextSibling),m=b.data==="F!";break e}}Ur(m)}m=!1}m&&(a=c[0])}}return c=an(),c.memoizedState=c.baseState=a,m={pending:null,lanes:0,dispatch:null,lastRenderedReducer:k1,lastRenderedState:a},c.queue=m,c=q1.bind(null,ct,m),m.dispatch=c,m=Tm(!1),y=Bm.bind(null,ct,!1,m.queue),m=an(),b={state:a,dispatch:null,action:i,pending:null},m.queue=b,c=KA.bind(null,ct,b,y,c),b.dispatch=c,m.memoizedState=i,[a,c,!1]}function C1(i){var a=fs();return E1(a,Lt,i)}function E1(i,a,c){if(a=jm(i,a,k1)[0],i=td(ur)[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=fs();var b=a.queue,y=b.dispatch;return c!==a.memoizedState&&(ct.flags|=2048,Bo(9,{destroy:void 0},YA.bind(null,b,c),null)),[m,y,i]}function YA(i,a){i.action=a}function j1(i){var a=fs(),c=Lt;if(c!==null)return E1(a,c,i);fs(),a=a.memoizedState,c=fs();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=ct.updateQueue,a===null&&(a=Ju(),ct.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 A1(){return fs().memoizedState}function sd(i,a,c,m){var b=an();ct.flags|=i,b.memoizedState=Bo(1|a,{destroy:void 0},c,m===void 0?null:m)}function nd(i,a,c,m){var b=fs();m=m===void 0?null:m;var y=b.memoizedState.inst;Lt!==null&&m!==null&&wm(m,Lt.memoizedState.deps)?b.memoizedState=Bo(a,y,c,m):(ct.flags|=i,b.memoizedState=Bo(1|a,y,c,m))}function T1(i,a){sd(8390656,8,i,a)}function Mm(i,a){nd(2048,8,i,a)}function XA(i){ct.flags|=4;var a=ct.updateQueue;if(a===null)a=Ju(),ct.updateQueue=a,a.events=[i];else{var c=a.events;c===null?a.events=[i]:c.push(i)}}function R1(i){var a=fs().memoizedState;return XA({ref:a,nextImpl:i}),function(){if((Ct&2)!==0)throw Error(n(440));return a.impl.apply(void 0,arguments)}}function M1(i,a){return nd(4,2,i,a)}function D1(i,a){return nd(4,4,i,a)}function O1(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 L1(i,a,c){c=c!=null?c.concat([i]):null,nd(4,4,O1.bind(null,a,i),c)}function Dm(){}function z1(i,a){var c=fs();a=a===void 0?null:a;var m=c.memoizedState;return a!==null&&wm(a,m[1])?m[0]:(c.memoizedState=[i,a],i)}function B1(i,a){var c=fs();a=a===void 0?null:a;var m=c.memoizedState;if(a!==null&&wm(a,m[1]))return m[0];if(m=i(),Ba){Ae(!0);try{i()}finally{Ae(!1)}}return c.memoizedState=[m,a],m}function Om(i,a,c){return c===void 0||(cr&1073741824)!==0&&(vt&261930)===0?i.memoizedState=a:(i.memoizedState=c,i=P_(),ct.lanes|=i,Zr|=i,c)}function P1(i,a,c,m){return Mn(c,a)?c:Oo.current!==null?(i=Om(i,c,m),Mn(i,a)||(_s=!0),i):(cr&42)===0||(cr&1073741824)!==0&&(vt&261930)===0?(_s=!0,i.memoizedState=c):(i=P_(),ct.lanes|=i,Zr|=i,a)}function I1(i,a,c,m,b){var y=Z.p;Z.p=y!==0&&8>y?y:8;var E=I.T,L={};I.T=L,Bm(i,!1,a,c);try{var Y=b(),ce=I.S;if(ce!==null&&ce(L,Y),Y!==null&&typeof Y=="object"&&typeof Y.then=="function"){var be=VA(Y,m);Yl(i,a,be,Pn(i))}else Yl(i,a,m,Pn(i))}catch(Ce){Yl(i,a,{then:function(){},status:"rejected",reason:Ce},Pn())}finally{Z.p=y,E!==null&&L.types!==null&&(E.types=L.types),I.T=E}}function ZA(){}function Lm(i,a,c,m){if(i.tag!==5)throw Error(n(476));var b=$1(i).queue;I1(i,b,a,W,c===null?ZA:function(){return H1(i),c(m)})}function $1(i){var a=i.memoizedState;if(a!==null)return a;a={memoizedState:W,baseState:W,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ur,lastRenderedState:W},next:null};var c={};return a.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ur,lastRenderedState:c},next:null},i.memoizedState=a,i=i.alternate,i!==null&&(i.memoizedState=a),a}function H1(i){var a=$1(i);a.next===null&&(a=i.alternate.memoizedState),Yl(i,a.next.queue,{},Pn())}function zm(){return Vs(hc)}function U1(){return fs().memoizedState}function F1(){return fs().memoizedState}function QA(i){for(var a=i.return;a!==null;){switch(a.tag){case 24:case 3:var c=Pn();i=Vr(c);var m=Gr(a,i,c);m!==null&&(kn(m,a,c),ql(m,a,c)),a={cache:dm()},i.payload=a;return}a=a.return}}function JA(i,a,c){var m=Pn();c={lane:m,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},id(i)?V1(a,c):(c=em(i,a,c,m),c!==null&&(kn(c,i,m),G1(c,a,m)))}function q1(i,a,c){var m=Pn();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))V1(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,L=y(E,c);if(b.hasEagerState=!0,b.eagerState=L,Mn(L,E))return Pu(i,a,b,0),$t===null&&Bu(),!1}catch{}if(c=em(i,a,b,m),c!==null)return kn(c,i,m),G1(c,a,m),!0}return!1}function Bm(i,a,c,m){if(m={lane:2,revertLane:pp(),gesture:null,action:m,hasEagerState:!1,eagerState:null,next:null},id(i)){if(a)throw Error(n(479))}else a=em(i,c,m,2),a!==null&&kn(a,i,2)}function id(i){var a=i.alternate;return i===ct||a!==null&&a===ct}function V1(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 G1(i,a,c){if((c&4194048)!==0){var m=a.lanes;m&=i.pendingLanes,c|=m,a.lanes=c,rt(i,c)}}var Xl={readContext:Vs,use:ed,useCallback:ss,useContext:ss,useEffect:ss,useImperativeHandle:ss,useLayoutEffect:ss,useInsertionEffect:ss,useMemo:ss,useReducer:ss,useRef:ss,useState:ss,useDebugValue:ss,useDeferredValue:ss,useTransition:ss,useSyncExternalStore:ss,useId:ss,useHostTransitionStatus:ss,useFormState:ss,useActionState:ss,useOptimistic:ss,useMemoCache:ss,useCacheRefresh:ss};Xl.useEffectEvent=ss;var W1={readContext:Vs,use:ed,useCallback:function(i,a){return an().memoizedState=[i,a===void 0?null:a],i},useContext:Vs,useEffect:T1,useImperativeHandle:function(i,a,c){c=c!=null?c.concat([i]):null,sd(4194308,4,O1.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=an();a=a===void 0?null:a;var m=i();if(Ba){Ae(!0);try{i()}finally{Ae(!1)}}return c.memoizedState=[m,a],m},useReducer:function(i,a,c){var m=an();if(c!==void 0){var b=c(a);if(Ba){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=JA.bind(null,ct,i),[m.memoizedState,i]},useRef:function(i){var a=an();return i={current:i},a.memoizedState=i},useState:function(i){i=Tm(i);var a=i.queue,c=q1.bind(null,ct,a);return a.dispatch=c,[i.memoizedState,c]},useDebugValue:Dm,useDeferredValue:function(i,a){var c=an();return Om(c,i,a)},useTransition:function(){var i=Tm(!1);return i=I1.bind(null,ct,i.queue,!0,!1),an().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,a,c){var m=ct,b=an();if(yt){if(c===void 0)throw Error(n(407));c=c()}else{if(c=a(),$t===null)throw Error(n(349));(vt&127)!==0||m1(m,a,c)}b.memoizedState=c;var y={value:c,getSnapshot:a};return b.queue=y,T1(g1.bind(null,m,y,i),[i]),m.flags|=2048,Bo(9,{destroy:void 0},p1.bind(null,m,y,c,a),null),c},useId:function(){var i=an(),a=$t.identifierPrefix;if(yt){var c=Li,m=Oi;c=(m&~(1<<32-R(m)-1)).toString(32)+c,a="_"+a+"R_"+c,c=Qu++,0<c&&(a+="H"+c.toString(32)),a+="_"}else c=GA++,a="_"+a+"r_"+c.toString(32)+"_";return i.memoizedState=a},useHostTransitionStatus:zm,useFormState:N1,useActionState:N1,useOptimistic:function(i){var a=an();a.memoizedState=a.baseState=i;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=c,a=Bm.bind(null,ct,!0,c),c.dispatch=a,[i,a]},useMemoCache:Em,useCacheRefresh:function(){return an().memoizedState=QA.bind(null,ct)},useEffectEvent:function(i){var a=an(),c={impl:i};return a.memoizedState=c,function(){if((Ct&2)!==0)throw Error(n(440));return c.impl.apply(void 0,arguments)}}},Pm={readContext:Vs,use:ed,useCallback:z1,useContext:Vs,useEffect:Mm,useImperativeHandle:L1,useInsertionEffect:M1,useLayoutEffect:D1,useMemo:B1,useReducer:td,useRef:A1,useState:function(){return td(ur)},useDebugValue:Dm,useDeferredValue:function(i,a){var c=fs();return P1(c,Lt.memoizedState,i,a)},useTransition:function(){var i=td(ur)[0],a=fs().memoizedState;return[typeof i=="boolean"?i:Kl(i),a]},useSyncExternalStore:f1,useId:U1,useHostTransitionStatus:zm,useFormState:C1,useActionState:C1,useOptimistic:function(i,a){var c=fs();return v1(c,Lt,i,a)},useMemoCache:Em,useCacheRefresh:F1};Pm.useEffectEvent=R1;var K1={readContext:Vs,use:ed,useCallback:z1,useContext:Vs,useEffect:Mm,useImperativeHandle:L1,useInsertionEffect:M1,useLayoutEffect:D1,useMemo:B1,useReducer:Am,useRef:A1,useState:function(){return Am(ur)},useDebugValue:Dm,useDeferredValue:function(i,a){var c=fs();return Lt===null?Om(c,i,a):P1(c,Lt.memoizedState,i,a)},useTransition:function(){var i=Am(ur)[0],a=fs().memoizedState;return[typeof i=="boolean"?i:Kl(i),a]},useSyncExternalStore:f1,useId:U1,useHostTransitionStatus:zm,useFormState:j1,useActionState:j1,useOptimistic:function(i,a){var c=fs();return Lt!==null?v1(c,Lt,i,a):(c.baseState=i,[i,c.queue.dispatch])},useMemoCache:Em,useCacheRefresh:F1};K1.useEffectEvent=R1;function Im(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 $m={enqueueSetState:function(i,a,c){i=i._reactInternals;var m=Pn(),b=Vr(m);b.payload=a,c!=null&&(b.callback=c),a=Gr(i,b,m),a!==null&&(kn(a,i,m),ql(a,i,m))},enqueueReplaceState:function(i,a,c){i=i._reactInternals;var m=Pn(),b=Vr(m);b.tag=1,b.payload=a,c!=null&&(b.callback=c),a=Gr(i,b,m),a!==null&&(kn(a,i,m),ql(a,i,m))},enqueueForceUpdate:function(i,a){i=i._reactInternals;var c=Pn(),m=Vr(c);m.tag=2,a!=null&&(m.callback=a),a=Gr(i,m,c),a!==null&&(kn(a,i,c),ql(a,i,c))}};function Y1(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 X1(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&&$m.enqueueReplaceState(a,a.state,null)}function Pa(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 Z1(i){zu(i)}function Q1(i){console.error(i)}function J1(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 e_(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 Hm(i,a,c){return c=Vr(c),c.tag=3,c.payload={element:null},c.callback=function(){rd(i,a)},c}function t_(i){return i=Vr(i),i.tag=3,i}function s_(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(){e_(a,c,m)}}var E=c.stateNode;E!==null&&typeof E.componentDidCatch=="function"&&(i.callback=function(){e_(a,c,m),typeof b!="function"&&(Qr===null?Qr=new Set([this]):Qr.add(this));var L=m.stack;this.componentDidCatch(m.value,{componentStack:L!==null?L:""})})}function eT(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=On.current,c!==null){switch(c.tag){case 31:case 13:return ti===null?xd():c.alternate===null&&ns===0&&(ns=3),c.flags&=-257,c.flags|=65536,c.lanes=b,m===Gu?c.flags|=16384:(a=c.updateQueue,a===null?c.updateQueue=new Set([m]):a.add(m),hp(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)),hp(i,m,b)),!1}throw Error(n(435,c.tag))}return hp(i,m,b),xd(),!1}if(yt)return a=On.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=b,m!==am&&(i=Error(n(422),{cause:m}),Il(Zn(i,c)))):(m!==am&&(a=Error(n(423),{cause:m}),Il(Zn(a,c))),i=i.current.alternate,i.flags|=65536,b&=-b,i.lanes|=b,m=Zn(m,c),b=Hm(i.stateNode,m,b),xm(i,b),ns!==4&&(ns=2)),!1;var y=Error(n(520),{cause:m});if(y=Zn(y,c),ic===null?ic=[y]:ic.push(y),ns!==4&&(ns=2),a===null)return!0;m=Zn(m,c),c=a;do{switch(c.tag){case 3:return c.flags|=65536,i=b&-b,c.lanes|=i,i=Hm(c.stateNode,m,i),xm(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=t_(b),s_(b,i,c,m),xm(c,b),!1}c=c.return}while(c!==null);return!1}var Um=Error(n(461)),_s=!1;function Gs(i,a,c,m){a.child=i===null?a1(a,null,c,m):za(a,i.child,c,m)}function n_(i,a,c,m,b){c=c.render;var y=a.ref;if("ref"in m){var E={};for(var L in m)L!=="ref"&&(E[L]=m[L])}else E=m;return Ma(a),m=Sm(i,a,c,E,y,b),L=km(),i!==null&&!_s?(Nm(i,a,b),dr(i,a,b)):(yt&&L&&im(a),a.flags|=1,Gs(i,a,m,b),a.child)}function i_(i,a,c,m,b){if(i===null){var y=c.type;return typeof y=="function"&&!tm(y)&&y.defaultProps===void 0&&c.compare===null?(a.tag=15,a.type=y,r_(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,!Xm(i,b)){var E=y.memoizedProps;if(c=c.compare,c=c!==null?c:zl,c(E,m)&&i.ref===a.ref)return dr(i,a,b)}return a.flags|=1,i=rr(y,m),i.ref=a.ref,i.return=a,a.child=i}function r_(i,a,c,m,b){if(i!==null){var y=i.memoizedProps;if(zl(y,m)&&i.ref===a.ref)if(_s=!1,a.pendingProps=m=y,Xm(i,b))(i.flags&131072)!==0&&(_s=!0);else return a.lanes=i.lanes,dr(i,a,b)}return Fm(i,a,c,m,b)}function a_(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 o_(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?c1(a,y):vm(),u1(a);else return m=a.lanes=536870912,o_(i,a,y!==null?y.baseLanes|c:c,c,m)}else y!==null?(qu(a,y.cachePool),c1(a,y),Kr(),a.memoizedState=null):(i!==null&&qu(a,null),vm(),Kr());return Gs(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 o_(i,a,c,m,b){var y=fm();return y=y===null?null:{parent:bs._currentValue,pool:y},a.memoizedState={baseLanes:c,cachePool:y},i!==null&&qu(a,null),vm(),u1(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 l_(i,a,c){return za(a,i.child,null,c),i=ad(a,a.pendingProps),i.flags|=2,Ln(a),a.memoizedState=null,i}function tT(i,a,c){var m=a.pendingProps,b=(a.flags&128)!==0;if(a.flags&=-129,i===null){if(yt){if(m.mode==="hidden")return i=ad(a,m),a.lanes=536870912,Zl(null,i);if(ym(a),(i=Vt)?(i=_y(i,ei),i=i!==null&&i.data==="&"?i:null,i!==null&&(a.memoizedState={dehydrated:i,treeContext:$r!==null?{id:Oi,overflow:Li}:null,retryLane:536870912,hydrationErrors:null},c=Vv(i),c.return=a,a.child=c,qs=a,Vt=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(ym(a),b)if(a.flags&256)a.flags&=-257,a=l_(i,a,c);else if(a.memoizedState!==null)a.child=i.child,a.flags|=128,a=null;else throw Error(n(558));else if(_s||Ao(i,a,c,!1),b=(c&i.childLanes)!==0,_s||b){if(m=$t,m!==null&&(E=cs(m,c),E!==0&&E!==y.retryLane))throw y.retryLane=E,ja(i,E),kn(m,i,E),Um;xd(),a=l_(i,a,c)}else i=y.treeContext,Vt=si(E.nextSibling),qs=a,yt=!0,Hr=null,ei=!1,i!==null&&Kv(a,i),a=ad(a,m),a.flags|=4096;return a}return i=rr(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 Fm(i,a,c,m,b){return Ma(a),c=Sm(i,a,c,m,void 0,b),m=km(),i!==null&&!_s?(Nm(i,a,b),dr(i,a,b)):(yt&&m&&im(a),a.flags|=1,Gs(i,a,c,b),a.child)}function c_(i,a,c,m,b,y){return Ma(a),a.updateQueue=null,c=h1(a,m,c,b),d1(i),m=km(),i!==null&&!_s?(Nm(i,a,y),dr(i,a,y)):(yt&&m&&im(a),a.flags|=1,Gs(i,a,c,y),a.child)}function u_(i,a,c,m,b){if(Ma(a),a.stateNode===null){var y=No,E=c.contextType;typeof E=="object"&&E!==null&&(y=Vs(E)),y=new c(m,y),a.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=$m,a.stateNode=y,y._reactInternals=a,y=a.stateNode,y.props=m,y.state=a.memoizedState,y.refs={},pm(a),E=c.contextType,y.context=typeof E=="object"&&E!==null?Vs(E):No,y.state=a.memoizedState,E=c.getDerivedStateFromProps,typeof E=="function"&&(Im(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&&$m.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 L=a.memoizedProps,Y=Pa(c,L);y.props=Y;var ce=y.context,be=c.contextType;E=No,typeof be=="object"&&be!==null&&(E=Vs(be));var Ce=c.getDerivedStateFromProps;be=typeof Ce=="function"||typeof y.getSnapshotBeforeUpdate=="function",L=a.pendingProps!==L,be||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(L||ce!==E)&&X1(a,y,m,E),qr=!1;var de=a.memoizedState;y.state=de,Gl(a,m,y,b),Vl(),ce=a.memoizedState,L||de!==ce||qr?(typeof Ce=="function"&&(Im(a,c,Ce,m),ce=a.memoizedState),(Y=qr||Y1(a,c,Y,m,de,ce,E))?(be||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=ce),y.props=m,y.state=ce,y.context=E,m=Y):(typeof y.componentDidMount=="function"&&(a.flags|=4194308),m=!1)}else{y=a.stateNode,gm(i,a),E=a.memoizedProps,be=Pa(c,E),y.props=be,Ce=a.pendingProps,de=y.context,ce=c.contextType,Y=No,typeof ce=="object"&&ce!==null&&(Y=Vs(ce)),L=c.getDerivedStateFromProps,(ce=typeof L=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(E!==Ce||de!==Y)&&X1(a,y,m,Y),qr=!1,de=a.memoizedState,y.state=de,Gl(a,m,y,b),Vl();var pe=a.memoizedState;E!==Ce||de!==pe||qr||i!==null&&i.dependencies!==null&&Uu(i.dependencies)?(typeof L=="function"&&(Im(a,c,L,m),pe=a.memoizedState),(be=qr||Y1(a,c,be,m,de,pe,Y)||i!==null&&i.dependencies!==null&&Uu(i.dependencies))?(ce||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(m,pe,Y),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(m,pe,Y)),typeof y.componentDidUpdate=="function"&&(a.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof y.componentDidUpdate!="function"||E===i.memoizedProps&&de===i.memoizedState||(a.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||E===i.memoizedProps&&de===i.memoizedState||(a.flags|=1024),a.memoizedProps=m,a.memoizedState=pe),y.props=m,y.state=pe,y.context=Y,m=be):(typeof y.componentDidUpdate!="function"||E===i.memoizedProps&&de===i.memoizedState||(a.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||E===i.memoizedProps&&de===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=za(a,i.child,null,b),a.child=za(a,null,c,b)):Gs(i,a,c,b),a.memoizedState=y.state,i=a.child):i=dr(i,a,b),i}function d_(i,a,c,m){return Ta(),a.flags|=256,Gs(i,a,c,m),a.child}var qm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Vm(i){return{baseLanes:i,cachePool:e1()}}function Gm(i,a,c){return i=i!==null?i.childLanes&~c:0,a&&(i|=Bn),i}function h_(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:(hs.current&2)!==0),E&&(b=!0,a.flags&=-129),E=(a.flags&32)!==0,a.flags&=-33,i===null){if(yt){if(b?Wr(a):Kr(),(i=Vt)?(i=_y(i,ei),i=i!==null&&i.data!=="&"?i:null,i!==null&&(a.memoizedState={dehydrated:i,treeContext:$r!==null?{id:Oi,overflow:Li}:null,retryLane:536870912,hydrationErrors:null},c=Vv(i),c.return=a,a.child=c,qs=a,Vt=null)):i=null,i===null)throw Ur(a);return jp(i)?a.lanes=32:a.lanes=536870912,null}var L=m.children;return m=m.fallback,b?(Kr(),b=a.mode,L=ld({mode:"hidden",children:L},b),m=Aa(m,b,c,null),L.return=a,m.return=a,L.sibling=m,a.child=L,m=a.child,m.memoizedState=Vm(c),m.childLanes=Gm(i,E,c),a.memoizedState=qm,Zl(null,m)):(Wr(a),Wm(a,L))}var Y=i.memoizedState;if(Y!==null&&(L=Y.dehydrated,L!==null)){if(y)a.flags&256?(Wr(a),a.flags&=-257,a=Km(i,a,c)):a.memoizedState!==null?(Kr(),a.child=i.child,a.flags|=128,a=null):(Kr(),L=m.fallback,b=a.mode,m=ld({mode:"visible",children:m.children},b),L=Aa(L,b,c,null),L.flags|=2,m.return=a,L.return=a,m.sibling=L,a.child=m,za(a,i.child,null,c),m=a.child,m.memoizedState=Vm(c),m.childLanes=Gm(i,E,c),a.memoizedState=qm,a=Zl(null,m));else if(Wr(a),jp(L)){if(E=L.nextSibling&&L.nextSibling.dataset,E)var ce=E.dgst;E=ce,m=Error(n(419)),m.stack="",m.digest=E,Il({value:m,source:null,stack:null}),a=Km(i,a,c)}else if(_s||Ao(i,a,c,!1),E=(c&i.childLanes)!==0,_s||E){if(E=$t,E!==null&&(m=cs(E,c),m!==0&&m!==Y.retryLane))throw Y.retryLane=m,ja(i,m),kn(E,i,m),Um;Ep(L)||xd(),a=Km(i,a,c)}else Ep(L)?(a.flags|=192,a.child=i.child,a=null):(i=Y.treeContext,Vt=si(L.nextSibling),qs=a,yt=!0,Hr=null,ei=!1,i!==null&&Kv(a,i),a=Wm(a,m.children),a.flags|=4096);return a}return b?(Kr(),L=m.fallback,b=a.mode,Y=i.child,ce=Y.sibling,m=rr(Y,{mode:"hidden",children:m.children}),m.subtreeFlags=Y.subtreeFlags&65011712,ce!==null?L=rr(ce,L):(L=Aa(L,b,c,null),L.flags|=2),L.return=a,m.return=a,m.sibling=L,a.child=m,Zl(null,m),m=a.child,L=i.child.memoizedState,L===null?L=Vm(c):(b=L.cachePool,b!==null?(Y=bs._currentValue,b=b.parent!==Y?{parent:Y,pool:Y}:b):b=e1(),L={baseLanes:L.baseLanes|c,cachePool:b}),m.memoizedState=L,m.childLanes=Gm(i,E,c),a.memoizedState=qm,Zl(i.child,m)):(Wr(a),c=i.child,i=c.sibling,c=rr(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 Wm(i,a){return a=ld({mode:"visible",children:a},i.mode),a.return=i,i.child=a}function ld(i,a){return i=Dn(22,i,null,a),i.lanes=0,i}function Km(i,a,c){return za(a,i.child,null,c),i=Wm(a,a.pendingProps.children),i.flags|=2,a.memoizedState=null,i}function f_(i,a,c){i.lanes|=a;var m=i.alternate;m!==null&&(m.lanes|=a),cm(i.return,a,c)}function Ym(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 m_(i,a,c){var m=a.pendingProps,b=m.revealOrder,y=m.tail;m=m.children;var E=hs.current,L=(E&2)!==0;if(L?(E=E&1|2,a.flags|=128):E&=1,oe(hs,E),Gs(i,a,m,c),m=yt?Pl:0,!L&&i!==null&&(i.flags&128)!==0)e:for(i=a.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&f_(i,c,a);else if(i.tag===19)f_(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),Ym(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}Ym(a,!0,c,null,y,m);break;case"together":Ym(a,!1,null,null,void 0,m);break;default:a.memoizedState=null}return a.child}function dr(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=rr(i,i.pendingProps),a.child=c,c.return=a;i.sibling!==null;)i=i.sibling,c=c.sibling=rr(i,i.pendingProps),c.return=a;c.sibling=null}return a.child}function Xm(i,a){return(i.lanes&a)!==0?!0:(i=i.dependencies,!!(i!==null&&Uu(i)))}function sT(i,a,c){switch(a.tag){case 3:Re(a,a.stateNode.containerInfo),Fr(a,bs,i.memoizedState.cache),Ta();break;case 27:case 5:Je(a);break;case 4:Re(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,ym(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?h_(i,a,c):(Wr(a),i=dr(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 m_(i,a,c);a.flags|=128}if(b=a.memoizedState,b!==null&&(b.rendering=null,b.tail=null,b.lastEffect=null),oe(hs,hs.current),m)break;return null;case 22:return a.lanes=0,a_(i,a,c,a.pendingProps);case 24:Fr(a,bs,i.memoizedState.cache)}return dr(i,a,c)}function p_(i,a,c){if(i!==null)if(i.memoizedProps!==a.pendingProps)_s=!0;else{if(!Xm(i,c)&&(a.flags&128)===0)return _s=!1,sT(i,a,c);_s=(i.flags&131072)!==0}else _s=!1,yt&&(a.flags&1048576)!==0&&Wv(a,Pl,a.index);switch(a.lanes=0,a.tag){case 16:e:{var m=a.pendingProps;if(i=Oa(a.elementType),a.type=i,typeof i=="function")tm(i)?(m=Pa(i,m),a.tag=1,a=u_(null,a,i,m,c)):(a.tag=0,a=Fm(null,a,i,m,c));else{if(i!=null){var b=i.$$typeof;if(b===T){a.tag=11,a=n_(null,a,i,m,c);break e}else if(b===$){a.tag=14,a=i_(null,a,i,m,c);break e}}throw a=U(i)||i,Error(n(306,a,""))}}return a;case 0:return Fm(i,a,a.type,a.pendingProps,c);case 1:return m=a.type,b=Pa(m,a.pendingProps),u_(i,a,m,b,c);case 3:e:{if(Re(a,a.stateNode.containerInfo),i===null)throw Error(n(387));m=a.pendingProps;var y=a.memoizedState;b=y.element,gm(i,a),Gl(a,m,null,c);var E=a.memoizedState;if(m=E.cache,Fr(a,bs,m),m!==y.cache&&um(a,[bs],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=d_(i,a,m,c);break e}else if(m!==b){b=Zn(Error(n(424)),a),Il(b),a=d_(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,Vt=si(i.firstChild),qs=a,yt=!0,Hr=null,ei=!0,c=a1(a,null,m,c),a.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(Ta(),m===b){a=dr(i,a,c);break e}Gs(i,a,m,c)}a=a.child}return a;case 26:return od(i,a),i===null?(c=Cy(a.type,null,a.pendingProps,null))?a.memoizedState=c:yt||(c=a.type,i=a.pendingProps,m=kd(ie.current).createElement(c),m[us]=a,m[Qs]=i,Ws(m,c,i),gs(m),a.stateNode=m):a.memoizedState=Cy(a.type,i.memoizedProps,a.pendingProps,i.memoizedState),null;case 27:return Je(a),i===null&&yt&&(m=a.stateNode=Sy(a.type,a.pendingProps,ie.current),qs=a,ei=!0,b=Vt,sa(a.type)?(Ap=b,Vt=si(m.firstChild)):Vt=b),Gs(i,a,a.pendingProps.children,c),od(i,a),i===null&&(a.flags|=4194304),a.child;case 5:return i===null&&yt&&((b=m=Vt)&&(m=MT(m,a.type,a.pendingProps,ei),m!==null?(a.stateNode=m,qs=a,Vt=si(m.firstChild),ei=!1,b=!0):b=!1),b||Ur(a)),Je(a),b=a.type,y=a.pendingProps,E=i!==null?i.memoizedProps:null,m=y.children,kp(b,y)?m=null:E!==null&&kp(b,E)&&(a.flags|=32),a.memoizedState!==null&&(b=Sm(i,a,WA,null,null,c),hc._currentValue=b),od(i,a),Gs(i,a,m,c),a.child;case 6:return i===null&&yt&&((i=c=Vt)&&(c=DT(c,a.pendingProps,ei),c!==null?(a.stateNode=c,qs=a,Vt=null,i=!0):i=!1),i||Ur(a)),null;case 13:return h_(i,a,c);case 4:return Re(a,a.stateNode.containerInfo),m=a.pendingProps,i===null?a.child=za(a,null,m,c):Gs(i,a,m,c),a.child;case 11:return n_(i,a,a.type,a.pendingProps,c);case 7:return Gs(i,a,a.pendingProps,c),a.child;case 8:return Gs(i,a,a.pendingProps.children,c),a.child;case 12:return Gs(i,a,a.pendingProps.children,c),a.child;case 10:return m=a.pendingProps,Fr(a,a.type,m.value),Gs(i,a,m.children,c),a.child;case 9:return b=a.type._context,m=a.pendingProps.children,Ma(a),b=Vs(b),m=m(b),a.flags|=1,Gs(i,a,m,c),a.child;case 14:return i_(i,a,a.type,a.pendingProps,c);case 15:return r_(i,a,a.type,a.pendingProps,c);case 19:return m_(i,a,c);case 31:return tT(i,a,c);case 22:return a_(i,a,c,a.pendingProps);case 24:return Ma(a),m=Vs(bs),i===null?(b=fm(),b===null&&(b=$t,y=dm(),b.pooledCache=y,y.refCount++,y!==null&&(b.pooledCacheLanes|=c),b=y),a.memoizedState={parent:m,cache:b},pm(a),Fr(a,bs,b)):((i.lanes&c)!==0&&(gm(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,bs,m)):(m=y.cache,Fr(a,bs,m),m!==b.cache&&um(a,[bs],c,!0))),Gs(i,a,a.pendingProps.children,c),a.child;case 29:throw a.pendingProps}throw Error(n(156,a.tag))}function hr(i){i.flags|=4}function Zm(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(U_())i.flags|=8192;else throw La=Gu,mm}else i.flags&=-16777217}function g_(i,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!Ry(a))if(U_())i.flags|=8192;else throw La=Gu,mm}function cd(i,a){a!==null&&(i.flags|=4),i.flags&16384&&(a=i.tag!==22?Pe():536870912,i.lanes|=a,Ho|=a)}function Ql(i,a){if(!yt)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 Gt(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 nT(i,a,c){var m=a.pendingProps;switch(rm(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Gt(a),null;case 1:return Gt(a),null;case 3:return c=a.stateNode,m=null,i!==null&&(m=i.memoizedState.cache),a.memoizedState.cache!==m&&(a.flags|=2048),lr(bs),De(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(i===null||i.child===null)&&(jo(a)?hr(a):i===null||i.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,om())),Gt(a),null;case 26:var b=a.type,y=a.memoizedState;return i===null?(hr(a),y!==null?(Gt(a),g_(a,y)):(Gt(a),Zm(a,b,null,m,c))):y?y!==i.memoizedState?(hr(a),Gt(a),g_(a,y)):(Gt(a),a.flags&=-16777217):(i=i.memoizedProps,i!==m&&hr(a),Gt(a),Zm(a,b,i,m,c)),null;case 27:if(Ne(a),c=ie.current,b=a.type,i!==null&&a.stateNode!=null)i.memoizedProps!==m&&hr(a);else{if(!m){if(a.stateNode===null)throw Error(n(166));return Gt(a),null}i=ee.current,jo(a)?Yv(a):(i=Sy(b,m,c),a.stateNode=i,hr(a))}return Gt(a),null;case 5:if(Ne(a),b=a.type,i!==null&&a.stateNode!=null)i.memoizedProps!==m&&hr(a);else{if(!m){if(a.stateNode===null)throw Error(n(166));return Gt(a),null}if(y=ee.current,jo(a))Yv(a);else{var E=kd(ie.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[us]=a,y[Qs]=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(Ws(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&&hr(a)}}return Gt(a),Zm(a,a.type,i===null?null:i.memoizedProps,a.pendingProps,c),null;case 6:if(i&&a.stateNode!=null)i.memoizedProps!==m&&hr(a);else{if(typeof m!="string"&&a.stateNode===null)throw Error(n(166));if(i=ie.current,jo(a)){if(i=a.stateNode,c=a.memoizedProps,m=null,b=qs,b!==null)switch(b.tag){case 27:case 5:m=b.memoizedProps}i[us]=a,i=!!(i.nodeValue===c||m!==null&&m.suppressHydrationWarning===!0||hy(i.nodeValue,c)),i||Ur(a,!0)}else i=kd(i).createTextNode(m),i[us]=a,a.stateNode=i}return Gt(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[us]=a}else Ta(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Gt(a),i=!1}else c=om(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=c),i=!0;if(!i)return a.flags&256?(Ln(a),a):(Ln(a),null);if((a.flags&128)!==0)throw Error(n(558))}return Gt(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[us]=a}else Ta(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Gt(a),b=!1}else b=om(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=b),b=!0;if(!b)return a.flags&256?(Ln(a),a):(Ln(a),null)}return Ln(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),Gt(a),null);case 4:return De(),i===null&&vp(a.stateNode.containerInfo),Gt(a),null;case 10:return lr(a.type),Gt(a),null;case 19:if(q(hs),m=a.memoizedState,m===null)return Gt(a),null;if(b=(a.flags&128)!==0,y=m.rendering,y===null)if(b)Ql(m,!1);else{if(ns!==0||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;)qv(c,i),c=c.sibling;return oe(hs,hs.current&1|2),yt&&ar(a,m.treeForkCount),a.child}i=i.sibling}m.tail!==null&&It()>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&&!yt)return Gt(a),null}else 2*It()-m.renderingStartTime>md&&c!==536870912&&(a.flags|=128,b=!0,Ql(m,!1),a.lanes=4194304);m.isBackwards?(y.sibling=a.child,a.child=y):(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=It(),i.sibling=null,c=hs.current,oe(hs,b?c&1|2:c&1),yt&&ar(a,m.treeForkCount),i):(Gt(a),null);case 22:case 23:return Ln(a),_m(),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&&(Gt(a),a.subtreeFlags&6&&(a.flags|=8192)):Gt(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&&q(Da),null;case 24:return c=null,i!==null&&(c=i.memoizedState.cache),a.memoizedState.cache!==c&&(a.flags|=2048),lr(bs),Gt(a),null;case 25:return null;case 30:return null}throw Error(n(156,a.tag))}function iT(i,a){switch(rm(a),a.tag){case 1:return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 3:return lr(bs),De(),i=a.flags,(i&65536)!==0&&(i&128)===0?(a.flags=i&-65537|128,a):null;case 26:case 27:case 5:return Ne(a),null;case 31:if(a.memoizedState!==null){if(Ln(a),a.alternate===null)throw Error(n(340));Ta()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 13:if(Ln(a),i=a.memoizedState,i!==null&&i.dehydrated!==null){if(a.alternate===null)throw Error(n(340));Ta()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 19:return q(hs),null;case 4:return De(),null;case 10:return lr(a.type),null;case 22:case 23:return Ln(a),_m(),i!==null&&q(Da),i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 24:return lr(bs),null;case 25:return null;default:return null}}function x_(i,a){switch(rm(a),a.tag){case 3:lr(bs),De();break;case 26:case 27:case 5:Ne(a);break;case 4:De();break;case 31:a.memoizedState!==null&&Ln(a);break;case 13:Ln(a);break;case 19:q(hs);break;case 10:lr(a.type);break;case 22:case 23:Ln(a),_m(),i!==null&&q(Da);break;case 24:lr(bs)}}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(L){Dt(a,a.return,L)}}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,L=E.destroy;if(L!==void 0){E.destroy=void 0,b=a;var Y=c,ce=L;try{ce()}catch(be){Dt(b,Y,be)}}}m=m.next}while(m!==y)}}catch(be){Dt(a,a.return,be)}}function b_(i){var a=i.updateQueue;if(a!==null){var c=i.stateNode;try{l1(a,c)}catch(m){Dt(i,i.return,m)}}}function v_(i,a,c){c.props=Pa(i.type,i.memoizedProps),c.state=i.memoizedState;try{c.componentWillUnmount()}catch(m){Dt(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){Dt(i,a,b)}}function zi(i,a){var c=i.ref,m=i.refCleanup;if(c!==null)if(typeof m=="function")try{m()}catch(b){Dt(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){Dt(i,a,b)}else c.current=null}function __(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){Dt(i,i.return,b)}}function Qm(i,a,c){try{var m=i.stateNode;CT(m,i.type,c,a),m[Qs]=a}catch(b){Dt(i,i.return,b)}}function y_(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&sa(i.type)||i.tag===4}function Jm(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||y_(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 ep(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=Ie));else if(m!==4&&(m===27&&sa(i.type)&&(c=i.stateNode,a=null),i=i.child,i!==null))for(ep(i,a,c),i=i.sibling;i!==null;)ep(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 w_(i){var a=i.stateNode,c=i.memoizedProps;try{for(var m=i.type,b=a.attributes;b.length;)a.removeAttributeNode(b[0]);Ws(a,m,c),a[us]=i,a[Qs]=c}catch(y){Dt(i,i.return,y)}}var fr=!1,ys=!1,tp=!1,S_=typeof WeakSet=="function"?WeakSet:Set,Ls=null;function rT(i,a){if(i=i.containerInfo,wp=Rd,i=Lv(i),Kf(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,L=-1,Y=-1,ce=0,be=0,Ce=i,de=null;t:for(;;){for(var pe;Ce!==c||b!==0&&Ce.nodeType!==3||(L=E+b),Ce!==y||m!==0&&Ce.nodeType!==3||(Y=E+m),Ce.nodeType===3&&(E+=Ce.nodeValue.length),(pe=Ce.firstChild)!==null;)de=Ce,Ce=pe;for(;;){if(Ce===i)break t;if(de===c&&++ce===b&&(L=E),de===y&&++be===m&&(Y=E),(pe=Ce.nextSibling)!==null)break;Ce=de,de=Ce.parentNode}Ce=pe}c=L===-1||Y===-1?null:{start:L,end:Y}}else c=null}c=c||{start:0,end:0}}else c=null;for(Sp={focusedElem:i,selectionRange:c},Rd=!1,Ls=a;Ls!==null;)if(a=Ls,i=a.child,(a.subtreeFlags&1028)!==0&&i!==null)i.return=a,Ls=i;else for(;Ls!==null;){switch(a=Ls,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 We=Pa(c.type,b);i=m.getSnapshotBeforeUpdate(We,y),m.__reactInternalSnapshotBeforeUpdate=i}catch(st){Dt(c,c.return,st)}}break;case 3:if((i&1024)!==0){if(i=a.stateNode.containerInfo,c=i.nodeType,c===9)Cp(i);else if(c===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":Cp(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(n(163))}if(i=a.sibling,i!==null){i.return=a.return,Ls=i;break}Ls=a.return}}function k_(i,a,c){var m=c.flags;switch(c.tag){case 0:case 11:case 15:pr(i,c),m&4&&Jl(5,c);break;case 1:if(pr(i,c),m&4)if(i=c.stateNode,a===null)try{i.componentDidMount()}catch(E){Dt(c,c.return,E)}else{var b=Pa(c.type,a.memoizedProps);a=a.memoizedState;try{i.componentDidUpdate(b,a,i.__reactInternalSnapshotBeforeUpdate)}catch(E){Dt(c,c.return,E)}}m&64&&b_(c),m&512&&ec(c,c.return);break;case 3:if(pr(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{l1(i,a)}catch(E){Dt(c,c.return,E)}}break;case 27:a===null&&m&4&&w_(c);case 26:case 5:pr(i,c),a===null&&m&4&&__(c),m&512&&ec(c,c.return);break;case 12:pr(i,c);break;case 31:pr(i,c),m&4&&E_(i,c);break;case 13:pr(i,c),m&4&&j_(i,c),m&64&&(i=c.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(c=mT.bind(null,c),OT(i,c))));break;case 22:if(m=c.memoizedState!==null||fr,!m){a=a!==null&&a.memoizedState!==null||ys,b=fr;var y=ys;fr=m,(ys=a)&&!y?gr(i,c,(c.subtreeFlags&8772)!==0):pr(i,c),fr=b,ys=y}break;case 30:break;default:pr(i,c)}}function N_(i){var a=i.alternate;a!==null&&(i.alternate=null,N_(a)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(a=i.stateNode,a!==null&&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 Zt=null,_n=!1;function mr(i,a,c){for(c=c.child;c!==null;)C_(i,a,c),c=c.sibling}function C_(i,a,c){if(he&&typeof he.onCommitFiberUnmount=="function")try{he.onCommitFiberUnmount(ye,c)}catch{}switch(c.tag){case 26:ys||zi(c,a),mr(i,a,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:ys||zi(c,a);var m=Zt,b=_n;sa(c.type)&&(Zt=c.stateNode,_n=!1),mr(i,a,c),cc(c.stateNode),Zt=m,_n=b;break;case 5:ys||zi(c,a);case 6:if(m=Zt,b=_n,Zt=null,mr(i,a,c),Zt=m,_n=b,Zt!==null)if(_n)try{(Zt.nodeType===9?Zt.body:Zt.nodeName==="HTML"?Zt.ownerDocument.body:Zt).removeChild(c.stateNode)}catch(y){Dt(c,a,y)}else try{Zt.removeChild(c.stateNode)}catch(y){Dt(c,a,y)}break;case 18:Zt!==null&&(_n?(i=Zt,by(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,c.stateNode),Yo(i)):by(Zt,c.stateNode));break;case 4:m=Zt,b=_n,Zt=c.stateNode.containerInfo,_n=!0,mr(i,a,c),Zt=m,_n=b;break;case 0:case 11:case 14:case 15:Yr(2,c,a),ys||Yr(4,c,a),mr(i,a,c);break;case 1:ys||(zi(c,a),m=c.stateNode,typeof m.componentWillUnmount=="function"&&v_(c,a,m)),mr(i,a,c);break;case 21:mr(i,a,c);break;case 22:ys=(m=ys)||c.memoizedState!==null,mr(i,a,c),ys=m;break;default:mr(i,a,c)}}function E_(i,a){if(a.memoizedState===null&&(i=a.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{Yo(i)}catch(c){Dt(a,a.return,c)}}}function j_(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){Dt(a,a.return,c)}}function aT(i){switch(i.tag){case 31:case 13:case 19:var a=i.stateNode;return a===null&&(a=i.stateNode=new S_),a;case 22:return i=i.stateNode,a=i._retryCache,a===null&&(a=i._retryCache=new S_),a;default:throw Error(n(435,i.tag))}}function dd(i,a){var c=aT(i);a.forEach(function(m){if(!c.has(m)){c.add(m);var b=pT.bind(null,i,m);m.then(b,b)}})}function yn(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,L=E;e:for(;L!==null;){switch(L.tag){case 27:if(sa(L.type)){Zt=L.stateNode,_n=!1;break e}break;case 5:Zt=L.stateNode,_n=!1;break e;case 3:case 4:Zt=L.stateNode.containerInfo,_n=!0;break e}L=L.return}if(Zt===null)throw Error(n(160));C_(y,E,b),Zt=null,_n=!1,y=b.alternate,y!==null&&(y.return=null),b.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)A_(a,i),a=a.sibling}var wi=null;function A_(i,a){var c=i.alternate,m=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:yn(a,i),wn(i),m&4&&(Yr(3,i,i.return),Jl(3,i),Yr(5,i,i.return));break;case 1:yn(a,i),wn(i),m&512&&(ys||c===null||zi(c,c.return)),m&64&&fr&&(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=wi;if(yn(a,i),wn(i),m&512&&(ys||c===null||zi(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[wa]||y[us]||y.namespaceURI==="http://www.w3.org/2000/svg"||y.hasAttribute("itemprop"))&&(y=b.createElement(m),b.head.insertBefore(y,b.querySelector("head > title"))),Ws(y,m,c),y[us]=i,gs(y),m=y;break e;case"link":var E=Ay("link","href",b).get(m+(c.href||""));if(E){for(var L=0;L<E.length;L++)if(y=E[L],y.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&y.getAttribute("rel")===(c.rel==null?null:c.rel)&&y.getAttribute("title")===(c.title==null?null:c.title)&&y.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){E.splice(L,1);break t}}y=b.createElement(m),Ws(y,m,c),b.head.appendChild(y);break;case"meta":if(E=Ay("meta","content",b).get(m+(c.content||""))){for(L=0;L<E.length;L++)if(y=E[L],y.getAttribute("content")===(c.content==null?null:""+c.content)&&y.getAttribute("name")===(c.name==null?null:c.name)&&y.getAttribute("property")===(c.property==null?null:c.property)&&y.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&y.getAttribute("charset")===(c.charSet==null?null:c.charSet)){E.splice(L,1);break t}}y=b.createElement(m),Ws(y,m,c),b.head.appendChild(y);break;default:throw Error(n(468,m))}y[us]=i,gs(y),m=y}i.stateNode=m}else Ty(b,i.type,i.stateNode);else i.stateNode=jy(b,m,i.memoizedProps);else y!==m?(y===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):y.count--,m===null?Ty(b,i.type,i.stateNode):jy(b,m,i.memoizedProps)):m===null&&i.stateNode!==null&&Qm(i,i.memoizedProps,c.memoizedProps)}break;case 27:yn(a,i),wn(i),m&512&&(ys||c===null||zi(c,c.return)),c!==null&&m&4&&Qm(i,i.memoizedProps,c.memoizedProps);break;case 5:if(yn(a,i),wn(i),m&512&&(ys||c===null||zi(c,c.return)),i.flags&32){b=i.stateNode;try{nt(b,"")}catch(We){Dt(i,i.return,We)}}m&4&&i.stateNode!=null&&(b=i.memoizedProps,Qm(i,b,c!==null?c.memoizedProps:b)),m&1024&&(tp=!0);break;case 6:if(yn(a,i),wn(i),m&4){if(i.stateNode===null)throw Error(n(162));m=i.memoizedProps,c=i.stateNode;try{c.nodeValue=m}catch(We){Dt(i,i.return,We)}}break;case 3:if(Ed=null,b=wi,wi=Nd(a.containerInfo),yn(a,i),wi=b,wn(i),m&4&&c!==null&&c.memoizedState.isDehydrated)try{Yo(a.containerInfo)}catch(We){Dt(i,i.return,We)}tp&&(tp=!1,T_(i));break;case 4:m=wi,wi=Nd(i.stateNode.containerInfo),yn(a,i),wn(i),wi=m;break;case 12:yn(a,i),wn(i);break;case 31:yn(a,i),wn(i),m&4&&(m=i.updateQueue,m!==null&&(i.updateQueue=null,dd(i,m)));break;case 13:yn(a,i),wn(i),i.child.flags&8192&&i.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(fd=It()),m&4&&(m=i.updateQueue,m!==null&&(i.updateQueue=null,dd(i,m)));break;case 22:b=i.memoizedState!==null;var Y=c!==null&&c.memoizedState!==null,ce=fr,be=ys;if(fr=ce||b,ys=be||Y,yn(a,i),ys=be,fr=ce,wn(i),m&8192)e:for(a=i.stateNode,a._visibility=b?a._visibility&-2:a._visibility|1,b&&(c===null||Y||fr||ys||Ia(i)),c=null,a=i;;){if(a.tag===5||a.tag===26){if(c===null){Y=c=a;try{if(y=Y.stateNode,b)E=y.style,typeof E.setProperty=="function"?E.setProperty("display","none","important"):E.display="none";else{L=Y.stateNode;var Ce=Y.memoizedProps.style,de=Ce!=null&&Ce.hasOwnProperty("display")?Ce.display:null;L.style.display=de==null||typeof de=="boolean"?"":(""+de).trim()}}catch(We){Dt(Y,Y.return,We)}}}else if(a.tag===6){if(c===null){Y=a;try{Y.stateNode.nodeValue=b?"":Y.memoizedProps}catch(We){Dt(Y,Y.return,We)}}}else if(a.tag===18){if(c===null){Y=a;try{var pe=Y.stateNode;b?vy(pe,!0):vy(Y.stateNode,!1)}catch(We){Dt(Y,Y.return,We)}}}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:yn(a,i),wn(i),m&4&&(m=i.updateQueue,m!==null&&(i.updateQueue=null,dd(i,m)));break;case 30:break;case 21:break;default:yn(a,i),wn(i)}}function wn(i){var a=i.flags;if(a&2){try{for(var c,m=i.return;m!==null;){if(y_(m)){c=m;break}m=m.return}if(c==null)throw Error(n(160));switch(c.tag){case 27:var b=c.stateNode,y=Jm(i);ud(i,y,b);break;case 5:var E=c.stateNode;c.flags&32&&(nt(E,""),c.flags&=-33);var L=Jm(i);ud(i,L,E);break;case 3:case 4:var Y=c.stateNode.containerInfo,ce=Jm(i);ep(i,ce,Y);break;default:throw Error(n(161))}}catch(be){Dt(i,i.return,be)}i.flags&=-3}a&4096&&(i.flags&=-4097)}function T_(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var a=i;T_(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),i=i.sibling}}function pr(i,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)k_(i,a.alternate,a),a=a.sibling}function Ia(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),Ia(a);break;case 1:zi(a,a.return);var c=a.stateNode;typeof c.componentWillUnmount=="function"&&v_(a,a.return,c),Ia(a);break;case 27:cc(a.stateNode);case 26:case 5:zi(a,a.return),Ia(a);break;case 22:a.memoizedState===null&&Ia(a);break;case 30:Ia(a);break;default:Ia(a)}i=i.sibling}}function gr(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:gr(b,y,c),Jl(4,y);break;case 1:if(gr(b,y,c),m=y,b=m.stateNode,typeof b.componentDidMount=="function")try{b.componentDidMount()}catch(ce){Dt(m,m.return,ce)}if(m=y,b=m.updateQueue,b!==null){var L=m.stateNode;try{var Y=b.shared.hiddenCallbacks;if(Y!==null)for(b.shared.hiddenCallbacks=null,b=0;b<Y.length;b++)o1(Y[b],L)}catch(ce){Dt(m,m.return,ce)}}c&&E&64&&b_(y),ec(y,y.return);break;case 27:w_(y);case 26:case 5:gr(b,y,c),c&&m===null&&E&4&&__(y),ec(y,y.return);break;case 12:gr(b,y,c);break;case 31:gr(b,y,c),c&&E&4&&E_(b,y);break;case 13:gr(b,y,c),c&&E&4&&j_(b,y);break;case 22:y.memoizedState===null&&gr(b,y,c),ec(y,y.return);break;case 30:break;default:gr(b,y,c)}a=a.sibling}}function sp(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 np(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 Si(i,a,c,m){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)R_(i,a,c,m),a=a.sibling}function R_(i,a,c,m){var b=a.flags;switch(a.tag){case 0:case 11:case 15:Si(i,a,c,m),b&2048&&Jl(9,a);break;case 1:Si(i,a,c,m);break;case 3:Si(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){Si(i,a,c,m),i=a.stateNode;try{var y=a.memoizedProps,E=y.id,L=y.onPostCommit;typeof L=="function"&&L(E,a.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(Y){Dt(a,a.return,Y)}}else Si(i,a,c,m);break;case 31:Si(i,a,c,m);break;case 13:Si(i,a,c,m);break;case 23:break;case 22:y=a.stateNode,E=a.alternate,a.memoizedState!==null?y._visibility&2?Si(i,a,c,m):tc(i,a):y._visibility&2?Si(i,a,c,m):(y._visibility|=2,Po(i,a,c,m,(a.subtreeFlags&10256)!==0||!1)),b&2048&&sp(E,a);break;case 24:Si(i,a,c,m),b&2048&&np(a.alternate,a);break;default:Si(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,L=c,Y=m,ce=E.flags;switch(E.tag){case 0:case 11:case 15:Po(y,E,L,Y,b),Jl(8,E);break;case 23:break;case 22:var be=E.stateNode;E.memoizedState!==null?be._visibility&2?Po(y,E,L,Y,b):tc(y,E):(be._visibility|=2,Po(y,E,L,Y,b)),b&&ce&2048&&sp(E.alternate,E);break;case 24:Po(y,E,L,Y,b),b&&ce&2048&&np(E.alternate,E);break;default:Po(y,E,L,Y,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&&sp(m.alternate,m);break;case 24:tc(c,m),b&2048&&np(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;)M_(i,a,c),i=i.sibling}function M_(i,a,c){switch(i.tag){case 26:Io(i,a,c),i.flags&sc&&i.memoizedState!==null&>(c,wi,i.memoizedState,i.memoizedProps);break;case 5:Io(i,a,c);break;case 3:case 4:var m=wi;wi=Nd(i.stateNode.containerInfo),Io(i,a,c),wi=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 D_(i){var a=i.alternate;if(a!==null&&(i=a.child,i!==null)){a.child=null;do a=i.sibling,i.sibling=null,i=a;while(i!==null)}}function 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];Ls=m,L_(m,i)}D_(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)O_(i),i=i.sibling}function O_(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];Ls=m,L_(m,i)}D_(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 L_(i,a){for(;Ls!==null;){var c=Ls;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,Ls=m;else e:for(c=i;Ls!==null;){m=Ls;var b=m.sibling,y=m.return;if(N_(m),m===c){Ls=null;break e}if(b!==null){b.return=y,Ls=b;break e}Ls=y}}}var oT={getCacheForType:function(i){var a=Vs(bs),c=a.data.get(i);return c===void 0&&(c=i(),a.data.set(i,c)),c},cacheSignal:function(){return Vs(bs).controller.signal}},lT=typeof WeakMap=="function"?WeakMap:Map,Ct=0,$t=null,gt=null,vt=0,Mt=0,zn=null,Xr=!1,$o=!1,ip=!1,xr=0,ns=0,Zr=0,$a=0,rp=0,Bn=0,Ho=0,ic=null,Sn=null,ap=!1,fd=0,z_=0,md=1/0,pd=null,Qr=null,Es=0,Jr=null,Uo=null,br=0,op=0,lp=null,B_=null,rc=0,cp=null;function Pn(){return(Ct&2)!==0&&vt!==0?vt&-vt:I.T!==null?pp():mo()}function P_(){if(Bn===0)if((vt&536870912)===0||yt){var i=je;je<<=1,(je&3932160)===0&&(je=262144),Bn=i}else Bn=536870912;return i=On.current,i!==null&&(i.flags|=32),Bn}function kn(i,a,c){(i===$t&&(Mt===2||Mt===9)||i.cancelPendingCommit!==null)&&(Fo(i,0),ea(i,vt,Bn,!1)),Et(i,c),((Ct&2)===0||i!==$t)&&(i===$t&&((Ct&2)===0&&($a|=c),ns===4&&ea(i,vt,Bn,!1)),Bi(i))}function I_(i,a,c){if((Ct&6)!==0)throw Error(n(327));var m=!c&&(a&127)===0&&(a&i.expiredLanes)===0||se(i,a),b=m?dT(i,a):dp(i,a,!0),y=m;do{if(b===0){$o&&!m&&ea(i,a,0,!1);break}else{if(c=i.current.alternate,y&&!cT(c)){b=dp(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 L=i;b=ic;var Y=L.current.memoizedState.isDehydrated;if(Y&&(Fo(L,E).flags|=256),E=dp(L,E,!1),E!==2){if(ip&&!Y){L.errorRecoveryDisabledLanes|=y,$a|=y,b=4;break e}y=Sn,Sn=b,y!==null&&(Sn===null?Sn=y:Sn.push.apply(Sn,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,Bn,!Xr);break e;case 2:Sn=null;break;case 3:case 5:break;default:throw Error(n(329))}if((a&62914560)===a&&(b=fd+300-It(),10<b)){if(ea(m,a,Bn,!Xr),H(m,0,!0)!==0)break e;br=a,m.timeoutHandle=gy($_.bind(null,m,c,Sn,pd,ap,a,Bn,$a,Ho,Xr,y,"Throttled",-0,0),b);break e}$_(m,c,Sn,pd,ap,a,Bn,$a,Ho,Xr,y,null,-0,0)}}break}while(!0);Bi(i)}function $_(i,a,c,m,b,y,E,L,Y,ce,be,Ce,de,pe){if(i.timeoutHandle=-1,Ce=a.subtreeFlags,Ce&8192||(Ce&16785408)===16785408){Ce={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ie},M_(a,y,Ce);var We=(y&62914560)===y?fd-It():(y&4194048)===y?z_-It():0;if(We=WT(Ce,We),We!==null){br=y,i.cancelPendingCommit=We(K_.bind(null,i,a,y,c,m,b,E,L,Y,be,Ce,null,de,pe)),ea(i,y,E,!ce);return}}K_(i,a,y,c,m,b,E,L,Y)}function cT(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(!Mn(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&=~rp,a&=~$a,i.suspendedLanes|=a,i.pingedLanes&=~a,m&&(i.warmLanes|=a),m=i.expirationTimes;for(var b=a;0<b;){var y=31-R(b),E=1<<y;m[y]=-1,b&=~E}c!==0&&He(i,c,a)}function gd(){return(Ct&6)===0?(ac(0),!1):!0}function up(){if(gt!==null){if(Mt===0)var i=gt.return;else i=gt,or=Ra=null,Cm(i),Do=null,Ul=0,i=gt;for(;i!==null;)x_(i.alternate,i),i=i.return;gt=null}}function Fo(i,a){var c=i.timeoutHandle;c!==-1&&(i.timeoutHandle=-1,AT(c)),c=i.cancelPendingCommit,c!==null&&(i.cancelPendingCommit=null,c()),br=0,up(),$t=i,gt=c=rr(i.current,null),vt=a,Mt=0,zn=null,Xr=!1,$o=se(i,a),ip=!1,Ho=Bn=rp=$a=Zr=ns=0,Sn=ic=null,ap=!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-R(m),y=1<<b;a|=i[b],m&=~y}return xr=a,Bu(),c}function H_(i,a){ct=null,I.H=Xl,a===Mo||a===Vu?(a=n1(),Mt=3):a===mm?(a=n1(),Mt=4):Mt=a===Um?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,zn=a,gt===null&&(ns=1,rd(i,Zn(a,i.current)))}function U_(){var i=On.current;return i===null?!0:(vt&4194048)===vt?ti===null:(vt&62914560)===vt||(vt&536870912)!==0?i===ti:!1}function F_(){var i=I.H;return I.H=Xl,i===null?Xl:i}function q_(){var i=I.A;return I.A=oT,i}function xd(){ns=4,Xr||(vt&4194048)!==vt&&On.current!==null||($o=!0),(Zr&134217727)===0&&($a&134217727)===0||$t===null||ea($t,vt,Bn,!1)}function dp(i,a,c){var m=Ct;Ct|=2;var b=F_(),y=q_();($t!==i||vt!==a)&&(pd=null,Fo(i,a)),a=!1;var E=ns;e:do try{if(Mt!==0&>!==null){var L=gt,Y=zn;switch(Mt){case 8:up(),E=6;break e;case 3:case 2:case 9:case 6:On.current===null&&(a=!0);var ce=Mt;if(Mt=0,zn=null,qo(i,L,Y,ce),c&&$o){E=0;break e}break;default:ce=Mt,Mt=0,zn=null,qo(i,L,Y,ce)}}uT(),E=ns;break}catch(be){H_(i,be)}while(!0);return a&&i.shellSuspendCounter++,or=Ra=null,Ct=m,I.H=b,I.A=y,gt===null&&($t=null,vt=0,Bu()),E}function uT(){for(;gt!==null;)V_(gt)}function dT(i,a){var c=Ct;Ct|=2;var m=F_(),b=q_();$t!==i||vt!==a?(pd=null,md=It()+500,Fo(i,a)):$o=se(i,a);e:do try{if(Mt!==0&>!==null){a=gt;var y=zn;t:switch(Mt){case 1:Mt=0,zn=null,qo(i,a,y,1);break;case 2:case 9:if(t1(y)){Mt=0,zn=null,G_(a);break}a=function(){Mt!==2&&Mt!==9||$t!==i||(Mt=7),Bi(i)},y.then(a,a);break e;case 3:Mt=7;break e;case 4:Mt=5;break e;case 7:t1(y)?(Mt=0,zn=null,G_(a)):(Mt=0,zn=null,qo(i,a,y,7));break;case 5:var E=null;switch(gt.tag){case 26:E=gt.memoizedState;case 5:case 27:var L=gt;if(E?Ry(E):L.stateNode.complete){Mt=0,zn=null;var Y=L.sibling;if(Y!==null)gt=Y;else{var ce=L.return;ce!==null?(gt=ce,bd(ce)):gt=null}break t}}Mt=0,zn=null,qo(i,a,y,5);break;case 6:Mt=0,zn=null,qo(i,a,y,6);break;case 8:up(),ns=6;break e;default:throw Error(n(462))}}hT();break}catch(be){H_(i,be)}while(!0);return or=Ra=null,I.H=m,I.A=b,Ct=c,gt!==null?0:($t=null,vt=0,Bu(),ns)}function hT(){for(;gt!==null&&!Ri();)V_(gt)}function V_(i){var a=p_(i.alternate,i,xr);i.memoizedProps=i.pendingProps,a===null?bd(i):gt=a}function G_(i){var a=i,c=a.alternate;switch(a.tag){case 15:case 0:a=c_(c,a,a.pendingProps,a.type,void 0,vt);break;case 11:a=c_(c,a,a.pendingProps,a.type.render,a.ref,vt);break;case 5:Cm(a);default:x_(c,a),a=gt=qv(a,xr),a=p_(c,a,xr)}i.memoizedProps=i.pendingProps,a===null?bd(i):gt=a}function qo(i,a,c,m){or=Ra=null,Cm(a),Do=null,Ul=0;var b=a.return;try{if(eT(i,b,a,c,vt)){ns=1,rd(i,Zn(c,i.current)),gt=null;return}}catch(y){if(b!==null)throw gt=b,y;ns=1,rd(i,Zn(c,i.current)),gt=null;return}a.flags&32768?(yt||m===1?i=!0:$o||(vt&536870912)!==0?i=!1:(Xr=i=!0,(m===2||m===9||m===3||m===6)&&(m=On.current,m!==null&&m.tag===13&&(m.flags|=16384))),W_(a,i)):bd(a)}function bd(i){var a=i;do{if((a.flags&32768)!==0){W_(a,Xr);return}i=a.return;var c=nT(a.alternate,a,xr);if(c!==null){gt=c;return}if(a=a.sibling,a!==null){gt=a;return}gt=a=i}while(a!==null);ns===0&&(ns=5)}function W_(i,a){do{var c=iT(i.alternate,i);if(c!==null){c.flags&=32767,gt=c;return}if(c=i.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!a&&(i=i.sibling,i!==null)){gt=i;return}gt=i=c}while(i!==null);ns=6,gt=null}function K_(i,a,c,m,b,y,E,L,Y){i.cancelPendingCommit=null;do vd();while(Es!==0);if((Ct&6)!==0)throw Error(n(327));if(a!==null){if(a===i.current)throw Error(n(177));if(y=a.lanes|a.childLanes,y|=Jf,qe(i,c,y,E,L,Y),i===$t&&(gt=$t=null,vt=0),Uo=a,Jr=i,br=c,op=y,lp=b,B_=m,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,gT(gn,function(){return J_(),null})):(i.callbackNode=null,i.callbackPriority=0),m=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||m){m=I.T,I.T=null,b=Z.p,Z.p=2,E=Ct,Ct|=4;try{rT(i,a,c)}finally{Ct=E,Z.p=b,I.T=m}}Es=1,Y_(),X_(),Z_()}}function Y_(){if(Es===1){Es=0;var i=Jr,a=Uo,c=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||c){c=I.T,I.T=null;var m=Z.p;Z.p=2;var b=Ct;Ct|=4;try{A_(a,i);var y=Sp,E=Lv(i.containerInfo),L=y.focusedElem,Y=y.selectionRange;if(E!==L&&L&&L.ownerDocument&&Ov(L.ownerDocument.documentElement,L)){if(Y!==null&&Kf(L)){var ce=Y.start,be=Y.end;if(be===void 0&&(be=ce),"selectionStart"in L)L.selectionStart=ce,L.selectionEnd=Math.min(be,L.value.length);else{var Ce=L.ownerDocument||document,de=Ce&&Ce.defaultView||window;if(de.getSelection){var pe=de.getSelection(),We=L.textContent.length,st=Math.min(Y.start,We),Bt=Y.end===void 0?st:Math.min(Y.end,We);!pe.extend&&st>Bt&&(E=Bt,Bt=st,st=E);var ne=Dv(L,st),Q=Dv(L,Bt);if(ne&&Q&&(pe.rangeCount!==1||pe.anchorNode!==ne.node||pe.anchorOffset!==ne.offset||pe.focusNode!==Q.node||pe.focusOffset!==Q.offset)){var le=Ce.createRange();le.setStart(ne.node,ne.offset),pe.removeAllRanges(),st>Bt?(pe.addRange(le),pe.extend(Q.node,Q.offset)):(le.setEnd(Q.node,Q.offset),pe.addRange(le))}}}}for(Ce=[],pe=L;pe=pe.parentNode;)pe.nodeType===1&&Ce.push({element:pe,left:pe.scrollLeft,top:pe.scrollTop});for(typeof L.focus=="function"&&L.focus(),L=0;L<Ce.length;L++){var we=Ce[L];we.element.scrollLeft=we.left,we.element.scrollTop=we.top}}Rd=!!wp,Sp=wp=null}finally{Ct=b,Z.p=m,I.T=c}}i.current=a,Es=2}}function X_(){if(Es===2){Es=0;var i=Jr,a=Uo,c=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||c){c=I.T,I.T=null;var m=Z.p;Z.p=2;var b=Ct;Ct|=4;try{k_(i,a.alternate,a)}finally{Ct=b,Z.p=m,I.T=c}}Es=3}}function Z_(){if(Es===4||Es===3){Es=0,_i();var i=Jr,a=Uo,c=br,m=B_;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?Es=5:(Es=0,Uo=Jr=null,Q_(i,i.pendingLanes));var b=i.pendingLanes;if(b===0&&(Qr=null),er(c),a=a.stateNode,he&&typeof he.onCommitFiberRoot=="function")try{he.onCommitFiberRoot(ye,a,void 0,(a.current.flags&128)===128)}catch{}if(m!==null){a=I.T,b=Z.p,Z.p=2,I.T=null;try{for(var y=i.onRecoverableError,E=0;E<m.length;E++){var L=m[E];y(L.value,{componentStack:L.stack})}}finally{I.T=a,Z.p=b}}(br&3)!==0&&vd(),Bi(i),b=i.pendingLanes,(c&261930)!==0&&(b&42)!==0?i===cp?rc++:(rc=0,cp=i):rc=0,ac(0)}}function Q_(i,a){(i.pooledCacheLanes&=a)===0&&(a=i.pooledCache,a!=null&&(i.pooledCache=null,$l(a)))}function vd(){return Y_(),X_(),Z_(),J_()}function J_(){if(Es!==5)return!1;var i=Jr,a=op;op=0;var c=er(br),m=I.T,b=Z.p;try{Z.p=32>c?32:c,I.T=null,c=lp,lp=null;var y=Jr,E=br;if(Es=0,Uo=Jr=null,br=0,(Ct&6)!==0)throw Error(n(331));var L=Ct;if(Ct|=4,O_(y.current),R_(y,y.current,E,c),Ct=L,ac(0,!1),he&&typeof he.onPostCommitFiberRoot=="function")try{he.onPostCommitFiberRoot(ye,y)}catch{}return!0}finally{Z.p=b,I.T=m,Q_(i,a)}}function ey(i,a,c){a=Zn(c,a),a=Hm(i.stateNode,a,2),i=Gr(i,a,2),i!==null&&(Et(i,2),Bi(i))}function Dt(i,a,c){if(i.tag===3)ey(i,i,c);else for(;a!==null;){if(a.tag===3){ey(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=Zn(c,i),c=t_(2),m=Gr(a,c,2),m!==null&&(s_(c,m,a,i),Et(m,2),Bi(m));break}}a=a.return}}function hp(i,a,c){var m=i.pingCache;if(m===null){m=i.pingCache=new lT;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)||(ip=!0,b.add(c),i=fT.bind(null,i,a,c),a.then(i,i))}function fT(i,a,c){var m=i.pingCache;m!==null&&m.delete(a),i.pingedLanes|=i.suspendedLanes&c,i.warmLanes&=~c,$t===i&&(vt&c)===c&&(ns===4||ns===3&&(vt&62914560)===vt&&300>It()-fd?(Ct&2)===0&&Fo(i,0):rp|=c,Ho===vt&&(Ho=0)),Bi(i)}function ty(i,a){a===0&&(a=Pe()),i=ja(i,a),i!==null&&(Et(i,a),Bi(i))}function mT(i){var a=i.memoizedState,c=0;a!==null&&(c=a.retryLane),ty(i,c)}function pT(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),ty(i,c)}function gT(i,a){return jn(i,a)}var _d=null,Vo=null,fp=!1,yd=!1,mp=!1,ta=0;function Bi(i){i!==Vo&&i.next===null&&(Vo===null?_d=Vo=i:Vo=Vo.next=i),yd=!0,fp||(fp=!0,bT())}function ac(i,a){if(!mp&&yd){mp=!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,L=m.pingedLanes;y=(1<<31-R(42|i)+1)-1,y&=b&~(E&~L),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(c=!0,ry(m,y))}else y=vt,y=H(m,m===$t?y:0,m.cancelPendingCommit!==null||m.timeoutHandle!==-1),(y&3)===0||se(m,y)||(c=!0,ry(m,y));m=m.next}while(c);mp=!1}}function xT(){sy()}function sy(){yd=fp=!1;var i=0;ta!==0&&jT()&&(i=ta);for(var a=It(),c=null,m=_d;m!==null;){var b=m.next,y=ny(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}Es!==0&&Es!==5||ac(i),ta!==0&&(ta=0)}function ny(i,a){for(var c=i.suspendedLanes,m=i.pingedLanes,b=i.expirationTimes,y=i.pendingLanes&-62914561;0<y;){var E=31-R(y),L=1<<E,Y=b[E];Y===-1?((L&c)===0||(L&m)!==0)&&(b[E]=ge(L,a)):Y<=a&&(i.expiredLanes|=L),y&=~L}if(a=$t,c=vt,c=H(i,i===a?c:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),m=i.callbackNode,c===0||i===a&&(Mt===2||Mt===9)||i.cancelPendingCommit!==null)return m!==null&&m!==null&&An(m),i.callbackNode=null,i.callbackPriority=0;if((c&3)===0||se(i,c)){if(a=c&-c,a===i.callbackPriority)return a;switch(m!==null&&An(m),er(c)){case 2:case 8:c=pn;break;case 32:c=gn;break;case 268435456:c=S;break;default:c=gn}return m=iy.bind(null,i),c=jn(c,m),i.callbackPriority=a,i.callbackNode=c,a}return m!==null&&m!==null&&An(m),i.callbackPriority=2,i.callbackNode=null,2}function iy(i,a){if(Es!==0&&Es!==5)return i.callbackNode=null,i.callbackPriority=0,null;var c=i.callbackNode;if(vd()&&i.callbackNode!==c)return null;var m=vt;return m=H(i,i===$t?m:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),m===0?null:(I_(i,m,a),ny(i,It()),i.callbackNode!=null&&i.callbackNode===c?iy.bind(null,i):null)}function ry(i,a){if(vd())return null;I_(i,a,!0)}function bT(){TT(function(){(Ct&6)!==0?jn(ls,xT):sy()})}function pp(){if(ta===0){var i=To;i===0&&(i=me,me<<=1,(me&261888)===0&&(me=256)),ta=i}return ta}function ay(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:Pr(""+i)}function oy(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 vT(i,a,c,m,b){if(a==="submit"&&c&&c.stateNode===b){var y=ay((b[Qs]||null).action),E=m.submitter;E&&(a=(a=E[Qs]||null)?ay(a.formAction):E.getAttribute("formAction"),a!==null&&(y=a,E=null));var L=new Du("action","action",null,m,b);i.push({event:L,listeners:[{instance:null,listener:function(){if(m.defaultPrevented){if(ta!==0){var Y=E?oy(b,E):new FormData(b);Lm(c,{pending:!0,data:Y,method:b.method,action:y},null,Y)}}else typeof y=="function"&&(L.preventDefault(),Y=E?oy(b,E):new FormData(b),Lm(c,{pending:!0,data:Y,method:b.method,action:y},y,Y))},currentTarget:b}]})}}for(var gp=0;gp<Qf.length;gp++){var xp=Qf[gp],_T=xp.toLowerCase(),yT=xp[0].toUpperCase()+xp.slice(1);yi(_T,"on"+yT)}yi(Pv,"onAnimationEnd"),yi(Iv,"onAnimationIteration"),yi($v,"onAnimationStart"),yi("dblclick","onDoubleClick"),yi("focusin","onFocus"),yi("focusout","onBlur"),yi(BA,"onTransitionRun"),yi(PA,"onTransitionStart"),yi(IA,"onTransitionCancel"),yi(Hv,"onTransitionEnd"),Oe("onMouseEnter",["mouseout","mouseover"]),Oe("onMouseLeave",["mouseout","mouseover"]),Oe("onPointerEnter",["pointerout","pointerover"]),Oe("onPointerLeave",["pointerout","pointerover"]),sr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),sr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),sr("onBeforeInput",["compositionend","keypress","textInput","paste"]),sr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),sr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),sr("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(" "),wT=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(oc));function ly(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 L=m[E],Y=L.instance,ce=L.currentTarget;if(L=L.listener,Y!==y&&b.isPropagationStopped())break e;y=L,b.currentTarget=ce;try{y(b)}catch(be){zu(be)}b.currentTarget=null,y=Y}else for(E=0;E<m.length;E++){if(L=m[E],Y=L.instance,ce=L.currentTarget,L=L.listener,Y!==y&&b.isPropagationStopped())break e;y=L,b.currentTarget=ce;try{y(b)}catch(be){zu(be)}b.currentTarget=null,y=Y}}}}function xt(i,a){var c=a[Sl];c===void 0&&(c=a[Sl]=new Set);var m=i+"__bubble";c.has(m)||(cy(a,i,2,!1),c.add(m))}function bp(i,a,c){var m=0;a&&(m|=4),cy(c,i,m,a)}var wd="_reactListening"+Math.random().toString(36).slice(2);function vp(i){if(!i[wd]){i[wd]=!0,Nu.forEach(function(c){c!=="selectionchange"&&(wT.has(c)||bp(c,!1,i),bp(c,!0,i))});var a=i.nodeType===9?i:i.ownerDocument;a===null||a[wd]||(a[wd]=!0,bp("selectionchange",!1,a))}}function cy(i,a,c,m){switch(Py(a)){case 2:var b=XT;break;case 8:b=ZT;break;default:b=Op}c=b.bind(null,a,c,i),b=void 0,!If||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 _p(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 L=m.stateNode.containerInfo;if(L===b)break;if(E===4)for(E=m.return;E!==null;){var Y=E.tag;if((Y===3||Y===4)&&E.stateNode.containerInfo===b)return;E=E.return}for(;L!==null;){if(E=rn(L),E===null)return;if(Y=E.tag,Y===5||Y===6||Y===26||Y===27){m=y=E;continue e}L=L.parentNode}}m=m.return}Au(function(){var ce=y,be=lt(c),Ce=[];e:{var de=Uv.get(i);if(de!==void 0){var pe=Du,We=i;switch(i){case"keypress":if(Ru(c)===0)break e;case"keydown":case"keyup":pe=pA;break;case"focusin":We="focus",pe=Ff;break;case"focusout":We="blur",pe=Ff;break;case"beforeblur":case"afterblur":pe=Ff;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":pe=xv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":pe=nA;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":pe=bA;break;case Pv:case Iv:case $v:pe=aA;break;case Hv:pe=_A;break;case"scroll":case"scrollend":pe=tA;break;case"wheel":pe=wA;break;case"copy":case"cut":case"paste":pe=lA;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":pe=vv;break;case"toggle":case"beforetoggle":pe=kA}var st=(a&4)!==0,Bt=!st&&(i==="scroll"||i==="scrollend"),ne=st?de!==null?de+"Capture":null:de;st=[];for(var Q=ce,le;Q!==null;){var we=Q;if(le=we.stateNode,we=we.tag,we!==5&&we!==26&&we!==27||le===null||ne===null||(we=Al(Q,ne),we!=null&&st.push(lc(Q,we,le))),Bt)break;Q=Q.return}0<st.length&&(de=new pe(de,We,null,c,be),Ce.push({event:de,listeners:st}))}}if((a&7)===0){e:{if(de=i==="mouseover"||i==="pointerover",pe=i==="mouseout"||i==="pointerout",de&&c!==Xe&&(We=c.relatedTarget||c.fromElement)&&(rn(We)||We[Or]))break e;if((pe||de)&&(de=be.window===be?be:(de=be.ownerDocument)?de.defaultView||de.parentWindow:window,pe?(We=c.relatedTarget||c.toElement,pe=ce,We=We?rn(We):null,We!==null&&(Bt=l(We),st=We.tag,We!==Bt||st!==5&&st!==27&&st!==6)&&(We=null)):(pe=null,We=ce),pe!==We)){if(st=xv,we="onMouseLeave",ne="onMouseEnter",Q="mouse",(i==="pointerout"||i==="pointerover")&&(st=vv,we="onPointerLeave",ne="onPointerEnter",Q="pointer"),Bt=pe==null?de:Lr(pe),le=We==null?de:Lr(We),de=new st(we,Q+"leave",pe,c,be),de.target=Bt,de.relatedTarget=le,we=null,rn(be)===ce&&(st=new st(ne,Q+"enter",We,c,be),st.target=le,st.relatedTarget=Bt,we=st),Bt=we,pe&&We)t:{for(st=ST,ne=pe,Q=We,le=0,we=ne;we;we=st(we))le++;we=0;for(var tt=Q;tt;tt=st(tt))we++;for(;0<le-we;)ne=st(ne),le--;for(;0<we-le;)Q=st(Q),we--;for(;le--;){if(ne===Q||Q!==null&&ne===Q.alternate){st=ne;break t}ne=st(ne),Q=st(Q)}st=null}else st=null;pe!==null&&uy(Ce,de,pe,st,!1),We!==null&&Bt!==null&&uy(Ce,Bt,We,st,!0)}}e:{if(de=ce?Lr(ce):window,pe=de.nodeName&&de.nodeName.toLowerCase(),pe==="select"||pe==="input"&&de.type==="file")var kt=Ev;else if(Nv(de))if(jv)kt=OA;else{kt=MA;var Ze=RA}else pe=de.nodeName,!pe||pe.toLowerCase()!=="input"||de.type!=="checkbox"&&de.type!=="radio"?ce&&Br(ce.elementType)&&(kt=Ev):kt=DA;if(kt&&(kt=kt(i,ce))){Cv(Ce,kt,c,be);break e}Ze&&Ze(i,de,ce),i==="focusout"&&ce&&de.type==="number"&&ce.memoizedProps.value!=null&&vo(de,"number",de.value)}switch(Ze=ce?Lr(ce):window,i){case"focusin":(Nv(Ze)||Ze.contentEditable==="true")&&(wo=Ze,Yf=ce,Bl=null);break;case"focusout":Bl=Yf=wo=null;break;case"mousedown":Xf=!0;break;case"contextmenu":case"mouseup":case"dragend":Xf=!1,zv(Ce,c,be);break;case"selectionchange":if(zA)break;case"keydown":case"keyup":zv(Ce,c,be)}var ut;if(Vf)e:{switch(i){case"compositionstart":var _t="onCompositionStart";break e;case"compositionend":_t="onCompositionEnd";break e;case"compositionupdate":_t="onCompositionUpdate";break e}_t=void 0}else yo?Sv(i,c)&&(_t="onCompositionEnd"):i==="keydown"&&c.keyCode===229&&(_t="onCompositionStart");_t&&(_v&&c.locale!=="ko"&&(yo||_t!=="onCompositionStart"?_t==="onCompositionEnd"&&yo&&(ut=pv()):(Ir=be,$f="value"in Ir?Ir.value:Ir.textContent,yo=!0)),Ze=Sd(ce,_t),0<Ze.length&&(_t=new bv(_t,i,null,c,be),Ce.push({event:_t,listeners:Ze}),ut?_t.data=ut:(ut=kv(c),ut!==null&&(_t.data=ut)))),(ut=CA?EA(i,c):jA(i,c))&&(_t=Sd(ce,"onBeforeInput"),0<_t.length&&(Ze=new bv("onBeforeInput","beforeinput",null,c,be),Ce.push({event:Ze,listeners:_t}),Ze.data=ut)),vT(Ce,i,ce,c,be)}ly(Ce,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 ST(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function uy(i,a,c,m,b){for(var y=a._reactName,E=[];c!==null&&c!==m;){var L=c,Y=L.alternate,ce=L.stateNode;if(L=L.tag,Y!==null&&Y===m)break;L!==5&&L!==26&&L!==27||ce===null||(Y=ce,b?(ce=Al(c,y),ce!=null&&E.unshift(lc(c,ce,Y))):b||(ce=Al(c,y),ce!=null&&E.push(lc(c,ce,Y)))),c=c.return}E.length!==0&&i.push({event:a,listeners:E})}var kT=/\r\n?/g,NT=/\u0000|\uFFFD/g;function dy(i){return(typeof i=="string"?i:""+i).replace(kT,`
|
|
10
|
+
`).replace(NT,"")}function hy(i,a){return a=dy(a),dy(i)===a}function zt(i,a,c,m,b,y){switch(c){case"children":typeof m=="string"?a==="body"||a==="textarea"&&m===""||nt(i,m):(typeof m=="number"||typeof m=="bigint")&&a!=="body"&&nt(i,""+m);break;case"className":Tn(i,"class",m);break;case"tabIndex":Tn(i,"tabindex",m);break;case"dir":case"role":case"viewBox":case"width":case"height":Tn(i,c,m);break;case"style":Rt(i,m,y);break;case"data":if(a!=="object"){Tn(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"&&zt(i,a,"name",b.name,b,null),zt(i,a,"formEncType",b.formEncType,b,null),zt(i,a,"formMethod",b.formMethod,b,null),zt(i,a,"formTarget",b.formTarget,b,null)):(zt(i,a,"encType",b.encType,b,null),zt(i,a,"method",b.method,b,null),zt(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=Ie);break;case"onScroll":m!=null&&xt("scroll",i);break;case"onScrollEnd":m!=null&&xt("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":xt("beforetoggle",i),xt("toggle",i),Js(i,"popover",m);break;case"xlinkActuate":xn(i,"http://www.w3.org/1999/xlink","xlink:actuate",m);break;case"xlinkArcrole":xn(i,"http://www.w3.org/1999/xlink","xlink:arcrole",m);break;case"xlinkRole":xn(i,"http://www.w3.org/1999/xlink","xlink:role",m);break;case"xlinkShow":xn(i,"http://www.w3.org/1999/xlink","xlink:show",m);break;case"xlinkTitle":xn(i,"http://www.w3.org/1999/xlink","xlink:title",m);break;case"xlinkType":xn(i,"http://www.w3.org/1999/xlink","xlink:type",m);break;case"xmlBase":xn(i,"http://www.w3.org/XML/1998/namespace","xml:base",m);break;case"xmlLang":xn(i,"http://www.w3.org/XML/1998/namespace","xml:lang",m);break;case"xmlSpace":xn(i,"http://www.w3.org/XML/1998/namespace","xml:space",m);break;case"is":Js(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=nr.get(c)||c,Js(i,c,m))}}function yp(i,a,c,m,b,y){switch(c){case"style":Rt(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"?nt(i,m):(typeof m=="number"||typeof m=="bigint")&&nt(i,""+m);break;case"onScroll":m!=null&&xt("scroll",i);break;case"onScrollEnd":m!=null&&xt("scrollend",i);break;case"onClick":m!=null&&(i.onclick=Ie);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Sa.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[Qs]||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,""):Js(i,c,m)}}}function Ws(i,a,c){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":xt("error",i),xt("load",i);var 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:zt(i,a,y,E,c,null)}}b&&zt(i,a,"srcSet",c.srcSet,c,null),m&&zt(i,a,"src",c.src,c,null);return;case"input":xt("invalid",i);var L=y=E=b=null,Y=null,ce=null;for(m in c)if(c.hasOwnProperty(m)){var be=c[m];if(be!=null)switch(m){case"name":b=be;break;case"type":E=be;break;case"checked":Y=be;break;case"defaultChecked":ce=be;break;case"value":y=be;break;case"defaultValue":L=be;break;case"children":case"dangerouslySetInnerHTML":if(be!=null)throw Error(n(137,a));break;default:zt(i,a,m,be,c,null)}}ka(i,y,L,Y,ce,E,b,!1);return;case"select":xt("invalid",i),m=E=y=null;for(b in c)if(c.hasOwnProperty(b)&&(L=c[b],L!=null))switch(b){case"value":y=L;break;case"defaultValue":E=L;break;case"multiple":m=L;default:zt(i,a,b,L,c,null)}a=y,c=E,i.multiple=!!m,a!=null?Fs(i,!!m,a,!1):c!=null&&Fs(i,!!m,c,!0);return;case"textarea":xt("invalid",i),y=b=m=null;for(E in c)if(c.hasOwnProperty(E)&&(L=c[E],L!=null))switch(E){case"value":m=L;break;case"defaultValue":b=L;break;case"children":y=L;break;case"dangerouslySetInnerHTML":if(L!=null)throw Error(n(91));break;default:zt(i,a,E,L,c,null)}_o(i,m,b,y);return;case"option":for(Y in c)c.hasOwnProperty(Y)&&(m=c[Y],m!=null)&&(Y==="selected"?i.selected=m&&typeof m!="function"&&typeof m!="symbol":zt(i,a,Y,m,c,null));return;case"dialog":xt("beforetoggle",i),xt("toggle",i),xt("cancel",i),xt("close",i);break;case"iframe":case"object":xt("load",i);break;case"video":case"audio":for(m=0;m<oc.length;m++)xt(oc[m],i);break;case"image":xt("error",i),xt("load",i);break;case"details":xt("toggle",i);break;case"embed":case"source":case"link":xt("error",i),xt("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ce in c)if(c.hasOwnProperty(ce)&&(m=c[ce],m!=null))switch(ce){case"children":case"dangerouslySetInnerHTML":throw Error(n(137,a));default:zt(i,a,ce,m,c,null)}return;default:if(Br(a)){for(be in c)c.hasOwnProperty(be)&&(m=c[be],m!==void 0&&yp(i,a,be,m,c,void 0));return}}for(L in c)c.hasOwnProperty(L)&&(m=c[L],m!=null&&zt(i,a,L,m,c,null))}function CT(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,L=null,Y=null,ce=null,be=null;for(pe in c){var Ce=c[pe];if(c.hasOwnProperty(pe)&&Ce!=null)switch(pe){case"checked":break;case"value":break;case"defaultValue":Y=Ce;default:m.hasOwnProperty(pe)||zt(i,a,pe,null,m,Ce)}}for(var de in m){var pe=m[de];if(Ce=c[de],m.hasOwnProperty(de)&&(pe!=null||Ce!=null))switch(de){case"type":y=pe;break;case"name":b=pe;break;case"checked":ce=pe;break;case"defaultChecked":be=pe;break;case"value":E=pe;break;case"defaultValue":L=pe;break;case"children":case"dangerouslySetInnerHTML":if(pe!=null)throw Error(n(137,a));break;default:pe!==Ce&&zt(i,a,de,pe,m,Ce)}}Cl(i,E,L,Y,ce,be,y,b);return;case"select":pe=E=L=de=null;for(y in c)if(Y=c[y],c.hasOwnProperty(y)&&Y!=null)switch(y){case"value":break;case"multiple":pe=Y;default:m.hasOwnProperty(y)||zt(i,a,y,null,m,Y)}for(b in m)if(y=m[b],Y=c[b],m.hasOwnProperty(b)&&(y!=null||Y!=null))switch(b){case"value":de=y;break;case"defaultValue":L=y;break;case"multiple":E=y;default:y!==Y&&zt(i,a,b,y,m,Y)}a=L,c=E,m=pe,de!=null?Fs(i,!!c,de,!1):!!m!=!!c&&(a!=null?Fs(i,!!c,a,!0):Fs(i,!!c,c?[]:"",!1));return;case"textarea":pe=de=null;for(L in c)if(b=c[L],c.hasOwnProperty(L)&&b!=null&&!m.hasOwnProperty(L))switch(L){case"value":break;case"children":break;default:zt(i,a,L,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":de=b;break;case"defaultValue":pe=b;break;case"children":break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(n(91));break;default:b!==y&&zt(i,a,E,b,m,y)}Eu(i,de,pe);return;case"option":for(var We in c)de=c[We],c.hasOwnProperty(We)&&de!=null&&!m.hasOwnProperty(We)&&(We==="selected"?i.selected=!1:zt(i,a,We,null,m,de));for(Y in m)de=m[Y],pe=c[Y],m.hasOwnProperty(Y)&&de!==pe&&(de!=null||pe!=null)&&(Y==="selected"?i.selected=de&&typeof de!="function"&&typeof de!="symbol":zt(i,a,Y,de,m,pe));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var st in c)de=c[st],c.hasOwnProperty(st)&&de!=null&&!m.hasOwnProperty(st)&&zt(i,a,st,null,m,de);for(ce in m)if(de=m[ce],pe=c[ce],m.hasOwnProperty(ce)&&de!==pe&&(de!=null||pe!=null))switch(ce){case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(n(137,a));break;default:zt(i,a,ce,de,m,pe)}return;default:if(Br(a)){for(var Bt in c)de=c[Bt],c.hasOwnProperty(Bt)&&de!==void 0&&!m.hasOwnProperty(Bt)&&yp(i,a,Bt,void 0,m,de);for(be in m)de=m[be],pe=c[be],!m.hasOwnProperty(be)||de===pe||de===void 0&&pe===void 0||yp(i,a,be,de,m,pe);return}}for(var ne in c)de=c[ne],c.hasOwnProperty(ne)&&de!=null&&!m.hasOwnProperty(ne)&&zt(i,a,ne,null,m,de);for(Ce in m)de=m[Ce],pe=c[Ce],!m.hasOwnProperty(Ce)||de===pe||de==null&&pe==null||zt(i,a,Ce,de,m,pe)}function fy(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function ET(){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,L=b.duration;if(y&&L&&fy(E)){for(E=0,L=b.responseEnd,m+=1;m<c.length;m++){var Y=c[m],ce=Y.startTime;if(ce>L)break;var be=Y.transferSize,Ce=Y.initiatorType;be&&fy(Ce)&&(Y=Y.responseEnd,E+=be*(Y<L?1:(L-ce)/(Y-ce)))}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 wp=null,Sp=null;function kd(i){return i.nodeType===9?i:i.ownerDocument}function my(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 py(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 kp(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 Np=null;function jT(){var i=window.event;return i&&i.type==="popstate"?i===Np?!1:(Np=i,!0):(Np=null,!1)}var gy=typeof setTimeout=="function"?setTimeout:void 0,AT=typeof clearTimeout=="function"?clearTimeout:void 0,xy=typeof Promise=="function"?Promise:void 0,TT=typeof queueMicrotask=="function"?queueMicrotask:typeof xy<"u"?function(i){return xy.resolve(null).then(i).catch(RT)}:gy;function RT(i){setTimeout(function(){throw i})}function sa(i){return i==="head"}function by(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,L=y.nodeName;y[wa]||L==="SCRIPT"||L==="STYLE"||L==="LINK"&&y.rel.toLowerCase()==="stylesheet"||c.removeChild(y),y=E}}else c==="body"&&cc(i.ownerDocument.body);c=b}while(c);Yo(a)}function vy(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 Cp(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":Cp(c),kl(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}i.removeChild(c)}}function MT(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[wa])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=si(i.nextSibling),i===null)break}return null}function DT(i,a,c){if(a==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!c||(i=si(i.nextSibling),i===null))return null;return i}function _y(i,a){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!a||(i=si(i.nextSibling),i===null))return null;return i}function Ep(i){return i.data==="$?"||i.data==="$~"}function jp(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function OT(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 si(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 Ap=null;function yy(i){i=i.nextSibling;for(var a=0;i;){if(i.nodeType===8){var c=i.data;if(c==="/$"||c==="/&"){if(a===0)return si(i.nextSibling);a--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||a++}i=i.nextSibling}return null}function wy(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 Sy(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 ni=new Map,ky=new Set;function Nd(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var vr=Z.d;Z.d={f:LT,r:zT,D:BT,C:PT,L:IT,m:$T,X:UT,S:HT,M:FT};function LT(){var i=vr.f(),a=gd();return i||a}function zT(i){var a=tr(i);a!==null&&a.tag===5&&a.type==="form"?H1(a):vr.r(i)}var Go=typeof document>"u"?null:document;function Ny(i,a,c){var m=Go;if(m&&typeof a=="string"&&a){var b=bn(a);b='link[rel="'+i+'"][href="'+b+'"]',typeof c=="string"&&(b+='[crossorigin="'+c+'"]'),ky.has(b)||(ky.add(b),i={rel:i,crossOrigin:c,href:a},m.querySelector(b)===null&&(a=m.createElement("link"),Ws(a,"link",i),gs(a),m.head.appendChild(a)))}}function BT(i){vr.D(i),Ny("dns-prefetch",i,null)}function PT(i,a){vr.C(i,a),Ny("preconnect",i,a)}function IT(i,a,c){vr.L(i,a,c);var m=Go;if(m&&i&&a){var b='link[rel="preload"][as="'+bn(a)+'"]';a==="image"&&c&&c.imageSrcSet?(b+='[imagesrcset="'+bn(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(b+='[imagesizes="'+bn(c.imageSizes)+'"]')):b+='[href="'+bn(i)+'"]';var y=b;switch(a){case"style":y=Wo(i);break;case"script":y=Ko(i)}ni.has(y)||(i=g({rel:"preload",href:a==="image"&&c&&c.imageSrcSet?void 0:i,as:a},c),ni.set(y,i),m.querySelector(b)!==null||a==="style"&&m.querySelector(uc(y))||a==="script"&&m.querySelector(dc(y))||(a=m.createElement("link"),Ws(a,"link",i),gs(a),m.head.appendChild(a)))}}function $T(i,a){vr.m(i,a);var c=Go;if(c&&i){var m=a&&typeof a.as=="string"?a.as:"script",b='link[rel="modulepreload"][as="'+bn(m)+'"][href="'+bn(i)+'"]',y=b;switch(m){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=Ko(i)}if(!ni.has(y)&&(i=g({rel:"modulepreload",href:i},a),ni.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"),Ws(m,"link",i),gs(m),c.head.appendChild(m)}}}function HT(i,a,c){vr.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 L={loading:0,preload:null};if(E=m.querySelector(uc(y)))L.loading=5;else{i=g({rel:"stylesheet",href:i,"data-precedence":a},c),(c=ni.get(y))&&Tp(i,c);var Y=E=m.createElement("link");gs(Y),Ws(Y,"link",i),Y._p=new Promise(function(ce,be){Y.onload=ce,Y.onerror=be}),Y.addEventListener("load",function(){L.loading|=1}),Y.addEventListener("error",function(){L.loading|=2}),L.loading|=4,Cd(E,a,m)}E={type:"stylesheet",instance:E,count:1,state:L},b.set(y,E)}}}function UT(i,a){vr.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=ni.get(b))&&Rp(i,a),y=c.createElement("script"),gs(y),Ws(y,"link",i),c.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},m.set(b,y))}}function FT(i,a){vr.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=ni.get(b))&&Rp(i,a),y=c.createElement("script"),gs(y),Ws(y,"link",i),c.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},m.set(b,y))}}function Cy(i,a,c,m){var b=(b=ie.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),ni.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},ni.set(i,c),y||qT(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="'+bn(i)+'"'}function uc(i){return'link[rel="stylesheet"]['+i+"]"}function Ey(i){return g({},i,{"data-precedence":i.precedence,precedence:null})}function qT(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}),Ws(a,"link",c),gs(a),i.head.appendChild(a))}function Ko(i){return'[src="'+bn(i)+'"]'}function dc(i){return"script[async]"+i}function jy(i,a,c){if(a.count++,a.instance===null)switch(a.type){case"style":var m=i.querySelector('style[data-href~="'+bn(c.href)+'"]');if(m)return a.instance=m,gs(m),m;var b=g({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return m=(i.ownerDocument||i).createElement("style"),gs(m),Ws(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,gs(y),y;m=Ey(c),(b=ni.get(b))&&Tp(m,b),y=(i.ownerDocument||i).createElement("link"),gs(y);var E=y;return E._p=new Promise(function(L,Y){E.onload=L,E.onerror=Y}),Ws(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,gs(b),b):(m=c,(b=ni.get(y))&&(m=g({},c),Rp(m,b)),i=i.ownerDocument||i,b=i.createElement("script"),gs(b),Ws(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 L=m[E];if(L.dataset.precedence===a)y=L;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 Tp(i,a){i.crossOrigin==null&&(i.crossOrigin=a.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=a.referrerPolicy),i.title==null&&(i.title=a.title)}function Rp(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 Ay(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[wa]||y[us]||i==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var E=y.getAttribute(a)||"";E=i+E;var L=m.get(E);L?L.push(y):m.set(E,[y])}}return m}function Ty(i,a,c){i=i.ownerDocument||i,i.head.insertBefore(c,a==="title"?i.querySelector("head > title"):null)}function VT(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 Ry(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function GT(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,gs(y);return}y=a.ownerDocument||a,m=Ey(m),(b=ni.get(b))&&Tp(m,b),y=y.createElement("link"),gs(y);var E=y;E._p=new Promise(function(L,Y){E.onload=L,E.onerror=Y}),Ws(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 Mp=0;function WT(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&&Mp===0&&(Mp=62500*ET());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>Mp?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(KT,i),Ad=null,jd.call(i))}function KT(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:W,_currentValue2:W,_threadCount:0};function YT(i,a,c,m,b,y,E,L,Y){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=it(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=it(0),this.hiddenUpdates=it(null),this.identifierPrefix=m,this.onUncaughtError=b,this.onCaughtError=y,this.onRecoverableError=E,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Y,this.incompleteTransitions=new Map}function My(i,a,c,m,b,y,E,L,Y,ce,be,Ce){return i=new YT(i,a,c,E,Y,ce,be,Ce,L),a=1,y===!0&&(a|=24),y=Dn(3,null,null,a),i.current=y,y.stateNode=i,a=dm(),a.refCount++,i.pooledCache=a,a.refCount++,y.memoizedState={element:m,isDehydrated:c,cache:a},pm(y),i}function Dy(i){return i?(i=No,i):No}function Oy(i,a,c,m,b,y){b=Dy(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&&(kn(c,i,a),ql(c,i,a))}function Ly(i,a){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var c=i.retryLane;i.retryLane=c!==0&&c<a?c:a}}function Dp(i,a){Ly(i,a),(i=i.alternate)&&Ly(i,a)}function zy(i){if(i.tag===13||i.tag===31){var a=ja(i,67108864);a!==null&&kn(a,i,67108864),Dp(i,67108864)}}function By(i){if(i.tag===13||i.tag===31){var a=Pn();a=Xt(a);var c=ja(i,a);c!==null&&kn(c,i,a),Dp(i,a)}}var Rd=!0;function XT(i,a,c,m){var b=I.T;I.T=null;var y=Z.p;try{Z.p=2,Op(i,a,c,m)}finally{Z.p=y,I.T=b}}function ZT(i,a,c,m){var b=I.T;I.T=null;var y=Z.p;try{Z.p=8,Op(i,a,c,m)}finally{Z.p=y,I.T=b}}function Op(i,a,c,m){if(Rd){var b=Lp(m);if(b===null)_p(i,a,m,Md,c),Iy(i,m);else if(JT(b,i,a,c,m))m.stopPropagation();else if(Iy(i,m),a&4&&-1<QT.indexOf(i)){for(;b!==null;){var y=tr(b);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var E=Be(y.pendingLanes);if(E!==0){var L=y;for(L.pendingLanes|=2,L.entangledLanes|=2;E;){var Y=1<<31-R(E);L.entanglements[1]|=Y,E&=~Y}Bi(y),(Ct&6)===0&&(md=It()+500,ac(0))}}break;case 31:case 13:L=ja(y,2),L!==null&&kn(L,y,2),gd(),Dp(y,2)}if(y=Lp(m),y===null&&_p(i,a,m,Md,c),y===b)break;b=y}b!==null&&m.stopPropagation()}else _p(i,a,m,null,c)}}function Lp(i){return i=lt(i),zp(i)}var Md=null;function zp(i){if(Md=null,i=rn(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 Py(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(Cs()){case ls:return 2;case pn:return 8;case gn:case Mi:return 32;case S:return 268435456;default:return 32}default:return 32}}var Bp=!1,na=null,ia=null,ra=null,fc=new Map,mc=new Map,aa=[],QT="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 Iy(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=tr(a),a!==null&&zy(a)),i):(i.eventSystemFlags|=m,a=i.targetContainers,b!==null&&a.indexOf(b)===-1&&a.push(b),i)}function JT(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 $y(i){var a=rn(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(){By(c)});return}}else if(a===31){if(a=h(c),a!==null){i.blockedOn=a,po(i.priority,function(){By(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=Lp(i.nativeEvent);if(c===null){c=i.nativeEvent;var m=new c.constructor(c.type,c);Xe=m,c.target.dispatchEvent(m),Xe=null}else return a=tr(c),a!==null&&zy(a),i.blockedOn=c,!1;a.shift()}return!0}function Hy(i,a,c){Dd(i)&&c.delete(a)}function e4(){Bp=!1,na!==null&&Dd(na)&&(na=null),ia!==null&&Dd(ia)&&(ia=null),ra!==null&&Dd(ra)&&(ra=null),fc.forEach(Hy),mc.forEach(Hy)}function Od(i,a){i.blockedOn===a&&(i.blockedOn=null,Bp||(Bp=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,e4)))}var Ld=null;function Uy(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(zp(m||c)===null)continue;break}var y=tr(c);y!==null&&(i.splice(a,3),a-=3,Lm(y,{pending:!0,data:b,method:c.method,action:m},m,b))}}))}function Yo(i){function a(Y){return Od(Y,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);)$y(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[Qs]||null;if(typeof y=="function")E||Uy(c);else if(E){var L=null;if(y&&y.hasAttribute("formAction")){if(b=y,E=y[Qs]||null)L=E.formAction;else if(zp(b)!==null)continue}else L=E.action;typeof L=="function"?c[m+1]=L:(c.splice(m,3),m-=3),Uy(c)}}}function Fy(){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 Pp(i){this._internalRoot=i}zd.prototype.render=Pp.prototype.render=function(i){var a=this._internalRoot;if(a===null)throw Error(n(409));var c=a.current,m=Pn();Oy(c,m,i,a,null,null)},zd.prototype.unmount=Pp.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var a=i.containerInfo;Oy(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&&$y(i)}};var qy=t.version;if(qy!=="19.2.6")throw Error(n(527,qy,"19.2.6"));Z.findDOMNode=function(i){var a=i._reactInternals;if(a===void 0)throw typeof i.render=="function"?Error(n(188)):(i=Object.keys(i).join(","),Error(n(268,i)));return i=d(a),i=i!==null?p(i):null,i=i===null?null:i.stateNode,i};var t4={bundleType:0,version:"19.2.6",rendererPackageName:"react-dom",currentDispatcherRef:I,reconcilerVersion:"19.2.6"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Bd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Bd.isDisabled&&Bd.supportsFiber)try{ye=Bd.inject(t4),he=Bd}catch{}}return xc.createRoot=function(i,a){if(!o(i))throw Error(n(299));var c=!1,m="",b=Z1,y=Q1,E=J1;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=My(i,1,!1,null,null,c,m,null,b,y,E,Fy),i[Or]=a.current,vp(i),new Pp(a)},xc.hydrateRoot=function(i,a,c){if(!o(i))throw Error(n(299));var m=!1,b="",y=Z1,E=Q1,L=J1,Y=null;return c!=null&&(c.unstable_strictMode===!0&&(m=!0),c.identifierPrefix!==void 0&&(b=c.identifierPrefix),c.onUncaughtError!==void 0&&(y=c.onUncaughtError),c.onCaughtError!==void 0&&(E=c.onCaughtError),c.onRecoverableError!==void 0&&(L=c.onRecoverableError),c.formState!==void 0&&(Y=c.formState)),a=My(i,1,!0,a,c??null,m,b,Y,y,E,L,Fy),a.context=Dy(null),c=a.current,m=Pn(),m=Xt(m),b=Vr(m),b.callback=null,Gr(c,b,m),c=m,a.current.lanes=c,Et(a,c),Bi(a),i[Or]=a.current,vp(i),new zd(a)},xc.version="19.2.6",xc}var ew;function d4(){if(ew)return Hp.exports;ew=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(),Hp.exports=u4(),Hp.exports}var UN=d4();const FN=(...e)=>e.filter((t,s,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===s).join(" ").trim();const h4=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const f4=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,s,n)=>n?n.toUpperCase():s.toLowerCase());const tw=e=>{const t=f4(e);return t.charAt(0).toUpperCase()+t.slice(1)};var Vp={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 m4=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},p4=_.createContext({}),g4=()=>_.useContext(p4),x4=_.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=""}=g4()??{},w=n??g?Number(s??p)*24/Number(t??d):s??p;return _.createElement("svg",{ref:f,...Vp,width:t??d??Vp.width,height:t??d??Vp.height,stroke:e??x,strokeWidth:w,className:FN("lucide",v,o),...!l&&!m4(h)&&{"aria-hidden":"true"},...h},[...u.map(([k,N])=>_.createElement(k,N)),...Array.isArray(l)?l:[l]])});const ve=(e,t)=>{const s=_.forwardRef(({className:n,...o},l)=>_.createElement(x4,{ref:l,iconNode:t,className:FN(`lucide-${h4(tw(e))}`,`lucide-${e}`,n),...o}));return s.displayName=tw(e),s};const b4=[["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"}]],Qa=ve("activity",b4);const v4=[["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"}]],sw=ve("archive",v4);const _4=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],cf=ve("arrow-down",_4);const y4=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],ou=ve("arrow-left",y4);const w4=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],uf=ve("arrow-up",w4);const S4=[["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"}]],k4=ve("blocks",S4);const N4=[["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"}]],C4=ve("book-open",N4);const E4=[["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"}]],qN=ve("bot",E4);const j4=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],df=ve("box",j4);const A4=[["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"}]],T4=ve("braces",A4);const R4=[["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"}]],VN=ve("brain",R4);const M4=[["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"}]],D4=ve("calendar",M4);const O4=[["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"}]],GN=ve("camera",O4);const L4=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Zs=ve("check",L4);const z4=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Gn=ve("chevron-down",z4);const B4=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],P4=ve("chevron-left",B4);const I4=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Wn=ve("chevron-right",I4);const $4=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],hf=ve("chevron-up",$4);const H4=[["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"}]],Y0=ve("circle-alert",H4);const U4=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],ff=ve("circle-check-big",U4);const F4=[["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"}]],q4=ve("circle-dashed",F4);const V4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],G4=ve("circle-dot",V4);const W4=[["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"}]],K4=ve("circle-play",W4);const Y4=[["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"}]],X0=ve("circle-x",Y4);const X4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],cl=ve("circle",X4);const Z4=[["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"}]],WN=ve("cloud-upload",Z4);const Q4=[["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"}]],KN=ve("code-xml",Q4);const J4=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Ah=ve("copy",J4);const eR=[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],tR=ve("corner-down-right",eR);const sR=[["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"}]],nR=ve("cpu",sR);const iR=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],di=ve("database",iR);const rR=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],aR=ve("dollar-sign",rR);const oR=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Xc=ve("download",oR);const lR=[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Th=ve("earth",lR);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"}]],YN=ve("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"}]],so=ve("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"}]],XN=ve("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"}]],Z0=ve("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"}]],ZN=ve("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"}]],QN=ve("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"}]],JN=ve("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=ve("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"}]],Q0=ve("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"}]],eC=ve("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=ve("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"}]],J0=ve("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"}]],mf=ve("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"}]],eb=ve("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"}]],lo=ve("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=ve("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"}]],tC=ve("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"}]],Vn=ve("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=ve("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"}]],nw=ve("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=ve("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=ve("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=ve("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"}]],sC=ve("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"}]],nC=ve("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=ve("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=ve("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=ve("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=ve("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"}]],Zc=ve("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"}]],iC=ve("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=ve("layers",XR);const QR=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],JR=ve("link",QR);const eM=[["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"}]],tM=ve("list-collapse",eM);const sM=[["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"}]],nM=ve("list-tree",sM);const iM=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],jt=ve("loader-circle",iM);const rM=[["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"}]],iw=ve("loader",rM);const aM=[["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"}]],oM=ve("lock-keyhole",aM);const lM=[["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"}]],rC=ve("lock-open",lM);const cM=[["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"}]],uM=ve("lock",cM);const dM=[["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"}]],hM=ve("log-in",dM);const fM=[["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"}]],mM=ve("log-out",fM);const pM=[["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"}]],tb=ve("maximize-2",pM);const gM=[["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"}]],xM=ve("memory-stick",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"}]],vM=ve("message-square-plus",bM);const _M=[["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"}]],yM=ve("message-square",_M);const wM=[["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"}]],sb=ve("minimize-2",wM);const SM=[["path",{d:"M5 12h14",key:"1ays0h"}]],aC=ve("minus",SM);const kM=[["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"}]],NM=ve("moon",kM);const CM=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],EM=ve("network",CM);const jM=[["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"}]],AM=ve("package",jM);const TM=[["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"}]],RM=ve("palette",TM);const MM=[["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"}]],DM=ve("panel-left-close",MM);const OM=[["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"}]],LM=ve("panel-left-open",OM);const zM=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],BM=ve("panel-left",zM);const PM=[["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"}]],IM=ve("paperclip",PM);const $M=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],HM=ve("pen-line",$M);const UM=[["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=ve("pencil",UM);const FM=[["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"}]],jr=ve("play",FM);const qM=[["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"}]],oC=ve("plug",qM);const VM=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ps=ve("plus",VM);const GM=[["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"}]],nb=ve("puzzle",GM);const WM=[["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"}]],KM=ve("radio",WM);const YM=[["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"}]],Ar=ve("refresh-cw",YM);const XM=[["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"}]],pf=ve("rotate-ccw",XM);const ZM=[["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"}]],QM=ve("rotate-cw",ZM);const JM=[["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"}]],lC=ve("save",JM);const e6=[["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"}]],cC=ve("scroll-text",e6);const t6=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],s6=ve("search",t6);const n6=[["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"}]],i6=ve("send-horizontal",n6);const r6=[["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"}]],ib=ve("server",r6);const a6=[["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"}]],o6=ve("settings-2",a6);const l6=[["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"}]],c6=ve("shield-alert",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:"m9 12 2 2 4-4",key:"dzmm74"}]],d6=ve("shield-check",u6);const h6=[["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"}]],uC=ve("shield-question-mark",h6);const f6=[["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"}]],dC=ve("skip-forward",f6);const m6=[["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"}]],Yi=ve("sparkles",m6);const p6=[["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"}]],rb=ve("square-terminal",p6);const g6=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],no=ve("square",g6);const x6=[["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"}]],b6=ve("stethoscope",x6);const v6=[["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"}]],_6=ve("sun",v6);const y6=[["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"}]],hC=ve("table-2",y6);const w6=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],ml=ve("terminal",w6);const S6=[["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"}]],Ti=ve("trash-2",S6);const k6=[["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"}]],Er=ve("triangle-alert",k6);const N6=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],gf=ve("upload",N6);const C6=[["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"}]],E6=ve("user",C6);const j6=[["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"}]],A6=ve("wand-sparkles",j6);const T6=[["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"}]],R6=ve("webhook",T6);const M6=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],Mh=ve("workflow",M6);const D6=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],qt=ve("x",D6);const O6=[["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"}]],fC=ve("zap",O6);class mC extends Error{conflict;constructor(t,s){super(t),this.name="PortConflictResponseError",this.conflict=s}}async function Me(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 mC(n?.error||"Port already in use",n.conflict):new Error(n?.error||s.statusText);return n}async function ji(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 Me(e,{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:s})}async function Un(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 Me(e,{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:s})}const L6="modulepreload",z6=function(e){return"/"+e},rw={},lu=function(t,s,n){let o=Promise.resolve();if(s&&s.length>0){let f=function(d){return Promise.all(d.map(p=>Promise.resolve(p).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),h=u?.nonce||u?.getAttribute("nonce");o=f(s.map(d=>{if(d=z6(d),d in rw)return;rw[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":L6,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)})},$s=()=>typeof window<"u"&&(!!window.__TAURI_INTERNALS__||!!window.__TAURI__);async function xf(){if(!$s())return null;try{return await lu(()=>import("./window-DlR023_X.js"),__vite__mapDeps([0,1,2]))}catch{return null}}async function B6(){await(await xf())?.getCurrentWindow().minimize()}async function P6(){await(await xf())?.getCurrentWindow().toggleMaximize()}async function I6(){await(await xf())?.getCurrentWindow().hide()}async function $6(){await(await xf())?.getCurrentWindow().startDragging()}async function bf(e){if($s())try{const{invoke:t}=await lu(async()=>{const{invoke:s}=await import("./core-DhEqZVGG.js");return{invoke:s}},[]);await t("open_external",{url:e});return}catch{}window.open(e,"_blank","noopener,noreferrer")}let Gp=null,Wp=null;async function H6(){return Gp||(Gp=(await lu(()=>import("./core-DhEqZVGG.js"),[])).invoke),Gp}async function U6(){return Wp||(Wp=(await lu(()=>import("./event-BK_86lmQ.js"),__vite__mapDeps([2,1]))).listen),Wp}async function Le(e,t){return(await H6())(e,t)}async function ab(e,t){return(await U6())(e,n=>t(n.payload))}function F6(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 q6(e){const t={};for(const s of e.runtime.services)t[s.name]=F6(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 V6(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 G6(e){const t=V6(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 W6(e){return e.map(t=>({name:t.name,current:t.isCurrent,remote:t.isRemote}))}async function K6(e){return Le("service_processes",{name:e})}async function Y6(){const e=await Le("get_dashboard"),t=q6(e),s=e.runtime.services.filter(d=>d.state.toLowerCase()==="running"),n={};await Promise.all(s.map(async d=>{const p=await K6(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([gC().catch(()=>null),fD().catch(()=>[])]);return{...t,git:{cwd:u.path,selectedRepository:u,status:h,branches:f}}}async function pC(e){await Le("start_service",{name:e})}async function X6(e){await Le("stop_service",{name:e})}async function Z6(e){await Le("restart_service",{name:e})}async function Q6(e){await Le("start_bundle",{name:e})}async function J6(e){await Le("stop_bundle",{name:e})}async function eD(e){await Le("remove_service",{name:e})}async function tD(e){return Le("register_service",{service:e})}async function sD(e){return Le("register_bundle",{bundle:e})}async function nD(e,t){return{logs:await Le("get_logs",{service:e,limit:t??200}),queryable:!1}}async function gC(e){return Le("git_status",{repo:null})}async function iD(e,t){return Le("git_diff",{file:e??null,repo:t??null})}async function rD(e=200){const t=await Le("git_graph",{limit:e,repo:null});return G6(t)}async function aD(e,t){return Le("git_commit_diff",{hash:e,file:t??null,repo:null})}async function oD(e){return await Le("git_commit_files",{hash:e,repo:null})}async function lD(e,t){await Le("git_stage",{paths:e,repo:t??null})}async function cD(e,t){await Le("git_unstage",{paths:e,repo:t??null})}async function uD(e,t){return Le("git_commit",{message:e,repo:t??null})}async function dD(e){return{output:await Le("git_push",{remote:null,repo:e??null}),branch:"",setUpstream:!1}}async function hD(e,t){return await Le("git_create_branch",{name:e,repo:null}),""}async function fD(e){const t=await Le("git_branches",{repo:null});return W6(t)}async function mD(e){return{output:await Le("git_pull_default",{repo:null}),branch:""}}async function pD(e){return Le("git_list_files",{repo:null})}async function gD(e){return Le("git_file_sizes",{repo:null})}async function xD(e){await Le("select_git_repository",{name:e})}async function bD(e,t){const s=await Le("git_read_file",{path:e,repo:null});return{content:s,truncated:!1,binary:!1,size:s.length}}async function vD(e,t,s){await Le("git_write_file",{path:e,content:t,repo:null})}async function _D(e){await Le("remove_git_repository",{name:e})}async function xC(e){return Le("register_git_repository",{repo:e})}async function yD(e){return Le("clone_git_repository",{url:e})}async function wD(e){return await Le("set_git_board_repositories",{names:e}),e}async function SD(){const e=await Le("get_dashboard"),t=e.config.gitRepositories,s=e.config.gitBoardRepositories;return{repos:(await Promise.allSettled(t.map(async l=>{const u=await Le("git_status",{repo:l.name});return{name:l.name,path:l.path,branch:u.branch,ahead:u.ahead,behind:u.behind,files:u.files}}))).map((l,u)=>l.status==="fulfilled"?l.value:{name:t[u].name,path:t[u].path,branch:"",ahead:0,behind:0,files:[],error:String(l.reason)}),board:s??t.map(l=>l.name)}}async function kD(){return Le("get_github_token_status")}async function aw(e,t){await Le("set_github_token",{host:e,token:t})}async function ND(e){await Le("remove_github_token",{host:e})}async function on(e){return Le("get_github_repo",{repo:null})}async function CD(e,t,s){return Le("list_pull_requests",{owner:e,repo:t,stateFilter:s??"open"})}async function ED(e,t,s){return Le("list_issues",{owner:e,repo:t,stateFilter:s??"open"})}async function ow(e,t,s){return Le("get_pull_request",{owner:e,repo:t,number:s})}async function jD(e){return Le("create_pull_request",e)}async function AD(e){return Le("github_oauth_start",{clientId:e})}async function TD(e,t){return Le("github_oauth_poll",{clientId:e,deviceCode:t})}async function RD(e,t,s){return Le("get_pr_diff",{owner:e,repo:t,number:s})}async function MD(e,t,s){return Le("list_pr_files",{owner:e,repo:t,number:s})}async function DD(e,t,s){return Le("list_pr_reviews",{owner:e,repo:t,number:s})}async function OD(e,t,s){return Le("list_pr_comments",{owner:e,repo:t,number:s})}async function LD(e,t,s,n={}){return Le("merge_pull_request",{owner:e,repo:t,number:s,method:n.method??null,commitTitle:n.commitTitle??null,commitMessage:n.commitMessage??null})}async function zD(e,t,s){return Le("get_github_issue",{owner:e,repo:t,number:s})}async function BD(e,t,s){return Le("list_issue_comments",{owner:e,repo:t,number:s})}async function PD(e,t,s,n){return Le("add_issue_comment",{owner:e,repo:t,number:s,body:n})}async function ID(e,t){return Le("list_github_branches",{owner:e,repo:t})}async function lw(e,t){return Le("get_github_repo_info",{owner:e,repo:t})}async function cw(e,t,s){return Le("list_commit_check_runs",{owner:e,repo:t,sha:s})}async function $D(e,t,s,n){return Le("list_workflow_runs",{owner:e,repo:t,branch:s??null,page:n??null})}async function HD(e,t,s){return Le("list_workflow_run_jobs",{owner:e,repo:t,runId:s})}async function UD(){return Le("list_databases")}async function Kp(e,t,s){return Le("query_database",{name:e,sql:t,limit:s??null})}async function FD(e,t){return Le("execute_database",{name:e,sql:t})}async function qD(e){return Le("list_tables",{name:e})}async function bC(e){await Le("register_database",{db:e})}async function VD(e){await Le("remove_database",{name:e})}async function GD(e,t){await Le("set_database_write_access",{name:e,unlocked:t})}async function WD(){return(await Le("get_config")).logSources}async function KD(e){await Le("register_log_source",{source:e})}async function YD(e){return Le("list_snapshots",{repo:null})}async function XD(e,t){return Le("create_snapshot",{label:e??null,repo:null})}async function ZD(e,t){await Le("restore_snapshot",{sha:e,repo:null})}async function QD(e,t){await Le("delete_snapshot",{sha:e,repo:null})}async function JD(e,t){return Le("get_snapshot_files",{sha:e,repo:null})}async function e8(e,t,s){return Le("get_snapshot_diff",{sha:e,path:t??null,repo:null})}async function t8(){return Le("list_workflows")}async function s8(e){return Le("save_workflow",{workflow:e})}async function n8(e){return Le("delete_workflow",{id:e})}async function i8(){return Le("get_agent_info")}async function r8(){return Le("get_agent_chat_status")}async function a8(e){return Le("set_chat_provider",{provider:e})}async function o8(e,t,s){await Le("start_agent_chat",{message:e,resumeSessionId:t??null,provider:s??null})}async function l8(e){return Le("scan_repo_url",{url:e})}async function c8(e,t){await Le("run_install_command",{cwd:e,command:t})}async function u8(){return(await Le("list_terminal_sessions")).map(t=>({...t,serviceName:t.serviceName??void 0,label:t.serviceName??t.label??void 0}))}async function uw(e){const t=await Le("create_terminal_session",{serviceName:e?.serviceName??null,cwd:e?.cwd??null,agent:e?.agent??null});return{...t,serviceName:t.serviceName??void 0,label:t.serviceName??t.label??void 0}}async function dw(e,t){await Le("write_terminal_input",{id:e,data:t})}async function d8(e){await Le("start_terminal_stream",{id:e})}async function h8(e,t,s){await Le("resize_terminal",{id:e,cols:t,rows:s})}async function f8(e){await Le("close_terminal_session",{id:e})}async function m8(e,t){return ab(`terminal-output-${e}`,s=>t(s))}const p8={async getAgentInfo(){return(await Me("/api/agent")).agent},async getMcpAuthStatuses(e){return(await Me(`/api/agent/mcp-status?agent=${encodeURIComponent(e)}`)).statuses},async getAgentUsage(){return(await Me("/api/agent/usage")).usage},async getAgentUsageHistory(e){const t=e?`?since=${encodeURIComponent(e)}`:"",s=await Me(`/api/agent/usage/history${t}`);return{entries:s.entries,summary:s.summary}},async getClaudeAgentSettings(){return(await Me("/api/agent/claude-settings")).settings},async updateClaudeAgentSettings(e){return(await Me("/api/agent/claude-settings",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})).settings}},g8={getAgentInfo:()=>i8(),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})},x8=$s()?g8:p8,{getAgentInfo:vC,getMcpAuthStatuses:b8,getAgentUsage:v8,getAgentUsageHistory:_8,getClaudeAgentSettings:y8,updateClaudeAgentSettings:w8}=x8,S8={async getAgentChatStatus(){const e=await Me("/api/agent/chat/status");return{configured:e.configured,approvals:e.approvals,provider:e.provider,providers:e.providers??[]}},async setChatProvider(e){return(await Me("/api/agent/chat/provider",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({provider:e})})).provider},async approveAgentTool(e,t,s){await Me("/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 Yp="claude";const k8={async getAgentChatStatus(){const t=await r8();return Yp=t.provider?.id??"claude",{...t,providers:t.providers??[]}},async setChatProvider(e){const s=await a8(e)??null;return Yp=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 ab("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 o8(e,t,l??Yp)}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())})})}},N8=$s()?k8:S8,{getAgentChatStatus:C8,setChatProvider:E8,approveAgentTool:j8,streamAgentChat:A8}=N8;function Pi(e,t){return Me(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)})}const T8={async getAgentEnvAgents(){return(await Me("/api/agent-env/agents")).agents},async getAgentEnvConfigs(){return(await Me("/api/agent-env/live")).configs},async getAgentEnvDoctor(){const e=await Me("/api/agent-env/doctor");return{checks:e.checks,hasIssues:e.hasIssues}},async previewAgentEnvChanges(e){const t=await Pi("/api/agent-env/changes/preview",{changes:e});return{valid:t.valid,items:t.items,agents:t.agents}},async applyAgentEnvChanges(e){return Pi("/api/agent-env/changes/apply",{changes:e})},async listAgentEnvProfiles(){return(await Me("/api/agent-env/profiles")).profiles},async deleteAgentEnvProfile(e){await Me(`/api/agent-env/profiles/${encodeURIComponent(e)}`,{method:"DELETE"})},async snapshotAgentEnvProfile(e){return(await Pi("/api/agent-env/profiles/snapshot",e)).profile},async previewAgentEnvProfileApply(e,t){return Pi(`/api/agent-env/profiles/${encodeURIComponent(e)}/apply-preview`,{agent:t})},async applyAgentEnvProfile({name:e,agent:t,skip:s}){return Pi(`/api/agent-env/profiles/${encodeURIComponent(e)}/apply`,{agent:t,skip:s})},async exportAgentEnvProfile(e){return{archivePath:(await Pi(`/api/agent-env/profiles/${encodeURIComponent(e)}/export`,{})).archivePath}},async importAgentEnvProfile(e,t){return Me(`/api/agent-env/profiles/import${t?.force?"?force=1":""}`,{method:"POST",headers:{"content-type":"application/gzip"},body:e})},async getRegistryAuthStatus(){const e=await Me("/api/agent-env/auth/status"),{ok:t,...s}=e;return s},async startRegistryAuth(){const e=await Pi("/api/agent-env/auth/start",{});return{url:e.url,state:e.state}},async getRegistryAuthOutcome(e){return Me(`/api/agent-env/auth/outcome?state=${encodeURIComponent(e)}`)},async registryLogout(){await Pi("/api/agent-env/auth/logout",{})},async publishAgentEnvProfile({name:e,...t}){return Pi(`/api/agent-env/profiles/${encodeURIComponent(e)}/publish`,t)},async installAgentEnvProfileFromRegistry(e){return Pi("/api/agent-env/profiles/install-from-registry",e)}},Nn=()=>Promise.reject(new Error("Agent Environments is not available in desktop mode yet.")),R8={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:Nn,applyAgentEnvChanges:Nn,listAgentEnvProfiles:async()=>[],deleteAgentEnvProfile:Nn,snapshotAgentEnvProfile:Nn,previewAgentEnvProfileApply:Nn,applyAgentEnvProfile:Nn,exportAgentEnvProfile:Nn,importAgentEnvProfile:Nn,getRegistryAuthStatus:Nn,startRegistryAuth:Nn,getRegistryAuthOutcome:Nn,registryLogout:Nn,publishAgentEnvProfile:Nn,installAgentEnvProfileFromRegistry:Nn},M8=$s()?R8:T8,{getAgentEnvAgents:D8,getAgentEnvConfigs:O8,getAgentEnvDoctor:L8,previewAgentEnvChanges:z8,applyAgentEnvChanges:B8,listAgentEnvProfiles:P8,deleteAgentEnvProfile:I8,snapshotAgentEnvProfile:$8,previewAgentEnvProfileApply:H8,applyAgentEnvProfile:U8,exportAgentEnvProfile:F8,importAgentEnvProfile:hw,getRegistryAuthStatus:q8,startRegistryAuth:V8,getRegistryAuthOutcome:G8,registryLogout:W8,publishAgentEnvProfile:K8,installAgentEnvProfileFromRegistry:fw}=M8,Y8={async listDatabases(){return(await Me("/api/databases")).connections},async detectDatabases(){return(await Me("/api/databases/detect")).detected},async addDatabase(e){await Un("/api/databases",e)},testDatabase(e){return Un("/api/databases/test",e)},async deleteDatabase(e){await Me(`/api/databases/${encodeURIComponent(e)}`,{method:"DELETE"})},async getDatabaseTables(e){return(await Me(`/api/databases/${encodeURIComponent(e)}/tables`)).tables},runDatabaseQuery(e,t,s=100){return Un(`/api/databases/${encodeURIComponent(e)}/query`,{sql:t,limit:s})},async setDatabaseWriteAccess(e,t){await Un(`/api/databases/${encodeURIComponent(e)}/write-access`,{unlocked:String(t)})},executeDatabaseWrite(e,t,s){return Un(`/api/databases/${encodeURIComponent(e)}/execute`,{sql:t,mode:s})},getDatabaseRows(e,t,s=100,n=0){return Me(`/api/databases/${encodeURIComponent(e)}/rows?table=${encodeURIComponent(t)}&limit=${s}&offset=${n}`)}};function mw(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 X8={async listDatabases(){return await UD()},detectDatabases:async()=>[],async addDatabase(e){await bC(e)},async testDatabase(){try{return await Kp("__test__","SELECT 1",1),{ok:!0}}catch(e){return{ok:!1,error:String(e)}}},async deleteDatabase(e){await VD(e)},async getDatabaseTables(e){return(await qD(e)).map(s=>({name:s,qualifiedName:s}))},async runDatabaseQuery(e,t,s=100){const n=await Kp(e,t,s),{columns:o,rows:l,rowCount:u}=mw(n);return{engine:"sqlite",columns:o,rows:l,rowCount:u,truncated:!1}},async setDatabaseWriteAccess(e,t){await GD(e,t)},async executeDatabaseWrite(e,t,s){return s==="preview"?{engine:"sqlite",previewUnavailable:!0}:{engine:"sqlite",previewUnavailable:!1,affectedRows:await FD(e,t),committed:!0}},async getDatabaseRows(e,t,s=100,n=0){const o=n>0?`SELECT * FROM ${t} LIMIT ${s} OFFSET ${n}`:`SELECT * FROM ${t} LIMIT ${s}`,l=await Kp(e,o,s),{columns:u,rows:h,rowCount:f}=mw(l);return{engine:"sqlite",table:{name:t,qualifiedName:t},columns:u,rows:h,rowCount:f,limit:s,offset:n}}},Z8=$s()?X8:Y8,{listDatabases:_C,detectDatabases:Q8,addDatabase:J8,testDatabase:eO,deleteDatabase:tO,getDatabaseTables:yC,runDatabaseQuery:sO,setDatabaseWriteAccess:nO,executeDatabaseWrite:pw,getDatabaseRows:iO}=Z8,wC={async getErrorIncidents(e=100){return(await Me(`/api/errors?limit=${e}`)).incidents},getErrorPrompt(e){return Me(`/api/errors/${e}/prompt`)},getErrorBundle(e,t=!1){return Me(`/api/errors/${e}/bundle${t?"?save=1":""}`)},startFix(e){return Me(`/api/errors/${e}/fix`,{method:"POST"})}},rO={...wC,getErrorIncidents:async()=>[]},aO=$s()?rO:wC,{getErrorIncidents:SC,startFix:oO}=aO,lO={async getGitGraph(e=200){return(await Me(`/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 Me(`/api/git/commit/files?hash=${encodeURIComponent(e)}`)).files},async getGitFiles(){return(await Me("/api/git/files")).files},async getFileSizeRanking(){return(await Me("/api/git/file-sizes")).files},async getGitFile(e){const t=await Me(`/api/git/file?path=${encodeURIComponent(e)}`);return{content:t.content,truncated:t.truncated,binary:t.binary,size:t.size}},async updateGitFile(e,t){await Me("/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 Me("/api/git/overview"),t=e.repos??[],s=e.board??t.map(n=>n.name);return{repos:t,board:s}},async setGitBoard(e){return(await Me("/api/git/board",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({names:e})})).board},async gitStage(e,t){await Me("/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 Me("/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 Un("/api/git/commit",{message:e,...t?{repo:t}:{}})).output},async gitPush(e){const t=await Un("/api/git/push",e?{repo:e}:{});return{output:t.output,branch:t.branch,setUpstream:t.setUpstream}},async gitCheckoutDefaultAndPull(){const e=await Un("/api/git/default-branch/pull",{});return{output:e.output,branch:e.branch}},async gitCreateBranch(e){return(await Un("/api/git/branches",{name:e})).output},async deleteGitRepository(e){await Me(`/api/git/repositories/${encodeURIComponent(e)}`,{method:"DELETE"})},async selectGitRepository(e){await ji("/api/git/select",{name:e})},async registerGitRepository(e,t){await ji("/api/git/repositories",{name:e,path:t})},async cloneGitRepository(e){const t=await Un("/api/git/clone",{url:e});return{name:t.name,path:t.path}}},cO={getGitGraph:(e=200)=>rD(e),getGitCommitDiff:(e,t)=>aD(e,t),getGitCommitFiles:e=>oD(e),getGitFiles:()=>pD(),getFileSizeRanking:()=>gD(),getGitFile:e=>bD(e),updateGitFile:(e,t)=>vD(e,t),getGitDiff:(e,t)=>iD(e,t),getGitOverview:()=>SD(),setGitBoard:e=>wD(e),gitStage:(e,t)=>lD(e,t),gitUnstage:(e,t)=>cD(e,t),gitCommit:(e,t)=>uD(e,t),gitPush:e=>dD(e),gitCheckoutDefaultAndPull:()=>mD(),gitCreateBranch:e=>hD(e),deleteGitRepository:e=>_D(e),selectGitRepository:e=>xD(e),registerGitRepository:async(e,t)=>{await xC({name:e,path:t})},cloneGitRepository:e=>yD(e)},uO=$s()?cO:lO,{getGitGraph:dO,getGitCommitDiff:hO,getGitCommitFiles:fO,getGitFiles:mO,getFileSizeRanking:pO,getGitFile:gO,updateGitFile:xO,getGitDiff:kC,getGitOverview:Xp,setGitBoard:gw,gitStage:ob,gitUnstage:NC,gitCommit:CC,gitPush:vf,gitCheckoutDefaultAndPull:bO,gitCreateBranch:vO,deleteGitRepository:_O,selectGitRepository:EC,registerGitRepository:yO,cloneGitRepository:wO}=uO,SO={getGitHubTokenInfo(){return Me("/api/github/token")},startGitHubDeviceFlow(){return Me("/api/github/oauth/start",{method:"POST"})},async pollGitHubDeviceFlow(e){const t=await Me("/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 Me("/api/github/token",{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:s})},async removeGitHubToken(e){await Me(`/api/github/token/${encodeURIComponent(e)}`,{method:"DELETE"})},async listGitHubBranches(){const e=await Me("/api/github/branches");return{repository:e.repository,defaultBranch:e.defaultBranch,currentBranch:e.currentBranch,branches:e.branches}},async listGitHubPRs(e="open",t=1){return(await Me(`/api/github/prs?state=${e}&page=${t}`)).prs},async getGitHubPR(e){return(await Me(`/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 Me(`/api/github/prs/${e}/review`)).cockpit},async getGitHubPRTemplate(){return(await Me("/api/github/pr-template")).template},async createGitHubPR(e){return(await Me("/api/github/prs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})).pr},async mergeGitHubPR(e,t={}){const s=await Me(`/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 Me(`/api/github/issues?state=${e}&page=${t}`)).issues},async getGitHubIssue(e){return(await Me(`/api/github/issues/${e}`)).issue},async listGitHubIssueComments(e){return(await Me(`/api/github/issues/${e}/comments`)).comments},async addGitHubIssueComment(e,t){return(await Me(`/api/github/issues/${e}/comments`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({body:t})})).comment},async getCommitCIStatus(e){return(await Me(`/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 Me(`/api/github/runs?${s}`)).runs},async listGitHubWorkflowRunJobs(e){return(await Me(`/api/github/runs/${e}/jobs`)).jobs}},xw="Iv23liCxW0Mv0KJP1Svr";function bw(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 kO={async getGitHubTokenInfo(){const e=await kD();return{configured:e.configured,deviceFlowAvailable:!0,status:e.configured?"connected":"not_configured"}},async startGitHubDeviceFlow(){return await AD(xw)},async pollGitHubDeviceFlow(e){const t=await TD(xw,e);return t.access_token?(await aw("github.com",t.access_token),{done:!0}):{done:!1,slowDown:t.error==="slow_down"}},async setGitHubToken(e,t){await aw(e,t)},async removeGitHubToken(e){await ND(e)},async listGitHubBranches(){const[e,t]=await on(),[s,n]=await Promise.all([ID(e,t),lw(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 on();return(await CD(s,n,e)).slice((t-1)*50,t*50)},async getGitHubPR(e){const[t,s]=await on();return ow(t,s,e)},async getGitHubPRDiff(e){const[t,s]=await on();return RD(t,s,e)},async getGitHubPRReviewCockpit(e){const[t,s]=await on(),n=await ow(t,s,e),[o,l,u,h]=await Promise.all([MD(t,s,e),DD(t,s,e),OD(t,s,e),cw(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:bw(f),totalCount:h.total_count??f.length,runs:f}}},async getGitHubPRTemplate(){const[e,t]=await on(),s=await lw(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 on();return jD({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 on();return await LD(s,n,e,t)},async listGitHubIssues(e="open",t=1){const[s,n]=await on();return(await ED(s,n,e)).slice((t-1)*50,t*50)},async getGitHubIssue(e){const[t,s]=await on();return zD(t,s,e)},async listGitHubIssueComments(e){const[t,s]=await on();return BD(t,s,e)},async addGitHubIssueComment(e,t){const[s,n]=await on();return PD(s,n,e,t)},async getCommitCIStatus(e){const[t,s]=await on(),n=await cw(t,s,e),o=n.check_runs??[];return{sha:e,state:bw(o),totalCount:n.total_count??o.length,runs:o}},async listGitHubWorkflowRuns(e,t=1){const[s,n]=await on();return(await $D(s,n,e,t)).workflow_runs??[]},async listGitHubWorkflowRunJobs(e){const[t,s]=await on();return(await HD(t,s,e)).jobs??[]}},NO=$s()?kO:SO,{getGitHubTokenInfo:CO,startGitHubDeviceFlow:EO,pollGitHubDeviceFlow:jO,setGitHubToken:AO,removeGitHubToken:TO,listGitHubBranches:RO,listGitHubPRs:Zp,getGitHubPR:MO,getGitHubPRDiff:DO,getGitHubPRReviewCockpit:OO,getGitHubPRTemplate:LO,createGitHubPR:zO,mergeGitHubPR:BO,listGitHubIssues:Qp,getGitHubIssue:PO,listGitHubIssueComments:IO,addGitHubIssueComment:$O,getCommitCIStatus:HO,listGitHubWorkflowRuns:fh,listGitHubWorkflowRunJobs:vw}=NO,UO={async listLogSources(){return(await Me("/api/log-sources")).sources},async addLogSource(e){return(await Un("/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 Me(`/api/log-sources/${encodeURIComponent(e)}/logs?${s.toString()}`)).logs}};async function _w(){return await WD()??[]}const FO={listLogSources:_w,async addLogSource(e){return await KD(e),_w()},getLogSourceLogs:async()=>[]},qO=$s()?FO:UO,{listLogSources:VO,addLogSource:GO,getLogSourceLogs:jC}=qO,Jp={"content-type":"application/json"};function WO(e,t){let s="message",n="";for(const o of e.split(`
|
|
16
|
+
`))o.startsWith("event:")?s=o.slice(6).trim():o.startsWith("data:")&&(n+=o.slice(5).trim());if(n)try{const o=JSON.parse(n);s==="output"?t.onLine(o):s==="done"?t.onDone(o.exitCode??null):s==="error"&&t.onError(o.error??"Install failed.")}catch{}}const KO={async scanRepo(e){const t=await Me("/api/onboard/scan",{method:"POST",headers:Jp,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 Me("/api/onboard/register",{method:"POST",headers:Jp,body:JSON.stringify({...e,start:t,database:n})})},async streamInstall(e,t){const s=await fetch("/api/onboard/install/stream",{method:"POST",headers:Jp,body:JSON.stringify(e)});if(!s.ok||!s.body){const u=await s.json().catch(()=>{});t.onError(u?.error||s.statusText);return}const n=s.body.getReader(),o=new TextDecoder;let l="";for(;;){const{done:u,value:h}=await n.read();if(u)break;l+=o.decode(h,{stream:!0});const f=l.split(`
|
|
17
|
+
|
|
18
|
+
`);l=f.pop()??"";for(const d of f)WO(d,t)}}},YO={scanRepo:e=>l8(e),async registerOnboarded(e,t,s){await xC({name:e.name,path:e.cwd}),await tD({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 bC({name:s.name,engine:s.engine,url:s.url}),t&&await pC(e.name)},async streamInstall(e,t){let s;s=await ab("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 c8(e.clonePath,e.command)}catch(n){s?.(),t.onError(String(n))}}},XO=$s()?YO:KO,{scanRepo:ZO,registerOnboarded:QO,streamInstall:JO}=XO,AC={getDashboard(){return Me("/api/dashboard")},async getServiceGraph(){return(await Me("/api/services/graph")).graph},async startService(e){await Me(`/api/services/${encodeURIComponent(e)}/start`,{method:"POST"})},async stopService(e){await Me(`/api/services/${encodeURIComponent(e)}/stop`,{method:"POST"})},async restartService(e){await Me(`/api/services/${encodeURIComponent(e)}/restart`,{method:"POST"})},async startBundle(e){await Me(`/api/bundles/${encodeURIComponent(e)}/start`,{method:"POST"})},async stopBundle(e){await Me(`/api/bundles/${encodeURIComponent(e)}/stop`,{method:"POST"})},async deleteService(e){await Me(`/api/services/${encodeURIComponent(e)}`,{method:"DELETE"})},async registerBundle(e){await ji("/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 Me(`/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"),Me(`/api/fs/directories?${s.toString()}`)},browseServiceConfig(e,t){const s=t?`?path=${encodeURIComponent(t)}`:"";return Me(`/api/services/${encodeURIComponent(e)}/config-browse${s}`)},async getServiceConfigFiles(e){const t=await Me(`/api/services/${encodeURIComponent(e)}/config-files`);return{cwd:t.cwd,files:t.files}},getServiceConfigFile(e,t){return Me(`/api/services/${encodeURIComponent(e)}/config-file?path=${encodeURIComponent(t)}`)},putServiceConfigFileEnv(e,t,s){return Me(`/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 Me(`/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 Me(`/api/services/${encodeURIComponent(e)}/env/runtime`)).runtime},async getServiceMetrics(e){return(await Me(`/api/services/${encodeURIComponent(e)}/metrics`)).metrics},testServiceCommand(e){return Un("/api/services/test",e)},runServiceTests(e,t){return Un(`/api/services/${encodeURIComponent(e)}/test`,t?{pattern:t}:{})}},eL={...AC,getDashboard:()=>Y6(),startService:e=>pC(e),stopService:e=>X6(e),restartService:e=>Z6(e),startBundle:e=>Q6(e),stopBundle:e=>J6(e),deleteService:e=>eD(e),registerBundle:e=>sD(e).then(()=>{}),getServiceLogs:(e,t={})=>nD(e,t.lines)},kr=$s()?eL:AC,{getDashboard:tL,getServiceGraph:sL,startService:nL,stopService:iL,restartService:TC,startBundle:TQ,stopBundle:yw,deleteService:rL,getServiceLogs:RC,getDirectories:MC,browseServiceConfig:aL,getServiceConfigFiles:oL,getServiceConfigFile:ww,putServiceConfigFileEnv:lL,putServiceConfigFileText:cL,getServiceEnvRuntime:uL,getServiceMetrics:dL,testServiceCommand:hL,runServiceTests:fL}=kr;async function mL(e,t,s){t.includes(s)||await kr.registerBundle({name:e,services:[...t,s]})}async function Sw(e,t){let s,n;try{s=await kr.getDashboard(),n=await kr.getServiceGraph()}catch{await kr.startBundle(e);return}const o=s.config.bundles.find(g=>g.name===e);if(!o){await kr.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 pL(v)}await kr.startService(g),await t?.(g)}}async function pL(e,t=15e3){const s=Date.now()+t;for(;Date.now()<s;){try{if((await kr.getDashboard()).ports.some(o=>o.port===e&&!o.available))return}catch{return}await new Promise(n=>setTimeout(n,400))}}async function gL(e,t,s){t.includes(s)&&await kr.registerBundle({name:e,services:t.filter(n=>n!==s)})}async function kw(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 xL={async listSnapshots(){return(await Me("/api/snapshots")).snapshots},async createSnapshot(e){return(await Me("/api/snapshots",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({label:e})})).snapshot},async renameSnapshot(e,t){return(await Me(`/api/snapshots/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({label:t})})).snapshot},async deleteSnapshot(e){await Me(`/api/snapshots/${encodeURIComponent(e)}`,{method:"DELETE"})},async getSnapshotFiles(e){return(await Me(`/api/snapshots/${encodeURIComponent(e)}/files`)).files},getSnapshotDiff(e,t){const s=t?`?path=${encodeURIComponent(t)}`:"";return kw(`/api/snapshots/${encodeURIComponent(e)}/diff${s}`)},restoreSnapshot(e){return Me(`/api/snapshots/${encodeURIComponent(e)}/restore`,{method:"POST"})},async listChangeSets(){return(await Me("/api/agent/change-sets")).sessions},getChangeSet(e){return Me(`/api/agent/change-sets/${encodeURIComponent(e)}`)},getChangeSetDiff(e,t){const s=t?`?path=${encodeURIComponent(t)}`:"";return kw(`/api/agent/change-sets/${encodeURIComponent(e)}/diff${s}`)},restoreChangeSet(e){return Me(`/api/agent/change-sets/${encodeURIComponent(e)}/restore`,{method:"POST"})}},bL={listSnapshots:()=>YD(),createSnapshot:e=>XD(e),renameSnapshot:async()=>{throw new Error("Snapshot rename is not supported in desktop mode")},deleteSnapshot:e=>QD(e),getSnapshotFiles:e=>JD(e),getSnapshotDiff:(e,t)=>e8(e,t),async restoreSnapshot(e){return await ZD(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")}},vL=$s()?bL:xL,{listSnapshots:_L,createSnapshot:yL,renameSnapshot:wL,deleteSnapshot:SL,getSnapshotFiles:kL,getSnapshotDiff:NL,restoreSnapshot:CL,listChangeSets:EL,getChangeSet:jL,getChangeSetDiff:AL,restoreChangeSet:TL}=vL,RL={async listTerminalSessions(){return(await Me("/api/terminal/sessions")).sessions},async createTerminalSession(e){return(await Me("/api/terminal/sessions",{method:"POST",...e?.serviceName?{headers:{"content-type":"application/json"},body:JSON.stringify({serviceName:e.serviceName})}:{}})).session},async createAgentTerminalSession(e){return(await Me("/api/terminal/sessions",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({agent:e})})).session},async closeTerminalSession(e){await Me(`/api/terminal/sessions/${encodeURIComponent(e)}`,{method:"DELETE"})}},ML={listTerminalSessions:()=>u8(),createTerminalSession:e=>uw(e),createAgentTerminalSession:e=>uw({agent:e}),closeTerminalSession:e=>f8(e)};function _f(){return $s()?ML:RL}function DC(){return _f().listTerminalSessions()}function mh(e){return _f().createTerminalSession(e)}function DL(e){return _f().createAgentTerminalSession(e)}function Cx(e){return _f().closeTerminalSession(e)}const OL={async listWorkflows(){return(await Me("/api/workflows")).workflows},async saveWorkflow(e){return(await Me("/api/workflows",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})).workflows},async deleteWorkflow(e){return(await Me(`/api/workflows/${encodeURIComponent(e)}`,{method:"DELETE"})).workflows},async getGitStatus(){return(await Me("/api/git/status")).status},async listWorkflowTriggers(){return(await Me("/api/workflow-triggers")).triggers},async saveWorkflowTrigger(e){return(await Me("/api/workflow-triggers",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})).triggers},async deleteWorkflowTrigger(e){return(await Me(`/api/workflow-triggers/${encodeURIComponent(e)}`,{method:"DELETE"})).triggers},async listPendingRuns(){return(await Me("/api/workflow-triggers/pending")).pending},async ackPendingRun(e){await Me(`/api/workflow-triggers/pending/${encodeURIComponent(e)}/ack`,{method:"POST"})}},LL={listWorkflows:()=>t8(),saveWorkflow:e=>s8(e),deleteWorkflow:e=>n8(e),async getGitStatus(){const e=await gC();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()=>{}},zL=$s()?LL:OL,{listWorkflows:OC,saveWorkflow:BL,deleteWorkflow:PL,getGitStatus:eg,listWorkflowTriggers:IL,saveWorkflowTrigger:$L,deleteWorkflowTrigger:HL,listPendingRuns:UL,ackPendingRun:FL}=zL;function LC(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=LC(e[t]))&&(n&&(n+=" "),n+=s)}else for(s in e)e[s]&&(n&&(n+=" "),n+=s);return n}function Qc(){for(var e,t,s=0,n="",o=arguments.length;s<o;s++)(e=arguments[s])&&(t=LC(e))&&(n&&(n+=" "),n+=t);return n}const Nw=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Cw=Qc,zC=(e,t)=>s=>{var n;if(t?.variants==null)return Cw(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=Nw(p)||Nw(g);return o[d][x]}),h=s&&Object.entries(s).reduce((d,p)=>{let[g,x]=p;return x===void 0||(d[g]=x),d},{}),f=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((d,p)=>{let{class:g,className:x,...v}=p;return Object.entries(v).every(w=>{let[k,N]=w;return Array.isArray(N)?N.includes({...l,...h}[k]):{...l,...h}[k]===N})?[...d,g,x]:d},[]);return Cw(e,u,f,s?.class,s?.className)},qL=(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},VL=(e,t)=>({classGroupId:e,validator:t}),BC=(e=new Map,t=null,s)=>({nextPart:e,validators:t,classGroupId:s}),Dh="-",Ew=[],GL="arbitrary..",WL=e=>{const t=YL(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return KL(u);const h=u.split(Dh),f=h[0]===""&&h.length>1?1:0;return PC(h,f,t)},getConflictingClassGroupIds:(u,h)=>{if(h){const f=n[u],d=s[u];return f?d?qL(d,f):f:d||Ew}return s[u]||Ew}}},PC=(e,t,s)=>{if(e.length-t===0)return s.classGroupId;const o=e[t],l=s.nextPart.get(o);if(l){const d=PC(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}},KL=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?GL+n:void 0})(),YL=e=>{const{theme:t,classGroups:s}=e;return XL(s,t)},XL=(e,t)=>{const s=BC();for(const n in e){const o=e[n];lb(o,s,n,t)}return s},lb=(e,t,s,n)=>{const o=e.length;for(let l=0;l<o;l++){const u=e[l];ZL(u,t,s,n)}},ZL=(e,t,s,n)=>{if(typeof e=="string"){QL(e,t,s);return}if(typeof e=="function"){JL(e,t,s,n);return}e7(e,t,s,n)},QL=(e,t,s)=>{const n=e===""?t:IC(t,e);n.classGroupId=s},JL=(e,t,s,n)=>{if(t7(e)){lb(e(n),t,s,n);return}t.validators===null&&(t.validators=[]),t.validators.push(VL(s,e))},e7=(e,t,s,n)=>{const o=Object.entries(e),l=o.length;for(let u=0;u<l;u++){const[h,f]=o[u];lb(f,IC(t,h),s,n)}},IC=(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=BC(),s.nextPart.set(u,h)),s=h}return s},t7=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,s7=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)}}},Ex="!",jw=":",n7=[],Aw=(e,t,s,n,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:s,maybePostfixModifierPosition:n,isExternal:o}),i7=e=>{const{prefix:t,experimentalParseClassName:s}=e;let n=o=>{const l=[];let u=0,h=0,f=0,d;const p=o.length;for(let k=0;k<p;k++){const N=o[k];if(u===0&&h===0){if(N===jw){l.push(o.slice(f,k)),f=k+1;continue}if(N==="/"){d=k;continue}}N==="["?u++:N==="]"?u--:N==="("?h++:N===")"&&h--}const g=l.length===0?o:o.slice(f);let x=g,v=!1;g.endsWith(Ex)?(x=g.slice(0,-1),v=!0):g.startsWith(Ex)&&(x=g.slice(1),v=!0);const w=d&&d>f?d-f:void 0;return Aw(l,v,x,w)};if(t){const o=t+jw,l=n;n=u=>u.startsWith(o)?l(u.slice(o.length)):Aw(n7,!1,u,void 0,!0)}if(s){const o=n;n=l=>s({className:l,parseClassName:o})}return n},r7=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}},a7=e=>({cache:s7(e.cacheSize),parseClassName:i7(e),sortModifiers:r7(e),postfixLookupClassGroupIds:o7(e),...WL(e)}),o7=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},l7=/\s+/,c7=(e,t)=>{const{parseClassName:s,getClassGroupId:n,getConflictingClassGroupIds:o,sortModifiers:l,postfixLookupClassGroupIds:u}=t,h=[],f=e.trim().split(l7);let d="";for(let p=f.length-1;p>=0;p-=1){const g=f[p],{isExternal:x,modifiers:v,hasImportantModifier:w,baseClassName:k,maybePostfixModifierPosition:N}=s(g);if(x){d=g+(d.length>0?" "+d:d);continue}let C=!!N,A;if(C){const $=k.substring(0,N);A=n($);const D=A&&u[A]?n(k):void 0;D&&D!==A&&(A=D,C=!1)}else A=n(k);if(!A){if(!C){d=g+(d.length>0?" "+d:d);continue}if(A=n(k),!A){d=g+(d.length>0?" "+d:d);continue}C=!1}const j=v.length===0?"":v.length===1?v[0]:l(v).join(":"),T=w?j+Ex:j,M=T+A;if(h.indexOf(M)>-1)continue;h.push(M);const O=o(A,C);for(let $=0;$<O.length;++$){const D=O[$];h.push(T+D)}d=g+(d.length>0?" "+d:d)}return d},u7=(...e)=>{let t=0,s,n,o="";for(;t<e.length;)(s=e[t++])&&(n=$C(s))&&(o&&(o+=" "),o+=n);return o},$C=e=>{if(typeof e=="string")return e;let t,s="";for(let n=0;n<e.length;n++)e[n]&&(t=$C(e[n]))&&(s&&(s+=" "),s+=t);return s},d7=(e,...t)=>{let s,n,o,l;const u=f=>{const d=t.reduce((p,g)=>g(p),e());return s=a7(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=c7(f,s);return o(f,p),p};return l=u,(...f)=>l(u7(...f))},h7=[],js=e=>{const t=s=>s[e]||h7;return t.isThemeGetter=!0,t},HC=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,UC=/^\((?:(\w[\w-]*):)?(.+)\)$/i,f7=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,m7=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,p7=/\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$/,g7=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,x7=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,b7=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,la=e=>f7.test(e),ft=e=>!!e&&!Number.isNaN(Number(e)),Ii=e=>!!e&&Number.isInteger(Number(e)),tg=e=>e.endsWith("%")&&ft(e.slice(0,-1)),_r=e=>m7.test(e),FC=()=>!0,v7=e=>p7.test(e)&&!g7.test(e),cb=()=>!1,_7=e=>x7.test(e),y7=e=>b7.test(e),w7=e=>!Ve(e)&&!Ge(e),S7=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)),k7=e=>_a(e,GC,cb),Ve=e=>HC.test(e),Ha=e=>_a(e,WC,v7),Tw=e=>_a(e,M7,ft),N7=e=>_a(e,YC,FC),C7=e=>_a(e,KC,cb),Rw=e=>_a(e,qC,cb),E7=e=>_a(e,VC,y7),Pd=e=>_a(e,XC,_7),Ge=e=>UC.test(e),bc=e=>co(e,WC),j7=e=>co(e,KC),Mw=e=>co(e,qC),A7=e=>co(e,GC),T7=e=>co(e,VC),Id=e=>co(e,XC,!0),R7=e=>co(e,YC,!0),_a=(e,t,s)=>{const n=HC.exec(e);return n?n[1]?t(n[1]):s(n[2]):!1},co=(e,t,s=!1)=>{const n=UC.exec(e);return n?n[1]?t(n[1]):s:!1},qC=e=>e==="position"||e==="percentage",VC=e=>e==="image"||e==="url",GC=e=>e==="length"||e==="size"||e==="bg-size",WC=e=>e==="length",M7=e=>e==="number",KC=e=>e==="family-name",YC=e=>e==="number"||e==="weight",XC=e=>e==="shadow",D7=()=>{const e=js("color"),t=js("font"),s=js("text"),n=js("font-weight"),o=js("tracking"),l=js("leading"),u=js("breakpoint"),h=js("container"),f=js("spacing"),d=js("radius"),p=js("shadow"),g=js("inset-shadow"),x=js("text-shadow"),v=js("drop-shadow"),w=js("blur"),k=js("perspective"),N=js("aspect"),C=js("ease"),A=js("animate"),j=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],M=()=>[...T(),Ge,Ve],O=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto","contain","none"],D=()=>[Ge,Ve,f],P=()=>[la,"full","auto",...D()],B=()=>[Ii,"none","subgrid",Ge,Ve],G=()=>["auto",{span:["full",Ii,Ge,Ve]},Ii,Ge,Ve],F=()=>[Ii,"auto",Ge,Ve],z=()=>["auto","min","max","fr",Ge,Ve],U=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],K=()=>["start","end","center","stretch","center-safe","end-safe"],I=()=>["auto",...D()],Z=()=>[la,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...D()],W=()=>[la,"screen","full","dvw","lvw","svw","min","max","fit",...D()],te=()=>[la,"screen","full","lh","dvh","lvh","svh","min","max","fit",...D()],X=()=>[e,Ge,Ve],V=()=>[...T(),Mw,Rw,{position:[Ge,Ve]}],q=()=>["no-repeat",{repeat:["","x","y","space","round"]}],oe=()=>["auto","cover","contain",A7,k7,{size:[Ge,Ve]}],ee=()=>[tg,bc,Ha],fe=()=>["","none","full",d,Ge,Ve],ie=()=>["",ft,bc,Ha],Se=()=>["solid","dashed","dotted","double"],Re=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],De=()=>[ft,tg,Mw,Rw],Je=()=>["","none",w,Ge,Ve],Ne=()=>["none",ft,Ge,Ve],Ue=()=>["none",ft,Ge,Ve],$e=()=>[ft,Ge,Ve],St=()=>[la,"full",...D()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[_r],breakpoint:[_r],color:[FC],container:[_r],"drop-shadow":[_r],ease:["in","out","in-out"],font:[w7],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[_r],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[_r],shadow:[_r],spacing:["px",ft],text:[_r],"text-shadow":[_r],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",la,Ve,Ge,N]}],container:["container"],"container-type":[{"@container":["","normal","size",Ge,Ve]}],"container-named":[S7],columns:[{columns:[ft,Ve,Ge,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:M()}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:$()}],"overscroll-x":[{"overscroll-x":$()}],"overscroll-y":[{"overscroll-y":$()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:P()}],"inset-x":[{"inset-x":P()}],"inset-y":[{"inset-y":P()}],start:[{"inset-s":P(),start:P()}],end:[{"inset-e":P(),end:P()}],"inset-bs":[{"inset-bs":P()}],"inset-be":[{"inset-be":P()}],top:[{top:P()}],right:[{right:P()}],bottom:[{bottom:P()}],left:[{left:P()}],visibility:["visible","invisible","collapse"],z:[{z:[Ii,"auto",Ge,Ve]}],basis:[{basis:[la,"full","auto",h,...D()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ft,la,"auto","initial","none",Ve]}],grow:[{grow:["",ft,Ge,Ve]}],shrink:[{shrink:["",ft,Ge,Ve]}],order:[{order:[Ii,"first","last","none",Ge,Ve]}],"grid-cols":[{"grid-cols":B()}],"col-start-end":[{col:G()}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":B()}],"row-start-end":[{row:G()}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":z()}],"auto-rows":[{"auto-rows":z()}],gap:[{gap:D()}],"gap-x":[{"gap-x":D()}],"gap-y":[{"gap-y":D()}],"justify-content":[{justify:[...U(),"normal"]}],"justify-items":[{"justify-items":[...K(),"normal"]}],"justify-self":[{"justify-self":["auto",...K()]}],"align-content":[{content:["normal",...U()]}],"align-items":[{items:[...K(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...K(),{baseline:["","last"]}]}],"place-content":[{"place-content":U()}],"place-items":[{"place-items":[...K(),"baseline"]}],"place-self":[{"place-self":["auto",...K()]}],p:[{p:D()}],px:[{px:D()}],py:[{py:D()}],ps:[{ps:D()}],pe:[{pe:D()}],pbs:[{pbs:D()}],pbe:[{pbe:D()}],pt:[{pt:D()}],pr:[{pr:D()}],pb:[{pb:D()}],pl:[{pl:D()}],m:[{m:I()}],mx:[{mx:I()}],my:[{my:I()}],ms:[{ms:I()}],me:[{me:I()}],mbs:[{mbs:I()}],mbe:[{mbe:I()}],mt:[{mt:I()}],mr:[{mr:I()}],mb:[{mb:I()}],ml:[{ml:I()}],"space-x":[{"space-x":D()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":D()}],"space-y-reverse":["space-y-reverse"],size:[{size:Z()}],"inline-size":[{inline:["auto",...W()]}],"min-inline-size":[{"min-inline":["auto",...W()]}],"max-inline-size":[{"max-inline":["none",...W()]}],"block-size":[{block:["auto",...te()]}],"min-block-size":[{"min-block":["auto",...te()]}],"max-block-size":[{"max-block":["none",...te()]}],w:[{w:[h,"screen",...Z()]}],"min-w":[{"min-w":[h,"screen","none",...Z()]}],"max-w":[{"max-w":[h,"screen","none","prose",{screen:[u]},...Z()]}],h:[{h:["screen","lh",...Z()]}],"min-h":[{"min-h":["screen","lh","none",...Z()]}],"max-h":[{"max-h":["screen","lh",...Z()]}],"font-size":[{text:["base",s,bc,Ha]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,R7,N7]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",tg,Ve]}],"font-family":[{font:[j7,C7,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,Ge,Ve]}],"line-clamp":[{"line-clamp":[ft,"none",Ge,Tw]}],leading:[{leading:[l,...D()]}],"list-image":[{"list-image":["none",Ge,Ve]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ge,Ve]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:X()}],"text-color":[{text:X()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Se(),"wavy"]}],"text-decoration-thickness":[{decoration:[ft,"from-font","auto",Ge,Ha]}],"text-decoration-color":[{decoration:X()}],"underline-offset":[{"underline-offset":[ft,"auto",Ge,Ve]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:D()}],"tab-size":[{tab:[Ii,Ge,Ve]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ge,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",Ge,Ve]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:V()}],"bg-repeat":[{bg:q()}],"bg-size":[{bg:oe()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ii,Ge,Ve],radial:["",Ge,Ve],conic:[Ii,Ge,Ve]},T7,E7]}],"bg-color":[{bg:X()}],"gradient-from-pos":[{from:ee()}],"gradient-via-pos":[{via:ee()}],"gradient-to-pos":[{to:ee()}],"gradient-from":[{from:X()}],"gradient-via":[{via:X()}],"gradient-to":[{to:X()}],rounded:[{rounded:fe()}],"rounded-s":[{"rounded-s":fe()}],"rounded-e":[{"rounded-e":fe()}],"rounded-t":[{"rounded-t":fe()}],"rounded-r":[{"rounded-r":fe()}],"rounded-b":[{"rounded-b":fe()}],"rounded-l":[{"rounded-l":fe()}],"rounded-ss":[{"rounded-ss":fe()}],"rounded-se":[{"rounded-se":fe()}],"rounded-ee":[{"rounded-ee":fe()}],"rounded-es":[{"rounded-es":fe()}],"rounded-tl":[{"rounded-tl":fe()}],"rounded-tr":[{"rounded-tr":fe()}],"rounded-br":[{"rounded-br":fe()}],"rounded-bl":[{"rounded-bl":fe()}],"border-w":[{border:ie()}],"border-w-x":[{"border-x":ie()}],"border-w-y":[{"border-y":ie()}],"border-w-s":[{"border-s":ie()}],"border-w-e":[{"border-e":ie()}],"border-w-bs":[{"border-bs":ie()}],"border-w-be":[{"border-be":ie()}],"border-w-t":[{"border-t":ie()}],"border-w-r":[{"border-r":ie()}],"border-w-b":[{"border-b":ie()}],"border-w-l":[{"border-l":ie()}],"divide-x":[{"divide-x":ie()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ie()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Se(),"hidden","none"]}],"divide-style":[{divide:[...Se(),"hidden","none"]}],"border-color":[{border:X()}],"border-color-x":[{"border-x":X()}],"border-color-y":[{"border-y":X()}],"border-color-s":[{"border-s":X()}],"border-color-e":[{"border-e":X()}],"border-color-bs":[{"border-bs":X()}],"border-color-be":[{"border-be":X()}],"border-color-t":[{"border-t":X()}],"border-color-r":[{"border-r":X()}],"border-color-b":[{"border-b":X()}],"border-color-l":[{"border-l":X()}],"divide-color":[{divide:X()}],"outline-style":[{outline:[...Se(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ft,Ge,Ve]}],"outline-w":[{outline:["",ft,bc,Ha]}],"outline-color":[{outline:X()}],shadow:[{shadow:["","none",p,Id,Pd]}],"shadow-color":[{shadow:X()}],"inset-shadow":[{"inset-shadow":["none",g,Id,Pd]}],"inset-shadow-color":[{"inset-shadow":X()}],"ring-w":[{ring:ie()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:X()}],"ring-offset-w":[{"ring-offset":[ft,Ha]}],"ring-offset-color":[{"ring-offset":X()}],"inset-ring-w":[{"inset-ring":ie()}],"inset-ring-color":[{"inset-ring":X()}],"text-shadow":[{"text-shadow":["none",x,Id,Pd]}],"text-shadow-color":[{"text-shadow":X()}],opacity:[{opacity:[ft,Ge,Ve]}],"mix-blend":[{"mix-blend":[...Re(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Re()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ft]}],"mask-image-linear-from-pos":[{"mask-linear-from":De()}],"mask-image-linear-to-pos":[{"mask-linear-to":De()}],"mask-image-linear-from-color":[{"mask-linear-from":X()}],"mask-image-linear-to-color":[{"mask-linear-to":X()}],"mask-image-t-from-pos":[{"mask-t-from":De()}],"mask-image-t-to-pos":[{"mask-t-to":De()}],"mask-image-t-from-color":[{"mask-t-from":X()}],"mask-image-t-to-color":[{"mask-t-to":X()}],"mask-image-r-from-pos":[{"mask-r-from":De()}],"mask-image-r-to-pos":[{"mask-r-to":De()}],"mask-image-r-from-color":[{"mask-r-from":X()}],"mask-image-r-to-color":[{"mask-r-to":X()}],"mask-image-b-from-pos":[{"mask-b-from":De()}],"mask-image-b-to-pos":[{"mask-b-to":De()}],"mask-image-b-from-color":[{"mask-b-from":X()}],"mask-image-b-to-color":[{"mask-b-to":X()}],"mask-image-l-from-pos":[{"mask-l-from":De()}],"mask-image-l-to-pos":[{"mask-l-to":De()}],"mask-image-l-from-color":[{"mask-l-from":X()}],"mask-image-l-to-color":[{"mask-l-to":X()}],"mask-image-x-from-pos":[{"mask-x-from":De()}],"mask-image-x-to-pos":[{"mask-x-to":De()}],"mask-image-x-from-color":[{"mask-x-from":X()}],"mask-image-x-to-color":[{"mask-x-to":X()}],"mask-image-y-from-pos":[{"mask-y-from":De()}],"mask-image-y-to-pos":[{"mask-y-to":De()}],"mask-image-y-from-color":[{"mask-y-from":X()}],"mask-image-y-to-color":[{"mask-y-to":X()}],"mask-image-radial":[{"mask-radial":[Ge,Ve]}],"mask-image-radial-from-pos":[{"mask-radial-from":De()}],"mask-image-radial-to-pos":[{"mask-radial-to":De()}],"mask-image-radial-from-color":[{"mask-radial-from":X()}],"mask-image-radial-to-color":[{"mask-radial-to":X()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":T()}],"mask-image-conic-pos":[{"mask-conic":[ft]}],"mask-image-conic-from-pos":[{"mask-conic-from":De()}],"mask-image-conic-to-pos":[{"mask-conic-to":De()}],"mask-image-conic-from-color":[{"mask-conic-from":X()}],"mask-image-conic-to-color":[{"mask-conic-to":X()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:V()}],"mask-repeat":[{mask:q()}],"mask-size":[{mask:oe()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ge,Ve]}],filter:[{filter:["","none",Ge,Ve]}],blur:[{blur:Je()}],brightness:[{brightness:[ft,Ge,Ve]}],contrast:[{contrast:[ft,Ge,Ve]}],"drop-shadow":[{"drop-shadow":["","none",v,Id,Pd]}],"drop-shadow-color":[{"drop-shadow":X()}],grayscale:[{grayscale:["",ft,Ge,Ve]}],"hue-rotate":[{"hue-rotate":[ft,Ge,Ve]}],invert:[{invert:["",ft,Ge,Ve]}],saturate:[{saturate:[ft,Ge,Ve]}],sepia:[{sepia:["",ft,Ge,Ve]}],"backdrop-filter":[{"backdrop-filter":["","none",Ge,Ve]}],"backdrop-blur":[{"backdrop-blur":Je()}],"backdrop-brightness":[{"backdrop-brightness":[ft,Ge,Ve]}],"backdrop-contrast":[{"backdrop-contrast":[ft,Ge,Ve]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ft,Ge,Ve]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ft,Ge,Ve]}],"backdrop-invert":[{"backdrop-invert":["",ft,Ge,Ve]}],"backdrop-opacity":[{"backdrop-opacity":[ft,Ge,Ve]}],"backdrop-saturate":[{"backdrop-saturate":[ft,Ge,Ve]}],"backdrop-sepia":[{"backdrop-sepia":["",ft,Ge,Ve]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":D()}],"border-spacing-x":[{"border-spacing-x":D()}],"border-spacing-y":[{"border-spacing-y":D()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ge,Ve]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ft,"initial",Ge,Ve]}],ease:[{ease:["linear","initial",C,Ge,Ve]}],delay:[{delay:[ft,Ge,Ve]}],animate:[{animate:["none",A,Ge,Ve]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[k,Ge,Ve]}],"perspective-origin":[{"perspective-origin":M()}],rotate:[{rotate:Ne()}],"rotate-x":[{"rotate-x":Ne()}],"rotate-y":[{"rotate-y":Ne()}],"rotate-z":[{"rotate-z":Ne()}],scale:[{scale:Ue()}],"scale-x":[{"scale-x":Ue()}],"scale-y":[{"scale-y":Ue()}],"scale-z":[{"scale-z":Ue()}],"scale-3d":["scale-3d"],skew:[{skew:$e()}],"skew-x":[{"skew-x":$e()}],"skew-y":[{"skew-y":$e()}],transform:[{transform:[Ge,Ve,"","none","gpu","cpu"]}],"transform-origin":[{origin:M()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:St()}],"translate-x":[{"translate-x":St()}],"translate-y":[{"translate-y":St()}],"translate-z":[{"translate-z":St()}],"translate-none":["translate-none"],zoom:[{zoom:[Ii,Ge,Ve]}],accent:[{accent:X()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:X()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ge,Ve]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":X()}],"scrollbar-track-color":[{"scrollbar-track":X()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-mbs":[{"scroll-mbs":D()}],"scroll-mbe":[{"scroll-mbe":D()}],"scroll-mt":[{"scroll-mt":D()}],"scroll-mr":[{"scroll-mr":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-pe":[{"scroll-pe":D()}],"scroll-pbs":[{"scroll-pbs":D()}],"scroll-pbe":[{"scroll-pbe":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-pr":[{"scroll-pr":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"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",Ge,Ve]}],fill:[{fill:["none",...X()]}],"stroke-w":[{stroke:[ft,bc,Ha,Tw]}],stroke:[{stroke:["none",...X()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},O7=d7(D7);function ue(...e){return O7(Qc(e))}const L7=[{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}],z7=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});function B7(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 L7)if(n>=l)return z7.format(Math.round(s/l),o);return"just now"}const P7=zC("inline-flex h-9 shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-md border border-transparent px-3 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",outline:"border-border bg-background hover:bg-muted",ghost:"hover:bg-muted",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",success:"bg-emerald-600 text-white hover:bg-emerald-700"},size:{default:"h-9 px-3",sm:"h-8 px-2.5 text-xs",icon:"size-9 p-0","icon-sm":"size-7 p-0"}},defaultVariants:{variant:"default",size:"default"}});function J({className:e,variant:t,size:s,...n}){return r.jsx("button",{className:ue(P7({variant:t,size:s,className:e})),...n})}const ZC=_.createContext({});function I7(e){const t=_.useRef(null);return t.current===null&&(t.current=e()),t.current}const $7=typeof window<"u",H7=$7?_.useLayoutEffect:_.useEffect,ub=_.createContext(null);function db(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 Xi=(e,t,s)=>s>t?t:s<e?e:s;let hb=()=>{};const ba={},QC=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function JC(e){return typeof e=="object"&&e!==null}const eE=e=>/^0[^.\s]+$/u.test(e);function tE(e){let t;return()=>(t===void 0&&(t=e()),t)}const ci=e=>e,U7=(e,t)=>s=>t(e(s)),cu=(...e)=>e.reduce(U7),Jc=(e,t,s)=>{const n=t-e;return n===0?1:(s-e)/n};class fb{constructor(){this.subscriptions=[]}add(t){return db(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 Fn=e=>e*1e3,li=e=>e/1e3;function sE(e,t){return t?e*(1e3/t):0}const nE=(e,t,s)=>(((1-3*s+3*t)*e+(3*s-6*t))*e+3*t)*e,F7=1e-7,q7=12;function V7(e,t,s,n,o){let l,u,h=0;do u=t+(s-t)/2,l=nE(u,n,o)-e,l>0?s=u:t=u;while(Math.abs(l)>F7&&++h<q7);return u}function uu(e,t,s,n){if(e===t&&s===n)return ci;const o=l=>V7(l,0,1,e,s);return l=>l===0||l===1?l:nE(o(l),t,n)}const iE=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,rE=e=>t=>1-e(1-t),aE=uu(.33,1.53,.69,.99),mb=rE(aE),oE=iE(mb),lE=e=>e>=1?1:(e*=2)<1?.5*mb(e):.5*(2-Math.pow(2,-10*(e-1))),pb=e=>1-Math.sin(Math.acos(e)),cE=rE(pb),uE=iE(pb),G7=uu(.42,0,1,1),W7=uu(0,0,.58,1),dE=uu(.42,0,.58,1),K7=e=>Array.isArray(e)&&typeof e[0]!="number",hE=e=>Array.isArray(e)&&typeof e[0]=="number",Y7={linear:ci,easeIn:G7,easeInOut:dE,easeOut:W7,circIn:pb,circInOut:uE,circOut:cE,backIn:mb,backInOut:oE,backOut:aE,anticipate:lE},X7=e=>typeof e=="string",Dw=e=>{if(hE(e)){hb(e.length===4);const[t,s,n,o]=e;return uu(t,s,n,o)}else if(X7(e))return Y7[e];return e},$d=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Z7(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 Q7=40;function fE(e,t){let s=!1,n=!0;const o={delta:0,timestamp:0,isProcessing:!1},l=()=>s=!0,u=$d.reduce((j,T)=>(j[T]=Z7(l),j),{}),{setup:h,read:f,resolveKeyframes:d,preUpdate:p,update:g,preRender:x,render:v,postRender:w}=u,k=()=>{const j=ba.useManualTiming,T=j?o.timestamp:performance.now();s=!1,j||(o.delta=n?1e3/60:Math.max(Math.min(T-o.timestamp,Q7),1)),o.timestamp=T,o.isProcessing=!0,h.process(o),f.process(o),d.process(o),p.process(o),g.process(o),x.process(o),v.process(o),w.process(o),o.isProcessing=!1,s&&t&&(n=!1,e(k))},N=()=>{s=!0,n=!0,o.isProcessing||e(k)};return{schedule:$d.reduce((j,T)=>{const M=u[T];return j[T]=(O,$=!1,D=!1)=>(s||N(),M.schedule(O,$,D)),j},{}),cancel:j=>{for(let T=0;T<$d.length;T++)u[$d[T]].cancel(j)},state:o,steps:u}}const{schedule:Ht,cancel:va,state:Ks,steps:sg}=fE(typeof requestAnimationFrame<"u"?requestAnimationFrame:ci,!0);let ph;function J7(){ph=void 0}const un={now:()=>(ph===void 0&&un.set(Ks.isProcessing||ba.useManualTiming?Ks.timestamp:performance.now()),ph),set:e=>{ph=e,queueMicrotask(J7)}},mE=e=>t=>typeof t=="string"&&t.startsWith(e),pE=mE("--"),e9=mE("var(--"),gb=e=>e9(e)?t9.test(e.split("/*")[0].trim()):!1,t9=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Ow(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const pl={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},eu={...pl,transform:e=>Xi(0,1,e)},Hd={...pl,default:1},Uc=e=>Math.round(e*1e5)/1e5,xb=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function s9(e){return e==null}const n9=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,bb=(e,t)=>s=>!!(typeof s=="string"&&n9.test(s)&&s.startsWith(e)||t&&!s9(s)&&Object.prototype.hasOwnProperty.call(s,t)),gE=(e,t,s)=>n=>{if(typeof n!="string")return n;const[o,l,u,h]=n.match(xb);return{[e]:parseFloat(o),[t]:parseFloat(l),[s]:parseFloat(u),alpha:h!==void 0?parseFloat(h):1}},i9=e=>Xi(0,255,e),ng={...pl,transform:e=>Math.round(i9(e))},Ya={test:bb("rgb","red"),parse:gE("red","green","blue"),transform:({red:e,green:t,blue:s,alpha:n=1})=>"rgba("+ng.transform(e)+", "+ng.transform(t)+", "+ng.transform(s)+", "+Uc(eu.transform(n))+")"};function r9(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 jx={test:bb("#"),parse:r9,transform:Ya.transform},du=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),fa=du("deg"),Wi=du("%"),Ke=du("px"),a9=du("vh"),o9=du("vw"),Lw={...Wi,parse:e=>Wi.parse(e)/100,transform:e=>Wi.transform(e*100)},tl={test:bb("hsl","hue"),parse:gE("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:s,alpha:n=1})=>"hsla("+Math.round(e)+", "+Wi.transform(Uc(t))+", "+Wi.transform(Uc(s))+", "+Uc(eu.transform(n))+")"},Ss={test:e=>Ya.test(e)||jx.test(e)||tl.test(e),parse:e=>Ya.test(e)?Ya.parse(e):tl.test(e)?tl.parse(e):jx.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Ya.transform(e):tl.transform(e),getAnimatableNone:e=>{const t=Ss.parse(e);return t.alpha=0,Ss.transform(t)}},l9=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function c9(e){return isNaN(e)&&typeof e=="string"&&(e.match(xb)?.length||0)+(e.match(l9)?.length||0)>0}const xE="number",bE="color",u9="var",d9="var(",zw="${}",h9=/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(h9,f=>(Ss.test(f)?(n.color.push(l),o.push(bE),s.push(Ss.parse(f))):f.startsWith(d9)?(n.var.push(l),o.push(u9),s.push(f)):(n.number.push(l),o.push(xE),s.push(parseFloat(f))),++l,zw)).split(zw);return{values:s,split:h,indexes:n,types:o}}function f9(e){return dl(e).values}function vE({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===xE?o+=Uc(n[l]):u===bE?o+=Ss.transform(n[l]):o+=n[l]}return o}}function m9(e){return vE(dl(e))}const p9=e=>typeof e=="number"?0:Ss.test(e)?Ss.getAnimatableNone(e):e,g9=(e,t)=>typeof e=="number"?t?.trim().endsWith("/")?e:0:p9(e);function x9(e){const t=dl(e);return vE(t)(t.values.map((n,o)=>g9(n,t.split[o])))}const Ai={test:c9,parse:f9,createTransformer:m9,getAnimatableNone:x9};function ig(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 b9({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=ig(f,h,e+1/3),l=ig(f,h,e),u=ig(f,h,e-1/3)}return{red:Math.round(o*255),green:Math.round(l*255),blue:Math.round(u*255),alpha:n}}function Lh(e,t){return s=>s>0?t:e}const Kt=(e,t,s)=>e+(t-e)*s,rg=(e,t,s)=>{const n=e*e,o=s*(t*t-n)+n;return o<0?0:Math.sqrt(o)},v9=[jx,Ya,tl],_9=e=>v9.find(t=>t.test(e));function Bw(e){const t=_9(e);if(!t)return!1;let s=t.parse(e);return t===tl&&(s=b9(s)),s}const Pw=(e,t)=>{const s=Bw(e),n=Bw(t);if(!s||!n)return Lh(e,t);const o={...s};return l=>(o.red=rg(s.red,n.red,l),o.green=rg(s.green,n.green,l),o.blue=rg(s.blue,n.blue,l),o.alpha=Kt(s.alpha,n.alpha,l),Ya.transform(o))},Ax=new Set(["none","hidden"]);function y9(e,t){return Ax.has(e)?s=>s<=0?e:t:s=>s>=1?t:e}function w9(e,t){return s=>Kt(e,t,s)}function vb(e){return typeof e=="number"?w9:typeof e=="string"?gb(e)?Lh:Ss.test(e)?Pw:N9:Array.isArray(e)?_E:typeof e=="object"?Ss.test(e)?Pw:S9:Lh}function _E(e,t){const s=[...e],n=s.length,o=e.map((l,u)=>vb(l)(l,t[u]));return l=>{for(let u=0;u<n;u++)s[u]=o[u](l);return s}}function S9(e,t){const s={...e,...t},n={};for(const o in s)e[o]!==void 0&&t[o]!==void 0&&(n[o]=vb(e[o])(e[o],t[o]));return o=>{for(const l in n)s[l]=n[l](o);return s}}function k9(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 N9=(e,t)=>{const s=Ai.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?Ax.has(e)&&!o.values.length||Ax.has(t)&&!n.values.length?y9(e,t):cu(_E(k9(n,o),o.values),s):Lh(e,t)};function yE(e,t,s){return typeof e=="number"&&typeof t=="number"&&typeof s=="number"?Kt(e,t,s):vb(e)(e,t)}const C9=e=>{const t=({timestamp:s})=>e(s);return{start:(s=!0)=>Ht.update(t,s),stop:()=>va(t),now:()=>Ks.isProcessing?Ks.timestamp:un.now()}},wE=(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 _b(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 E9(e,t=100,s){const n=s({...e,keyframes:[0,t]}),o=Math.min(_b(n),zh);return{type:"keyframes",ease:l=>n.next(o*l).value/t,duration:li(o)}}const is={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function Tx(e,t){return e*Math.sqrt(1-t*t)}const j9=12;function A9(e,t,s){let n=s;for(let o=1;o<j9;o++)n=n-e(n)/t(n);return n}const ag=.001;function T9({duration:e=is.duration,bounce:t=is.bounce,velocity:s=is.velocity,mass:n=is.mass}){let o,l,u=1-t;u=Xi(is.minDamping,is.maxDamping,u),e=Xi(is.minDuration,is.maxDuration,li(e)),u<1?(o=d=>{const p=d*u,g=p*e,x=p-s,v=Tx(d,u),w=Math.exp(-g);return ag-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=Tx(Math.pow(d,2),u);return(-o(d)+ag>0?-1:1)*((x-v)*w)/k}):(o=d=>{const p=Math.exp(-d*e),g=(d-s)*e+1;return-ag+p*g},l=d=>{const p=Math.exp(-d*e),g=(s-d)*(e*e);return p*g});const h=5/e,f=A9(o,l,h);if(e=Fn(e),isNaN(f))return{stiffness:is.stiffness,damping:is.damping,duration:e};{const d=Math.pow(f,2)*n;return{stiffness:d,damping:u*2*Math.sqrt(n*d),duration:e}}}const R9=["duration","bounce"],M9=["stiffness","damping","mass"];function Iw(e,t){return t.some(s=>e[s]!==void 0)}function D9(e){let t={velocity:is.velocity,stiffness:is.stiffness,damping:is.damping,mass:is.mass,isResolvedFromDuration:!1,...e};if(!Iw(e,M9)&&Iw(e,R9))if(t.velocity=0,e.visualDuration){const s=e.visualDuration,n=2*Math.PI/(s*1.2),o=n*n,l=2*Xi(.05,1,1-(e.bounce||0))*Math.sqrt(o);t={...t,mass:is.mass,stiffness:o,damping:l}}else{const s=T9({...e,velocity:0});t={...t,...s,mass:is.mass},t.isResolvedFromDuration=!0}return t}function Bh(e=is.visualDuration,t=is.bounce){const s=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:n,restDelta:o}=s;const l=s.keyframes[0],u=s.keyframes[s.keyframes.length-1],h={done:!1,value:l},{stiffness:f,damping:d,mass:p,duration:g,velocity:x,isResolvedFromDuration:v}=D9({...s,velocity:-li(s.velocity||0)}),w=x||0,k=d/(2*Math.sqrt(f*p)),N=u-l,C=li(Math.sqrt(f/p)),A=Math.abs(N)<5;n||(n=A?is.restSpeed.granular:is.restSpeed.default),o||(o=A?is.restDelta.granular:is.restDelta.default);let j,T,M,O,$,D;if(k<1)M=Tx(C,k),O=(w+k*C*N)/M,j=B=>{const G=Math.exp(-k*C*B);return u-G*(O*Math.sin(M*B)+N*Math.cos(M*B))},$=k*C*O+N*M,D=k*C*N-O*M,T=B=>Math.exp(-k*C*B)*($*Math.sin(M*B)+D*Math.cos(M*B));else if(k===1){j=G=>u-Math.exp(-C*G)*(N+(w+C*N)*G);const B=w+C*N;T=G=>Math.exp(-C*G)*(C*B*G-w)}else{const B=C*Math.sqrt(k*k-1);j=U=>{const K=Math.exp(-k*C*U),I=Math.min(B*U,300);return u-K*((w+k*C*N)*Math.sinh(I)+B*N*Math.cosh(I))/B};const G=(w+k*C*N)/B,F=k*C*G-N*B,z=k*C*N-G*B;T=U=>{const K=Math.exp(-k*C*U),I=Math.min(B*U,300);return K*(F*Math.sinh(I)+z*Math.cosh(I))}}const P={calculatedDuration:v&&g||null,velocity:B=>Fn(T(B)),next:B=>{if(!v&&k<1){const F=Math.exp(-k*C*B),z=Math.sin(M*B),U=Math.cos(M*B),K=u-F*(O*z+N*U),I=Fn(F*($*z+D*U));return h.done=Math.abs(I)<=n&&Math.abs(u-K)<=o,h.value=h.done?u:K,h}const G=j(B);if(v)h.done=B>=g;else{const F=Fn(T(B));h.done=Math.abs(F)<=n&&Math.abs(u-G)<=o}return h.value=h.done?u:G,h},toString:()=>{const B=Math.min(_b(P),zh),G=wE(F=>P.next(B*F).value,B,30);return B+"ms "+G},toTransition:()=>{}};return P}Bh.applyToOptions=e=>{const t=E9(e,100,Bh);return e.ease=t.ease,e.duration=Fn(t.duration),e.type="keyframes",e};const O9=5;function SE(e,t,s){const n=Math.max(t-O9,0);return sE(s-e(n),t-n)}function Rx({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=D=>h!==void 0&&D<h||f!==void 0&&D>f,w=D=>h===void 0?f:f===void 0||Math.abs(h-D)<Math.abs(f-D)?h:f;let k=s*t;const N=g+k,C=u===void 0?N:u(N);C!==N&&(k=C-g);const A=D=>-k*Math.exp(-D/n),j=D=>C+A(D),T=D=>{const P=A(D),B=j(D);x.done=Math.abs(P)<=d,x.value=x.done?C:B};let M,O;const $=D=>{v(x.value)&&(M=D,O=Bh({keyframes:[x.value,w(x.value)],velocity:SE(j,D,x.value),damping:o,stiffness:l,restDelta:d,restSpeed:p}))};return $(0),{calculatedDuration:null,next:D=>{let P=!1;return!O&&M===void 0&&(P=!0,T(D),$(D)),M!==void 0&&D>=M?O.next(D-M):(!P&&T(D),x)}}}function L9(e,t,s){const n=[],o=s||ba.mix||yE,l=e.length-1;for(let u=0;u<l;u++){let h=o(e[u],e[u+1]);if(t){const f=Array.isArray(t)?t[u]||ci:t;h=cu(f,h)}n.push(h)}return n}function z9(e,t,{clamp:s=!0,ease:n,mixer:o}={}){const l=e.length;if(hb(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=L9(t,n,o),f=h.length,d=p=>{if(u&&p<e[0])return t[0];let g=0;if(f>1)for(;g<e.length-2&&!(p<e[g+1]);g++);const x=Jc(e[g],e[g+1],p);return h[g](x)};return s?p=>d(Xi(e[0],e[l-1],p)):d}function B9(e,t){const s=e[e.length-1];for(let n=1;n<=t;n++){const o=Jc(0,t,n);e.push(Kt(s,1,o))}}function P9(e){const t=[0];return B9(t,e.length-1),t}function I9(e,t){return e.map(s=>s*t)}function $9(e,t){return e.map(()=>t||dE).splice(0,e.length-1)}function Fc({duration:e=300,keyframes:t,times:s,ease:n="easeInOut"}){const o=K7(n)?n.map(Dw):Dw(n),l={done:!1,value:t[0]},u=I9(s&&s.length===t.length?s:P9(t),e),h=z9(u,t,{ease:Array.isArray(o)?o:$9(t,o)});return{calculatedDuration:e,next:f=>(l.value=h(f),l.done=f>=e,l)}}const H9=e=>e!==null;function yf(e,{repeat:t,repeatType:s="loop"},n,o=1){const l=e.filter(H9),h=o<0||t&&s!=="loop"&&t%2===1?0:l.length-1;return!h||n===void 0?l[h]:n}const U9={decay:Rx,inertia:Rx,tween:Fc,keyframes:Fc,spring:Bh};function kE(e){typeof e.type=="string"&&(e.type=U9[e.type])}class yb{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 F9=e=>e/100;class Ph extends yb{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!==un.now()&&this.tick(un.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;kE(t);const{type:s=Fc,repeat:n=0,repeatDelay:o=0,repeatType:l,velocity:u=0}=t;let{keyframes:h}=t;const f=s||Fc;f!==Fc&&typeof h[0]!="number"&&(this.mixKeyframes=cu(F9,yE(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=_b(d));const{calculatedDuration:p}=d;this.calculatedDuration=p,this.resolvedDuration=p+o,this.totalDuration=this.resolvedDuration*(n+1)-o,this.generator=d}updateTime(t){const s=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=s}tick(t,s=!1){const{generator:n,totalDuration:o,mixKeyframes:l,mirroredGenerator:u,resolvedDuration:h,calculatedDuration:f}=this;if(this.startTime===null)return n.next(0);const{delay:d=0,keyframes:p,repeat:g,repeatType:x,repeatDelay:v,type:w,onUpdate:k,finalKeyframe:N}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-o/this.speed,this.startTime)),s?this.currentTime=t:this.updateTime(t);const C=this.currentTime-d*(this.playbackSpeed>=0?1:-1),A=this.playbackSpeed>=0?C<0:C>o;this.currentTime=Math.max(C,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=o);let j=this.currentTime,T=n;if(g){const D=Math.min(this.currentTime,o)/h;let P=Math.floor(D),B=D%1;!B&&D>=1&&(B=1),B===1&&P--,P=Math.min(P,g+1),P%2&&(x==="reverse"?(B=1-B,v&&(B-=v/h)):x==="mirror"&&(T=u)),j=Xi(0,1,B)*h}let M;A?(this.delayState.value=p[0],M=this.delayState):M=T.next(j),l&&!A&&(M.value=l(M.value));let{done:O}=M;!A&&f!==null&&(O=this.playbackSpeed>=0?this.currentTime>=o:this.currentTime<=0);const $=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&O);return $&&w!==Rx&&(M.value=yf(p,this.options,N,this.speed)),k&&k(M.value),$&&this.finish(),M}then(t,s){return this.finished.then(t,s)}get duration(){return li(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+li(t)}get time(){return li(this.currentTime)}set time(t){t=Fn(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 SE(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(un.now()),this.playbackSpeed=t,s&&this.driver&&(this.time=li(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=C9,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(un.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 q9(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Xa=e=>e*180/Math.PI,Mx=e=>{const t=Xa(Math.atan2(e[1],e[0]));return Dx(t)},V9={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Mx,rotateZ:Mx,skewX:e=>Xa(Math.atan(e[1])),skewY:e=>Xa(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Dx=e=>(e=e%360,e<0&&(e+=360),e),$w=Mx,Hw=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Uw=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),G9={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Hw,scaleY:Uw,scale:e=>(Hw(e)+Uw(e))/2,rotateX:e=>Dx(Xa(Math.atan2(e[6],e[5]))),rotateY:e=>Dx(Xa(Math.atan2(-e[2],e[0]))),rotateZ:$w,rotate:$w,skewX:e=>Xa(Math.atan(e[4])),skewY:e=>Xa(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Ox(e){return e.includes("scale")?1:0}function Lx(e,t){if(!e||e==="none")return Ox(t);const s=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let n,o;if(s)n=G9,o=s;else{const h=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);n=V9,o=h}if(!o)return Ox(t);const l=n[t],u=o[1].split(",").map(K9);return typeof l=="function"?l(u):u[l]}const W9=(e,t)=>{const{transform:s="none"}=getComputedStyle(e);return Lx(s,t)};function K9(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),Fw=e=>e===pl||e===Ke,Y9=new Set(["x","y","z"]),X9=gl.filter(e=>!Y9.has(e));function Z9(e){const t=[];return X9.forEach(s=>{const n=e.getValue(s);n!==void 0&&(t.push([s,n.get()]),n.set(s.startsWith("scale")?1:0))}),t}const pa={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})=>Lx(t,"x"),y:(e,{transform:t})=>Lx(t,"y")};pa.translateX=pa.x;pa.translateY=pa.y;const Ja=new Set;let zx=!1,Bx=!1,Px=!1;function NE(){if(Bx){const e=Array.from(Ja).filter(n=>n.needsMeasurement),t=new Set(e.map(n=>n.element)),s=new Map;t.forEach(n=>{const o=Z9(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)})}Bx=!1,zx=!1,Ja.forEach(e=>e.complete(Px)),Ja.clear()}function CE(){Ja.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Bx=!0)})}function Q9(){Px=!0,CE(),NE(),Px=!1}class wb{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?(Ja.add(this),zx||(zx=!0,Ht.read(CE),Ht.resolveKeyframes(NE))):(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])}q9(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Ja.delete(this)}cancel(){this.state==="scheduled"&&(Ja.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const J9=e=>e.startsWith("--");function EE(e,t,s){J9(t)?e.style.setProperty(t,s):e.style[t]=s}const ez={};function jE(e,t){const s=tE(e);return()=>ez[t]??s()}const tz=jE(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),AE=jE(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Mc=([e,t,s,n])=>`cubic-bezier(${e}, ${t}, ${s}, ${n})`,qw={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Mc([0,.65,.55,1]),circOut:Mc([.55,0,1,.45]),backIn:Mc([.31,.01,.66,-.59]),backOut:Mc([.33,1.53,.69,.99])};function TE(e,t){if(e)return typeof e=="function"?AE()?wE(e,t):"ease-out":hE(e)?Mc(e):Array.isArray(e)?e.map(s=>TE(s,t)||qw.easeOut):qw[e]}function sz(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=TE(h,o);Array.isArray(g)&&(p.easing=g);const x={delay:n,duration:o,easing:Array.isArray(g)?"linear":g,fill:"both",iterations:l+1,direction:u==="reverse"?"alternate":"normal"};return d&&(x.pseudoElement=d),e.animate(p,x)}function RE(e){return typeof e=="function"&&"applyToOptions"in e}function nz({type:e,...t}){return RE(e)&&AE()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class ME extends yb{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,hb(typeof t.type!="string");const d=nz(t);this.animation=sz(s,n,o,d,l),d.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!l){const p=yf(o,this.options,h,this.speed);this.updateMotionValue&&this.updateMotionValue(p),EE(s,n,p),this.animation.cancel()}f?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const t=this.options?.element;!this.isPseudoElement&&t?.isConnected&&this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return li(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+li(t)}get time(){return li(Number(this.animation.currentTime)||0)}set time(t){const s=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Fn(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&&tz()?(this.animation.timeline=t,s&&(this.animation.rangeStart=s),n&&(this.animation.rangeEnd=n),ci):o(this)}}const DE={anticipate:lE,backInOut:oE,circInOut:uE};function iz(e){return e in DE}function rz(e){typeof e.ease=="string"&&iz(e.ease)&&(e.ease=DE[e.ease])}const og=10;class az extends ME{constructor(t){rz(t),kE(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(og,un.now()-this.startTime),d=Xi(0,og,f-og),p=h.sample(f).value,{name:g}=this.options;l&&g&&EE(l,g,p),s.setWithVelocity(h.sample(Math.max(0,f-d)).value,p,d),h.stop()}}const Vw=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Ai.test(e)||e==="0")&&!e.startsWith("url("));function oz(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 lz(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=Vw(o,t),h=Vw(l,t);return!u||!h?!1:oz(e)||(s==="spring"||RE(s))&&n}function Ix(e){e.duration=0,e.type="keyframes"}const OE=new Set(["opacity","clipPath","filter","transform"]),cz=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function uz(e){for(let t=0;t<e.length;t++)if(typeof e[t]=="string"&&cz.test(e[t]))return!0;return!1}const dz=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),hz=tE(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function fz(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 hz()&&s&&(OE.has(s)||dz.has(s)&&uz(h))&&(s!=="transform"||!p)&&!d&&!n&&o!=="mirror"&&l!==0&&u!=="inertia"}const mz=40;class pz extends yb{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=un.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||wb;this.keyframeResolver=new v(h,(w,k,N)=>this.onKeyframesResolved(w,k,x,!N),f,d,p),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,s,n,o){this.keyframeResolver=void 0;const{name:l,type:u,velocity:h,delay:f,isHandoff:d,onUpdate:p}=n;this.resolvedAt=un.now();let g=!0;lz(t,l,u,h)||(g=!1,(ba.instantAnimations||!f)&&p?.(yf(t,n,s)),t[0]=t[t.length-1],Ix(n),n.repeat=0);const v={startTime:o?this.resolvedAt?this.resolvedAt-this.createdAt>mz?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:s,...n,keyframes:t},w=g&&!d&&fz(v),k=v.motionValue?.owner?.current;let N;if(w)try{N=new az({...v,element:k})}catch{N=new Ph(v)}else N=new Ph(v);N.finished.then(()=>{this.notifyFinished()}).catch(ci),this.pendingTimeline&&(this.stopTimeline=N.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=N}get finished(){return this._animation?this.animation.finished:this._finished}then(t,s){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),Q9()),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 LE(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 gz=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function xz(e){const t=gz.exec(e);if(!t)return[,];const[,s,n,o]=t;return[`--${s??n}`,o]}function zE(e,t,s=1){const[n,o]=xz(e);if(!n)return;const l=window.getComputedStyle(t).getPropertyValue(n);if(l){const u=l.trim();return QC(u)?parseFloat(u):u}return gb(o)?zE(o,t,s+1):o}const bz={type:"spring",stiffness:500,damping:25,restSpeed:10},vz=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),_z={type:"keyframes",duration:.8},yz={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},wz=(e,{keyframes:t})=>t.length>2?_z:xl.has(e)?e.startsWith("scale")?vz(t[1]):bz:yz;function BE(e,t){if(e?.inherit&&t){const{inherit:s,...n}=e;return{...t,...n}}return e}function Sb(e,t){const s=e?.[t]??e?.default??e;return s!==e?BE(s,e):s}const Sz=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function kz(e){for(const t in e)if(!Sz.has(t))return!0;return!1}const kb=(e,t,s,n={},o,l)=>u=>{const h=Sb(n,e)||{},f=h.delay||n.delay||0;let{elapsed:d=0}=n;d=d-Fn(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};kz(h)||Object.assign(p,wz(e,p)),p.duration&&(p.duration=Fn(p.duration)),p.repeatDelay&&(p.repeatDelay=Fn(p.repeatDelay)),p.from!==void 0&&(p.keyframes[0]=p.from);let g=!1;if((p.type===!1||p.duration===0&&!p.repeatDelay)&&(Ix(p),p.delay===0&&(g=!0)),(ba.instantAnimations||ba.skipAnimations||o?.shouldSkipAnimations)&&(g=!0,Ix(p),p.delay=0),p.allowFlatten=!h.type&&!h.ease,g&&!l&&t.get()!==void 0){const x=yf(p.keyframes,h);if(x!==void 0){Ht.update(()=>{p.onUpdate(x),p.onComplete()});return}}return h.isSync?new Ph(p):new pz(p)};function Gw(e){const t=[{},{}];return e?.values.forEach((s,n)=>{t[0][n]=s.get(),t[1][n]=s.getVelocity()}),t}function Nb(e,t,s,n){if(typeof t=="function"){const[o,l]=Gw(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]=Gw(n);t=t(s!==void 0?s:e.custom,o,l)}return t}function eo(e,t,s){const n=e.getProps();return Nb(n,t,s!==void 0?s:n.custom,e)}const PE=new Set(["width","height","top","left","right","bottom",...gl]),Ww=30,Nz=e=>!isNaN(parseFloat(e));class Cz{constructor(t,s={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=n=>{const o=un.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=un.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=Nz(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 fb);const n=this.events[t].add(s);return t==="change"?()=>{n(),Ht.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,s){this.passiveEffect=t,this.stopPassiveEffect=s}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,s,n){this.set(s),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-n}jump(t,s=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,s&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=un.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>Ww)return 0;const s=Math.min(this.updatedAt-this.prevUpdatedAt,Ww);return sE(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 Cz(e,t)}const $x=e=>Array.isArray(e);function Ez(e,t,s){e.hasValue(t)?e.getValue(t).set(s):e.addValue(t,hl(s))}function jz(e){return $x(e)?e[e.length-1]||0:e}function Az(e,t){const s=eo(e,t);let{transitionEnd:n={},transition:o={},...l}=s||{};l={...l,...n};for(const u in l){const h=jz(l[u]);Ez(e,u,h)}}const Xs=e=>!!(e&&e.getVelocity);function Tz(e){return!!(Xs(e)&&e.add)}function Hx(e,t){const s=e.getValue("willChange");if(Tz(s))return s.add(t);if(!s&&ba.WillChange){const n=new ba.WillChange("auto");e.addValue("willChange",n),n.add(t)}}function Cb(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const Rz="framerAppearId",IE="data-"+Cb(Rz);function $E(e){return e.props[IE]}function Mz({protectedKeys:e,needsAnimating:t},s){const n=e.hasOwnProperty(s)&&t[s]!==!0;return t[s]=!1,n}function HE(e,t,{delay:s=0,transitionOverride:n,type:o}={}){let{transition:l,transitionEnd:u,...h}=t;const f=e.getDefaultTransition();l=l?BE(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&&Mz(g,x))continue;const k={delay:s,...Sb(l||{},x)},N=v.get();if(N!==void 0&&!v.isAnimating()&&!Array.isArray(w)&&w===N&&!k.velocity){Ht.update(()=>v.set(w));continue}let C=!1;if(window.MotionHandoffAnimation){const T=$E(e);if(T){const M=window.MotionHandoffAnimation(T,x,Ht);M!==null&&(k.startTime=M,C=!0)}}Hx(e,x);const A=d??e.shouldReduceMotion;v.start(kb(x,v,w,A&&PE.has(x)?{type:!1}:k,e,C));const j=v.animation;j&&p.push(j)}if(u){const x=()=>Ht.update(()=>{u&&Az(e,u)});p.length?Promise.all(p).then(x):x()}return p}function Ux(e,t,s={}){const n=eo(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(HE(e,n,s)):()=>Promise.resolve(),u=e.variantChildren&&e.variantChildren.size?(f=0)=>{const{delayChildren:d=0,staggerChildren:p,staggerDirection:g}=o;return Dz(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 Dz(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(Ux(f,t,{...u,delay:s+(typeof n=="function"?0:n)+LE(e.variantChildren,f,n,o,l)}).then(()=>f.notify("AnimationComplete",t)));return Promise.all(h)}function Oz(e,t,s={}){e.notify("AnimationStart",t);let n;if(Array.isArray(t)){const o=t.map(l=>Ux(e,l,s));n=Promise.all(o)}else if(typeof t=="string")n=Ux(e,t,s);else{const o=typeof t=="function"?eo(e,t,s.custom):t;n=Promise.all(HE(e,o,s))}return n.then(()=>{e.notify("AnimationComplete",t)})}const Lz={test:e=>e==="auto",parse:e=>e},UE=e=>t=>t.test(e),FE=[pl,Ke,Wi,fa,o9,a9,Lz],Kw=e=>FE.find(UE(e));function zz(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||eE(e):!0}const Bz=new Set(["brightness","contrast","saturate","opacity"]);function Pz(e){const[t,s]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[n]=s.match(xb)||[];if(!n)return e;const o=s.replace(n,"");let l=Bz.has(t)?1:0;return n!==s&&(l*=100),t+"("+l+o+")"}const Iz=/\b([a-z-]*)\(.*?\)/gu,Fx={...Ai,getAnimatableNone:e=>{const t=e.match(Iz);return t?t.map(Pz).join(" "):e}},qx={...Ai,getAnimatableNone:e=>{const t=Ai.parse(e);return Ai.createTransformer(e)(t.map(n=>typeof n=="number"?0:typeof n=="object"?{...n,alpha:1}:n))}},Yw={...pl,transform:Math.round},$z={rotate:fa,rotateX:fa,rotateY:fa,rotateZ:fa,scale:Hd,scaleX:Hd,scaleY:Hd,scaleZ:Hd,skew:fa,skewX:fa,skewY:fa,distance:Ke,translateX:Ke,translateY:Ke,translateZ:Ke,x:Ke,y:Ke,z:Ke,perspective:Ke,transformPerspective:Ke,opacity:eu,originX:Lw,originY:Lw,originZ:Ke},Eb={borderWidth:Ke,borderTopWidth:Ke,borderRightWidth:Ke,borderBottomWidth:Ke,borderLeftWidth:Ke,borderRadius:Ke,borderTopLeftRadius:Ke,borderTopRightRadius:Ke,borderBottomRightRadius:Ke,borderBottomLeftRadius:Ke,width:Ke,maxWidth:Ke,height:Ke,maxHeight:Ke,top:Ke,right:Ke,bottom:Ke,left:Ke,inset:Ke,insetBlock:Ke,insetBlockStart:Ke,insetBlockEnd:Ke,insetInline:Ke,insetInlineStart:Ke,insetInlineEnd:Ke,padding:Ke,paddingTop:Ke,paddingRight:Ke,paddingBottom:Ke,paddingLeft:Ke,paddingBlock:Ke,paddingBlockStart:Ke,paddingBlockEnd:Ke,paddingInline:Ke,paddingInlineStart:Ke,paddingInlineEnd:Ke,margin:Ke,marginTop:Ke,marginRight:Ke,marginBottom:Ke,marginLeft:Ke,marginBlock:Ke,marginBlockStart:Ke,marginBlockEnd:Ke,marginInline:Ke,marginInlineStart:Ke,marginInlineEnd:Ke,fontSize:Ke,backgroundPositionX:Ke,backgroundPositionY:Ke,...$z,zIndex:Yw,fillOpacity:eu,strokeOpacity:eu,numOctaves:Yw},Hz={...Eb,color:Ss,backgroundColor:Ss,outlineColor:Ss,fill:Ss,stroke:Ss,borderColor:Ss,borderTopColor:Ss,borderRightColor:Ss,borderBottomColor:Ss,borderLeftColor:Ss,filter:Fx,WebkitFilter:Fx,mask:qx,WebkitMask:qx},qE=e=>Hz[e],Uz=new Set([Fx,qx]);function VE(e,t){let s=qE(e);return Uz.has(s)||(s=Ai),s.getAnimatableNone?s.getAnimatableNone(t):void 0}const Fz=new Set(["auto","none","0"]);function qz(e,t,s){let n=0,o;for(;n<e.length&&!o;){const l=e[n];typeof l=="string"&&!Fz.has(l)&&dl(l).values.length&&(o=e[n]),n++}if(o&&s)for(const l of t)e[l]=VE(s,o)}class Vz extends wb{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(),gb(g))){const x=zE(g,s.current);x!==void 0&&(t[p]=x),p===t.length-1&&(this.finalKeyframe=g)}}if(this.resolveNoneKeyframes(),!PE.has(n)||t.length!==2)return;const[o,l]=t,u=Kw(o),h=Kw(l),f=Ow(o),d=Ow(l);if(f!==d&&pa[n]){this.needsMeasurement=!0;return}if(u!==h)if(Fw(u)&&Fw(h))for(let p=0;p<t.length;p++){const g=t[p];typeof g=="string"&&(t[p]=parseFloat(g))}else pa[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:s}=this,n=[];for(let o=0;o<t.length;o++)(t[o]===null||zz(t[o]))&&n.push(o);n.length&&qz(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=pa[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]=pa[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 GE(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 WE=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function Gz(e){return JC(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}const{schedule:jb}=fE(queueMicrotask,!1),Ni={x:!1,y:!1};function KE(){return Ni.x||Ni.y}function Wz(e){return e==="x"||e==="y"?Ni[e]?null:(Ni[e]=!0,()=>{Ni[e]=!1}):Ni.x||Ni.y?null:(Ni.x=Ni.y=!0,()=>{Ni.x=Ni.y=!1})}function YE(e,t){const s=GE(e),n=new AbortController,o={passive:!0,...t,signal:n.signal};return[s,o,()=>n.abort()]}function Kz(e){return!(e.pointerType==="touch"||KE())}function Yz(e,t,s={}){const[n,o,l]=YE(e,s);return n.forEach(u=>{let h=!1,f=!1,d;const p=()=>{u.removeEventListener("pointerleave",w)},g=N=>{d&&(d(N),d=void 0),p()},x=N=>{h=!1,window.removeEventListener("pointerup",x),window.removeEventListener("pointercancel",x),f&&(f=!1,g(N))},v=()=>{h=!0,window.addEventListener("pointerup",x,o),window.addEventListener("pointercancel",x,o)},w=N=>{if(N.pointerType!=="touch"){if(h){f=!0;return}g(N)}},k=N=>{if(!Kz(N))return;f=!1;const C=t(u,N);typeof C=="function"&&(d=C,u.addEventListener("pointerleave",w,o))};u.addEventListener("pointerenter",k,o),u.addEventListener("pointerdown",v,o)}),l}const XE=(e,t)=>t?e===t?!0:XE(e,t.parentElement):!1,Ab=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,Xz=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Zz(e){return Xz.has(e.tagName)||e.isContentEditable===!0}const Qz=new Set(["INPUT","SELECT","TEXTAREA"]);function Jz(e){return Qz.has(e.tagName)||e.isContentEditable===!0}const gh=new WeakSet;function Xw(e){return t=>{t.key==="Enter"&&e(t)}}function lg(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const eB=(e,t)=>{const s=e.currentTarget;if(!s)return;const n=Xw(()=>{if(gh.has(s))return;lg(s,"down");const o=Xw(()=>{lg(s,"up")}),l=()=>lg(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 Zw(e){return Ab(e)&&!KE()}const Qw=new WeakSet;function tB(e,t,s={}){const[n,o,l]=YE(e,s),u=h=>{const f=h.currentTarget;if(!Zw(h)||Qw.has(h))return;gh.add(f),s.stopPropagation&&Qw.add(h);const d=t(f,h),p=(v,w)=>{window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",x),gh.has(f)&&gh.delete(f),Zw(v)&&typeof d=="function"&&d(v,{success:w})},g=v=>{p(v,f===window||f===document||s.useGlobalTarget||XE(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),Gz(h)&&(h.addEventListener("focus",d=>eB(d,o)),!Zz(h)&&!h.hasAttribute("tabindex")&&(h.tabIndex=0))}),l}function Tb(e){return JC(e)&&"ownerSVGElement"in e}const xh=new WeakMap;let bh;const ZE=(e,t,s)=>(n,o)=>o&&o[0]?o[0][e+"Size"]:Tb(n)&&"getBBox"in n?n.getBBox()[t]:n[s],sB=ZE("inline","width","offsetWidth"),nB=ZE("block","height","offsetHeight");function iB({target:e,borderBoxSize:t}){xh.get(e)?.forEach(s=>{s(e,{get width(){return sB(e,t)},get height(){return nB(e,t)}})})}function rB(e){e.forEach(iB)}function aB(){typeof ResizeObserver>"u"||(bh=new ResizeObserver(rB))}function oB(e,t){bh||aB();const s=GE(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 lB(){sl=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};vh.forEach(t=>t(e))},window.addEventListener("resize",sl)}function cB(e){return vh.add(e),sl||lB(),()=>{vh.delete(e),!vh.size&&typeof sl=="function"&&(window.removeEventListener("resize",sl),sl=void 0)}}function Jw(e,t){return typeof e=="function"?cB(e):oB(e,t)}function uB(e){return Tb(e)&&e.tagName==="svg"}const dB=[...FE,Ss,Ai],hB=e=>dB.find(UE(e)),eS=()=>({translate:0,scale:1,origin:0,originPoint:0}),nl=()=>({x:eS(),y:eS()}),tS=()=>({min:0,max:0}),Rs=()=>({x:tS(),y:tS()}),fB=new WeakMap;function wf(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function tu(e){return typeof e=="string"||Array.isArray(e)}const Rb=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Mb=["initial",...Rb];function Sf(e){return wf(e.animate)||Mb.some(t=>tu(e[t]))}function QE(e){return!!(Sf(e)||e.variants)}function mB(e,t,s){for(const n in t){const o=t[n],l=s[n];if(Xs(o))e.addValue(n,o);else if(Xs(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 Vx={current:null},JE={current:!1},pB=typeof window<"u";function gB(){if(JE.current=!0,!!pB)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Vx.current=e.matches;e.addEventListener("change",t),t()}else Vx.current=!1}const sS=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Ih={};function e3(e){Ih=e}function xB(){return Ih}class bB{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=wb,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=un.now();this.renderScheduledAt<v&&(this.renderScheduledAt=v,Ht.render(this.render,!1,!0))};const{latestValues:d,renderState:p}=h;this.latestValues=d,this.baseTarget={...d},this.initialValues=s.initial?{...d}:{},this.renderState=p,this.parent=t,this.props=s,this.presenceContext=n,this.depth=t?t.depth+1:0,this.reducedMotionConfig=o,this.skipAnimationsConfig=l,this.options=f,this.blockInitialAnimation=!!u,this.isControllingVariants=Sf(s),this.isVariantNode=QE(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&&Xs(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,fB.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:(JE.current||gB(),this.shouldReduceMotion=Vx.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(),va(this.notifyUpdate),va(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&&OE.has(t)&&this.current instanceof HTMLElement){const{factory:u,keyframes:h,times:f,ease:d,duration:p}=s.accelerate,g=new ME({element:this.current,name:t,keyframes:h,times:f,ease:d,duration:Fn(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&&Ht.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let l;typeof window<"u"&&window.MotionCheckAppearSync&&(l=window.MotionCheckAppearSync(this,t,s)),this.valueSubscriptions.set(t,()=>{o(),l&&l(),s.owner&&s.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Ih){const s=Ih[t];if(!s)continue;const{isEnabled:n,Feature:o}=s;if(!this.features[t]&&o&&n(this.props)&&(this.features[t]=new o(this)),this.features[t]){const l=this.features[t];l.isMounted?l.update():(l.mount(),l.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Rs()}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<sS.length;n++){const o=sS[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=mB(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"&&(QC(n)||eE(n))?n=parseFloat(n):!hB(n)&&Ai.test(s)&&(n=VE(t,s)),this.setBaseTarget(t,Xs(n)?n.get():n)),Xs(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=Nb(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&&!Xs(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 fb),this.events[t].add(s)}notify(t,...s){this.events[t]&&this.events[t].notify(...s)}scheduleRenderMicrotask(){jb.render(this.render)}}class t3 extends bB{constructor(){super(...arguments),this.KeyframeResolver=Vz}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;Xs(t)&&(this.childSubscription=t.on("change",s=>{this.current&&(this.current.textContent=`${s}`)}))}}class ya{constructor(t){this.isMounted=!1,this.node=t}update(){}}function s3({top:e,left:t,right:s,bottom:n}){return{x:{min:t,max:s},y:{min:e,max:n}}}function vB({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function _B(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 cg(e){return e===void 0||e===1}function Gx({scale:e,scaleX:t,scaleY:s}){return!cg(e)||!cg(t)||!cg(s)}function Va(e){return Gx(e)||n3(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function n3(e){return nS(e.x)||nS(e.y)}function nS(e){return e&&e!=="0%"}function $h(e,t,s){const n=e-s,o=t*n;return s+o}function iS(e,t,s,n,o){return o!==void 0&&(e=$h(e,o,n)),$h(e,s,n)+t}function Wx(e,t=0,s=1,n,o){e.min=iS(e.min,t,s,n,o),e.max=iS(e.max,t,s,n,o)}function i3(e,{x:t,y:s}){Wx(e.x,t.translate,t.scale,t.originPoint),Wx(e.y,s.translate,s.scale,s.originPoint)}const rS=.999999999999,aS=1.0000000000001;function yB(e,t,s,n=!1){const o=s.length;if(!o)return;t.x=t.y=1;let l,u;for(let h=0;h<o;h++){l=s[h],u=l.projectionDelta;const{visualElement:f}=l.options;f&&f.props.style&&f.props.style.display==="contents"||(n&&l.options.layoutScroll&&l.scroll&&l!==l.root&&(Vi(e.x,-l.scroll.offset.x),Vi(e.y,-l.scroll.offset.y)),u&&(t.x*=u.x.scale,t.y*=u.y.scale,i3(e,u)),n&&Va(l.latestValues)&&_h(e,l.latestValues,l.layout?.layoutBox))}t.x<aS&&t.x>rS&&(t.x=1),t.y<aS&&t.y>rS&&(t.y=1)}function Vi(e,t){e.min+=t,e.max+=t}function oS(e,t,s,n,o=.5){const l=Kt(e.min,e.max,o);Wx(e,t,s,l,n)}function lS(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function _h(e,t,s){const n=s??e;oS(e.x,lS(t.x,n.x),t.scaleX,t.scale,t.originX),oS(e.y,lS(t.y,n.y),t.scaleY,t.scale,t.originY)}function r3(e,t){return s3(_B(e.getBoundingClientRect(),t))}function wB(e,t,s){const n=r3(e,s),{scroll:o}=t;return o&&(Vi(n.x,o.offset.x),Vi(n.y,o.offset.y)),n}const SB={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},kB=gl.length;function NB(e,t,s){let n="",o=!0;for(let l=0;l<kB;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=WE(h,Eb[u]);if(!f){o=!1;const p=SB[u]||u;n+=`${p}(${d}) `}s&&(t[u]=d)}}return n=n.trim(),s?n=s(t,o?"":n):o&&(n="none"),n}function Db(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(pE(f)){o[f]=d;continue}else{const p=WE(d,Eb[f]);f.startsWith("origin")?(h=!0,l[f]=p):n[f]=p}}if(t.transform||(u||s?n.transform=NB(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 a3(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 cS(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(Ke.test(e))e=parseFloat(e);else return e;const s=cS(e,t.target.x),n=cS(e,t.target.y);return`${s}% ${n}%`}},CB={correct:(e,{treeScale:t,projectionDelta:s})=>{const n=e,o=Ai.parse(e);if(o.length>5)return n;const l=Ai.createTransformer(e),u=typeof o[0]!="number"?1:0,h=s.x.scale*t.x,f=s.y.scale*t.y;o[0+u]/=h,o[1+u]/=f;const d=Kt(h,f,.5);return typeof o[2+u]=="number"&&(o[2+u]/=d),typeof o[3+u]=="number"&&(o[3+u]/=d),l(o)}},Kx={borderRadius:{...vc,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:vc,borderTopRightRadius:vc,borderBottomLeftRadius:vc,borderBottomRightRadius:vc,boxShadow:CB};function o3(e,{layout:t,layoutId:s}){return xl.has(e)||e.startsWith("origin")||(t||s!==void 0)&&(!!Kx[e]||e==="opacity")}function Ob(e,t,s){const n=e.style,o=t?.style,l={};if(!n)return l;for(const u in n)(Xs(n[u])||o&&Xs(o[u])||o3(u,e)||s?.getValue(u)?.liveStyle!==void 0)&&(l[u]=n[u]);return l}function EB(e){return window.getComputedStyle(e)}class jB extends t3{constructor(){super(...arguments),this.type="html",this.renderInstance=a3}readValueFromInstance(t,s){if(xl.has(s))return this.projection?.isProjecting?Ox(s):W9(t,s);{const n=EB(t),o=(pE(s)?n.getPropertyValue(s):n[s])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(t,{transformPagePoint:s}){return r3(t,s)}build(t,s,n){Db(t,s,n.transformTemplate)}scrapeMotionValuesFromProps(t,s,n){return Ob(t,s,n)}}const AB={offset:"stroke-dashoffset",array:"stroke-dasharray"},TB={offset:"strokeDashoffset",array:"strokeDasharray"};function RB(e,t,s=1,n=0,o=!0){e.pathLength=1;const l=o?AB:TB;e[l.offset]=`${-n}`,e[l.array]=`${t} ${s}`}const MB=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function l3(e,{attrX:t,attrY:s,attrScale:n,pathLength:o,pathSpacing:l=1,pathOffset:u=0,...h},f,d,p){if(Db(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 MB)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&&RB(g,o,l,u,!1)}const c3=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"]),u3=e=>typeof e=="string"&&e.toLowerCase()==="svg";function DB(e,t,s,n){a3(e,t,void 0,n);for(const o in t.attrs)e.setAttribute(c3.has(o)?o:Cb(o),t.attrs[o])}function d3(e,t,s){const n=Ob(e,t,s);for(const o in e)if(Xs(e[o])||Xs(t[o])){const l=gl.indexOf(o)!==-1?"attr"+o.charAt(0).toUpperCase()+o.substring(1):o;n[l]=e[o]}return n}class OB extends t3{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Rs}getBaseTargetFromProps(t,s){return t[s]}readValueFromInstance(t,s){if(xl.has(s)){const n=qE(s);return n&&n.default||0}return s=c3.has(s)?s:Cb(s),t.getAttribute(s)}scrapeMotionValuesFromProps(t,s,n){return d3(t,s,n)}build(t,s,n){l3(t,s,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(t,s,n,o){DB(t,s,n,o)}mount(t){this.isSVGTag=u3(t.tagName),super.mount(t)}}const LB=Mb.length;function h3(e){if(!e)return;if(!e.isControllingVariants){const s=e.parent?h3(e.parent)||{}:{};return e.props.initial!==void 0&&(s.initial=e.props.initial),s}const t={};for(let s=0;s<LB;s++){const n=Mb[s],o=e.props[n];(tu(o)||o===!1)&&(t[n]=o)}return t}function f3(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 zB=[...Rb].reverse(),BB=Rb.length;function PB(e){return t=>Promise.all(t.map(({animation:s,options:n})=>Oz(e,s,n)))}function IB(e){let t=PB(e),s=uS(),n=!0,o=!1;const l=d=>(p,g)=>{const x=eo(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=h3(e.parent)||{},x=[],v=new Set;let w={},k=1/0;for(let C=0;C<BB;C++){const A=zB[C],j=s[A],T=p[A]!==void 0?p[A]:g[A],M=tu(T),O=A===d?j.isActive:null;O===!1&&(k=C);let $=T===g[A]&&T!==p[A]&&M;if($&&(n||o)&&e.manuallyAnimateOnMount&&($=!1),j.protectedKeys={...w},!j.isActive&&O===null||!T&&!j.prevProp||wf(T)||typeof T=="boolean")continue;if(A==="exit"&&j.isActive&&O!==!0){j.prevResolvedValues&&(w={...w,...j.prevResolvedValues});continue}const D=$B(j.prevProp,T);let P=D||A===d&&j.isActive&&!$&&M||C>k&&M,B=!1;const G=Array.isArray(T)?T:[T];let F=G.reduce(l(A),{});O===!1&&(F={});const{prevResolvedValues:z={}}=j,U={...z,...F},K=W=>{P=!0,v.has(W)&&(B=!0,v.delete(W)),j.needsAnimating[W]=!0;const te=e.getValue(W);te&&(te.liveStyle=!1)};for(const W in U){const te=F[W],X=z[W];if(w.hasOwnProperty(W))continue;let V=!1;$x(te)&&$x(X)?V=!f3(te,X):V=te!==X,V?te!=null?K(W):v.add(W):te!==void 0&&v.has(W)?K(W):j.protectedKeys[W]=!0}j.prevProp=T,j.prevResolvedValues=F,j.isActive&&(w={...w,...F}),(n||o)&&e.blockInitialAnimation&&(P=!1);const I=$&&D;P&&(!I||B)&&x.push(...G.map(W=>{const te={type:A};if(typeof W=="string"&&(n||o)&&!I&&e.manuallyAnimateOnMount&&e.parent){const{parent:X}=e,V=eo(X,W);if(X.enteringChildren&&V){const{delayChildren:q}=V.transition||{};te.delay=LE(X.enteringChildren,e,q)}}return{animation:W,options:te}}))}if(v.size){const C={};if(typeof p.initial!="boolean"){const A=eo(e,Array.isArray(p.initial)?p.initial[0]:p.initial);A&&A.transition&&(C.transition=A.transition)}v.forEach(A=>{const j=e.getBaseTarget(A),T=e.getValue(A);T&&(T.liveStyle=!0),C[A]=j??null}),x.push({animation:C})}let N=!!x.length;return n&&(p.initial===!1||p.initial===p.animate)&&!e.manuallyAnimateOnMount&&(N=!1),n=!1,o=!1,N?t(x):Promise.resolve()}function f(d,p){if(s[d].isActive===p)return Promise.resolve();e.variantChildren?.forEach(x=>x.animationState?.setActive(d,p)),s[d].isActive=p;const g=h(d);for(const x in s)s[x].protectedKeys={};return g}return{animateChanges:h,setActive:f,setAnimateFunction:u,getState:()=>s,reset:()=>{s=uS(),o=!0}}}function $B(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!f3(t,e):!1}function Ua(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function uS(){return{animate:Ua(!0),whileInView:Ua(),whileHover:Ua(),whileTap:Ua(),whileDrag:Ua(),whileFocus:Ua(),exit:Ua()}}function Yx(e,t){e.min=t.min,e.max=t.max}function ki(e,t){Yx(e.x,t.x),Yx(e.y,t.y)}function dS(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const m3=1e-4,HB=1-m3,UB=1+m3,p3=.01,FB=0-p3,qB=0+p3;function dn(e){return e.max-e.min}function VB(e,t,s){return Math.abs(e-t)<=s}function hS(e,t,s,n=.5){e.origin=n,e.originPoint=Kt(t.min,t.max,e.origin),e.scale=dn(s)/dn(t),e.translate=Kt(s.min,s.max,e.origin)-e.originPoint,(e.scale>=HB&&e.scale<=UB||isNaN(e.scale))&&(e.scale=1),(e.translate>=FB&&e.translate<=qB||isNaN(e.translate))&&(e.translate=0)}function qc(e,t,s,n){hS(e.x,t.x,s.x,n?n.originX:void 0),hS(e.y,t.y,s.y,n?n.originY:void 0)}function fS(e,t,s,n=0){const o=n?Kt(s.min,s.max,n):s.min;e.min=o+t.min,e.max=e.min+dn(t)}function GB(e,t,s,n){fS(e.x,t.x,s.x,n?.x),fS(e.y,t.y,s.y,n?.y)}function mS(e,t,s,n=0){const o=n?Kt(s.min,s.max,n):s.min;e.min=t.min-o,e.max=e.min+dn(t)}function Hh(e,t,s,n){mS(e.x,t.x,s.x,n?.x),mS(e.y,t.y,s.y,n?.y)}function pS(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 WB(e,t=0,s=1,n=.5,o,l=e,u=e){if(Wi.test(t)&&(t=parseFloat(t),t=Kt(u.min,u.max,t/100)-u.min),typeof t!="number")return;let h=Kt(l.min,l.max,n);e===l&&(h-=t),e.min=pS(e.min,t,s,h,o),e.max=pS(e.max,t,s,h,o)}function gS(e,t,[s,n,o],l,u){WB(e,t[s],t[n],t[o],t.scale,l,u)}const KB=["x","scaleX","originX"],YB=["y","scaleY","originY"];function xS(e,t,s,n){gS(e.x,t,KB,s?s.x:void 0,n?n.x:void 0),gS(e.y,t,YB,s?s.y:void 0,n?n.y:void 0)}function bS(e){return e.translate===0&&e.scale===1}function g3(e){return bS(e.x)&&bS(e.y)}function vS(e,t){return e.min===t.min&&e.max===t.max}function XB(e,t){return vS(e.x,t.x)&&vS(e.y,t.y)}function _S(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function x3(e,t){return _S(e.x,t.x)&&_S(e.y,t.y)}function yS(e){return dn(e.x)/dn(e.y)}function wS(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function qi(e){return[e("x"),e("y")]}function ZB(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 b3=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],QB=b3.length,SS=e=>typeof e=="string"?parseFloat(e):e,kS=e=>typeof e=="number"||Ke.test(e);function JB(e,t,s,n,o,l){o?(e.opacity=Kt(0,s.opacity??1,eP(n)),e.opacityExit=Kt(t.opacity??1,0,tP(n))):l&&(e.opacity=Kt(t.opacity??1,s.opacity??1,n));for(let u=0;u<QB;u++){const h=b3[u];let f=NS(t,h),d=NS(s,h);if(f===void 0&&d===void 0)continue;f||(f=0),d||(d=0),f===0||d===0||kS(f)===kS(d)?(e[h]=Math.max(Kt(SS(f),SS(d),n),0),(Wi.test(d)||Wi.test(f))&&(e[h]+="%")):e[h]=d}(t.rotate||s.rotate)&&(e.rotate=Kt(t.rotate||0,s.rotate||0,n))}function NS(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const eP=v3(0,.5,cE),tP=v3(.5,.95,ci);function v3(e,t,s){return n=>n<e?0:n>t?1:s(Jc(e,t,n))}function sP(e,t,s){const n=Xs(e)?e:hl(e);return n.start(kb("",n,t,s)),n.animation}function su(e,t,s,n={passive:!0}){return e.addEventListener(t,s,n),()=>e.removeEventListener(t,s)}const nP=(e,t)=>e.depth-t.depth;class iP{constructor(){this.children=[],this.isDirty=!1}add(t){db(this.children,t),this.isDirty=!0}remove(t){Oh(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(nP),this.isDirty=!1,this.children.forEach(t)}}function rP(e,t){const s=un.now(),n=({timestamp:o})=>{const l=o-s;l>=t&&(va(n),e(l-t))};return Ht.setup(n,!0),()=>va(n)}function yh(e){return Xs(e)?e.get():e}class aP{constructor(){this.members=[]}add(t){db(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},ug=["","X","Y","Z"],oP=1e3;let lP=0;function dg(e,t,s,n){const{latestValues:o}=t;o[e]&&(s[e]=o[e],t.setStaticValue(e,0),n&&(n[e]=0))}function _3(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const s=$E(t);if(window.MotionHasOptimisedAnimation(s,"transform")){const{layout:o,layoutId:l}=e.options;window.MotionCancelOptimisedAnimation(s,"transform",Ht,!(o||l))}const{parent:n}=e;n&&!n.hasCheckedOptimisedAppear&&_3(n)}function y3({attachResizeListener:e,defaultParent:t,measureScroll:s,checkIsScrollRoot:n,resetTransform:o}){return class{constructor(u={},h=t?.()){this.id=lP++,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(dP),this.nodes.forEach(xP),this.nodes.forEach(bP),this.nodes.forEach(hP)},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 iP)}addEventListener(u,h){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new fb),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=Tb(u)&&!uB(u),this.instance=u;const{layoutId:h,layout:f,visualElement:d}=this.options;if(d&&!d.current&&d.mount(u),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(f||h)&&(this.isLayoutDirty=!0),e){let p,g=0;const x=()=>this.root.updateBlockedByResize=!1;Ht.read(()=>{g=window.innerWidth}),e(u,()=>{const v=window.innerWidth;v!==g&&(g=v,this.root.updateBlockedByResize=!0,p&&p(),p=rP(x,250),wh.hasAnimatedSinceResize&&(wh.hasAnimatedSinceResize=!1,this.nodes.forEach(jS)))})}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()||SP,{onLayoutAnimationStart:k,onLayoutAnimationComplete:N}=d.getProps(),C=!this.targetLayout||!x3(this.targetLayout,v),A=!g&&x;if(this.options.layoutRoot||this.resumeFrom||A||g&&(C||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const j={...Sb(w,"layout"),onPlay:k,onComplete:N};(d.shouldReduceMotion||this.options.layoutRoot)&&(j.delay=0,j.type=!1),this.startAnimation(j),this.setAnimationOrigin(p,A)}else g||jS(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(),va(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(vP),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&&_3(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(mP),this.nodes.forEach(CS);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(ES);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(pP),this.nodes.forEach(gP),this.nodes.forEach(cP),this.nodes.forEach(uP)):this.nodes.forEach(ES),this.clearAllSnapshots();const h=un.now();Ks.delta=Xi(0,1e3/60,h-Ks.timestamp),Ks.timestamp=h,Ks.isProcessing=!0,sg.update.process(Ks),sg.preRender.process(Ks),sg.render.process(Ks),Ks.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,jb.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(fP),this.sharedNodes.forEach(_P)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Ht.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Ht.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!dn(this.snapshot.measuredBox.x)&&!dn(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=Rs()),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&&!g3(this.projectionDelta),f=this.getTransformTemplate(),d=f?f(this.latestValues,""):void 0,p=d!==this.prevTransformTemplateValue;u&&this.instance&&(h||Va(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)),kP(f),{animationId:this.root.animationId,measuredBox:h,layoutBox:f,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:u}=this.options;if(!u)return Rs();const h=u.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(NP))){const{scroll:d}=this.root;d&&(Vi(h.x,d.offset.x),Vi(h.y,d.offset.y))}return h}removeElementScroll(u){const h=Rs();if(ki(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&&ki(h,u),Vi(h.x,p.offset.x),Vi(h.y,p.offset.y))}return h}applyTransform(u,h=!1,f){const d=f||Rs();ki(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&&(Vi(d.x,-g.scroll.offset.x),Vi(d.y,-g.scroll.offset.y)),Va(g.latestValues)&&_h(d,g.latestValues,g.layout?.layoutBox)}return Va(this.latestValues)&&_h(d,this.latestValues,this.layout?.layoutBox),d}removeTransform(u){const h=Rs();ki(h,u);for(let f=0;f<this.path.length;f++){const d=this.path[f];if(!Va(d.latestValues))continue;let p;d.instance&&(Gx(d.latestValues)&&d.updateSnapshot(),p=Rs(),ki(p,d.measurePageBox())),xS(h,d.latestValues,d.snapshot?.layoutBox,p)}return Va(this.latestValues)&&xS(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!==Ks.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=Ks.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=Rs(),this.targetWithTransforms=Rs()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),GB(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):ki(this.target,this.layout.layoutBox),i3(this.target,this.targetDelta)):ki(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||Gx(this.parent.latestValues)||n3(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=Rs(),this.relativeTargetOrigin=Rs(),Hh(this.relativeTargetOrigin,h,f,this.options.layoutAnchor||void 0),ki(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===Ks.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;ki(this.layoutCorrected,this.layout.layoutBox);const g=this.treeScale.x,x=this.treeScale.y;yB(this.layoutCorrected,this.treeScale,this.path,h),u.layout&&!u.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(u.target=u.layout.layoutBox,u.targetWithTransforms=Rs());const{target:v}=u;if(!v){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(dS(this.prevProjectionDelta.x,this.projectionDelta.x),dS(this.prevProjectionDelta.y,this.projectionDelta.y)),qc(this.projectionDelta,this.layoutCorrected,v,this.latestValues),(this.treeScale.x!==g||this.treeScale.y!==x||!wS(this.projectionDelta.x,this.prevProjectionDelta.x)||!wS(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=Rs(),v=f?f.source:void 0,w=this.layout?this.layout.source:void 0,k=v!==w,N=this.getStack(),C=!N||N.members.length<=1,A=!!(k&&!C&&this.options.crossfade===!0&&!this.path.some(wP));this.animationProgress=0;let j;this.mixTargetDelta=T=>{const M=T/1e3;AS(g.x,u.x,M),AS(g.y,u.y,M),this.setTargetDelta(g),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Hh(x,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),yP(this.relativeTarget,this.relativeTargetOrigin,x,M),j&&XB(this.relativeTarget,j)&&(this.isProjectionDirty=!1),j||(j=Rs()),ki(j,this.relativeTarget)),k&&(this.animationValues=p,JB(p,d,this.latestValues,M,A,C)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=M},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(u){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(va(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Ht.update(()=>{wh.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=hl(0)),this.motionValue.jump(0,!1),this.currentAnimation=sP(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(oP),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&&w3(this.options.animationType,this.layout.layoutBox,d.layoutBox)){f=this.target||Rs();const g=dn(this.layout.layoutBox.x);f.x.min=u.target.x.min,f.x.max=f.x.min+g;const x=dn(this.layout.layoutBox.y);f.y.min=u.target.y.min,f.y.max=f.y.min+x}ki(h,f),_h(h,p),qc(this.projectionDeltaWithTransform,this.layoutCorrected,h,p)}}registerSharedNode(u,h){this.sharedNodes.has(u)||this.sharedNodes.set(u,new aP),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&&dg("z",u,d,this.animationValues);for(let p=0;p<ug.length;p++)dg(`rotate${ug[p]}`,u,d,this.animationValues),dg(`skew${ug[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&&!Va(this.latestValues)&&(u.transform=f?f({},""):"none",this.hasProjected=!1);return}u.visibility="";const p=d.animationValues||d.latestValues;this.applyTransformsToTarget();let g=ZB(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 Kx){if(p[w]===void 0)continue;const{correct:k,applyTo:N,isCSSVariable:C}=Kx[w],A=g==="none"?p[w]:k(p[w],d);if(N){const j=N.length;for(let T=0;T<j;T++)u[N[T]]=A}else C?this.options.visualElement.renderState.vars[w]=A:u[w]=A}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(CS),this.root.sharedNodes.clear()}}}function cP(e){e.updateLayout()}function uP(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")qi(p=>{const g=l?t.measuredBox[p]:t.layoutBox[p],x=dn(g);g.min=s[p].min,g.max=g.min+x});else if(o==="x"||o==="y"){const p=o==="x"?"y":"x";Yx(l?t.measuredBox[p]:t.layoutBox[p],s[p])}else w3(o,t.layoutBox,s)&&qi(p=>{const g=l?t.measuredBox[p]:t.layoutBox[p],x=dn(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();qc(u,s,t.layoutBox);const h=nl();l?qc(h,e.applyTransform(n,!0),t.measuredBox):qc(h,s,t.layoutBox);const f=!g3(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=Rs();Hh(w,t.layoutBox,g.layoutBox,v);const k=Rs();Hh(k,s,x.layoutBox,v),x3(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 dP(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 hP(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function fP(e){e.clearSnapshot()}function CS(e){e.clearMeasurements()}function mP(e){e.isLayoutDirty=!0,e.updateLayout()}function ES(e){e.isLayoutDirty=!1}function pP(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function gP(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function jS(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function xP(e){e.resolveTargetDelta()}function bP(e){e.calcProjection()}function vP(e){e.resetSkewAndRotation()}function _P(e){e.removeLeadSnapshot()}function AS(e,t,s){e.translate=Kt(t.translate,0,s),e.scale=Kt(t.scale,1,s),e.origin=t.origin,e.originPoint=t.originPoint}function TS(e,t,s,n){e.min=Kt(t.min,s.min,n),e.max=Kt(t.max,s.max,n)}function yP(e,t,s,n){TS(e.x,t.x,s.x,n),TS(e.y,t.y,s.y,n)}function wP(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const SP={duration:.45,ease:[.4,0,.1,1]},RS=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),MS=RS("applewebkit/")&&!RS("chrome/")?Math.round:ci;function DS(e){e.min=MS(e.min),e.max=MS(e.max)}function kP(e){DS(e.x),DS(e.y)}function w3(e,t,s){return e==="position"||e==="preserve-aspect"&&!VB(yS(t),yS(s),.2)}function NP(e){return e!==e.root&&e.scroll?.wasRoot}const CP=y3({attachResizeListener:(e,t)=>su(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),hg={current:void 0},S3=y3({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!hg.current){const e=new CP({});e.mount(window),e.setOptions({layoutScroll:!0}),hg.current=e}return hg.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),k3=_.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function EP(e=!0){const t=_.useContext(ub);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 N3=_.createContext({strict:!1}),OS={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 LS=!1;function jP(){if(LS)return;const e={};for(const t in OS)e[t]={isEnabled:s=>OS[t].some(n=>!!s[n])};e3(e),LS=!0}function C3(){return jP(),xB()}function AP(e){const t=C3();for(const s in e)t[s]={...t[s],...e[s]};e3(t)}const TP=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")||TP.has(e)}let E3=e=>!Uh(e);function RP(e){typeof e=="function"&&(E3=t=>t.startsWith("on")?!Uh(t):e(t))}try{RP(require("@emotion/is-prop-valid").default)}catch{}function MP(e,t,s){const n={};for(const o in e)o==="values"&&typeof e.values=="object"||Xs(e[o])||(E3(o)||s===!0&&Uh(o)||!t&&!Uh(o)||e.draggable&&o.startsWith("onDrag"))&&(n[o]=e[o]);return n}const kf=_.createContext({});function DP(e,t){if(Sf(e)){const{initial:s,animate:n}=e;return{initial:s===!1||tu(s)?s:void 0,animate:tu(n)?n:void 0}}return e.inherit!==!1?t:{}}function OP(e){const{initial:t,animate:s}=DP(e,_.useContext(kf));return _.useMemo(()=>({initial:t,animate:s}),[zS(t),zS(s)])}function zS(e){return Array.isArray(e)?e.join(" "):e}const Lb=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function j3(e,t,s){for(const n in t)!Xs(t[n])&&!o3(n,s)&&(e[n]=t[n])}function LP({transformTemplate:e},t){return _.useMemo(()=>{const s=Lb();return Db(s,t,e),Object.assign({},s.vars,s.style)},[t])}function zP(e,t){const s=e.style||{},n={};return j3(n,s,e),Object.assign(n,LP(e,t)),n}function BP(e,t){const s={},n=zP(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 A3=()=>({...Lb(),attrs:{}});function PP(e,t,s,n){const o=_.useMemo(()=>{const l=A3();return l3(l,t,u3(n),e.transformTemplate,e.style),{...l.attrs,style:{...l.style}}},[t]);if(e.style){const l={};j3(l,e.style,e),o.style={...l,...o.style}}return o}const IP=["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 zb(e){return typeof e!="string"||e.includes("-")?!1:!!(IP.indexOf(e)>-1||/[A-Z]/u.test(e))}function $P(e,t,s,{latestValues:n},o,l=!1,u){const f=(u??zb(e)?PP:BP)(t,n,o,e),d=MP(t,typeof e=="string",l),p=e!==_.Fragment?{...d,...f,ref:s}:{},{children:g}=t,x=_.useMemo(()=>Xs(g)?g.get():g,[g]);return _.createElement(e,{...p,children:x})}function HP({scrapeMotionValuesFromProps:e,createRenderState:t},s,n,o){return{latestValues:UP(s,n,o,e),renderState:t()}}function UP(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=Sf(e),d=QE(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"&&!wf(g)){const x=Array.isArray(g)?g:[g];for(let v=0;v<x.length;v++){const w=Nb(e,x[v]);if(w){const{transitionEnd:k,transition:N,...C}=w;for(const A in C){let j=C[A];if(Array.isArray(j)){const T=p?j.length-1:0;j=j[T]}j!==null&&(o[A]=j)}for(const A in k)o[A]=k[A]}}}return o}const T3=e=>(t,s)=>{const n=_.useContext(kf),o=_.useContext(ub),l=()=>HP(e,t,n,o);return s?l():I7(l)},FP=T3({scrapeMotionValuesFromProps:Ob,createRenderState:Lb}),qP=T3({scrapeMotionValuesFromProps:d3,createRenderState:A3}),VP=Symbol.for("motionComponentSymbol");function GP(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 R3=_.createContext({});function el(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function WP(e,t,s,n,o,l){const{visualElement:u}=_.useContext(kf),h=_.useContext(N3),f=_.useContext(ub),d=_.useContext(k3),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(R3);w&&!w.projection&&o&&(w.type==="html"||w.type==="svg")&&KP(x.current,s,o,k);const N=_.useRef(!1);_.useInsertionEffect(()=>{w&&N.current&&w.update(s,f)});const C=s[IE],A=_.useRef(!!C&&typeof window<"u"&&!window.MotionHandoffIsComplete?.(C)&&window.MotionHasOptimisedAnimation?.(C));return H7(()=>{v.current=!0,w&&(N.current=!0,window.MotionIsMounted=!0,w.updateFeatures(),w.scheduleRenderMicrotask(),A.current&&w.animationState&&w.animationState.animateChanges())}),_.useEffect(()=>{w&&(!A.current&&w.animationState&&w.animationState.animateChanges(),A.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(C)}),A.current=!1),w.enteringChildren=void 0)}),w}function KP(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:M3(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 M3(e){if(e)return e.options.allowProjection!==!1?e.projection:M3(e.parent)}function fg(e,{forwardMotionProps:t=!1,type:s}={},n,o){n&&AP(n);const l=s?s==="svg":zb(e),u=l?qP:FP;function h(d,p){let g;const x={..._.useContext(k3),...d,layoutId:YP(d)},{isStatic:v}=x,w=OP(d),k=u(d,v);if(!v&&typeof window<"u"){XP();const N=ZP(x);g=N.MeasureLayout,w.visualElement=WP(e,k,x,o,N.ProjectionNode,l)}return r.jsxs(kf.Provider,{value:w,children:[g&&w.visualElement?r.jsx(g,{visualElement:w.visualElement,...x}):null,$P(e,d,GP(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[VP]=e,f}function YP({layoutId:e}){const t=_.useContext(ZC).id;return t&&e!==void 0?t+"-"+e:e}function XP(e,t){_.useContext(N3).strict}function ZP(e){const t=C3(),{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 QP(e,t){if(typeof Proxy>"u")return fg;const s=new Map,n=(l,u)=>fg(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,fg(u,void 0,e,t)),s.get(u))})}const JP=(e,t)=>t.isSVG??zb(e)?new OB(t):new jB(t,{allowProjection:e!==_.Fragment});class eI extends ya{constructor(t){super(t),t.animationState||(t.animationState=IB(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();wf(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 tI=0;class sI extends ya{constructor(){super(...arguments),this.id=tI++,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=eo(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 nI={animation:{Feature:eI},exit:{Feature:sI}};function hu(e){return{point:{x:e.pageX,y:e.pageY}}}const iI=e=>t=>Ab(t)&&e(t,hu(t));function Vc(e,t,s,n){return su(e,t,iI(s),n)}const D3=({current:e})=>e?e.ownerDocument.defaultView:null,BS=(e,t)=>Math.abs(e-t);function rI(e,t){const s=BS(e.x,t.x),n=BS(e.y,t.y);return Math.sqrt(s**2+n**2)}const PS=new Set(["auto","scroll"]);class O3{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=mg(this.lastMoveEventInfo,this.history),w=this.startEvent!==null,k=rI(v.offset,{x:0,y:0})>=this.distanceThreshold;if(!w&&!k)return;const{point:N}=v,{timestamp:C}=Ks;this.history.push({...N,timestamp:C});const{onStart:A,onMove:j}=this.handlers;w||(A&&A(this.lastMoveEvent,v),this.startEvent=this.lastMoveEvent),j&&j(this.lastMoveEvent,v)},this.handlePointerMove=(v,w)=>{this.lastMoveEvent=v,this.lastRawMoveEventInfo=w,this.lastMoveEventInfo=Ud(w,this.transformPagePoint),Ht.update(this.updatePoint,!0)},this.handlePointerUp=(v,w)=>{this.end();const{onEnd:k,onSessionEnd:N,resumeAnimation:C}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&C&&C(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const A=mg(v.type==="pointercancel"?this.lastMoveEventInfo:Ud(w,this.transformPagePoint),this.history);this.startEvent&&k&&k(v,A),N&&N(v,A)},!Ab(t))return;this.dragSnapToOrigin=l,this.handlers=s,this.transformPagePoint=n,this.distanceThreshold=u,this.contextWindow=o||window;const f=hu(t),d=Ud(f,this.transformPagePoint),{point:p}=d,{timestamp:g}=Ks;this.history=[{...p,timestamp:g}];const{onSessionStart:x}=s;x&&x(t,mg(d,this.history)),this.removeListeners=cu(Vc(this.contextWindow,"pointermove",this.handlePointerMove),Vc(this.contextWindow,"pointerup",this.handlePointerUp),Vc(this.contextWindow,"pointercancel",this.handlePointerUp)),h&&this.startScrollTracking(h)}startScrollTracking(t){let s=t.parentElement;for(;s;){const n=getComputedStyle(s);(PS.has(n.overflowX)||PS.has(n.overflowY))&&this.scrollPositions.set(s,{x:s.scrollLeft,y:s.scrollTop}),s=s.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const s=this.scrollPositions.get(t);if(!s)return;const n=t===window,o=n?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},l={x:o.x-s.x,y:o.y-s.y};l.x===0&&l.y===0||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=l.x,this.lastMoveEventInfo.point.y+=l.y):this.history.length>0&&(this.history[0].x-=l.x,this.history[0].y-=l.y),this.scrollPositions.set(t,o),Ht.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),va(this.updatePoint)}}function Ud(e,t){return t?{point:t(e.point)}:e}function IS(e,t){return{x:e.x-t.x,y:e.y-t.y}}function mg({point:e},t){return{point:e,delta:IS(e,L3(t)),offset:IS(e,aI(t)),velocity:oI(t,.1)}}function aI(e){return e[0]}function L3(e){return e[e.length-1]}function oI(e,t){if(e.length<2)return{x:0,y:0};let s=e.length-1,n=null;const o=L3(e);for(;s>=0&&(n=e[s],!(o.timestamp-n.timestamp>Fn(t)));)s--;if(!n)return{x:0,y:0};n===e[0]&&e.length>2&&o.timestamp-n.timestamp>Fn(t)*2&&(n=e[1]);const l=li(o.timestamp-n.timestamp);if(l===0)return{x:0,y:0};const u={x:(o.x-n.x)/l,y:(o.y-n.y)/l};return u.x===1/0&&(u.x=0),u.y===1/0&&(u.y=0),u}function lI(e,{min:t,max:s},n){return t!==void 0&&e<t?e=n?Kt(t,e,n.min):Math.max(e,t):s!==void 0&&e>s&&(e=n?Kt(s,e,n.max):Math.min(e,s)),e}function $S(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 cI(e,{top:t,left:s,bottom:n,right:o}){return{x:$S(e.x,s,o),y:$S(e.y,t,n)}}function HS(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 uI(e,t){return{x:HS(e.x,t.x),y:HS(e.y,t.y)}}function dI(e,t){let s=.5;const n=dn(e),o=dn(t);return o>n?s=Jc(t.min,t.max-n,e.min):n>o&&(s=Jc(e.min,e.max-o,t.min)),Xi(0,1,s)}function hI(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 Xx=.35;function fI(e=Xx){return e===!1?e=0:e===!0&&(e=Xx),{x:US(e,"left","right"),y:US(e,"top","bottom")}}function US(e,t,s){return{min:FS(e,t),max:FS(e,s)}}function FS(e,t){return typeof e=="number"?e:e[t]||0}const mI=new WeakMap;class pI{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=Rs(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:s=!1,distanceThreshold:n}={}){const{presenceContext:o}=this.visualElement;if(o&&o.isPresent===!1)return;const l=g=>{s&&this.snapToCursor(hu(g).point),this.stopAnimation()},u=(g,x)=>{const{drag:v,dragPropagation:w,onDragStart:k}=this.getProps();if(v&&!w&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Wz(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),qi(C=>{let A=this.getAxisMotionValue(C).get()||0;if(Wi.test(A)){const{projection:j}=this.visualElement;if(j&&j.layout){const T=j.layout.layoutBox[C];T&&(A=dn(T)*(parseFloat(A)/100))}}this.originPoint[C]=A}),k&&Ht.update(()=>k(g,x),!1,!0),Hx(this.visualElement,"transform");const{animationState:N}=this.visualElement;N&&N.setActive("whileDrag",!0)},h=(g,x)=>{this.latestPointerEvent=g,this.latestPanInfo=x;const{dragPropagation:v,dragDirectionLock:w,onDirectionLock:k,onDrag:N}=this.getProps();if(!v&&!this.openDragLock)return;const{offset:C}=x;if(w&&this.currentDirection===null){this.currentDirection=xI(C),this.currentDirection!==null&&k&&k(this.currentDirection);return}this.updateAxis("x",x.point,C),this.updateAxis("y",x.point,C),this.visualElement.render(),N&&Ht.update(()=>N(g,x),!1,!0)},f=(g,x)=>{this.latestPointerEvent=g,this.latestPanInfo=x,this.stop(g,x),this.latestPointerEvent=null,this.latestPanInfo=null},d=()=>{const{dragSnapToOrigin:g}=this.getProps();(g||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:p}=this.getProps();this.panSession=new O3(t,{onSessionStart:l,onStart:u,onMove:h,onSessionEnd:f,resumeAnimation:d},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:p,distanceThreshold:n,contextWindow:D3(this.visualElement),element:this.visualElement.current})}stop(t,s){const n=t||this.latestPointerEvent,o=s||this.latestPanInfo,l=this.isDragging;if(this.cancel(),!l||!o||!n)return;const{velocity:u}=o;this.startAnimation(u);const{onDragEnd:h}=this.getProps();h&&Ht.postRender(()=>h(n,o))}cancel(){this.isDragging=!1;const{projection:t,animationState:s}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),s&&s.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(t,s,n){const{drag:o}=this.getProps();if(!n||!Fd(t,o,this.currentDirection))return;const l=this.getAxisMotionValue(t);let u=this.originPoint[t]+n[t];this.constraints&&this.constraints[t]&&(u=lI(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=cI(n.layoutBox,t):this.constraints=!1,this.elastic=fI(s),o!==this.constraints&&!el(t)&&n&&this.constraints&&!this.hasMutatedConstraints&&qi(l=>{this.constraints!==!1&&this.getAxisMotionValue(l)&&(this.constraints[l]=hI(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=wB(n,o.root,this.visualElement.getTransformPagePoint());let u=uI(o.layout.layoutBox,l);if(s){const h=s(vB(u));this.hasMutatedConstraints=!!h,h&&(u=s3(h))}return u}startAnimation(t){const{drag:s,dragMomentum:n,dragElastic:o,dragTransition:l,dragSnapToOrigin:u,onDragTransitionEnd:h}=this.getProps(),f=this.constraints||{},d=qi(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 Hx(this.visualElement,t),n.start(kb(t,n,0,s,this.visualElement,!1))}stopAnimation(){qi(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){qi(s=>{const{drag:n}=this.getProps();if(!Fd(s,n,this.currentDirection))return;const{projection:o}=this.visualElement,l=this.getAxisMotionValue(s);if(o&&o.layout){const{min:u,max:h}=o.layout.layoutBox[s],f=l.get()||0;l.set(t[s]-Kt(u,h,.5)+f)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:s}=this.getProps(),{projection:n}=this.visualElement;if(!el(s)||!n||!this.constraints)return;this.stopAnimation();const o={x:0,y:0};qi(u=>{const h=this.getAxisMotionValue(u);if(h&&this.constraints!==!1){const f=h.get();o[u]=dI({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(),qi(u=>{if(!Fd(u,t,null))return;const h=this.getAxisMotionValue(u),{min:f,max:d}=this.constraints[u];h.set(Kt(f,d,o[u]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;mI.set(this.visualElement,this);const t=this.visualElement.current,s=Vc(t,"pointerdown",d=>{const{drag:p,dragListener:g=!0}=this.getProps(),x=d.target,v=x!==t&&Jz(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=gI(t,d.current,()=>this.scalePositionWithinConstraints())))},{projection:l}=this.visualElement,u=l.addEventListener("measure",o);l&&!l.layout&&(l.root&&l.root.updateScroll(),l.updateLayout()),Ht.read(o);const h=su(window,"resize",()=>this.scalePositionWithinConstraints()),f=l.addEventListener("didUpdate",(({delta:d,hasLayoutChanged:p})=>{this.isDragging&&p&&(qi(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=Xx,dragMomentum:h=!0}=t;return{...t,drag:s,dragDirectionLock:n,dragPropagation:o,dragConstraints:l,dragElastic:u,dragMomentum:h}}}function qS(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function gI(e,t,s){const n=Jw(e,qS(s)),o=Jw(t,qS(s));return()=>{n(),o()}}function Fd(e,t,s){return(t===!0||t===e)&&(s===null||s===e)}function xI(e,t=10){let s=null;return Math.abs(e.y)>t?s="y":Math.abs(e.x)>t&&(s="x"),s}class bI extends ya{constructor(t){super(t),this.removeGroupControls=ci,this.removeListeners=ci,this.controls=new pI(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||ci}update(){const{dragControls:t}=this.node.getProps(),{dragControls:s}=this.node.prevProps||{};t!==s&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const pg=e=>(t,s)=>{e&&Ht.update(()=>e(t,s),!1,!0)};class vI extends ya{constructor(){super(...arguments),this.removePointerDownListener=ci}onPointerDown(t){this.session=new O3(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:D3(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:s,onPan:n,onPanEnd:o}=this.node.getProps();return{onSessionStart:pg(t),onStart:pg(s),onMove:pg(n),onEnd:(l,u)=>{delete this.session,o&&Ht.postRender(()=>o(l,u))}}}mount(){this.removePointerDownListener=Vc(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let gg=!1;class _I 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),gg&&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}),gg=!0,o||t.layoutDependency!==s||s===void 0||t.isPresent!==l?u.willUpdate():this.safeToRemove(),t.isPresent!==l&&(l?u.promote():u.relegate()||Ht.postRender(()=>{const h=u.getStack();(!h||!h.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:t,layoutAnchor:s}=this.props,{projection:n}=t;n&&(n.options.layoutAnchor=s,n.root.didUpdate(),jb.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:s,switchLayoutGroup:n}=this.props,{projection:o}=t;gg=!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 z3(e){const[t,s]=EP(),n=_.useContext(ZC);return r.jsx(_I,{...e,layoutGroup:n,switchLayoutGroup:_.useContext(R3),isPresent:t,safeToRemove:s})}const yI={pan:{Feature:vI},drag:{Feature:bI,ProjectionNode:S3,MeasureLayout:z3}};function VS(e,t,s){const{props:n}=e;e.animationState&&n.whileHover&&e.animationState.setActive("whileHover",s==="Start");const o="onHover"+s,l=n[o];l&&Ht.postRender(()=>l(t,hu(t)))}class wI extends ya{mount(){const{current:t}=this.node;t&&(this.unmount=Yz(t,(s,n)=>(VS(this.node,n,"Start"),o=>VS(this.node,o,"End"))))}unmount(){}}class SI extends ya{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=cu(su(this.node.current,"focus",()=>this.onFocus()),su(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function GS(e,t,s){const{props:n}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&n.whileTap&&e.animationState.setActive("whileTap",s==="Start");const o="onTap"+(s==="End"?"":s),l=n[o];l&&Ht.postRender(()=>l(t,hu(t)))}class kI extends ya{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:s,propagate:n}=this.node.props;this.unmount=tB(t,(o,l)=>(GS(this.node,l,"Start"),(u,{success:h})=>GS(this.node,u,h?"End":"Cancel")),{useGlobalTarget:s,stopPropagation:n?.tap===!1})}unmount(){}}const Zx=new WeakMap,xg=new WeakMap,NI=e=>{const t=Zx.get(e.target);t&&t(e)},CI=e=>{e.forEach(NI)};function EI({root:e,...t}){const s=e||document;xg.has(s)||xg.set(s,{});const n=xg.get(s),o=JSON.stringify(t);return n[o]||(n[o]=new IntersectionObserver(CI,{root:e,...t})),n[o]}function jI(e,t,s){const n=EI(t);return Zx.set(e,s),n.observe(e),()=>{Zx.delete(e),n.unobserve(e)}}const AI={some:0,all:1};class TI extends ya{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:AI[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=jI(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(RI(t,s))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}}function RI({viewport:e={}},{viewport:t={}}={}){return s=>e[s]!==t[s]}const MI={inView:{Feature:TI},tap:{Feature:kI},focus:{Feature:SI},hover:{Feature:wI}},DI={layout:{ProjectionNode:S3,MeasureLayout:z3}},OI={...nI,...MI,...yI,...DI},bg=QP(OI,JP),Ye=({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=LI(s),v=d??(s==="outline"?"outline":"solid"),w=e??t,k=!!l,N={primary:{solid:"border border-transparent bg-primary text-primary-foreground dark:border-zinc-700/80 dark:bg-zinc-900/80 dark:text-zinc-100",outline:"border-2 border-primary/60 text-foreground dark:border-zinc-700/80 dark:bg-zinc-900/80 dark:text-zinc-100",subtle:"border border-transparent bg-primary/15 text-foreground dark:border-zinc-700/70 dark:bg-zinc-900/70 dark:text-zinc-200"},secondary:{solid:"border border-transparent bg-secondary text-secondary-foreground dark:border-zinc-700/80 dark:bg-zinc-900/80 dark:text-zinc-200",outline:"border-2 border-border bg-card text-foreground dark:border-zinc-700/80 dark:bg-zinc-900/80 dark:text-zinc-200",subtle:"border border-border bg-muted text-foreground dark:border-zinc-700/70 dark:bg-zinc-900/70 dark:text-zinc-200"},success:{solid:"border border-transparent bg-emerald-600 text-white dark:border-emerald-400/30 dark:bg-emerald-500/15 dark:text-emerald-300",outline:"border-2 border-emerald-600 text-emerald-700 dark:border-emerald-400/40 dark:bg-emerald-500/10 dark:text-emerald-300",subtle:"border border-transparent bg-emerald-500/15 text-emerald-700 dark:border-emerald-400/25 dark:bg-emerald-500/15 dark:text-emerald-300"},warning:{solid:"border border-transparent bg-amber-500 text-white dark:border-amber-400/30 dark:bg-amber-500/15 dark:text-amber-300",outline:"border-2 border-amber-500 text-amber-700 dark:border-amber-400/40 dark:bg-amber-500/10 dark:text-amber-300",subtle:"border border-transparent bg-amber-500/15 text-amber-700 dark:border-amber-400/25 dark:bg-amber-500/15 dark:text-amber-300"},error:{solid:"border border-transparent bg-destructive text-destructive-foreground dark:border-red-400/30 dark:bg-red-500/15 dark:text-red-300",outline:"border-2 border-destructive text-destructive dark:border-red-400/40 dark:bg-red-500/10 dark:text-red-300",subtle:"border border-transparent bg-destructive/20 text-destructive dark:border-red-400/25 dark:bg-red-500/15 dark:text-red-300"}},C={small:"text-xs px-2 py-1",medium:"text-xs px-2.5 py-1",large:"text-sm px-3 py-1.5"},A=T=>{T.stopPropagation(),l?.()},j=T=>{T.stopPropagation(),p?.()};return r.jsxs(bg.div,{initial:{opacity:0,scale:.95,y:8,filter:"blur(8px)"},animate:{opacity:1,scale:1,y:0,filter:"blur(0px)"},transition:{duration:.32,ease:"easeInOut",type:"spring"},whileHover:{scale:k?1.04:1,transition:{duration:.2,ease:"easeInOut",type:"spring"}},onClick:A,style:{maxWidth:f},className:ue("inline-flex max-w-full items-center gap-1.5 rounded-lg font-medium shadow-[0_0_16px_rgba(0,0,0,0.14)] backdrop-blur-sm",N[x][v],C[n],k&&"cursor-pointer",h),children:[g?r.jsx(bg.div,{animate:{rotate:360},transition:{duration:1,ease:"linear",repeat:1/0},className:"flex-shrink-0",children:r.jsx(jt,{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(bg.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(qt,{className:"size-3.5"})})]})};function LI(e){return e==="danger"?"error":e==="default"||e==="outline"?"primary":e}const zI=zC("rounded-lg border p-4 text-sm has-[>svg]:flex has-[>svg]:items-start has-[>svg]:gap-2.5 [&>svg]:mt-0.5 [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"border-border bg-card text-card-foreground",muted:"border-border bg-muted text-muted-foreground",destructive:"border-destructive/40 bg-destructive/10 text-destructive dark:text-red-300"}},defaultVariants:{variant:"default"}});function Qe({className:e,variant:t,...s}){return r.jsx("div",{className:ue(zI({variant:t,className:e})),...s})}function B3({className:e,...t}){return r.jsx("h5",{className:ue("mb-1 font-medium leading-none",e),...t})}function P3({className:e,...t}){return r.jsx("p",{className:ue("leading-5",e),...t})}function Fh(e){return ue("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 ue("flex size-7 shrink-0 items-center justify-center [&_svg]:size-4 [&_svg]:shrink-0",e)}function Vh(e){return ue("max-w-0 overflow-hidden whitespace-nowrap text-left opacity-0 transition-[max-width,opacity] duration-200 group-hover/header-action:max-w-20 group-hover/header-action:opacity-100 group-focus/header-action:max-w-20 group-focus/header-action:opacity-100",e)}function hi({className:e,...t}){return r.jsx("div",{className:ue("rounded-lg border border-border bg-card text-card-foreground",e),...t})}function fi({className:e,...t}){return r.jsx("div",{className:ue("grid gap-1.5 p-4",e),...t})}function mi({className:e,...t}){return r.jsx("h3",{className:ue("text-sm font-semibold tracking-tight",e),...t})}function Ji({className:e,...t}){return r.jsx("p",{className:ue("text-sm text-muted-foreground",e),...t})}function pi({className:e,...t}){return r.jsx("div",{className:ue("p-4 pt-0",e),...t})}const WS=100;function BI(){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>WS&&p.splice(0,p.length-WS),p})}catch{}}),()=>{u.close()}},[]);const l=[...e].reverse();return r.jsxs(hi,{className:"min-w-0 rounded-none border-0 border-b border-border bg-transparent",children:[r.jsxs(fi,{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(Qa,{className:"size-4 text-muted-foreground"}),r.jsx(mi,{children:"Live MCP Tool Calls"}),r.jsx(Ye,{variant:"outline",size:"small",children:e.length})]}),r.jsx(Ye,{variant:"outline",size:"small",icon:r.jsx("span",{className:ue("inline-block size-1.5 rounded-full",s?"animate-pulse bg-emerald-500":"bg-muted-foreground/60")}),children:s?"live":"reconnecting…"})]}),r.jsx(Ji,{className:"text-xs",children:"Streamed from this NoMoreIDE MCP server. Newest at the top."})]}),r.jsx(pi,{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(Ye,{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 PI({agent:e}){return r.jsxs(r.Fragment,{children:[r.jsx(BI,{}),r.jsxs(hi,{className:"min-w-0 rounded-none border-0 bg-transparent",children:[r.jsxs(fi,{className:"border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(mf,{className:"size-4 text-muted-foreground"}),r.jsx(mi,{children:"Recent Projects"})]}),r.jsx(Ye,{variant:"outline",size:"small",children:e.projects.length})]}),r.jsx(Ji,{className:"text-xs",children:"Most recently active projects known to the agent."})]}),r.jsx(pi,{className:"p-0",children:e.projects.length?r.jsx("ul",{className:"divide-y divide-border",children:e.projects.map(t=>r.jsxs("li",{className:ue("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(Ye,{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:II(t.lastSessionModified)}):null]})]},t.path))}):r.jsx("p",{className:"px-3 py-4 text-xs text-muted-foreground",children:"No known projects."})})]})]})}function II(e){const t=Date.parse(e);return Number.isNaN(t)?e:new Date(t).toLocaleString()}function uo({className:e}){return r.jsx("svg",{className:ue("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 bl({className:e}){return r.jsx("svg",{className:ue("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 $I({className:e}){return r.jsx("svg",{className:ue("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 HI=800;function fu({activeHunkIndex:e=0,diff:t}){const s=qI(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>HI;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(J,{onClick:()=>u(!0),size:"sm",type:"button",variant:"outline",children:"Show diff anyway"})]})})}return r.jsx("div",{className:"absolute inset-0 overflow-auto bg-card text-xs leading-6 text-foreground",ref:n,children:r.jsx("div",{className:"min-w-full font-mono",children:s.map((d,p)=>r.jsxs("div",{className:ue("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",KS(s,p)&&d.hunkIndex===e&&"outline outline-1 outline-offset-[-1px] outline-primary/35"),ref:d.hunkIndex!==null&&KS(s,p)?g=>{o.current[d.hunkIndex??0]=g}:void 0,children:[r.jsx(YS,{value:d.oldLine}),r.jsx(YS,{value:d.newLine}),r.jsx("span",{className:"min-w-0 whitespace-pre-wrap break-all px-2",children:d.content||" "})]},`${p}-${d.content}`))})})}function UI(e){const t=[];let s=null;const n=()=>{if(!s)return;const o=s.join(`
|
|
19
|
+
`),l=Bb(o);t.push({path:FI(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 FI(e){const t=/^diff --git a\/(.+?) b\/(.+)$/.exec(e);return t?t[2]:e.replace(/^diff --git /,"")}function Bb(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 qI(e){const t=VI(e);return t.some(s=>s.kind==="hunk")?t.filter(s=>s.kind!=="meta"&&s.kind!=="hunk"):t}function VI(e){let t=null,s=null,n=null;return e.split(`
|
|
22
|
+
`).map(o=>{if(GI(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 KS(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 GI(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 YS({value:e}){return r.jsx("span",{className:ue("select-none border-r border-border/70 px-2 text-right text-muted-foreground",e===null&&"text-transparent"),children:e??"-"})}function WI(){const[e,t]=_.useState([]),[s,n]=_.useState(""),[o,l]=_.useState(null),[u,h]=_.useState(!1),[f,d]=_.useState(null),p=_.useCallback(async()=>{try{const N=await _L();t(N),n(C=>C&&N.some(A=>A.sha===C)?C:N[0]?.sha??""),l(null)}catch(N){l(N instanceof Error?N.message:String(N))}},[]);_.useEffect(()=>{p()},[p]);async function g(){h(!0),d(null);try{const N=await yL("manual snapshot");await p(),n(N.sha),d(`Snapshot ${N.sha.slice(0,7)} created.`)}catch(N){l(N instanceof Error?N.message:String(N))}finally{h(!1)}}async function x(N,C){h(!0),d(null);try{const A=await wL(N,C);await p(),n(A.sha),d(`Snapshot renamed to “${A.label}”.`)}catch(A){l(A instanceof Error?A.message:String(A))}finally{h(!1)}}async function v(N){h(!0),d(null);try{await SL(N),await p(),d(`Snapshot ${N.slice(0,7)} deleted.`)}catch(C){l(C instanceof Error?C.message:String(C))}finally{h(!1)}}async function w(N){h(!0),d(null);try{const C=await CL(N);await p(),d(`Restored ${C.restoredFiles} file(s)`+(C.deletedPaths.length?`, removed ${C.deletedPaths.length} added since`:"")+`. Undo via pre-restore snapshot ${C.preRestore.sha.slice(0,7)}.`)}catch(C){l(C instanceof Error?C.message:String(C))}finally{h(!1)}}const k=e.find(N=>N.sha===s);return r.jsxs("div",{className:"grid h-full min-h-0 overflow-hidden bg-card/85 xl:grid-cols-[320px_minmax(0,1fr)]",children:[r.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden border-r border-border",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-2",children:[r.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-semibold",children:[r.jsx(VR,{className:"size-3.5"}),"Snapshots"]}),r.jsxs(J,{disabled:u,onClick:()=>{g()},size:"sm",type:"button",children:[r.jsx(GN,{className:"size-3.5"}),"Snapshot now"]})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:o?r.jsxs(Qe,{variant:"destructive",className:"m-3",children:[r.jsx(Y0,{}),r.jsxs("div",{className:"min-w-0",children:[r.jsx(B3,{children:"Couldn’t load snapshots"}),r.jsx(P3,{className:"break-words",children:o})]})]}):e.length===0?r.jsx(Qe,{variant:"muted",className:"m-3 border-dashed",children:"No snapshots yet. Take one before risky changes, or let agent sessions create them automatically."}):r.jsx("ul",{children:e.map(N=>r.jsx(KI,{busy:u,onDelete:v,onRename:x,onSelect:n,selected:N.sha===s,snapshot:N},N.ref))})})]}),r.jsxs("section",{className:"flex min-h-0 min-w-0 flex-col",children:[f?r.jsx(Qe,{variant:"muted",className:"m-3 mb-0",children:f}):null,k?r.jsx(YI,{busy:u,onRestore:w,snapshot:k}):r.jsx("div",{className:"p-4",children:r.jsx(Qe,{variant:"muted",className:"border-dashed p-12 text-center",children:"Select a snapshot to compare it with the current working tree."})})]})]})}function KI({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:ue("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(J,{disabled:e,onClick:v,size:"icon-sm",type:"button",variant:"ghost",children:r.jsx(Zs,{className:"size-3.5"})}),r.jsx(J,{onClick:()=>h(!1),size:"icon-sm",type:"button",variant:"ghost",children:r.jsx(qt,{className:"size-3.5"})})]}):r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",onClick:()=>n(l.sha),className:"w-full px-3 py-2 pr-16 text-left",children:[r.jsx("span",{className:"block truncate text-xs font-medium",children:l.label}),r.jsxs("span",{className:"mt-0.5 flex items-center gap-2 text-[10px] text-muted-foreground",children:[r.jsx("span",{className:"font-mono",children:l.sha.slice(0,7)}),r.jsx("span",{children:new Date(l.createdAt).toLocaleString()})]})]}),r.jsx("div",{className:"absolute right-2 top-1.5 flex items-center gap-0.5",children:p?r.jsxs(r.Fragment,{children:[r.jsx(J,{disabled:e,onClick:()=>{g(!1),t(l.sha)},size:"icon-sm",title:"Confirm delete",type:"button",variant:"ghost",className:"text-red-600 hover:text-red-600",children:r.jsx(Zs,{className:"size-3.5"})}),r.jsx(J,{onClick:()=>g(!1),size:"icon-sm",title:"Cancel",type:"button",variant:"ghost",children:r.jsx(qt,{className:"size-3.5"})})]}):r.jsxs("span",{className:"hidden items-center gap-0.5 group-hover:flex",children:[r.jsx(J,{disabled:e,onClick:x,size:"icon-sm",title:"Rename snapshot",type:"button",variant:"ghost",children:r.jsx(ul,{className:"size-3.5"})}),r.jsx(J,{disabled:e,onClick:()=>g(!0),size:"icon-sm",title:"Delete snapshot",type:"button",variant:"ghost",className:"text-muted-foreground hover:text-red-600",children:r.jsx(Ti,{className:"size-3.5"})})]})})]})})}function YI({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),kL(s.sha).then(w=>{v&&(o(w),u(k=>k&&w.some(N=>N.path===k)?k:w[0]?.path??""))}).catch(w=>{v&&p(w instanceof Error?w.message:String(w))}),()=>{v=!1}},[s.sha]),_.useEffect(()=>{if(!l){f("");return}let v=!0;return NL(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(J,{disabled:e,onClick:()=>{x(!1),t(s.sha)},size:"sm",type:"button",variant:"destructive",children:"Confirm restore"}),r.jsx(J,{onClick:()=>x(!1),size:"sm",type:"button",variant:"outline",children:"Cancel"})]}):r.jsxs(J,{disabled:e||n.length===0,onClick:()=>x(!0),size:"sm",title:"Reset the working tree to this snapshot (a pre-restore snapshot is taken first)",type:"button",variant:"outline",children:[r.jsx(pf,{className:"size-3.5"}),"Restore…"]})]}),r.jsx(I3,{diff:h,error:d,files:n,onSelectPath:u,selectedPath:l})]})}function I3({diff:e,error:t,files:s,onSelectPath:n,selectedPath:o}){return t?r.jsx("div",{className:"p-4",children:r.jsxs(Qe,{variant:"destructive",children:[r.jsx(Y0,{}),r.jsxs("div",{className:"min-w-0",children:[r.jsx(B3,{children:"Couldn’t load this snapshot"}),r.jsx(P3,{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:ue("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:ue("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(Qe,{variant:"muted",className:"border-dashed p-8 text-center",children:"Select a file to see how it differs from the snapshot."})})})]})}function XI(){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 EL();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 TL(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(Qe,{variant:"muted",className:"border-dashed p-8 text-center",children:o??"No agent sessions recorded yet. Sessions appear here once an agent calls a nomoreide MCP tool; each one starts with a working-tree snapshot you can roll back to."})}):r.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[u?r.jsx(Qe,{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:ue("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(ZI,{busy:f,id:s,onRestore:g}):null})]})]})}function ZI({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),jL(t).then(N=>{k&&(o(N.session),u(N.files),f(C=>C&&N.files.some(A=>A.path===C)?C:N.files[0]?.path??""))}).catch(N=>{k&&x(N instanceof Error?N.message:String(N))}),()=>{k=!1}},[t]),_.useEffect(()=>{if(!h){p("");return}let k=!0;return AL(t,h).then(N=>{k&&p(N)}).catch(N=>{k&&x(N instanceof Error?N.message:String(N))}),()=>{k=!1}},[t,h]),r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:l.length?`${l.length} file(s) changed since this session started`:"No working-tree changes since this session started"}),r.jsx("p",{className:"truncate text-[10px] text-muted-foreground",children:n?.repoPath??""})]}),n?.snapshotSha?v?r.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[r.jsx(J,{disabled:e,onClick:()=>{w(!1),s(t)},size:"sm",type:"button",variant:"destructive",children:"Confirm restore"}),r.jsx(J,{onClick:()=>w(!1),size:"sm",type:"button",variant:"outline",children:"Cancel"})]}):r.jsxs(J,{disabled:e||l.length===0,onClick:()=>w(!0),size:"sm",title:"Reset the working tree to before this session (a pre-restore snapshot is taken first)",type:"button",variant:"outline",children:[r.jsx(pf,{className:"size-3.5"}),"Restore to before this session…"]}):null]}),r.jsx(I3,{diff:d,error:g,files:l,onSelectPath:f,selectedPath:h})]})}function QI(e){return e==="codex"?{id:e,label:"Codex",commandName:"codex",installHint:"",intro:""}:{id:e,label:"Claude Code",commandName:"claude",installHint:"",intro:""}}function _c(e){return e instanceof Error?e.message:String(e)}function JI(){const[e,t]=_.useState([]),s=_.useRef([]),[n,o]=_.useState(null),l=_.useRef(null),[u,h]=_.useState(0),[f,d]=_.useState(null),[p,g]=_.useState(new Set),x=_.useRef(new Set),[v,w]=_.useState(null),[k,N]=_.useState(null),[C,A]=_.useState([]),j=_.useRef(void 0),T=_.useRef(!0),M=_.useRef(0),O=_.useRef(0),$=_.useRef(0),D=_.useRef(new Map),P=_.useRef(0),B=_.useRef(new Set),G=_.useRef(new Set),F=_.useCallback(q=>[...q].sort((oe,ee)=>{const fe=D.current.get(oe.id),ie=D.current.get(ee.id);return!fe||!ie?fe?1:ie?-1:0:fe.group!==ie.group?fe.group==="attached"?-1:1:fe.index-ie.index}),[]),z=_.useCallback(q=>{s.current=q,t(q)},[]),U=_.useCallback(q=>{l.current=q,o(q)},[]),K=_.useCallback(()=>{if(l.current||P.current>0)return;const q=F(s.current).find(oe=>!B.current.has(oe.id)&&D.current.get(oe.id)?.group==="attached");q&&U(q.id)},[U,F]);_.useEffect(()=>(T.current=!0,()=>{T.current=!1}),[]),_.useEffect(()=>{DC().then(q=>{if(!T.current)return;const oe=q.filter(Re=>Re.kind==="agent"&&!B.current.has(Re.id));oe.forEach((Re,De)=>{D.current.has(Re.id)||D.current.set(Re.id,{group:"attached",index:De})});const ee=new Map(s.current.map(Re=>[Re.id,Re])),fe=oe.map(Re=>{const De=ee.get(Re.id);return De?{...Re,label:De.label??Re.label,source:De.source,createdAt:De.createdAt}:Re}),ie=new Set(fe.map(Re=>Re.id)),Se=[...fe,...s.current.filter(Re=>!ie.has(Re.id))];z(F(Se)),K()}).catch(q=>{T.current&&d(_c(q))})},[K,z,F]),_.useEffect(()=>{const q=$.current;C8().then(oe=>{if(!T.current)return;if(A(oe.providers),$.current===q){w(oe.configured),N(oe.provider),j.current=oe.provider.id;return}const ee=oe.providers.find(fe=>fe.id===j.current);ee&&w(ee.configured)}).catch(()=>{T.current&&$.current===q&&(w(!1),d("Unable to load agent provider status"))})},[]);const I=_.useCallback(async q=>{const oe=++$.current,ee=C.find(fe=>fe.id===q);j.current=q,d(null),N(ee??QI(q)),ee&&w(ee.configured);try{const fe=await E8(q);if(!T.current||$.current!==oe)return;j.current=fe.id,N(fe);const ie=C.find(Se=>Se.id===fe.id);ie&&w(ie.configured)}catch(fe){T.current&&$.current===oe&&d(_c(fe))}},[C]),Z=_.useCallback(async({prompt:q,label:oe,source:ee,background:fe=!1})=>{const ie=++M.current;P.current+=1,fe||(O.current=ie);const Se=Date.now(),Re=j.current??"claude";d(null),h(De=>De+1);try{const De=await DL({provider:Re,prompt:q,label:oe});if(!T.current||B.current.has(De.id))return;const Je={...De,label:De.label??oe,source:ee,createdAt:Se,initialPrompt:q};D.current.set(Je.id,{group:"created",index:ie});const Ne=s.current.filter(Ue=>Ue.id!==Je.id);return z(F([...Ne,Je])),!fe&&O.current===ie&&U(Je.id),Je}catch(De){T.current&&d(_c(De));return}finally{P.current=Math.max(0,P.current-1),T.current&&P.current===0&&K(),T.current&&h(De=>Math.max(0,De-1))}},[K,U,z,F]),W=_.useCallback(async q=>{if(!x.current.has(q)){x.current.add(q),g(new Set(x.current)),B.current.add(q);try{if(await Cx(q),!T.current)return;const oe=s.current,ee=oe.findIndex(ie=>ie.id===q),fe=oe.filter(ie=>ie.id!==q);if(D.current.delete(q),z(fe),l.current===q){const ie=fe[Math.min(Math.max(ee,0),fe.length-1)];U(ie?.id??null)}}catch(oe){const ee=s.current,fe=ee.findIndex(ie=>ie.id===q);if(ee[fe]?.state==="exited"){const ie=ee.filter(Se=>Se.id!==q);if(D.current.delete(q),z(ie),l.current===q){const Se=ie[Math.min(Math.max(fe,0),ie.length-1)];U(Se?.id??null)}return}B.current.delete(q),T.current&&d(_c(oe))}finally{x.current.delete(q),T.current&&g(new Set(x.current))}}},[U,z]),te=_.useCallback(async q=>{if(!x.current.has(q)){x.current.add(q),g(new Set(x.current)),d(null);try{if(await Cx(q),!T.current)return;const oe=s.current.map(ee=>ee.id===q?{...ee,state:"exited"}:ee);z(oe)}catch(oe){T.current&&d(_c(oe))}finally{x.current.delete(q),T.current&&g(new Set(x.current))}}},[z]),X=_.useCallback((q,oe)=>{const ee=s.current.map(fe=>fe.id===q?{...fe,...oe,id:q}:fe);z(ee)},[z]),V=_.useCallback(q=>{if(G.current.has(q))return;const oe=s.current.find(ee=>ee.id===q)?.initialPrompt;if(oe)return G.current.add(q),oe},[]);return{tasks:e,activeTaskId:n,setActiveTaskId:U,creating:u,terminalError:f,pendingTaskIds:p,error:f,provider:k,configured:v,providers:C,selectProvider:I,createTask:Z,closeTask:W,stopTask:te,updateTaskStatus:X,claimInitialPrompt:V}}const $3=_.createContext(null);function e$({children:e}){const t=JI(),[s,n]=_.useState(!1),[o,l]=_.useState(""),[u,h]=_.useState(null),[f,d]=_.useState(0),[p,g]=_.useState(!1),x=_.useCallback(()=>d(A=>A+1),[]),v=_.useCallback(()=>h(null),[]),w=_.useCallback(()=>{n(!0),g(!0)},[]),k=_.useCallback(A=>{n(!0),l(j=>j.trim()?`${j.replace(/\s*$/,"")}
|
|
23
|
+
${A}`:A),x()},[x]),N=_.useCallback(({prompt:A,source:j,mode:T="send",label:M,background:O})=>T==="draft"?(n(!0),h(j??null),l(A),x(),{queued:!1}):(O||(n(!0),h(j??null)),t.createTask({prompt:A,label:M,source:j,background:O}),{queued:!1}),[t.createTask,x]),C={...t,open:s,setOpen:n,draft:o,setDraft:l,insertPath:k,activeSource:u,clearSource:v,focusNonce:f,sendToAgent:N,onboarding:p,setOnboarding:g,startOnboard:w};return r.jsx($3.Provider,{value:C,children:e})}function At(){const e=_.useContext($3);if(!e)throw new Error("useAgentDock must be used within an AgentProvider");return e}function t$({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(hi,{className:"min-w-0 rounded-none border-0 bg-transparent",children:[r.jsxs(fi,{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(VN,{className:"size-4 text-muted-foreground"}),r.jsx(mi,{children:"Project Memory"})]}),r.jsx(Ye,{variant:"outline",size:"small",children:o})]}),r.jsx(Ji,{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(pi,{className:"space-y-2 p-3",children:[s?r.jsx(XS,{title:s,preview:n,defaultOpen:!0}):null,e.project.memoryFiles.length?e.project.memoryFiles.map(l=>r.jsx(XS,{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 XS({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(Wn,{className:ue("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 s$=[{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%)"}],n$=({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:s$.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))})}),i$=[{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"}],r$={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"},a$={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:Qc("flex items-center justify-center gap-0.5 duration-150",i$[+o][e],p||d?"cursor-not-allowed border border-gray-400 bg-gray-100 text-gray-700":r$[t],a$[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(n$,{size:e==="large"?24:16}):u,r.jsx("span",{className:Qc("relative overflow-hidden overflow-ellipsis whitespace-nowrap font-sans",e!=="tiny"&&s!=="unstyled"&&"px-1.5"),children:l}),!d&&h]}),o$=({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"})}),l$=()=>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 vg=null,c$=0;const ks={toasts:[],listeners:new Set,add(e,t,s,n,o,l){const u=c$++,h={id:u,text:e,preserve:s,action:n,onAction:o,onUndoAction:l,type:t};if(!h.preserve){h.remaining=3e3,h.start=Date.now();const f=()=>{this.toasts=this.toasts.filter(d=>d.id!==u),this.notify()};h.timeout=setTimeout(f,h.remaining),h.pause=()=>{h.timeout&&(clearTimeout(h.timeout),h.timeout=void 0,h.remaining-=Date.now()-h.start)},h.resume=()=>{h.timeout||(h.start=Date.now(),h.timeout=setTimeout(f,h.remaining))}}this.toasts.push(h),this.notify()},remove(e){ks.toasts=ks.toasts.filter(t=>t.id!==e),ks.notify()},subscribe(e){return ks.listeners.add(e),()=>{ks.listeners.delete(e)}},notify(){ks.listeners.forEach(e=>{e()})}},u$=()=>{const[e,t]=_.useState([]),[s,n]=_.useState([]),[o,l]=_.useState(!1),u=w=>k=>{k&&w.measuredHeight==null&&(w.measuredHeight=k.getBoundingClientRect().height,ks.notify())};_.useEffect(()=>(t([...ks.toasts]),ks.subscribe(()=>{t([...ks.toasts])})),[]),_.useEffect(()=>{const w=e.filter(k=>!s.includes(k.id)).map(k=>k.id);w.length>0&&requestAnimationFrame(()=>{n(k=>[...k,...w])})},[s,e]);const f=Math.max(0,e.length-3),d=(w,k)=>{if(w===k-1)return"none";const N=k-1-w;let C=e[k-1]?.measuredHeight||63;for(let T=k-1;T>w;T--)o?C+=(e[T-1]?.measuredHeight||63)+10:C+=20;const A=-N,j=o?1:1-.05*N;return`translate3d(0, calc(100% - ${C}px), ${A}px) scale(${j})`},p=()=>{l(!0),ks.toasts.forEach(w=>{w.pause?.()})},g=()=>{l(!1),ks.toasts.forEach(w=>{w.resume?.()})},v=e.slice(f).reduce((w,k)=>w+(k.measuredHeight??63),0);return r.jsx("div",{className:"pointer-events-none fixed bottom-4 right-4 z-[9999] w-[min(420px,calc(100vw-2rem))]",style:{height:v},children:r.jsx("div",{className:"pointer-events-auto relative w-full",style:{height:v},onMouseEnter:p,onMouseLeave:g,children:e.map((w,k)=>{const N=k>=f;return r.jsx("div",{ref:u(w),className:Qc("absolute bottom-0 right-0 h-fit rounded-xl p-4 leading-[21px] shadow-menu",{message:"bg-geist-background text-gray-1000",success:"bg-blue-700 text-contrast-fg",warning:"bg-amber-800 text-gray-1000 dark:text-gray-100",error:"bg-red-800 text-contrast-fg"}[w.type],N?"opacity-100":"opacity-0",k<f&&"pointer-events-none"),style:{width:"100%",transition:"all .35s cubic-bezier(.25,.75,.6,.98)",transform:s.includes(w.id)?d(k,e.length):"translate3d(0, 100%, 150px) scale(1)"},children: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?.(),ks.remove(w.id)},children:r.jsx(l$,{})}),r.jsx(qd,{type:"tertiary",svgOnly:!0,size:"small",onClick:()=>ks.remove(w.id),children:r.jsx(o$,{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:()=>ks.remove(w.id),children:"Dismiss"}),r.jsx(qd,{type:"primary",size:"small",onClick:()=>{w.onAction?.(),ks.remove(w.id)},children:w.action})]})]})},w.id)})})})},Vd=()=>{if(vg)return;const e=document.createElement("div");e.className="fixed bottom-4 right-4 z-[9999]",document.body.appendChild(e),vg=UN.createRoot(e),vg.render(r.jsx(u$,{}))},as=()=>({message:_.useCallback(({text:e,preserve:t,action:s,onAction:n,onUndoAction:o})=>{Vd(),ks.add(e,"message",t,s,n,o)},[]),success:_.useCallback(e=>{Vd(),ks.add(e,"success")},[]),warning:_.useCallback(e=>{Vd(),ks.add(e,"warning")},[]),error:_.useCallback(e=>{Vd(),ks.add(e,"error")},[])});function d$({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(uo,{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(H3,{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(sn,{label:"Input",value:cn(e.inputTokens)}),r.jsx(sn,{label:"Output",value:cn(e.outputTokens)}),r.jsx(sn,{label:"Cache read",value:cn(e.cacheReadInputTokens)}),r.jsx(sn,{label:"Cache create",value:cn(e.cacheCreationInputTokens)}),r.jsx(sn,{label:"Lines +",value:String(e.linesAdded)}),r.jsx(sn,{label:"Lines −",value:String(e.linesRemoved)}),r.jsx(sn,{label:"Wall",value:ZS(e.durationMs)}),r.jsx(sn,{label:"API",value:ZS(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:[cn(s.inputTokens+s.outputTokens)," tok ·"," ",r.jsxs("span",{className:"text-emerald-700",children:["$",s.costUSD.toFixed(4)]})]})]},s.model))]}):null]})}function h$({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(bl,{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(H3,{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(sn,{label:"Input",value:cn(e.inputTokens)}),r.jsx(sn,{label:"Output",value:cn(e.outputTokens)}),r.jsx(sn,{label:"Cache read",value:cn(e.cachedInputTokens)}),r.jsx(sn,{label:"Reasoning",value:cn(e.reasoningOutputTokens)}),r.jsx(sn,{label:"Total",value:cn(e.totalTokens)}),r.jsx(sn,{label:"Last turn",value:cn(e.lastTotalTokens)}),r.jsx(sn,{label:"Context",value:e.contextWindow?cn(e.contextWindow):"n/a"}),r.jsx(sn,{label:"Cost",value:"n/a"})]}),e.contextWindow?r.jsx("div",{className:"border-t border-border px-3 py-2",children:r.jsx(f$,{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 H3({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:[cn(s)," in · ",cn(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:ue("h-full",o.className),style:{width:`${(o.value/t*100).toFixed(2)}%`},title:`${o.label}: ${cn(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:ue("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 f$({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:ue("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:ue("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 sn({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 cn(e){return e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function ZS(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 m$(e=1e4){const[t,s]=_.useState(null),[n,o]=_.useState(null);return _.useEffect(()=>{let l=!0;const u=()=>{v8().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 p$={"claude-code":{label:"Claude Code",icon:r.jsx(uo,{})},codex:{label:"Codex",icon:r.jsx(bl,{})}};function g$({agent:e,agentId:t,isDetected:s}){const{usage:n,error:o}=m$(),l=p$[t],u=t==="codex";return r.jsxs(hi,{className:"min-w-0 rounded-none border-0 bg-transparent",children:[r.jsxs(fi,{className:"border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx(tC,{className:"size-4 text-muted-foreground"}),r.jsx(mi,{children:u?"Token Usage & Rate Limits":"Token & Cost Usage"}),r.jsx(Ye,{variant:"outline",size:"small",icon:l.icon,children:l.label}),s?r.jsx(Ye,{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(x$,{className:"ml-auto"})]}),r.jsxs(Ji,{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(pi,{className:"p-3",children:[o?r.jsx("p",{className:"text-xs text-destructive",children:o}):null,u?n?.codex?r.jsx(h$,{usage:n.codex}):o?null:r.jsx(QS,{agent:"Codex CLI"}):n?.claude?r.jsx(d$,{usage:n.claude}):o?null:r.jsx(QS,{agent:"Claude Code"})]})]})}function x$({className:e}){const[t,s]=_.useState(!0),[n,o]=_.useState(!0),[l,u]=_.useState(!1),h=as();_.useEffect(()=>{let d=!0;return y8().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 w8({coAuthorWithClaude:d});s(p.coAuthorWithClaude),h.success(p.coAuthorWithClaude?"Claude co-author trailer enabled for commits":"Claude co-author trailer disabled for commits")}catch(p){s(!d),h.error(p instanceof Error?p.message:"Failed to update setting")}finally{u(!1)}};return r.jsxs(J,{type:"button",variant:t?"default":"outline",size:"sm",onClick: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:ue("gap-1.5",e),children:[r.jsx(uo,{className:"size-3.5"}),"Co-author"]})}function QS({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 JS=["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
|
+
`),b$=["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 v$(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 _$(e){return e.map(t=>`- ${t.name}: ${t.dataType}${t.primaryKey?" (PK)":""}${t.nullable?"":" NOT NULL"}`).join(`
|
|
27
|
+
`)}function U3(e){return e?.length?["## Table schema",_$(e),""].join(`
|
|
28
|
+
`):""}const F3="Your prompt: ";function y$(e,t,s,n,o){return[`I'm looking at a row in my ${t} database (connection "${e}", table \`${s.qualifiedName}\`).`,"",U3(n),"## Row","```json",JSON.stringify(o,null,2),"```","",F3].join(`
|
|
29
|
+
`)}function e2(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=U3(s?.columns);return l&&o.push(l),o.push(F3),o.join(`
|
|
30
|
+
`)}function w$(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 S$(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 k$({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 N$(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 C$(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 E$(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 j$(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 A$(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 T$(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 q3(e){return`Pull request #${e.number} — "${e.title}" (${e.head.ref} → ${e.base.ref}, by ${e.user.login}):`}function R$(e,t){return[q3(e),"",t,"",`Pull the diff with \`gh pr diff ${e.number}\` (or your GitHub tools) if you need it.`].join(`
|
|
42
|
+
`)}function M$(e,t,s){return[q3(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 D$(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 O$(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 L$({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 t2(){return{serviceNames:[],databaseNames:[],errorIds:[],repositoryPaths:[]}}function z$(e){return e.serviceNames.length>0||e.databaseNames.length>0||e.errorIds.length>0||e.repositoryPaths.length>0}function B$({dashboard:e,databases:t,incidents:s,note:n,selection:o}){const l=[I$(e,o.serviceNames),$$(t,o.databaseNames),H$(s,o.errorIds),U$(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 P$({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 I$(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 $$(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 H$(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 U$(e,t){if(!t.length)return null;const s=F$(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 F$(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 Nf(e){return e==="codex"?"Codex":"Claude Code"}function q$(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 ${Nf(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 V$(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 G$(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 W$(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 ${Nf(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 K$(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 Y$(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 X$(e,t){return[`Install a plugin for ${Nf(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 Z$(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 Q$(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 J$(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 ${Nf(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 eH(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 tH(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 V3({id:e,className:t}){return e==="codex"?r.jsx(bl,{className:ue("text-foreground",t)}):e==="gemini"?r.jsx($I,{className:ue("text-[#1A73E8]",t)}):r.jsx(uo,{className:ue("text-[#D97757]",t)})}function Ft({className:e}){const{provider:t}=At();return r.jsx(V3,{id:t?.id,className:e})}function Zi({onAsk:e,label:t,className:s}){const{provider:n}=At(),o=t??`Ask ${n?.label??"Claude"}`;return r.jsx("button",{"aria-label":o,className:ue("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(V3,{id:n?.id,className:"size-3.5"})})}function Tr({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:ue("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(Zi,{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(J,{type:"submit",size:"icon",className:"size-6",disabled:!o.trim(),title:"Send",children:r.jsx(Zs,{className:"size-3.5"})}),r.jsx(J,{type:"button",size:"icon",variant:"ghost",className:"size-6",onClick:s,"aria-label":"Cancel",title:"Cancel",children:r.jsx(qt,{className:"size-3.5"})})]})}function Cf({label:e,onClick:t}){return r.jsxs(J,{type:"button",variant:"ghost",size:"sm",className:"h-6 gap-1 px-1.5 text-[11px] font-medium",onClick:t,title:e,"aria-label":e,children:[r.jsx(ps,{className:"size-3.5"}),"Add"]})}function Ef({askLabel:e,removeLabel:t,onAsk:s,onRemove:n}){return r.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[r.jsx(Zi,{label:e,onAsk:s}),r.jsx(sH,{label:t,onConfirm:n})]})}function sH({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(Zs,{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(qt,{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(Ti,{className:"size-3.5"})})}function nH({agent:e,agentId:t,alternateHooks:s}){const{sendToAgent:n}=At(),[o,l]=_.useState(!1),u=e.hooks??[];function h(p){l(!1),n({prompt:J$(t,p),source:{type:"agent-hook",label:"New hook"},label:`Add hook: ${p}`})}function f(p){n({prompt:tH(p),source:{type:"agent-hook",label:`${p.event} hook`},mode:"draft"})}function d(p){n({prompt:eH(p),source:{type:"agent-hook",label:`Remove ${p.event}`},label:`Remove hook: ${p.event}`})}return r.jsxs(hi,{className:"min-w-0 rounded-none border-0 border-t border-border bg-transparent md:border-l lg:border-t-0",children:[r.jsxs(fi,{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(R6,{className:"size-4 text-muted-foreground"}),r.jsx(mi,{children:"Hooks"})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(Ye,{variant:"outline",size:"small",children:u.length}),r.jsx(Cf,{label:"Add a hook with AI",onClick:()=>l(p=>!p)})]})]}),o?r.jsx(Tr,{className:"mt-1.5",placeholder:"Describe the event, matcher, and command…",onSubmit:h,onCancel:()=>l(!1)}):r.jsx(Ji,{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(pi,{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(Ef,{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(rH,{hook:p}),r.jsx(aH,{hook:p}),r.jsx(Ye,{variant:"outline",size:"small",children:p.scope})]})]}),r.jsx("div",{className:"mt-1 truncate font-mono text-[11px] text-muted-foreground",title:s2(p),children:s2(p)})]},p.id))}):r.jsx(iH,{agentId:t,alternateHooks:s})})]})}function iH({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 rH({hook:e}){return e.status==="enabled"?r.jsx(Ye,{variant:"success",appearance:"subtle",size:"small",children:"Enabled"}):e.status==="disabled"?r.jsx(Ye,{variant:"error",appearance:"subtle",size:"small",children:"Disabled"}):r.jsx(Ye,{variant:"warning",appearance:"subtle",size:"small",children:"Default"})}function aH({hook:e}){return e.trusted===void 0?null:r.jsx(Ye,{variant:e.trusted?"success":"warning",appearance:"subtle",size:"small",children:e.trusted?"Trusted":"Untrusted"})}function oH(e){return e.command?e.command:e.type??e.settingsPath}function s2(e){return`${e.matcher?`matcher ${e.matcher} · `:""}${oH(e)}`}function lH({agent:e,agentId:t}){const{sendToAgent:s}=At(),[n,o]=_.useState([]),[l,u]=_.useState(!1),[h,f]=_.useState(!1),d=_.useCallback(async()=>{u(!0);try{o(await b8(t))}catch{o([])}finally{u(!1)}},[t]);_.useEffect(()=>{d()},[d]);const p=_.useMemo(()=>{const k={};for(const N of n)k[N.name]=N.state;return k},[n]),g=_.useMemo(()=>{const k=new Set(e.mcpServers.map(C=>C.name)),N=n.filter(C=>!k.has(C.name)).map(C=>({name:C.name,scope:"user",synthetic:!0}));return[...e.mcpServers,...N]},[e.mcpServers,n]);function x(k){f(!1),s({prompt:W$(t,k),source:{type:"agent-mcp",label:"New MCP server"},label:`Add MCP server: ${k}`})}function v(k){s({prompt:Y$(k),source:{type:"agent-mcp",label:`${k.name} server`},mode:"draft"})}function w(k){s({prompt:K$(k,t),source:{type:"agent-mcp",label:`Remove ${k.name}`},label:`Remove MCP server: ${k.name}`})}return r.jsxs(hi,{className:"min-w-0 rounded-none border-0 bg-transparent md:border-l md:border-border",children:[r.jsxs(fi,{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(oC,{className:"size-4 text-muted-foreground"}),r.jsx(mi,{children:"MCP Servers"})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(Ye,{variant:"outline",size:"small",children:g.length}),r.jsx(J,{type:"button",variant:"ghost",size:"icon",className:"size-6",onClick:()=>{d()},disabled:l,title:"Re-check authentication status","aria-label":"Re-check authentication status",children:r.jsx(Ar,{className:l?"animate-spin":void 0})}),r.jsx(Cf,{label:"Register an MCP server with AI",onClick:()=>f(k=>!k)})]})]}),h?r.jsx(Tr,{className:"mt-1.5",placeholder:"Paste the MCP install command or URL…",onSubmit:x,onCancel:()=>f(!1)}):r.jsxs(Ji,{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(pi,{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(Ef,{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(uH,{state:p[k.name],loading:l}),r.jsx(Ye,{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":n2(k),children:k.synthetic?"claude.ai managed connector":n2(k)})]},`${k.scope}:${k.name}`))}):r.jsx("p",{className:"px-3 py-4 text-xs text-muted-foreground",children:"No MCP servers configured."})})]})}const cH={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 uH({state:e,loading:t}){if(!e)return t?r.jsx(jt,{className:"size-3 animate-spin text-muted-foreground"}):null;const s=e==="unknown"?void 0:cH[e];return s?r.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[r.jsx("span",{className:ue("size-1.5 shrink-0 rounded-full",s.dot),"aria-hidden":!0}),s.label]}):null}function n2(e){return e.command?[e.command,...e.args??[]].join(" "):e.url??e.type??"-"}function dH({agent:e,agentId:t}){const{sendToAgent:s}=At(),[n,o]=_.useState(!1),l=e.plugins??[];function u(d){o(!1),s({prompt:X$(t,d),source:{type:"agent-plugin",label:"New plugin"},label:`Install plugin: ${d}`})}function h(d){s({prompt:Q$(d),source:{type:"agent-plugin",label:`${d.name} plugin`},mode:"draft"})}function f(d){s({prompt:Z$(d),source:{type:"agent-plugin",label:`Remove ${d.name}`},label:`Uninstall plugin: ${d.name}`})}return r.jsxs(hi,{className:"min-w-0 rounded-none border-0 border-t border-border bg-transparent lg:border-l lg:border-t-0",children:[r.jsxs(fi,{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(k4,{className:"size-4 text-muted-foreground"}),r.jsx(mi,{children:"Plugins"})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(Ye,{variant:"outline",size:"small",children:l.length}),r.jsx(Cf,{label:"Install a plugin with AI",onClick:()=>o(d=>!d)})]})]}),n?r.jsx(Tr,{className:"mt-1.5",placeholder:"Paste a plugin name, marketplace, or install command…",onSubmit:u,onCancel:()=>o(!1)}):r.jsx(Ji,{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(pi,{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(Ef,{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(Ye,{variant:"outline",size:"small",children:["v",d.version]}):null,d.marketplace?r.jsx(Ye,{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(hH,{plugin:d})]},`${d.name}@${d.marketplace??""}`))}):r.jsx("p",{className:"px-3 py-4 text-xs text-muted-foreground",children:"No plugins installed."})})]})}function hH({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 fH({agent:e,agentId:t}){const{sendToAgent:s}=At(),[n,o]=_.useState(!1);function l(f){o(!1),s({prompt:q$(t,f),source:{type:"agent-skill",label:"New skill"},label:`Add skill: ${f}`})}function u(f){s({prompt:G$(f),source:{type:"agent-skill",label:`${f.name} skill`},mode:"draft"})}function h(f){s({prompt:V$(f),source:{type:"agent-skill",label:`Remove ${f.name}`},label:`Remove skill: ${f.name}`})}return r.jsxs(hi,{className:"min-w-0 rounded-none border-0 bg-transparent",children:[r.jsxs(fi,{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(Yi,{className:"size-4 text-muted-foreground"}),r.jsx(mi,{children:"Skills"})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(Ye,{variant:"outline",size:"small",children:e.skills.length}),r.jsx(Cf,{label:"Add a skill with AI",onClick:()=>o(f=>!f)})]})]}),n?r.jsx(Tr,{className:"mt-1.5",placeholder:"Paste a skill URL/repo, or describe the skill…",onSubmit:l,onCancel:()=>o(!1)}):r.jsx(Ji,{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(pi,{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(Ef,{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(Ye,{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 mH({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(fH,{agent:e,agentId:t}),r.jsx(lH,{agent:e,agentId:t}),r.jsx(dH,{agent:e,agentId:t}),r.jsx(nH,{agent:e,agentId:t,alternateHooks:s})]})}function pH(e=3e4){const[t,s]=_.useState(null),[n,o]=_.useState(null),[l,u]=_.useState(!0),h=_.useCallback(async()=>{try{s(await _8()),o(null)}catch(f){o(f instanceof Error?f.message:String(f))}finally{u(!1)}},[]);return _.useEffect(()=>{h();const f=window.setInterval(()=>{h()},e);return()=>window.clearInterval(f)},[h,e]),{data:t,error:n,loading:l,refresh:h}}function gH(){const{data:e,error:t,loading:s}=pH();if(s&&!e)return r.jsx(Kd,{children:r.jsx(Qe,{variant:"muted",children:"Loading usage history…"})});if(t)return r.jsx(Kd,{children:r.jsxs(Qe,{variant:"muted",className:"border-destructive/40 text-destructive",children:["Failed to load usage history: ",t]})});const n=e?.summary;return!n||n.runs===0&&n.codexTotalTokens===0?r.jsx(Kd,{children:r.jsx(Qe,{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:i2(n.totalTokens)}),r.jsx(Yd,{label:"Codex tokens",value:i2(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(xH,{days:n.byDay})]}):null,r.jsx(bH,{summary:n})]})}function xH({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 bH({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 i2(e){return e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}const vH=[{id:"claude-code",chatId:"claude",label:"Claude Code",icon:r.jsx(uo,{className:"size-4"})},{id:"codex",chatId:"codex",label:"Codex",icon:r.jsx(bl,{className:"size-4"})}],_H=[{id:"overview",label:"Overview",icon:r.jsx(tC,{className:"size-3.5"})},{id:"memory",label:"Memory",icon:r.jsx(VN,{className:"size-3.5"})},{id:"tools",label:"Skills, MCPs, Plugins & Hooks",icon:r.jsx(oC,{className:"size-3.5"})},{id:"activity",label:"Activity",icon:r.jsx(Qa,{className:"size-3.5"})},{id:"changes",label:"Changes",icon:r.jsx(QN,{className:"size-3.5"})},{id:"usage",label:"Usage",icon:r.jsx(aR,{className:"size-3.5"})}];function yH({focusChanges:e}={}){const[t,s]=_.useState(null),[n,o]=_.useState(null),[l,u]=_.useState("claude-code"),[h,f]=_.useState("overview"),{provider:d,providers:p,selectProvider:g}=At();_.useEffect(()=>{e&&f("changes")},[e]);function x(k,N){u(k),d?.id!==N&&g(N)}if(_.useEffect(()=>{d&&u(d.id==="codex"?"codex":"claude-code")},[d]),_.useEffect(()=>{let k=!0;return vC().then(N=>{k&&s(N)}).catch(N=>{k&&o(N instanceof Error?N.message:String(N))}),()=>{k=!1}},[]),n)return r.jsx("div",{className:"h-full overflow-auto bg-card/85 p-4",children:r.jsxs(Qe,{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(Qe,{variant:"muted",children:"Loading agent info…"})});const v=t.agents?.[l]??t,w=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:vH.map(k=>{const N=l===k.id,C=t.detected.name===k.id,A=d?.id===k.chatId,T=p.find(M=>M.id===k.chatId)?.configured??!0;return r.jsxs("button",{type:"button",onClick:()=>x(k.id,k.chatId),title:T?`Use ${k.label} for chat`:`${k.label} CLI isn't installed`,className:ue("flex items-center gap-2 rounded-lg border px-3 py-1.5 text-xs font-medium transition-colors",N?"border-border bg-background text-foreground shadow-sm":"border-transparent text-muted-foreground hover:bg-muted/60 hover:text-foreground",!T&&"opacity-60"),children:[k.icon,k.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"}):C?r.jsx("span",{className:"size-1.5 rounded-full bg-emerald-500",title:"Detected agent","aria-hidden":!0}):T?null:r.jsx("span",{className:"text-[10px] font-normal text-muted-foreground",children:"not installed"})]},k.id)})}),r.jsx("div",{className:"flex shrink-0 items-center gap-1 border-b border-border bg-card/90 px-3",children:_H.map(k=>r.jsxs("button",{type:"button",onClick:()=>f(k.id),className:ue("relative flex items-center gap-1.5 px-2.5 py-2 text-xs font-medium transition-colors",h===k.id?"text-foreground":"text-muted-foreground hover:text-foreground"),children:[k.icon,k.label,h===k.id?r.jsx("span",{className:"absolute inset-x-1 -bottom-px h-0.5 bg-primary"}):null]},k.id))}),r.jsxs("div",{className:"min-h-0 flex-1 overflow-auto",children:[h==="overview"?r.jsx(g$,{agent:v,agentId:l,isDetected:t.detected.name===l}):null,h==="memory"?r.jsx(t$,{agent:v,agentId:l}):null,h==="tools"?r.jsx(mH,{agent:v,agentId:l,alternateHooks:w}):null,h==="activity"?r.jsx(PI,{agent:v,agentId:l}):null,h==="changes"?r.jsx(XI,{}):null,h==="usage"?r.jsx(gH,{}):null]})]})}const G3=_.createContext(null);function wH(){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 SH({value:e,children:t}){return r.jsx(G3.Provider,{value:e,children:t})}function vl(e){const t=_.useContext(G3),s=_.useRef(e);s.current=e,_.useEffect(()=>{if(t)return t.register(()=>s.current())},[t])}var Rr=HN();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:ue("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(YN,{className:"size-3.5"})}),n?Rr.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 io={claude:"Claude Code",codex:"Codex CLI",antigravity:"Antigravity"},kH=["claude","codex","antigravity"];function NH({availability:e,config:t,onStage:s}){const n=[...Object.entries(t.mcpServers).map(([l,u])=>({name:l,detail:a2(u),remote:!1})),...Object.entries(t.remoteMcpServers).map(([l,u])=>({name:l,detail:o2(u),remote:!0}))],o=[...Object.entries(t.projectMcpServers).map(([l,u])=>({name:l,detail:a2(u),remote:!1})),...Object.entries(t.projectRemoteMcpServers).map(([l,u])=>({name:l,detail:o2(u),remote:!0}))];return r.jsxs(hi,{className:"flex min-h-0 flex-col",children:[r.jsxs(fi,{className:"shrink-0",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx(mi,{children:io[t.agent]}),e?r.jsx(Ye,{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(pi,{className:"min-h-0 flex-1 space-y-4 overflow-y-auto",children:[r.jsx(r2,{agent:t.agent,label:"MCP servers",mcps:n,onStage:s,scope:"user"}),o.length>0?r.jsx(r2,{agent:t.agent,label:"Project MCP servers",mcps:o,onStage:s,scope:"project"}):null,r.jsx(CH,{agent:t.agent,onStage:s,skills:t.skills})]})]})}function W3(e,t,s){const n=kH.filter(o=>o!==e.sourceAgent);return[...n.map(o=>({label:`Copy to ${io[o]}`,onSelect:()=>t({...e,action:"copy",targetAgent:o,targetScope:s(o)})})),...n.map(o=>({label:`Move to ${io[o]}`,onSelect:()=>t({...e,action:"move",targetAgent:o,targetScope:s(o)})})),{label:"Remove",onSelect:()=>t({...e,action:"remove"})}]}function r2({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(nC,{}):r.jsx(rb,{})}),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:W3({category:"mcp",name:l.name,sourceAgent:e,sourceScope:n},o,()=>n)}):null]},l.name))})]})}function CH({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(AM,{}):r.jsx(Yi,{})}),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(Ye,{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:W3({category:"skill",name:n.name,sourceAgent:e,sourceScope:n.scope},s,o=>o==="claude"?n.scope:"user")}):null]},`${n.scope}:${n.name}`))})]})}function a2(e){return[e.command,...e.args??[]].join(" ").trim()||"(no command)"}function o2(e){return`${e.transport} · ${e.url}`}function jf({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 Rr.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(J,{disabled:u,onClick:f,size:"sm",type:"button",variant:"outline",children:n}),r.jsx(J,{disabled:u,onClick:h,size:"sm",type:"button",variant:d,children:s})]})]})}),document.body)}function EH({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(jf,{confirmLabel:t?"Applying...":`Apply ${h} item${h===1?"":"s"}`,icon:r.jsx(Xc,{}),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 ",io[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(Ye,{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(Er,{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(Er,{className:"size-3 shrink-0"}),"Unfilled credentials applied as placeholders:"," ",l.unresolvedCredentials.join(", ")]}):null]}),onCancel:o,onConfirm:n,title:`Apply profile to ${io[l.agent]}`,tone:"success"})}function l2(e){return e.trim().toLowerCase().replace(/[\s_]+/g,"-").replace(/[^a-z0-9.-]/g,"").replace(/-+/g,"-").replace(/^[-.]+|[-.]+$/g,"")}function jH({profileName:e,busy:t,onConfirm:s,onCancel:n}){const[o,l]=_.useState(l2(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(jf,{confirmLabel:t?"Publishing...":"Publish",icon:r.jsx(WN,{}),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(l2(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 c2=["claude","codex","antigravity"];function AH({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),N=()=>{const C=x.trim();C&&(n(p,C),v(""))};return r.jsxs("div",{className:"flex min-w-0 flex-col",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(sw,{className:"size-3.5 text-muted-foreground"}),"Profiles",e.length>0?r.jsx(Ye,{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:C=>g(C.target.value),value:p,children:c2.map(C=>r.jsx("option",{value:C,children:io[C]},C))}),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:C=>v(C.target.value),onKeyDown:C=>{C.key==="Enter"&&N()},placeholder:"profile name",value:x}),r.jsxs(J,{disabled:s||x.trim().length===0,onClick:N,size:"sm",variant:"outline",children:[r.jsx(GN,{}),"Snapshot"]}),r.jsxs(J,{disabled:s,onClick:()=>d.current?.click(),size:"sm",variant:"outline",children:[r.jsx(gf,{}),"Import"]}),r.jsx("input",{accept:".tar.gz,.tgz,application/gzip",className:"hidden",onChange:C=>{const A=C.target.files?.[0];A&&u(A),C.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:"max-h-44 divide-y divide-border/60 overflow-y-auto",children:e.map(C=>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:C.name}),r.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[C.mcpCount," MCP",C.mcpCount===1?"":"s"," ·"," ",C.skillCount," skill",C.skillCount===1?"":"s"]})]}),C.description?r.jsx("span",{className:"block truncate text-[11px] text-muted-foreground",children:C.description}):null]}),r.jsx(mu,{className:"opacity-100",items:[...c2.map(A=>({label:`Apply to ${io[A]}`,onSelect:()=>o(C.name,A)})),{label:"Export .tar.gz",icon:r.jsx(sw,{className:"size-3.5"}),onSelect:()=>l(C.name)},{label:"Publish to registry...",icon:r.jsx(WN,{className:"size-3.5"}),onSelect:()=>f(C.name)},{label:"Delete",icon:r.jsx(Ti,{className:"size-3.5"}),onSelect:()=>k(C.name)}],label:`Actions for ${C.name}`})]},C.name))}),w?r.jsx(jf,{confirmLabel:"Delete",icon:r.jsx(Ti,{}),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 TH({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 min-w-0 flex-wrap content-start items-center gap-2 px-3 py-2",children:[r.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-semibold",children:[r.jsx(nC,{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(Ye,{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(J,{disabled:t,onClick:o,size:"sm",variant:"ghost",children:[r.jsx(mM,{}),"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(J,{disabled:s,onClick:n,size:"sm",variant:"outline",children:[r.jsx(hM,{}),s?"Waiting for browser...":"Sign in"]})]}),e&&e.apiMode!=="prod"?r.jsx(Ye,{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(J,{disabled:t||u.trim().length===0,onClick:f,size:"sm",variant:"outline",children:[r.jsx(Xc,{}),"Install"]})]})}function RH({count:e,preview:t,applying:s,onUnstage:n,onClear:o,onApply:l}){return e===0?null:r.jsxs("div",{className:"shrink-0 border-t border-border bg-card/95",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(Ye,{size:"small",variant:"outline",children:e})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(J,{disabled:s,onClick:o,size:"sm",variant:"ghost",children:"Clear"}),r.jsx(J,{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(Er,{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(qt,{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 MH(){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([D8(),O8(),L8()]);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 DH(e){const[t,s]=_.useState([]),[n,o]=_.useState(!0),[l,u]=_.useState(!1),[h,f]=_.useState(null),d=as(),p=_.useCallback(async()=>{try{s(await P8())}catch{}finally{o(!1)}},[]);_.useEffect(()=>{p()},[p]);const g=_.useCallback(async j=>{if(!l){u(!0);try{await j()}catch(T){d.error(T instanceof Error?T.message:String(T))}finally{u(!1)}}},[l,d]),x=_.useCallback((j,T)=>g(async()=>{const M=await $8({agent:j,name:T});d.success(`Snapshotted ${j} into "${M.name}" (${Object.keys(M.mcps).length} MCPs, ${M.skills.length} skills)`),await p()}),[p,g,d]),v=_.useCallback((j,T)=>g(async()=>{const M=await H8(j,T),O=new Set(M.items.filter($=>$.status==="conflict").map($=>`${$.category}:${$.name}`));f({preview:M,skipped:O})}),[g]),w=_.useCallback(j=>{f(T=>{if(!T)return T;const M=new Set(T.skipped);return M.has(j)?M.delete(j):M.add(j),{...T,skipped:M}})},[]),k=_.useCallback(()=>g(async()=>{if(!h)return;const{preview:j,skipped:T}=h,M=await U8({name:j.profile,agent:j.agent,skip:{mcps:j.items.filter(O=>O.category==="mcp"&&T.has(`mcp:${O.name}`)).map(O=>O.name),skills:j.items.filter(O=>O.category==="skill"&&T.has(`skill:${O.name}`)).map(O=>O.name)}});f(null),d.success(`Applied "${M.profile}" to ${M.agent}: ${M.mcpsApplied.length} MCPs, ${M.skillsApplied.length} skills — ${M.backups.length} backup${M.backups.length===1?"":"s"} written`),e()}),[e,h,g,d]),N=_.useCallback(j=>g(async()=>{const{archivePath:T}=await F8(j);d.message({text:`Exported to ${T} (credentials redacted)`,preserve:!0})}),[g,d]),C=_.useCallback(j=>g(async()=>{try{const T=await hw(j);d.success(u2(T.name,T.missingCredentials.length)),await p()}catch(T){if(!(T instanceof Error?T.message:String(T)).includes("already exists"))throw T;const O=await hw(j,{force:!0});d.success(`${u2(O.name,O.missingCredentials.length)} (overwrote existing)`),await p()}}),[p,g,d]),A=_.useCallback(j=>g(async()=>{await I8(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:N,importArchive:C,deleteOne:A}}function u2(e,t){return t>0?`Imported "${e}" — ${t} credential${t===1?"":"s"} still needed`:`Imported "${e}"`}const OH=1500,LH=300*1e3;function zH(e){const[t,s]=_.useState(null),[n,o]=_.useState(!1),[l,u]=_.useState(!1),h=_.useRef(!1),f=as(),d=_.useCallback(async()=>{try{s(await q8())}catch{}},[]);_.useEffect(()=>(d(),()=>{h.current=!0}),[d]);const p=_.useCallback(async()=>{if(!l){u(!0);try{const{url:k,state:N}=await V8();window.open(k,"_blank","noopener");const C=Date.now()+LH;for(;Date.now()<C&&!h.current;){await new Promise(j=>setTimeout(j,OH));const A=await G8(N).catch(()=>null);if(!(!A||A.status==="pending")){A.status==="success"?f.success("Signed in to the profile registry"):f.error(A.message??"Registry sign-in failed"),await d();return}}h.current||f.error("Registry sign-in timed out")}catch(k){f.error(k instanceof Error?k.message:String(k))}finally{u(!1)}}},[d,l,f]),g=_.useCallback(async k=>{if(n)return!1;o(!0);try{return await k(),!0}catch(N){return f.error(N instanceof Error?N.message:String(N)),!1}finally{o(!1)}},[n,f]),x=_.useCallback(()=>g(async()=>{await W8(),f.success("Signed out of the profile registry"),await d()}),[d,g,f]),v=_.useCallback(k=>g(async()=>{try{const N=await fw({slug:k});f.success(d2(N.name,N.missingCredentials.length))}catch(N){if(!(N instanceof Error?N.message:String(N)).includes("already exists"))throw N;const A=await fw({slug:k,force:!0});f.success(`${d2(A.name,A.missingCredentials.length)} (overwrote existing)`)}e()}),[e,g,f]),w=_.useCallback(k=>g(async()=>{const N=await K8(k);f.message({text:`Published "${N.slug}" v${N.version} to the registry (credentials redacted)`,preserve:!0})}),[g,f]);return{status:t,busy:n,signingIn:l,refreshStatus:d,signIn:p,signOut:x,install:v,publish:w}}function d2(e,t){return t>0?`Installed "${e}" — ${t} credential${t===1?"":"s"} still needed`:`Installed "${e}" from the registry`}function BH(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 PH(e){const[t,s]=_.useState([]),[n,o]=_.useState(null),[l,u]=_.useState(!1),h=as(),f=_.useCallback(x=>{s(v=>v.some(w=>BH(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 z8(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 B8(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 IH(){const{agents:e,configs:t,doctor:s,loading:n,error:o,refresh:l}=MH();vl(l);const{staged:u,preview:h,applying:f,stage:d,unstage:p,clear:g,apply:x}=PH(l),v=DH(l),w=zH(v.refresh),[k,N]=_.useState(null),C=new Map(e.map(j=>[j.agent,j])),A=s?.checks.filter(j=>j.status!=="ok")??[];return r.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/85",children:[r.jsxs("header",{className:"flex shrink-0 flex-wrap items-center gap-2 border-b border-border px-3 py-2",children:[r.jsx(nb,{className:"size-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm font-semibold",children:"Agent Environments"}),A.length>0?r.jsxs("span",{className:"flex flex-wrap items-center gap-1.5",children:[r.jsxs("span",{className:"ml-2 flex items-center gap-1 text-xs font-medium text-muted-foreground",children:[r.jsx(b6,{className:"size-3.5"}),"Doctor"]}),A.map(j=>r.jsx(Ye,{size:"small",variant:"warning",children:j.message},j.message))]}):null]}),o?r.jsx(Qe,{className:"m-3 shrink-0",variant:"muted",children:o}):null,r.jsxs("div",{className:"grid shrink-0 grid-cols-1 divide-y divide-border border-b border-border lg:grid-cols-[minmax(0,3fr)_minmax(0,2fr)] lg:divide-x lg:divide-y-0",children:[r.jsx(AH,{busy:v.busy,loading:v.loading,onApply:v.startApply,onDelete:v.deleteOne,onExport:v.exportOne,onImport:v.importArchive,onPublish:N,onSnapshot:v.snapshot,profiles:v.profiles}),r.jsx(TH,{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:"min-h-0 flex-1 overflow-y-auto p-4",children:r.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:t.map(j=>r.jsx(NH,{availability:C.get(j.agent),config:j,onStage:d},j.agent))})}):r.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center p-8 text-center",children:r.jsx("p",{className:"max-w-sm text-xs text-muted-foreground",children:n?"Reading agent configurations...":o?null:"No agent configurations found. Agent Environments reads Claude Code, Codex CLI, and Antigravity configs from your home directory."})}),r.jsx(RH,{applying:f,count:u.length,onApply:()=>{x()},onClear:g,onUnstage:p,preview:h}),k?r.jsx(jH,{busy:w.busy,onCancel:()=>N(null),onConfirm:j=>{w.publish(j).then(T=>{T&&N(null)})},profileName:k}):null,v.pendingApply?r.jsx(EH,{busy:v.busy,onCancel:v.cancelApply,onConfirm:()=>{v.confirmApply()},onToggle:v.toggleSkip,pending:v.pendingApply}):null]})}function qn({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]),Rr.createPortal(r.jsx("div",{className:"fixed inset-0 z-[1000] grid place-items-center bg-black/35 px-4",onMouseDown:s,children:r.jsxs("div",{"aria-modal":"true",className:`flex max-h-[min(820px,calc(100vh-2rem))] w-full flex-col overflow-hidden rounded-lg border border-border bg-card shadow-xl ${o==="xl"?"max-w-[min(1400px,calc(100vw-2rem))]":o==="lg"?"max-w-3xl":"max-w-lg"}`,onMouseDown:l=>l.stopPropagation(),role:"dialog",children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[r.jsx("div",{className:"flex size-8 items-center justify-center rounded-md border border-border bg-background text-foreground [&_svg]:size-4",children:t}),r.jsx("h2",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:n}),r.jsx(J,{"aria-label":"Close dialog",onClick:s,size:"icon",type:"button",variant:"ghost",children:r.jsx(qt,{})})]}),r.jsx("div",{className:"min-h-0 overflow-auto p-4",children:e})]})}),document.body)}function dt({className:e,type:t,...s}){return r.jsx("input",{type:t,className:ue("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 $H={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:ue("group/tt relative inline-flex",n),children:[t,r.jsx("span",{role:"tooltip",className:ue("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",$H[s]),children:e})]})}const HH="application/x-nomoreide-path";function pu(e,t){return`${e.replace(/\/+$/,"")}/${t.replace(/^\/+/,"")}`}function K3(e,t){e.setData(HH,t)}function Y3(e){return{draggable:!0,onDragStart:t=>{K3(t.dataTransfer,e),t.dataTransfer.effectAllowed="copy"}}}const gi='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>',xi='</title><path d="',bi='"/></svg>',UH={title:".NET",slug:"dotnet",get svg(){return gi+".NET"+xi+this.path+bi},path:"M24 8.77h-2.468v7.565h-1.425V8.77h-2.462V7.53H24zm-6.852 7.565h-4.821V7.53h4.63v1.24h-3.205v2.494h2.953v1.234h-2.953v2.604h3.396zm-6.708 0H8.882L4.78 9.863a2.896 2.896 0 0 1-.258-.51h-.036c.032.189.048.592.048 1.21v5.772H3.157V7.53h1.659l3.965 6.32c.167.261.275.442.323.54h.024c-.04-.233-.06-.629-.06-1.185V7.529h1.372zm-8.703-.693a.868.829 0 0 1-.869.829.868.829 0 0 1-.868-.83.868.829 0 0 1 .868-.828.868.829 0 0 1 .869.829Z",source:"https://github.com/dotnet/brand/blob/c7d0f51b8ec59531332d05fb27a5b758a7a3d689/logo/dotnet-logo.svg",hex:"512BD4",guidelines:"https://github.com/dotnet/brand/blob/c7d0f51b8ec59531332d05fb27a5b758a7a3d689/dotnet-styleGuide-2024.pdf",license:{type:"CC0-1.0",url:"https://spdx.org/licenses/CC0-1.0"}},FH={title:"Bun",slug:"bun",get svg(){return gi+"Bun"+xi+this.path+bi},path:"M12 22.596c6.628 0 12-4.338 12-9.688 0-3.318-2.057-6.248-5.219-7.986-1.286-.715-2.297-1.357-3.139-1.89C14.058 2.025 13.08 1.404 12 1.404c-1.097 0-2.334.785-3.966 1.821a49.92 49.92 0 0 1-2.816 1.697C2.057 6.66 0 9.59 0 12.908c0 5.35 5.372 9.687 12 9.687v.001ZM10.599 4.715c.334-.759.503-1.58.498-2.409 0-.145.202-.187.23-.029.658 2.783-.902 4.162-2.057 4.624-.124.048-.199-.121-.103-.209a5.763 5.763 0 0 0 1.432-1.977Zm2.058-.102a5.82 5.82 0 0 0-.782-2.306v-.016c-.069-.123.086-.263.185-.172 1.962 2.111 1.307 4.067.556 5.051-.082.103-.23-.003-.189-.126a5.85 5.85 0 0 0 .23-2.431Zm1.776-.561a5.727 5.727 0 0 0-1.612-1.806v-.014c-.112-.085-.024-.274.114-.218 2.595 1.087 2.774 3.18 2.459 4.407a.116.116 0 0 1-.049.071.11.11 0 0 1-.153-.026.122.122 0 0 1-.022-.083 5.891 5.891 0 0 0-.737-2.331Zm-5.087.561c-.617.546-1.282.76-2.063 1-.117 0-.195-.078-.156-.181 1.752-.909 2.376-1.649 2.999-2.778 0 0 .155-.118.188.085 0 .304-.349 1.329-.968 1.874Zm4.945 11.237a2.957 2.957 0 0 1-.937 1.553c-.346.346-.8.565-1.286.62a2.178 2.178 0 0 1-1.327-.62 2.955 2.955 0 0 1-.925-1.553.244.244 0 0 1 .064-.198.234.234 0 0 1 .193-.069h3.965a.226.226 0 0 1 .19.07c.05.053.073.125.063.197Zm-5.458-2.176a1.862 1.862 0 0 1-2.384-.245 1.98 1.98 0 0 1-.233-2.447c.207-.319.503-.566.848-.713a1.84 1.84 0 0 1 1.092-.11c.366.075.703.261.967.531a1.98 1.98 0 0 1 .408 2.114 1.931 1.931 0 0 1-.698.869v.001Zm8.495.005a1.86 1.86 0 0 1-2.381-.253 1.964 1.964 0 0 1-.547-1.366c0-.384.11-.76.32-1.079.207-.319.503-.567.849-.713a1.844 1.844 0 0 1 1.093-.108c.367.076.704.262.968.534a1.98 1.98 0 0 1 .4 2.117 1.932 1.932 0 0 1-.702.868Z",source:"https://bun.sh/press-kit",hex:"000000"},qH={title:"Deno",slug:"deno",get svg(){return gi+"Deno"+xi+this.path+bi},path:"M1.105 18.02A11.9 11.9 0 0 1 0 12.985q0-.698.078-1.376a12 12 0 0 1 .231-1.34A12 12 0 0 1 4.025 4.02a12 12 0 0 1 5.46-2.771 12 12 0 0 1 3.428-.23c1.452.112 2.825.477 4.077 1.05a12 12 0 0 1 2.78 1.774 12.02 12.02 0 0 1 4.053 7.078A12 12 0 0 1 24 12.985q0 .454-.036.914a12 12 0 0 1-.728 3.305 12 12 0 0 1-2.38 3.875c-1.33 1.357-3.02 1.962-4.43 1.936a4.4 4.4 0 0 1-2.724-1.024c-.99-.853-1.391-1.83-1.53-2.919a5 5 0 0 1 .128-1.518c.105-.38.37-1.116.76-1.437-.455-.197-1.04-.624-1.226-.829-.045-.05-.04-.13 0-.183a.155.155 0 0 1 .177-.053c.392.134.869.267 1.372.35.66.111 1.484.25 2.317.292 2.03.1 4.153-.813 4.812-2.627s.403-3.609-1.96-4.685-3.454-2.356-5.363-3.128c-1.247-.505-2.636-.205-4.06.582-3.838 2.121-7.277 8.822-5.69 15.032a.191.191 0 0 1-.315.19 12 12 0 0 1-1.25-1.634 12 12 0 0 1-.769-1.404M11.57 6.087c.649-.051 1.214.501 1.31 1.236.13.979-.228 1.99-1.41 2.013-1.01.02-1.315-.997-1.248-1.614.066-.616.574-1.575 1.35-1.635",source:"https://github.com/denoland/docs/blob/5dee713844c7447f80acd4093caa9d350d80bf36/static/img/logo.svg",hex:"000000",guidelines:"https://deno.com/brand",license:{type:"MIT",url:"https://spdx.org/licenses/MIT"}},VH={title:"Docker",slug:"docker",get svg(){return gi+"Docker"+xi+this.path+bi},path:"M13.983 11.078h2.119a.186.186 0 00.186-.185V9.006a.186.186 0 00-.186-.186h-2.119a.185.185 0 00-.185.185v1.888c0 .102.083.185.185.185m-2.954-5.43h2.118a.186.186 0 00.186-.186V3.574a.186.186 0 00-.186-.185h-2.118a.185.185 0 00-.185.185v1.888c0 .102.082.185.185.185m0 2.716h2.118a.187.187 0 00.186-.186V6.29a.186.186 0 00-.186-.185h-2.118a.185.185 0 00-.185.185v1.887c0 .102.082.185.185.186m-2.93 0h2.12a.186.186 0 00.184-.186V6.29a.185.185 0 00-.185-.185H8.1a.185.185 0 00-.185.185v1.887c0 .102.083.185.185.186m-2.964 0h2.119a.186.186 0 00.185-.186V6.29a.185.185 0 00-.185-.185H5.136a.186.186 0 00-.186.185v1.887c0 .102.084.185.186.186m5.893 2.715h2.118a.186.186 0 00.186-.185V9.006a.186.186 0 00-.186-.186h-2.118a.185.185 0 00-.185.185v1.888c0 .102.082.185.185.185m-2.93 0h2.12a.185.185 0 00.184-.185V9.006a.185.185 0 00-.184-.186h-2.12a.185.185 0 00-.184.185v1.888c0 .102.083.185.185.185m-2.964 0h2.119a.185.185 0 00.185-.185V9.006a.185.185 0 00-.184-.186h-2.12a.186.186 0 00-.186.186v1.887c0 .102.084.185.186.185m-2.92 0h2.12a.185.185 0 00.184-.185V9.006a.185.185 0 00-.184-.186h-2.12a.185.185 0 00-.184.185v1.888c0 .102.082.185.185.185M23.763 9.89c-.065-.051-.672-.51-1.954-.51-.338.001-.676.03-1.01.087-.248-1.7-1.653-2.53-1.716-2.566l-.344-.199-.226.327c-.284.438-.49.922-.612 1.43-.23.97-.09 1.882.403 2.661-.595.332-1.55.413-1.744.42H.751a.751.751 0 00-.75.748 11.376 11.376 0 00.692 4.062c.545 1.428 1.355 2.48 2.41 3.124 1.18.723 3.1 1.137 5.275 1.137.983.003 1.963-.086 2.93-.266a12.248 12.248 0 003.823-1.389c.98-.567 1.86-1.288 2.61-2.136 1.252-1.418 1.998-2.997 2.553-4.4h.221c1.372 0 2.215-.549 2.68-1.009.309-.293.55-.65.707-1.046l.098-.288Z",source:"https://www.docker.com/company/newsroom/media-resources",hex:"2496ED"},GH={title:"Go",slug:"go",get svg(){return gi+"Go"+xi+this.path+bi},path:"M1.811 10.231c-.047 0-.058-.023-.035-.059l.246-.315c.023-.035.081-.058.128-.058h4.172c.046 0 .058.035.035.07l-.199.303c-.023.036-.082.07-.117.07zM.047 11.306c-.047 0-.059-.023-.035-.058l.245-.316c.023-.035.082-.058.129-.058h5.328c.047 0 .07.035.058.07l-.093.28c-.012.047-.058.07-.105.07zm2.828 1.075c-.047 0-.059-.035-.035-.07l.163-.292c.023-.035.07-.07.117-.07h2.337c.047 0 .07.035.07.082l-.023.28c0 .047-.047.082-.082.082zm12.129-2.36c-.736.187-1.239.327-1.963.514-.176.046-.187.058-.34-.117-.174-.199-.303-.327-.548-.444-.737-.362-1.45-.257-2.115.175-.795.514-1.204 1.274-1.192 2.22.011.935.654 1.706 1.577 1.835.795.105 1.46-.175 1.987-.77.105-.13.198-.27.315-.434H10.47c-.245 0-.304-.152-.222-.35.152-.362.432-.97.596-1.274a.315.315 0 01.292-.187h4.253c-.023.316-.023.631-.07.947a4.983 4.983 0 01-.958 2.29c-.841 1.11-1.94 1.8-3.33 1.986-1.145.152-2.209-.07-3.143-.77-.865-.655-1.356-1.52-1.484-2.595-.152-1.274.222-2.419.993-3.424.83-1.086 1.928-1.776 3.272-2.02 1.098-.2 2.15-.07 3.096.571.62.41 1.063.97 1.356 1.648.07.105.023.164-.117.2m3.868 6.461c-1.064-.024-2.034-.328-2.852-1.029a3.665 3.665 0 01-1.262-2.255c-.21-1.32.152-2.489.947-3.529.853-1.122 1.881-1.706 3.272-1.95 1.192-.21 2.314-.095 3.33.595.923.63 1.496 1.484 1.648 2.605.198 1.578-.257 2.863-1.344 3.962-.771.783-1.718 1.273-2.805 1.495-.315.06-.63.07-.934.106zm2.78-4.72c-.011-.153-.011-.27-.034-.387-.21-1.157-1.274-1.81-2.384-1.554-1.087.245-1.788.935-2.045 2.033-.21.912.234 1.835 1.075 2.21.643.28 1.285.244 1.905-.07.923-.48 1.425-1.228 1.484-2.233z",source:"https://blog.golang.org/go-brand",hex:"00ADD8",guidelines:"https://blog.golang.org/go-brand"},WH={title:"Node.js",slug:"nodedotjs",get svg(){return gi+"Node.js"+xi+this.path+bi},path:"M11.998,24c-0.321,0-0.641-0.084-0.922-0.247l-2.936-1.737c-0.438-0.245-0.224-0.332-0.08-0.383 c0.585-0.203,0.703-0.25,1.328-0.604c0.065-0.037,0.151-0.023,0.218,0.017l2.256,1.339c0.082,0.045,0.197,0.045,0.272,0l8.795-5.076 c0.082-0.047,0.134-0.141,0.134-0.238V6.921c0-0.099-0.053-0.192-0.137-0.242l-8.791-5.072c-0.081-0.047-0.189-0.047-0.271,0 L3.075,6.68C2.99,6.729,2.936,6.825,2.936,6.921v10.15c0,0.097,0.054,0.189,0.139,0.235l2.409,1.392 c1.307,0.654,2.108-0.116,2.108-0.89V7.787c0-0.142,0.114-0.253,0.256-0.253h1.115c0.139,0,0.255,0.112,0.255,0.253v10.021 c0,1.745-0.95,2.745-2.604,2.745c-0.508,0-0.909,0-2.026-0.551L2.28,18.675c-0.57-0.329-0.922-0.945-0.922-1.604V6.921 c0-0.659,0.353-1.275,0.922-1.603l8.795-5.082c0.557-0.315,1.296-0.315,1.848,0l8.794,5.082c0.57,0.329,0.924,0.944,0.924,1.603 v10.15c0,0.659-0.354,1.273-0.924,1.604l-8.794,5.078C12.643,23.916,12.324,24,11.998,24z M19.099,13.993 c0-1.9-1.284-2.406-3.987-2.763c-2.731-0.361-3.009-0.548-3.009-1.187c0-0.528,0.235-1.233,2.258-1.233 c1.807,0,2.473,0.389,2.747,1.607c0.024,0.115,0.129,0.199,0.247,0.199h1.141c0.071,0,0.138-0.031,0.186-0.081 c0.048-0.054,0.074-0.123,0.067-0.196c-0.177-2.098-1.571-3.076-4.388-3.076c-2.508,0-4.004,1.058-4.004,2.833 c0,1.925,1.488,2.457,3.895,2.695c2.88,0.282,3.103,0.703,3.103,1.269c0,0.983-0.789,1.402-2.642,1.402 c-2.327,0-2.839-0.584-3.011-1.742c-0.02-0.124-0.126-0.215-0.253-0.215h-1.137c-0.141,0-0.254,0.112-0.254,0.253 c0,1.482,0.806,3.248,4.655,3.248C17.501,17.007,19.099,15.91,19.099,13.993z",source:"https://nodejs.org/en/about/branding",hex:"5FA04E",guidelines:"https://nodejs.org/en/about/branding"},KH={title:"npm",slug:"npm",get svg(){return gi+"npm"+xi+this.path+bi},path:"M1.763 0C.786 0 0 .786 0 1.763v20.474C0 23.214.786 24 1.763 24h20.474c.977 0 1.763-.786 1.763-1.763V1.763C24 .786 23.214 0 22.237 0zM5.13 5.323l13.837.019-.009 13.836h-3.464l.01-10.382h-3.456L12.04 19.17H5.113z",source:"https://www.npmjs.com",hex:"CB3837",guidelines:"https://docs.npmjs.com/policies/logos-and-usage"},YH={title:"pnpm",slug:"pnpm",get svg(){return gi+"pnpm"+xi+this.path+bi},path:"M0 0v7.5h7.5V0zm8.25 0v7.5h7.498V0zm8.25 0v7.5H24V0zM2 2h3.5v3.5H2zm8.25 0h3.498v3.5H10.25zm8.25 0H22v3.5h-3.5zM8.25 8.25v7.5h7.498v-7.5zm8.25 0v7.5H24v-7.5zm2 2H22v3.5h-3.5zM0 16.5V24h7.5v-7.5zm8.25 0V24h7.498v-7.5zm8.25 0V24H24v-7.5z",source:"https://pnpm.io/logos",hex:"F69220"},XH={title:"Python",slug:"python",get svg(){return gi+"Python"+xi+this.path+bi},path:"M14.25.18l.9.2.73.26.59.3.45.32.34.34.25.34.16.33.1.3.04.26.02.2-.01.13V8.5l-.05.63-.13.55-.21.46-.26.38-.3.31-.33.25-.35.19-.35.14-.33.1-.3.07-.26.04-.21.02H8.77l-.69.05-.59.14-.5.22-.41.27-.33.32-.27.35-.2.36-.15.37-.1.35-.07.32-.04.27-.02.21v3.06H3.17l-.21-.03-.28-.07-.32-.12-.35-.18-.36-.26-.36-.36-.35-.46-.32-.59-.28-.73-.21-.88-.14-1.05-.05-1.23.06-1.22.16-1.04.24-.87.32-.71.36-.57.4-.44.42-.33.42-.24.4-.16.36-.1.32-.05.24-.01h.16l.06.01h8.16v-.83H6.18l-.01-2.75-.02-.37.05-.34.11-.31.17-.28.25-.26.31-.23.38-.2.44-.18.51-.15.58-.12.64-.1.71-.06.77-.04.84-.02 1.27.05zm-6.3 1.98l-.23.33-.08.41.08.41.23.34.33.22.41.09.41-.09.33-.22.23-.34.08-.41-.08-.41-.23-.33-.33-.22-.41-.09-.41.09zm13.09 3.95l.28.06.32.12.35.18.36.27.36.35.35.47.32.59.28.73.21.88.14 1.04.05 1.23-.06 1.23-.16 1.04-.24.86-.32.71-.36.57-.4.45-.42.33-.42.24-.4.16-.36.09-.32.05-.24.02-.16-.01h-8.22v.82h5.84l.01 2.76.02.36-.05.34-.11.31-.17.29-.25.25-.31.24-.38.2-.44.17-.51.15-.58.13-.64.09-.71.07-.77.04-.84.01-1.27-.04-1.07-.14-.9-.2-.73-.25-.59-.3-.45-.33-.34-.34-.25-.34-.16-.33-.1-.3-.04-.25-.02-.2.01-.13v-5.34l.05-.64.13-.54.21-.46.26-.38.3-.32.33-.24.35-.2.35-.14.33-.1.3-.06.26-.04.21-.02.13-.01h5.84l.69-.05.59-.14.5-.21.41-.28.33-.32.27-.35.2-.36.15-.36.1-.35.07-.32.04-.28.02-.21V6.07h2.09l.14.01zm-6.47 14.25l-.23.33-.08.41.08.41.23.33.33.23.41.08.41-.08.33-.23.23-.33.08-.41-.08-.41-.23-.33-.33-.23-.41-.08-.41.08z",source:"https://www.python.org/community/logos/",hex:"3776AB",guidelines:"https://www.python.org/community/logos/"},h2={title:"Rust",slug:"rust",get svg(){return gi+"Rust"+xi+this.path+bi},path:"M23.8346 11.7033l-1.0073-.6236a13.7268 13.7268 0 00-.0283-.2936l.8656-.8069a.3483.3483 0 00-.1154-.578l-1.1066-.414a8.4958 8.4958 0 00-.087-.2856l.6904-.9587a.3462.3462 0 00-.2257-.5446l-1.1663-.1894a9.3574 9.3574 0 00-.1407-.2622l.49-1.0761a.3437.3437 0 00-.0274-.3361.3486.3486 0 00-.3006-.154l-1.1845.0416a6.7444 6.7444 0 00-.1873-.2268l.2723-1.153a.3472.3472 0 00-.417-.4172l-1.1532.2724a14.0183 14.0183 0 00-.2278-.1873l.0415-1.1845a.3442.3442 0 00-.49-.328l-1.076.491c-.0872-.0476-.1742-.0952-.2623-.1407l-.1903-1.1673A.3483.3483 0 0016.256.955l-.9597.6905a8.4867 8.4867 0 00-.2855-.086l-.414-1.1066a.3483.3483 0 00-.5781-.1154l-.8069.8666a9.2936 9.2936 0 00-.2936-.0284L12.2946.1683a.3462.3462 0 00-.5892 0l-.6236 1.0073a13.7383 13.7383 0 00-.2936.0284L9.9803.3374a.3462.3462 0 00-.578.1154l-.4141 1.1065c-.0962.0274-.1903.0567-.2855.086L7.744.955a.3483.3483 0 00-.5447.2258L7.009 2.348a9.3574 9.3574 0 00-.2622.1407l-1.0762-.491a.3462.3462 0 00-.49.328l.0416 1.1845a7.9826 7.9826 0 00-.2278.1873L3.8413 3.425a.3472.3472 0 00-.4171.4171l.2713 1.1531c-.0628.075-.1255.1509-.1863.2268l-1.1845-.0415a.3462.3462 0 00-.328.49l.491 1.0761a9.167 9.167 0 00-.1407.2622l-1.1662.1894a.3483.3483 0 00-.2258.5446l.6904.9587a13.303 13.303 0 00-.087.2855l-1.1065.414a.3483.3483 0 00-.1155.5781l.8656.807a9.2936 9.2936 0 00-.0283.2935l-1.0073.6236a.3442.3442 0 000 .5892l1.0073.6236c.008.0982.0182.1964.0283.2936l-.8656.8079a.3462.3462 0 00.1155.578l1.1065.4141c.0273.0962.0567.1914.087.2855l-.6904.9587a.3452.3452 0 00.2268.5447l1.1662.1893c.0456.088.0922.1751.1408.2622l-.491 1.0762a.3462.3462 0 00.328.49l1.1834-.0415c.0618.0769.1235.1528.1873.2277l-.2713 1.1541a.3462.3462 0 00.4171.4161l1.153-.2713c.075.0638.151.1255.2279.1863l-.0415 1.1845a.3442.3442 0 00.49.327l1.0761-.49c.087.0486.1741.0951.2622.1407l.1903 1.1662a.3483.3483 0 00.5447.2268l.9587-.6904a9.299 9.299 0 00.2855.087l.414 1.1066a.3452.3452 0 00.5781.1154l.8079-.8656c.0972.0111.1954.0203.2936.0294l.6236 1.0073a.3472.3472 0 00.5892 0l.6236-1.0073c.0982-.0091.1964-.0183.2936-.0294l.8069.8656a.3483.3483 0 00.578-.1154l.4141-1.1066a8.4626 8.4626 0 00.2855-.087l.9587.6904a.3452.3452 0 00.5447-.2268l.1903-1.1662c.088-.0456.1751-.0931.2622-.1407l1.0762.49a.3472.3472 0 00.49-.327l-.0415-1.1845a6.7267 6.7267 0 00.2267-.1863l1.1531.2713a.3472.3472 0 00.4171-.416l-.2713-1.1542c.0628-.0749.1255-.1508.1863-.2278l1.1845.0415a.3442.3442 0 00.328-.49l-.49-1.076c.0475-.0872.0951-.1742.1407-.2623l1.1662-.1893a.3483.3483 0 00.2258-.5447l-.6904-.9587.087-.2855 1.1066-.414a.3462.3462 0 00.1154-.5781l-.8656-.8079c.0101-.0972.0202-.1954.0283-.2936l1.0073-.6236a.3442.3442 0 000-.5892zm-6.7413 8.3551a.7138.7138 0 01.2986-1.396.714.714 0 11-.2997 1.396zm-.3422-2.3142a.649.649 0 00-.7715.5l-.3573 1.6685c-1.1035.501-2.3285.7795-3.6193.7795a8.7368 8.7368 0 01-3.6951-.814l-.3574-1.6684a.648.648 0 00-.7714-.499l-1.473.3158a8.7216 8.7216 0 01-.7613-.898h7.1676c.081 0 .1356-.0141.1356-.088v-2.536c0-.074-.0536-.0881-.1356-.0881h-2.0966v-1.6077h2.2677c.2065 0 1.1065.0587 1.394 1.2088.0901.3533.2875 1.5044.4232 1.8729.1346.413.6833 1.2381 1.2685 1.2381h3.5716a.7492.7492 0 00.1296-.0131 8.7874 8.7874 0 01-.8119.9526zM6.8369 20.024a.714.714 0 11-.2997-1.396.714.714 0 01.2997 1.396zM4.1177 8.9972a.7137.7137 0 11-1.304.5791.7137.7137 0 011.304-.579zm-.8352 1.9813l1.5347-.6824a.65.65 0 00.33-.8585l-.3158-.7147h1.2432v5.6025H3.5669a8.7753 8.7753 0 01-.2834-3.348zm6.7343-.5437V8.7836h2.9601c.153 0 1.0792.1772 1.0792.8697 0 .575-.7107.7815-1.2948.7815zm10.7574 1.4862c0 .2187-.008.4363-.0243.651h-.9c-.09 0-.1265.0586-.1265.1477v.413c0 .973-.5487 1.1846-1.0296 1.2382-.4576.0517-.9648-.1913-1.0275-.4717-.2704-1.5186-.7198-1.8436-1.4305-2.4034.8817-.5599 1.799-1.386 1.799-2.4915 0-1.1936-.819-1.9458-1.3769-2.3153-.7825-.5163-1.6491-.6195-1.883-.6195H5.4682a8.7651 8.7651 0 014.907-2.7699l1.0974 1.151a.648.648 0 00.9182.0213l1.227-1.1743a8.7753 8.7753 0 016.0044 4.2762l-.8403 1.8982a.652.652 0 00.33.8585l1.6178.7188c.0283.2875.0425.577.0425.8717zm-9.3006-9.5993a.7128.7128 0 11.984 1.0316.7137.7137 0 01-.984-1.0316zm8.3389 6.71a.7107.7107 0 01.9395-.3625.7137.7137 0 11-.9405.3635z",source:"https://www.rust-lang.org",hex:"000000",guidelines:"https://www.rust-lang.org/policies/media-guide",license:{type:"CC-BY-SA-4.0",url:"https://spdx.org/licenses/CC-BY-SA-4.0"}},ZH={title:"Vite",slug:"vite",get svg(){return gi+"Vite"+xi+this.path+bi},path:"M13.056 23.238a.57.57 0 0 1-1.02-.355v-5.202c0-.63-.512-1.143-1.144-1.143H5.148a.57.57 0 0 1-.464-.903l3.777-5.29c.54-.753 0-1.804-.93-1.804H.57a.574.574 0 0 1-.543-.746.6.6 0 0 1 .08-.157L5.008.78a.57.57 0 0 1 .467-.24h14.589a.57.57 0 0 1 .466.903l-3.778 5.29c-.54.755 0 1.806.93 1.806h5.745c.238 0 .424.138.513.322a.56.56 0 0 1-.063.603z",source:"https://github.com/voidzero-dev/community-design-resources/blob/55902097229cf01cf2a4ceb376f992f5cf306756/brand-assets/vite/vite-icon-color-bracketless.svg",hex:"9135FF"},QH={title:"Yarn",slug:"yarn",get svg(){return gi+"Yarn"+xi+this.path+bi},path:"M12 0C5.375 0 0 5.375 0 12s5.375 12 12 12 12-5.375 12-12S18.625 0 12 0zm.768 4.105c.183 0 .363.053.525.157.125.083.287.185.755 1.154.31-.088.468-.042.551-.019.204.056.366.19.463.375.477.917.542 2.553.334 3.605-.241 1.232-.755 2.029-1.131 2.576.324.329.778.899 1.117 1.825.278.774.31 1.478.273 2.015a5.51 5.51 0 0 0 .602-.329c.593-.366 1.487-.917 2.553-.931.714-.009 1.269.445 1.353 1.103a1.23 1.23 0 0 1-.945 1.362c-.649.158-.95.278-1.821.843-1.232.797-2.539 1.242-3.012 1.39a1.686 1.686 0 0 1-.704.343c-.737.181-3.266.315-3.466.315h-.046c-.783 0-1.214-.241-1.45-.491-.658.329-1.51.19-2.122-.134a1.078 1.078 0 0 1-.58-1.153 1.243 1.243 0 0 1-.153-.195c-.162-.25-.528-.936-.454-1.946.056-.723.556-1.367.88-1.71a5.522 5.522 0 0 1 .408-2.256c.306-.727.885-1.348 1.32-1.737-.32-.537-.644-1.367-.329-2.21.227-.602.412-.936.82-1.08h-.005c.199-.074.389-.153.486-.259a3.418 3.418 0 0 1 2.298-1.103c.037-.093.079-.185.125-.283.31-.658.639-1.029 1.024-1.168a.94.94 0 0 1 .328-.06zm.006.7c-.507.016-1.001 1.519-1.001 1.519s-1.27-.204-2.266.871c-.199.218-.468.334-.746.44-.079.028-.176.023-.417.672-.371.991.625 2.094.625 2.094s-1.186.839-1.626 1.881c-.486 1.144-.338 2.261-.338 2.261s-.843.732-.899 1.487c-.051.663.139 1.2.343 1.515.227.343.51.176.51.176s-.561.653-.037.931c.477.25 1.283.394 1.71-.037.31-.31.371-1.001.486-1.283.028-.065.12.111.209.199.097.093.264.195.264.195s-.755.324-.445 1.066c.102.246.468.403 1.066.398.222-.005 2.664-.139 3.313-.296.375-.088.505-.283.505-.283s1.566-.431 2.998-1.357c.917-.598 1.293-.76 2.034-.936.612-.148.57-1.098-.241-1.084-.839.009-1.575.44-2.196.825-1.163.718-1.742.672-1.742.672l-.018-.032c-.079-.13.371-1.293-.134-2.678-.547-1.515-1.413-1.881-1.344-1.997.297-.5 1.038-1.297 1.334-2.78.176-.899.13-2.377-.269-3.151-.074-.144-.732.241-.732.241s-.616-1.371-.788-1.483a.271.271 0 0 0-.157-.046z",source:"https://github.com/yarnpkg/assets/blob/76d30ca2aebed5b73ea8131d972218fb860bd32d/yarn-kitten-circle.svg",hex:"2C8EBB",guidelines:"https://github.com/yarnpkg/assets/tree/76d30ca2aebed5b73ea8131d972218fb860bd32d",license:{type:"CC-BY-4.0",url:"https://spdx.org/licenses/CC-BY-4.0"}};function JH(e){const t=e.toLowerCase();return/\bvite\b/.test(t)?Cn.vite:/\bcargo\s+/.test(t)?Cn.cargo:/\brustc\b/.test(t)?Cn.rust:/\bdotnet\b/.test(t)?Cn.dotnet:/\bdocker(?:\s+compose|-compose|\s+)/.test(t)?Cn.docker:/\bpython3?\b|\buvicorn\b|\bfastapi\b/.test(t)?Cn.python:/\bgo\s+(run|test|build)\b|\bair\b/.test(t)?Cn.go:/\bbun\b/.test(t)?Cn.bun:/\bdeno\b/.test(t)?Cn.deno:/\bpnpm\b/.test(t)?Cn.pnpm:/\byarn\b/.test(t)?Cn.yarn:/\bnpm\b/.test(t)?Cn.npm:/\bnode\b/.test(t)?Cn.node:Cn.generic}const Cn={bun:{kind:"bun",label:"Bun"},cargo:{kind:"cargo",label:"Cargo"},deno:{kind:"deno",label:"Deno"},dotnet:{kind:"dotnet",label:".NET"},docker:{kind:"docker",label:"Docker"},generic:{kind:"generic",label:"Process"},go:{kind:"go",label:"Go"},node:{kind:"node",label:"Node"},npm:{kind:"npm",label:"npm"},pnpm:{kind:"pnpm",label:"pnpm"},python:{kind:"python",label:"Python"},rust:{kind:"rust",label:"Rust"},vite:{kind:"vite",label:"Vite"},yarn:{kind:"yarn",label:"Yarn"}};function Pb({command:e,compact:t}){const s=JH(e),n=eU[s.kind];return r.jsx("span",{"aria-label":`${s.label} process`,className:ue("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 eU={bun:FH,cargo:h2,deno:qH,dotnet:UH,docker:VH,generic:null,go:GH,node:WH,npm:KH,pnpm:YH,python:XH,rust:h2,vite:ZH,yarn:QH};function ri({className:e,...t}){return r.jsx("label",{className:ue("grid gap-1.5 text-xs font-medium text-muted-foreground",e),...t})}const tU=[{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"}],f2=[{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 sU({result:e}){const t=[...e.stdout,...e.stderr].slice(0,4);return r.jsxs(Qe,{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 nU(e,t,s,n){if(t==="bundle"){if(e==="start")return Sw(s,()=>n?.());if(e==="stop")return yw(s);await yw(s),await Sw(s,()=>n?.());return}return e==="start"?nL(s):e==="stop"?iL(s):TC(s)}function Ib({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(_g,{baseUrl:t,compact:s,intent:"restart",icon:r.jsx(pf,{}),label:"Restart",op:"restart",resourceKind:l,resourceName:u,targetLabel:f,onRefresh:n,onSuccess:o}),r.jsx(_g,{baseUrl:t,compact:s,intent:"stop",icon:r.jsx(no,{}),label:"Stop",op:"stop",resourceKind:l,resourceName:u,targetLabel:f,onRefresh:n})]}):r.jsx(_g,{baseUrl:t,compact:s,intent:h?"startSolid":"start",icon:r.jsx(jr,{}),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 _g({baseUrl:e,compact:t=!1,intent:s="neutral",icon:n,label:o,op:l,resourceKind:u,resourceName:h,targetLabel:f,onRefresh:d,onSuccess:p}){const[g,x]=_.useState(!1),[v,w]=_.useState(null),{error:k,success:N}=as();async function C(j=!1){x(!0);try{j?await ji(`${e}/start`,{strategy:"killHolder"}):await nU(l,u,h,()=>d()),N(`${o} requested for ${f}.`),await d(),w(null),p?.()}catch(T){T instanceof mC?w(T.conflict):k(Wh(o,f,T))}finally{x(!1)}}const A=r.jsxs(J,{"aria-label":o,className:`${rU[s]} ${t?"size-7":""}`.trim(),disabled:g,onClick:()=>C(),size:t?"icon":"sm",variant:"outline",children:[n,t?null:o]});return r.jsxs(r.Fragment,{children:[t?r.jsx(rl,{label:o,children:A}):A,v?r.jsx(iU,{busy:g,conflict:v,onCancel:()=>w(null),onKillAndStart:()=>C(!0),targetLabel:f}):null]})}function iU({busy:e,conflict:t,onCancel:s,onKillAndStart:n,targetLabel:o}){const l=t.holder,u=`http://localhost:${t.port}/`;return r.jsx(qn,{icon:r.jsx(fC,{}),onClose:e?()=>{}:s,title:`Port ${t.port} is already in use`,children:r.jsxs("div",{className:"space-y-3 p-4 text-sm",children:[r.jsxs("p",{children:[r.jsx("span",{className:"font-medium",children:o})," wants port"," ",r.jsx("span",{className:"font-mono",children:t.port}),", but it's already held by:"]}),r.jsx("pre",{className:"overflow-auto whitespace-pre-wrap rounded border border-border bg-background p-3 font-mono text-xs",children:l?`pid ${l.pid}${l.pgid?` (pgid ${l.pgid})`:""}
|
|
89
|
+
${l.command}`:"unknown process"}),r.jsxs("div",{className:"flex flex-wrap justify-end gap-2 pt-2",children:[r.jsx(J,{onClick:s,size:"sm",type:"button",variant:"outline",disabled:e,children:"Cancel"}),r.jsxs(J,{onClick:()=>{bf(u)},size:"sm",type:"button",variant:"outline",disabled:e,children:[r.jsx(so,{}),"Open in browser"]}),r.jsx(J,{className:"border-red-600 bg-red-600 text-white hover:bg-red-700",disabled:e||!l,onClick:n,size:"sm",type:"button",children:"Stop holder & start"})]})]})})}const rU={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 aU({cwd:e,onRefresh:t,onSaved:s,initialService:n}){const{error:o,success:l}=as(),u=!!n,[h,f]=_.useState(n?.kind??"local"),[d,p]=_.useState(n?.name??""),[g,x]=_.useState(n?.command??""),[v,w]=_.useState(n?.cwd??e),[k,N]=_.useState(n?.port?String(n.port):""),[C,A]=_.useState(n?.description??""),[j,T]=_.useState(n?.composeFile??""),[M,O]=_.useState(n?.composeService??""),[$,D]=_.useState(n?.host??""),[P,B]=_.useState(n?.dependsOn??[]),[G,F]=_.useState(null),[z,U]=_.useState(!1);_.useEffect(()=>{F(null)},[g,v,k,h]);function K(){p(""),x(""),w(e),N(""),A(""),T(""),O(""),D(""),B([]),F(null)}async function I(W){W.preventDefault();try{const te={name:d,kind:h,cwd:v,port:k,description:C};(h==="local"||h==="ssh")&&(te.command=g),h==="docker-compose"&&(te.composeFile=j,te.composeService=M),h==="ssh"&&(te.host=$),te.dependsOn=P.filter(X=>X!==d).join(","),await ji("/api/services",te),u||K(),l(u?`${d} updated.`:`${d} added.`),await t(),s?.()}catch(te){o(Wh(u?"Update service":"Add service",d||"service",te))}}async function Z(){if(!g.trim()){o("Test command failed for service: command is required.");return}U(!0);try{F(await hL({command:g,cwd:v,port:k}))}catch(W){o(Wh("Test command",d||"service",W))}finally{U(!1)}}return{editing:u,kind:h,setKind:f,name:d,setName:p,command:g,setCommand:x,formCwd:v,setFormCwd:w,port:k,setPort:N,description:C,setDescription:A,composeFile:j,setComposeFile:T,composeService:M,setComposeService:O,host:$,setHost:D,dependsOn:P,setDependsOn:B,testResult:G,testing:z,submit:I,testCommand:Z}}function m2({cwd:e,onRefresh:t,onSaved:s,initialService:n,availableServices:o=[]}){const{editing:l,kind:u,setKind:h,name:f,setName:d,command:p,setCommand:g,formCwd:x,setFormCwd:v,port:w,setPort:k,description:N,setDescription:C,composeFile:A,setComposeFile:j,composeService:T,setComposeService:M,host:O,setHost:$,dependsOn:D,setDependsOn:P,testResult:B,testing:G,submit:F,testCommand:z}=aU({cwd:e,onRefresh:t,onSaved:s,initialService:n}),U=f2.find(X=>X.value===u),K=o.filter(X=>X!==f),I=X=>P(V=>V.includes(X)?V.filter(q=>q!==X):[...V,X]),Z=u==="local"&&p.trim().length>0&&x.trim().length>0,W="grid gap-2 rounded-md border border-border bg-muted/30 p-3",te="px-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground";return r.jsxs("form",{className:"grid gap-3",onSubmit:F,children:[r.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[r.jsxs("fieldset",{className:`${W} sm:col-span-2`,children:[r.jsx("legend",{className:te,children:"Step 1 · Service kind"}),r.jsx("div",{className:"grid grid-cols-3 gap-1.5",children:f2.map(X=>r.jsx(J,{className:"justify-center",disabled:l,onClick:()=>h(X.value),size:"sm",type:"button",variant:u===X.value?"default":"outline",children:X.label},X.value))}),r.jsx("p",{className:"text-[11px] text-muted-foreground",children:U.hint})]}),r.jsxs("div",{className:"grid gap-3 sm:col-start-1 sm:row-start-2 sm:self-start",children:[r.jsxs("fieldset",{className:W,children:[r.jsx("legend",{className:te,children:"Step 2 · Identity"}),r.jsxs(ri,{children:["Name",r.jsx(dt,{className:"h-8 text-sm",name:"name",onChange:X=>d(X.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(ri,{children:["Description",r.jsx(dt,{className:"h-8 text-sm",name:"description",onChange:X=>C(X.target.value),placeholder:"API server",value:N})]})]}),r.jsxs("fieldset",{className:W,children:[r.jsx("legend",{className:te,children:"Step 4 · Networking (optional)"}),r.jsxs(ri,{children:["Port",r.jsx(dt,{className:"h-8 text-sm",inputMode:"numeric",name:"port",onChange:X=>k(X.target.value),placeholder:"3001",value:w})]})]})]}),u==="local"?r.jsxs("fieldset",{className:`${W} sm:col-start-2 sm:row-start-2 sm:self-start`,children:[r.jsx("legend",{className:te,children:"Step 3 · Local command"}),r.jsx("div",{className:"grid grid-cols-2 gap-1.5 sm:grid-cols-4",children:tU.map(X=>r.jsxs(J,{className:"justify-start gap-1.5",onClick:()=>{g(X.command),C(X.description)},size:"sm",type:"button",variant:"outline",children:[r.jsx(Pb,{command:X.badgeCommand??X.command,compact:!0}),r.jsx("span",{className:"truncate",children:X.label})]},X.label))}),r.jsxs(ri,{children:["Command",r.jsx(dt,{className:"h-8 font-mono text-sm",name:"command",onChange:X=>g(X.target.value),placeholder:"npm run dev",required:!0,value:p})]}),r.jsxs(ri,{children:["Working Directory",r.jsx(dt,{className:"h-8 font-mono text-sm",name:"cwd",onChange:X=>v(X.target.value),required:!0,value:x})]})]}):null,u==="docker-compose"?r.jsxs("fieldset",{className:`${W} sm:col-start-2 sm:row-start-2 sm:self-start`,children:[r.jsx("legend",{className:te,children:"Step 3 · Docker Compose target"}),r.jsxs(ri,{children:["Compose Service",r.jsx(dt,{className:"h-8 font-mono text-sm",name:"composeService",onChange:X=>M(X.target.value),placeholder:"api",required:!0,value:T})]}),r.jsxs(ri,{children:["Compose File (optional)",r.jsx(dt,{className:"h-8 font-mono text-sm",name:"composeFile",onChange:X=>j(X.target.value),placeholder:"docker-compose.yml",value:A})]}),r.jsxs(ri,{children:["Working Directory (where compose file lives)",r.jsx(dt,{className:"h-8 font-mono text-sm",name:"cwd",onChange:X=>v(X.target.value),required:!0,value:x})]})]}):null,u==="ssh"?r.jsxs("fieldset",{className:`${W} sm:col-start-2 sm:row-start-2 sm:self-start`,children:[r.jsx("legend",{className:te,children:"Step 3 · SSH connection"}),r.jsxs(ri,{children:["SSH Host (alias from ~/.ssh/config)",r.jsx(dt,{className:"h-8 font-mono text-sm",name:"host",onChange:X=>$(X.target.value),placeholder:"devbox",required:!0,value:O})]}),r.jsxs(ri,{children:["Remote Command",r.jsx(dt,{className:"h-8 font-mono text-sm",name:"command",onChange:X=>g(X.target.value),placeholder:"npm run dev",required:!0,value:p})]}),r.jsxs(ri,{children:["Remote Working Directory",r.jsx(dt,{className:"h-8 font-mono text-sm",name:"cwd",onChange:X=>v(X.target.value),placeholder:"/srv/app",required:!0,value:x})]}),r.jsxs(Qe,{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,K.length>0?r.jsxs("fieldset",{className:`${W} sm:col-span-2`,children:[r.jsx("legend",{className:te,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:K.map(X=>r.jsx(J,{className:"h-7 px-2.5 text-xs",onClick:()=>I(X),size:"sm",type:"button",variant:D.includes(X)?"default":"outline",children:X},X))})]}):null]}),B?r.jsx(sU,{result:B}):null,r.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[u==="local"?r.jsxs(J,{disabled:G||!Z,onClick:z,type:"button",variant:"outline",children:[r.jsx(ml,{}),G?"Testing...":"Test Command"]}):null,r.jsx(J,{type:"submit",children:l?"Save Service":"Add Service"})]})]})}function X3({initialName:e="",initialServices:t=[],onSaved:s,onRefresh:n,originalName:o,services:l,submitLabel:u="Save Group"}){const{error:h,success:f}=as();async function d(p){p.preventDefault();const g=p.currentTarget,x=new FormData(g),v=String(x.get("name")??""),w=x.getAll("services").map(k=>String(k)).filter(Boolean);try{await ji("/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(ri,{children:["Group name",r.jsx(dt,{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(Pb,{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(Qe,{variant:"muted",children:"All services are already grouped, or none registered."})]}),r.jsx(J,{className:"h-8",disabled:!l.length,type:"submit",children:u})]})}function oU({allServices:e,group:t,onRefresh:s,ports:n,services:o,health:l,statuses:u,timeline:h,selectedService:f,onSelectService:d,onDropService:p}){const[g,x]=_.useState(!1),[v,w]=_.useState(!1),[k,N]=_.useState(!1),C=o.some(T=>Gc(u[T.name]?.state));function A(T){!p||!T.dataTransfer.types.includes(nu)||(T.preventDefault(),T.dataTransfer.dropEffect="copy",N(!0))}function j(T){if(!p)return;T.preventDefault(),N(!1);const M=T.dataTransfer.getData(nu);M&&p(M)}return r.jsxs("section",{className:ue("transition-colors",k&&"bg-primary/5 outline-dashed outline-2 -outline-offset-2 outline-primary/60"),onDragOver:A,onDragLeave:()=>N(!1),onDrop:j,children:[r.jsxs("div",{className:"flex items-center gap-1.5 bg-muted/35 px-3 py-1.5",children:[r.jsxs("button",{"aria-expanded":!v,className:"flex min-w-0 flex-1 cursor-pointer items-center gap-1.5 text-left",onClick:()=>w(T=>!T),type:"button",children:[r.jsx(Gn,{className:ue("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(Ye,{size:"small",variant:"secondary",children:t.services.length}):null]}),r.jsx(rl,{label:"Edit group",children:r.jsx(J,{"aria-expanded":g,"aria-label":`Edit ${t.name}`,className:"size-7",onClick:()=>x(T=>!T),size:"icon",type:"button",variant:"ghost",children:r.jsx(ul,{})})}),r.jsx(Ib,{active:C,baseUrl:`/api/bundles/${encodeURIComponent(t.name)}`,compact:!0,resourceKind:"bundle",resourceName:t.name,solidStart:!0,targetLabel:`group ${t.name}`,onRefresh:s,onStarted:()=>{const T=o[0];T&&d(T.name)}})]}),g?r.jsx("div",{className:"border-t border-border bg-background/65 p-3",children:r.jsx(X3,{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(T=>r.jsx(Z3,{service:T,status:u[T.name],health:l[T.name],ports:n,onRefresh:s,timeline:h,selected:f===T.name,onSelect:()=>d(T.name)},T.name)):r.jsx(Qe,{variant:"muted",className:"m-4",children:"This group does not match any registered services."})})]})}function Z3({service:e,status:t,onRefresh:s,selected:n=!1,onSelect:o}){const l=t?.state??"stopped",u=Gc(l),[h,f]=_.useState(!1);return r.jsxs("div",{"aria-selected":n,draggable:!0,onDragStart:d=>{d.dataTransfer.setData(nu,e.name),e.cwd&&K3(d.dataTransfer,e.cwd),d.dataTransfer.effectAllowed="copyMove",f(!0)},onDragEnd:()=>f(!1),className:ue("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(Pb,{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(lU,{kind:e.kind}),e.port?r.jsxs("span",{children:[":",e.port]}):null]})]}),r.jsx(uU,{state:l}),r.jsx("span",{className:"flex items-center gap-1",onClick:d=>d.stopPropagation(),children:r.jsx(Ib,{active:u,baseUrl:`/api/services/${encodeURIComponent(e.name)}`,compact:!0,resourceKind:"service",resourceName:e.name,targetLabel:e.name,onRefresh:s,onStarted:o})})]})}const nu="application/x-nomoreide-service",p2={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 lU({kind:e}){const t=p2[e??"local"]??p2.local;return r.jsx("span",{className:ue("rounded border px-1 py-px text-[9px] font-semibold uppercase leading-none tracking-wide",t.className),children:t.label})}function Gc(e){return e==="running"||e==="starting"}function cU(e){return`http://127.0.0.1:${e}`}const g2={running:{className:"bg-emerald-500"},starting:{className:"bg-amber-500",pulse:!0},exited:{className:"bg-red-500"},stopped:{className:"bg-muted-foreground/40"}};function uU({state:e}){const t=g2[e]??g2.stopped;return r.jsxs("span",{className:"relative flex size-2.5 items-center justify-center",title:e,children:[t.pulse&&r.jsx("span",{className:ue("absolute inline-flex size-full animate-ping rounded-full opacity-60",t.className)}),r.jsx("span",{className:ue("relative inline-flex size-2 rounded-full",t.className)})]})}function Q3({state:e}){return r.jsx(Ye,{variant:e==="running"?"success":e==="exited"?"danger":e==="starting"?"warning":"outline",className:ue(e==="running"&&"font-mono"),children:e})}function dU({data:e}){const[t,s]=_.useState(!1),[n,o]=_.useState(()=>t2()),[l,u]=_.useState(""),[h,f]=_.useState([]),[d,p]=_.useState([]),[g,x]=_.useState(null),{sendToAgent:v}=At();_.useEffect(()=>{if(!t)return;let j=!0;return x(null),Promise.allSettled([_C(),SC(20)]).then(T=>{if(!j)return;const[M,O]=T;M.status==="fulfilled"&&f(M.value),O.status==="fulfilled"&&p(O.value),T.filter(D=>D.status==="rejected").length&&x("Some AI context could not be loaded. You can still send available context.")}),()=>{j=!1}},[t]);const w=_.useMemo(()=>hU(e),[e]),k=z$(n),N=_.useMemo(()=>n.serviceNames.length+n.databaseNames.length+n.errorIds.length+n.repositoryPaths.length,[n]);function C(j,T){o(M=>{const O=M[j],$=O.includes(T)?O.filter(D=>D!==T):[...O,T];return{...M,[j]:$}})}function A(){k&&(v({prompt:B$({dashboard:e,databases:h,incidents:d,note:l,selection:n}),source:{type:"workspace-context",label:"AI Diagnose"},label:P$({note:l,selection:n})}),s(!1),u(""),o(t2()))}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(Ft,{className:"size-4"})}),r.jsx("span",{className:Vh(),children:"Diagnose"})]}),t?r.jsx(qn,{icon:r.jsx(Ft,{}),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(Ye,{variant:N?"secondary":"outline",children:[N," selected"]})]}),g?r.jsx(Qe,{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(ib,{}),title:"Services",children:r.jsx("div",{className:"grid gap-2",children:e.config.services.map(j=>{const T=n.serviceNames.includes(j.name),M=e.runtime.services[j.name],O=e.health[j.name];return r.jsxs(Zd,{selected:T,onClick:()=>C("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(Q3,{state:M?.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(di,{}),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:()=>C("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(x2,{text:"No database connections detected."})}),r.jsx(Xd,{count:d.length,icon:r.jsx(Zc,{}),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:()=>C("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(Ye,{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(x2,{text:"No recent incidents."})}),r.jsx(Xd,{count:w.length,icon:r.jsx(Vn,{}),title:"Git Repositories",children:r.jsx("div",{className:"grid gap-2",children:w.map(j=>{const T=n.repositoryPaths.includes(j.path),M=j.path===(e.git.selectedRepository?.path??e.git.cwd),O=M?e.git.status?.files.length??0:void 0;return r.jsxs(Zd,{selected:T,onClick:()=>C("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}),M?r.jsx(Ye,{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(J,{onClick:()=>s(!1),type:"button",variant:"outline",children:"Cancel"}),r.jsxs(J,{className:"gap-2",disabled:!k,onClick:A,type:"button",children:[r.jsx(i6,{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(Ye,{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:ue("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 x2({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 hU(e){return e.config.gitRepositories.length?e.config.gitRepositories:e.git.selectedRepository?[e.git.selectedRepository]:[{name:e.git.cwd.split("/").pop()??"repository",path:e.git.cwd}]}async function $b({prompt:e,provider:t,autoApprove:s=!1,signal:n}){let o="",l,u,h,f=!1;const d=[],p=new AbortController,g=()=>p.abort(n?.reason);n?.aborted?g():n?.addEventListener("abort",g,{once:!0});const x=w=>{if(w.type==="session")l=w.sessionId;else if(w.type==="text")o+=w.text;else if(w.type==="error")u=new Error(w.message);else if(w.type==="approval_request"){const k=l?j8(l,w.requestId,s?"allow":"deny"):Promise.reject(new Error("Agent requested approval before starting a session"));d.push(k.catch(N=>{f||(f=!0,h=N),p.abort()}))}};let v;try{await A8(e,void 0,x,p.signal,s,t)}catch(w){v=w}finally{await Promise.allSettled(d),n?.removeEventListener("abort",g)}if(f)throw h;if(v)throw v;if(u)throw u;return o.trim()}function fU(e){const t=gU(e.capabilities);return t?`${e.prompt}
|
|
90
|
+
|
|
91
|
+
${t}`:e.prompt}function mU({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:",xU(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 pU({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 gU(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 xU(e){return e.kind==="agent"?e.prompt:e.kind==="gate"?`Gate: ${e.message}`:`Action: ${e.op}`}const b2=/^[ \t>*_-]*WORKFLOW_STATUS:\s*(ok|blocked)\b[ \t]*[—–:-]?[ \t]*(.*)$/im,bU=/^[ \t>*_-]*BRANCH_NAME:\s*`?([A-Za-z0-9][A-Za-z0-9._/-]{0,127})`?\s*$/im,vU=/^[A-Za-z0-9][A-Za-z0-9._/-]{0,127}$/;function _U(e){const t=e.match(b2);if(t){const s=t[1].toLowerCase()==="blocked",n=t[2]?.trim()||void 0;return{output:e.replace(b2,"").trim(),blocked:s,reason:s?n:void 0}}return{output:e,blocked:yU(e)}}function yU(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 wU(e){const t=e.match(bU);if(t&&v2(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(v2(o))return o}return null}function v2(e){return!(!vU.test(e)||e==="main"||e==="master"||e.includes("..")||e.endsWith(".")||e.endsWith("/"))}const SU="\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 kU(e){const{provider:t}=At(),[s,n]=_.useState(null),o=_.useRef(s);_.useEffect(()=>{o.current=s},[s]);const l=_.useRef(!1),u=_.useRef(!1),h=_.useRef(null),f=_.useRef(null),d=_.useRef(!0);_.useEffect(()=>(d.current=!0,u.current=!1,()=>{d.current=!1,u.current=!0,l.current=!1,f.current?.abort(),f.current=null,h.current?.("stop"),h.current=null}),[]);const p=_.useCallback(()=>new Promise(T=>{h.current=T}),[]),g=_.useCallback(async T=>{const M=await eg();return T==="committed"?M.files.length===0:T==="pushed"?M.ahead===0:!0},[]),x=_.useCallback(async(T,M,O)=>{if(T.op==="assert-pr-branch"){EU(await eg());return}if(T.op==="push"){await vf();return}if(T.op==="checkout-default-and-pull"){await bO();return}if(T.op==="commit"){const $=await eg();if(!$.files.length)throw new Error("Nothing to commit — the working tree is clean.");const D=CU($.files);D.length&&await ob(D),await CC(NU(O,M,$.files));return}throw new Error(`Unknown action: ${T.op}`)},[]),v=_.useCallback(async(T,M,O)=>{if(l.current||!d.current)return;l.current=!0,u.current=!1;const $=O?.index??0,D=T.steps.map((F,z)=>O&&z<$?O.statuses[z]??"pending":"pending"),P=T.steps.map((F,z)=>O?.outputs[z]??""),B=(F,z,U)=>{D[F]=z,d.current&&n(K=>K&&{...K,index:F,statuses:[...D],outputs:[...P],...U})};if(!d.current)return;n({workflow:T,startedAt:O?.startedAt??Date.now(),index:$,statuses:[...D],outputs:[...P],error:null,outcome:"running"});const G=F=>{l.current=!1,d.current&&n(z=>z&&{...z,outcome:F,endedAt:Date.now()})};for(let F=$;F<T.steps.length;F++){const z=T.steps[F];if(z.kind==="gate"){B(F,"waiting");const Z=await p();if(h.current=null,Z==="stop"){B(F,"skipped"),G("stopped");return}B(F,Z==="skip"?"skipped":"done");continue}if(z.kind==="action"){B(F,"running");try{await x(z,F,P),B(F,"done"),d.current&&e?.()}catch(Z){if(z.op==="assert-pr-branch"){B(F,"blocked",{error:yg(Z)}),G("blocked");return}B(F,"failed",{error:yg(Z)}),G("failed");return}if(u.current)return G("stopped");continue}B(F,"running");const U=new AbortController;f.current=U;let K;try{K=await $b({prompt:fU(z)+SU,provider:t?.id,autoApprove:M,signal:U.signal})}catch(Z){if(f.current=null,u.current||U.signal.aborted){G("stopped");return}B(F,"failed",{error:yg(Z)}),G("failed");return}if(f.current=null,!d.current)return G("stopped");e?.();const I=_U(K);if(P[F]=I.output||"(no reply from agent)",I.blocked){B(F,"blocked",{error:I.reason?`Paused — ${I.reason} Fix it (Debug with AI in the dock if you like), then Resume workflow to retry this step.`:"Paused — this step needs your input. Fix it (Debug with AI in the dock if you like), then Resume workflow to retry this step."}),G("blocked");return}if(z.verify&&!await g(z.verify).catch(()=>!1)){B(F,"failed",{error:z.verify==="committed"?"Expected the working tree to be clean after this step, but it isn't. Stopping before the next step.":"Expected the branch to be pushed (no commits ahead), but it isn't. Stopping."}),G("failed");return}if(B(F,"done"),u.current)return G("stopped")}G("done")},[e,t?.id,x,g,p]),w=_.useCallback((T,M=!1)=>v(T,M),[v]),k=_.useCallback((T=!1)=>{const M=o.current;!M||M.outcome==="running"||l.current||v(M.workflow,T,{index:M.index,statuses:M.statuses,outputs:M.outputs,startedAt:M.startedAt})},[v]),N=_.useCallback(()=>h.current?.("approve"),[]),C=_.useCallback(()=>h.current?.("skip"),[]),A=_.useCallback(()=>{u.current=!0,f.current?.abort(),h.current?.("stop")},[]),j=_.useCallback(()=>{l.current||!d.current||n(null)},[]);return{run:s,start:w,resume:k,approve:N,skip:C,stop:A,dismiss:j,isRunning:!!s&&s.outcome==="running"}}function yg(e){return e instanceof Error?e.message:String(e)}function NU(e,t,s){return e[t-1]?.trim()||AU(s)}function CU(e){return e.some(s=>s.index.trim()&&s.index!=="?")?[]:e.map(s=>s.path)}function EU(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(!jU(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 jU(e){return e==="main"||e==="master"}function AU(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 J3=_.createContext(null);function TU({onRefresh:e,children:t}){const s=kU(e);return r.jsx(J3.Provider,{value:s,children:t})}function ej(){const e=_.useContext(J3);if(!e)throw new Error("useWorkflowRun must be used within a WorkflowRunProvider");return e}const tj=_.createContext(null);function RU({children:e}){const{start:t,isRunning:s}=ej(),[n,o]=_.useState([]),[l,u]=_.useState([]),[h,f]=_.useState([]),[d,p]=_.useState(null),g=_.useRef(new Set),x=_.useCallback(C=>{u(A=>[C,...A.filter(j=>j.id!==C.id)])},[]);_.useEffect(()=>{let C=!0;Promise.all([IL().catch(()=>[]),OC().catch(()=>[]),UL().catch(()=>[])]).then(([j,T,M])=>{C&&(o(Array.isArray(j)?j:[]),f(Array.isArray(T)?T:[]),u(Array.isArray(M)?M:[]))});const A=new EventSource("/api/workflow-triggers/pending/stream");return A.addEventListener("pending",j=>{try{x(JSON.parse(j.data))}catch{}}),()=>{C=!1,A.close()}},[x]);const v=_.useCallback(async C=>{u(A=>A.filter(j=>j.id!==C)),await FL(C).catch(()=>{})},[]),w=_.useCallback(C=>{const A=h.find(j=>j.id===C.workflowId);g.current.add(C.id),v(C.id),A?t(A,!0):p(`Trigger references a missing workflow: ${C.workflowId}`)},[h,t,v]);_.useEffect(()=>{if(s)return;const C=[...l].reverse().find(A=>A.autoRun&&!g.current.has(A.id));C&&w(C)},[l,s,w]);const k=_.useCallback(async C=>{try{o(await $L(C)),p(null)}catch(A){p(A instanceof Error?A.message:String(A))}},[]),N=_.useCallback(async C=>{try{o(await HL(C))}catch(A){p(A instanceof Error?A.message:String(A))}},[]);return r.jsx(tj.Provider,{value:{triggers:n,pending:l,workflows:h,error:d,saveTrigger:k,removeTrigger:N,runPending:w,dismissPending:v},children:e})}function MU(){const e=_.useContext(tj);if(!e)throw new Error("useWorkflowTriggers must be used within a WorkflowTriggerProvider");return e}function DU({git:e,onRefresh:t}){const{sendToAgent:s}=At(),[n,o]=_.useState(!1),[l,u]=_.useState(null),[h,f]=_.useState(null),d=e.status,p=d?.branch||void 0,g=d?.files.length??0,x=d?.ahead??0,v=d?.behind??0;_.useEffect(()=>{if(!p){f(null);return}let N=!0;return fh(p,1).then(C=>{if(!N)return;const A=C[0];f(A&&OU(A)?A:null)}).catch(()=>{N&&f(null)}),()=>{N=!1}},[p]);const w=_.useMemo(()=>g>0||x>0||v>0||!!h,[g,x,v,h]);if(!d||!w)return null;async function k(){o(!0),u(null);try{await vf(),t?.()}catch(N){u(N instanceof Error?N.message:String(N))}finally{o(!1)}}return r.jsx("div",{className:"mx-auto mb-2 w-full max-w-4xl",children:r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 rounded-md border border-border bg-muted/40 px-2 py-1.5 text-[11px]",children:[r.jsxs("span",{className:"mr-0.5 inline-flex items-center gap-1 font-medium text-muted-foreground",children:[r.jsx(Ft,{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:E$({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:j$({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(jt,{className:"size-3 animate-spin"}):r.jsx(gf,{className:"size-3"}),label:`Push ${x}`,disabled:n,onClick:()=>{k()}}):null,h?r.jsx(Jd,{danger:!0,icon:r.jsx(Er,{className:"size-3"}),label:"Fix failing CI",ai:!0,onClick:()=>s({prompt:A$({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:ue("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(Ft,{className:"size-3 opacity-70"}):null]})}function OU(e){return e.status==="completed"&&e.conclusion!==null&&!["success","neutral","skipped"].includes(e.conclusion)}var LU=2,zU=1,BU=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(LU,Math.floor(p/e.css.cell.width)),rows:Math.max(zU,Math.floor(d/e.css.cell.height))}}};var sj=Object.defineProperty,PU=Object.getOwnPropertyDescriptor,IU=(e,t)=>{for(var s in t)sj(e,s,{get:t[s],enumerable:!0})},os=(e,t,s,n)=>{for(var o=n>1?void 0:n?PU(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&&sj(t,s,o),o},Fe=(e,t)=>(s,n)=>t(s,n,e),_2="Terminal input",Qx={get:()=>_2,set:e=>_2=e},y2="Too much output to announce, navigate to rows manually to read",Jx={get:()=>y2,set:e=>y2=e};function $U(e){return e.replace(/\r?\n/g,"\r")}function HU(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function UU(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function FU(e,t,s,n){if(e.stopPropagation(),e.clipboardData){let o=e.clipboardData.getData("text/plain");nj(o,t,s,n)}}function nj(e,t,s,n){e=$U(e),e=HU(e,s.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(e,!0),t.value=""}function ij(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 w2(e,t,s,n,o){ij(e,t,s),o&&n.rightClickSelect(e),t.value=n.selectionText,t.select()}function ma(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Af(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 qU=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}},VU=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let s=e.length;if(!s)return 0;let n=0,o,l,u,h,f=0,d=0;if(this.interim[0]){let x=!1,v=this.interim[0];v&=(v&224)===192?31:(v&240)===224?15:7;let w=0,k;for(;(k=this.interim[++w]&63)&&w<4;)v<<=6,v|=k;let N=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,C=N-w;for(;d<C;){if(d>=s)return 0;if(k=e[d++],(k&192)!==128){d--,x=!0;break}else this.interim[w++]=k,v<<=6,v|=k&63}x||(N===2?v<128?d--:t[n++]=v:N===3?v<2048||v>=55296&&v<=57343||v===65279||(t[n++]=v):v<65536||v>1114111||(t[n++]=v)),this.interim.fill(0)}let p=s-4,g=d;for(;g<s;){for(;g<p&&!((o=e[g])&128)&&!((l=e[g+1])&128)&&!((u=e[g+2])&128)&&!((h=e[g+3])&128);)t[n++]=o,t[n++]=l,t[n++]=u,t[n++]=h,g+=4;if(o=e[g++],o<128)t[n++]=o;else if((o&224)===192){if(g>=s)return this.interim[0]=o,n;if(l=e[g++],(l&192)!==128){g--;continue}if(f=(o&31)<<6|l&63,f<128){g--;continue}t[n++]=f}else if((o&240)===224){if(g>=s)return this.interim[0]=o,n;if(l=e[g++],(l&192)!==128){g--;continue}if(g>=s)return this.interim[0]=o,this.interim[1]=l,n;if(u=e[g++],(u&192)!==128){g--;continue}if(f=(o&15)<<12|(l&63)<<6|u&63,f<2048||f>=55296&&f<=57343||f===65279)continue;t[n++]=f}else if((o&248)===240){if(g>=s)return this.interim[0]=o,n;if(l=e[g++],(l&192)!==128){g--;continue}if(g>=s)return this.interim[0]=o,this.interim[1]=l,n;if(u=e[g++],(u&192)!==128){g--;continue}if(g>=s)return this.interim[0]=o,this.interim[1]=l,this.interim[2]=u,n;if(h=e[g++],(h&192)!==128){g--;continue}if(f=(o&7)<<18|(l&63)<<12|(u&63)<<6|h&63,f<65536||f>1114111)continue;t[n++]=f}}return n}},rj="",ga=" ",gu=class aj{constructor(){this.fg=0,this.bg=0,this.extended=new Kh}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new aj;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Kh=class oj{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 oj(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},ui=class lj extends gu{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Kh,this.combinedData=""}static fromCharData(t){let s=new lj;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?ma(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()]}},S2="di$target",e0="di$dependencies",wg=new Map;function GU(e){return e[e0]||[]}function Hs(e){if(wg.has(e))return wg.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");WU(t,s,o)};return t._id=e,wg.set(e,t),t}function WU(e,t,s){t[S2]===t?t[e0].push({id:e,index:s}):(t[e0]=[{id:e,index:s}],t[S2]=t)}var hn=Hs("BufferService"),cj=Hs("CoreMouseService"),ho=Hs("CoreService"),KU=Hs("CharsetService"),Hb=Hs("InstantiationService"),uj=Hs("LogService"),fn=Hs("OptionsService"),dj=Hs("OscLinkService"),YU=Hs("UnicodeService"),xu=Hs("DecorationService"),t0=class{constructor(e,t,s){this._bufferService=e,this._optionsService=t,this._oscLinkService=s}provideLinks(e,t){let s=this._bufferService.buffer.lines.get(e-1);if(!s){t(void 0);return}let n=[],o=this._optionsService.rawOptions.linkHandler,l=new ui,u=s.getTrimmedLength(),h=-1,f=-1,d=!1;for(let p=0;p<u;p++)if(!(f===-1&&!s.hasContent(p))){if(s.loadCell(p,l),l.hasExtendedAttrs()&&l.extended.urlId)if(f===-1){f=p,h=l.extended.urlId;continue}else d=l.extended.urlId!==h;else f!==-1&&(d=!0);if(d||f!==-1&&p===u-1){let g=this._oscLinkService.getLinkData(h)?.uri;if(g){let x={start:{x:f+1,y:e},end:{x:p+(!d&&p===u-1?1:0),y:e}},v=!1;if(!o?.allowNonHttpProtocols)try{let w=new URL(g);["http:","https:"].includes(w.protocol)||(v=!0)}catch{v=!0}v||n.push({text:g,range:x,activate:(w,k)=>o?o.activate(w,k,x):XU(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)}};t0=os([Fe(0,hn),Fe(1,fn),Fe(2,dj)],t0);function XU(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
95
|
+
|
|
96
|
+
WARNING: This link could potentially be dangerous`)){let s=window.open();if(s){try{s.opener=null}catch{}s.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var Tf=Hs("CharSizeService"),Mr=Hs("CoreBrowserService"),Ub=Hs("MouseService"),Dr=Hs("RenderService"),ZU=Hs("SelectionService"),hj=Hs("CharacterJoinerService"),_l=Hs("ThemeService"),fj=Hs("LinkProviderService"),QU=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?k2.isErrorNoTelemetry(e)?new k2(e.message+`
|
|
97
|
+
|
|
98
|
+
`+e.stack):new Error(e.message+`
|
|
99
|
+
|
|
100
|
+
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},JU=new QU;function Sh(e){eF(e)||JU.onUnexpectedError(e)}var s0="Canceled";function eF(e){return e instanceof tF?!0:e instanceof Error&&e.name===s0&&e.message===s0}var tF=class extends Error{constructor(){super(s0),this.name=this.message}};function sF(e){return new Error(`Illegal argument: ${e}`)}var k2=class n0 extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof n0)return t;let s=new n0;return s.message=t.message,s.stack=t.stack,s}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},i0=class mj extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,mj.prototype)}};function In(e,t=0){return e[e.length-(1+t)]}var nF;(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})(nF||={});function iF(e,t){let s=this,n=!1,o;return function(){return n||(n=!0,t||(o=e.apply(s,arguments))),o}}var pj;(e=>{function t(T){return T&&typeof T=="object"&&typeof T[Symbol.iterator]=="function"}e.is=t;let s=Object.freeze([]);function n(){return s}e.empty=n;function*o(T){yield T}e.single=o;function l(T){return t(T)?T:o(T)}e.wrap=l;function u(T){return T||s}e.from=u;function*h(T){for(let M=T.length-1;M>=0;M--)yield T[M]}e.reverse=h;function f(T){return!T||T[Symbol.iterator]().next().done===!0}e.isEmpty=f;function d(T){return T[Symbol.iterator]().next().value}e.first=d;function p(T,M){let O=0;for(let $ of T)if(M($,O++))return!0;return!1}e.some=p;function g(T,M){for(let O of T)if(M(O))return O}e.find=g;function*x(T,M){for(let O of T)M(O)&&(yield O)}e.filter=x;function*v(T,M){let O=0;for(let $ of T)yield M($,O++)}e.map=v;function*w(T,M){let O=0;for(let $ of T)yield*M($,O++)}e.flatMap=w;function*k(...T){for(let M of T)yield*M}e.concat=k;function N(T,M,O){let $=O;for(let D of T)$=M($,D);return $}e.reduce=N;function*C(T,M,O=T.length){for(M<0&&(M+=T.length),O<0?O+=T.length:O>T.length&&(O=T.length);M<O;M++)yield T[M]}e.slice=C;function A(T,M=Number.POSITIVE_INFINITY){let O=[];if(M===0)return[O,T];let $=T[Symbol.iterator]();for(let D=0;D<M;D++){let P=$.next();if(P.done)return[O,e.empty()];O.push(P.value)}return[O,{[Symbol.iterator](){return $}}]}e.consume=A;async function j(T){let M=[];for await(let O of T)M.push(O);return Promise.resolve(M)}e.asyncToArray=j})(pj||={});function ro(e){if(pj.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 rF(...e){return Qt(()=>ro(e))}function Qt(e){return{dispose:iF(()=>{e()})}}var gj=class xj{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{ro(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?xj.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)}};gj.DISABLE_DISPOSED_WARNING=!1;var xa=gj,mt=class{constructor(){this._store=new xa,this._store}dispose(){this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}};mt.None=Object.freeze({dispose(){}});var fl=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){this._isDisposed||t===this._value||(this._value?.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t}},Nr=typeof window=="object"?window:globalThis,r0=class a0{constructor(t){this.element=t,this.next=a0.Undefined,this.prev=a0.Undefined}};r0.Undefined=new r0(void 0);var es=r0,N2=class{constructor(){this._first=es.Undefined,this._last=es.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===es.Undefined}clear(){let e=this._first;for(;e!==es.Undefined;){let t=e.next;e.prev=es.Undefined,e.next=es.Undefined,e=t}this._first=es.Undefined,this._last=es.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let s=new es(e);if(this._first===es.Undefined)this._first=s,this._last=s;else if(t){let o=this._last;this._last=s,s.prev=o,o.next=s}else{let o=this._first;this._first=s,s.next=o,o.prev=s}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(s))}}shift(){if(this._first!==es.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==es.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==es.Undefined&&e.next!==es.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===es.Undefined&&e.next===es.Undefined?(this._first=es.Undefined,this._last=es.Undefined):e.next===es.Undefined?(this._last=this._last.prev,this._last.next=es.Undefined):e.prev===es.Undefined&&(this._first=this._first.next,this._first.prev=es.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==es.Undefined;)yield e.element,e=e.next}},aF=globalThis.performance&&typeof globalThis.performance.now=="function",oF=class bj{static create(t){return new bj(t)}constructor(t){this._now=aF&&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}},Ys;(e=>{e.None=()=>mt.None;function t(F,z){return g(F,()=>{},0,void 0,!0,void 0,z)}e.defer=t;function s(F){return(z,U=null,K)=>{let I=!1,Z;return Z=F(W=>{if(!I)return Z?Z.dispose():I=!0,z.call(U,W)},null,K),I&&Z.dispose(),Z}}e.once=s;function n(F,z,U){return d((K,I=null,Z)=>F(W=>K.call(I,z(W)),null,Z),U)}e.map=n;function o(F,z,U){return d((K,I=null,Z)=>F(W=>{z(W),K.call(I,W)},null,Z),U)}e.forEach=o;function l(F,z,U){return d((K,I=null,Z)=>F(W=>z(W)&&K.call(I,W),null,Z),U)}e.filter=l;function u(F){return F}e.signal=u;function h(...F){return(z,U=null,K)=>{let I=rF(...F.map(Z=>Z(W=>z.call(U,W))));return p(I,K)}}e.any=h;function f(F,z,U,K){let I=U;return n(F,Z=>(I=z(I,Z),I),K)}e.reduce=f;function d(F,z){let U,K={onWillAddFirstListener(){U=F(I.fire,I)},onDidRemoveLastListener(){U?.dispose()}},I=new ze(K);return z?.add(I),I.event}function p(F,z){return z instanceof Array?z.push(F):z&&z.add(F),F}function g(F,z,U=100,K=!1,I=!1,Z,W){let te,X,V,q=0,oe,ee={leakWarningThreshold:Z,onWillAddFirstListener(){te=F(ie=>{q++,X=z(X,ie),K&&!V&&(fe.fire(X),X=void 0),oe=()=>{let Se=X;X=void 0,V=void 0,(!K||q>1)&&fe.fire(Se),q=0},typeof U=="number"?(clearTimeout(V),V=setTimeout(oe,U)):V===void 0&&(V=0,queueMicrotask(oe))})},onWillRemoveListener(){I&&q>0&&oe?.()},onDidRemoveLastListener(){oe=void 0,te.dispose()}},fe=new ze(ee);return W?.add(fe),fe.event}e.debounce=g;function x(F,z=0,U){return e.debounce(F,(K,I)=>K?(K.push(I),K):[I],z,void 0,!0,void 0,U)}e.accumulate=x;function v(F,z=(K,I)=>K===I,U){let K=!0,I;return l(F,Z=>{let W=K||!z(Z,I);return K=!1,I=Z,W},U)}e.latch=v;function w(F,z,U){return[e.filter(F,z,U),e.filter(F,K=>!z(K),U)]}e.split=w;function k(F,z=!1,U=[],K){let I=U.slice(),Z=F(X=>{I?I.push(X):te.fire(X)});K&&K.add(Z);let W=()=>{I?.forEach(X=>te.fire(X)),I=null},te=new ze({onWillAddFirstListener(){Z||(Z=F(X=>te.fire(X)),K&&K.add(Z))},onDidAddFirstListener(){I&&(z?setTimeout(W):W())},onDidRemoveLastListener(){Z&&Z.dispose(),Z=null}});return K&&K.add(te),te.event}e.buffer=k;function N(F,z){return(U,K,I)=>{let Z=z(new A);return F(function(W){let te=Z.evaluate(W);te!==C&&U.call(K,te)},void 0,I)}}e.chain=N;let C=Symbol("HaltChainable");class A{constructor(){this.steps=[]}map(z){return this.steps.push(z),this}forEach(z){return this.steps.push(U=>(z(U),U)),this}filter(z){return this.steps.push(U=>z(U)?U:C),this}reduce(z,U){let K=U;return this.steps.push(I=>(K=z(K,I),K)),this}latch(z=(U,K)=>U===K){let U=!0,K;return this.steps.push(I=>{let Z=U||!z(I,K);return U=!1,K=I,Z?I:C}),this}evaluate(z){for(let U of this.steps)if(z=U(z),z===C)break;return z}}function j(F,z,U=K=>K){let K=(...te)=>W.fire(U(...te)),I=()=>F.on(z,K),Z=()=>F.removeListener(z,K),W=new ze({onWillAddFirstListener:I,onDidRemoveLastListener:Z});return W.event}e.fromNodeEventEmitter=j;function T(F,z,U=K=>K){let K=(...te)=>W.fire(U(...te)),I=()=>F.addEventListener(z,K),Z=()=>F.removeEventListener(z,K),W=new ze({onWillAddFirstListener:I,onDidRemoveLastListener:Z});return W.event}e.fromDOMEventEmitter=T;function M(F){return new Promise(z=>s(F)(z))}e.toPromise=M;function O(F){let z=new ze;return F.then(U=>{z.fire(U)},()=>{z.fire(void 0)}).finally(()=>{z.dispose()}),z.event}e.fromPromise=O;function $(F,z){return F(U=>z.fire(U))}e.forward=$;function D(F,z,U){return z(U),F(K=>z(K))}e.runAndSubscribe=D;class P{constructor(z,U){this._observable=z,this._counter=0,this._hasChanged=!1;let K={onWillAddFirstListener:()=>{z.addObserver(this)},onDidRemoveLastListener:()=>{z.removeObserver(this)}};this.emitter=new ze(K),U&&U.add(this.emitter)}beginUpdate(z){this._counter++}handlePossibleChange(z){}handleChange(z,U){this._hasChanged=!0}endUpdate(z){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function B(F,z){return new P(F,z).emitter.event}e.fromObservable=B;function G(F){return(z,U,K)=>{let I=0,Z=!1,W={beginUpdate(){I++},endUpdate(){I--,I===0&&(F.reportChanges(),Z&&(Z=!1,z.call(U)))},handlePossibleChange(){},handleChange(){Z=!0}};F.addObserver(W),F.reportChanges();let te={dispose(){F.removeObserver(W)}};return K instanceof xa?K.add(te):Array.isArray(K)&&K.push(te),te}}e.fromObservableLight=G})(Ys||={});var o0=class l0{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${l0._idPool++}`,l0.all.add(this)}start(t){this._stopWatch=new oF,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}}};o0.all=new Set,o0._idPool=0;var lF=o0,cF=-1,vj=class _j{constructor(t,s,n=(_j._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 hF(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}};vj._idPool=1;var uF=vj,dF=class yj{constructor(t){this.value=t}static create(){let t=new Error;return new yj(t.stack??"")}print(){console.warn(this.value.split(`
|
|
101
|
+
`).slice(2).join(`
|
|
102
|
+
`))}},hF=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},fF=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},mF=0,Sg=class{constructor(e){this.value=e,this.id=mF++}},pF=2,gF,ze=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new uF(t?.onListenerError??Sh,this._options?.leakWarningThreshold??cF):void 0,this._perfMon=this._options?._profName?new lF(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(t,s,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let h=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(h);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],d=new fF(`${h}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(this._options?.onListenerError||Sh)(d),mt.None}if(this._disposed)return mt.None;s&&(t=t.bind(s));let o=new Sg(t),l;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(o.stack=dF.create(),l=this._leakageMon.check(o.stack,this._size+1)),this._listeners?this._listeners instanceof Sg?(this._deliveryQueue??=new xF,this._listeners=[this._listeners,o]):this._listeners.push(o):(this._options?.onWillAddFirstListener?.(this),this._listeners=o,this._options?.onDidAddFirstListener?.(this)),this._size++;let u=Qt(()=>{l?.(),this._removeListener(o)});return n instanceof xa?n.add(u):Array.isArray(n)&&n.push(u),u},this._event}_removeListener(t){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let s=this._listeners,n=s.indexOf(t);if(n===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,s[n]=void 0;let o=this._deliveryQueue.current===this;if(this._size*pF<=s.length){let l=0;for(let u=0;u<s.length;u++)s[u]?s[l++]=s[u]:o&&(this._deliveryQueue.end--,l<this._deliveryQueue.i&&this._deliveryQueue.i--);s.length=l}}_deliver(t,s){if(!t)return;let n=this._options?.onListenerError||Sh;if(!n){t.value(s);return}try{t.value(s)}catch(o){n(o)}}_deliverQueue(t){let s=t.current._listeners;for(;t.i<t.end;)this._deliver(s[t.i++],t.value);t.reset()}fire(t){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof Sg)this._deliver(this._listeners,t);else{let s=this._deliveryQueue;s.enqueue(this,t,this._listeners.length),this._deliverQueue(s)}this._perfMon?.stop()}hasListeners(){return this._size>0}},xF=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}},c0=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ze,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ze,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,s){if(this.getZoomLevel(s)===t)return;let n=this.getWindowId(s);this.mapWindowIdToZoomLevel.set(n,t),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,s){this.mapWindowIdToZoomFactor.set(this.getWindowId(s),t)}setFullscreen(t,s){if(this.isFullscreen(s)===t)return;let n=this.getWindowId(s);this.mapWindowIdToFullScreen.set(n,t),this._onDidChangeFullscreen.fire(n)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};c0.INSTANCE=new c0;var Fb=c0;function bF(e,t,s){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",s)}Fb.INSTANCE.onDidChangeZoomLevel;function vF(e){return Fb.INSTANCE.getZoomFactor(e)}Fb.INSTANCE.onDidChangeFullscreen;var yl=typeof navigator=="object"?navigator.userAgent:"",u0=yl.indexOf("Firefox")>=0,_F=yl.indexOf("AppleWebKit")>=0,qb=yl.indexOf("Chrome")>=0,yF=!qb&&yl.indexOf("Safari")>=0;yl.indexOf("Electron/")>=0;yl.indexOf("Android")>=0;var kg=!1;if(typeof Nr.matchMedia=="function"){let e=Nr.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Nr.matchMedia("(display-mode: fullscreen)");kg=e.matches,bF(Nr,e,({matches:s})=>{kg&&t.matches||(kg=s)})}var il="en",d0=!1,h0=!1,kh=!1,wj=!1,eh,Nh=il,C2=il,wF,Sr,to=globalThis,Hn;typeof to.vscode<"u"&&typeof to.vscode.process<"u"?Hn=to.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Hn=process);var SF=typeof Hn?.versions?.electron=="string",kF=SF&&Hn?.type==="renderer";if(typeof Hn=="object"){d0=Hn.platform==="win32",h0=Hn.platform==="darwin",kh=Hn.platform==="linux",kh&&Hn.env.SNAP&&Hn.env.SNAP_REVISION,Hn.env.CI||Hn.env.BUILD_ARTIFACTSTAGINGDIRECTORY,eh=il,Nh=il;let e=Hn.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);eh=t.userLocale,C2=t.osLocale,Nh=t.resolvedLanguage||il,wF=t.languagePack?.translationsConfigFile}catch{}wj=!0}else typeof navigator=="object"&&!kF?(Sr=navigator.userAgent,d0=Sr.indexOf("Windows")>=0,h0=Sr.indexOf("Macintosh")>=0,(Sr.indexOf("Macintosh")>=0||Sr.indexOf("iPad")>=0||Sr.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,kh=Sr.indexOf("Linux")>=0,Sr?.indexOf("Mobi")>=0,Nh=globalThis._VSCODE_NLS_LANGUAGE||il,eh=navigator.language.toLowerCase(),C2=eh):console.error("Unable to resolve platform.");var Sj=d0,Ki=h0,NF=kh,E2=wj,Qi=Sr,ca=Nh,CF;(e=>{function t(){return ca}e.value=t;function s(){return ca.length===2?ca==="en":ca.length>=3?ca[0]==="e"&&ca[1]==="n"&&ca[2]==="-":!1}e.isDefaultVariant=s;function n(){return ca==="en"}e.isDefault=n})(CF||={});var EF=typeof to.postMessage=="function"&&!to.importScripts;(()=>{if(EF){let e=[];to.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}),to.postMessage({vscodeScheduleAsyncWork:n},"*")}}return e=>setTimeout(e)})();var jF=!!(Qi&&Qi.indexOf("Chrome")>=0);Qi&&Qi.indexOf("Firefox")>=0;!jF&&Qi&&Qi.indexOf("Safari")>=0;Qi&&Qi.indexOf("Edg/")>=0;Qi&&Qi.indexOf("Android")>=0;var Xo=typeof navigator=="object"?navigator:{};E2||document.queryCommandSupported&&document.queryCommandSupported("copy")||Xo&&Xo.clipboard&&Xo.clipboard.writeText,E2||Xo&&Xo.clipboard&&Xo.clipboard.readText;var Vb=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}},Ng=new Vb,j2=new Vb,A2=new Vb,AF=new Array(230),kj;(e=>{function t(h){return Ng.keyCodeToStr(h)}e.toString=t;function s(h){return Ng.strToKeyCode(h)}e.fromString=s;function n(h){return j2.keyCodeToStr(h)}e.toUserSettingsUS=n;function o(h){return A2.keyCodeToStr(h)}e.toUserSettingsGeneral=o;function l(h){return j2.strToKeyCode(h)||A2.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 Ng.keyCodeToStr(h)}e.toElectronAccelerator=u})(kj||={});var TF=class Nj{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 Nj&&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 RF([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},RF=class{constructor(e){if(e.length===0)throw sF("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 MF(e){if(e.charCode){let s=String.fromCharCode(e.charCode).toUpperCase();return kj.fromString(s)}let t=e.keyCode;if(t===3)return 7;if(u0)switch(t){case 59:return 85;case 60:if(NF)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Ki)return 57;break}else if(_F&&(Ki&&t===93||!Ki&&t===92))return 57;return AF[t]||0}var DF=Ki?256:2048,OF=512,LF=1024,zF=Ki?2048:256,T2=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=MF(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|=DF),this.altKey&&(t|=OF),this.shiftKey&&(t|=LF),this.metaKey&&(t|=zF),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new TF(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},R2=new WeakMap;function BF(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 PF=class{static getSameOriginWindowChain(e){let t=R2.get(e);if(!t){t=[],R2.set(e,t);let s=e,n;do n=BF(s),n?t.push({window:new WeakRef(s),iframeElement:s.frameElement||null}):t.push({window:new WeakRef(s),iframeElement:null}),s=n;while(s)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let s=0,n=0,o=this.getSameOriginWindowChain(e);for(let l of o){let u=l.window.deref();if(s+=u?.scrollY??0,n+=u?.scrollX??0,u===t||!l.iframeElement)break;let h=l.iframeElement.getBoundingClientRect();s+=h.top,n+=h.left}return{top:s,left:n}}},th=class{constructor(t,s){this.timestamp=Date.now(),this.browserEvent=s,this.leftButton=s.button===0,this.middleButton=s.button===1,this.rightButton=s.button===2,this.buttons=s.buttons,this.target=s.target,this.detail=s.detail||1,s.type==="dblclick"&&(this.detail=2),this.ctrlKey=s.ctrlKey,this.shiftKey=s.shiftKey,this.altKey=s.altKey,this.metaKey=s.metaKey,typeof s.pageX=="number"?(this.posx=s.pageX,this.posy=s.pageY):(this.posx=s.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=s.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=PF.getPositionOfChildWindowRelativeToAncestorWindow(t,s.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},M2=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(qb){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?u0&&!Ki?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")yF&&Sj?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?u0&&!Ki?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()}},Cj=Object.freeze(function(e,t){let s=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(s)}}}),IF;(e=>{function t(s){return s===e.None||s===e.Cancelled||s instanceof $F?!0:!s||typeof s!="object"?!1:typeof s.isCancellationRequested=="boolean"&&typeof s.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ys.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Cj})})(IF||={});var $F=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?Cj:(this._emitter||(this._emitter=new ze),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Gb=class{constructor(t,s){this._isDisposed=!1,this._token=-1,typeof t=="function"&&typeof s=="number"&&this.setIfNotSet(t,s)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(t,s){if(this._isDisposed)throw new i0("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,t()},s)}setIfNotSet(t,s){if(this._isDisposed)throw new i0("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,t()},s))}},HF=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 i0("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let n=s.setInterval(()=>{e()},t);this.disposable=Qt(()=>{s.clearInterval(n),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},UF;(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})(UF||={});var D2=class ai{static fromArray(t){return new ai(s=>{s.emitMany(t)})}static fromPromise(t){return new ai(async s=>{s.emitMany(await t)})}static fromPromises(t){return new ai(async s=>{await Promise.all(t.map(async n=>s.emitOne(await n)))})}static merge(t){return new ai(async s=>{await Promise.all(t.map(async n=>{for await(let o of n)s.emitOne(o)}))})}constructor(t,s){this._state=0,this._results=[],this._error=null,this._onReturn=s,this._onStateChanged=new ze,queueMicrotask(async()=>{let n={emitOne:o=>this.emitOne(o),emitMany:o=>this.emitMany(o),reject:o=>this.reject(o)};try{await Promise.resolve(t(n)),this.resolve()}catch(o){this.reject(o)}finally{n.emitOne=void 0,n.emitMany=void 0,n.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Ys.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,s){return new ai(async n=>{for await(let o of t)n.emitOne(s(o))})}map(t){return ai.map(this,t)}static filter(t,s){return new ai(async n=>{for await(let o of t)s(o)&&n.emitOne(o)})}filter(t){return ai.filter(this,t)}static coalesce(t){return ai.filter(t,s=>!!s)}coalesce(){return ai.coalesce(this)}static async toPromise(t){let s=[];for await(let n of t)s.push(n);return s}toPromise(){return ai.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};D2.EMPTY=D2.fromArray([]);var{getWindow:Gi,getWindowId:FF,onDidRegisterWindow:qF}=(function(){let e=new Map,t={window:Nr,disposables:new xa};e.set(Nr.vscodeWindowId,t);let s=new ze,n=new ze,o=new ze;function l(u,h){return(typeof u=="number"?e.get(u):void 0)??(h?t:void 0)}return{onDidRegisterWindow:s.event,onWillUnregisterWindow:o.event,onDidUnregisterWindow:n.event,registerWindow(u){if(e.has(u.vscodeWindowId))return mt.None;let h=new xa,f={window:u,disposables:h.add(new xa)};return e.set(u.vscodeWindowId,f),h.add(Qt(()=>{e.delete(u.vscodeWindowId),n.fire(u)})),h.add(at(u,zs.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:Nr},getDocument(u){return Gi(u).document}}})(),VF=class{constructor(e,t,s,n){this._node=e,this._type=t,this._handler=s,this._options=n||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function at(e,t,s,n){return new VF(e,t,s,n)}var O2=function(e,t,s,n){return at(e,t,s,n)},Wb,GF=class extends HF{constructor(e){super(),this.defaultTarget=e&&Gi(e)}cancelAndSet(e,t,s){return super.cancelAndSet(e,t,s??this.defaultTarget)}},L2=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Sh(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,s=new Map,n=new Map,o=l=>{s.set(l,!1);let u=e.get(l)??[];for(t.set(l,u),e.set(l,[]),n.set(l,!0);u.length>0;)u.sort(L2.sort),u.shift().execute();n.set(l,!1)};Wb=(l,u,h=0)=>{let f=FF(l),d=new L2(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 WF(e){let t=e.getBoundingClientRect(),s=Gi(e);return{left:t.left+s.scrollX,top:t.top+s.scrollY,width:t.width,height:t.height}}var zs={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},KF=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=En(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=En(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=En(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=En(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=En(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=En(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=En(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=En(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=En(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=En(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=En(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=En(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=En(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=En(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function En(e){return typeof e=="number"?`${e}px`:e}function Wc(e){return new KF(e)}var Ej=class{constructor(){this._hooks=new xa,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let s=this._onStopCallback;this._onStopCallback=null,e&&s&&s(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,s,n,o){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=n,this._onStopCallback=o;let l=e;try{e.setPointerCapture(t),this._hooks.add(Qt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{l=Gi(e)}this._hooks.add(at(l,zs.POINTER_MOVE,u=>{if(u.buttons!==s){this.stopMonitoring(!0);return}u.preventDefault(),this._pointerMoveCallback(u)})),this._hooks.add(at(l,zs.POINTER_UP,u=>this.stopMonitoring(!0)))}};function YF(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 Ui;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Ui||={});var Dc=class tn extends mt{constructor(){super(),this.dispatched=!1,this.targets=new N2,this.ignoreTargets=new N2,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Ys.runAndSubscribe(qF,({window:t,disposables:s})=>{s.add(at(t.document,"touchstart",n=>this.onTouchStart(n),{passive:!1})),s.add(at(t.document,"touchend",n=>this.onTouchEnd(t,n))),s.add(at(t.document,"touchmove",n=>this.onTouchMove(n),{passive:!1}))},{window:Nr,disposables:this._store}))}static addTarget(t){if(!tn.isTouchDevice())return mt.None;tn.INSTANCE||(tn.INSTANCE=new tn);let s=tn.INSTANCE.targets.push(t);return Qt(s)}static ignoreTarget(t){if(!tn.isTouchDevice())return mt.None;tn.INSTANCE||(tn.INSTANCE=new tn);let s=tn.INSTANCE.ignoreTargets.push(t);return Qt(s)}static isTouchDevice(){return"ontouchstart"in Nr||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(Ui.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<tn.HOLD_DELAY&&Math.abs(f.initialPageX-In(f.rollingPageX))<30&&Math.abs(f.initialPageY-In(f.rollingPageY))<30){let p=this.newGestureEvent(Ui.Tap,f.initialTarget);p.pageX=In(f.rollingPageX),p.pageY=In(f.rollingPageY),this.dispatchEvent(p)}else if(d>=tn.HOLD_DELAY&&Math.abs(f.initialPageX-In(f.rollingPageX))<30&&Math.abs(f.initialPageY-In(f.rollingPageY))<30){let p=this.newGestureEvent(Ui.Contextmenu,f.initialTarget);p.pageX=In(f.rollingPageX),p.pageY=In(f.rollingPageY),this.dispatchEvent(p)}else if(o===1){let p=In(f.rollingPageX),g=In(f.rollingPageY),x=In(f.rollingTimestamps)-f.rollingTimestamps[0],v=p-f.rollingPageX[0],w=g-f.rollingPageY[0],k=[...this.targets].filter(N=>f.initialTarget instanceof Node&&N.contains(f.initialTarget));this.inertia(t,k,n,Math.abs(v)/x,v>0?1:-1,p,Math.abs(w)/x,w>0?1:-1,g)}this.dispatchEvent(this.newGestureEvent(Ui.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===Ui.Tap){let s=new Date().getTime(),n=0;s-this._lastSetTapCountTime>tn.CLEAR_TAP_COUNT_TIME?n=1:n=2,this._lastSetTapCountTime=s,t.tapCount=n}else(t.type===Ui.Change||t.type===Ui.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=Wb(t,()=>{let p=Date.now(),g=p-n,x=0,v=0,w=!0;o+=tn.SCROLL_FRICTION*g,h+=tn.SCROLL_FRICTION*g,o>0&&(w=!1,x=l*o*g),h>0&&(w=!1,v=f*h*g);let k=this.newGestureEvent(Ui.Change);k.translationX=x,k.translationY=v,s.forEach(N=>N.dispatchEvent(k)),w||this.inertia(t,s,p,o,l,u+x,h,f,d+v)})}onTouchMove(t){let s=Date.now();for(let n=0,o=t.changedTouches.length;n<o;n++){let l=t.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("end of an UNKNOWN touch",l);continue}let u=this.activeTouches[l.identifier],h=this.newGestureEvent(Ui.Change,u.initialTarget);h.translationX=l.pageX-In(u.rollingPageX),h.translationY=l.pageY-In(u.rollingPageY),h.pageX=l.pageX,h.pageY=l.pageY,this.dispatchEvent(h),u.rollingPageX.length>3&&(u.rollingPageX.shift(),u.rollingPageY.shift(),u.rollingTimestamps.shift()),u.rollingPageX.push(l.pageX),u.rollingPageY.push(l.pageY),u.rollingTimestamps.push(s)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Dc.SCROLL_FRICTION=-.005,Dc.HOLD_DELAY=700,Dc.CLEAR_TAP_COUNT_TIME=400,os([YF],Dc,"isTouchDevice",1);var XF=Dc,Kb=class extends mt{onclick(e,t){this._register(at(e,zs.CLICK,s=>t(new th(Gi(e),s))))}onmousedown(e,t){this._register(at(e,zs.MOUSE_DOWN,s=>t(new th(Gi(e),s))))}onmouseover(e,t){this._register(at(e,zs.MOUSE_OVER,s=>t(new th(Gi(e),s))))}onmouseleave(e,t){this._register(at(e,zs.MOUSE_LEAVE,s=>t(new th(Gi(e),s))))}onkeydown(e,t){this._register(at(e,zs.KEY_DOWN,s=>t(new T2(s))))}onkeyup(e,t){this._register(at(e,zs.KEY_UP,s=>t(new T2(s))))}oninput(e,t){this._register(at(e,zs.INPUT,t))}onblur(e,t){this._register(at(e,zs.BLUR,t))}onfocus(e,t){this._register(at(e,zs.FOCUS,t))}onchange(e,t){this._register(at(e,zs.CHANGE,t))}ignoreGesture(e){return XF.ignoreTarget(e)}},z2=11,ZF=class extends Kb{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=z2+"px",this.domNode.style.height=z2+"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 Ej),this._register(O2(this.bgDomNode,zs.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(O2(this.domNode,zs.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new GF),this._pointerdownScheduleRepeatTimer=this._register(new Gb)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Gi(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()}},QF=class f0{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 f0(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 f0(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}}},JF=class extends mt{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new ze),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new QF(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 P2(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=P2.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)))}},B2=class{constructor(e,t,s){this.scrollLeft=e,this.scrollTop=t,this.isDone=s}};function Cg(e,t){let s=t-e;return function(n){return e+s*sq(n)}}function eq(e,t,s){return function(n){return n<s?e(n/s):t((n-s)/(1-s))}}var P2=class m0{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),eq(Cg(t,o),Cg(l,s),.33)}return Cg(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 B2(n,o,!1)}return new B2(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,s,n){return m0.start(t,s,n)}static start(t,s,n){n=n+10;let o=Date.now()-10;return new m0(t,s,o,n)}};function tq(e){return Math.pow(e,3)}function sq(e){return 1-tq(1-e)}var nq=class extends mt{constructor(e,t,s){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=s,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Gb)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?" fade":"")))}},iq=140,jj=class extends Kb{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 nq(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Ej),this._shouldRender=!0,this.domNode=Wc(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(at(this.domNode.domNode,zs.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new ZF(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,s,n){this.slider=Wc(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof s=="number"&&this.slider.setWidth(s),typeof n=="number"&&this.slider.setHeight(n),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(at(this.slider.domNode,zs.POINTER_DOWN,o=>{o.button===0&&(o.preventDefault(),this._sliderPointerDown(o))})),this.onclick(this.slider.domNode,o=>{o.leftButton&&o.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,s=t+this._scrollbarState.getSliderPosition(),n=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),o=this._sliderPointerPosition(e);s<=o&&o<=n?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,s;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,s=e.offsetY;else{let o=WF(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(Sj&&u>iq){this._setDesiredScrollPositionNow(n.getScrollPosition());return}let h=this._sliderPointerPosition(o)-t;this._setDesiredScrollPositionNow(n.getDesiredScrollPositionFromDelta(h))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},Aj=class p0{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 p0(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=p0._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)}},rq=class extends jj{constructor(e,t,s){let n=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:s,scrollbarState:new Aj(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}},aq=class extends jj{constructor(e,t,s){let n=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:s,scrollbarState:new Aj(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}},oq=500,I2=50,lq=class{constructor(e,t,s){this.timestamp=e,this.deltaX=t,this.deltaY=s,this.score=0}},g0=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(qb){let s=Gi(t.browserEvent),n=vF(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 lq(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}};g0.INSTANCE=new g0;var cq=g0,uq=class extends Kb{constructor(e,t,s){super(),this._onScroll=this._register(new ze),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new ze),this.onWillScroll=this._onWillScroll.event,this._options=hq(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 aq(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new rq(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 Gb),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=ro(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,Ki&&(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 M2(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=ro(this._mouseWheelToDispose),e)){let t=s=>{this._onMouseWheel(new M2(s))};this._mouseWheelToDispose.push(at(this._listenOnDomNode,zs.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=cq.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=!Ki&&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=I2*o,p=h.scrollTop-(d<0?Math.floor(d):Math.ceil(d));this._verticalScrollbar.writeScrollPosition(f,p)}if(l){let d=I2*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(),oq)}},dq=class extends uq{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 hq(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,Ki&&(t.className+=" mac"),t}var x0=class extends mt{constructor(e,t,s,n,o,l,u,h){super(),this._bufferService=s,this._optionsService=u,this._renderService=h,this._onRequestScrollLines=this._register(new ze),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let f=this._register(new JF({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:d=>Wb(n.window,d)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{f.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new dq(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(Ys.runAndSubscribe(l.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=l.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Qt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=n.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Qt(()=>this._styleElement.remove())),this._register(Ys.runAndSubscribe(l.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${l.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${l.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${l.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
103
|
+
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(d=>this._handleScroll(d)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),s=t-this._bufferService.buffer.ydisp;s!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(s)),this._isHandlingScroll=!1}};x0=os([Fe(2,hn),Fe(3,Mr),Fe(4,cj),Fe(5,_l),Fe(6,fn),Fe(7,Dr)],x0);var b0=class extends mt{constructor(e,t,s,n,o){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=s,this._decorationService=n,this._renderService=o,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(l=>this._removeDecoration(l))),this._register(Qt(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",e?.options?.layer==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let s=e.options.x??0;return s&&s>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let s=this._decorationElements.get(e);s||(s=this._createElement(e),e.element=s,this._decorationElements.set(e,s),this._container.appendChild(s),e.onDispose(()=>{this._decorationElements.delete(e),s.remove()})),s.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(s.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,s.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,s.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,s.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(s)}}_refreshXPosition(e,t=e.element){if(!t)return;let s=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=s?`${s*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=s?`${s*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};b0=os([Fe(1,hn),Fe(2,Mr),Fe(3,xu),Fe(4,Dr)],b0);var fq=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)}},$i={full:0,left:0,center:0,right:0},ua={full:0,left:0,center:0,right:0},yc={full:0,left:0,center:0,right:0},Yh=class extends mt{constructor(e,t,s,n,o,l,u,h){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=s,this._decorationService=n,this._renderService=o,this._optionsService=l,this._themeService=u,this._coreBrowserService=h,this._colorZoneStore=new fq,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(Qt(()=>this._canvas?.remove()));let f=this._canvas.getContext("2d");if(f)this._ctx=f;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);ua.full=this._canvas.width,ua.left=e,ua.center=t,ua.right=e,this._refreshDrawHeightConstants(),yc.full=1,yc.left=1,yc.center=1+ua.left,yc.right=1+ua.left+ua.center}_refreshDrawHeightConstants(){$i.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);$i.left=t,$i.center=t,$i.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*$i.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*$i.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*$i.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*$i.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)-$i[e.position||"full"]/2),ua[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+$i[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};Yh=os([Fe(2,hn),Fe(3,xu),Fe(4,Dr),Fe(5,fn),Fe(6,_l),Fe(7,Mr)],Yh);var Ee;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
|
|
104
|
+
`,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(Ee||={});var Ch;(e=>(e.PAD="",e.HOP="",e.BPH="",e.NBH="",e.IND="",e.NEL="
",e.SSA="",e.ESA="",e.HTS="",e.HTJ="",e.VTS="",e.PLD="",e.PLU="",e.RI="",e.SS2="",e.SS3="",e.DCS="",e.PU1="",e.PU2="",e.STS="",e.CCH="",e.MW="",e.SPA="",e.EPA="",e.SOS="",e.SGCI="",e.SCI="",e.CSI="",e.ST="",e.OSC="",e.PM="",e.APC=""))(Ch||={});var Tj;(e=>e.ST=`${Ee.ESC}\\`)(Tj||={});var v0=class{constructor(e,t,s,n,o,l){this._textarea=e,this._compositionView=t,this._bufferService=s,this._optionsService=n,this._coreService=o,this._renderService=l,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let s;t.start+=this._dataAlreadySent.length,this._isComposing?s=this._textarea.value.substring(t.start,this._compositionPosition.start):s=this._textarea.value.substring(t.start),s.length>0&&this._coreService.triggerDataEvent(s,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,s=t.replace(e,"");this._dataAlreadySent=s,t.length>e.length?this._coreService.triggerDataEvent(s,!0):t.length<e.length?this._coreService.triggerDataEvent(`${Ee.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),s=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,o=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=o+"px",this._compositionView.style.top=n+"px",this._compositionView.style.height=s+"px",this._compositionView.style.lineHeight=s+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let l=this._compositionView.getBoundingClientRect();this._textarea.style.left=o+"px",this._textarea.style.top=n+"px",this._textarea.style.width=Math.max(l.width,1)+"px",this._textarea.style.height=Math.max(l.height,1)+"px",this._textarea.style.lineHeight=l.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};v0=os([Fe(2,hn),Fe(3,fn),Fe(4,ho),Fe(5,Dr)],v0);var Bs=0,Ps=0,Is=0,rs=0,$2={css:"#00000000",rgba:0},Ns;(e=>{function t(o,l,u,h){return h!==void 0?`#${Fa(o)}${Fa(l)}${Fa(u)}${Fa(h)}`:`#${Fa(o)}${Fa(l)}${Fa(u)}`}e.toCss=t;function s(o,l,u,h=255){return(o<<24|l<<16|u<<8|h)>>>0}e.toRgba=s;function n(o,l,u,h){return{css:e.toCss(o,l,u,h),rgba:e.toRgba(o,l,u,h)}}e.toColor=n})(Ns||={});var Wt;(e=>{function t(f,d){if(rs=(d.rgba&255)/255,rs===1)return{css:d.css,rgba:d.rgba};let p=d.rgba>>24&255,g=d.rgba>>16&255,x=d.rgba>>8&255,v=f.rgba>>24&255,w=f.rgba>>16&255,k=f.rgba>>8&255;Bs=v+Math.round((p-v)*rs),Ps=w+Math.round((g-w)*rs),Is=k+Math.round((x-k)*rs);let N=Ns.toCss(Bs,Ps,Is),C=Ns.toRgba(Bs,Ps,Is);return{css:N,rgba:C}}e.blend=t;function s(f){return(f.rgba&255)===255}e.isOpaque=s;function n(f,d,p){let g=Eh.ensureContrastRatio(f.rgba,d.rgba,p);if(g)return Ns.toColor(g>>24&255,g>>16&255,g>>8&255)}e.ensureContrastRatio=n;function o(f){let d=(f.rgba|255)>>>0;return[Bs,Ps,Is]=Eh.toChannels(d),{css:Ns.toCss(Bs,Ps,Is),rgba:d}}e.opaque=o;function l(f,d){return rs=Math.round(d*255),[Bs,Ps,Is]=Eh.toChannels(f.rgba),{css:Ns.toCss(Bs,Ps,Is,rs),rgba:Ns.toRgba(Bs,Ps,Is,rs)}}e.opacity=l;function u(f,d){return rs=f.rgba&255,l(f,rs*d/255)}e.multiplyOpacity=u;function h(f){return[f.rgba>>24&255,f.rgba>>16&255,f.rgba>>8&255]}e.toColorRGB=h})(Wt||={});var ts;(e=>{let t,s;try{let o=document.createElement("canvas");o.width=1,o.height=1;let l=o.getContext("2d",{willReadFrequently:!0});l&&(t=l,t.globalCompositeOperation="copy",s=t.createLinearGradient(0,0,1,1))}catch{}function n(o){if(o.match(/#[\da-f]{3,8}/i))switch(o.length){case 4:return Bs=parseInt(o.slice(1,2).repeat(2),16),Ps=parseInt(o.slice(2,3).repeat(2),16),Is=parseInt(o.slice(3,4).repeat(2),16),Ns.toColor(Bs,Ps,Is);case 5:return Bs=parseInt(o.slice(1,2).repeat(2),16),Ps=parseInt(o.slice(2,3).repeat(2),16),Is=parseInt(o.slice(3,4).repeat(2),16),rs=parseInt(o.slice(4,5).repeat(2),16),Ns.toColor(Bs,Ps,Is,rs);case 7:return{css:o,rgba:(parseInt(o.slice(1),16)<<8|255)>>>0};case 9:return{css:o,rgba:parseInt(o.slice(1),16)>>>0}}let l=o.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(l)return Bs=parseInt(l[1]),Ps=parseInt(l[2]),Is=parseInt(l[3]),rs=Math.round((l[5]===void 0?1:parseFloat(l[5]))*255),Ns.toColor(Bs,Ps,Is,rs);if(!t||!s)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=s,t.fillStyle=o,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Bs,Ps,Is,rs]=t.getImageData(0,0,1,1).data,rs!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Ns.toRgba(Bs,Ps,Is,rs),css:o}}e.toColor=n})(ts||={});var ln;(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})(ln||={});var Eh;(e=>{function t(u,h){if(rs=(h&255)/255,rs===1)return h;let f=h>>24&255,d=h>>16&255,p=h>>8&255,g=u>>24&255,x=u>>16&255,v=u>>8&255;return Bs=g+Math.round((f-g)*rs),Ps=x+Math.round((d-x)*rs),Is=v+Math.round((p-v)*rs),Ns.toRgba(Bs,Ps,Is)}e.blend=t;function s(u,h,f){let d=ln.relativeLuminance(u>>8),p=ln.relativeLuminance(h>>8);if(yr(d,p)<f){if(p<d){let v=n(u,h,f),w=yr(d,ln.relativeLuminance(v>>8));if(w<f){let k=o(u,h,f),N=yr(d,ln.relativeLuminance(k>>8));return w>N?v:k}return v}let g=o(u,h,f),x=yr(d,ln.relativeLuminance(g>>8));if(x<f){let v=n(u,h,f),w=yr(d,ln.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=yr(ln.relativeLuminance2(x,v,w),ln.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=yr(ln.relativeLuminance2(x,v,w),ln.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=yr(ln.relativeLuminance2(x,v,w),ln.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=yr(ln.relativeLuminance2(x,v,w),ln.relativeLuminance2(d,p,g));return(x<<24|v<<16|w<<8|255)>>>0}e.increaseLuminance=o;function l(u){return[u>>24&255,u>>16&255,u>>8&255,u&255]}e.toChannels=l})(Eh||={});function Fa(e){let t=e.toString(16);return t.length<2?"0"+t:t}function yr(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var mq=class extends gu{constructor(e,t,s){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=s}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Xh=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new ui}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let s=[],n=t.translateToString(!0),o=0,l=0,u=0,h=t.getFg(0),f=t.getBg(0);for(let d=0;d<t.getTrimmedLength();d++)if(t.loadCell(d,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==h||this._workCell.bg!==f){if(d-o>1){let p=this._getJoinedRanges(n,u,l,t,o);for(let g=0;g<p.length;g++)s.push(p[g])}o=d,u=l,h=this._workCell.fg,f=this._workCell.bg}l+=this._workCell.getChars().length||ga.length}if(this._bufferService.cols-o>1){let d=this._getJoinedRanges(n,u,l,t,o);for(let p=0;p<d.length;p++)s.push(d[p])}return s}_getJoinedRanges(e,t,s,n,o){let l=e.substring(t,s),u=[];try{u=this._characterJoiners[0].handler(l)}catch(h){console.error(h)}for(let h=1;h<this._characterJoiners.length;h++)try{let f=this._characterJoiners[h].handler(l);for(let d=0;d<f.length;d++)Xh._mergeRanges(u,f[d])}catch(f){console.error(f)}return this._stringRangesToCellRanges(u,n,o),u}_stringRangesToCellRanges(e,t,s){let n=0,o=!1,l=0,u=e[n];if(u){for(let h=s;h<this._bufferService.cols;h++){let f=t.getWidth(h),d=t.getString(h).length||ga.length;if(f!==0){if(!o&&u[0]<=l&&(u[0]=h,o=!0),u[1]<=l){if(u[1]=h,u=e[++n],!u)break;u[0]<=l?(u[0]=h,o=!0):o=!1}l+=d}}u&&(u[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let s=!1;for(let n=0;n<e.length;n++){let o=e[n];if(s){if(t[1]<=o[0])return e[n-1][1]=t[1],e;if(t[1]<=o[1])return e[n-1][1]=Math.max(t[1],o[1]),e.splice(n,1),e;e.splice(n,1),n--}else{if(t[1]<=o[0])return e.splice(n,0,t),e;if(t[1]<=o[1])return o[0]=Math.min(t[0],o[0]),e;t[0]<o[1]&&(o[0]=Math.min(t[0],o[0]),s=!0);continue}}return s?e[e.length-1][1]=t[1]:e.push(t),e}};Xh=os([Fe(0,hn)],Xh);function pq(e){return 57508<=e&&e<=57558}function gq(e){return 9472<=e&&e<=9631}function xq(e){return pq(e)||gq(e)}function bq(){return{css:{canvas:sh(),cell:sh()},device:{canvas:sh(),cell:sh(),char:{width:0,height:0,left:0,top:0}}}}function sh(){return{width:0,height:0}}var _0=class{constructor(e,t,s,n,o,l,u){this._document=e,this._characterJoinerService=t,this._optionsService=s,this._coreBrowserService=n,this._coreService=o,this._decorationService=l,this._themeService=u,this._workCell=new ui,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,s){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=s}createRow(e,t,s,n,o,l,u,h,f,d,p){let g=[],x=this._characterJoinerService.getJoinedCharacters(t),v=this._themeService.colors,w=e.getNoBgTrimmedLength();s&&w<l+1&&(w=l+1);let k,N=0,C="",A=0,j=0,T=0,M=0,O=!1,$=0,D=!1,P=0,B=0,G=[],F=d!==-1&&p!==-1;for(let z=0;z<w;z++){e.loadCell(z,this._workCell);let U=this._workCell.getWidth();if(U===0)continue;let K=!1,I=z>=B,Z=z,W=this._workCell;if(x.length>0&&z===x[0][0]&&I){let $e=x.shift(),St=this._isCellInSelection($e[0],t);for(A=$e[0]+1;A<$e[1];A++)I&&=St===this._isCellInSelection(A,t);I&&=!s||l<$e[0]||l>=$e[1],I?(K=!0,W=new mq(this._workCell,e.translateToString(!0,$e[0],$e[1]),$e[1]-$e[0]),Z=$e[1]-1,U=W.getWidth()):B=$e[1]}let te=this._isCellInSelection(z,t),X=s&&z===l,V=F&&z>=d&&z<=p,q=!1;this._decorationService.forEachDecorationAtCell(z,t,void 0,$e=>{q=!0});let oe=W.getChars()||ga;if(oe===" "&&(W.isUnderline()||W.isOverline())&&(oe=" "),P=U*h-f.get(oe,W.isBold(),W.isItalic()),!k)k=this._document.createElement("span");else if(N&&(te&&D||!te&&!D&&W.bg===j)&&(te&&D&&v.selectionForeground||W.fg===T)&&W.extended.ext===M&&V===O&&P===$&&!X&&!K&&!q&&I){W.isInvisible()?C+=ga:C+=oe,N++;continue}else N&&(k.textContent=C),k=this._document.createElement("span"),N=0,C="";if(j=W.bg,T=W.fg,M=W.extended.ext,O=V,$=P,D=te,K&&l>=z&&l<=Z&&(l=z),!this._coreService.isCursorHidden&&X&&this._coreService.isCursorInitialized){if(G.push("xterm-cursor"),this._coreBrowserService.isFocused)u&&G.push("xterm-cursor-blink"),G.push(n==="bar"?"xterm-cursor-bar":n==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(o)switch(o){case"outline":G.push("xterm-cursor-outline");break;case"block":G.push("xterm-cursor-block");break;case"bar":G.push("xterm-cursor-bar");break;case"underline":G.push("xterm-cursor-underline");break}}if(W.isBold()&&G.push("xterm-bold"),W.isItalic()&&G.push("xterm-italic"),W.isDim()&&G.push("xterm-dim"),W.isInvisible()?C=ga:C=W.getChars()||ga,W.isUnderline()&&(G.push(`xterm-underline-${W.extended.underlineStyle}`),C===" "&&(C=" "),!W.isUnderlineColorDefault()))if(W.isUnderlineColorRGB())k.style.textDecorationColor=`rgb(${gu.toColorRGB(W.getUnderlineColor()).join(",")})`;else{let $e=W.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&W.isBold()&&$e<8&&($e+=8),k.style.textDecorationColor=v.ansi[$e].css}W.isOverline()&&(G.push("xterm-overline"),C===" "&&(C=" ")),W.isStrikethrough()&&G.push("xterm-strikethrough"),V&&(k.style.textDecoration="underline");let ee=W.getFgColor(),fe=W.getFgColorMode(),ie=W.getBgColor(),Se=W.getBgColorMode(),Re=!!W.isInverse();if(Re){let $e=ee;ee=ie,ie=$e;let St=fe;fe=Se,Se=St}let De,Je,Ne=!1;this._decorationService.forEachDecorationAtCell(z,t,void 0,$e=>{$e.options.layer!=="top"&&Ne||($e.backgroundColorRGB&&(Se=50331648,ie=$e.backgroundColorRGB.rgba>>8&16777215,De=$e.backgroundColorRGB),$e.foregroundColorRGB&&(fe=50331648,ee=$e.foregroundColorRGB.rgba>>8&16777215,Je=$e.foregroundColorRGB),Ne=$e.options.layer==="top")}),!Ne&&te&&(De=this._coreBrowserService.isFocused?v.selectionBackgroundOpaque:v.selectionInactiveBackgroundOpaque,ie=De.rgba>>8&16777215,Se=50331648,Ne=!0,v.selectionForeground&&(fe=50331648,ee=v.selectionForeground.rgba>>8&16777215,Je=v.selectionForeground)),Ne&&G.push("xterm-decoration-top");let Ue;switch(Se){case 16777216:case 33554432:Ue=v.ansi[ie],G.push(`xterm-bg-${ie}`);break;case 50331648:Ue=Ns.toColor(ie>>16,ie>>8&255,ie&255),this._addStyle(k,`background-color:#${H2((ie>>>0).toString(16),"0",6)}`);break;default:Re?(Ue=v.foreground,G.push("xterm-bg-257")):Ue=v.background}switch(De||W.isDim()&&(De=Wt.multiplyOpacity(Ue,.5)),fe){case 16777216:case 33554432:W.isBold()&&ee<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ee+=8),this._applyMinimumContrast(k,Ue,v.ansi[ee],W,De,void 0)||G.push(`xterm-fg-${ee}`);break;case 50331648:let $e=Ns.toColor(ee>>16&255,ee>>8&255,ee&255);this._applyMinimumContrast(k,Ue,$e,W,De,Je)||this._addStyle(k,`color:#${H2(ee.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(k,Ue,v.foreground,W,De,Je)||Re&&G.push("xterm-fg-257")}G.length&&(k.className=G.join(" "),G.length=0),!X&&!K&&!q&&I?N++:k.textContent=C,P!==this.defaultSpacing&&(k.style.letterSpacing=`${P}px`),g.push(k),z=Z}return k&&N&&(k.textContent=C),g}_applyMinimumContrast(e,t,s,n,o,l){if(this._optionsService.rawOptions.minimumContrastRatio===1||xq(n.getCode()))return!1;let u=this._getContrastCache(n),h;if(!o&&!l&&(h=u.getColor(t.rgba,s.rgba)),h===void 0){let f=this._optionsService.rawOptions.minimumContrastRatio/(n.isDim()?2:1);h=Wt.ensureContrastRatio(o||t,l||s,f),u.setColor((o||t).rgba,(l||s).rgba,h??null)}return h?(this._addStyle(e,`color:${h.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let s=this._selectionStart,n=this._selectionEnd;return!s||!n?!1:this._columnSelectMode?s[0]<=n[0]?e>=s[0]&&t>=s[1]&&e<n[0]&&t<=n[1]:e<s[0]&&t>=s[1]&&e>=n[0]&&t<=n[1]:t>s[1]&&t<n[1]||s[1]===n[1]&&t===s[1]&&e>=s[0]&&e<n[0]||s[1]<n[1]&&t===n[1]&&e<n[0]||s[1]<n[1]&&t===s[1]&&e>=s[0]}};_0=os([Fe(1,hj),Fe(2,fn),Fe(3,Mr),Fe(4,ho),Fe(5,xu),Fe(6,_l)],_0);function H2(e,t,s){for(;e.length<s;)e=t+e;return e}var vq=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}},_q=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 yq(){return new _q}var Eg="xterm-dom-renderer-owner-",ii="xterm-rows",nh="xterm-fg-",U2="xterm-bg-",wc="xterm-focus",ih="xterm-selection",wq=1,y0=class extends mt{constructor(e,t,s,n,o,l,u,h,f,d,p,g,x,v){super(),this._terminal=e,this._document=t,this._element=s,this._screenElement=n,this._viewportElement=o,this._helperContainer=l,this._linkifier2=u,this._charSizeService=f,this._optionsService=d,this._bufferService=p,this._coreService=g,this._coreBrowserService=x,this._themeService=v,this._terminalClass=wq++,this._rowElements=[],this._selectionRenderModel=yq(),this.onRequestRedraw=this._register(new ze).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(ii),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(ih),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=bq(),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(_0,document),this._element.classList.add(Eg+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(w=>this._handleLinkHover(w))),this._register(this._linkifier2.onHideLinkUnderline(w=>this._handleLinkLeave(w))),this._register(Qt(()=>{this._element.classList.remove(Eg+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new vq(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let s of this._rowElements)s.style.width=`${this.dimensions.css.canvas.width}px`,s.style.height=`${this.dimensions.css.cell.height}px`,s.style.lineHeight=`${this.dimensions.css.cell.height}px`,s.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${ii} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${ii} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${ii} .xterm-dim { color: ${Wt.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let s=`blink_underline_${this._terminalClass}`,n=`blink_bar_${this._terminalClass}`,o=`blink_block_${this._terminalClass}`;t+=`@keyframes ${s} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${n} { 50% { box-shadow: none; }}`,t+=`@keyframes ${o} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${ii}.${wc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${ii}.${wc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${ii}.${wc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${o} 1s step-end infinite;}${this._terminalSelector} .${ii} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${ii} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${ii} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${ii} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${ii} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${ih} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${ih} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${ih} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[l,u]of e.ansi.entries())t+=`${this._terminalSelector} .${nh}${l} { color: ${u.css}; }${this._terminalSelector} .${nh}${l}.xterm-dim { color: ${Wt.multiplyOpacity(u,.5).css}; }${this._terminalSelector} .${U2}${l} { background-color: ${u.css}; }`;t+=`${this._terminalSelector} .${nh}257 { color: ${Wt.opaque(e.background).css}; }${this._terminalSelector} .${nh}257.xterm-dim { color: ${Wt.multiplyOpacity(Wt.opaque(e.background),.5).css}; }${this._terminalSelector} .${U2}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`.${Eg}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,s,n,o,l){s<0&&(e=0),n<0&&(t=0);let u=this._bufferService.rows-1;s=Math.max(Math.min(s,u),0),n=Math.max(Math.min(n,u),0),o=Math.min(o,this._bufferService.cols);let h=this._bufferService.buffer,f=h.ybase+h.y,d=Math.min(h.x,o-1),p=this._optionsService.rawOptions.cursorBlink,g=this._optionsService.rawOptions.cursorStyle,x=this._optionsService.rawOptions.cursorInactiveStyle;for(let v=s;v<=n;++v){let w=v+h.ydisp,k=this._rowElements[v],N=h.lines.get(w);if(!k||!N)break;k.replaceChildren(...this._rowFactory.createRow(N,w,w===f,g,x,d,p,this.dimensions.css.cell.width,this._widthCache,l?v===s?e:0:-1,l?(v===n?t:o)-1:-1))}}};y0=os([Fe(7,Hb),Fe(8,Tf),Fe(9,fn),Fe(10,hn),Fe(11,ho),Fe(12,Mr),Fe(13,_l)],y0);var w0=class extends mt{constructor(e,t,s){super(),this._optionsService=s,this.width=0,this.height=0,this._onCharSizeChange=this._register(new ze),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new kq(this._optionsService))}catch{this._measureStrategy=this._register(new Sq(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())}};w0=os([Fe(2,fn)],w0);var Rj=class extends mt{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},Sq=class extends Rj{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}},kq=class extends Rj{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}},Nq=class extends mt{constructor(e,t,s){super(),this._textarea=e,this._window=t,this.mainDocument=s,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new Cq(this._window)),this._onDprChange=this._register(new ze),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new ze),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(n=>this._screenDprMonitor.setWindow(n))),this._register(Ys.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(at(this._textarea,"focus",()=>this._isFocused=!0)),this._register(at(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},Cq=class extends mt{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new fl),this._onDprChange=this._register(new ze),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Qt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=at(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},Eq=class extends mt{constructor(){super(),this.linkProviders=[],this._register(Qt(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function Yb(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 jq(e,t,s,n,o,l,u,h,f){if(!l)return;let d=Yb(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 S0=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,s,n,o){return jq(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=Yb(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])}}};S0=os([Fe(0,Dr),Fe(1,Tf)],S0);var Aq=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=[]}},Mj={};IU(Mj,{getSafariVersion:()=>Rq,isChromeOS:()=>zj,isFirefox:()=>Dj,isIpad:()=>Mq,isIphone:()=>Dq,isLegacyEdge:()=>Tq,isLinux:()=>Xb,isMac:()=>Zh,isNode:()=>Rf,isSafari:()=>Oj,isWindows:()=>Lj});var Rf=typeof process<"u"&&"title"in process,bu=Rf?"node":navigator.userAgent,vu=Rf?"node":navigator.platform,Dj=bu.includes("Firefox"),Tq=bu.includes("Edge"),Oj=/^((?!chrome|android).)*safari/i.test(bu);function Rq(){if(!Oj)return 0;let e=bu.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Zh=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(vu),Mq=vu==="iPad",Dq=vu==="iPhone",Lj=["Windows","Win16","Win32","WinCE"].includes(vu),Xb=vu.indexOf("Linux")>=0,zj=/\bCrOS\b/.test(bu),Bj=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()}},Oq=class extends Bj{_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())}}},Lq=class extends Bj{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Qh=!Rf&&"requestIdleCallback"in window?Lq:Oq,zq=class{constructor(){this._queue=new Qh}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},k0=class extends mt{constructor(e,t,s,n,o,l,u,h,f){super(),this._rowCount=e,this._optionsService=s,this._charSizeService=n,this._coreService=o,this._coreBrowserService=h,this._renderer=this._register(new fl),this._pausedResizeTask=new zq,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 ze),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new ze),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new ze),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new ze),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new Aq((d,p)=>this._renderRows(d,p),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new Bq(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Qt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(u.onResize(()=>this._fullRefresh())),this._register(u.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(l.onDecorationRegistered(()=>this._fullRefresh())),this._register(l.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(u.cols,u.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(u.buffer.y,u.buffer.y,!0))),this._register(f.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(d=>this._registerIntersectionObserver(d,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let s=new e.IntersectionObserver(n=>this._handleIntersectionChange(n[n.length-1]),{threshold:0});s.observe(t),this._observerDisposable.value=Qt(()=>s.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,s=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let n=this._syncOutputHandler.flush();n&&(e=Math.min(e,n.start),t=Math.max(t,n.end)),s||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,s){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=s,this._renderer.value?.handleSelectionChanged(e,t,s)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};k0=os([Fe(2,fn),Fe(3,Tf),Fe(4,ho),Fe(5,xu),Fe(6,hn),Fe(7,Mr),Fe(8,_l)],k0);var Bq=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 Pq(e,t,s,n){let o=s.buffer.x,l=s.buffer.y;if(!s.buffer.hasScrollback)return Hq(o,l,e,t,s,n)+Mf(l,t,s,n)+Uq(o,l,e,t,s,n);let u;if(l===t)return u=o>e?"D":"C",ru(Math.abs(o-e),iu(u,n));u=l>t?"D":"C";let h=Math.abs(l-t),f=$q(l>t?e:o,s)+(h-1)*s.cols+1+Iq(l>t?o:e);return ru(f,iu(u,n))}function Iq(e,t){return e-1}function $q(e,t){return t.cols-e}function Hq(e,t,s,n,o,l){return Mf(t,n,o,l).length===0?"":ru(Ij(e,t,e,t-ao(t,o),!1,o).length,iu("D",l))}function Mf(e,t,s,n){let o=e-ao(e,s),l=t-ao(t,s),u=Math.abs(o-l)-Fq(e,t,s);return ru(u,iu(Pj(e,t),n))}function Uq(e,t,s,n,o,l){let u;Mf(t,n,o,l).length>0?u=n-ao(n,o):u=t;let h=n,f=qq(e,t,s,n,o,l);return ru(Ij(e,u,s,h,f==="C",o).length,iu(f,l))}function Fq(e,t,s){let n=0,o=e-ao(e,s),l=t-ao(t,s);for(let u=0;u<Math.abs(o-l);u++){let h=Pj(e,t)==="A"?-1:1;s.buffer.lines.get(o+h*u)?.isWrapped&&n++}return n}function ao(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 qq(e,t,s,n,o,l){let u;return Mf(s,n,o,l).length>0?u=n-ao(n,o):u=t,e<s&&u<=n||e>=s&&u<n?"C":"D"}function Pj(e,t){return e>t?"A":"B"}function Ij(e,t,s,n,o,l){let u=e,h=t,f="";for(;(u!==s||h!==n)&&h>=0&&h<l.buffer.lines.length;)u+=o?1:-1,o&&u>l.cols-1?(f+=l.buffer.translateBufferLineToString(h,!1,e,u),u=0,e=0,h++):!o&&u<0&&(f+=l.buffer.translateBufferLineToString(h,!1,0,e+1),u=l.cols-1,e=u,h--);return f+l.buffer.translateBufferLineToString(h,!1,e,u)}function iu(e,t){let s=t?"O":"[";return Ee.ESC+s+e}function ru(e,t){e=Math.floor(e);let s="";for(let n=0;n<e;n++)s+=t;return s}var Vq=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 F2(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 jg=50,Gq=15,Wq=50,Kq=500,Yq=" ",Xq=new RegExp(Yq,"g"),N0=class extends mt{constructor(e,t,s,n,o,l,u,h,f){super(),this._element=e,this._screenElement=t,this._linkifier=s,this._bufferService=n,this._coreService=o,this._mouseService=l,this._optionsService=u,this._renderService=h,this._coreBrowserService=f,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new ui,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new ze),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new ze),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new ze),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new ze),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=d=>this._handleMouseMove(d),this._mouseUpListener=d=>this._handleMouseUp(d),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(d=>this._handleTrim(d)),this._register(this._bufferService.buffers.onBufferActivate(d=>this._handleBufferActivate(d))),this.enable(),this._model=new Vq(this._bufferService),this._activeSelectionMode=0,this._register(Qt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(d=>{d.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let s=this._bufferService.buffer,n=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let o=e[0]<t[0]?e[0]:t[0],l=e[0]<t[0]?t[0]:e[0];for(let u=e[1];u<=t[1];u++){let h=s.translateBufferLineToString(u,!0,o,l);n.push(h)}}else{let o=e[1]===t[1]?t[0]:void 0;n.push(s.translateBufferLineToString(e[1],!0,e[0],o));for(let l=e[1]+1;l<=t[1]-1;l++){let u=s.lines.get(l),h=s.translateBufferLineToString(l,!0);u?.isWrapped?n[n.length-1]+=h:n.push(h)}if(e[1]!==t[1]){let l=s.lines.get(t[1]),u=s.translateBufferLineToString(t[1],!0,0,t[0]);l&&l.isWrapped?n[n.length-1]+=u:n.push(u)}}return n.map(o=>o.replace(Xq," ")).join(Lj?`\r
|
|
105
|
+
`:`
|
|
106
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Xb&&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=F2(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=Yb(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,-jg),jg),t/=jg,t/Math.abs(t)+Math.round(t*(Gq-1)))}shouldForceSelection(e){return Zh?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),Wq)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(Zh&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let s=this._bufferService.buffer;if(this._model.selectionEnd[1]<s.lines.length){let n=s.lines.get(this._model.selectionEnd[1]);n&&n.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<Kq&&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=Pq(s[0]-1,s[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(n,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,s=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!s){this._oldHasSelection&&this._fireOnSelectionChange(e,t,s);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,s)}_fireOnSelectionChange(e,t,s){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=s,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let s=t;for(let n=0;t>=n;n++){let o=e.loadCell(n,this._workCell).getChars().length;this._workCell.getWidth()===0?s--:o>1&&t!==n&&(s+=o-1)}return s}setSelection(e,t,s){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=s,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,s=!0,n=!0){if(e[0]>=this._bufferService.cols)return;let o=this._bufferService.buffer,l=o.lines.get(e[1]);if(!l)return;let u=o.translateBufferLineToString(e[1],!1),h=this._convertViewportColToCharacterIndex(l,e[0]),f=h,d=e[0]-h,p=0,g=0,x=0,v=0;if(u.charAt(h)===" "){for(;h>0&&u.charAt(h-1)===" ";)h--;for(;f<u.length&&u.charAt(f+1)===" ";)f++}else{let N=e[0],C=e[0];l.getWidth(N)===0&&(p++,N--),l.getWidth(C)===2&&(g++,C++);let A=l.getString(C).length;for(A>1&&(v+=A-1,f+=A-1);N>0&&h>0&&!this._isCharWordSeparator(l.loadCell(N-1,this._workCell));){l.loadCell(N-1,this._workCell);let j=this._workCell.getChars().length;this._workCell.getWidth()===0?(p++,N--):j>1&&(x+=j-1,h-=j-1),h--,N--}for(;C<l.length&&f+1<u.length&&!this._isCharWordSeparator(l.loadCell(C+1,this._workCell));){l.loadCell(C+1,this._workCell);let j=this._workCell.getChars().length;this._workCell.getWidth()===2?(g++,C++):j>1&&(v+=j-1,f+=j-1),f++,C++}}f++;let w=h+d-p+x,k=Math.min(this._bufferService.cols,f-h+p+g-x-v);if(!(!t&&u.slice(h,f).trim()==="")){if(s&&w===0&&l.getCodePoint(0)!==32){let N=o.lines.get(e[1]-1);if(N&&l.isWrapped&&N.getCodePoint(this._bufferService.cols-1)!==32){let C=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(C){let A=this._bufferService.cols-C.start;w-=A,k+=A}}}if(n&&w+k===this._bufferService.cols&&l.getCodePoint(this._bufferService.cols-1)!==32){let N=o.lines.get(e[1]+1);if(N?.isWrapped&&N.getCodePoint(0)!==32){let C=this._getWordAt([0,e[1]+1],!1,!1,!0);C&&(k+=C.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=F2(s,this._bufferService.cols)}};N0=os([Fe(3,hn),Fe(4,ho),Fe(5,Ub),Fe(6,fn),Fe(7,Dr),Fe(8,Mr)],N0);var q2=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={}}},V2=class{constructor(){this._color=new q2,this._css=new q2}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()}},As=Object.freeze((()=>{let e=[ts.toColor("#2e3436"),ts.toColor("#cc0000"),ts.toColor("#4e9a06"),ts.toColor("#c4a000"),ts.toColor("#3465a4"),ts.toColor("#75507b"),ts.toColor("#06989a"),ts.toColor("#d3d7cf"),ts.toColor("#555753"),ts.toColor("#ef2929"),ts.toColor("#8ae234"),ts.toColor("#fce94f"),ts.toColor("#729fcf"),ts.toColor("#ad7fa8"),ts.toColor("#34e2e2"),ts.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let s=0;s<216;s++){let n=t[s/36%6|0],o=t[s/6%6|0],l=t[s%6];e.push({css:Ns.toCss(n,o,l),rgba:Ns.toRgba(n,o,l)})}for(let s=0;s<24;s++){let n=8+s*10;e.push({css:Ns.toCss(n,n,n),rgba:Ns.toRgba(n,n,n)})}return e})()),Ga=ts.toColor("#ffffff"),Oc=ts.toColor("#000000"),G2=ts.toColor("#ffffff"),W2=Oc,Sc={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},Zq=Ga,C0=class extends mt{constructor(e){super(),this._optionsService=e,this._contrastCache=new V2,this._halfContrastCache=new V2,this._onChangeColors=this._register(new ze),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Ga,background:Oc,cursor:G2,cursorAccent:W2,selectionForeground:void 0,selectionBackgroundTransparent:Sc,selectionBackgroundOpaque:Wt.blend(Oc,Sc),selectionInactiveBackgroundTransparent:Sc,selectionInactiveBackgroundOpaque:Wt.blend(Oc,Sc),scrollbarSliderBackground:Wt.opacity(Ga,.2),scrollbarSliderHoverBackground:Wt.opacity(Ga,.4),scrollbarSliderActiveBackground:Wt.opacity(Ga,.5),overviewRulerBorder:Ga,ansi:As.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=Pt(e.foreground,Ga),t.background=Pt(e.background,Oc),t.cursor=Wt.blend(t.background,Pt(e.cursor,G2)),t.cursorAccent=Wt.blend(t.background,Pt(e.cursorAccent,W2)),t.selectionBackgroundTransparent=Pt(e.selectionBackground,Sc),t.selectionBackgroundOpaque=Wt.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Pt(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Wt.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Pt(e.selectionForeground,$2):void 0,t.selectionForeground===$2&&(t.selectionForeground=void 0),Wt.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Wt.opacity(t.selectionBackgroundTransparent,.3)),Wt.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Wt.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Pt(e.scrollbarSliderBackground,Wt.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Pt(e.scrollbarSliderHoverBackground,Wt.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Pt(e.scrollbarSliderActiveBackground,Wt.opacity(t.foreground,.5)),t.overviewRulerBorder=Pt(e.overviewRulerBorder,Zq),t.ansi=As.slice(),t.ansi[0]=Pt(e.black,As[0]),t.ansi[1]=Pt(e.red,As[1]),t.ansi[2]=Pt(e.green,As[2]),t.ansi[3]=Pt(e.yellow,As[3]),t.ansi[4]=Pt(e.blue,As[4]),t.ansi[5]=Pt(e.magenta,As[5]),t.ansi[6]=Pt(e.cyan,As[6]),t.ansi[7]=Pt(e.white,As[7]),t.ansi[8]=Pt(e.brightBlack,As[8]),t.ansi[9]=Pt(e.brightRed,As[9]),t.ansi[10]=Pt(e.brightGreen,As[10]),t.ansi[11]=Pt(e.brightYellow,As[11]),t.ansi[12]=Pt(e.brightBlue,As[12]),t.ansi[13]=Pt(e.brightMagenta,As[13]),t.ansi[14]=Pt(e.brightCyan,As[14]),t.ansi[15]=Pt(e.brightWhite,As[15]),e.extendedAnsi){let s=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let n=0;n<s;n++)t.ansi[n+16]=Pt(e.extendedAnsi[n],As[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()}}};C0=os([Fe(0,fn)],C0);function Pt(e,t){if(e!==void 0)try{return ts.toColor(e)}catch{}return t}var Qq=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)}},Jq=class{constructor(){this._services=new Qq,this._services.set(Hb,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let s=GU(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)}},eV={trace:0,debug:1,info:2,warn:3,error:4,off:5},tV="xterm.js: ",E0=class extends mt{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=eV[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?"":tV)+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)}};E0=os([Fe(0,fn)],E0);var K2=class extends mt{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new ze),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new ze),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new ze),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let s=0;s<Math.min(e,this.length);s++)t[s]=this._array[this._getCyclicIndex(s)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...s){if(t){for(let n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let n=this._length-1;n>=e;n--)this._array[this._getCyclicIndex(n+s.length)]=this._array[this._getCyclicIndex(n)];for(let n=0;n<s.length;n++)this._array[this._getCyclicIndex(e+n)]=s[n];if(s.length&&this.onInsertEmitter.fire({index:e,amount:s.length}),this._length+s.length>this._maxLength){let n=this._length+s.length-this._maxLength;this._startIndex+=n,this._length=this._maxLength,this.onTrimEmitter.fire(n)}else this._length+=s.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,s){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+s<0)throw new Error("Cannot shift elements in list beyond index 0");if(s>0){for(let o=t-1;o>=0;o--)this.set(e+o+s,this.get(e+o));let n=e+t+s-this._length;if(n>0)for(this._length+=n;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let n=0;n<t;n++)this.set(e+n+s,this.get(e+n))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},ht=3,ws=Object.freeze(new gu),rh=0,Ag=2,Lc=class $j{constructor(t,s,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*ht);let o=s||ui.fromCharData([0,rj,1,0]);for(let l=0;l<t;++l)this.setCell(l,o);this.length=t}get(t){let s=this._data[t*ht+0],n=s&2097151;return[this._data[t*ht+1],s&2097152?this._combined[t]:n?ma(n):"",s>>22,s&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n]}set(t,s){this._data[t*ht+1]=s[0],s[1].length>1?(this._combined[t]=s[1],this._data[t*ht+0]=t|2097152|s[2]<<22):this._data[t*ht+0]=s[1].charCodeAt(0)|s[2]<<22}getWidth(t){return this._data[t*ht+0]>>22}hasWidth(t){return this._data[t*ht+0]&12582912}getFg(t){return this._data[t*ht+1]}getBg(t){return this._data[t*ht+2]}hasContent(t){return this._data[t*ht+0]&4194303}getCodePoint(t){let s=this._data[t*ht+0];return s&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):s&2097151}isCombined(t){return this._data[t*ht+0]&2097152}getString(t){let s=this._data[t*ht+0];return s&2097152?this._combined[t]:s&2097151?ma(s&2097151):""}isProtected(t){return this._data[t*ht+2]&536870912}loadCell(t,s){return rh=t*ht,s.content=this._data[rh+0],s.fg=this._data[rh+1],s.bg=this._data[rh+2],s.content&2097152&&(s.combinedData=this._combined[t]),s.bg&268435456&&(s.extended=this._extendedAttrs[t]),s}setCell(t,s){s.content&2097152&&(this._combined[t]=s.combinedData),s.bg&268435456&&(this._extendedAttrs[t]=s.extended),this._data[t*ht+0]=s.content,this._data[t*ht+1]=s.fg,this._data[t*ht+2]=s.bg}setCellFromCodepoint(t,s,n,o){o.bg&268435456&&(this._extendedAttrs[t]=o.extended),this._data[t*ht+0]=s|n<<22,this._data[t*ht+1]=o.fg,this._data[t*ht+2]=o.bg}addCodepointToCell(t,s,n){let o=this._data[t*ht+0];o&2097152?this._combined[t]+=ma(s):o&2097151?(this._combined[t]=ma(o&2097151)+ma(s),o&=-2097152,o|=2097152):o=s|1<<22,n&&(o&=-12582913,o|=n<<22),this._data[t*ht+0]=o}insertCells(t,s,n){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),s<this.length-t){let o=new ui;for(let l=this.length-t-s-1;l>=0;--l)this.setCell(t+s+l,this.loadCell(t+l,o));for(let l=0;l<s;++l)this.setCell(t+l,n)}else for(let o=t;o<this.length;++o)this.setCell(o,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(t,s,n){if(t%=this.length,s<this.length-t){let o=new ui;for(let l=0;l<this.length-t-s;++l)this.setCell(t+l,this.loadCell(t+s+l,o));for(let l=this.length-s;l<this.length;++l)this.setCell(l,n)}else for(let o=t;o<this.length;++o)this.setCell(o,n);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,n)}replaceCells(t,s,n,o=!1){if(o){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,n),s<this.length&&this.getWidth(s-1)===2&&!this.isProtected(s)&&this.setCellFromCodepoint(s,0,1,n);t<s&&t<this.length;)this.isProtected(t)||this.setCell(t,n),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),s<this.length&&this.getWidth(s-1)===2&&this.setCellFromCodepoint(s,0,1,n);t<s&&t<this.length;)this.setCell(t++,n)}resize(t,s){if(t===this.length)return this._data.length*4*Ag<this._data.buffer.byteLength;let n=t*ht;if(t>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let o=new Uint32Array(n);o.set(this._data),this._data=o}for(let o=this.length;o<t;++o)this.setCell(o,s)}else{this._data=this._data.subarray(0,n);let o=Object.keys(this._combined);for(let u=0;u<o.length;u++){let h=parseInt(o[u],10);h>=t&&delete this._combined[h]}let l=Object.keys(this._extendedAttrs);for(let u=0;u<l.length;u++){let h=parseInt(l[u],10);h>=t&&delete this._extendedAttrs[h]}}return this.length=t,n*4*Ag<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Ag<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 $j(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let s in this._combined)t._combined[s]=this._combined[s];for(let s in this._extendedAttrs)t._extendedAttrs[s]=this._extendedAttrs[s];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*ht+0]&4194303)return t+(this._data[t*ht+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*ht+0]&4194303||this._data[t*ht+2]&50331648)return t+(this._data[t*ht+0]>>22);return 0}copyCellsFrom(t,s,n,o,l){let u=t._data;if(l)for(let f=o-1;f>=0;f--){for(let d=0;d<ht;d++)this._data[(n+f)*ht+d]=u[(s+f)*ht+d];u[(s+f)*ht+2]&268435456&&(this._extendedAttrs[n+f]=t._extendedAttrs[s+f])}else for(let f=0;f<o;f++){for(let d=0;d<ht;d++)this._data[(n+f)*ht+d]=u[(s+f)*ht+d];u[(s+f)*ht+2]&268435456&&(this._extendedAttrs[n+f]=t._extendedAttrs[s+f])}let h=Object.keys(t._combined);for(let f=0;f<h.length;f++){let d=parseInt(h[f],10);d>=s&&(this._combined[d-s+n]=t._combined[d])}}translateToString(t,s,n,o){s=s??0,n=n??this.length,t&&(n=Math.min(n,this.getTrimmedLength())),o&&(o.length=0);let l="";for(;s<n;){let u=this._data[s*ht+0],h=u&2097151,f=u&2097152?this._combined[s]:h?ma(h):ga;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 sV(e,t,s,n,o,l){let u=[];for(let h=0;h<e.length-1;h++){let f=h,d=e.get(++f);if(!d.isWrapped)continue;let p=[e.get(h)];for(;f<e.length&&d.isWrapped;)p.push(d),d=e.get(++f);if(!l&&n>=h&&n<f){h+=p.length-1;continue}let g=0,x=au(p,g,t),v=1,w=0;for(;v<p.length;){let N=au(p,v,t),C=N-w,A=s-x,j=Math.min(C,A);p[g].copyCellsFrom(p[v],w,x,j,!1),x+=j,x===s&&(g++,x=0),w+=j,w===N&&(v++,w=0),x===0&&g!==0&&p[g-1].getWidth(s-1)===2&&(p[g].copyCellsFrom(p[g-1],s-1,x++,1,!1),p[g-1].setCell(s-1,o))}p[g].replaceCells(x,s,o);let k=0;for(let N=p.length-1;N>0&&(N>g||p[N].getTrimmedLength()===0);N--)k++;k>0&&(u.push(h+p.length-k),u.push(k)),h+=p.length-1}return u}function nV(e,t){let s=[],n=0,o=t[n],l=0;for(let u=0;u<e.length;u++)if(o===u){let h=t[++n];e.onDeleteEmitter.fire({index:u-l,amount:h}),u+=h-1,l+=h,o=t[++n]}else s.push(u);return{layout:s,countRemoved:l}}function iV(e,t){let s=[];for(let n=0;n<t.length;n++)s.push(e.get(t[n]));for(let n=0;n<s.length;n++)e.set(n,s[n]);e.length=t.length}function rV(e,t,s){let n=[],o=e.map((f,d)=>au(e,d,t)).reduce((f,d)=>f+d),l=0,u=0,h=0;for(;h<o;){if(o-h<s){n.push(o-h);break}l+=s;let f=au(e,u,t);l>f&&(l-=f,u++);let d=e[u].getWidth(l-1)===2;d&&l--;let p=d?s-1:s;n.push(p),h+=p}return n}function au(e,t,s){if(t===e.length-1)return e[t].getTrimmedLength();let n=!e[t].hasContent(s-1)&&e[t].getWidth(s-1)===1,o=e[t+1].getWidth(0)===2;return n&&o?s-1:s}var Hj=class Uj{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=Uj._nextId++,this._onDispose=this.register(new ze),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),ro(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};Hj._nextId=1;var aV=Hj,Ms={},Wa=Ms.B;Ms[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Ms.A={"#":"£"};Ms.B=void 0;Ms[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Ms.C=Ms[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Ms.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Ms.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Ms.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Ms.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Ms.E=Ms[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Ms.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Ms.H=Ms[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Ms["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Y2=4294967295,X2=class{constructor(e,t,s){this._hasScrollback=e,this._optionsService=t,this._bufferService=s,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=ws.clone(),this.savedCharset=Wa,this.markers=[],this._nullCell=ui.fromCharData([0,rj,1,0]),this._whitespaceCell=ui.fromCharData([0,ga,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Qh,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new K2(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new Kh),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new Kh),this._whitespaceCell}getBlankLine(e,t){return new Lc(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>Y2?Y2:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=ws);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new K2(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let s=this.getNullCell(ws),n=0,o=this._getCorrectBufferLength(t);if(o>this.lines.maxLength&&(this.lines.maxLength=o),this.lines.length>0){if(this._cols<e)for(let u=0;u<this.lines.length;u++)n+=+this.lines.get(u).resize(e,s);let l=0;if(this._rows<t)for(let u=this._rows;u<t;u++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new Lc(e,s)):this.ybase>0&&this.lines.length<=this.ybase+this.y+l+1?(this.ybase--,l++,this.ydisp>0&&this.ydisp--):this.lines.push(new Lc(e,s)));else for(let u=this._rows;u>t;u--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(o<this.lines.maxLength){let u=this.lines.length-o;u>0&&(this.lines.trimStart(u),this.ybase=Math.max(this.ybase-u,0),this.ydisp=Math.max(this.ydisp-u,0),this.savedY=Math.max(this.savedY-u,0)),this.lines.maxLength=o}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),l&&(this.y+=l),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let l=0;l<this.lines.length;l++)n+=+this.lines.get(l).resize(e,s);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),n>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let s=this._optionsService.rawOptions.reflowCursorLine,n=sV(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(ws),s);if(n.length>0){let o=nV(this.lines,n);iV(this.lines,o.layout),this._reflowLargerAdjustViewport(e,t,o.countRemoved)}}_reflowLargerAdjustViewport(e,t,s){let n=this.getNullCell(ws),o=s;for(;o-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Lc(e,n))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-s,0)}_reflowSmaller(e,t){let s=this._optionsService.rawOptions.reflowCursorLine,n=this.getNullCell(ws),o=[],l=0;for(let u=this.lines.length-1;u>=0;u--){let h=this.lines.get(u);if(!h||!h.isWrapped&&h.getTrimmedLength()<=e)continue;let f=[h];for(;h.isWrapped&&u>0;)h=this.lines.get(--u),f.unshift(h);if(!s){let j=this.ybase+this.y;if(j>=u&&j<u+f.length)continue}let d=f[f.length-1].getTrimmedLength(),p=rV(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 T=this.getBlankLine(ws,!0);v.push(T)}v.length>0&&(o.push({start:u+f.length+l,newLines:v}),l+=v.length),f.push(...v);let w=p.length-1,k=p[w];k===0&&(w--,k=p[w]);let N=f.length-g-1,C=d;for(;N>=0;){let j=Math.min(C,k);if(f[w]===void 0)break;if(f[w].copyCellsFrom(f[N],C-j,k-j,j,!0),k-=j,k===0&&(w--,k=p[w]),C-=j,C===0){N--;let T=Math.max(N,0);C=au(f,T,this._cols)}}for(let j=0;j<f.length;j++)p[j]<e&&f[j].setCell(p[j],n);let A=g-x;for(;A-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+l)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+g,this.ybase+t-1)}if(o.length>0){let u=[],h=[];for(let k=0;k<this.lines.length;k++)h.push(this.lines.get(k));let f=this.lines.length,d=f-1,p=0,g=o[p];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+l);let x=0;for(let k=Math.min(this.lines.maxLength-1,f+l-1);k>=0;k--)if(g&&g.start>d+x){for(let N=g.newLines.length-1;N>=0;N--)this.lines.set(k--,g.newLines[N]);k++,u.push({index:d+1,amount:g.newLines.length}),x+=g.newLines.length,g=o[++p]}else this.lines.set(k,h[d--]);let v=0;for(let k=u.length-1;k>=0;k--)u[k].index+=v,this.lines.onInsertEmitter.fire(u[k]),v+=u[k].amount;let w=Math.max(0,f+l-this.lines.maxLength);w>0&&this.lines.onTrimEmitter.fire(w)}}translateBufferLineToString(e,t,s=0,n){let o=this.lines.get(e);return o?o.translateToString(t,s,n):""}getWrappedRangeForLine(e){let t=e,s=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;s+1<this.lines.length&&this.lines.get(s+1).isWrapped;)s++;return{first:t,last:s}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new aV(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)}},oV=class extends mt{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new ze),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new X2(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new X2(!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)}},Fj=2,qj=1,j0=class extends mt{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new ze),this.onResize=this._onResize.event,this._onScroll=this._register(new ze),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,Fj),this.rows=Math.max(e.rawOptions.rows||0,qj),this.buffers=this._register(new oV(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))}};j0=os([Fe(0,fn)],j0);var Zo={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:Zh,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},lV=["normal","bold","100","200","300","400","500","600","700","800","900"],cV=class extends mt{constructor(e){super(),this._onOptionChange=this._register(new ze),this.onOptionChange=this._onOptionChange.event;let t={...Zo};for(let s in e)if(s in t)try{let n=e[s];t[s]=this._sanitizeAndValidateOption(s,n)}catch(n){console.error(n)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(Qt(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(s=>{s===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(s=>{e.indexOf(s)!==-1&&t()})}_setupOptions(){let e=s=>{if(!(s in Zo))throw new Error(`No option with key "${s}"`);return this.rawOptions[s]},t=(s,n)=>{if(!(s in Zo))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=Zo[e]),!uV(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Zo[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=lV.includes(t)?t:Zo[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 uV(e){return e==="block"||e==="underline"||e==="bar"}function zc(e,t=5){if(typeof e!="object")return e;let s=Array.isArray(e)?[]:{};for(let n in e)s[n]=t<=1?e[n]:e[n]&&zc(e[n],t-1);return s}var Z2=Object.freeze({insertMode:!1}),Q2=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),A0=class extends mt{constructor(e,t,s){super(),this._bufferService=e,this._logService=t,this._optionsService=s,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new ze),this.onData=this._onData.event,this._onUserInput=this._register(new ze),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new ze),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new ze),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=zc(Z2),this.decPrivateModes=zc(Q2)}reset(){this.modes=zc(Z2),this.decPrivateModes=zc(Q2)}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))}};A0=os([Fe(0,hn),Fe(1,uj),Fe(2,fn)],A0);var J2={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 Tg(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 Rg=String.fromCharCode,ek={DEFAULT:e=>{let t=[Tg(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Rg(t[0])}${Rg(t[1])}${Rg(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Tg(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Tg(e,!0)};${e.x};${e.y}${t}`}},T0=class extends mt{constructor(e,t,s){super(),this._bufferService=e,this._coreService=t,this._optionsService=s,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new ze),this.onProtocolChange=this._onProtocolChange.event;for(let n of Object.keys(J2))this.addProtocol(n,J2[n]);for(let n of Object.keys(ek))this.addEncoding(n,ek[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)}};T0=os([Fe(0,hn),Fe(1,ho),Fe(2,fn)],T0);var Mg=[[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]],dV=[[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]],Ts;function hV(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 fV=class{constructor(){if(this.version="6",!Ts){Ts=new Uint8Array(65536),Ts.fill(1),Ts[0]=0,Ts.fill(0,1,32),Ts.fill(0,127,160),Ts.fill(2,4352,4448),Ts[9001]=2,Ts[9002]=2,Ts.fill(2,11904,42192),Ts[12351]=1,Ts.fill(2,44032,55204),Ts.fill(2,63744,64256),Ts.fill(2,65040,65050),Ts.fill(2,65072,65136),Ts.fill(2,65280,65377),Ts.fill(2,65504,65511);for(let e=0;e<Mg.length;++e)Ts.fill(0,Mg[e][0],Mg[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Ts[e]:hV(e,dV)?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=Za.extractWidth(t);o===0?n=!1:o>s&&(s=o)}return Za.createPropertyValue(0,s,n)}},Za=class jh{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new ze,this.onChange=this._onChange.event;let t=new fV;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,s,n=!1){return(t&16777215)<<3|(s&3)<<1|(n?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let s=0,n=0,o=t.length;for(let l=0;l<o;++l){let u=t.charCodeAt(l);if(55296<=u&&u<=56319){if(++l>=o)return s+this.wcwidth(u);let d=t.charCodeAt(l);56320<=d&&d<=57343?u=(u-55296)*1024+d-56320+65536:s+=this.wcwidth(d)}let h=this.charProperties(u,n),f=jh.extractWidth(h);jh.extractShouldJoin(h)&&(f-=jh.extractWidth(n)),s+=f,n=h}return s}charProperties(t,s){return this._activeProvider.charProperties(t,s)}},mV=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 tk(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,pV=256,Vj=class R0{constructor(t=32,s=32){if(this.maxLength=t,this.maxSubParamsLength=s,s>pV)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 R0;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 R0(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=[],gV=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",Af(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}}},$n=class{constructor(t){this._handler=t,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(t,s,n){this._hitLimit||(this._data+=Af(t,s,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(t){let s=!1;if(this._hitLimit)s=!1;else if(t&&(s=this._handler(this._data),s instanceof Promise))return s.then(n=>(this._data="",this._hitLimit=!1,n));return this._data="",this._hitLimit=!1,s}},Cc=[],xV=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",Af(e,t,s));else for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,s)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let s=!1,n=this._active.length-1,o=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,s=t,o=this._stack.fallThrough,this._stack.paused=!1),!o&&s===!1){for(;n>=0&&(s=this._active[n].unhook(e),s!==!0);n--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,s;n--}for(;n>=0;n--)if(s=this._active[n].unhook(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,s}this._active=Cc,this._ident=0}},Bc=new Vj;Bc.addParam(0);var sk=class{constructor(e){this._handler=e,this._data="",this._params=Bc,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Bc,this._data="",this._hitLimit=!1}put(e,t,s){this._hitLimit||(this._data+=Af(e,t,s),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(s=>(this._params=Bc,this._data="",this._hitLimit=!1,s));return this._params=Bc,this._data="",this._hitLimit=!1,t}},bV=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,s,n){this.table[t<<8|e]=s<<4|n}addMany(e,t,s,n){for(let o=0;o<e.length;o++)this.table[t<<8|e[o]]=s<<4|n}},oi=160,vV=(function(){let e=new bV(4095),t=Array.apply(null,Array(256)).map((h,f)=>f),s=(h,f)=>t.slice(h,f),n=s(32,127),o=s(0,24);o.push(25),o.push.apply(o,s(28,32));let l=s(0,14),u;e.setDefault(1,0),e.addMany(n,0,2,0);for(u in l)e.addMany([24,26,153,154],u,3,0),e.addMany(s(128,144),u,3,0),e.addMany(s(144,152),u,3,0),e.add(156,u,0,0),e.add(27,u,11,1),e.add(157,u,4,8),e.addMany([152,158,159],u,0,7),e.add(155,u,11,3),e.add(144,u,11,9);return e.addMany(o,0,3,0),e.addMany(o,1,3,1),e.add(127,1,0,1),e.addMany(o,8,0,8),e.addMany(o,3,3,3),e.add(127,3,0,3),e.addMany(o,4,3,4),e.add(127,4,0,4),e.addMany(o,6,3,6),e.addMany(o,5,3,5),e.add(127,5,0,5),e.addMany(o,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(n,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(s(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(n,7,0,7),e.addMany(o,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(s(64,127),3,7,0),e.addMany(s(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(s(48,60),4,8,4),e.addMany(s(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(s(32,64),6,0,6),e.add(127,6,0,6),e.addMany(s(64,127),6,0,0),e.addMany(s(32,48),3,9,5),e.addMany(s(32,48),5,9,5),e.addMany(s(48,64),5,0,6),e.addMany(s(64,127),5,7,0),e.addMany(s(32,48),4,9,5),e.addMany(s(32,48),1,9,2),e.addMany(s(32,48),2,9,2),e.addMany(s(48,127),2,10,0),e.addMany(s(48,80),1,10,0),e.addMany(s(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(s(96,127),1,10,0),e.add(80,1,11,9),e.addMany(o,9,0,9),e.add(127,9,0,9),e.addMany(s(28,32),9,0,9),e.addMany(s(32,48),9,9,12),e.addMany(s(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(o,11,0,11),e.addMany(s(32,128),11,0,11),e.addMany(s(28,32),11,0,11),e.addMany(o,10,0,10),e.add(127,10,0,10),e.addMany(s(28,32),10,0,10),e.addMany(s(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(s(32,48),10,9,12),e.addMany(o,12,0,12),e.add(127,12,0,12),e.addMany(s(28,32),12,0,12),e.addMany(s(32,48),12,9,12),e.addMany(s(48,64),12,0,11),e.addMany(s(64,127),12,12,13),e.addMany(s(64,127),10,12,13),e.addMany(s(64,127),9,12,13),e.addMany(o,13,13,13),e.addMany(n,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(oi,0,2,0),e.add(oi,8,5,8),e.add(oi,6,0,6),e.add(oi,11,0,11),e.add(oi,13,13,13),e})(),_V=class extends mt{constructor(e=vV){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 Vj,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,s,n)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,s)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(Qt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new gV),this._dcsParser=this._register(new xV),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let s=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(s=e.prefix.charCodeAt(0),s&&60>s||s>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let o=0;o<e.intermediates.length;++o){let l=e.intermediates.charCodeAt(o);if(32>l||l>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");s<<=8,s|=l}}if(e.final.length!==1)throw new Error("final must be a single byte");let n=e.final.charCodeAt(0);if(t[0]>n||n>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return s<<=8,s|=n,s}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let s=this._identifier(e,[48,126]);this._escHandlers[s]===void 0&&(this._escHandlers[s]=[]);let n=this._escHandlers[s];return n.push(t),{dispose:()=>{let o=n.indexOf(t);o!==-1&&n.splice(o,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let s=this._identifier(e);this._csiHandlers[s]===void 0&&(this._csiHandlers[s]=[]);let n=this._csiHandlers[s];return n.push(t),{dispose:()=>{let o=n.indexOf(t);o!==-1&&n.splice(o,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,s,n,o){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=s,this._parseStack.transition=n,this._parseStack.chunkPos=o}parse(e,t,s){let n=0,o=0,l=0,u;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,l=this._parseStack.chunkPos+1;else{if(s===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let h=this._parseStack.handlers,f=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(s===!1&&f>-1){for(;f>=0&&(u=h[f](this._params),u!==!0);f--)if(u instanceof Promise)return this._parseStack.handlerPos=f,u}this._parseStack.handlers=[];break;case 4:if(s===!1&&f>-1){for(;f>=0&&(u=h[f](),u!==!0);f--)if(u instanceof Promise)return this._parseStack.handlerPos=f,u}this._parseStack.handlers=[];break;case 6:if(n=e[this._parseStack.chunkPos],u=this._dcsParser.unhook(n!==24&&n!==26,s),u)return u;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(n=e[this._parseStack.chunkPos],u=this._oscParser.end(n!==24&&n!==26,s),u)return u;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,l=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let h=l;h<t;++h){switch(n=e[h],o=this._transitions.table[this.currentState<<8|(n<160?n:oi)],o>>4){case 2:for(let x=h+1;;++x){if(x>=t||(n=e[x])<32||n>126&&n<oi){this._printHandler(e,h,x),h=x-1;break}if(++x>=t||(n=e[x])<32||n>126&&n<oi){this._printHandler(e,h,x),h=x-1;break}if(++x>=t||(n=e[x])<32||n>126&&n<oi){this._printHandler(e,h,x),h=x-1;break}if(++x>=t||(n=e[x])<32||n>126&&n<oi){this._printHandler(e,h,x),h=x-1;break}}break;case 3:this._executeHandlers[n]?this._executeHandlers[n]():this._executeHandlerFb(n),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:h,code:n,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let f=this._csiHandlers[this._collect<<8|n],d=f?f.length-1:-1;for(;d>=0&&(u=f[d](this._params),u!==!0);d--)if(u instanceof Promise)return this._preserveStack(3,f,d,o,h),u;d<0&&this._csiHandlerFb(this._collect<<8|n,this._params),this.precedingJoinState=0;break;case 8:do switch(n){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(n-48)}while(++h<t&&(n=e[h])>47&&n<60);h--;break;case 9:this._collect<<=8,this._collect|=n;break;case 10:let p=this._escHandlers[this._collect<<8|n],g=p?p.length-1:-1;for(;g>=0&&(u=p[g](),u!==!0);g--)if(u instanceof Promise)return this._preserveStack(4,p,g,o,h),u;g<0&&this._escHandlerFb(this._collect<<8|n),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|n,this._params);break;case 13:for(let x=h+1;;++x)if(x>=t||(n=e[x])===24||n===26||n===27||n>127&&n<oi){this._dcsParser.put(e,h,x),h=x-1;break}break;case 14:if(u=this._dcsParser.unhook(n!==24&&n!==26),u)return this._preserveStack(6,[],0,o,h),u;n===27&&(o|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let x=h+1;;x++)if(x>=t||(n=e[x])<32||n>127&&n<oi){this._oscParser.put(e,h,x),h=x-1;break}break;case 6:if(u=this._oscParser.end(n!==24&&n!==26),u)return this._preserveStack(5,[],0,o,h),u;n===27&&(o|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=o&15}}},yV=/^([\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})$/,wV=/^[\da-f]+$/;function nk(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let s=yV.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),wV.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 Dg(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 SV(e,t=16){let[s,n,o]=e;return`rgb:${Dg(s,t)}/${Dg(n,t)}/${Dg(o,t)}`}var kV={"(":0,")":1,"*":2,"+":3,"-":1,".":2},da=131072,ik=10;function rk(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 ak=5e3,ok=0,NV=class extends mt{constructor(e,t,s,n,o,l,u,h,f=new _V){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 qU,this._utf8Decoder=new VU,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=ws.clone(),this._eraseAttrDataInternal=ws.clone(),this._onRequestBell=this._register(new ze),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new ze),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new ze),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new ze),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new ze),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new ze),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new ze),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new ze),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new ze),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new ze),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new ze),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new ze),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new ze),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new M0(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(d=>this._activeBuffer=d.activeBuffer)),this._parser.setCsiHandlerFallback((d,p)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(d),params:p.toArray()})}),this._parser.setEscHandlerFallback(d=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(d)})}),this._parser.setExecuteHandlerFallback(d=>{this._logService.debug("Unknown EXECUTE code: ",{code:d})}),this._parser.setOscHandlerFallback((d,p,g)=>{this._logService.debug("Unknown OSC code: ",{identifier:d,action:p,data:g})}),this._parser.setDcsHandlerFallback((d,p,g)=>{p==="HOOK"&&(g=g.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(d),action:p,payload:g})}),this._parser.setPrintHandler((d,p,g)=>this.print(d,p,g)),this._parser.registerCsiHandler({final:"@"},d=>this.insertChars(d)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},d=>this.scrollLeft(d)),this._parser.registerCsiHandler({final:"A"},d=>this.cursorUp(d)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},d=>this.scrollRight(d)),this._parser.registerCsiHandler({final:"B"},d=>this.cursorDown(d)),this._parser.registerCsiHandler({final:"C"},d=>this.cursorForward(d)),this._parser.registerCsiHandler({final:"D"},d=>this.cursorBackward(d)),this._parser.registerCsiHandler({final:"E"},d=>this.cursorNextLine(d)),this._parser.registerCsiHandler({final:"F"},d=>this.cursorPrecedingLine(d)),this._parser.registerCsiHandler({final:"G"},d=>this.cursorCharAbsolute(d)),this._parser.registerCsiHandler({final:"H"},d=>this.cursorPosition(d)),this._parser.registerCsiHandler({final:"I"},d=>this.cursorForwardTab(d)),this._parser.registerCsiHandler({final:"J"},d=>this.eraseInDisplay(d,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},d=>this.eraseInDisplay(d,!0)),this._parser.registerCsiHandler({final:"K"},d=>this.eraseInLine(d,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},d=>this.eraseInLine(d,!0)),this._parser.registerCsiHandler({final:"L"},d=>this.insertLines(d)),this._parser.registerCsiHandler({final:"M"},d=>this.deleteLines(d)),this._parser.registerCsiHandler({final:"P"},d=>this.deleteChars(d)),this._parser.registerCsiHandler({final:"S"},d=>this.scrollUp(d)),this._parser.registerCsiHandler({final:"T"},d=>this.scrollDown(d)),this._parser.registerCsiHandler({final:"X"},d=>this.eraseChars(d)),this._parser.registerCsiHandler({final:"Z"},d=>this.cursorBackwardTab(d)),this._parser.registerCsiHandler({final:"`"},d=>this.charPosAbsolute(d)),this._parser.registerCsiHandler({final:"a"},d=>this.hPositionRelative(d)),this._parser.registerCsiHandler({final:"b"},d=>this.repeatPrecedingCharacter(d)),this._parser.registerCsiHandler({final:"c"},d=>this.sendDeviceAttributesPrimary(d)),this._parser.registerCsiHandler({prefix:">",final:"c"},d=>this.sendDeviceAttributesSecondary(d)),this._parser.registerCsiHandler({final:"d"},d=>this.linePosAbsolute(d)),this._parser.registerCsiHandler({final:"e"},d=>this.vPositionRelative(d)),this._parser.registerCsiHandler({final:"f"},d=>this.hVPosition(d)),this._parser.registerCsiHandler({final:"g"},d=>this.tabClear(d)),this._parser.registerCsiHandler({final:"h"},d=>this.setMode(d)),this._parser.registerCsiHandler({prefix:"?",final:"h"},d=>this.setModePrivate(d)),this._parser.registerCsiHandler({final:"l"},d=>this.resetMode(d)),this._parser.registerCsiHandler({prefix:"?",final:"l"},d=>this.resetModePrivate(d)),this._parser.registerCsiHandler({final:"m"},d=>this.charAttributes(d)),this._parser.registerCsiHandler({final:"n"},d=>this.deviceStatus(d)),this._parser.registerCsiHandler({prefix:"?",final:"n"},d=>this.deviceStatusPrivate(d)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},d=>this.softReset(d)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},d=>this.setCursorStyle(d)),this._parser.registerCsiHandler({final:"r"},d=>this.setScrollRegion(d)),this._parser.registerCsiHandler({final:"s"},d=>this.saveCursor(d)),this._parser.registerCsiHandler({final:"t"},d=>this.windowOptions(d)),this._parser.registerCsiHandler({final:"u"},d=>this.restoreCursor(d)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},d=>this.insertColumns(d)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},d=>this.deleteColumns(d)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},d=>this.selectProtected(d)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},d=>this.requestMode(d,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},d=>this.requestMode(d,!1)),this._parser.setExecuteHandler(Ee.BEL,()=>this.bell()),this._parser.setExecuteHandler(Ee.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(Ee.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(Ee.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(Ee.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(Ee.BS,()=>this.backspace()),this._parser.setExecuteHandler(Ee.HT,()=>this.tab()),this._parser.setExecuteHandler(Ee.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(Ee.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Ch.IND,()=>this.index()),this._parser.setExecuteHandler(Ch.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Ch.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new $n(d=>(this.setTitle(d),this.setIconName(d),!0))),this._parser.registerOscHandler(1,new $n(d=>this.setIconName(d))),this._parser.registerOscHandler(2,new $n(d=>this.setTitle(d))),this._parser.registerOscHandler(4,new $n(d=>this.setOrReportIndexedColor(d))),this._parser.registerOscHandler(8,new $n(d=>this.setHyperlink(d))),this._parser.registerOscHandler(10,new $n(d=>this.setOrReportFgColor(d))),this._parser.registerOscHandler(11,new $n(d=>this.setOrReportBgColor(d))),this._parser.registerOscHandler(12,new $n(d=>this.setOrReportCursorColor(d))),this._parser.registerOscHandler(104,new $n(d=>this.restoreIndexedColor(d))),this._parser.registerOscHandler(110,new $n(d=>this.restoreFgColor(d))),this._parser.registerOscHandler(111,new $n(d=>this.restoreBgColor(d))),this._parser.registerOscHandler(112,new $n(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 Ms)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 sk((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"),ak))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${ak} 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>da&&(l=this._parseStack.position+da)}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<da&&(this._parseBuffer=new Uint32Array(Math.min(e.length,da))),u||this._dirtyRowTracker.clearRange(),e.length>da)for(let d=l;d<e.length;d+=da){let p=d+da<e.length?d+da: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 C=l[String.fromCharCode(n)];C&&(n=C.charCodeAt(0))}let w=this._unicodeService.charProperties(n,x);o=Za.extractWidth(w);let k=Za.extractShouldJoin(w),N=k?Za.extractWidth(x):0;if(x=w,u&&this._onA11yChar.fire(ma(n)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+o-N>h){if(f){let C=g,A=this._activeBuffer.x-N;for(this._activeBuffer.x=N,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),g=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),N>0&&g instanceof Lc&&g.copyCellsFrom(C,A,0,N,!1);A<h;)C.setCellFromCodepoint(A++,0,1,p)}else if(this._activeBuffer.x=h-1,o===2)continue}if(k&&this._activeBuffer.x){let C=g.getWidth(this._activeBuffer.x-1)?1:2;g.addCodepointToCell(this._activeBuffer.x-C,n,o);for(let A=o-N;--A>=0;)g.setCellFromCodepoint(this._activeBuffer.x++,0,0,p);continue}if(d&&(g.insertCells(this._activeBuffer.x,o-N,this._activeBuffer.getNullCell(p)),g.getWidth(h-1)===2&&g.setCellFromCodepoint(h-1,0,1,p)),g.setCellFromCodepoint(this._activeBuffer.x++,n,o,p),o>0)for(;--o;)g.setCellFromCodepoint(this._activeBuffer.x++,0,0,p)}this._parser.precedingJoinState=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=>rk(s.params[0],this._optionsService.rawOptions.windowOptions)?t(s):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new sk(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new $n(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,s,n=!1,o=!1){let l=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);l.replaceCells(t,s,this._activeBuffer.getNullCell(this._eraseAttrData()),o),n&&(l.isWrapped=!1)}_resetBufferLine(e,t=!1){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s&&(s.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),s.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let s;switch(e.params[0]){case 0:for(s=this._activeBuffer.y,this._dirtyRowTracker.markDirty(s),this._eraseInBufferLine(s++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);s<this._bufferService.rows;s++)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(s);break;case 1:for(s=this._activeBuffer.y,this._dirtyRowTracker.markDirty(s),this._eraseInBufferLine(s,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(s+1).isWrapped=!1);s--;)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(s=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,s-1);s--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+s)?.getTrimmedLength(););for(;s>=0;s--)this._bufferService.scroll(this._eraseAttrData())}else{for(s=this._bufferService.rows,this._dirtyRowTracker.markDirty(s-1);s--;)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let n=this._activeBuffer.lines.length-this._bufferService.rows;n>0&&(this._activeBuffer.lines.trimStart(n),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-n,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-n,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let s=this._activeBuffer.ybase+this._activeBuffer.y,n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,o=this._bufferService.rows-1+this._activeBuffer.ybase-n+1;for(;t--;)this._activeBuffer.lines.splice(o-1,1),this._activeBuffer.lines.splice(s,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let s=this._activeBuffer.ybase+this._activeBuffer.y,n;for(n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,n=this._bufferService.rows-1+this._activeBuffer.ybase-n;t--;)this._activeBuffer.lines.splice(s,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(ws));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);n.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);n.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);n.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);n.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let s=e.params[0]||1,n=Za.extractWidth(t),o=this._activeBuffer.x-n,l=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(o),u=new Uint32Array(l.length*s),h=0;for(let d=0;d<l.length;){let p=l.codePointAt(d)||0;u[h++]=p,d+=p>65535?2:1}let f=h;for(let d=1;d<s;++d)u.copyWithin(f,0,h),f+=h;return this.print(u,0,f),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(Ee.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(Ee.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(Ee.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(Ee.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(Ee.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,Wa),this._charsetService.setgCharset(1,Wa),this._charsetService.setgCharset(2,Wa),this._charsetService.setgCharset(3,Wa);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){let s;(k=>(k[k.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",k[k.SET=1]="SET",k[k.RESET=2]="RESET",k[k.PERMANENTLY_SET=3]="PERMANENTLY_SET",k[k.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(s||={});let n=this._coreService.decPrivateModes,{activeProtocol:o,activeEncoding:l}=this._coreMouseService,u=this._coreService,{buffers:h,cols:f}=this._bufferService,{active:d,alt:p}=h,g=this._optionsService.rawOptions,x=(k,N)=>(u.triggerDataEvent(`${Ee.ESC}[${t?"":"?"}${k};${N}$y`),!0),v=k=>k?1:2,w=e.params[0];return t?w===2?x(w,4):w===4?x(w,v(u.modes.insertMode)):w===12?x(w,3):w===20?x(w,v(g.convertEol)):x(w,0):w===1?x(w,v(n.applicationCursorKeys)):w===3?x(w,g.windowOptions.setWinLines?f===80?2:f===132?1:0:0):w===6?x(w,v(n.origin)):w===7?x(w,v(n.wraparound)):w===8?x(w,3):w===9?x(w,v(o==="X10")):w===12?x(w,v(g.cursorBlink)):w===25?x(w,v(!u.isCursorHidden)):w===45?x(w,v(n.reverseWraparound)):w===66?x(w,v(n.applicationKeypad)):w===67?x(w,4):w===1e3?x(w,v(o==="VT200")):w===1002?x(w,v(o==="DRAG")):w===1003?x(w,v(o==="ANY")):w===1004?x(w,v(n.sendFocus)):w===1005?x(w,4):w===1006?x(w,v(l==="SGR")):w===1015?x(w,4):w===1016?x(w,v(l==="SGR_PIXELS")):w===1048?x(w,1):w===47||w===1047||w===1049?x(w,v(d===p)):w===2004?x(w,v(n.bracketedPasteMode)):w===2026?x(w,v(n.synchronizedOutput)):x(w,0)}_updateAttrColor(e,t,s,n,o){return t===2?(e|=50331648,e&=-16777216,e|=gu.fromColorRGB([s,n,o])):t===5&&(e&=-50331904,e|=33554432|s&255),e}_extractColor(e,t,s){let n=[0,0,-1,0,0,0],o=0,l=0;do{if(n[l+o]=e.params[t+l],e.hasSubParams(t+l)){let u=e.getSubParams(t+l),h=0;do n[1]===5&&(o=1),n[l+h+1+o]=u[h];while(++h<u.length&&h+l+1+o<n.length);break}if(n[1]===5&&l+o>=2||n[1]===2&&l+o>=5)break;n[1]&&(o=1)}while(++l+t<e.length&&l+o<n.length);for(let u=2;u<n.length;++u)n[u]===-1&&(n[u]=0);switch(n[0]){case 38:s.fg=this._updateAttrColor(s.fg,n[1],n[3],n[4],n[5]);break;case 48:s.bg=this._updateAttrColor(s.bg,n[1],n[3],n[4],n[5]);break;case 58:s.extended=s.extended.clone(),s.extended.underlineColor=this._updateAttrColor(s.extended.underlineColor,n[1],n[3],n[4],n[5])}return l}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=ws.fg,e.bg=ws.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,s,n=this._curAttrData;for(let o=0;o<t;o++)s=e.params[o],s>=30&&s<=37?(n.fg&=-50331904,n.fg|=16777216|s-30):s>=40&&s<=47?(n.bg&=-50331904,n.bg|=16777216|s-40):s>=90&&s<=97?(n.fg&=-50331904,n.fg|=16777216|s-90|8):s>=100&&s<=107?(n.bg&=-50331904,n.bg|=16777216|s-100|8):s===0?this._processSGR0(n):s===1?n.fg|=134217728:s===3?n.bg|=67108864:s===4?(n.fg|=268435456,this._processUnderline(e.hasSubParams(o)?e.getSubParams(o)[0]:1,n)):s===5?n.fg|=536870912:s===7?n.fg|=67108864:s===8?n.fg|=1073741824:s===9?n.fg|=2147483648:s===2?n.bg|=134217728:s===21?this._processUnderline(2,n):s===22?(n.fg&=-134217729,n.bg&=-134217729):s===23?n.bg&=-67108865:s===24?(n.fg&=-268435457,this._processUnderline(0,n)):s===25?n.fg&=-536870913:s===27?n.fg&=-67108865:s===28?n.fg&=-1073741825:s===29?n.fg&=2147483647:s===39?(n.fg&=-67108864,n.fg|=ws.fg&16777215):s===49?(n.bg&=-67108864,n.bg|=ws.bg&16777215):s===38||s===48||s===58?o+=this._extractColor(e,o,n):s===53?n.bg|=1073741824:s===55?n.bg&=-1073741825:s===59?(n.extended=n.extended.clone(),n.extended.underlineColor=-1,n.updateExtended()):s===100?(n.fg&=-67108864,n.fg|=ws.fg&16777215,n.bg&=-67108864,n.bg|=ws.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",s);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${Ee.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,s=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Ee.ESC}[${t};${s}R`);break}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let t=this._activeBuffer.y+1,s=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Ee.ESC}[?${t};${s}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=ws.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let s=t%2===1;this._coreService.decPrivateModes.cursorBlink=s}return!0}setScrollRegion(e){let t=e.params[0]||1,s;return(e.length<2||(s=e.params[1])>this._bufferService.rows||s===0)&&(s=this._bufferService.rows),s>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=s-1,this._setCursor(0,0)),!0}windowOptions(e){if(!rk(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${Ee.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>ik&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>ik&&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(lk(l))if(o==="?")t.push({type:0,index:l});else{let u=nk(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=nk(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]);lk(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,Wa),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(kV[e[0]],Ms[e[1]]||Wa),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=ws.clone(),this._eraseAttrDataInternal=ws.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new ui;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let s=this._activeBuffer.ybase+this._activeBuffer.y+t,n=this._activeBuffer.lines.get(s);n&&(n.fill(e),n.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let s=u=>(this._coreService.triggerDataEvent(`${Ee.ESC}${u}${Ee.ESC}\\`),!0),n=this._bufferService.buffer,o=this._optionsService.rawOptions;return s(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${n.scrollTop+1};${n.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[o.cursorStyle]-(o.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},M0=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&&(ok=e,e=t,t=ok),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};M0=os([Fe(0,hn)],M0);function lk(e){return 0<=e&&e<256}var CV=5e7,ck=12,EV=50,jV=class extends mt{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new ze),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let s;for(;s=this._writeBuffer.shift();){this._action(s);let n=this._callbacks.shift();n&&n()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>CV)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>=ck?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>=ck)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>EV&&(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()}},D0=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)))}};D0=os([Fe(0,hn)],D0);var uk=!1,AV=class extends mt{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new fl),this._onBinary=this._register(new ze),this.onBinary=this._onBinary.event,this._onData=this._register(new ze),this.onData=this._onData.event,this._onLineFeed=this._register(new ze),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new ze),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new ze),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new ze),this._instantiationService=new Jq,this.optionsService=this._register(new cV(e)),this._instantiationService.setService(fn,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(j0)),this._instantiationService.setService(hn,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(E0)),this._instantiationService.setService(uj,this._logService),this.coreService=this._register(this._instantiationService.createInstance(A0)),this._instantiationService.setService(ho,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(T0)),this._instantiationService.setService(cj,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Za)),this._instantiationService.setService(YU,this.unicodeService),this._charsetService=this._instantiationService.createInstance(mV),this._instantiationService.setService(KU,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(D0),this._instantiationService.setService(dj,this._oscLinkService),this._inputHandler=this._register(new NV(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Ys.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Ys.forward(this._bufferService.onResize,this._onResize)),this._register(Ys.forward(this.coreService.onData,this._onData)),this._register(Ys.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 jV((t,s)=>this._inputHandler.parse(t,s))),this._register(Ys.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new ze),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!uk&&(this._logService.warn("writeSync is unreliable and will be removed soon."),uk=!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,Fj),t=Math.max(t,qj),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(tk.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(tk(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Qt(()=>{for(let t of e)t.dispose()})}}},TV={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 RV(e,t,s,n){let o={type:0,cancel:!1,key:void 0},l=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?o.key=Ee.ESC+"OA":o.key=Ee.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?o.key=Ee.ESC+"OD":o.key=Ee.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?o.key=Ee.ESC+"OC":o.key=Ee.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?o.key=Ee.ESC+"OB":o.key=Ee.ESC+"[B");break;case 8:o.key=e.ctrlKey?"\b":Ee.DEL,e.altKey&&(o.key=Ee.ESC+o.key);break;case 9:if(e.shiftKey){o.key=Ee.ESC+"[Z";break}o.key=Ee.HT,o.cancel=!0;break;case 13:o.key=e.altKey?Ee.ESC+Ee.CR:Ee.CR,o.cancel=!0;break;case 27:o.key=Ee.ESC,e.altKey&&(o.key=Ee.ESC+Ee.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;l?o.key=Ee.ESC+"[1;"+(l+1)+"D":t?o.key=Ee.ESC+"OD":o.key=Ee.ESC+"[D";break;case 39:if(e.metaKey)break;l?o.key=Ee.ESC+"[1;"+(l+1)+"C":t?o.key=Ee.ESC+"OC":o.key=Ee.ESC+"[C";break;case 38:if(e.metaKey)break;l?o.key=Ee.ESC+"[1;"+(l+1)+"A":t?o.key=Ee.ESC+"OA":o.key=Ee.ESC+"[A";break;case 40:if(e.metaKey)break;l?o.key=Ee.ESC+"[1;"+(l+1)+"B":t?o.key=Ee.ESC+"OB":o.key=Ee.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(o.key=Ee.ESC+"[2~");break;case 46:l?o.key=Ee.ESC+"[3;"+(l+1)+"~":o.key=Ee.ESC+"[3~";break;case 36:l?o.key=Ee.ESC+"[1;"+(l+1)+"H":t?o.key=Ee.ESC+"OH":o.key=Ee.ESC+"[H";break;case 35:l?o.key=Ee.ESC+"[1;"+(l+1)+"F":t?o.key=Ee.ESC+"OF":o.key=Ee.ESC+"[F";break;case 33:e.shiftKey?o.type=2:e.ctrlKey?o.key=Ee.ESC+"[5;"+(l+1)+"~":o.key=Ee.ESC+"[5~";break;case 34:e.shiftKey?o.type=3:e.ctrlKey?o.key=Ee.ESC+"[6;"+(l+1)+"~":o.key=Ee.ESC+"[6~";break;case 112:l?o.key=Ee.ESC+"[1;"+(l+1)+"P":o.key=Ee.ESC+"OP";break;case 113:l?o.key=Ee.ESC+"[1;"+(l+1)+"Q":o.key=Ee.ESC+"OQ";break;case 114:l?o.key=Ee.ESC+"[1;"+(l+1)+"R":o.key=Ee.ESC+"OR";break;case 115:l?o.key=Ee.ESC+"[1;"+(l+1)+"S":o.key=Ee.ESC+"OS";break;case 116:l?o.key=Ee.ESC+"[15;"+(l+1)+"~":o.key=Ee.ESC+"[15~";break;case 117:l?o.key=Ee.ESC+"[17;"+(l+1)+"~":o.key=Ee.ESC+"[17~";break;case 118:l?o.key=Ee.ESC+"[18;"+(l+1)+"~":o.key=Ee.ESC+"[18~";break;case 119:l?o.key=Ee.ESC+"[19;"+(l+1)+"~":o.key=Ee.ESC+"[19~";break;case 120:l?o.key=Ee.ESC+"[20;"+(l+1)+"~":o.key=Ee.ESC+"[20~";break;case 121:l?o.key=Ee.ESC+"[21;"+(l+1)+"~":o.key=Ee.ESC+"[21~";break;case 122:l?o.key=Ee.ESC+"[23;"+(l+1)+"~":o.key=Ee.ESC+"[23~";break;case 123:l?o.key=Ee.ESC+"[24;"+(l+1)+"~":o.key=Ee.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?o.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?o.key=Ee.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?o.key=Ee.DEL:e.keyCode===219?o.key=Ee.ESC:e.keyCode===220?o.key=Ee.FS:e.keyCode===221&&(o.key=Ee.GS);else if((!s||n)&&e.altKey&&!e.metaKey){let u=TV[e.keyCode]?.[e.shiftKey?1:0];if(u)o.key=Ee.ESC+u;else if(e.keyCode>=65&&e.keyCode<=90){let h=e.ctrlKey?e.keyCode-64:e.keyCode+32,f=String.fromCharCode(h);e.shiftKey&&(f=f.toUpperCase()),o.key=Ee.ESC+f}else if(e.keyCode===32)o.key=Ee.ESC+(e.ctrlKey?Ee.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let h=e.code.slice(3,4);e.shiftKey||(h=h.toLowerCase()),o.key=Ee.ESC+h,o.cancel=!0}}else s&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(o.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?o.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(o.key=Ee.US),e.key==="@"&&(o.key=Ee.NUL));break}return o}var ms=0,MV=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Qh,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Qh,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((o,l)=>this._getKey(o)-this._getKey(l)),t=0,s=0,n=new Array(this._array.length+this._insertedValues.length);for(let o=0;o<n.length;o++)s>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[s])?(n[o]=e[t],t++):n[o]=this._array[s++];this._array=n,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(ms=this._search(t),ms===-1)||this._getKey(this._array[ms])!==t)return!1;do if(this._array[ms]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(ms),!0;while(++ms<this._array.length&&this._getKey(this._array[ms])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((o,l)=>o-l),t=0,s=new Array(this._array.length-e.length),n=0;for(let o=0;o<this._array.length;o++)e[t]===o?t++:s[n++]=this._array[o];this._array=s,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(ms=this._search(e),!(ms<0||ms>=this._array.length)&&this._getKey(this._array[ms])===e))do yield this._array[ms];while(++ms<this._array.length&&this._getKey(this._array[ms])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(ms=this._search(e),!(ms<0||ms>=this._array.length)&&this._getKey(this._array[ms])===e))do t(this._array[ms]);while(++ms<this._array.length&&this._getKey(this._array[ms])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,s=this._array.length-1;for(;s>=t;){let n=t+s>>1,o=this._getKey(this._array[n]);if(o>e)s=n-1;else if(o<e)t=n+1;else{for(;n>0&&this._getKey(this._array[n-1])===e;)n--;return n}}return t}},Og=0,dk=0,DV=class extends mt{constructor(){super(),this._decorations=new MV(e=>e?.marker.line),this._onDecorationRegistered=this._register(new ze),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new ze),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Qt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new OV(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=>{Og=o.options.x??0,dk=Og+(o.options.width??1),e>=Og&&e<dk&&(!s||(o.options.layer??"bottom")===s)&&n(o)})}},OV=class extends xa{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new ze),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new ze),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=ts.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=ts.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},LV=1e3,zV=class{constructor(e,t=LV){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)}},hk=20,Jh=class extends mt{constructor(e,t,s,n){super(),this._terminal=e,this._coreBrowserService=s,this._renderService=n,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let o=this._coreBrowserService.mainDocument;this._accessibilityContainer=o.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=o.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let l=0;l<this._terminal.rows;l++)this._rowElements[l]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[l]);if(this._topBoundaryFocusListener=l=>this._handleBoundaryFocus(l,0),this._bottomBoundaryFocusListener=l=>this._handleBoundaryFocus(l,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=o.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new zV(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(l=>this._handleResize(l.rows))),this._register(this._terminal.onRender(l=>this._refreshRows(l.start,l.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(l=>this._handleChar(l))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
107
|
+
`))),this._register(this._terminal.onA11yTab(l=>this._handleTab(l))),this._register(this._terminal.onKey(l=>this._handleKey(l.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(at(o,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Qt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<hk+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
108
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===hk+1&&(this._liveRegion.textContent+=Jx.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let s=this._terminal.buffer,n=s.lines.length.toString();for(let o=e;o<=t;o++){let l=s.lines.get(s.ydisp+o),u=[],h=l?.translateToString(!0,void 0,void 0,u)||"",f=(s.ydisp+o+1).toString(),d=this._rowElements[o];d&&(h.length===0?(d.textContent=" ",this._rowColumns.set(d,[0,1])):(d.textContent=h,this._rowColumns.set(d,u)),d.setAttribute("aria-posinset",f),d.setAttribute("aria-setsize",n),this._alignRowWidth(d))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let s=e.target,n=this._rowElements[t===0?1:this._rowElements.length-2],o=s.getAttribute("aria-posinset"),l=t===0?"1":`${this._terminal.buffer.lines.length}`;if(o===l||e.relatedTarget!==n)return;let u,h;if(t===0?(u=s,h=this._rowElements.pop(),this._rowContainer.removeChild(h)):(u=this._rowElements.shift(),h=s,this._rowContainer.removeChild(u)),u.removeEventListener("focus",this._topBoundaryFocusListener),h.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let f=this._createAccessibilityTreeNode();this._rowElements.unshift(f),this._rowContainer.insertAdjacentElement("afterbegin",f)}else{let f=this._createAccessibilityTreeNode();this._rowElements.push(f),this._rowContainer.appendChild(f)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},s={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(s.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===s.node&&t.offset>s.offset)&&([t,s]=[s,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let n=this._rowElements.slice(-1)[0];if(s.node.compareDocumentPosition(n)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(s={node:n,offset:n.textContent?.length??0}),!this._rowContainer.contains(s.node))return;let o=({node:h,offset:f})=>{let d=h instanceof Text?h.parentNode:h,p=parseInt(d?.getAttribute("aria-posinset"),10)-1;if(isNaN(p))return console.warn("row is invalid. Race condition?"),null;let g=this._rowColumns.get(d);if(!g)return console.warn("columns is null. Race condition?"),null;let x=f<g.length?g[f]:g.slice(-1)[0]+1;return x>=this._terminal.cols&&(++p,x=0),{row:p,column:x}},l=o(t),u=o(s);if(!(!l||!u)){if(l.row>u.row||l.row===u.row&&l.column>=u.column)throw new Error("invalid range");this._terminal.select(l.column,l.row,(u.row-l.row)*this._terminal.cols-l.column+u.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform="";let t=e.getBoundingClientRect().width,s=this._rowColumns.get(e)?.slice(-1)?.[0];if(!s)return;let n=s*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${n/t})`}};Jh=os([Fe(1,Hb),Fe(2,Mr),Fe(3,Dr)],Jh);var O0=class extends mt{constructor(e,t,s,n,o){super(),this._element=e,this._mouseService=t,this._renderService=s,this._bufferService=n,this._linkProviderService=o,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new ze),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new ze),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Qt(()=>{ro(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(at(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(at(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(at(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(at(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let s=e.composedPath();for(let n=0;n<s.length;n++){let o=s[n];if(o.classList.contains("xterm"))break;if(o.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(n=>{n?.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let s=!1;for(let[n,o]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(n)&&(s=this._checkLinkProviderResult(n,e,s)):o.provideLinks(e.y,l=>{if(this._isMouseOut)return;let u=l?.map(h=>({link:h}));this._activeProviderReplies?.set(n,u),s=this._checkLinkProviderResult(n,e,s),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let s=new Set;for(let n=0;n<t.size;n++){let o=t.get(n);if(o)for(let l=0;l<o.length;l++){let u=o[l],h=u.link.range.start.y<e?0:u.link.range.start.x,f=u.link.range.end.y>e?this._bufferService.cols:u.link.range.end.x;for(let d=h;d<=f;d++){if(s.has(d)){o.splice(l--,1);break}s.add(d)}}}}_checkLinkProviderResult(e,t,s){if(!this._activeProviderReplies)return s;let n=this._activeProviderReplies.get(e),o=!1;for(let l=0;l<e;l++)(!this._activeProviderReplies.has(l)||this._activeProviderReplies.get(l))&&(o=!0);if(!o&&n){let l=n.find(u=>this._linkAtPosition(u.link,t));l&&(s=!0,this._handleNewLink(l))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!s)for(let l=0;l<this._activeProviderReplies.size;l++){let u=this._activeProviderReplies.get(l)?.find(h=>this._linkAtPosition(h.link,t));if(u){s=!0,this._handleNewLink(u);break}}return s}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&BV(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,ro(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}}};O0=os([Fe(1,Ub),Fe(2,Dr),Fe(3,hn),Fe(4,fj)],O0);function BV(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 PV=class extends AV{constructor(e={}){super(e),this._linkifier=this._register(new fl),this.browser=Mj,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new fl),this._onCursorMove=this._register(new ze),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new ze),this.onKey=this._onKey.event,this._onRender=this._register(new ze),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new ze),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new ze),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new ze),this.onBell=this._onBell.event,this._onFocus=this._register(new ze),this._onBlur=this._register(new ze),this._onA11yCharEmitter=this._register(new ze),this._onA11yTabEmitter=this._register(new ze),this._onWillOpen=this._register(new ze),this._setup(),this._decorationService=this._instantiationService.createInstance(DV),this._instantiationService.setService(xu,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Eq),this._instantiationService.setService(fj,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(t0)),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(Ys.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Ys.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Ys.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Ys.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(Qt(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let s,n="";switch(t.index){case 256:s="foreground",n="10";break;case 257:s="background",n="11";break;case 258:s="cursor",n="12";break;default:s="ansi",n="4;"+t.index}switch(t.type){case 0:let o=Wt.toColorRGB(s==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[s]);this.coreService.triggerDataEvent(`${Ee.ESC}]${n};${SV(o)}${Tj.ST}`);break;case 1:if(s==="ansi")this._themeService.modifyColors(l=>l.ansi[t.index]=Ns.toColor(...t.color));else{let l=s;this._themeService.modifyColors(u=>u[l]=Ns.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Jh,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Ee.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Ee.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let s=Math.min(this.buffer.x,this.cols-1),n=this._renderService.dimensions.css.cell.height,o=t.getWidth(s),l=this._renderService.dimensions.css.cell.width*o,u=this.buffer.y*this._renderService.dimensions.css.cell.height,h=s*this._renderService.dimensions.css.cell.width;this.textarea.style.left=h+"px",this.textarea.style.top=u+"px",this.textarea.style.width=l+"px",this.textarea.style.height=n+"px",this.textarea.style.lineHeight=n+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(at(this.element,"copy",t=>{this.hasSelection()&&UU(t,this._selectionService)}));let e=t=>FU(t,this.textarea,this.coreService,this.optionsService);this._register(at(this.textarea,"paste",e)),this._register(at(this.element,"paste",e)),Dj?this._register(at(this.element,"mousedown",t=>{t.button===2&&w2(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(at(this.element,"contextmenu",t=>{w2(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Xb&&this._register(at(this.element,"auxclick",t=>{t.button===1&&ij(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(at(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(at(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(at(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(at(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(at(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(at(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(at(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(at(this.screenElement,"mousemove",o=>this.updateCursorStyle(o))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let s=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Qx.get()),zj||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(Nq,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Mr,this._coreBrowserService),this._register(at(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(at(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(w0,this._document,this._helperContainer),this._instantiationService.setService(Tf,this._charSizeService),this._themeService=this._instantiationService.createInstance(C0),this._instantiationService.setService(_l,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Xh),this._instantiationService.setService(hj,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(k0,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(v0,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(S0),this._instantiationService.setService(Ub,this._mouseService);let n=this._linkifier.value=this._register(this._instantiationService.createInstance(O0,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(x0,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(N0,this.element,this.screenElement,n)),this._instantiationService.setService(ZU,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(Ys.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(b0,this.screenElement)),this._register(at(this.element,"mousedown",o=>this._selectionService.handleMouseDown(o))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(Jh,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Yh,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Yh,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(y0,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function s(l){let u=e._mouseService.getMouseReportCoords(l,e.screenElement);if(!u)return!1;let h,f;switch(l.overrideType||l.type){case"mousemove":f=32,l.buttons===void 0?(h=3,l.button!==void 0&&(h=l.button<3?l.button:3)):h=l.buttons&1?0:l.buttons&4?1:l.buttons&2?2:3;break;case"mouseup":f=0,h=l.button<3?l.button:3;break;case"mousedown":f=1,h=l.button<3?l.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(l)===!1)return!1;let d=l.deltaY;if(d===0||e.coreMouseService.consumeWheelEvent(l,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;f=d<0?0:1,h=4;break;default:return!1}return f===void 0||h===void 0||h>4?!1:e.coreMouseService.triggerMouseEvent({col:u.col,row:u.row,x:u.x,y:u.y,button:h,action:f,ctrl:l.ctrlKey,alt:l.altKey,shift:l.shiftKey})}let n={mouseup:null,wheel:null,mousedrag:null,mousemove:null},o={mouseup:l=>(s(l),l.buttons||(this._document.removeEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.removeEventListener("mousemove",n.mousedrag)),this.cancel(l)),wheel:l=>(s(l),this.cancel(l,!0)),mousedrag:l=>{l.buttons&&s(l)},mousemove:l=>{l.buttons||s(l)}};this._register(this.coreMouseService.onProtocolChange(l=>{l?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(l)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),l&8?n.mousemove||(t.addEventListener("mousemove",o.mousemove),n.mousemove=o.mousemove):(t.removeEventListener("mousemove",n.mousemove),n.mousemove=null),l&16?n.wheel||(t.addEventListener("wheel",o.wheel,{passive:!1}),n.wheel=o.wheel):(t.removeEventListener("wheel",n.wheel),n.wheel=null),l&2?n.mouseup||(n.mouseup=o.mouseup):(this._document.removeEventListener("mouseup",n.mouseup),n.mouseup=null),l&4?n.mousedrag||(n.mousedrag=o.mousedrag):(this._document.removeEventListener("mousemove",n.mousedrag),n.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(at(t,"mousedown",l=>{if(l.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(l)))return s(l),n.mouseup&&this._document.addEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.addEventListener("mousemove",n.mousedrag),this.cancel(l)})),this._register(at(t,"wheel",l=>{if(!n.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(l)===!1)return!1;if(!this.buffer.hasScrollback){if(l.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(l,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(l,!0);let u=Ee.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(l.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(u,!0),this.cancel(l,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){nj(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=RV(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),s.type===3||s.type===2){let n=this.rows-1;return this.scrollLines(s.type===2?-n:n),this.cancel(e,!0)}if(s.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(s.cancel&&this.cancel(e,!0),!s.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((s.key===Ee.ETX||s.key===Ee.CR)&&(this.textarea.value=""),this._onKey.fire({key:s.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(s.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let s=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?s:s&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(IV(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(ws));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(Ee.ESC+"[I"):this.coreService.triggerDataEvent(Ee.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),s=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Ee.ESC}[4;${s};${t}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),o=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Ee.ESC}[6;${o};${n}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function IV(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var $V=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)}},HV=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new ui)}translateToString(e,t,s){return this._line.translateToString(e,t,s)}},fk=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 HV(t)}getNullCell(){return new ui}},UV=class extends mt{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new ze),this.onBufferChange=this._onBufferChange.event,this._normal=new fk(this._core.buffers.normal,"normal"),this._alternate=new fk(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)}},FV=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)}},qV=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}},VV=["cols","rows"],Hi=0,GV=class extends mt{constructor(e){super(),this._core=this._register(new PV(e)),this._addonManager=this._register(new $V),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(VV.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 FV(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new qV(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 UV(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,s){this._verifyIntegers(e,t,s),this._core.select(e,t,s)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
|
|
109
|
+
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return Qx.get()},set promptLabel(e){Qx.set(e)},get tooMuchOutput(){return Jx.get()},set tooMuchOutput(e){Jx.set(e)}}}_verifyIntegers(...e){for(Hi of e)if(Hi===1/0||isNaN(Hi)||Hi%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Hi of e)if(Hi&&(Hi===1/0||isNaN(Hi)||Hi%1!==0||Hi<0))throw new Error("This API only accepts positive integers")}};const Lg={state:"connecting",cwd:"Local workspace",detail:"Opening shell"},Zb=1;function WV(e){return{focus:e.focus,refit:e.refit,restart:()=>e.sendControl("restart"),stop:()=>e.sendControl("stop")}}function KV(e,t,s){if(!e||e.readyState!==Zb)return;const n=t?.proposeDimensions();e.send(JSON.stringify({cols:n?.cols,rows:n?.rows,type:s}))}function YV(e,t){if(!e)return;const s=t.schedule(()=>{t.refit(),t.focus()});return()=>t.cancel(s)}function XV(e){const t=e.location??window.location,s=e.createSocket??(p=>new WebSocket(p));e.reportStatus(e.initialStatus);const n=s(ZV(e.sessionId,t));let o=!1,l;const u=[],h=e.scheduleInitialInput??(p=>{const g=window.setTimeout(p,200);return()=>window.clearTimeout(g)}),f=()=>{l?.(),l=h(()=>{l=void 0,(e.claimInitialInput?.()??[]).forEach((g,x)=>{const v=()=>n.send(JSON.stringify({data:g,type:"input"}));if(x===0)v();else{const w=e.scheduleInput??((k,N)=>{const C=window.setTimeout(k,N);return()=>window.clearTimeout(C)});u.push(w(v,x*(e.initialInputIntervalMs??75)))}})})},d=e.terminal.onData(p=>{o||n.readyState===Zb&&n.send(JSON.stringify({data:p,type:"input"}))});return n.addEventListener("open",()=>{o||(e.reportStatus(p=>({...p,state:"running",detail:"Shell connected"})),e.sendResize())}),n.addEventListener("message",p=>{if(o)return;const g=QV(p.data);if(g){if(g.type==="output"){e.terminal.write(g.data),f();return}if(g.type==="error"){e.reportStatus(x=>({...x,state:"error",detail:g.error}));return}e.reportStatus(x=>({state:g.state==="idle"?"connecting":g.state,cwd:g.cwd??x.cwd,detail:g.error??g.shell??"Shell connected"}))}}),n.addEventListener("close",()=>{o||e.reportStatus(p=>({...p,state:p.state==="exited"?p.state:"exited",detail:"Socket closed"}))}),n.addEventListener("error",()=>{o||e.reportStatus(p=>({...p,state:"error",detail:"Terminal socket error"}))}),{socket:n,dispose:()=>{o||(o=!0,l?.(),u.forEach(p=>p()),d.dispose(),n.close())}}}const Gj=_.forwardRef(function({sessionId:t,active:s,claimInitialInput:n,initialInputIntervalMs:o,onStatusChange:l},u){const h=_.useRef(null),f=_.useRef(null),d=_.useRef(null),p=_.useRef(null),g=_.useRef(l),x=_.useRef(Lg),v=$s();_.useEffect(()=>{g.current=l},[l]);const w=_.useCallback(C=>{const A=typeof C=="function"?C(x.current):C;x.current=A,g.current?.(A)},[]),k=_.useCallback(()=>{const C=d.current;if(!C)return;C.fit();const A=C.proposeDimensions();if(!A)return;if(v){h8(t,A.cols,A.rows);return}const j=p.current;j?.readyState===Zb&&j.send(JSON.stringify({cols:A.cols,rows:A.rows,type:"resize"}))},[v,t]),N=_.useCallback(C=>{v||KV(p.current,d.current,C)},[v]);return _.useImperativeHandle(u,()=>WV({focus:()=>f.current?.focus(),refit:k,sendControl:N}),[N,k]),_.useEffect(()=>{const C=h.current;if(!C)return;const A=new GV({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"}}),j=new BU;A.loadAddon(j),A.open(C),f.current=A,d.current=j;let T;if(v){w(Lg);let $=null,D=!1,P;const B=A.onData(G=>{dw(t,G)});m8(t,G=>{A.write(G),P!==void 0&&window.clearTimeout(P),P=window.setTimeout(()=>{P=void 0,(async()=>{const F=n?.()??[];for(let z=0;z<F.length;z+=1)z>0&&await new Promise(U=>window.setTimeout(U,o??75)),await dw(t,F[z])})()},200)}).then(G=>{if(D){G();return}$=G,w(F=>({...F,state:"running",detail:"Shell connected"})),d8(t),k()},G=>{D||w(F=>({...F,state:"error",detail:G instanceof Error?G.message:String(G)}))}),T=()=>{D=!0,P!==void 0&&window.clearTimeout(P),B.dispose(),$?.()}}else{const $=XV({claimInitialInput:n,initialInputIntervalMs:o,initialStatus:Lg,reportStatus:w,sendResize:k,sessionId:t,terminal:A});p.current=$.socket,T=()=>{$.dispose(),p.current=null}}window.addEventListener("resize",k);const M=window.setTimeout(k,0),O=new ResizeObserver(()=>k());return O.observe(C),()=>{window.removeEventListener("resize",k),window.clearTimeout(M),O.disconnect(),T(),A.dispose(),f.current=null,d.current=null}},[w,t,k,v]),_.useEffect(()=>YV(s,{cancel:C=>window.clearTimeout(C),focus:()=>f.current?.focus(),refit:k,schedule:C=>window.setTimeout(C,0)}),[s,k]),r.jsx("section",{"aria-label":"terminal viewport",className:ue("h-full min-h-0 overflow-hidden bg-[#090909] px-3 py-0.5",!s&&"hidden"),children:r.jsx("div",{className:"h-full w-full",ref:h})})});function ZV(e,t){const s=t.protocol==="https:"?"wss:":"ws:",n=encodeURIComponent(e);return`${s}//${t.host}/api/terminal/socket?id=${n}`}function QV(e){if(typeof e!="string")return null;try{const t=JSON.parse(e);return typeof t?.type=="string"?t:null}catch{return null}}const JV=new Set(["c","cpp","cs","go","java","js","jsx","kt","mjs","py","rs","swift","ts","tsx"]),eG=new Set([".env",".gitignore","components.json","dockerfile","package.json","tsconfig.json","vite.config.ts"]),tG=new Set(["conf","config","ini","toml","yaml","yml"]),sG=new Set(["csv","json","sql","xml"]),nG=new Set(["md","mdx","rst","txt"]),iG=new Set(["gif","jpeg","jpg","png","svg","webp"]),rG=new Set(["package-lock.json","pnpm-lock.yaml","yarn.lock"]),aG=new Set(["css","less","sass","scss"]);function oG(e){const t=e.split("/").pop()?.toLowerCase()??e.toLowerCase(),s=t.includes(".")?t.split(".").pop()??"":"";return rG.has(t)||t.endsWith(".lock")?"lock":lG(t)?"test":eG.has(t)||tG.has(s)?"config":aG.has(s)?"style":iG.has(s)?"image":nG.has(s)?"document":sG.has(s)?"data":JV.has(s)?"code":"generic"}function lG(e){return e.includes(".test.")||e.includes(".spec.")||e.endsWith("_test.go")}function Qb({path:e,className:t}){const s=oG(e),n=cG[s];return r.jsx(n,{"aria-label":`${s} file`,className:ue("size-3.5 shrink-0",uG[s],t)})}const cG={code:ZN,config:o6,data:di,document:Q0,generic:eC,image:WR,lock:oM,style:RM,test:yR},uG={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 dG(e){const t=e.lastIndexOf(".");return t>0?e.slice(t):""}function hG({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),MC(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(J,{"aria-label":"Parent folder",className:"size-7",disabled:!g,onClick:()=>o&&n(o.parent),size:"icon",type:"button",variant:"ghost",children:r.jsx(hf,{})}),r.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-muted-foreground",title:o?.path,children:o?.path??"…"}),f?r.jsx(jt,{className:"size-3.5 animate-spin text-muted-foreground"}):null,o?r.jsxs(J,{className:"h-7 px-2 text-[11px]",onClick:()=>e(o.path),size:"sm",title:"Attach this folder",type:"button",variant:"outline",children:[r.jsx(tR,{})," This folder"]}):null,r.jsx(J,{"aria-label":"Close",className:"size-7",onClick:t,size:"icon",type:"button",variant:"ghost",children:r.jsx(qt,{})})]}),r.jsx("div",{className:"max-h-64 overflow-auto p-1",children:u?r.jsx(Qe,{variant:"destructive",className:"m-1",children:u}):o&&o.entries.length===0?r.jsx(Qe,{variant:"muted",className:"m-1 text-center",children:"Empty folder."}):o?.entries.map(x=>{const v=x.isDir?"":dG(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(lo,{className:"size-3.5 shrink-0 text-amber-600"}):r.jsx(Qb,{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)})})]})}function fG(e,t){const s=t?.trim()||e.split(/\r?\n/).find(n=>n.trim())?.trim()||"Agent task";return s.length>60?`${s.slice(0,57).trimEnd()}…`:s}function mG({onSubmitted:e}){const{activeSource:t,clearSource:s,configured:n,createTask:o,creating:l,draft:u,focusNonce:h,insertPath:f,onboarding:d,provider:p,setDraft:g,setOnboarding:x}=At(),[v,w]=_.useState(!1),[k,N]=_.useState(""),C=_.useRef(null);_.useEffect(()=>{const M=requestAnimationFrame(()=>{const O=C.current;if(!O)return;O.focus();const $=O.value.length;O.setSelectionRange($,$)});return()=>cancelAnimationFrame(M)},[h]),_.useLayoutEffect(()=>{C.current&&(C.current.style.height="auto",C.current.style.height=`${C.current.scrollHeight}px`)},[u]);async function A(M=u,O){!M.trim()||l||n!==!0||!await o({prompt:M,label:fG(M,O??t?.label),source:t??void 0})||(g(""),s(),x(!1),N(""),e?.())}function j(M){M.key==="Enter"&&!M.shiftKey&&(M.preventDefault(),A())}const T=p?.id==="codex"?r.jsx(bl,{className:"size-4"}):r.jsx(uo,{className:"size-4"});return r.jsx("div",{className:"flex h-full items-center justify-center overflow-auto p-6",children:r.jsxs("div",{className:"w-full max-w-3xl",children:[n===null?r.jsxs("div",{className:"mb-3 border-l-2 border-border pl-3 text-xs text-muted-foreground",children:["Checking ",p?.label??"agent"," availability…"]}):null,n===!1?r.jsxs("div",{className:"mb-3 border-l-2 border-amber-500/70 pl-3 text-xs text-muted-foreground",children:[r.jsxs("span",{className:"font-medium text-foreground",children:[p?.label??"Agent"," is not installed."]})," ",p?.installHint]}):null,t?r.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[r.jsx("span",{className:"font-mono uppercase tracking-wide",children:"Source"}),r.jsx("span",{className:"rounded-sm bg-muted px-1.5 py-0.5 text-foreground",children:t.label}),r.jsx("button",{"aria-label":"Clear source",onClick:s,type:"button",children:r.jsx(qt,{className:"size-3"})})]}):null,r.jsxs("div",{className:"border border-border bg-card shadow-sm",children:[d?r.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[r.jsx(JR,{className:"size-4 text-muted-foreground"}),r.jsx("input",{"aria-label":"Repository URL",className:"min-w-0 flex-1 bg-transparent text-sm outline-none",disabled:n!==!0,onChange:M=>N(M.target.value),placeholder:"https://github.com/owner/repository",value:k}),r.jsx(J,{disabled:n!==!0||!k.trim()||!!l,onClick:()=>{A(v$(k),`Onboard ${k}`)},size:"sm",children:"Onboard"})]}):null,r.jsx("textarea",{"aria-label":"Agent task prompt",className:"block max-h-40 min-h-20 w-full resize-none bg-transparent px-3 py-3 text-sm leading-relaxed outline-none placeholder:text-muted-foreground",disabled:n!==!0,onChange:M=>g(M.target.value),onKeyDown:j,placeholder:"Describe the complete task…",ref:C,rows:2,value:u}),r.jsxs("div",{className:"flex h-10 items-center gap-1 border-t border-border px-2",children:[r.jsxs("span",{className:"flex items-center gap-1.5 px-1 text-xs font-medium",children:[T,p?.label??"Agent"]}),r.jsx("button",{"aria-label":"Attach file or folder",className:"grid size-7 place-items-center rounded-sm text-muted-foreground hover:bg-muted hover:text-foreground",onClick:()=>w(M=>!M),type:"button",children:r.jsx(IM,{className:"size-3.5"})}),r.jsx("button",{className:"px-2 text-[11px] text-muted-foreground hover:text-foreground",onClick:()=>x(!d),type:"button",children:"Repository URL"}),r.jsx("span",{className:"flex-1"}),r.jsx("span",{className:"hidden text-[10px] text-muted-foreground sm:inline",children:"Shift+Enter for newline"}),r.jsx(J,{"aria-label":"Run agent task",className:"size-7",disabled:n!==!0||!u.trim()||!!l,onClick:()=>{A()},size:"icon",children:r.jsx(uf,{})})]})]}),v?r.jsx("div",{className:"relative mt-2",children:r.jsx(hG,{onClose:()=>w(!1),onPick:M=>{f(M),w(!1)}})}):null]})})}function pG(e){return e==="running"?"fill-emerald-500 text-emerald-500":e==="error"?"fill-destructive text-destructive":"fill-muted-foreground/50 text-muted-foreground/50"}function gG({tasks:e,activeTaskId:t,onActivate:s,onClose:n,pendingTaskIds:o}){return r.jsx("div",{"aria-label":"Agent tasks",className:"flex min-w-0 flex-1 items-stretch gap-px overflow-x-auto",role:"tablist",children:e.map(l=>{const u=l.label||`${l.provider==="codex"?"Codex":"Claude"} task`,h=l.id===t;return r.jsxs("div",{className:ue("group/tab flex h-9 shrink-0 items-center border-x border-transparent",h&&"border-border bg-background"),children:[r.jsxs("button",{"aria-controls":`agent-panel-${l.id}`,"aria-label":`Open task ${u}`,"aria-selected":h,className:"flex h-full max-w-56 items-center gap-2 px-3 text-xs",id:`agent-tab-${l.id}`,onClick:()=>s(l.id),role:"tab",type:"button",children:[r.jsx(cl,{"aria-hidden":!0,className:ue("size-2",pG(l.state))}),r.jsx("span",{className:ue("truncate font-mono text-[11px]",h?"text-foreground":"text-muted-foreground"),children:u})]}),r.jsx("button",{"aria-label":`Close task ${u}`,className:"mr-1 grid size-6 place-items-center rounded-sm text-muted-foreground opacity-50 hover:bg-muted hover:text-foreground group-hover/tab:opacity-100 disabled:pointer-events-none disabled:opacity-25",disabled:o?.has(l.id),onClick:()=>n(l.id),type:"button",children:r.jsx(qt,{className:"size-3"})})]},l.id)})})}function xG(e){return[`\x1B[200~${e}\x1B[201~`,"\r"]}function bG(e){return e==="claude"?500:75}function Df({className:e}){return r.jsx("svg",{className:ue("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"})})}const vG=[{page:"services",label:"Services",icon:r.jsx(ib,{})},{page:"git",label:"Git Review",icon:r.jsx(Vn,{})},{page:"github",label:"GitHub",icon:r.jsx(Df,{})},{page:"workflows",label:"Workflows",icon:r.jsx(Mh,{})},{page:"errors",label:"Error Inbox",icon:r.jsx(Zc,{})},{page:"database",label:"Database",icon:r.jsx(di,{})},{page:"terminal",label:"Terminal",icon:r.jsx(rb,{})},{page:"agent",label:"Agent",icon:r.jsx(qN,{})},{page:"agent-env",label:"Agent Env",icon:r.jsx(nb,{})}];function _G(e,t){const s=Math.max(0,t-48),n=Math.min(180,s);return Math.max(n,Math.min(s,e))}function yG(e){return`${e.charAt(0).toUpperCase()}${e.slice(1)}`}function wG({currentPage:e="services",git:t,onGitRefresh:s,onNavigate:n}){const{activeTaskId:o,claimInitialPrompt:l,closeTask:u,draft:h,focusNonce:f,onboarding:d,open:p,pendingTaskIds:g,provider:x,providers:v,selectProvider:w,setActiveTaskId:k,setOpen:N,stopTask:C,tasks:A,terminalError:j,updateTaskStatus:T}=At(),[M,O]=_.useState(()=>!!(h||f||d||A.length===0)),[$,D]=_.useState(null),[P,B]=_.useState(!1),[G,F]=_.useState(!1),z=_.useRef(null),U=_.useRef(f),K=_.useRef(d),I=_.useRef(A.length),Z=A.find(ee=>ee.id===o)??null;_.useEffect(()=>{A.length===0?O(!0):I.current===0&&!h&&O(!1),I.current=A.length},[h,A.length]),_.useEffect(()=>{f!==U.current&&O(!0),U.current=f},[f]),_.useEffect(()=>{d&&!K.current&&O(!0),K.current=d},[d]),_.useEffect(()=>()=>z.current?.(),[]),_.useEffect(()=>{if(!G)return;const ee=fe=>{fe.key==="Escape"&&F(!1)};return window.addEventListener("keydown",ee),()=>window.removeEventListener("keydown",ee)},[G]),_.useEffect(()=>{p||F(!1)},[p]);const W=()=>{F(!1),N(!1)},te=ee=>{n?.(ee),W()};function X(ee){ee.preventDefault(),ee.currentTarget.setPointerCapture?.(ee.pointerId),B(!0);const fe=Re=>D(_G(window.innerHeight-Re.clientY,window.innerHeight)),ie=()=>{window.removeEventListener("pointermove",fe),window.removeEventListener("pointerup",Se),z.current=null},Se=()=>{B(!1),ie()};z.current?.(),z.current=ie,window.addEventListener("pointermove",fe),window.addEventListener("pointerup",Se)}const q=(Z?.provider??x?.id)==="codex"?bl:uo,oe=Z?Z.provider==="codex"?"Codex":"Claude Code":x?.label??"Agent";return r.jsxs(r.Fragment,{children:[p?null:r.jsxs("button",{"aria-label":"Open agent terminal",className:"fixed inset-x-0 bottom-0 z-50 flex h-9 w-full items-center gap-2 border-t border-border bg-card/95 px-3 text-left shadow-[0_-4px_18px_-14px_rgba(0,0,0,.45)] backdrop-blur",onClick:()=>N(!0),type:"button",children:[r.jsx(q,{className:"size-3.5 text-primary"}),r.jsx("span",{className:"text-xs font-medium",children:oe}),r.jsx("span",{className:"h-3 w-px bg-border"}),r.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-muted-foreground",children:Z?.label??"New agent task"}),Z?r.jsxs("span",{className:ue("font-mono text-[10px] text-muted-foreground",Z.state==="running"&&"text-emerald-600",Z.state==="error"&&"text-destructive"),children:[r.jsx("span",{className:"sr-only",children:"Active task status: "}),yG(Z.state)]}):null,A.length>1?r.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:A.length}):null,r.jsx(hf,{className:"size-3.5 text-muted-foreground"})]}),r.jsxs("div",{"aria-hidden":!p||void 0,className:ue("fixed inset-x-0 bottom-0 z-50 flex flex-col overflow-hidden border-t border-border bg-card shadow-[0_-12px_30px_-20px_rgba(0,0,0,.5)]",!G&&(P||"transition-[height] duration-150"),!p&&"invisible pointer-events-none border-transparent shadow-none"),inert:!p||void 0,style:G?{height:"auto",top:$s()?32:0}:{height:p?$??"50vh":0},children:[G?r.jsx("nav",{"aria-label":"Full-screen navigation",className:"flex h-11 shrink-0 items-center gap-1 overflow-x-auto border-b border-border bg-background px-2",children:vG.map(ee=>r.jsxs("button",{"aria-current":e===ee.page?"page":void 0,"aria-label":ee.label,className:ue("flex h-8 shrink-0 items-center gap-2 rounded-md px-3 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground [&_svg]:size-4",e===ee.page&&"bg-primary text-primary-foreground hover:bg-primary/90 hover:text-primary-foreground"),onClick:()=>te(ee.page),type:"button",children:[ee.icon,r.jsx("span",{children:ee.label})]},ee.page))}):null,r.jsx("div",{"aria-hidden":!0,className:ue("absolute inset-x-0 -top-1 z-20 h-2 cursor-ns-resize",G&&"hidden"),"data-agent-resize-grip":!0,onDoubleClick:()=>D(null),onPointerDown:X}),r.jsxs("div",{className:"flex h-9 shrink-0 items-stretch border-b border-border bg-muted/25",children:[r.jsx("select",{"aria-label":"Agent provider",className:"h-9 max-w-36 border-r border-border bg-transparent px-2 text-xs font-medium outline-none",disabled:v.length<2,onChange:ee=>{w(ee.target.value)},value:x?.id??"claude",children:v.map(ee=>r.jsxs("option",{disabled:!ee.configured,title:ee.configured?void 0:ee.installHint,value:ee.id,children:[ee.label,ee.configured?"":" · not installed"]},ee.id))}),r.jsx(gG,{activeTaskId:o,onActivate:ee=>{k(ee),O(!1)},onClose:ee=>{u(ee)},pendingTaskIds:g,tasks:A}),r.jsxs("div",{className:"flex shrink-0 items-center border-l border-border px-1",children:[r.jsx("button",{"aria-label":"New agent task",className:"grid size-7 place-items-center rounded-sm text-muted-foreground hover:bg-muted hover:text-foreground",onClick:()=>O(!0),type:"button",children:r.jsx(ps,{className:"size-3.5"})}),Z?.state==="running"?r.jsx("button",{"aria-label":`Stop task ${Z.label??"Agent task"}`,className:"grid size-7 place-items-center rounded-sm text-muted-foreground hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-35",disabled:g.has(Z.id),onClick:()=>{C(Z.id)},type:"button",children:r.jsx(no,{className:"size-3"})}):null,r.jsx("button",{"aria-label":G?"Restore terminal dock":"Enter full-screen terminal",className:"grid size-7 place-items-center rounded-sm text-muted-foreground hover:bg-muted hover:text-foreground",onClick:()=>F(ee=>!ee),type:"button",children:G?r.jsx(sb,{className:"size-3.5"}):r.jsx(tb,{className:"size-3.5"})}),r.jsx("button",{"aria-label":"Collapse agent terminal",className:"grid size-7 place-items-center rounded-sm text-muted-foreground hover:bg-muted hover:text-foreground",onClick:W,type:"button",children:r.jsx(Gn,{className:"size-3.5"})})]})]}),j?r.jsx("div",{role:"alert",className:"border-b border-destructive/30 bg-destructive/5 px-3 py-1 font-mono text-[11px] text-destructive",children:j}):null,t&&(M||A.length===0)?r.jsx("div",{className:"shrink-0 px-3 pt-2",children:r.jsx(DU,{git:t,onRefresh:s})}):null,r.jsxs("div",{className:"relative min-h-0 flex-1 bg-[#101214]",children:[A.map(ee=>r.jsx("div",{"aria-labelledby":`agent-tab-${ee.id}`,className:ue("absolute inset-0",(!p||M||ee.id!==o)&&"invisible pointer-events-none"),id:`agent-panel-${ee.id}`,role:"tabpanel",children:r.jsx(Gj,{active:p&&!M&&ee.id===o,claimInitialInput:()=>{const fe=l(ee.id);return fe?xG(fe):void 0},initialInputIntervalMs:bG(ee.provider??"claude"),onStatusChange:fe=>T(ee.id,{state:fe.state==="connecting"?"idle":fe.state,cwd:fe.cwd,error:fe.state==="error"?fe.detail:void 0}),sessionId:ee.id})},ee.id)),p&&(M||A.length===0)?r.jsx("div",{className:"absolute inset-0 bg-background",children:r.jsx(mG,{onSubmitted:()=>O(!1)})}):null]})]})]})}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]}function Of(e,t){if(!e)return!1;const s=t.endsWith("/")?t.slice(0,-1):t;return e===s||e.startsWith(`${s}/`)}function SG(e,t){return!t||!e?!0:Of(e,t)}function kG(e,t){const s=e.config.services.filter(h=>Of(h.cwd,t.path)),n=new Set(s.map(h=>h.name)),o=e.config.bundles.map(h=>({...h,services:h.services.filter(f=>n.has(f))})).filter(h=>h.services.length>0),l=Object.fromEntries(Object.entries(e.runtime.services).filter(([h])=>n.has(h))),u=Object.fromEntries(Object.entries(e.health).filter(([h])=>n.has(h)));return{...e,config:{...e.config,services:s,bundles:o},runtime:{services:l},health:u,ports:e.ports.filter(h=>h.services.some(f=>n.has(f))),logs:e.logs.filter(h=>n.has(h.service)),timeline:e.timeline.filter(h=>!h.service||n.has(h.service))}}const zg={host:"",port:"",user:"",password:"",database:"",ssl:!1},NG="localhost";function L0(e,t,{includePassword:s=!0}={}){const n=e==="mysql"?"mysql":"postgres",o=t.host.trim()||NG,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 z0(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:mk(t.username),password:mk(t.password),database:t.pathname.replace(/^\//,""),ssl:t.searchParams.get("sslmode")==="require"||t.searchParams.has("ssl")}}function CG(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 mk(e){try{return decodeURIComponent(e)}catch{return e}}const EG=[{value:"postgres",label:"Postgres"},{value:"mysql",label:"MySQL"},{value:"sqlite",label:"SQLite"}];function jG({onClose:e,onSaved:t,initial:s,projects:n=[]}){const{error:o,success:l}=as(),u=!!s,h=_.useMemo(()=>AG(s),[s]),[f,d]=_.useState(h.engine),[p,g]=_.useState(h.name),[x,v]=_.useState(h.url),[w,k]=_.useState(h.fields),[N,C]=_.useState([]),[A,j]=_.useState(s?.projectPath??""),[T,M]=_.useState({status:"idle"}),[O,$]=_.useState(!1),[D,P]=_.useState(!1);_.useEffect(()=>{u||Q8().then(C).catch(()=>C([]))},[u]);const B=f==="sqlite",G=B?x.trim():L0(f,w),F=B?!!x.trim():!!(w.host.trim()&&w.database.trim());function z(){M({status:"idle"})}function U(q,oe){return L0(q,oe,{includePassword:!1})}function K(q){d(q),z(),q!=="sqlite"&&v(U(q,w))}function I(q){const oe={...w,...q};k(oe),v(U(f,oe)),z()}function Z(q){z();const oe=CG(q),ee=oe??f;oe&&oe!==f&&d(oe);const fe=oe==="sqlite"?null:z0(q);if(!fe){v(q);return}fe.password?(k(fe),v(U(ee,fe))):(k({...fe,password:w.password}),v(q))}function W(q){d(q.engine);const oe=q.engine==="sqlite"?null:z0(q.url);oe?(k(oe),v(U(q.engine,oe))):v(q.url),z(),p.trim()||g(TG(q));const ee=q.cwd?n.find(fe=>Of(q.cwd,fe.path)):void 0;ee&&j(ee.path)}function te(){return p.trim()?B?x.trim()?null:"Database file path is required.":w.host.trim()?w.database.trim()?null:"Database name is required.":"Host is required.":"Name is required."}async function X(){if(F){$(!0),z();try{const q=await eO({engine:f,url:G});M(q.ok?{status:"ok",message:"Connected"}:{status:"fail",message:q.error??"Connection failed"})}catch(q){M({status:"fail",message:q instanceof Error?q.message:String(q)})}finally{$(!1)}}}async function V(){const q=te();if(q){o(q);return}P(!0);try{await J8({name:p.trim(),engine:f,url:G,projectPath:A}),l(`Saved connection "${p.trim()}".`),t(),e()}catch(oe){o(oe instanceof Error?oe.message:String(oe))}finally{P(!1)}}return r.jsx(qn,{icon:r.jsx(di,{}),onClose:e,title:u?"Edit database connection":"Add database connection",children:r.jsxs("div",{className:"flex flex-col gap-4",children:[N.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(A6,{className:"size-3.5"}),"Found in your services"]}),r.jsx("div",{className:"flex flex-wrap gap-1.5",children:N.map(q=>r.jsxs("button",{type:"button",onClick:()=>W(q),className:"group flex items-center gap-1.5 rounded-md border border-border bg-background px-2 py-1 text-left text-xs transition-colors hover:border-primary hover:bg-muted",title:q.maskedUrl,children:[r.jsx(Ye,{variant:"outline",size:"small",children:q.engine}),r.jsx("span",{className:"font-mono",children:q.service}),r.jsxs("span",{className:"font-mono text-muted-foreground",children:["·",q.key]})]},`${q.service}:${q.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:EG.map(q=>r.jsx(J,{size:"sm",variant:f===q.value?"default":"outline",onClick:()=>K(q.value),disabled:u,type:"button",children:q.label},q.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(dt,{value:p,onChange:q=>g(q.target.value),placeholder:"e.g. shop-db",disabled:u}),u?r.jsx("span",{className:"text-[11px] text-muted-foreground",children:"The name identifies the connection and can't be changed here."}):null]}),n.length>0?r.jsxs("label",{className:"flex flex-col gap-1.5",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Project"}),r.jsxs("select",{className:"h-9 rounded-md border border-border bg-background px-2 text-sm",onChange:q=>j(q.target.value),value:A,children:[r.jsx("option",{value:"",children:"No project (shared)"}),A&&!n.some(q=>q.path===A)?r.jsx("option",{value:A,children:A}):null,n.map(q=>r.jsx("option",{value:q.path,children:q.name},q.path))]}),r.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Classifies the connection under a project; shared connections show in every project scope."})]}):null,B?null: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(dt,{value:w.host,onChange:q=>I({host:q.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(dt,{value:w.port,onChange:q=>I({port:q.target.value}),placeholder:f==="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(dt,{value:w.user,onChange:q=>I({user:q.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(dt,{type:"password",value:w.password,onChange:q=>I({password:q.target.value}),placeholder:u?"leave blank to keep current":"••••••••",className:"font-mono text-xs"})]})]}),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(dt,{value:w.database,onChange:q=>I({database:q.target.value}),placeholder:"app",className:"font-mono text-xs"})]}),f==="postgres"?r.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("input",{type:"checkbox",checked:w.ssl,onChange:q=>I({ssl:q.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:B?"Database file path":"Connection URL"}),r.jsx(dt,{value:x,onChange:q=>Z(q.target.value),placeholder:B?"/abs/path/to/app.db":f==="mysql"?"mysql://user:pass@host:3306/db":"postgres://user:pass@host:5432/db",className:"font-mono text-xs"}),r.jsx("span",{className:"text-[11px] text-muted-foreground",children:B?"Read-only. Stored like a secret and masked in the UI and API.":"Synced with the fields above; the password stays in its field and is never shown here. Stored like a secret and masked in the UI and API."})]}),T.status!=="idle"?r.jsxs("div",{className:`flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 text-xs ${T.status==="ok"?"border-emerald-500/40 text-emerald-600 dark:text-emerald-400":"border-destructive/40 text-destructive"}`,children:[T.status==="ok"?r.jsx(Zs,{className:"size-3.5"}):r.jsx(qt,{className:"size-3.5"}),r.jsx("span",{className:"break-all font-mono",children:T.message})]}):null,r.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-border pt-3",children:[r.jsxs(J,{variant:"outline",size:"sm",onClick:()=>{X()},disabled:O||!F,type:"button",children:[O?r.jsx(jt,{className:"animate-spin"}):null,"Test connection"]}),r.jsxs(J,{size:"sm",onClick:()=>{V()},disabled:D,type:"button",children:[D?r.jsx(jt,{className:"animate-spin"}):null,u?"Save changes":"Save"]})]})]})})}function AG(e){if(!e)return{engine:"postgres",name:"",fields:zg,url:""};if(e.engine==="sqlite")return{engine:"sqlite",name:e.name,fields:zg,url:e.url};const t=z0(e.url),s=t?{...t,password:""}:zg;return{engine:e.engine,name:e.name,fields:s,url:L0(e.engine,s,{includePassword:!1})}}function TG(e){try{const s=new URL(e.url).pathname.replace(/^\//,"");if(s)return`${e.service}-${s}`}catch{}return`${e.service}-${e.engine}`}function RG({connections:e,projectLabel:t,selected:s,onSelect:n,onAdd:o,onEdit:l,onRemove:u}){const[h,f]=_.useState(!1),d=_.useRef(null),p=e.find(g=>g.name===s);return _.useEffect(()=>{if(!h)return;function g(x){d.current&&x.target instanceof Node&&!d.current.contains(x.target)&&f(!1)}return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[h]),r.jsxs("div",{className:"relative z-50 flex items-center gap-2",ref:d,children:[r.jsxs(J,{className:"max-w-[240px] justify-start gap-2 rounded-md border-border bg-card",onClick:()=>f(g=>!g),size:"sm",type:"button",variant:"outline",children:[r.jsx(di,{className:"text-muted-foreground"}),r.jsx("span",{className:"truncate",children:p?.name??"Select connection"}),p?r.jsx(Ye,{variant:"outline",size:"small",children:p.engine}):null,r.jsx(Gn,{className:ue("ml-auto transition-transform",h&&"rotate-180")})]}),h?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(di,{className:"size-3.5 text-muted-foreground"}),r.jsx("div",{className:"text-xs font-semibold",children:"Connections"}),r.jsx(Ye,{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(g=>{const x=g.name===s;return r.jsxs("div",{className:ue("group grid w-full grid-cols-[1fr_auto_auto_auto] items-center gap-2 px-3 py-1.5 text-left transition-colors hover:bg-muted",x&&"bg-muted/70"),children:[r.jsxs("button",{className:"min-w-0 text-left",onClick:()=>{n(g.name),f(!1)},type:"button",children:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"truncate text-sm font-medium leading-tight",children:g.name}),t?r.jsx(Ye,{className:"shrink-0",size:"small",variant:"outline",children:t(g)??"unassigned"}):null]}),r.jsx("span",{className:"block truncate font-mono text-[10px] leading-tight text-muted-foreground",children:g.url})]}),x?r.jsx(Zs,{className:"size-3.5"}):r.jsx("span",{className:"size-3.5"}),r.jsx(J,{"aria-label":`Edit ${g.name}`,className:"size-6 opacity-0 transition-opacity group-hover:opacity-100",onClick:()=>{l(g),f(!1)},size:"icon",title:`Edit ${g.name}`,type:"button",variant:"ghost",children:r.jsx(ul,{className:"size-3.5"})}),r.jsx(J,{"aria-label":`Remove ${g.name}`,className:"size-6 opacity-0 transition-opacity group-hover:opacity-100",onClick:()=>u(g.name),size:"icon",title:`Remove ${g.name}`,type:"button",variant:"ghost",children:r.jsx(Ti,{className:"size-3.5 text-destructive"})})]},g.name)})}):r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"No saved connections yet."})}),r.jsx("div",{className:"border-t border-border bg-muted/20 p-2",children:r.jsxs(J,{className:"w-full",onClick:()=>{o(),f(!1)},size:"sm",type:"button",children:[r.jsx(ps,{className:"size-3"}),"Add connection"]})})]}):null]})}function MG({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(J,{"aria-label":"Add database connection",onClick:()=>n(u=>!u),size:"sm",type:"button",children:[r.jsx(ps,{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(di,{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(Yi,{className:"size-3.5 text-muted-foreground"}),"Add with AI"]})]}):null]})}function DG(){const[e,t]=_.useState([]),[s,n]=_.useState(!0),[o,l]=_.useState(null),u=_.useCallback(async()=>{n(!0),l(null);try{t(await _C())}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 Wj=[50,100,500,1e3];function OG(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 sO(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 LG=["select","show","explain","pragma","describe","desc"];function zG(e){const t=/^\s*([a-z]+)/i.exec(e)?.[1]?.toLowerCase()??"";return LG.includes(t)}function BG(e){const[t,s]=_.useState(null),[n,o]=_.useState(null),[l,u]=_.useState(null),[h,f]=_.useState(!1),[d,p]=_.useState(!1);_.useEffect(()=>{s(null),o(null),u(null)},[e]);const g=_.useCallback(async k=>{if(!(!e||!k.trim())){f(!0),u(null),o(null);try{const N=await pw(e,k,"preview");s({sql:k,preview:N})}catch(N){u(N instanceof Error?N.message:String(N))}finally{f(!1)}}},[e]),x=_.useCallback(async()=>{if(!e||!t)return null;p(!0),u(null);try{const k=await pw(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 PG(e,t){const[s,n]=_.useState(!1),o=_.useCallback(async l=>{if(e){n(!0);try{await nO(e,l),t()}finally{n(!1)}}},[e,t]);return{updating:s,setUnlocked:o}}function IG(e){const[t,s]=_.useState([]),[n,o]=_.useState(null),[l,u]=_.useState(null),[h,f]=_.useState(null),[d,p]=_.useState(null),[g,x]=_.useState(!1),[v,w]=_.useState(!1),[k,N]=_.useState(100),[C,A]=_.useState(0);_.useEffect(()=>{A(0)},[e,n]),_.useEffect(()=>{if(s([]),o(null),u(null),f(null),p(null),!e)return;let D=!1;return x(!0),yC(e).then(P=>{D||(s(P),o(P[0]?.qualifiedName??null))}).catch(P=>{D||f(P instanceof Error?P.message:String(P))}).finally(()=>{D||x(!1)}),()=>{D=!0}},[e]),_.useEffect(()=>{if(u(null),p(null),!e||!n)return;let D=!1;return w(!0),iO(e,n,k,C).then(P=>{D||u(P)}).catch(P=>{D||p(P instanceof Error?P.message:String(P))}).finally(()=>{D||w(!1)}),()=>{D=!0}},[e,n,k,C]);const j=C>0,T=l?l.rowCount===k:!1;function M(D){N(D),A(0)}function O(){T&&A(D=>D+k)}function $(){A(D=>Math.max(0,D-k))}return{tables:t,selectedTable:n,setSelectedTable:o,sample:l,tablesError:h,rowsError:d,loadingTables:g,loadingRows:v,limit:k,offset:C,canPrev:j,canNext:T,changePageSize:M,nextPage:O,prevPage:$}}function $G(e,t,s,n){const{provider:o}=At(),[l,u]=_.useState(!1),[h,f]=_.useState(null),d=_.useRef(null),p=_.useRef(!0);return _.useEffect(()=>(p.current=!0,()=>{p.current=!1,d.current?.abort()}),[]),{generate:_.useCallback(async x=>{if(!e||!x.trim()||l)return;u(!0),f(null);const v=new AbortController;d.current=v;try{let w=[];try{w=await yC(e)}catch{w=[]}if(!p.current||v.signal.aborted)return;const k=await $b({prompt:w$(e,x,{engine:t,tables:w,unlocked:s}),provider:o?.id,signal:v.signal});if(!p.current)return;const N=HG(k);N?n(N):f("The agent didn't return a SQL block.")}catch(w){p.current&&!v.signal.aborted&&f(w instanceof Error?w.message:String(w))}finally{d.current===v&&(d.current=null),p.current&&u(!1)}},[e,t,s,l,n,o?.id]),generating:l,error:h}}function HG(e){if(!e)return null;const s=/```(?:sql)?\s*\n?([\s\S]*?)```/i.exec(e)?.[1]?.trim();return s||null}function UG({connection:e,sample:t}){const{sendToAgent:s}=At(),{success:n,error:o}=as(),l=t.columns.map(p=>p.name);function u(p){s({prompt:y$(e,t.engine,t.table,t.columns,p),source:{type:"database-row",label:`${t.table} row`},mode:"draft"})}async function h(p,g){try{await navigator.clipboard.writeText(p),n(`Copied ${g}.`)}catch(x){o(x instanceof Error?x.message:String(x))}}function f(p){const g=x=>{const v=Kc(x);return/[",\n]/.test(v)?`"${v.replace(/"/g,'""')}"`:v};return`${l.join(",")}
|
|
110
|
+
${l.map(x=>g(p[x])).join(",")}`}function d(p){const g=v=>v==null?"NULL":typeof v=="number"||typeof v=="boolean"?String(v):`'${(typeof v=="object"?JSON.stringify(v):String(v)).replace(/'/g,"''")}'`,x=l.map(v=>g(p[v])).join(", ");return`INSERT INTO ${t.table} (${l.join(", ")}) VALUES (${x});`}return t.columns.length===0?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(iC,{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:Kc(p[x.name]),children:Kc(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(Zi,{label:"Ask AI about this row",onAsk:()=>u(p)}),r.jsx(mu,{label:"Row actions",items:[{label:"Copy as JSON",icon:r.jsx(T4,{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(di,{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 Kc(e){return e==null?"NULL":typeof e=="object"?JSON.stringify(e):String(e)}function FG({connection:e,busy:t,onConfirm:s,onClose:n}){return r.jsx(qn,{icon:r.jsx(c6,{className:"text-amber-500"}),onClose:n,title:`Unlock writes on "${e}"?`,children:r.jsxs("div",{className:"flex flex-col gap-4 text-sm",children:[r.jsxs("p",{className:"text-muted-foreground",children:["This lets the SQL console run statements that ",r.jsx("strong",{children:"change data"})," ","— ",r.jsx("span",{className:"font-mono",children:"INSERT"}),","," ",r.jsx("span",{className:"font-mono",children:"UPDATE"}),","," ",r.jsx("span",{className:"font-mono",children:"DELETE"}),", and DDL like"," ",r.jsx("span",{className:"font-mono",children:"DROP"}),". Writes still preview their affected rows before they commit, but an unlocked connection can modify or destroy real data."]}),r.jsx("p",{className:"text-muted-foreground",children:"The lock stays open for this connection until you re-lock it. It is never shared with the AI agent."}),r.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-border pt-3",children:[r.jsx(J,{variant:"outline",size:"sm",onClick:n,type:"button",children:"Cancel"}),r.jsxs(J,{size:"sm",onClick:s,disabled:t,type:"button",children:[t?r.jsx(jt,{className:"animate-spin"}):r.jsx(rC,{}),"Unlock writes"]})]})]})})}function qG({sql:e,preview:t,busy:s,onConfirm:n,onClose:o}){return r.jsx(qn,{icon:r.jsx(Er,{className:"text-amber-500"}),onClose:o,title:"Confirm write",children:r.jsxs("div",{className:"flex flex-col gap-4 text-sm",children:[r.jsx("pre",{className:"max-h-40 overflow-auto rounded-md border border-border bg-muted/40 px-3 py-2 font-mono text-[11px] whitespace-pre-wrap",children:e}),t.previewUnavailable?r.jsx("p",{className:"rounded-md border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-[13px] text-amber-700 dark:text-amber-300",children:"This statement can’t be previewed — DDL commits immediately on this engine and cannot be rolled back. Running it applies the change at once."}):r.jsxs("p",{className:"text-muted-foreground",children:["This will affect"," ",r.jsx("strong",{className:"text-foreground tabular-nums",children:t.affectedRows??0})," ","row",t.affectedRows===1?"":"s",". The preview ran in a transaction that was rolled back — nothing has changed yet."]}),r.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-border pt-3",children:[r.jsx(J,{variant:"outline",size:"sm",onClick:o,type:"button",children:"Cancel"}),r.jsxs(J,{size:"sm",className:"bg-amber-600 text-white hover:bg-amber-600/90",onClick:n,disabled:s,type:"button",children:[s?r.jsx(jt,{className:"animate-spin"}):null,"Run & commit"]})]})]})})}function VG({connection:e,engine:t,unlocked:s,seed:n,onWriteAccessChange:o}){const{success:l}=as(),{sendToAgent:u}=At(),h=OG(e),f=BG(e),d=PG(e,o),[p,g]=_.useState(n?.sql??""),[x,v]=_.useState(100),w=n?.nonce;_.useEffect(()=>{n&&g(n.sql)},[w]);const[k,N]=_.useState(!1),C=$G(e,t,s,g),A=p.trim().length>0&&!zG(p),j=s&&A,T=A&&!s,M=h.running||f.previewing;function O(){if(p.trim()){if(T){N(!0);return}j?(h.reset(),f.preview(p)):(f.reset(),h.run(p,x))}}function $(B){(B.metaKey||B.ctrlKey)&&B.key==="Enter"&&(B.preventDefault(),O())}function D(B){u({prompt:S$(e,t,p,B),source:{type:"database-sql-debug",label:"Debug SQL"},label:"Debug this SQL error"})}async function P(){const B=await f.commit();if(B?.committed){const G=B.affectedRows??0;l(`Committed — ${G} row${G===1?"":"s"} affected.`)}}return 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(GG,{generate:C}),r.jsx("textarea",{value:p,onChange:B=>g(B.target.value),onKeyDown:$,spellCheck:!1,placeholder:s?"SELECT … / INSERT … / UPDATE … (Cmd/Ctrl+Enter to run)":"SELECT * FROM … (read-only — Cmd/Ctrl+Enter to run)",className:"h-24 w-full resize-y rounded-md border border-border bg-background px-2 py-1.5 font-mono text-[12px] outline-none focus:border-ring"}),r.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[r.jsx(WG,{unlocked:s,updating:d.updating,onUnlock:()=>N(!0),onLock:()=>{d.setUnlocked(!1)}}),r.jsxs("div",{className:"flex items-center gap-2",children:[j?null:r.jsx("select",{"aria-label":"Max rows",className:"rounded-md border border-border bg-background px-1.5 py-1 text-[11px]",value:x,onChange:B=>v(Number(B.target.value)),children:Wj.map(B=>r.jsxs("option",{value:B,children:[B," rows"]},B))}),r.jsxs(J,{size:"sm",className:ue("h-7 px-3",j&&"bg-amber-600 text-white hover:bg-amber-600/90"),onClick:O,disabled:M||!p.trim(),type:"button",children:[M?r.jsx(jt,{className:"size-3.5 animate-spin"}):r.jsx(jr,{className:"size-3.5"}),j?"Preview write":"Run"]})]})]})]}),r.jsx(KG,{read:h,write:f,onDebug:D}),k?r.jsx(FG,{connection:e,busy:d.updating,onConfirm:async()=>{await d.setUnlocked(!0),N(!1)},onClose:()=>N(!1)}):null,f.pending?r.jsx(qG,{sql:f.pending.sql,preview:f.pending.preview,busy:f.committing,onConfirm:()=>{P()},onClose:f.cancel}):null]})}function GG({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(Ft,{className:"pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2"}),r.jsx("input",{value:t,onChange:l=>s(l.target.value),onKeyDown:o,disabled:e.generating,placeholder:"Describe the query in plain English — AI writes the SQL below",className:"h-8 w-full rounded-md border border-border bg-background pl-7 pr-2 text-[12px] outline-none focus:border-ring disabled:opacity-60"})]}),r.jsxs(J,{size:"sm",variant:"outline",className:"h-8 px-3",onClick:n,disabled:e.generating||!t.trim(),type:"button",children:[e.generating?r.jsx(jt,{className:"size-3.5 animate-spin"}):r.jsx(Ft,{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 WG({unlocked:e,updating:t,onUnlock:s,onLock:n}){return r.jsxs("button",{type:"button",onClick:e?n:s,disabled:t,className:ue("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(jt,{className:"size-3.5 animate-spin"}):e?r.jsx(rC,{className:"size-3.5"}):r.jsx(uM,{className:"size-3.5"}),e?"Writes unlocked":"Read-only"]})}function KG({read:e,write:t,onDebug:s}){const n=t.error??e.error;return r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:n?r.jsxs("div",{className:"space-y-3 p-4",children:[r.jsx("p",{className:"whitespace-pre-wrap font-mono text-[12px] text-destructive",children:n}),r.jsxs(J,{size:"sm",variant:"outline",className:"h-7 px-3",onClick:()=>s(n),type:"button",children:[r.jsx(Ft,{className:"size-3.5"}),"Debug with AI"]})]}):t.committed?r.jsx(YG,{outcome:t.committed}):e.result?r.jsx(Kj,{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 YG({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(Zs,{className:"size-3.5"}),"Committed — ",t," row",t===1?"":"s"," affected."]}),e.rows&&e.rows.length>0&&e.columns?r.jsx(Kj,{columns:e.columns,rows:e.rows}):null]})}function Kj({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(Er,{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:Kc(n[l.name]),children:Kc(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 XG({staged:e,onStageConsumed:t,projects:s=[],scopePath:n=null}={}){const{connections:o,loading:l,error:u,refresh:h}=DG(),f=_.useMemo(()=>o.filter(D=>SG(D.projectPath,n)),[o,n]),d=D=>D.projectPath?s.find(B=>Of(D.projectPath,B.path))?.name??D.projectPath.split("/").pop()??null:null;vl(h);const{error:p,success:g}=as(),{sendToAgent:x}=At(),[v,w]=al("database:selected",null),[k,N]=al("database:mode","browse"),[C,A]=_.useState(null),[j,T]=_.useState(null);_.useEffect(()=>{e&&(e.connection&&w(e.connection),N("query"),T({sql:e.sql,nonce:e.nonce}),t?.())},[e?.nonce]);function M(){x({prompt:b$,source:{type:"database-setup",label:"Add a database"},label:"Help me connect a database, one step at a time."})}_.useEffect(()=>{if(f.length===0){v!==null&&w(null);return}(!v||!f.some(D=>D.name===v))&&w(f[0].name)},[f,v,w]);async function O(D){try{await tO(D),g(`Removed connection "${D}".`),await h()}catch(P){p(P instanceof Error?P.message:String(P))}}function $(D){A({mode:"edit",target:D})}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(di,{className:"size-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm font-semibold",children:"Databases"}),l&&f.length===0?r.jsx(jt,{className:"size-3.5 animate-spin text-muted-foreground"}):null]}),r.jsxs("div",{className:"flex items-center gap-2",children:[v?r.jsx(ZG,{mode:k,onChange:N}):null,r.jsx(RG,{connections:f,projectLabel:d,selected:v,onSelect:w,onAdd:()=>A({mode:"add"}),onEdit:$,onRemove:D=>{O(D)}}),r.jsx(MG,{onAddManual:()=>A({mode:"add"}),onAddWithAi:M})]})]}),r.jsx("div",{className:"min-h-0 flex-1",children:u?r.jsx("div",{className:"p-4",children:r.jsx(Qe,{variant:"muted",className:"border-destructive/40 text-destructive",children:u})}):v?k==="query"?r.jsx(VG,{connection:v,engine:f.find(D=>D.name===v)?.engine,unlocked:f.find(D=>D.name===v)?.writeUnlocked??!1,seed:j,onWriteAccessChange:h},v):r.jsx(QG,{connection:v}):r.jsx(JG,{onAdd:()=>A({mode:"add"}),onAddWithAi:M})}),C?r.jsx(jG,{initial:C.mode==="edit"?C.target:void 0,projects:s,onClose:()=>A(null),onSaved:h}):null]})}function ZG({mode:e,onChange:t}){const s=[{value:"browse",label:"Browse",icon:hC},{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:ue("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 QG({connection:e}){const{sendToAgent:t}=At(),{tables:s,selectedTable:n,setSelectedTable:o,sample:l,tablesError:u,rowsError:h,loadingTables:f,loadingRows:d,limit:p,offset:g,canPrev:x,canNext:v,changePageSize:w,nextPage:k,prevPage:N}=IG(e);function C(j){t({prompt:e2(e,j.table,{engine:j.engine,columns:j.columns}),source:{type:"database-table",label:`${j.table.name} table`},mode:"draft"})}function A(j){t({prompt:e2(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(hC,{className:"size-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm font-semibold",children:"Tables"}),r.jsx(Ye,{variant:"outline",size:"small",children:s.length}),f?r.jsx(jt,{className:"size-3.5 animate-spin"}):null]}),u?r.jsx("div",{className:"p-3",children:r.jsx(Qe,{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:ue("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:ue("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(Zi,{label:`Ask AI about \`${j.qualifiedName}\``,onAsk:()=>A(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(Zi,{label:`Ask AI about \`${l.table.qualifiedName}\``,onAsk:()=>C(l)}):null]}),l?r.jsxs("div",{className:"flex shrink-0 items-center gap-2 text-[11px] text-muted-foreground",children:[r.jsx("span",{className:"tabular-nums",children:l.rowCount===0?"no rows":`rows ${g+1}–${g+l.rowCount}`}),r.jsx("select",{"aria-label":"Rows per page",className:"rounded-md border border-border bg-background px-1.5 py-0.5 text-[11px]",value:p,onChange:j=>w(Number(j.target.value)),children:Wj.map(j=>r.jsxs("option",{value:j,children:[j," / page"]},j))}),r.jsx(J,{size:"sm",variant:"outline",className:"h-6 px-2",onClick:N,disabled:!x,type:"button",children:"Prev"}),r.jsx(J,{size:"sm",variant:"outline",className:"h-6 px-2",onClick:k,disabled:!v,type:"button",children:"Next"})]}):null]}),h?r.jsx("div",{className:"p-4",children:r.jsx(Qe,{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(jt,{className:"mr-2 size-4 animate-spin"}),"Loading rows…"]}):l?r.jsx(UG,{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 JG({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(di,{className:"mx-auto size-8 text-muted-foreground/50"}),r.jsx("p",{className:"mt-3 text-sm font-medium",children:"No connections yet"}),r.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Add a read-only Postgres, MySQL, or SQLite connection to browse tables and sample rows. NoMoreIDE can auto-detect connection strings from your services' ",r.jsx("code",{children:".env"})," files."]}),r.jsxs("div",{className:"mt-4 flex items-center justify-center gap-2",children:[r.jsxs(J,{size:"sm",onClick:e,type:"button",children:[r.jsx(ps,{}),"Add connection"]}),r.jsxs(J,{size:"sm",variant:"outline",onClick:t,type:"button",children:[r.jsx(Yi,{}),"Add with AI"]})]})]})})}function eW({incident:e,onReviewChanges:t}){const{error:s}=as(),{sendToAgent:n}=At(),[o,l]=_.useState(!1),[u,h]=_.useState(null);async function f(){l(!0);try{const{prompt:d,sessionId:p}=await oO(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(Ye,{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(Ye,{variant:"outline",size:"small",children:["×",e.count]}):null]}),r.jsxs(J,{onClick:()=>{f()},disabled:o,size:"sm",variant:"outline",children:[r.jsx(Ft,{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(JN,{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(Qe,{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(J,{onClick:()=>t(u),size:"sm",variant:"outline",children:[r.jsx(QN,{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(`
|
|
111
|
+
`)}),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 pk(e){return[...e].sort((t,s)=>t.lastSeen<s.lastSeen?1:t.lastSeen>s.lastSeen?-1:s.id-t.id)}function tW(){const[e,t]=_.useState([]),[s,n]=_.useState(!1),[o,l]=_.useState(null),u=_.useCallback(h=>{t(f=>pk([...f.filter(d=>d.id!==h.id),h]))},[]);return _.useEffect(()=>{let h=!0;SC().then(d=>{h&&t(pk(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 sW({inScope:e,onReviewChanges:t}={}){const{incidents:s,connected:n,error:o}=tW(),l=_.useMemo(()=>e?s.filter(d=>e(d.service)):s,[s,e]),[u,h]=_.useState(null);_.useEffect(()=>{if(l.length===0){h(null);return}h(d=>d!==null&&l.some(p=>p.id===d)?d:l[0].id)},[l]);const f=_.useMemo(()=>l.find(d=>d.id===u)??null,[l,u]);return 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(Zc,{className:"size-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm font-semibold",children:"Incidents"}),r.jsx(Ye,{variant:"outline",size:"small",children:l.length})]}),r.jsx(Ye,{variant:"outline",size:"small",icon:r.jsx("span",{className:ue("inline-block size-1.5 rounded-full",n?"animate-pulse bg-emerald-500":"bg-muted-foreground/60")}),children:n?"live":"reconnecting…"})]}),r.jsx("ul",{className:"min-h-0 flex-1 divide-y divide-border overflow-auto",children:l.map(d=>r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>h(d.id),className:ue("flex w-full flex-col gap-1 px-3 py-2 text-left transition-colors hover:bg-muted/50",d.id===u&&"bg-muted/70"),children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"truncate font-mono text-[11px] font-semibold",children:d.service}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[d.count>1?r.jsxs(Ye,{variant:"outline",size:"small",children:["×",d.count]}):null,r.jsx(Ye,{variant:d.level==="error"?"danger":"secondary",appearance:"subtle",size:"small",children:d.level})]})]}),r.jsx("span",{className:"truncate font-mono text-[11px] text-muted-foreground",children:d.title}),r.jsx("span",{className:"font-mono text-[10px] text-muted-foreground/70",children:new Date(d.lastSeen).toLocaleTimeString()})]})},d.id))})]}),r.jsx("div",{className:"min-h-0 min-w-0 flex-1",children:o?r.jsx("div",{className:"p-4",children:r.jsxs(Qe,{variant:"muted",className:"border-destructive/40 text-destructive",children:["Failed to load incidents: ",o]})}):f?r.jsx(eW,{incident:f,onReviewChanges:t}):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(Zc,{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 ef({label:e}){return r.jsx(Qe,{variant:"muted",className:"m-4 text-center",children:e})}const nW=900*1e3,Pc=12,Bg=200;function iW({events:e}){const[t,s]=_.useState(null),[n,o]=_.useState(null),{rows:l,windowStart:u,windowEnd:h}=_.useMemo(()=>rW(e),[e]),f=t?l.find(d=>d.service===t)??null:null;return r.jsxs(r.Fragment,{children:[r.jsxs(hi,{className:"rounded-none border-0 border-b border-border bg-transparent",children:[r.jsxs(fi,{className:"border-b border-border px-3 py-2",children:[r.jsxs(mi,{className:"flex items-center gap-2",children:[r.jsx(Qa,{className:"size-3.5"}),"Runtime Monitor"]}),r.jsx(Ji,{className:"text-xs",children:e.length===0?"No events yet":`${e.length} event${e.length===1?"":"s"} · last 15 min`})]}),r.jsx(pi,{className:"p-0",children:l.length===0?r.jsx(ef,{label:"No runtime timeline events yet."}):r.jsxs("div",{className:"divide-y divide-border",children:[l.map(d=>r.jsx(oW,{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:tf(u)}),r.jsx("span",{children:"now"})]})]})})]}),f?r.jsx(qn,{icon:r.jsx(Qa,{}),onClose:()=>s(null),title:f.service,children:r.jsx(cW,{onSelect:o,row:f})}):null,n?r.jsx(qn,{icon:r.jsx(Qa,{}),onClose:()=>o(null),title:n.title,children:r.jsx(uW,{event:n})}):null]})}function rW(e){const t=Date.now(),s=t,n=t-nW;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(-Bg):o.length>Bg&&(o=o.slice(-Bg));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((A,j)=>A.timestamp.localeCompare(j.timestamp)),g=new Array(Pc).fill(0),x=new Array(Pc).fill(null);for(const A of p){const j=new Date(A.timestamp).getTime(),T=Math.max(n,Math.min(s,j)),M=Math.min(Pc-1,Math.floor((T-n)/u*Pc));g[M]+=1;const O=x[M];x[M]=aW(O,A.severity)}const v=p.filter(A=>A.severity==="error").length,w=p.filter(A=>A.severity==="warning").length,k=p.length-v-w,N=[...p].reverse().find(A=>A.severity!=="info")??null,C=v>0?"error":w>0?"warning":"info";return{service:f,events:p,errors:v,warnings:w,infos:k,buckets:g,bucketSeverity:x,lastNotable:N,worstSeverity:C}}).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 aW(e,t){return e==="error"||t==="error"?"error":e==="warning"||t==="warning"?"warning":"info"}function oW({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:ue("size-2 shrink-0 rounded-full",Yj(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(Wn,{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(${Pc}, minmax(0, 1fr))`},children:t.buckets.map((l,u)=>r.jsx(lW,{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:tf(n)}),r.jsx("span",{children:tf(s)})]})]})}function lW({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:ue("rounded-sm",dW(s)),style:{opacity:n},title:`${e} event${e===1?"":"s"}`})}function cW({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:ue("size-2 shrink-0 rounded-full",Yj(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:tf(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 uW({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:ue("rounded px-1.5 py-0.5 font-mono text-[10px] uppercase text-white",hW(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 Yj(e){return e==="error"?"bg-red-500":e==="warning"?"bg-amber-500":"bg-zinc-400"}function dW(e){return e==="error"?"bg-red-500":e==="warning"?"bg-amber-500":"bg-zinc-500"}function hW(e){return e==="error"?"bg-red-600":e==="warning"?"bg-amber-600":"bg-zinc-700"}function tf(e){const t=typeof e=="number"?new Date(e):new Date(e);return Number.isNaN(t.getTime())?"--:--:--":t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}const B0=150,ol=40,gk=200,xk=64,ah=20;function fW({statuses:e,health:t,hasDependencies:s,onSelectService:n}){const[o,l]=_.useState(null),[u,h]=_.useState(null);_.useEffect(()=>{let p=!0;return sL().then(g=>{p&&l(g)}).catch(g=>{p&&h(g instanceof Error?g.message:String(g))}),()=>{p=!1}},[]);const f=_.useMemo(()=>o?mW(o.nodes):null,[o]);if(u)return r.jsxs(Qe,{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(jt,{className:"size-4 animate-spin"}),"Loading graph…"]});if(!s)return r.jsx("div",{className:"grid gap-3",children:r.jsxs(Qe,{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(Qe,{variant:"destructive",children:[r.jsxs("div",{className:"flex items-center gap-1.5 font-medium",children:[r.jsx(Er,{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(Qe,{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=pW(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:ue("stroke-2",x.fill,x.stroke),height:ol,rx:6,width:B0}),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:gW(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 mW(e){const t=new Map(e.map(g=>[g.name,g.dependsOn])),s=new Map,n=new Set,o=g=>{const x=s.get(g);if(x!==void 0)return x;if(n.has(g))return 0;n.add(g);const v=t.get(g)??[],w=v.length===0?0:Math.max(...v.map(k=>o(k)+1));return n.delete(g),s.set(g,w),w};for(const g of e)o(g.name);const l=new Map,u=e.map(g=>{const x=s.get(g.name)??0,v=l.get(x)??0;return l.set(x,v+1),{...g,x:ah+x*gk,y:ah+v*xk}}),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+B0,k=v.y+ol/2,N=g.x,C=g.y+ol/2,A=(w+N)/2;return[{from:x,to:g.name,path:`M ${w} ${k} C ${A} ${k}, ${A} ${C}, ${N} ${C}`}]})),d=Math.max(0,...u.map(g=>s.get(g.name)??0)),p=Math.max(1,...l.values());return{nodes:u,edges:f,width:ah*2+d*gk+B0,height:ah*2+(p-1)*xk+ol}}function pW(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 gW(e,t=18){return e.length>t?`${e.slice(0,t-1)}…`:e}function xW({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(bk,{icon:r.jsx(Vn,{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(bk,{icon:r.jsx(ps,{className:"size-5"}),title:"Create a service",description:"Define the command, working directory and port yourself.",onClick:s,onAi:n,aiTitle:"Set up with AI — the agent walks you through it, one step at a time"})]})]})})}function bk({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(Ft,{className:"size-4 shrink-0"}),"AI"]})]})}function bW({health:e}){if(!e)return null;const t=e.processTree,s=e.status==="healthy"||e.status==="unknown"?void 0:wW(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:ue("inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md px-2.5 font-medium",vW(e.status)),children:[r.jsx("span",{className:"inline-flex shrink-0",children:r.jsx(Qa,{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(nR,{className:"size-3"}),t.processCount," ",t.processCount===1?"process":"processes"]}),r.jsxs("span",{children:[yW(t.cpuPercent)," CPU"]}),r.jsxs("span",{className:"inline-flex items-center gap-1 font-mono",children:[r.jsx(xM,{className:"size-3"}),_W(t.rssMb)," RAM"]})]}):null]})}function vW(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 _W(e){return Number.isInteger(e)?`${e} MB`:`${e.toFixed(1)} MB`}function yW(e){return`${e.toFixed(1)}%`}function wW(e){return e.replace(/^Recent error log:\s*/i,"Recent stderr: ").replace(/:\s*\d+(?:\.\d+)? MB RSS\.?$/i,"").replace(/\s+RSS\.?$/i,"")}function SW({ports:e}){const t=e.filter(n=>n.state==="occupied").length,s=e.filter(n=>n.state==="managed").length;return r.jsxs(hi,{className:"rounded-none border-0 border-b border-border bg-transparent",children:[r.jsxs(fi,{className:"border-b border-border px-3 py-2",children:[r.jsxs(mi,{className:"flex items-center gap-2",children:[r.jsx(EM,{className:"size-3.5"}),"Ports"]}),r.jsxs(Ji,{className:"text-xs",children:[s," managed, ",t," occupied by other"]})]}),r.jsx(pi,{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(kW,{port:n})]},n.port))}):r.jsx(ef,{label:"No configured ports yet."})})]})}function kW({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(Ye,{className:ue(e&&"max-w-36 truncate"),variant:n,children:s})}function NW({onChange:e,value:t}){return r.jsxs("label",{className:"relative block",children:[r.jsx(s6,{className:"pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground"}),r.jsx(dt,{"aria-label":"Search logs",className:"h-8 w-44 pl-7 text-xs",onChange:s=>e(s.target.value),placeholder:"Search logs",value:t})]})}function CW({className:e,containerRef:t,emptyText:s,logs:n,query:o}){return r.jsx("div",{className:ue("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:ue("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:EW(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,AW(l.text,o)]})]},`${l.timestamp}-${l.stream}-${u}`)):r.jsx("div",{className:"p-3 text-muted-foreground",children:s})})}function EW(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 jW(e){return`${e.timestamp} ${e.stream} ${e.text}`}function AW(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 vk(e){return`${e.kind}:${e.name}`}function TW(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 RC(e.name,s);p||(o(v.logs),f(v.queryable),u(void 0))}else{const v=await jC(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 RW=[{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 Xj({target:e,query:t,setQuery:s,streaming:n,setStreaming:o,hideStdout:l,setHideStdout:u,fill:h=!1,leading:f,trailing:d}){const p=e.kind==="source",[g,x]=_.useState(""),[v,w]=_.useState(""),[k,N]=_.useState(t);_.useEffect(()=>{const te=window.setTimeout(()=>N(t),300);return()=>window.clearTimeout(te)},[t]);const C=_.useMemo(()=>{const te={};g&&(te.since=g),v&&(te.level=v);const X=k.trim();return X&&(te.grep=X),te},[g,v,k]),{logs:A,error:j,queryable:T}=TW(e,n,C),M=p||T,O=_.useRef(null),$=_.useRef(!0),[D,P]=_.useState([]),[B,G]=_.useState(!1),F=JSON.stringify(C);_.useEffect(()=>{P([])},[F,e.kind,e.name]);const z=_.useMemo(()=>{const te=A??[];if(D.length===0)return te;const X=new Set(D.map(V=>V.cursor).filter(Boolean));return[...D,...te.filter(V=>!V.cursor||!X.has(V.cursor))]},[A,D]),U=(D[0]??(A??[])[0])?.cursor;async function K(){if(!(!M||!U||B)){G(!0),$.current=!1;try{const te={...C,before:U,lines:200},X=e.kind==="source"?await jC(e.name,te):(await RC(e.name,te)).logs;X.length&&P(V=>{const q=new Set(V.map(ee=>ee.cursor).filter(Boolean));return[...X.filter(ee=>!ee.cursor||!q.has(ee.cursor)),...V]})}finally{G(!1)}}}const I=t.trim().toLowerCase(),Z=_.useMemo(()=>{let te=z;return l&&(te=te.filter(X=>X.stream==="stderr")),I&&(te=te.filter(X=>jW(X).toLowerCase().includes(I))),te},[z,l,I]);_.useEffect(()=>{const te=O.current;if(!te)return;const X=()=>{const V=te.scrollHeight-te.scrollTop-te.clientHeight;$.current=V<40};return X(),te.addEventListener("scroll",X,{passive:!0}),()=>te.removeEventListener("scroll",X)},[]),_.useEffect(()=>{if(!n||!$.current||Z.length===0)return;const te=O.current;te&&(te.scrollTop=te.scrollHeight)},[n,Z]);const W=A?I?`No log lines match "${t.trim()}".`:l?"No stderr output captured.":"No log entries.":"Loading…";return r.jsxs("div",{className:h?"flex h-full min-h-0 flex-col gap-2":"flex flex-col gap-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f,r.jsx(NW,{onChange:s,value:t}),M?r.jsxs(r.Fragment,{children:[r.jsx("select",{"aria-label":"Time range",className:"h-8 rounded-md border border-border bg-background px-2 text-xs",onChange:te=>x(te.target.value),value:g,children:RW.map(te=>r.jsx("option",{value:te.value,children:te.label},te.label))}),r.jsxs("select",{"aria-label":"Level",className:"h-8 rounded-md border border-border bg-background px-2 text-xs",onChange:te=>w(te.target.value),value:v,children:[r.jsx("option",{value:"",children:"All levels"}),r.jsx("option",{value:"warn",children:"Warnings+"}),r.jsx("option",{value:"error",children:"Errors"})]})]}):r.jsxs(_k,{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(_k,{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(KM,{}),n?"Streaming":"Stream"]}),M&&U?r.jsxs(J,{disabled:B,onClick:()=>{K()},size:"sm",type:"button",variant:"outline",children:[r.jsx(hf,{}),B?"Loading…":"Load older"]}):null,d?r.jsx("div",{className:"ml-auto flex items-center gap-2",children:d}):null]}),j?r.jsx("div",{className:"text-red-600",children:j}):null,r.jsx(CW,{className:ue("rounded border border-border/60",h?"min-h-0 flex-1":"max-h-80"),containerRef:O,emptyText:W,logs:Z,query:t})]})}function _k({active:e,activeClassName:t,children:s,onClick:n}){return r.jsx(J,{"aria-pressed":e,className:e?t:void 0,onClick:n,size:"sm",type:"button",variant:"outline",children:s})}function MW(e,t){return e.kind===t.kind&&e.name===t.name}function DW({options:e,target:t,onChange:s,className:n}){const o=e.findIndex(u=>MW(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 OW({serviceName:e}){const[t,s]=_.useState(""),[n,o]=_.useState(!1),[l,u]=_.useState(!1),[h,f]=_.useState(!1),d=r.jsx(Xj,{fill:!0,hideStdout:l,query:t,setHideStdout:u,setQuery:s,setStreaming:o,streaming:n,target:{kind:"service",name:e},trailing:r.jsx(J,{"aria-label":h?"Exit fullscreen logs":"Expand logs",className:"text-muted-foreground hover:text-foreground",onClick:()=>f(p=>!p),size:"icon-sm",title:h?"Exit fullscreen":"Expand",type:"button",variant:"ghost",children:h?r.jsx(sb,{}):r.jsx(tb,{})})});return h?r.jsx(Jb,{onClose:()=>f(!1),title:`Logs — ${e}`,children:d}):r.jsx("div",{className:"h-[60vh] min-h-[24rem]",children:d})}function Jb({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]),Rr.createPortal(r.jsx("div",{className:"fixed inset-0 z-[1000] bg-black/40 p-4 sm:p-8",onMouseDown:t,children:r.jsxs("div",{"aria-modal":"true",className:`mx-auto flex h-full ${n} flex-col overflow-hidden rounded-lg border border-border bg-card text-xs shadow-xl`,onMouseDown:o=>o.stopPropagation(),role:"dialog",children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-2",children:[r.jsx("h2",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:e}),r.jsx(J,{"aria-label":"Close logs",onClick:t,size:"icon",type:"button",variant:"ghost",children:r.jsx(qt,{})})]}),r.jsx("div",{className:"min-h-0 flex-1 p-3",children:s})]})}),document.body)}const LW={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 zW({onClose:e,onAdded:t}){const[s,n]=_.useState(""),[o,l]=_.useState("journald"),[u,h]=_.useState(""),[f,d]=_.useState(""),[p,g]=_.useState(""),[x,v]=_.useState(""),[w,k]=_.useState(""),[N,C]=_.useState(""),[A,j]=_.useState(),[T,M]=_.useState(!1);async function O(){M(!0),j(void 0);try{const $={name:s.trim(),kind:"command"};o==="file"?($.kind="file",$.path=f.trim()):o==="ssh"?($.kind="ssh",$.host=u.trim(),$.path=f.trim()):o==="command"?($.kind="command",$.command=p.trim(),x.trim()&&($.cwd=x.trim())):o==="journald"?($.driver="journald",$.unit=w.trim(),u.trim()&&($.host=u.trim())):o==="docker"&&($.driver="docker",$.container=N.trim(),u.trim()&&($.host=u.trim()));const D=await GO($);t(D,$.name),e()}catch($){j($ instanceof Error?$.message:String($))}finally{M(!1)}}return r.jsx(qn,{icon:r.jsx(cC,{}),onClose:e,size:"md",title:"Add log source",children:r.jsxs("form",{className:"flex flex-col gap-3 p-4 text-xs",onSubmit:$=>{$.preventDefault(),O()},children:[r.jsx(wr,{label:"Name",children:r.jsx(dt,{autoFocus:!0,onChange:$=>n($.target.value),placeholder:"PROD",value:s})}),r.jsxs(wr,{label:"Type",children:[r.jsxs("select",{className:"h-9 w-full rounded-md border border-border bg-background px-2 text-xs",onChange:$=>l($.target.value),value:o,children:[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:LW[o]})]}),o==="journald"||o==="docker"?r.jsx(wr,{label:"Host (optional — leave blank to run locally)",children:r.jsx(dt,{onChange:$=>h($.target.value),placeholder:"jobjourney-prod (an alias from ~/.ssh/config)",value:u})}):null,o==="journald"?r.jsx(wr,{label:"Unit",children:r.jsx(dt,{onChange:$=>k($.target.value),placeholder:"jobjourney",value:w})}):null,o==="docker"?r.jsx(wr,{label:"Container",children:r.jsx(dt,{onChange:$=>C($.target.value),placeholder:"brainctl-api",value:N})}):null,o==="ssh"?r.jsx(wr,{label:"Host",children:r.jsx(dt,{onChange:$=>h($.target.value),placeholder:"prod (an alias from ~/.ssh/config)",value:u})}):null,o==="file"||o==="ssh"?r.jsx(wr,{label:o==="ssh"?"Remote path":"File path",children:r.jsx(dt,{onChange:$=>d($.target.value),placeholder:"/var/log/app/out.log",value:f})}):null,o==="command"?r.jsxs(r.Fragment,{children:[r.jsx(wr,{label:"Command",children:r.jsx(dt,{onChange:$=>g($.target.value),placeholder:"kubectl logs -l app=myapp --tail 500",value:p})}),r.jsx(wr,{label:"Working directory (optional)",children:r.jsx(dt,{onChange:$=>v($.target.value),placeholder:"/srv/app",value:x})})]}):null,A?r.jsx("div",{className:"text-red-600",children:A}):null,r.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[r.jsx(J,{onClick:e,size:"sm",type:"button",variant:"outline",children:"Cancel"}),r.jsx(J,{disabled:T||!s.trim(),size:"sm",type:"submit",children:T?"Saving…":"Add source"})]})]})})}function wr({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 yk=4;function BW({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 VO().then(T=>{j||o(T)}),()=>{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>=yk||v.length===0)return;const j=g.current++,T=new Set(Object.values(d).map(vk)),M=v.find(O=>!T.has(vk(O)))??v[0];f(O=>[...O,j]),p(O=>({...O,[j]:M}))}function k(j){f(T=>T.filter(M=>M!==j)),p(T=>{const M={...T};return delete M[j],M})}function N(j,T){p(M=>({...M,[j]:T}))}function C(j,T){o(j);const M=h[0];M!==void 0&&N(M,{kind:"source",name:T})}const A=r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{children:"Logs"}),r.jsxs(J,{onClick:()=>u(!0),size:"sm",type:"button",variant:"outline",children:[r.jsx(ps,{}),"Add source"]}),r.jsxs(J,{disabled:h.length>=yk||v.length===0,onClick:w,size:"sm",type:"button",variant:"outline",children:[r.jsx(ps,{}),"Add pane"]})]});return r.jsxs(r.Fragment,{children:[r.jsx(Jb,{maxWidthClass:"max-w-[1500px]",onClose:s,title:A,children:v.length===0?r.jsx("div",{className:"grid h-full place-items-center text-center text-muted-foreground",children:r.jsxs("div",{children:[r.jsx("p",{children:"No services or log sources yet."}),r.jsxs(J,{className:"mt-2",onClick:()=>u(!0),size:"sm",type:"button",children:[r.jsx(ps,{}),"Add a log source"]})]})}):r.jsx("div",{className:ue("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(PW,{onChangeTarget:T=>N(j,T),onRemove:h.length>1?()=>k(j):void 0,options:x,target:d[j]??v[0]},j))})}),l?r.jsx(zW,{onAdded:C,onClose:()=>u(!1)}):null]})}function PW({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(Xj,{fill:!0,hideStdout:f,leading:r.jsx(DW,{onChange:s,options:e,target:t}),query:o,setHideStdout:d,setQuery:l,setStreaming:h,streaming:u,target:t,trailing:n?r.jsx(J,{"aria-label":"Remove pane",onClick:n,size:"icon",type:"button",variant:"ghost",children:r.jsx(qt,{})}):void 0})})}function IW({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(Er,{className:"size-4 shrink-0"}),r.jsxs("span",{children:["Running with a stale configuration — ",o," after this service started. Reload to apply."]})]}),r.jsxs(J,{disabled:t,onClick:s,size:"sm",type:"button",variant:"outline",children:[r.jsx(QM,{})," ",t?"Reloading…":"Reload service"]})]})}function $W({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(XN,{size:14}):r.jsx(Z0,{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(Ti,{size:14})})})]},u)})})]})})}function HW({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 aL(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(qn,{icon:r.jsx(mf,{}),onClose:t,size:"lg",title:"Pick a config file",children:r.jsxs("div",{className:"flex flex-col gap-2 p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[r.jsxs(J,{disabled:!n||n.isRoot,onClick:x,size:"sm",type:"button",variant:"outline",children:[r.jsx(hf,{})," Up"]}),r.jsx("code",{className:"truncate rounded bg-muted px-2 py-1 font-mono",children:n?.relativePath||"./"})]}),l?r.jsx("div",{className:"text-red-600",children:l}):h?r.jsx("div",{className:"text-muted-foreground",children:"Loading…"}):!n||n.entries.length===0?r.jsx("div",{className:"text-muted-foreground",children:"Empty directory."}):r.jsx("div",{className:"max-h-[50vh] overflow-auto rounded border border-border/60",children:r.jsx("ul",{className:"divide-y divide-border/40",children:n.entries.map(v=>{const w=v.kind==="directory",k=w||v.supported;return r.jsx("li",{children:r.jsxs("button",{className:ue("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(lo,{size:14}):r.jsx(eC,{size:14}),r.jsx("span",{className:"flex-1 truncate font-mono",children:v.name}),!w&&v.format?r.jsx(Ye,{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 UW(e){const{error:t,success:s}=as(),[n,o]=_.useState(),[l,u]=_.useState(!1),h=_.useCallback(async()=>{try{o(await uL(e))}catch{o(void 0)}},[e]);_.useEffect(()=>{h()},[h]);const f=_.useCallback(async()=>{u(!0);try{await TC(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 Zj(e){if(!e.trim())return e;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function FW(e){const{error:t,success:s}=as(),[n,o]=_.useState([]),[l,u]=_.useState(),[h,f]=_.useState(),[d,p]=_.useState(!0),[g,x]=_.useState(!1),[v,w]=_.useState(!1),[k,N]=_.useState(!1),[C,A]=_.useState();_.useEffect(()=>{let B=!1;return p(!0),A(void 0),(async()=>{try{const G=await oL(e);if(B)return;o(G.files),G.files.length>0?u(F=>F??G.files[0].path):(u(void 0),f(void 0))}catch(G){B||A(G instanceof Error?G.message:String(G))}finally{B||p(!1)}})(),()=>{B=!0}},[e]);const j=_.useCallback(async B=>{x(!0),A(void 0);try{const G=await ww(e,B),F={path:G.path,relativePath:G.relativePath,format:G.format};G.format==="env"?f({info:F,exists:G.exists,rows:G.entries.map(z=>({...z,reveal:!1}))}):f({info:F,exists:G.exists,text:G.format==="json"?Zj(G.content):G.content}),N(!1)}catch(G){A(G instanceof Error?G.message:String(G))}finally{x(!1)}},[e]);_.useEffect(()=>{l&&j(l)},[l,j]);function T(B,G){f(F=>{if(!F?.rows)return F;const z=F.rows.map((U,K)=>K===B?{...U,...G}:U);return{...F,rows:z}}),N(!0)}function M(){f(B=>B?.rows?{...B,rows:[...B.rows,{key:"",value:"",secret:!1,reveal:!0}]}:B),N(!0)}function O(B){f(G=>G?.rows?{...G,rows:G.rows.filter((F,z)=>z!==B)}:G),N(!0)}function $(B){f(G=>G&&{...G,text:B}),N(!0)}async function D(){if(h){w(!0);try{if(h.info.format==="env"&&h.rows){const B=await lL(e,h.info.path,h.rows.map(G=>({key:G.key.trim(),value:G.value})));f({info:{path:B.path,relativePath:B.relativePath,format:B.format},exists:B.exists,rows:B.entries.map(G=>({...G,reveal:!1}))}),s(`Saved ${B.entries.length} entries to ${B.relativePath}.`)}else if(h.text!==void 0){const B=await cL(e,h.info.path,h.text);f({info:{path:B.path,relativePath:B.relativePath,format:B.format},exists:B.exists,text:B.content}),s(`Saved ${B.relativePath}.`)}N(!1)}catch(B){t(B instanceof Error?B.message:String(B))}finally{w(!1)}}}async function P(B){try{const G=await ww(e,B),F={path:G.path,relativePath:G.relativePath,format:G.format};return o(z=>z.some(U=>U.path===F.path)?z:[...z,F]),u(F.path),s(`Loaded ${F.relativePath}.`),!0}catch(G){return t(G instanceof Error?G.message:String(G)),!1}}return{files:n,selectedPath:l,setSelectedPath:u,loaded:h,loadingList:d,loadingFile:g,saving:v,dirty:k,error:C,addRow:M,removeRow:O,updateRow:T,updateText:$,save:D,pickFile:P}}function qW({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}=FW(e),N=UW(e),[C,A]=_.useState(!1),[j,T]=_.useState(!1);async function M(){await w(),await N.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(IW,{onReload:()=>{N.reload()},reloading:N.reloading,runtime:N.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(J,{onClick:()=>T(!0),size:"sm",type:"button",variant:"outline",children:[r.jsx(mf,{})," Browse files"]}),o?r.jsx("code",{className:"rounded bg-background px-1.5 py-0.5 font-mono text-muted-foreground",children:o.info.path}):null]}),r.jsxs("div",{className:"flex items-center gap-1",children:[o?.info.format==="env"?r.jsxs(r.Fragment,{children:[r.jsxs(J,{onClick:()=>A(O=>!O),size:"sm",type:"button",variant:"outline",children:[C?r.jsx(XN,{}):r.jsx(Z0,{}),C?"Hide secrets":"Reveal secrets"]}),r.jsxs(J,{onClick:p,size:"sm",type:"button",variant:"outline",children:[r.jsx(ps,{})," Add"]})]}):null,r.jsxs(J,{disabled:!f||h||!o,onClick:()=>{M()},size:"sm",type:"button",children:[r.jsx(lC,{})," ",h?"Saving…":"Save"]})]})]}),d&&!o?r.jsx("div",{className:"text-red-600",children:d}):o?.info.format==="env"&&o.rows?r.jsx("div",{className:ue(u&&"opacity-60 transition-opacity"),children:r.jsx($W,{revealAll:C,rows:o.rows,onAdd:p,onRemove:g,onUpdate:x})}):o?.text!==void 0?r.jsxs("div",{className:ue("space-y-1",u&&"opacity-60 transition-opacity"),children:[o.info.format==="json"?r.jsx("div",{className:"flex justify-end",children:r.jsx(J,{onClick:()=>v(Zj(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(HW,{onClose:()=>T(!1),onPick:O=>{k(O).then($=>{$&&T(!1)})},serviceName:e}):null]})}function VW({serviceName:e,status:t,timeline:s,onRefresh:n}){const{error:o,success:l}=as(),[u,h]=_.useState(!1),f=t?.inspector,d=t?.state==="running",p=_.useMemo(()=>s.filter(v=>v.kind==="service.http"&&v.service===e).map(v=>{const w=v.data??{};return{id:w.id??v.id,startedAt:v.timestamp,method:w.method??"?",path:w.path??"?",status:w.status??0,durationMs:w.durationMs??0,reqBytes:w.reqBytes??0,resBytes:w.resBytes??0}}).slice(-500).reverse(),[s,e]);async function g(v){h(!0);try{await ji(`/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(J,{disabled:u,onClick:()=>g(!0),size:"sm",type:"button",children:[r.jsx(jr,{})," 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(J,{onClick:()=>{navigator.clipboard.writeText(x),l("Copied inspect URL.")},size:"sm",type:"button",variant:"outline",children:[r.jsx(Ah,{})," Copy"]}),r.jsx(J,{onClick:()=>{bf(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(J,{disabled:u,onClick:()=>g(!1),size:"sm",type:"button",variant:"outline",children:[r.jsx(no,{})," 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:ue("py-1 pr-3 text-right",GW(v.status)),children:v.status}),r.jsx("td",{className:"py-1 pr-3 text-right text-muted-foreground",children:WW(v.resBytes)}),r.jsx("td",{className:"py-1 pr-3 text-right",children:v.durationMs.toFixed(1)})]},v.id))})]})})]})}function GW(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 WW(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function KW({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 dL(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(YW,{series:t,now:l}):r.jsx("p",{className:"text-muted-foreground",children:"Loading metrics…"})}function YW({series:e,now:t}){const{samples:s}=e,n=_.useMemo(()=>wk(s,f=>f.cpu),[s]),o=_.useMemo(()=>wk(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(oh,{accent:"#22c55e",label:"CPU",value:`${n.last.toFixed(1)}%`,sub:`peak ${n.max.toFixed(1)}% · avg ${n.avg.toFixed(1)}%`}),r.jsx(oh,{accent:"#3b82f6",label:"Memory",value:Pg(o.last),sub:`peak ${Pg(o.max)} · avg ${Pg(o.avg)}`}),r.jsx(oh,{accent:"#a855f7",label:"Uptime",value:u!=null?Nk(u):"—",sub:l?`since ${l.toLocaleTimeString()}`:"not running"}),r.jsx(oh,{accent:"#f59e0b",label:"Samples",value:String(s.length),sub:h?`over ${Nk(h)}`:"collecting…"})]}),r.jsx(kk,{label:"CPU",samples:s,pick:f=>f.cpu,summary:n,color:"#22c55e",suffix:"%",unit:"percent"}),r.jsx(kk,{label:"Memory (RSS)",samples:s,pick:f=>f.rss,summary:o,color:"#3b82f6",suffix:" MB",unit:"mb"})]})}function wk(e,t){const s=e.map(t),n=s.reduce((o,l)=>o+l,0);return{last:s[s.length-1],max:Math.max(...s),min:Math.min(...s),avg:n/s.length}}function oh({accent:e,label:t,value:s,sub:n}){return 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 Qo=160,Sk=44,XW=20;function kk({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=ZW(d),g=0,x=p-g||1,v=t[0].t,w=t[t.length-1].t,k=Math.max(1,w-v),N=B=>(B-v)/k*1e3,C=B=>(1-(B-g)/x)*1e3,A=t.map(B=>`${N(B.t).toFixed(1)},${C(s(B)).toFixed(1)}`),j=`M0,1000 L${A.join(" L")} L1000,1000 Z`,T=`M${A.join(" L")}`,M=N(w),O=C(n.last),$=C(n.avg),D=[1,.75,.5,.25,0],P=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:Sk,height:Qo},children:D.map(B=>r.jsx("span",{className:"pr-1 leading-none",children:QW(g+B*x,u)},B))}),r.jsxs("div",{className:"relative min-w-0 flex-1",style:{height:Qo},children:[D.map((B,G)=>r.jsx("div",{className:"pointer-events-none absolute inset-x-0 border-t border-border/40",style:{top:`${B===1?0:B===0?Qo-1:(1-B)*Qo}px`,borderStyle:G===D.length-1?"solid":"dashed"}},B)),r.jsx("div",{className:"pointer-events-none absolute inset-x-0 border-t border-dashed",style:{top:`${$/1e3*Qo}px`,borderColor:o,opacity:.4}}),r.jsxs("svg",{"aria-label":e,className:"absolute inset-0 h-full w-full",preserveAspectRatio:"none",role:"img",viewBox:"0 0 1000 1000",children:[r.jsx("defs",{children:r.jsxs("linearGradient",{id:h,x1:"0",x2:"0",y1:"0",y2:"1",children:[r.jsx("stop",{offset:"0%",stopColor:o,stopOpacity:.35}),r.jsx("stop",{offset:"100%",stopColor:o,stopOpacity:.02})]})}),r.jsx("path",{d:j,fill:`url(#${h})`}),r.jsx("path",{d:T,fill:"none",stroke:o,strokeWidth:2,vectorEffect:"non-scaling-stroke",strokeLinejoin:"round",strokeLinecap:"round"})]}),r.jsx("span",{className:"pointer-events-none absolute z-10 block h-2.5 w-2.5 -translate-x-1/2 -translate-y-1/2 rounded-full ring-2 ring-card",style:{left:`${M/1e3*100}%`,top:`${O/1e3*Qo}px`,backgroundColor:o,boxShadow:`0 0 0 4px ${o}33`}})]})]}),r.jsx("div",{className:"flex font-mono text-[10px] text-muted-foreground",style:{height:XW,paddingLeft:Sk},children:r.jsx("div",{className:"relative flex-1",children:Array.from({length:P+1},(B,G)=>{const F=G/P,z=v+F*k;return r.jsx("span",{className:"absolute top-1 whitespace-nowrap",style:{left:`${F*100}%`,transform:G===0?"translateX(0)":G===P?"translateX(-100%)":"translateX(-50%)"},children:JW(z-w)},G)})})})]})]})}function ZW(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 QW(e,t){return t==="percent"?`${e.toFixed(0)}%`:e>=1024?`${(e/1024).toFixed(1)}G`:`${e.toFixed(0)}M`}function Pg(e){return e>=1024?`${(e/1024).toFixed(2)} GB`:`${e.toFixed(0)} MB`}function Nk(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 JW(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 eK({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:ue("py-1 truncate max-w-[60ch]",l&&"pl-4"),children:o.command})]},o.pid)})})]})})}const Ck={connecting:"bg-amber-500",running:"bg-emerald-500",exited:"bg-muted-foreground/40",error:"bg-red-500"},tK={state:"connecting",cwd:"Local workspace",detail:"Opening shell"};function Qj({sessionId:e,active:t,toolbarExtra:s}){const n=_.useRef(null),[o,l]=_.useState(tK),u=_.useCallback(h=>l(h),[]);return r.jsxs("section",{className:ue("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:o.state,children:[o.state==="connecting"&&r.jsx("span",{className:ue("absolute inline-flex size-full animate-ping rounded-full opacity-60",Ck[o.state])}),r.jsx("span",{className:ue("relative inline-flex size-2 rounded-full",Ck[o.state])})]}),r.jsxs("span",{className:"truncate font-mono text-[11px] text-white/55",children:[o.cwd," · ",o.detail]})]})}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(J,{"aria-label":"Restart terminal",className:"text-white/60 hover:bg-white/10 hover:text-white",size:"icon-sm",variant:"ghost",onClick:()=>n.current?.restart(),title:"Restart terminal",type:"button",children:r.jsx(pf,{})}),r.jsx(J,{"aria-label":"Stop terminal",className:"text-white/60 hover:bg-white/10 hover:text-white",size:"icon-sm",variant:"ghost",onClick:()=>n.current?.stop(),title:"Stop terminal",type:"button",children:r.jsx(no,{})}),s]})]}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(Gj,{active:t,onStatusChange:u,ref:n,sessionId:e})})]})}function sK({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(J,{"aria-label":u?"Exit fullscreen terminal":"Expand terminal",className:"text-white/60 hover:bg-white/10 hover:text-white",onClick:()=>h(x=>!x),size:"icon-sm",title:u?"Exit fullscreen":"Expand",type:"button",variant:"ghost",children:u?r.jsx(sb,{}):r.jsx(tb,{})}),g=o?r.jsxs("div",{className:"p-3 font-mono text-[11px] text-destructive",children:["Could not open terminal: ",o]}):s?r.jsx(Qj,{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(Jb,{onClose:()=>h(!1),title:`Terminal — ${e}`,children:g}):r.jsx("div",{className:ue("h-[60vh] min-h-[24rem] overflow-hidden rounded-md border border-border",!t&&"hidden"),children:g})}const nK=500;function iK(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(-nK))}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 fL(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 rK={running:"secondary",passed:"success",failed:"error",error:"error"},aK={running:"Running",passed:"Passed",failed:"Failed",error:"Error"};function oK({serviceName:e}){const{run:t,lines:s,error:n,starting:o,start:l}=iK(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(dt,{className:"h-7 flex-1 text-[11px]",disabled:f,onChange:p=>h(p.target.value),placeholder:"Optional test pattern (e.g. config-store)",value:u}),r.jsx(J,{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(Ye,{size:"small",variant:rK[t.status],children:aK[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:ue(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 lK({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(qa,{active:l==="logs",onClick:()=>u("logs"),children:"Logs"}),r.jsxs(qa,{active:l==="processes",onClick:()=>u("processes"),children:["Processes ",h.length?r.jsx(Ye,{variant:"secondary",size:"small",children:h.length}):null]}),r.jsx(qa,{active:l==="metrics",onClick:()=>u("metrics"),children:"Metrics"}),r.jsxs(qa,{active:l==="http",onClick:()=>u("http"),children:["HTTP",t?.inspector?.enabled?r.jsx(Ye,{variant:"success",size:"small",children:"on"}):null]}),r.jsx(qa,{active:l==="env",onClick:()=>u("env"),children:"Env"}),r.jsx(qa,{active:l==="tests",onClick:()=>u("tests"),children:"Tests"}),r.jsx(qa,{active:l==="terminal",onClick:()=>u("terminal"),children:"Terminal"})]}),l==="processes"?r.jsx(eK,{rows:h,running:t?.state==="running"}):null,l==="metrics"?r.jsx(KW,{serviceName:e}):null,l==="http"?r.jsx(VW,{serviceName:e,status:t,timeline:n,onRefresh:o}):null,l==="env"?r.jsx(qW,{serviceName:e}):null,l==="tests"?r.jsx(oK,{serviceName:e}):null,l==="logs"?r.jsx(OW,{serviceName:e}):null,r.jsx(sK,{active:l==="terminal",serviceName:e},e)]})}function qa({active:e,onClick:t,children:s}){return r.jsx("button",{className:ue("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 cK={high:"success",medium:"warning",low:"secondary"};function uK({onClose:e,onRefresh:t}){const s=as(),{sendToAgent:n}=At(),[o,l]=_.useState("url"),[u,h]=_.useState(""),[f,d]=_.useState(!1),[p,g]=_.useState(null),[x,v]=_.useState(null),[w,k]=_.useState([]),[N,C]=_.useState([]),[A,j]=_.useState(null),T=A?.kind==="docker-compose"?N.find(D=>D.composeService===A.composeService):void 0;async function M(){if(u.trim()){d(!0),g(null);try{const D=await ZO(u.trim());v(D.profile),k(D.proposals),C(D.databases),j(D.proposals[0]??null),D.proposals.length===0&&g("Cloned, but couldn't detect how to run this repo. Refine with AI or add it manually."),l("review")}catch(D){g(D instanceof Error?D.message:String(D))}finally{d(!1)}}}function O(){n({prompt:`Onboard this repository and register it as a NoMoreIDE service: ${u.trim()}
|
|
112
|
+
Use nomoreide_onboard_repo to inspect it, pick the best run command, then register and start it.`,source:{type:"repo-onboard",label:"Onboard repo"},label:`Onboard and run this repo: ${u.trim()}`}),e()}async function $(D){if(A){d(!0),g(null);try{await QO(A,D,T),await t(),s.success(`${A.name} registered${T?" (+ database)":""}${D?" and starting":""}.`),e()}catch(P){g(P instanceof Error?P.message:String(P))}finally{d(!1)}}}return r.jsxs(qn,{icon:r.jsx(Vn,{}),onClose:e,size:"lg",title:"Add from GitHub",children:[o==="url"?r.jsx(dK,{url:u,busy:f,error:p,onChange:h,onScan:M,onRefine:O}):null,o==="review"&&x?r.jsx(hK,{profile:x,proposals:w,selected:A,database:T,error:p,onSelect:j,onEdit:j,onBack:()=>l("url"),onRefine:O,onContinue:()=>l("install")}):null,o==="install"&&A?r.jsx(mK,{proposal:A,busy:f,error:p,onBack:()=>l("review"),onRegister:$}):null]})}function dK({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(dt,{autoFocus:!0,placeholder:"https://github.com/owner/repo",value:e,onChange:u=>n(u.target.value),onKeyDown:u=>{u.key==="Enter"&&!t&&o()}}),s?r.jsx("p",{className:"text-sm text-destructive",children:s}):null,r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs(J,{variant:"ghost",size:"sm",onClick:l,disabled:!e.trim(),children:[r.jsx(Yi,{className:"size-3.5"}),"Refine with AI"]}),r.jsxs(J,{onClick:o,disabled:t||!e.trim(),children:[t?r.jsx(jt,{className:"size-4 animate-spin"}):r.jsx(Vn,{className:"size-4"}),t?"Cloning…":"Clone & detect"]})]})]})}function hK({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(Ye,{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(Ye,{variant:cK[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(fK,{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(di,{className:"size-3.5"}),r.jsxs("span",{children:["Also registers database ",r.jsx("span",{className:"font-medium",children:n.name})," (",n.engine,") so it shows in the Database tab."]})]}):null,e.envKeys.length>0?r.jsxs("div",{className:"text-xs text-muted-foreground",children:[r.jsx("span",{className:"font-medium",children:"Env from .env.example:"})," ",e.envKeys.join(", ")]}):null,e.readmeExcerpt?r.jsxs("details",{className:"rounded-md border border-border bg-muted/30 p-2 text-xs",children:[r.jsx("summary",{className:"cursor-pointer font-medium",children:"README excerpt"}),r.jsx("pre",{className:"mt-2 max-h-40 overflow-auto whitespace-pre-wrap font-mono",children:e.readmeExcerpt})]}):null,r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs(J,{variant:"ghost",size:"sm",onClick:h,children:[r.jsx(ou,{className:"size-3.5"}),"Back"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(J,{variant:"outline",size:"sm",onClick:f,children:[r.jsx(Yi,{className:"size-3.5"}),"Refine with AI"]}),r.jsx(J,{onClick:d,disabled:!s,children:"Continue"})]})]})]})}function fK({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(dt,{value:e.name,onChange:s=>t({...e,name:s.target.value})})}),r.jsx(Ic,{label:"Port (optional)",children:r.jsx(dt,{value:e.port?.toString()??"",placeholder:"auto",onChange:s=>t({...e,port:s.target.value?Number(s.target.value):void 0})})}),e.kind==="docker-compose"?r.jsx(Ic,{label:"Compose service",className:"col-span-2",children:r.jsx(dt,{value:e.composeService??"",onChange:s=>t({...e,composeService:s.target.value})})}):r.jsx(Ic,{label:"Run command",className:"col-span-2",children:r.jsx(dt,{value:e.command??"",onChange:s=>t({...e,command:s.target.value})})})]})}function mK({proposal:e,busy:t,error:s,onBack:n,onRegister:o}){const[l,u]=_.useState(e.installCommand??""),[h,f]=_.useState([]),[d,p]=_.useState(!1),[g,x]=_.useState(!1),v=_.useRef(null);function w(N){f(C=>[...C,N]),queueMicrotask(()=>{const C=v.current;C&&(C.scrollTop=C.scrollHeight)})}async function k(){l.trim()&&(p(!0),x(!1),f([]),await JO({clonePath:e.cwd,command:l.trim()},{onLine:N=>w(N.text),onDone:N=>{w(N===0?"✓ install complete":`✗ install exited ${N}`),p(!1),x(N===0)},onError:N=>{w(`✗ ${N}`),p(!1)}}))}return 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(dt,{value:l,placeholder:"e.g. npm install",onChange:N=>u(N.target.value)})}),r.jsxs(J,{variant:"outline",onClick:k,disabled:d||!l.trim(),children:[d?r.jsx(jt,{className:"size-4 animate-spin"}):r.jsx(Xc,{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(`
|
|
113
|
+
`)}):null,s?r.jsx("p",{className:"text-sm text-destructive",children:s}):null,r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs(J,{variant:"ghost",size:"sm",onClick:n,children:[r.jsx(ou,{className:"size-3.5"}),"Back"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(J,{variant:"outline",onClick:()=>o(!1),disabled:t,children:"Register only"}),r.jsxs(J,{onClick:()=>o(!0),disabled:t,children:[t?r.jsx(jt,{className:"size-4 animate-spin"}):r.jsx(jr,{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 pK({data:e,onRefresh:t,focusService:s,onServiceFocused:n,scopeName:o}){const l=e.config.services[0]?.name??"",[u,h]=_.useState(l),[f,d]=_.useState(null),[p,g]=_.useState(!1),{sendToAgent:x,startOnboard:v}=At(),[w,k]=_.useState(!1),[N,C]=_.useState(!1),[A,j]=_.useState(!1),[T,M]=_.useState(!1),[O,$]=_.useState(!1),D=_.useRef({}),{error:P,message:B,success:G}=as(),F=_.useMemo(()=>new Set(e.config.bundles.flatMap(ie=>ie.services)),[e.config.bundles]),z=_.useMemo(()=>{const ie=new Map;for(const Se of e.config.bundles)for(const Re of Se.services)ie.has(Re)||ie.set(Re,Se.name);return ie},[e.config.bundles]),U=_.useMemo(()=>e.config.services.filter(ie=>!F.has(ie.name)),[e.config.services,F]),K=_.useMemo(()=>e.config.services.map(ie=>ie.name),[e.config.services]),I=_.useMemo(()=>e.config.services.some(ie=>(ie.dependsOn?.length??0)>0),[e.config.services]),Z=e.health??{},W=e.config.bundles.length>0||U.length>0;_.useEffect(()=>{!e.config.services.some(Se=>Se.name===u)&&l&&h(l)},[e.config.services,l,u]),_.useEffect(()=>{s&&e.config.services.some(ie=>ie.name===s)&&(h(s),n?.())},[s,e.config.services,n]);const te=_.useMemo(()=>e.config.services.find(ie=>ie.name===u),[e.config.services,u]),X=u?e.runtime.services[u]:void 0,V=u?Z[u]:void 0;async function q(ie,Se){if(!ie.services.includes(Se))try{await mL(ie.name,ie.services,Se),G(`Added ${Se} to ${ie.name}.`),await t()}catch(Re){P(Re instanceof Error?Re.message:String(Re))}}async function oe(){if(te){if(Gc(X?.state)){P(`Stop ${te.name} before deleting it.`);return}if(window.confirm(`Delete service "${te.name}"? This removes it from your config.`))try{await rL(te.name),G(`Deleted ${te.name}.`),await t()}catch(ie){P(ie instanceof Error?ie.message:String(ie))}}}async function ee(ie){const Se=e.config.bundles.filter(Re=>Re.services.includes(ie));if(Se.length!==0)try{for(const Re of Se)await gL(Re.name,Re.services,ie);B({text:`Removed ${ie} from ${Se.map(Re=>Re.name).join(", ")}.`}),await t()}catch(Re){P(Re instanceof Error?Re.message:String(Re))}}_.useEffect(()=>{const ie=Object.fromEntries(e.config.services.map(Re=>[Re.name,e.runtime.services[Re.name]?.state??"stopped"])),Se=D.current;if(Object.keys(Se).length){const Re=new Map,De=new Map;for(const Je of e.config.services){const Ne=ie[Je.name],Ue=Se[Je.name];if(!Ue||Ue===Ne)continue;const $e=e.runtime.services[Je.name],St=z.get(Je.name);if(St){const Ds=Re.get(St)??new Map;if(Ds.set(Ne,(Ds.get(Ne)??0)+1),Re.set(St,Ds),Ne==="exited"){const Os=De.get(St)??[];Os.push($e?.exitCode),De.set(St,Os)}continue}if(Ne==="running")G(`${Je.name} is running.`);else if(Ne==="stopped")B({text:`${Je.name} stopped.`});else if(Ne==="starting")B({text:`${Je.name} is starting.`});else if(Ne==="exited"){const Ds=$e?.exitCode===void 0||$e.exitCode===null?"":` with code ${$e.exitCode}`;P(`${Je.name} exited${Ds}.`)}}for(const[Je,Ne]of Re)xK({exitCodes:De.get(Je)??[],groupName:Je,showErrorToast:P,showMessageToast:B,showSuccessToast:G,transitions:Ne})}D.current=ie},[e.config.services,e.runtime.services,z,P,B,G]);const fe=e.config.services.length>0;return r.jsxs(r.Fragment,{children:[!fe&&o?r.jsx("div",{className:"flex h-full items-center justify-center p-8 text-center",children:r.jsxs("div",{className:"max-w-sm text-sm text-muted-foreground",children:[r.jsxs("p",{className:"font-medium text-foreground",children:["No services in ",o]}),r.jsx("p",{className:"mt-1 text-xs",children:"Services whose working directory lives under this project appear here. Switch to All projects in the sidebar to see everything."})]})}):fe?r.jsxs("div",{className:ue("grid h-full min-h-0 overflow-hidden bg-card/85",A?"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(hi,{className:"min-w-0 rounded-none border-0 border-b border-border bg-transparent",children:[r.jsx(fi,{className:"border-b border-border px-3 py-2",children:r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx(mi,{className:"text-sm",children:"Services"}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsxs(J,{"aria-haspopup":"dialog",className:"h-7 gap-1.5 px-2 text-xs",onClick:()=>C(!0),size:"sm",type:"button",variant:"outline",children:[r.jsx(Mh,{className:"size-3.5"}),"Graph"]}),r.jsxs(J,{"aria-haspopup":"dialog",className:"h-7 gap-1.5 px-2 text-xs",onClick:()=>k(!0),size:"sm",type:"button",variant:"outline",children:[r.jsx(cC,{className:"size-3.5"}),"Logs"]}),r.jsx(gK,{onCreateGroup:()=>d("group"),onCreateService:()=>d("service"),onOnboardRepo:()=>g(!0),onOnboardWithAi:v,canGroupWithAi:U.length>1,onCreateWithAi:()=>x({prompt:JS,source:{type:"service-setup",label:"Add a service"},label:"Help me add a new service, one step at a time."}),onGroupWithAi:()=>x({prompt:T$(U),source:{type:"group-services",label:"Group services"},label:"Propose how to group my ungrouped services."})})]})]})}),r.jsx(pi,{className:"p-0",children:W?r.jsxs("div",{className:"divide-y divide-border",children:[e.config.bundles.map(ie=>r.jsx(oU,{group:ie,onRefresh:t,ports:e.ports,allServices:e.config.services,health:Z,services:e.config.services.filter(Se=>ie.services.includes(Se.name)),statuses:e.runtime.services,timeline:e.timeline,selectedService:u,onSelectService:h,onDropService:Se=>{q(ie,Se)}},ie.name)),U.length?r.jsxs("div",{className:ue("transition-colors",O&&"bg-primary/5 outline-dashed outline-2 -outline-offset-2 outline-primary/60"),onDragOver:ie=>{ie.dataTransfer.types.includes(nu)&&(ie.preventDefault(),ie.dataTransfer.dropEffect="move",$(!0))},onDragLeave:()=>$(!1),onDrop:ie=>{ie.preventDefault(),$(!1);const Se=ie.dataTransfer.getData(nu);Se&&ee(Se)},children:[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:U.length})]}),r.jsx("div",{className:"divide-y divide-border",children:U.map(ie=>r.jsx(Z3,{service:ie,status:e.runtime.services[ie.name],health:Z[ie.name],ports:e.ports,onRefresh:t,timeline:e.timeline,selected:u===ie.name,onSelect:()=>h(ie.name)},ie.name))})]}):null]}):r.jsx(ef,{label:"No services registered yet."})})]})}),r.jsx("div",{className:"min-h-0 min-w-0 overflow-auto",children:te?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:te.name}),r.jsx(Q3,{state:X?.state??"stopped"}),r.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1.5",children:[(()=>{const ie=X?.url??(te.port?cU(te.port):void 0);return ie?r.jsx(rl,{label:`Open ${ie}`,children:r.jsx(J,{"aria-label":"Open in browser",className:"size-7",onClick:()=>{bf(ie)},size:"icon",type:"button",variant:"outline",children:r.jsx(so,{})})}):null})(),V?.agentContext&&te?r.jsx(rl,{label:"Debug this service with AI",children:r.jsx(J,{"aria-label":"Debug this service with AI",className:"size-7",onClick:()=>x({prompt:L$({service:te.name,context:V.agentContext}),source:{type:"service-debug",label:te.name},label:`Debug \`${te.name}\` with its current context.`}),size:"icon",type:"button",variant:"outline",children:r.jsx(Ft,{className:"size-3.5"})})}):null,r.jsx(Ib,{active:Gc(X?.state),baseUrl:`/api/services/${encodeURIComponent(te.name)}`,compact:!0,resourceKind:"service",resourceName:te.name,targetLabel:te.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:()=>M(!0)},...Gc(X?.state)?[]:[{icon:r.jsx(Ti,{className:"size-3.5 text-destructive"}),label:"Delete service",onSelect:()=>{oe()}}]],label:`More actions for ${te.name}`}),r.jsx(rl,{label:A?"Show Ports & Timeline":"Hide Ports & Timeline",side:"left",children:r.jsx(J,{"aria-label":A?"Show Ports & Timeline":"Hide Ports & Timeline",className:"size-7",onClick:()=>j(ie=>!ie),size:"icon",type:"button",variant:"ghost",children:A?r.jsx(P4,{}):r.jsx(Wn,{})})})]})]}),te.command?r.jsxs("div",{className:"truncate font-mono text-[11px] text-muted-foreground",title:te.command,children:["$ ",te.command]}):null,te.cwd?r.jsx("div",{className:"truncate font-mono text-[11px] text-muted-foreground",title:te.cwd,children:te.cwd}):null,r.jsx(bW,{health:V})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:r.jsx(lK,{serviceName:te.name,status:X,health:V,timeline:e.timeline??[],onRefresh:t},te.name)})]}):r.jsx(ef,{label:"Select a service to see details."})}),A?null:r.jsxs("div",{className:"min-h-0 overflow-auto border-l border-border",children:[r.jsx(SW,{ports:e.ports}),r.jsx(iW,{events:e.timeline??[]})]})]}):r.jsx(xW,{onOnboardRepo:()=>g(!0),onOnboardWithAi:v,onCreateService:()=>d("service"),onCreateWithAi:()=>x({prompt:JS,source:{type:"service-setup",label:"Add a service"},label:"Help me add a new service, one step at a time."})}),T&&te?r.jsx(qn,{icon:r.jsx(ul,{}),onClose:()=>M(!1),size:"lg",title:`Edit Service — ${te.name}`,children:r.jsx(m2,{cwd:e.cwd,initialService:te,availableServices:K,onRefresh:t,onSaved:()=>M(!1)})}):null,f?r.jsx(qn,{icon:f==="service"?r.jsx(ps,{}):r.jsx(df,{}),onClose:()=>d(null),size:f==="service"?"lg":"md",title:f==="service"?"Add Service":"Create Group",children:f==="service"?r.jsx(m2,{cwd:e.cwd,availableServices:K,onRefresh:t,onSaved:()=>d(null)}):r.jsx(X3,{services:U,onRefresh:t,onSaved:()=>d(null)})}):null,p?r.jsx(uK,{onClose:()=>g(!1),onRefresh:t}):null,w?r.jsx(BW,{initialService:u||void 0,onClose:()=>k(!1),services:e.config.services.map(ie=>ie.name)}):null,N?r.jsx(qn,{icon:r.jsx(Mh,{}),onClose:()=>C(!1),size:"lg",title:"Service Dependency Graph",children:r.jsx(fW,{statuses:e.runtime.services,health:Z,hasDependencies:I,onSelectService:ie=>{h(ie),C(!1)}})}):null]})}function gK({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(J,{"aria-expanded":h,"aria-haspopup":"menu","aria-label":"Add service or group",className:"size-7",onClick:()=>f(p=>!p),size:"icon",type:"button",variant:"ghost",children:r.jsx(ps,{})})}),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(ps,{}),"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(Ft,{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(df,{}),"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(Ft,{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(Vn,{}),"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(Ft,{className:"size-3.5 shrink-0"}),"AI"]})]})]})]}):null]})}function xK({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 bK({data:e,onOpenService:t}){const s=_.useMemo(()=>vK(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(Qa,{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:ue("size-2 shrink-0 rounded-full",yK(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 vK(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:_K(s,e.health[s.name]),port:t.get(s.name)??wK(s.url),uptime:s.state==="running"?SK(s.startedAt):"starting…",url:s.url})).sort((s,n)=>s.name.localeCompare(n.name))}function _K(e,t){return e.state==="starting"?"starting":t?.status==="healthy"?"healthy":t?.status==="warning"?"warning":t?.status==="unhealthy"?"unhealthy":"healthy"}function yK(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 wK(e){if(e)try{const t=new URL(e).port;return t?Number(t):void 0}catch{return}}function SK(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 kK(){const[e,t]=_.useState([]),[s,n]=_.useState(null),[o,l]=_.useState(!1);_.useEffect(()=>{let f=!1;return(async()=>{let d=await DC().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 Cx(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:ue("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(qt,{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(ps,{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(Qj,{active:f.id===s,sessionId:f.id})},f.id))})]})}function Jj({branch:e}){return r.jsx("span",{className:"min-w-0 max-w-40",title:e,children:r.jsx(Ye,{className:"w-full max-w-full shadow-none",variant:"outline",children:e})})}function e5({branch:e,error:t,files:s,selectedFile:n,onSelectFile:o,root:l,staging:u}){const h=_.useMemo(()=>jK(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(Vn,{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(Jj,{branch:e}):null,r.jsx(Ye,{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(NK,{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(Qe,{variant:"muted",className:"m-3 text-center",children:t??"No changed files."})})]})}function NK({collapsed:e,group:t,onSelectFile:s,onToggle:n,root:o,selectedFile:l,staging:u}){const h=e?Wn:Gn,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(Ye,{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(CK,{active:l===p.path,file:p,group:t.id,onClick:()=>s(p.path),root:o,staging:u},p.path))})]})}function CK({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?Y3(pu(o,t.path)):{},d=s==="staged";return r.jsxs("div",{className:ue("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(Qb,{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(aC,{className:"size-3.5"}):r.jsx(ps,{className:"size-3.5"})}):null,r.jsx("span",{className:ue("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:EK(t,s)})]})}function EK(e,t){return t==="untracked"?"?":t==="staged"?e.index.trim():e.workingTree.trim()}function jK(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 t5({branch:e,files:t,onDone:s,repo:n}){const{sendToAgent:o}=At(),[l,u]=_.useState(""),[h,f]=_.useState(null),[d,p]=_.useState(null),[g,x]=_.useState(null),v=_.useMemo(()=>t.filter(C=>C.index.trim()&&C.index!=="?").map(C=>C.path),[t]),w=v.length>0&&l.trim().length>0&&h===null;async function k(C,A){f(C),p(null),x(null);try{if(await CC(l.trim(),n),A){const j=await vf(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 N(){o({prompt:C$({branch:e,stagedFiles:v}),source:{type:"git-commit",label:"commit message"},mode:"send",label:"Suggest a commit message"})}return r.jsxs("div",{className:"shrink-0 space-y-2 border-t border-border bg-card/95 p-2.5",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-tight text-muted-foreground",children:"Commit"}),r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[v.length," staged"]}),r.jsxs("button",{"aria-label":"Suggest a commit message with AI",className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-50",disabled:v.length===0,onClick:N,title:"Ask the agent to draft a commit message from the staged diff",type:"button",children:[r.jsx(Ft,{className:"size-3.5"}),"AI message"]})]})]}),r.jsx("textarea",{"aria-label":"Commit message",className:"min-h-16 w-full resize-y rounded-md border border-border bg-background px-2.5 py-1.5 text-[12px] outline-none transition-colors placeholder:text-muted-foreground focus:border-foreground/40 focus:ring-2 focus:ring-ring",onChange:C=>{u(C.target.value),p(null),x(null)},placeholder:v.length?"Commit message…":"Stage files to commit",value:l}),r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs(J,{disabled:!w,onClick:()=>{k("commit",!1)},size:"sm",type:"button",variant:"outline",children:[h==="commit"?r.jsx(jt,{className:"size-3.5 animate-spin"}):r.jsx(Zs,{className:"size-3.5"}),"Commit"]}),r.jsxs(J,{disabled:!w,onClick:()=>{k("push",!0)},size:"sm",type:"button",children:[h==="push"?r.jsx(jt,{className:"size-3.5 animate-spin"}):r.jsx(gf,{className:"size-3.5"}),"Commit & push"]})]}),d?r.jsx(Qe,{className:"px-2.5 py-1.5 text-[11px]",variant:"destructive",children:d}):g?r.jsx(Qe,{className:"px-2.5 py-1.5 text-[11px]",variant:"muted",children:g}):null]})}function AK(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 Ek(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 jk({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(()=>AK(t),[t]),p=_.useMemo(()=>Ek(d,e),[e,d]),g=_.useMemo(()=>Ek(d,!0),[d]),x=Math.max(0,Object.keys(g).length-1),v=_.useMemo(()=>{const M=new Map;for(const O of s)M.set(O.path,O);return M},[s]),[w,k]=_.useState(p),[N,C]=_.useState(!1);_.useEffect(()=>{N||d.children.length===0||(k(p),C(!0))},[p,N,d.children.length]);function A(M){k(O=>({...O,[M]:!O[M]}))}function j(){k(g)}function T(){k({"":!0})}return r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border bg-card/95 px-2.5 py-1.5",children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-[12px] font-semibold tracking-tight",children:[r.jsx(lo,{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(nM,{className:"size-3.5"})}),r.jsx("button",{"aria-label":"Collapse all folders",className:"flex size-6 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:T,title:"Collapse all folders",type:"button",children:r.jsx(tM,{className:"size-3.5"})})]}):null,l?r.jsx(Jj,{branch:l}):null,r.jsx(Ye,{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(Qe,{variant:"muted",className:"m-3 text-center",children:u}):d.children.map(M=>r.jsx(s5,{depth:0,expanded:w,node:M,onSelectFile:o,onToggle:A,root:h,selectedFile:n,statusByPath:v},M.path))})]})}function s5({depth:e,expanded:t,node:s,onSelectFile:n,onToggle:o,root:l,selectedFile:u,statusByPath:h}){const f=t[s.path]??!1,d=6+e*12,p=l?Y3(pu(l,s.path)):{};if(s.isFile){const v=h.get(s.path),w=u===s.path;return r.jsxs("button",{className:ue("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(Qb,{path:s.path}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:s.name}),v?r.jsx(TK,{file:v}):null]})}const g=f?Gn:Wn,x=f?mf:lo;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(s5,{depth:e+1,expanded:t,node:v,onSelectFile:n,onToggle:o,root:l,selectedFile:u,statusByPath:h},v.path)):null]})}function TK({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:ue("ml-1 shrink-0 font-mono text-[10px] font-semibold",s),children:t})}var Ig,Ak;function RK(){if(Ak)return Ig;Ak=1;function e(H){return H instanceof Map?H.clear=H.delete=H.set=function(){throw new Error("map is read-only")}:H instanceof Set&&(H.add=H.clear=H.delete=function(){throw new Error("set is read-only")}),Object.freeze(H),Object.getOwnPropertyNames(H).forEach(se=>{const ge=H[se],Pe=typeof ge;(Pe==="object"||Pe==="function")&&!Object.isFrozen(ge)&&e(ge)}),H}class t{constructor(se){se.data===void 0&&(se.data={}),this.data=se.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function s(H){return H.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function n(H,...se){const ge=Object.create(null);for(const Pe in H)ge[Pe]=H[Pe];return se.forEach(function(Pe){for(const it in Pe)ge[it]=Pe[it]}),ge}const o="</span>",l=H=>!!H.scope,u=(H,{prefix:se})=>{if(H.startsWith("language:"))return H.replace("language:","language-");if(H.includes(".")){const ge=H.split(".");return[`${se}${ge.shift()}`,...ge.map((Pe,it)=>`${Pe}${"_".repeat(it+1)}`)].join(" ")}return`${se}${H}`};class h{constructor(se,ge){this.buffer="",this.classPrefix=ge.classPrefix,se.walk(this)}addText(se){this.buffer+=s(se)}openNode(se){if(!l(se))return;const ge=u(se.scope,{prefix:this.classPrefix});this.span(ge)}closeNode(se){l(se)&&(this.buffer+=o)}value(){return this.buffer}span(se){this.buffer+=`<span class="${se}">`}}const f=(H={})=>{const se={children:[]};return Object.assign(se,H),se};class d{constructor(){this.rootNode=f(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(se){this.top.children.push(se)}openNode(se){const ge=f({scope:se});this.add(ge),this.stack.push(ge)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(se){return this.constructor._walk(se,this.rootNode)}static _walk(se,ge){return typeof ge=="string"?se.addText(ge):ge.children&&(se.openNode(ge),ge.children.forEach(Pe=>this._walk(se,Pe)),se.closeNode(ge)),se}static _collapse(se){typeof se!="string"&&se.children&&(se.children.every(ge=>typeof ge=="string")?se.children=[se.children.join("")]:se.children.forEach(ge=>{d._collapse(ge)}))}}class p extends d{constructor(se){super(),this.options=se}addText(se){se!==""&&this.add(se)}startScope(se){this.openNode(se)}endScope(){this.closeNode()}__addSublanguage(se,ge){const Pe=se.root;ge&&(Pe.scope=`language:${ge}`),this.add(Pe)}toHTML(){return new h(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function g(H){return H?typeof H=="string"?H:H.source:null}function x(H){return k("(?=",H,")")}function v(H){return k("(?:",H,")*")}function w(H){return k("(?:",H,")?")}function k(...H){return H.map(ge=>g(ge)).join("")}function N(H){const se=H[H.length-1];return typeof se=="object"&&se.constructor===Object?(H.splice(H.length-1,1),se):{}}function C(...H){return"("+(N(H).capture?"":"?:")+H.map(Pe=>g(Pe)).join("|")+")"}function A(H){return new RegExp(H.toString()+"|").exec("").length-1}function j(H,se){const ge=H&&H.exec(se);return ge&&ge.index===0}const T=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function M(H,{joinWith:se}){let ge=0;return H.map(Pe=>{ge+=1;const it=ge;let Et=g(Pe),qe="";for(;Et.length>0;){const He=T.exec(Et);if(!He){qe+=Et;break}qe+=Et.substring(0,He.index),Et=Et.substring(He.index+He[0].length),He[0][0]==="\\"&&He[1]?qe+="\\"+String(Number(He[1])+it):(qe+=He[0],He[0]==="("&&ge++)}return qe}).map(Pe=>`(${Pe})`).join(se)}const O=/\b\B/,$="[a-zA-Z]\\w*",D="[a-zA-Z_]\\w*",P="\\b\\d+(\\.\\d+)?",B="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",G="\\b(0b[01]+)",F="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",z=(H={})=>{const se=/^#![ ]*\//;return H.binary&&(H.begin=k(se,/.*\b/,H.binary,/\b.*/)),n({scope:"meta",begin:se,end:/$/,relevance:0,"on:begin":(ge,Pe)=>{ge.index!==0&&Pe.ignoreMatch()}},H)},U={begin:"\\\\[\\s\\S]",relevance:0},K={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[U]},I={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[U]},Z={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},W=function(H,se,ge={}){const Pe=n({scope:"comment",begin:H,end:se,contains:[]},ge);Pe.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const it=C("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return Pe.contains.push({begin:k(/[ ]+/,"(",it,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),Pe},te=W("//","$"),X=W("/\\*","\\*/"),V=W("#","$"),q={scope:"number",begin:P,relevance:0},oe={scope:"number",begin:B,relevance:0},ee={scope:"number",begin:G,relevance:0},fe={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[U,{begin:/\[/,end:/\]/,relevance:0,contains:[U]}]},ie={scope:"title",begin:$,relevance:0},Se={scope:"title",begin:D,relevance:0},Re={begin:"\\.\\s*"+D,relevance:0};var Je=Object.freeze({__proto__:null,APOS_STRING_MODE:K,BACKSLASH_ESCAPE:U,BINARY_NUMBER_MODE:ee,BINARY_NUMBER_RE:G,COMMENT:W,C_BLOCK_COMMENT_MODE:X,C_LINE_COMMENT_MODE:te,C_NUMBER_MODE:oe,C_NUMBER_RE:B,END_SAME_AS_BEGIN:function(H){return Object.assign(H,{"on:begin":(se,ge)=>{ge.data._beginMatch=se[1]},"on:end":(se,ge)=>{ge.data._beginMatch!==se[1]&&ge.ignoreMatch()}})},HASH_COMMENT_MODE:V,IDENT_RE:$,MATCH_NOTHING_RE:O,METHOD_GUARD:Re,NUMBER_MODE:q,NUMBER_RE:P,PHRASAL_WORDS_MODE:Z,QUOTE_STRING_MODE:I,REGEXP_MODE:fe,RE_STARTERS_RE:F,SHEBANG:z,TITLE_MODE:ie,UNDERSCORE_IDENT_RE:D,UNDERSCORE_TITLE_MODE:Se});function Ne(H,se){H.input[H.index-1]==="."&&se.ignoreMatch()}function Ue(H,se){H.className!==void 0&&(H.scope=H.className,delete H.className)}function $e(H,se){se&&H.beginKeywords&&(H.begin="\\b("+H.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",H.__beforeBegin=Ne,H.keywords=H.keywords||H.beginKeywords,delete H.beginKeywords,H.relevance===void 0&&(H.relevance=0))}function St(H,se){Array.isArray(H.illegal)&&(H.illegal=C(...H.illegal))}function Ds(H,se){if(H.match){if(H.begin||H.end)throw new Error("begin & end are not supported with match");H.begin=H.match,delete H.match}}function Os(H,se){H.relevance===void 0&&(H.relevance=1)}const vi=(H,se)=>{if(!H.beforeMatch)return;if(H.starts)throw new Error("beforeMatch cannot be used with starts");const ge=Object.assign({},H);Object.keys(H).forEach(Pe=>{delete H[Pe]}),H.keywords=ge.keywords,H.begin=k(ge.beforeMatch,x(ge.begin)),H.starts={relevance:0,contains:[Object.assign(ge,{endsParent:!0})]},H.relevance=0,delete ge.beforeMatch},Kn=["of","and","for","in","not","or","if","then","parent","list","value"],Us="keyword";function jn(H,se,ge=Us){const Pe=Object.create(null);return typeof H=="string"?it(ge,H.split(" ")):Array.isArray(H)?it(ge,H):Object.keys(H).forEach(function(Et){Object.assign(Pe,jn(H[Et],se,Et))}),Pe;function it(Et,qe){se&&(qe=qe.map(He=>He.toLowerCase())),qe.forEach(function(He){const rt=He.split("|");Pe[rt[0]]=[Et,An(rt[0],rt[1])]})}}function An(H,se){return se?Number(se):Ri(H)?0:1}function Ri(H){return Kn.includes(H.toLowerCase())}const _i={},It=H=>{console.error(H)},Cs=(H,...se)=>{console.log(`WARN: ${H}`,...se)},ls=(H,se)=>{_i[`${H}/${se}`]||(console.log(`Deprecated as of ${H}. ${se}`),_i[`${H}/${se}`]=!0)},pn=new Error;function gn(H,se,{key:ge}){let Pe=0;const it=H[ge],Et={},qe={};for(let He=1;He<=se.length;He++)qe[He+Pe]=it[He],Et[He+Pe]=!0,Pe+=A(se[He-1]);H[ge]=qe,H[ge]._emit=Et,H[ge]._multi=!0}function Mi(H){if(Array.isArray(H.begin)){if(H.skip||H.excludeBegin||H.returnBegin)throw It("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),pn;if(typeof H.beginScope!="object"||H.beginScope===null)throw It("beginScope must be object"),pn;gn(H,H.begin,{key:"beginScope"}),H.begin=M(H.begin,{joinWith:""})}}function S(H){if(Array.isArray(H.end)){if(H.skip||H.excludeEnd||H.returnEnd)throw It("skip, excludeEnd, returnEnd not compatible with endScope: {}"),pn;if(typeof H.endScope!="object"||H.endScope===null)throw It("endScope must be object"),pn;gn(H,H.end,{key:"endScope"}),H.end=M(H.end,{joinWith:""})}}function re(H){H.scope&&typeof H.scope=="object"&&H.scope!==null&&(H.beginScope=H.scope,delete H.scope)}function xe(H){re(H),typeof H.beginScope=="string"&&(H.beginScope={_wrap:H.beginScope}),typeof H.endScope=="string"&&(H.endScope={_wrap:H.endScope}),Mi(H),S(H)}function ye(H){function se(qe,He){return new RegExp(g(qe),"m"+(H.case_insensitive?"i":"")+(H.unicodeRegex?"u":"")+(He?"g":""))}class ge{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(He,rt){rt.position=this.position++,this.matchIndexes[this.matchAt]=rt,this.regexes.push([rt,He]),this.matchAt+=A(He)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const He=this.regexes.map(rt=>rt[1]);this.matcherRe=se(M(He,{joinWith:"|"}),!0),this.lastIndex=0}exec(He){this.matcherRe.lastIndex=this.lastIndex;const rt=this.matcherRe.exec(He);if(!rt)return null;const cs=rt.findIndex((er,mo)=>mo>0&&er!==void 0),Xt=this.matchIndexes[cs];return rt.splice(0,cs),Object.assign(rt,Xt)}}class Pe{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(He){if(this.multiRegexes[He])return this.multiRegexes[He];const rt=new ge;return this.rules.slice(He).forEach(([cs,Xt])=>rt.addRule(cs,Xt)),rt.compile(),this.multiRegexes[He]=rt,rt}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(He,rt){this.rules.push([He,rt]),rt.type==="begin"&&this.count++}exec(He){const rt=this.getMatcher(this.regexIndex);rt.lastIndex=this.lastIndex;let cs=rt.exec(He);if(this.resumingScanAtSamePosition()&&!(cs&&cs.index===this.lastIndex)){const Xt=this.getMatcher(0);Xt.lastIndex=this.lastIndex+1,cs=Xt.exec(He)}return cs&&(this.regexIndex+=cs.position+1,this.regexIndex===this.count&&this.considerAll()),cs}}function it(qe){const He=new Pe;return qe.contains.forEach(rt=>He.addRule(rt.begin,{rule:rt,type:"begin"})),qe.terminatorEnd&&He.addRule(qe.terminatorEnd,{type:"end"}),qe.illegal&&He.addRule(qe.illegal,{type:"illegal"}),He}function Et(qe,He){const rt=qe;if(qe.isCompiled)return rt;[Ue,Ds,xe,vi].forEach(Xt=>Xt(qe,He)),H.compilerExtensions.forEach(Xt=>Xt(qe,He)),qe.__beforeBegin=null,[$e,St,Os].forEach(Xt=>Xt(qe,He)),qe.isCompiled=!0;let cs=null;return typeof qe.keywords=="object"&&qe.keywords.$pattern&&(qe.keywords=Object.assign({},qe.keywords),cs=qe.keywords.$pattern,delete qe.keywords.$pattern),cs=cs||/\w+/,qe.keywords&&(qe.keywords=jn(qe.keywords,H.case_insensitive)),rt.keywordPatternRe=se(cs,!0),He&&(qe.begin||(qe.begin=/\B|\b/),rt.beginRe=se(rt.begin),!qe.end&&!qe.endsWithParent&&(qe.end=/\B|\b/),qe.end&&(rt.endRe=se(rt.end)),rt.terminatorEnd=g(rt.end)||"",qe.endsWithParent&&He.terminatorEnd&&(rt.terminatorEnd+=(qe.end?"|":"")+He.terminatorEnd)),qe.illegal&&(rt.illegalRe=se(qe.illegal)),qe.contains||(qe.contains=[]),qe.contains=[].concat(...qe.contains.map(function(Xt){return Ae(Xt==="self"?qe:Xt)})),qe.contains.forEach(function(Xt){Et(Xt,rt)}),qe.starts&&Et(qe.starts,He),rt.matcher=it(rt),rt}if(H.compilerExtensions||(H.compilerExtensions=[]),H.contains&&H.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return H.classNameAliases=n(H.classNameAliases||{}),Et(H)}function he(H){return H?H.endsWithParent||he(H.starts):!1}function Ae(H){return H.variants&&!H.cachedVariants&&(H.cachedVariants=H.variants.map(function(se){return n(H,{variants:null},se)})),H.cachedVariants?H.cachedVariants:he(H)?n(H,{starts:H.starts?n(H.starts):null}):Object.isFrozen(H)?n(H):H}var R="11.11.1";class ae extends Error{constructor(se,ge){super(se),this.name="HTMLInjectionError",this.html=ge}}const Te=s,_e=n,me=Symbol("nomatch"),je=7,ke=function(H){const se=Object.create(null),ge=Object.create(null),Pe=[];let it=!0;const Et="Could not find the language '{}', did you forget to load/include a language module?",qe={disableAutodetect:!0,name:"Plain text",contains:[]};let He={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:p};function rt(Oe){return He.noHighlightRe.test(Oe)}function cs(Oe){let et=Oe.className+" ";et+=Oe.parentNode?Oe.parentNode.className:"";const pt=He.languageDetectRe.exec(et);if(pt){const Tt=rn(pt[1]);return Tt||(Cs(Et.replace("{}",pt[1])),Cs("Falling back to no-highlight mode for this block.",Oe)),Tt?pt[1]:"no-highlight"}return et.split(/\s+/).find(Tt=>rt(Tt)||rn(Tt))}function Xt(Oe,et,pt){let Tt="",ds="";typeof et=="object"?(Tt=Oe,pt=et.ignoreIllegals,ds=et.language):(ls("10.7.0","highlight(lang, code, ...args) has been deprecated."),ls("10.7.0",`Please use highlight(code, options) instead.
|
|
114
|
+
https://github.com/highlightjs/highlight.js/issues/2277`),ds=Oe,Tt=et),pt===void 0&&(pt=!0);const Js={code:Tt,language:ds};Sa("before:highlight",Js);const Tn=Js.result?Js.result:er(Js.language,Js.code,pt);return Tn.code=Js.code,Sa("after:highlight",Tn),Tn}function er(Oe,et,pt,Tt){const ds=Object.create(null);function Js(Ie,Xe){return Ie.keywords[Xe]}function Tn(){if(!nt.keywords){xs.addText(Rt);return}let Ie=0;nt.keywordPatternRe.lastIndex=0;let Xe=nt.keywordPatternRe.exec(Rt),lt="";for(;Xe;){lt+=Rt.substring(Ie,Xe.index);const bt=Fs.case_insensitive?Xe[0].toLowerCase():Xe[0],Jt=Js(nt,bt);if(Jt){const[Yn,jl]=Jt;if(xs.addText(lt),lt="",ds[bt]=(ds[bt]||0)+1,ds[bt]<=je&&(Br+=jl),Yn.startsWith("_"))lt+=Xe[0];else{const Au=Fs.classNameAliases[Yn]||Yn;Rn(Xe[0],Au)}}else lt+=Xe[0];Ie=nt.keywordPatternRe.lastIndex,Xe=nt.keywordPatternRe.exec(Rt)}lt+=Rt.substring(Ie),xs.addText(lt)}function xn(){if(Rt==="")return;let Ie=null;if(typeof nt.subLanguage=="string"){if(!se[nt.subLanguage]){xs.addText(Rt);return}Ie=er(nt.subLanguage,Rt,!0,ju[nt.subLanguage]),ju[nt.subLanguage]=Ie._top}else Ie=po(Rt,nt.subLanguage.length?nt.subLanguage:null);nt.relevance>0&&(Br+=Ie.relevance),xs.__addSublanguage(Ie._emitter,Ie.language)}function Ut(){nt.subLanguage!=null?xn():Tn(),Rt=""}function Rn(Ie,Xe){Ie!==""&&(xs.startScope(Xe),xs.addText(Ie),xs.endScope())}function Cu(Ie,Xe){let lt=1;const bt=Xe.length-1;for(;lt<=bt;){if(!Ie._emit[lt]){lt++;continue}const Jt=Fs.classNameAliases[Ie[lt]]||Ie[lt],Yn=Xe[lt];Jt?Rn(Yn,Jt):(Rt=Yn,Tn(),Rt=""),lt++}}function xo(Ie,Xe){return Ie.scope&&typeof Ie.scope=="string"&&xs.openNode(Fs.classNameAliases[Ie.scope]||Ie.scope),Ie.beginScope&&(Ie.beginScope._wrap?(Rn(Rt,Fs.classNameAliases[Ie.beginScope._wrap]||Ie.beginScope._wrap),Rt=""):Ie.beginScope._multi&&(Cu(Ie.beginScope,Xe),Rt="")),nt=Object.create(Ie,{parent:{value:nt}}),nt}function Nl(Ie,Xe,lt){let bt=j(Ie.endRe,lt);if(bt){if(Ie["on:end"]){const Jt=new t(Ie);Ie["on:end"](Xe,Jt),Jt.isMatchIgnored&&(bt=!1)}if(bt){for(;Ie.endsParent&&Ie.parent;)Ie=Ie.parent;return Ie}}if(Ie.endsWithParent)return Nl(Ie.parent,Xe,lt)}function bo(Ie){return nt.matcher.regexIndex===0?(Rt+=Ie[0],1):(Pr=!0,0)}function Pf(Ie){const Xe=Ie[0],lt=Ie.rule,bt=new t(lt),Jt=[lt.__beforeBegin,lt["on:begin"]];for(const Yn of Jt)if(Yn&&(Yn(Ie,bt),bt.isMatchIgnored))return bo(Xe);return lt.skip?Rt+=Xe:(lt.excludeBegin&&(Rt+=Xe),Ut(),!lt.returnBegin&&!lt.excludeBegin&&(Rt=Xe)),xo(lt,Ie),lt.returnBegin?0:Xe.length}function bn(Ie){const Xe=Ie[0],lt=et.substring(Ie.index),bt=Nl(nt,Ie,lt);if(!bt)return me;const Jt=nt;nt.endScope&&nt.endScope._wrap?(Ut(),Rn(Xe,nt.endScope._wrap)):nt.endScope&&nt.endScope._multi?(Ut(),Cu(nt.endScope,Ie)):Jt.skip?Rt+=Xe:(Jt.returnEnd||Jt.excludeEnd||(Rt+=Xe),Ut(),Jt.excludeEnd&&(Rt=Xe));do nt.scope&&xs.closeNode(),!nt.skip&&!nt.subLanguage&&(Br+=nt.relevance),nt=nt.parent;while(nt!==bt.parent);return bt.starts&&xo(bt.starts,Ie),Jt.returnEnd?0:Xe.length}function Cl(){const Ie=[];for(let Xe=nt;Xe!==Fs;Xe=Xe.parent)Xe.scope&&Ie.unshift(Xe.scope);Ie.forEach(Xe=>xs.openNode(Xe))}let ka={};function vo(Ie,Xe){const lt=Xe&&Xe[0];if(Rt+=Ie,lt==null)return Ut(),0;if(ka.type==="begin"&&Xe.type==="end"&&ka.index===Xe.index&<===""){if(Rt+=et.slice(Xe.index,Xe.index+1),!it){const bt=new Error(`0 width match regex (${Oe})`);throw bt.languageName=Oe,bt.badRule=ka.rule,bt}return 1}if(ka=Xe,Xe.type==="begin")return Pf(Xe);if(Xe.type==="illegal"&&!pt){const bt=new Error('Illegal lexeme "'+lt+'" for mode "'+(nt.scope||"<unnamed>")+'"');throw bt.mode=nt,bt}else if(Xe.type==="end"){const bt=bn(Xe);if(bt!==me)return bt}if(Xe.type==="illegal"&<==="")return Rt+=`
|
|
115
|
+
`,1;if(El>1e5&&El>Xe.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Rt+=lt,lt.length}const Fs=rn(Oe);if(!Fs)throw It(Et.replace("{}",Oe)),new Error('Unknown language: "'+Oe+'"');const Eu=ye(Fs);let _o="",nt=Tt||Eu;const ju={},xs=new He.__emitter(He);Cl();let Rt="",Br=0,nr=0,El=0,Pr=!1;try{if(Fs.__emitTokens)Fs.__emitTokens(et,xs);else{for(nt.matcher.considerAll();;){El++,Pr?Pr=!1:nt.matcher.considerAll(),nt.matcher.lastIndex=nr;const Ie=nt.matcher.exec(et);if(!Ie)break;const Xe=et.substring(nr,Ie.index),lt=vo(Xe,Ie);nr=Ie.index+lt}vo(et.substring(nr))}return xs.finalize(),_o=xs.toHTML(),{language:Oe,value:_o,relevance:Br,illegal:!1,_emitter:xs,_top:nt}}catch(Ie){if(Ie.message&&Ie.message.includes("Illegal"))return{language:Oe,value:Te(et),illegal:!0,relevance:0,_illegalBy:{message:Ie.message,index:nr,context:et.slice(nr-100,nr+100),mode:Ie.mode,resultSoFar:_o},_emitter:xs};if(it)return{language:Oe,value:Te(et),illegal:!1,relevance:0,errorRaised:Ie,_emitter:xs,_top:nt};throw Ie}}function mo(Oe){const et={value:Te(Oe),illegal:!1,relevance:0,_top:qe,_emitter:new He.__emitter(He)};return et._emitter.addText(Oe),et}function po(Oe,et){et=et||He.languages||Object.keys(se);const pt=mo(Oe),Tt=et.filter(rn).filter(Lr).map(Ut=>er(Ut,Oe,!1));Tt.unshift(pt);const ds=Tt.sort((Ut,Rn)=>{if(Ut.relevance!==Rn.relevance)return Rn.relevance-Ut.relevance;if(Ut.language&&Rn.language){if(rn(Ut.language).supersetOf===Rn.language)return 1;if(rn(Rn.language).supersetOf===Ut.language)return-1}return 0}),[Js,Tn]=ds,xn=Js;return xn.secondBest=Tn,xn}function Di(Oe,et,pt){const Tt=et&&ge[et]||pt;Oe.classList.add("hljs"),Oe.classList.add(`language-${Tt}`)}function us(Oe){let et=null;const pt=cs(Oe);if(rt(pt))return;if(Sa("before:highlightElement",{el:Oe,language:pt}),Oe.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",Oe);return}if(Oe.children.length>0&&(He.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(Oe)),He.throwUnescapedHTML))throw new ae("One of your code blocks includes unescaped HTML.",Oe.innerHTML);et=Oe;const Tt=et.textContent,ds=pt?Xt(Tt,{language:pt,ignoreIllegals:!0}):po(Tt);Oe.innerHTML=ds.value,Oe.dataset.highlighted="yes",Di(Oe,pt,ds.language),Oe.result={language:ds.language,re:ds.relevance,relevance:ds.relevance},ds.secondBest&&(Oe.secondBest={language:ds.secondBest.language,relevance:ds.secondBest.relevance}),Sa("after:highlightElement",{el:Oe,result:ds,text:Tt})}function Qs(Oe){He=_e(He,Oe)}const Or=()=>{go(),ls("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Sl(){go(),ls("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Su=!1;function go(){function Oe(){go()}if(document.readyState==="loading"){Su||window.addEventListener("DOMContentLoaded",Oe,!1),Su=!0;return}document.querySelectorAll(He.cssSelector).forEach(us)}function ku(Oe,et){let pt=null;try{pt=et(H)}catch(Tt){if(It("Language definition for '{}' could not be registered.".replace("{}",Oe)),it)It(Tt);else throw Tt;pt=qe}pt.name||(pt.name=Oe),se[Oe]=pt,pt.rawDefinition=et.bind(null,H),pt.aliases&&tr(pt.aliases,{languageName:Oe})}function wa(Oe){delete se[Oe];for(const et of Object.keys(ge))ge[et]===Oe&&delete ge[et]}function kl(){return Object.keys(se)}function rn(Oe){return Oe=(Oe||"").toLowerCase(),se[Oe]||se[ge[Oe]]}function tr(Oe,{languageName:et}){typeof Oe=="string"&&(Oe=[Oe]),Oe.forEach(pt=>{ge[pt.toLowerCase()]=et})}function Lr(Oe){const et=rn(Oe);return et&&!et.disableAutodetect}function zr(Oe){Oe["before:highlightBlock"]&&!Oe["before:highlightElement"]&&(Oe["before:highlightElement"]=et=>{Oe["before:highlightBlock"](Object.assign({block:et.el},et))}),Oe["after:highlightBlock"]&&!Oe["after:highlightElement"]&&(Oe["after:highlightElement"]=et=>{Oe["after:highlightBlock"](Object.assign({block:et.el},et))})}function gs(Oe){zr(Oe),Pe.push(Oe)}function Nu(Oe){const et=Pe.indexOf(Oe);et!==-1&&Pe.splice(et,1)}function Sa(Oe,et){const pt=Oe;Pe.forEach(function(Tt){Tt[pt]&&Tt[pt](et)})}function sr(Oe){return ls("10.7.0","highlightBlock will be removed entirely in v12.0"),ls("10.7.0","Please use highlightElement now."),us(Oe)}Object.assign(H,{highlight:Xt,highlightAuto:po,highlightAll:go,highlightElement:us,highlightBlock:sr,configure:Qs,initHighlighting:Or,initHighlightingOnLoad:Sl,registerLanguage:ku,unregisterLanguage:wa,listLanguages:kl,getLanguage:rn,registerAliases:tr,autoDetection:Lr,inherit:_e,addPlugin:gs,removePlugin:Nu}),H.debugMode=function(){it=!1},H.safeMode=function(){it=!0},H.versionString=R,H.regex={concat:k,lookahead:x,either:C,optional:w,anyNumberOfTimes:v};for(const Oe in Je)typeof Je[Oe]=="object"&&e(Je[Oe]);return Object.assign(H,Je),H},Be=ke({});return Be.newInstance=()=>ke({}),Ig=Be,Be.HighlightJS=Be,Be.default=Be,Ig}var $g,Tk;function MK(){if(Tk)return $g;Tk=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 $g=e,$g}var Hg,Rk;function DK(){if(Rk)return Hg;Rk=1;function e(t){const s=t.regex,n={},o={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:s.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},o]});const l={className:"subst",begin:/\$\(/,end:/\)/,contains:[t.BACKSLASH_ESCAPE]},u=t.inherit(t.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),h={begin:/<<-?\s*(?=\w+)/,starts:{contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},f={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,n,l]};l.contains.push(f);const d={match:/\\"/},p={className:"string",begin:/'/,end:/'/},g={match:/\\'/},x={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},t.NUMBER_MODE,n]},v=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],w=t.SHEBANG({binary:`(${v.join("|")})`,relevance:10}),k={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[t.inherit(t.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},N=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],C=["true","false"],A={match:/(\/[a-z._-]+)+/},j=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],T=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],M=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],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:N,literal:C,built_in:[...j,...T,"set","shopt",...M,...O]},contains:[w,t.SHEBANG(),k,x,u,h,A,f,d,p,g,n]}}return Hg=e,Hg}var Ug,Mk;function OK(){if(Mk)return Ug;Mk=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*\\(",C={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},A=[x,f,n,t.C_BLOCK_COMMENT_MODE,g,p],j={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:C,contains:A.concat([{begin:/\(/,end:/\)/,keywords:C,contains:A.concat(["self"]),relevance:0}]),relevance:0},T={begin:"("+h+"[\\*&\\s]+)+"+w,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:C,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:o,keywords:C,relevance:0},{begin:w,returnBegin:!0,contains:[t.inherit(v,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:C,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,p,g,f,{begin:/\(/,end:/\)/,keywords:C,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:C,disableAutodetect:!0,illegal:"</",contains:[].concat(j,T,A,[x,{begin:t.IDENT_RE+"::",keywords:C},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},t.TITLE_MODE]}]),exports:{preprocessor:x,strings:p,keywords:C}}}return Ug=e,Ug}var Fg,Dk;function LK(){if(Dk)return Fg;Dk=1;function e(t){const s=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),o="decltype\\(auto\\)",l="[a-zA-Z_]\\w*::",h="(?!struct)("+o+"|"+s.optional(l)+"[a-zA-Z_]\\w*"+s.optional("<[^<>]+>")+")",f={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},p={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},g={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},x={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(p,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},v={className:"title",begin:s.optional(l)+t.IDENT_RE,relevance:0},w=s.optional(l)+t.IDENT_RE+"\\s*\\(",k=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],N=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],C=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],A=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],M={type:N,keyword:k,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:C},O={className:"function.dispatch",relevance:0,keywords:{_hint:A},begin:s.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,s.lookahead(/(<[^<>]+>|)\s*\(/))},$=[O,x,f,n,t.C_BLOCK_COMMENT_MODE,g,p],D={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:M,contains:$.concat([{begin:/\(/,end:/\)/,keywords:M,contains:$.concat(["self"]),relevance:0}]),relevance:0},P={className:"function",begin:"("+h+"[\\*&\\s]+)+"+w,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:M,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:o,keywords:M,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:M,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,p,g,f,{begin:/\(/,end:/\)/,keywords:M,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:M,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(D,P,O,$,[x,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:M,contains:["self",f]},{begin:t.IDENT_RE+"::",keywords:M},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}return Fg=e,Fg}var qg,Ok;function zK(){if(Ok)return qg;Ok=1;function e(t){const s=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],n=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],o=["default","false","null","true"],l=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],u=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],h={keyword:l.concat(u),built_in:s,literal:o},f=t.inherit(t.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),d={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},p={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},g={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},x=t.inherit(g,{illegal:/\n/}),v={className:"subst",begin:/\{/,end:/\}/,keywords:h},w=t.inherit(v,{illegal:/\n/}),k={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},t.BACKSLASH_ESCAPE,w]},N={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},v]},C=t.inherit(N,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},w]});v.contains=[N,k,g,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,d,t.C_BLOCK_COMMENT_MODE],w.contains=[C,k,x,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,d,t.inherit(t.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const A={variants:[p,N,k,g,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},j={begin:"<",end:">",contains:[{beginKeywords:"in out"},f]},T=t.IDENT_RE+"(<"+t.IDENT_RE+"(\\s*,\\s*"+t.IDENT_RE+")*>)?(\\[\\])?",M={begin:"@"+t.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:h,illegal:/::/,contains:[t.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:"<!--|-->"},{begin:"</?",end:">"}]}]}),t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},A,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:"("+T+"\\s+)+"+t.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:h,contains:[{beginKeywords:n.join(" "),relevance:0},{begin:t.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[t.TITLE_MODE,j],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,relevance:0,contains:[A,d,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},M]}}return qg=e,qg}var Vg,Lk;function BK(){if(Lk)return Vg;Lk=1;const e=d=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:d.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[d.APOS_STRING_MODE,d.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:d.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),t=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],s=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],n=[...t,...s],o=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),l=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),u=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),h=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function f(d){const p=d.regex,g=e(d),x={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},v="and or not only",w=/@-?\w[\w]*(-\w+)*/,k="[a-zA-Z-][a-zA-Z0-9_-]*",N=[d.APOS_STRING_MODE,d.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[g.BLOCK_COMMENT,x,g.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+k,relevance:0},g.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+l.join("|")+")"},{begin:":(:)?("+u.join("|")+")"}]},g.CSS_VARIABLE,{className:"attribute",begin:"\\b("+h.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[g.BLOCK_COMMENT,g.HEXCOLOR,g.IMPORTANT,g.CSS_NUMBER_MODE,...N,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...N,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},g.FUNCTION_DISPATCH]},{begin:p.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:w},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:v,attribute:o.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...N,g.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+n.join("|")+")\\b"}]}}return Vg=f,Vg}var Gg,zk;function PK(){if(zk)return Gg;zk=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(A=>{A.contains=A.contains.concat(w)}),w=w.concat(p,g),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:w},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:w}]}]},n,u,p,g,{className:"quote",begin:"^>\\s+",contains:w,end:"$"},l,o,d,h,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}return Gg=e,Gg}var Wg,Bk;function IK(){if(Bk)return Wg;Bk=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 Wg=e,Wg}var Kg,Pk;function $K(){if(Pk)return Kg;Pk=1;function e(t){const s=t.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",o=s.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),l=s.concat(o,/(::\w+)*/),h={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},f={className:"doctag",begin:"@[A-Za-z]+"},d={begin:"#<",end:">"},p=[t.COMMENT("#","$",{contains:[f]}),t.COMMENT("^=begin","^=end",{contains:[f],relevance:10}),t.COMMENT("^__END__",t.MATCH_NOTHING_RE)],g={className:"subst",begin:/#\{/,end:/\}/,keywords:h},x={className:"string",contains:[t.BACKSLASH_ESCAPE,g],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:s.concat(/<<[-~]?'?/,s.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[t.BACKSLASH_ESCAPE,g]})]}]},v="[1-9](_?[0-9])*|0",w="[0-9](_?[0-9])*",k={className:"number",relevance:0,variants:[{begin:`\\b(${v})(\\.(${w}))?([eE][+-]?(${w})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},N={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:h}]},$=[x,{variants:[{match:[/class\s+/,l,/\s+<\s+/,l]},{match:[/\b(class|module)\s+/,l]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:h},{match:[/(include|extend)\s+/,l],scope:{2:"title.class"},keywords:h},{relevance:0,match:[l,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:o,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[N]},{begin:t.IDENT_RE+"::"},{className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[x,{begin:n}],relevance:0},k,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:h},{begin:"("+t.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[t.BACKSLASH_ESCAPE,g],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(d,p),relevance:0}].concat(d,p);g.contains=$,N.contains=$;const G=[{begin:/^\s*=>/,starts:{end:"$",contains:$}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:h,contains:$}}];return p.unshift(d),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:h,illegal:/\/\*/,contains:[t.SHEBANG({binary:"ruby"})].concat(G).concat(p).concat($)}}return Kg=e,Kg}var Yg,Ik;function HK(){if(Ik)return Yg;Ik=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 Yg=e,Yg}var Xg,$k;function UK(){if($k)return Xg;$k=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 Xg=e,Xg}var Zg,Hk;function FK(){if(Hk)return Zg;Hk=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 Zg=e,Zg}var Qg,Uk;function qK(){if(Uk)return Qg;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(u,h,f){return f===-1?"":u.replace(h,d=>o(u,h,f-1))}function l(u){const h=u.regex,f="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",d=f+o("(?:<"+f+"~~~(?:\\s*,\\s*"+f+"~~~)*>)?",/~~~/g,2),w={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},k={className:"meta",begin:"@"+f,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},N={className:"params",begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:[u.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:w,illegal:/<\/|#/,contains:[u.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},u.C_LINE_COMMENT_MODE,u.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[u.BACKSLASH_ESCAPE]},u.APOS_STRING_MODE,u.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,f],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[h.concat(/(?!else)/,f),/\s+/,f,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,f],className:{1:"keyword",3:"title.class"},contains:[N,u.C_LINE_COMMENT_MODE,u.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+d+"\\s+)",u.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:w,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:[k,u.APOS_STRING_MODE,u.QUOTE_STRING_MODE,n,u.C_BLOCK_COMMENT_MODE]},u.C_LINE_COMMENT_MODE,u.C_BLOCK_COMMENT_MODE]},n,k]}}return Qg=l,Qg}var Jg,Fk;function VK(){if(Fk)return Jg;Fk=1;const e="[A-Za-z$_][0-9A-Za-z$_]*",t=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],s=["true","false","null","undefined","NaN","Infinity"],n=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],o=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],l=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],u=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],h=[].concat(l,n,o);function f(d){const p=d.regex,g=(Se,{after:Re})=>{const De="</"+Se[0].slice(1);return Se.input.indexOf(De,Re)!==-1},x=e,v={begin:"<>",end:"</>"},w=/<[A-Za-z0-9\\._:-]+\s*\/>/,k={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(Se,Re)=>{const De=Se[0].length+Se.index,Je=Se.input[De];if(Je==="<"||Je===","){Re.ignoreMatch();return}Je===">"&&(g(Se,{after:De})||Re.ignoreMatch());let Ne;const Ue=Se.input.substring(De);if(Ne=Ue.match(/^\s*=/)){Re.ignoreMatch();return}if((Ne=Ue.match(/^\s+extends\s+/))&&Ne.index===0){Re.ignoreMatch();return}}},N={$pattern:e,keyword:t,literal:s,built_in:h,"variable.language":u},C="[0-9](_?[0-9])*",A=`\\.(${C})`,j="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",T={className:"number",variants:[{begin:`(\\b(${j})((${A})|\\.)?|(${A}))[eE][+-]?(${C})\\b`},{begin:`\\b(${j})\\b((${A})\\b|\\.)?|(${A})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},M={className:"subst",begin:"\\$\\{",end:"\\}",keywords:N,contains:[]},O={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[d.BACKSLASH_ESCAPE,M],subLanguage:"xml"}},$={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[d.BACKSLASH_ESCAPE,M],subLanguage:"css"}},D={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[d.BACKSLASH_ESCAPE,M],subLanguage:"graphql"}},P={className:"string",begin:"`",end:"`",contains:[d.BACKSLASH_ESCAPE,M]},G={className:"comment",variants:[d.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:x+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),d.C_BLOCK_COMMENT_MODE,d.C_LINE_COMMENT_MODE]},F=[d.APOS_STRING_MODE,d.QUOTE_STRING_MODE,O,$,D,P,{match:/\$\d+/},T];M.contains=F.concat({begin:/\{/,end:/\}/,keywords:N,contains:["self"].concat(F)});const z=[].concat(G,M.contains),U=z.concat([{begin:/(\s*)\(/,end:/\)/,keywords:N,contains:["self"].concat(z)}]),K={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:N,contains:U},I={variants:[{match:[/class/,/\s+/,x,/\s+/,/extends/,/\s+/,p.concat(x,"(",p.concat(/\./,x),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,x],scope:{1:"keyword",3:"title.class"}}]},Z={relevance:0,match:p.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...n,...o]}},W={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},te={variants:[{match:[/function/,/\s+/,x,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[K],illegal:/%/},X={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function V(Se){return p.concat("(?!",Se.join("|"),")")}const q={match:p.concat(/\b/,V([...l,"super","import"].map(Se=>`${Se}\\s*\\(`)),x,p.lookahead(/\s*\(/)),className:"title.function",relevance:0},oe={begin:p.concat(/\./,p.lookahead(p.concat(x,/(?![0-9A-Za-z$_(])/))),end:x,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},ee={match:[/get|set/,/\s+/,x,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},K]},fe="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+d.UNDERSCORE_IDENT_RE+")\\s*=>",ie={match:[/const|var|let/,/\s+/,x,/\s*/,/=\s*/,/(async\s*)?/,p.lookahead(fe)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[K]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:N,exports:{PARAMS_CONTAINS:U,CLASS_REFERENCE:Z},illegal:/#(?![$_A-z])/,contains:[d.SHEBANG({label:"shebang",binary:"node",relevance:5}),W,d.APOS_STRING_MODE,d.QUOTE_STRING_MODE,O,$,D,P,G,{match:/\$\d+/},T,Z,{scope:"attr",match:x+p.lookahead(":"),relevance:0},ie,{begin:"("+d.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[G,d.REGEXP_MODE,{className:"function",begin:fe,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:d.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:N,contains:U}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:v.begin,end:v.end},{match:w},{begin:k.begin,"on:begin":k.isTrulyOpeningTag,end:k.end}],subLanguage:"xml",contains:[{begin:k.begin,end:k.end,skip:!0,contains:["self"]}]}]},te,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+d.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[K,d.inherit(d.TITLE_MODE,{begin:x,className:"title.function"})]},{match:/\.\.\./,relevance:0},oe,{match:"\\$"+x,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[K]},q,X,I,ee,{match:/\$[(.]/}]}}return Jg=f,Jg}var ex,qk;function GK(){if(qk)return ex;qk=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 ex=e,ex}var tx,Vk;function WK(){if(Vk)return tx;Vk=1;var e="[0-9](_*[0-9])*",t=`\\.(${e})`,s="[0-9a-fA-F](_*[0-9a-fA-F])*",n={className:"number",variants:[{begin:`(\\b(${e})((${t})|\\.)?|(${t}))[eE][+-]?(${e})[fFdD]?\\b`},{begin:`\\b(${e})((${t})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${t})[fFdD]?\\b`},{begin:`\\b(${e})[fFdD]\\b`},{begin:`\\b0[xX]((${s})\\.?|(${s})?\\.(${s}))[pP][+-]?(${e})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${s})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function o(l){const u={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},h={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},f={className:"symbol",begin:l.UNDERSCORE_IDENT_RE+"@"},d={className:"subst",begin:/\$\{/,end:/\}/,contains:[l.C_NUMBER_MODE]},p={className:"variable",begin:"\\$"+l.UNDERSCORE_IDENT_RE},g={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[p,d]},{begin:"'",end:"'",illegal:/\n/,contains:[l.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[l.BACKSLASH_ESCAPE,p,d]}]};d.contains.push(g);const x={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+l.UNDERSCORE_IDENT_RE+")?"},v={className:"meta",begin:"@"+l.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[l.inherit(g,{className:"string"}),"self"]}]},w=n,k=l.COMMENT("/\\*","\\*/",{contains:[l.C_BLOCK_COMMENT_MODE]}),N={variants:[{className:"type",begin:l.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},C=N;return C.variants[1].contains=[N],N.variants[1].contains=[C],{name:"Kotlin",aliases:["kt","kts"],keywords:u,contains:[l.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),l.C_LINE_COMMENT_MODE,k,h,f,x,v,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:u,relevance:5,contains:[{begin:l.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[l.UNDERSCORE_TITLE_MODE]},{className:"type",begin:/</,end:/>/,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:u,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[N,l.C_LINE_COMMENT_MODE,k],relevance:0},l.C_LINE_COMMENT_MODE,k,x,v,g,l.C_NUMBER_MODE]},k]},{begin:[/class|interface|trait/,/\s+/,l.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},l.UNDERSCORE_TITLE_MODE,{className:"type",begin:/</,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},x,v]},g,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:`
|
|
116
|
+
`},w]}}return tx=o,tx}var sx,Gk;function KK(){if(Gk)return sx;Gk=1;const e=p=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:p.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[p.APOS_STRING_MODE,p.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:p.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),t=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],s=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],n=[...t,...s],o=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),l=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),u=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),h=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),f=l.concat(u).sort().reverse();function d(p){const g=e(p),x=f,v="and or not only",w="[\\w-]+",k="("+w+"|@\\{"+w+"\\})",N=[],C=[],A=function(z){return{className:"string",begin:"~?"+z+".*?"+z}},j=function(z,U,K){return{className:z,begin:U,relevance:K}},T={$pattern:/[a-z-]+/,keyword:v,attribute:o.join(" ")},M={begin:"\\(",end:"\\)",contains:C,keywords:T,relevance:0};C.push(p.C_LINE_COMMENT_MODE,p.C_BLOCK_COMMENT_MODE,A("'"),A('"'),g.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},g.HEXCOLOR,M,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=C.concat({begin:/\{/,end:/\}/,contains:N}),$={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(C)},D={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:C}}]},P={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:T,returnEnd:!0,contains:C,relevance:0}},B={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,$,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]},F={begin:w+`:(:)?(${x.join("|")})`,returnBegin:!0,contains:[G]};return N.push(p.C_LINE_COMMENT_MODE,p.C_BLOCK_COMMENT_MODE,P,B,F,D,G,$,g.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:N}}return sx=d,sx}var nx,Wk;function YK(){if(Wk)return nx;Wk=1;function e(t){const s="\\[=*\\[",n="\\]=*\\]",o={begin:s,end:n,contains:["self"]},l=[t.COMMENT("--(?!"+s+")","$"),t.COMMENT("--"+s,n,{contains:[o],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:t.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:l.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[t.inherit(t.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:l}].concat(l)},t.C_NUMBER_MODE,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{className:"string",begin:s,end:n,contains:[o],relevance:5}])}}return nx=e,nx}var ix,Kk;function XK(){if(Kk)return ix;Kk=1;function e(t){const s={className:"variable",variants:[{begin:"\\$\\("+t.UNDERSCORE_IDENT_RE+"\\)",contains:[t.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},n={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,s]},o={className:"variable",begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:"subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value"},contains:[s,n]},l={begin:"^"+t.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},u={className:"meta",begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},h={className:"section",begin:/^[^\s]+:/,end:/$/,contains:[s]};return{name:"Makefile",aliases:["mk","mak","make"],keywords:{$pattern:/[\w-]+/,keyword:"define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath"},contains:[t.HASH_COMMENT_MODE,s,n,o,l,u,h]}}return ix=e,ix}var rx,Yk;function ZK(){if(Yk)return rx;Yk=1;function e(t){const s=t.regex,n=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],o=/[dualxmsipngr]{0,12}/,l={$pattern:/[\w.]+/,keyword:n.join(" ")},u={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:l},h={begin:/->\{/,end:/\}/},f={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},d={scope:"variable",variants:[{begin:/\$\d/},{begin:s.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[f]},p={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},g=[t.BACKSLASH_ESCAPE,u,d],x=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],v=(N,C,A="\\1")=>{const j=A==="\\1"?A:s.concat(A,C);return s.concat(s.concat("(?:",N,")"),C,/(?:\\.|[^\\\/])*?/,j,/(?:\\.|[^\\\/])*?/,A,o)},w=(N,C,A)=>s.concat(s.concat("(?:",N,")"),C,/(?:\\.|[^\\\/])*?/,A,o),k=[d,t.HASH_COMMENT_MODE,t.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),h,{className:"string",contains:g,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},p,{begin:"(\\/\\/|"+t.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[t.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:v("s|tr|y",s.either(...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 rx=e,rx}var ax,Xk;function QK(){if(Xk)return ax;Xk=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 ax=e,ax}var ox,Zk;function JK(){if(Zk)return ox;Zk=1;function e(t){const s=t.regex,n=/(?![A-Za-z0-9])(?![$])/,o=s.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),l=s.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),u=s.concat(/[A-Z]+/,n),h={scope:"variable",match:"\\$+"+o},f={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},d={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},p=t.inherit(t.APOS_STRING_MODE,{illegal:null}),g=t.inherit(t.QUOTE_STRING_MODE,{illegal:null,contains:t.QUOTE_STRING_MODE.contains.concat(d)}),x={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:t.QUOTE_STRING_MODE.contains.concat(d),"on:begin":(K,I)=>{I.data._beginMatch=K[1]||K[2]},"on:end":(K,I)=>{I.data._beginMatch!==K[1]&&I.ignoreMatch()}},v=t.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),w=`[
|
|
117
|
+
]`,k={scope:"string",variants:[g,p,x,v]},N={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},C=["false","null","true"],A=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],j=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],M={keyword:A,literal:(K=>{const I=[];return K.forEach(Z=>{I.push(Z),Z.toLowerCase()===Z?I.push(Z.toUpperCase()):I.push(Z.toLowerCase())}),I})(C),built_in:j},O=K=>K.map(I=>I.replace(/\|\d+$/,"")),$={variants:[{match:[/new/,s.concat(w,"+"),s.concat("(?!",O(j).join("\\b|"),"\\b)"),l],scope:{1:"keyword",4:"title.class"}}]},D=s.concat(o,"\\b(?!\\()"),P={variants:[{match:[s.concat(/::/,s.lookahead(/(?!class\b)/)),D],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[l,s.concat(/::/,s.lookahead(/(?!class\b)/)),D],scope:{1:"title.class",3:"variable.constant"}},{match:[l,s.concat("::",s.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[l,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},B={scope:"attr",match:s.concat(o,s.lookahead(":"),s.lookahead(/(?!::)/))},G={relevance:0,begin:/\(/,end:/\)/,keywords:M,contains:[B,h,P,t.C_BLOCK_COMMENT_MODE,k,N,$]},F={relevance:0,match:[/\b/,s.concat("(?!fn\\b|function\\b|",O(A).join("\\b|"),"|",O(j).join("\\b|"),"\\b)"),o,s.concat(w,"*"),s.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[G]};G.contains.push(F);const z=[B,P,t.C_BLOCK_COMMENT_MODE,k,N,$],U={begin:s.concat(/#\[\s*\\?/,s.either(l,u)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:C,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:C,keyword:["new","array"]},contains:["self",...z]},...z,{scope:"meta",variants:[{match:l},{match:u}]}]};return{case_insensitive:!1,keywords:M,contains:[U,t.HASH_COMMENT_MODE,t.COMMENT("//","$"),t.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:t.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},f,{scope:"variable.language",match:/\$this\b/},h,F,P,{match:[/const/,/\s/,o],scope:{1:"keyword",3:"variable.constant"}},$,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},t.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:M,contains:["self",U,h,P,t.C_BLOCK_COMMENT_MODE,k,N]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},t.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[t.inherit(t.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},t.UNDERSCORE_TITLE_MODE]},k,N]}}return ox=e,ox}var lx,Qk;function eY(){if(Qk)return lx;Qk=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 lx=e,lx}var cx,Jk;function tY(){if(Jk)return cx;Jk=1;function e(t){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}return cx=e,cx}var ux,eN;function sY(){if(eN)return ux;eN=1;function e(t){const s=t.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),o=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],f={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:o,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},d={className:"meta",begin:/^(>>>|\.\.\.) /},p={className:"subst",begin:/\{/,end:/\}/,keywords:f,illegal:/#/},g={begin:/\{\{/,relevance:0},x={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,d],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,d],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,d,g,p]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,d,g,p]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[t.BACKSLASH_ESCAPE,g,p]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,g,p]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},v="[0-9](_?[0-9])*",w=`(\\b(${v}))?\\.(${v})|\\b(${v})\\.`,k=`\\b|${o.join("|")}`,N={className:"number",relevance:0,variants:[{begin:`(\\b(${v})|(${w}))[eE][+-]?(${v})[jJ]?(?=${k})`},{begin:`(${w})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${k})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${k})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${k})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${k})`},{begin:`\\b(${v})[jJ](?=${k})`}]},C={className:"comment",begin:s.lookahead(/# type:/),end:/$/,keywords:f,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},A={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:f,contains:["self",d,N,x,t.HASH_COMMENT_MODE]}]};return p.contains=[x,N,d],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:f,illegal:/(<\/|\?)|=>/,contains:[d,N,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},x,C,t.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[A]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[N,A,x]}]}}return ux=e,ux}var dx,tN;function nY(){if(tN)return dx;tN=1;function e(t){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}return dx=e,dx}var hx,sN;function iY(){if(sN)return hx;sN=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 hx=e,hx}var fx,nN;function rY(){if(nN)return fx;nN=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 fx=e,fx}var mx,iN;function aY(){if(iN)return mx;iN=1;const e=d=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:d.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[d.APOS_STRING_MODE,d.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:d.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),t=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],s=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],n=[...t,...s],o=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),l=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),u=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),h=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function f(d){const p=e(d),g=u,x=l,v="@[a-z-]+",w="and or not only",N={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[d.C_LINE_COMMENT_MODE,d.C_BLOCK_COMMENT_MODE,p.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},p.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+n.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+x.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+g.join("|")+")"},N,{begin:/\(/,end:/\)/,contains:[p.CSS_NUMBER_MODE]},p.CSS_VARIABLE,{className:"attribute",begin:"\\b("+h.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[p.BLOCK_COMMENT,N,p.HEXCOLOR,p.CSS_NUMBER_MODE,d.QUOTE_STRING_MODE,d.APOS_STRING_MODE,p.IMPORTANT,p.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:v,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:w,attribute:o.join(" ")},contains:[{begin:v,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},N,d.QUOTE_STRING_MODE,d.APOS_STRING_MODE,p.HEXCOLOR,p.CSS_NUMBER_MODE]},p.FUNCTION_DISPATCH]}}return mx=f,mx}var px,rN;function oY(){if(rN)return px;rN=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 px=e,px}var gx,aN;function lY(){if(aN)return gx;aN=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)),N={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},C={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},A={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($=>$.replace(/\s+/,"\\s+"))),/\b/)}const T={scope:"keyword",match:j(v),relevance:0};function M(O,{exceptions:$,when:D}={}){const P=D;return $=$||[],O.map(B=>B.match(/\|\d+$/)||$.includes(B)?B:P(B)?`${B}|0`:B)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:M(k,{when:O=>O.length<3}),literal:u,type:f,built_in:x},contains:[{scope:"type",match:j(h)},T,A,N,o,l,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,n,C]}}return gx=e,gx}var xx,oN;function cY(){if(oN)return xx;oN=1;function e(D){return D?typeof D=="string"?D:D.source:null}function t(D){return s("(?=",D,")")}function s(...D){return D.map(B=>e(B)).join("")}function n(D){const P=D[D.length-1];return typeof P=="object"&&P.constructor===Object?(D.splice(D.length-1,1),P):{}}function o(...D){return"("+(n(D).capture?"":"?:")+D.map(G=>e(G)).join("|")+")"}const l=D=>s(/\b/,D,/\w$/.test(D)?/\b/:/\B/),u=["Protocol","Type"].map(l),h=["init","self"].map(l),f=["Any","Self"],d=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],p=["false","nil","true"],g=["assignment","associativity","higherThan","left","lowerThan","none","right"],x=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],v=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],w=o(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),k=o(w,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),N=s(w,k,"*"),C=o(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),A=o(C,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),j=s(C,A,"*"),T=s(/[A-Z]/,A,"*"),M=["attached","autoclosure",s(/convention\(/,o("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",s(/objc\(/,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 $(D){const P={match:/\s+/,relevance:0},B=D.COMMENT("/\\*","\\*/",{contains:["self"]}),G=[D.C_LINE_COMMENT_MODE,B],F={match:[/\./,o(...u,...h)],className:{2:"keyword"}},z={match:s(/\./,o(...d)),relevance:0},U=d.filter(me=>typeof me=="string").concat(["_|0"]),K=d.filter(me=>typeof me!="string").concat(f).map(l),I={variants:[{className:"keyword",match:o(...K,...h)}]},Z={$pattern:o(/\b\w+/,/#\w+/),keyword:U.concat(x),literal:p},W=[F,z,I],te={match:s(/\./,o(...v)),relevance:0},X={className:"built_in",match:s(/\b/,o(...v),/(?=\()/)},V=[te,X],q={match:/->/,relevance:0},oe={className:"operator",relevance:0,variants:[{match:N},{match:`\\.(\\.|${k})+`}]},ee=[q,oe],fe="([0-9]_*)+",ie="([0-9a-fA-F]_*)+",Se={className:"number",relevance:0,variants:[{match:`\\b(${fe})(\\.(${fe}))?([eE][+-]?(${fe}))?\\b`},{match:`\\b0x(${ie})(\\.(${ie}))?([pP][+-]?(${fe}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},Re=(me="")=>({className:"subst",variants:[{match:s(/\\/,me,/[0\\tnr"']/)},{match:s(/\\/,me,/u\{[0-9a-fA-F]{1,8}\}/)}]}),De=(me="")=>({className:"subst",match:s(/\\/,me,/[\t ]*(?:[\r\n]|\r\n)/)}),Je=(me="")=>({className:"subst",label:"interpol",begin:s(/\\/,me,/\(/),end:/\)/}),Ne=(me="")=>({begin:s(me,/"""/),end:s(/"""/,me),contains:[Re(me),De(me),Je(me)]}),Ue=(me="")=>({begin:s(me,/"/),end:s(/"/,me),contains:[Re(me),Je(me)]}),$e={className:"string",variants:[Ne(),Ne("#"),Ne("##"),Ne("###"),Ue(),Ue("#"),Ue("##"),Ue("###")]},St=[D.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[D.BACKSLASH_ESCAPE]}],Ds={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:St},Os=me=>{const je=s(me,/\//),ke=s(/\//,me);return{begin:je,end:ke,contains:[...St,{scope:"comment",begin:`#(?!.*${ke})`,end:/$/}]}},vi={scope:"regexp",variants:[Os("###"),Os("##"),Os("#"),Ds]},Kn={match:s(/`/,j,/`/)},Us={className:"variable",match:/\$\d+/},jn={className:"variable",match:`\\$${A}+`},An=[Kn,Us,jn],Ri={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:O,contains:[...ee,Se,$e]}]}},_i={scope:"keyword",match:s(/@/,o(...M),t(o(/\(/,/\s+/)))},It={scope:"meta",match:s(/@/,j)},Cs=[Ri,_i,It],ls={match:t(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:s(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,A,"+")},{className:"type",match:T,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:s(/\s+&\s+/,t(T)),relevance:0}]},pn={begin:/</,end:/>/,keywords:Z,contains:[...G,...W,...Cs,q,ls]};ls.contains.push(pn);const gn={match:s(j,/\s*:/),keywords:"_|0",relevance:0},Mi={begin:/\(/,end:/\)/,relevance:0,keywords:Z,contains:["self",gn,...G,vi,...W,...V,...ee,Se,$e,...An,...Cs,ls]},S={begin:/</,end:/>/,keywords:"repeat each",contains:[...G,ls]},re={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}]},xe={begin:/\(/,end:/\)/,keywords:Z,contains:[re,...G,...W,...ee,Se,$e,...Cs,ls,Mi],endsParent:!0,illegal:/["']/},ye={match:[/(func|macro)/,/\s+/,o(Kn.match,j,N)],className:{1:"keyword",3:"title.function"},contains:[S,xe,P],illegal:[/\[/,/%/]},he={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[S,xe,P],illegal:/\[|%/},Ae={match:[/operator/,/\s+/,N],className:{1:"keyword",3:"title"}},R={begin:[/precedencegroup/,/\s+/,T],className:{1:"keyword",3:"title"},contains:[ls],keywords:[...g,...p],end:/}/},ae={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Te={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},_e={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,j,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:Z,contains:[S,...W,{begin:/:/,end:/\{/,keywords:Z,contains:[{scope:"title.class.inherited",match:T},...W],relevance:0}]};for(const me of $e.variants){const je=me.contains.find(Be=>Be.label==="interpol");je.keywords=Z;const ke=[...W,...V,...ee,Se,$e,...An];je.contains=[...ke,{begin:/\(/,end:/\)/,contains:["self",...ke]}]}return{name:"Swift",keywords:Z,contains:[...G,ye,he,ae,Te,_e,Ae,R,{beginKeywords:"import",end:/$/,contains:[...G],relevance:0},vi,...W,...V,...ee,Se,$e,...An,...Cs,ls,Mi]}}return xx=$,xx}var bx,lN;function uY(){if(lN)return bx;lN=1;function e(t){const s="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",o={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},l={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},u={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},h={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[t.BACKSLASH_ESCAPE,l]},f=t.inherit(h,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),v={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},w={end:",",endsWithParent:!0,excludeEnd:!0,keywords:s,relevance:0},k={begin:/\{/,end:/\}/,contains:[w],illegal:"\\n",relevance:0},N={begin:"\\[",end:"\\]",contains:[w],illegal:"\\n",relevance:0},C=[o,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+t.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+t.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},t.HASH_COMMENT_MODE,{beginKeywords:s,keywords:{literal:s}},v,{className:"number",begin:t.C_NUMBER_RE+"\\b",relevance:0},k,N,u,h],A=[...C];return A.pop(),A.push(f),w.contains=A,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:C}}return bx=e,bx}var vx,cN;function dY(){if(cN)return vx;cN=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=(Re,{after:De})=>{const Je="</"+Re[0].slice(1);return Re.input.indexOf(Je,De)!==-1},v=e,w={begin:"<>",end:"</>"},k=/<[A-Za-z0-9\\._:-]+\s*\/>/,N={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(Re,De)=>{const Je=Re[0].length+Re.index,Ne=Re.input[Je];if(Ne==="<"||Ne===","){De.ignoreMatch();return}Ne===">"&&(x(Re,{after:Je})||De.ignoreMatch());let Ue;const $e=Re.input.substring(Je);if(Ue=$e.match(/^\s*=/)){De.ignoreMatch();return}if((Ue=$e.match(/^\s+extends\s+/))&&Ue.index===0){De.ignoreMatch();return}}},C={$pattern:e,keyword:t,literal:s,built_in:h,"variable.language":u},A="[0-9](_?[0-9])*",j=`\\.(${A})`,T="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",M={className:"number",variants:[{begin:`(\\b(${T})((${j})|\\.)?|(${j}))[eE][+-]?(${A})\\b`},{begin:`\\b(${T})\\b((${j})\\b|\\.)?|(${j})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},O={className:"subst",begin:"\\$\\{",end:"\\}",keywords:C,contains:[]},$={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[p.BACKSLASH_ESCAPE,O],subLanguage:"xml"}},D={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[p.BACKSLASH_ESCAPE,O],subLanguage:"css"}},P={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[p.BACKSLASH_ESCAPE,O],subLanguage:"graphql"}},B={className:"string",begin:"`",end:"`",contains:[p.BACKSLASH_ESCAPE,O]},F={className:"comment",variants:[p.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:v+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),p.C_BLOCK_COMMENT_MODE,p.C_LINE_COMMENT_MODE]},z=[p.APOS_STRING_MODE,p.QUOTE_STRING_MODE,$,D,P,B,{match:/\$\d+/},M];O.contains=z.concat({begin:/\{/,end:/\}/,keywords:C,contains:["self"].concat(z)});const U=[].concat(F,O.contains),K=U.concat([{begin:/(\s*)\(/,end:/\)/,keywords:C,contains:["self"].concat(U)}]),I={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:C,contains:K},Z={variants:[{match:[/class/,/\s+/,v,/\s+/,/extends/,/\s+/,g.concat(v,"(",g.concat(/\./,v),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,v],scope:{1:"keyword",3:"title.class"}}]},W={relevance:0,match:g.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...n,...o]}},te={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},X={variants:[{match:[/function/,/\s+/,v,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[I],illegal:/%/},V={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function q(Re){return g.concat("(?!",Re.join("|"),")")}const oe={match:g.concat(/\b/,q([...l,"super","import"].map(Re=>`${Re}\\s*\\(`)),v,g.lookahead(/\s*\(/)),className:"title.function",relevance:0},ee={begin:g.concat(/\./,g.lookahead(g.concat(v,/(?![0-9A-Za-z$_(])/))),end:v,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},fe={match:[/get|set/,/\s+/,v,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},I]},ie="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+p.UNDERSCORE_IDENT_RE+")\\s*=>",Se={match:[/const|var|let/,/\s+/,v,/\s*/,/=\s*/,/(async\s*)?/,g.lookahead(ie)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[I]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:C,exports:{PARAMS_CONTAINS:K,CLASS_REFERENCE:W},illegal:/#(?![$_A-z])/,contains:[p.SHEBANG({label:"shebang",binary:"node",relevance:5}),te,p.APOS_STRING_MODE,p.QUOTE_STRING_MODE,$,D,P,B,F,{match:/\$\d+/},M,W,{scope:"attr",match:v+g.lookahead(":"),relevance:0},Se,{begin:"("+p.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[F,p.REGEXP_MODE,{className:"function",begin:ie,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:p.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:C,contains:K}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:w.begin,end:w.end},{match:k},{begin:N.begin,"on:begin":N.isTrulyOpeningTag,end:N.end}],subLanguage:"xml",contains:[{begin:N.begin,end:N.end,skip:!0,contains:["self"]}]}]},X,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+p.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[I,p.inherit(p.TITLE_MODE,{begin:v,className:"title.function"})]},{match:/\.\.\./,relevance:0},ee,{match:"\\$"+v,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[I]},oe,V,Z,fe,{match:/\$[(.]/}]}}function d(p){const g=p.regex,x=f(p),v=e,w=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],k={begin:[/namespace/,/\s+/,p.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},N={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:w},contains:[x.exports.CLASS_REFERENCE]},C={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},A=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],j={$pattern:e,keyword:t.concat(A),literal:s,built_in:h.concat(w),"variable.language":u},T={className:"meta",begin:"@"+v},M=(P,B,G)=>{const F=P.contains.findIndex(z=>z.label===B);if(F===-1)throw new Error("can not find mode to replace");P.contains.splice(F,1,G)};Object.assign(x.keywords,j),x.exports.PARAMS_CONTAINS.push(T);const O=x.contains.find(P=>P.scope==="attr"),$=Object.assign({},O,{match:g.concat(v,g.lookahead(/\s*\?:/))});x.exports.PARAMS_CONTAINS.push([x.exports.CLASS_REFERENCE,O,$]),x.contains=x.contains.concat([T,k,N,$]),M(x,"shebang",p.SHEBANG()),M(x,"use_strict",C);const D=x.contains.find(P=>P.label==="func.def");return D.relevance=0,Object.assign(x,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),x}return vx=d,vx}var _x,uN;function hY(){if(uN)return _x;uN=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 _x=e,_x}var yx,dN;function fY(){if(dN)return yx;dN=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 yx=e,yx}var wx,hN;function mY(){if(hN)return wx;hN=1;var e=RK();return e.registerLanguage("xml",MK()),e.registerLanguage("bash",DK()),e.registerLanguage("c",OK()),e.registerLanguage("cpp",LK()),e.registerLanguage("csharp",zK()),e.registerLanguage("css",BK()),e.registerLanguage("markdown",PK()),e.registerLanguage("diff",IK()),e.registerLanguage("ruby",$K()),e.registerLanguage("go",HK()),e.registerLanguage("graphql",UK()),e.registerLanguage("ini",FK()),e.registerLanguage("java",qK()),e.registerLanguage("javascript",VK()),e.registerLanguage("json",GK()),e.registerLanguage("kotlin",WK()),e.registerLanguage("less",KK()),e.registerLanguage("lua",YK()),e.registerLanguage("makefile",XK()),e.registerLanguage("perl",ZK()),e.registerLanguage("objectivec",QK()),e.registerLanguage("php",JK()),e.registerLanguage("php-template",eY()),e.registerLanguage("plaintext",tY()),e.registerLanguage("python",sY()),e.registerLanguage("python-repl",nY()),e.registerLanguage("r",iY()),e.registerLanguage("rust",rY()),e.registerLanguage("scss",aY()),e.registerLanguage("shell",oY()),e.registerLanguage("sql",lY()),e.registerLanguage("swift",cY()),e.registerLanguage("yaml",uY()),e.registerLanguage("typescript",dY()),e.registerLanguage("vbnet",hY()),e.registerLanguage("wasm",fY()),e.HighlightJS=e,e.default=e,wx=e,wx}var pY=mY();const P0=n4(pY);function ev(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var fo=ev();function n5(e){fo=e}var Ka={exec:()=>null};function Jo(e){let t=[];return s=>{let n=Math.max(0,Math.min(3,s-1)),o=t[n];return o||(o=e(n),t[n]=o),o}}function wt(e,t=""){let s=typeof e=="string"?e:e.source,n={replace:(o,l)=>{let u=typeof l=="string"?l:l.source;return u=u.replace(nn.caret,"$1"),s=s.replace(o,u),n},getRegex:()=>new RegExp(s,t)};return n}var gY=((e="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+e)}catch{return!1}})(),nn={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:Jo(e=>new RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Jo(e=>new RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Jo(e=>new RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Jo(e=>new RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Jo(e=>new RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:Jo(e=>new RegExp(`^ {0,${e}}>`))},xY=/^(?:[ \t]*(?:\n|$))+/,bY=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,vY=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,_u=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,_Y=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,tv=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,i5=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,r5=wt(i5).replace(/bull/g,tv).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(),yY=wt(i5).replace(/bull/g,tv).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(),sv=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,wY=/^[^\n]+/,nv=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,SY=wt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",nv).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),kY=wt(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,tv).getRegex(),Lf="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",iv=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,NY=wt("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",iv).replace("tag",Lf).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),a5=wt(sv).replace("hr",_u).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Lf).getRegex(),CY=wt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",a5).getRegex(),rv={blockquote:CY,code:bY,def:SY,fences:vY,heading:_Y,hr:_u,html:NY,lheading:r5,list:kY,newline:xY,paragraph:a5,table:Ka,text:wY},fN=wt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",_u).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Lf).getRegex(),EY={...rv,lheading:yY,table:fN,paragraph:wt(sv).replace("hr",_u).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",fN).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",Lf).getRegex()},jY={...rv,html:wt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",iv).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:Ka,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:wt(sv).replace("hr",_u).replace("heading",` *#{1,6} *[^
|
|
118
|
+
]`).replace("lheading",r5).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},AY=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,TY=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,o5=/^( {2,}|\\)\n(?!\s*$)/,RY=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,wl=/[\p{P}\p{S}]/u,zf=/[\s\p{P}\p{S}]/u,av=/[^\s\p{P}\p{S}]/u,MY=wt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,zf).getRegex(),l5=/(?!~)[\p{P}\p{S}]/u,DY=/(?!~)[\s\p{P}\p{S}]/u,OY=/(?:[^\s\p{P}\p{S}]|~)/u,LY=wt(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",gY?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),c5=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,zY=wt(c5,"u").replace(/punct/g,wl).getRegex(),BY=wt(c5,"u").replace(/punct/g,l5).getRegex(),u5="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",PY=wt(u5,"gu").replace(/notPunctSpace/g,av).replace(/punctSpace/g,zf).replace(/punct/g,wl).getRegex(),IY=wt(u5,"gu").replace(/notPunctSpace/g,OY).replace(/punctSpace/g,DY).replace(/punct/g,l5).getRegex(),$Y=wt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,av).replace(/punctSpace/g,zf).replace(/punct/g,wl).getRegex(),HY=wt(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,wl).getRegex(),UY="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",FY=wt(UY,"gu").replace(/notPunctSpace/g,av).replace(/punctSpace/g,zf).replace(/punct/g,wl).getRegex(),qY=wt(/\\(punct)/,"gu").replace(/punct/g,wl).getRegex(),VY=wt(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),GY=wt(iv).replace("(?:-->|$)","-->").getRegex(),WY=wt("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",GY).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),sf=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,KY=wt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",sf).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),d5=wt(/^!?\[(label)\]\[(ref)\]/).replace("label",sf).replace("ref",nv).getRegex(),h5=wt(/^!?\[(ref)\](?:\[\])?/).replace("ref",nv).getRegex(),YY=wt("reflink|nolink(?!\\()","g").replace("reflink",d5).replace("nolink",h5).getRegex(),mN=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,ov={_backpedal:Ka,anyPunctuation:qY,autolink:VY,blockSkip:LY,br:o5,code:TY,del:Ka,delLDelim:Ka,delRDelim:Ka,emStrongLDelim:zY,emStrongRDelimAst:PY,emStrongRDelimUnd:$Y,escape:AY,link:KY,nolink:h5,punctuation:MY,reflink:d5,reflinkSearch:YY,tag:WY,text:RY,url:Ka},XY={...ov,link:wt(/^!?\[(label)\]\((.*?)\)/).replace("label",sf).getRegex(),reflink:wt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",sf).getRegex()},I0={...ov,emStrongRDelimAst:IY,emStrongLDelim:BY,delLDelim:HY,delRDelim:FY,url:wt(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",mN).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:wt(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",mN).getRegex()},ZY={...I0,br:wt(o5).replace("{2,}","*").getRegex(),text:wt(I0.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},lh={normal:rv,gfm:EY,pedantic:jY},Ec={normal:ov,gfm:I0,breaks:ZY,pedantic:XY},QY={"&":"&","<":"<",">":">",'"':""","'":"'"},pN=e=>QY[e];function Fi(e,t){if(t){if(nn.escapeTest.test(e))return e.replace(nn.escapeReplace,pN)}else if(nn.escapeTestNoEncode.test(e))return e.replace(nn.escapeReplaceNoEncode,pN);return e}function gN(e){try{e=encodeURI(e).replace(nn.percentDecode,"%")}catch{return null}return e}function xN(e,t){let s=e.replace(nn.findPipe,(l,u,h)=>{let f=!1,d=u;for(;--d>=0&&h[d]==="\\";)f=!f;return f?"|":" |"}),n=s.split(nn.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(nn.slashPipe,"|");return n}function ha(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 bN(e){let t=e.split(`
|
|
119
|
+
`),s=t.length-1;for(;s>=0&&nn.blankLine.test(t[s]);)s--;return t.length-s<=2?e:t.slice(0,s+1).join(`
|
|
120
|
+
`)}function JY(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 eX(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 vN(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 tX(e,t,s){let n=e.match(s.other.indentCodeCompensation);if(n===null)return t;let o=n[1];return t.split(`
|
|
121
|
+
`).map(l=>{let u=l.match(s.other.beginningSpace);if(u===null)return l;let[h]=u;return h.length>=o.length?l.slice(o.length):l}).join(`
|
|
122
|
+
`)}var nf=class{options;rules;lexer;constructor(e){this.options=e||fo}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]:bN(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=tX(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=ha(s,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(s=n.trim())}return{type:"heading",raw:ha(t[0],`
|
|
123
|
+
`),depth:t[1].length,text:s,tokens:this.lexer.inline(s)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:ha(t[0],`
|
|
124
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let s=ha(t[0],`
|
|
125
|
+
`).split(`
|
|
126
|
+
`),n="",o="",l=[];for(;s.length>0;){let u=!1,h=[],f;for(f=0;f<s.length;f++)if(this.rules.other.blockquoteStart.test(s[f]))h.push(s[f]),u=!0;else if(!u)h.push(s[f]);else break;s=s.slice(f);let d=h.join(`
|
|
127
|
+
`),p=d.replace(this.rules.other.blockquoteSetextReplace,`
|
|
128
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}
|
|
129
|
+
${d}`:d,o=o?`${o}
|
|
130
|
+
${p}`:p;let g=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,l,!0),this.lexer.state.top=g,s.length===0)break;let x=l.at(-1);if(x?.type==="code")break;if(x?.type==="blockquote"){let v=x,w=v.raw+`
|
|
131
|
+
`+s.join(`
|
|
132
|
+
`),k=this.blockquote(w);l[l.length-1]=k,n=n.substring(0,n.length-v.raw.length)+k.raw,o=o.substring(0,o.length-v.text.length)+k.text;break}else if(x?.type==="list"){let v=x,w=v.raw+`
|
|
133
|
+
`+s.join(`
|
|
134
|
+
`),k=this.list(w);l[l.length-1]=k,n=n.substring(0,n.length-x.raw.length)+k.raw,o=o.substring(0,o.length-v.raw.length)+k.raw,s=w.substring(l.at(-1).raw.length).split(`
|
|
135
|
+
`);continue}}return{type:"blockquote",raw:n,tokens:l,text:o}}}list(e){let t=this.rules.block.list.exec(e);if(t){let s=t[1].trim(),n=s.length>1,o={type:"list",raw:"",ordered:n,start:n?+s.slice(0,-1):"",loose:!1,items:[]};s=n?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=n?s:"[*+-]");let l=this.rules.other.listItemRegex(s),u=!1;for(;e;){let f=!1,d="",p="";if(!(t=l.exec(e))||this.rules.block.hr.test(e))break;d=t[0],e=e.substring(d.length);let g=eX(t[2].split(`
|
|
136
|
+
`,1)[0],t[1].length),x=e.split(`
|
|
137
|
+
`,1)[0],v=!g.trim(),w=0;if(this.options.pedantic?(w=2,p=g.trimStart()):v?w=t[1].length+1:(w=g.search(this.rules.other.nonSpaceChar),w=w>4?1:w,p=g.slice(w),w+=t[1].length),v&&this.rules.other.blankLine.test(x)&&(d+=x+`
|
|
138
|
+
`,e=e.substring(x.length+1),f=!0),!f){let k=this.rules.other.nextBulletRegex(w),N=this.rules.other.hrRegex(w),C=this.rules.other.fencesBeginRegex(w),A=this.rules.other.headingBeginRegex(w),j=this.rules.other.htmlBeginRegex(w),T=this.rules.other.blockquoteBeginRegex(w);for(;e;){let M=e.split(`
|
|
139
|
+
`,1)[0],O;if(x=M,this.options.pedantic?(x=x.replace(this.rules.other.listReplaceNesting," "),O=x):O=x.replace(this.rules.other.tabCharGlobal," "),C.test(x)||A.test(x)||j.test(x)||T.test(x)||k.test(x)||N.test(x))break;if(O.search(this.rules.other.nonSpaceChar)>=w||!x.trim())p+=`
|
|
140
|
+
`+O.slice(w);else{if(v||g.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||C.test(g)||A.test(g)||N.test(g))break;p+=`
|
|
141
|
+
`+x}v=!x.trim(),d+=M+`
|
|
142
|
+
`,e=e.substring(M.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=bN(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:ha(t[0],`
|
|
143
|
+
`),href:n,title:o}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let s=xN(t[1]),n=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
144
|
+
`):[],l={type:"table",raw:ha(t[0],`
|
|
145
|
+
`),header:[],align:[],rows:[]};if(s.length===n.length){for(let u of n)this.rules.other.tableAlignRight.test(u)?l.align.push("right"):this.rules.other.tableAlignCenter.test(u)?l.align.push("center"):this.rules.other.tableAlignLeft.test(u)?l.align.push("left"):l.align.push(null);for(let u=0;u<s.length;u++)l.header.push({text:s[u],tokens:this.lexer.inline(s[u]),header:!0,align:l.align[u]});for(let u of o)l.rows.push(xN(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:ha(t[0],`
|
|
146
|
+
`),depth:t[2].charAt(0)==="="?1:2,text:s,tokens:this.lexer.inline(s)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let s=t[1].charAt(t[1].length-1)===`
|
|
147
|
+
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:s,tokens:this.lexer.inline(s)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let s=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(s)){if(!this.rules.other.endAngleBracket.test(s))return;let l=ha(s.slice(0,-1),"\\");if((s.length-l.length)%2===0)return}else{let l=JY(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)),vN(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 vN(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}}}},Ci=class $0{tokens;options;state;inlineQueue;tokenizer;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||fo,this.options.tokenizer=this.options.tokenizer||new nf,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let s={other:nn,block:lh.normal,inline:Ec.normal};this.options.pedantic?(s.block=lh.pedantic,s.inline=Ec.pedantic):this.options.gfm&&(s.block=lh.gfm,this.options.breaks?s.inline=Ec.breaks:s.inline=Ec.gfm),this.tokenizer.rules=s}static get rules(){return{block:lh,inline:Ec}}static lex(t,s){return new $0(s).lex(t)}static lexInline(t,s){return new $0(s).inlineTokens(t)}lex(t){t=t.replace(nn.carriageReturn,`
|
|
148
|
+
`),this.blockTokens(t,this.tokens);for(let s=0;s<this.inlineQueue.length;s++){let n=this.inlineQueue[s];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,s=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(t=t.replace(nn.tabCharGlobal," ").replace(nn.spaceLine,""));let o=1/0;for(;t;){if(t.length<o)o=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}let l;if(this.options.extensions?.block?.some(h=>(l=h.call({lexer:this},t,s))?(t=t.substring(l.raw.length),s.push(l),!0):!1))continue;if(l=this.tokenizer.space(t)){t=t.substring(l.raw.length);let h=s.at(-1);l.raw.length===1&&h!==void 0?h.raw+=`
|
|
149
|
+
`:s.push(l);continue}if(l=this.tokenizer.code(t)){t=t.substring(l.raw.length);let h=s.at(-1);h?.type==="paragraph"||h?.type==="text"?(h.raw+=(h.raw.endsWith(`
|
|
150
|
+
`)?"":`
|
|
151
|
+
`)+l.raw,h.text+=`
|
|
152
|
+
`+l.text,this.inlineQueue.at(-1).src=h.text):s.push(l);continue}if(l=this.tokenizer.fences(t)){t=t.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.heading(t)){t=t.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.hr(t)){t=t.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.blockquote(t)){t=t.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.list(t)){t=t.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.html(t)){t=t.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.def(t)){t=t.substring(l.raw.length);let h=s.at(-1);h?.type==="paragraph"||h?.type==="text"?(h.raw+=(h.raw.endsWith(`
|
|
153
|
+
`)?"":`
|
|
154
|
+
`)+l.raw,h.text+=`
|
|
155
|
+
`+l.raw,this.inlineQueue.at(-1).src=h.text):this.tokens.links[l.tag]||(this.tokens.links[l.tag]={href:l.href,title:l.title},s.push(l));continue}if(l=this.tokenizer.table(t)){t=t.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.lheading(t)){t=t.substring(l.raw.length),s.push(l);continue}let u=t;if(this.options.extensions?.startBlock){let h=1/0,f=t.slice(1),d;this.options.extensions.startBlock.forEach(p=>{d=p.call({lexer:this},f),typeof d=="number"&&d>=0&&(h=Math.min(h,d))}),h<1/0&&h>=0&&(u=t.substring(0,h+1))}if(this.state.top&&(l=this.tokenizer.paragraph(u))){let h=s.at(-1);n&&h?.type==="paragraph"?(h.raw+=(h.raw.endsWith(`
|
|
156
|
+
`)?"":`
|
|
157
|
+
`)+l.raw,h.text+=`
|
|
158
|
+
`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):s.push(l),n=u.length!==t.length,t=t.substring(l.raw.length);continue}if(l=this.tokenizer.text(t)){t=t.substring(l.raw.length);let h=s.at(-1);h?.type==="text"?(h.raw+=(h.raw.endsWith(`
|
|
159
|
+
`)?"":`
|
|
160
|
+
`)+l.raw,h.text+=`
|
|
161
|
+
`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):s.push(l);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return this.state.top=!0,s}inline(t,s=[]){return this.inlineQueue.push({src:t,tokens:s}),s}inlineTokens(t,s=[]){this.tokenizer.lexer=this;let n=t,o=null;if(this.tokens.links){let d=Object.keys(this.tokens.links);if(d.length>0)for(;(o=this.tokenizer.rules.inline.reflinkSearch.exec(n))!==null;)d.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(o=this.tokenizer.rules.inline.anyPunctuation.exec(n))!==null;)n=n.slice(0,o.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let l;for(;(o=this.tokenizer.rules.inline.blockSkip.exec(n))!==null;)l=o[2]?o[2].length:0,n=n.slice(0,o.index+l)+"["+"a".repeat(o[0].length-l-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let u=!1,h="",f=1/0;for(;t;){if(t.length<f)f=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}u||(h=""),u=!1;let d;if(this.options.extensions?.inline?.some(g=>(d=g.call({lexer:this},t,s))?(t=t.substring(d.raw.length),s.push(d),!0):!1))continue;if(d=this.tokenizer.escape(t)){t=t.substring(d.raw.length),s.push(d);continue}if(d=this.tokenizer.tag(t)){t=t.substring(d.raw.length),s.push(d);continue}if(d=this.tokenizer.link(t)){t=t.substring(d.raw.length),s.push(d);continue}if(d=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(d.raw.length);let g=s.at(-1);d.type==="text"&&g?.type==="text"?(g.raw+=d.raw,g.text+=d.text):s.push(d);continue}if(d=this.tokenizer.emStrong(t,n,h)){t=t.substring(d.raw.length),s.push(d);continue}if(d=this.tokenizer.codespan(t)){t=t.substring(d.raw.length),s.push(d);continue}if(d=this.tokenizer.br(t)){t=t.substring(d.raw.length),s.push(d);continue}if(d=this.tokenizer.del(t,n,h)){t=t.substring(d.raw.length),s.push(d);continue}if(d=this.tokenizer.autolink(t)){t=t.substring(d.raw.length),s.push(d);continue}if(!this.state.inLink&&(d=this.tokenizer.url(t))){t=t.substring(d.raw.length),s.push(d);continue}let p=t;if(this.options.extensions?.startInline){let g=1/0,x=t.slice(1),v;this.options.extensions.startInline.forEach(w=>{v=w.call({lexer:this},x),typeof v=="number"&&v>=0&&(g=Math.min(g,v))}),g<1/0&&g>=0&&(p=t.substring(0,g+1))}if(d=this.tokenizer.inlineText(p)){t=t.substring(d.raw.length),d.raw.slice(-1)!=="_"&&(h=d.raw.slice(-1)),u=!0;let g=s.at(-1);g?.type==="text"?(g.raw+=d.raw,g.text+=d.text):s.push(d);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return s}infiniteLoopError(t){let s="Infinite loop on byte: "+t;if(this.options.silent)console.error(s);else throw new Error(s)}},rf=class{options;parser;constructor(e){this.options=e||fo}space(e){return""}code({text:e,lang:t,escaped:s}){let n=(t||"").match(nn.notSpaceStart)?.[0],o=e.replace(nn.endingNewline,"")+`
|
|
162
|
+
`;return n?'<pre><code class="language-'+Fi(n)+'">'+(s?o:Fi(o,!0))+`</code></pre>
|
|
163
|
+
`:"<pre><code>"+(s?o:Fi(o,!0))+`</code></pre>
|
|
164
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
165
|
+
${this.parser.parse(e)}</blockquote>
|
|
166
|
+
`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
167
|
+
`}hr(e){return`<hr>
|
|
168
|
+
`}list(e){let t=e.ordered,s=e.start,n="";for(let u=0;u<e.items.length;u++){let h=e.items[u];n+=this.listitem(h)}let o=t?"ol":"ul",l=t&&s!==1?' start="'+s+'"':"";return"<"+o+l+`>
|
|
169
|
+
`+n+"</"+o+`>
|
|
170
|
+
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
171
|
+
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
172
|
+
`}table(e){let t="",s="";for(let o=0;o<e.header.length;o++)s+=this.tablecell(e.header[o]);t+=this.tablerow({text:s});let n="";for(let o=0;o<e.rows.length;o++){let l=e.rows[o];s="";for(let u=0;u<l.length;u++)s+=this.tablecell(l[u]);n+=this.tablerow({text:s})}return n&&(n=`<tbody>${n}</tbody>`),`<table>
|
|
173
|
+
<thead>
|
|
174
|
+
`+t+`</thead>
|
|
175
|
+
`+n+`</table>
|
|
176
|
+
`}tablerow({text:e}){return`<tr>
|
|
177
|
+
${e}</tr>
|
|
178
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),s=e.header?"th":"td";return(e.align?`<${s} align="${e.align}">`:`<${s}>`)+t+`</${s}>
|
|
179
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${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=gN(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=gN(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)}},lv=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},Ei=class H0{options;renderer;textRenderer;constructor(t){this.options=t||fo,this.options.renderer=this.options.renderer||new rf,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new lv}static parse(t,s){return new H0(s).parse(t)}static parseInline(t,s){return new H0(s).parseInline(t)}parse(t){this.renderer.parser=this;let s="";for(let n=0;n<t.length;n++){let o=t[n];if(this.options.extensions?.renderers?.[o.type]){let u=o,h=this.options.extensions.renderers[u.type].call({parser:this},u);if(h!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(u.type)){s+=h||"";continue}}let l=o;switch(l.type){case"space":{s+=this.renderer.space(l);break}case"hr":{s+=this.renderer.hr(l);break}case"heading":{s+=this.renderer.heading(l);break}case"code":{s+=this.renderer.code(l);break}case"table":{s+=this.renderer.table(l);break}case"blockquote":{s+=this.renderer.blockquote(l);break}case"list":{s+=this.renderer.list(l);break}case"checkbox":{s+=this.renderer.checkbox(l);break}case"html":{s+=this.renderer.html(l);break}case"def":{s+=this.renderer.def(l);break}case"paragraph":{s+=this.renderer.paragraph(l);break}case"text":{s+=this.renderer.text(l);break}default:{let u='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return s}parseInline(t,s=this.renderer){this.renderer.parser=this;let n="";for(let o=0;o<t.length;o++){let l=t[o];if(this.options.extensions?.renderers?.[l.type]){let h=this.options.extensions.renderers[l.type].call({parser:this},l);if(h!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){n+=h||"";continue}}let u=l;switch(u.type){case"escape":{n+=s.text(u);break}case"html":{n+=s.html(u);break}case"link":{n+=s.link(u);break}case"image":{n+=s.image(u);break}case"checkbox":{n+=s.checkbox(u);break}case"strong":{n+=s.strong(u);break}case"em":{n+=s.em(u);break}case"codespan":{n+=s.codespan(u);break}case"br":{n+=s.br(u);break}case"del":{n+=s.del(u);break}case"text":{n+=s.text(u);break}default:{let h='Token with "'+u.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return n}},$c=class{options;block;constructor(e){this.options=e||fo}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?Ci.lex:Ci.lexInline}provideParser(e=this.block){return e?Ei.parse:Ei.parseInline}},sX=class{defaults=ev();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Ei;Renderer=rf;TextRenderer=lv;Lexer=Ci;Tokenizer=nf;Hooks=$c;constructor(...e){this.use(...e)}walkTokens(e,t){let s=[];for(let n of e)switch(s=s.concat(t.call(this,n)),n.type){case"table":{let o=n;for(let l of o.header)s=s.concat(this.walkTokens(l.tokens,t));for(let l of o.rows)for(let u of l)s=s.concat(this.walkTokens(u.tokens,t));break}case"list":{let o=n;s=s.concat(this.walkTokens(o.items,t));break}default:{let o=n;this.defaults.extensions?.childTokens?.[o.type]?this.defaults.extensions.childTokens[o.type].forEach(l=>{let u=o[l].flat(1/0);s=s.concat(this.walkTokens(u,t))}):o.tokens&&(s=s.concat(this.walkTokens(o.tokens,t)))}}return s}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(s=>{let n={...s};if(n.async=this.defaults.async||n.async||!1,s.extensions&&(s.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){let l=t.renderers[o.name];l?t.renderers[o.name]=function(...u){let h=o.renderer.apply(this,u);return h===!1&&(h=l.apply(this,u)),h}:t.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let l=t[o.level];l?l.unshift(o.tokenizer):t[o.level]=[o.tokenizer],o.start&&(o.level==="block"?t.startBlock?t.startBlock.push(o.start):t.startBlock=[o.start]:o.level==="inline"&&(t.startInline?t.startInline.push(o.start):t.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(t.childTokens[o.name]=o.childTokens)}),n.extensions=t),s.renderer){let o=this.defaults.renderer||new rf(this.defaults);for(let l in s.renderer){if(!(l in o))throw new Error(`renderer '${l}' does not exist`);if(["options","parser"].includes(l))continue;let u=l,h=s.renderer[u],f=o[u];o[u]=(...d)=>{let p=h.apply(o,d);return p===!1&&(p=f.apply(o,d)),p||""}}n.renderer=o}if(s.tokenizer){let o=this.defaults.tokenizer||new nf(this.defaults);for(let l in s.tokenizer){if(!(l in o))throw new Error(`tokenizer '${l}' does not exist`);if(["options","rules","lexer"].includes(l))continue;let u=l,h=s.tokenizer[u],f=o[u];o[u]=(...d)=>{let p=h.apply(o,d);return p===!1&&(p=f.apply(o,d)),p}}n.tokenizer=o}if(s.hooks){let o=this.defaults.hooks||new $c;for(let l in s.hooks){if(!(l in o))throw new Error(`hook '${l}' does not exist`);if(["options","block"].includes(l))continue;let u=l,h=s.hooks[u],f=o[u];$c.passThroughHooks.has(l)?o[u]=d=>{if(this.defaults.async&&$c.passThroughHooksRespectAsync.has(l))return(async()=>{let g=await h.call(o,d);return f.call(o,g)})();let p=h.call(o,d);return f.call(o,p)}:o[u]=(...d)=>{if(this.defaults.async)return(async()=>{let g=await h.apply(o,d);return g===!1&&(g=await f.apply(o,d)),g})();let p=h.apply(o,d);return p===!1&&(p=f.apply(o,d)),p}}n.hooks=o}if(s.walkTokens){let o=this.defaults.walkTokens,l=s.walkTokens;n.walkTokens=function(u){let h=[];return h.push(l.call(this,u)),o&&(h=h.concat(o.call(this,u))),h}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Ci.lex(e,t??this.defaults)}parser(e,t){return Ei.parse(e,t??this.defaults)}parseMarkdown(e){return(t,s)=>{let n={...s},o={...this.defaults,...n},l=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&n.async===!1)return l(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return l(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return l(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(o.hooks&&(o.hooks.options=o,o.hooks.block=e),o.async)return(async()=>{let u=o.hooks?await o.hooks.preprocess(t):t,h=await(o.hooks?await o.hooks.provideLexer(e):e?Ci.lex:Ci.lexInline)(u,o),f=o.hooks?await o.hooks.processAllTokens(h):h;o.walkTokens&&await Promise.all(this.walkTokens(f,o.walkTokens));let d=await(o.hooks?await o.hooks.provideParser(e):e?Ei.parse:Ei.parseInline)(f,o);return o.hooks?await o.hooks.postprocess(d):d})().catch(l);try{o.hooks&&(t=o.hooks.preprocess(t));let u=(o.hooks?o.hooks.provideLexer(e):e?Ci.lex:Ci.lexInline)(t,o);o.hooks&&(u=o.hooks.processAllTokens(u)),o.walkTokens&&this.walkTokens(u,o.walkTokens);let h=(o.hooks?o.hooks.provideParser(e):e?Ei.parse:Ei.parseInline)(u,o);return o.hooks&&(h=o.hooks.postprocess(h)),h}catch(u){return l(u)}}}onError(e,t){return s=>{if(s.message+=`
|
|
180
|
+
Please report this to https://github.com/markedjs/marked.`,e){let n="<p>An error occurred:</p><pre>"+Fi(s.message+"",!0)+"</pre>";return t?Promise.resolve(n):n}if(t)return Promise.reject(s);throw s}}},oo=new sX;function Ot(e,t){return oo.parse(e,t)}Ot.options=Ot.setOptions=function(e){return oo.setOptions(e),Ot.defaults=oo.defaults,n5(Ot.defaults),Ot};Ot.getDefaults=ev;Ot.defaults=fo;Ot.use=function(...e){return oo.use(...e),Ot.defaults=oo.defaults,n5(Ot.defaults),Ot};Ot.walkTokens=function(e,t){return oo.walkTokens(e,t)};Ot.parseInline=oo.parseInline;Ot.Parser=Ei;Ot.parser=Ei.parse;Ot.Renderer=rf;Ot.TextRenderer=lv;Ot.Lexer=Ci;Ot.lexer=Ci.lex;Ot.Tokenizer=nf;Ot.Hooks=$c;Ot.parse=Ot;Ot.options;Ot.setOptions;Ot.use;Ot.walkTokens;Ot.parseInline;Ei.parse;Ci.lex;function nX(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 cv({content:e}){const t=_.useMemo(()=>{const n=Ot.parse(e,{async:!1,gfm:!0,breaks:!1});return nX(n)},[e]),s=_.useRef(null);return _.useEffect(()=>{const n=s.current;n&&n.querySelectorAll("pre code").forEach(o=>{P0.highlightElement(o)})},[t]),r.jsx("div",{ref:s,className:"md-preview min-w-0 px-6 py-5",dangerouslySetInnerHTML:{__html:t}})}var iX=Object.create,f5=Object.defineProperty,rX=Object.getOwnPropertyDescriptor,aX=Object.getOwnPropertyNames,oX=Object.getPrototypeOf,lX=Object.prototype.hasOwnProperty,Yt=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),cX=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(var o=aX(t),l=0,u=o.length,h;l<u;l++)h=o[l],!lX.call(e,h)&&h!==s&&f5(e,h,{get:(f=>t[f]).bind(null,h),enumerable:!(n=rX(t,h))||n.enumerable});return e},uX=(e,t,s)=>(s=e!=null?iX(oX(e)):{},cX(f5(s,"default",{value:e,enumerable:!0}),e)),yu=Yt(((e,t)=>{function s(f){return typeof f>"u"||f===null}function n(f){return typeof f=="object"&&f!==null}function o(f){return Array.isArray(f)?f:s(f)?[]:[f]}function l(f,d){if(d){const p=Object.keys(d);for(let g=0,x=p.length;g<x;g+=1){const v=p[g];f[v]=d[v]}}return f}function u(f,d){let p="";for(let g=0;g<d;g+=1)p+=f;return p}function h(f){return f===0&&Number.NEGATIVE_INFINITY===1/f}t.exports.isNothing=s,t.exports.isObject=n,t.exports.toArray=o,t.exports.repeat=u,t.exports.isNegativeZero=h,t.exports.extend=l})),wu=Yt(((e,t)=>{function s(o,l){let u="";const h=o.reason||"(unknown reason)";return o.mark?(o.mark.name&&(u+='in "'+o.mark.name+'" '),u+="("+(o.mark.line+1)+":"+(o.mark.column+1)+")",!l&&o.mark.snippet&&(u+=`
|
|
181
|
+
|
|
182
|
+
`+o.mark.snippet),h+" "+u):h}function n(o,l){Error.call(this),this.name="YAMLException",this.reason=o,this.mark=l,this.message=s(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n.prototype.toString=function(l){return this.name+": "+s(this,l)},t.exports=n})),dX=Yt(((e,t)=>{var s=yu();function n(u,h,f,d,p){let g="",x="";const v=Math.floor(p/2)-1;return d-h>v&&(g=" ... ",h=d-v+g.length),f-d>v&&(x=" ...",f=d+v-x.length),{str:g+u.slice(h,f).replace(/\t/g,"→")+x,pos:d-h+g.length}}function o(u,h){return s.repeat(" ",h-u.length)+u}function l(u,h){if(h=Object.create(h||null),!u.buffer)return null;h.maxLength||(h.maxLength=79),typeof h.indent!="number"&&(h.indent=1),typeof h.linesBefore!="number"&&(h.linesBefore=3),typeof h.linesAfter!="number"&&(h.linesAfter=2);const f=/\r?\n|\r|\0/g,d=[0],p=[];let g,x=-1;for(;g=f.exec(u.buffer);)p.push(g.index),d.push(g.index+g[0].length),u.position<=g.index&&x<0&&(x=d.length-2);x<0&&(x=d.length-1);let v="";const w=Math.min(u.line+h.linesAfter,p.length).toString().length,k=h.maxLength-(h.indent+w+3);for(let C=1;C<=h.linesBefore&&!(x-C<0);C++){const A=n(u.buffer,d[x-C],p[x-C],u.position-(d[x]-d[x-C]),k);v=s.repeat(" ",h.indent)+o((u.line-C+1).toString(),w)+" | "+A.str+`
|
|
183
|
+
`+v}const N=n(u.buffer,d[x],p[x],u.position,k);v+=s.repeat(" ",h.indent)+o((u.line+1).toString(),w)+" | "+N.str+`
|
|
184
|
+
`,v+=s.repeat("-",h.indent+w+3+N.pos)+`^
|
|
185
|
+
`;for(let C=1;C<=h.linesAfter&&!(x+C>=p.length);C++){const A=n(u.buffer,d[x+C],p[x+C],u.position-(d[x]-d[x+C]),k);v+=s.repeat(" ",h.indent)+o((u.line+C+1).toString(),w)+" | "+A.str+`
|
|
186
|
+
`}return v.replace(/\n$/,"")}t.exports=l})),mn=Yt(((e,t)=>{var s=wu(),n=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],o=["scalar","sequence","mapping"];function l(h){const f={};return h!==null&&Object.keys(h).forEach(function(d){h[d].forEach(function(p){f[String(p)]=d})}),f}function u(h,f){if(f=f||{},Object.keys(f).forEach(function(d){if(n.indexOf(d)===-1)throw new s('Unknown option "'+d+'" is met in definition of "'+h+'" YAML type.')}),this.options=f,this.tag=h,this.kind=f.kind||null,this.resolve=f.resolve||function(){return!0},this.construct=f.construct||function(d){return d},this.instanceOf=f.instanceOf||null,this.predicate=f.predicate||null,this.represent=f.represent||null,this.representName=f.representName||null,this.defaultStyle=f.defaultStyle||null,this.multi=f.multi||!1,this.styleAliases=l(f.styleAliases||null),o.indexOf(this.kind)===-1)throw new s('Unknown kind "'+this.kind+'" is specified for "'+h+'" YAML type.')}t.exports=u})),m5=Yt(((e,t)=>{var s=wu(),n=mn();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})),p5=Yt(((e,t)=>{t.exports=new(mn())("tag:yaml.org,2002:str",{kind:"scalar",construct:function(s){return s!==null?s:""}})})),g5=Yt(((e,t)=>{t.exports=new(mn())("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(s){return s!==null?s:[]}})})),x5=Yt(((e,t)=>{t.exports=new(mn())("tag:yaml.org,2002:map",{kind:"mapping",construct:function(s){return s!==null?s:{}}})})),b5=Yt(((e,t)=>{t.exports=new(m5())({explicit:[p5(),g5(),x5()]})})),v5=Yt(((e,t)=>{var s=mn();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"})})),_5=Yt(((e,t)=>{var s=mn();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"})})),y5=Yt(((e,t)=>{var s=yu(),n=mn();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"]}})})),w5=Yt(((e,t)=>{var s=yu(),n=mn(),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"})})),S5=Yt(((e,t)=>{t.exports=b5().extend({implicit:[v5(),_5(),y5(),w5()]})})),k5=Yt(((e,t)=>{t.exports=S5()})),N5=Yt(((e,t)=>{var s=mn(),n=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),o=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function l(f){return f===null?!1:n.exec(f)!==null||o.exec(f)!==null}function u(f){let d=0,p=null,g=n.exec(f);if(g===null&&(g=o.exec(f)),g===null)throw new Error("Date resolve error");const x=+g[1],v=+g[2]-1,w=+g[3];if(!g[4])return new Date(Date.UTC(x,v,w));const k=+g[4],N=+g[5],C=+g[6];if(g[7]){for(d=g[7].slice(0,3);d.length<3;)d+="0";d=+d}if(g[9]){const j=+g[10],T=+(g[11]||0);p=(j*60+T)*6e4,g[9]==="-"&&(p=-p)}const A=new Date(Date.UTC(x,v,w,k,N,C,d));return p&&A.setTime(A.getTime()-p),A}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})})),C5=Yt(((e,t)=>{var s=mn();function n(o){return o==="<<"||o===null}t.exports=new s("tag:yaml.org,2002:merge",{kind:"scalar",resolve:n})})),E5=Yt(((e,t)=>{var s=mn(),n=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
187
|
+
\r`;function o(f){if(f===null)return!1;let d=0;const p=f.length,g=n;for(let x=0;x<p;x++){const v=g.indexOf(f.charAt(x));if(!(v>64)){if(v<0)return!1;d+=6}}return d%8===0}function l(f){const d=f.replace(/[\r\n=]/g,""),p=d.length,g=n;let x=0;const v=[];for(let k=0;k<p;k++)k%4===0&&k&&(v.push(x>>16&255),v.push(x>>8&255),v.push(x&255)),x=x<<6|g.indexOf(d.charAt(k));const w=p%4*6;return w===0?(v.push(x>>16&255),v.push(x>>8&255),v.push(x&255)):w===18?(v.push(x>>10&255),v.push(x>>2&255)):w===12&&v.push(x>>4&255),new Uint8Array(v)}function u(f){let d="",p=0;const g=f.length,x=n;for(let w=0;w<g;w++)w%3===0&&w&&(d+=x[p>>18&63],d+=x[p>>12&63],d+=x[p>>6&63],d+=x[p&63]),p=(p<<8)+f[w];const v=g%3;return v===0?(d+=x[p>>18&63],d+=x[p>>12&63],d+=x[p>>6&63],d+=x[p&63]):v===2?(d+=x[p>>10&63],d+=x[p>>4&63],d+=x[p<<2&63],d+=x[64]):v===1&&(d+=x[p>>2&63],d+=x[p<<4&63],d+=x[64],d+=x[64]),d}function h(f){return Object.prototype.toString.call(f)==="[object Uint8Array]"}t.exports=new s("tag:yaml.org,2002:binary",{kind:"scalar",resolve:o,construct:l,predicate:h,represent:u})})),j5=Yt(((e,t)=>{var s=mn(),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})})),A5=Yt(((e,t)=>{var s=mn(),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})})),T5=Yt(((e,t)=>{var s=mn(),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})})),uv=Yt(((e,t)=>{t.exports=k5().extend({implicit:[N5(),C5()],explicit:[E5(),j5(),A5(),T5()]})})),hX=Yt(((e,t)=>{var s=yu(),n=wu(),o=dX(),l=uv(),u=Object.prototype.hasOwnProperty,h=1,f=2,d=3,p=4,g=1,x=2,v=3,w=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,k=/[\x85\u2028\u2029]/,N=/[,\[\]{}]/,C=/^(?:!|!!|![0-9A-Za-z-]+!)$/,A=/^(?:!|[^,\[\]{}])(?:%[0-9a-f]{2}|[0-9a-z\-#;/?:@&=+$,_.!~*'()\[\]])*$/i;function j(S){return Object.prototype.toString.call(S)}function T(S){return S===10||S===13}function M(S){return S===9||S===32}function O(S){return S===9||S===32||S===10||S===13}function $(S){return S===44||S===91||S===93||S===123||S===125}function D(S){if(S>=48&&S<=57)return S-48;const re=S|32;return re>=97&&re<=102?re-97+10:-1}function P(S){return S===120?2:S===117?4:S===85?8:0}function B(S){return S>=48&&S<=57?S-48:-1}function G(S){switch(S){case 48:return"\0";case 97:return"\x07";case 98:return"\b";case 116:return" ";case 9:return" ";case 110:return`
|
|
188
|
+
`;case 118:return"\v";case 102:return"\f";case 114:return"\r";case 101:return"\x1B";case 32:return" ";case 34:return'"';case 47:return"/";case 92:return"\\";case 78:return"
";case 95:return" ";case 76:return"\u2028";case 80:return"\u2029";default:return""}}function F(S){return S<=65535?String.fromCharCode(S):String.fromCharCode((S-65536>>10)+55296,(S-65536&1023)+56320)}function z(S,re,xe){re==="__proto__"?Object.defineProperty(S,re,{configurable:!0,enumerable:!0,writable:!0,value:xe}):S[re]=xe}var U=new Array(256),K=new Array(256);for(let S=0;S<256;S++)U[S]=G(S)?1:0,K[S]=G(S);function I(S,re){this.input=S,this.filename=re.filename||null,this.schema=re.schema||l,this.onWarning=re.onWarning||null,this.legacy=re.legacy||!1,this.json=re.json||!1,this.listener=re.listener||null,this.maxDepth=typeof re.maxDepth=="number"?re.maxDepth:100,this.maxMergeSeqLength=typeof re.maxMergeSeqLength=="number"?re.maxMergeSeqLength:20,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=S.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.depth=0,this.firstTabInLine=-1,this.documents=[],this.anchorMapTransactions=[]}function Z(S,re){const xe={name:S.filename,buffer:S.input.slice(0,-1),position:S.position,line:S.line,column:S.position-S.lineStart};return xe.snippet=o(xe),new n(re,xe)}function W(S,re){throw Z(S,re)}function te(S,re){S.onWarning&&S.onWarning.call(null,Z(S,re))}function X(S,re,xe){const ye=S.anchorMapTransactions;if(ye.length!==0){const he=ye[ye.length-1];u.call(he,re)||(he[re]={existed:u.call(S.anchorMap,re),value:S.anchorMap[re]})}S.anchorMap[re]=xe}function V(S){S.anchorMapTransactions.push(Object.create(null))}function q(S){const re=S.anchorMapTransactions.pop(),xe=S.anchorMapTransactions;if(xe.length===0)return;const ye=xe[xe.length-1],he=Object.keys(re);for(let Ae=0,R=he.length;Ae<R;Ae+=1){const ae=he[Ae];u.call(ye,ae)||(ye[ae]=re[ae])}}function oe(S){const re=S.anchorMapTransactions.pop(),xe=Object.keys(re);for(let ye=xe.length-1;ye>=0;ye-=1){const he=re[xe[ye]];he.existed?S.anchorMap[xe[ye]]=he.value:delete S.anchorMap[xe[ye]]}}function ee(S){return{position:S.position,line:S.line,lineStart:S.lineStart,lineIndent:S.lineIndent,firstTabInLine:S.firstTabInLine,tag:S.tag,anchor:S.anchor,kind:S.kind,result:S.result}}function fe(S,re){S.position=re.position,S.line=re.line,S.lineStart=re.lineStart,S.lineIndent=re.lineIndent,S.firstTabInLine=re.firstTabInLine,S.tag=re.tag,S.anchor=re.anchor,S.kind=re.kind,S.result=re.result}var ie={YAML:function(re,xe,ye){re.version!==null&&W(re,"duplication of %YAML directive"),ye.length!==1&&W(re,"YAML directive accepts exactly one argument");const he=/^([0-9]+)\.([0-9]+)$/.exec(ye[0]);he===null&&W(re,"ill-formed argument of the YAML directive");const Ae=parseInt(he[1],10),R=parseInt(he[2],10);Ae!==1&&W(re,"unacceptable YAML version of the document"),re.version=ye[0],re.checkLineBreaks=R<2,R!==1&&R!==2&&te(re,"unsupported YAML version of the document")},TAG:function(re,xe,ye){let he;ye.length!==2&&W(re,"TAG directive accepts exactly two arguments");const Ae=ye[0];he=ye[1],C.test(Ae)||W(re,"ill-formed tag handle (first argument) of the TAG directive"),u.call(re.tagMap,Ae)&&W(re,'there is a previously declared suffix for "'+Ae+'" tag handle'),A.test(he)||W(re,"ill-formed tag prefix (second argument) of the TAG directive");try{he=decodeURIComponent(he)}catch{W(re,"tag prefix is malformed: "+he)}re.tagMap[Ae]=he}};function Se(S,re,xe,ye){if(re<xe){const he=S.input.slice(re,xe);if(ye)for(let Ae=0,R=he.length;Ae<R;Ae+=1){const ae=he.charCodeAt(Ae);ae===9||ae>=32&&ae<=1114111||W(S,"expected valid JSON character")}else w.test(he)&&W(S,"the stream contains non-printable characters");S.result+=he}}function Re(S,re,xe,ye){s.isObject(xe)||W(S,"cannot merge mappings; the provided source object is unacceptable");const he=Object.keys(xe);for(let Ae=0,R=he.length;Ae<R;Ae+=1){const ae=he[Ae];u.call(re,ae)||(z(re,ae,xe[ae]),ye[ae]=!0)}}function De(S,re,xe,ye,he,Ae,R,ae,Te){if(Array.isArray(he)){he=Array.prototype.slice.call(he);for(let _e=0,me=he.length;_e<me;_e+=1)Array.isArray(he[_e])&&W(S,"nested arrays are not supported inside keys"),typeof he=="object"&&j(he[_e])==="[object Object]"&&(he[_e]="[object Object]")}if(typeof he=="object"&&j(he)==="[object Object]"&&(he="[object Object]"),he=String(he),re===null&&(re={}),ye==="tag:yaml.org,2002:merge")if(Array.isArray(Ae)){Ae.length>S.maxMergeSeqLength&&W(S,"merge sequence length exceeded maxMergeSeqLength ("+S.maxMergeSeqLength+")");const _e=new Set;for(let me=0,je=Ae.length;me<je;me+=1){const ke=Ae[me];_e.has(ke)||(_e.add(ke),Re(S,re,ke,xe))}}else Re(S,re,Ae,xe);else!S.json&&!u.call(xe,he)&&u.call(re,he)&&(S.line=R||S.line,S.lineStart=ae||S.lineStart,S.position=Te||S.position,W(S,"duplicated mapping key")),z(re,he,Ae),delete xe[he];return re}function Je(S){const re=S.input.charCodeAt(S.position);re===10?S.position++:re===13?(S.position++,S.input.charCodeAt(S.position)===10&&S.position++):W(S,"a line break is expected"),S.line+=1,S.lineStart=S.position,S.firstTabInLine=-1}function Ne(S,re,xe){let ye=0,he=S.input.charCodeAt(S.position);for(;he!==0;){for(;M(he);)he===9&&S.firstTabInLine===-1&&(S.firstTabInLine=S.position),he=S.input.charCodeAt(++S.position);if(re&&he===35)do he=S.input.charCodeAt(++S.position);while(he!==10&&he!==13&&he!==0);if(T(he))for(Je(S),he=S.input.charCodeAt(S.position),ye++,S.lineIndent=0;he===32;)S.lineIndent++,he=S.input.charCodeAt(++S.position);else break}return xe!==-1&&ye!==0&&S.lineIndent<xe&&te(S,"deficient indentation"),ye}function Ue(S){let re=S.position,xe=S.input.charCodeAt(re);return!!((xe===45||xe===46)&&xe===S.input.charCodeAt(re+1)&&xe===S.input.charCodeAt(re+2)&&(re+=3,xe=S.input.charCodeAt(re),xe===0||O(xe)))}function $e(S,re){re===1?S.result+=" ":re>1&&(S.result+=s.repeat(`
|
|
189
|
+
`,re-1))}function St(S,re,xe){let ye,he,Ae,R,ae,Te;const _e=S.kind,me=S.result;let je=S.input.charCodeAt(S.position);if(O(je)||$(je)||je===35||je===38||je===42||je===33||je===124||je===62||je===39||je===34||je===37||je===64||je===96)return!1;if(je===63||je===45){const ke=S.input.charCodeAt(S.position+1);if(O(ke)||xe&&$(ke))return!1}for(S.kind="scalar",S.result="",ye=he=S.position,Ae=!1;je!==0;){if(je===58){const ke=S.input.charCodeAt(S.position+1);if(O(ke)||xe&&$(ke))break}else if(je===35){if(O(S.input.charCodeAt(S.position-1)))break}else{if(S.position===S.lineStart&&Ue(S)||xe&&$(je))break;if(T(je))if(R=S.line,ae=S.lineStart,Te=S.lineIndent,Ne(S,!1,-1),S.lineIndent>=re){Ae=!0,je=S.input.charCodeAt(S.position);continue}else{S.position=he,S.line=R,S.lineStart=ae,S.lineIndent=Te;break}}Ae&&(Se(S,ye,he,!1),$e(S,S.line-R),ye=he=S.position,Ae=!1),M(je)||(he=S.position+1),je=S.input.charCodeAt(++S.position)}return Se(S,ye,he,!1),S.result?!0:(S.kind=_e,S.result=me,!1)}function Ds(S,re){let xe,ye,he=S.input.charCodeAt(S.position);if(he!==39)return!1;for(S.kind="scalar",S.result="",S.position++,xe=ye=S.position;(he=S.input.charCodeAt(S.position))!==0;)if(he===39)if(Se(S,xe,S.position,!0),he=S.input.charCodeAt(++S.position),he===39)xe=S.position,S.position++,ye=S.position;else return!0;else T(he)?(Se(S,xe,ye,!0),$e(S,Ne(S,!1,re)),xe=ye=S.position):S.position===S.lineStart&&Ue(S)?W(S,"unexpected end of the document within a single quoted scalar"):(S.position++,M(he)||(ye=S.position));W(S,"unexpected end of the stream within a single quoted scalar")}function Os(S,re){let xe,ye,he,Ae=S.input.charCodeAt(S.position);if(Ae!==34)return!1;for(S.kind="scalar",S.result="",S.position++,xe=ye=S.position;(Ae=S.input.charCodeAt(S.position))!==0;){if(Ae===34)return Se(S,xe,S.position,!0),S.position++,!0;if(Ae===92){if(Se(S,xe,S.position,!0),Ae=S.input.charCodeAt(++S.position),T(Ae))Ne(S,!1,re);else if(Ae<256&&U[Ae])S.result+=K[Ae],S.position++;else if((he=P(Ae))>0){let R=he,ae=0;for(;R>0;R--)Ae=S.input.charCodeAt(++S.position),(he=D(Ae))>=0?ae=(ae<<4)+he:W(S,"expected hexadecimal character");S.result+=F(ae),S.position++}else W(S,"unknown escape sequence");xe=ye=S.position}else T(Ae)?(Se(S,xe,ye,!0),$e(S,Ne(S,!1,re)),xe=ye=S.position):S.position===S.lineStart&&Ue(S)?W(S,"unexpected end of the document within a double quoted scalar"):(S.position++,M(Ae)||(ye=S.position))}W(S,"unexpected end of the stream within a double quoted scalar")}function vi(S,re){let xe=!0,ye,he,Ae;const R=S.tag;let ae;const Te=S.anchor;let _e,me,je,ke;const Be=Object.create(null);let H,se,ge,Pe=S.input.charCodeAt(S.position);if(Pe===91)_e=93,ke=!1,ae=[];else if(Pe===123)_e=125,ke=!0,ae={};else return!1;for(S.anchor!==null&&X(S,S.anchor,ae),Pe=S.input.charCodeAt(++S.position);Pe!==0;){if(Ne(S,!0,re),Pe=S.input.charCodeAt(S.position),Pe===_e)return S.position++,S.tag=R,S.anchor=Te,S.kind=ke?"mapping":"sequence",S.result=ae,!0;xe?Pe===44&&W(S,"expected the node content, but found ','"):W(S,"missed comma between flow collection entries"),se=H=ge=null,me=je=!1,Pe===63&&O(S.input.charCodeAt(S.position+1))&&(me=je=!0,S.position++,Ne(S,!0,re)),ye=S.line,he=S.lineStart,Ae=S.position,Cs(S,re,h,!1,!0),se=S.tag,H=S.result,Ne(S,!0,re),Pe=S.input.charCodeAt(S.position),(je||S.line===ye)&&Pe===58&&(me=!0,Pe=S.input.charCodeAt(++S.position),Ne(S,!0,re),Cs(S,re,h,!1,!0),ge=S.result),ke?De(S,ae,Be,se,H,ge,ye,he,Ae):me?ae.push(De(S,null,Be,se,H,ge,ye,he,Ae)):ae.push(H),Ne(S,!0,re),Pe=S.input.charCodeAt(S.position),Pe===44?(xe=!0,Pe=S.input.charCodeAt(++S.position)):xe=!1}W(S,"unexpected end of the stream within a flow collection")}function Kn(S,re){let xe,ye=g,he=!1,Ae=!1,R=re,ae=0,Te=!1,_e,me=S.input.charCodeAt(S.position);if(me===124)xe=!1;else if(me===62)xe=!0;else return!1;for(S.kind="scalar",S.result="";me!==0;)if(me=S.input.charCodeAt(++S.position),me===43||me===45)g===ye?ye=me===43?v:x:W(S,"repeat of a chomping mode identifier");else if((_e=B(me))>=0)_e===0?W(S,"bad explicit indentation width of a block scalar; it cannot be less than one"):Ae?W(S,"repeat of an indentation width identifier"):(R=re+_e-1,Ae=!0);else break;if(M(me)){do me=S.input.charCodeAt(++S.position);while(M(me));if(me===35)do me=S.input.charCodeAt(++S.position);while(!T(me)&&me!==0)}for(;me!==0;){for(Je(S),S.lineIndent=0,me=S.input.charCodeAt(S.position);(!Ae||S.lineIndent<R)&&me===32;)S.lineIndent++,me=S.input.charCodeAt(++S.position);if(!Ae&&S.lineIndent>R&&(R=S.lineIndent),T(me)){ae++;continue}if(!Ae&&R===0&&W(S,"missing indentation for block scalar"),S.lineIndent<R){ye===v?S.result+=s.repeat(`
|
|
190
|
+
`,he?1+ae:ae):ye===g&&he&&(S.result+=`
|
|
191
|
+
`);break}xe?M(me)?(Te=!0,S.result+=s.repeat(`
|
|
192
|
+
`,he?1+ae:ae)):Te?(Te=!1,S.result+=s.repeat(`
|
|
193
|
+
`,ae+1)):ae===0?he&&(S.result+=" "):S.result+=s.repeat(`
|
|
194
|
+
`,ae):S.result+=s.repeat(`
|
|
195
|
+
`,he?1+ae:ae),he=!0,Ae=!0,ae=0;const je=S.position;for(;!T(me)&&me!==0;)me=S.input.charCodeAt(++S.position);Se(S,je,S.position,!1)}return!0}function Us(S,re){const xe=S.tag,ye=S.anchor,he=[];let Ae=!1;if(S.firstTabInLine!==-1)return!1;S.anchor!==null&&X(S,S.anchor,he);let R=S.input.charCodeAt(S.position);for(;R!==0&&(S.firstTabInLine!==-1&&(S.position=S.firstTabInLine,W(S,"tab characters must not be used in indentation")),!(R!==45||!O(S.input.charCodeAt(S.position+1))));){if(Ae=!0,S.position++,Ne(S,!0,-1)&&S.lineIndent<=re){he.push(null),R=S.input.charCodeAt(S.position);continue}const ae=S.line;if(Cs(S,re,d,!1,!0),he.push(S.result),Ne(S,!0,-1),R=S.input.charCodeAt(S.position),(S.line===ae||S.lineIndent>re)&&R!==0)W(S,"bad indentation of a sequence entry");else if(S.lineIndent<re)break}return Ae?(S.tag=xe,S.anchor=ye,S.kind="sequence",S.result=he,!0):!1}function jn(S,re,xe){let ye,he,Ae,R;const ae=S.tag,Te=S.anchor,_e={},me=Object.create(null);let je=null,ke=null,Be=null,H=!1,se=!1;if(S.firstTabInLine!==-1)return!1;S.anchor!==null&&X(S,S.anchor,_e);let ge=S.input.charCodeAt(S.position);for(;ge!==0;){!H&&S.firstTabInLine!==-1&&(S.position=S.firstTabInLine,W(S,"tab characters must not be used in indentation"));const Pe=S.input.charCodeAt(S.position+1),it=S.line;if((ge===63||ge===58)&&O(Pe))ge===63?(H&&(De(S,_e,me,je,ke,null,he,Ae,R),je=ke=Be=null),se=!0,H=!0,ye=!0):H?(H=!1,ye=!0):W(S,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),S.position+=1,ge=Pe;else{if(he=S.line,Ae=S.lineStart,R=S.position,!Cs(S,xe,f,!1,!0))break;if(S.line===it){for(ge=S.input.charCodeAt(S.position);M(ge);)ge=S.input.charCodeAt(++S.position);if(ge===58)ge=S.input.charCodeAt(++S.position),O(ge)||W(S,"a whitespace character is expected after the key-value separator within a block mapping"),H&&(De(S,_e,me,je,ke,null,he,Ae,R),je=ke=Be=null),se=!0,H=!1,ye=!1,je=S.tag,ke=S.result;else if(se)W(S,"can not read an implicit mapping pair; a colon is missed");else return S.tag=ae,S.anchor=Te,!0}else if(se)W(S,"can not read a block mapping entry; a multiline key may not be an implicit key");else return S.tag=ae,S.anchor=Te,!0}if((S.line===it||S.lineIndent>re)&&(H&&(he=S.line,Ae=S.lineStart,R=S.position),Cs(S,re,p,!0,ye)&&(H?ke=S.result:Be=S.result),H||(De(S,_e,me,je,ke,Be,he,Ae,R),je=ke=Be=null),Ne(S,!0,-1),ge=S.input.charCodeAt(S.position)),(S.line===it||S.lineIndent>re)&&ge!==0)W(S,"bad indentation of a mapping entry");else if(S.lineIndent<re)break}return H&&De(S,_e,me,je,ke,null,he,Ae,R),se&&(S.tag=ae,S.anchor=Te,S.kind="mapping",S.result=_e),se}function An(S){let re=!1,xe=!1,ye,he,Ae=S.input.charCodeAt(S.position);if(Ae!==33)return!1;S.tag!==null&&W(S,"duplication of a tag property"),Ae=S.input.charCodeAt(++S.position),Ae===60?(re=!0,Ae=S.input.charCodeAt(++S.position)):Ae===33?(xe=!0,ye="!!",Ae=S.input.charCodeAt(++S.position)):ye="!";let R=S.position;if(re){do Ae=S.input.charCodeAt(++S.position);while(Ae!==0&&Ae!==62);S.position<S.length?(he=S.input.slice(R,S.position),Ae=S.input.charCodeAt(++S.position)):W(S,"unexpected end of the stream within a verbatim tag")}else{for(;Ae!==0&&!O(Ae);)Ae===33&&(xe?W(S,"tag suffix cannot contain exclamation marks"):(ye=S.input.slice(R-1,S.position+1),C.test(ye)||W(S,"named tag handle cannot contain such characters"),xe=!0,R=S.position+1)),Ae=S.input.charCodeAt(++S.position);he=S.input.slice(R,S.position),N.test(he)&&W(S,"tag suffix cannot contain flow indicator characters")}he&&!A.test(he)&&W(S,"tag name cannot contain such characters: "+he);try{he=decodeURIComponent(he)}catch{W(S,"tag name is malformed: "+he)}return re?S.tag=he:u.call(S.tagMap,ye)?S.tag=S.tagMap[ye]+he:ye==="!"?S.tag="!"+he:ye==="!!"?S.tag="tag:yaml.org,2002:"+he:W(S,'undeclared tag handle "'+ye+'"'),!0}function Ri(S){let re=S.input.charCodeAt(S.position);if(re!==38)return!1;S.anchor!==null&&W(S,"duplication of an anchor property"),re=S.input.charCodeAt(++S.position);const xe=S.position;for(;re!==0&&!O(re)&&!$(re);)re=S.input.charCodeAt(++S.position);return S.position===xe&&W(S,"name of an anchor node must contain at least one character"),S.anchor=S.input.slice(xe,S.position),!0}function _i(S){let re=S.input.charCodeAt(S.position);if(re!==42)return!1;re=S.input.charCodeAt(++S.position);const xe=S.position;for(;re!==0&&!O(re)&&!$(re);)re=S.input.charCodeAt(++S.position);S.position===xe&&W(S,"name of an alias node must contain at least one character");const ye=S.input.slice(xe,S.position);return u.call(S.anchorMap,ye)||W(S,'unidentified alias "'+ye+'"'),S.result=S.anchorMap[ye],Ne(S,!0,-1),!0}function It(S,re,xe,ye){const he=ee(S);return V(S),fe(S,re),S.tag=null,S.anchor=null,S.kind=null,S.result=null,jn(S,xe,ye)&&S.kind==="mapping"?(q(S),!0):(oe(S),fe(S,he),!1)}function Cs(S,re,xe,ye,he){let Ae,R,ae=1,Te=!1,_e=!1,me=null,je,ke,Be;S.depth>=S.maxDepth&&W(S,"nesting exceeded maxDepth ("+S.maxDepth+")"),S.depth+=1,S.listener!==null&&S.listener("open",S),S.tag=null,S.anchor=null,S.kind=null,S.result=null;const H=Ae=R=p===xe||d===xe;if(ye&&Ne(S,!0,-1)&&(Te=!0,S.lineIndent>re?ae=1:S.lineIndent===re?ae=0:S.lineIndent<re&&(ae=-1)),ae===1)for(;;){const se=S.input.charCodeAt(S.position),ge=ee(S);if(Te&&(se===33&&S.tag!==null||se===38&&S.anchor!==null)||!An(S)&&!Ri(S))break;me===null&&(me=ge),Ne(S,!0,-1)?(Te=!0,R=H,S.lineIndent>re?ae=1:S.lineIndent===re?ae=0:S.lineIndent<re&&(ae=-1)):R=!1}if(R&&(R=Te||he),ae===1||p===xe)if(h===xe||f===xe?ke=re:ke=re+1,Be=S.position-S.lineStart,ae===1)if(R&&(Us(S,Be)||jn(S,Be,ke))||vi(S,ke))_e=!0;else{const se=S.input.charCodeAt(S.position);me!==null&&H&&!R&&se!==124&&se!==62&&It(S,me,me.position-me.lineStart,ke)||Ae&&Kn(S,ke)||Ds(S,ke)||Os(S,ke)?_e=!0:_i(S)?(_e=!0,(S.tag!==null||S.anchor!==null)&&W(S,"alias node should not have any properties")):St(S,ke,h===xe)&&(_e=!0,S.tag===null&&(S.tag="?")),S.anchor!==null&&X(S,S.anchor,S.result)}else ae===0&&(_e=R&&Us(S,Be));if(S.tag===null)S.anchor!==null&&X(S,S.anchor,S.result);else if(S.tag==="?"){S.result!==null&&S.kind!=="scalar"&&W(S,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+S.kind+'"');for(let se=0,ge=S.implicitTypes.length;se<ge;se+=1)if(je=S.implicitTypes[se],je.resolve(S.result)){S.result=je.construct(S.result),S.tag=je.tag,S.anchor!==null&&X(S,S.anchor,S.result);break}}else if(S.tag!=="!"){if(u.call(S.typeMap[S.kind||"fallback"],S.tag))je=S.typeMap[S.kind||"fallback"][S.tag];else{je=null;const se=S.typeMap.multi[S.kind||"fallback"];for(let ge=0,Pe=se.length;ge<Pe;ge+=1)if(S.tag.slice(0,se[ge].tag.length)===se[ge].tag){je=se[ge];break}}je||W(S,"unknown tag !<"+S.tag+">"),S.result!==null&&je.kind!==S.kind&&W(S,"unacceptable node kind for !<"+S.tag+'> tag; it should be "'+je.kind+'", not "'+S.kind+'"'),je.resolve(S.result,S.tag)?(S.result=je.construct(S.result,S.tag),S.anchor!==null&&X(S,S.anchor,S.result)):W(S,"cannot resolve a node with !<"+S.tag+"> explicit tag")}return S.listener!==null&&S.listener("close",S),S.depth-=1,S.tag!==null||S.anchor!==null||_e}function ls(S){const re=S.position;let xe=!1,ye;for(S.version=null,S.checkLineBreaks=S.legacy,S.tagMap=Object.create(null),S.anchorMap=Object.create(null);(ye=S.input.charCodeAt(S.position))!==0&&(Ne(S,!0,-1),ye=S.input.charCodeAt(S.position),!(S.lineIndent>0||ye!==37));){xe=!0,ye=S.input.charCodeAt(++S.position);let he=S.position;for(;ye!==0&&!O(ye);)ye=S.input.charCodeAt(++S.position);const Ae=S.input.slice(he,S.position),R=[];for(Ae.length<1&&W(S,"directive name must not be less than one character in length");ye!==0;){for(;M(ye);)ye=S.input.charCodeAt(++S.position);if(ye===35){do ye=S.input.charCodeAt(++S.position);while(ye!==0&&!T(ye));break}if(T(ye))break;for(he=S.position;ye!==0&&!O(ye);)ye=S.input.charCodeAt(++S.position);R.push(S.input.slice(he,S.position))}ye!==0&&Je(S),u.call(ie,Ae)?ie[Ae](S,Ae,R):te(S,'unknown document directive "'+Ae+'"')}if(Ne(S,!0,-1),S.lineIndent===0&&S.input.charCodeAt(S.position)===45&&S.input.charCodeAt(S.position+1)===45&&S.input.charCodeAt(S.position+2)===45?(S.position+=3,Ne(S,!0,-1)):xe&&W(S,"directives end mark is expected"),Cs(S,S.lineIndent-1,p,!1,!0),Ne(S,!0,-1),S.checkLineBreaks&&k.test(S.input.slice(re,S.position))&&te(S,"non-ASCII line breaks are interpreted as content"),S.documents.push(S.result),S.position===S.lineStart&&Ue(S)){S.input.charCodeAt(S.position)===46&&(S.position+=3,Ne(S,!0,-1));return}S.position<S.length-1&&W(S,"end of the stream or a document separator is expected")}function pn(S,re){S=String(S),re=re||{},S.length!==0&&(S.charCodeAt(S.length-1)!==10&&S.charCodeAt(S.length-1)!==13&&(S+=`
|
|
196
|
+
`),S.charCodeAt(0)===65279&&(S=S.slice(1)));const xe=new I(S,re),ye=S.indexOf("\0");for(ye!==-1&&(xe.position=ye,W(xe,"null byte is not allowed in input")),xe.input+="\0";xe.input.charCodeAt(xe.position)===32;)xe.lineIndent+=1,xe.position+=1;for(;xe.position<xe.length-1;)ls(xe);return xe.documents}function gn(S,re,xe){re!==null&&typeof re=="object"&&typeof xe>"u"&&(xe=re,re=null);const ye=pn(S,xe);if(typeof re!="function")return ye;for(let he=0,Ae=ye.length;he<Ae;he+=1)re(ye[he])}function Mi(S,re){const xe=pn(S,re);if(xe.length!==0){if(xe.length===1)return xe[0];throw new n("expected a single document in the stream, but found more")}}t.exports.loadAll=gn,t.exports.load=Mi})),fX=Yt(((e,t)=>{var s=yu(),n=wu(),o=uv(),l=Object.prototype.toString,u=Object.prototype.hasOwnProperty,h=65279,f=9,d=10,p=13,g=32,x=33,v=34,w=35,k=37,N=38,C=39,A=42,j=44,T=45,M=58,O=61,$=62,D=63,P=64,B=91,G=93,F=96,z=123,U=124,K=125,I={};I[0]="\\0",I[7]="\\a",I[8]="\\b",I[9]="\\t",I[10]="\\n",I[11]="\\v",I[12]="\\f",I[13]="\\r",I[27]="\\e",I[34]='\\"',I[92]="\\\\",I[133]="\\N",I[160]="\\_",I[8232]="\\L",I[8233]="\\P";var Z=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],W=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function te(R,ae){if(ae===null)return{};const Te={},_e=Object.keys(ae);for(let me=0,je=_e.length;me<je;me+=1){let ke=_e[me],Be=String(ae[ke]);ke.slice(0,2)==="!!"&&(ke="tag:yaml.org,2002:"+ke.slice(2));const H=R.compiledTypeMap.fallback[ke];H&&u.call(H.styleAliases,Be)&&(Be=H.styleAliases[Be]),Te[ke]=Be}return Te}function X(R){let ae,Te;const _e=R.toString(16).toUpperCase();if(R<=255)ae="x",Te=2;else if(R<=65535)ae="u",Te=4;else if(R<=4294967295)ae="U",Te=8;else throw new n("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+ae+s.repeat("0",Te-_e.length)+_e}var V=1,q=2;function oe(R){this.schema=R.schema||o,this.indent=Math.max(1,R.indent||2),this.noArrayIndent=R.noArrayIndent||!1,this.skipInvalid=R.skipInvalid||!1,this.flowLevel=s.isNothing(R.flowLevel)?-1:R.flowLevel,this.styleMap=te(this.schema,R.styles||null),this.sortKeys=R.sortKeys||!1,this.lineWidth=R.lineWidth||80,this.noRefs=R.noRefs||!1,this.noCompatMode=R.noCompatMode||!1,this.condenseFlow=R.condenseFlow||!1,this.quotingType=R.quotingType==='"'?q:V,this.forceQuotes=R.forceQuotes||!1,this.replacer=typeof R.replacer=="function"?R.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function ee(R,ae){const Te=s.repeat(" ",ae);let _e=0,me="";const je=R.length;for(;_e<je;){let ke;const Be=R.indexOf(`
|
|
197
|
+
`,_e);Be===-1?(ke=R.slice(_e),_e=je):(ke=R.slice(_e,Be+1),_e=Be+1),ke.length&&ke!==`
|
|
198
|
+
`&&(me+=Te),me+=ke}return me}function fe(R,ae){return`
|
|
199
|
+
`+s.repeat(" ",R.indent*ae)}function ie(R,ae){for(let Te=0,_e=R.implicitTypes.length;Te<_e;Te+=1)if(R.implicitTypes[Te].resolve(ae))return!0;return!1}function Se(R){return R===g||R===f}function Re(R){return R>=32&&R<=126||R>=161&&R<=55295&&R!==8232&&R!==8233||R>=57344&&R<=65533&&R!==h||R>=65536&&R<=1114111}function De(R){return Re(R)&&R!==h&&R!==p&&R!==d}function Je(R,ae,Te){const _e=De(R),me=_e&&!Se(R);return(Te?_e:_e&&R!==j&&R!==B&&R!==G&&R!==z&&R!==K)&&R!==w&&!(ae===M&&!me)||De(ae)&&!Se(ae)&&R===w||ae===M&&me}function Ne(R){return Re(R)&&R!==h&&!Se(R)&&R!==T&&R!==D&&R!==M&&R!==j&&R!==B&&R!==G&&R!==z&&R!==K&&R!==w&&R!==N&&R!==A&&R!==x&&R!==U&&R!==O&&R!==$&&R!==C&&R!==v&&R!==k&&R!==P&&R!==F}function Ue(R){return!Se(R)&&R!==M}function $e(R,ae){const Te=R.charCodeAt(ae);let _e;return Te>=55296&&Te<=56319&&ae+1<R.length&&(_e=R.charCodeAt(ae+1),_e>=56320&&_e<=57343)?(Te-55296)*1024+_e-56320+65536:Te}function St(R){return/^\n* /.test(R)}var Ds=1,Os=2,vi=3,Kn=4,Us=5;function jn(R,ae,Te,_e,me,je,ke,Be){let H,se=0,ge=null,Pe=!1,it=!1;const Et=_e!==-1;let qe=-1,He=Ne($e(R,0))&&Ue($e(R,R.length-1));if(ae||ke)for(H=0;H<R.length;se>=65536?H+=2:H++){if(se=$e(R,H),!Re(se))return Us;He=He&&Je(se,ge,Be),ge=se}else{for(H=0;H<R.length;se>=65536?H+=2:H++){if(se=$e(R,H),se===d)Pe=!0,Et&&(it=it||H-qe-1>_e&&R[qe+1]!==" ",qe=H);else if(!Re(se))return Us;He=He&&Je(se,ge,Be),ge=se}it=it||Et&&H-qe-1>_e&&R[qe+1]!==" "}return!Pe&&!it?He&&!ke&&!me(R)?Ds:je===q?Us:Os:Te>9&&St(R)?Us:ke?je===q?Us:Os:it?Kn:vi}function An(R,ae,Te,_e,me){R.dump=(function(){if(ae.length===0)return R.quotingType===q?'""':"''";if(!R.noCompatMode&&(Z.indexOf(ae)!==-1||W.test(ae)))return R.quotingType===q?'"'+ae+'"':"'"+ae+"'";const je=R.indent*Math.max(1,Te),ke=R.lineWidth===-1?-1:Math.max(Math.min(R.lineWidth,40),R.lineWidth-je),Be=_e||R.flowLevel>-1&&Te>=R.flowLevel;function H(se){return ie(R,se)}switch(jn(ae,Be,R.indent,ke,H,R.quotingType,R.forceQuotes&&!_e,me)){case Ds:return ae;case Os:return"'"+ae.replace(/'/g,"''")+"'";case vi:return"|"+Ri(ae,R.indent)+_i(ee(ae,je));case Kn:return">"+Ri(ae,R.indent)+_i(ee(It(ae,ke),je));case Us:return'"'+ls(ae)+'"';default:throw new n("impossible error: invalid scalar style")}})()}function Ri(R,ae){const Te=St(R)?String(ae):"",_e=R[R.length-1]===`
|
|
200
|
+
`;return Te+(_e&&(R[R.length-2]===`
|
|
201
|
+
`||R===`
|
|
202
|
+
`)?"+":_e?"":"-")+`
|
|
203
|
+
`}function _i(R){return R[R.length-1]===`
|
|
204
|
+
`?R.slice(0,-1):R}function It(R,ae){const Te=/(\n+)([^\n]*)/g;let _e=(function(){let Be=R.indexOf(`
|
|
205
|
+
`);return Be=Be!==-1?Be:R.length,Te.lastIndex=Be,Cs(R.slice(0,Be),ae)})(),me=R[0]===`
|
|
206
|
+
`||R[0]===" ",je,ke;for(;ke=Te.exec(R);){const Be=ke[1],H=ke[2];je=H[0]===" ",_e+=Be+(!me&&!je&&H!==""?`
|
|
207
|
+
`:"")+Cs(H,ae),me=je}return _e}function Cs(R,ae){if(R===""||R[0]===" ")return R;const Te=/ [^ ]/g;let _e,me=0,je,ke=0,Be=0,H="";for(;_e=Te.exec(R);)Be=_e.index,Be-me>ae&&(je=ke>me?ke:Be,H+=`
|
|
208
|
+
`+R.slice(me,je),me=je+1),ke=Be;return H+=`
|
|
209
|
+
`,R.length-me>ae&&ke>me?H+=R.slice(me,ke)+`
|
|
210
|
+
`+R.slice(ke+1):H+=R.slice(me),H.slice(1)}function ls(R){let ae="",Te=0;for(let _e=0;_e<R.length;Te>=65536?_e+=2:_e++){Te=$e(R,_e);const me=I[Te];!me&&Re(Te)?(ae+=R[_e],Te>=65536&&(ae+=R[_e+1])):ae+=me||X(Te)}return ae}function pn(R,ae,Te){let _e="";const me=R.tag;for(let je=0,ke=Te.length;je<ke;je+=1){let Be=Te[je];R.replacer&&(Be=R.replacer.call(Te,String(je),Be)),(xe(R,ae,Be,!1,!1)||typeof Be>"u"&&xe(R,ae,null,!1,!1))&&(_e!==""&&(_e+=","+(R.condenseFlow?"":" ")),_e+=R.dump)}R.tag=me,R.dump="["+_e+"]"}function gn(R,ae,Te,_e){let me="";const je=R.tag;for(let ke=0,Be=Te.length;ke<Be;ke+=1){let H=Te[ke];R.replacer&&(H=R.replacer.call(Te,String(ke),H)),(xe(R,ae+1,H,!0,!0,!1,!0)||typeof H>"u"&&xe(R,ae+1,null,!0,!0,!1,!0))&&((!_e||me!=="")&&(me+=fe(R,ae)),R.dump&&d===R.dump.charCodeAt(0)?me+="-":me+="- ",me+=R.dump)}R.tag=je,R.dump=me||"[]"}function Mi(R,ae,Te){let _e="";const me=R.tag,je=Object.keys(Te);for(let ke=0,Be=je.length;ke<Be;ke+=1){let H="";_e!==""&&(H+=", "),R.condenseFlow&&(H+='"');const se=je[ke];let ge=Te[se];R.replacer&&(ge=R.replacer.call(Te,se,ge)),xe(R,ae,se,!1,!1)&&(R.dump.length>1024&&(H+="? "),H+=R.dump+(R.condenseFlow?'"':"")+":"+(R.condenseFlow?"":" "),xe(R,ae,ge,!1,!1)&&(H+=R.dump,_e+=H))}R.tag=me,R.dump="{"+_e+"}"}function S(R,ae,Te,_e){let me="";const je=R.tag,ke=Object.keys(Te);if(R.sortKeys===!0)ke.sort();else if(typeof R.sortKeys=="function")ke.sort(R.sortKeys);else if(R.sortKeys)throw new n("sortKeys must be a boolean or a function");for(let Be=0,H=ke.length;Be<H;Be+=1){let se="";(!_e||me!=="")&&(se+=fe(R,ae));const ge=ke[Be];let Pe=Te[ge];if(R.replacer&&(Pe=R.replacer.call(Te,ge,Pe)),!xe(R,ae+1,ge,!0,!0,!0))continue;const it=R.tag!==null&&R.tag!=="?"||R.dump&&R.dump.length>1024;it&&(R.dump&&d===R.dump.charCodeAt(0)?se+="?":se+="? "),se+=R.dump,it&&(se+=fe(R,ae)),xe(R,ae+1,Pe,!0,it)&&(R.dump&&d===R.dump.charCodeAt(0)?se+=":":se+=": ",se+=R.dump,me+=se)}R.tag=je,R.dump=me||"{}"}function re(R,ae,Te){const _e=Te?R.explicitTypes:R.implicitTypes;for(let me=0,je=_e.length;me<je;me+=1){const ke=_e[me];if((ke.instanceOf||ke.predicate)&&(!ke.instanceOf||typeof ae=="object"&&ae instanceof ke.instanceOf)&&(!ke.predicate||ke.predicate(ae))){if(Te?ke.multi&&ke.representName?R.tag=ke.representName(ae):R.tag=ke.tag:R.tag="?",ke.represent){const Be=R.styleMap[ke.tag]||ke.defaultStyle;let H;if(l.call(ke.represent)==="[object Function]")H=ke.represent(ae,Be);else if(u.call(ke.represent,Be))H=ke.represent[Be](ae,Be);else throw new n("!<"+ke.tag+'> tag resolver accepts not "'+Be+'" style');R.dump=H}return!0}}return!1}function xe(R,ae,Te,_e,me,je,ke){R.tag=null,R.dump=Te,re(R,Te,!1)||re(R,Te,!0);const Be=l.call(R.dump),H=_e;_e&&(_e=R.flowLevel<0||R.flowLevel>ae);const se=Be==="[object Object]"||Be==="[object Array]";let ge,Pe;if(se&&(ge=R.duplicates.indexOf(Te),Pe=ge!==-1),(R.tag!==null&&R.tag!=="?"||Pe||R.indent!==2&&ae>0)&&(me=!1),Pe&&R.usedDuplicates[ge])R.dump="*ref_"+ge;else{if(se&&Pe&&!R.usedDuplicates[ge]&&(R.usedDuplicates[ge]=!0),Be==="[object Object]")_e&&Object.keys(R.dump).length!==0?(S(R,ae,R.dump,me),Pe&&(R.dump="&ref_"+ge+R.dump)):(Mi(R,ae,R.dump),Pe&&(R.dump="&ref_"+ge+" "+R.dump));else if(Be==="[object Array]")_e&&R.dump.length!==0?(R.noArrayIndent&&!ke&&ae>0?gn(R,ae-1,R.dump,me):gn(R,ae,R.dump,me),Pe&&(R.dump="&ref_"+ge+R.dump)):(pn(R,ae,R.dump),Pe&&(R.dump="&ref_"+ge+" "+R.dump));else if(Be==="[object String]")R.tag!=="?"&&An(R,R.dump,ae,je,H);else{if(Be==="[object Undefined]")return!1;if(R.skipInvalid)return!1;throw new n("unacceptable kind of an object to dump "+Be)}if(R.tag!==null&&R.tag!=="?"){let it=encodeURI(R.tag[0]==="!"?R.tag.slice(1):R.tag).replace(/!/g,"%21");R.tag[0]==="!"?it="!"+it:it.slice(0,18)==="tag:yaml.org,2002:"?it="!!"+it.slice(18):it="!<"+it+">",R.dump=it+" "+R.dump}}return!0}function ye(R,ae){const Te=[],_e=[];he(R,Te,_e);const me=_e.length;for(let je=0;je<me;je+=1)ae.duplicates.push(Te[_e[je]]);ae.usedDuplicates=new Array(me)}function he(R,ae,Te){if(R!==null&&typeof R=="object"){const _e=ae.indexOf(R);if(_e!==-1)Te.indexOf(_e)===-1&&Te.push(_e);else if(ae.push(R),Array.isArray(R))for(let me=0,je=R.length;me<je;me+=1)he(R[me],ae,Te);else{const me=Object.keys(R);for(let je=0,ke=me.length;je<ke;je+=1)he(R[me[je]],ae,Te)}}}function Ae(R,ae){ae=ae||{};const Te=new oe(ae);Te.noRefs||ye(R,Te);let _e=R;return Te.replacer&&(_e=Te.replacer.call({"":_e},"",_e)),xe(Te,0,_e,!0,!0)?Te.dump+`
|
|
211
|
+
`:""}t.exports.dump=Ae})),R5=uX(Yt(((e,t)=>{var s=hX(),n=fX();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=mn(),t.exports.Schema=m5(),t.exports.FAILSAFE_SCHEMA=b5(),t.exports.JSON_SCHEMA=S5(),t.exports.CORE_SCHEMA=k5(),t.exports.DEFAULT_SCHEMA=uv(),t.exports.load=s.load,t.exports.loadAll=s.loadAll,t.exports.dump=n.dump,t.exports.YAMLException=wu(),t.exports.types={binary:E5(),float:w5(),map:x5(),null:v5(),pairs:A5(),set:T5(),timestamp:N5(),bool:_5(),int:y5(),merge:C5(),omap:j5(),seq:g5(),str:p5()},t.exports.safeLoad=o("safeLoad","load"),t.exports.safeLoadAll=o("safeLoadAll","loadAll"),t.exports.safeDump=o("safeDump","dump")}))()),{Type:$Q,Schema:HQ,FAILSAFE_SCHEMA:UQ,JSON_SCHEMA:FQ,CORE_SCHEMA:qQ,DEFAULT_SCHEMA:VQ,load:GQ,loadAll:WQ,dump:KQ,YAMLException:YQ,types:XQ,safeLoad:ZQ,safeLoadAll:QQ,safeDump:JQ}=R5.default,mX=R5.default;function M5(e){return e!==null&&typeof e=="object"}function D5(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 O5(e){return e==null?"null":typeof e=="string"?e===""?'""':e:String(e)}function L5({label:e,value:t,depth:s,defaultOpen:n}){const[o,l]=_.useState(n),u={paddingLeft:`${s*1.1}rem`};if(!M5(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:ue("whitespace-pre-wrap break-words",D5(t)),children:O5(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(Gn,{className:"size-3.5 shrink-0 text-muted-foreground"}):r.jsx(Wn,{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(L5,{label:d,value:p,depth:s+1,defaultOpen:s<1},d)):null]})}function pX({content:e}){const t=_.useMemo(()=>{try{const n=mX.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(Qe,{variant:"destructive",children:["Could not parse YAML: ",t.error]})});if(!M5(t.value))return r.jsx("div",{className:"p-4 font-mono text-[12px]",children:r.jsx("span",{className:D5(t.value),children:O5(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(L5,{label:n,value:o,depth:0,defaultOpen:!0},n))})}const gX=_.lazy(()=>lu(()=>import("./code-editor-GK07_DNL.js"),[]).then(e=>({default:e.CodeEditor})));function xX(e){const t=e.split("/").pop()?.toLowerCase().split(".").pop()??"";return t==="md"||t==="mdx"||t==="markdown"?"markdown":t==="yml"||t==="yaml"?"yaml":null}function bX(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 vX(e,t){const s=e.endsWith(`
|
|
212
|
+
`)?e.slice(0,-1):e;return!t||!P0.getLanguage(t)?s.split(`
|
|
213
|
+
`).map(_N):s.split(`
|
|
214
|
+
`).map(n=>{if(!n)return"";try{return P0.highlight(n,{language:t,ignoreIllegals:!0}).value}catch{return _N(n)}})}function _N(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function _X({content:e,path:t}){const s=_.useMemo(()=>bX(t),[t]),n=_.useMemo(()=>vX(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 yX({path:e,isModified:t,onViewDiff:s,onFileSaved:n,onSendToAi:o}){const[l,u]=_.useState(null),[h,f]=_.useState(""),[d,p]=_.useState(!1),[g,x]=_.useState(null),[v,w]=_.useState(!1),[k,N]=_.useState(!1),{success:C,error:A}=as(),j=_.useMemo(()=>xX(e),[e]),[T,M]=_.useState("preview"),O=!!(l&&!l.binary&&!l.truncated),$=l?h!==l.content:!1;_.useEffect(()=>{M(j?"preview":"source"),p(!1)},[j]),_.useEffect(()=>{if(!e){u(null);return}let B=!0;return w(!0),x(null),p(!1),gO(e).then(G=>{B&&(u(G),f(G.content),w(!1))}).catch(G=>{B&&(x(G instanceof Error?G.message:String(G)),w(!1))}),()=>{B=!1}},[e]);async function D(){if(!(!e||!l||!$||k)){N(!0);try{await xO(e,h);const B={...l,content:h,size:new TextEncoder().encode(h).length};u(B),p(!1),C(`Saved ${e}.`),n?.(e)}catch(B){A(B instanceof Error?B.message:String(B))}finally{N(!1)}}}function P(){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:()=>M("preview"),"aria-pressed":T==="preview",className:ue("flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium transition-colors",T==="preview"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"),children:[r.jsx(Z0,{className:"size-3.5"}),"Preview"]}),r.jsxs("button",{type:"button",onClick:()=>M("source"),"aria-pressed":T==="source",className:ue("flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium transition-colors",T==="source"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"),children:[r.jsx(KN,{className:"size-3.5"}),"Source"]})]}):null,t?r.jsx(J,{onClick:s,size:"sm",type:"button",variant:"outline",children:"View diff"}):null,o?r.jsx(J,{"aria-label":"Send file to AI input",className:"size-8",disabled:!e,onClick:o,size:"icon",title:"Send file path to AI input",type:"button",variant:"outline",children:r.jsx(Ft,{className:"size-4"})}):null,d?r.jsxs(r.Fragment,{children:[r.jsxs(J,{disabled:!$||k,onClick:()=>{D()},size:"sm",type:"button",children:[r.jsx(lC,{}),"Apply"]}),r.jsxs(J,{disabled:k,onClick:P,size:"sm",type:"button",variant:"outline",children:[r.jsx(qt,{}),"Cancel"]})]}):O?r.jsxs(J,{onClick:()=>{M("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(Qe,{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(gX,{path:e,value:h,onChange:f})}):j&&T==="preview"?j==="markdown"?r.jsx(cv,{content:l.content}):r.jsx(pX,{content:l.content}):r.jsx(_X,{content:l.content,path:e}):null})]}):r.jsx("div",{className:"p-4",children:r.jsx(Qe,{variant:"muted",className:"border-dashed p-12 text-center",children:"Select a file to view its contents."})})}function wX({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 yN(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 wN({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(Gn,{size:12}):r.jsx(Wn,{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(z5,{node:d,depth:1,onSelect:s,forceOpen:o},d.fullPath))}):null]})}function z5({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(Vn,{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(Gn,{size:11}):r.jsx(Wn,{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(z5,{node:p,depth:t+1,onSelect:s,forceOpen:n},p.fullPath))}):null]})}function SX({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(Qe,{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(Qe,{variant:"muted",className:"border-dashed p-6 text-center",children:e.parents.length>1?"Merge commit with no conflict resolution — no diff against the first parent.":"No textual changes in this commit."})}):r.jsx("div",{className:"p-4",children:r.jsx(Qe,{variant:"muted",className:"border-dashed p-12 text-center",children:"Select a commit to inspect its diff."})})})]})}function kX({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(Qe,{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:NX(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 NX(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 SN=["#3b82f6","#10b981","#f59e0b","#ec4899","#8b5cf6","#14b8a6","#ef4444","#84cc16"];function jc(e){return SN[e%SN.length]}function CX({lane:e,laneCount:t,edges:s,throughLanes:n,isMerge:o,height:l=28,laneWidth:u=14}){const f=Math.max(e+1,t,1)*u,d=l/2,p=Ac(e,u),g=o?4:3.5;return 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:Ac(x,u),y1:0,x2:Ac(x,u),y2:l,stroke:jc(x),strokeWidth:1.5},`t-${x}`)),r.jsx("line",{x1:p,y1:0,x2:p,y2:d,stroke:jc(e),strokeWidth:1.5}),s.map((x,v)=>{const w=Ac(x.fromLane,u),k=Ac(x.toLane,u);if(w===k)return r.jsx("line",{x1:w,y1:d,x2:k,y2:l,stroke:jc(x.toLane),strokeWidth:1.5},`e-${v}`);const N=d+(l-d)/2;return r.jsx("path",{d:`M ${w} ${d} C ${w} ${N}, ${k} ${N}, ${k} ${l}`,fill:"none",stroke:jc(x.toLane),strokeWidth:1.5},`e-${v}`)}),r.jsx("circle",{cx:p,cy:d,r:g,fill:jc(e),stroke:"var(--background, #fff)",strokeWidth:1.5})]})}function Ac(e,t){return e*t+t/2}const EX=5,U0=new Map,Sx=new Map,F0=[];let q0=0;function kN(){for(;q0<EX&&F0.length>0;){const e=F0.shift();e&&(q0++,e())}}function jX(e){return U0.get(e)}function AX(e){const t=U0.get(e);if(t)return Promise.resolve(t);const s=Sx.get(e);if(s)return s;const n=new Promise((o,l)=>{F0.push(()=>{HO(e).then(u=>{u.state!=="pending"&&U0.set(e,u),o(u)}).catch(l).finally(()=>{q0--,Sx.delete(e),kN()})})});return Sx.set(e,n),kN(),n}function TX({sha:e}){const[t,s]=_.useState(()=>jX(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(),AX(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=RX(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 RX(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 NN=28;function MX({commits:e,loading:t,error:s,selectedHash:n,maxLanes:o,rowRefs:l,onSelect:u,onLoadMore:h}){const{sendToAgent:f}=At(),[d,p]=_.useState(null);function g(x,v){p(null),f({prompt:N$(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(J,{disabled:t,onClick:h,size:"sm",type:"button",variant:"outline",children:"Load more"})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:s?r.jsx("div",{className:"p-3",children:r.jsx(Qe,{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:NN},title:`${x.hash}
|
|
215
|
+
${x.author} <${x.email}>
|
|
216
|
+
${x.subject}`,children:[r.jsx(CX,{lane:x.lane,laneCount:Math.max(x.laneCount,o),edges:x.edges,throughLanes:x.throughLanes,isMerge:x.parents.length>1,height:NN}),r.jsxs("span",{className:"flex items-center gap-1 font-mono text-[10px] text-muted-foreground",children:[x.hash.slice(0,7),r.jsx(TX,{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:OX(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:DX(x.timestamp)})]}),r.jsx(Zi,{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(Tr,{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 DX(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 OX(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 CN=200;function LX(){const[e,t]=_.useState([]),[s,n]=_.useState(CN),[o,l]=_.useState(0),[u,h]=_.useState(!0),[f,d]=_.useState(null),[p,g]=_.useState(null),[x,v]=_.useState([]),[w,k]=_.useState(!1),[N,C]=_.useState(null),[A,j]=_.useState(null),[T,M]=_.useState(""),[O,$]=_.useState(!1),[D,P]=_.useState(null),B=_.useCallback(z=>{g(z),v([]),j(null),M("")},[]);_.useEffect(()=>{let z=!0;return h(!0),d(null),dO(s).then(U=>{z&&(t(U),U.length>0&&!U.some(K=>K.hash===p)&&B(U[0].hash))}).catch(U=>{z&&d(U instanceof Error?U.message:String(U))}).finally(()=>{z&&h(!1)}),()=>{z=!1}},[s,o]),_.useEffect(()=>{if(!p){v([]),j(null),k(!1);return}let z=!0;return C(null),k(!0),fO(p).then(U=>{z&&(v(U),j(U[0]?.path??null))}).catch(U=>{z&&C(U instanceof Error?U.message:String(U))}).finally(()=>{z&&k(!1)}),()=>{z=!1}},[p]),_.useEffect(()=>{if(!p||!A){M(""),$(!1);return}let z=!0;return P(null),$(!0),hO(p,A).then(U=>{z&&M(U)}).catch(U=>{z&&P(U instanceof Error?U.message:String(U))}).finally(()=>{z&&$(!1)}),()=>{z=!1}},[p,A]);const G=_.useMemo(()=>e.reduce((z,U)=>Math.max(z,U.laneCount),1),[e]),F=e.find(z=>z.hash===p)??null;return{commits:e,loading:u,error:f,selectedHash:p,setSelectedHash:B,files:x,filesError:N,selectedFile:A,setSelectedFile:j,diff:T,diffLoading:O||w,diffError:D,maxLanes:G,selectedCommit:F,loadMore:()=>n(z=>z+CN),refresh:()=>l(z=>z+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:N}=LX();vl(N);const[C,A]=_.useState(""),j=_.useMemo(()=>{const P=C.trim().toLowerCase();return P?e.filter(B=>B.name.toLowerCase().includes(P)):e},[e,C]),T=_.useMemo(()=>yN(j.filter(P=>!P.remote)),[j]),M=_.useMemo(()=>yN(j.filter(P=>P.remote)),[j]),O=C.trim().length>0,$=_.useRef(new Map);function D(P){const B=P.remote?"remote":"branch",G=t.find(U=>U.refs.some(K=>K.kind===B&&K.name===P.name));if(!G)return;l(G.hash);const F=$.current.get(G.hash),z=F?.parentElement?.parentElement;!F||!z||z.scrollTo({top:Math.max(F.offsetTop-z.clientHeight/2+F.clientHeight/2,0),behavior:"smooth"})}return 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:C,onChange:P=>A(P.target.value),placeholder:"Search branches…",className:"w-full rounded border border-border bg-background px-2 py-1 text-[11px] outline-none focus:border-foreground"})]}),r.jsxs("div",{className:"min-h-0 flex-1 overflow-auto py-1",children:[r.jsx(wN,{label:"Local",tree:T,onSelect:D,defaultOpen:!0,forceOpen:O}),r.jsx(wN,{label:"Remote",tree:M,onSelect:D,forceOpen:O})]})]}),r.jsxs("div",{className:"grid min-h-0 min-w-0 grid-rows-[minmax(0,3fr)_minmax(0,2fr)]",children:[r.jsx(SX,{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(MX,{commits:t,loading:s,error:n,selectedHash:o,maxLanes:v,rowRefs:$,onSelect:l,onLoadMore:k}),r.jsx(kX,{files:u,filesError:h,selectedHash:o,selectedFile:f,onSelect:d})]})]})]})}function BX({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),kC(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=Bb(n);return Rr.createPortal(r.jsxs("div",{className:"fixed inset-0 z-[1000] flex justify-end",children:[r.jsx("button",{"aria-label":"Close diff",className:"absolute inset-0 bg-black/35",onClick:s,type:"button"}),r.jsxs("div",{className:"relative z-10 flex h-full w-[min(900px,calc(100vw-3rem))] flex-col bg-card shadow-xl",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-3 py-2",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"truncate text-[13px] font-semibold tracking-tight",children:t}),r.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground",children:[r.jsx("span",{className:"font-mono",children:e}),d.additions||d.deletions?r.jsxs("span",{className:"flex items-center gap-1 font-mono",children:[r.jsxs("span",{className:"text-emerald-700",children:["+",d.additions]}),r.jsxs("span",{className:"text-red-700",children:["-",d.deletions]})]}):null]})]}),r.jsx(J,{"aria-label":"Close diff",onClick:s,size:"icon",variant:"ghost",children:r.jsx(qt,{})})]}),r.jsx("div",{className:"relative min-h-0 min-w-0 flex-1",children:l?r.jsx("div",{className:"p-4",children:r.jsx(Qe,{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 B5(e){return e.split(/[\\/]/).filter(Boolean).pop()??"project"}function PX({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=IX(h);return _.useEffect(()=>{o(e)},[e]),_.useEffect(()=>{h&&u(h.path)},[h]),_.useEffect(()=>{let w=!0;return x(!0),p(null),MC(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(J,{"aria-label":"Open parent folder",onClick:()=>h&&o(h.parent),size:"icon",type:"button",variant:"ghost",children:r.jsx(Gn,{className:"rotate-90"})}):null,r.jsx(dt,{"aria-label":"Folder path",className:"h-7 min-w-0 flex-1 font-mono text-xs",onChange:w=>u(w.target.value),onKeyDown:w=>{if(w.key==="Enter"){w.preventDefault();const k=l.trim();k&&o(k)}},spellCheck:!1,value:l}),g?r.jsx(jt,{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(Qe,{variant:"destructive",className:"m-1",children:d}):null,!d&&h?.entries.length===0?r.jsx(Qe,{variant:"muted",className:"m-1 text-center",children:"No folders here."}):null,h?.entries.map(w=>r.jsxs(J,{className:ue("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(lo,{className:"text-accent"}),r.jsx("span",{className:"truncate",children:w.name})]},w.path))]})]})}function IX(e){return!!(e&&e.parent!==e.path)}function P5({confirmLabel:e="Use this folder",errorMessage:t,initialPath:s,onCancel:n,onSelect:o,onUse:l,selectedPath:u,title:h="Choose Git Project Folder"}){return Rr.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(lo,{className:"size-4"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"text-sm font-semibold",children:h}),r.jsx("div",{className:"truncate font-mono text-xs text-muted-foreground",children:u})]}),r.jsx(J,{"aria-label":"Close folder picker",onClick:n,size:"icon",variant:"ghost",children:r.jsx(qt,{})})]}),r.jsx(PX,{initialPath:s,onSelect:o,selectedPath:u}),t?r.jsx("div",{className:"mt-3 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:t}):null,r.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[r.jsx(J,{onClick:n,type:"button",variant:"outline",children:"Cancel"}),r.jsx(J,{onClick:()=>{l()},type:"button",children:e})]})]})}),document.body)}const Tc=5,$X=240,V0=8,HX=176+V0;function UX({currentRepoPath:e}){const[t,s]=_.useState(null),[n,o]=_.useState([]),[l,u]=_.useState(null),[h,f]=_.useState(!0),[d,p]=_.useState(null),g=_.useRef(null),x=_.useRef(null),[v,w]=_.useState(0);_.useEffect(()=>{const z=x.current;if(!z)return;const U=new ResizeObserver(K=>{w(K[0].contentRect.width)});return U.observe(z),()=>U.disconnect()},[t]);const k=_.useCallback(()=>{let z=!0;return f(!0),u(null),Xp().then(U=>{z&&(s(U.repos),o(U.board))}).catch(U=>{z&&u(U instanceof Error?U.message:String(U))}).finally(()=>{z&&f(!1)}),()=>{z=!1}},[]);_.useEffect(k,[k]);const N=_.useCallback(()=>{Xp().then(z=>{s(z.repos),o(z.board)}).catch(z=>{u(z instanceof Error?z.message:String(z))})},[]),C=_.useCallback(z=>{o(z),gw(z).catch(U=>{u(U instanceof Error?U.message:String(U))})},[]),A=_.useCallback(async z=>{const U=z.trim();if(!U.startsWith("/"))return"Please add an absolute path (it must start with /).";try{const K=B5(U);await ji("/api/git/repositories",{name:K,path:U});const I=await Xp();s(I.repos);const Z=(I.board.includes(K)?I.board:[...I.board,K]).slice(0,Tc);return o(Z),await gw(Z),null}catch(K){return K instanceof Error?K.message:String(K)}},[]),j=new Map((t??[]).map(z=>[z.name,z])),T=n.map(z=>j.get(z)).filter(z=>!!z).slice(0,Tc),M=(t??[]).filter(z=>!n.includes(z.name)),O=T.length<Tc,$=Math.max(0,v-(O?HX:0)),D=v===0?Tc:Math.max(1,Math.floor(($+V0)/($X+V0))),P=Math.min(T.length,D),B=T.slice(0,P),G=T.length-P;function F(z){const U=g.current;if(g.current=null,U===null||U===z)return;const K=[...n],[I]=K.splice(U,1);K.splice(z,0,I),C(K)}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(J0,{className:"size-3.5"}),"Repositories",t?r.jsxs(Ye,{variant:"secondary",className:"ml-1",children:[T.length,t.length>T.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(J,{"aria-label":"Refresh repositories",disabled:h,onClick:k,size:"sm",type:"button",variant:"outline",children:[r.jsx(Ar,{className:h?"animate-spin":void 0}),"Refresh"]})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:l?r.jsx(Qe,{variant:"destructive",className:"m-3",children:l}):t&&t.length===0?r.jsx(Qe,{variant:"muted",className:"m-3 text-center",children:"No Git projects registered. Add one with the project picker in the header."}):r.jsxs("div",{className:"flex h-full min-h-0 gap-2 p-2",ref:x,children:[B.map((z,U)=>r.jsx(FX,{repo:z,isCurrent:!!e&&z.path===e,selectedFile:d?.repo===z.name?d.file:"",onSelectFile:K=>p({repo:z.name,file:K}),onRemove:()=>C(n.filter(K=>K!==z.name)),onMutated:N,onDragStart:()=>{g.current=U},onDropColumn:()=>F(U)},z.name)),O?r.jsx(qX,{unpinned:M,onAdd:z=>C([...n,z].slice(0,Tc)),onRegister:A}):null]})}),d?r.jsx(BX,{repo:d.repo,file:d.file,onClose:()=>p(null)}):null]})}function FX({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(A,j)=>{if(j.length){g(!0);try{await A(j,e.name),l()}finally{g(!1)}}},[e.name,l]),k={busy:p,onStage:A=>{w(ob,A)},onUnstage:A=>{w(NC,A)}},N=e.files.filter(A=>A.index.trim()&&A.index!=="?").length,C=x?Gn:Wn;return r.jsxs("div",{className:ue("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:A=>{A.preventDefault(),d(!0)},onDragLeave:()=>d(!1),onDrop:()=>{d(!1),h()},children:[r.jsxs("div",{className:"flex shrink-0 cursor-grab items-center justify-between gap-1 border-b border-border bg-muted/40 px-1.5 py-1.5 active:cursor-grabbing",draggable:!0,onDragStart:u,children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[r.jsx(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(Zs,{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(qt,{className:"size-3.5"})})]})]}),r.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:r.jsx(e5,{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(A=>!A),type:"button",children:[r.jsx(C,{className:"size-3.5 shrink-0"}),r.jsx("span",{className:"flex-1",children:"Commit"}),N?r.jsxs(Ye,{size:"small",variant:"secondary",children:[N," staged"]}):null]}),x?r.jsx(t5,{branch:e.branch||void 0,files:e.files,onDone:l,repo:e.name}):null]})]})}function qX({unpinned:e,onAdd:t,onRegister:s}){const[n,o]=_.useState(!1),[l,u]=_.useState(null),[h,f]=_.useState(""),[d,p]=_.useState(null),[g,x]=_.useState(!1),[v,w]=_.useState(!1),[k,N]=_.useState(""),C=_.useRef(null),A=_.useRef(null);function j(){if(n){o(!1);return}u(C.current?.getBoundingClientRect()??null),p(null),o(!0)}_.useEffect(()=>{if(!n)return;function O($){const D=$.target;D instanceof Node&&(A.current?.contains(D)||C.current?.contains(D)||o(!1))}return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[n]);async function T(O){x(!0),p(null);const $=await s(O);return x(!1),$?(p($),!1):(f(""),o(!1),!0)}async function M(O){O.preventDefault(),await T(h)}return r.jsxs("div",{className:"w-44 shrink-0",children:[r.jsxs("button",{ref:C,className:"flex h-full w-full flex-col items-center justify-center gap-1.5 rounded-md border border-dashed border-border text-muted-foreground transition-colors hover:border-foreground/40 hover:text-foreground",onClick:j,type:"button",children:[r.jsx(ps,{className:"size-5"}),r.jsx("span",{className:"text-[12px] font-medium",children:"Add repository"})]}),n&&l?Rr.createPortal(r.jsxs("div",{ref:A,className:"fixed z-[1000] w-72 overflow-hidden rounded-lg border border-border bg-card shadow-xl",style:{left:Math.max(8,Math.min(l.left,window.innerWidth-296)),top:Math.min(l.top,window.innerHeight-320)},children:[e.length?r.jsxs("div",{className:"border-b border-border",children:[r.jsx("div",{className:"px-3 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Pin a registered repo"}),r.jsx("div",{className:"max-h-52 overflow-auto pb-1",children:e.map(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(J0,{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(Ye,{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:M,children:[r.jsx(dt,{"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(J,{className:"h-7 px-2 text-[11px]",disabled:g||!h.trim(),size:"sm",type:"submit",children:"Add"})]}),r.jsxs(J,{className:"mt-1.5 h-7 w-full gap-1.5 text-[11px]",disabled:g,onClick:()=>{N(h.trim()||""),w(!0)},size:"sm",type:"button",variant:"outline",children:[r.jsx(eb,{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(P5,{confirmLabel:"Add repository",errorMessage:d,initialPath:k||"/",selectedPath:k,title:"Add Repository",onCancel:()=>w(!1),onSelect:N,onUse:async()=>{await T(k)&&w(!1)}}):null]})}const G0=300,VX=600,GX=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 WX(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:!GX.has(t.slice(s+1))}function KX(e){return e>=VX?"danger":e>=G0?"warn":"ok"}const YX={ok:"bg-emerald-500/60",warn:"bg-amber-500/70",danger:"bg-destructive/70"},XX={ok:"text-muted-foreground",warn:"text-amber-600 dark:text-amber-400",danger:"text-destructive"};function ZX({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),pO().then(n).catch(k=>h(k instanceof Error?k.message:String(k))).finally(()=>l(!1))}_.useEffect(()=>{p()},[]);const g=_.useMemo(()=>f?s.filter(k=>WX(k.path)):s,[s,f]),x=s.length-g.length,v=g[0]?.lines??1,w=g.filter(k=>k.lines>=G0).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(JN,{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 ",G0," lines",f&&x>0?` · ${x} data/docs hidden`:""]}):null]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsxs(J,{size:"sm",variant:f?"default":"outline",className:"h-7",onClick:()=>d(k=>!k),title:"Hide docs, data, config and generated files",type:"button",children:[r.jsx(KN,{}),"Code only"]}),r.jsxs(J,{size:"sm",variant:"outline",className:"h-7",onClick:p,disabled:o,type:"button",children:[o?r.jsx(jt,{className:"animate-spin"}):r.jsx(Ar,{}),"Refresh"]})]})]}),u?r.jsx(Qe,{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(jt,{className:"mr-2 size-4 animate-spin"}),"Scanning tracked files…"]}):g.length===0?r.jsx("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:s.length===0?"No tracked text files found.":"No code files — toggle off “Code only” to see data & docs."}):r.jsx("ul",{className:"min-h-0 flex-1 divide-y divide-border/60 overflow-auto",children:g.map((k,N)=>{const C=KX(k.lines);return r.jsxs("li",{className:"group flex items-center gap-3 px-3 transition-colors hover:bg-muted/50",children:[r.jsx("span",{className:"w-6 shrink-0 text-right font-mono text-[10px] text-muted-foreground",children:N+1}),r.jsx("button",{type:"button",onClick:()=>e(k.path),className:"min-w-0 flex-1 py-1.5 text-left",children:r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsx("span",{className:"truncate font-mono text-[11px]",children:k.path}),r.jsxs("span",{className:ue("shrink-0 font-mono text-[11px] tabular-nums",XX[C]),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:ue("h-full rounded-full",YX[C]),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(QX,{file:k,root:t}),r.jsx(JX,{file:k,root:t})]})]},k.path)})})]})}function QX({file:e,root:t}){const{sendToAgent:s}=At(),n=pu(t,e.path),o=e.path.split("/").pop()??e.path;function l(){s({prompt:k$({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(I5,{label:`AI actions for ${e.path}`,trigger:r.jsx(Ft,{className:"size-3.5"}),children:h=>r.jsxs(r.Fragment,{children:[r.jsx(Yc,{icon:r.jsx(Ft,{className:"size-3.5"}),onSelect:()=>{h(),l()},children:"Ask AI to split this file"}),r.jsx(Yc,{icon:r.jsx(ZN,{className:"size-3.5"}),onSelect:()=>{h(),u()},children:"Send file path to AI"})]})})}function JX({file:e,root:t}){const{error:s,success:n}=as(),o=pu(t,e.path),l=e.path.split("/").pop()??e.path;async function u(h,f){try{await navigator.clipboard.writeText(h),n(`Copied ${f}.`)}catch(d){s(d instanceof Error?d.message:`Could not copy ${f}.`)}}return r.jsx(I5,{label:`Copy path for ${e.path}`,trigger:r.jsxs(r.Fragment,{children:[r.jsx(YN,{className:"size-3.5"}),r.jsx("span",{className:"sr-only",children:"More actions"})]}),children:h=>r.jsxs(r.Fragment,{children:[r.jsx(Yc,{icon:r.jsx(Q0,{className:"size-3.5"}),onSelect:()=>{h(),u(l,"file name")},children:"Copy file name"}),r.jsx(Yc,{icon:r.jsx(Ah,{className:"size-3.5"}),onSelect:()=>{h(),u(e.path,"relative path")},children:"Copy relative path"}),r.jsx(Yc,{icon:r.jsx(Ah,{className:"size-3.5"}),onSelect:()=>{h(),u(o,"absolute path")},children:"Copy absolute path"})]})})}function I5({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:ue("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?Rr.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 Yc({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 eZ({data:e,onRefresh:t}){const{insertPath:s}=At(),[n,o]=_.useState(!1),[l,u]=_.useState("changes"),[h,f]=_.useState("changes"),[d,p]=_.useState(e.git.status?.files[0]?.path??""),[g,x]=_.useState(""),[v,w]=_.useState([]),[k,N]=_.useState(null),[C,A]=_.useState(""),[j,T]=_.useState(null),[M,O]=_.useState(0),[$,D]=_.useState(null),[P,B]=_.useState(()=>new Set),G=e.git.status?.files??[],F=_.useMemo(()=>{const Ne=new Set(G.map($e=>$e.path)),Ue=[...P].filter($e=>!Ne.has($e)).sort().map($e=>({path:$e,index:" ",workingTree:"M"}));return[...G,...Ue]},[G,P]),z=_.useMemo(()=>F.map(Ne=>Ne.path),[F]),U=_.useMemo(()=>Bb(C),[C]),K=_.useCallback(async(Ne,Ue)=>{if(Ue.length){o(!0);try{await Ne(Ue),t?.()}finally{o(!1)}}},[t]),I=t?{busy:n,onStage:Ne=>{K(ob,Ne)},onUnstage:Ne=>{K(NC,Ne)}}:void 0;_.useEffect(()=>{const Ne=F[0]?.path??"";p(Ue=>Ue&&F.some($e=>$e.path===Ue)?Ue:Ne)},[F]),_.useEffect(()=>{if(l!=="all"||v.length>0)return;let Ne=!0;return N(null),mO().then(Ue=>{Ne&&w(Ue)}).catch(Ue=>{Ne&&N(Ue instanceof Error?Ue.message:String(Ue))}),()=>{Ne=!1}},[l,v.length]),_.useEffect(()=>{if(!d){A("");return}let Ne=!0;return T(null),kC(d).then(Ue=>{Ne&&(A(Ue),O(0),D(null))}).catch(Ue=>{Ne&&T(Ue instanceof Error?Ue.message:String(Ue))}),()=>{Ne=!1}},[d]);function Z(Ne){O(0),D(null),p(Ne)}function W(){const Ne=wX({activeHunkIndex:M,filePaths:z,hunkCount:U.hunks,pendingNextFilePath:$,selectedFile:d});Ne.kind==="hunk"?(D(null),O(Ne.activeHunkIndex)):Ne.kind==="confirm-next-file"?D(Ne.filePath):Ne.kind==="file"?Z(Ne.filePath):D(null)}function te(){if(D(null),M>0){O($e=>$e-1);return}const Ne=F.findIndex($e=>$e.path===d),Ue=F[Ne-1];Ue&&Z(Ue.path)}const X=F.findIndex(Ne=>Ne.path===d),V=!!(U.hunks&&M<U.hunks-1||F[X+1]),q=!!(M>0||F[X-1]),oe=$?`End of file. Click Next again to open ${$}.`:null,ee=Ne=>`rounded px-2 py-0.5 text-[11px] font-medium transition-colors ${Ne?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,fe=Ne=>`flex-1 px-2 py-0.5 text-[11px] font-medium transition-colors ${Ne?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,ie=_.useMemo(()=>{const Ne=new Set(F.map(Ue=>Ue.path));for(const Ue of P)Ne.add(Ue);return Ne},[F,P]);if(!e.git.selectedRepository)return r.jsx(tZ,{});function Se(){g&&(u("changes"),f("changes"),Z(g))}function Re(Ne){B(Ue=>new Set(Ue).add(Ne)),x(Ne),u("changes"),f("changes"),Z(Ne)}function De(Ne){x(Ne),u("all")}function Je(Ne){Ne&&s(pu(e.git.cwd,Ne))}return 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:ee(l==="changes"),onClick:()=>u("changes"),children:"Changes"}),r.jsx("button",{type:"button","aria-label":"Show changed files across all repositories",className:ee(l==="board"),onClick:()=>u("board"),children:"Board"}),r.jsx("button",{type:"button","aria-label":"Open all tracked files",className:ee(l==="all"),onClick:()=>u("all"),children:"All files"}),r.jsx("button",{type:"button",className:ee(l==="graph"),onClick:()=>u("graph"),children:"Tree"}),r.jsx("button",{type:"button",className:ee(l==="largest"),onClick:()=>u("largest"),children:"Largest files"}),r.jsx("button",{type:"button",className:ee(l==="snapshots"),onClick:()=>u("snapshots"),children:"Snapshots"})]}),r.jsx("div",{className:"min-h-0 flex-1",children:l==="board"?r.jsx(UX,{currentRepoPath:e.git.cwd}):l==="graph"?r.jsx(zX,{branches:e.git.branches??[]}):l==="largest"?r.jsx(ZX,{onOpenFile:De,root:e.git.cwd}):l==="snapshots"?r.jsx(WI,{}):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(Qe,{variant:"destructive",className:"m-3",children:k}):r.jsx(jk,{branch:e.git.status?.branch||void 0,onSelectFile:x,paths:v,root:e.git.cwd,selectedFile:g,status:F})}),r.jsx(yX,{isModified:ie.has(g),onFileSaved:Re,onSendToAi:()=>Je(g),onViewDiff:Se,path:g})]}):r.jsxs("div",{className:"grid h-full min-h-0 overflow-hidden border-0 bg-card/85 xl:grid-cols-[320px_minmax(0,1fr)]",children:[r.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden",children:[r.jsxs("div",{className:"flex shrink-0 gap-0.5 border-b border-border bg-card/95 p-1",children:[r.jsx("button",{"aria-label":"Show changed files as a list",className:fe(h==="changes"),onClick:()=>f("changes"),type:"button",children:"Changes"}),r.jsx("button",{"aria-label":"Show changed files as a tree",className:fe(h==="tree"),onClick:()=>f("tree"),type:"button",children:"Tree"})]}),h==="changes"?r.jsx(e5,{branch:e.git.status?.branch||void 0,error:e.git.error,files:F,selectedFile:d,onSelectFile:Z,root:e.git.cwd,staging:I}):r.jsx(jk,{branch:e.git.status?.branch||void 0,defaultExpandAll:!0,emptyMessage:e.git.error??"No changed files.",onSelectFile:Z,paths:z,root:e.git.cwd,selectedFile:d,status:F,title:"Changes"}),t&&e.git.status?r.jsx(t5,{branch:e.git.status.branch||void 0,files:F,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."}),U.additions||U.deletions?r.jsxs("span",{className:"flex items-center gap-1 font-mono",children:[r.jsxs("span",{className:"text-emerald-700",children:["+",U.additions]}),r.jsxs("span",{className:"text-red-700",children:["-",U.deletions]})]}):null]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[oe?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:oe}):null,r.jsxs(J,{disabled:!d||!q,onClick:te,size:"sm",type:"button",variant:"outline",children:[r.jsx(uf,{}),"Previous"]}),r.jsxs(J,{disabled:!d||!V,onClick:W,size:"sm",type:"button",variant:"outline",children:[r.jsx(cf,{}),"Next"]}),r.jsx(J,{"aria-label":"Send selected file to AI input",className:"size-8",disabled:!d,onClick:()=>Je(d),size:"icon",title:"Send selected file path to AI input",type:"button",variant:"outline",children:r.jsx(Ft,{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(Qe,{variant:"destructive",children:j})}):d?r.jsx(fu,{activeHunkIndex:M,diff:C||"No unstaged diff for this file."}):r.jsx("div",{className:"p-4",children:r.jsx(Qe,{variant:"muted",className:"border-dashed p-12 text-center",children:"Select a changed file to inspect its diff."})})})]})]})})]})}function tZ(){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(J0,{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 switcher in the sidebar to add one."})]})})}function EN(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=nZ(o,s);return p&&l.push({kind:"action",id:"assert-pr-branch",title:"Check PR branch",op:"assert-pr-branch"}),u&&(l.push(ch("gate-review","Approve review","Review the current changes?")),l.push(Rc("review","Review changes","Review the current git changes. Summarize risks, likely bugs, and anything that should change before committing.",uh(g,["skills","mcpServers"])))),h&&l.push(Rc("verify","Run verification","Run the relevant tests or checks for this repository. If something fails, stop and explain the failure.",uh(g,["skills","mcpServers","plugins"]))),f&&(l.push(Rc("commit-message","Generate commit message","Stage the appropriate changed files, inspect the staged diff briefly, and draft one conventional commit message. Do not commit.",uh(g,["skills"]))),l.push(ch("gate-commit","Approve commit","Commit with this generated message?")),l.push({kind:"action",id:"commit",title:"Commit with approved message",op:"commit"})),d&&(l.push(ch("gate-push","Approve push",p?"Push and continue toward a PR?":"Push this branch?")),l.push({kind:"action",id:"push",title:"Push branch",op:"push"})),p&&(l.push(Rc("open-pr","Open PR","Open a pull request for the current branch. Use the latest commit subject as the title and summarize the commit list in the body.",uh(g,["mcpServers","plugins"]))),l.push({kind:"action",id:"checkout-default-and-pull",title:"Return to default branch",op:"checkout-default-and-pull"})),l.length||(l.push(ch("gate-start","Approve start","Run this workflow?")),l.push(Rc("ai-step","AI step",n||"Complete this workflow step.",g))),{id:rZ($5(jN(o))||"custom-workflow",t),name:jN(o),description:n||"Custom AI-authored workflow.",builtin:!1,steps:iZ(l)}}function sZ(e){return["Create a NoMoreIDE workflow from this user intent:","",e.trim()||"(no intent provided)","","Return a workflow JSON object only. Use this shape:","{",' "id": "short-kebab-id",',' "name": "Human name",',' "description": "One sentence",',' "steps": [',' { kind: "gate", id: "gate-id", title: "Approve thing", message: "Question for the user?" },',' { kind: "agent", id: "ai-id", title: "AI task", prompt: "Clear instruction", capabilities: { skills: [], mcpServers: [], plugins: [], hooks: [] }, verify: "committed" },',' { kind: "action", id: "push", title: "Push", op: "push" },',' { kind: "action", id: "checkout-default-and-pull", title: "Return to default branch", op: "checkout-default-and-pull" }'," ]","}","","Use gates before mutating git or GitHub state. Prefer intent-level AI steps over direct MCP tool calls."].join(`
|
|
217
|
+
`)}function jN(e){const t=/\breview|check|inspect|audit\b/.test(e),s=/\bcommit\b|\bship|push|pr|pull request\b/.test(e),n=/\bpr\b|pull request/.test(e),o=/\btest|verify|ci\b/.test(e);return t&&s&&n?"Review, Commit & PR":o&&s&&n?"Verify, Commit & PR":t&&s?"Review & Commit":s&&n?"Commit & PR":s?"Commit workflow":t?"Review workflow":"Custom workflow"}function ch(e,t,s){return{kind:"gate",id:e,title:t,message:s}}function Rc(e,t,s,n,o){return{kind:"agent",id:e,title:t,prompt:s,capabilities:dv(n),verify:o}}function nZ(e,t){return dv({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 dv(s)}function dv(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 iZ(e){const t=new Map;return e.map(s=>{const n=$5(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 rZ(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 $5(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}const af={"error-incident":"Error incident","service-crash":"Service crash"};function aZ({workflows:e}){const{triggers:t,pending:s,error:n,saveTrigger:o,removeTrigger:l,runPending:u,dismissPending:h}=MU(),[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(fC,{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(J,{onClick:()=>d(g=>!g),size:"sm",type:"button",variant:"outline",children:[r.jsx(ps,{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(J,{onClick:()=>u(g),size:"sm",type:"button",variant:"outline",children:[r.jsx(jr,{className:"size-3"})," Run"]}),r.jsx(J,{onClick:()=>{h(g.id)},size:"icon",type:"button",variant:"ghost","aria-label":"Dismiss",children:r.jsx(qt,{className:"size-3.5"})})]})]},g.id))}):null,f?r.jsx(oZ,{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(J,{onClick:()=>{l(g.id)},size:"icon",type:"button",variant:"ghost","aria-label":"Delete trigger",children:r.jsx(Ti,{className:"size-3.5"})})]},g.id))]})]})}function oZ({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(J,{onClick:t,size:"sm",type:"button",variant:"ghost",children:"Cancel"}),r.jsx(J,{disabled:!l,onClick:()=>{s({id:`trigger-${Date.now().toString(36)}`,event:n,workflowId:l,filter:h.trim()||void 0,enabled:!0,autoRun:d})},size:"sm",type:"button",children:"Add"})]})]})}function lZ(){const{run:e,start:t,resume:s,approve:n,skip:o,stop:l,dismiss:u}=ej(),[h,f]=_.useState([]),[d,p]=_.useState(null),[g,x]=_.useState(null),[v,w]=_.useState(null),[k,N]=_.useState(!0),[C,A]=_.useState(!1),[j,T]=_.useState(!0);_.useEffect(()=>{let P=!0;return N(!0),Promise.all([OC(),vC().catch(()=>null)]).then(([B,G])=>{P&&(f(B),p(G))}).catch(B=>{P&&w(B instanceof Error?B.message:String(B))}).finally(()=>{P&&N(!1)}),()=>{P=!1}},[]);function M(P){A(!0),t(P,j)}async function O(P){w(null);try{const B=await BL(P);f(B),x(null)}catch(B){w(B instanceof Error?B.message:String(B))}}async function $(P){if(!P.builtin&&window.confirm(`Delete workflow "${P.name}"?`)){w(null);try{f(await PL(P.id))}catch(B){w(B instanceof Error?B.message:String(B))}}}function D(P){x({...P,id:hv(`${P.id}-copy`,h),name:`${P.name} copy`,builtin:!1,steps:P.steps.map((B,G)=>({...B,id:`${B.id}-${G+1}`}))})}return e&&C?r.jsx(bZ,{run:e,onApprove:n,onSkip:o,onStop:l,onBack:()=>A(!1),onResume:()=>{A(!0),s(j)},onRestart:()=>{A(!0),t(e.workflow,j)}}):g?r.jsx(dZ,{agent:d?yZ(d):null,existing:h,initial:g,onCancel:()=>x(null),onSave:P=>{O(P)}}):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(Ft,{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 — agent steps do the work, pausing at each gate for your OK."})]}),r.jsxs(J,{onClick:()=>x(SZ(h)),size:"sm",type:"button",variant:"outline",children:[r.jsx(ps,{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:P=>T(P.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(Qe,{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(jt,{className:"mr-2 size-4 animate-spin"})," Loading workflows…"]}):r.jsxs(r.Fragment,{children:[e?r.jsx(cZ,{onClear:u,onView:()=>A(!0),run:e}):null,r.jsx("div",{className:"grid gap-3 p-4 sm:grid-cols-2 xl:grid-cols-3",children:h.map(P=>r.jsx(uZ,{lastRun:e?.workflow.id===P.id?e:null,workflow:P,onDelete:()=>{$(P)},onDuplicate:()=>D(P),onEdit:()=>x(P),onRun:()=>M(P)},P.id))}),r.jsx(aZ,{workflows:h})]})]})}function cZ({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(q5,{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"," ",F5(s.startedAt)]})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[r.jsxs(J,{onClick:t,size:"sm",type:"button",children:[r.jsx(ml,{className:"size-3.5"})," View run"]}),n?null:r.jsxs(J,{onClick:e,size:"sm",type:"button",variant:"outline",children:[r.jsx(qt,{className:"size-3.5"})," Clear"]})]})]})})}function uZ({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 ${F5(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(Wn,{className:ue("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(CZ,{kind:d.kind}),r.jsx("span",{className:"truncate",children:of(d)})]},d.id))}):null,r.jsxs(J,{className:"mt-3 w-full",onClick:l,size:"sm",type:"button",children:[r.jsx(jr,{className:"size-3.5"})," Run"]}),r.jsxs("div",{className:"mt-2 grid grid-cols-3 gap-1.5",children:[r.jsxs(J,{onClick:o,size:"sm",type:"button",variant:"outline",children:[r.jsx(HM,{className:"size-3.5"})," Edit"]}),r.jsxs(J,{onClick:n,size:"sm",type:"button",variant:"outline",children:[r.jsx(Ah,{className:"size-3.5"})," Copy"]}),r.jsxs(J,{disabled:t.builtin,onClick:s,size:"sm",title:t.builtin?"Duplicate or edit to create your own version first":"Delete workflow",type:"button",variant:"outline",children:[r.jsx(Ti,{className:"size-3.5"})," Delete"]})]})]})}function dZ({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=wZ(e),{sendToAgent:x}=At(),v=!l.id.trim()||!l.name.trim()||l.steps.length===0;function w(O,$){u(D=>({...D,steps:D.steps.map((P,B)=>B===O?$(P):P)}))}function k(O,$){u(D=>{const P=O+$;if(P<0||P>=D.steps.length)return D;const B=[...D.steps],[G]=B.splice(O,1);return B.splice(P,0,G),{...D,steps:B}})}function N(O){u($=>({...$,steps:$.steps.filter((D,P)=>P!==O)}))}function C(O,$){u(D=>{const P=[...D.steps];return P.splice(O,0,fZ($,D.steps)),{...D,steps:P}})}function A(O=h){const $=EN(O,t,g);u($)}function j(O){const $=EN(O,[],g);u(D=>({...D,steps:[...D.steps,...$.steps]}))}function T(){x({prompt:sZ(h||l.description||l.name),source:{type:"workflow",label:"Workflow composer"},mode:"draft"})}function M(){const O=ll(l.id)||hv(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(kZ)})}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(Ft,{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($=>({...$,name:O.target.value,id:ll(O.target.value)||$.id})),placeholder:"Name your workflow",value:l.name}),r.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:l.id})]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[r.jsxs(J,{onClick:()=>p(O=>!O),size:"sm",type:"button",variant:d?"default":"outline",children:[r.jsx(Yi,{className:"size-3.5"})," AI compose"]}),r.jsxs(J,{onClick:n,size:"sm",type:"button",variant:"outline",children:[r.jsx(ou,{className:"size-3.5"})," Back"]}),r.jsxs(J,{disabled:v,onClick:M,size:"sm",type:"button",children:[r.jsx(Zs,{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(Cr,{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(J,{onClick:()=>A(),size:"sm",type:"button",children:[r.jsx(Yi,{className:"size-3.5"})," Draft timeline"]}),r.jsxs(J,{onClick:T,size:"sm",type:"button",variant:"outline",children:[r.jsx(vM,{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),A(O)},type:"button",children:O},O))]})]}),r.jsxs("div",{className:"grid gap-3",children:[r.jsx(mZ,{onAdd:j}),r.jsx(pZ,{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(AN,{onInsert:O=>C(0,O)}),l.steps.length?l.steps.map((O,$)=>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(hZ,{index:$,kind:O.kind})]}),r.jsx("div",{className:"min-w-0 flex-1 pb-1",children:r.jsx(gZ,{capabilities:g,index:$,isFirst:$===0,isLast:$===l.steps.length-1,onMove:k,onRemove:N,onUpdate:w,step:O})})]}),r.jsx(AN,{onInsert:D=>C($+1,D)})]},`${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 AN({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:ue("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(qt,{className:"size-3"}):r.jsx(ps,{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(V5,{kind:l})," ",u]},l))}):null})]})}function hZ({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(V5,{kind:t})]})}function fZ(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 mZ({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(Cr,{children:"Add a step"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{className:"min-w-0 flex-1 bg-transparent text-[12px] outline-none placeholder:text-muted-foreground",onChange:n=>s(n.target.value),placeholder:"ask before merge, run tests, open an issue...",value:t}),r.jsxs(J,{size:"sm",type:"submit",variant:"outline",children:[r.jsx(ps,{className:"size-3.5"})," Add"]})]})]})}function pZ({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(Cr,{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 gZ({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(W0,{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:H5(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.jsx(xZ,{capabilities:e,selected:h.capabilities,onToggle:(f,d)=>u(t,p=>p.kind==="agent"?{...p,capabilities:NZ(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(J,{disabled:s,onClick:()=>o(t,-1),size:"sm",type:"button",variant:"ghost",children:"↑"}),r.jsx(J,{disabled:n,onClick:()=>o(t,1),size:"sm",type:"button",variant:"ghost",children:"↓"}),r.jsx(J,{onClick:()=>l(t),size:"sm",type:"button",variant:"ghost",children:r.jsx(Ti,{className:"size-3.5"})})]})]})})}function xZ({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(Cr,{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:ue("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 bZ({run:e,onApprove:t,onSkip:s,onStop:n,onBack:o,onResume:l,onRestart:u}){const{sendToAgent:h}=At(),f=e.outcome!=="running",[d,p]=_.useState(e.index);_.useEffect(()=>{p(e.index)},[e.index]);const g=e.workflow.steps[d]??e.workflow.steps[e.index],x=e.statuses[d]??"pending",v=e.outputs[d],w=e.outputs[d-1],k=g?.kind==="gate"&&x==="waiting",N=x==="failed"||x==="blocked",C=x==="blocked"&&g?.kind==="action"&&g.op==="assert-pr-branch";return r.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-card/85",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("h2",{className:"flex items-center gap-1.5 text-[13px] font-semibold",children:[r.jsx(Ft,{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 workflow run."]})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(q5,{outcome:e.outcome}),r.jsxs(J,{onClick:o,size:"sm",type:"button",variant:"outline",children:[r.jsx(ou,{className:"size-3.5"})," Workflows"]}),f?null:r.jsxs(J,{onClick:n,size:"sm",type:"button",variant:"outline",children:[r.jsx(no,{className:"size-3.5"})," Stop"]})]})]}),r.jsxs("div",{className:"grid min-h-0 flex-1 overflow-hidden lg:grid-cols-[minmax(240px,320px)_minmax(0,1fr)]",children:[r.jsx("aside",{className:"min-h-0 overflow-auto border-b border-border bg-background/55 p-3 lg:border-b-0 lg:border-r",children:r.jsx("ol",{className:"space-y-1",children:e.workflow.steps.map((A,j)=>{const T=e.statuses[j],M=T==="running"||T==="waiting",O=j===d;return r.jsx("li",{children:r.jsxs("button",{className:ue("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]":M?"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:ue("flex size-7 shrink-0 items-center justify-center rounded-full border bg-card",T==="failed"?"border-destructive/50":T==="blocked"?"border-amber-500/50":M?"border-primary/50":T==="done"?"border-emerald-500/50":"border-border"),children:r.jsx(RN,{status:T,kind:A.kind})}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-[12px] font-medium",children:of(A)}),r.jsxs("span",{className:"mt-0.5 flex items-center gap-1.5",children:[r.jsx(W0,{kind:A.kind}),r.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground/70",children:TN(T)})]})]}),r.jsx(Wn,{className:ue("size-3.5 shrink-0 text-muted-foreground/50 transition-transform",O?"translate-x-0.5 text-primary":"")})]})},A.id)})})}),r.jsx("main",{className:"min-h-0 overflow-auto p-4",children:g?r.jsxs("section",{className:ue("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(RN,{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(W0,{kind:g.kind}),r.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground/70",children:TN(x)})]})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[f&&N&&d===e.index&&!C?r.jsxs(J,{"aria-label":"Resume the workflow from this step",onClick:l,size:"sm",type:"button",children:[r.jsx(jr,{className:"size-3.5"})," Resume workflow"]}):null,N?r.jsxs(J,{"aria-label":"Debug this workflow step with AI",onClick:()=>h({prompt:mU({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(Ft,{className:"size-3.5"})," Debug with AI"]}):null,f?null:r.jsxs(J,{"aria-label":"Stop workflow run from step detail",onClick:n,size:"sm",type:"button",variant:"outline",children:[r.jsx(no,{className:"size-3.5"})," Stop after this step"]})]})]}),r.jsxs("div",{className:"py-3 text-[11px] leading-relaxed",children:[r.jsx(_Z,{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(J,{onClick:t,size:"sm",type:"button",children:[r.jsx(Zs,{className:"size-3.5"})," Approve"]}),r.jsxs(J,{onClick:s,size:"sm",type:"button",variant:"outline",children:[r.jsx(dC,{className:"size-3.5"})," Skip"]}),r.jsxs(J,{onClick:n,size:"sm",type:"button",variant:"outline",children:[r.jsx(qt,{className:"size-3.5"})," Stop"]})]}):null,x==="failed"&&e.error?r.jsx("p",{className:"mt-3 text-destructive",children:e.error}):null,C?r.jsx(vZ,{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 vZ({error:e,onRestart:t,workflowName:s}){const{provider:n}=At(),[o,l]=_.useState(""),[u,h]=_.useState(!1),[f,d]=_.useState(!1),[p,g]=_.useState(null),[x,v]=_.useState(null),w=_.useRef(null),k=wU(o);_.useEffect(()=>()=>w.current?.abort(),[]);async function N(A){w.current?.abort();const j=new AbortController;w.current=j,v(null),g(null),l(""),h(!0);try{const T=await $b({prompt:[pU({workflowName:s,error:e}),A?.trim()?A.trim():""].filter(Boolean).join(`
|
|
218
|
+
|
|
219
|
+
`),provider:n?.id,signal:j.signal});j.signal.aborted||l(T)}catch(T){j.signal.aborted||v(T instanceof Error?T.message:String(T))}finally{w.current===j&&(w.current=null,h(!1))}}async function C(){if(k){d(!0),v(null);try{await vO(k),g(k)}catch(A){v(A instanceof Error?A.message:String(A))}finally{d(!1)}}}return r.jsxs("div",{className:"mt-3 rounded-md border border-border bg-muted/35 p-3",children:[r.jsx(Cr,{children:"Recover with AI"}),r.jsx("p",{className:"mb-2 text-[11px] text-muted-foreground",children:"Let the agent inspect the change and suggest a feature branch. You approve before anything changes."}),r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[r.jsxs(J,{onClick:()=>{N()},size:"sm",type:"button",children:[r.jsx(Ft,{className:"size-3.5"})," Recommend branch with AI"]}),p?r.jsxs(J,{onClick:t,size:"sm",type:"button",variant:"outline",children:[r.jsx(jr,{className:"size-3.5"})," Run again"]}):null]}),u?r.jsxs("p",{className:"mt-2 flex items-center gap-1 text-[11px] text-muted-foreground",children:[r.jsx(jt,{className:"size-3 animate-spin"})," Choosing a branch name in the background."]}):null,k?r.jsxs("div",{className:"mt-3 rounded-md border border-border bg-background p-2.5",children:[r.jsx(Cr,{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:k}),r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[r.jsxs(J,{disabled:f||p===k,onClick:()=>{C()},size:"sm",type:"button",children:[f?r.jsx(jt,{className:"size-3.5 animate-spin"}):r.jsx(Zs,{className:"size-3.5"}),"Create this branch"]}),r.jsxs(J,{disabled:f,onClick:()=>{N("Recommend a different concise branch name. Keep the same output contract with `BRANCH_NAME: <branch-name>`.")},size:"sm",type:"button",variant:"outline",children:[r.jsx(Ft,{className:"size-3.5"})," Ask for another"]})]})]})]}):o&&!u?r.jsxs("div",{className:"mt-3 rounded-md border border-border bg-background p-2.5",children:[r.jsx("p",{className:"text-[11px] text-muted-foreground",children:"The agent did not return a branch name the workflow could read."}),r.jsxs(J,{className:"mt-2",onClick:()=>{N("Return only a concise branch suggestion using this exact line: `BRANCH_NAME: <branch-name>`.")},size:"sm",type:"button",variant:"outline",children:[r.jsx(Ft,{className:"size-3.5"})," Ask for another"]})]}):null,p?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:p}),". Run the workflow again from here."]}):null,x?r.jsx("p",{className:"mt-2 text-[11px] text-destructive",children:x}):null]})}function TN(e){return e==="running"?"Running":e==="waiting"?"Waiting":e==="done"?"Done":e==="blocked"?"Needs you":e==="failed"?"Failed":e==="skipped"?"Skipped":"Queued"}function _Z({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(Cr,{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:H5(n.op)});const o=s==="done"||s==="failed"||s==="skipped";return e?r.jsxs("div",{children:[r.jsx(Cr,{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(Cr,{children:o?"Result":"Task"}),o?r.jsx("p",{className:"italic text-muted-foreground",children:"The agent returned no text result."}):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(jt,{className:"size-3 animate-spin"})," Running agent step…"]}):null]})]})}function yZ(e){return e.detected.name==="codex"?e.agents.codex:e.agents["claude-code"]??e}function wZ(e){return e?{skills:Hc(e.skills.map(t=>t.name)),mcpServers:Hc(e.mcpServers.map(t=>t.name)),plugins:Hc(e.plugins.map(t=>t.name)),hooks:Hc(e.hooks.map(t=>t.matcher?`${t.event}: ${t.matcher}`:t.event))}:{skills:[],mcpServers:[],plugins:[],hooks:[]}}function SZ(e){return{id:hv("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 kZ(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=U5(e.capabilities);return{...e,id:t,title:s,prompt:e.prompt.trim()||"Complete this workflow step.",capabilities:n}}function H5(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 U5(e){if(!e)return;const t={};for(const s of["skills","mcpServers","plugins","hooks"]){const n=Hc((e[s]??[]).map(o=>o.trim()).filter(Boolean));n.length&&(t[s]=n)}return Object.keys(t).length?t:void 0}function NZ(e,t,s){const n=e?.[t]??[],o=n.includes(s)?n.filter(l=>l!==s):[...n,s];return U5({...e??{},[t]:o})}function hv(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 Hc(e){return Array.from(new Set(e.filter(Boolean)))}function Cr({children:e}){return r.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:e})}function F5(e){return new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}).format(new Date(e))}function q5({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:ue("rounded-full border px-2 py-0.5 text-[10px] font-medium",n),children:s})}function V5({kind:e}){return e==="gate"?r.jsx(uC,{className:"size-4 text-amber-600 dark:text-amber-400"}):e==="agent"?r.jsx(Yi,{className:"size-4 text-primary"}):r.jsx(jr,{className:"size-4 text-muted-foreground"})}function RN({status:e,kind:t}){return e==="running"?r.jsx(jt,{className:"size-4 shrink-0 animate-spin text-primary"}):e==="waiting"?r.jsx(uC,{className:"size-4 shrink-0 text-primary"}):e==="done"?r.jsx(Zs,{className:"size-4 shrink-0 text-emerald-600 dark:text-emerald-400"}):e==="blocked"?r.jsx(Y0,{className:"size-4 shrink-0 text-amber-600 dark:text-amber-400"}):e==="failed"?r.jsx(Er,{className:"size-4 shrink-0 text-destructive"}):e==="skipped"?r.jsx(dC,{className:"size-4 shrink-0 text-muted-foreground/60"}):t==="agent"?r.jsx(Yi,{className:"size-4 shrink-0 text-muted-foreground/50"}):r.jsx(q4,{className:"size-4 shrink-0 text-muted-foreground/50"})}function CZ(e){return r.jsx(Wn,{className:"size-3 shrink-0 text-muted-foreground/40","aria-hidden":!0})}function W0({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:ue("shrink-0 rounded-full border px-1.5 py-px text-[9px] uppercase tracking-wide",s),children:t})}function of(e){return e.title}const EZ={sm:"size-3.5",md:"size-4",lg:"size-6"};function fv({size:e="md",className:t}){return r.jsx(jt,{"aria-hidden":!0,className:ue("animate-spin",EZ[e],t)})}function Bf({label:e,size:t="md",fill:s=!1,className:n}){return r.jsxs("div",{className:ue("flex items-center justify-center gap-2 text-[12px] text-muted-foreground",s&&"h-full",n),role:"status",children:[r.jsx(fv,{size:t}),e?r.jsx("span",{children:e}):null]})}function jZ(){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),CO().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 kx=30;function AZ(e="open"){const[t,s]=_.useState([]),[n,o]=_.useState(!0),[l,u]=_.useState(!1),[h,f]=_.useState(!1),[d,p]=_.useState(1),[g,x]=_.useState(null),[v,w]=_.useState(null),[k,N]=_.useState(null),[C,A]=_.useState(""),[j,T]=_.useState(!1),[M,O]=_.useState(null);_.useEffect(()=>{let P=!0;return o(!0),x(null),p(1),Zp(e,1).then(B=>{P&&(s(B),f(B.length===kx),B.length>0&&!B.some(G=>G.number===v)&&w(B[0]?.number??null))}).catch(B=>{P&&x(B instanceof Error?B.message:String(B))}).finally(()=>{P&&o(!1)}),()=>{P=!1}},[e]),_.useEffect(()=>{if(!v){N(null);return}let P=!0;return MO(v).then(B=>{P&&N(B)}).catch(()=>{}),()=>{P=!1}},[v]),_.useEffect(()=>{if(!v){A("");return}let P=!0;return T(!0),O(null),DO(v).then(B=>{P&&A(B)}).catch(B=>{P&&O(B instanceof Error?B.message:String(B))}).finally(()=>{P&&T(!1)}),()=>{P=!1}},[v]);function $(){if(l||!h)return;const P=d+1;u(!0),Zp(e,P).then(B=>{s(G=>{const F=new Set(G.map(z=>z.number));return[...G,...B.filter(z=>!F.has(z.number))]}),f(B.length===kx),p(P)}).catch(B=>x(B instanceof Error?B.message:String(B))).finally(()=>u(!1))}function D(){let P=!0;return o(!0),x(null),p(1),Zp(e,1).then(B=>{P&&(s(B),f(B.length===kx))}).catch(B=>{P&&x(B instanceof Error?B.message:String(B))}).finally(()=>{P&&o(!1)}),()=>{P=!1}}return{prs:t,loading:n,loadingMore:l,hasMore:h,error:g,selectedNumber:v,setSelectedNumber:w,selectedPR:k,diff:C,diffLoading:j,diffError:M,loadMore:$,refresh:D}}const Nx=30;function TZ(e="open"){const[t,s]=_.useState([]),[n,o]=_.useState(!0),[l,u]=_.useState(!1),[h,f]=_.useState(!1),[d,p]=_.useState(1),[g,x]=_.useState(null),[v,w]=_.useState(null),[k,N]=_.useState(null),[C,A]=_.useState([]),[j,T]=_.useState(!1),[M,O]=_.useState(null),[$,D]=_.useState(!1);_.useEffect(()=>{let F=!0;return o(!0),x(null),p(1),Qp(e,1).then(z=>{F&&(s(z),f(z.length===Nx),z.length>0&&!z.some(U=>U.number===v)&&w(z[0]?.number??null))}).catch(z=>{F&&x(z instanceof Error?z.message:String(z))}).finally(()=>{F&&o(!1)}),()=>{F=!1}},[e]),_.useEffect(()=>{if(!v){N(null),A([]);return}let F=!0;return T(!0),Promise.all([PO(v),IO(v)]).then(([z,U])=>{F&&(N(z),A(U))}).catch(()=>{}).finally(()=>{F&&T(!1)}),()=>{F=!1}},[v]);async function P(F){if(v){D(!0),O(null);try{const z=await $O(v,F);A(U=>[...U,z])}catch(z){O(z instanceof Error?z.message:String(z))}finally{D(!1)}}}function B(){if(l||!h)return;const F=d+1;u(!0),Qp(e,F).then(z=>{s(U=>{const K=new Set(U.map(I=>I.number));return[...U,...z.filter(I=>!K.has(I.number))]}),f(z.length===Nx),p(F)}).catch(z=>x(z instanceof Error?z.message:String(z))).finally(()=>u(!1))}function G(){let F=!0;return o(!0),p(1),Qp(e,1).then(z=>{F&&(s(z),f(z.length===Nx))}).catch(()=>{}).finally(()=>{F&&o(!1)}),()=>{F=!1}}return{issues:t,loading:n,loadingMore:l,hasMore:h,error:g,selectedNumber:v,setSelectedNumber:w,selectedIssue:k,comments:C,commentsLoading:j,commentError:M,submitting:$,addComment:P,loadMore:B,refresh:G}}function G5({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(RZ,{onSuccess:s,onCancel:()=>o("choose")}):n==="pat"?r.jsx(MZ,{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(nw,{className:"size-6 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-base font-semibold",children:"Connect GitHub"}),r.jsx("p",{className:"mt-1 max-w-sm text-[13px] text-muted-foreground",children:"Authorize NoMoreIDE to read pull requests, issues, and CI status for your repositories."})]})]}),r.jsxs("div",{className:"flex w-full max-w-xs flex-col gap-2",children:[r.jsxs(J,{className:"w-full",onClick:()=>o("device-pending"),type:"button",children:[r.jsx(nw,{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 RZ({onSuccess:e,onCancel:t}){const[s,n]=_.useState(null),[o,l]=_.useState(null),[u,h]=_.useState(!0),[f,d]=_.useState(!1),p=_.useRef(null),g=_.useRef(5),x=_.useRef(!1);_.useEffect(()=>{let N=!0;return EO().then(C=>{if(!N)return;n(C),g.current=C.interval,h(!1);const A=C.verification_uri_complete||C.verification_uri;A&&bf(A),v(C.device_code,C.interval),setTimeout(()=>{x.current=!0},C.expires_in*1e3)}).catch(C=>{N&&(l(C instanceof Error?C.message:String(C)),h(!1))}),()=>{N=!1,p.current&&clearTimeout(p.current)}},[]);function v(N,C){p.current=setTimeout(()=>{w(N,C)},C*1e3)}async function w(N,C){if(x.current){l("Authorization expired. Please try again.");return}try{const A=await jO(N);if(A.done){e();return}const j=A.slowDown?C+5:C;g.current=j,v(N,j)}catch{v(N,g.current)}}function k(){s&&navigator.clipboard.writeText(s.user_code).then(()=>{d(!0),setTimeout(()=>d(!1),2e3)})}return u?r.jsx("div",{className:"flex h-full items-center justify-center",children:r.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[r.jsx(iw,{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(Qe,{variant:"destructive",children:o}),r.jsx(J,{onClick:t,variant:"outline",children:"Go back"})]}):r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-6 p-8",children:[r.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[r.jsx("div",{className:"flex size-12 items-center justify-center rounded-xl bg-emerald-100 dark:bg-emerald-500/15",children:r.jsx(ff,{className:"size-6 text-emerald-600 dark:text-emerald-400"})}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-base font-semibold",children:"Authorize on GitHub"}),r.jsxs("p",{className:"mt-1 max-w-sm text-[13px] text-muted-foreground",children:["A GitHub page just opened in a new tab. Enter the code below and click"," ",r.jsx("strong",{children:"Authorize"}),"."]})]})]}),r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx("div",{className:"flex cursor-pointer select-all items-center gap-3 rounded-xl border-2 border-border bg-muted px-6 py-4 font-mono text-2xl font-bold tracking-[0.3em] transition-colors hover:border-ring",onClick: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(iw,{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 MZ({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 AO("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(iC,{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(Qe,{variant:"destructive",children:u}):null,r.jsx(J,{disabled:!s.trim()||o,type:"submit",children:o?"Saving…":"Save token"}),t?r.jsx("button",{className:"text-[12px] text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",onClick:t,type:"button",children:"← Back"}):null]})]})}function mv({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(jt,{className:"size-3 animate-spin"}):null,t?"Loading…":"Load more"]})}):null}function DZ({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(OZ,{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(mv,{hasMore:n,loading:s,onLoadMore:h})]})}function OZ({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(sC,{className:"size-4 text-emerald-500"})}function W5({body:e,title:t="Description"}){const[s,n]=_.useState("rendered"),o=l=>ue("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(cv,{content:e}):r.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap px-3 py-3 font-mono text-[12px]",children:e})]})}function LZ({pr:e,diff:t,diffLoading:s,diffError:n,onMerged:o}){const[l,u]=_.useState("cockpit"),[h,f]=_.useState(null),[d,p]=_.useState(!1),[g,x]=_.useState(null),[v,w]=_.useState(!1),[k,N]=_.useState(null),[C,A]=_.useState(!1),[j,T]=_.useState(null),[M,O]=_.useState(!1),{sendToAgent:$}=At(),D=_.useMemo(()=>UI(t),[t]);_.useEffect(()=>{T(K=>K&&D.some(I=>I.path===K)?K:D[0]?.path??null)},[D]);const P=D.find(K=>K.path===j)??D[0]??null;function B(K){T(K),u("diff")}function G(K,I){e&&(O(!1),$({prompt:I?M$(e,I,K):R$(e,K),source:{type:"github-pr",label:`PR #${e.number}${I?` · ${lf(I)}`:""}`},label:`PR #${e.number}${I?` (${lf(I)})`:""}: ${K}`}))}if(_.useEffect(()=>{if(O(!1),!e){f(null);return}let K=!0;return p(!0),x(null),OO(e.number).then(I=>{K&&f(I)}).catch(I=>{K&&x(I instanceof Error?I.message:String(I))}).finally(()=>{K&&p(!1)}),()=>{K=!1}},[e]),!e)return r.jsx("div",{className:"flex h-full items-center justify-center text-[12px] text-muted-foreground",children:"Select a pull request"});const F=e.state==="open"&&!e.draft;async function z(){if(!(!e||v)){w(!0),N(null);try{await BO(e.number,{method:"squash"}),A(!1),o?.()}catch(K){N(K instanceof Error?K.message:String(K)),A(!1)}finally{w(!1)}}}const U=K=>`rounded px-2 py-0.5 text-[11px] font-medium transition-colors ${K?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`;return 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(Zi,{className:ue("shrink-0",M&&"opacity-100"),label:`Ask AI about PR #${e.number}`,onAsk:()=>O(K=>!K)}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[r.jsx("button",{className:U(l==="cockpit"),onClick:()=>u("cockpit"),type:"button",children:"Review"}),r.jsx("button",{className:U(l==="diff"),onClick:()=>u("diff"),type:"button",children:"Diff"})]}),F?r.jsxs(J,{className:"shrink-0",disabled:v,onClick:()=>A(!0),size:"sm",title:"Squash & merge this pull request",type:"button",variant:"success",children:[r.jsx(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(so,{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,M?r.jsx("div",{className:"shrink-0 border-b border-border px-3 py-1.5",children:r.jsx(Tr,{placeholder:"What should the agent do with this PR? (review, summarize, find regressions…)",onSubmit:K=>G(K),onCancel:()=>O(!1)})}):null,l==="cockpit"?r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:r.jsx(zZ,{cockpit:h,error:g,loading:d,onOpenFile:B,pr:e})}):s?r.jsx(Bf,{className:"flex-1",label:"Loading diff…"}):n?r.jsx("div",{className:"p-4 text-[12px] text-red-500",children:n}):D.length?r.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1",children:[r.jsx(BZ,{files:D,onAsk:(K,I)=>G(I,K),onSelect:T,selected:P?.path??null}),r.jsx("div",{className:"relative min-h-0 min-w-0 flex-1",children:P?r.jsx(fu,{diff:P.diff}):null})]}):r.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"No diff available."}),C?r.jsx(jf,{confirmLabel:v?r.jsxs(r.Fragment,{children:[r.jsx(fv,{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:()=>A(!1),onConfirm:()=>{z()},title:"Squash & merge",tone:"success"}):null]})}function zZ({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($Z,{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(Vn,{className:"size-3 shrink-0 text-muted-foreground"}),h.base.ref,r.jsx(ou,{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(E6,{className:"size-3 shrink-0"}),h.user.login]}),r.jsxs("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[r.jsx(D4,{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(Bf,{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:K5(h,g),tone:PZ(h,g)}),r.jsx(dh,{title:"Review state",value:Y5(d),tone:IZ(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(X0,{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(Gn,{className:"size-3.5 text-muted-foreground"}):r.jsx(Wn,{className:"size-3.5 text-muted-foreground"}),r.jsx(Q0,{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(yM,{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(MN,{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(MN,{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(W5,{body:h.body}):r.jsx("p",{className:"text-[12px] italic text-muted-foreground",children:"No description provided."})]})}function BZ({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:ue("flex items-center transition-colors",u.path===t?"bg-muted":"hover:bg-muted/60"),children:[r.jsxs("button",{className:ue("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(Zi,{className:ue("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(Tr,{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 MN({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(so,{className:"size-3"}),e]}),r.jsx("span",{className:"line-clamp-2 whitespace-pre-wrap",children:t})]})}function K5(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 PZ(e,t){const s=K5(e,t);return s==="ready"?"success":s==="blocked"||s==="checks failing"?"danger":s==="draft"||s==="checks pending"?"warning":"muted"}function Y5(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 IZ(e){const t=Y5(e);return t==="approved"?"success":t==="changes requested"?"danger":t==="commented"?"warning":"muted"}function $Z({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(ff,{className:"size-3"}):r.jsx(cl,{className:"size-3"}),t]})}function X5({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 HZ({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(G4,{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(X5,{label:d},d.name))}):null]})},f.number))}),r.jsx(mv,{hasMore:n,loading:s,onLoadMore:h})]})}const hh=6,UZ=6,FZ=8;function qZ(e,t,s,n){const o=Math.max(0,Math.min(UZ,e/2,t/2)),l=Math.max(0,Math.min(FZ,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 VZ({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?qZ(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 GZ({issue:e,comments:t,commentsLoading:s,commentError:n,submitting:o,onAddComment:l}){const[u,h]=_.useState(""),[f,d]=_.useState(!1),{sendToAgent:p}=At();_.useEffect(()=>{d(!1)},[e?.number]);function g(v){e&&(d(!1),p({prompt:D$(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(Zi,{className:ue("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(so,{className:"size-3.5"})})]}),f?r.jsx("div",{className:"shrink-0 border-b border-border px-3 py-1.5",children:r.jsx(Tr,{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(X5,{label:v},v.name))]}),e.body?r.jsx(W5,{body:e.body}):r.jsx("p",{className:"text-[12px] text-muted-foreground italic",children:"No description provided."}),s?r.jsx(Bf,{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(cv,{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(VZ,{action:r.jsx(J,{disabled:!u.trim()||o,size:"sm",type:"submit",children:o?r.jsxs(r.Fragment,{children:[r.jsx(fv,{size:"sm"})," Posting…"]}):"Comment"}),onChange:h,placeholder:"Add a comment…",value:u}),n?r.jsx(Qe,{variant:"destructive",children:n}):null]})})]})}const DN=30,WZ=4e3;function KZ(e){return e.status==="in_progress"||e.status==="queued"}function ON(e){return e.map(t=>`${t.id}:${t.status}:${t.conclusion}`).join("|")}function LN(e){return e.map(t=>`${t.id}:${t.status}:${t.conclusion}:`+t.steps.map(s=>`${s.number}:${s.status}:${s.conclusion}`).join(",")).join("|")}function YZ(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 XZ(e){const[t,s]=_.useState([]),[n,o]=_.useState(null),[l,u]=_.useState([]),[h,f]=_.useState(!0),[d,p]=_.useState(!1),[g,x]=_.useState(!1),[v,w]=_.useState(1),[k,N]=_.useState(!1),[C,A]=_.useState(null),[j,T]=_.useState(null);function M(){let P=!0;return f(!0),A(null),w(1),fh(e,1).then(B=>{P&&(s(B),x(B.length===DN))}).catch(B=>{P&&A(B instanceof Error?B.message:String(B))}).finally(()=>{P&&f(!1)}),()=>{P=!1}}function O(){if(d||!g)return;const P=v+1;p(!0),fh(e,P).then(B=>{s(G=>{const F=new Set(G.map(z=>z.id));return[...G,...B.filter(z=>!F.has(z.id))]}),x(B.length===DN),w(P)}).catch(B=>A(B instanceof Error?B.message:String(B))).finally(()=>p(!1))}const $=_.useCallback(()=>{fh(e,1).then(P=>s(B=>{const G=YZ(B,P);return ON(B)===ON(G)?B:G})).catch(()=>{}),n&&vw(n).then(P=>u(B=>LN(B)===LN(P)?B:P)).catch(()=>{})},[e,n]);_.useEffect(M,[e]),_.useEffect(()=>{o(P=>P&&t.some(B=>B.id===P)?P:t[0]?.id??null)},[t]),_.useEffect(()=>{if(!n){u([]);return}let P=!0;return N(!0),T(null),vw(n).then(B=>{P&&u(B)}).catch(B=>{P&&T(B instanceof Error?B.message:String(B))}).finally(()=>{P&&N(!1)}),()=>{P=!1}},[n]);const D=t.some(KZ);return _.useEffect(()=>{if(!D)return;const P=window.setInterval(()=>{document.visibilityState==="visible"&&$()},WZ);return()=>window.clearInterval(P)},[D,$]),{runs:t,selectedRunId:n,jobs:l,loading:h,loadingMore:d,hasMore:g,jobsLoading:k,error:C,jobsError:j,loadMore:O,refresh:M,syncLatest:$,setSelectedRunId:o}}function Z5(e){return e.conclusion==="failure"||e.conclusion==="timed_out"||e.conclusion==="cancelled"}function ZZ({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}=XZ(e);vl(v);const k=s.find(T=>T.id===n)??null,{sendToAgent:N}=At(),[C,A]=_.useState(null);function j(T,M){A(null),N({prompt:O$(T,M),source:{type:"github-run",label:`Run #${T.run_number}`},label:`Run #${T.run_number}: ${M??"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(qt,{className:"size-3"})}):null]}):null]}),r.jsxs(J,{disabled:l,onClick:()=>{x()},size:"sm",type:"button",variant:"outline",children:[r.jsx(Ar,{className:`mr-1 size-3.5 ${l?"animate-spin":""}`}),"Refresh"]})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:d?r.jsx("div",{className:"p-4 text-[12px] text-red-500",children:d}):l&&s.length===0?r.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"Loading workflow runs…"}):s.length===0?r.jsx("div",{className:"p-4 text-[12px] text-muted-foreground",children:"No workflow runs found."}):r.jsxs("div",{className:"grid h-full min-h-0 grid-cols-[minmax(280px,380px)_minmax(0,1fr)] divide-x divide-border",children:[r.jsxs("div",{className:"min-h-0 overflow-auto",children:[r.jsx("ul",{className:"divide-y divide-border",children:s.map(T=>r.jsxs("li",{className:"group flex flex-col",children:[r.jsxs("div",{className:`flex items-center transition-colors hover:bg-muted/60 ${T.id===n?"bg-muted/70":""}`,children:[r.jsxs("button",{className:"flex min-w-0 flex-1 items-center gap-3 px-3 py-2.5 text-left",onClick:()=>w(T.id),type:"button",children:[r.jsx(QZ,{run:T}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-[13px] font-medium",children:T.name}),r.jsxs("span",{className:"block text-[11px] text-muted-foreground",children:["#",T.run_number," · ",T.head_branch," · ",T.event," ·"," ",r.jsx("span",{title:new Date(T.created_at).toLocaleString(),children:B7(T.created_at)})]})]}),r.jsx(JZ,{run:T})]}),Z5(T)?r.jsx(Zi,{className:`mr-2 shrink-0 ${C===T.id?"opacity-100":""}`,label:`Fix failing run #${T.run_number} with AI`,onAsk:()=>A(M=>M===T.id?null:T.id)}):null]}),C===T.id?r.jsx("div",{className:"px-3 pb-2 pt-0.5",children:r.jsx(Tr,{onCancel:()=>A(null),onSubmit:M=>j(T,M),placeholder:"What should the agent do? (fix it, explain the failure, find the broken step…)"})}):null]},T.id))}),r.jsx(mv,{hasMore:h,loading:u,onLoadMore:g})]}),r.jsx(eQ,{error:p,jobs:o,loading:f,onFix:T=>j(T),run:k})]})})]})}function QZ({run:e}){return e.status==="in_progress"||e.status==="queued"?r.jsx(cl,{className:"size-4 shrink-0 animate-pulse text-amber-400"}):e.conclusion==="success"?r.jsx(ff,{className:"size-4 shrink-0 text-emerald-500"}):e.conclusion==="failure"||e.conclusion==="timed_out"?r.jsx(X0,{className:"size-4 shrink-0 text-red-500"}):r.jsx(cl,{className:"size-4 shrink-0 text-zinc-400"})}function JZ({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 eQ({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)]})]}),Z5(e)?r.jsxs(J,{className:"shrink-0 gap-1",onClick:()=>o(e),size:"sm",title:"Send this failing run to the agent to investigate and fix",type:"button",variant:"outline",children:[r.jsx(Ft,{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(so,{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(zN,{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:BN(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(so,{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(zN,{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:BN(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 zN({item:e}){return e.status==="in_progress"||e.status==="queued"?r.jsx(cl,{className:"size-3.5 shrink-0 animate-pulse text-amber-400"}):e.conclusion==="success"||e.conclusion==="skipped"?r.jsx(ff,{className:"size-3.5 shrink-0 text-emerald-500"}):e.conclusion==="failure"||e.conclusion==="timed_out"||e.conclusion==="cancelled"?r.jsx(X0,{className:"size-3.5 shrink-0 text-red-500"}):r.jsx(cl,{className:"size-3.5 shrink-0 text-zinc-400"})}function BN(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 tQ({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),RO().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=IN(g,s),w=IN(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(J,{disabled:o,onClick:()=>{f()},size:"sm",type:"button",variant:"outline",children:[r.jsx(Ar,{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(sQ,{branch:p,currentBranch:s?.currentBranch??null,defaultBranch:s?.defaultBranch??null,onCreatePR:e,onViewRuns:t},p.name))})})]})}function sQ({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(Vn,{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(PN,{label:"Default",tone:"success"}):null,u?r.jsx(PN,{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(d6,{className:"size-3"}),"protected"]}):null]}),r.jsx("div",{className:"mt-0.5 font-mono text-[11px] text-muted-foreground",children:e.commit.sha.slice(0,7)})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[r.jsxs(J,{onClick:()=>o(e.name),size:"sm",title:`View workflow runs for ${e.name}`,type:"button",variant:"outline",children:[r.jsx(K4,{className:"size-3.5"}),"View runs"]}),r.jsxs(J,{disabled:!h,onClick:()=>n(e.name),size:"sm",title:h?`Open PR from ${e.name}`:"Default branch does not need a PR",type:"button",variant:"outline",children:[r.jsx(sC,{className:"size-3.5"}),"Open PR"]})]})]})}function PN({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 IN(e,t){return e.name===t?.currentBranch?0:e.name===t?.defaultBranch?1:e.protected?2:3}function nQ(){const e=jZ();let t;return e.loading||e.status==="checking"?t=r.jsx(Bf,{fill:!0,label:"Loading…"}):e.status==="not_configured"?t=r.jsx(G5,{deviceFlowAvailable:e.deviceFlowAvailable,onSaved:e.refresh}):e.status==="auth_error"||e.status==="connection_error"?t=r.jsx(iQ,{token:e}):t=r.jsx(rQ,{token:e}),r.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-card/85",children:t})}function iQ({token:e}){const[t,s]=_.useState(null);if(t)return r.jsx(G5,{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(Df,{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(Q5,{label:n?"Needs re-login":"Connection problem",tone:n?"danger":"warning"})]}),e.error?r.jsx(Qe,{variant:"destructive",children:e.error}):null,r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(J,{onClick:e.refresh,type:"button",variant:n?"outline":"default",children:[r.jsx(Ar,{}),"Refresh"]}),r.jsx(J,{onClick:()=>s(e.deviceFlowAvailable?"device-pending":"pat"),type:"button",variant:n?"default":"outline",children:"Reconnect GitHub"}),r.jsx(J,{onClick:()=>s("pat"),type:"button",variant:"outline",children:"Use token instead"})]})]})})}function rQ({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=AZ(n),N=TZ(l);vl(()=>{t==="prs"?k.refresh():t==="issues"&&N.refresh()});const C=T=>`rounded px-2 py-0.5 text-[11px] font-medium transition-colors ${T?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,A=T=>`rounded px-2 py-0.5 text-[10px] font-medium transition-colors ${T?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`;async function j(){x(!0),w(null);try{await TO("github.com"),e.refresh()}catch(T){w(T instanceof Error?T.message:String(T))}finally{x(!1)}}return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-1 border-b border-border bg-card/95 px-3 py-1",children:[r.jsx("button",{className:C(t==="prs"),onClick:()=>s("prs"),type:"button",children:"Pull Requests"}),r.jsx("button",{className:C(t==="issues"),onClick:()=>s("issues"),type:"button",children:"Issues"}),r.jsx("button",{className:C(t==="branches"),onClick:()=>s("branches"),type:"button",children:"Branches"}),r.jsx("button",{className:C(t==="actions"),onClick:()=>s("actions"),type:"button",children:"Actions"}),r.jsxs("div",{className:"ml-auto flex min-w-0 items-center gap-2",children:[r.jsx(aQ,{token:e}),r.jsxs(J,{onClick:e.refresh,size:"sm",title:"Re-check the GitHub connection",type:"button",variant:"outline",children:[r.jsx(Ar,{}),"Reconnect"]}),r.jsx(J,{disabled:g,onClick:()=>{j()},size:"sm",type:"button",variant:"outline",children:g?"Disconnecting…":"Disconnect"})]}),t==="prs"?r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("div",{className:"flex items-center gap-0.5 rounded-md bg-muted/60 p-0.5",children:[r.jsx("button",{className:A(n==="open"),onClick:()=>o("open"),type:"button",children:"Open"}),r.jsx("button",{className:A(n==="closed"),onClick:()=>o("closed"),type:"button",children:"Closed"})]}),r.jsx(J,{onClick:()=>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:A(l==="open"),onClick:()=>u("open"),type:"button",children:"Open"}),r.jsx("button",{className:A(l==="closed"),onClick:()=>u("closed"),type:"button",children:"Closed"})]}):null]}),v?r.jsx(Qe,{variant:"destructive",className:"m-3",children:v}):null,h!==null?r.jsx(oQ,{initialHead:h,onCreated:T=>{f(null),s("prs"),k.setSelectedNumber(T.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(DZ,{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(LZ,{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(HZ,{error:N.error,hasMore:N.hasMore,issues:N.issues,loading:N.loading,loadingMore:N.loadingMore,onLoadMore:N.loadMore,onSelect:N.setSelectedNumber,selectedNumber:N.selectedNumber})}),r.jsx("div",{className:"flex min-h-0 min-w-0 flex-col overflow-hidden",children:r.jsx(GZ,{commentError:N.commentError,comments:N.comments,commentsLoading:N.commentsLoading,issue:N.selectedIssue,onAddComment:N.addComment,submitting:N.submitting})})]}):t==="branches"?r.jsx(tQ,{onCreatePR:T=>f(T),onViewRuns:T=>{p(T),s("actions")}}):r.jsx(ZZ,{branch:d??void 0,onClearBranch:()=>p(null)})})]})}function aQ({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(Df,{className:"size-4 shrink-0 text-foreground"}),r.jsx(Q5,{label:"Connected",tone:"success"}),r.jsx("span",{className:"max-w-48 truncate font-mono text-[10px] text-muted-foreground",children:t})]})}function Q5({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 oQ({initialHead:e,onCreated:t,onCancel:s}){const[n,o]=_.useState(""),[l,u]=_.useState(""),[h,f]=_.useState(""),[d,p]=_.useState("main"),[g,x]=_.useState(!1),[v,w]=_.useState(null),[k,N]=_.useState(!0),[C,A]=_.useState(!1),[j,T]=_.useState(null);_.useEffect(()=>{let D=!0;return N(!0),T(null),LO().then(P=>{D&&(w(P),o(P.title),u(P.body),f(e||P.head),p(P.base||P.suggestedBase||"main"),x(P.draft))}).catch(P=>{D&&T(P instanceof Error?P.message:String(P))}).finally(()=>{D&&N(!1)}),()=>{D=!1}},[e]);async function M(D){if(D.preventDefault(),!(!n.trim()||!h.trim()||!d.trim())){A(!0),T(null);try{const P=await zO({title:n.trim(),body:l.trim()||void 0,head:h.trim(),base:d.trim(),draft:g});t(P)}catch(P){T(P instanceof Error?P.message:String(P))}finally{A(!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",$=v?.warnings??[];return r.jsxs("form",{className:"flex min-h-0 flex-col gap-3 overflow-auto bg-muted/20 p-4",onSubmit:D=>{M(D)},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(lQ,{template:v,loading:k}),$.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:$[0]}):null,r.jsx("input",{className:O,disabled:k,onChange:D=>o(D.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:D=>f(D.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:D=>p(D.target.value),placeholder:"Base branch",required:!0,value:d})]})]}),r.jsx("textarea",{className:`${O} resize-none`,disabled:k,onChange:D=>u(D.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:D=>x(D.target.checked),type:"checkbox"}),"Create as draft"]}),j?r.jsx(Qe,{variant:"destructive",children:j}):null,r.jsxs("div",{className:"flex gap-2",children:[r.jsx(J,{disabled:k||C||!n.trim()||!h.trim()||!d.trim(),type:"submit",children:C?"Creating…":"Create PR"}),r.jsx(J,{onClick:s,type:"button",variant:"outline",children:"Cancel"})]})]})}function lQ({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 cQ({data:e,docked:t,scopeAll:s,onScopeChange:n,onRefresh:o,onClose:l,onManage:u}){const{error:h,success:f}=as(),d=e.git.selectedRepository;async function p(w){l();try{await EC(w),n(!1),await o(),f(`Switched to ${w}.`)}catch(k){h(k instanceof Error?k.message:String(k))}}function g(){l(),n(!0),f("Showing all projects.")}const x=w=>ue("grid h-8 grid-cols-[48px_minmax(0,1fr)] items-center overflow-hidden rounded-md text-left transition-[background-color,width] duration-150 hover:bg-muted",t?"w-full":"w-12 group-hover/sidebar:w-full",w&&"bg-muted/60"),v=ue("flex min-w-0 items-center gap-2 overflow-hidden whitespace-pre pr-2 text-xs transition duration-150",t?"translate-x-1 opacity-100":"opacity-0 group-hover/sidebar:translate-x-1 group-hover/sidebar:opacity-100");return r.jsxs("div",{className:"mt-1 grid gap-0.5",children:[r.jsxs("button",{className:x(s),onClick:g,title:"All projects",type:"button",children:[r.jsx("span",{className:"flex h-8 w-12 items-center justify-center",children:r.jsx(Th,{className:"size-4 text-muted-foreground"})}),r.jsxs("span",{className:v,children:[r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:"All projects"}),s?r.jsx(Zs,{className:"size-3.5 shrink-0"}):null]})]}),e.config.gitRepositories.map(w=>{const k=!s&&w.name===d?.name;return r.jsxs("button",{className:x(k),onClick:()=>{p(w.name)},title:w.path,type:"button",children:[r.jsx("span",{className:"flex h-8 w-12 items-center justify-center",children:r.jsx(df,{className:"size-4 text-muted-foreground"})}),r.jsxs("span",{className:v,children:[r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:w.name}),k?r.jsx(Zs,{className:"size-3.5 shrink-0"}):null]})]},w.name)}),r.jsxs("button",{className:ue("grid h-8 grid-cols-[48px_minmax(0,1fr)] items-center overflow-hidden rounded-md text-left text-muted-foreground transition-[background-color,color,width] duration-150 hover:bg-muted hover:text-foreground",t?"w-full":"w-12 group-hover/sidebar:w-full"),onClick:()=>{l(),u()},title:"Add or manage projects",type:"button",children:[r.jsx("span",{className:"flex h-8 w-12 items-center justify-center",children:r.jsx(eb,{className:"size-4"})}),r.jsx("span",{className:v,children:r.jsx("span",{className:"min-w-0 flex-1 truncate",children:"Add or manage projects…"})})]})]})}function uQ({data:e,docked:t,scopeAll:s,onScopeChange:n,onRefresh:o}){const[l,u]=_.useState(!1),[h,f]=_.useState(!1),d=e.git.selectedRepository,p=s?"All projects":d?.name??"Pick a project",g=e.config.gitRepositories.length,x=s?`${g} project${g===1?"":"s"}`:d?e.git.status?.branch??d.path:"set the context";return r.jsxs(r.Fragment,{children:[r.jsxs("button",{"aria-label":`Project scope: ${p}`,className:ue("relative grid h-11 grid-cols-[48px_minmax(0,1fr)] items-center overflow-hidden rounded-md text-left transition-[background-color,width] duration-150 hover:bg-muted",t?"w-full":"w-12 group-hover/sidebar:w-full"),"aria-expanded":l,onClick:()=>u(v=>!v),title:`Project scope: ${p}`,type:"button",children:[r.jsx("span",{className:"flex h-11 w-12 items-center justify-center",children:r.jsx("span",{className:"flex size-8 items-center justify-center rounded-lg border border-border bg-background text-[13px] font-semibold text-foreground",children:s?r.jsx(Th,{className:"size-4 text-muted-foreground"}):d?p.charAt(0).toUpperCase():r.jsx(df,{className:"size-4 text-muted-foreground"})})}),r.jsxs("span",{className:ue("min-w-0 overflow-hidden whitespace-pre pr-8 transition duration-150",t?"translate-x-1 opacity-100":"opacity-0 group-hover/sidebar:translate-x-1 group-hover/sidebar:opacity-100"),children:[r.jsx("span",{className:"block truncate text-[13px] font-semibold leading-tight",children:p}),r.jsx("span",{className:"block truncate text-[10px] leading-tight text-muted-foreground",children:x})]}),r.jsx(Gn,{className:ue("absolute right-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground transition-[opacity,transform] duration-150",t?"opacity-100":"opacity-0 group-hover/sidebar:opacity-100",l&&"rotate-180")})]}),l?r.jsx(cQ,{data:e,docked:t,onClose:()=>u(!1),onManage:()=>f(!0),onRefresh:o,onScopeChange:n,scopeAll:s}):null,h?r.jsx(dQ,{data:e,onClose:()=>f(!1),onRefresh:o,onScopeChange:n,scopeAll:s}):null]})}function dQ({data:e,onClose:t,onRefresh:s,onScopeChange:n,scopeAll:o}){const[l,u]=_.useState("path"),[h,f]=_.useState(e.git.cwd),[d,p]=_.useState(""),[g,x]=_.useState(!1),[v,w]=_.useState(null),[k,N]=_.useState(!1),[C,A]=_.useState(e.git.cwd),j=e.git.selectedRepository,{error:T,success:M}=as();async function O(F){try{await EC(F),n(!1),t(),await s(),M(`Switched to ${F}.`)}catch(z){T(z instanceof Error?z.message:String(z))}}function $(){n(!0),t(),M("Showing all projects.")}async function D(F){const z=F.trim();if(!z.startsWith("/")){const U="Please add an absolute path. Paths beginning with ~ are not expanded here.";return w(U),T(U),!1}try{const U=B5(z);return await yO(U,z),w(null),await s(),M(`Added Git project ${U}.`),!0}catch(U){const K=U instanceof Error?U.message:String(U);return w(K),T(K),!1}}async function P(F){try{await _O(F),await s(),M(`Removed Git project ${F}.`)}catch(z){T(z instanceof Error?z.message:String(z))}}async function B(F){F.preventDefault(),await D(h)&&t()}async function G(F){F.preventDefault();const z=d.trim();if(z){x(!0),w(null);try{const{name:U}=await wO(z);p(""),await s(),M(`Cloned and added ${U}.`),t()}catch(U){const K=U instanceof Error?U.message:String(U);w(K),T(K)}finally{x(!1)}}}return Rr.createPortal(r.jsxs("div",{className:"fixed inset-0 z-[1000] grid place-items-center bg-black/35 px-4",onMouseDown:F=>{F.target===F.currentTarget&&t()},children:[r.jsxs("div",{className:"w-full max-w-md overflow-hidden rounded-xl border border-border bg-card shadow-xl",children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-4 py-3",children:[r.jsx(Th,{className:"size-4 text-muted-foreground"}),r.jsx("div",{className:"text-sm font-semibold",children:"Projects"}),r.jsx(Ye,{className:"h-5 px-1.5 text-[10px]",variant:"outline",children:e.config.gitRepositories.length}),r.jsx(J,{"aria-label":"Close project switcher",className:"ml-auto size-7",onClick:t,size:"icon",variant:"ghost",children:r.jsx(qt,{className:"size-4"})})]}),r.jsxs("div",{className:"max-h-80 overflow-auto",children:[r.jsxs("button",{className:ue("grid w-full grid-cols-[1fr_auto] items-center gap-2 border-b border-border px-4 py-2.5 text-left transition-colors hover:bg-muted",o&&"bg-muted/70"),onClick:$,type:"button",children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r.jsx(Th,{className:"size-3.5 shrink-0 text-muted-foreground"}),r.jsxs("span",{className:"min-w-0",children:[r.jsx("span",{className:"block truncate text-sm font-medium leading-tight",children:"All projects"}),r.jsx("span",{className:"block truncate text-[10px] leading-tight text-muted-foreground",children:"Everything the daemon runs, across every repo"})]})]}),o?r.jsx(Zs,{className:"size-3.5"}):r.jsx("span",{className:"size-3.5"})]}),e.config.gitRepositories.length?r.jsx("div",{className:"divide-y divide-border",children:e.config.gitRepositories.map(F=>{const z=!o&&F.name===j?.name;return r.jsxs("div",{className:ue("group grid w-full grid-cols-[1fr_auto_auto] items-center gap-2 px-4 py-2 text-left transition-colors hover:bg-muted",z&&"bg-muted/70"),children:[r.jsxs("button",{className:"min-w-0 text-left",onClick:()=>{O(F.name)},type:"button",children:[r.jsx("span",{className:"block truncate text-sm font-medium leading-tight",children:F.name}),r.jsx("span",{className:"block truncate font-mono text-[10px] leading-tight text-muted-foreground",children:F.path})]}),z?r.jsx(Zs,{className:"size-3.5"}):r.jsx("span",{className:"size-3.5"}),r.jsx(J,{"aria-label":`Remove ${F.name}`,className:"size-6 opacity-0 transition-opacity group-hover:opacity-100",onClick:()=>{P(F.name)},size:"icon",title:`Remove ${F.name}`,type:"button",variant:"ghost",children:r.jsx(Ti,{className:"size-3.5 text-destructive"})})]},F.name)})}):r.jsx("div",{className:"px-4 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-3",children:[r.jsxs("div",{className:"mb-1.5 flex gap-1 text-[11px]",children:[r.jsxs("button",{className:ue("flex items-center gap-1 rounded px-2 py-0.5 transition-colors",l==="path"?"bg-muted font-medium text-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>{u("path"),w(null)},type:"button",children:[r.jsx(lo,{className:"size-3"}),"Local path"]}),r.jsxs("button",{className:ue("flex items-center gap-1 rounded px-2 py-0.5 transition-colors",l==="url"?"bg-muted font-medium text-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>{u("url"),w(null)},type:"button",children:[r.jsx(Xc,{className:"size-3"}),"Clone URL"]})]}),l==="path"?r.jsxs("form",{className:"flex gap-1.5",onSubmit:B,children:[r.jsx(dt,{"aria-label":"Paste absolute path",className:"h-7 flex-1 px-2 font-mono text-[11px]",onChange:F=>{f(F.target.value),w(null)},placeholder:"/absolute/path",value:h}),r.jsxs(J,{className:"h-7 px-2 text-[11px]",size:"sm",type:"submit",children:[r.jsx(ps,{className:"size-3"}),"Add"]}),r.jsx(J,{"aria-label":"Browse and add Git project",className:"h-7 px-2",onClick:()=>{w(null),A(e.git.cwd),N(!0)},size:"sm",type:"button",variant:"outline",children:r.jsx(eb,{className:"size-3"})})]}):r.jsxs("form",{className:"flex gap-1.5",onSubmit:G,children:[r.jsx(dt,{"aria-label":"Git remote URL",className:"h-7 flex-1 px-2 font-mono text-[11px]",onChange:F=>{p(F.target.value),w(null)},placeholder:"https://… or git@host:owner/repo.git",value:d}),r.jsxs(J,{className:"h-7 px-2 text-[11px]",disabled:g||!d.trim(),size:"sm",type:"submit",children:[r.jsx(Xc,{className:"size-3"}),g?"Cloning…":"Clone"]})]}),v?r.jsx("div",{className:"mt-1.5 truncate text-[10px] text-destructive",children:v}):null,l==="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]})]}),k?r.jsx(P5,{confirmLabel:"Add Git project",errorMessage:v,initialPath:e.git.cwd,selectedPath:C,title:"Add Git Project",onCancel:()=>N(!1),onSelect:A,onUse:async()=>{await D(C)&&(N(!1),t())}}):null]}),document.body)}function hQ({ahead:e=0,behind:t=0,branches:s,currentBranch:n,disabled:o,onRefresh:l,upstream:u}){const[h,f]=_.useState(!1),[d,p]=_.useState(""),[g,x]=_.useState(null),[v,w]=_.useState(null),[k,N]=_.useState(null),C=s.filter(P=>!P.remote),A=s.filter(P=>P.remote);async function j(P,B){x(P),N(null),w(null);try{await B(),await l()}catch(G){N(G instanceof Error?G.message:String(G))}finally{x(null)}}async function T(P){await j(`switch:${P}`,async()=>{await ji("/api/git/branches/switch",{name:P}),f(!1)})}async function M(){await j("fetch",async()=>{await ji("/api/git/fetch",{}),w("Fetched latest branch refs.")})}async function O(){await j("push",async()=>{const P=await vf();w(P.setUpstream?`Pushed ${P.branch} and set upstream.`:`Pushed ${P.branch}.`)})}const $=!!n&&(e>0||!u&&t===0);async function D(P){P.preventDefault();const B=d.trim();if(!B){N("Branch name is required.");return}await j("create",async()=>{await ji("/api/git/branches",{name:B}),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(Vn,{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:[$?r.jsxs(J,{"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(gf,{className:ue("size-3.5",g==="push"&&"animate-pulse")}),"Push",e>0?` ${e}`:""]}):null,r.jsx(J,{"aria-label":"Fetch branches",disabled:o||g!==null,onClick:()=>{M()},size:"icon",title:"Fetch branches",type:"button",variant:"ghost",children:r.jsx(Ar,{className:ue(g==="fetch"&&"animate-spin")})}),r.jsx(J,{"aria-label":"Close branch dialog",onClick:()=>f(!1),size:"icon",type:"button",variant:"ghost",children:r.jsx(qt,{})})]})]}),r.jsx("div",{className:"max-h-72 overflow-auto",children:s.length?r.jsxs(r.Fragment,{children:[r.jsx($N,{branches:C,busy:g!==null,disabled:o,label:"Local",onSwitch:T}),r.jsx($N,{branches:A,busy:g!==null,disabled:o,label:"Remote",onSwitch:T})]}):r.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"No branches found."})}),r.jsxs("div",{className:"border-t border-border p-3",children:[r.jsxs("form",{className:"grid gap-2 sm:grid-cols-[1fr_auto]",onSubmit:D,children:[r.jsx(dt,{"aria-label":"New branch name",disabled:o||g!==null,onChange:P=>{p(P.target.value),N(null),w(null)},placeholder:"feature/new-work",value:d}),r.jsxs(J,{disabled:o||g!==null,type:"submit",children:[r.jsx(BR,{}),"Create"]})]}),k||v?r.jsx(Qe,{className:"mt-3 px-3 py-2 text-xs",variant:k?"destructive":"muted",children:k??v}):null]})]}):null,r.jsxs(J,{className:"h-8 max-w-[260px] gap-2 rounded-md shadow-lg",disabled:o,onClick:()=>f(P=>!P),size:"sm",title:"Switch Git branch",type:"button",variant:"default",children:[r.jsx(Vn,{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(Gn,{className:ue("size-4 transition-transform",h&&"rotate-180")})]})]})}function $N({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:ue("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(Ye,{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 J5="nomoreide-theme-choice";function fQ(){if(typeof window>"u")return"dark";const e=window.localStorage.getItem(J5);return e==="light"||e==="dark"?e:"dark"}function mQ(e){const t=document.documentElement;t.classList.toggle("dark",e==="dark"),t.style.colorScheme=e}function pQ(){const[e,t]=_.useState(()=>fQ()),s=_.useRef(null);_.useEffect(()=>{mQ(e),window.localStorage.setItem(J5,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(_6,{}):r.jsx(NM,{})}),r.jsx("span",{className:Vh(),children:"Theme"})]})}function gQ(){return $s()?r.jsxs("div",{className:"flex items-center justify-between h-8 bg-background border-b border-border select-none",style:{WebkitAppRegion:"drag"},onMouseDown:()=>$6(),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:B6,className:"h-8 w-10 flex items-center justify-center hover:bg-muted transition-colors","aria-label":"Minimize",children:r.jsx(aC,{className:"h-3 w-3"})}),r.jsx("button",{type:"button",onClick:P6,className:"h-8 w-10 flex items-center justify-center hover:bg-muted transition-colors","aria-label":"Maximize",children:r.jsx(no,{className:"h-3 w-3"})}),r.jsx("button",{type:"button",onClick:I6,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(qt,{className:"h-3 w-3"})})]})]}):null}const eA={services:"/",git:"/git",github:"/github",workflows:"/workflows",errors:"/errors",database:"/database",terminal:"/terminal",agent:"/agent","agent-env":"/agent-env"},xQ={services:"Services",git:"Git Review",github:"GitHub",workflows:"Workflows",errors:"Error Inbox",database:"Database",terminal:"Terminal",agent:"Agent","agent-env":"Agent Env"},bQ=Object.entries(eA).filter(([,e])=>e!=="/").sort(([,e],[,t])=>t.length-e.length);function vQ(e){for(const[t,s]of bQ)if(e.startsWith(s))return t;return"services"}const _Q=[{label:"Run",items:[{page:"services",label:"Services",icon:r.jsx(ib,{})},{page:"errors",label:"Error Inbox",icon:r.jsx(Zc,{})},{page:"terminal",label:"Terminal",icon:r.jsx(rb,{})}]},{label:"Code",items:[{page:"git",label:"Git Review",icon:r.jsx(Vn,{})},{page:"github",label:"GitHub",icon:r.jsx(Df,{})},{page:"workflows",label:"Workflows",icon:r.jsx(Mh,{})}]},{label:"Data",items:[{page:"database",label:"Database",icon:r.jsx(di,{})}]},{label:"Agent",items:[{page:"agent",label:"Agent",icon:r.jsx(qN,{})},{page:"agent-env",label:"Agent Env",icon:r.jsx(nb,{})}]}];function yQ(e=!1){return ue("group/sidebar hidden h-full shrink-0 overflow-x-hidden overflow-y-auto border-r border-border bg-card/85 py-4 backdrop-blur transition-[width,padding] duration-200 md:flex md:flex-col",e?"w-64 px-4":"w-16 px-2 hover:w-64 hover:px-4")}function wQ(e,t=!1){return ue("relative grid h-10 grid-cols-[48px_minmax(0,1fr)] items-center justify-start gap-0 overflow-hidden rounded-md px-0 text-sm font-medium transition-[background-color,color,width] duration-150",t?"w-full":"w-12 group-hover/sidebar:w-full",e?"bg-primary text-primary-foreground hover:bg-primary/90":"hover:bg-muted")}function SQ(e=!1,t=!1){return ue("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 kQ(e=!1){return ue("flex h-10 w-12 items-center justify-center text-current transition-transform duration-150 [&_svg]:size-5",e?"translate-x-0":"-translate-x-px group-hover/sidebar:translate-x-0")}function NQ({docked:e,onToggleDock:t}){return r.jsxs("div",{className:ue("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:ue("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:ue("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(DM,{}):r.jsx(LM,{})})]})}function CQ({className:e}){return r.jsxs("div",{className:ue("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.74"]})]}),r.jsx("div",{className:"font-mono text-[11px] text-muted-foreground",children:"127.0.0.1 console"})]})}function EQ({syncLocation:e=!0}={}){const[t,s]=_.useState(()=>e?vQ(window.location.pathname):"services"),[n,o]=_.useState(null),[l,u]=_.useState(null),[h,f]=_.useState(null),[d,p]=_.useState(0),[g,x]=_.useState(null),[v,w]=_.useState(!0),{error:k,message:N,success:C}=as(),[A,j]=_.useState(()=>window.localStorage.getItem("nomoreide:sidebar-docked")==="true"),[T,M]=_.useState(()=>window.localStorage.getItem("nomoreide:project-scope")!=="project"),O=wH(),$=_.useCallback(async(U={})=>{U.silent||w(!0),x(null);try{o(await tL()),U.notify&&C("Dashboard refreshed.")}catch(K){const I=K instanceof Error?K.message:String(K);x(I),k(I)}finally{w(!1)}},[k,C]),D=_.useCallback(()=>{$({notify:!0}),O.runActive()},[$,O]);_.useEffect(()=>{$()},[$]),_.useEffect(()=>{function U(){document.visibilityState==="visible"&&($({silent:!0}),O.runActive())}const K=window.setInterval(U,5e3);return window.addEventListener("focus",U),document.addEventListener("visibilitychange",U),()=>{window.clearInterval(K),window.removeEventListener("focus",U),document.removeEventListener("visibilitychange",U)}},[t,$,O.runActive]),_.useEffect(()=>{if(!e)return;const U=eA[t];window.location.pathname!==U&&window.history.pushState(null,"",U)},[t,e]),_.useEffect(()=>{window.localStorage.setItem("nomoreide:sidebar-docked",String(A))},[A]),_.useEffect(()=>{window.localStorage.setItem("nomoreide:project-scope",T?"all":"project")},[T]);const P=!T&&n?.git.selectedRepository||null,B=_.useMemo(()=>n&&P?kG(n,P):n,[n,P]),G=_.useMemo(()=>P&&B?new Set(B.config.services.map(U=>U.name)):null,[P,B]),F=_.useMemo(()=>B?Object.values(B.runtime.services).filter(U=>U.state==="running").length:0,[B]),z=n?.git.selectedRepository?.name??n?.git.cwd??"no-git-repository";return r.jsx(e$,{children:r.jsx(SH,{value:O,children:r.jsx(TU,{onRefresh:()=>{$({silent:!0})},children:r.jsx(RU,{children:r.jsxs("div",{className:"flex flex-col h-screen overflow-hidden",children:[r.jsx(gQ,{}),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:yQ(A),children:[r.jsxs("div",{className:ue("grid h-12 grid-cols-[48px_minmax(0,1fr)] items-center overflow-hidden transition-[width] duration-150",A?"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(CQ,{className:ue("min-w-0 translate-x-1 overflow-hidden transition-opacity duration-200",A?"opacity-100":"opacity-0 group-hover/sidebar:opacity-100")})]}),n?r.jsx("div",{className:"mt-3 border-b border-border/60 pb-2",children:r.jsx(uQ,{data:n,docked:A,onRefresh:()=>$({silent:!0}),onScopeChange:M,scopeAll:T})}):null,r.jsx("nav",{className:"mt-2 flex-1 content-start overflow-y-auto overflow-x-hidden",children:_Q.map((U,K)=>r.jsxs("div",{className:ue(K>0&&"mt-2 border-t border-border/60 pt-2"),children:[r.jsx(jQ,{docked:A,label:U.label}),r.jsx("div",{className:"grid gap-0.5",children:U.items.map(I=>r.jsx(AQ,{active:t===I.page,badge:I.page==="services"?F:void 0,docked:A,icon:I.icon,label:I.label,onClick:()=>s(I.page)},I.page))})]},U.label))}),r.jsx(NQ,{docked:A,onToggleDock:()=>j(U=>!U)})]}),r.jsxs("main",{className:"flex h-full min-w-0 flex-1 flex-col px-0 py-0",children:[r.jsxs("header",{className:ue("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(BM,{className:"size-4 text-muted-foreground md:hidden"}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-lg font-semibold tracking-tight",children:xQ[t]}),r.jsx("p",{className:"font-mono text-xs text-muted-foreground",children:t==="git"||t==="github"?n?.git.selectedRepository?.name??n?.git.cwd??"Local workspace":P?.name??"All projects"})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[g?r.jsx(Ye,{variant:"danger",children:g}):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:D,title:"Refresh this page",type:"button",children:[r.jsx("span",{className:qh(),children:r.jsx(Ar,{className:ue(v&&"animate-spin")})}),r.jsx("span",{className:Vh(),children:"Refresh"})]}),r.jsx(pQ,{}),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(C4,{})}),r.jsx("span",{className:Vh(),children:"Docs"})]}),n?r.jsx(dU,{data:n}):null]})]})]}),n?r.jsx(bK,{data:n,onOpenService:U=>{G&&!G.has(U)&&(M(!0),N({text:"Service is outside the current project — showing all projects."})),u(U),s("services"),$({silent:!0})}}):null,v&&!n?r.jsx(Qe,{variant:"muted",children:"Loading NoMoreIDE state..."}):null,r.jsxs("div",{className:"min-h-0 flex-1 overflow-hidden",children:[B&&t==="services"?r.jsx(pK,{data:B,onRefresh:$,focusService:l,onServiceFocused:()=>u(null),scopeName:P?.name??null}):null,n&&t==="git"?r.jsx(eZ,{data:n,onRefresh:()=>{$({silent:!0})}}):null,t==="github"?r.jsx(nQ,{},z):null,t==="workflows"?r.jsx(lZ,{}):null,t==="agent"?r.jsx(yH,{focusChanges:d}):null,t==="agent-env"?r.jsx(IH,{}):null,t==="errors"?r.jsx(sW,{inScope:G?U=>G.has(U):void 0,onReviewChanges:()=>{p(U=>U+1),s("agent")}}):null,t==="database"?r.jsx(XG,{projects:n?.config.gitRepositories??[],scopePath:P?.path??null,staged:h,onStageConsumed:()=>f(null)}):null,t==="terminal"?r.jsx(kK,{}):null]})]})]}),n&&t==="git"?r.jsx(hQ,{ahead:n.git.status?.ahead??0,behind:n.git.status?.behind??0,branches:n.git.branches,currentBranch:n.git.status?.branch||void 0,disabled:!n.git.status,onRefresh:$,upstream:n.git.status?.upstream}):null,r.jsx(wG,{currentPage:t,git:n?.git,onNavigate:U=>s(U),onGitRefresh:()=>{$({silent:!0})}})]})]})})})})})}function jQ({docked:e,label:t}){return r.jsx("div",{className:"flex h-5 items-center overflow-hidden px-3",children:r.jsx("span",{className:ue("whitespace-pre text-[10px] font-semibold uppercase tracking-widest text-muted-foreground transition-opacity duration-150",e?"opacity-100":"opacity-0 group-hover/sidebar:opacity-100"),children:t})})}function AQ({active:e,badge:t,docked:s,icon:n,label:o,onClick:l}){const u=t!==void 0&&t>0;return r.jsxs(J,{"aria-label":o,title:o,className:wQ(e,s),variant:"ghost",onClick:l,type:"button",children:[r.jsx("span",{className:kQ(s),children:n}),r.jsx("span",{className:SQ(s,u),children:o}),t!==void 0&&t>0?r.jsx(Ye,{appearance:t>0?"solid":"outline",className:ue("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]})}UN.createRoot(document.getElementById("root")).render(r.jsx(_.StrictMode,{children:r.jsx(EQ,{})}));export{r as j,_ as r};
|